@indexing/jiti 0.0.3 → 0.0.5

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 CHANGED
@@ -35,10 +35,28 @@ const $59fb8e0333a5d25f$var$rawTemplate = {
35
35
  "EVM",
36
36
  "RAW"
37
37
  ],
38
- disabled: false,
38
+ disabled: true,
39
39
  params: [],
40
40
  transform: (payload)=>payload,
41
- tests: []
41
+ tests: [
42
+ {
43
+ params: {},
44
+ payload: {
45
+ a: "b",
46
+ c: 1,
47
+ d: {
48
+ e: true
49
+ }
50
+ },
51
+ output: {
52
+ a: "b",
53
+ c: 1,
54
+ d: {
55
+ e: true
56
+ }
57
+ }
58
+ }
59
+ ]
42
60
  };
43
61
  var $59fb8e0333a5d25f$export$2e2bcd8739ae039 = $59fb8e0333a5d25f$var$rawTemplate;
44
62
 
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,EAAE;AACX;IAEA,2CAAe;;;;;;;;AGXR,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,qBAAQ,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,U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AAC,YAAY,KAAK,MAAM,KAAK,EACtE,OAAO;YAET,IAAI,KAAK,MAAM,CAAC,aAAa,IAAI,CAAC;gBAAC,MAAM,IAAI;gBAAE,MAAM,EAAE;aAAC,CAAC,QAAQ,CAAC,KAAK,MAAM,CAAC,aAAa,GACzF,OAAO;YAET,OAAO;QACT;QAEA,OAAO;IACT;IAEA,OAAO;QACL;YACE,QAAQ;gBACN,SAAS;gBACT,eAAe;gBACf,iBAAiB;YACnB;YACA,SAAS;YACT,QAAQ;gBACN;oBACE,QAAQ,uBAAuB;oBAC/B,aAAa;oBACb,MAAM;oBACN,OAAO;oBACP,WAAW;oBACX,IAAI;oBACJ,OAAO;oBACP,WAAW;oBACX,mBAAmB,cAAc;oBACjC,iBAAiB;gBACnB;aACD;QACH;KACD;AACH;IAEA,2CAAe;;;AF7NR,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: false,\n params: [],\n transform: (payload) => payload,\n tests: [],\n};\n\nexport default rawTemplate;\n","import { evmDecodeLogWithMetadata } from '../utils';\nimport { Template } from '../types';\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: 'tokenAddress', name: 'Token Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n { key: 'tokenTypes', name: 'Token Types', type: 'STRING', multiple: true, optional: true },\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 // @TODO: expand to non-EVM\n\n // assume EVM as default for now\n default: {\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 // @TODO: add NFT transfers\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.tokenAddress && _ctx.params.tokenAddress !== 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 {\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};\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';\n multiple?: boolean;\n optional?: boolean;\n};\n\nexport type TemplateTest = {\n params: Record<string, unknown>;\n payload: `https://${string}` | Record<string, unknown>;\n output: Record<string, unknown>[];\n};\n"],"names":[],"version":3,"file":"main.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,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,qBAAQ,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,KA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AEA,OAAO;IACT;IAEA,OAAO;QACL;YACE,QAAQ;gBACN,SAAS;gBACT,eAAe;gBACf,iBAAiB;YACnB;YACA,SAAS;YACT,QAAQ;gBACN;oBACE,QAAQ,uBAAuB;oBAC/B,aAAa;oBACb,MAAM;oBACN,OAAO;oBACP,WAAW;oBACX,IAAI;oBACJ,OAAO;oBACP,WAAW;oBACX,mBAAmB,cAAc;oBACjC,iBAAiB;gBACnB;aACD;QACH;KACD;AACH;IAEA,2CAAe;;;AF7NR,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';\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: 'tokenAddress', name: 'Token Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n { key: 'tokenTypes', name: 'Token Types', type: 'STRING', multiple: true, optional: true },\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 // @TODO: expand to non-EVM\n\n // assume EVM as default for now\n default: {\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 // @TODO: add NFT transfers\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.tokenAddress && _ctx.params.tokenAddress !== 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 {\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};\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';\n multiple?: boolean;\n optional?: boolean;\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
@@ -29,10 +29,28 @@ const $a4b307b872b01f44$var$rawTemplate = {
29
29
  "EVM",
30
30
  "RAW"
31
31
  ],
32
- disabled: false,
32
+ disabled: true,
33
33
  params: [],
34
34
  transform: (payload)=>payload,
35
- tests: []
35
+ tests: [
36
+ {
37
+ params: {},
38
+ payload: {
39
+ a: "b",
40
+ c: 1,
41
+ d: {
42
+ e: true
43
+ }
44
+ },
45
+ output: {
46
+ a: "b",
47
+ c: 1,
48
+ d: {
49
+ e: true
50
+ }
51
+ }
52
+ }
53
+ ]
36
54
  };
