@sentio/sdk 2.13.3-rc.5 → 2.13.3
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/lib/eth/builtin/eacaggregatorproxy.d.ts +2 -1
- package/lib/eth/builtin/eacaggregatorproxy.js +2 -1
- package/lib/eth/builtin/eacaggregatorproxy.js.map +1 -1
- package/lib/eth/builtin/erc1155.d.ts +2 -1
- package/lib/eth/builtin/erc1155.js +2 -1
- package/lib/eth/builtin/erc1155.js.map +1 -1
- package/lib/eth/builtin/erc20.d.ts +2 -1
- package/lib/eth/builtin/erc20.js +2 -1
- package/lib/eth/builtin/erc20.js.map +1 -1
- package/lib/eth/builtin/erc20bytes.d.ts +2 -1
- package/lib/eth/builtin/erc20bytes.js +2 -1
- package/lib/eth/builtin/erc20bytes.js.map +1 -1
- package/lib/eth/builtin/erc721.d.ts +2 -1
- package/lib/eth/builtin/erc721.js +2 -1
- package/lib/eth/builtin/erc721.js.map +1 -1
- package/lib/eth/builtin/weth9.d.ts +2 -1
- package/lib/eth/builtin/weth9.js +2 -1
- package/lib/eth/builtin/weth9.js.map +1 -1
- package/lib/eth/codegen/file.js +2 -1
- package/lib/eth/codegen/file.js.map +1 -1
- package/package.json +3 -3
- package/src/eth/builtin/eacaggregatorproxy.ts +2 -1
- package/src/eth/builtin/erc1155.ts +2 -1
- package/src/eth/builtin/erc20.ts +2 -1
- package/src/eth/builtin/erc20bytes.ts +2 -1
- package/src/eth/builtin/erc721.ts +2 -1
- package/src/eth/builtin/weth9.ts +2 -1
- package/src/eth/codegen/file.ts +2 -1
@@ -1,3 +1,4 @@
|
|
1
1
|
export * from "./internal/eacaggregatorproxy-processor.js";
|
2
|
-
export * from "./internal/EACAggregatorProxy.js";
|
3
2
|
export * from "./internal/eacaggregatorproxy-test-utils.js";
|
3
|
+
export * from "./internal/EACAggregatorProxy.js";
|
4
|
+
export * from "./internal/factories/EACAggregatorProxy__factory.js";
|
@@ -2,6 +2,7 @@
|
|
2
2
|
/* tslint:disable */
|
3
3
|
/* eslint-disable */
|
4
4
|
export * from "./internal/eacaggregatorproxy-processor.js";
|
5
|
-
export * from "./internal/EACAggregatorProxy.js";
|
6
5
|
export * from "./internal/eacaggregatorproxy-test-utils.js";
|
6
|
+
export * from "./internal/EACAggregatorProxy.js";
|
7
|
+
export * from "./internal/factories/EACAggregatorProxy__factory.js";
|
7
8
|
//# sourceMappingURL=eacaggregatorproxy.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"eacaggregatorproxy.js","sourceRoot":"","sources":["../../../src/eth/builtin/eacaggregatorproxy.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,
|
1
|
+
{"version":3,"file":"eacaggregatorproxy.js","sourceRoot":"","sources":["../../../src/eth/builtin/eacaggregatorproxy.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,4CAA4C,CAAC;AAC3D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,kCAAkC,CAAC;AACjD,cAAc,qDAAqD,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n\nexport * from \"./internal/eacaggregatorproxy-processor.js\";\nexport * from \"./internal/eacaggregatorproxy-test-utils.js\";\nexport * from \"./internal/EACAggregatorProxy.js\";\nexport * from \"./internal/factories/EACAggregatorProxy__factory.js\";\n"]}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
/* tslint:disable */
|
3
3
|
/* eslint-disable */
|
4
4
|
export * from "./internal/erc1155-processor.js";
|
5
|
-
export * from "./internal/ERC1155.js";
|
6
5
|
export * from "./internal/erc1155-test-utils.js";
|
6
|
+
export * from "./internal/ERC1155.js";
|
7
|
+
export * from "./internal/factories/ERC1155__factory.js";
|
7
8
|
//# sourceMappingURL=erc1155.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"erc1155.js","sourceRoot":"","sources":["../../../src/eth/builtin/erc1155.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
1
|
+
{"version":3,"file":"erc1155.js","sourceRoot":"","sources":["../../../src/eth/builtin/erc1155.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,0CAA0C,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n\nexport * from \"./internal/erc1155-processor.js\";\nexport * from \"./internal/erc1155-test-utils.js\";\nexport * from \"./internal/ERC1155.js\";\nexport * from \"./internal/factories/ERC1155__factory.js\";\n"]}
|
package/lib/eth/builtin/erc20.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
/* tslint:disable */
|
3
3
|
/* eslint-disable */
|
4
4
|
export * from "./internal/erc20-processor.js";
|
5
|
-
export * from "./internal/ERC20.js";
|
6
5
|
export * from "./internal/erc20-test-utils.js";
|
6
|
+
export * from "./internal/ERC20.js";
|
7
|
+
export * from "./internal/factories/ERC20__factory.js";
|
7
8
|
//# sourceMappingURL=erc20.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../src/eth/builtin/erc20.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,
|
1
|
+
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../src/eth/builtin/erc20.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wCAAwC,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n\nexport * from \"./internal/erc20-processor.js\";\nexport * from \"./internal/erc20-test-utils.js\";\nexport * from \"./internal/ERC20.js\";\nexport * from \"./internal/factories/ERC20__factory.js\";\n"]}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
/* tslint:disable */
|
3
3
|
/* eslint-disable */
|
4
4
|
export * from "./internal/erc20bytes-processor.js";
|
5
|
-
export * from "./internal/ERC20Bytes.js";
|
6
5
|
export * from "./internal/erc20bytes-test-utils.js";
|
6
|
+
export * from "./internal/ERC20Bytes.js";
|
7
|
+
export * from "./internal/factories/ERC20Bytes__factory.js";
|
7
8
|
//# sourceMappingURL=erc20bytes.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"erc20bytes.js","sourceRoot":"","sources":["../../../src/eth/builtin/erc20bytes.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,
|
1
|
+
{"version":3,"file":"erc20bytes.js","sourceRoot":"","sources":["../../../src/eth/builtin/erc20bytes.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,6CAA6C,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n\nexport * from \"./internal/erc20bytes-processor.js\";\nexport * from \"./internal/erc20bytes-test-utils.js\";\nexport * from \"./internal/ERC20Bytes.js\";\nexport * from \"./internal/factories/ERC20Bytes__factory.js\";\n"]}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
/* tslint:disable */
|
3
3
|
/* eslint-disable */
|
4
4
|
export * from "./internal/erc721-processor.js";
|
5
|
-
export * from "./internal/ERC721.js";
|
6
5
|
export * from "./internal/erc721-test-utils.js";
|
6
|
+
export * from "./internal/ERC721.js";
|
7
|
+
export * from "./internal/factories/ERC721__factory.js";
|
7
8
|
//# sourceMappingURL=erc721.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../src/eth/builtin/erc721.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,
|
1
|
+
{"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../src/eth/builtin/erc721.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,yCAAyC,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n\nexport * from \"./internal/erc721-processor.js\";\nexport * from \"./internal/erc721-test-utils.js\";\nexport * from \"./internal/ERC721.js\";\nexport * from \"./internal/factories/ERC721__factory.js\";\n"]}
|
package/lib/eth/builtin/weth9.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
/* tslint:disable */
|
3
3
|
/* eslint-disable */
|
4
4
|
export * from "./internal/weth9-processor.js";
|
5
|
-
export * from "./internal/WETH9.js";
|
6
5
|
export * from "./internal/weth9-test-utils.js";
|
6
|
+
export * from "./internal/WETH9.js";
|
7
|
+
export * from "./internal/factories/WETH9__factory.js";
|
7
8
|
//# sourceMappingURL=weth9.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"weth9.js","sourceRoot":"","sources":["../../../src/eth/builtin/weth9.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,
|
1
|
+
{"version":3,"file":"weth9.js","sourceRoot":"","sources":["../../../src/eth/builtin/weth9.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wCAAwC,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n\nexport * from \"./internal/weth9-processor.js\";\nexport * from \"./internal/weth9-test-utils.js\";\nexport * from \"./internal/WETH9.js\";\nexport * from \"./internal/factories/WETH9__factory.js\";\n"]}
|
package/lib/eth/codegen/file.js
CHANGED
@@ -6,8 +6,9 @@ import { generateBoundViewFunctions, generateViewFunctions } from './view-functi
|
|
6
6
|
export function codeGenIndex(contract) {
|
7
7
|
return `
|
8
8
|
export * from './internal/${contract.name.toLowerCase()}-processor.js'
|
9
|
-
export * from './internal/${contract.name}.js'
|
10
9
|
export * from './internal/${contract.name.toLowerCase()}-test-utils.js'
|
10
|
+
export * from './internal/${contract.name}.js'
|
11
|
+
export * from './internal/factories/${contract.name}__factory.js'
|
11
12
|
`;
|
12
13
|
}
|
13
14
|
export function codeGenSentioFile(contract) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/eth/codegen/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,+BAA+B,EAE/B,gCAAgC,EAChC,wBAAwB,GACzB,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAA;AACtF,OAAO,EAAE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AElG,MAAM,OAAO,GAAG,+BAA+B,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;IAExE,OAAO,OAAO,GAAG,MAAM,CAAA;AACzB,CAAC;AAED,SAAS,4BAA4B,CAAC,KAAuB,EAAE,YAAoB,EAAE,eAAwB;IAC3G,IAAI,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC1B,IAAI,eAAe,EAAE;QACnB,SAAS,GAAG,gCAAgC,CAAC,KAAK,CAAC,GAAG,GAAG,CAAA;KAC1D;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAA;IAE/F,OAAO;0BACiB,SAAS,uCAAuC,SAAS;4BACvD,YAAY;;WAE7B,wBAAwB,CAAC,KAAK,CAAC;WAC/B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;GAU5B,CAAA;AACH,CAAC","sourcesContent":["import {\n Contract,\n createImportsForUsedIdentifiers,\n EventDeclaration,\n getFullSignatureAsSymbolForEvent,\n getFullSignatureForEvent,\n} from 'typechain'\n\nimport { reservedKeywords } from '@sentio/ethers-v6/dist/codegen/reserved-keywords.js'\nimport { codegenCallTraceTypes, generateCallHandlers } from './functions-handler.js'\nimport { generateEventFilters, generateEventHandlers } from './event-handler.js'\nimport { generateBoundViewFunctions, generateViewFunctions } from './view-function.js'\n\nexport function codeGenIndex(contract: Contract): string {\n return ` \n export * from './internal/${contract.name.toLowerCase()}-processor.js'\n export * from './internal/${contract.name}.js'\n export * from './internal/${contract.name.toLowerCase()}-test-utils.js'\n `\n}\n\nexport function codeGenSentioFile(contract: Contract): string {\n const source = `\n ${Object.values(contract.functions).map(codegenCallTraceTypes).join('\\n')}\n\n const templateContract = ${contract.name}__factory.connect(\"0x0\", DummyProvider)\n\n export class ${contract.name}ContractView extends ContractView<${contract.name}> {\n constructor (contract: ${contract.name}) {\n super(contract);\n }\n\n ${Object.values(contract.functions)\n .filter((f) => !reservedKeywords.has(f[0].name))\n .map((fs) => generateViewFunctions(fs))\n .join('\\n')}\n }\n \n export class ${contract.name}BoundContractView extends BoundContractView<${contract.name}, \n ${contract.name}ContractView> {\n ${Object.values(contract.functions)\n .filter((f) => !reservedKeywords.has(f[0].name))\n .map((fs) => generateBoundViewFunctions(fs))\n .join('\\n')}\n }\n\n export type ${contract.name}Context = ContractContext<${contract.name}, ${contract.name}BoundContractView>\n\n export class ${contract.name}Processor extends BaseProcessor<${contract.name}, ${contract.name}BoundContractView> {\n ${Object.values(contract.events)\n .map((events) => generateEventHandlers(events, contract.name))\n .join('\\n')}\n\n ${Object.values(contract.functions)\n .map((f) => generateCallHandlers(f, contract.name))\n .join('\\n')}\n\n public static filters = {\n ${Object.values(contract.events)\n .map((events) => generateEventFilters(events))\n .join(',')}\n }\n \n protected CreateBoundContractView(): ${contract.name}BoundContractView {\n const view = get${contract.name}Contract(this.config.network, this.config.address)\n return new ${contract.name}BoundContractView(this.config.address, view)\n }\n\n public static bind(options: BindOptions): ${contract.name}Processor {\n if (!options.name) {\n options.name = \"${contract.name}\"\n }\n let processor = getProcessor(options) as ${contract.name}Processor\n if (!processor) {\n processor = new ${contract.name}Processor(options)\n addProcessor(options, processor)\n }\n return processor\n }\n}\n\nexport class ${contract.name}ProcessorTemplate extends BaseProcessorTemplate<${contract.name}, ${\n contract.name\n }BoundContractView> {\n bindInternal(options: BindOptions) {\n if (!options.name) {\n options.name = \"${contract.name}\"\n }\n let processor = getProcessor(options) as ${contract.name}Processor\n if (!processor) {\n processor = new ${contract.name}Processor(options)\n addProcessor(options, processor)\n }\n return processor\n }\n\n ${Object.values(contract.events)\n .map((events) => generateEventHandlers(events, contract.name))\n .join('\\n')}\n \n ${Object.values(contract.functions)\n .map((functions) => {\n generateCallHandlers(functions, contract.name)\n })\n .join('\\n')}\n }\n\n export function get${contract.name}Contract(contextOrNetwork: BaseContext | Networkish, address: string): ${\n contract.name\n }ContractView {\n const network = getNetworkFromCtxOrNetworkish(contextOrNetwork) \n let contract = getContractByABI(\"${contract.name}\", address, network) as ${contract.name}ContractView\n if (!contract) {\n const rawContract = ${contract.name}__factory.connect(address, getProvider(network))\n contract = new ${contract.name}ContractView(rawContract)\n addContractByABI(\"${contract.name}\", address, network, contract)\n }\n return contract\n }\n `\n const eventsImports = Object.values(contract.events).flatMap((events) => {\n if (events.length === 1) {\n return [`${events[0].name}Event`, `${events[0].name}EventFilter`]\n } else {\n return events.flatMap((e) => [\n `${getFullSignatureAsSymbolForEvent(e)}_Event`,\n `${getFullSignatureAsSymbolForEvent(e)}_EventFilter`,\n ])\n }\n })\n\n const structImports = Object.values(contract.structs).flatMap((structs) => {\n return structs.flatMap((s) => {\n if (!s.structName) {\n return []\n }\n if (s.structName.namespace) {\n return [s.structName.namespace]\n } else {\n return [s.structName.identifier + 'StructOutput', s.structName.identifier + 'Struct']\n }\n })\n })\n // dedup namespace\n const uniqueStructImports = [...new Set(structImports)]\n\n const imports = createImportsForUsedIdentifiers(\n {\n ethers: ['BigNumberish', 'Overrides', 'BytesLike'],\n 'ethers/providers': ['Networkish'],\n '@sentio/sdk/eth': [\n 'addContractByABI',\n 'getContractByABI',\n 'addProcessor',\n 'getProcessor',\n 'getProvider',\n 'transformEtherError',\n 'Trace',\n 'BindOptions',\n 'BaseProcessor',\n 'BaseProcessorTemplate',\n 'BoundContractView',\n 'ContractContext',\n 'ContractView',\n 'DummyProvider',\n 'TypedCallTrace',\n 'getNetworkFromCtxOrNetworkish',\n // 'toBlockTag',\n 'EthFetchConfig',\n ],\n '@sentio/sdk': ['BaseContext'],\n // '@sentio/protos': ['EthFetchConfig'],\n './common.js': ['PromiseOrValue'],\n './index.js': [`${contract.name}`, `${contract.name}__factory`],\n [`./${contract.name}.js`]: eventsImports.concat(uniqueStructImports),\n },\n source\n )\n\n return imports + source\n}\n\nexport function codeGenTestUtilsFile(contract: Contract): string {\n const source = `\n const mockField = {\n blockHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n blockNumber: 0,\n logIndex: 0,\n removed: false,\n transactionHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n transactionIndex: 0,\n }\n ${Object.values(contract.events)\n .map((events) => {\n if (events.length === 1) {\n return generateMockEventLogFunction(events[0], contract.name, false)\n } else {\n return events.map((e) => generateMockEventLogFunction(e, contract.name, true)).join('\\n')\n }\n })\n .join('\\n')}\n `\n\n const possibleImports = {\n 'ethers/providers': ['LogParams'],\n } as any\n possibleImports[`./${contract.name}.js`] = Object.values(contract.events).flatMap((events) => {\n if (events.length === 1) {\n return `${events[0].name}EventObject`\n } else {\n return events.flatMap((e) => `${getFullSignatureAsSymbolForEvent(e)}_EventObject`)\n }\n })\n\n possibleImports[`./${contract.name.toLowerCase()}-processor.js`] = [`get${contract.name}Contract`]\n\n const imports = createImportsForUsedIdentifiers(possibleImports, source)\n\n return imports + source\n}\n\nfunction generateMockEventLogFunction(event: EventDeclaration, contractName: string, includeArgTypes: boolean): string {\n let eventName = event.name\n if (includeArgTypes) {\n eventName = getFullSignatureAsSymbolForEvent(event) + '_'\n }\n\n const eventArgs = event.inputs.map((input, i) => `event.${input.name ?? `arg${i.toString()}`}`)\n\n return `\n export function mock${eventName}Log(contractAddress: string, event: ${eventName}EventObject): LogParams {\n const contract = get${contractName}Contract(1, contractAddress)\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n '${getFullSignatureForEvent(event)}',\n [${eventArgs.join(', ')}]\n )\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n }\n }\n `\n}\n"]}
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/eth/codegen/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,+BAA+B,EAE/B,gCAAgC,EAChC,wBAAwB,GACzB,MAAM,WAAW,CAAA;AAElB,O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AI,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,UAAU,CAAC,CAAA;IAElG,MAAM,OAAO,GAAG,+BAA+B,CAAC,eAAe,EAAE,MAAM,CAAC,CAAA;IAExE,OAAO,OAAO,GAAG,MAAM,CAAA;AACzB,CAAC;AAED,SAAS,4BAA4B,CAAC,KAAuB,EAAE,YAAoB,EAAE,eAAwB;IAC3G,IAAI,SAAS,GAAG,KAAK,CAAC,IAAI,CAAA;IAC1B,IAAI,eAAe,EAAE;QACnB,SAAS,GAAG,gCAAgC,CAAC,KAAK,CAAC,GAAG,GAAG,CAAA;KAC1D;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAA;IAE/F,OAAO;0BACiB,SAAS,uCAAuC,SAAS;4BACvD,YAAY;;WAE7B,wBAAwB,CAAC,KAAK,CAAC;WAC/B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;GAU5B,CAAA;AACH,CAAC","sourcesContent":["import {\n Contract,\n createImportsForUsedIdentifiers,\n EventDeclaration,\n getFullSignatureAsSymbolForEvent,\n getFullSignatureForEvent,\n} from 'typechain'\n\nimport { reservedKeywords } from '@sentio/ethers-v6/dist/codegen/reserved-keywords.js'\nimport { codegenCallTraceTypes, generateCallHandlers } from './functions-handler.js'\nimport { generateEventFilters, generateEventHandlers } from './event-handler.js'\nimport { generateBoundViewFunctions, generateViewFunctions } from './view-function.js'\n\nexport function codeGenIndex(contract: Contract): string {\n return ` \n export * from './internal/${contract.name.toLowerCase()}-processor.js'\n export * from './internal/${contract.name.toLowerCase()}-test-utils.js'\n export * from './internal/${contract.name}.js'\n export * from './internal/factories/${contract.name}__factory.js'\n `\n}\n\nexport function codeGenSentioFile(contract: Contract): string {\n const source = `\n ${Object.values(contract.functions).map(codegenCallTraceTypes).join('\\n')}\n\n const templateContract = ${contract.name}__factory.connect(\"0x0\", DummyProvider)\n\n export class ${contract.name}ContractView extends ContractView<${contract.name}> {\n constructor (contract: ${contract.name}) {\n super(contract);\n }\n\n ${Object.values(contract.functions)\n .filter((f) => !reservedKeywords.has(f[0].name))\n .map((fs) => generateViewFunctions(fs))\n .join('\\n')}\n }\n \n export class ${contract.name}BoundContractView extends BoundContractView<${contract.name}, \n ${contract.name}ContractView> {\n ${Object.values(contract.functions)\n .filter((f) => !reservedKeywords.has(f[0].name))\n .map((fs) => generateBoundViewFunctions(fs))\n .join('\\n')}\n }\n\n export type ${contract.name}Context = ContractContext<${contract.name}, ${contract.name}BoundContractView>\n\n export class ${contract.name}Processor extends BaseProcessor<${contract.name}, ${contract.name}BoundContractView> {\n ${Object.values(contract.events)\n .map((events) => generateEventHandlers(events, contract.name))\n .join('\\n')}\n\n ${Object.values(contract.functions)\n .map((f) => generateCallHandlers(f, contract.name))\n .join('\\n')}\n\n public static filters = {\n ${Object.values(contract.events)\n .map((events) => generateEventFilters(events))\n .join(',')}\n }\n \n protected CreateBoundContractView(): ${contract.name}BoundContractView {\n const view = get${contract.name}Contract(this.config.network, this.config.address)\n return new ${contract.name}BoundContractView(this.config.address, view)\n }\n\n public static bind(options: BindOptions): ${contract.name}Processor {\n if (!options.name) {\n options.name = \"${contract.name}\"\n }\n let processor = getProcessor(options) as ${contract.name}Processor\n if (!processor) {\n processor = new ${contract.name}Processor(options)\n addProcessor(options, processor)\n }\n return processor\n }\n}\n\nexport class ${contract.name}ProcessorTemplate extends BaseProcessorTemplate<${contract.name}, ${\n contract.name\n }BoundContractView> {\n bindInternal(options: BindOptions) {\n if (!options.name) {\n options.name = \"${contract.name}\"\n }\n let processor = getProcessor(options) as ${contract.name}Processor\n if (!processor) {\n processor = new ${contract.name}Processor(options)\n addProcessor(options, processor)\n }\n return processor\n }\n\n ${Object.values(contract.events)\n .map((events) => generateEventHandlers(events, contract.name))\n .join('\\n')}\n \n ${Object.values(contract.functions)\n .map((functions) => {\n generateCallHandlers(functions, contract.name)\n })\n .join('\\n')}\n }\n\n export function get${contract.name}Contract(contextOrNetwork: BaseContext | Networkish, address: string): ${\n contract.name\n }ContractView {\n const network = getNetworkFromCtxOrNetworkish(contextOrNetwork) \n let contract = getContractByABI(\"${contract.name}\", address, network) as ${contract.name}ContractView\n if (!contract) {\n const rawContract = ${contract.name}__factory.connect(address, getProvider(network))\n contract = new ${contract.name}ContractView(rawContract)\n addContractByABI(\"${contract.name}\", address, network, contract)\n }\n return contract\n }\n `\n const eventsImports = Object.values(contract.events).flatMap((events) => {\n if (events.length === 1) {\n return [`${events[0].name}Event`, `${events[0].name}EventFilter`]\n } else {\n return events.flatMap((e) => [\n `${getFullSignatureAsSymbolForEvent(e)}_Event`,\n `${getFullSignatureAsSymbolForEvent(e)}_EventFilter`,\n ])\n }\n })\n\n const structImports = Object.values(contract.structs).flatMap((structs) => {\n return structs.flatMap((s) => {\n if (!s.structName) {\n return []\n }\n if (s.structName.namespace) {\n return [s.structName.namespace]\n } else {\n return [s.structName.identifier + 'StructOutput', s.structName.identifier + 'Struct']\n }\n })\n })\n // dedup namespace\n const uniqueStructImports = [...new Set(structImports)]\n\n const imports = createImportsForUsedIdentifiers(\n {\n ethers: ['BigNumberish', 'Overrides', 'BytesLike'],\n 'ethers/providers': ['Networkish'],\n '@sentio/sdk/eth': [\n 'addContractByABI',\n 'getContractByABI',\n 'addProcessor',\n 'getProcessor',\n 'getProvider',\n 'transformEtherError',\n 'Trace',\n 'BindOptions',\n 'BaseProcessor',\n 'BaseProcessorTemplate',\n 'BoundContractView',\n 'ContractContext',\n 'ContractView',\n 'DummyProvider',\n 'TypedCallTrace',\n 'getNetworkFromCtxOrNetworkish',\n // 'toBlockTag',\n 'EthFetchConfig',\n ],\n '@sentio/sdk': ['BaseContext'],\n // '@sentio/protos': ['EthFetchConfig'],\n './common.js': ['PromiseOrValue'],\n './index.js': [`${contract.name}`, `${contract.name}__factory`],\n [`./${contract.name}.js`]: eventsImports.concat(uniqueStructImports),\n },\n source\n )\n\n return imports + source\n}\n\nexport function codeGenTestUtilsFile(contract: Contract): string {\n const source = `\n const mockField = {\n blockHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n blockNumber: 0,\n logIndex: 0,\n removed: false,\n transactionHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n transactionIndex: 0,\n }\n ${Object.values(contract.events)\n .map((events) => {\n if (events.length === 1) {\n return generateMockEventLogFunction(events[0], contract.name, false)\n } else {\n return events.map((e) => generateMockEventLogFunction(e, contract.name, true)).join('\\n')\n }\n })\n .join('\\n')}\n `\n\n const possibleImports = {\n 'ethers/providers': ['LogParams'],\n } as any\n possibleImports[`./${contract.name}.js`] = Object.values(contract.events).flatMap((events) => {\n if (events.length === 1) {\n return `${events[0].name}EventObject`\n } else {\n return events.flatMap((e) => `${getFullSignatureAsSymbolForEvent(e)}_EventObject`)\n }\n })\n\n possibleImports[`./${contract.name.toLowerCase()}-processor.js`] = [`get${contract.name}Contract`]\n\n const imports = createImportsForUsedIdentifiers(possibleImports, source)\n\n return imports + source\n}\n\nfunction generateMockEventLogFunction(event: EventDeclaration, contractName: string, includeArgTypes: boolean): string {\n let eventName = event.name\n if (includeArgTypes) {\n eventName = getFullSignatureAsSymbolForEvent(event) + '_'\n }\n\n const eventArgs = event.inputs.map((input, i) => `event.${input.name ?? `arg${i.toString()}`}`)\n\n return `\n export function mock${eventName}Log(contractAddress: string, event: ${eventName}EventObject): LogParams {\n const contract = get${contractName}Contract(1, contractAddress)\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n '${getFullSignatureForEvent(event)}',\n [${eventArgs.join(', ')}]\n )\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n }\n }\n `\n}\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentio/sdk",
|
3
3
|
"license": "Apache-2.0",
|
4
|
-
"version": "2.13.3
|
4
|
+
"version": "2.13.3",
|
5
5
|
"type": "module",
|
6
6
|
"dependencies": {
|
7
7
|
"@mysten/sui.js": "npm:@sentio/sui.js@^0.32.0-patch.1",
|
@@ -30,8 +30,8 @@
|
|
30
30
|
"nice-grpc-common": "^2.0.2",
|
31
31
|
"@coral-xyz/borsh": "^0.27.0",
|
32
32
|
"typedoc": "^0.24.1",
|
33
|
-
"@sentio/protos": "2.13.3
|
34
|
-
"@sentio/runtime": "2.13.3
|
33
|
+
"@sentio/protos": "2.13.3",
|
34
|
+
"@sentio/runtime": "2.13.3"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
37
|
"@certusone/wormhole-sdk": "^0.9.10",
|
@@ -3,5 +3,6 @@
|
|
3
3
|
/* eslint-disable */
|
4
4
|
|
5
5
|
export * from "./internal/eacaggregatorproxy-processor.js";
|
6
|
-
export * from "./internal/EACAggregatorProxy.js";
|
7
6
|
export * from "./internal/eacaggregatorproxy-test-utils.js";
|
7
|
+
export * from "./internal/EACAggregatorProxy.js";
|
8
|
+
export * from "./internal/factories/EACAggregatorProxy__factory.js";
|
package/src/eth/builtin/erc20.ts
CHANGED
@@ -3,5 +3,6 @@
|
|
3
3
|
/* eslint-disable */
|
4
4
|
|
5
5
|
export * from "./internal/erc20bytes-processor.js";
|
6
|
-
export * from "./internal/ERC20Bytes.js";
|
7
6
|
export * from "./internal/erc20bytes-test-utils.js";
|
7
|
+
export * from "./internal/ERC20Bytes.js";
|
8
|
+
export * from "./internal/factories/ERC20Bytes__factory.js";
|
package/src/eth/builtin/weth9.ts
CHANGED
package/src/eth/codegen/file.ts
CHANGED
@@ -14,8 +14,9 @@ import { generateBoundViewFunctions, generateViewFunctions } from './view-functi
|
|
14
14
|
export function codeGenIndex(contract: Contract): string {
|
15
15
|
return `
|
16
16
|
export * from './internal/${contract.name.toLowerCase()}-processor.js'
|
17
|
-
export * from './internal/${contract.name}.js'
|
18
17
|
export * from './internal/${contract.name.toLowerCase()}-test-utils.js'
|
18
|
+
export * from './internal/${contract.name}.js'
|
19
|
+
export * from './internal/factories/${contract.name}__factory.js'
|
19
20
|
`
|
20
21
|
}
|
21
22
|
|