@indexing/jiti 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +15 -16
- package/dist/main.js.map +1 -1
- package/dist/module.js +15 -16
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -331,7 +331,7 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
331
331
|
case "APTOS":
|
|
332
332
|
case "APTOS_TESTNET":
|
|
333
333
|
for (const tx of block.transactions){
|
|
334
|
-
if (!tx?.events || !Array.isArray(tx.events))
|
|
334
|
+
if (!tx?.events || !Array.isArray(tx.events)) continue;
|
|
335
335
|
const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp) / 1000).toISOString() : null;
|
|
336
336
|
const txfersByKey = {};
|
|
337
337
|
for (const evt of tx.events)if ([
|
|
@@ -352,9 +352,9 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
352
352
|
transfers.push({
|
|
353
353
|
amount: BigInt(partial.amount),
|
|
354
354
|
blockNumber: parseInt(block.block_height),
|
|
355
|
-
from: partial.from,
|
|
355
|
+
from: partial.from?.length < 66 ? `0x0${partial.from?.slice(2)}` : partial.from,
|
|
356
356
|
timestamp: timestamp,
|
|
357
|
-
to: partial.to,
|
|
357
|
+
to: partial.to?.length < 66 ? `0x0${partial.to?.slice(2)}` : partial.to,
|
|
358
358
|
token: partial.tokenAddress,
|
|
359
359
|
tokenType: "NATIVE",
|
|
360
360
|
transactionGasFee: BigInt(tx.gas_used),
|
|
@@ -373,19 +373,18 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
373
373
|
const vout = tx.vout;
|
|
374
374
|
const fromVout = Math.min(vin.vout || 1000, vout.length - 1);
|
|
375
375
|
const fromAddress = vin.prevout?.scriptPubKey?.address || vout[fromVout]?.scriptPubKey?.address || vout[fromVout]?.scriptPubKey?.addresses?.[0];
|
|
376
|
-
if (!fromAddress)
|
|
376
|
+
if (!fromAddress) continue;
|
|
377
377
|
for (const v of vout)transfers.push({
|
|
378
378
|
amount: BigInt(Math.round(v.value * Math.pow(10, 8))),
|
|
379
379
|
blockNumber: block.height,
|
|
380
380
|
from: fromAddress,
|
|
381
381
|
timestamp: timestamp,
|
|
382
382
|
to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],
|
|
383
|
-
transactionGasFee: BigInt(tx.fee || 0) *
|
|
383
|
+
transactionGasFee: BigInt(Math.round((tx.fee || 0) * Math.pow(10, 8))),
|
|
384
384
|
transactionHash: tx.txid,
|
|
385
385
|
token: null,
|
|
386
386
|
tokenType: "NATIVE"
|
|
387
387
|
});
|
|
388
|
-
break;
|
|
389
388
|
}
|
|
390
389
|
break;
|
|
391
390
|
case "CARDANO":
|
|
@@ -397,7 +396,7 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
397
396
|
const transactionHash = typedTx.transaction_identifier?.hash || "";
|
|
398
397
|
const inputs = typedTx.operations.filter((op)=>op.type === "input");
|
|
399
398
|
const outputs = typedTx.operations.filter((op)=>op.type === "output");
|
|
400
|
-
if (!inputs.length && !outputs.length)
|
|
399
|
+
if (!inputs.length && !outputs.length) continue;
|
|
401
400
|
const fromAddress = inputs[0]?.account?.address;
|
|
402
401
|
if (!fromAddress) continue;
|
|
403
402
|
const sumInputs = inputs.reduce((acc, op)=>{
|
|
@@ -798,21 +797,21 @@ const $6144a02851f23907$var$tokenTransfersTemplate = {
|
|
|
798
797
|
{
|
|
799
798
|
params: {
|
|
800
799
|
network: "APTOS",
|
|
801
|
-
walletAddress: "
|
|
800
|
+
walletAddress: "0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e",
|
|
802
801
|
contractAddress: "0x1"
|
|
803
802
|
},
|
|
804
|
-
payload: "https://jiti.indexing.co/networks/aptos/
|
|
803
|
+
payload: "https://jiti.indexing.co/networks/aptos/297956660",
|
|
805
804
|
output: [
|
|
806
805
|
{
|
|
807
|
-
amount:
|
|
808
|
-
blockNumber:
|
|
809
|
-
from: "
|
|
810
|
-
timestamp: "
|
|
811
|
-
to: "
|
|
806
|
+
amount: 1502138836n,
|
|
807
|
+
blockNumber: 297956660,
|
|
808
|
+
from: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
809
|
+
timestamp: "2025-03-02T21:07:06.002Z",
|
|
810
|
+
to: "0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e",
|
|
812
811
|
token: null,
|
|
813
812
|
tokenType: "NATIVE",
|
|
814
|
-
transactionGasFee:
|
|
815
|
-
transactionHash: "
|
|
813
|
+
transactionGasFee: 13n,
|
|
814
|
+
transactionHash: "0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13"
|
|
816
815
|
}
|
|
817
816
|
]
|
|
818
817
|
},
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEEA,MAAM,oCAAwB;IAC5B,KAAK;IACL,MAAM;IACN,aAAa;IACb,MAAM;QAAC;QAAO;KAAM;IACpB,UAAU;IACV,QAAQ,EAAE;IACV,WAAW,CAAC,UAAY;IACxB,OAAO;QACL;YACE,QAAQ,CAAC;YACT,SAAS;gBAAE,GAAG;gBAAK,GAAG;gBAAG,GAAG;oBAAE,GAAG;gBAAK;YAAE;YACxC,QAAQ;gBAAE,GAAG;gBAAK,GAAG;gBAAG,GAAG;oBAAE,GAAG;gBAAK;YAAE;QACzC;KACD;AACH;IAEA,2CAAe;;;;;;;;AGjBR,SAAS,0CAAqB,OAAe;IAClD,IAAI,CAAC,WAAW,CAAC,uBAAuB,IAAI,CAAC,UAC3C,OAAO;IAGT,MAAM,eAAe,QAAQ,KAAK,CAAC,GAAG,WAAW;IACjD,MAAM,aAAa,CAAA,GA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iB;YACnB;YACA,SAAS;YACT,QAAQ;gBACN;oBACE,aAAa;oBACb,MAAM;oBACN,IAAI;oBACJ,QAAQ,OAAO;oBACf,OAAO;oBACP,WAAW;oBACX,WAAW;oBACX,iBAAiB;oBACjB,mBAAmB,CAAC,QAAQ;gBAC9B;aACD;QACH;QACA,MAAM;QACN;YACE,QAAQ;gBACN,SAAS;gBACT,eAAe;gBACf,iBAAiB;YACnB;YACA,SAAS;YACT,QAAQ;gBACN;oBACE,aAAa;oBACb,MAAM;oBACN,IAAI;oBACJ,QAAQ,SAAS;oBACjB,OAAO;oBACP,WAAW;oBACX,WAAW;oBACX,iBAAiB;oBACjB,mBAAmB,QAAQ;gBAC7B;aACD;QACH;QACA,SAAS;QACT;YACE,QAAQ;gBACN,SAAS;gBACT,eAAe;gBACf,iBAAiB;YACnB;YACA,SAAS;YACT,QAAQ;gBACN;oBACE,aAAa;oBACb,MAAM;oBACN,IAAI;oBACJ,QAAQ,OAAO;oBACf,OAAO;oBACP,WAAW;oBACX,WAAW;oBACX,iBAAiB;oBACjB,mBAAmB,KAAK;gBAC1B;aACD;QACH;KACD;AACH;IAEA,2CAAe;;;AFl9BR,MAAM,4CAAY;IAAC,CAAA,GAAA,wCAAU;IAAG,CAAA,GAAA,wCAAqB;CAAE;;;;;;;ADC9D,MAAM,4CAAY,CAAA,GAAA,yCAAW,EAAE,MAAM,CAAC,CAAC,GAAG,IAAO,CAAA;QAAE,GAAG,CAAC;QAAE,CAAC,EAAE,GAAG,CAAC,EAAE,OAAO,MAAM,CAAC,CAAC,GAAG;IAAG,CAAA,GAAI,CAAC;AAIrF,SAAS;IACd,OAAO,CAAA,GAAA,yCAAW,EAAE,KAAK;AAC3B;AAEO,SAAS,0CAAiB,GAAW;IAC1C,OAAO,CAAA,GAAA,yCAAW,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,WAAa,SAAS,GAAG,KAAK;AAClE","sources":["src/index.ts","src/templates/index.ts","src/templates/raw.ts","src/templates/token-transfers.ts","src/utils/index.ts","src/utils/evm-address-to-checksum.ts","src/utils/evm-chain-to-id.ts","src/utils/evm-decode-log.ts","src/utils/evm-method-signature-to-hex.ts","src/utils/evm-normalize-raw-block.ts","src/types.ts"],"sourcesContent":["import { templates as templateList } from './templates';\nimport * as utils from './utils';\nimport * as types from './types';\n\nconst templates = templateList.reduce((a, b) => ({ ...a, [b.key]: Object.assign({}, b) }), {});\n\nexport { utils, templates, types };\n\nexport function getAllTemplates() {\n return templateList.slice();\n}\n\nexport function getTemplateByKey(key: string) {\n return templateList.slice().find((template) => template.key === key);\n}\n","import rawTemplate from './raw';\nimport tokenTransfersTemplate from './token-transfers';\n\nexport const templates = [rawTemplate, tokenTransfersTemplate];\n","import { Template } from '../types';\n\nconst rawTemplate: Template = {\n key: 'raw',\n name: 'Raw Block Data',\n description: 'Get all blocks with all available fields',\n tags: ['EVM', 'RAW'],\n disabled: true,\n params: [],\n transform: (payload) => payload,\n tests: [\n {\n params: {},\n payload: { a: 'b', c: 1, d: { e: true } },\n output: { a: 'b', c: 1, d: { e: true } },\n },\n ],\n};\n\nexport default rawTemplate;\n","import { evmDecodeLogWithMetadata } from '../utils';\nimport { Template } from '../types';\nimport { decodeTxRaw, Registry } from '@cosmjs/proto-signing';\nimport { defaultRegistryTypes as defaultStargateTypes, SigningStargateClient } from '@cosmjs/stargate';\n\ntype NetworkTransfer = {\n amount: number | bigint;\n blockNumber: number;\n from: string;\n index?: string;\n timestamp: string;\n to: string;\n token?: string;\n tokenId?: string;\n tokenType: 'NATIVE' | 'TOKEN' | 'NFT';\n transactionGasFee: bigint;\n transactionHash: string;\n};\n\nconst NULL_ADDRESS = '0x0000000000000000000000000000000000000000';\n\nconst tokenTransfersTemplate: Template = {\n key: 'token_transfers',\n name: 'Token Transfers',\n description: 'Get all token transfers for a set of token types.',\n tags: ['EVM', 'ERC20', 'ERC721', 'NFT', 'TOKEN'],\n disabled: false,\n params: [\n { key: 'network', name: 'Network', type: 'NETWORK', optional: false },\n { key: 'contractAddress', name: 'Contract Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n {\n key: 'tokenTypes',\n name: 'Token Types',\n type: 'STRING',\n multiple: true,\n optional: true,\n values: ['NATIVE', 'TOKEN', 'NFT'],\n },\n ],\n\n transform: (block, _ctx) => {\n const TOKEN_TYPES = (_ctx.params.tokenTypes as NetworkTransfer['tokenType'][]) || [];\n let transfers: NetworkTransfer[] = [];\n\n switch (block._network) {\n case 'APTOS':\n case 'APTOS_TESTNET': {\n for (const tx of block.transactions as Record<string, unknown>[]) {\n if (!tx?.events || !Array.isArray(tx.events)) {\n break;\n }\n\n const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp as string) / 1000).toISOString() : null;\n const txfersByKey: Record<string, Record<string, string>> = {};\n\n for (const evt of tx.events as Record<string, unknown>[]) {\n if (['0x1::coin::WithdrawEvent', '0x1::coin::DepositEvent'].includes(evt.type as string)) {\n const amount = (evt.data as Record<string, string>)?.amount;\n const key = `0x1-${amount}`;\n txfersByKey[key] ||= { amount, tokenAddress: null };\n if ((evt.type as string).endsWith('WithdrawEvent')) {\n txfersByKey[key].from = (evt.guid as Record<string, string>)?.account_address;\n } else {\n txfersByKey[key].to = (evt.guid as Record<string, string>)?.account_address;\n }\n }\n }\n\n for (const partial of Object.values(txfersByKey)) {\n if (!partial.from || !partial.to) continue;\n transfers.push({\n amount: BigInt(partial.amount),\n blockNumber: parseInt(block.block_height as string),\n from: partial.from,\n timestamp,\n to: partial.to,\n token: partial.tokenAddress,\n tokenType: 'NATIVE',\n transactionGasFee: BigInt(tx.gas_used as string),\n transactionHash: tx.hash as string,\n });\n }\n }\n break;\n }\n\n case 'BITCOIN':\n case 'BITCOIN_TESTNET':\n case 'LITCOIN': // @TODO\n case 'DOGECOIN': {\n for (const tx of block.tx as Record<string, unknown>[]) {\n const timestamp = tx.time ? new Date((tx.time as number) * 1000).toISOString() : null;\n const vin = tx.vin[0] as { prevout?: { scriptPubKey: { address: string } }; vout?: number };\n const vout = tx.vout as { value: number; scriptPubKey?: { address: string; addresses?: string[] } }[];\n\n const fromVout = Math.min(vin.vout || 1000, vout.length - 1);\n const fromAddress =\n vin.prevout?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.addresses?.[0];\n if (!fromAddress) {\n break;\n }\n\n for (const v of vout) {\n transfers.push({\n amount: BigInt(Math.round(v.value * Math.pow(10, 8))),\n blockNumber: block.height as number,\n from: fromAddress,\n timestamp,\n to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],\n transactionGasFee: BigInt((tx.fee as number) || 0) * BigInt(Math.pow(10, 8)),\n transactionHash: tx.txid as string,\n token: null,\n tokenType: 'NATIVE',\n });\n }\n\n break;\n }\n break;\n }\n\n case 'CARDANO': {\n const blockTimestamp = new Date((block.timestamp as number) * 1000).toISOString();\n\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n transaction_identifier?: { hash?: string };\n operations?: {\n type: string;\n account?: { address?: string };\n amount?: {\n value?: string;\n currency?: {\n symbol?: string;\n decimals?: number;\n };\n };\n }[];\n };\n\n if (!Array.isArray(typedTx.operations)) {\n continue;\n }\n\n const transactionHash = typedTx.transaction_identifier?.hash || '';\n\n const inputs = typedTx.operations.filter((op) => op.type === 'input');\n const outputs = typedTx.operations.filter((op) => op.type === 'output');\n\n if (!inputs.length && !outputs.length) {\n break;\n }\n\n const fromAddress = inputs[0]?.account?.address;\n if (!fromAddress) {\n continue;\n }\n\n const sumInputs = inputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n const sumOutputs = outputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n\n const transactionFee = sumInputs + BigInt(sumOutputs);\n\n for (const out of outputs) {\n const rawValue = out.amount?.value || '0';\n const absoluteValue = BigInt(rawValue);\n transfers.push({\n amount: absoluteValue < 0 ? -absoluteValue : absoluteValue,\n blockNumber: (block.block_identifier as { index: number }).index,\n from: fromAddress,\n timestamp: blockTimestamp,\n to: out.account?.address || '',\n token: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? null : out.amount?.currency?.symbol,\n tokenType: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: transactionFee < 0 ? -transactionFee : transactionFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'RIPPLE': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const rawTx of block.transactions) {\n const typedTx = rawTx as {\n Account?: string;\n Amount?: string | { currency: string; issuer: string; value: string };\n Destination?: string;\n Fee?: string;\n hash?: string;\n TransactionType?: string;\n date?: number;\n metaData?: {\n delivered_amount?: string | { currency: string; issuer: string; value: string };\n };\n };\n if (typedTx.TransactionType !== 'Payment') {\n continue;\n }\n const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? '0';\n let tokenSymbol = 'XRP';\n let tokenType: 'NATIVE' | 'TOKEN' | 'NFT' = 'NATIVE';\n\n let parsedAmount: bigint;\n\n if (typeof deliveredOrAmount === 'object') {\n tokenSymbol = deliveredOrAmount.currency?.toUpperCase() ?? 'UNKNOWN';\n tokenType = 'TOKEN';\n const floatVal = parseFloat(deliveredOrAmount.value);\n const smallestUnit = Math.round(floatVal * 1_000_000);\n parsedAmount = BigInt(smallestUnit);\n } else {\n parsedAmount = BigInt(String(deliveredOrAmount));\n }\n transfers.push({\n amount: parsedAmount,\n blockNumber: parseInt(block.ledger_index as string, 10),\n from: typedTx.Account ?? 'UNKNOWN',\n timestamp: block.close_time_iso ? (block.close_time_iso as string) : null,\n to: typedTx.Destination ?? 'UNKNOWN',\n token: tokenSymbol,\n tokenType: tokenType,\n transactionGasFee: BigInt(typedTx.Fee ?? '0'),\n transactionHash: typedTx.hash ?? '',\n });\n }\n\n break;\n }\n\n case 'SOLANA': {\n for (const tx of block.transactions as unknown[]) {\n const solanaTx = tx as {\n meta: {\n fee: number;\n postTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n preTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n postBalances: number[];\n preBalances: number[];\n };\n transaction: {\n message: { accountKeys: (string | { pubkey: string })[]; instructions: unknown[] };\n signatures: string[];\n };\n };\n const txHash = solanaTx.transaction.signatures[0];\n const timestamp = block.blockTime ? new Date((block.blockTime as number) * 1000).toISOString() : null;\n\n let txFee = BigInt(solanaTx.meta.fee);\n if (txFee < BigInt(10)) {\n txFee = txFee * BigInt(Math.pow(10, 9));\n }\n\n const transfersByKey: Record<string, NetworkTransfer> = {};\n for (const post of solanaTx.meta.postTokenBalances) {\n let matched = false;\n for (const pre of solanaTx.meta.preTokenBalances) {\n if (post.mint === pre.mint && post.owner === pre.owner) {\n let diff = BigInt(post.uiTokenAmount.amount) - BigInt(pre.uiTokenAmount.amount);\n if (diff === BigInt(0)) {\n continue;\n }\n if (diff < 0) {\n diff = -diff;\n }\n\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: pre.owner,\n timestamp,\n to: post.owner,\n transactionGasFee: txFee,\n transactionHash: txHash,\n token: post.mint,\n tokenType: 'TOKEN',\n };\n if (transfersByKey[key]) {\n if (diff > 0) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n matched = true;\n }\n }\n\n if (!matched) {\n let diff = BigInt(post.uiTokenAmount.amount);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: null,\n timestamp,\n to: post.owner,\n token: post.mint,\n tokenType: 'TOKEN',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n delete txfer.from;\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n for (let i = 1; i < solanaTx.meta.postBalances.length; i += 1) {\n const post = solanaTx.meta.postBalances[i];\n const pre = solanaTx.meta.preBalances[i];\n if (post !== undefined && pre !== undefined && post !== pre) {\n let diff = BigInt(post) - BigInt(pre);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `null-${diff.toString()}`;\n\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from:\n post > pre\n ? typeof solanaTx.transaction.message.accountKeys[0] === 'string'\n ? solanaTx.transaction.message.accountKeys[0]\n : (solanaTx.transaction.message.accountKeys[0] as { pubkey: string })?.pubkey\n : typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey,\n timestamp,\n to:\n typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey?.toString(),\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n if (transfersByKey[key]) {\n if (post > pre) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n transfers.push(...Object.values(transfersByKey));\n }\n break;\n }\n\n case 'STARKNET': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const tx of block.transactions) {\n const typedTx = tx as {\n transaction_hash: string;\n sender_address: string;\n receipt?: {\n actual_fee?: {\n amount?: string;\n unit?: string;\n };\n events?: {\n keys: string[];\n data: string[];\n }[];\n };\n timestamp?: number | string;\n data_availability?: Record<string, unknown>;\n };\n\n const timestamp = block.timestamp ? new Date((block.timestamp as number) * 1000).toISOString() : null;\n\n let transactionGasFee = BigInt(0);\n if (typedTx?.receipt?.actual_fee?.amount) {\n transactionGasFee = BigInt(typedTx.receipt.actual_fee.amount);\n }\n\n const transactionHash = typedTx.transaction_hash;\n\n if (!typedTx.receipt?.events) {\n continue;\n }\n\n for (const event of typedTx.receipt.events) {\n if (!event.keys.includes('0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9')) {\n continue;\n }\n if (event.data.length < 3) {\n continue;\n }\n\n const [from, to, amountHex] = event.data;\n const amount = BigInt(amountHex);\n\n transfers.push({\n amount,\n blockNumber: block.block_number as number,\n from,\n timestamp,\n to,\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'STELLAR': {\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n hash: string;\n created_at: string;\n fee_charged: string;\n operations: {\n type: string;\n from: string;\n to: string;\n amount: string;\n asset_type: string;\n asset_issuer: string;\n }[];\n };\n for (const op of typedTx.operations) {\n if (op.type === 'payment') {\n transfers.push({\n amount: BigInt(op.amount.replace('.', '')),\n blockNumber: block.sequence as number,\n from: op.from,\n timestamp: typedTx.created_at,\n to: op.to,\n token: op.asset_type === 'native' ? null : op.asset_issuer,\n tokenType: op.asset_type === 'native' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: BigInt(typedTx.fee_charged),\n transactionHash: typedTx.hash,\n });\n }\n }\n }\n break;\n }\n\n case 'SUI': {\n const blockNumber = block.sequence as number;\n const blockTimestamp = new Date(block.timestamp as number).toISOString();\n\n for (const tx of (block.transactions as any[]) || []) {\n const transactionHash = tx.digest as string;\n const transactionGasFee = BigInt((tx.gasFee as string) || '0');\n\n for (const bc of (tx.balanceChanges as any[]) || []) {\n transfers.push({\n blockNumber,\n from: tx.sender ? (tx.sender as string) : undefined,\n to: tx.receiver ? (tx.receiver as string) : undefined,\n amount: BigInt(bc.amount as string),\n token: bc.coinRepr as string,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee,\n });\n }\n }\n\n break;\n }\n\n case 'TON': {\n const blockNumber = block.seqno as number;\n const blockTimestamp = new Date((block.shards?.[0]?.gen_utime as number) * 1000).toISOString();\n\n for (const shard of (block.shards as any[]) || []) {\n for (const tx of (shard.transactions as any[]) || []) {\n const transactionLT = tx.transaction_id.lt as string;\n const transactionHash = tx.transaction_id.hash as string;\n const transactionFee = BigInt((tx.fee as string) || '0');\n\n const inVal = BigInt((tx.in_msg?.value as string) || '0');\n if (inVal > 0n) {\n transfers.push({\n blockNumber,\n from: tx.in_msg?.source?.account_address as string,\n to: tx.address?.account_address as string,\n amount: inVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n\n for (const outMsg of (tx.out_msgs as any[]) || []) {\n const outVal = BigInt((outMsg.value as string) || '0');\n if (outVal > 0n) {\n transfers.push({\n blockNumber,\n from: outMsg.source?.account_address as string,\n to: outMsg.destination?.account_address as string,\n amount: outVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n }\n }\n }\n\n break;\n }\n\n // attempt to introspect data types\n default: {\n // try Cosmos\n if (block.block) {\n const typedBlock = block as {\n block: { header: { height: string; time: string }; data: { txs?: string[] } };\n block_id: { hash: string };\n };\n\n const blockNumber = Number(typedBlock.block.header.height);\n const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();\n const blockHash = typedBlock.block_id.hash;\n\n for (const txRaw of typedBlock.block.data.txs || []) {\n const decoded = decodeTxRaw(new Uint8Array(Buffer.from(txRaw, 'base64')));\n const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || '0');\n\n const registry = new Registry(defaultStargateTypes);\n for (const message of decoded.body.messages) {\n if (\n ['/ibc.applications.transfer.v1.MsgTransfer', '/cosmos.bank.v1beta1.MsgSend'].includes(message.typeUrl)\n ) {\n const decodedMsg = registry.decode(message);\n transfers.push({\n blockNumber,\n from: decodedMsg.sender,\n to: decodedMsg.receiver,\n amount: BigInt(decodedMsg.token.amount),\n token: decodedMsg.token.denom,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash: blockHash,\n transactionGasFee,\n });\n }\n }\n }\n\n break;\n }\n\n // otherwise assume EVM\n for (const tx of block.transactions as any[]) {\n if (!tx.receipt) {\n continue;\n }\n\n const timestamp = new Date((block.timestamp as number) * 1000).toISOString();\n const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);\n\n // track direct ETH transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NATIVE')) {\n // pull from traces, if available\n if (Array.isArray(tx.traces)) {\n for (const trace of tx.traces.filter((t) => t.action)) {\n const action = trace.action as unknown as { from: string; to: string; value: string };\n if (!action?.value) continue;\n\n transfers.push({\n amount: BigInt(action.value),\n blockNumber: tx.blockNumber as number,\n from: action.from?.toLowerCase() || NULL_ADDRESS,\n index: trace.traceAddress?.join('-'),\n timestamp,\n to: action.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n } else if ((tx.value as string)?.length >= 3 || /\\d+/.test(tx.value as string)) {\n transfers.push({\n amount: BigInt(tx.value as string),\n blockNumber: tx.blockNumber as number,\n from: tx.from?.toLowerCase() || NULL_ADDRESS,\n timestamp,\n to: tx.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n\n // track ERC20 transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('TOKEN')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 value)',\n ]);\n if (txfer) {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenType: 'TOKEN',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n }\n\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NFT')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 indexed value)',\n 'TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)',\n 'TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)',\n ]);\n\n if (!txfer) continue;\n\n switch (txfer.metadata.name) {\n case 'Transfer': {\n transfers.push({\n amount: 1,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.value as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferSingle': {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.id as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferBatch': {\n for (let i = 0; i < (txfer.decoded.ids as bigint[]).length; i += 1) {\n transfers.push({\n amount: txfer.decoded.values[i] as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.ids[i] as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n break;\n }\n }\n }\n }\n }\n if (typeof _ctx.params.contractAddress === 'string') {\n _ctx.params.contractAddress = _ctx.params.contractAddress.toLowerCase();\n }\n if (typeof _ctx.params.walletAddress === 'string') {\n _ctx.params.walletAddress = _ctx.params.walletAddress.toLowerCase();\n }\n break;\n }\n }\n\n transfers = transfers.filter((txfer) => {\n if (txfer.amount <= BigInt(0)) {\n return false;\n }\n if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token && txfer.token) {\n return false;\n }\n if (_ctx.params.walletAddress && ![txfer.from, txfer.to].includes(_ctx.params.walletAddress as string)) {\n return false;\n }\n return true;\n });\n\n return transfers;\n },\n\n tests: [\n // APTOS\n {\n params: {\n network: 'APTOS',\n walletAddress: '0xb3589951a7d8579a2918a749260804047abc60438bf0738c4e67683e972b41cd',\n contractAddress: '0x1',\n },\n payload: 'https://jiti.indexing.co/networks/aptos/237372198',\n output: [\n {\n amount: 12776498n,\n blockNumber: 237372198,\n from: '0xb3589951a7d8579a2918a749260804047abc60438bf0738c4e67683e972b41cd',\n timestamp: '2024-10-10T16:59:34.414Z',\n to: '0x1f5d15c9a1330389bda239ed2f40d8d2a2ba446e7a48ee57483a047d5ed1aafe',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 507n,\n transactionHash: '0xbabaf20c07c80ace9f1f2f6539e0df6c57c9a6b24d5e62fa4989b46c0807d9bb',\n },\n ],\n },\n\n // BASE\n {\n params: {\n network: 'BASE',\n walletAddress: '0x4F80864cD68782144e3736626896990acAe15a11',\n contractAddress: '0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed',\n },\n payload: 'https://jiti.indexing.co/networks/base/23507423',\n output: [\n {\n amount: 1000000000000000000000n,\n blockNumber: 23507423,\n from: '0x053002b4b332b422733c9469ddf9990bb6235e3d',\n index: 536,\n timestamp: '2024-12-10T04:16:33.000Z',\n to: '0x4f80864cd68782144e3736626896990acae15a11',\n token: '0x4ed4e862860bed51a9570b96d89af5e1b0efefed',\n tokenType: 'TOKEN',\n transactionGasFee: 1192354854229n,\n transactionHash: '0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56',\n },\n ],\n },\n\n // DOGECOIN\n {\n params: {\n network: 'DOGECOIN',\n walletAddress: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/dogecoin/1000075',\n output: [\n {\n amount: 1008521000000n,\n blockNumber: 1000075,\n from: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n to: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 0n,\n transactionHash: '9873fe46ab29f61cefdec498b691af68e0ad29a7599c94f42d2d4e9a5d461dbe',\n timestamp: '2015-12-13T19:59:52.000Z',\n },\n ],\n },\n\n // CARDANO\n {\n params: {\n network: 'CARDANO',\n walletAddress:\n 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/cardano/11443286',\n output: [\n {\n amount: 1110000n,\n blockNumber: 11443286,\n from: 'addr1qymdv285few5tyqvya86rl97r9e608njs37shfew6l2nn473aw2pcnrcvfwfgg2dnew99m4tjj0apsu7232w2euzwpysndh0h3',\n timestamp: '+057068-01-19T05:23:20.000Z',\n to: 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 174257n,\n transactionHash: '261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309',\n },\n ],\n },\n\n // RIPPLE\n {\n params: {\n network: 'RIPPLE',\n walletAddress: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ripple/88104659',\n output: [\n {\n amount: 238n,\n blockNumber: 88104659,\n from: 'rMAGnTv4eMWktZnhKa5cHcDiY84ZiKUaQm',\n timestamp: '2024-05-19T22:18:52Z',\n to: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n token: 'XRP',\n tokenType: 'NATIVE',\n transactionGasFee: 15n,\n transactionHash: '03564E6109261CDE73FCC5062C2A0A70F365CB1A0F9408C065B60EC3E94E4DBF',\n },\n ],\n },\n\n // STELLAR\n {\n params: {\n network: 'STELLAR',\n walletAddress: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n contractAddress: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n },\n payload: 'https://jiti.indexing.co/networks/stellar/51720546',\n output: [\n {\n amount: 150000n,\n blockNumber: 51720546,\n from: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n timestamp: '2024-05-18T04:41:39Z',\n to: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n token: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n tokenType: 'TOKEN',\n transactionGasFee: 100n,\n transactionHash: '4fb2441210cbe87f5003abdfa86f03bafa54f789ed041feccbda0bd054297c4d',\n },\n ],\n },\n // STARKNET\n {\n params: {\n network: 'STARKNET',\n walletAddress: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/starknet/1149460',\n output: [\n {\n amount: 0x1c286f74458fc6n,\n blockNumber: 1149460,\n from: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n timestamp: '2025-02-13T17:36:52.000Z',\n to: '0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 7925758505095110n,\n transactionHash: '0x707203dba31f442ae9a5477e6a8906f3676effa0f1d3bb19cbbc14e1ddfe21',\n },\n ],\n },\n //SUI\n {\n params: {\n network: 'SUI',\n walletAddress: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/sui/112336044',\n output: [\n {\n blockNumber: 112336044,\n from: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n to: undefined,\n amount: 180772n,\n token: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:54.529Z',\n transactionHash: '336V3wP8cHDAnB1Aku3j6n9948i8FG5N1eVP6Ac68BaE',\n transactionGasFee: -4165572n,\n },\n ],\n },\n // TON\n {\n params: {\n network: 'TON',\n walletAddress: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ton/44919328',\n output: [\n {\n blockNumber: 44919328,\n from: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n to: 'EQCFTFAHOU3vFt2NiZhRD5dwuS0k7GS59vIg3WfCKwfaQGW2',\n amount: 10000000n,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:18.000Z',\n transactionHash: 'Vh5cWr2uvCsdhoouBQ+EiUcF54os9oqvh8A/62EroQc=',\n transactionGasFee: 2355233n,\n },\n ],\n },\n // COSMOS\n {\n params: {\n network: 'COSMOS',\n walletAddress: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n contractAddress: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n },\n payload: 'https://jiti.indexing.co/networks/cosmos/24419691',\n output: [\n {\n blockNumber: 24419691,\n from: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n to: 'noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv',\n amount: 500000n,\n token: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n tokenType: 'NATIVE',\n timestamp: '2025-02-14T21:48:22.809Z',\n transactionHash: 'DF5FB086E60EE2ADA3A842751337E06A40696D7983CC1C038ADE236B36ED8AEB',\n transactionGasFee: 4860n,\n },\n ],\n },\n ],\n};\n\nexport default tokenTransfersTemplate;\n","export * from './evm-address-to-checksum';\nexport * from './evm-chain-to-id';\nexport * from './evm-decode-log';\nexport * from './evm-method-signature-to-hex';\nexport * from './evm-normalize-raw-block';\n","import { keccak256 } from 'viem';\n\nexport function evmAddressToChecksum(address: string) {\n if (!address || !/^(0x)?[0-9a-f]{40}$/i.test(address)) {\n return null;\n }\n\n const stripAddress = address.slice(2).toLowerCase();\n const keccakHash = keccak256(stripAddress as `0x${string}`);\n let checksumAddress = '0x';\n\n for (let i = 0; i < stripAddress.length; i++) {\n checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i];\n }\n\n return checksumAddress;\n}\n","const CHAIN_ID = {\n ARBITRUM: 42161,\n AVALANCHE: 43114,\n BASE: 8453,\n BASE_SEPOLIA: 84532,\n BERACHAIN_BARTIO: 80084,\n BLAST: 81457,\n BSC: 56,\n CELO: 42220,\n CYBER: 7560,\n DEGEN: 666666666,\n ETHEREUM: 1,\n ETH_HOLESKY: 17000,\n ETH_SEPOLIA: 11155111,\n FRAXTAL: 252,\n FRAXTAL_SEPOLIA: 2522,\n FUSE: 122,\n GNOSIS: 100,\n GOLD: 4653,\n HAM: 5112,\n HEMI_TESTNET: 743111,\n LINEA: 59144,\n LINEA_SEPOLIA: 59141,\n LISK_SEPOLIA: 4202,\n LYRA: 957,\n LYRA_SEPOLIA: 901,\n MODE: 34443,\n MODE_SEPOLIA: 919,\n NEON: 245022934,\n OASIS_SAPPHIRE: 23294,\n OPTIMISM: 10,\n OP_SEPOLIA: 11155420,\n ORDERLY: 291,\n ORDERLY_SEPOLIA: 4460,\n PGN_SEPOLIA: 58008,\n POLYGON: 137,\n POLYGON_AMOY: 80002,\n POLYGON_ZKEVM: 1101,\n PUBLIC_GOODS_NETWORK: 424,\n SCROLL: 534352,\n SCROLL_SEPOLIA: 534351,\n STACK: 78225,\n SYNDICATE_FRAME_CHAIN: 5101,\n TRON: 728126428,\n ZER0: 543210,\n ZK_LINK: 810180,\n ZORA: 7777777,\n ZORA_SEPOLIA: 999999999,\n};\n\nexport function evmChainToId(chain: string) {\n return CHAIN_ID[chain?.toUpperCase()];\n}\n","import { decodeEventLog, parseAbi } from 'viem';\n\nimport { evmMethodSignatureToHex } from './evm-method-signature-to-hex';\n\ntype BasicLog = Record<string, unknown> & { address: string; topics: string[] };\ntype SignaturesToDecode = string | { addresses?: string[]; signature: string; topic0?: string };\n\nexport function evmDecodeLog(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): Record<string, unknown> {\n if (Array.isArray(signatures)) {\n for (const sig of signatures) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return decoded;\n }\n }\n\n return null;\n }\n\n if (typeof signatures !== 'string' && Array.isArray(signatures.addresses) && signatures.addresses.length) {\n const addresses = signatures.addresses.map((a) => a?.toLowerCase());\n if (!addresses.includes(log.address.toLowerCase())) {\n return null;\n }\n }\n\n let sig = (typeof signatures === 'string' ? signatures : signatures.signature).trim();\n if (!sig.startsWith('event ')) {\n sig = 'event ' + sig;\n }\n const topic0 = typeof signatures !== 'string' && signatures.topic0 ? signatures.topic0 : evmMethodSignatureToHex(sig);\n if ((sig.match(/ indexed /g)?.length || 0) === log.topics.length - 1) {\n if (log.topics[0] === topic0) {\n try {\n const result = decodeEventLog({\n abi: parseAbi([sig]),\n data: log.data as `0x${string}`,\n topics: log.topics as [],\n });\n return result.args as unknown as Record<string, unknown>;\n } catch (e) {\n // ignore this\n }\n }\n }\n\n return null;\n}\n\nexport function evmDecodeLogWithMetadata(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): { decoded: Record<string, unknown>; metadata: { name: string } } {\n for (const sig of [signatures].flat()) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return {\n decoded,\n metadata: {\n name: (typeof sig === 'string' ? sig : sig.signature).split('(')[0],\n },\n };\n }\n }\n\n return null;\n}\n","import { keccak256 } from 'viem';\n\nexport function evmMethodSignatureToHex(sig: string): string {\n const [method, rest] = sig.split('(');\n const params = rest\n .split(')')[0]\n .split(',')\n .map((p) => p.trim());\n const topic0 = keccak256(\n `${method.split(' ').pop()}(${params.map((p) => p.split(' ')[0]).join(',')})` as `0x${string}`\n );\n return topic0;\n}\n","import { evmAddressToChecksum } from './evm-address-to-checksum';\n\nexport function normalizeEVMBlock(rawBlock: Record<string, unknown>): Record<string, unknown> {\n for (const k of ['baseFeePerGas', 'gasLimit', 'gasUsed', 'number', 'size', 'timestamp']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = parseInt(rawBlock[k] as string);\n }\n }\n\n for (const k of ['difficulty', 'totalDifficulty']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = BigInt(rawBlock[k] as string).toString();\n }\n }\n for (const k of ['miner']) {\n rawBlock[k] = evmAddressToChecksum(rawBlock[k] as string);\n }\n\n rawBlock.transactions = (\n rawBlock.transactions as { receipt: Record<string, unknown>; traces: Record<string, unknown>[] } & Record<\n string,\n unknown\n >[]\n ).map((tx) => {\n for (const k of [\n 'blockNumber',\n 'cumulativeGasUsed',\n 'effectiveGasPrice',\n 'gas',\n 'gasUsed',\n 'nonce',\n 'status',\n 'transactionIndex',\n ]) {\n if (typeof tx[k] === 'string') {\n tx[k] = parseInt(tx[k] as string);\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = parseInt(tx.receipt[k] as string);\n }\n }\n\n for (const k of ['gasPrice', 'maxFeePerGas', 'maxPriorityFeePerGas', 'value']) {\n if (typeof tx[k] === 'string') {\n tx[k] = BigInt(tx[k] as string).toString();\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = BigInt(tx.receipt[k] as string).toString();\n }\n }\n\n for (const k of ['from', 'to']) {\n if (typeof tx[k] === 'string') {\n tx[k] = evmAddressToChecksum(tx[k] as string);\n }\n }\n for (const k of ['contractAddress']) {\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = evmAddressToChecksum(tx.receipt[k] as string);\n }\n }\n\n tx.type = parseInt(tx.type as string);\n tx.receipt['status'] = Boolean(tx.receipt['status'] as string);\n\n tx.receipt['logs'] = (tx.receipt['logs'] as Record<string, unknown>[])?.map((log) => {\n for (const k of ['blockNumber', 'logIndex', 'transactionIndex']) {\n if (typeof log[k] === 'string') {\n log[k] = parseInt(log[k] as string);\n }\n }\n log['address'] = evmAddressToChecksum(log['address'] as string);\n return log;\n });\n\n return tx;\n });\n\n return rawBlock;\n}\n","export type Template = {\n key: string;\n name: string;\n description: string;\n disabled: boolean;\n tags: string[];\n params: Param[];\n transform: (\n payload: Record<string, unknown>,\n _ctx?: Record<string, unknown> & { params: Record<string, unknown> }\n ) => unknown;\n tests: TemplateTest[];\n};\n\nexport type Param = {\n key: string;\n name: string;\n type: 'NETWORK' | 'ADDRESS' | 'STRING' | 'NUMBER' | 'BOOLEAN';\n multiple?: boolean;\n optional?: boolean;\n values?: string[];\n default?: string;\n};\n\nexport type TemplateTest = {\n params: Record<string, unknown>;\n payload: `https://${string}` | Record<string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oBACX,WAAW;oBACX,iBAAiB;oBACjB,mBAAmB,QAAQ;gBAC7B;aACD;QACH;QACA,SAAS;QACT;YACE,QAAQ;gBACN,SAAS;gBACT,eAAe;gBACf,iBAAiB;YACnB;YACA,SAAS;YACT,QAAQ;gBACN;oBACE,aAAa;oBACb,MAAM;oBACN,IAAI;oBACJ,QAAQ,OAAO;oBACf,OAAO;oBACP,WAAW;oBACX,WAAW;oBACX,iBAAiB;oBACjB,mBAAmB,KAAK;gBAC1B;aACD;QACH;KACD;AACH;IAEA,2CAAe;;;AFh9BR,MAAM,4CAAY;IAAC,CAAA,GAAA,wCAAU;IAAG,CAAA,GAAA,wCAAqB;CAAE;;;;;;;ADC9D,MAAM,4CAAY,CAAA,GAAA,yCAAW,EAAE,MAAM,CAAC,CAAC,GAAG,IAAO,CAAA;QAAE,GAAG,CAAC;QAAE,CAAC,EAAE,GAAG,CAAC,EAAE,OAAO,MAAM,CAAC,CAAC,GAAG;IAAG,CAAA,GAAI,CAAC;AAIrF,SAAS;IACd,OAAO,CAAA,GAAA,yCAAW,EAAE,KAAK;AAC3B;AAEO,SAAS,0CAAiB,GAAW;IAC1C,OAAO,CAAA,GAAA,yCAAW,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,WAAa,SAAS,GAAG,KAAK;AAClE","sources":["src/index.ts","src/templates/index.ts","src/templates/raw.ts","src/templates/token-transfers.ts","src/utils/index.ts","src/utils/evm-address-to-checksum.ts","src/utils/evm-chain-to-id.ts","src/utils/evm-decode-log.ts","src/utils/evm-method-signature-to-hex.ts","src/utils/evm-normalize-raw-block.ts","src/types.ts"],"sourcesContent":["import { templates as templateList } from './templates';\nimport * as utils from './utils';\nimport * as types from './types';\n\nconst templates = templateList.reduce((a, b) => ({ ...a, [b.key]: Object.assign({}, b) }), {});\n\nexport { utils, templates, types };\n\nexport function getAllTemplates() {\n return templateList.slice();\n}\n\nexport function getTemplateByKey(key: string) {\n return templateList.slice().find((template) => template.key === key);\n}\n","import rawTemplate from './raw';\nimport tokenTransfersTemplate from './token-transfers';\n\nexport const templates = [rawTemplate, tokenTransfersTemplate];\n","import { Template } from '../types';\n\nconst rawTemplate: Template = {\n key: 'raw',\n name: 'Raw Block Data',\n description: 'Get all blocks with all available fields',\n tags: ['EVM', 'RAW'],\n disabled: true,\n params: [],\n transform: (payload) => payload,\n tests: [\n {\n params: {},\n payload: { a: 'b', c: 1, d: { e: true } },\n output: { a: 'b', c: 1, d: { e: true } },\n },\n ],\n};\n\nexport default rawTemplate;\n","import { evmDecodeLogWithMetadata } from '../utils';\nimport { Template } from '../types';\nimport { decodeTxRaw, Registry } from '@cosmjs/proto-signing';\nimport { defaultRegistryTypes as defaultStargateTypes, SigningStargateClient } from '@cosmjs/stargate';\n\ntype NetworkTransfer = {\n amount: number | bigint;\n blockNumber: number;\n from: string;\n index?: string;\n timestamp: string;\n to: string;\n token?: string;\n tokenId?: string;\n tokenType: 'NATIVE' | 'TOKEN' | 'NFT';\n transactionGasFee: bigint;\n transactionHash: string;\n};\n\nconst NULL_ADDRESS = '0x0000000000000000000000000000000000000000';\n\nconst tokenTransfersTemplate: Template = {\n key: 'token_transfers',\n name: 'Token Transfers',\n description: 'Get all token transfers for a set of token types.',\n tags: ['EVM', 'ERC20', 'ERC721', 'NFT', 'TOKEN'],\n disabled: false,\n params: [\n { key: 'network', name: 'Network', type: 'NETWORK', optional: false },\n { key: 'contractAddress', name: 'Contract Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n {\n key: 'tokenTypes',\n name: 'Token Types',\n type: 'STRING',\n multiple: true,\n optional: true,\n values: ['NATIVE', 'TOKEN', 'NFT'],\n },\n ],\n\n transform: (block, _ctx) => {\n const TOKEN_TYPES = (_ctx.params.tokenTypes as NetworkTransfer['tokenType'][]) || [];\n let transfers: NetworkTransfer[] = [];\n\n switch (block._network) {\n case 'APTOS':\n case 'APTOS_TESTNET': {\n for (const tx of block.transactions as Record<string, unknown>[]) {\n if (!tx?.events || !Array.isArray(tx.events)) {\n continue;\n }\n\n const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp as string) / 1000).toISOString() : null;\n const txfersByKey: Record<string, Record<string, string>> = {};\n\n for (const evt of tx.events as Record<string, unknown>[]) {\n if (['0x1::coin::WithdrawEvent', '0x1::coin::DepositEvent'].includes(evt.type as string)) {\n const amount = (evt.data as Record<string, string>)?.amount;\n const key = `0x1-${amount}`;\n txfersByKey[key] ||= { amount, tokenAddress: null };\n if ((evt.type as string).endsWith('WithdrawEvent')) {\n txfersByKey[key].from = (evt.guid as Record<string, string>)?.account_address;\n } else {\n txfersByKey[key].to = (evt.guid as Record<string, string>)?.account_address;\n }\n }\n }\n\n for (const partial of Object.values(txfersByKey)) {\n if (!partial.from || !partial.to) continue;\n transfers.push({\n amount: BigInt(partial.amount),\n blockNumber: parseInt(block.block_height as string),\n from: partial.from?.length < 66 ? `0x0${partial.from?.slice(2)}` : partial.from,\n timestamp,\n to: partial.to?.length < 66 ? `0x0${partial.to?.slice(2)}` : partial.to,\n token: partial.tokenAddress,\n tokenType: 'NATIVE',\n transactionGasFee: BigInt(tx.gas_used as string),\n transactionHash: tx.hash as string,\n });\n }\n }\n break;\n }\n\n case 'BITCOIN':\n case 'BITCOIN_TESTNET':\n case 'LITCOIN': // @TODO\n case 'DOGECOIN': {\n for (const tx of block.tx as Record<string, unknown>[]) {\n const timestamp = tx.time ? new Date((tx.time as number) * 1000).toISOString() : null;\n const vin = tx.vin[0] as { prevout?: { scriptPubKey: { address: string } }; vout?: number };\n const vout = tx.vout as { value: number; scriptPubKey?: { address: string; addresses?: string[] } }[];\n\n const fromVout = Math.min(vin.vout || 1000, vout.length - 1);\n const fromAddress =\n vin.prevout?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.addresses?.[0];\n if (!fromAddress) {\n continue;\n }\n\n for (const v of vout) {\n transfers.push({\n amount: BigInt(Math.round(v.value * Math.pow(10, 8))),\n blockNumber: block.height as number,\n from: fromAddress,\n timestamp,\n to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],\n transactionGasFee: BigInt(Math.round(((tx.fee as number) || 0) * Math.pow(10, 8))),\n transactionHash: tx.txid as string,\n token: null,\n tokenType: 'NATIVE',\n });\n }\n }\n break;\n }\n\n case 'CARDANO': {\n const blockTimestamp = new Date((block.timestamp as number) * 1000).toISOString();\n\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n transaction_identifier?: { hash?: string };\n operations?: {\n type: string;\n account?: { address?: string };\n amount?: {\n value?: string;\n currency?: {\n symbol?: string;\n decimals?: number;\n };\n };\n }[];\n };\n\n if (!Array.isArray(typedTx.operations)) {\n continue;\n }\n\n const transactionHash = typedTx.transaction_identifier?.hash || '';\n\n const inputs = typedTx.operations.filter((op) => op.type === 'input');\n const outputs = typedTx.operations.filter((op) => op.type === 'output');\n\n if (!inputs.length && !outputs.length) {\n continue;\n }\n\n const fromAddress = inputs[0]?.account?.address;\n if (!fromAddress) {\n continue;\n }\n\n const sumInputs = inputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n const sumOutputs = outputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n\n const transactionFee = sumInputs + BigInt(sumOutputs);\n\n for (const out of outputs) {\n const rawValue = out.amount?.value || '0';\n const absoluteValue = BigInt(rawValue);\n transfers.push({\n amount: absoluteValue < 0 ? -absoluteValue : absoluteValue,\n blockNumber: (block.block_identifier as { index: number }).index,\n from: fromAddress,\n timestamp: blockTimestamp,\n to: out.account?.address || '',\n token: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? null : out.amount?.currency?.symbol,\n tokenType: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: transactionFee < 0 ? -transactionFee : transactionFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'RIPPLE': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const rawTx of block.transactions) {\n const typedTx = rawTx as {\n Account?: string;\n Amount?: string | { currency: string; issuer: string; value: string };\n Destination?: string;\n Fee?: string;\n hash?: string;\n TransactionType?: string;\n date?: number;\n metaData?: {\n delivered_amount?: string | { currency: string; issuer: string; value: string };\n };\n };\n if (typedTx.TransactionType !== 'Payment') {\n continue;\n }\n const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? '0';\n let tokenSymbol = 'XRP';\n let tokenType: 'NATIVE' | 'TOKEN' | 'NFT' = 'NATIVE';\n\n let parsedAmount: bigint;\n\n if (typeof deliveredOrAmount === 'object') {\n tokenSymbol = deliveredOrAmount.currency?.toUpperCase() ?? 'UNKNOWN';\n tokenType = 'TOKEN';\n const floatVal = parseFloat(deliveredOrAmount.value);\n const smallestUnit = Math.round(floatVal * 1_000_000);\n parsedAmount = BigInt(smallestUnit);\n } else {\n parsedAmount = BigInt(String(deliveredOrAmount));\n }\n transfers.push({\n amount: parsedAmount,\n blockNumber: parseInt(block.ledger_index as string, 10),\n from: typedTx.Account ?? 'UNKNOWN',\n timestamp: block.close_time_iso ? (block.close_time_iso as string) : null,\n to: typedTx.Destination ?? 'UNKNOWN',\n token: tokenSymbol,\n tokenType: tokenType,\n transactionGasFee: BigInt(typedTx.Fee ?? '0'),\n transactionHash: typedTx.hash ?? '',\n });\n }\n\n break;\n }\n\n case 'SOLANA': {\n for (const tx of block.transactions as unknown[]) {\n const solanaTx = tx as {\n meta: {\n fee: number;\n postTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n preTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n postBalances: number[];\n preBalances: number[];\n };\n transaction: {\n message: { accountKeys: (string | { pubkey: string })[]; instructions: unknown[] };\n signatures: string[];\n };\n };\n const txHash = solanaTx.transaction.signatures[0];\n const timestamp = block.blockTime ? new Date((block.blockTime as number) * 1000).toISOString() : null;\n\n let txFee = BigInt(solanaTx.meta.fee);\n if (txFee < BigInt(10)) {\n txFee = txFee * BigInt(Math.pow(10, 9));\n }\n\n const transfersByKey: Record<string, NetworkTransfer> = {};\n for (const post of solanaTx.meta.postTokenBalances) {\n let matched = false;\n for (const pre of solanaTx.meta.preTokenBalances) {\n if (post.mint === pre.mint && post.owner === pre.owner) {\n let diff = BigInt(post.uiTokenAmount.amount) - BigInt(pre.uiTokenAmount.amount);\n if (diff === BigInt(0)) {\n continue;\n }\n if (diff < 0) {\n diff = -diff;\n }\n\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: pre.owner,\n timestamp,\n to: post.owner,\n transactionGasFee: txFee,\n transactionHash: txHash,\n token: post.mint,\n tokenType: 'TOKEN',\n };\n if (transfersByKey[key]) {\n if (diff > 0) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n matched = true;\n }\n }\n\n if (!matched) {\n let diff = BigInt(post.uiTokenAmount.amount);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: null,\n timestamp,\n to: post.owner,\n token: post.mint,\n tokenType: 'TOKEN',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n delete txfer.from;\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n for (let i = 1; i < solanaTx.meta.postBalances.length; i += 1) {\n const post = solanaTx.meta.postBalances[i];\n const pre = solanaTx.meta.preBalances[i];\n if (post !== undefined && pre !== undefined && post !== pre) {\n let diff = BigInt(post) - BigInt(pre);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `null-${diff.toString()}`;\n\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from:\n post > pre\n ? typeof solanaTx.transaction.message.accountKeys[0] === 'string'\n ? solanaTx.transaction.message.accountKeys[0]\n : (solanaTx.transaction.message.accountKeys[0] as { pubkey: string })?.pubkey\n : typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey,\n timestamp,\n to:\n typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey?.toString(),\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n if (transfersByKey[key]) {\n if (post > pre) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n transfers.push(...Object.values(transfersByKey));\n }\n break;\n }\n\n case 'STARKNET': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const tx of block.transactions) {\n const typedTx = tx as {\n transaction_hash: string;\n sender_address: string;\n receipt?: {\n actual_fee?: {\n amount?: string;\n unit?: string;\n };\n events?: {\n keys: string[];\n data: string[];\n }[];\n };\n timestamp?: number | string;\n data_availability?: Record<string, unknown>;\n };\n\n const timestamp = block.timestamp ? new Date((block.timestamp as number) * 1000).toISOString() : null;\n\n let transactionGasFee = BigInt(0);\n if (typedTx?.receipt?.actual_fee?.amount) {\n transactionGasFee = BigInt(typedTx.receipt.actual_fee.amount);\n }\n\n const transactionHash = typedTx.transaction_hash;\n\n if (!typedTx.receipt?.events) {\n continue;\n }\n\n for (const event of typedTx.receipt.events) {\n if (!event.keys.includes('0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9')) {\n continue;\n }\n if (event.data.length < 3) {\n continue;\n }\n\n const [from, to, amountHex] = event.data;\n const amount = BigInt(amountHex);\n\n transfers.push({\n amount,\n blockNumber: block.block_number as number,\n from,\n timestamp,\n to,\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'STELLAR': {\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n hash: string;\n created_at: string;\n fee_charged: string;\n operations: {\n type: string;\n from: string;\n to: string;\n amount: string;\n asset_type: string;\n asset_issuer: string;\n }[];\n };\n for (const op of typedTx.operations) {\n if (op.type === 'payment') {\n transfers.push({\n amount: BigInt(op.amount.replace('.', '')),\n blockNumber: block.sequence as number,\n from: op.from,\n timestamp: typedTx.created_at,\n to: op.to,\n token: op.asset_type === 'native' ? null : op.asset_issuer,\n tokenType: op.asset_type === 'native' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: BigInt(typedTx.fee_charged),\n transactionHash: typedTx.hash,\n });\n }\n }\n }\n break;\n }\n\n case 'SUI': {\n const blockNumber = block.sequence as number;\n const blockTimestamp = new Date(block.timestamp as number).toISOString();\n\n for (const tx of (block.transactions as any[]) || []) {\n const transactionHash = tx.digest as string;\n const transactionGasFee = BigInt((tx.gasFee as string) || '0');\n\n for (const bc of (tx.balanceChanges as any[]) || []) {\n transfers.push({\n blockNumber,\n from: tx.sender ? (tx.sender as string) : undefined,\n to: tx.receiver ? (tx.receiver as string) : undefined,\n amount: BigInt(bc.amount as string),\n token: bc.coinRepr as string,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee,\n });\n }\n }\n\n break;\n }\n\n case 'TON': {\n const blockNumber = block.seqno as number;\n const blockTimestamp = new Date((block.shards?.[0]?.gen_utime as number) * 1000).toISOString();\n\n for (const shard of (block.shards as any[]) || []) {\n for (const tx of (shard.transactions as any[]) || []) {\n const transactionLT = tx.transaction_id.lt as string;\n const transactionHash = tx.transaction_id.hash as string;\n const transactionFee = BigInt((tx.fee as string) || '0');\n\n const inVal = BigInt((tx.in_msg?.value as string) || '0');\n if (inVal > 0n) {\n transfers.push({\n blockNumber,\n from: tx.in_msg?.source?.account_address as string,\n to: tx.address?.account_address as string,\n amount: inVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n\n for (const outMsg of (tx.out_msgs as any[]) || []) {\n const outVal = BigInt((outMsg.value as string) || '0');\n if (outVal > 0n) {\n transfers.push({\n blockNumber,\n from: outMsg.source?.account_address as string,\n to: outMsg.destination?.account_address as string,\n amount: outVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n }\n }\n }\n\n break;\n }\n\n // attempt to introspect data types\n default: {\n // try Cosmos\n if (block.block) {\n const typedBlock = block as {\n block: { header: { height: string; time: string }; data: { txs?: string[] } };\n block_id: { hash: string };\n };\n\n const blockNumber = Number(typedBlock.block.header.height);\n const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();\n const blockHash = typedBlock.block_id.hash;\n\n for (const txRaw of typedBlock.block.data.txs || []) {\n const decoded = decodeTxRaw(new Uint8Array(Buffer.from(txRaw, 'base64')));\n const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || '0');\n\n const registry = new Registry(defaultStargateTypes);\n for (const message of decoded.body.messages) {\n if (\n ['/ibc.applications.transfer.v1.MsgTransfer', '/cosmos.bank.v1beta1.MsgSend'].includes(message.typeUrl)\n ) {\n const decodedMsg = registry.decode(message);\n transfers.push({\n blockNumber,\n from: decodedMsg.sender,\n to: decodedMsg.receiver,\n amount: BigInt(decodedMsg.token.amount),\n token: decodedMsg.token.denom,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash: blockHash,\n transactionGasFee,\n });\n }\n }\n }\n\n break;\n }\n\n // otherwise assume EVM\n for (const tx of block.transactions as any[]) {\n if (!tx.receipt) {\n continue;\n }\n\n const timestamp = new Date((block.timestamp as number) * 1000).toISOString();\n const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);\n\n // track direct ETH transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NATIVE')) {\n // pull from traces, if available\n if (Array.isArray(tx.traces)) {\n for (const trace of tx.traces.filter((t) => t.action)) {\n const action = trace.action as unknown as { from: string; to: string; value: string };\n if (!action?.value) continue;\n\n transfers.push({\n amount: BigInt(action.value),\n blockNumber: tx.blockNumber as number,\n from: action.from?.toLowerCase() || NULL_ADDRESS,\n index: trace.traceAddress?.join('-'),\n timestamp,\n to: action.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n } else if ((tx.value as string)?.length >= 3 || /\\d+/.test(tx.value as string)) {\n transfers.push({\n amount: BigInt(tx.value as string),\n blockNumber: tx.blockNumber as number,\n from: tx.from?.toLowerCase() || NULL_ADDRESS,\n timestamp,\n to: tx.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n\n // track ERC20 transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('TOKEN')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 value)',\n ]);\n if (txfer) {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenType: 'TOKEN',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n }\n\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NFT')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 indexed value)',\n 'TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)',\n 'TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)',\n ]);\n\n if (!txfer) continue;\n\n switch (txfer.metadata.name) {\n case 'Transfer': {\n transfers.push({\n amount: 1,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.value as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferSingle': {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.id as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferBatch': {\n for (let i = 0; i < (txfer.decoded.ids as bigint[]).length; i += 1) {\n transfers.push({\n amount: txfer.decoded.values[i] as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.ids[i] as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n break;\n }\n }\n }\n }\n }\n if (typeof _ctx.params.contractAddress === 'string') {\n _ctx.params.contractAddress = _ctx.params.contractAddress.toLowerCase();\n }\n if (typeof _ctx.params.walletAddress === 'string') {\n _ctx.params.walletAddress = _ctx.params.walletAddress.toLowerCase();\n }\n break;\n }\n }\n\n transfers = transfers.filter((txfer) => {\n if (txfer.amount <= BigInt(0)) {\n return false;\n }\n if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token && txfer.token) {\n return false;\n }\n if (_ctx.params.walletAddress && ![txfer.from, txfer.to].includes(_ctx.params.walletAddress as string)) {\n return false;\n }\n return true;\n });\n\n return transfers;\n },\n\n tests: [\n // APTOS\n {\n params: {\n network: 'APTOS',\n walletAddress: '0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e',\n contractAddress: '0x1',\n },\n payload: 'https://jiti.indexing.co/networks/aptos/297956660',\n output: [\n {\n amount: 1502138836n,\n blockNumber: 297956660,\n from: '0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00',\n timestamp: '2025-03-02T21:07:06.002Z',\n to: '0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 13n,\n transactionHash: '0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13',\n },\n ],\n },\n\n // BASE\n {\n params: {\n network: 'BASE',\n walletAddress: '0x4F80864cD68782144e3736626896990acAe15a11',\n contractAddress: '0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed',\n },\n payload: 'https://jiti.indexing.co/networks/base/23507423',\n output: [\n {\n amount: 1000000000000000000000n,\n blockNumber: 23507423,\n from: '0x053002b4b332b422733c9469ddf9990bb6235e3d',\n index: 536,\n timestamp: '2024-12-10T04:16:33.000Z',\n to: '0x4f80864cd68782144e3736626896990acae15a11',\n token: '0x4ed4e862860bed51a9570b96d89af5e1b0efefed',\n tokenType: 'TOKEN',\n transactionGasFee: 1192354854229n,\n transactionHash: '0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56',\n },\n ],\n },\n\n // DOGECOIN\n {\n params: {\n network: 'DOGECOIN',\n walletAddress: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/dogecoin/1000075',\n output: [\n {\n amount: 1008521000000n,\n blockNumber: 1000075,\n from: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n to: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 0n,\n transactionHash: '9873fe46ab29f61cefdec498b691af68e0ad29a7599c94f42d2d4e9a5d461dbe',\n timestamp: '2015-12-13T19:59:52.000Z',\n },\n ],\n },\n\n // CARDANO\n {\n params: {\n network: 'CARDANO',\n walletAddress:\n 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/cardano/11443286',\n output: [\n {\n amount: 1110000n,\n blockNumber: 11443286,\n from: 'addr1qymdv285few5tyqvya86rl97r9e608njs37shfew6l2nn473aw2pcnrcvfwfgg2dnew99m4tjj0apsu7232w2euzwpysndh0h3',\n timestamp: '+057068-01-19T05:23:20.000Z',\n to: 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 174257n,\n transactionHash: '261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309',\n },\n ],\n },\n\n // RIPPLE\n {\n params: {\n network: 'RIPPLE',\n walletAddress: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ripple/88104659',\n output: [\n {\n amount: 238n,\n blockNumber: 88104659,\n from: 'rMAGnTv4eMWktZnhKa5cHcDiY84ZiKUaQm',\n timestamp: '2024-05-19T22:18:52Z',\n to: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n token: 'XRP',\n tokenType: 'NATIVE',\n transactionGasFee: 15n,\n transactionHash: '03564E6109261CDE73FCC5062C2A0A70F365CB1A0F9408C065B60EC3E94E4DBF',\n },\n ],\n },\n\n // STELLAR\n {\n params: {\n network: 'STELLAR',\n walletAddress: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n contractAddress: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n },\n payload: 'https://jiti.indexing.co/networks/stellar/51720546',\n output: [\n {\n amount: 150000n,\n blockNumber: 51720546,\n from: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n timestamp: '2024-05-18T04:41:39Z',\n to: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n token: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n tokenType: 'TOKEN',\n transactionGasFee: 100n,\n transactionHash: '4fb2441210cbe87f5003abdfa86f03bafa54f789ed041feccbda0bd054297c4d',\n },\n ],\n },\n // STARKNET\n {\n params: {\n network: 'STARKNET',\n walletAddress: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/starknet/1149460',\n output: [\n {\n amount: 0x1c286f74458fc6n,\n blockNumber: 1149460,\n from: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n timestamp: '2025-02-13T17:36:52.000Z',\n to: '0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 7925758505095110n,\n transactionHash: '0x707203dba31f442ae9a5477e6a8906f3676effa0f1d3bb19cbbc14e1ddfe21',\n },\n ],\n },\n //SUI\n {\n params: {\n network: 'SUI',\n walletAddress: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/sui/112336044',\n output: [\n {\n blockNumber: 112336044,\n from: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n to: undefined,\n amount: 180772n,\n token: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:54.529Z',\n transactionHash: '336V3wP8cHDAnB1Aku3j6n9948i8FG5N1eVP6Ac68BaE',\n transactionGasFee: -4165572n,\n },\n ],\n },\n // TON\n {\n params: {\n network: 'TON',\n walletAddress: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ton/44919328',\n output: [\n {\n blockNumber: 44919328,\n from: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n to: 'EQCFTFAHOU3vFt2NiZhRD5dwuS0k7GS59vIg3WfCKwfaQGW2',\n amount: 10000000n,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:18.000Z',\n transactionHash: 'Vh5cWr2uvCsdhoouBQ+EiUcF54os9oqvh8A/62EroQc=',\n transactionGasFee: 2355233n,\n },\n ],\n },\n // COSMOS\n {\n params: {\n network: 'COSMOS',\n walletAddress: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n contractAddress: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n },\n payload: 'https://jiti.indexing.co/networks/cosmos/24419691',\n output: [\n {\n blockNumber: 24419691,\n from: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n to: 'noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv',\n amount: 500000n,\n token: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n tokenType: 'NATIVE',\n timestamp: '2025-02-14T21:48:22.809Z',\n transactionHash: 'DF5FB086E60EE2ADA3A842751337E06A40696D7983CC1C038ADE236B36ED8AEB',\n transactionGasFee: 4860n,\n },\n ],\n },\n ],\n};\n\nexport default tokenTransfersTemplate;\n","export * from './evm-address-to-checksum';\nexport * from './evm-chain-to-id';\nexport * from './evm-decode-log';\nexport * from './evm-method-signature-to-hex';\nexport * from './evm-normalize-raw-block';\n","import { keccak256 } from 'viem';\n\nexport function evmAddressToChecksum(address: string) {\n if (!address || !/^(0x)?[0-9a-f]{40}$/i.test(address)) {\n return null;\n }\n\n const stripAddress = address.slice(2).toLowerCase();\n const keccakHash = keccak256(stripAddress as `0x${string}`);\n let checksumAddress = '0x';\n\n for (let i = 0; i < stripAddress.length; i++) {\n checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i];\n }\n\n return checksumAddress;\n}\n","const CHAIN_ID = {\n ARBITRUM: 42161,\n AVALANCHE: 43114,\n BASE: 8453,\n BASE_SEPOLIA: 84532,\n BERACHAIN_BARTIO: 80084,\n BLAST: 81457,\n BSC: 56,\n CELO: 42220,\n CYBER: 7560,\n DEGEN: 666666666,\n ETHEREUM: 1,\n ETH_HOLESKY: 17000,\n ETH_SEPOLIA: 11155111,\n FRAXTAL: 252,\n FRAXTAL_SEPOLIA: 2522,\n FUSE: 122,\n GNOSIS: 100,\n GOLD: 4653,\n HAM: 5112,\n HEMI_TESTNET: 743111,\n LINEA: 59144,\n LINEA_SEPOLIA: 59141,\n LISK_SEPOLIA: 4202,\n LYRA: 957,\n LYRA_SEPOLIA: 901,\n MODE: 34443,\n MODE_SEPOLIA: 919,\n NEON: 245022934,\n OASIS_SAPPHIRE: 23294,\n OPTIMISM: 10,\n OP_SEPOLIA: 11155420,\n ORDERLY: 291,\n ORDERLY_SEPOLIA: 4460,\n PGN_SEPOLIA: 58008,\n POLYGON: 137,\n POLYGON_AMOY: 80002,\n POLYGON_ZKEVM: 1101,\n PUBLIC_GOODS_NETWORK: 424,\n SCROLL: 534352,\n SCROLL_SEPOLIA: 534351,\n STACK: 78225,\n SYNDICATE_FRAME_CHAIN: 5101,\n TRON: 728126428,\n ZER0: 543210,\n ZK_LINK: 810180,\n ZORA: 7777777,\n ZORA_SEPOLIA: 999999999,\n};\n\nexport function evmChainToId(chain: string) {\n return CHAIN_ID[chain?.toUpperCase()];\n}\n","import { decodeEventLog, parseAbi } from 'viem';\n\nimport { evmMethodSignatureToHex } from './evm-method-signature-to-hex';\n\ntype BasicLog = Record<string, unknown> & { address: string; topics: string[] };\ntype SignaturesToDecode = string | { addresses?: string[]; signature: string; topic0?: string };\n\nexport function evmDecodeLog(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): Record<string, unknown> {\n if (Array.isArray(signatures)) {\n for (const sig of signatures) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return decoded;\n }\n }\n\n return null;\n }\n\n if (typeof signatures !== 'string' && Array.isArray(signatures.addresses) && signatures.addresses.length) {\n const addresses = signatures.addresses.map((a) => a?.toLowerCase());\n if (!addresses.includes(log.address.toLowerCase())) {\n return null;\n }\n }\n\n let sig = (typeof signatures === 'string' ? signatures : signatures.signature).trim();\n if (!sig.startsWith('event ')) {\n sig = 'event ' + sig;\n }\n const topic0 = typeof signatures !== 'string' && signatures.topic0 ? signatures.topic0 : evmMethodSignatureToHex(sig);\n if ((sig.match(/ indexed /g)?.length || 0) === log.topics.length - 1) {\n if (log.topics[0] === topic0) {\n try {\n const result = decodeEventLog({\n abi: parseAbi([sig]),\n data: log.data as `0x${string}`,\n topics: log.topics as [],\n });\n return result.args as unknown as Record<string, unknown>;\n } catch (e) {\n // ignore this\n }\n }\n }\n\n return null;\n}\n\nexport function evmDecodeLogWithMetadata(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): { decoded: Record<string, unknown>; metadata: { name: string } } {\n for (const sig of [signatures].flat()) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return {\n decoded,\n metadata: {\n name: (typeof sig === 'string' ? sig : sig.signature).split('(')[0],\n },\n };\n }\n }\n\n return null;\n}\n","import { keccak256 } from 'viem';\n\nexport function evmMethodSignatureToHex(sig: string): string {\n const [method, rest] = sig.split('(');\n const params = rest\n .split(')')[0]\n .split(',')\n .map((p) => p.trim());\n const topic0 = keccak256(\n `${method.split(' ').pop()}(${params.map((p) => p.split(' ')[0]).join(',')})` as `0x${string}`\n );\n return topic0;\n}\n","import { evmAddressToChecksum } from './evm-address-to-checksum';\n\nexport function normalizeEVMBlock(rawBlock: Record<string, unknown>): Record<string, unknown> {\n for (const k of ['baseFeePerGas', 'gasLimit', 'gasUsed', 'number', 'size', 'timestamp']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = parseInt(rawBlock[k] as string);\n }\n }\n\n for (const k of ['difficulty', 'totalDifficulty']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = BigInt(rawBlock[k] as string).toString();\n }\n }\n for (const k of ['miner']) {\n rawBlock[k] = evmAddressToChecksum(rawBlock[k] as string);\n }\n\n rawBlock.transactions = (\n rawBlock.transactions as { receipt: Record<string, unknown>; traces: Record<string, unknown>[] } & Record<\n string,\n unknown\n >[]\n ).map((tx) => {\n for (const k of [\n 'blockNumber',\n 'cumulativeGasUsed',\n 'effectiveGasPrice',\n 'gas',\n 'gasUsed',\n 'nonce',\n 'status',\n 'transactionIndex',\n ]) {\n if (typeof tx[k] === 'string') {\n tx[k] = parseInt(tx[k] as string);\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = parseInt(tx.receipt[k] as string);\n }\n }\n\n for (const k of ['gasPrice', 'maxFeePerGas', 'maxPriorityFeePerGas', 'value']) {\n if (typeof tx[k] === 'string') {\n tx[k] = BigInt(tx[k] as string).toString();\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = BigInt(tx.receipt[k] as string).toString();\n }\n }\n\n for (const k of ['from', 'to']) {\n if (typeof tx[k] === 'string') {\n tx[k] = evmAddressToChecksum(tx[k] as string);\n }\n }\n for (const k of ['contractAddress']) {\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = evmAddressToChecksum(tx.receipt[k] as string);\n }\n }\n\n tx.type = parseInt(tx.type as string);\n tx.receipt['status'] = Boolean(tx.receipt['status'] as string);\n\n tx.receipt['logs'] = (tx.receipt['logs'] as Record<string, unknown>[])?.map((log) => {\n for (const k of ['blockNumber', 'logIndex', 'transactionIndex']) {\n if (typeof log[k] === 'string') {\n log[k] = parseInt(log[k] as string);\n }\n }\n log['address'] = evmAddressToChecksum(log['address'] as string);\n return log;\n });\n\n return tx;\n });\n\n return rawBlock;\n}\n","export type Template = {\n key: string;\n name: string;\n description: string;\n disabled: boolean;\n tags: string[];\n params: Param[];\n transform: (\n payload: Record<string, unknown>,\n _ctx?: Record<string, unknown> & { params: Record<string, unknown> }\n ) => unknown;\n tests: TemplateTest[];\n};\n\nexport type Param = {\n key: string;\n name: string;\n type: 'NETWORK' | 'ADDRESS' | 'STRING' | 'NUMBER' | 'BOOLEAN';\n multiple?: boolean;\n optional?: boolean;\n values?: string[];\n default?: string;\n};\n\nexport type TemplateTest = {\n params: Record<string, unknown>;\n payload: `https://${string}` | Record<string, unknown>;\n output: unknown;\n};\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -325,7 +325,7 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
325
325
|
case "APTOS":
|
|
326
326
|
case "APTOS_TESTNET":
|
|
327
327
|
for (const tx of block.transactions){
|
|
328
|
-
if (!tx?.events || !Array.isArray(tx.events))
|
|
328
|
+
if (!tx?.events || !Array.isArray(tx.events)) continue;
|
|
329
329
|
const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp) / 1000).toISOString() : null;
|
|
330
330
|
const txfersByKey = {};
|
|
331
331
|
for (const evt of tx.events)if ([
|
|
@@ -346,9 +346,9 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
346
346
|
transfers.push({
|
|
347
347
|
amount: BigInt(partial.amount),
|
|
348
348
|
blockNumber: parseInt(block.block_height),
|
|
349
|
-
from: partial.from,
|
|
349
|
+
from: partial.from?.length < 66 ? `0x0${partial.from?.slice(2)}` : partial.from,
|
|
350
350
|
timestamp: timestamp,
|
|
351
|
-
to: partial.to,
|
|
351
|
+
to: partial.to?.length < 66 ? `0x0${partial.to?.slice(2)}` : partial.to,
|
|
352
352
|
token: partial.tokenAddress,
|
|
353
353
|
tokenType: "NATIVE",
|
|
354
354
|
transactionGasFee: BigInt(tx.gas_used),
|
|
@@ -367,19 +367,18 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
367
367
|
const vout = tx.vout;
|
|
368
368
|
const fromVout = Math.min(vin.vout || 1000, vout.length - 1);
|
|
369
369
|
const fromAddress = vin.prevout?.scriptPubKey?.address || vout[fromVout]?.scriptPubKey?.address || vout[fromVout]?.scriptPubKey?.addresses?.[0];
|
|
370
|
-
if (!fromAddress)
|
|
370
|
+
if (!fromAddress) continue;
|
|
371
371
|
for (const v of vout)transfers.push({
|
|
372
372
|
amount: BigInt(Math.round(v.value * Math.pow(10, 8))),
|
|
373
373
|
blockNumber: block.height,
|
|
374
374
|
from: fromAddress,
|
|
375
375
|
timestamp: timestamp,
|
|
376
376
|
to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],
|
|
377
|
-
transactionGasFee: BigInt(tx.fee || 0) *
|
|
377
|
+
transactionGasFee: BigInt(Math.round((tx.fee || 0) * Math.pow(10, 8))),
|
|
378
378
|
transactionHash: tx.txid,
|
|
379
379
|
token: null,
|
|
380
380
|
tokenType: "NATIVE"
|
|
381
381
|
});
|
|
382
|
-
break;
|
|
383
382
|
}
|
|
384
383
|
break;
|
|
385
384
|
case "CARDANO":
|
|
@@ -391,7 +390,7 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
391
390
|
const transactionHash = typedTx.transaction_identifier?.hash || "";
|
|
392
391
|
const inputs = typedTx.operations.filter((op)=>op.type === "input");
|
|
393
392
|
const outputs = typedTx.operations.filter((op)=>op.type === "output");
|
|
394
|
-
if (!inputs.length && !outputs.length)
|
|
393
|
+
if (!inputs.length && !outputs.length) continue;
|
|
395
394
|
const fromAddress = inputs[0]?.account?.address;
|
|
396
395
|
if (!fromAddress) continue;
|
|
397
396
|
const sumInputs = inputs.reduce((acc, op)=>{
|
|
@@ -792,21 +791,21 @@ const $c18434deda90759d$var$tokenTransfersTemplate = {
|
|
|
792
791
|
{
|
|
793
792
|
params: {
|
|
794
793
|
network: "APTOS",
|
|
795
|
-
walletAddress: "
|
|
794
|
+
walletAddress: "0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e",
|
|
796
795
|
contractAddress: "0x1"
|
|
797
796
|
},
|
|
798
|
-
payload: "https://jiti.indexing.co/networks/aptos/
|
|
797
|
+
payload: "https://jiti.indexing.co/networks/aptos/297956660",
|
|
799
798
|
output: [
|
|
800
799
|
{
|
|
801
|
-
amount:
|
|
802
|
-
blockNumber:
|
|
803
|
-
from: "
|
|
804
|
-
timestamp: "
|
|
805
|
-
to: "
|
|
800
|
+
amount: 1502138836n,
|
|
801
|
+
blockNumber: 297956660,
|
|
802
|
+
from: "0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00",
|
|
803
|
+
timestamp: "2025-03-02T21:07:06.002Z",
|
|
804
|
+
to: "0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e",
|
|
806
805
|
token: null,
|
|
807
806
|
tokenType: "NATIVE",
|
|
808
|
-
transactionGasFee:
|
|
809
|
-
transactionHash: "
|
|
807
|
+
transactionGasFee: 13n,
|
|
808
|
+
transactionHash: "0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13"
|
|
810
809
|
}
|
|
811
810
|
]
|
|
812
811
|
},
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AEEA,MAAM,oCAAwB;IAC5B,KAAK;IACL,MAAM;IACN,aAAa;IACb,MAAM;QAAC;QAAO;KAAM;IACpB,UAAU;IACV,QAAQ,EAAE;IACV,WAAW,CAAC,UAAY;IACxB,OAAO;QACL;YACE,QAAQ,CAAC;YACT,SAAS;gBAAE,GAAG;gBAAK,GAAG;gBAAG,GAAG;oBAAE,GAAG;gBAAK;YAAE;YACxC,QAAQ;gBAAE,GAAG;gBAAK,GAAG;gBAAG,GAAG;oBAAE,GAAG;gBAAK;YAAE;QACzC;KACD;AACH;IAEA,2CAAe;;;;;;;;AGjBR,SAAS,0CAAqB,OAAe;IAClD,IAAI,CAAC,WAAW,CAAC,uBAAuB,IAAI,CAAC,UAC3C,OAAO;IAGT,MAAM,eAAe,QAAQ,KAAK,CAAC,GAAG,WAAW;IACjD,MAAM,aAAa,CAAA,GAAA,gBAAQ,EAAE;IAC7B,IAAI,kBAAkB;IAEtB,IAAK,IAAI,IAAI,GAAG,IAAI,aAAa,MAAM,EAAE,IACvC,mBAAmB,SAAS,UAAU,CAAC,EAAE,EAAE,OAAO,IAAI,YAAY,CAAC,EAAE,CAAC,WAAW,KAAK,YAAY,CAAC,EAAE;IAGvG,OAAO;AACT;;;;;;AChBA,MAAM,iCAAW;IACf,UAAU;IACV,WAAW;IACX,MAAM;IACN,cAAc;IACd,kBAAkB;IAClB,OAAO;IACP,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;IACP,UAAU;IACV,aAAa;IACb,aAAa;IACb,SAAS;IACT,iBAAiB;IACjB,MAAM;IACN,QAAQ;IACR,MAAM;IACN,KAAK;IACL,cAAc;I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AAS;gBACT,eAAe;gBACf,iBAAiB;YACnB;YACA,SAAS;YACT,QAAQ;gBACN;oBACE,aAAa;oBACb,MAAM;oBACN,IAAI;oBACJ,QAAQ,OAAO;oBACf,OAAO;oBACP,WAAW;oBACX,WAAW;oBACX,iBAAiB;oBACjB,mBAAmB,KAAK;gBAC1B;aACD;QACH;KACD;AACH;IAEA,2CAAe;;;AFl9BR,MAAM,4CAAY;IAAC,CAAA,GAAA,wCAAU;IAAG,CAAA,GAAA,wCAAqB;CAAE;;;;;;;ADC9D,MAAM,4CAAY,CAAA,GAAA,yCAAW,EAAE,MAAM,CAAC,CAAC,GAAG,IAAO,CAAA;QAAE,GAAG,CAAC;QAAE,CAAC,EAAE,GAAG,CAAC,EAAE,OAAO,MAAM,CAAC,CAAC,GAAG;IAAG,CAAA,GAAI,CAAC;AAIrF,SAAS;IACd,OAAO,CAAA,GAAA,yCAAW,EAAE,KAAK;AAC3B;AAEO,SAAS,0CAAiB,GAAW;IAC1C,OAAO,CAAA,GAAA,yCAAW,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,WAAa,SAAS,GAAG,KAAK;AAClE","sources":["src/index.ts","src/templates/index.ts","src/templates/raw.ts","src/templates/token-transfers.ts","src/utils/index.ts","src/utils/evm-address-to-checksum.ts","src/utils/evm-chain-to-id.ts","src/utils/evm-decode-log.ts","src/utils/evm-method-signature-to-hex.ts","src/utils/evm-normalize-raw-block.ts","src/types.ts"],"sourcesContent":["import { templates as templateList } from './templates';\nimport * as utils from './utils';\nimport * as types from './types';\n\nconst templates = templateList.reduce((a, b) => ({ ...a, [b.key]: Object.assign({}, b) }), {});\n\nexport { utils, templates, types };\n\nexport function getAllTemplates() {\n return templateList.slice();\n}\n\nexport function getTemplateByKey(key: string) {\n return templateList.slice().find((template) => template.key === key);\n}\n","import rawTemplate from './raw';\nimport tokenTransfersTemplate from './token-transfers';\n\nexport const templates = [rawTemplate, tokenTransfersTemplate];\n","import { Template } from '../types';\n\nconst rawTemplate: Template = {\n key: 'raw',\n name: 'Raw Block Data',\n description: 'Get all blocks with all available fields',\n tags: ['EVM', 'RAW'],\n disabled: true,\n params: [],\n transform: (payload) => payload,\n tests: [\n {\n params: {},\n payload: { a: 'b', c: 1, d: { e: true } },\n output: { a: 'b', c: 1, d: { e: true } },\n },\n ],\n};\n\nexport default rawTemplate;\n","import { evmDecodeLogWithMetadata } from '../utils';\nimport { Template } from '../types';\nimport { decodeTxRaw, Registry } from '@cosmjs/proto-signing';\nimport { defaultRegistryTypes as defaultStargateTypes, SigningStargateClient } from '@cosmjs/stargate';\n\ntype NetworkTransfer = {\n amount: number | bigint;\n blockNumber: number;\n from: string;\n index?: string;\n timestamp: string;\n to: string;\n token?: string;\n tokenId?: string;\n tokenType: 'NATIVE' | 'TOKEN' | 'NFT';\n transactionGasFee: bigint;\n transactionHash: string;\n};\n\nconst NULL_ADDRESS = '0x0000000000000000000000000000000000000000';\n\nconst tokenTransfersTemplate: Template = {\n key: 'token_transfers',\n name: 'Token Transfers',\n description: 'Get all token transfers for a set of token types.',\n tags: ['EVM', 'ERC20', 'ERC721', 'NFT', 'TOKEN'],\n disabled: false,\n params: [\n { key: 'network', name: 'Network', type: 'NETWORK', optional: false },\n { key: 'contractAddress', name: 'Contract Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n {\n key: 'tokenTypes',\n name: 'Token Types',\n type: 'STRING',\n multiple: true,\n optional: true,\n values: ['NATIVE', 'TOKEN', 'NFT'],\n },\n ],\n\n transform: (block, _ctx) => {\n const TOKEN_TYPES = (_ctx.params.tokenTypes as NetworkTransfer['tokenType'][]) || [];\n let transfers: NetworkTransfer[] = [];\n\n switch (block._network) {\n case 'APTOS':\n case 'APTOS_TESTNET': {\n for (const tx of block.transactions as Record<string, unknown>[]) {\n if (!tx?.events || !Array.isArray(tx.events)) {\n break;\n }\n\n const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp as string) / 1000).toISOString() : null;\n const txfersByKey: Record<string, Record<string, string>> = {};\n\n for (const evt of tx.events as Record<string, unknown>[]) {\n if (['0x1::coin::WithdrawEvent', '0x1::coin::DepositEvent'].includes(evt.type as string)) {\n const amount = (evt.data as Record<string, string>)?.amount;\n const key = `0x1-${amount}`;\n txfersByKey[key] ||= { amount, tokenAddress: null };\n if ((evt.type as string).endsWith('WithdrawEvent')) {\n txfersByKey[key].from = (evt.guid as Record<string, string>)?.account_address;\n } else {\n txfersByKey[key].to = (evt.guid as Record<string, string>)?.account_address;\n }\n }\n }\n\n for (const partial of Object.values(txfersByKey)) {\n if (!partial.from || !partial.to) continue;\n transfers.push({\n amount: BigInt(partial.amount),\n blockNumber: parseInt(block.block_height as string),\n from: partial.from,\n timestamp,\n to: partial.to,\n token: partial.tokenAddress,\n tokenType: 'NATIVE',\n transactionGasFee: BigInt(tx.gas_used as string),\n transactionHash: tx.hash as string,\n });\n }\n }\n break;\n }\n\n case 'BITCOIN':\n case 'BITCOIN_TESTNET':\n case 'LITCOIN': // @TODO\n case 'DOGECOIN': {\n for (const tx of block.tx as Record<string, unknown>[]) {\n const timestamp = tx.time ? new Date((tx.time as number) * 1000).toISOString() : null;\n const vin = tx.vin[0] as { prevout?: { scriptPubKey: { address: string } }; vout?: number };\n const vout = tx.vout as { value: number; scriptPubKey?: { address: string; addresses?: string[] } }[];\n\n const fromVout = Math.min(vin.vout || 1000, vout.length - 1);\n const fromAddress =\n vin.prevout?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.addresses?.[0];\n if (!fromAddress) {\n break;\n }\n\n for (const v of vout) {\n transfers.push({\n amount: BigInt(Math.round(v.value * Math.pow(10, 8))),\n blockNumber: block.height as number,\n from: fromAddress,\n timestamp,\n to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],\n transactionGasFee: BigInt((tx.fee as number) || 0) * BigInt(Math.pow(10, 8)),\n transactionHash: tx.txid as string,\n token: null,\n tokenType: 'NATIVE',\n });\n }\n\n break;\n }\n break;\n }\n\n case 'CARDANO': {\n const blockTimestamp = new Date((block.timestamp as number) * 1000).toISOString();\n\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n transaction_identifier?: { hash?: string };\n operations?: {\n type: string;\n account?: { address?: string };\n amount?: {\n value?: string;\n currency?: {\n symbol?: string;\n decimals?: number;\n };\n };\n }[];\n };\n\n if (!Array.isArray(typedTx.operations)) {\n continue;\n }\n\n const transactionHash = typedTx.transaction_identifier?.hash || '';\n\n const inputs = typedTx.operations.filter((op) => op.type === 'input');\n const outputs = typedTx.operations.filter((op) => op.type === 'output');\n\n if (!inputs.length && !outputs.length) {\n break;\n }\n\n const fromAddress = inputs[0]?.account?.address;\n if (!fromAddress) {\n continue;\n }\n\n const sumInputs = inputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n const sumOutputs = outputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n\n const transactionFee = sumInputs + BigInt(sumOutputs);\n\n for (const out of outputs) {\n const rawValue = out.amount?.value || '0';\n const absoluteValue = BigInt(rawValue);\n transfers.push({\n amount: absoluteValue < 0 ? -absoluteValue : absoluteValue,\n blockNumber: (block.block_identifier as { index: number }).index,\n from: fromAddress,\n timestamp: blockTimestamp,\n to: out.account?.address || '',\n token: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? null : out.amount?.currency?.symbol,\n tokenType: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: transactionFee < 0 ? -transactionFee : transactionFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'RIPPLE': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const rawTx of block.transactions) {\n const typedTx = rawTx as {\n Account?: string;\n Amount?: string | { currency: string; issuer: string; value: string };\n Destination?: string;\n Fee?: string;\n hash?: string;\n TransactionType?: string;\n date?: number;\n metaData?: {\n delivered_amount?: string | { currency: string; issuer: string; value: string };\n };\n };\n if (typedTx.TransactionType !== 'Payment') {\n continue;\n }\n const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? '0';\n let tokenSymbol = 'XRP';\n let tokenType: 'NATIVE' | 'TOKEN' | 'NFT' = 'NATIVE';\n\n let parsedAmount: bigint;\n\n if (typeof deliveredOrAmount === 'object') {\n tokenSymbol = deliveredOrAmount.currency?.toUpperCase() ?? 'UNKNOWN';\n tokenType = 'TOKEN';\n const floatVal = parseFloat(deliveredOrAmount.value);\n const smallestUnit = Math.round(floatVal * 1_000_000);\n parsedAmount = BigInt(smallestUnit);\n } else {\n parsedAmount = BigInt(String(deliveredOrAmount));\n }\n transfers.push({\n amount: parsedAmount,\n blockNumber: parseInt(block.ledger_index as string, 10),\n from: typedTx.Account ?? 'UNKNOWN',\n timestamp: block.close_time_iso ? (block.close_time_iso as string) : null,\n to: typedTx.Destination ?? 'UNKNOWN',\n token: tokenSymbol,\n tokenType: tokenType,\n transactionGasFee: BigInt(typedTx.Fee ?? '0'),\n transactionHash: typedTx.hash ?? '',\n });\n }\n\n break;\n }\n\n case 'SOLANA': {\n for (const tx of block.transactions as unknown[]) {\n const solanaTx = tx as {\n meta: {\n fee: number;\n postTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n preTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n postBalances: number[];\n preBalances: number[];\n };\n transaction: {\n message: { accountKeys: (string | { pubkey: string })[]; instructions: unknown[] };\n signatures: string[];\n };\n };\n const txHash = solanaTx.transaction.signatures[0];\n const timestamp = block.blockTime ? new Date((block.blockTime as number) * 1000).toISOString() : null;\n\n let txFee = BigInt(solanaTx.meta.fee);\n if (txFee < BigInt(10)) {\n txFee = txFee * BigInt(Math.pow(10, 9));\n }\n\n const transfersByKey: Record<string, NetworkTransfer> = {};\n for (const post of solanaTx.meta.postTokenBalances) {\n let matched = false;\n for (const pre of solanaTx.meta.preTokenBalances) {\n if (post.mint === pre.mint && post.owner === pre.owner) {\n let diff = BigInt(post.uiTokenAmount.amount) - BigInt(pre.uiTokenAmount.amount);\n if (diff === BigInt(0)) {\n continue;\n }\n if (diff < 0) {\n diff = -diff;\n }\n\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: pre.owner,\n timestamp,\n to: post.owner,\n transactionGasFee: txFee,\n transactionHash: txHash,\n token: post.mint,\n tokenType: 'TOKEN',\n };\n if (transfersByKey[key]) {\n if (diff > 0) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n matched = true;\n }\n }\n\n if (!matched) {\n let diff = BigInt(post.uiTokenAmount.amount);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: null,\n timestamp,\n to: post.owner,\n token: post.mint,\n tokenType: 'TOKEN',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n delete txfer.from;\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n for (let i = 1; i < solanaTx.meta.postBalances.length; i += 1) {\n const post = solanaTx.meta.postBalances[i];\n const pre = solanaTx.meta.preBalances[i];\n if (post !== undefined && pre !== undefined && post !== pre) {\n let diff = BigInt(post) - BigInt(pre);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `null-${diff.toString()}`;\n\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from:\n post > pre\n ? typeof solanaTx.transaction.message.accountKeys[0] === 'string'\n ? solanaTx.transaction.message.accountKeys[0]\n : (solanaTx.transaction.message.accountKeys[0] as { pubkey: string })?.pubkey\n : typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey,\n timestamp,\n to:\n typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey?.toString(),\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n if (transfersByKey[key]) {\n if (post > pre) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n transfers.push(...Object.values(transfersByKey));\n }\n break;\n }\n\n case 'STARKNET': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const tx of block.transactions) {\n const typedTx = tx as {\n transaction_hash: string;\n sender_address: string;\n receipt?: {\n actual_fee?: {\n amount?: string;\n unit?: string;\n };\n events?: {\n keys: string[];\n data: string[];\n }[];\n };\n timestamp?: number | string;\n data_availability?: Record<string, unknown>;\n };\n\n const timestamp = block.timestamp ? new Date((block.timestamp as number) * 1000).toISOString() : null;\n\n let transactionGasFee = BigInt(0);\n if (typedTx?.receipt?.actual_fee?.amount) {\n transactionGasFee = BigInt(typedTx.receipt.actual_fee.amount);\n }\n\n const transactionHash = typedTx.transaction_hash;\n\n if (!typedTx.receipt?.events) {\n continue;\n }\n\n for (const event of typedTx.receipt.events) {\n if (!event.keys.includes('0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9')) {\n continue;\n }\n if (event.data.length < 3) {\n continue;\n }\n\n const [from, to, amountHex] = event.data;\n const amount = BigInt(amountHex);\n\n transfers.push({\n amount,\n blockNumber: block.block_number as number,\n from,\n timestamp,\n to,\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'STELLAR': {\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n hash: string;\n created_at: string;\n fee_charged: string;\n operations: {\n type: string;\n from: string;\n to: string;\n amount: string;\n asset_type: string;\n asset_issuer: string;\n }[];\n };\n for (const op of typedTx.operations) {\n if (op.type === 'payment') {\n transfers.push({\n amount: BigInt(op.amount.replace('.', '')),\n blockNumber: block.sequence as number,\n from: op.from,\n timestamp: typedTx.created_at,\n to: op.to,\n token: op.asset_type === 'native' ? null : op.asset_issuer,\n tokenType: op.asset_type === 'native' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: BigInt(typedTx.fee_charged),\n transactionHash: typedTx.hash,\n });\n }\n }\n }\n break;\n }\n\n case 'SUI': {\n const blockNumber = block.sequence as number;\n const blockTimestamp = new Date(block.timestamp as number).toISOString();\n\n for (const tx of (block.transactions as any[]) || []) {\n const transactionHash = tx.digest as string;\n const transactionGasFee = BigInt((tx.gasFee as string) || '0');\n\n for (const bc of (tx.balanceChanges as any[]) || []) {\n transfers.push({\n blockNumber,\n from: tx.sender ? (tx.sender as string) : undefined,\n to: tx.receiver ? (tx.receiver as string) : undefined,\n amount: BigInt(bc.amount as string),\n token: bc.coinRepr as string,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee,\n });\n }\n }\n\n break;\n }\n\n case 'TON': {\n const blockNumber = block.seqno as number;\n const blockTimestamp = new Date((block.shards?.[0]?.gen_utime as number) * 1000).toISOString();\n\n for (const shard of (block.shards as any[]) || []) {\n for (const tx of (shard.transactions as any[]) || []) {\n const transactionLT = tx.transaction_id.lt as string;\n const transactionHash = tx.transaction_id.hash as string;\n const transactionFee = BigInt((tx.fee as string) || '0');\n\n const inVal = BigInt((tx.in_msg?.value as string) || '0');\n if (inVal > 0n) {\n transfers.push({\n blockNumber,\n from: tx.in_msg?.source?.account_address as string,\n to: tx.address?.account_address as string,\n amount: inVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n\n for (const outMsg of (tx.out_msgs as any[]) || []) {\n const outVal = BigInt((outMsg.value as string) || '0');\n if (outVal > 0n) {\n transfers.push({\n blockNumber,\n from: outMsg.source?.account_address as string,\n to: outMsg.destination?.account_address as string,\n amount: outVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n }\n }\n }\n\n break;\n }\n\n // attempt to introspect data types\n default: {\n // try Cosmos\n if (block.block) {\n const typedBlock = block as {\n block: { header: { height: string; time: string }; data: { txs?: string[] } };\n block_id: { hash: string };\n };\n\n const blockNumber = Number(typedBlock.block.header.height);\n const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();\n const blockHash = typedBlock.block_id.hash;\n\n for (const txRaw of typedBlock.block.data.txs || []) {\n const decoded = decodeTxRaw(new Uint8Array(Buffer.from(txRaw, 'base64')));\n const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || '0');\n\n const registry = new Registry(defaultStargateTypes);\n for (const message of decoded.body.messages) {\n if (\n ['/ibc.applications.transfer.v1.MsgTransfer', '/cosmos.bank.v1beta1.MsgSend'].includes(message.typeUrl)\n ) {\n const decodedMsg = registry.decode(message);\n transfers.push({\n blockNumber,\n from: decodedMsg.sender,\n to: decodedMsg.receiver,\n amount: BigInt(decodedMsg.token.amount),\n token: decodedMsg.token.denom,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash: blockHash,\n transactionGasFee,\n });\n }\n }\n }\n\n break;\n }\n\n // otherwise assume EVM\n for (const tx of block.transactions as any[]) {\n if (!tx.receipt) {\n continue;\n }\n\n const timestamp = new Date((block.timestamp as number) * 1000).toISOString();\n const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);\n\n // track direct ETH transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NATIVE')) {\n // pull from traces, if available\n if (Array.isArray(tx.traces)) {\n for (const trace of tx.traces.filter((t) => t.action)) {\n const action = trace.action as unknown as { from: string; to: string; value: string };\n if (!action?.value) continue;\n\n transfers.push({\n amount: BigInt(action.value),\n blockNumber: tx.blockNumber as number,\n from: action.from?.toLowerCase() || NULL_ADDRESS,\n index: trace.traceAddress?.join('-'),\n timestamp,\n to: action.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n } else if ((tx.value as string)?.length >= 3 || /\\d+/.test(tx.value as string)) {\n transfers.push({\n amount: BigInt(tx.value as string),\n blockNumber: tx.blockNumber as number,\n from: tx.from?.toLowerCase() || NULL_ADDRESS,\n timestamp,\n to: tx.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n\n // track ERC20 transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('TOKEN')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 value)',\n ]);\n if (txfer) {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenType: 'TOKEN',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n }\n\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NFT')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 indexed value)',\n 'TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)',\n 'TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)',\n ]);\n\n if (!txfer) continue;\n\n switch (txfer.metadata.name) {\n case 'Transfer': {\n transfers.push({\n amount: 1,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.value as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferSingle': {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.id as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferBatch': {\n for (let i = 0; i < (txfer.decoded.ids as bigint[]).length; i += 1) {\n transfers.push({\n amount: txfer.decoded.values[i] as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.ids[i] as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n break;\n }\n }\n }\n }\n }\n if (typeof _ctx.params.contractAddress === 'string') {\n _ctx.params.contractAddress = _ctx.params.contractAddress.toLowerCase();\n }\n if (typeof _ctx.params.walletAddress === 'string') {\n _ctx.params.walletAddress = _ctx.params.walletAddress.toLowerCase();\n }\n break;\n }\n }\n\n transfers = transfers.filter((txfer) => {\n if (txfer.amount <= BigInt(0)) {\n return false;\n }\n if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token && txfer.token) {\n return false;\n }\n if (_ctx.params.walletAddress && ![txfer.from, txfer.to].includes(_ctx.params.walletAddress as string)) {\n return false;\n }\n return true;\n });\n\n return transfers;\n },\n\n tests: [\n // APTOS\n {\n params: {\n network: 'APTOS',\n walletAddress: '0xb3589951a7d8579a2918a749260804047abc60438bf0738c4e67683e972b41cd',\n contractAddress: '0x1',\n },\n payload: 'https://jiti.indexing.co/networks/aptos/237372198',\n output: [\n {\n amount: 12776498n,\n blockNumber: 237372198,\n from: '0xb3589951a7d8579a2918a749260804047abc60438bf0738c4e67683e972b41cd',\n timestamp: '2024-10-10T16:59:34.414Z',\n to: '0x1f5d15c9a1330389bda239ed2f40d8d2a2ba446e7a48ee57483a047d5ed1aafe',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 507n,\n transactionHash: '0xbabaf20c07c80ace9f1f2f6539e0df6c57c9a6b24d5e62fa4989b46c0807d9bb',\n },\n ],\n },\n\n // BASE\n {\n params: {\n network: 'BASE',\n walletAddress: '0x4F80864cD68782144e3736626896990acAe15a11',\n contractAddress: '0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed',\n },\n payload: 'https://jiti.indexing.co/networks/base/23507423',\n output: [\n {\n amount: 1000000000000000000000n,\n blockNumber: 23507423,\n from: '0x053002b4b332b422733c9469ddf9990bb6235e3d',\n index: 536,\n timestamp: '2024-12-10T04:16:33.000Z',\n to: '0x4f80864cd68782144e3736626896990acae15a11',\n token: '0x4ed4e862860bed51a9570b96d89af5e1b0efefed',\n tokenType: 'TOKEN',\n transactionGasFee: 1192354854229n,\n transactionHash: '0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56',\n },\n ],\n },\n\n // DOGECOIN\n {\n params: {\n network: 'DOGECOIN',\n walletAddress: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/dogecoin/1000075',\n output: [\n {\n amount: 1008521000000n,\n blockNumber: 1000075,\n from: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n to: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 0n,\n transactionHash: '9873fe46ab29f61cefdec498b691af68e0ad29a7599c94f42d2d4e9a5d461dbe',\n timestamp: '2015-12-13T19:59:52.000Z',\n },\n ],\n },\n\n // CARDANO\n {\n params: {\n network: 'CARDANO',\n walletAddress:\n 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/cardano/11443286',\n output: [\n {\n amount: 1110000n,\n blockNumber: 11443286,\n from: 'addr1qymdv285few5tyqvya86rl97r9e608njs37shfew6l2nn473aw2pcnrcvfwfgg2dnew99m4tjj0apsu7232w2euzwpysndh0h3',\n timestamp: '+057068-01-19T05:23:20.000Z',\n to: 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 174257n,\n transactionHash: '261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309',\n },\n ],\n },\n\n // RIPPLE\n {\n params: {\n network: 'RIPPLE',\n walletAddress: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ripple/88104659',\n output: [\n {\n amount: 238n,\n blockNumber: 88104659,\n from: 'rMAGnTv4eMWktZnhKa5cHcDiY84ZiKUaQm',\n timestamp: '2024-05-19T22:18:52Z',\n to: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n token: 'XRP',\n tokenType: 'NATIVE',\n transactionGasFee: 15n,\n transactionHash: '03564E6109261CDE73FCC5062C2A0A70F365CB1A0F9408C065B60EC3E94E4DBF',\n },\n ],\n },\n\n // STELLAR\n {\n params: {\n network: 'STELLAR',\n walletAddress: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n contractAddress: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n },\n payload: 'https://jiti.indexing.co/networks/stellar/51720546',\n output: [\n {\n amount: 150000n,\n blockNumber: 51720546,\n from: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n timestamp: '2024-05-18T04:41:39Z',\n to: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n token: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n tokenType: 'TOKEN',\n transactionGasFee: 100n,\n transactionHash: '4fb2441210cbe87f5003abdfa86f03bafa54f789ed041feccbda0bd054297c4d',\n },\n ],\n },\n // STARKNET\n {\n params: {\n network: 'STARKNET',\n walletAddress: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/starknet/1149460',\n output: [\n {\n amount: 0x1c286f74458fc6n,\n blockNumber: 1149460,\n from: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n timestamp: '2025-02-13T17:36:52.000Z',\n to: '0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 7925758505095110n,\n transactionHash: '0x707203dba31f442ae9a5477e6a8906f3676effa0f1d3bb19cbbc14e1ddfe21',\n },\n ],\n },\n //SUI\n {\n params: {\n network: 'SUI',\n walletAddress: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/sui/112336044',\n output: [\n {\n blockNumber: 112336044,\n from: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n to: undefined,\n amount: 180772n,\n token: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:54.529Z',\n transactionHash: '336V3wP8cHDAnB1Aku3j6n9948i8FG5N1eVP6Ac68BaE',\n transactionGasFee: -4165572n,\n },\n ],\n },\n // TON\n {\n params: {\n network: 'TON',\n walletAddress: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ton/44919328',\n output: [\n {\n blockNumber: 44919328,\n from: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n to: 'EQCFTFAHOU3vFt2NiZhRD5dwuS0k7GS59vIg3WfCKwfaQGW2',\n amount: 10000000n,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:18.000Z',\n transactionHash: 'Vh5cWr2uvCsdhoouBQ+EiUcF54os9oqvh8A/62EroQc=',\n transactionGasFee: 2355233n,\n },\n ],\n },\n // COSMOS\n {\n params: {\n network: 'COSMOS',\n walletAddress: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n contractAddress: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n },\n payload: 'https://jiti.indexing.co/networks/cosmos/24419691',\n output: [\n {\n blockNumber: 24419691,\n from: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n to: 'noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv',\n amount: 500000n,\n token: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n tokenType: 'NATIVE',\n timestamp: '2025-02-14T21:48:22.809Z',\n transactionHash: 'DF5FB086E60EE2ADA3A842751337E06A40696D7983CC1C038ADE236B36ED8AEB',\n transactionGasFee: 4860n,\n },\n ],\n },\n ],\n};\n\nexport default tokenTransfersTemplate;\n","export * from './evm-address-to-checksum';\nexport * from './evm-chain-to-id';\nexport * from './evm-decode-log';\nexport * from './evm-method-signature-to-hex';\nexport * from './evm-normalize-raw-block';\n","import { keccak256 } from 'viem';\n\nexport function evmAddressToChecksum(address: string) {\n if (!address || !/^(0x)?[0-9a-f]{40}$/i.test(address)) {\n return null;\n }\n\n const stripAddress = address.slice(2).toLowerCase();\n const keccakHash = keccak256(stripAddress as `0x${string}`);\n let checksumAddress = '0x';\n\n for (let i = 0; i < stripAddress.length; i++) {\n checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i];\n }\n\n return checksumAddress;\n}\n","const CHAIN_ID = {\n ARBITRUM: 42161,\n AVALANCHE: 43114,\n BASE: 8453,\n BASE_SEPOLIA: 84532,\n BERACHAIN_BARTIO: 80084,\n BLAST: 81457,\n BSC: 56,\n CELO: 42220,\n CYBER: 7560,\n DEGEN: 666666666,\n ETHEREUM: 1,\n ETH_HOLESKY: 17000,\n ETH_SEPOLIA: 11155111,\n FRAXTAL: 252,\n FRAXTAL_SEPOLIA: 2522,\n FUSE: 122,\n GNOSIS: 100,\n GOLD: 4653,\n HAM: 5112,\n HEMI_TESTNET: 743111,\n LINEA: 59144,\n LINEA_SEPOLIA: 59141,\n LISK_SEPOLIA: 4202,\n LYRA: 957,\n LYRA_SEPOLIA: 901,\n MODE: 34443,\n MODE_SEPOLIA: 919,\n NEON: 245022934,\n OASIS_SAPPHIRE: 23294,\n OPTIMISM: 10,\n OP_SEPOLIA: 11155420,\n ORDERLY: 291,\n ORDERLY_SEPOLIA: 4460,\n PGN_SEPOLIA: 58008,\n POLYGON: 137,\n POLYGON_AMOY: 80002,\n POLYGON_ZKEVM: 1101,\n PUBLIC_GOODS_NETWORK: 424,\n SCROLL: 534352,\n SCROLL_SEPOLIA: 534351,\n STACK: 78225,\n SYNDICATE_FRAME_CHAIN: 5101,\n TRON: 728126428,\n ZER0: 543210,\n ZK_LINK: 810180,\n ZORA: 7777777,\n ZORA_SEPOLIA: 999999999,\n};\n\nexport function evmChainToId(chain: string) {\n return CHAIN_ID[chain?.toUpperCase()];\n}\n","import { decodeEventLog, parseAbi } from 'viem';\n\nimport { evmMethodSignatureToHex } from './evm-method-signature-to-hex';\n\ntype BasicLog = Record<string, unknown> & { address: string; topics: string[] };\ntype SignaturesToDecode = string | { addresses?: string[]; signature: string; topic0?: string };\n\nexport function evmDecodeLog(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): Record<string, unknown> {\n if (Array.isArray(signatures)) {\n for (const sig of signatures) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return decoded;\n }\n }\n\n return null;\n }\n\n if (typeof signatures !== 'string' && Array.isArray(signatures.addresses) && signatures.addresses.length) {\n const addresses = signatures.addresses.map((a) => a?.toLowerCase());\n if (!addresses.includes(log.address.toLowerCase())) {\n return null;\n }\n }\n\n let sig = (typeof signatures === 'string' ? signatures : signatures.signature).trim();\n if (!sig.startsWith('event ')) {\n sig = 'event ' + sig;\n }\n const topic0 = typeof signatures !== 'string' && signatures.topic0 ? signatures.topic0 : evmMethodSignatureToHex(sig);\n if ((sig.match(/ indexed /g)?.length || 0) === log.topics.length - 1) {\n if (log.topics[0] === topic0) {\n try {\n const result = decodeEventLog({\n abi: parseAbi([sig]),\n data: log.data as `0x${string}`,\n topics: log.topics as [],\n });\n return result.args as unknown as Record<string, unknown>;\n } catch (e) {\n // ignore this\n }\n }\n }\n\n return null;\n}\n\nexport function evmDecodeLogWithMetadata(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): { decoded: Record<string, unknown>; metadata: { name: string } } {\n for (const sig of [signatures].flat()) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return {\n decoded,\n metadata: {\n name: (typeof sig === 'string' ? sig : sig.signature).split('(')[0],\n },\n };\n }\n }\n\n return null;\n}\n","import { keccak256 } from 'viem';\n\nexport function evmMethodSignatureToHex(sig: string): string {\n const [method, rest] = sig.split('(');\n const params = rest\n .split(')')[0]\n .split(',')\n .map((p) => p.trim());\n const topic0 = keccak256(\n `${method.split(' ').pop()}(${params.map((p) => p.split(' ')[0]).join(',')})` as `0x${string}`\n );\n return topic0;\n}\n","import { evmAddressToChecksum } from './evm-address-to-checksum';\n\nexport function normalizeEVMBlock(rawBlock: Record<string, unknown>): Record<string, unknown> {\n for (const k of ['baseFeePerGas', 'gasLimit', 'gasUsed', 'number', 'size', 'timestamp']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = parseInt(rawBlock[k] as string);\n }\n }\n\n for (const k of ['difficulty', 'totalDifficulty']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = BigInt(rawBlock[k] as string).toString();\n }\n }\n for (const k of ['miner']) {\n rawBlock[k] = evmAddressToChecksum(rawBlock[k] as string);\n }\n\n rawBlock.transactions = (\n rawBlock.transactions as { receipt: Record<string, unknown>; traces: Record<string, unknown>[] } & Record<\n string,\n unknown\n >[]\n ).map((tx) => {\n for (const k of [\n 'blockNumber',\n 'cumulativeGasUsed',\n 'effectiveGasPrice',\n 'gas',\n 'gasUsed',\n 'nonce',\n 'status',\n 'transactionIndex',\n ]) {\n if (typeof tx[k] === 'string') {\n tx[k] = parseInt(tx[k] as string);\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = parseInt(tx.receipt[k] as string);\n }\n }\n\n for (const k of ['gasPrice', 'maxFeePerGas', 'maxPriorityFeePerGas', 'value']) {\n if (typeof tx[k] === 'string') {\n tx[k] = BigInt(tx[k] as string).toString();\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = BigInt(tx.receipt[k] as string).toString();\n }\n }\n\n for (const k of ['from', 'to']) {\n if (typeof tx[k] === 'string') {\n tx[k] = evmAddressToChecksum(tx[k] as string);\n }\n }\n for (const k of ['contractAddress']) {\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = evmAddressToChecksum(tx.receipt[k] as string);\n }\n }\n\n tx.type = parseInt(tx.type as string);\n tx.receipt['status'] = Boolean(tx.receipt['status'] as string);\n\n tx.receipt['logs'] = (tx.receipt['logs'] as Record<string, unknown>[])?.map((log) => {\n for (const k of ['blockNumber', 'logIndex', 'transactionIndex']) {\n if (typeof log[k] === 'string') {\n log[k] = parseInt(log[k] as string);\n }\n }\n log['address'] = evmAddressToChecksum(log['address'] as string);\n return log;\n });\n\n return tx;\n });\n\n return rawBlock;\n}\n","export type Template = {\n key: string;\n name: string;\n description: string;\n disabled: boolean;\n tags: string[];\n params: Param[];\n transform: (\n payload: Record<string, unknown>,\n _ctx?: Record<string, unknown> & { params: Record<string, unknown> }\n ) => unknown;\n tests: TemplateTest[];\n};\n\nexport type Param = {\n key: string;\n name: string;\n type: 'NETWORK' | 'ADDRESS' | 'STRING' | 'NUMBER' | 'BOOLEAN';\n multiple?: boolean;\n optional?: boolean;\n values?: string[];\n default?: string;\n};\n\nexport type TemplateTest = {\n params: Record<string, unknown>;\n payload: `https://${string}` | Record<string, unknown>;\n output: unknown;\n};\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AEEA,MAAM,oCAAwB;IAC5B,KAAK;IACL,MAAM;IACN,aAAa;IACb,MAAM;QAAC;QAAO;KAAM;IACpB,UAAU;IACV,QAAQ,EAAE;IACV,WAAW,CAAC,UAAY;IACxB,OAAO;QACL;YACE,QAAQ,CAAC;YACT,SAAS;gBAAE,GAAG;gBAAK,GAAG;gBAAG,GAAG;oBAAE,GAAG;gBAAK;YAAE;YACxC,QAAQ;gBAAE,GAAG;gBAAK,GAAG;gBAAG,GAAG;oBAAE,GAAG;gBAAK;YAAE;QACzC;KACD;AACH;IAEA,2CAAe;;;;;;;;AGjBR,SA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AC,GAAG,IAAO,CAAA;QAAE,GAAG,CAAC;QAAE,CAAC,EAAE,GAAG,CAAC,EAAE,OAAO,MAAM,CAAC,CAAC,GAAG;IAAG,CAAA,GAAI,CAAC;AAIrF,SAAS;IACd,OAAO,CAAA,GAAA,yCAAW,EAAE,KAAK;AAC3B;AAEO,SAAS,0CAAiB,GAAW;IAC1C,OAAO,CAAA,GAAA,yCAAW,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,WAAa,SAAS,GAAG,KAAK;AAClE","sources":["src/index.ts","src/templates/index.ts","src/templates/raw.ts","src/templates/token-transfers.ts","src/utils/index.ts","src/utils/evm-address-to-checksum.ts","src/utils/evm-chain-to-id.ts","src/utils/evm-decode-log.ts","src/utils/evm-method-signature-to-hex.ts","src/utils/evm-normalize-raw-block.ts","src/types.ts"],"sourcesContent":["import { templates as templateList } from './templates';\nimport * as utils from './utils';\nimport * as types from './types';\n\nconst templates = templateList.reduce((a, b) => ({ ...a, [b.key]: Object.assign({}, b) }), {});\n\nexport { utils, templates, types };\n\nexport function getAllTemplates() {\n return templateList.slice();\n}\n\nexport function getTemplateByKey(key: string) {\n return templateList.slice().find((template) => template.key === key);\n}\n","import rawTemplate from './raw';\nimport tokenTransfersTemplate from './token-transfers';\n\nexport const templates = [rawTemplate, tokenTransfersTemplate];\n","import { Template } from '../types';\n\nconst rawTemplate: Template = {\n key: 'raw',\n name: 'Raw Block Data',\n description: 'Get all blocks with all available fields',\n tags: ['EVM', 'RAW'],\n disabled: true,\n params: [],\n transform: (payload) => payload,\n tests: [\n {\n params: {},\n payload: { a: 'b', c: 1, d: { e: true } },\n output: { a: 'b', c: 1, d: { e: true } },\n },\n ],\n};\n\nexport default rawTemplate;\n","import { evmDecodeLogWithMetadata } from '../utils';\nimport { Template } from '../types';\nimport { decodeTxRaw, Registry } from '@cosmjs/proto-signing';\nimport { defaultRegistryTypes as defaultStargateTypes, SigningStargateClient } from '@cosmjs/stargate';\n\ntype NetworkTransfer = {\n amount: number | bigint;\n blockNumber: number;\n from: string;\n index?: string;\n timestamp: string;\n to: string;\n token?: string;\n tokenId?: string;\n tokenType: 'NATIVE' | 'TOKEN' | 'NFT';\n transactionGasFee: bigint;\n transactionHash: string;\n};\n\nconst NULL_ADDRESS = '0x0000000000000000000000000000000000000000';\n\nconst tokenTransfersTemplate: Template = {\n key: 'token_transfers',\n name: 'Token Transfers',\n description: 'Get all token transfers for a set of token types.',\n tags: ['EVM', 'ERC20', 'ERC721', 'NFT', 'TOKEN'],\n disabled: false,\n params: [\n { key: 'network', name: 'Network', type: 'NETWORK', optional: false },\n { key: 'contractAddress', name: 'Contract Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n {\n key: 'tokenTypes',\n name: 'Token Types',\n type: 'STRING',\n multiple: true,\n optional: true,\n values: ['NATIVE', 'TOKEN', 'NFT'],\n },\n ],\n\n transform: (block, _ctx) => {\n const TOKEN_TYPES = (_ctx.params.tokenTypes as NetworkTransfer['tokenType'][]) || [];\n let transfers: NetworkTransfer[] = [];\n\n switch (block._network) {\n case 'APTOS':\n case 'APTOS_TESTNET': {\n for (const tx of block.transactions as Record<string, unknown>[]) {\n if (!tx?.events || !Array.isArray(tx.events)) {\n continue;\n }\n\n const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp as string) / 1000).toISOString() : null;\n const txfersByKey: Record<string, Record<string, string>> = {};\n\n for (const evt of tx.events as Record<string, unknown>[]) {\n if (['0x1::coin::WithdrawEvent', '0x1::coin::DepositEvent'].includes(evt.type as string)) {\n const amount = (evt.data as Record<string, string>)?.amount;\n const key = `0x1-${amount}`;\n txfersByKey[key] ||= { amount, tokenAddress: null };\n if ((evt.type as string).endsWith('WithdrawEvent')) {\n txfersByKey[key].from = (evt.guid as Record<string, string>)?.account_address;\n } else {\n txfersByKey[key].to = (evt.guid as Record<string, string>)?.account_address;\n }\n }\n }\n\n for (const partial of Object.values(txfersByKey)) {\n if (!partial.from || !partial.to) continue;\n transfers.push({\n amount: BigInt(partial.amount),\n blockNumber: parseInt(block.block_height as string),\n from: partial.from?.length < 66 ? `0x0${partial.from?.slice(2)}` : partial.from,\n timestamp,\n to: partial.to?.length < 66 ? `0x0${partial.to?.slice(2)}` : partial.to,\n token: partial.tokenAddress,\n tokenType: 'NATIVE',\n transactionGasFee: BigInt(tx.gas_used as string),\n transactionHash: tx.hash as string,\n });\n }\n }\n break;\n }\n\n case 'BITCOIN':\n case 'BITCOIN_TESTNET':\n case 'LITCOIN': // @TODO\n case 'DOGECOIN': {\n for (const tx of block.tx as Record<string, unknown>[]) {\n const timestamp = tx.time ? new Date((tx.time as number) * 1000).toISOString() : null;\n const vin = tx.vin[0] as { prevout?: { scriptPubKey: { address: string } }; vout?: number };\n const vout = tx.vout as { value: number; scriptPubKey?: { address: string; addresses?: string[] } }[];\n\n const fromVout = Math.min(vin.vout || 1000, vout.length - 1);\n const fromAddress =\n vin.prevout?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.addresses?.[0];\n if (!fromAddress) {\n continue;\n }\n\n for (const v of vout) {\n transfers.push({\n amount: BigInt(Math.round(v.value * Math.pow(10, 8))),\n blockNumber: block.height as number,\n from: fromAddress,\n timestamp,\n to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],\n transactionGasFee: BigInt(Math.round(((tx.fee as number) || 0) * Math.pow(10, 8))),\n transactionHash: tx.txid as string,\n token: null,\n tokenType: 'NATIVE',\n });\n }\n }\n break;\n }\n\n case 'CARDANO': {\n const blockTimestamp = new Date((block.timestamp as number) * 1000).toISOString();\n\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n transaction_identifier?: { hash?: string };\n operations?: {\n type: string;\n account?: { address?: string };\n amount?: {\n value?: string;\n currency?: {\n symbol?: string;\n decimals?: number;\n };\n };\n }[];\n };\n\n if (!Array.isArray(typedTx.operations)) {\n continue;\n }\n\n const transactionHash = typedTx.transaction_identifier?.hash || '';\n\n const inputs = typedTx.operations.filter((op) => op.type === 'input');\n const outputs = typedTx.operations.filter((op) => op.type === 'output');\n\n if (!inputs.length && !outputs.length) {\n continue;\n }\n\n const fromAddress = inputs[0]?.account?.address;\n if (!fromAddress) {\n continue;\n }\n\n const sumInputs = inputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n const sumOutputs = outputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n\n const transactionFee = sumInputs + BigInt(sumOutputs);\n\n for (const out of outputs) {\n const rawValue = out.amount?.value || '0';\n const absoluteValue = BigInt(rawValue);\n transfers.push({\n amount: absoluteValue < 0 ? -absoluteValue : absoluteValue,\n blockNumber: (block.block_identifier as { index: number }).index,\n from: fromAddress,\n timestamp: blockTimestamp,\n to: out.account?.address || '',\n token: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? null : out.amount?.currency?.symbol,\n tokenType: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: transactionFee < 0 ? -transactionFee : transactionFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'RIPPLE': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const rawTx of block.transactions) {\n const typedTx = rawTx as {\n Account?: string;\n Amount?: string | { currency: string; issuer: string; value: string };\n Destination?: string;\n Fee?: string;\n hash?: string;\n TransactionType?: string;\n date?: number;\n metaData?: {\n delivered_amount?: string | { currency: string; issuer: string; value: string };\n };\n };\n if (typedTx.TransactionType !== 'Payment') {\n continue;\n }\n const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? '0';\n let tokenSymbol = 'XRP';\n let tokenType: 'NATIVE' | 'TOKEN' | 'NFT' = 'NATIVE';\n\n let parsedAmount: bigint;\n\n if (typeof deliveredOrAmount === 'object') {\n tokenSymbol = deliveredOrAmount.currency?.toUpperCase() ?? 'UNKNOWN';\n tokenType = 'TOKEN';\n const floatVal = parseFloat(deliveredOrAmount.value);\n const smallestUnit = Math.round(floatVal * 1_000_000);\n parsedAmount = BigInt(smallestUnit);\n } else {\n parsedAmount = BigInt(String(deliveredOrAmount));\n }\n transfers.push({\n amount: parsedAmount,\n blockNumber: parseInt(block.ledger_index as string, 10),\n from: typedTx.Account ?? 'UNKNOWN',\n timestamp: block.close_time_iso ? (block.close_time_iso as string) : null,\n to: typedTx.Destination ?? 'UNKNOWN',\n token: tokenSymbol,\n tokenType: tokenType,\n transactionGasFee: BigInt(typedTx.Fee ?? '0'),\n transactionHash: typedTx.hash ?? '',\n });\n }\n\n break;\n }\n\n case 'SOLANA': {\n for (const tx of block.transactions as unknown[]) {\n const solanaTx = tx as {\n meta: {\n fee: number;\n postTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n preTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n postBalances: number[];\n preBalances: number[];\n };\n transaction: {\n message: { accountKeys: (string | { pubkey: string })[]; instructions: unknown[] };\n signatures: string[];\n };\n };\n const txHash = solanaTx.transaction.signatures[0];\n const timestamp = block.blockTime ? new Date((block.blockTime as number) * 1000).toISOString() : null;\n\n let txFee = BigInt(solanaTx.meta.fee);\n if (txFee < BigInt(10)) {\n txFee = txFee * BigInt(Math.pow(10, 9));\n }\n\n const transfersByKey: Record<string, NetworkTransfer> = {};\n for (const post of solanaTx.meta.postTokenBalances) {\n let matched = false;\n for (const pre of solanaTx.meta.preTokenBalances) {\n if (post.mint === pre.mint && post.owner === pre.owner) {\n let diff = BigInt(post.uiTokenAmount.amount) - BigInt(pre.uiTokenAmount.amount);\n if (diff === BigInt(0)) {\n continue;\n }\n if (diff < 0) {\n diff = -diff;\n }\n\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: pre.owner,\n timestamp,\n to: post.owner,\n transactionGasFee: txFee,\n transactionHash: txHash,\n token: post.mint,\n tokenType: 'TOKEN',\n };\n if (transfersByKey[key]) {\n if (diff > 0) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n matched = true;\n }\n }\n\n if (!matched) {\n let diff = BigInt(post.uiTokenAmount.amount);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: null,\n timestamp,\n to: post.owner,\n token: post.mint,\n tokenType: 'TOKEN',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n delete txfer.from;\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n for (let i = 1; i < solanaTx.meta.postBalances.length; i += 1) {\n const post = solanaTx.meta.postBalances[i];\n const pre = solanaTx.meta.preBalances[i];\n if (post !== undefined && pre !== undefined && post !== pre) {\n let diff = BigInt(post) - BigInt(pre);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `null-${diff.toString()}`;\n\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from:\n post > pre\n ? typeof solanaTx.transaction.message.accountKeys[0] === 'string'\n ? solanaTx.transaction.message.accountKeys[0]\n : (solanaTx.transaction.message.accountKeys[0] as { pubkey: string })?.pubkey\n : typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey,\n timestamp,\n to:\n typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey?.toString(),\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n if (transfersByKey[key]) {\n if (post > pre) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n transfers.push(...Object.values(transfersByKey));\n }\n break;\n }\n\n case 'STARKNET': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const tx of block.transactions) {\n const typedTx = tx as {\n transaction_hash: string;\n sender_address: string;\n receipt?: {\n actual_fee?: {\n amount?: string;\n unit?: string;\n };\n events?: {\n keys: string[];\n data: string[];\n }[];\n };\n timestamp?: number | string;\n data_availability?: Record<string, unknown>;\n };\n\n const timestamp = block.timestamp ? new Date((block.timestamp as number) * 1000).toISOString() : null;\n\n let transactionGasFee = BigInt(0);\n if (typedTx?.receipt?.actual_fee?.amount) {\n transactionGasFee = BigInt(typedTx.receipt.actual_fee.amount);\n }\n\n const transactionHash = typedTx.transaction_hash;\n\n if (!typedTx.receipt?.events) {\n continue;\n }\n\n for (const event of typedTx.receipt.events) {\n if (!event.keys.includes('0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9')) {\n continue;\n }\n if (event.data.length < 3) {\n continue;\n }\n\n const [from, to, amountHex] = event.data;\n const amount = BigInt(amountHex);\n\n transfers.push({\n amount,\n blockNumber: block.block_number as number,\n from,\n timestamp,\n to,\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'STELLAR': {\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n hash: string;\n created_at: string;\n fee_charged: string;\n operations: {\n type: string;\n from: string;\n to: string;\n amount: string;\n asset_type: string;\n asset_issuer: string;\n }[];\n };\n for (const op of typedTx.operations) {\n if (op.type === 'payment') {\n transfers.push({\n amount: BigInt(op.amount.replace('.', '')),\n blockNumber: block.sequence as number,\n from: op.from,\n timestamp: typedTx.created_at,\n to: op.to,\n token: op.asset_type === 'native' ? null : op.asset_issuer,\n tokenType: op.asset_type === 'native' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: BigInt(typedTx.fee_charged),\n transactionHash: typedTx.hash,\n });\n }\n }\n }\n break;\n }\n\n case 'SUI': {\n const blockNumber = block.sequence as number;\n const blockTimestamp = new Date(block.timestamp as number).toISOString();\n\n for (const tx of (block.transactions as any[]) || []) {\n const transactionHash = tx.digest as string;\n const transactionGasFee = BigInt((tx.gasFee as string) || '0');\n\n for (const bc of (tx.balanceChanges as any[]) || []) {\n transfers.push({\n blockNumber,\n from: tx.sender ? (tx.sender as string) : undefined,\n to: tx.receiver ? (tx.receiver as string) : undefined,\n amount: BigInt(bc.amount as string),\n token: bc.coinRepr as string,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee,\n });\n }\n }\n\n break;\n }\n\n case 'TON': {\n const blockNumber = block.seqno as number;\n const blockTimestamp = new Date((block.shards?.[0]?.gen_utime as number) * 1000).toISOString();\n\n for (const shard of (block.shards as any[]) || []) {\n for (const tx of (shard.transactions as any[]) || []) {\n const transactionLT = tx.transaction_id.lt as string;\n const transactionHash = tx.transaction_id.hash as string;\n const transactionFee = BigInt((tx.fee as string) || '0');\n\n const inVal = BigInt((tx.in_msg?.value as string) || '0');\n if (inVal > 0n) {\n transfers.push({\n blockNumber,\n from: tx.in_msg?.source?.account_address as string,\n to: tx.address?.account_address as string,\n amount: inVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n\n for (const outMsg of (tx.out_msgs as any[]) || []) {\n const outVal = BigInt((outMsg.value as string) || '0');\n if (outVal > 0n) {\n transfers.push({\n blockNumber,\n from: outMsg.source?.account_address as string,\n to: outMsg.destination?.account_address as string,\n amount: outVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n }\n }\n }\n\n break;\n }\n\n // attempt to introspect data types\n default: {\n // try Cosmos\n if (block.block) {\n const typedBlock = block as {\n block: { header: { height: string; time: string }; data: { txs?: string[] } };\n block_id: { hash: string };\n };\n\n const blockNumber = Number(typedBlock.block.header.height);\n const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();\n const blockHash = typedBlock.block_id.hash;\n\n for (const txRaw of typedBlock.block.data.txs || []) {\n const decoded = decodeTxRaw(new Uint8Array(Buffer.from(txRaw, 'base64')));\n const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || '0');\n\n const registry = new Registry(defaultStargateTypes);\n for (const message of decoded.body.messages) {\n if (\n ['/ibc.applications.transfer.v1.MsgTransfer', '/cosmos.bank.v1beta1.MsgSend'].includes(message.typeUrl)\n ) {\n const decodedMsg = registry.decode(message);\n transfers.push({\n blockNumber,\n from: decodedMsg.sender,\n to: decodedMsg.receiver,\n amount: BigInt(decodedMsg.token.amount),\n token: decodedMsg.token.denom,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash: blockHash,\n transactionGasFee,\n });\n }\n }\n }\n\n break;\n }\n\n // otherwise assume EVM\n for (const tx of block.transactions as any[]) {\n if (!tx.receipt) {\n continue;\n }\n\n const timestamp = new Date((block.timestamp as number) * 1000).toISOString();\n const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);\n\n // track direct ETH transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NATIVE')) {\n // pull from traces, if available\n if (Array.isArray(tx.traces)) {\n for (const trace of tx.traces.filter((t) => t.action)) {\n const action = trace.action as unknown as { from: string; to: string; value: string };\n if (!action?.value) continue;\n\n transfers.push({\n amount: BigInt(action.value),\n blockNumber: tx.blockNumber as number,\n from: action.from?.toLowerCase() || NULL_ADDRESS,\n index: trace.traceAddress?.join('-'),\n timestamp,\n to: action.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n } else if ((tx.value as string)?.length >= 3 || /\\d+/.test(tx.value as string)) {\n transfers.push({\n amount: BigInt(tx.value as string),\n blockNumber: tx.blockNumber as number,\n from: tx.from?.toLowerCase() || NULL_ADDRESS,\n timestamp,\n to: tx.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n\n // track ERC20 transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('TOKEN')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 value)',\n ]);\n if (txfer) {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenType: 'TOKEN',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n }\n\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NFT')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 indexed value)',\n 'TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)',\n 'TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)',\n ]);\n\n if (!txfer) continue;\n\n switch (txfer.metadata.name) {\n case 'Transfer': {\n transfers.push({\n amount: 1,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.value as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferSingle': {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.id as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferBatch': {\n for (let i = 0; i < (txfer.decoded.ids as bigint[]).length; i += 1) {\n transfers.push({\n amount: txfer.decoded.values[i] as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.ids[i] as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n break;\n }\n }\n }\n }\n }\n if (typeof _ctx.params.contractAddress === 'string') {\n _ctx.params.contractAddress = _ctx.params.contractAddress.toLowerCase();\n }\n if (typeof _ctx.params.walletAddress === 'string') {\n _ctx.params.walletAddress = _ctx.params.walletAddress.toLowerCase();\n }\n break;\n }\n }\n\n transfers = transfers.filter((txfer) => {\n if (txfer.amount <= BigInt(0)) {\n return false;\n }\n if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token && txfer.token) {\n return false;\n }\n if (_ctx.params.walletAddress && ![txfer.from, txfer.to].includes(_ctx.params.walletAddress as string)) {\n return false;\n }\n return true;\n });\n\n return transfers;\n },\n\n tests: [\n // APTOS\n {\n params: {\n network: 'APTOS',\n walletAddress: '0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e',\n contractAddress: '0x1',\n },\n payload: 'https://jiti.indexing.co/networks/aptos/297956660',\n output: [\n {\n amount: 1502138836n,\n blockNumber: 297956660,\n from: '0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00',\n timestamp: '2025-03-02T21:07:06.002Z',\n to: '0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 13n,\n transactionHash: '0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13',\n },\n ],\n },\n\n // BASE\n {\n params: {\n network: 'BASE',\n walletAddress: '0x4F80864cD68782144e3736626896990acAe15a11',\n contractAddress: '0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed',\n },\n payload: 'https://jiti.indexing.co/networks/base/23507423',\n output: [\n {\n amount: 1000000000000000000000n,\n blockNumber: 23507423,\n from: '0x053002b4b332b422733c9469ddf9990bb6235e3d',\n index: 536,\n timestamp: '2024-12-10T04:16:33.000Z',\n to: '0x4f80864cd68782144e3736626896990acae15a11',\n token: '0x4ed4e862860bed51a9570b96d89af5e1b0efefed',\n tokenType: 'TOKEN',\n transactionGasFee: 1192354854229n,\n transactionHash: '0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56',\n },\n ],\n },\n\n // DOGECOIN\n {\n params: {\n network: 'DOGECOIN',\n walletAddress: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/dogecoin/1000075',\n output: [\n {\n amount: 1008521000000n,\n blockNumber: 1000075,\n from: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n to: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 0n,\n transactionHash: '9873fe46ab29f61cefdec498b691af68e0ad29a7599c94f42d2d4e9a5d461dbe',\n timestamp: '2015-12-13T19:59:52.000Z',\n },\n ],\n },\n\n // CARDANO\n {\n params: {\n network: 'CARDANO',\n walletAddress:\n 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/cardano/11443286',\n output: [\n {\n amount: 1110000n,\n blockNumber: 11443286,\n from: 'addr1qymdv285few5tyqvya86rl97r9e608njs37shfew6l2nn473aw2pcnrcvfwfgg2dnew99m4tjj0apsu7232w2euzwpysndh0h3',\n timestamp: '+057068-01-19T05:23:20.000Z',\n to: 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 174257n,\n transactionHash: '261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309',\n },\n ],\n },\n\n // RIPPLE\n {\n params: {\n network: 'RIPPLE',\n walletAddress: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ripple/88104659',\n output: [\n {\n amount: 238n,\n blockNumber: 88104659,\n from: 'rMAGnTv4eMWktZnhKa5cHcDiY84ZiKUaQm',\n timestamp: '2024-05-19T22:18:52Z',\n to: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n token: 'XRP',\n tokenType: 'NATIVE',\n transactionGasFee: 15n,\n transactionHash: '03564E6109261CDE73FCC5062C2A0A70F365CB1A0F9408C065B60EC3E94E4DBF',\n },\n ],\n },\n\n // STELLAR\n {\n params: {\n network: 'STELLAR',\n walletAddress: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n contractAddress: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n },\n payload: 'https://jiti.indexing.co/networks/stellar/51720546',\n output: [\n {\n amount: 150000n,\n blockNumber: 51720546,\n from: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n timestamp: '2024-05-18T04:41:39Z',\n to: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n token: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n tokenType: 'TOKEN',\n transactionGasFee: 100n,\n transactionHash: '4fb2441210cbe87f5003abdfa86f03bafa54f789ed041feccbda0bd054297c4d',\n },\n ],\n },\n // STARKNET\n {\n params: {\n network: 'STARKNET',\n walletAddress: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/starknet/1149460',\n output: [\n {\n amount: 0x1c286f74458fc6n,\n blockNumber: 1149460,\n from: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n timestamp: '2025-02-13T17:36:52.000Z',\n to: '0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 7925758505095110n,\n transactionHash: '0x707203dba31f442ae9a5477e6a8906f3676effa0f1d3bb19cbbc14e1ddfe21',\n },\n ],\n },\n //SUI\n {\n params: {\n network: 'SUI',\n walletAddress: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/sui/112336044',\n output: [\n {\n blockNumber: 112336044,\n from: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n to: undefined,\n amount: 180772n,\n token: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:54.529Z',\n transactionHash: '336V3wP8cHDAnB1Aku3j6n9948i8FG5N1eVP6Ac68BaE',\n transactionGasFee: -4165572n,\n },\n ],\n },\n // TON\n {\n params: {\n network: 'TON',\n walletAddress: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ton/44919328',\n output: [\n {\n blockNumber: 44919328,\n from: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n to: 'EQCFTFAHOU3vFt2NiZhRD5dwuS0k7GS59vIg3WfCKwfaQGW2',\n amount: 10000000n,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:18.000Z',\n transactionHash: 'Vh5cWr2uvCsdhoouBQ+EiUcF54os9oqvh8A/62EroQc=',\n transactionGasFee: 2355233n,\n },\n ],\n },\n // COSMOS\n {\n params: {\n network: 'COSMOS',\n walletAddress: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n contractAddress: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n },\n payload: 'https://jiti.indexing.co/networks/cosmos/24419691',\n output: [\n {\n blockNumber: 24419691,\n from: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n to: 'noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv',\n amount: 500000n,\n token: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n tokenType: 'NATIVE',\n timestamp: '2025-02-14T21:48:22.809Z',\n transactionHash: 'DF5FB086E60EE2ADA3A842751337E06A40696D7983CC1C038ADE236B36ED8AEB',\n transactionGasFee: 4860n,\n },\n ],\n },\n ],\n};\n\nexport default tokenTransfersTemplate;\n","export * from './evm-address-to-checksum';\nexport * from './evm-chain-to-id';\nexport * from './evm-decode-log';\nexport * from './evm-method-signature-to-hex';\nexport * from './evm-normalize-raw-block';\n","import { keccak256 } from 'viem';\n\nexport function evmAddressToChecksum(address: string) {\n if (!address || !/^(0x)?[0-9a-f]{40}$/i.test(address)) {\n return null;\n }\n\n const stripAddress = address.slice(2).toLowerCase();\n const keccakHash = keccak256(stripAddress as `0x${string}`);\n let checksumAddress = '0x';\n\n for (let i = 0; i < stripAddress.length; i++) {\n checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i];\n }\n\n return checksumAddress;\n}\n","const CHAIN_ID = {\n ARBITRUM: 42161,\n AVALANCHE: 43114,\n BASE: 8453,\n BASE_SEPOLIA: 84532,\n BERACHAIN_BARTIO: 80084,\n BLAST: 81457,\n BSC: 56,\n CELO: 42220,\n CYBER: 7560,\n DEGEN: 666666666,\n ETHEREUM: 1,\n ETH_HOLESKY: 17000,\n ETH_SEPOLIA: 11155111,\n FRAXTAL: 252,\n FRAXTAL_SEPOLIA: 2522,\n FUSE: 122,\n GNOSIS: 100,\n GOLD: 4653,\n HAM: 5112,\n HEMI_TESTNET: 743111,\n LINEA: 59144,\n LINEA_SEPOLIA: 59141,\n LISK_SEPOLIA: 4202,\n LYRA: 957,\n LYRA_SEPOLIA: 901,\n MODE: 34443,\n MODE_SEPOLIA: 919,\n NEON: 245022934,\n OASIS_SAPPHIRE: 23294,\n OPTIMISM: 10,\n OP_SEPOLIA: 11155420,\n ORDERLY: 291,\n ORDERLY_SEPOLIA: 4460,\n PGN_SEPOLIA: 58008,\n POLYGON: 137,\n POLYGON_AMOY: 80002,\n POLYGON_ZKEVM: 1101,\n PUBLIC_GOODS_NETWORK: 424,\n SCROLL: 534352,\n SCROLL_SEPOLIA: 534351,\n STACK: 78225,\n SYNDICATE_FRAME_CHAIN: 5101,\n TRON: 728126428,\n ZER0: 543210,\n ZK_LINK: 810180,\n ZORA: 7777777,\n ZORA_SEPOLIA: 999999999,\n};\n\nexport function evmChainToId(chain: string) {\n return CHAIN_ID[chain?.toUpperCase()];\n}\n","import { decodeEventLog, parseAbi } from 'viem';\n\nimport { evmMethodSignatureToHex } from './evm-method-signature-to-hex';\n\ntype BasicLog = Record<string, unknown> & { address: string; topics: string[] };\ntype SignaturesToDecode = string | { addresses?: string[]; signature: string; topic0?: string };\n\nexport function evmDecodeLog(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): Record<string, unknown> {\n if (Array.isArray(signatures)) {\n for (const sig of signatures) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return decoded;\n }\n }\n\n return null;\n }\n\n if (typeof signatures !== 'string' && Array.isArray(signatures.addresses) && signatures.addresses.length) {\n const addresses = signatures.addresses.map((a) => a?.toLowerCase());\n if (!addresses.includes(log.address.toLowerCase())) {\n return null;\n }\n }\n\n let sig = (typeof signatures === 'string' ? signatures : signatures.signature).trim();\n if (!sig.startsWith('event ')) {\n sig = 'event ' + sig;\n }\n const topic0 = typeof signatures !== 'string' && signatures.topic0 ? signatures.topic0 : evmMethodSignatureToHex(sig);\n if ((sig.match(/ indexed /g)?.length || 0) === log.topics.length - 1) {\n if (log.topics[0] === topic0) {\n try {\n const result = decodeEventLog({\n abi: parseAbi([sig]),\n data: log.data as `0x${string}`,\n topics: log.topics as [],\n });\n return result.args as unknown as Record<string, unknown>;\n } catch (e) {\n // ignore this\n }\n }\n }\n\n return null;\n}\n\nexport function evmDecodeLogWithMetadata(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): { decoded: Record<string, unknown>; metadata: { name: string } } {\n for (const sig of [signatures].flat()) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return {\n decoded,\n metadata: {\n name: (typeof sig === 'string' ? sig : sig.signature).split('(')[0],\n },\n };\n }\n }\n\n return null;\n}\n","import { keccak256 } from 'viem';\n\nexport function evmMethodSignatureToHex(sig: string): string {\n const [method, rest] = sig.split('(');\n const params = rest\n .split(')')[0]\n .split(',')\n .map((p) => p.trim());\n const topic0 = keccak256(\n `${method.split(' ').pop()}(${params.map((p) => p.split(' ')[0]).join(',')})` as `0x${string}`\n );\n return topic0;\n}\n","import { evmAddressToChecksum } from './evm-address-to-checksum';\n\nexport function normalizeEVMBlock(rawBlock: Record<string, unknown>): Record<string, unknown> {\n for (const k of ['baseFeePerGas', 'gasLimit', 'gasUsed', 'number', 'size', 'timestamp']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = parseInt(rawBlock[k] as string);\n }\n }\n\n for (const k of ['difficulty', 'totalDifficulty']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = BigInt(rawBlock[k] as string).toString();\n }\n }\n for (const k of ['miner']) {\n rawBlock[k] = evmAddressToChecksum(rawBlock[k] as string);\n }\n\n rawBlock.transactions = (\n rawBlock.transactions as { receipt: Record<string, unknown>; traces: Record<string, unknown>[] } & Record<\n string,\n unknown\n >[]\n ).map((tx) => {\n for (const k of [\n 'blockNumber',\n 'cumulativeGasUsed',\n 'effectiveGasPrice',\n 'gas',\n 'gasUsed',\n 'nonce',\n 'status',\n 'transactionIndex',\n ]) {\n if (typeof tx[k] === 'string') {\n tx[k] = parseInt(tx[k] as string);\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = parseInt(tx.receipt[k] as string);\n }\n }\n\n for (const k of ['gasPrice', 'maxFeePerGas', 'maxPriorityFeePerGas', 'value']) {\n if (typeof tx[k] === 'string') {\n tx[k] = BigInt(tx[k] as string).toString();\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = BigInt(tx.receipt[k] as string).toString();\n }\n }\n\n for (const k of ['from', 'to']) {\n if (typeof tx[k] === 'string') {\n tx[k] = evmAddressToChecksum(tx[k] as string);\n }\n }\n for (const k of ['contractAddress']) {\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = evmAddressToChecksum(tx.receipt[k] as string);\n }\n }\n\n tx.type = parseInt(tx.type as string);\n tx.receipt['status'] = Boolean(tx.receipt['status'] as string);\n\n tx.receipt['logs'] = (tx.receipt['logs'] as Record<string, unknown>[])?.map((log) => {\n for (const k of ['blockNumber', 'logIndex', 'transactionIndex']) {\n if (typeof log[k] === 'string') {\n log[k] = parseInt(log[k] as string);\n }\n }\n log['address'] = evmAddressToChecksum(log['address'] as string);\n return log;\n });\n\n return tx;\n });\n\n return rawBlock;\n}\n","export type Template = {\n key: string;\n name: string;\n description: string;\n disabled: boolean;\n tags: string[];\n params: Param[];\n transform: (\n payload: Record<string, unknown>,\n _ctx?: Record<string, unknown> & { params: Record<string, unknown> }\n ) => unknown;\n tests: TemplateTest[];\n};\n\nexport type Param = {\n key: string;\n name: string;\n type: 'NETWORK' | 'ADDRESS' | 'STRING' | 'NUMBER' | 'BOOLEAN';\n multiple?: boolean;\n optional?: boolean;\n values?: string[];\n default?: string;\n};\n\nexport type TemplateTest = {\n params: Record<string, unknown>;\n payload: `https://${string}` | Record<string, unknown>;\n output: unknown;\n};\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA,gBAAuB;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,CACT,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KACjE,OAAO,CAAC;IACb,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB,CAAC;AAEF,aAAoB;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oBAA2B;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,EAAE,WAAW,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AUxBF,OAAA,MAAM,aAAwF,CAAC;AAI/F,8CAEC;AAED,iCAAiC,GAAG,EAAE,MAAM,YAE3C","sources":["src/types.ts","src/templates/raw.ts","src/utils/evm-address-to-checksum.ts","src/utils/evm-chain-to-id.ts","src/utils/evm-method-signature-to-hex.ts","src/utils/evm-decode-log.ts","src/utils/evm-normalize-raw-block.ts","src/utils/index.ts","src/templates/token-transfers.ts","src/templates/index.ts","src/index.ts"],"sourcesContent":["export type Template = {\n key: string;\n name: string;\n description: string;\n disabled: boolean;\n tags: string[];\n params: Param[];\n transform: (\n payload: Record<string, unknown>,\n _ctx?: Record<string, unknown> & { params: Record<string, unknown> }\n ) => unknown;\n tests: TemplateTest[];\n};\n\nexport type Param = {\n key: string;\n name: string;\n type: 'NETWORK' | 'ADDRESS' | 'STRING' | 'NUMBER' | 'BOOLEAN';\n multiple?: boolean;\n optional?: boolean;\n values?: string[];\n default?: string;\n};\n\nexport type TemplateTest = {\n params: Record<string, unknown>;\n payload: `https://${string}` | Record<string, unknown>;\n output: unknown;\n};\n","import { Template } from '../types';\n\nconst rawTemplate: Template = {\n key: 'raw',\n name: 'Raw Block Data',\n description: 'Get all blocks with all available fields',\n tags: ['EVM', 'RAW'],\n disabled: true,\n params: [],\n transform: (payload) => payload,\n tests: [\n {\n params: {},\n payload: { a: 'b', c: 1, d: { e: true } },\n output: { a: 'b', c: 1, d: { e: true } },\n },\n ],\n};\n\nexport default rawTemplate;\n","import { keccak256 } from 'viem';\n\nexport function evmAddressToChecksum(address: string) {\n if (!address || !/^(0x)?[0-9a-f]{40}$/i.test(address)) {\n return null;\n }\n\n const stripAddress = address.slice(2).toLowerCase();\n const keccakHash = keccak256(stripAddress as `0x${string}`);\n let checksumAddress = '0x';\n\n for (let i = 0; i < stripAddress.length; i++) {\n checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i];\n }\n\n return checksumAddress;\n}\n","const CHAIN_ID = {\n ARBITRUM: 42161,\n AVALANCHE: 43114,\n BASE: 8453,\n BASE_SEPOLIA: 84532,\n BERACHAIN_BARTIO: 80084,\n BLAST: 81457,\n BSC: 56,\n CELO: 42220,\n CYBER: 7560,\n DEGEN: 666666666,\n ETHEREUM: 1,\n ETH_HOLESKY: 17000,\n ETH_SEPOLIA: 11155111,\n FRAXTAL: 252,\n FRAXTAL_SEPOLIA: 2522,\n FUSE: 122,\n GNOSIS: 100,\n GOLD: 4653,\n HAM: 5112,\n HEMI_TESTNET: 743111,\n LINEA: 59144,\n LINEA_SEPOLIA: 59141,\n LISK_SEPOLIA: 4202,\n LYRA: 957,\n LYRA_SEPOLIA: 901,\n MODE: 34443,\n MODE_SEPOLIA: 919,\n NEON: 245022934,\n OASIS_SAPPHIRE: 23294,\n OPTIMISM: 10,\n OP_SEPOLIA: 11155420,\n ORDERLY: 291,\n ORDERLY_SEPOLIA: 4460,\n PGN_SEPOLIA: 58008,\n POLYGON: 137,\n POLYGON_AMOY: 80002,\n POLYGON_ZKEVM: 1101,\n PUBLIC_GOODS_NETWORK: 424,\n SCROLL: 534352,\n SCROLL_SEPOLIA: 534351,\n STACK: 78225,\n SYNDICATE_FRAME_CHAIN: 5101,\n TRON: 728126428,\n ZER0: 543210,\n ZK_LINK: 810180,\n ZORA: 7777777,\n ZORA_SEPOLIA: 999999999,\n};\n\nexport function evmChainToId(chain: string) {\n return CHAIN_ID[chain?.toUpperCase()];\n}\n","import { keccak256 } from 'viem';\n\nexport function evmMethodSignatureToHex(sig: string): string {\n const [method, rest] = sig.split('(');\n const params = rest\n .split(')')[0]\n .split(',')\n .map((p) => p.trim());\n const topic0 = keccak256(\n `${method.split(' ').pop()}(${params.map((p) => p.split(' ')[0]).join(',')})` as `0x${string}`\n );\n return topic0;\n}\n","import { decodeEventLog, parseAbi } from 'viem';\n\nimport { evmMethodSignatureToHex } from './evm-method-signature-to-hex';\n\ntype BasicLog = Record<string, unknown> & { address: string; topics: string[] };\ntype SignaturesToDecode = string | { addresses?: string[]; signature: string; topic0?: string };\n\nexport function evmDecodeLog(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): Record<string, unknown> {\n if (Array.isArray(signatures)) {\n for (const sig of signatures) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return decoded;\n }\n }\n\n return null;\n }\n\n if (typeof signatures !== 'string' && Array.isArray(signatures.addresses) && signatures.addresses.length) {\n const addresses = signatures.addresses.map((a) => a?.toLowerCase());\n if (!addresses.includes(log.address.toLowerCase())) {\n return null;\n }\n }\n\n let sig = (typeof signatures === 'string' ? signatures : signatures.signature).trim();\n if (!sig.startsWith('event ')) {\n sig = 'event ' + sig;\n }\n const topic0 = typeof signatures !== 'string' && signatures.topic0 ? signatures.topic0 : evmMethodSignatureToHex(sig);\n if ((sig.match(/ indexed /g)?.length || 0) === log.topics.length - 1) {\n if (log.topics[0] === topic0) {\n try {\n const result = decodeEventLog({\n abi: parseAbi([sig]),\n data: log.data as `0x${string}`,\n topics: log.topics as [],\n });\n return result.args as unknown as Record<string, unknown>;\n } catch (e) {\n // ignore this\n }\n }\n }\n\n return null;\n}\n\nexport function evmDecodeLogWithMetadata(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): { decoded: Record<string, unknown>; metadata: { name: string } } {\n for (const sig of [signatures].flat()) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return {\n decoded,\n metadata: {\n name: (typeof sig === 'string' ? sig : sig.signature).split('(')[0],\n },\n };\n }\n }\n\n return null;\n}\n","import { evmAddressToChecksum } from './evm-address-to-checksum';\n\nexport function normalizeEVMBlock(rawBlock: Record<string, unknown>): Record<string, unknown> {\n for (const k of ['baseFeePerGas', 'gasLimit', 'gasUsed', 'number', 'size', 'timestamp']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = parseInt(rawBlock[k] as string);\n }\n }\n\n for (const k of ['difficulty', 'totalDifficulty']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = BigInt(rawBlock[k] as string).toString();\n }\n }\n for (const k of ['miner']) {\n rawBlock[k] = evmAddressToChecksum(rawBlock[k] as string);\n }\n\n rawBlock.transactions = (\n rawBlock.transactions as { receipt: Record<string, unknown>; traces: Record<string, unknown>[] } & Record<\n string,\n unknown\n >[]\n ).map((tx) => {\n for (const k of [\n 'blockNumber',\n 'cumulativeGasUsed',\n 'effectiveGasPrice',\n 'gas',\n 'gasUsed',\n 'nonce',\n 'status',\n 'transactionIndex',\n ]) {\n if (typeof tx[k] === 'string') {\n tx[k] = parseInt(tx[k] as string);\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = parseInt(tx.receipt[k] as string);\n }\n }\n\n for (const k of ['gasPrice', 'maxFeePerGas', 'maxPriorityFeePerGas', 'value']) {\n if (typeof tx[k] === 'string') {\n tx[k] = BigInt(tx[k] as string).toString();\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = BigInt(tx.receipt[k] as string).toString();\n }\n }\n\n for (const k of ['from', 'to']) {\n if (typeof tx[k] === 'string') {\n tx[k] = evmAddressToChecksum(tx[k] as string);\n }\n }\n for (const k of ['contractAddress']) {\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = evmAddressToChecksum(tx.receipt[k] as string);\n }\n }\n\n tx.type = parseInt(tx.type as string);\n tx.receipt['status'] = Boolean(tx.receipt['status'] as string);\n\n tx.receipt['logs'] = (tx.receipt['logs'] as Record<string, unknown>[])?.map((log) => {\n for (const k of ['blockNumber', 'logIndex', 'transactionIndex']) {\n if (typeof log[k] === 'string') {\n log[k] = parseInt(log[k] as string);\n }\n }\n log['address'] = evmAddressToChecksum(log['address'] as string);\n return log;\n });\n\n return tx;\n });\n\n return rawBlock;\n}\n","export * from './evm-address-to-checksum';\nexport * from './evm-chain-to-id';\nexport * from './evm-decode-log';\nexport * from './evm-method-signature-to-hex';\nexport * from './evm-normalize-raw-block';\n","import { evmDecodeLogWithMetadata } from '../utils';\nimport { Template } from '../types';\nimport { decodeTxRaw, Registry } from '@cosmjs/proto-signing';\nimport { defaultRegistryTypes as defaultStargateTypes, SigningStargateClient } from '@cosmjs/stargate';\n\ntype NetworkTransfer = {\n amount: number | bigint;\n blockNumber: number;\n from: string;\n index?: string;\n timestamp: string;\n to: string;\n token?: string;\n tokenId?: string;\n tokenType: 'NATIVE' | 'TOKEN' | 'NFT';\n transactionGasFee: bigint;\n transactionHash: string;\n};\n\nconst NULL_ADDRESS = '0x0000000000000000000000000000000000000000';\n\nconst tokenTransfersTemplate: Template = {\n key: 'token_transfers',\n name: 'Token Transfers',\n description: 'Get all token transfers for a set of token types.',\n tags: ['EVM', 'ERC20', 'ERC721', 'NFT', 'TOKEN'],\n disabled: false,\n params: [\n { key: 'network', name: 'Network', type: 'NETWORK', optional: false },\n { key: 'contractAddress', name: 'Contract Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n {\n key: 'tokenTypes',\n name: 'Token Types',\n type: 'STRING',\n multiple: true,\n optional: true,\n values: ['NATIVE', 'TOKEN', 'NFT'],\n },\n ],\n\n transform: (block, _ctx) => {\n const TOKEN_TYPES = (_ctx.params.tokenTypes as NetworkTransfer['tokenType'][]) || [];\n let transfers: NetworkTransfer[] = [];\n\n switch (block._network) {\n case 'APTOS':\n case 'APTOS_TESTNET': {\n for (const tx of block.transactions as Record<string, unknown>[]) {\n if (!tx?.events || !Array.isArray(tx.events)) {\n break;\n }\n\n const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp as string) / 1000).toISOString() : null;\n const txfersByKey: Record<string, Record<string, string>> = {};\n\n for (const evt of tx.events as Record<string, unknown>[]) {\n if (['0x1::coin::WithdrawEvent', '0x1::coin::DepositEvent'].includes(evt.type as string)) {\n const amount = (evt.data as Record<string, string>)?.amount;\n const key = `0x1-${amount}`;\n txfersByKey[key] ||= { amount, tokenAddress: null };\n if ((evt.type as string).endsWith('WithdrawEvent')) {\n txfersByKey[key].from = (evt.guid as Record<string, string>)?.account_address;\n } else {\n txfersByKey[key].to = (evt.guid as Record<string, string>)?.account_address;\n }\n }\n }\n\n for (const partial of Object.values(txfersByKey)) {\n if (!partial.from || !partial.to) continue;\n transfers.push({\n amount: BigInt(partial.amount),\n blockNumber: parseInt(block.block_height as string),\n from: partial.from,\n timestamp,\n to: partial.to,\n token: partial.tokenAddress,\n tokenType: 'NATIVE',\n transactionGasFee: BigInt(tx.gas_used as string),\n transactionHash: tx.hash as string,\n });\n }\n }\n break;\n }\n\n case 'BITCOIN':\n case 'BITCOIN_TESTNET':\n case 'LITCOIN': // @TODO\n case 'DOGECOIN': {\n for (const tx of block.tx as Record<string, unknown>[]) {\n const timestamp = tx.time ? new Date((tx.time as number) * 1000).toISOString() : null;\n const vin = tx.vin[0] as { prevout?: { scriptPubKey: { address: string } }; vout?: number };\n const vout = tx.vout as { value: number; scriptPubKey?: { address: string; addresses?: string[] } }[];\n\n const fromVout = Math.min(vin.vout || 1000, vout.length - 1);\n const fromAddress =\n vin.prevout?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.addresses?.[0];\n if (!fromAddress) {\n break;\n }\n\n for (const v of vout) {\n transfers.push({\n amount: BigInt(Math.round(v.value * Math.pow(10, 8))),\n blockNumber: block.height as number,\n from: fromAddress,\n timestamp,\n to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],\n transactionGasFee: BigInt((tx.fee as number) || 0) * BigInt(Math.pow(10, 8)),\n transactionHash: tx.txid as string,\n token: null,\n tokenType: 'NATIVE',\n });\n }\n\n break;\n }\n break;\n }\n\n case 'CARDANO': {\n const blockTimestamp = new Date((block.timestamp as number) * 1000).toISOString();\n\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n transaction_identifier?: { hash?: string };\n operations?: {\n type: string;\n account?: { address?: string };\n amount?: {\n value?: string;\n currency?: {\n symbol?: string;\n decimals?: number;\n };\n };\n }[];\n };\n\n if (!Array.isArray(typedTx.operations)) {\n continue;\n }\n\n const transactionHash = typedTx.transaction_identifier?.hash || '';\n\n const inputs = typedTx.operations.filter((op) => op.type === 'input');\n const outputs = typedTx.operations.filter((op) => op.type === 'output');\n\n if (!inputs.length && !outputs.length) {\n break;\n }\n\n const fromAddress = inputs[0]?.account?.address;\n if (!fromAddress) {\n continue;\n }\n\n const sumInputs = inputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n const sumOutputs = outputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n\n const transactionFee = sumInputs + BigInt(sumOutputs);\n\n for (const out of outputs) {\n const rawValue = out.amount?.value || '0';\n const absoluteValue = BigInt(rawValue);\n transfers.push({\n amount: absoluteValue < 0 ? -absoluteValue : absoluteValue,\n blockNumber: (block.block_identifier as { index: number }).index,\n from: fromAddress,\n timestamp: blockTimestamp,\n to: out.account?.address || '',\n token: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? null : out.amount?.currency?.symbol,\n tokenType: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: transactionFee < 0 ? -transactionFee : transactionFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'RIPPLE': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const rawTx of block.transactions) {\n const typedTx = rawTx as {\n Account?: string;\n Amount?: string | { currency: string; issuer: string; value: string };\n Destination?: string;\n Fee?: string;\n hash?: string;\n TransactionType?: string;\n date?: number;\n metaData?: {\n delivered_amount?: string | { currency: string; issuer: string; value: string };\n };\n };\n if (typedTx.TransactionType !== 'Payment') {\n continue;\n }\n const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? '0';\n let tokenSymbol = 'XRP';\n let tokenType: 'NATIVE' | 'TOKEN' | 'NFT' = 'NATIVE';\n\n let parsedAmount: bigint;\n\n if (typeof deliveredOrAmount === 'object') {\n tokenSymbol = deliveredOrAmount.currency?.toUpperCase() ?? 'UNKNOWN';\n tokenType = 'TOKEN';\n const floatVal = parseFloat(deliveredOrAmount.value);\n const smallestUnit = Math.round(floatVal * 1_000_000);\n parsedAmount = BigInt(smallestUnit);\n } else {\n parsedAmount = BigInt(String(deliveredOrAmount));\n }\n transfers.push({\n amount: parsedAmount,\n blockNumber: parseInt(block.ledger_index as string, 10),\n from: typedTx.Account ?? 'UNKNOWN',\n timestamp: block.close_time_iso ? (block.close_time_iso as string) : null,\n to: typedTx.Destination ?? 'UNKNOWN',\n token: tokenSymbol,\n tokenType: tokenType,\n transactionGasFee: BigInt(typedTx.Fee ?? '0'),\n transactionHash: typedTx.hash ?? '',\n });\n }\n\n break;\n }\n\n case 'SOLANA': {\n for (const tx of block.transactions as unknown[]) {\n const solanaTx = tx as {\n meta: {\n fee: number;\n postTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n preTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n postBalances: number[];\n preBalances: number[];\n };\n transaction: {\n message: { accountKeys: (string | { pubkey: string })[]; instructions: unknown[] };\n signatures: string[];\n };\n };\n const txHash = solanaTx.transaction.signatures[0];\n const timestamp = block.blockTime ? new Date((block.blockTime as number) * 1000).toISOString() : null;\n\n let txFee = BigInt(solanaTx.meta.fee);\n if (txFee < BigInt(10)) {\n txFee = txFee * BigInt(Math.pow(10, 9));\n }\n\n const transfersByKey: Record<string, NetworkTransfer> = {};\n for (const post of solanaTx.meta.postTokenBalances) {\n let matched = false;\n for (const pre of solanaTx.meta.preTokenBalances) {\n if (post.mint === pre.mint && post.owner === pre.owner) {\n let diff = BigInt(post.uiTokenAmount.amount) - BigInt(pre.uiTokenAmount.amount);\n if (diff === BigInt(0)) {\n continue;\n }\n if (diff < 0) {\n diff = -diff;\n }\n\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: pre.owner,\n timestamp,\n to: post.owner,\n transactionGasFee: txFee,\n transactionHash: txHash,\n token: post.mint,\n tokenType: 'TOKEN',\n };\n if (transfersByKey[key]) {\n if (diff > 0) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n matched = true;\n }\n }\n\n if (!matched) {\n let diff = BigInt(post.uiTokenAmount.amount);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: null,\n timestamp,\n to: post.owner,\n token: post.mint,\n tokenType: 'TOKEN',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n delete txfer.from;\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n for (let i = 1; i < solanaTx.meta.postBalances.length; i += 1) {\n const post = solanaTx.meta.postBalances[i];\n const pre = solanaTx.meta.preBalances[i];\n if (post !== undefined && pre !== undefined && post !== pre) {\n let diff = BigInt(post) - BigInt(pre);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `null-${diff.toString()}`;\n\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from:\n post > pre\n ? typeof solanaTx.transaction.message.accountKeys[0] === 'string'\n ? solanaTx.transaction.message.accountKeys[0]\n : (solanaTx.transaction.message.accountKeys[0] as { pubkey: string })?.pubkey\n : typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey,\n timestamp,\n to:\n typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey?.toString(),\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n if (transfersByKey[key]) {\n if (post > pre) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n transfers.push(...Object.values(transfersByKey));\n }\n break;\n }\n\n case 'STARKNET': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const tx of block.transactions) {\n const typedTx = tx as {\n transaction_hash: string;\n sender_address: string;\n receipt?: {\n actual_fee?: {\n amount?: string;\n unit?: string;\n };\n events?: {\n keys: string[];\n data: string[];\n }[];\n };\n timestamp?: number | string;\n data_availability?: Record<string, unknown>;\n };\n\n const timestamp = block.timestamp ? new Date((block.timestamp as number) * 1000).toISOString() : null;\n\n let transactionGasFee = BigInt(0);\n if (typedTx?.receipt?.actual_fee?.amount) {\n transactionGasFee = BigInt(typedTx.receipt.actual_fee.amount);\n }\n\n const transactionHash = typedTx.transaction_hash;\n\n if (!typedTx.receipt?.events) {\n continue;\n }\n\n for (const event of typedTx.receipt.events) {\n if (!event.keys.includes('0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9')) {\n continue;\n }\n if (event.data.length < 3) {\n continue;\n }\n\n const [from, to, amountHex] = event.data;\n const amount = BigInt(amountHex);\n\n transfers.push({\n amount,\n blockNumber: block.block_number as number,\n from,\n timestamp,\n to,\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'STELLAR': {\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n hash: string;\n created_at: string;\n fee_charged: string;\n operations: {\n type: string;\n from: string;\n to: string;\n amount: string;\n asset_type: string;\n asset_issuer: string;\n }[];\n };\n for (const op of typedTx.operations) {\n if (op.type === 'payment') {\n transfers.push({\n amount: BigInt(op.amount.replace('.', '')),\n blockNumber: block.sequence as number,\n from: op.from,\n timestamp: typedTx.created_at,\n to: op.to,\n token: op.asset_type === 'native' ? null : op.asset_issuer,\n tokenType: op.asset_type === 'native' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: BigInt(typedTx.fee_charged),\n transactionHash: typedTx.hash,\n });\n }\n }\n }\n break;\n }\n\n case 'SUI': {\n const blockNumber = block.sequence as number;\n const blockTimestamp = new Date(block.timestamp as number).toISOString();\n\n for (const tx of (block.transactions as any[]) || []) {\n const transactionHash = tx.digest as string;\n const transactionGasFee = BigInt((tx.gasFee as string) || '0');\n\n for (const bc of (tx.balanceChanges as any[]) || []) {\n transfers.push({\n blockNumber,\n from: tx.sender ? (tx.sender as string) : undefined,\n to: tx.receiver ? (tx.receiver as string) : undefined,\n amount: BigInt(bc.amount as string),\n token: bc.coinRepr as string,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee,\n });\n }\n }\n\n break;\n }\n\n case 'TON': {\n const blockNumber = block.seqno as number;\n const blockTimestamp = new Date((block.shards?.[0]?.gen_utime as number) * 1000).toISOString();\n\n for (const shard of (block.shards as any[]) || []) {\n for (const tx of (shard.transactions as any[]) || []) {\n const transactionLT = tx.transaction_id.lt as string;\n const transactionHash = tx.transaction_id.hash as string;\n const transactionFee = BigInt((tx.fee as string) || '0');\n\n const inVal = BigInt((tx.in_msg?.value as string) || '0');\n if (inVal > 0n) {\n transfers.push({\n blockNumber,\n from: tx.in_msg?.source?.account_address as string,\n to: tx.address?.account_address as string,\n amount: inVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n\n for (const outMsg of (tx.out_msgs as any[]) || []) {\n const outVal = BigInt((outMsg.value as string) || '0');\n if (outVal > 0n) {\n transfers.push({\n blockNumber,\n from: outMsg.source?.account_address as string,\n to: outMsg.destination?.account_address as string,\n amount: outVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n }\n }\n }\n\n break;\n }\n\n // attempt to introspect data types\n default: {\n // try Cosmos\n if (block.block) {\n const typedBlock = block as {\n block: { header: { height: string; time: string }; data: { txs?: string[] } };\n block_id: { hash: string };\n };\n\n const blockNumber = Number(typedBlock.block.header.height);\n const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();\n const blockHash = typedBlock.block_id.hash;\n\n for (const txRaw of typedBlock.block.data.txs || []) {\n const decoded = decodeTxRaw(new Uint8Array(Buffer.from(txRaw, 'base64')));\n const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || '0');\n\n const registry = new Registry(defaultStargateTypes);\n for (const message of decoded.body.messages) {\n if (\n ['/ibc.applications.transfer.v1.MsgTransfer', '/cosmos.bank.v1beta1.MsgSend'].includes(message.typeUrl)\n ) {\n const decodedMsg = registry.decode(message);\n transfers.push({\n blockNumber,\n from: decodedMsg.sender,\n to: decodedMsg.receiver,\n amount: BigInt(decodedMsg.token.amount),\n token: decodedMsg.token.denom,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash: blockHash,\n transactionGasFee,\n });\n }\n }\n }\n\n break;\n }\n\n // otherwise assume EVM\n for (const tx of block.transactions as any[]) {\n if (!tx.receipt) {\n continue;\n }\n\n const timestamp = new Date((block.timestamp as number) * 1000).toISOString();\n const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);\n\n // track direct ETH transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NATIVE')) {\n // pull from traces, if available\n if (Array.isArray(tx.traces)) {\n for (const trace of tx.traces.filter((t) => t.action)) {\n const action = trace.action as unknown as { from: string; to: string; value: string };\n if (!action?.value) continue;\n\n transfers.push({\n amount: BigInt(action.value),\n blockNumber: tx.blockNumber as number,\n from: action.from?.toLowerCase() || NULL_ADDRESS,\n index: trace.traceAddress?.join('-'),\n timestamp,\n to: action.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n } else if ((tx.value as string)?.length >= 3 || /\\d+/.test(tx.value as string)) {\n transfers.push({\n amount: BigInt(tx.value as string),\n blockNumber: tx.blockNumber as number,\n from: tx.from?.toLowerCase() || NULL_ADDRESS,\n timestamp,\n to: tx.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n\n // track ERC20 transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('TOKEN')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 value)',\n ]);\n if (txfer) {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenType: 'TOKEN',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n }\n\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NFT')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 indexed value)',\n 'TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)',\n 'TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)',\n ]);\n\n if (!txfer) continue;\n\n switch (txfer.metadata.name) {\n case 'Transfer': {\n transfers.push({\n amount: 1,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.value as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferSingle': {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.id as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferBatch': {\n for (let i = 0; i < (txfer.decoded.ids as bigint[]).length; i += 1) {\n transfers.push({\n amount: txfer.decoded.values[i] as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.ids[i] as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n break;\n }\n }\n }\n }\n }\n if (typeof _ctx.params.contractAddress === 'string') {\n _ctx.params.contractAddress = _ctx.params.contractAddress.toLowerCase();\n }\n if (typeof _ctx.params.walletAddress === 'string') {\n _ctx.params.walletAddress = _ctx.params.walletAddress.toLowerCase();\n }\n break;\n }\n }\n\n transfers = transfers.filter((txfer) => {\n if (txfer.amount <= BigInt(0)) {\n return false;\n }\n if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token && txfer.token) {\n return false;\n }\n if (_ctx.params.walletAddress && ![txfer.from, txfer.to].includes(_ctx.params.walletAddress as string)) {\n return false;\n }\n return true;\n });\n\n return transfers;\n },\n\n tests: [\n // APTOS\n {\n params: {\n network: 'APTOS',\n walletAddress: '0xb3589951a7d8579a2918a749260804047abc60438bf0738c4e67683e972b41cd',\n contractAddress: '0x1',\n },\n payload: 'https://jiti.indexing.co/networks/aptos/237372198',\n output: [\n {\n amount: 12776498n,\n blockNumber: 237372198,\n from: '0xb3589951a7d8579a2918a749260804047abc60438bf0738c4e67683e972b41cd',\n timestamp: '2024-10-10T16:59:34.414Z',\n to: '0x1f5d15c9a1330389bda239ed2f40d8d2a2ba446e7a48ee57483a047d5ed1aafe',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 507n,\n transactionHash: '0xbabaf20c07c80ace9f1f2f6539e0df6c57c9a6b24d5e62fa4989b46c0807d9bb',\n },\n ],\n },\n\n // BASE\n {\n params: {\n network: 'BASE',\n walletAddress: '0x4F80864cD68782144e3736626896990acAe15a11',\n contractAddress: '0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed',\n },\n payload: 'https://jiti.indexing.co/networks/base/23507423',\n output: [\n {\n amount: 1000000000000000000000n,\n blockNumber: 23507423,\n from: '0x053002b4b332b422733c9469ddf9990bb6235e3d',\n index: 536,\n timestamp: '2024-12-10T04:16:33.000Z',\n to: '0x4f80864cd68782144e3736626896990acae15a11',\n token: '0x4ed4e862860bed51a9570b96d89af5e1b0efefed',\n tokenType: 'TOKEN',\n transactionGasFee: 1192354854229n,\n transactionHash: '0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56',\n },\n ],\n },\n\n // DOGECOIN\n {\n params: {\n network: 'DOGECOIN',\n walletAddress: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/dogecoin/1000075',\n output: [\n {\n amount: 1008521000000n,\n blockNumber: 1000075,\n from: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n to: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 0n,\n transactionHash: '9873fe46ab29f61cefdec498b691af68e0ad29a7599c94f42d2d4e9a5d461dbe',\n timestamp: '2015-12-13T19:59:52.000Z',\n },\n ],\n },\n\n // CARDANO\n {\n params: {\n network: 'CARDANO',\n walletAddress:\n 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/cardano/11443286',\n output: [\n {\n amount: 1110000n,\n blockNumber: 11443286,\n from: 'addr1qymdv285few5tyqvya86rl97r9e608njs37shfew6l2nn473aw2pcnrcvfwfgg2dnew99m4tjj0apsu7232w2euzwpysndh0h3',\n timestamp: '+057068-01-19T05:23:20.000Z',\n to: 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 174257n,\n transactionHash: '261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309',\n },\n ],\n },\n\n // RIPPLE\n {\n params: {\n network: 'RIPPLE',\n walletAddress: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ripple/88104659',\n output: [\n {\n amount: 238n,\n blockNumber: 88104659,\n from: 'rMAGnTv4eMWktZnhKa5cHcDiY84ZiKUaQm',\n timestamp: '2024-05-19T22:18:52Z',\n to: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n token: 'XRP',\n tokenType: 'NATIVE',\n transactionGasFee: 15n,\n transactionHash: '03564E6109261CDE73FCC5062C2A0A70F365CB1A0F9408C065B60EC3E94E4DBF',\n },\n ],\n },\n\n // STELLAR\n {\n params: {\n network: 'STELLAR',\n walletAddress: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n contractAddress: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n },\n payload: 'https://jiti.indexing.co/networks/stellar/51720546',\n output: [\n {\n amount: 150000n,\n blockNumber: 51720546,\n from: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n timestamp: '2024-05-18T04:41:39Z',\n to: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n token: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n tokenType: 'TOKEN',\n transactionGasFee: 100n,\n transactionHash: '4fb2441210cbe87f5003abdfa86f03bafa54f789ed041feccbda0bd054297c4d',\n },\n ],\n },\n // STARKNET\n {\n params: {\n network: 'STARKNET',\n walletAddress: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/starknet/1149460',\n output: [\n {\n amount: 0x1c286f74458fc6n,\n blockNumber: 1149460,\n from: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n timestamp: '2025-02-13T17:36:52.000Z',\n to: '0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 7925758505095110n,\n transactionHash: '0x707203dba31f442ae9a5477e6a8906f3676effa0f1d3bb19cbbc14e1ddfe21',\n },\n ],\n },\n //SUI\n {\n params: {\n network: 'SUI',\n walletAddress: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/sui/112336044',\n output: [\n {\n blockNumber: 112336044,\n from: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n to: undefined,\n amount: 180772n,\n token: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:54.529Z',\n transactionHash: '336V3wP8cHDAnB1Aku3j6n9948i8FG5N1eVP6Ac68BaE',\n transactionGasFee: -4165572n,\n },\n ],\n },\n // TON\n {\n params: {\n network: 'TON',\n walletAddress: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ton/44919328',\n output: [\n {\n blockNumber: 44919328,\n from: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n to: 'EQCFTFAHOU3vFt2NiZhRD5dwuS0k7GS59vIg3WfCKwfaQGW2',\n amount: 10000000n,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:18.000Z',\n transactionHash: 'Vh5cWr2uvCsdhoouBQ+EiUcF54os9oqvh8A/62EroQc=',\n transactionGasFee: 2355233n,\n },\n ],\n },\n // COSMOS\n {\n params: {\n network: 'COSMOS',\n walletAddress: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n contractAddress: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n },\n payload: 'https://jiti.indexing.co/networks/cosmos/24419691',\n output: [\n {\n blockNumber: 24419691,\n from: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n to: 'noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv',\n amount: 500000n,\n token: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n tokenType: 'NATIVE',\n timestamp: '2025-02-14T21:48:22.809Z',\n transactionHash: 'DF5FB086E60EE2ADA3A842751337E06A40696D7983CC1C038ADE236B36ED8AEB',\n transactionGasFee: 4860n,\n },\n ],\n },\n ],\n};\n\nexport default tokenTransfersTemplate;\n","import rawTemplate from './raw';\nimport tokenTransfersTemplate from './token-transfers';\n\nexport const templates = [rawTemplate, tokenTransfersTemplate];\n","import { templates as templateList } from './templates';\nimport * as utils from './utils';\nimport * as types from './types';\n\nconst templates = templateList.reduce((a, b) => ({ ...a, [b.key]: Object.assign({}, b) }), {});\n\nexport { utils, templates, types };\n\nexport function getAllTemplates() {\n return templateList.slice();\n}\n\nexport function getTemplateByKey(key: string) {\n return templateList.slice().find((template) => template.key === key);\n}\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
1
|
+
{"mappings":"AAAA,gBAAuB;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,CACT,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KACjE,OAAO,CAAC;IACb,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB,CAAC;AAEF,aAAoB;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oBAA2B;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,EAAE,WAAW,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AUxBF,OAAA,MAAM,aAAwF,CAAC;AAI/F,8CAEC;AAED,iCAAiC,GAAG,EAAE,MAAM,YAE3C","sources":["src/types.ts","src/templates/raw.ts","src/utils/evm-address-to-checksum.ts","src/utils/evm-chain-to-id.ts","src/utils/evm-method-signature-to-hex.ts","src/utils/evm-decode-log.ts","src/utils/evm-normalize-raw-block.ts","src/utils/index.ts","src/templates/token-transfers.ts","src/templates/index.ts","src/index.ts"],"sourcesContent":["export type Template = {\n key: string;\n name: string;\n description: string;\n disabled: boolean;\n tags: string[];\n params: Param[];\n transform: (\n payload: Record<string, unknown>,\n _ctx?: Record<string, unknown> & { params: Record<string, unknown> }\n ) => unknown;\n tests: TemplateTest[];\n};\n\nexport type Param = {\n key: string;\n name: string;\n type: 'NETWORK' | 'ADDRESS' | 'STRING' | 'NUMBER' | 'BOOLEAN';\n multiple?: boolean;\n optional?: boolean;\n values?: string[];\n default?: string;\n};\n\nexport type TemplateTest = {\n params: Record<string, unknown>;\n payload: `https://${string}` | Record<string, unknown>;\n output: unknown;\n};\n","import { Template } from '../types';\n\nconst rawTemplate: Template = {\n key: 'raw',\n name: 'Raw Block Data',\n description: 'Get all blocks with all available fields',\n tags: ['EVM', 'RAW'],\n disabled: true,\n params: [],\n transform: (payload) => payload,\n tests: [\n {\n params: {},\n payload: { a: 'b', c: 1, d: { e: true } },\n output: { a: 'b', c: 1, d: { e: true } },\n },\n ],\n};\n\nexport default rawTemplate;\n","import { keccak256 } from 'viem';\n\nexport function evmAddressToChecksum(address: string) {\n if (!address || !/^(0x)?[0-9a-f]{40}$/i.test(address)) {\n return null;\n }\n\n const stripAddress = address.slice(2).toLowerCase();\n const keccakHash = keccak256(stripAddress as `0x${string}`);\n let checksumAddress = '0x';\n\n for (let i = 0; i < stripAddress.length; i++) {\n checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i];\n }\n\n return checksumAddress;\n}\n","const CHAIN_ID = {\n ARBITRUM: 42161,\n AVALANCHE: 43114,\n BASE: 8453,\n BASE_SEPOLIA: 84532,\n BERACHAIN_BARTIO: 80084,\n BLAST: 81457,\n BSC: 56,\n CELO: 42220,\n CYBER: 7560,\n DEGEN: 666666666,\n ETHEREUM: 1,\n ETH_HOLESKY: 17000,\n ETH_SEPOLIA: 11155111,\n FRAXTAL: 252,\n FRAXTAL_SEPOLIA: 2522,\n FUSE: 122,\n GNOSIS: 100,\n GOLD: 4653,\n HAM: 5112,\n HEMI_TESTNET: 743111,\n LINEA: 59144,\n LINEA_SEPOLIA: 59141,\n LISK_SEPOLIA: 4202,\n LYRA: 957,\n LYRA_SEPOLIA: 901,\n MODE: 34443,\n MODE_SEPOLIA: 919,\n NEON: 245022934,\n OASIS_SAPPHIRE: 23294,\n OPTIMISM: 10,\n OP_SEPOLIA: 11155420,\n ORDERLY: 291,\n ORDERLY_SEPOLIA: 4460,\n PGN_SEPOLIA: 58008,\n POLYGON: 137,\n POLYGON_AMOY: 80002,\n POLYGON_ZKEVM: 1101,\n PUBLIC_GOODS_NETWORK: 424,\n SCROLL: 534352,\n SCROLL_SEPOLIA: 534351,\n STACK: 78225,\n SYNDICATE_FRAME_CHAIN: 5101,\n TRON: 728126428,\n ZER0: 543210,\n ZK_LINK: 810180,\n ZORA: 7777777,\n ZORA_SEPOLIA: 999999999,\n};\n\nexport function evmChainToId(chain: string) {\n return CHAIN_ID[chain?.toUpperCase()];\n}\n","import { keccak256 } from 'viem';\n\nexport function evmMethodSignatureToHex(sig: string): string {\n const [method, rest] = sig.split('(');\n const params = rest\n .split(')')[0]\n .split(',')\n .map((p) => p.trim());\n const topic0 = keccak256(\n `${method.split(' ').pop()}(${params.map((p) => p.split(' ')[0]).join(',')})` as `0x${string}`\n );\n return topic0;\n}\n","import { decodeEventLog, parseAbi } from 'viem';\n\nimport { evmMethodSignatureToHex } from './evm-method-signature-to-hex';\n\ntype BasicLog = Record<string, unknown> & { address: string; topics: string[] };\ntype SignaturesToDecode = string | { addresses?: string[]; signature: string; topic0?: string };\n\nexport function evmDecodeLog(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): Record<string, unknown> {\n if (Array.isArray(signatures)) {\n for (const sig of signatures) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return decoded;\n }\n }\n\n return null;\n }\n\n if (typeof signatures !== 'string' && Array.isArray(signatures.addresses) && signatures.addresses.length) {\n const addresses = signatures.addresses.map((a) => a?.toLowerCase());\n if (!addresses.includes(log.address.toLowerCase())) {\n return null;\n }\n }\n\n let sig = (typeof signatures === 'string' ? signatures : signatures.signature).trim();\n if (!sig.startsWith('event ')) {\n sig = 'event ' + sig;\n }\n const topic0 = typeof signatures !== 'string' && signatures.topic0 ? signatures.topic0 : evmMethodSignatureToHex(sig);\n if ((sig.match(/ indexed /g)?.length || 0) === log.topics.length - 1) {\n if (log.topics[0] === topic0) {\n try {\n const result = decodeEventLog({\n abi: parseAbi([sig]),\n data: log.data as `0x${string}`,\n topics: log.topics as [],\n });\n return result.args as unknown as Record<string, unknown>;\n } catch (e) {\n // ignore this\n }\n }\n }\n\n return null;\n}\n\nexport function evmDecodeLogWithMetadata(\n log: BasicLog,\n signatures: SignaturesToDecode | SignaturesToDecode[]\n): { decoded: Record<string, unknown>; metadata: { name: string } } {\n for (const sig of [signatures].flat()) {\n const decoded = evmDecodeLog(log, sig);\n if (decoded) {\n return {\n decoded,\n metadata: {\n name: (typeof sig === 'string' ? sig : sig.signature).split('(')[0],\n },\n };\n }\n }\n\n return null;\n}\n","import { evmAddressToChecksum } from './evm-address-to-checksum';\n\nexport function normalizeEVMBlock(rawBlock: Record<string, unknown>): Record<string, unknown> {\n for (const k of ['baseFeePerGas', 'gasLimit', 'gasUsed', 'number', 'size', 'timestamp']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = parseInt(rawBlock[k] as string);\n }\n }\n\n for (const k of ['difficulty', 'totalDifficulty']) {\n if (typeof rawBlock[k] === 'string') {\n rawBlock[k] = BigInt(rawBlock[k] as string).toString();\n }\n }\n for (const k of ['miner']) {\n rawBlock[k] = evmAddressToChecksum(rawBlock[k] as string);\n }\n\n rawBlock.transactions = (\n rawBlock.transactions as { receipt: Record<string, unknown>; traces: Record<string, unknown>[] } & Record<\n string,\n unknown\n >[]\n ).map((tx) => {\n for (const k of [\n 'blockNumber',\n 'cumulativeGasUsed',\n 'effectiveGasPrice',\n 'gas',\n 'gasUsed',\n 'nonce',\n 'status',\n 'transactionIndex',\n ]) {\n if (typeof tx[k] === 'string') {\n tx[k] = parseInt(tx[k] as string);\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = parseInt(tx.receipt[k] as string);\n }\n }\n\n for (const k of ['gasPrice', 'maxFeePerGas', 'maxPriorityFeePerGas', 'value']) {\n if (typeof tx[k] === 'string') {\n tx[k] = BigInt(tx[k] as string).toString();\n }\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = BigInt(tx.receipt[k] as string).toString();\n }\n }\n\n for (const k of ['from', 'to']) {\n if (typeof tx[k] === 'string') {\n tx[k] = evmAddressToChecksum(tx[k] as string);\n }\n }\n for (const k of ['contractAddress']) {\n if (typeof tx.receipt[k] === 'string') {\n tx.receipt[k] = evmAddressToChecksum(tx.receipt[k] as string);\n }\n }\n\n tx.type = parseInt(tx.type as string);\n tx.receipt['status'] = Boolean(tx.receipt['status'] as string);\n\n tx.receipt['logs'] = (tx.receipt['logs'] as Record<string, unknown>[])?.map((log) => {\n for (const k of ['blockNumber', 'logIndex', 'transactionIndex']) {\n if (typeof log[k] === 'string') {\n log[k] = parseInt(log[k] as string);\n }\n }\n log['address'] = evmAddressToChecksum(log['address'] as string);\n return log;\n });\n\n return tx;\n });\n\n return rawBlock;\n}\n","export * from './evm-address-to-checksum';\nexport * from './evm-chain-to-id';\nexport * from './evm-decode-log';\nexport * from './evm-method-signature-to-hex';\nexport * from './evm-normalize-raw-block';\n","import { evmDecodeLogWithMetadata } from '../utils';\nimport { Template } from '../types';\nimport { decodeTxRaw, Registry } from '@cosmjs/proto-signing';\nimport { defaultRegistryTypes as defaultStargateTypes, SigningStargateClient } from '@cosmjs/stargate';\n\ntype NetworkTransfer = {\n amount: number | bigint;\n blockNumber: number;\n from: string;\n index?: string;\n timestamp: string;\n to: string;\n token?: string;\n tokenId?: string;\n tokenType: 'NATIVE' | 'TOKEN' | 'NFT';\n transactionGasFee: bigint;\n transactionHash: string;\n};\n\nconst NULL_ADDRESS = '0x0000000000000000000000000000000000000000';\n\nconst tokenTransfersTemplate: Template = {\n key: 'token_transfers',\n name: 'Token Transfers',\n description: 'Get all token transfers for a set of token types.',\n tags: ['EVM', 'ERC20', 'ERC721', 'NFT', 'TOKEN'],\n disabled: false,\n params: [\n { key: 'network', name: 'Network', type: 'NETWORK', optional: false },\n { key: 'contractAddress', name: 'Contract Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n {\n key: 'tokenTypes',\n name: 'Token Types',\n type: 'STRING',\n multiple: true,\n optional: true,\n values: ['NATIVE', 'TOKEN', 'NFT'],\n },\n ],\n\n transform: (block, _ctx) => {\n const TOKEN_TYPES = (_ctx.params.tokenTypes as NetworkTransfer['tokenType'][]) || [];\n let transfers: NetworkTransfer[] = [];\n\n switch (block._network) {\n case 'APTOS':\n case 'APTOS_TESTNET': {\n for (const tx of block.transactions as Record<string, unknown>[]) {\n if (!tx?.events || !Array.isArray(tx.events)) {\n continue;\n }\n\n const timestamp = tx.timestamp ? new Date(parseInt(tx.timestamp as string) / 1000).toISOString() : null;\n const txfersByKey: Record<string, Record<string, string>> = {};\n\n for (const evt of tx.events as Record<string, unknown>[]) {\n if (['0x1::coin::WithdrawEvent', '0x1::coin::DepositEvent'].includes(evt.type as string)) {\n const amount = (evt.data as Record<string, string>)?.amount;\n const key = `0x1-${amount}`;\n txfersByKey[key] ||= { amount, tokenAddress: null };\n if ((evt.type as string).endsWith('WithdrawEvent')) {\n txfersByKey[key].from = (evt.guid as Record<string, string>)?.account_address;\n } else {\n txfersByKey[key].to = (evt.guid as Record<string, string>)?.account_address;\n }\n }\n }\n\n for (const partial of Object.values(txfersByKey)) {\n if (!partial.from || !partial.to) continue;\n transfers.push({\n amount: BigInt(partial.amount),\n blockNumber: parseInt(block.block_height as string),\n from: partial.from?.length < 66 ? `0x0${partial.from?.slice(2)}` : partial.from,\n timestamp,\n to: partial.to?.length < 66 ? `0x0${partial.to?.slice(2)}` : partial.to,\n token: partial.tokenAddress,\n tokenType: 'NATIVE',\n transactionGasFee: BigInt(tx.gas_used as string),\n transactionHash: tx.hash as string,\n });\n }\n }\n break;\n }\n\n case 'BITCOIN':\n case 'BITCOIN_TESTNET':\n case 'LITCOIN': // @TODO\n case 'DOGECOIN': {\n for (const tx of block.tx as Record<string, unknown>[]) {\n const timestamp = tx.time ? new Date((tx.time as number) * 1000).toISOString() : null;\n const vin = tx.vin[0] as { prevout?: { scriptPubKey: { address: string } }; vout?: number };\n const vout = tx.vout as { value: number; scriptPubKey?: { address: string; addresses?: string[] } }[];\n\n const fromVout = Math.min(vin.vout || 1000, vout.length - 1);\n const fromAddress =\n vin.prevout?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.address ||\n vout[fromVout]?.scriptPubKey?.addresses?.[0];\n if (!fromAddress) {\n continue;\n }\n\n for (const v of vout) {\n transfers.push({\n amount: BigInt(Math.round(v.value * Math.pow(10, 8))),\n blockNumber: block.height as number,\n from: fromAddress,\n timestamp,\n to: v.scriptPubKey.address || v.scriptPubKey.addresses?.[0],\n transactionGasFee: BigInt(Math.round(((tx.fee as number) || 0) * Math.pow(10, 8))),\n transactionHash: tx.txid as string,\n token: null,\n tokenType: 'NATIVE',\n });\n }\n }\n break;\n }\n\n case 'CARDANO': {\n const blockTimestamp = new Date((block.timestamp as number) * 1000).toISOString();\n\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n transaction_identifier?: { hash?: string };\n operations?: {\n type: string;\n account?: { address?: string };\n amount?: {\n value?: string;\n currency?: {\n symbol?: string;\n decimals?: number;\n };\n };\n }[];\n };\n\n if (!Array.isArray(typedTx.operations)) {\n continue;\n }\n\n const transactionHash = typedTx.transaction_identifier?.hash || '';\n\n const inputs = typedTx.operations.filter((op) => op.type === 'input');\n const outputs = typedTx.operations.filter((op) => op.type === 'output');\n\n if (!inputs.length && !outputs.length) {\n continue;\n }\n\n const fromAddress = inputs[0]?.account?.address;\n if (!fromAddress) {\n continue;\n }\n\n const sumInputs = inputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n const sumOutputs = outputs.reduce((acc, op) => {\n const val = BigInt(op.amount?.value || '0');\n return acc + val;\n }, BigInt(0));\n\n const transactionFee = sumInputs + BigInt(sumOutputs);\n\n for (const out of outputs) {\n const rawValue = out.amount?.value || '0';\n const absoluteValue = BigInt(rawValue);\n transfers.push({\n amount: absoluteValue < 0 ? -absoluteValue : absoluteValue,\n blockNumber: (block.block_identifier as { index: number }).index,\n from: fromAddress,\n timestamp: blockTimestamp,\n to: out.account?.address || '',\n token: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? null : out.amount?.currency?.symbol,\n tokenType: out.amount?.currency?.symbol?.toUpperCase() === 'ADA' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: transactionFee < 0 ? -transactionFee : transactionFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'RIPPLE': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const rawTx of block.transactions) {\n const typedTx = rawTx as {\n Account?: string;\n Amount?: string | { currency: string; issuer: string; value: string };\n Destination?: string;\n Fee?: string;\n hash?: string;\n TransactionType?: string;\n date?: number;\n metaData?: {\n delivered_amount?: string | { currency: string; issuer: string; value: string };\n };\n };\n if (typedTx.TransactionType !== 'Payment') {\n continue;\n }\n const deliveredOrAmount = typedTx.metaData?.delivered_amount ?? typedTx.Amount ?? '0';\n let tokenSymbol = 'XRP';\n let tokenType: 'NATIVE' | 'TOKEN' | 'NFT' = 'NATIVE';\n\n let parsedAmount: bigint;\n\n if (typeof deliveredOrAmount === 'object') {\n tokenSymbol = deliveredOrAmount.currency?.toUpperCase() ?? 'UNKNOWN';\n tokenType = 'TOKEN';\n const floatVal = parseFloat(deliveredOrAmount.value);\n const smallestUnit = Math.round(floatVal * 1_000_000);\n parsedAmount = BigInt(smallestUnit);\n } else {\n parsedAmount = BigInt(String(deliveredOrAmount));\n }\n transfers.push({\n amount: parsedAmount,\n blockNumber: parseInt(block.ledger_index as string, 10),\n from: typedTx.Account ?? 'UNKNOWN',\n timestamp: block.close_time_iso ? (block.close_time_iso as string) : null,\n to: typedTx.Destination ?? 'UNKNOWN',\n token: tokenSymbol,\n tokenType: tokenType,\n transactionGasFee: BigInt(typedTx.Fee ?? '0'),\n transactionHash: typedTx.hash ?? '',\n });\n }\n\n break;\n }\n\n case 'SOLANA': {\n for (const tx of block.transactions as unknown[]) {\n const solanaTx = tx as {\n meta: {\n fee: number;\n postTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n preTokenBalances: {\n accountIndex: number;\n mint: string;\n owner: string;\n uiTokenAmount: { amount: string };\n }[];\n postBalances: number[];\n preBalances: number[];\n };\n transaction: {\n message: { accountKeys: (string | { pubkey: string })[]; instructions: unknown[] };\n signatures: string[];\n };\n };\n const txHash = solanaTx.transaction.signatures[0];\n const timestamp = block.blockTime ? new Date((block.blockTime as number) * 1000).toISOString() : null;\n\n let txFee = BigInt(solanaTx.meta.fee);\n if (txFee < BigInt(10)) {\n txFee = txFee * BigInt(Math.pow(10, 9));\n }\n\n const transfersByKey: Record<string, NetworkTransfer> = {};\n for (const post of solanaTx.meta.postTokenBalances) {\n let matched = false;\n for (const pre of solanaTx.meta.preTokenBalances) {\n if (post.mint === pre.mint && post.owner === pre.owner) {\n let diff = BigInt(post.uiTokenAmount.amount) - BigInt(pre.uiTokenAmount.amount);\n if (diff === BigInt(0)) {\n continue;\n }\n if (diff < 0) {\n diff = -diff;\n }\n\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: pre.owner,\n timestamp,\n to: post.owner,\n transactionGasFee: txFee,\n transactionHash: txHash,\n token: post.mint,\n tokenType: 'TOKEN',\n };\n if (transfersByKey[key]) {\n if (diff > 0) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n matched = true;\n }\n }\n\n if (!matched) {\n let diff = BigInt(post.uiTokenAmount.amount);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `${post.mint}-${diff.toString()}`;\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from: null,\n timestamp,\n to: post.owner,\n token: post.mint,\n tokenType: 'TOKEN',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n delete txfer.from;\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n for (let i = 1; i < solanaTx.meta.postBalances.length; i += 1) {\n const post = solanaTx.meta.postBalances[i];\n const pre = solanaTx.meta.preBalances[i];\n if (post !== undefined && pre !== undefined && post !== pre) {\n let diff = BigInt(post) - BigInt(pre);\n if (diff < 0) {\n diff = -diff;\n }\n const key = `null-${diff.toString()}`;\n\n const txfer: NetworkTransfer = {\n amount: diff,\n blockNumber: block.blockHeight as number,\n from:\n post > pre\n ? typeof solanaTx.transaction.message.accountKeys[0] === 'string'\n ? solanaTx.transaction.message.accountKeys[0]\n : (solanaTx.transaction.message.accountKeys[0] as { pubkey: string })?.pubkey\n : typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey,\n timestamp,\n to:\n typeof solanaTx.transaction.message.accountKeys[i] === 'string'\n ? (solanaTx.transaction.message.accountKeys[i] as string)\n : (solanaTx.transaction.message.accountKeys[i] as { pubkey: string })?.pubkey?.toString(),\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: txFee,\n transactionHash: txHash,\n };\n if (transfersByKey[key]) {\n if (post > pre) {\n delete txfer.from;\n } else {\n delete txfer.to;\n }\n }\n transfersByKey[key] = Object.assign(transfersByKey[key] || {}, txfer);\n }\n }\n\n transfers.push(...Object.values(transfersByKey));\n }\n break;\n }\n\n case 'STARKNET': {\n if (!Array.isArray(block.transactions)) {\n break;\n }\n\n for (const tx of block.transactions) {\n const typedTx = tx as {\n transaction_hash: string;\n sender_address: string;\n receipt?: {\n actual_fee?: {\n amount?: string;\n unit?: string;\n };\n events?: {\n keys: string[];\n data: string[];\n }[];\n };\n timestamp?: number | string;\n data_availability?: Record<string, unknown>;\n };\n\n const timestamp = block.timestamp ? new Date((block.timestamp as number) * 1000).toISOString() : null;\n\n let transactionGasFee = BigInt(0);\n if (typedTx?.receipt?.actual_fee?.amount) {\n transactionGasFee = BigInt(typedTx.receipt.actual_fee.amount);\n }\n\n const transactionHash = typedTx.transaction_hash;\n\n if (!typedTx.receipt?.events) {\n continue;\n }\n\n for (const event of typedTx.receipt.events) {\n if (!event.keys.includes('0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9')) {\n continue;\n }\n if (event.data.length < 3) {\n continue;\n }\n\n const [from, to, amountHex] = event.data;\n const amount = BigInt(amountHex);\n\n transfers.push({\n amount,\n blockNumber: block.block_number as number,\n from,\n timestamp,\n to,\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash,\n });\n }\n }\n break;\n }\n\n case 'STELLAR': {\n for (const tx of block.transactions as unknown[]) {\n const typedTx = tx as {\n hash: string;\n created_at: string;\n fee_charged: string;\n operations: {\n type: string;\n from: string;\n to: string;\n amount: string;\n asset_type: string;\n asset_issuer: string;\n }[];\n };\n for (const op of typedTx.operations) {\n if (op.type === 'payment') {\n transfers.push({\n amount: BigInt(op.amount.replace('.', '')),\n blockNumber: block.sequence as number,\n from: op.from,\n timestamp: typedTx.created_at,\n to: op.to,\n token: op.asset_type === 'native' ? null : op.asset_issuer,\n tokenType: op.asset_type === 'native' ? 'NATIVE' : 'TOKEN',\n transactionGasFee: BigInt(typedTx.fee_charged),\n transactionHash: typedTx.hash,\n });\n }\n }\n }\n break;\n }\n\n case 'SUI': {\n const blockNumber = block.sequence as number;\n const blockTimestamp = new Date(block.timestamp as number).toISOString();\n\n for (const tx of (block.transactions as any[]) || []) {\n const transactionHash = tx.digest as string;\n const transactionGasFee = BigInt((tx.gasFee as string) || '0');\n\n for (const bc of (tx.balanceChanges as any[]) || []) {\n transfers.push({\n blockNumber,\n from: tx.sender ? (tx.sender as string) : undefined,\n to: tx.receiver ? (tx.receiver as string) : undefined,\n amount: BigInt(bc.amount as string),\n token: bc.coinRepr as string,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee,\n });\n }\n }\n\n break;\n }\n\n case 'TON': {\n const blockNumber = block.seqno as number;\n const blockTimestamp = new Date((block.shards?.[0]?.gen_utime as number) * 1000).toISOString();\n\n for (const shard of (block.shards as any[]) || []) {\n for (const tx of (shard.transactions as any[]) || []) {\n const transactionLT = tx.transaction_id.lt as string;\n const transactionHash = tx.transaction_id.hash as string;\n const transactionFee = BigInt((tx.fee as string) || '0');\n\n const inVal = BigInt((tx.in_msg?.value as string) || '0');\n if (inVal > 0n) {\n transfers.push({\n blockNumber,\n from: tx.in_msg?.source?.account_address as string,\n to: tx.address?.account_address as string,\n amount: inVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n\n for (const outMsg of (tx.out_msgs as any[]) || []) {\n const outVal = BigInt((outMsg.value as string) || '0');\n if (outVal > 0n) {\n transfers.push({\n blockNumber,\n from: outMsg.source?.account_address as string,\n to: outMsg.destination?.account_address as string,\n amount: outVal,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash,\n transactionGasFee: transactionFee,\n });\n }\n }\n }\n }\n\n break;\n }\n\n // attempt to introspect data types\n default: {\n // try Cosmos\n if (block.block) {\n const typedBlock = block as {\n block: { header: { height: string; time: string }; data: { txs?: string[] } };\n block_id: { hash: string };\n };\n\n const blockNumber = Number(typedBlock.block.header.height);\n const blockTimestamp = new Date(typedBlock.block.header.time).toISOString();\n const blockHash = typedBlock.block_id.hash;\n\n for (const txRaw of typedBlock.block.data.txs || []) {\n const decoded = decodeTxRaw(new Uint8Array(Buffer.from(txRaw, 'base64')));\n const transactionGasFee = BigInt(decoded.authInfo.fee?.amount?.[0]?.amount || '0');\n\n const registry = new Registry(defaultStargateTypes);\n for (const message of decoded.body.messages) {\n if (\n ['/ibc.applications.transfer.v1.MsgTransfer', '/cosmos.bank.v1beta1.MsgSend'].includes(message.typeUrl)\n ) {\n const decodedMsg = registry.decode(message);\n transfers.push({\n blockNumber,\n from: decodedMsg.sender,\n to: decodedMsg.receiver,\n amount: BigInt(decodedMsg.token.amount),\n token: decodedMsg.token.denom,\n tokenType: 'NATIVE',\n timestamp: blockTimestamp,\n transactionHash: blockHash,\n transactionGasFee,\n });\n }\n }\n }\n\n break;\n }\n\n // otherwise assume EVM\n for (const tx of block.transactions as any[]) {\n if (!tx.receipt) {\n continue;\n }\n\n const timestamp = new Date((block.timestamp as number) * 1000).toISOString();\n const transactionGasFee = BigInt(tx.receipt.gasUsed) * BigInt(tx.receipt.effectiveGasPrice);\n\n // track direct ETH transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NATIVE')) {\n // pull from traces, if available\n if (Array.isArray(tx.traces)) {\n for (const trace of tx.traces.filter((t) => t.action)) {\n const action = trace.action as unknown as { from: string; to: string; value: string };\n if (!action?.value) continue;\n\n transfers.push({\n amount: BigInt(action.value),\n blockNumber: tx.blockNumber as number,\n from: action.from?.toLowerCase() || NULL_ADDRESS,\n index: trace.traceAddress?.join('-'),\n timestamp,\n to: action.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n } else if ((tx.value as string)?.length >= 3 || /\\d+/.test(tx.value as string)) {\n transfers.push({\n amount: BigInt(tx.value as string),\n blockNumber: tx.blockNumber as number,\n from: tx.from?.toLowerCase() || NULL_ADDRESS,\n timestamp,\n to: tx.to?.toLowerCase() || NULL_ADDRESS,\n tokenType: 'NATIVE',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n\n // track ERC20 transfers\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('TOKEN')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 value)',\n ]);\n if (txfer) {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenType: 'TOKEN',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n }\n }\n\n if (!TOKEN_TYPES.length || TOKEN_TYPES.includes('NFT')) {\n for (const log of tx.receipt.logs) {\n const txfer = evmDecodeLogWithMetadata(log, [\n 'Transfer(address indexed from, address indexed to, uint256 indexed value)',\n 'TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value)',\n 'TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values)',\n ]);\n\n if (!txfer) continue;\n\n switch (txfer.metadata.name) {\n case 'Transfer': {\n transfers.push({\n amount: 1,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.value as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferSingle': {\n transfers.push({\n amount: txfer.decoded.value as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.id as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n break;\n }\n case 'TransferBatch': {\n for (let i = 0; i < (txfer.decoded.ids as bigint[]).length; i += 1) {\n transfers.push({\n amount: txfer.decoded.values[i] as bigint,\n blockNumber: tx.blockNumber as number,\n from: (txfer.decoded.from as string)?.toLowerCase() || NULL_ADDRESS,\n index: log.logIndex,\n timestamp,\n to: (txfer.decoded.to as string)?.toLowerCase() || NULL_ADDRESS,\n token: (log.address as string).toLowerCase(),\n tokenId: (txfer.decoded.ids[i] as bigint).toString(),\n tokenType: 'NFT',\n transactionGasFee,\n transactionHash: tx.hash,\n });\n }\n break;\n }\n }\n }\n }\n }\n if (typeof _ctx.params.contractAddress === 'string') {\n _ctx.params.contractAddress = _ctx.params.contractAddress.toLowerCase();\n }\n if (typeof _ctx.params.walletAddress === 'string') {\n _ctx.params.walletAddress = _ctx.params.walletAddress.toLowerCase();\n }\n break;\n }\n }\n\n transfers = transfers.filter((txfer) => {\n if (txfer.amount <= BigInt(0)) {\n return false;\n }\n if (_ctx.params.contractAddress && _ctx.params.contractAddress !== txfer.token && txfer.token) {\n return false;\n }\n if (_ctx.params.walletAddress && ![txfer.from, txfer.to].includes(_ctx.params.walletAddress as string)) {\n return false;\n }\n return true;\n });\n\n return transfers;\n },\n\n tests: [\n // APTOS\n {\n params: {\n network: 'APTOS',\n walletAddress: '0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e',\n contractAddress: '0x1',\n },\n payload: 'https://jiti.indexing.co/networks/aptos/297956660',\n output: [\n {\n amount: 1502138836n,\n blockNumber: 297956660,\n from: '0x5bd7de5c56d5691f32ea86c973c73fec7b1445e59736c97158020018c080bb00',\n timestamp: '2025-03-02T21:07:06.002Z',\n to: '0x04b2b6bc8c2c5794c51607c962f482593f9b5ea09373a8ce249a1f799cca7a1e',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 13n,\n transactionHash: '0xfbdef795d11df124cca264f3370b09fb04fb1c1d24a2d2e1df0693c096a76d13',\n },\n ],\n },\n\n // BASE\n {\n params: {\n network: 'BASE',\n walletAddress: '0x4F80864cD68782144e3736626896990acAe15a11',\n contractAddress: '0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed',\n },\n payload: 'https://jiti.indexing.co/networks/base/23507423',\n output: [\n {\n amount: 1000000000000000000000n,\n blockNumber: 23507423,\n from: '0x053002b4b332b422733c9469ddf9990bb6235e3d',\n index: 536,\n timestamp: '2024-12-10T04:16:33.000Z',\n to: '0x4f80864cd68782144e3736626896990acae15a11',\n token: '0x4ed4e862860bed51a9570b96d89af5e1b0efefed',\n tokenType: 'TOKEN',\n transactionGasFee: 1192354854229n,\n transactionHash: '0x69c9b12ccbe2d4f2f1dfc7c4a8557fc099fc5df276424417815acbc79a06fd56',\n },\n ],\n },\n\n // DOGECOIN\n {\n params: {\n network: 'DOGECOIN',\n walletAddress: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/dogecoin/1000075',\n output: [\n {\n amount: 1008521000000n,\n blockNumber: 1000075,\n from: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n to: 'DMqRVLrhbam3Kcfddpxd6EYvEBbpi3bEpP',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 0n,\n transactionHash: '9873fe46ab29f61cefdec498b691af68e0ad29a7599c94f42d2d4e9a5d461dbe',\n timestamp: '2015-12-13T19:59:52.000Z',\n },\n ],\n },\n\n // CARDANO\n {\n params: {\n network: 'CARDANO',\n walletAddress:\n 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/cardano/11443286',\n output: [\n {\n amount: 1110000n,\n blockNumber: 11443286,\n from: 'addr1qymdv285few5tyqvya86rl97r9e608njs37shfew6l2nn473aw2pcnrcvfwfgg2dnew99m4tjj0apsu7232w2euzwpysndh0h3',\n timestamp: '+057068-01-19T05:23:20.000Z',\n to: 'addr1q9syxu908lef7r6rsvk0h7gsx3rxj22cuykgx2a2l4hcfd8e9y2e9vtv4w9dyej96w99wwj8hwgc273862lk6a3vt30qjjrund',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 174257n,\n transactionHash: '261c42ba9124f55d8e169ebb692cd3759d796a54369acb316ee449b546e79309',\n },\n ],\n },\n\n // RIPPLE\n {\n params: {\n network: 'RIPPLE',\n walletAddress: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ripple/88104659',\n output: [\n {\n amount: 238n,\n blockNumber: 88104659,\n from: 'rMAGnTv4eMWktZnhKa5cHcDiY84ZiKUaQm',\n timestamp: '2024-05-19T22:18:52Z',\n to: 'rUUgoiJmjTPEbxfZ4RsS9pVS9Kv813Wpui',\n token: 'XRP',\n tokenType: 'NATIVE',\n transactionGasFee: 15n,\n transactionHash: '03564E6109261CDE73FCC5062C2A0A70F365CB1A0F9408C065B60EC3E94E4DBF',\n },\n ],\n },\n\n // STELLAR\n {\n params: {\n network: 'STELLAR',\n walletAddress: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n contractAddress: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n },\n payload: 'https://jiti.indexing.co/networks/stellar/51720546',\n output: [\n {\n amount: 150000n,\n blockNumber: 51720546,\n from: 'GA5KLTNAWV27IOTBX5PKUOMVWFMLX4X7CPMQJ4QLR3G266MMVL7NMA4X',\n timestamp: '2024-05-18T04:41:39Z',\n to: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n token: 'GC4Z2TDXU4GXVLHOS5P5SU6HKBCP7NKN4TJ5ZGTVRBW7MCBZTU7SNUSA',\n tokenType: 'TOKEN',\n transactionGasFee: 100n,\n transactionHash: '4fb2441210cbe87f5003abdfa86f03bafa54f789ed041feccbda0bd054297c4d',\n },\n ],\n },\n // STARKNET\n {\n params: {\n network: 'STARKNET',\n walletAddress: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/starknet/1149460',\n output: [\n {\n amount: 0x1c286f74458fc6n,\n blockNumber: 1149460,\n from: '0x309e6b209031362268d62d646a067365e6f6d6eb7f571b5212cbdfd5f26fe54',\n timestamp: '2025-02-13T17:36:52.000Z',\n to: '0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8',\n token: null,\n tokenType: 'NATIVE',\n transactionGasFee: 7925758505095110n,\n transactionHash: '0x707203dba31f442ae9a5477e6a8906f3676effa0f1d3bb19cbbc14e1ddfe21',\n },\n ],\n },\n //SUI\n {\n params: {\n network: 'SUI',\n walletAddress: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/sui/112336044',\n output: [\n {\n blockNumber: 112336044,\n from: '0xfd0fb434d076e4cca300cf6534a5235b19ad184eedf49066726664ded42c6b5e',\n to: undefined,\n amount: 180772n,\n token: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:54.529Z',\n transactionHash: '336V3wP8cHDAnB1Aku3j6n9948i8FG5N1eVP6Ac68BaE',\n transactionGasFee: -4165572n,\n },\n ],\n },\n // TON\n {\n params: {\n network: 'TON',\n walletAddress: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n contractAddress: '',\n },\n payload: 'https://jiti.indexing.co/networks/ton/44919328',\n output: [\n {\n blockNumber: 44919328,\n from: 'EQAFukUyzmHjUvOYDOjNE-wbZFFl2FWas1rFJoh8IiTsWD40',\n to: 'EQCFTFAHOU3vFt2NiZhRD5dwuS0k7GS59vIg3WfCKwfaQGW2',\n amount: 10000000n,\n token: 'TON',\n tokenType: 'NATIVE',\n timestamp: '2025-02-13T23:10:18.000Z',\n transactionHash: 'Vh5cWr2uvCsdhoouBQ+EiUcF54os9oqvh8A/62EroQc=',\n transactionGasFee: 2355233n,\n },\n ],\n },\n // COSMOS\n {\n params: {\n network: 'COSMOS',\n walletAddress: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n contractAddress: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n },\n payload: 'https://jiti.indexing.co/networks/cosmos/24419691',\n output: [\n {\n blockNumber: 24419691,\n from: 'cosmos1x4qvmtcfc02pklttfgxzdccxcsyzklrxavteyz',\n to: 'noble1x4qvmtcfc02pklttfgxzdccxcsyzklrx4073uv',\n amount: 500000n,\n token: 'ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013',\n tokenType: 'NATIVE',\n timestamp: '2025-02-14T21:48:22.809Z',\n transactionHash: 'DF5FB086E60EE2ADA3A842751337E06A40696D7983CC1C038ADE236B36ED8AEB',\n transactionGasFee: 4860n,\n },\n ],\n },\n ],\n};\n\nexport default tokenTransfersTemplate;\n","import rawTemplate from './raw';\nimport tokenTransfersTemplate from './token-transfers';\n\nexport const templates = [rawTemplate, tokenTransfersTemplate];\n","import { templates as templateList } from './templates';\nimport * as utils from './utils';\nimport * as types from './types';\n\nconst templates = templateList.reduce((a, b) => ({ ...a, [b.key]: Object.assign({}, b) }), {});\n\nexport { utils, templates, types };\n\nexport function getAllTemplates() {\n return templateList.slice();\n}\n\nexport function getTemplateByKey(key: string) {\n return templateList.slice().find((template) => template.key === key);\n}\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|