@sentio/sdk 2.1.3-rc.1 → 2.1.4-rc.1

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.
Files changed (93) hide show
  1. package/lib/eth/builtin/eacaggregatorproxy.d.ts +3 -0
  2. package/lib/eth/builtin/eacaggregatorproxy.js +7 -0
  3. package/lib/eth/builtin/eacaggregatorproxy.js.map +1 -0
  4. package/lib/eth/builtin/erc1155.d.ts +3 -0
  5. package/lib/eth/builtin/erc1155.js +7 -0
  6. package/lib/eth/builtin/erc1155.js.map +1 -0
  7. package/lib/eth/builtin/erc20.d.ts +3 -0
  8. package/lib/eth/builtin/erc20.js +7 -0
  9. package/lib/eth/builtin/erc20.js.map +1 -0
  10. package/lib/eth/builtin/erc20bytes.d.ts +3 -0
  11. package/lib/eth/builtin/erc20bytes.js +7 -0
  12. package/lib/eth/builtin/erc20bytes.js.map +1 -0
  13. package/lib/eth/builtin/erc721.d.ts +3 -0
  14. package/lib/eth/builtin/erc721.js +7 -0
  15. package/lib/eth/builtin/erc721.js.map +1 -0
  16. package/lib/eth/builtin/index.d.ts +12 -8
  17. package/lib/eth/builtin/index.js +15 -8
  18. package/lib/eth/builtin/index.js.map +1 -1
  19. package/lib/eth/builtin/{eacaggregatorproxy/test-utils.d.ts → internal/eacaggregatorproxy_test-utils.d.ts} +1 -1
  20. package/lib/eth/builtin/{eacaggregatorproxy/test-utils.js → internal/eacaggregatorproxy_test-utils.js} +2 -2
  21. package/lib/eth/builtin/internal/eacaggregatorproxy_test-utils.js.map +1 -0
  22. package/lib/eth/builtin/{erc1155/test-utils.d.ts → internal/erc1155_test-utils.d.ts} +1 -1
  23. package/lib/eth/builtin/{erc1155/test-utils.js → internal/erc1155_test-utils.js} +2 -2
  24. package/lib/eth/builtin/internal/erc1155_test-utils.js.map +1 -0
  25. package/lib/eth/builtin/{erc20/test-utils.d.ts → internal/erc20_test-utils.d.ts} +1 -1
  26. package/lib/eth/builtin/{erc20/test-utils.js → internal/erc20_test-utils.js} +2 -2
  27. package/lib/eth/builtin/internal/erc20_test-utils.js.map +1 -0
  28. package/lib/eth/builtin/{erc20bytes/test-utils.d.ts → internal/erc20bytes_test-utils.d.ts} +1 -1
  29. package/lib/eth/builtin/{erc20bytes/test-utils.js → internal/erc20bytes_test-utils.js} +2 -2
  30. package/lib/eth/builtin/internal/erc20bytes_test-utils.js.map +1 -0
  31. package/lib/eth/builtin/{erc721/test-utils.d.ts → internal/erc721_test-utils.d.ts} +1 -1
  32. package/lib/eth/builtin/{erc721/test-utils.js → internal/erc721_test-utils.js} +2 -2
  33. package/lib/eth/builtin/internal/erc721_test-utils.js.map +1 -0
  34. package/lib/eth/builtin/{weth9/test-utils.d.ts → internal/weth9_test-utils.d.ts} +1 -1
  35. package/lib/eth/builtin/{weth9/test-utils.js → internal/weth9_test-utils.js} +2 -2
  36. package/lib/eth/builtin/internal/weth9_test-utils.js.map +1 -0
  37. package/lib/eth/builtin/weth9.d.ts +3 -0
  38. package/lib/eth/builtin/weth9.js +7 -0
  39. package/lib/eth/builtin/weth9.js.map +1 -0
  40. package/lib/eth/codegen/ethers-sentio.d.ts +1 -0
  41. package/lib/eth/codegen/ethers-sentio.js +21 -4
  42. package/lib/eth/codegen/ethers-sentio.js.map +1 -1
  43. package/lib/eth/codegen/file.js +15 -16
  44. package/lib/eth/codegen/file.js.map +1 -1
  45. package/lib/utils/token.js +1 -1
  46. package/lib/utils/token.js.map +1 -1
  47. package/package.json +10 -10
  48. package/src/eth/builtin/eacaggregatorproxy.ts +7 -0
  49. package/src/eth/builtin/erc1155.ts +7 -0
  50. package/src/eth/builtin/erc20.ts +7 -0
  51. package/src/eth/builtin/erc20bytes.ts +7 -0
  52. package/src/eth/builtin/erc721.ts +7 -0
  53. package/src/eth/builtin/index.ts +27 -8
  54. package/src/eth/builtin/{eacaggregatorproxy/test-utils.ts → internal/eacaggregatorproxy_test-utils.ts} +2 -2
  55. package/src/eth/builtin/{erc1155/test-utils.ts → internal/erc1155_test-utils.ts} +2 -2
  56. package/src/eth/builtin/{erc20/test-utils.ts → internal/erc20_test-utils.ts} +2 -2
  57. package/src/eth/builtin/{erc20bytes/test-utils.ts → internal/erc20bytes_test-utils.ts} +2 -5
  58. package/src/eth/builtin/{erc721/test-utils.ts → internal/erc721_test-utils.ts} +2 -2
  59. package/src/eth/builtin/{weth9/test-utils.ts → internal/weth9_test-utils.ts} +2 -2
  60. package/src/eth/builtin/weth9.ts +7 -0
  61. package/src/eth/codegen/ethers-sentio.ts +31 -5
  62. package/src/eth/codegen/file.ts +17 -19
  63. package/src/utils/token.ts +1 -1
  64. package/lib/eth/builtin/eacaggregatorproxy/index.d.ts +0 -3
  65. package/lib/eth/builtin/eacaggregatorproxy/index.js +0 -7
  66. package/lib/eth/builtin/eacaggregatorproxy/index.js.map +0 -1
  67. package/lib/eth/builtin/eacaggregatorproxy/test-utils.js.map +0 -1
  68. package/lib/eth/builtin/erc1155/index.d.ts +0 -3
  69. package/lib/eth/builtin/erc1155/index.js +0 -7
  70. package/lib/eth/builtin/erc1155/index.js.map +0 -1
  71. package/lib/eth/builtin/erc1155/test-utils.js.map +0 -1
  72. package/lib/eth/builtin/erc20/index.d.ts +0 -3
  73. package/lib/eth/builtin/erc20/index.js +0 -7
  74. package/lib/eth/builtin/erc20/index.js.map +0 -1
  75. package/lib/eth/builtin/erc20/test-utils.js.map +0 -1
  76. package/lib/eth/builtin/erc20bytes/index.d.ts +0 -3
  77. package/lib/eth/builtin/erc20bytes/index.js +0 -7
  78. package/lib/eth/builtin/erc20bytes/index.js.map +0 -1
  79. package/lib/eth/builtin/erc20bytes/test-utils.js.map +0 -1
  80. package/lib/eth/builtin/erc721/index.d.ts +0 -3
  81. package/lib/eth/builtin/erc721/index.js +0 -7
  82. package/lib/eth/builtin/erc721/index.js.map +0 -1
  83. package/lib/eth/builtin/erc721/test-utils.js.map +0 -1
  84. package/lib/eth/builtin/weth9/index.d.ts +0 -3
  85. package/lib/eth/builtin/weth9/index.js +0 -7
  86. package/lib/eth/builtin/weth9/index.js.map +0 -1
  87. package/lib/eth/builtin/weth9/test-utils.js.map +0 -1
  88. package/src/eth/builtin/eacaggregatorproxy/index.ts +0 -7
  89. package/src/eth/builtin/erc1155/index.ts +0 -7
  90. package/src/eth/builtin/erc20/index.ts +0 -7
  91. package/src/eth/builtin/erc20bytes/index.ts +0 -7
  92. package/src/eth/builtin/erc721/index.ts +0 -7
  93. package/src/eth/builtin/weth9/index.ts +0 -7
