@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.
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +25 -69
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.js +10 -24
- package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.js +20 -52
- package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.js +11 -25
- package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.js +16 -40
- package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.js +13 -31
- package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
- package/lib/eth/codegen/file.d.ts.map +1 -1
- package/lib/eth/codegen/file.js +5 -1
- package/lib/eth/codegen/file.js.map +1 -1
- package/lib/eth/codegen/function-calls.d.ts +1 -0
- package/lib/eth/codegen/function-calls.d.ts.map +1 -1
- package/lib/eth/codegen/function-calls.js +3 -1
- package/lib/eth/codegen/function-calls.js.map +1 -1
- package/lib/eth/codegen/types.d.ts.map +1 -1
- package/lib/eth/codegen/types.js +23 -6
- package/lib/eth/codegen/types.js.map +1 -1
- package/package.json +3 -3
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +26 -69
- package/src/eth/builtin/internal/erc1155-processor.ts +11 -24
- package/src/eth/builtin/internal/erc20-processor.ts +21 -52
- package/src/eth/builtin/internal/erc20bytes-processor.ts +12 -25
- package/src/eth/builtin/internal/erc721-processor.ts +17 -40
- package/src/eth/builtin/internal/weth9-processor.ts +14 -31
- package/src/eth/codegen/file.ts +5 -0
- package/src/eth/codegen/function-calls.ts +4 -1
- package/src/eth/codegen/types.ts +29 -7
package/src/eth/codegen/types.ts
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
import {
|
2
2
|
AbiOutputParameter,
|
3
3
|
AbiParameter,
|
4
|
+
ArrayType,
|
5
|
+
EventArgDeclaration,
|
4
6
|
EventDeclaration,
|
5
7
|
FunctionDeclaration,
|
6
|
-
|
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
|
-
|
59
|
-
|
60
|
-
.map((i) =>
|
61
|
-
|
62
|
-
.
|
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
|
}
|