@sentio/sdk 1.7.14 → 1.7.17

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 (283) hide show
  1. package/{base-processor-template.d.ts → lib/base-processor-template.d.ts} +0 -0
  2. package/{base-processor-template.js → lib/base-processor-template.js} +0 -0
  3. package/{base-processor-template.js.map → lib/base-processor-template.js.map} +0 -0
  4. package/{base-processor.d.ts → lib/base-processor.d.ts} +0 -0
  5. package/{base-processor.js → lib/base-processor.js} +0 -0
  6. package/{base-processor.js.map → lib/base-processor.js.map} +0 -0
  7. package/{bind-options.d.ts → lib/bind-options.d.ts} +0 -0
  8. package/{bind-options.js → lib/bind-options.js} +0 -0
  9. package/{bind-options.js.map → lib/bind-options.js.map} +0 -0
  10. package/{binds.d.ts → lib/binds.d.ts} +0 -0
  11. package/{binds.js → lib/binds.js} +0 -0
  12. package/{binds.js.map → lib/binds.js.map} +0 -0
  13. package/{builtin → lib/builtin}/erc20/index.d.ts +0 -0
  14. package/{builtin → lib/builtin}/erc20/index.js +0 -0
  15. package/{builtin → lib/builtin}/erc20/index.js.map +0 -0
  16. package/{builtin → lib/builtin}/erc20/test-utils.d.ts +0 -0
  17. package/{builtin → lib/builtin}/erc20/test-utils.js +0 -0
  18. package/{builtin → lib/builtin}/erc20/test-utils.js.map +0 -0
  19. package/{builtin → lib/builtin}/internal/Erc20.d.ts +0 -0
  20. package/{builtin → lib/builtin}/internal/Erc20.js +0 -0
  21. package/{builtin → lib/builtin}/internal/Erc20.js.map +0 -0
  22. package/lib/builtin/internal/Weth9.d.ts +221 -0
  23. package/lib/builtin/internal/Weth9.js +3 -0
  24. package/lib/builtin/internal/Weth9.js.map +1 -0
  25. package/{builtin → lib/builtin}/internal/common.d.ts +0 -0
  26. package/{builtin → lib/builtin}/internal/common.js +0 -0
  27. package/{builtin → lib/builtin}/internal/common.js.map +0 -0
  28. package/{builtin → lib/builtin}/internal/erc20_processor.d.ts +0 -0
  29. package/{builtin → lib/builtin}/internal/erc20_processor.js +0 -0
  30. package/{builtin → lib/builtin}/internal/erc20_processor.js.map +0 -0
  31. package/{builtin → lib/builtin}/internal/factories/Erc20__factory.d.ts +0 -0
  32. package/{builtin → lib/builtin}/internal/factories/Erc20__factory.js +0 -0
  33. package/{builtin → lib/builtin}/internal/factories/Erc20__factory.js.map +0 -0
  34. package/lib/builtin/internal/factories/Weth9__factory.d.ts +45 -0
  35. package/lib/builtin/internal/factories/Weth9__factory.js +297 -0
  36. package/lib/builtin/internal/factories/Weth9__factory.js.map +1 -0
  37. package/{builtin → lib/builtin}/internal/factories/index.d.ts +1 -0
  38. package/{builtin → lib/builtin}/internal/factories/index.js +3 -1
  39. package/lib/builtin/internal/factories/index.js.map +1 -0
  40. package/{builtin → lib/builtin}/internal/index.d.ts +2 -0
  41. package/{builtin → lib/builtin}/internal/index.js +3 -1
  42. package/lib/builtin/internal/index.js.map +1 -0
  43. package/lib/builtin/internal/weth9_processor.d.ts +50 -0
  44. package/lib/builtin/internal/weth9_processor.js +295 -0
  45. package/lib/builtin/internal/weth9_processor.js.map +1 -0
  46. package/lib/builtin/weth9/index.d.ts +2 -0
  47. package/lib/builtin/weth9/index.js +22 -0
  48. package/lib/builtin/weth9/index.js.map +1 -0
  49. package/lib/builtin/weth9/test-utils.d.ts +6 -0
  50. package/lib/builtin/weth9/test-utils.js +57 -0
  51. package/lib/builtin/weth9/test-utils.js.map +1 -0
  52. package/{chain-config.d.ts → lib/chain-config.d.ts} +0 -0
  53. package/{chain-config.js → lib/chain-config.js} +0 -0
  54. package/{chain-config.js.map → lib/chain-config.js.map} +0 -0
  55. package/{cli → lib/cli}/build.d.ts +0 -0
  56. package/{cli → lib/cli}/build.js +14 -0
  57. package/lib/cli/build.js.map +1 -0
  58. package/{cli → lib/cli}/cli.d.ts +0 -0
  59. package/{cli → lib/cli}/cli.js +0 -0
  60. package/{cli → lib/cli}/cli.js.map +0 -0
  61. package/{cli → lib/cli}/config.d.ts +0 -0
  62. package/{cli → lib/cli}/config.js +0 -0
  63. package/{cli → lib/cli}/config.js.map +0 -0
  64. package/{cli → lib/cli}/key.d.ts +0 -0
  65. package/{cli → lib/cli}/key.js +0 -0
  66. package/{cli → lib/cli}/key.js.map +0 -0
  67. package/{cli → lib/cli}/solana-code-gen.d.ts +0 -0
  68. package/{cli → lib/cli}/solana-code-gen.js +0 -0
  69. package/{cli → lib/cli}/solana-code-gen.js.map +0 -0
  70. package/{cli → lib/cli}/upload.d.ts +0 -0
  71. package/{cli → lib/cli}/upload.js +0 -0
  72. package/{cli → lib/cli}/upload.js.map +0 -0
  73. package/{cli → lib/cli}/webpack.config.js +0 -0
  74. package/{context.d.ts → lib/context.d.ts} +0 -0
  75. package/{context.js → lib/context.js} +0 -0
  76. package/{context.js.map → lib/context.js.map} +0 -0
  77. package/{contract-namer.d.ts → lib/contract-namer.d.ts} +0 -0
  78. package/{contract-namer.js → lib/contract-namer.js} +0 -0
  79. package/{contract-namer.js.map → lib/contract-namer.js.map} +0 -0
  80. package/{error.d.ts → lib/error.d.ts} +0 -0
  81. package/{error.js → lib/error.js} +0 -0
  82. package/{error.js.map → lib/error.js.map} +0 -0
  83. package/{gen → lib/gen}/builtin.d.ts +0 -0
  84. package/{gen → lib/gen}/builtin.js +0 -0
  85. package/{gen → lib/gen}/builtin.js.map +0 -0
  86. package/{gen → lib/gen}/google/protobuf/empty.d.ts +0 -0
  87. package/{gen → lib/gen}/google/protobuf/empty.js +0 -0
  88. package/{gen → lib/gen}/google/protobuf/empty.js.map +0 -0
  89. package/{gen → lib/gen}/processor/protos/processor.d.ts +0 -0
  90. package/{gen → lib/gen}/processor/protos/processor.js +0 -0
  91. package/{gen → lib/gen}/processor/protos/processor.js.map +0 -0
  92. package/{generic-processor.d.ts → lib/generic-processor.d.ts} +0 -0
  93. package/{generic-processor.js → lib/generic-processor.js} +0 -0
  94. package/{generic-processor.js.map → lib/generic-processor.js.map} +0 -0
  95. package/{index.d.ts → lib/index.d.ts} +0 -0
  96. package/{index.js → lib/index.js} +0 -0
  97. package/{index.js.map → lib/index.js.map} +0 -0
  98. package/lib/loader.d.ts +5 -0
  99. package/lib/loader.js +30 -0
  100. package/lib/loader.js.map +1 -0
  101. package/{meter.d.ts → lib/meter.d.ts} +0 -0
  102. package/{meter.js → lib/meter.js} +0 -0
  103. package/{meter.js.map → lib/meter.js.map} +0 -0
  104. package/{numberish.d.ts → lib/numberish.d.ts} +0 -0
  105. package/{numberish.js → lib/numberish.js} +0 -0
  106. package/{numberish.js.map → lib/numberish.js.map} +0 -0
  107. package/{numberish.test.d.ts → lib/numberish.test.d.ts} +0 -0
  108. package/{numberish.test.js → lib/numberish.test.js} +0 -0
  109. package/{numberish.test.js.map → lib/numberish.test.js.map} +0 -0
  110. package/{processor-runner.d.ts → lib/processor-runner.d.ts} +0 -0
  111. package/{processor-runner.js → lib/processor-runner.js} +2 -27
  112. package/lib/processor-runner.js.map +1 -0
  113. package/{processor-state.d.ts → lib/processor-state.d.ts} +0 -0
  114. package/{processor-state.js → lib/processor-state.js} +0 -0
  115. package/{processor-state.js.map → lib/processor-state.js.map} +0 -0
  116. package/{promise-or-void.d.ts → lib/promise-or-void.d.ts} +0 -0
  117. package/{promise-or-void.js → lib/promise-or-void.js} +0 -0
  118. package/{promise-or-void.js.map → lib/promise-or-void.js.map} +0 -0
  119. package/{provider.d.ts → lib/provider.d.ts} +0 -0
  120. package/{provider.js → lib/provider.js} +0 -0
  121. package/{provider.js.map → lib/provider.js.map} +0 -0
  122. package/{release.config.js → lib/release.config.js} +0 -0
  123. package/{service.d.ts → lib/service.d.ts} +2 -1
  124. package/{service.js → lib/service.js} +6 -3
  125. package/lib/service.js.map +1 -0
  126. package/{solana → lib/solana}/builtin/index.d.ts +0 -0
  127. package/{solana → lib/solana}/builtin/index.js +0 -0
  128. package/{solana → lib/solana}/builtin/index.js.map +0 -0
  129. package/{solana → lib/solana}/builtin/spl-token-processor.d.ts +0 -0
  130. package/{solana → lib/solana}/builtin/spl-token-processor.js +0 -0
  131. package/{solana → lib/solana}/builtin/spl-token-processor.js.map +0 -0
  132. package/{solana → lib/solana}/builtin/types.d.ts +0 -0
  133. package/{solana → lib/solana}/builtin/types.js +0 -0
  134. package/{solana → lib/solana}/builtin/types.js.map +0 -0
  135. package/{solana → lib/solana}/builtin/wormhole-processor.d.ts +0 -0
  136. package/{solana → lib/solana}/builtin/wormhole-processor.js +0 -0
  137. package/{solana → lib/solana}/builtin/wormhole-processor.js.map +0 -0
  138. package/{solana-processor.d.ts → lib/solana-processor.d.ts} +0 -0
  139. package/{solana-processor.js → lib/solana-processor.js} +0 -0
  140. package/{solana-processor.js.map → lib/solana-processor.js.map} +0 -0
  141. package/{target-ethers-sentio → lib/target-ethers-sentio}/codegen.d.ts +0 -0
  142. package/{target-ethers-sentio → lib/target-ethers-sentio}/codegen.js +0 -0
  143. package/lib/target-ethers-sentio/codegen.js.map +1 -0
  144. package/{target-ethers-sentio → lib/target-ethers-sentio}/index.d.ts +0 -0
  145. package/{target-ethers-sentio → lib/target-ethers-sentio}/index.js +0 -0
  146. package/lib/target-ethers-sentio/index.js.map +1 -0
  147. package/{test → lib/test}/codegen.test.d.ts +0 -0
  148. package/{test → lib/test}/codegen.test.js +1 -1
  149. package/{test → lib/test}/codegen.test.js.map +1 -1
  150. package/{test → lib/test}/erc20-template.d.ts +0 -0
  151. package/{test → lib/test}/erc20-template.js +0 -0
  152. package/{test → lib/test}/erc20-template.js.map +0 -0
  153. package/{test → lib/test}/erc20-template.test.d.ts +0 -0
  154. package/{test → lib/test}/erc20-template.test.js +1 -3
  155. package/lib/test/erc20-template.test.js.map +1 -0
  156. package/{test → lib/test}/erc20.d.ts +0 -0
  157. package/{test → lib/test}/erc20.js +0 -0
  158. package/{test → lib/test}/erc20.js.map +0 -0
  159. package/{test → lib/test}/erc20.test.d.ts +0 -0
  160. package/{test → lib/test}/erc20.test.js +1 -3
  161. package/lib/test/erc20.test.js.map +1 -0
  162. package/{test → lib/test}/generic-processor.test.d.ts +0 -0
  163. package/{test → lib/test}/generic-processor.test.js +3 -3
  164. package/lib/test/generic-processor.test.js.map +1 -0
  165. package/{test → lib/test}/index.d.ts +0 -0
  166. package/{test → lib/test}/index.js +0 -0
  167. package/{test → lib/test}/index.js.map +0 -0
  168. package/{test → lib/test}/metric-utils.d.ts +0 -0
  169. package/{test → lib/test}/metric-utils.js +0 -0
  170. package/{test → lib/test}/metric-utils.js.map +0 -0
  171. package/{test → lib/test}/mirrorworld.d.ts +0 -0
  172. package/{test → lib/test}/mirrorworld.js +0 -0
  173. package/{test → lib/test}/mirrorworld.js.map +0 -0
  174. package/{test → lib/test}/solana.test.d.ts +0 -0
  175. package/{test → lib/test}/solana.test.js +3 -3
  176. package/lib/test/solana.test.js.map +1 -0
  177. package/{test → lib/test}/test-processor-server.d.ts +1 -1
  178. package/{test → lib/test}/test-processor-server.js +3 -8
  179. package/lib/test/test-processor-server.js.map +1 -0
  180. package/{test → lib/test}/types/game_wallet.d.ts +0 -0
  181. package/{test → lib/test}/types/game_wallet.js +0 -0
  182. package/{test → lib/test}/types/game_wallet.js.map +0 -0
  183. package/{test → lib/test}/types/game_wallet_processor.d.ts +0 -0
  184. package/{test → lib/test}/types/game_wallet_processor.js +0 -0
  185. package/{test → lib/test}/types/game_wallet_processor.js.map +0 -0
  186. package/{test → lib/test}/wormhole-token-bridge.d.ts +0 -0
  187. package/{test → lib/test}/wormhole-token-bridge.js +0 -0
  188. package/{test → lib/test}/wormhole-token-bridge.js.map +0 -0
  189. package/{utils → lib/utils}/chainmap.d.ts +0 -0
  190. package/{utils → lib/utils}/chainmap.js +0 -0
  191. package/{utils → lib/utils}/chainmap.js.map +0 -0
  192. package/{utils → lib/utils}/convert.d.ts +0 -0
  193. package/{utils → lib/utils}/convert.js +0 -0
  194. package/{utils → lib/utils}/convert.js.map +0 -0
  195. package/{utils → lib/utils}/index.d.ts +0 -0
  196. package/{utils → lib/utils}/index.js +0 -0
  197. package/{utils → lib/utils}/index.js.map +0 -0
  198. package/package.json +47 -6
  199. package/src/abis/erc20.json +198 -0
  200. package/src/abis/weth9.json +153 -0
  201. package/src/base-processor-template.ts +92 -0
  202. package/src/base-processor.ts +128 -0
  203. package/src/bind-options.ts +41 -0
  204. package/src/binds.ts +73 -0
  205. package/src/builtin/erc20/index.ts +6 -0
  206. package/src/builtin/erc20/test-utils.ts +49 -0
  207. package/src/builtin/internal/Erc20.ts +356 -0
  208. package/src/builtin/internal/Weth9.ts +480 -0
  209. package/src/builtin/internal/common.ts +46 -0
  210. package/src/builtin/internal/erc20_processor.ts +295 -0
  211. package/src/builtin/internal/factories/Erc20__factory.ts +216 -0
  212. package/src/builtin/internal/factories/Weth9__factory.ts +297 -0
  213. package/src/builtin/internal/factories/index.ts +5 -0
  214. package/src/builtin/internal/index.ts +8 -0
  215. package/src/builtin/internal/weth9_processor.ts +403 -0
  216. package/src/builtin/weth9/index.ts +6 -0
  217. package/src/builtin/weth9/test-utils.ts +89 -0
  218. package/src/chain-config.ts +6 -0
  219. package/src/cli/build.ts +196 -0
  220. package/src/cli/cli.ts +217 -0
  221. package/src/cli/config.ts +43 -0
  222. package/src/cli/key.ts +43 -0
  223. package/src/cli/solana-code-gen.ts +16 -0
  224. package/src/cli/upload.ts +86 -0
  225. package/src/cli/webpack.config.js +42 -0
  226. package/src/context.ts +93 -0
  227. package/src/contract-namer.ts +17 -0
  228. package/src/error.ts +43 -0
  229. package/src/gen/builtin.ts +22 -0
  230. package/src/gen/google/protobuf/empty.ts +70 -0
  231. package/src/gen/processor/protos/processor.ts +3071 -0
  232. package/src/generic-processor.ts +38 -0
  233. package/src/index.ts +19 -0
  234. package/src/loader.ts +24 -0
  235. package/src/meter.ts +122 -0
  236. package/src/numberish.test.ts +82 -0
  237. package/src/numberish.ts +99 -0
  238. package/src/processor-runner.ts +49 -0
  239. package/src/processor-state.ts +24 -0
  240. package/src/promise-or-void.ts +1 -0
  241. package/src/provider.ts +74 -0
  242. package/src/service.ts +439 -0
  243. package/src/solana/builtin/index.ts +2 -0
  244. package/src/solana/builtin/spl-token-processor.ts +164 -0
  245. package/src/solana/builtin/types.ts +268 -0
  246. package/src/solana/builtin/wormhole-processor.ts +178 -0
  247. package/src/solana-processor.ts +105 -0
  248. package/src/target-ethers-sentio/codegen.ts +289 -0
  249. package/src/target-ethers-sentio/index.ts +50 -0
  250. package/src/target-ethers-sentio/tsconfig.json +9 -0
  251. package/src/test/abis/evm/anyswapRouter.json +490 -0
  252. package/src/test/abis/solana/mirrorworld.json +1392 -0
  253. package/src/test/codegen.test.ts +26 -0
  254. package/src/test/erc20-template.test.ts +37 -0
  255. package/src/test/erc20-template.ts +25 -0
  256. package/src/test/erc20.test.ts +90 -0
  257. package/src/test/erc20.ts +48 -0
  258. package/src/test/generic-processor.test.ts +70 -0
  259. package/src/test/index.ts +1 -0
  260. package/src/test/metric-utils.ts +49 -0
  261. package/src/test/mirrorworld.ts +40 -0
  262. package/src/test/sentio.yaml +4 -0
  263. package/src/test/solana.test.ts +93 -0
  264. package/src/test/test-processor-server.ts +205 -0
  265. package/src/test/types/game_wallet.ts +1392 -0
  266. package/src/test/types/game_wallet_processor.ts +113 -0
  267. package/src/test/wormhole-token-bridge.ts +21 -0
  268. package/src/types/global.d.ts +17 -0
  269. package/src/utils/chainmap.ts +95 -0
  270. package/src/utils/convert.ts +6 -0
  271. package/src/utils/index.ts +2 -0
  272. package/builtin/internal/factories/index.js.map +0 -1
  273. package/builtin/internal/index.js.map +0 -1
  274. package/cli/build.js.map +0 -1
  275. package/processor-runner.js.map +0 -1
  276. package/service.js.map +0 -1
  277. package/target-ethers-sentio/codegen.js.map +0 -1
  278. package/target-ethers-sentio/index.js.map +0 -1
  279. package/test/erc20-template.test.js.map +0 -1
  280. package/test/erc20.test.js.map +0 -1
  281. package/test/generic-processor.test.js.map +0 -1
  282. package/test/solana.test.js.map +0 -1
  283. package/test/test-processor-server.js.map +0 -1