@@ -0,0 +1,3 @@
1
+ export * from "./internal/eacaggregatorproxy_processor.js";
2
+ export * from "./internal/EACAggregatorProxy.js";
3
+ export * from "./internal/eacaggregatorproxy_test-utils.js";
@@ -0,0 +1,7 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export * from "./internal/eacaggregatorproxy_processor.js";
5
+ export * from "./internal/EACAggregatorProxy.js";
6
+ export * from "./internal/eacaggregatorproxy_test-utils.js";
7
+ //# sourceMappingURL=eacaggregatorproxy.js.map
@@ -0,0 +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,6CAA6C,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.js\";\nexport * from \"./internal/eacaggregatorproxy_test-utils.js\";\n"]}
@@ -0,0 +1,3 @@
1
+ export * from "./internal/erc1155_processor.js";
2
+ export * from "./internal/ERC1155.js";
3
+ export * from "./internal/erc1155_test-utils.js";
@@ -0,0 +1,7 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export * from "./internal/erc1155_processor.js";
5
+ export * from "./internal/ERC1155.js";
6
+ export * from "./internal/erc1155_test-utils.js";
7
+ //# sourceMappingURL=erc1155.js.map
@@ -0,0 +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,kCAAkC,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.js\";\nexport * from \"./internal/erc1155_test-utils.js\";\n"]}
@@ -0,0 +1,3 @@
1
+ export * from "./internal/erc20_processor.js";
2
+ export * from "./internal/ERC20.js";
3
+ export * from "./internal/erc20_test-utils.js";
@@ -0,0 +1,7 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export * from "./internal/erc20_processor.js";
5
+ export * from "./internal/ERC20.js";
6
+ export * from "./internal/erc20_test-utils.js";
7
+ //# sourceMappingURL=erc20.js.map
@@ -0,0 +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,gCAAgC,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.js\";\nexport * from \"./internal/erc20_test-utils.js\";\n"]}
@@ -0,0 +1,3 @@
1
+ export * from "./internal/erc20bytes_processor.js";
2
+ export * from "./internal/ERC20Bytes.js";
3
+ export * from "./internal/erc20bytes_test-utils.js";
@@ -0,0 +1,7 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export * from "./internal/erc20bytes_processor.js";
5
+ export * from "./internal/ERC20Bytes.js";
6
+ export * from "./internal/erc20bytes_test-utils.js";
7
+ //# sourceMappingURL=erc20bytes.js.map
@@ -0,0 +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,qCAAqC,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.js\";\nexport * from \"./internal/erc20bytes_test-utils.js\";\n"]}
@@ -0,0 +1,3 @@
1
+ export * from "./internal/erc721_processor.js";
2
+ export * from "./internal/ERC721.js";
3
+ export * from "./internal/erc721_test-utils.js";
@@ -0,0 +1,7 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export * from "./internal/erc721_processor.js";
5
+ export * from "./internal/ERC721.js";
6
+ export * from "./internal/erc721_test-utils.js";
7
+ //# sourceMappingURL=erc721.js.map
@@ -0,0 +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,iCAAiC,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.js\";\nexport * from \"./internal/erc721_test-utils.js\";\n"]}
@@ -1,8 +1,12 @@
1
- export * as eacaggregatorproxy from './eacaggregatorproxy/index.js';
2
- export { EACAggregatorProxyProcessor, EACAggregatorProxyProcessorTemplate } from './eacaggregatorproxy/index.js';
3
- export * as erc20 from './erc20/index.js';
4
- export { ERC20Processor, ERC20ProcessorTemplate } from './erc20/index.js';
5
- export * as erc20bytes from './erc20bytes/index.js';
6
- export { ERC20BytesProcessor, ERC20BytesProcessorTemplate } from './erc20bytes/index.js';
7
- export * as weth9 from './weth9/index.js';
8
- export { WETH9Processor, WETH9ProcessorTemplate } from './weth9/index.js';
1
+ export * as eacaggregatorproxy from "./eacaggregatorproxy.js";
2
+ export { EACAggregatorProxyProcessor, EACAggregatorProxyProcessorTemplate, } from "./eacaggregatorproxy.js";
3
+ export * as erc1155 from "./erc1155.js";
4
+ export { ERC1155Processor, ERC1155ProcessorTemplate } from "./erc1155.js";
5
+ export * as erc20 from "./erc20.js";
6
+ export { ERC20Processor, ERC20ProcessorTemplate } from "./erc20.js";
7
+ export * as erc20bytes from "./erc20bytes.js";
8
+ export { ERC20BytesProcessor, ERC20BytesProcessorTemplate, } from "./erc20bytes.js";
9
+ export * as erc721 from "./erc721.js";
10
+ export { ERC721Processor, ERC721ProcessorTemplate } from "./erc721.js";
11
+ export * as weth9 from "./weth9.js";
12
+ export { WETH9Processor, WETH9ProcessorTemplate } from "./weth9.js";
@@ -1,9 +1,16 @@
1
- export * as eacaggregatorproxy from './eacaggregatorproxy/index.js';
2
- export { EACAggregatorProxyProcessor, EACAggregatorProxyProcessorTemplate } from './eacaggregatorproxy/index.js';
3
- export * as erc20 from './erc20/index.js';
4
- export { ERC20Processor, ERC20ProcessorTemplate } from './erc20/index.js';
5
- export * as erc20bytes from './erc20bytes/index.js';
6
- export { ERC20BytesProcessor, ERC20BytesProcessorTemplate } from './erc20bytes/index.js';
7
- export * as weth9 from './weth9/index.js';
8
- export { WETH9Processor, WETH9ProcessorTemplate } from './weth9/index.js';
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export * as eacaggregatorproxy from "./eacaggregatorproxy.js";
5
+ export { EACAggregatorProxyProcessor, EACAggregatorProxyProcessorTemplate, } from "./eacaggregatorproxy.js";
6
+ export * as erc1155 from "./erc1155.js";
7
+ export { ERC1155Processor, ERC1155ProcessorTemplate } from "./erc1155.js";
8
+ export * as erc20 from "./erc20.js";
9
+ export { ERC20Processor, ERC20ProcessorTemplate } from "./erc20.js";
10
+ export * as erc20bytes from "./erc20bytes.js";
11
+ export { ERC20BytesProcessor, ERC20BytesProcessorTemplate, } from "./erc20bytes.js";
12
+ export * as erc721 from "./erc721.js";
13
+ export { ERC721Processor, ERC721ProcessorTemplate } from "./erc721.js";
14
+ export * as weth9 from "./weth9.js";
15
+ export { WETH9Processor, WETH9ProcessorTemplate } from "./weth9.js";
9
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/eth/builtin/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAE,2BAA2B,EAAE,mCAAmC,EAAE,MAAM,+BAA+B,CAAA;AAChH,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzE,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAA;AACxF,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["export * as eacaggregatorproxy from './eacaggregatorproxy/index.js'\nexport { EACAggregatorProxyProcessor, EACAggregatorProxyProcessorTemplate } from './eacaggregatorproxy/index.js'\nexport * as erc20 from './erc20/index.js'\nexport { ERC20Processor, ERC20ProcessorTemplate } from './erc20/index.js'\nexport * as erc20bytes from './erc20bytes/index.js'\nexport { ERC20BytesProcessor, ERC20BytesProcessorTemplate } from './erc20bytes/index.js'\nexport * as weth9 from './weth9/index.js'\nexport { WETH9Processor, WETH9ProcessorTemplate } from './weth9/index.js'"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/eth/builtin/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAEpB,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,2BAA2B,EAC3B,mCAAmC,GACpC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpE,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n\nexport * as eacaggregatorproxy from \"./eacaggregatorproxy.js\";\nexport {\n EACAggregatorProxyProcessor,\n EACAggregatorProxyProcessorTemplate,\n} from \"./eacaggregatorproxy.js\";\n\nexport * as erc1155 from \"./erc1155.js\";\nexport { ERC1155Processor, ERC1155ProcessorTemplate } from \"./erc1155.js\";\n\nexport * as erc20 from \"./erc20.js\";\nexport { ERC20Processor, ERC20ProcessorTemplate } from \"./erc20.js\";\n\nexport * as erc20bytes from \"./erc20bytes.js\";\nexport {\n ERC20BytesProcessor,\n ERC20BytesProcessorTemplate,\n} from \"./erc20bytes.js\";\n\nexport * as erc721 from \"./erc721.js\";\nexport { ERC721Processor, ERC721ProcessorTemplate } from \"./erc721.js\";\n\nexport * as weth9 from \"./weth9.js\";\nexport { WETH9Processor, WETH9ProcessorTemplate } from \"./weth9.js\";\n"]}
@@ -1,5 +1,5 @@
1
1
  import { LogParams } from "ethers/providers";