37
55
  var $a4b307b872b01f44$export$2e2bcd8739ae039 = $a4b307b872b01f44$var$rawTemplate;
38
56
 
@@ -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,EAAE;AACX;IAEA,2CAAe;;;;;;;;AGXR,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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BAAC,MAAM,IAAI;gBAAE,MAAM,EAAE;aAAC,CAAC,QAAQ,CAAC,KAAK,MAAM,CAAC,aAAa,GACzF,OAAO;YAET,OAAO;QACT;QAEA,OAAO;IACT;IAEA,OAAO;QACL;YACE,QAAQ;gBACN,SAAS;gBACT,eAAe;gBACf,iBAAiB;YACnB;YACA,SAAS;YACT,QAAQ;gBACN;oBACE,QAAQ,uBAAuB;oBAC/B,aAAa;oBACb,MAAM;oBACN,OAAO;oBACP,WAAW;oBACX,IAAI;oBACJ,OAAO;oBACP,WAAW;oBACX,mBAAmB,cAAc;oBACjC,iBAAiB;gBACnB;aACD;QACH;KACD;AACH;IAEA,2CAAe;;;AF7NR,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: false,\n params: [],\n transform: (payload) => payload,\n tests: [],\n};\n\nexport default rawTemplate;\n","import { evmDecodeLogWithMetadata } from '../utils';\nimport { Template } from '../types';\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: 'tokenAddress', name: 'Token Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n { key: 'tokenTypes', name: 'Token Types', type: 'STRING', multiple: true, optional: true },\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 // @TODO: expand to non-EVM\n\n // assume EVM as default for now\n default: {\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 // @TODO: add NFT transfers\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.tokenAddress && _ctx.params.tokenAddress !== 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 {\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};\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';\n multiple?: boolean;\n optional?: boolean;\n};\n\nexport type TemplateTest = {\n params: Record<string, unknown>;\n payload: `https://${string}` | Record<string, unknown>;\n output: Record<string, 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,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;IACd,OAAO;IACP,eAAe;IACf,cAAc;IACd,MAAM;IACN,cAAc;IACd,MAAM;IACN,cAAc;IACd,M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S;YACT,QAAQ;gBACN;oBACE,QAAQ,uBAAuB;oBAC/B,aAAa;oBACb,MAAM;oBACN,OAAO;oBACP,WAAW;oBACX,IAAI;oBACJ,OAAO;oBACP,WAAW;oBACX,mBAAmB,cAAc;oBACjC,iBAAiB;gBACnB;aACD;QACH;KACD;AACH;IAEA,2CAAe;;;AF7NR,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';\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: 'tokenAddress', name: 'Token Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n { key: 'tokenTypes', name: 'Token Types', type: 'STRING', multiple: true, optional: true },\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 // @TODO: expand to non-EVM\n\n // assume EVM as default for now\n default: {\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 // @TODO: add NFT transfers\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.tokenAddress && _ctx.params.tokenAddress !== 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 {\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};\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';\n multiple?: boolean;\n optional?: boolean;\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 CHANGED
@@ -20,7 +20,7 @@ type Param = {
20
20
  type TemplateTest = {
21
21
  params: Record<string, unknown>;
22
22
  payload: `https://${string}` | Record<string, unknown>;
23
- output: Record<string, unknown>[];
23
+ output: unknown;
24
24
  };
25
25
  export const templates: {};
26
26
  export function getAllTemplates(): Template[];
@@ -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,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,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,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CACnC,CAAC;AUtBF,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';\n multiple?: boolean;\n optional?: boolean;\n};\n\nexport type TemplateTest = {\n params: Record<string, unknown>;\n payload: `https://${string}` | Record<string, unknown>;\n output: Record<string, 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: false,\n params: [],\n transform: (payload) => payload,\n tests: [],\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';\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: 'tokenAddress', name: 'Token Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n { key: 'tokenTypes', name: 'Token Types', type: 'STRING', multiple: true, optional: true },\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 // @TODO: expand to non-EVM\n\n // assume EVM as default for now\n default: {\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 // @TODO: add NFT transfers\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.tokenAddress && _ctx.params.tokenAddress !== 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 {\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};\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,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,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;AUtBF,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';\n multiple?: boolean;\n optional?: boolean;\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';\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: 'tokenAddress', name: 'Token Address', type: 'ADDRESS', optional: true },\n { key: 'walletAddress', name: 'Wallet Address', type: 'ADDRESS', optional: true },\n { key: 'tokenTypes', name: 'Token Types', type: 'STRING', multiple: true, optional: true },\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 // @TODO: expand to non-EVM\n\n // assume EVM as default for now\n default: {\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 // @TODO: add NFT transfers\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.tokenAddress && _ctx.params.tokenAddress !== 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 {\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};\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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexing/jiti",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Just In Time Indexing, for all",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",