@sentio/sdk 2.40.1-rc.1 → 2.40.1-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  2. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +25 -69
  3. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  4. package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
  5. package/lib/eth/builtin/internal/erc1155-processor.js +10 -24
  6. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  7. package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
  8. package/lib/eth/builtin/internal/erc20-processor.js +20 -52
  9. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  10. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
  11. package/lib/eth/builtin/internal/erc20bytes-processor.js +11 -25
  12. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  13. package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
  14. package/lib/eth/builtin/internal/erc721-processor.js +16 -40
  15. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  16. package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
  17. package/lib/eth/builtin/internal/weth9-processor.js +13 -31
  18. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  19. package/lib/eth/codegen/file.d.ts.map +1 -1
  20. package/lib/eth/codegen/file.js +5 -1
  21. package/lib/eth/codegen/file.js.map +1 -1
  22. package/lib/eth/codegen/function-calls.d.ts +1 -0
  23. package/lib/eth/codegen/function-calls.d.ts.map +1 -1
  24. package/lib/eth/codegen/function-calls.js +3 -1
  25. package/lib/eth/codegen/function-calls.js.map +1 -1
  26. package/lib/eth/codegen/types.d.ts.map +1 -1
  27. package/lib/eth/codegen/types.js +23 -6
  28. package/lib/eth/codegen/types.js.map +1 -1
  29. package/package.json +3 -3
  30. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +26 -69
  31. package/src/eth/builtin/internal/erc1155-processor.ts +11 -24
  32. package/src/eth/builtin/internal/erc20-processor.ts +21 -52
  33. package/src/eth/builtin/internal/erc20bytes-processor.ts +12 -25
  34. package/src/eth/builtin/internal/erc721-processor.ts +17 -40
  35. package/src/eth/builtin/internal/weth9-processor.ts +14 -31
  36. package/src/eth/codegen/file.ts +5 -0
  37. package/src/eth/codegen/function-calls.ts +4 -1
  38. package/src/eth/codegen/types.ts +29 -7
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  AbiOutputParameter,
3
3
  AbiParameter,
4
+ ArrayType,
5
+ EventArgDeclaration,
4
6
  EventDeclaration,
5
7
  FunctionDeclaration,
6
- getArgumentForSignature,
7
- getSignatureForFn
8
+ TupleType
8
9
  } from 'typechain'
9
10
  import { EvmType } from 'typechain/dist/parser/parseEvmType.js'
10
11
 
@@ -48,6 +49,13 @@ export function getFullSignatureForFunction(fn: FunctionDeclaration): string {
48
49
  .join(',')})`
49
50
  }
50
51
 
52
+ export function getFullSignatureWithOutputForFn(fn: FunctionDeclaration) {
53
+ return `${fn.name}(${fn.inputs.map((i) => getArgumentForSignature(i)).join(', ')}) ${fn.stateMutability} returns (${fn.outputs
54
+ .map((i) => getOutputArgumentForSignature(i))
55
+ .filter((s) => s != '')
56
+ .join(', ')})`
57
+ }
58
+
51
59
  function getOutputArgumentForSignature(argument: AbiOutputParameter) {
52
60
  if (argument.type.type == 'void') {
53
61
  return ''
@@ -55,9 +63,23 @@ function getOutputArgumentForSignature(argument: AbiOutputParameter) {
55
63
  return getArgumentForSignature(argument as AbiParameter)
56
64
  }
57
65
 
58
- export function getFullSignatureWithOutputForFn(fn: FunctionDeclaration) {
59
- return `${getSignatureForFn(fn)} ${fn.stateMutability} returns (${fn.outputs
60
- .map((i) => getOutputArgumentForSignature(i))
61
- .filter((s) => s != '')
62
- .join(',')})`
66
+ function getArgumentForSignature(argument: EventArgDeclaration | AbiParameter): string {
67
+ if (argument.type.originalType === 'tuple') {
68
+ return `(${(argument.type as TupleType).components.map((i) => getTypeWithName(getArgumentForSignature(i), argument.name)).join(', ')})`
69
+ } else if (argument.type.originalType.startsWith('tuple')) {
70
+ const arr = argument.type as ArrayType
71
+ return getTypeWithName(
72
+ `${getArgumentForSignature({
73
+ name: '',
74
+ type: arr.itemType
75
+ })}[${arr.size?.toString() || ''}]`,
76
+ argument.name
77
+ )
78
+ } else {
79
+ return getTypeWithName(argument.type.originalType, argument.name)
80
+ }
81
+ }
82
+
83
+ function getTypeWithName(type: string, name?: string) {
84
+ return (name ?? '').length > 0 ? `${type} ${name}` : type
63
85
  }