2
- import { AnswerUpdatedEventObject, NewRoundEventObject, OwnershipTransferRequestedEventObject, OwnershipTransferredEventObject } from "./index.js";
2
+ import { AnswerUpdatedEventObject, NewRoundEventObject, OwnershipTransferRequestedEventObject, OwnershipTransferredEventObject } from "./EACAggregatorProxy.js";
3
3
  export declare function mockAnswerUpdatedLog(contractAddress: string, event: AnswerUpdatedEventObject): LogParams;
4
4
  export declare function mockNewRoundLog(contractAddress: string, event: NewRoundEventObject): LogParams;
5
5
  export declare function mockOwnershipTransferRequestedLog(contractAddress: string, event: OwnershipTransferRequestedEventObject): LogParams;
@@ -1,4 +1,4 @@
1
- import { getEACAggregatorProxyContract, } from "./index.js";
1
+ import { getEACAggregatorProxyContract } from "./eacaggregatorproxy_processor.js";
2
2
  const mockField = {
3
3
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
4
4
  blockNumber: 0,
@@ -51,4 +51,4 @@ export function mockOwnershipTransferredLog(contractAddress, event) {
51
51
  topics: encodedLog.topics,
52
52
  };
53
53
  }
54
- //# sourceMappingURL=test-utils.js.map
54
+ //# sourceMappingURL=eacaggregatorproxy_test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eacaggregatorproxy_test-utils.js","sourceRoot":"","sources":["../../../../src/eth/builtin/internal/eacaggregatorproxy_test-utils.ts"],"names":[],"mappings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Q,GAAG,6BAA6B,CAAC,eAAe,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAC9D,6CAA6C,EAC7C,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CACvB,CAAC;IACF,OAAO;QACL,GAAG,SAAS;QACZ,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,eAAuB,EACvB,KAAsC;IAEtC,MAAM,QAAQ,GAAG,6BAA6B,CAAC,eAAe,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAC9D,uCAAuC,EACvC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CACvB,CAAC;IACF,OAAO;QACL,GAAG,SAAS;QACZ,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\nimport { LogParams } from \"ethers/providers\";\nimport {\n AnswerUpdatedEventObject,\n NewRoundEventObject,\n OwnershipTransferRequestedEventObject,\n OwnershipTransferredEventObject,\n} from \"./EACAggregatorProxy.js\";\nimport { getEACAggregatorProxyContract } from \"./eacaggregatorproxy_processor.js\";\nconst mockField = {\n blockHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n blockNumber: 0,\n logIndex: 0,\n removed: false,\n transactionHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n transactionIndex: 0,\n};\n\nexport function mockAnswerUpdatedLog(\n contractAddress: string,\n event: AnswerUpdatedEventObject\n): LogParams {\n const contract = getEACAggregatorProxyContract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"AnswerUpdated(int256,uint256,uint256)\",\n [event.current, event.roundId, event.updatedAt]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockNewRoundLog(\n contractAddress: string,\n event: NewRoundEventObject\n): LogParams {\n const contract = getEACAggregatorProxyContract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"NewRound(uint256,address,uint256)\",\n [event.roundId, event.startedBy, event.startedAt]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockOwnershipTransferRequestedLog(\n contractAddress: string,\n event: OwnershipTransferRequestedEventObject\n): LogParams {\n const contract = getEACAggregatorProxyContract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"OwnershipTransferRequested(address,address)\",\n [event.from, event.to]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockOwnershipTransferredLog(\n contractAddress: string,\n event: OwnershipTransferredEventObject\n): LogParams {\n const contract = getEACAggregatorProxyContract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"OwnershipTransferred(address,address)\",\n [event.from, event.to]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { LogParams } from "ethers/providers";
2
- import { ApprovalForAllEventObject, TransferBatchEventObject, TransferSingleEventObject, URIEventObject } from "./index.js";
2
+ import { ApprovalForAllEventObject, TransferBatchEventObject, TransferSingleEventObject, URIEventObject } from "./ERC1155.js";
3
3
  export declare function mockApprovalForAllLog(contractAddress: string, event: ApprovalForAllEventObject): LogParams;
