Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/vibenet/library/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
10 changes: 10 additions & 0 deletions app/vibenet/library/explorer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
timeFromHex,
txTypeLabel,
weiToEth,
roleLabel,
} from './explorer';

// Function fragments used to build faithful calldata for the decoders under
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 4 additions & 0 deletions app/vibenet/library/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<number, string> = {
0: 'sender',
1: 'recipient',
2: 'creator',
3: 'token-from',
4: 'token-to',
5: 'payer',
};

export function roleLabel(role: number): string {
Expand Down
Loading