@@ -0,0 +1,295 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ import { CallOverrides } from "ethers";
5
+ import { Networkish } from "@ethersproject/providers";
6
+ import {
7
+ addContractByABI,
8
+ getContractByABI,
9
+ addProcessor,
10
+ getProcessor,
11
+ getProvider,
12
+ transformEtherError,
13
+ BindOptions,
14
+ BaseProcessor,
15
+ BaseProcessorTemplate,
16
+ BoundContractView,
17
+ Context,
18
+ ContractView,
19
+ DummyProvider,
20
+ getContractName,
21
+ } from "@sentio/sdk";
22
+ import { PromiseOrValue } from "./common";
23
+ import { Erc20, Erc20__factory } from "./index";
24
+ import {
25
+ ApprovalEvent,
26
+ ApprovalEventFilter,
27
+ TransferEvent,
28
+ TransferEventFilter,
29
+ } from "./Erc20";
30
+ const templateContract = Erc20__factory.connect("", DummyProvider);
31
+
32
+ export class Erc20ContractView extends ContractView<Erc20> {
33
+ constructor(contract: Erc20) {
34
+ super(contract);
35
+ }
36
+
37
+ async allowance(
38
+ owner: PromiseOrValue<string>,
39
+ spender: PromiseOrValue<string>,
40
+ overrides?: CallOverrides
41
+ ) {
42
+ try {
43
+ if (overrides) {
44
+ return await this.contract.allowance(owner, spender, overrides);
45
+ } else {
46
+ return await this.contract.allowance(owner, spender);
47
+ }
48
+ } catch (e) {
49
+ throw transformEtherError(e, undefined);
50
+ }
51
+ }
52
+
53
+ async balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides) {
54
+ try {
55
+ if (overrides) {
56
+ return await this.contract.balanceOf(account, overrides);
57
+ } else {
58
+ return await this.contract.balanceOf(account);
59
+ }
60
+ } catch (e) {
61
+ throw transformEtherError(e, undefined);
62
+ }
63
+ }
64
+
65
+ async decimals(overrides?: CallOverrides) {
66
+ try {
67
+ if (overrides) {
68
+ return await this.contract.decimals(overrides);
69
+ } else {
70
+ return await this.contract.decimals();
71
+ }
72
+ } catch (e) {
73
+ throw transformEtherError(e, undefined);
74
+ }
75
+ }
76
+
77
+ async totalSupply(overrides?: CallOverrides) {
78
+ try {
79
+ if (overrides) {
80
+ return await this.contract.totalSupply(overrides);
81
+ } else {
82
+ return await this.contract.totalSupply();
83
+ }
84
+ } catch (e) {
85
+ throw transformEtherError(e, undefined);
86
+ }
87
+ }
88
+ }
89
+
90
+ export class Erc20BoundContractView extends BoundContractView<
91
+ Erc20,
92
+ Erc20ContractView
93
+ > {
94
+ // constructor (contract: Erc20) {
95
+ // super(contract);
96
+ // }
97
+
98
+ async allowance(
99
+ owner: PromiseOrValue<string>,
100
+ spender: PromiseOrValue<string>,
101
+ overrides?: CallOverrides
102
+ ) {
103
+ try {
104
+ if (!overrides && this.context) {
105
+ overrides = {
106
+ blockTag: this.context.blockNumber.toNumber(),
107
+ };
108
+ }
109
+ if (overrides) {
110
+ return await this.view.allowance(owner, spender, overrides);
111
+ } else {
112
+ return await this.view.allowance(owner, spender);
113
+ }
114
+ } catch (e) {
115
+ throw transformEtherError(e, this.context);
116
+ }
117
+ }
118
+
119
+ async balanceOf(account: PromiseOrValue<string>, overrides?: CallOverrides) {
120
+ try {
121
+ if (!overrides && this.context) {
122
+ overrides = {
123
+ blockTag: this.context.blockNumber.toNumber(),
124
+ };
125
+ }
126
+ if (overrides) {
127
+ return await this.view.balanceOf(account, overrides);
128
+ } else {
129
+ return await this.view.balanceOf(account);
130
+ }
131
+ } catch (e) {
132
+ throw transformEtherError(e, this.context);
133
+ }
134
+ }
135
+
136
+ async decimals(overrides?: CallOverrides) {
137
+ try {
138
+ if (!overrides && this.context) {
139
+ overrides = {
140
+ blockTag: this.context.blockNumber.toNumber(),
141
+ };
142
+ }
143
+ if (overrides) {
144
+ return await this.view.decimals(overrides);
145
+ } else {
146
+ return await this.view.decimals();
147
+ }
148
+ } catch (e) {
149
+ throw transformEtherError(e, this.context);
150
+ }
151
+ }
152
+
153
+ async totalSupply(overrides?: CallOverrides) {
154
+ try {
155
+ if (!overrides && this.context) {
156
+ overrides = {
157
+ blockTag: this.context.blockNumber.toNumber(),
158
+ };
159
+ }
160
+ if (overrides) {
161
+ return await this.view.totalSupply(overrides);
162
+ } else {
163
+ return await this.view.totalSupply();
164
+ }
165
+ } catch (e) {
166
+ throw transformEtherError(e, this.context);
167
+ }
168
+ }
169
+ }
170
+
171
+ export type Erc20Context = Context<Erc20, Erc20BoundContractView>;
172
+
173
+ export class Erc20ProcessorTemplate extends BaseProcessorTemplate<
174
+ Erc20,
175
+ Erc20BoundContractView
176
+ > {
177
+ bindInternal(options: BindOptions) {
178
+ let processor = getProcessor("Erc20", options) as Erc20Processor;
179
+ if (!processor) {
180
+ const finalOptions = Object.assign({}, options);
181
+ finalOptions.name = getContractName(
182
+ "Erc20",
183
+ options.name,
184
+ options.address,
185
+ options.network
186
+ );
187
+ processor = new Erc20Processor(finalOptions);
188
+ addProcessor("Erc20", options, processor);
189
+ }
190
+ return processor;
191
+ }
192
+
193
+ onApproval(
194
+ handler: (event: ApprovalEvent, ctx: Erc20Context) => void,
195
+ filter?: ApprovalEventFilter | ApprovalEventFilter[]
196
+ ) {
197
+ if (!filter) {
198
+ filter = Erc20Processor.filters["Approval(address,address,uint256)"](
199
+ null,
200
+ null,
201
+ null
202
+ );
203
+ }
204
+ return super.onEvent(handler, filter);
205
+ }
206
+
207
+ onTransfer(
208
+ handler: (event: TransferEvent, ctx: Erc20Context) => void,
209
+ filter?: TransferEventFilter | TransferEventFilter[]
210
+ ) {
211
+ if (!filter) {
212
+ filter = Erc20Processor.filters["Transfer(address,address,uint256)"](
213
+ null,
214
+ null,
215
+ null
216
+ );
217
+ }
218
+ return super.onEvent(handler, filter);
219
+ }
220
+ }
221
+
222
+ export class Erc20Processor extends BaseProcessor<
223
+ Erc20,
224
+ Erc20BoundContractView
225
+ > {
226
+ onApproval(
227
+ handler: (event: ApprovalEvent, ctx: Erc20Context) => void,
228
+ filter?: ApprovalEventFilter | ApprovalEventFilter[]
229
+ ) {
230
+ if (!filter) {
231
+ filter = Erc20Processor.filters["Approval(address,address,uint256)"](
232
+ null,
233
+ null,
234
+ null
235
+ );
236
+ }
237
+ return super.onEvent(handler, filter);
238
+ }
239
+
240
+ onTransfer(
241
+ handler: (event: TransferEvent, ctx: Erc20Context) => void,
242
+ filter?: TransferEventFilter | TransferEventFilter[]
243
+ ) {
244
+ if (!filter) {
245
+ filter = Erc20Processor.filters["Transfer(address,address,uint256)"](
246
+ null,
247
+ null,
248
+ null
249
+ );
250
+ }
251
+ return super.onEvent(handler, filter);
252
+ }
253
+
254
+ public static filters = templateContract.filters;
255
+
256
+ protected CreateBoundContractView(): Erc20BoundContractView {
257
+ const view = getErc20Contract(this.config.address, this.config.network);
258
+ return new Erc20BoundContractView(view);
259
+ }
260
+
261
+ public static bind(options: BindOptions): Erc20Processor {
262
+ let processor = getProcessor("Erc20", options) as Erc20Processor;
263
+ if (!processor) {
264
+ // const wrapper = getErc20Contract(options.address, options.network)
265
+
266
+ const finalOptions = Object.assign({}, options);
267
+ finalOptions.name = getContractName(
268
+ "Erc20",
269
+ options.name,
270
+ options.address,
271
+ options.network
272
+ );
273
+ processor = new Erc20Processor(finalOptions);
274
+ addProcessor("Erc20", options, processor);
275
+ }
276
+ return processor;
277
+ }
278
+ }
279
+
280
+ export function getErc20Contract(
281
+ address: string,
282
+ network: Networkish = 1
283
+ ): Erc20ContractView {
284
+ let contract = getContractByABI(
285
+ "Erc20",
286
+ address,
287
+ network
288
+ ) as Erc20ContractView;
289
+ if (!contract) {
290
+ const rawContract = Erc20__factory.connect(address, getProvider(network));
291
+ contract = new Erc20ContractView(rawContract);
292
+ addContractByABI("Erc20", address, network, contract);
293
+ }
294
+ return contract;
295
+ }
@@ -0,0 +1,216 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ import { Contract, Signer, utils } from "ethers";
6
+ import type { Provider } from "@ethersproject/providers";
7
+ import type { Erc20, Erc20Interface } from "../Erc20";
8
+
9
+ const _abi = [
10
+ {
11
+ anonymous: false,
12
+ inputs: [
13
+ {
14
+ indexed: true,
15
+ internalType: "address",
16
+ name: "owner",
17
+ type: "address",
18
+ },
19
+ {
20
+ indexed: true,
21
+ internalType: "address",
22
+ name: "spender",
23
+ type: "address",
24
+ },
25
+ {
26
+ indexed: false,
27
+ internalType: "uint256",
28
+ name: "value",
29
+ type: "uint256",
30
+ },
31
+ ],
32
+ name: "Approval",
33
+ type: "event",
34
+ },
35
+ {
36
+ anonymous: false,
37
+ inputs: [
38
+ {
39
+ indexed: true,
40
+ internalType: "address",
41
+ name: "from",
42
+ type: "address",
43
+ },
44
+ {
45
+ indexed: true,
46
+ internalType: "address",
47
+ name: "to",
48
+ type: "address",
49
+ },
50
+ {
51
+ indexed: false,
52
+ internalType: "uint256",
53
+ name: "value",
54
+ type: "uint256",
55
+ },
56
+ ],
57
+ name: "Transfer",
58
+ type: "event",
59
+ },
60
+ {
61
+ inputs: [
62
+ {
63
+ internalType: "address",
64
+ name: "owner",
65
+ type: "address",
66
+ },
67
+ {
68
+ internalType: "address",
69
+ name: "spender",
70
+ type: "address",
71
+ },
72
+ ],
73
+ name: "allowance",
74
+ outputs: [
75
+ {
76
+ internalType: "uint256",
77
+ name: "",
78
+ type: "uint256",
79
+ },
80
+ ],
81
+ stateMutability: "view",
82
+ type: "function",
83
+ },
84
+ {
85
+ inputs: [
86
+ {
87
+ internalType: "address",
88
+ name: "spender",
89
+ type: "address",
90
+ },
91
+ {
92
+ internalType: "uint256",
93
+ name: "amount",
94
+ type: "uint256",
95
+ },
96
+ ],
97
+ name: "approve",
98
+ outputs: [
99
+ {
100
+ internalType: "bool",
101
+ name: "",
102
+ type: "bool",
103
+ },
104
+ ],
105
+ stateMutability: "nonpayable",
106
+ type: "function",
107
+ },
108
+ {
109
+ inputs: [
110
+ {
111
+ internalType: "address",
112
+ name: "account",
113
+ type: "address",
114
+ },
115
+ ],
116
+ name: "balanceOf",
117
+ outputs: [
118
+ {
119
+ internalType: "uint256",
120
+ name: "",
121
+ type: "uint256",
122
+ },
123
+ ],
124
+ stateMutability: "view",
125
+ type: "function",
126
+ },
127
+ {
128
+ inputs: [],
129
+ name: "decimals",
130
+ outputs: [
131
+ {
132
+ internalType: "uint8",
133
+ name: "",
134
+ type: "uint8",
135
+ },
136
+ ],
137
+ stateMutability: "view",
138
+ type: "function",
139
+ },
140
+ {
141
+ inputs: [],
142
+ name: "totalSupply",
143
+ outputs: [
144
+ {
145
+ internalType: "uint256",
146
+ name: "",
147
+ type: "uint256",
148
+ },
149
+ ],
150
+ stateMutability: "view",
151
+ type: "function",
152
+ },
153
+ {
154
+ inputs: [
155
+ {
156
+ internalType: "address",
157
+ name: "to",
158
+ type: "address",
159
+ },
160
+ {
161
+ internalType: "uint256",
162
+ name: "amount",
163
+ type: "uint256",
164
+ },
165
+ ],
166
+ name: "transfer",
167
+ outputs: [
168
+ {
169
+ internalType: "bool",
170
+ name: "",
171
+ type: "bool",
172
+ },
173
+ ],
174
+ stateMutability: "nonpayable",
175
+ type: "function",
176
+ },
177
+ {
178
+ inputs: [
179
+ {
180
+ internalType: "address",
181
+ name: "from",
182
+ type: "address",
183
+ },
184
+ {
185
+ internalType: "address",
186
+ name: "to",
187
+ type: "address",
188
+ },
189
+ {
190
+ internalType: "uint256",
191
+ name: "amount",
192
+ type: "uint256",
193
+ },
194
+ ],
195
+ name: "transferFrom",
196
+ outputs: [
197
+ {
198
+ internalType: "bool",
199
+ name: "",
200
+ type: "bool",
201
+ },
202
+ ],
203
+ stateMutability: "nonpayable",
204
+ type: "function",
205
+ },
206
+ ];
207
+
208
+ export class Erc20__factory {
209
+ static readonly abi = _abi;
210
+ static createInterface(): Erc20Interface {
211
+ return new utils.Interface(_abi) as Erc20Interface;
212
+ }
213
+ static connect(address: string, signerOrProvider: Signer | Provider): Erc20 {
214
+ return new Contract(address, _abi, signerOrProvider) as Erc20;
215
+ }
216
+ }