4
4
  export declare function mockTransferBatchLog(contractAddress: string, event: TransferBatchEventObject): LogParams;
5
5
  export declare function mockTransferSingleLog(contractAddress: string, event: TransferSingleEventObject): LogParams;
@@ -1,4 +1,4 @@
1
- import { getERC1155Contract, } from "./index.js";
1
+ import { getERC1155Contract } from "./erc1155_processor.js";
2
2
  const mockField = {
3
3
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
4
4
  blockNumber: 0,
@@ -51,4 +51,4 @@ export function mockURILog(contractAddress, event) {
51
51
  topics: encodedLog.topics,
52
52
  };
53
53
  }
54
- //# sourceMappingURL=test-utils.js.map
54
+ //# sourceMappingURL=erc1155_test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"erc1155_test-utils.js","sourceRoot":"","sources":["../../../../src/eth/builtin/internal/erc1155_test-utils.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,MAAM,SAAS,GAAG;IAChB,SAAS,EACP,oEAAoE;IACtE,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,eAAe,EACb,oEAAoE;IACtE,gBAAgB,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,UAAU,qBAAqB,CACnC,eAAuB,EACvB,KAAgC;IAEhC,MAAM,QAAQ,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAC9D,sCAAsC,EACtC,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAChD,CAAC;IACF,OAAO;QACL,GAAG,SAAS;QACZ,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ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C,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,CACxB,CAAC;IACF,OAAO;QACL,GAAG,SAAS;QACZ,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\nimport { LogParams } from \"ethers/providers\";\nimport {\n ApprovalForAllEventObject,\n TransferBatchEventObject,\n TransferSingleEventObject,\n URIEventObject,\n} from \"./ERC1155.js\";\nimport { getERC1155Contract } from \"./erc1155_processor.js\";\nconst mockField = {\n blockHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n blockNumber: 0,\n logIndex: 0,\n removed: false,\n transactionHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n transactionIndex: 0,\n};\n\nexport function mockApprovalForAllLog(\n contractAddress: string,\n event: ApprovalForAllEventObject\n): LogParams {\n const contract = getERC1155Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"ApprovalForAll(address,address,bool)\",\n [event.account, event.operator, event.approved]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockTransferBatchLog(\n contractAddress: string,\n event: TransferBatchEventObject\n): LogParams {\n const contract = getERC1155Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"TransferBatch(address,address,address,uint256[],uint256[])\",\n [event.operator, event.from, event.to, event.ids, event.values]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockTransferSingleLog(\n contractAddress: string,\n event: TransferSingleEventObject\n): LogParams {\n const contract = getERC1155Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"TransferSingle(address,address,address,uint256,uint256)\",\n [event.operator, event.from, event.to, event.id, event.value]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockURILog(\n contractAddress: string,\n event: URIEventObject\n): LogParams {\n const contract = getERC1155Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"URI(string,uint256)\",\n [event.value, event.id]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { LogParams } from "ethers/providers";
2
- import { ApprovalEventObject, OwnershipTransferredEventObject, TransferEventObject } from "./index.js";
2
+ import { ApprovalEventObject, OwnershipTransferredEventObject, TransferEventObject } from "./ERC20.js";
3
3
  export declare function mockApprovalLog(contractAddress: string, event: ApprovalEventObject): LogParams;
4
4
  export declare function mockOwnershipTransferredLog(contractAddress: string, event: OwnershipTransferredEventObject): LogParams;
5
5
  export declare function mockTransferLog(contractAddress: string, event: TransferEventObject): LogParams;
@@ -1,4 +1,4 @@
1
- import { getERC20Contract, } from "./index.js";
1
+ import { getERC20Contract } from "./erc20_processor.js";
2
2
  const mockField = {
3
3
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
4
4
  blockNumber: 0,
@@ -40,4 +40,4 @@ export function mockTransferLog(contractAddress, event) {
40
40
  topics: encodedLog.topics,
41
41
  };
42
42
  }
