diff --git a/app/vibenet/library/api-types.ts b/app/vibenet/library/api-types.ts index 31de55b..9c258f3 100644 --- a/app/vibenet/library/api-types.ts +++ b/app/vibenet/library/api-types.ts @@ -52,6 +52,10 @@ export type ActivityRow = { tx_index: number; log_index: number; tx_hash: string; + /** + * Vibescan address-activity role (vibenet APIs only — no explorer HTML there): + * 0 sender, 1 recipient, 2 creator, 3 token-from, 4 token-to, 5 payer. + */ role: number; token: string | null; }; diff --git a/app/vibenet/library/explorer.test.ts b/app/vibenet/library/explorer.test.ts index c2dfe18..313f618 100644 --- a/app/vibenet/library/explorer.test.ts +++ b/app/vibenet/library/explorer.test.ts @@ -21,6 +21,7 @@ import { timeFromHex, txTypeLabel, weiToEth, + roleLabel, } from './explorer'; // Function fragments used to build faithful calldata for the decoders under @@ -210,6 +211,15 @@ describe('EIP-8130 scope bitmask', () => { }); }); +describe('address-activity role labels', () => { + it('maps vibescan indexer roles including EIP-8130 payer', () => { + expect(roleLabel(0)).toBe('sender'); + expect(roleLabel(4)).toBe('token-to'); + expect(roleLabel(5)).toBe('payer'); + expect(roleLabel(99)).toBe('99'); + }); +}); + describe('explorer number + type formatting', () => { it('formats token amounts, trimming fractional zeros', () => { expect(fmtTokenAmount(0n, 18)).toBe('0'); diff --git a/app/vibenet/library/explorer.ts b/app/vibenet/library/explorer.ts index 2e12f85..b4a73e6 100644 --- a/app/vibenet/library/explorer.ts +++ b/app/vibenet/library/explorer.ts @@ -201,12 +201,16 @@ export function expiryLabel(expiry: number): string { return `expires ${new Date(expiry * 1000).toLocaleString()}`; } +// Address-activity roles from vibenet's vibescan indexer +// (`/api/vibenet/explorer/address/*`). Vibenet no longer ships explorer HTML — +// this mapping is the UI for those API role integers. const ROLE_LABELS: Record = { 0: 'sender', 1: 'recipient', 2: 'creator', 3: 'token-from', 4: 'token-to', + 5: 'payer', }; export function roleLabel(role: number): string {