gen-typescript-from-tolk-dev 0.1.0 → 0.2.0
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/README.md +53 -27
- package/bin/generator.js +1 -13
- package/dist/abi-types.d.ts +169 -0
- package/dist/abi-types.js +8 -0
- package/dist/abi.d.ts +53 -0
- package/dist/abi.js +13 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +122 -0
- package/dist/codegen-ctx.d.ts +66 -0
- package/dist/codegen-ctx.js +108 -0
- package/dist/dynamic-ctx.d.ts +17 -0
- package/dist/dynamic-ctx.js +39 -0
- package/dist/dynamic-debug-print.d.ts +9 -0
- package/{src/dynamic-debug-print.ts → dist/dynamic-debug-print.js} +57 -65
- package/dist/dynamic-get-methods.d.ts +43 -0
- package/dist/dynamic-get-methods.js +451 -0
- package/dist/dynamic-serialization.d.ts +22 -0
- package/dist/dynamic-serialization.js +453 -0
- package/dist/dynamic-validation.d.ts +8 -0
- package/{src/dynamic-validation.ts → dist/dynamic-validation.js} +19 -18
- package/dist/emit-field-defs.d.ts +5 -0
- package/dist/emit-field-defs.js +61 -0
- package/dist/emit-pack-unpack.d.ts +9 -0
- package/dist/emit-pack-unpack.js +296 -0
- package/dist/emit-stack-rw.d.ts +4 -0
- package/dist/emit-stack-rw.js +232 -0
- package/dist/emit-ts-types.d.ts +6 -0
- package/dist/emit-ts-types.js +74 -0
- package/dist/formatting.d.ts +15 -0
- package/{src/formatting.ts → dist/formatting.js} +26 -28
- package/dist/generate-ts-wrappers.d.ts +7 -0
- package/dist/generate-ts-wrappers.js +444 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +11 -0
- package/dist/out-template.generated.d.ts +1 -0
- package/dist/out-template.generated.js +6 -0
- package/dist/tolk-to-abi.d.ts +2 -0
- package/dist/tolk-to-abi.js +22 -0
- package/dist/types-kernel.d.ts +10 -0
- package/dist/types-kernel.js +212 -0
- package/dist/unsupported-errors.d.ts +28 -0
- package/{src/unsupported-errors.ts → dist/unsupported-errors.js} +33 -39
- package/package.json +73 -27
- package/src/abi-types.ts +0 -157
- package/src/abi.ts +0 -132
- package/src/cli-generate-from-abi-json.ts +0 -21
- package/src/codegen-ctx.ts +0 -115
- package/src/dynamic-ctx.ts +0 -55
- package/src/dynamic-get-methods.ts +0 -454
- package/src/dynamic-serialization.ts +0 -430
- package/src/emit-field-defs.ts +0 -60
- package/src/emit-pack-unpack.ts +0 -280
- package/src/emit-stack-rw.ts +0 -239
- package/src/emit-ts-types.ts +0 -66
- package/src/generate-from-abi-json.ts +0 -22
- package/src/generate-ts-wrappers.ts +0 -477
- package/src/out-template.ts +0 -514
- package/src/tolk-to-abi.ts +0 -5
- package/src/types-kernel.ts +0 -215
- package/tsconfig.json +0 -13
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DynamicCtx = void 0;
|
|
4
|
+
const codegen_ctx_1 = require("./codegen-ctx");
|
|
5
|
+
const unsupported_errors_1 = require("./unsupported-errors");
|
|
6
|
+
class DynamicCtx {
|
|
7
|
+
constructor(contract) {
|
|
8
|
+
this.customSerializersRegistry = new Map;
|
|
9
|
+
this.contractName = contract.contract_name;
|
|
10
|
+
this.getMethods = contract.get_methods;
|
|
11
|
+
this.symbols = new codegen_ctx_1.SymTable(contract.declarations);
|
|
12
|
+
}
|
|
13
|
+
registerCustomPackUnpack(typeName, packToBuilderFn, unpackFromSliceFn) {
|
|
14
|
+
if (this.customSerializersRegistry.has(typeName)) {
|
|
15
|
+
throw new Error(`Custom pack/unpack for '${typeName}' already registered`);
|
|
16
|
+
}
|
|
17
|
+
this.customSerializersRegistry.set(typeName, [packToBuilderFn, unpackFromSliceFn]);
|
|
18
|
+
}
|
|
19
|
+
getCustomPackFnOrThrow(typeName, fieldPath) {
|
|
20
|
+
let packUnpack = this.customSerializersRegistry.get(typeName);
|
|
21
|
+
let packFn = packUnpack ? packUnpack[0] : null;
|
|
22
|
+
if (!packFn) {
|
|
23
|
+
throw new unsupported_errors_1.CantPackDynamic(fieldPath, `custom packToBuilder was not registered for '${typeName}'`);
|
|
24
|
+
}
|
|
25
|
+
return packFn;
|
|
26
|
+
}
|
|
27
|
+
getCustomUnpackFnOrThrow(typeName, fieldPath) {
|
|
28
|
+
let packUnpack = this.customSerializersRegistry.get(typeName);
|
|
29
|
+
let unpackFn = packUnpack ? packUnpack[1] : null;
|
|
30
|
+
if (!unpackFn) {
|
|
31
|
+
throw new unsupported_errors_1.CantUnpackDynamic(fieldPath, `custom unpackFromSlice was not registered for '${typeName}'`);
|
|
32
|
+
}
|
|
33
|
+
return unpackFn;
|
|
34
|
+
}
|
|
35
|
+
findGetMethod(getMethodName) {
|
|
36
|
+
return this.getMethods.find(m => m.name === getMethodName);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.DynamicCtx = DynamicCtx;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DynamicCtx } from './dynamic-ctx';
|
|
2
|
+
import { Ty } from './abi-types';
|
|
3
|
+
import { StackReader } from './dynamic-get-methods';
|
|
4
|
+
/**
|
|
5
|
+
* Read a value of type `ty` from the TVM stack `tuple` and return a human-readable string.
|
|
6
|
+
* Consumes `calcWidthOnStack(ty)` elements from the beginning of the array.
|
|
7
|
+
* Example: given `Point { x: int, y: int }` and stack `[10n, 20n]`, returns "Point { x: 10, y: 20 }".
|
|
8
|
+
*/
|
|
9
|
+
export declare function debugPrintFromStack(ctx: DynamicCtx, r: StackReader, ty: Ty): string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.debugPrintFromStack = debugPrintFromStack;
|
|
4
|
+
const dynamic_get_methods_1 = require("./dynamic-get-methods");
|
|
5
|
+
const dynamic_serialization_1 = require("./dynamic-serialization");
|
|
6
|
+
const types_kernel_1 = require("./types-kernel");
|
|
8
7
|
/*
|
|
9
8
|
Debug printing from the TVM stack.
|
|
10
9
|
Given TupleItem[] of a type Ty, and an ABI (via DynamicCtx),
|
|
@@ -12,54 +11,51 @@ import { calcWidthOnStack, createLabelsForUnion, instantiateGenerics, renderTy }
|
|
|
12
11
|
This is used for debugging / println / explorers —
|
|
13
12
|
to show the value of a variable or a get method result in a readable format.
|
|
14
13
|
*/
|
|
15
|
-
|
|
16
|
-
function printRawCellContents(c: c.Cell): string {
|
|
14
|
+
function printRawCellContents(c) {
|
|
17
15
|
return c.toString();
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
// Read `ty` from a stack and return formatted human-readable representation.
|
|
21
18
|
// Throws if a stack is too small or failed to deserialize a value (inside `Cell<T>` or a map, for example).
|
|
22
|
-
function debugFormat(ctx
|
|
19
|
+
function debugFormat(ctx, r, fieldPath, ty, unTupleIfW = false) {
|
|
23
20
|
if (unTupleIfW) {
|
|
24
|
-
let wOnStack = calcWidthOnStack(ctx.symbols, ty);
|
|
21
|
+
let wOnStack = (0, types_kernel_1.calcWidthOnStack)(ctx.symbols, ty);
|
|
25
22
|
if (wOnStack !== 1) {
|
|
26
23
|
return r.readTuple(wOnStack, (r) => debugFormat(ctx, r, fieldPath, ty, false));
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
switch (ty.kind) {
|
|
31
27
|
case 'int':
|
|
32
28
|
case 'intN':
|
|
33
29
|
case 'uintN':
|
|
34
30
|
case 'varintN':
|
|
35
31
|
case 'varuintN':
|
|
36
|
-
case 'coins':
|
|
37
|
-
case 'bool':
|
|
38
|
-
case 'cell':
|
|
39
|
-
case 'builder':
|
|
32
|
+
case 'coins': return r.readBigInt().toString();
|
|
33
|
+
case 'bool': return r.readBoolean() ? 'true' : 'false';
|
|
34
|
+
case 'cell': return `cell{${printRawCellContents(r.readCell())}}`;
|
|
35
|
+
case 'builder': return `builder{${printRawCellContents(r.readBuilder().endCell())}}`;
|
|
40
36
|
case 'slice':
|
|
41
37
|
case 'bitsN':
|
|
42
|
-
case 'remaining':
|
|
43
|
-
case 'string':
|
|
44
|
-
case 'address':
|
|
45
|
-
case 'addressOpt':
|
|
46
|
-
case 'addressExt':
|
|
38
|
+
case 'remaining': return `slice{${printRawCellContents(r.readSlice().asCell())}}`;
|
|
39
|
+
case 'string': return `"${r.readSnakeString()}"`;
|
|
40
|
+
case 'address': return r.readSlice().loadAddress().toString();
|
|
41
|
+
case 'addressOpt': return debugFormat(ctx, r, fieldPath, { kind: 'nullable', inner: { kind: 'address' } });
|
|
42
|
+
case 'addressExt': return r.readSlice().loadExternalAddress().toString();
|
|
47
43
|
case 'addressAny': {
|
|
48
|
-
let addr = dynamicUnpack(ctx, fieldPath, ty, r.readSlice());
|
|
44
|
+
let addr = (0, dynamic_serialization_1.dynamicUnpack)(ctx, fieldPath, ty, r.readSlice());
|
|
49
45
|
return addr === 'none' ? 'addr_none' : addr.toString();
|
|
50
46
|
}
|
|
51
47
|
case 'nullLiteral': return r.readNullLiteral() ?? 'null';
|
|
52
|
-
case 'void':
|
|
53
|
-
case 'unknown':
|
|
48
|
+
case 'void': return '(void)';
|
|
49
|
+
case 'unknown': return debugPrintUnknown(r.readUnknown());
|
|
54
50
|
case 'nullable': {
|
|
55
|
-
if (ty.
|
|
56
|
-
return r.readWideNullable(ty.
|
|
51
|
+
if (ty.stack_type_id) {
|
|
52
|
+
return r.readWideNullable(ty.stack_width, (r) => debugFormat(ctx, r, fieldPath, ty.inner)) ?? 'null';
|
|
57
53
|
}
|
|
58
54
|
return r.readNullable((r) => debugFormat(ctx, r, fieldPath, ty.inner)) ?? 'null';
|
|
59
55
|
}
|
|
60
56
|
case 'cellOf': {
|
|
61
57
|
let innerStr = r.readCellRef((s) => {
|
|
62
|
-
const deserialized = dynamicUnpack(ctx, fieldPath, ty.inner, s);
|
|
58
|
+
const deserialized = (0, dynamic_serialization_1.dynamicUnpack)(ctx, fieldPath, ty.inner, s);
|
|
63
59
|
return debugFormatValue(ctx, fieldPath, ty.inner, deserialized);
|
|
64
60
|
});
|
|
65
61
|
return `ref{${innerStr.ref}}`;
|
|
@@ -73,7 +69,7 @@ function debugFormat(ctx: DynamicCtx, r: StackReader, fieldPath: string, ty: Ty,
|
|
|
73
69
|
return `[${items.join(', ')}]`;
|
|
74
70
|
}
|
|
75
71
|
case 'tensor': {
|
|
76
|
-
let parts
|
|
72
|
+
let parts = [];
|
|
77
73
|
for (let i = 0; i < ty.items.length; ++i) {
|
|
78
74
|
parts.push(debugFormat(ctx, r, `${fieldPath}[${i}]`, ty.items[i]));
|
|
79
75
|
}
|
|
@@ -81,7 +77,7 @@ function debugFormat(ctx: DynamicCtx, r: StackReader, fieldPath: string, ty: Ty,
|
|
|
81
77
|
}
|
|
82
78
|
case 'shapedTuple': {
|
|
83
79
|
return r.readTuple(ty.items.length, (r) => {
|
|
84
|
-
let parts
|
|
80
|
+
let parts = [];
|
|
85
81
|
for (let i = 0; i < ty.items.length; ++i) {
|
|
86
82
|
parts.push(debugFormat(ctx, r, `${fieldPath}[${i}]`, ty.items[i], true));
|
|
87
83
|
}
|
|
@@ -89,9 +85,9 @@ function debugFormat(ctx: DynamicCtx, r: StackReader, fieldPath: string, ty: Ty,
|
|
|
89
85
|
});
|
|
90
86
|
}
|
|
91
87
|
case 'mapKV': {
|
|
92
|
-
let dictKey = createTonCoreDictionaryKey(fieldPath, ty.k);
|
|
93
|
-
let dictValue = createTonCoreDictionaryValue(ctx, fieldPath, ty.v);
|
|
94
|
-
let entries
|
|
88
|
+
let dictKey = (0, dynamic_serialization_1.createTonCoreDictionaryKey)(fieldPath, ty.k);
|
|
89
|
+
let dictValue = (0, dynamic_serialization_1.createTonCoreDictionaryValue)(ctx, fieldPath, ty.v);
|
|
90
|
+
let entries = [];
|
|
95
91
|
for (let [k, v] of r.readDictionary(dictKey, dictValue)) {
|
|
96
92
|
let kStr = debugFormatValue(ctx, fieldPath, ty.k, k);
|
|
97
93
|
let vStr = debugFormatValue(ctx, `${fieldPath}[${kStr}]`, ty.v, v);
|
|
@@ -104,41 +100,41 @@ function debugFormat(ctx: DynamicCtx, r: StackReader, fieldPath: string, ty: Ty,
|
|
|
104
100
|
}
|
|
105
101
|
case 'EnumRef': {
|
|
106
102
|
let value = r.readBigInt();
|
|
107
|
-
let enumRef = ctx.symbols.getEnum(ty.
|
|
103
|
+
let enumRef = ctx.symbols.getEnum(ty.enum_name);
|
|
108
104
|
let member = enumRef.members.find(m => BigInt(m.value) === value);
|
|
109
105
|
if (member) {
|
|
110
|
-
return `${ty.
|
|
106
|
+
return `${ty.enum_name}.${member.name}`;
|
|
111
107
|
}
|
|
112
|
-
return `${ty.
|
|
108
|
+
return `${ty.enum_name}(${value})`;
|
|
113
109
|
}
|
|
114
110
|
case 'StructRef': {
|
|
115
|
-
const structRef = ctx.symbols.getStruct(ty.
|
|
111
|
+
const structRef = ctx.symbols.getStruct(ty.struct_name);
|
|
116
112
|
if (structRef.fields.length === 0) {
|
|
117
|
-
return `${ty.
|
|
113
|
+
return `${ty.struct_name} {}`;
|
|
118
114
|
}
|
|
119
|
-
const fieldStrs
|
|
115
|
+
const fieldStrs = [];
|
|
120
116
|
for (const f of structRef.fields) {
|
|
121
|
-
const fTy = ty.
|
|
117
|
+
const fTy = ty.type_args ? (0, types_kernel_1.instantiateGenerics)(f.ty, structRef.type_params, ty.type_args) : f.ty;
|
|
122
118
|
fieldStrs.push(`${f.name}: ${debugFormat(ctx, r, `${fieldPath}.${f.name}`, fTy)}`);
|
|
123
119
|
}
|
|
124
|
-
return `${ty.
|
|
120
|
+
return `${ty.struct_name} { ${fieldStrs.join(', ')} }`;
|
|
125
121
|
}
|
|
126
122
|
case 'AliasRef': {
|
|
127
|
-
const aliasRef = ctx.symbols.getAlias(ty.
|
|
128
|
-
const targetTy = ty.
|
|
123
|
+
const aliasRef = ctx.symbols.getAlias(ty.alias_name);
|
|
124
|
+
const targetTy = ty.type_args ? (0, types_kernel_1.instantiateGenerics)(aliasRef.target_ty, aliasRef.type_params, ty.type_args) : aliasRef.target_ty;
|
|
129
125
|
return debugFormat(ctx, r, fieldPath, targetTy);
|
|
130
126
|
}
|
|
131
127
|
case 'union': {
|
|
132
|
-
const variants = createLabelsForUnion(ctx.symbols, ty.variants);
|
|
133
|
-
const infoForTypeId = {}
|
|
128
|
+
const variants = (0, types_kernel_1.createLabelsForUnion)(ctx.symbols, ty.variants);
|
|
129
|
+
const infoForTypeId = {};
|
|
134
130
|
for (let v of variants) {
|
|
135
|
-
infoForTypeId[v.
|
|
136
|
-
(r
|
|
131
|
+
infoForTypeId[v.stack_type_id] = [v.stack_width, v.hasValueField ? v.labelStr : null,
|
|
132
|
+
(r) => debugFormat(ctx, r, `${fieldPath}#${v.labelStr}`, v.variant_ty)
|
|
137
133
|
];
|
|
138
134
|
}
|
|
139
135
|
// readUnionType returns `valueT` (if no label) or `{ $: "label", value: valueT }`
|
|
140
136
|
// In our case, valueT is already a string.
|
|
141
|
-
const result = r.readUnionType
|
|
137
|
+
const result = r.readUnionType(ty.stack_width, infoForTypeId);
|
|
142
138
|
if (typeof result === 'string') {
|
|
143
139
|
// label is null, then it's a struct with its own $, like "Point { ... }", or it's "null"
|
|
144
140
|
return result;
|
|
@@ -150,42 +146,38 @@ function debugFormat(ctx: DynamicCtx, r: StackReader, fieldPath: string, ty: Ty,
|
|
|
150
146
|
r.readUnknown();
|
|
151
147
|
return 'continuation';
|
|
152
148
|
}
|
|
153
|
-
case 'genericT': throw new Error(`unexpected genericT=${ty.
|
|
149
|
+
case 'genericT': throw new Error(`unexpected genericT=${ty.name_t}`);
|
|
154
150
|
}
|
|
155
151
|
}
|
|
156
|
-
|
|
157
152
|
// Format a value that was already parsed by dynamicUnpack into a JS representation.
|
|
158
153
|
// This is used for inner values of `Cell<T>` and map entries, where we parse via `dynamicUnpack`
|
|
159
154
|
// and then need to show the result as a string.
|
|
160
|
-
function debugFormatValue(ctx
|
|
155
|
+
function debugFormatValue(ctx, fieldPath, ty, value) {
|
|
161
156
|
// unlike `debugFormat()`, here we don't read `ty` from a stack: we already have `value` of type `ty`;
|
|
162
157
|
// to visualize it, instead of making a giant switch-case for all types, do the following trick:
|
|
163
158
|
// pack value back to a tuple, and render this tuple as if it's a stack value
|
|
164
|
-
const backToTuple = makeTvmTupleDynamic(ctx, ty, value);
|
|
165
|
-
return debugFormat(ctx, new StackReader(backToTuple), fieldPath, ty);
|
|
159
|
+
const backToTuple = (0, dynamic_get_methods_1.makeTvmTupleDynamic)(ctx, ty, value);
|
|
160
|
+
return debugFormat(ctx, new dynamic_get_methods_1.StackReader(backToTuple), fieldPath, ty);
|
|
166
161
|
}
|
|
167
|
-
|
|
168
162
|
// `unknown` is a raw TVM tuple item; `tuple`, by definition, is `array<unknown>`,
|
|
169
163
|
// it has no compile-time type information, so visualize it anyhow
|
|
170
|
-
function debugPrintUnknown(item
|
|
164
|
+
function debugPrintUnknown(item) {
|
|
171
165
|
switch (item.type) {
|
|
172
|
-
case 'int':
|
|
173
|
-
case 'cell':
|
|
174
|
-
case 'slice':
|
|
166
|
+
case 'int': return `${item.value}`;
|
|
167
|
+
case 'cell': return `cell{${printRawCellContents(item.cell)}}`;
|
|
168
|
+
case 'slice': return `slice{${printRawCellContents(item.cell)}}`;
|
|
175
169
|
case 'builder': return `builder{${printRawCellContents(item.cell)}}`;
|
|
176
|
-
case 'null':
|
|
177
|
-
case 'tuple':
|
|
178
|
-
case 'nan':
|
|
179
|
-
default:
|
|
170
|
+
case 'null': return 'null';
|
|
171
|
+
case 'tuple': return `(${item.items.map(debugPrintUnknown).join(', ')})`;
|
|
172
|
+
case 'nan': return 'NaN';
|
|
173
|
+
default: return `<unknown>`;
|
|
180
174
|
}
|
|
181
175
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
176
|
/**
|
|
185
177
|
* Read a value of type `ty` from the TVM stack `tuple` and return a human-readable string.
|
|
186
178
|
* Consumes `calcWidthOnStack(ty)` elements from the beginning of the array.
|
|
187
179
|
* Example: given `Point { x: int, y: int }` and stack `[10n, 20n]`, returns "Point { x: 10, y: 20 }".
|
|
188
180
|
*/
|
|
189
|
-
|
|
181
|
+
function debugPrintFromStack(ctx, r, ty) {
|
|
190
182
|
return debugFormat(ctx, r, 'self', ty);
|
|
191
183
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as c from '@ton/core';
|
|
2
|
+
import { DynamicCtx } from './dynamic-ctx';
|
|
3
|
+
import { Ty } from './abi-types';
|
|
4
|
+
type LoadCallback<T> = (s: c.Slice) => T;
|
|
5
|
+
export declare class StackReader {
|
|
6
|
+
private tuple;
|
|
7
|
+
constructor(tuple: c.TupleItem[]);
|
|
8
|
+
static fromGetMethod(expectedN: number, getMethodResult: {
|
|
9
|
+
stack: c.TupleReader;
|
|
10
|
+
}): StackReader;
|
|
11
|
+
private popExpecting;
|
|
12
|
+
readBigInt(): bigint;
|
|
13
|
+
readBoolean(): boolean;
|
|
14
|
+
readCell(): c.Cell;
|
|
15
|
+
readSlice(): c.Slice;
|
|
16
|
+
readBuilder(): c.Builder;
|
|
17
|
+
readUnknown(): c.TupleItem;
|
|
18
|
+
readArrayOf<T>(readFn_T: (nestedReader: StackReader) => T): T[];
|
|
19
|
+
readLispListOf<T>(readFn_T: (nestedReader: StackReader) => T): T[];
|
|
20
|
+
readSnakeString(): string;
|
|
21
|
+
readTuple<T>(expectedN: number, readFn_T: (nestedReader: StackReader) => T): T;
|
|
22
|
+
readNullLiteral(): null;
|
|
23
|
+
readNullable<T>(readFn_T: (r: StackReader) => T): T | null;
|
|
24
|
+
readWideNullable<T>(stackW: number, readFn_T: (r: StackReader) => T): T | null;
|
|
25
|
+
readUnionType<T>(stackW: number, infoForTypeId: Record<number, [number, string | null, (r: StackReader) => any]>): T;
|
|
26
|
+
readCellRef<T>(loadFn_T: LoadCallback<T>): {
|
|
27
|
+
ref: T;
|
|
28
|
+
};
|
|
29
|
+
readDictionary<K extends c.DictionaryKeyTypes, V>(keySerializer: c.DictionaryKey<K>, valueSerializer: c.DictionaryValue<V>): c.Dictionary<K, V>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Pack any `value` of type `ty` to a TVM tuple.
|
|
33
|
+
* This tuple can be used as a get method argument or debug-printed as human-readable.
|
|
34
|
+
*/
|
|
35
|
+
export declare function makeTvmTupleDynamic(ctx: DynamicCtx, ty: Ty, value: any): c.TupleItem[];
|
|
36
|
+
/**
|
|
37
|
+
* Invoke any get method taking plain JS variables as arguments and interpreting the resulting TVM tuple according to ABI.
|
|
38
|
+
* Example: `get fun intAndPoint(i: int, p: Point): Point`.
|
|
39
|
+
* Call: `callGetMethodDynamic(provider, ctx, 'intAndPoint', [num, {x: num, y: num}])` returns `{x: num, y: num}`.
|
|
40
|
+
* When input is incorrect (e.g. missing property in a JS object), throws InvalidDynamicInput.
|
|
41
|
+
*/
|
|
42
|
+
export declare function callGetMethodDynamic(provider: c.ContractProvider, ctx: DynamicCtx, getMethodName: string, args: any[]): Promise<any>;
|
|
43
|
+
export {};
|