43
- //# sourceMappingURL=test-utils.js.map
43
+ //# sourceMappingURL=erc20_test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"erc20_test-utils.js","sourceRoot":"","sources":["../../../../src/eth/builtin/internal/erc20_test-utils.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,MAAM,SAAS,GAAG;IAChB,SAAS,EACP,oEAAoE;IACtE,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC;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E,EAAE,KAAK,CAAC,KAAK,CAAC,CACpC,CAAC;IACF,OAAO;QACL,GAAG,SAAS;QACZ,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\nimport { LogParams } from \"ethers/providers\";\nimport {\n ApprovalEventObject,\n OwnershipTransferredEventObject,\n TransferEventObject,\n} from \"./ERC20.js\";\nimport { getERC20Contract } from \"./erc20_processor.js\";\nconst mockField = {\n blockHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n blockNumber: 0,\n logIndex: 0,\n removed: false,\n transactionHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n transactionIndex: 0,\n};\n\nexport function mockApprovalLog(\n contractAddress: string,\n event: ApprovalEventObject\n): LogParams {\n const contract = getERC20Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"Approval(address,address,uint256)\",\n [event.owner, event.spender, event.value]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockOwnershipTransferredLog(\n contractAddress: string,\n event: OwnershipTransferredEventObject\n): LogParams {\n const contract = getERC20Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"OwnershipTransferred(address,address)\",\n [event.previousOwner, event.newOwner]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockTransferLog(\n contractAddress: string,\n event: TransferEventObject\n): LogParams {\n const contract = getERC20Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"Transfer(address,address,uint256)\",\n [event.from, event.to, event.value]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  import { LogParams } from "ethers/providers";
2
- import { ApprovalEventObject, TransferEventObject } from "./index.js";
2
+ import { ApprovalEventObject, TransferEventObject } from "./ERC20Bytes.js";
3
3
  export declare function mockApprovalLog(contractAddress: string, event: ApprovalEventObject): LogParams;
4
4
  export declare function mockTransferLog(contractAddress: string, event: TransferEventObject): LogParams;
@@ -1,4 +1,4 @@
1
- import { getERC20BytesContract, } from "./index.js";
1
+ import { getERC20BytesContract } from "./erc20bytes_processor.js";
2
2
  const mockField = {
3
3
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
4
4
  blockNumber: 0,
@@ -29,4 +29,4 @@ export function mockTransferLog(contractAddress, event) {
29
29
  topics: encodedLog.topics,
30
30
  };
31
31
  }
32
- //# sourceMappingURL=test-utils.js.map
32
+ //# sourceMappingURL=erc20bytes_test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"erc20bytes_test-utils.js","sourceRoot":"","sources":["../../../../src/eth/builtin/internal/erc20bytes_test-utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,MAAM,SAAS,GAAG;IAChB,SAAS,EACP,oEAAoE;IACtE,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,eAAe,EACb,oEAAoE;IACtE,gBAAgB,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,UAAU,eAAe,CAC7B,eAAuB,EACvB,KAA0B;IAE1B,MAAM,QAAQ,GAAG,qBAAqB,CAAC,eAAe,CAAC,CAAC;IACxD,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAC9D,mCAAmC,EACnC,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAC1C,CAAC;IACF,OAAO;QACL,GAAG,SAAS;QACZ,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,eAAuB,EACvB,KAA0B;IAE1B,MAAM,QAAQ,GAAG,qBAAqB,CAAC,eAAe,CAAC,CAAC;IACxD,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAC9D,mCAAmC,EACnC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CACpC,CAAC;IACF,OAAO;QACL,GAAG,SAAS;QACZ,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\nimport { LogParams } from \"ethers/providers\";\nimport { ApprovalEventObject, TransferEventObject } from \"./ERC20Bytes.js\";\nimport { getERC20BytesContract } from \"./erc20bytes_processor.js\";\nconst mockField = {\n blockHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n blockNumber: 0,\n logIndex: 0,\n removed: false,\n transactionHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n transactionIndex: 0,\n};\n\nexport function mockApprovalLog(\n contractAddress: string,\n event: ApprovalEventObject\n): LogParams {\n const contract = getERC20BytesContract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"Approval(address,address,uint256)\",\n [event.owner, event.spender, event.value]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockTransferLog(\n contractAddress: string,\n event: TransferEventObject\n): LogParams {\n const contract = getERC20BytesContract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"Transfer(address,address,uint256)\",\n [event.from, event.to, event.value]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { LogParams } from "ethers/providers";
2
- import { ApprovalEventObject, ApprovalForAllEventObject, TransferEventObject } from "./index.js";
2
+ import { ApprovalEventObject, ApprovalForAllEventObject, TransferEventObject } from "./ERC721.js";
3
3
  export declare function mockApprovalLog(contractAddress: string, event: ApprovalEventObject): LogParams;
4
4
  export declare function mockApprovalForAllLog(contractAddress: string, event: ApprovalForAllEventObject): LogParams;
5
5
  export declare function mockTransferLog(contractAddress: string, event: TransferEventObject): LogParams;
@@ -1,4 +1,4 @@
1
- import { getERC721Contract, } from "./index.js";
1
+ import { getERC721Contract } from "./erc721_processor.js";
2
2
  const mockField = {
3
3
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
4
4
  blockNumber: 0,
@@ -40,4 +40,4 @@ export function mockTransferLog(contractAddress, event) {
40
40
  topics: encodedLog.topics,
41
41
  };
42
42
  }
43
- //# sourceMappingURL=test-utils.js.map
43
+ //# sourceMappingURL=erc721_test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"erc721_test-utils.js","sourceRoot":"","sources":["../../../../src/eth/builtin/internal/erc721_test-utils.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,MAAM,SAAS,GAAG;IAChB,SAAS,EACP,oEAAoE;IACtE,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,eAAe,EACb,oEAAoE;IACtE,gBAAgB,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,UAAU,eAAe,CAC7B,eAAuB,EACvB,KAA0B;IAE1B,MAAM,QAAQ,GA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AAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\nimport { LogParams } from \"ethers/providers\";\nimport {\n ApprovalEventObject,\n ApprovalForAllEventObject,\n TransferEventObject,\n} from \"./ERC721.js\";\nimport { getERC721Contract } from \"./erc721_processor.js\";\nconst mockField = {\n blockHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n blockNumber: 0,\n logIndex: 0,\n removed: false,\n transactionHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n transactionIndex: 0,\n};\n\nexport function mockApprovalLog(\n contractAddress: string,\n event: ApprovalEventObject\n): LogParams {\n const contract = getERC721Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"Approval(address,address,uint256)\",\n [event.owner, event.approved, event.tokenId]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockApprovalForAllLog(\n contractAddress: string,\n event: ApprovalForAllEventObject\n): LogParams {\n const contract = getERC721Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"ApprovalForAll(address,address,bool)\",\n [event.owner, event.operator, event.approved]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockTransferLog(\n contractAddress: string,\n event: TransferEventObject\n): LogParams {\n const contract = getERC721Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"Transfer(address,address,uint256)\",\n [event.from, event.to, event.tokenId]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { LogParams } from "ethers/providers";
2
- import { ApprovalEventObject, TransferEventObject, DepositEventObject, WithdrawalEventObject } from "./index.js";
2
+ import { ApprovalEventObject, TransferEventObject, DepositEventObject, WithdrawalEventObject } from "./WETH9.js";
3
3
  export declare function mockApprovalLog(contractAddress: string, event: ApprovalEventObject): LogParams;
