@sentio/sdk 1.7.16 → 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 (33) hide show
  1. package/lib/builtin/internal/Weth9.d.ts +221 -0
  2. package/lib/builtin/internal/Weth9.js +3 -0
  3. package/lib/builtin/internal/Weth9.js.map +1 -0
  4. package/lib/builtin/internal/factories/Weth9__factory.d.ts +45 -0
  5. package/lib/builtin/internal/factories/Weth9__factory.js +297 -0
  6. package/lib/builtin/internal/factories/Weth9__factory.js.map +1 -0
  7. package/lib/builtin/internal/factories/index.d.ts +1 -0
  8. package/lib/builtin/internal/factories/index.js +3 -1
  9. package/lib/builtin/internal/factories/index.js.map +1 -1
  10. package/lib/builtin/internal/index.d.ts +2 -0
  11. package/lib/builtin/internal/index.js +3 -1
  12. package/lib/builtin/internal/index.js.map +1 -1
  13. package/lib/builtin/internal/weth9_processor.d.ts +50 -0
  14. package/lib/builtin/internal/weth9_processor.js +295 -0
  15. package/lib/builtin/internal/weth9_processor.js.map +1 -0
  16. package/lib/builtin/weth9/index.d.ts +2 -0
  17. package/lib/builtin/weth9/index.js +22 -0
  18. package/lib/builtin/weth9/index.js.map +1 -0
  19. package/lib/builtin/weth9/test-utils.d.ts +6 -0
  20. package/lib/builtin/weth9/test-utils.js +57 -0
  21. package/lib/builtin/weth9/test-utils.js.map +1 -0
  22. package/lib/cli/build.js +14 -0
  23. package/lib/cli/build.js.map +1 -1
  24. package/package.json +1 -1
  25. package/src/abis/weth9.json +153 -0
  26. package/src/builtin/internal/Weth9.ts +480 -0
  27. package/src/builtin/internal/factories/Weth9__factory.ts +297 -0
  28. package/src/builtin/internal/factories/index.ts +1 -0
  29. package/src/builtin/internal/index.ts +2 -0
  30. package/src/builtin/internal/weth9_processor.ts +403 -0
  31. package/src/builtin/weth9/index.ts +6 -0
  32. package/src/builtin/weth9/test-utils.ts +89 -0
  33. package/src/cli/build.ts +16 -0
@@ -0,0 +1,89 @@
1
+ /* Autogenerated file. Do not edit manually. */
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ import { Log } from "@ethersproject/providers";
5
+ import {
6
+ getWeth9Contract,
7
+ ApprovalEventObject,
8
+ TransferEventObject,
9
+ DepositEventObject,
10
+ WithdrawalEventObject,
11
+ } from ".";
12
+ const mockField = {
13
+ blockHash:
14
+ "0x0000000000000000000000000000000000000000000000000000000000000000",
15
+ blockNumber: 0,
16
+ logIndex: 0,
17
+ removed: false,
18
+ transactionHash:
19
+ "0x0000000000000000000000000000000000000000000000000000000000000000",
20
+ transactionIndex: 0,
21
+ };
22
+
23
+ export function mockApprovalLog(
24
+ contractAddress: string,
25
+ event: ApprovalEventObject
26
+ ): Log {
27
+ const contract = getWeth9Contract(contractAddress);
28
+ const encodedLog = contract.rawContract.interface.encodeEventLog(
29
+ contract.rawContract.interface.getEvent("Approval"),
30
+ Object.values(event)
31
+ );
32
+ return {
33
+ ...mockField,
34
+ address: contractAddress,
35
+ data: encodedLog.data,
36
+ topics: encodedLog.topics,
37
+ };
38
+ }
39
+
40
+ export function mockTransferLog(
41
+ contractAddress: string,
42
+ event: TransferEventObject
43
+ ): Log {
44
+ const contract = getWeth9Contract(contractAddress);
45
+ const encodedLog = contract.rawContract.interface.encodeEventLog(
46
+ contract.rawContract.interface.getEvent("Transfer"),
47
+ Object.values(event)
48
+ );
49
+ return {
50
+ ...mockField,
51
+ address: contractAddress,
52
+ data: encodedLog.data,
53
+ topics: encodedLog.topics,
54
+ };
55
+ }
56
+
57
+ export function mockDepositLog(
58
+ contractAddress: string,
59
+ event: DepositEventObject
60
+ ): Log {
61
+ const contract = getWeth9Contract(contractAddress);
62
+ const encodedLog = contract.rawContract.interface.encodeEventLog(
63
+ contract.rawContract.interface.getEvent("Deposit"),
64
+ Object.values(event)
65
+ );
66
+ return {
67
+ ...mockField,
68
+ address: contractAddress,
69
+ data: encodedLog.data,
70
+ topics: encodedLog.topics,
71
+ };
72
+ }
73
+
74
+ export function mockWithdrawalLog(
75
+ contractAddress: string,
76
+ event: WithdrawalEventObject
77
+ ): Log {
78
+ const contract = getWeth9Contract(contractAddress);
79
+ const encodedLog = contract.rawContract.interface.encodeEventLog(
80
+ contract.rawContract.interface.getEvent("Withdrawal"),
81
+ Object.values(event)
82
+ );
83
+ return {
84
+ ...mockField,
85
+ address: contractAddress,
86
+ data: encodedLog.data,
87
+ topics: encodedLog.topics,
88
+ };
89
+ }
package/src/cli/build.ts CHANGED
@@ -42,6 +42,22 @@ export async function codeGenEthersProcessor(
42
42
  ETHERS_TARGET = path.join(__dirname, '../target-ethers-sentio'),
43
43
  outDir = 'src/types/internal'
44
44
  ) {
45
+ if (!fs.existsSync(abisDir)) {
46
+ return
47
+ }
48
+
49
+ let haveJson = false
50
+ const files = fs.readdirSync(abisDir)
51
+ for (const file of files) {
52
+ if (file.toLowerCase().endsWith('.json')) {
53
+ haveJson = true
54
+ break
55
+ }
56
+ }
57
+ if (!haveJson) {
58
+ return
59
+ }
60
+
45
61
  // TODO this will fail during postinstall, need to locate real typechain path
46
62
  await execStep(
47
63
  'yarn typechain --target ' + ETHERS_TARGET + ` --out-dir ${outDir} ${path.join(abisDir, '*.json')}`,