4
4
  export declare function mockTransferLog(contractAddress: string, event: TransferEventObject): LogParams;
5
5
  export declare function mockDepositLog(contractAddress: string, event: DepositEventObject): LogParams;
@@ -1,4 +1,4 @@
1
- import { getWETH9Contract, } from "./index.js";
1
+ import { getWETH9Contract } from "./weth9_processor.js";
2
2
  const mockField = {
3
3
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
4
4
  blockNumber: 0,
@@ -51,4 +51,4 @@ export function mockWithdrawalLog(contractAddress, event) {
51
51
  topics: encodedLog.topics,
52
52
  };
53
53
  }
54
- //# sourceMappingURL=test-utils.js.map
54
+ //# sourceMappingURL=weth9_test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weth9_test-utils.js","sourceRoot":"","sources":["../../../../src/eth/builtin/internal/weth9_test-utils.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,MAAM,SAAS,GAAG;IAChB,SAAS,EACP,oEAAoE;IACtE,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,eAAe,EACb,oEAAoE;IACtE,gBAAgB,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,UAAU,eAAe,CAC7B,eAAuB,EACvB,KAA0B;IAE1B,MAAM,QAAQ,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,cAAc,CAC9D,mCAAmC,EACnC,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAClC,CAAC;IACF,OAAO;QACL,GAAG,SAAS;QACZ,KAAK,EAAE,CAAC;QACR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AC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CACvB,CAAC;IACF,OAAO;QACL,GAAG,SAAS;QACZ,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,MAAM,EAAE,UAAU,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\nimport { LogParams } from \"ethers/providers\";\nimport {\n ApprovalEventObject,\n TransferEventObject,\n DepositEventObject,\n WithdrawalEventObject,\n} from \"./WETH9.js\";\nimport { getWETH9Contract } from \"./weth9_processor.js\";\nconst mockField = {\n blockHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n blockNumber: 0,\n logIndex: 0,\n removed: false,\n transactionHash:\n \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n transactionIndex: 0,\n};\n\nexport function mockApprovalLog(\n contractAddress: string,\n event: ApprovalEventObject\n): LogParams {\n const contract = getWETH9Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"Approval(address,address,uint256)\",\n [event.src, event.guy, event.wad]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockTransferLog(\n contractAddress: string,\n event: TransferEventObject\n): LogParams {\n const contract = getWETH9Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"Transfer(address,address,uint256)\",\n [event.src, event.dst, event.wad]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockDepositLog(\n contractAddress: string,\n event: DepositEventObject\n): LogParams {\n const contract = getWETH9Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"Deposit(address,uint256)\",\n [event.dst, event.wad]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n\nexport function mockWithdrawalLog(\n contractAddress: string,\n event: WithdrawalEventObject\n): LogParams {\n const contract = getWETH9Contract(contractAddress);\n const encodedLog = contract.rawContract.interface.encodeEventLog(\n \"Withdrawal(address,uint256)\",\n [event.src, event.wad]\n );\n return {\n ...mockField,\n index: 0,\n address: contractAddress,\n data: encodedLog.data,\n topics: encodedLog.topics,\n };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export * from "./internal/weth9_processor.js";
2
+ export * from "./internal/WETH9.js";
3
+ export * from "./internal/weth9_test-utils.js";
@@ -0,0 +1,7 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ export * from "./internal/weth9_processor.js";
5
+ export * from "./internal/WETH9.js";
6
+ export * from "./internal/weth9_test-utils.js";
7
+ //# sourceMappingURL=weth9.js.map
@@ -0,0 +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,gCAAgC,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.js\";\nexport * from \"./internal/weth9_test-utils.js\";\n"]}
@@ -2,6 +2,7 @@ import Ethers from '@sentio/ethers-v6';
2
2
  import { Config, FileDescription } from 'typechain';
3
3
  export default class EthersSentio extends Ethers.default {
4
4
  constructor(config: Config);
5
+ private processedContracts;
5
6
  transformAbiOrFullJsonFile(file: FileDescription): FileDescription[] | void;
6
7
  afterRun(): FileDescription[];
7
8
  }
@@ -1,5 +1,5 @@
1
1
  import Ethers from '@sentio/ethers-v6';
2
- import { extractAbi, extractDocumentation, parse, shortenFullJsonFilePath } from 'typechain';
2
+ import { extractAbi, extractDocumentation, parse, shortenFullJsonFilePath, } from 'typechain';
3
3
  import { dirname, join, relative } from 'path';
4
4
  import { codeGenIndex, codeGenSentioFile, codeGenTestUtilsFile } from './file.js';
5
5
  export default class EthersSentio extends Ethers.default {
@@ -9,6 +9,7 @@ export default class EthersSentio extends Ethers.default {
9
9
  }
10
10
  super(config);
11
11
  }
12
+ processedContracts = [];
12
13
  // TODO(pc): also have to override transformBinFile, transformFile
13
14
  transformAbiOrFullJsonFile(file) {
14
15
  const abi = extractAbi(file.contents);
@@ -19,6 +20,7 @@ export default class EthersSentio extends Ethers.default {
19
20
  const jsonPath = relative(this.cfg.inputDir, shortenFullJsonFilePath(file.path, this.cfg.allFiles));
20
21
  const contract = parse(abi, jsonPath, documentation);
21
22
  const files = super.transformAbiOrFullJsonFile(file);
23
+ this.processedContracts.push(contract);
22
24
  if (files !== undefined) {
23
25
  // files.forEach(this.transformFilePath)
24
26
  // for (const file of files) {
@@ -31,11 +33,11 @@ export default class EthersSentio extends Ethers.default {
31
33
  contents: codeGenSentioFile(contract),
32
34
  },
33
35
  {
34
- path: join(dirname(files[0].path), '..', contract.name.toLowerCase(), 'index.ts'),
36
+ path: join(dirname(files[0].path), '..', `${contract.name.toLowerCase()}.ts`),
35
37
  contents: codeGenIndex(contract),
36
38
  },
37
39
  {
38
- path: join(dirname(files[0].path), '..', contract.name.toLowerCase(), 'test-utils.ts'),
40
+ path: join(dirname(files[0].path), `${contract.name.toLowerCase()}_test-utils.ts`),
39
41
  contents: codeGenTestUtilsFile(contract),
40
42
  },
41
43
  ];
@@ -47,10 +49,25 @@ export default class EthersSentio extends Ethers.default {
47
49
  if (file.path.endsWith('__factory.ts')) {
48
50
  file.contents = '// @ts-nocheck\n' + file.contents;
49
51
  }
50
- if (file.path.endsWith('factories/index.ts')) {
52
+ else if (file.path.endsWith('factories/index.ts')) {
51
53
  file.contents = file.contents.replaceAll("__factory'", "__factory.js'");
52
54
  }
55
+ else if (file.path.endsWith('_processor.ts')) {
56
+ }
57
+ }
58
+ let indexContent = '';
59
+ for (const contract of this.processedContracts) {
60
+ indexContent =
61
+ indexContent +
62
+ `
63
+ export * as ${contract.name.toLowerCase()} from './${contract.name.toLowerCase()}.js'
64
+ export { ${contract.name}Processor, ${contract.name}ProcessorTemplate } from './${contract.name.toLowerCase()}.js'
65
+ `;
53
66
  }
67
+ files.push({
68
+ path: join(dirname(files[0].path), '../index.ts'),
69
+ contents: indexContent,
70
+ });
54
71
  return files;
55
72
  }
56
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ethers-sentio.js","sourceRoot":"","sources":["../../../src/eth/codegen/ethers-sentio.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAU,UAAU,EAAE,oBAAoB,EAAmB,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AACrH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEjF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM,CAAC,OAAO;IACtD,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;SAC/C;QACD,KAAK,CAAC,MAAM,CAAC,CAAA;IACf,CAAC;IAED,kEAAkE;IACzD,0BAA0B,CAAC,IAAqB;QACvD,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;YACpB,OAAM;SACP;QAED,MAAM,aAAa,GAAG,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAEzD,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,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C,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;gBACtC,IAAI,CAAC,QAAQ,GAAG,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAA;aACnD;YACD,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE;gBAC5C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,eAAe,CAAC,CAAA;aACxE;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF","sourcesContent":["import Ethers from '@sentio/ethers-v6'\nimport { Config, extractAbi, extractDocumentation, FileDescription, parse, shortenFullJsonFilePath } from 'typechain'\nimport { dirname, join, relative } from 'path'\nimport { codeGenIndex, codeGenSentioFile, codeGenTestUtilsFile } from './file.js'\n\nexport default class EthersSentio extends Ethers.default {\n constructor(config: Config) {\n if (!config.outDir) {\n throw new Error('Out put path not specificed')\n }\n super(config)\n }\n\n // TODO(pc): also have to override transformBinFile, transformFile\n override transformAbiOrFullJsonFile(file: FileDescription): FileDescription[] | void {\n const abi = extractAbi(file.contents)\n if (abi.length === 0) {\n return\n }\n\n const documentation = extractDocumentation(file.contents)\n\n const jsonPath = relative(this.cfg.inputDir, shortenFullJsonFilePath(file.path, this.cfg.allFiles))\n const contract = parse(abi, jsonPath, documentation)\n const files = super.transformAbiOrFullJsonFile(file)\n\n if (files !== undefined) {\n // files.forEach(this.transformFilePath)\n // for (const file of files) {\n // this.transformFilePath(file)\n // }\n\n return [\n ...files,\n {\n path: join(dirname(files[0].path), `${contract.name.toLowerCase()}_processor.ts`),\n contents: codeGenSentioFile(contract),\n },\n {\n path: join(dirname(files[0].path), '..', contract.name.toLowerCase(), 'index.ts'),\n contents: codeGenIndex(contract),\n },\n {\n path: join(dirname(files[0].path), '..', contract.name.toLowerCase(), 'test-utils.ts'),\n contents: codeGenTestUtilsFile(contract),\n },\n ]\n }\n }\n\n override afterRun() {\n const files = super.afterRun()\n for (const [idx, file] of files.entries()) {\n if (file.path.endsWith('__factory.ts')) {\n file.contents = '// @ts-nocheck\\n' + file.contents\n }\n if (file.path.endsWith('factories/index.ts')) {\n file.contents = file.contents.replaceAll(\"__factory'\", \"__factory.js'\")\n }\n }\n return files\n }\n}\n"]}
1
+ {"version":3,"file":"ethers-sentio.js","sourceRoot":"","sources":["../../../src/eth/codegen/ethers-sentio.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAEL,UAAU,EACV,oBAAoB,EAEpB,KAAK,EACL,uBAAuB,GAExB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEjF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM,CAAC,OAAO;IACtD,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;SAC/C;QACD,KAAK,CAAC,MAAM,CAAC,CAAA;IACf,CAAC;IAEO,kBAAkB,GAAe,EAAE,CAAA;IAE3C,kEAAkE;IACzD,0BAA0B,CAAC,IAAqB;QACvD,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACrC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;YACpB,OAAM;SACP;QAED,MAAM,aAAa,GAAG,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAEzD,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,uBAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAA;QACnG,MAAM,QAAQ,GA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BAAkB,GAAG,IAAI,CAAC,QAAQ,CAAA;aACnD;iBAAM,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE;gBACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,eAAe,CAAC,CAAA;aACxE;iBAAM,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;aAC/C;SACF;QACD,IAAI,YAAY,GAAG,EAAE,CAAA;QACrB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC9C,YAAY;gBACV,YAAY;oBACZ;0BACkB,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE;uBACrE,QAAQ,CAAC,IAAI,cAC1B,QAAQ,CAAC,IACX,+BAA+B,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE;aACrD,CAAA;SACR;QACD,KAAK,CAAC,IAAI,CAAC;YACT,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;YACjD,QAAQ,EAAE,YAAY;SACvB,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;CACF","sourcesContent":["import Ethers from '@sentio/ethers-v6'\nimport {\n Config,\n extractAbi,\n extractDocumentation,\n FileDescription,\n parse,\n shortenFullJsonFilePath,\n Contract,\n} from 'typechain'\nimport { dirname, join, relative } from 'path'\nimport { codeGenIndex, codeGenSentioFile, codeGenTestUtilsFile } from './file.js'\n\nexport default class EthersSentio extends Ethers.default {\n constructor(config: Config) {\n if (!config.outDir) {\n throw new Error('Out put path not specificed')\n }\n super(config)\n }\n\n private processedContracts: Contract[] = []\n\n // TODO(pc): also have to override transformBinFile, transformFile\n override transformAbiOrFullJsonFile(file: FileDescription): FileDescription[] | void {\n const abi = extractAbi(file.contents)\n if (abi.length === 0) {\n return\n }\n\n const documentation = extractDocumentation(file.contents)\n\n const jsonPath = relative(this.cfg.inputDir, shortenFullJsonFilePath(file.path, this.cfg.allFiles))\n const contract = parse(abi, jsonPath, documentation)\n const files = super.transformAbiOrFullJsonFile(file)\n this.processedContracts.push(contract)\n\n if (files !== undefined) {\n // files.forEach(this.transformFilePath)\n // for (const file of files) {\n // this.transformFilePath(file)\n // }\n\n return [\n ...files,\n {\n path: join(dirname(files[0].path), `${contract.name.toLowerCase()}_processor.ts`),\n contents: codeGenSentioFile(contract),\n },\n {\n path: join(dirname(files[0].path), '..', `${contract.name.toLowerCase()}.ts`),\n contents: codeGenIndex(contract),\n },\n {\n path: join(dirname(files[0].path), `${contract.name.toLowerCase()}_test-utils.ts`),\n contents: codeGenTestUtilsFile(contract),\n },\n ]\n }\n }\n\n override afterRun() {\n const files = super.afterRun()\n for (const [idx, file] of files.entries()) {\n if (file.path.endsWith('__factory.ts')) {\n file.contents = '// @ts-nocheck\\n' + file.contents\n } else if (file.path.endsWith('factories/index.ts')) {\n file.contents = file.contents.replaceAll(\"__factory'\", \"__factory.js'\")\n } else if (file.path.endsWith('_processor.ts')) {\n }\n }\n let indexContent = ''\n for (const contract of this.processedContracts) {\n indexContent =\n indexContent +\n `\n export * as ${contract.name.toLowerCase()} from './${contract.name.toLowerCase()}.js'\n export { ${contract.name}Processor, ${\n contract.name\n }ProcessorTemplate } from './${contract.name.toLowerCase()}.js'\n `\n }\n files.push({\n path: join(dirname(files[0].path), '../index.ts'),\n contents: indexContent,\n })\n return files\n }\n}\n"]}
@@ -5,9 +5,9 @@ import { generateEventFilters, generateEventHandlers } from './event-handler.js'
5
5
  import { generateBoundViewFunctions, generateViewFunctions } from './view-function.js';
6
6
  export function codeGenIndex(contract) {
7
7
  return `
8
- export * from '../internal/${contract.name.toLowerCase()}_processor.js'
9
- export * from '../internal/${contract.name}.js'
10
- export * from './test-utils.js'
8
+ export * from './internal/${contract.name.toLowerCase()}_processor.js'
9
+ export * from './internal/${contract.name}.js'
10
+ export * from './internal/${contract.name.toLowerCase()}_test-utils.js'
11
11
  `;
12
12
  }
13
13
  export function codeGenSentioFile(contract) {
@@ -182,20 +182,19 @@ export function codeGenTestUtilsFile(contract) {
182
182
  })
183
183
  .join('\n')}
184
184
  `;
185
- const imports = createImportsForUsedIdentifiers({
185
+ const possibleImports = {
186
186
  'ethers/providers': ['LogParams'],
187
- './index.js': [
188
- `get${contract.name}Contract`,
189
- ...Object.values(contract.events).flatMap((events) => {
190
- if (events.length === 1) {
191
- return `${events[0].name}EventObject`;
192
- }
193
- else {
194
- return events.flatMap((e) => `${getFullSignatureAsSymbolForEvent(e)}_EventObject`);
195
- }
196
- }),
197
- ],
198
- }, source);
187
+ };
188
+ possibleImports[`./${contract.name}.js`] = Object.values(contract.events).flatMap((events) => {
189
+ if (events.length === 1) {
190
+ return `${events[0].name}EventObject`;
191
+ }
192
+ else {
193
+ return events.flatMap((e) => `${getFullSignatureAsSymbolForEvent(e)}_EventObject`);
194
+ }
195
+ });
196
+ possibleImports[`./${contract.name.toLowerCase()}_processor.js`] = [`get${contract.name}Contract`];
197
+ const imports = createImportsForUsedIdentifiers(possibleImports, source);
199
198
  return imports + source;
200
199
  }
201
200
  function generateMockEventLogFunction(event, contractName, includeArgTypes) {
@@ -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,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AACpF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAChF,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,C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AS,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 './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.address, this.config.network)\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\n export function get${contract.name}Contract(address: string, network: Networkish = 1): ${contract.name}ContractView {\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 'toBlockTag',\n ],\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 imports = createImportsForUsedIdentifiers(\n {\n 'ethers/providers': ['LogParams'],\n './index.js': [\n `get${contract.name}Contract`,\n ...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 },\n source\n )\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(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,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAA;AACtF,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AACpF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAChF,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAEtF,MAAM,UAAU,YAAY,CAAC,QAAkB;IAC7C,OAAO;8BACqB,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE;8BAC3B,QAAQ,CAAC,IAAI;8BACb,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE;GACtD,CAAA;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAkB;IAClD,MAAM,MAAM,GAAG;IACb,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;6BAE9C,QAAQ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,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.address, this.config.network)\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\n export function get${contract.name}Contract(address: string, network: Networkish = 1): ${contract.name}ContractView {\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 'toBlockTag',\n ],\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(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"]}