@metoncash/sdk-v1 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/artifacts/deposit/deposit_final.zkey +0 -0
- package/artifacts/deposit/deposit_js/deposit.wasm +0 -0
- package/artifacts/transfer/transfer_final.zkey +0 -0
- package/artifacts/transfer/transfer_js/transfer.wasm +0 -0
- package/artifacts/withdraw/withdraw_final.zkey +0 -0
- package/artifacts/withdraw/withdraw_js/withdraw.wasm +0 -0
- package/dist/prover.d.ts +6 -0
- package/dist/prover.js +8 -0
- package/package.json +4 -3
- package/dist/wrappers/Account.gen.d.ts +0 -542
- package/dist/wrappers/Account.gen.js +0 -677
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/prover.d.ts
CHANGED
|
@@ -69,6 +69,12 @@ export declare class MetonSDK {
|
|
|
69
69
|
* <dir>/<c>/<c>_js/<c>.wasm and <dir>/<c>/<c>_final.zkey
|
|
70
70
|
*/
|
|
71
71
|
static fromBuildDir(dir: string): MetonSDK;
|
|
72
|
+
/**
|
|
73
|
+
* Zero-config: use the proving artifacts (wasm + zkey) shipped with this
|
|
74
|
+
* package under `artifacts/` (populated at build time from the repo's `build/`).
|
|
75
|
+
* These are tied to a specific trusted setup — verify against the on-chain vkey.
|
|
76
|
+
*/
|
|
77
|
+
static bundled(): MetonSDK;
|
|
72
78
|
private prove;
|
|
73
79
|
/** Deposit a public `amount`, producing a commitment to it. */
|
|
74
80
|
deposit(args: DepositArgs): Promise<DepositResult>;
|
package/dist/prover.js
CHANGED
|
@@ -57,6 +57,14 @@ class MetonSDK {
|
|
|
57
57
|
});
|
|
58
58
|
return new MetonSDK({ deposit: mk("deposit"), withdraw: mk("withdraw"), transfer: mk("transfer") });
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Zero-config: use the proving artifacts (wasm + zkey) shipped with this
|
|
62
|
+
* package under `artifacts/` (populated at build time from the repo's `build/`).
|
|
63
|
+
* These are tied to a specific trusted setup — verify against the on-chain vkey.
|
|
64
|
+
*/
|
|
65
|
+
static bundled() {
|
|
66
|
+
return MetonSDK.fromBuildDir(path.join(__dirname, "..", "artifacts"));
|
|
67
|
+
}
|
|
60
68
|
prove(art, input) {
|
|
61
69
|
return snarkjs.groth16.fullProve(input, art.wasm, art.zkey);
|
|
62
70
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metoncash/sdk-v1",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"artifacts"
|
|
9
10
|
],
|
|
10
11
|
"scripts": {
|
|
11
|
-
"build": "tsc -p tsconfig.json && node ../scripts/strip_sdk_dist.cjs",
|
|
12
|
+
"build": "rm -rf dist && tsc -p tsconfig.json && node ../scripts/copy_sdk_artifacts.cjs && node ../scripts/strip_sdk_dist.cjs",
|
|
12
13
|
"test": "jest",
|
|
13
14
|
"prepare": "npm run build"
|
|
14
15
|
},
|
|
@@ -1,542 +0,0 @@
|
|
|
1
|
-
import * as c from '@ton/core';
|
|
2
|
-
import { ContractProvider, Sender, SendMode } from '@ton/core';
|
|
3
|
-
export type CellRef<T> = {
|
|
4
|
-
ref: T;
|
|
5
|
-
};
|
|
6
|
-
type coins = bigint;
|
|
7
|
-
type uint32 = bigint;
|
|
8
|
-
type uint64 = bigint;
|
|
9
|
-
type uint256 = bigint;
|
|
10
|
-
/**
|
|
11
|
-
> struct AccountRuntimeStorage {
|
|
12
|
-
> locked: bool
|
|
13
|
-
> minter: address
|
|
14
|
-
> owner: address
|
|
15
|
-
> seqNo: uint32
|
|
16
|
-
> publicViewKey: Point
|
|
17
|
-
> commitment: Point
|
|
18
|
-
> }
|
|
19
|
-
*/
|
|
20
|
-
export interface AccountRuntimeStorage {
|
|
21
|
-
readonly $: 'AccountRuntimeStorage';
|
|
22
|
-
locked: boolean;
|
|
23
|
-
minter: c.Address;
|
|
24
|
-
owner: c.Address;
|
|
25
|
-
seqNo: uint32;
|
|
26
|
-
publicViewKey: Point;
|
|
27
|
-
commitment: Point;
|
|
28
|
-
}
|
|
29
|
-
export declare const AccountRuntimeStorage: {
|
|
30
|
-
create(args: {
|
|
31
|
-
locked: boolean;
|
|
32
|
-
minter: c.Address;
|
|
33
|
-
owner: c.Address;
|
|
34
|
-
seqNo: uint32;
|
|
35
|
-
publicViewKey: Point;
|
|
36
|
-
commitment: Point;
|
|
37
|
-
}): AccountRuntimeStorage;
|
|
38
|
-
fromSlice(s: c.Slice): AccountRuntimeStorage;
|
|
39
|
-
store(self: AccountRuntimeStorage, b: c.Builder): void;
|
|
40
|
-
toCell(self: AccountRuntimeStorage): c.Cell;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
> struct AccountStorage {
|
|
44
|
-
> locked: bool
|
|
45
|
-
> minter: address
|
|
46
|
-
> owner: address
|
|
47
|
-
> seqNo: uint32
|
|
48
|
-
> publicViewKey: Cell<Point>
|
|
49
|
-
> commitment: Cell<Point>
|
|
50
|
-
> }
|
|
51
|
-
*/
|
|
52
|
-
export interface AccountStorage {
|
|
53
|
-
readonly $: 'AccountStorage';
|
|
54
|
-
locked: boolean;
|
|
55
|
-
minter: c.Address;
|
|
56
|
-
owner: c.Address;
|
|
57
|
-
seqNo: uint32;
|
|
58
|
-
publicViewKey: CellRef<Point>;
|
|
59
|
-
commitment: CellRef<Point>;
|
|
60
|
-
}
|
|
61
|
-
export declare const AccountStorage: {
|
|
62
|
-
create(args: {
|
|
63
|
-
locked?: boolean;
|
|
64
|
-
minter: c.Address;
|
|
65
|
-
owner: c.Address;
|
|
66
|
-
seqNo?: uint32;
|
|
67
|
-
publicViewKey: CellRef<Point>;
|
|
68
|
-
commitment: CellRef<Point>;
|
|
69
|
-
}): AccountStorage;
|
|
70
|
-
fromSlice(s: c.Slice): AccountStorage;
|
|
71
|
-
store(self: AccountStorage, b: c.Builder): void;
|
|
72
|
-
toCell(self: AccountStorage): c.Cell;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
> struct TransferAdditionalData {
|
|
76
|
-
> ephemeral: Point
|
|
77
|
-
> encAmount: uint256
|
|
78
|
-
> encBlind: Cell<uint256>
|
|
79
|
-
> }
|
|
80
|
-
*/
|
|
81
|
-
export interface TransferAdditionalData {
|
|
82
|
-
readonly $: 'TransferAdditionalData';
|
|
83
|
-
ephemeral: Point;
|
|
84
|
-
encAmount: uint256;
|
|
85
|
-
encBlind: CellRef<uint256>;
|
|
86
|
-
}
|
|
87
|
-
export declare const TransferAdditionalData: {
|
|
88
|
-
create(args: {
|
|
89
|
-
ephemeral: Point;
|
|
90
|
-
encAmount: uint256;
|
|
91
|
-
encBlind: CellRef<uint256>;
|
|
92
|
-
}): TransferAdditionalData;
|
|
93
|
-
fromSlice(s: c.Slice): TransferAdditionalData;
|
|
94
|
-
store(self: TransferAdditionalData, b: c.Builder): void;
|
|
95
|
-
toCell(self: TransferAdditionalData): c.Cell;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
> struct (0x886055ac) InitTransfer {
|
|
99
|
-
> queryId: uint64
|
|
100
|
-
> to: address
|
|
101
|
-
> receiverViewKey: Point
|
|
102
|
-
> newCommitment: Cell<Point>
|
|
103
|
-
> amountCommit: Cell<Point>
|
|
104
|
-
> proof: Cell<Proof>
|
|
105
|
-
> ad: Cell<TransferAdditionalData>
|
|
106
|
-
> }
|
|
107
|
-
*/
|
|
108
|
-
export interface InitTransfer {
|
|
109
|
-
readonly $: 'InitTransfer';
|
|
110
|
-
queryId: uint64;
|
|
111
|
-
to: c.Address;
|
|
112
|
-
receiverViewKey: Point;
|
|
113
|
-
newCommitment: CellRef<Point>;
|
|
114
|
-
amountCommit: CellRef<Point>;
|
|
115
|
-
proof: CellRef<Proof>;
|
|
116
|
-
ad: CellRef<TransferAdditionalData>;
|
|
117
|
-
}
|
|
118
|
-
export declare const InitTransfer: {
|
|
119
|
-
PREFIX: number;
|
|
120
|
-
create(args: {
|
|
121
|
-
queryId: uint64;
|
|
122
|
-
to: c.Address;
|
|
123
|
-
receiverViewKey: Point;
|
|
124
|
-
newCommitment: CellRef<Point>;
|
|
125
|
-
amountCommit: CellRef<Point>;
|
|
126
|
-
proof: CellRef<Proof>;
|
|
127
|
-
ad: CellRef<TransferAdditionalData>;
|
|
128
|
-
}): InitTransfer;
|
|
129
|
-
fromSlice(s: c.Slice): InitTransfer;
|
|
130
|
-
store(self: InitTransfer, b: c.Builder): void;
|
|
131
|
-
toCell(self: InitTransfer): c.Cell;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
> struct InternalTransferAdditionalData {
|
|
135
|
-
> ephemeral: Point
|
|
136
|
-
> encBlind: uint256
|
|
137
|
-
> }
|
|
138
|
-
*/
|
|
139
|
-
export interface InternalTransferAdditionalData {
|
|
140
|
-
readonly $: 'InternalTransferAdditionalData';
|
|
141
|
-
ephemeral: Point;
|
|
142
|
-
encBlind: uint256;
|
|
143
|
-
}
|
|
144
|
-
export declare const InternalTransferAdditionalData: {
|
|
145
|
-
create(args: {
|
|
146
|
-
ephemeral: Point;
|
|
147
|
-
encBlind: uint256;
|
|
148
|
-
}): InternalTransferAdditionalData;
|
|
149
|
-
fromSlice(s: c.Slice): InternalTransferAdditionalData;
|
|
150
|
-
store(self: InternalTransferAdditionalData, b: c.Builder): void;
|
|
151
|
-
toCell(self: InternalTransferAdditionalData): c.Cell;
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
> struct (0xc22d1aa0) InternalTransfer {
|
|
155
|
-
> queryId: uint64
|
|
156
|
-
> from: address
|
|
157
|
-
> receiverViewKey: Point
|
|
158
|
-
> encAmount: Cell<uint256>
|
|
159
|
-
> amountCommit: Cell<Point>
|
|
160
|
-
> oldStorageCommitment: Cell<Point>
|
|
161
|
-
> ad: Cell<InternalTransferAdditionalData>
|
|
162
|
-
> }
|
|
163
|
-
*/
|
|
164
|
-
export interface InternalTransfer {
|
|
165
|
-
readonly $: 'InternalTransfer';
|
|
166
|
-
queryId: uint64;
|
|
167
|
-
from: c.Address;
|
|
168
|
-
receiverViewKey: Point;
|
|
169
|
-
encAmount: CellRef<uint256>;
|
|
170
|
-
amountCommit: CellRef<Point>;
|
|
171
|
-
oldStorageCommitment: CellRef<Point>;
|
|
172
|
-
ad: CellRef<InternalTransferAdditionalData>;
|
|
173
|
-
}
|
|
174
|
-
export declare const InternalTransfer: {
|
|
175
|
-
PREFIX: number;
|
|
176
|
-
create(args: {
|
|
177
|
-
queryId: uint64;
|
|
178
|
-
from: c.Address;
|
|
179
|
-
receiverViewKey: Point;
|
|
180
|
-
encAmount: CellRef<uint256>;
|
|
181
|
-
amountCommit: CellRef<Point>;
|
|
182
|
-
oldStorageCommitment: CellRef<Point>;
|
|
183
|
-
ad: CellRef<InternalTransferAdditionalData>;
|
|
184
|
-
}): InternalTransfer;
|
|
185
|
-
fromSlice(s: c.Slice): InternalTransfer;
|
|
186
|
-
store(self: InternalTransfer, b: c.Builder): void;
|
|
187
|
-
toCell(self: InternalTransfer): c.Cell;
|
|
188
|
-
};
|
|
189
|
-
/**
|
|
190
|
-
> struct (0x5c4dfe3b) TransferCallback {
|
|
191
|
-
> queryId: uint64
|
|
192
|
-
> from: address
|
|
193
|
-
> }
|
|
194
|
-
*/
|
|
195
|
-
export interface TransferCallback {
|
|
196
|
-
readonly $: 'TransferCallback';
|
|
197
|
-
queryId: uint64;
|
|
198
|
-
from: c.Address;
|
|
199
|
-
}
|
|
200
|
-
export declare const TransferCallback: {
|
|
201
|
-
PREFIX: number;
|
|
202
|
-
create(args: {
|
|
203
|
-
queryId: uint64;
|
|
204
|
-
from: c.Address;
|
|
205
|
-
}): TransferCallback;
|
|
206
|
-
fromSlice(s: c.Slice): TransferCallback;
|
|
207
|
-
store(self: TransferCallback, b: c.Builder): void;
|
|
208
|
-
toCell(self: TransferCallback): c.Cell;
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
> struct (0xde913221) InternalDeposit {
|
|
212
|
-
> queryId: uint64
|
|
213
|
-
> amount: coins
|
|
214
|
-
> commitment: Point
|
|
215
|
-
> proof: Cell<Proof>
|
|
216
|
-
> }
|
|
217
|
-
*/
|
|
218
|
-
export interface InternalDeposit {
|
|
219
|
-
readonly $: 'InternalDeposit';
|
|
220
|
-
queryId: uint64;
|
|
221
|
-
amount: coins;
|
|
222
|
-
commitment: Point;
|
|
223
|
-
proof: CellRef<Proof>;
|
|
224
|
-
}
|
|
225
|
-
export declare const InternalDeposit: {
|
|
226
|
-
PREFIX: number;
|
|
227
|
-
create(args: {
|
|
228
|
-
queryId: uint64;
|
|
229
|
-
amount: coins;
|
|
230
|
-
commitment: Point;
|
|
231
|
-
proof: CellRef<Proof>;
|
|
232
|
-
}): InternalDeposit;
|
|
233
|
-
fromSlice(s: c.Slice): InternalDeposit;
|
|
234
|
-
store(self: InternalDeposit, b: c.Builder): void;
|
|
235
|
-
toCell(self: InternalDeposit): c.Cell;
|
|
236
|
-
};
|
|
237
|
-
/**
|
|
238
|
-
> struct (0xa71f12ae) InitWithdraw {
|
|
239
|
-
> queryId: uint64
|
|
240
|
-
> amount: coins
|
|
241
|
-
> newCommitment: Cell<Point>
|
|
242
|
-
> proof: Cell<Proof>
|
|
243
|
-
> }
|
|
244
|
-
*/
|
|
245
|
-
export interface InitWithdraw {
|
|
246
|
-
readonly $: 'InitWithdraw';
|
|
247
|
-
queryId: uint64;
|
|
248
|
-
amount: coins;
|
|
249
|
-
newCommitment: CellRef<Point>;
|
|
250
|
-
proof: CellRef<Proof>;
|
|
251
|
-
}
|
|
252
|
-
export declare const InitWithdraw: {
|
|
253
|
-
PREFIX: number;
|
|
254
|
-
create(args: {
|
|
255
|
-
queryId: uint64;
|
|
256
|
-
amount: coins;
|
|
257
|
-
newCommitment: CellRef<Point>;
|
|
258
|
-
proof: CellRef<Proof>;
|
|
259
|
-
}): InitWithdraw;
|
|
260
|
-
fromSlice(s: c.Slice): InitWithdraw;
|
|
261
|
-
store(self: InitWithdraw, b: c.Builder): void;
|
|
262
|
-
toCell(self: InitWithdraw): c.Cell;
|
|
263
|
-
};
|
|
264
|
-
/**
|
|
265
|
-
> struct (0xdde0f974) InternalRegister {
|
|
266
|
-
> queryId: uint64
|
|
267
|
-
> publicViewKey: Point
|
|
268
|
-
> }
|
|
269
|
-
*/
|
|
270
|
-
export interface InternalRegister {
|
|
271
|
-
readonly $: 'InternalRegister';
|
|
272
|
-
queryId: uint64;
|
|
273
|
-
publicViewKey: Point;
|
|
274
|
-
}
|
|
275
|
-
export declare const InternalRegister: {
|
|
276
|
-
PREFIX: number;
|
|
277
|
-
create(args: {
|
|
278
|
-
queryId: uint64;
|
|
279
|
-
publicViewKey: Point;
|
|
280
|
-
}): InternalRegister;
|
|
281
|
-
fromSlice(s: c.Slice): InternalRegister;
|
|
282
|
-
store(self: InternalRegister, b: c.Builder): void;
|
|
283
|
-
toCell(self: InternalRegister): c.Cell;
|
|
284
|
-
};
|
|
285
|
-
/**
|
|
286
|
-
> struct (0x158bd66b) InternalFlipAccountStatus {
|
|
287
|
-
> queryId: uint64
|
|
288
|
-
> excess: address
|
|
289
|
-
> }
|
|
290
|
-
*/
|
|
291
|
-
export interface InternalFlipAccountStatus {
|
|
292
|
-
readonly $: 'InternalFlipAccountStatus';
|
|
293
|
-
queryId: uint64;
|
|
294
|
-
excess: c.Address;
|
|
295
|
-
}
|
|
296
|
-
export declare const InternalFlipAccountStatus: {
|
|
297
|
-
PREFIX: number;
|
|
298
|
-
create(args: {
|
|
299
|
-
queryId: uint64;
|
|
300
|
-
excess: c.Address;
|
|
301
|
-
}): InternalFlipAccountStatus;
|
|
302
|
-
fromSlice(s: c.Slice): InternalFlipAccountStatus;
|
|
303
|
-
store(self: InternalFlipAccountStatus, b: c.Builder): void;
|
|
304
|
-
toCell(self: InternalFlipAccountStatus): c.Cell;
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
> struct Point {
|
|
308
|
-
> x: uint256
|
|
309
|
-
> y: uint256
|
|
310
|
-
> }
|
|
311
|
-
*/
|
|
312
|
-
export interface Point {
|
|
313
|
-
readonly $: 'Point';
|
|
314
|
-
x: uint256;
|
|
315
|
-
y: uint256;
|
|
316
|
-
}
|
|
317
|
-
export declare const Point: {
|
|
318
|
-
create(args: {
|
|
319
|
-
x: uint256;
|
|
320
|
-
y: uint256;
|
|
321
|
-
}): Point;
|
|
322
|
-
fromSlice(s: c.Slice): Point;
|
|
323
|
-
store(self: Point, b: c.Builder): void;
|
|
324
|
-
toCell(self: Point): c.Cell;
|
|
325
|
-
};
|
|
326
|
-
/**
|
|
327
|
-
> struct Proof {
|
|
328
|
-
> piA: cell
|
|
329
|
-
> piB: cell
|
|
330
|
-
> piC: cell
|
|
331
|
-
> }
|
|
332
|
-
*/
|
|
333
|
-
export interface Proof {
|
|
334
|
-
readonly $: 'Proof';
|
|
335
|
-
piA: c.Cell;
|
|
336
|
-
piB: c.Cell;
|
|
337
|
-
piC: c.Cell;
|
|
338
|
-
}
|
|
339
|
-
export declare const Proof: {
|
|
340
|
-
create(args: {
|
|
341
|
-
piA: c.Cell;
|
|
342
|
-
piB: c.Cell;
|
|
343
|
-
piC: c.Cell;
|
|
344
|
-
}): Proof;
|
|
345
|
-
fromSlice(s: c.Slice): Proof;
|
|
346
|
-
store(self: Proof, b: c.Builder): void;
|
|
347
|
-
toCell(self: Proof): c.Cell;
|
|
348
|
-
};
|
|
349
|
-
/**
|
|
350
|
-
> struct (0xd53276db) ExcessMessage {
|
|
351
|
-
> queryId: uint64
|
|
352
|
-
> }
|
|
353
|
-
*/
|
|
354
|
-
export interface ExcessMessage {
|
|
355
|
-
readonly $: 'ExcessMessage';
|
|
356
|
-
queryId: uint64;
|
|
357
|
-
}
|
|
358
|
-
export declare const ExcessMessage: {
|
|
359
|
-
PREFIX: number;
|
|
360
|
-
create(args: {
|
|
361
|
-
queryId: uint64;
|
|
362
|
-
}): ExcessMessage;
|
|
363
|
-
fromSlice(s: c.Slice): ExcessMessage;
|
|
364
|
-
store(self: ExcessMessage, b: c.Builder): void;
|
|
365
|
-
toCell(self: ExcessMessage): c.Cell;
|
|
366
|
-
};
|
|
367
|
-
/**
|
|
368
|
-
> struct (0x37c7e6fe) InternalWithdraw {
|
|
369
|
-
> queryId: uint64
|
|
370
|
-
> from: address
|
|
371
|
-
> amount: coins
|
|
372
|
-
> }
|
|
373
|
-
*/
|
|
374
|
-
export interface InternalWithdraw {
|
|
375
|
-
readonly $: 'InternalWithdraw';
|
|
376
|
-
queryId: uint64;
|
|
377
|
-
from: c.Address;
|
|
378
|
-
amount: coins;
|
|
379
|
-
}
|
|
380
|
-
export declare const InternalWithdraw: {
|
|
381
|
-
PREFIX: number;
|
|
382
|
-
create(args: {
|
|
383
|
-
queryId: uint64;
|
|
384
|
-
from: c.Address;
|
|
385
|
-
amount: coins;
|
|
386
|
-
}): InternalWithdraw;
|
|
387
|
-
fromSlice(s: c.Slice): InternalWithdraw;
|
|
388
|
-
store(self: InternalWithdraw, b: c.Builder): void;
|
|
389
|
-
toCell(self: InternalWithdraw): c.Cell;
|
|
390
|
-
};
|
|
391
|
-
/**
|
|
392
|
-
> struct (0x4882c87b) TransferSuccessfulLog {
|
|
393
|
-
> queryId: uint64
|
|
394
|
-
> from: address
|
|
395
|
-
> data: cell
|
|
396
|
-
> }
|
|
397
|
-
*/
|
|
398
|
-
export interface TransferSuccessfulLog {
|
|
399
|
-
readonly $: 'TransferSuccessfulLog';
|
|
400
|
-
queryId: uint64;
|
|
401
|
-
from: c.Address;
|
|
402
|
-
data: c.Cell;
|
|
403
|
-
}
|
|
404
|
-
export declare const TransferSuccessfulLog: {
|
|
405
|
-
PREFIX: number;
|
|
406
|
-
create(args: {
|
|
407
|
-
queryId: uint64;
|
|
408
|
-
from: c.Address;
|
|
409
|
-
data: c.Cell;
|
|
410
|
-
}): TransferSuccessfulLog;
|
|
411
|
-
fromSlice(s: c.Slice): TransferSuccessfulLog;
|
|
412
|
-
store(self: TransferSuccessfulLog, b: c.Builder): void;
|
|
413
|
-
toCell(self: TransferSuccessfulLog): c.Cell;
|
|
414
|
-
};
|
|
415
|
-
interface ExtraSendOptions {
|
|
416
|
-
bounce?: boolean;
|
|
417
|
-
sendMode?: SendMode;
|
|
418
|
-
extraCurrencies?: c.ExtraCurrency;
|
|
419
|
-
}
|
|
420
|
-
interface DeployedAddrOptions {
|
|
421
|
-
workchain?: number;
|
|
422
|
-
toShard?: {
|
|
423
|
-
fixedPrefixLength: number;
|
|
424
|
-
closeTo: c.Address;
|
|
425
|
-
};
|
|
426
|
-
overrideContractCode?: c.Cell;
|
|
427
|
-
}
|
|
428
|
-
export declare class Account implements c.Contract {
|
|
429
|
-
static Errors: {
|
|
430
|
-
'DepositErrors.InvalidInputs': number;
|
|
431
|
-
'TransferErrors.InvalidInputs': number;
|
|
432
|
-
'WithdrawErrors.InvalidInputs': number;
|
|
433
|
-
'TransferErrors.IndexOutOfRange': number;
|
|
434
|
-
'Errors.InvalidProof': number;
|
|
435
|
-
'Errors.InvalidAmount': number;
|
|
436
|
-
'Errors.AlreadyInitialized': number;
|
|
437
|
-
'Errors.NotAlreadyInitialized': number;
|
|
438
|
-
'Errors.NotEnoughGas': number;
|
|
439
|
-
'Errors.InvalidPoint': number;
|
|
440
|
-
'Errors.InvalidWorkchain': number;
|
|
441
|
-
'Errors.WrongSender': number;
|
|
442
|
-
'Errors.PositionLocked': number;
|
|
443
|
-
'Errors.WrongOP': number;
|
|
444
|
-
};
|
|
445
|
-
readonly address: c.Address;
|
|
446
|
-
readonly init: {
|
|
447
|
-
code: c.Cell;
|
|
448
|
-
data: c.Cell;
|
|
449
|
-
} | undefined;
|
|
450
|
-
protected constructor(address: c.Address, init?: {
|
|
451
|
-
code: c.Cell;
|
|
452
|
-
data: c.Cell;
|
|
453
|
-
});
|
|
454
|
-
static fromAddress(address: c.Address): Account;
|
|
455
|
-
static createCellOfInternalDeposit(body: {
|
|
456
|
-
queryId: uint64;
|
|
457
|
-
amount: coins;
|
|
458
|
-
commitment: Point;
|
|
459
|
-
proof: CellRef<Proof>;
|
|
460
|
-
}): c.Cell;
|
|
461
|
-
static createCellOfInitTransfer(body: {
|
|
462
|
-
queryId: uint64;
|
|
463
|
-
to: c.Address;
|
|
464
|
-
receiverViewKey: Point;
|
|
465
|
-
newCommitment: CellRef<Point>;
|
|
466
|
-
amountCommit: CellRef<Point>;
|
|
467
|
-
proof: CellRef<Proof>;
|
|
468
|
-
ad: CellRef<TransferAdditionalData>;
|
|
469
|
-
}): c.Cell;
|
|
470
|
-
static createCellOfInternalTransfer(body: {
|
|
471
|
-
queryId: uint64;
|
|
472
|
-
from: c.Address;
|
|
473
|
-
receiverViewKey: Point;
|
|
474
|
-
encAmount: CellRef<uint256>;
|
|
475
|
-
amountCommit: CellRef<Point>;
|
|
476
|
-
oldStorageCommitment: CellRef<Point>;
|
|
477
|
-
ad: CellRef<InternalTransferAdditionalData>;
|
|
478
|
-
}): c.Cell;
|
|
479
|
-
static createCellOfTransferCallback(body: {
|
|
480
|
-
queryId: uint64;
|
|
481
|
-
from: c.Address;
|
|
482
|
-
}): c.Cell;
|
|
483
|
-
static createCellOfInitWithdraw(body: {
|
|
484
|
-
queryId: uint64;
|
|
485
|
-
amount: coins;
|
|
486
|
-
newCommitment: CellRef<Point>;
|
|
487
|
-
proof: CellRef<Proof>;
|
|
488
|
-
}): c.Cell;
|
|
489
|
-
static createCellOfInternalRegister(body: {
|
|
490
|
-
queryId: uint64;
|
|
491
|
-
publicViewKey: Point;
|
|
492
|
-
}): c.Cell;
|
|
493
|
-
static createCellOfInternalFlipAccountStatus(body: {
|
|
494
|
-
queryId: uint64;
|
|
495
|
-
excess: c.Address;
|
|
496
|
-
}): c.Cell;
|
|
497
|
-
sendDeploy(provider: ContractProvider, via: Sender, msgValue: coins, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
498
|
-
sendInternalDeposit(provider: ContractProvider, via: Sender, msgValue: coins, body: {
|
|
499
|
-
queryId: uint64;
|
|
500
|
-
amount: coins;
|
|
501
|
-
commitment: Point;
|
|
502
|
-
proof: CellRef<Proof>;
|
|
503
|
-
}, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
504
|
-
sendInitTransfer(provider: ContractProvider, via: Sender, msgValue: coins, body: {
|
|
505
|
-
queryId: uint64;
|
|
506
|
-
to: c.Address;
|
|
507
|
-
receiverViewKey: Point;
|
|
508
|
-
newCommitment: CellRef<Point>;
|
|
509
|
-
amountCommit: CellRef<Point>;
|
|
510
|
-
proof: CellRef<Proof>;
|
|
511
|
-
ad: CellRef<TransferAdditionalData>;
|
|
512
|
-
}, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
513
|
-
sendInternalTransfer(provider: ContractProvider, via: Sender, msgValue: coins, body: {
|
|
514
|
-
queryId: uint64;
|
|
515
|
-
from: c.Address;
|
|
516
|
-
receiverViewKey: Point;
|
|
517
|
-
encAmount: CellRef<uint256>;
|
|
518
|
-
amountCommit: CellRef<Point>;
|
|
519
|
-
oldStorageCommitment: CellRef<Point>;
|
|
520
|
-
ad: CellRef<InternalTransferAdditionalData>;
|
|
521
|
-
}, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
522
|
-
sendTransferCallback(provider: ContractProvider, via: Sender, msgValue: coins, body: {
|
|
523
|
-
queryId: uint64;
|
|
524
|
-
from: c.Address;
|
|
525
|
-
}, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
526
|
-
sendInitWithdraw(provider: ContractProvider, via: Sender, msgValue: coins, body: {
|
|
527
|
-
queryId: uint64;
|
|
528
|
-
amount: coins;
|
|
529
|
-
newCommitment: CellRef<Point>;
|
|
530
|
-
proof: CellRef<Proof>;
|
|
531
|
-
}, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
532
|
-
sendInternalRegister(provider: ContractProvider, via: Sender, msgValue: coins, body: {
|
|
533
|
-
queryId: uint64;
|
|
534
|
-
publicViewKey: Point;
|
|
535
|
-
}, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
536
|
-
sendInternalFlipAccountStatus(provider: ContractProvider, via: Sender, msgValue: coins, body: {
|
|
537
|
-
queryId: uint64;
|
|
538
|
-
excess: c.Address;
|
|
539
|
-
}, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
540
|
-
getAccountData(provider: ContractProvider): Promise<AccountRuntimeStorage>;
|
|
541
|
-
}
|
|
542
|
-
export {};
|
|
@@ -1,677 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// AUTO-GENERATED, do not edit
|
|
3
|
-
// It's a TypeScript wrapper for a Account contract in Tolk.
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.Account = exports.TransferSuccessfulLog = exports.InternalWithdraw = exports.ExcessMessage = exports.Proof = exports.Point = exports.InternalFlipAccountStatus = exports.InternalRegister = exports.InitWithdraw = exports.InternalDeposit = exports.TransferCallback = exports.InternalTransfer = exports.InternalTransferAdditionalData = exports.InitTransfer = exports.TransferAdditionalData = exports.AccountStorage = exports.AccountRuntimeStorage = void 0;
|
|
40
|
-
const c = __importStar(require("@ton/core"));
|
|
41
|
-
const core_1 = require("@ton/core");
|
|
42
|
-
function makeCellFrom(self, storeFn_T) {
|
|
43
|
-
let b = (0, core_1.beginCell)();
|
|
44
|
-
storeFn_T(self, b);
|
|
45
|
-
return b.endCell();
|
|
46
|
-
}
|
|
47
|
-
function loadAndCheckPrefix32(s, expected, structName) {
|
|
48
|
-
let prefix = s.loadUint(32);
|
|
49
|
-
if (prefix !== expected) {
|
|
50
|
-
throw new Error(`Incorrect prefix for '${structName}': expected 0x${expected.toString(16).padStart(8, '0')}, got 0x${prefix.toString(16).padStart(8, '0')}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function lookupPrefix(s, expected, prefixLen) {
|
|
54
|
-
return s.remainingBits >= prefixLen && s.preloadUint(prefixLen) === expected;
|
|
55
|
-
}
|
|
56
|
-
function throwNonePrefixMatch(fieldPath) {
|
|
57
|
-
throw new Error(`Incorrect prefix for '${fieldPath}': none of variants matched`);
|
|
58
|
-
}
|
|
59
|
-
function storeCellRef(cell, b, storeFn_T) {
|
|
60
|
-
let b_ref = c.beginCell();
|
|
61
|
-
storeFn_T(cell.ref, b_ref);
|
|
62
|
-
b.storeRef(b_ref.endCell());
|
|
63
|
-
}
|
|
64
|
-
function loadCellRef(s, loadFn_T) {
|
|
65
|
-
let s_ref = s.loadRef().beginParse();
|
|
66
|
-
return { ref: loadFn_T(s_ref) };
|
|
67
|
-
}
|
|
68
|
-
function storeTolkNullable(v, b, storeFn_T) {
|
|
69
|
-
if (v === null) {
|
|
70
|
-
b.storeUint(0, 1);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
b.storeUint(1, 1);
|
|
74
|
-
storeFn_T(v, b);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
// ————————————————————————————————————————————
|
|
78
|
-
// parse get methods result from a TVM stack
|
|
79
|
-
//
|
|
80
|
-
class StackReader {
|
|
81
|
-
constructor(tuple) {
|
|
82
|
-
this.tuple = tuple;
|
|
83
|
-
}
|
|
84
|
-
static fromGetMethod(expectedN, getMethodResult) {
|
|
85
|
-
let tuple = [];
|
|
86
|
-
while (getMethodResult.stack.remaining) {
|
|
87
|
-
tuple.push(getMethodResult.stack.pop());
|
|
88
|
-
}
|
|
89
|
-
if (tuple.length !== expectedN) {
|
|
90
|
-
throw new Error(`expected ${expectedN} stack width, got ${tuple.length}`);
|
|
91
|
-
}
|
|
92
|
-
return new StackReader(tuple);
|
|
93
|
-
}
|
|
94
|
-
popExpecting(itemType) {
|
|
95
|
-
const item = this.tuple.shift();
|
|
96
|
-
if (item?.type === itemType) {
|
|
97
|
-
return item;
|
|
98
|
-
}
|
|
99
|
-
throw new Error(`not '${itemType}' on a stack`);
|
|
100
|
-
}
|
|
101
|
-
popCellLike() {
|
|
102
|
-
const item = this.tuple.shift();
|
|
103
|
-
if (item && (item.type === 'cell' || item.type === 'slice' || item.type === 'builder')) {
|
|
104
|
-
return item.cell;
|
|
105
|
-
}
|
|
106
|
-
throw new Error(`not cell/slice on a stack`);
|
|
107
|
-
}
|
|
108
|
-
readBigInt() {
|
|
109
|
-
return this.popExpecting('int').value;
|
|
110
|
-
}
|
|
111
|
-
readBoolean() {
|
|
112
|
-
return this.popExpecting('int').value !== 0n;
|
|
113
|
-
}
|
|
114
|
-
readCell() {
|
|
115
|
-
return this.popCellLike();
|
|
116
|
-
}
|
|
117
|
-
readSlice() {
|
|
118
|
-
return this.popCellLike().beginParse();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.AccountRuntimeStorage = {
|
|
122
|
-
create(args) {
|
|
123
|
-
return {
|
|
124
|
-
$: 'AccountRuntimeStorage',
|
|
125
|
-
...args
|
|
126
|
-
};
|
|
127
|
-
},
|
|
128
|
-
fromSlice(s) {
|
|
129
|
-
return {
|
|
130
|
-
$: 'AccountRuntimeStorage',
|
|
131
|
-
locked: s.loadBoolean(),
|
|
132
|
-
minter: s.loadAddress(),
|
|
133
|
-
owner: s.loadAddress(),
|
|
134
|
-
seqNo: s.loadUintBig(32),
|
|
135
|
-
publicViewKey: exports.Point.fromSlice(s),
|
|
136
|
-
commitment: exports.Point.fromSlice(s),
|
|
137
|
-
};
|
|
138
|
-
},
|
|
139
|
-
store(self, b) {
|
|
140
|
-
b.storeBit(self.locked);
|
|
141
|
-
b.storeAddress(self.minter);
|
|
142
|
-
b.storeAddress(self.owner);
|
|
143
|
-
b.storeUint(self.seqNo, 32);
|
|
144
|
-
exports.Point.store(self.publicViewKey, b);
|
|
145
|
-
exports.Point.store(self.commitment, b);
|
|
146
|
-
},
|
|
147
|
-
toCell(self) {
|
|
148
|
-
return makeCellFrom(self, exports.AccountRuntimeStorage.store);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
exports.AccountStorage = {
|
|
152
|
-
create(args) {
|
|
153
|
-
return {
|
|
154
|
-
$: 'AccountStorage',
|
|
155
|
-
locked: false,
|
|
156
|
-
seqNo: 0n,
|
|
157
|
-
...args
|
|
158
|
-
};
|
|
159
|
-
},
|
|
160
|
-
fromSlice(s) {
|
|
161
|
-
return {
|
|
162
|
-
$: 'AccountStorage',
|
|
163
|
-
locked: s.loadBoolean(),
|
|
164
|
-
minter: s.loadAddress(),
|
|
165
|
-
owner: s.loadAddress(),
|
|
166
|
-
seqNo: s.loadUintBig(32),
|
|
167
|
-
publicViewKey: loadCellRef(s, exports.Point.fromSlice),
|
|
168
|
-
commitment: loadCellRef(s, exports.Point.fromSlice),
|
|
169
|
-
};
|
|
170
|
-
},
|
|
171
|
-
store(self, b) {
|
|
172
|
-
b.storeBit(self.locked);
|
|
173
|
-
b.storeAddress(self.minter);
|
|
174
|
-
b.storeAddress(self.owner);
|
|
175
|
-
b.storeUint(self.seqNo, 32);
|
|
176
|
-
storeCellRef(self.publicViewKey, b, exports.Point.store);
|
|
177
|
-
storeCellRef(self.commitment, b, exports.Point.store);
|
|
178
|
-
},
|
|
179
|
-
toCell(self) {
|
|
180
|
-
return makeCellFrom(self, exports.AccountStorage.store);
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
exports.TransferAdditionalData = {
|
|
184
|
-
create(args) {
|
|
185
|
-
return {
|
|
186
|
-
$: 'TransferAdditionalData',
|
|
187
|
-
...args
|
|
188
|
-
};
|
|
189
|
-
},
|
|
190
|
-
fromSlice(s) {
|
|
191
|
-
return {
|
|
192
|
-
$: 'TransferAdditionalData',
|
|
193
|
-
ephemeral: exports.Point.fromSlice(s),
|
|
194
|
-
encAmount: s.loadUintBig(256),
|
|
195
|
-
encBlind: loadCellRef(s, (s) => s.loadUintBig(256)),
|
|
196
|
-
};
|
|
197
|
-
},
|
|
198
|
-
store(self, b) {
|
|
199
|
-
exports.Point.store(self.ephemeral, b);
|
|
200
|
-
b.storeUint(self.encAmount, 256);
|
|
201
|
-
storeCellRef(self.encBlind, b, (v, b) => b.storeUint(v, 256));
|
|
202
|
-
},
|
|
203
|
-
toCell(self) {
|
|
204
|
-
return makeCellFrom(self, exports.TransferAdditionalData.store);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
exports.InitTransfer = {
|
|
208
|
-
PREFIX: 0x886055ac,
|
|
209
|
-
create(args) {
|
|
210
|
-
return {
|
|
211
|
-
$: 'InitTransfer',
|
|
212
|
-
...args
|
|
213
|
-
};
|
|
214
|
-
},
|
|
215
|
-
fromSlice(s) {
|
|
216
|
-
loadAndCheckPrefix32(s, 0x886055ac, 'InitTransfer');
|
|
217
|
-
return {
|
|
218
|
-
$: 'InitTransfer',
|
|
219
|
-
queryId: s.loadUintBig(64),
|
|
220
|
-
to: s.loadAddress(),
|
|
221
|
-
receiverViewKey: exports.Point.fromSlice(s),
|
|
222
|
-
newCommitment: loadCellRef(s, exports.Point.fromSlice),
|
|
223
|
-
amountCommit: loadCellRef(s, exports.Point.fromSlice),
|
|
224
|
-
proof: loadCellRef(s, exports.Proof.fromSlice),
|
|
225
|
-
ad: loadCellRef(s, exports.TransferAdditionalData.fromSlice),
|
|
226
|
-
};
|
|
227
|
-
},
|
|
228
|
-
store(self, b) {
|
|
229
|
-
b.storeUint(0x886055ac, 32);
|
|
230
|
-
b.storeUint(self.queryId, 64);
|
|
231
|
-
b.storeAddress(self.to);
|
|
232
|
-
exports.Point.store(self.receiverViewKey, b);
|
|
233
|
-
storeCellRef(self.newCommitment, b, exports.Point.store);
|
|
234
|
-
storeCellRef(self.amountCommit, b, exports.Point.store);
|
|
235
|
-
storeCellRef(self.proof, b, exports.Proof.store);
|
|
236
|
-
storeCellRef(self.ad, b, exports.TransferAdditionalData.store);
|
|
237
|
-
},
|
|
238
|
-
toCell(self) {
|
|
239
|
-
return makeCellFrom(self, exports.InitTransfer.store);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
exports.InternalTransferAdditionalData = {
|
|
243
|
-
create(args) {
|
|
244
|
-
return {
|
|
245
|
-
$: 'InternalTransferAdditionalData',
|
|
246
|
-
...args
|
|
247
|
-
};
|
|
248
|
-
},
|
|
249
|
-
fromSlice(s) {
|
|
250
|
-
return {
|
|
251
|
-
$: 'InternalTransferAdditionalData',
|
|
252
|
-
ephemeral: exports.Point.fromSlice(s),
|
|
253
|
-
encBlind: s.loadUintBig(256),
|
|
254
|
-
};
|
|
255
|
-
},
|
|
256
|
-
store(self, b) {
|
|
257
|
-
exports.Point.store(self.ephemeral, b);
|
|
258
|
-
b.storeUint(self.encBlind, 256);
|
|
259
|
-
},
|
|
260
|
-
toCell(self) {
|
|
261
|
-
return makeCellFrom(self, exports.InternalTransferAdditionalData.store);
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
exports.InternalTransfer = {
|
|
265
|
-
PREFIX: 0xc22d1aa0,
|
|
266
|
-
create(args) {
|
|
267
|
-
return {
|
|
268
|
-
$: 'InternalTransfer',
|
|
269
|
-
...args
|
|
270
|
-
};
|
|
271
|
-
},
|
|
272
|
-
fromSlice(s) {
|
|
273
|
-
loadAndCheckPrefix32(s, 0xc22d1aa0, 'InternalTransfer');
|
|
274
|
-
return {
|
|
275
|
-
$: 'InternalTransfer',
|
|
276
|
-
queryId: s.loadUintBig(64),
|
|
277
|
-
from: s.loadAddress(),
|
|
278
|
-
receiverViewKey: exports.Point.fromSlice(s),
|
|
279
|
-
encAmount: loadCellRef(s, (s) => s.loadUintBig(256)),
|
|
280
|
-
amountCommit: loadCellRef(s, exports.Point.fromSlice),
|
|
281
|
-
oldStorageCommitment: loadCellRef(s, exports.Point.fromSlice),
|
|
282
|
-
ad: loadCellRef(s, exports.InternalTransferAdditionalData.fromSlice),
|
|
283
|
-
};
|
|
284
|
-
},
|
|
285
|
-
store(self, b) {
|
|
286
|
-
b.storeUint(0xc22d1aa0, 32);
|
|
287
|
-
b.storeUint(self.queryId, 64);
|
|
288
|
-
b.storeAddress(self.from);
|
|
289
|
-
exports.Point.store(self.receiverViewKey, b);
|
|
290
|
-
storeCellRef(self.encAmount, b, (v, b) => b.storeUint(v, 256));
|
|
291
|
-
storeCellRef(self.amountCommit, b, exports.Point.store);
|
|
292
|
-
storeCellRef(self.oldStorageCommitment, b, exports.Point.store);
|
|
293
|
-
storeCellRef(self.ad, b, exports.InternalTransferAdditionalData.store);
|
|
294
|
-
},
|
|
295
|
-
toCell(self) {
|
|
296
|
-
return makeCellFrom(self, exports.InternalTransfer.store);
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
exports.TransferCallback = {
|
|
300
|
-
PREFIX: 0x5c4dfe3b,
|
|
301
|
-
create(args) {
|
|
302
|
-
return {
|
|
303
|
-
$: 'TransferCallback',
|
|
304
|
-
...args
|
|
305
|
-
};
|
|
306
|
-
},
|
|
307
|
-
fromSlice(s) {
|
|
308
|
-
loadAndCheckPrefix32(s, 0x5c4dfe3b, 'TransferCallback');
|
|
309
|
-
return {
|
|
310
|
-
$: 'TransferCallback',
|
|
311
|
-
queryId: s.loadUintBig(64),
|
|
312
|
-
from: s.loadAddress(),
|
|
313
|
-
};
|
|
314
|
-
},
|
|
315
|
-
store(self, b) {
|
|
316
|
-
b.storeUint(0x5c4dfe3b, 32);
|
|
317
|
-
b.storeUint(self.queryId, 64);
|
|
318
|
-
b.storeAddress(self.from);
|
|
319
|
-
},
|
|
320
|
-
toCell(self) {
|
|
321
|
-
return makeCellFrom(self, exports.TransferCallback.store);
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
exports.InternalDeposit = {
|
|
325
|
-
PREFIX: 0xde913221,
|
|
326
|
-
create(args) {
|
|
327
|
-
return {
|
|
328
|
-
$: 'InternalDeposit',
|
|
329
|
-
...args
|
|
330
|
-
};
|
|
331
|
-
},
|
|
332
|
-
fromSlice(s) {
|
|
333
|
-
loadAndCheckPrefix32(s, 0xde913221, 'InternalDeposit');
|
|
334
|
-
return {
|
|
335
|
-
$: 'InternalDeposit',
|
|
336
|
-
queryId: s.loadUintBig(64),
|
|
337
|
-
amount: s.loadCoins(),
|
|
338
|
-
commitment: exports.Point.fromSlice(s),
|
|
339
|
-
proof: loadCellRef(s, exports.Proof.fromSlice),
|
|
340
|
-
};
|
|
341
|
-
},
|
|
342
|
-
store(self, b) {
|
|
343
|
-
b.storeUint(0xde913221, 32);
|
|
344
|
-
b.storeUint(self.queryId, 64);
|
|
345
|
-
b.storeCoins(self.amount);
|
|
346
|
-
exports.Point.store(self.commitment, b);
|
|
347
|
-
storeCellRef(self.proof, b, exports.Proof.store);
|
|
348
|
-
},
|
|
349
|
-
toCell(self) {
|
|
350
|
-
return makeCellFrom(self, exports.InternalDeposit.store);
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
exports.InitWithdraw = {
|
|
354
|
-
PREFIX: 0xa71f12ae,
|
|
355
|
-
create(args) {
|
|
356
|
-
return {
|
|
357
|
-
$: 'InitWithdraw',
|
|
358
|
-
...args
|
|
359
|
-
};
|
|
360
|
-
},
|
|
361
|
-
fromSlice(s) {
|
|
362
|
-
loadAndCheckPrefix32(s, 0xa71f12ae, 'InitWithdraw');
|
|
363
|
-
return {
|
|
364
|
-
$: 'InitWithdraw',
|
|
365
|
-
queryId: s.loadUintBig(64),
|
|
366
|
-
amount: s.loadCoins(),
|
|
367
|
-
newCommitment: loadCellRef(s, exports.Point.fromSlice),
|
|
368
|
-
proof: loadCellRef(s, exports.Proof.fromSlice),
|
|
369
|
-
};
|
|
370
|
-
},
|
|
371
|
-
store(self, b) {
|
|
372
|
-
b.storeUint(0xa71f12ae, 32);
|
|
373
|
-
b.storeUint(self.queryId, 64);
|
|
374
|
-
b.storeCoins(self.amount);
|
|
375
|
-
storeCellRef(self.newCommitment, b, exports.Point.store);
|
|
376
|
-
storeCellRef(self.proof, b, exports.Proof.store);
|
|
377
|
-
},
|
|
378
|
-
toCell(self) {
|
|
379
|
-
return makeCellFrom(self, exports.InitWithdraw.store);
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
|
-
exports.InternalRegister = {
|
|
383
|
-
PREFIX: 0xdde0f974,
|
|
384
|
-
create(args) {
|
|
385
|
-
return {
|
|
386
|
-
$: 'InternalRegister',
|
|
387
|
-
...args
|
|
388
|
-
};
|
|
389
|
-
},
|
|
390
|
-
fromSlice(s) {
|
|
391
|
-
loadAndCheckPrefix32(s, 0xdde0f974, 'InternalRegister');
|
|
392
|
-
return {
|
|
393
|
-
$: 'InternalRegister',
|
|
394
|
-
queryId: s.loadUintBig(64),
|
|
395
|
-
publicViewKey: exports.Point.fromSlice(s),
|
|
396
|
-
};
|
|
397
|
-
},
|
|
398
|
-
store(self, b) {
|
|
399
|
-
b.storeUint(0xdde0f974, 32);
|
|
400
|
-
b.storeUint(self.queryId, 64);
|
|
401
|
-
exports.Point.store(self.publicViewKey, b);
|
|
402
|
-
},
|
|
403
|
-
toCell(self) {
|
|
404
|
-
return makeCellFrom(self, exports.InternalRegister.store);
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
exports.InternalFlipAccountStatus = {
|
|
408
|
-
PREFIX: 0x158bd66b,
|
|
409
|
-
create(args) {
|
|
410
|
-
return {
|
|
411
|
-
$: 'InternalFlipAccountStatus',
|
|
412
|
-
...args
|
|
413
|
-
};
|
|
414
|
-
},
|
|
415
|
-
fromSlice(s) {
|
|
416
|
-
loadAndCheckPrefix32(s, 0x158bd66b, 'InternalFlipAccountStatus');
|
|
417
|
-
return {
|
|
418
|
-
$: 'InternalFlipAccountStatus',
|
|
419
|
-
queryId: s.loadUintBig(64),
|
|
420
|
-
excess: s.loadAddress(),
|
|
421
|
-
};
|
|
422
|
-
},
|
|
423
|
-
store(self, b) {
|
|
424
|
-
b.storeUint(0x158bd66b, 32);
|
|
425
|
-
b.storeUint(self.queryId, 64);
|
|
426
|
-
b.storeAddress(self.excess);
|
|
427
|
-
},
|
|
428
|
-
toCell(self) {
|
|
429
|
-
return makeCellFrom(self, exports.InternalFlipAccountStatus.store);
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
exports.Point = {
|
|
433
|
-
create(args) {
|
|
434
|
-
return {
|
|
435
|
-
$: 'Point',
|
|
436
|
-
...args
|
|
437
|
-
};
|
|
438
|
-
},
|
|
439
|
-
fromSlice(s) {
|
|
440
|
-
return {
|
|
441
|
-
$: 'Point',
|
|
442
|
-
x: s.loadUintBig(256),
|
|
443
|
-
y: s.loadUintBig(256),
|
|
444
|
-
};
|
|
445
|
-
},
|
|
446
|
-
store(self, b) {
|
|
447
|
-
b.storeUint(self.x, 256);
|
|
448
|
-
b.storeUint(self.y, 256);
|
|
449
|
-
},
|
|
450
|
-
toCell(self) {
|
|
451
|
-
return makeCellFrom(self, exports.Point.store);
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
exports.Proof = {
|
|
455
|
-
create(args) {
|
|
456
|
-
return {
|
|
457
|
-
$: 'Proof',
|
|
458
|
-
...args
|
|
459
|
-
};
|
|
460
|
-
},
|
|
461
|
-
fromSlice(s) {
|
|
462
|
-
return {
|
|
463
|
-
$: 'Proof',
|
|
464
|
-
piA: s.loadRef(),
|
|
465
|
-
piB: s.loadRef(),
|
|
466
|
-
piC: s.loadRef(),
|
|
467
|
-
};
|
|
468
|
-
},
|
|
469
|
-
store(self, b) {
|
|
470
|
-
b.storeRef(self.piA);
|
|
471
|
-
b.storeRef(self.piB);
|
|
472
|
-
b.storeRef(self.piC);
|
|
473
|
-
},
|
|
474
|
-
toCell(self) {
|
|
475
|
-
return makeCellFrom(self, exports.Proof.store);
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
exports.ExcessMessage = {
|
|
479
|
-
PREFIX: 0xd53276db,
|
|
480
|
-
create(args) {
|
|
481
|
-
return {
|
|
482
|
-
$: 'ExcessMessage',
|
|
483
|
-
...args
|
|
484
|
-
};
|
|
485
|
-
},
|
|
486
|
-
fromSlice(s) {
|
|
487
|
-
loadAndCheckPrefix32(s, 0xd53276db, 'ExcessMessage');
|
|
488
|
-
return {
|
|
489
|
-
$: 'ExcessMessage',
|
|
490
|
-
queryId: s.loadUintBig(64),
|
|
491
|
-
};
|
|
492
|
-
},
|
|
493
|
-
store(self, b) {
|
|
494
|
-
b.storeUint(0xd53276db, 32);
|
|
495
|
-
b.storeUint(self.queryId, 64);
|
|
496
|
-
},
|
|
497
|
-
toCell(self) {
|
|
498
|
-
return makeCellFrom(self, exports.ExcessMessage.store);
|
|
499
|
-
}
|
|
500
|
-
};
|
|
501
|
-
exports.InternalWithdraw = {
|
|
502
|
-
PREFIX: 0x37c7e6fe,
|
|
503
|
-
create(args) {
|
|
504
|
-
return {
|
|
505
|
-
$: 'InternalWithdraw',
|
|
506
|
-
...args
|
|
507
|
-
};
|
|
508
|
-
},
|
|
509
|
-
fromSlice(s) {
|
|
510
|
-
loadAndCheckPrefix32(s, 0x37c7e6fe, 'InternalWithdraw');
|
|
511
|
-
return {
|
|
512
|
-
$: 'InternalWithdraw',
|
|
513
|
-
queryId: s.loadUintBig(64),
|
|
514
|
-
from: s.loadAddress(),
|
|
515
|
-
amount: s.loadCoins(),
|
|
516
|
-
};
|
|
517
|
-
},
|
|
518
|
-
store(self, b) {
|
|
519
|
-
b.storeUint(0x37c7e6fe, 32);
|
|
520
|
-
b.storeUint(self.queryId, 64);
|
|
521
|
-
b.storeAddress(self.from);
|
|
522
|
-
b.storeCoins(self.amount);
|
|
523
|
-
},
|
|
524
|
-
toCell(self) {
|
|
525
|
-
return makeCellFrom(self, exports.InternalWithdraw.store);
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
exports.TransferSuccessfulLog = {
|
|
529
|
-
PREFIX: 0x4882c87b,
|
|
530
|
-
create(args) {
|
|
531
|
-
return {
|
|
532
|
-
$: 'TransferSuccessfulLog',
|
|
533
|
-
...args
|
|
534
|
-
};
|
|
535
|
-
},
|
|
536
|
-
fromSlice(s) {
|
|
537
|
-
loadAndCheckPrefix32(s, 0x4882c87b, 'TransferSuccessfulLog');
|
|
538
|
-
return {
|
|
539
|
-
$: 'TransferSuccessfulLog',
|
|
540
|
-
queryId: s.loadUintBig(64),
|
|
541
|
-
from: s.loadAddress(),
|
|
542
|
-
data: s.loadRef(),
|
|
543
|
-
};
|
|
544
|
-
},
|
|
545
|
-
store(self, b) {
|
|
546
|
-
b.storeUint(0x4882c87b, 32);
|
|
547
|
-
b.storeUint(self.queryId, 64);
|
|
548
|
-
b.storeAddress(self.from);
|
|
549
|
-
b.storeRef(self.data);
|
|
550
|
-
},
|
|
551
|
-
toCell(self) {
|
|
552
|
-
return makeCellFrom(self, exports.TransferSuccessfulLog.store);
|
|
553
|
-
}
|
|
554
|
-
};
|
|
555
|
-
class Account {
|
|
556
|
-
constructor(address, init) {
|
|
557
|
-
this.address = address;
|
|
558
|
-
this.init = init;
|
|
559
|
-
}
|
|
560
|
-
static fromAddress(address) {
|
|
561
|
-
return new Account(address);
|
|
562
|
-
}
|
|
563
|
-
static createCellOfInternalDeposit(body) {
|
|
564
|
-
return exports.InternalDeposit.toCell(exports.InternalDeposit.create(body));
|
|
565
|
-
}
|
|
566
|
-
static createCellOfInitTransfer(body) {
|
|
567
|
-
return exports.InitTransfer.toCell(exports.InitTransfer.create(body));
|
|
568
|
-
}
|
|
569
|
-
static createCellOfInternalTransfer(body) {
|
|
570
|
-
return exports.InternalTransfer.toCell(exports.InternalTransfer.create(body));
|
|
571
|
-
}
|
|
572
|
-
static createCellOfTransferCallback(body) {
|
|
573
|
-
return exports.TransferCallback.toCell(exports.TransferCallback.create(body));
|
|
574
|
-
}
|
|
575
|
-
static createCellOfInitWithdraw(body) {
|
|
576
|
-
return exports.InitWithdraw.toCell(exports.InitWithdraw.create(body));
|
|
577
|
-
}
|
|
578
|
-
static createCellOfInternalRegister(body) {
|
|
579
|
-
return exports.InternalRegister.toCell(exports.InternalRegister.create(body));
|
|
580
|
-
}
|
|
581
|
-
static createCellOfInternalFlipAccountStatus(body) {
|
|
582
|
-
return exports.InternalFlipAccountStatus.toCell(exports.InternalFlipAccountStatus.create(body));
|
|
583
|
-
}
|
|
584
|
-
async sendDeploy(provider, via, msgValue, extraOptions) {
|
|
585
|
-
return provider.internal(via, {
|
|
586
|
-
value: msgValue,
|
|
587
|
-
body: c.Cell.EMPTY,
|
|
588
|
-
...extraOptions
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
async sendInternalDeposit(provider, via, msgValue, body, extraOptions) {
|
|
592
|
-
return provider.internal(via, {
|
|
593
|
-
value: msgValue,
|
|
594
|
-
body: exports.InternalDeposit.toCell(exports.InternalDeposit.create(body)),
|
|
595
|
-
...extraOptions
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
async sendInitTransfer(provider, via, msgValue, body, extraOptions) {
|
|
599
|
-
return provider.internal(via, {
|
|
600
|
-
value: msgValue,
|
|
601
|
-
body: exports.InitTransfer.toCell(exports.InitTransfer.create(body)),
|
|
602
|
-
...extraOptions
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
async sendInternalTransfer(provider, via, msgValue, body, extraOptions) {
|
|
606
|
-
return provider.internal(via, {
|
|
607
|
-
value: msgValue,
|
|
608
|
-
body: exports.InternalTransfer.toCell(exports.InternalTransfer.create(body)),
|
|
609
|
-
...extraOptions
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
async sendTransferCallback(provider, via, msgValue, body, extraOptions) {
|
|
613
|
-
return provider.internal(via, {
|
|
614
|
-
value: msgValue,
|
|
615
|
-
body: exports.TransferCallback.toCell(exports.TransferCallback.create(body)),
|
|
616
|
-
...extraOptions
|
|
617
|
-
});
|
|
618
|
-
}
|
|
619
|
-
async sendInitWithdraw(provider, via, msgValue, body, extraOptions) {
|
|
620
|
-
return provider.internal(via, {
|
|
621
|
-
value: msgValue,
|
|
622
|
-
body: exports.InitWithdraw.toCell(exports.InitWithdraw.create(body)),
|
|
623
|
-
...extraOptions
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
async sendInternalRegister(provider, via, msgValue, body, extraOptions) {
|
|
627
|
-
return provider.internal(via, {
|
|
628
|
-
value: msgValue,
|
|
629
|
-
body: exports.InternalRegister.toCell(exports.InternalRegister.create(body)),
|
|
630
|
-
...extraOptions
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
async sendInternalFlipAccountStatus(provider, via, msgValue, body, extraOptions) {
|
|
634
|
-
return provider.internal(via, {
|
|
635
|
-
value: msgValue,
|
|
636
|
-
body: exports.InternalFlipAccountStatus.toCell(exports.InternalFlipAccountStatus.create(body)),
|
|
637
|
-
...extraOptions
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
async getAccountData(provider) {
|
|
641
|
-
const r = StackReader.fromGetMethod(8, await provider.get('getAccountData', []));
|
|
642
|
-
return ({
|
|
643
|
-
$: 'AccountRuntimeStorage',
|
|
644
|
-
locked: r.readBoolean(),
|
|
645
|
-
minter: r.readSlice().loadAddress(),
|
|
646
|
-
owner: r.readSlice().loadAddress(),
|
|
647
|
-
seqNo: r.readBigInt(),
|
|
648
|
-
publicViewKey: ({
|
|
649
|
-
$: 'Point',
|
|
650
|
-
x: r.readBigInt(),
|
|
651
|
-
y: r.readBigInt(),
|
|
652
|
-
}),
|
|
653
|
-
commitment: ({
|
|
654
|
-
$: 'Point',
|
|
655
|
-
x: r.readBigInt(),
|
|
656
|
-
y: r.readBigInt(),
|
|
657
|
-
}),
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
exports.Account = Account;
|
|
662
|
-
Account.Errors = {
|
|
663
|
-
'DepositErrors.InvalidInputs': 258,
|
|
664
|
-
'TransferErrors.InvalidInputs': 258,
|
|
665
|
-
'WithdrawErrors.InvalidInputs': 258,
|
|
666
|
-
'TransferErrors.IndexOutOfRange': 259,
|
|
667
|
-
'Errors.InvalidProof': 519,
|
|
668
|
-
'Errors.InvalidAmount': 3775,
|
|
669
|
-
'Errors.AlreadyInitialized': 16689,
|
|
670
|
-
'Errors.NotAlreadyInitialized': 22161,
|
|
671
|
-
'Errors.NotEnoughGas': 29432,
|
|
672
|
-
'Errors.InvalidPoint': 37828,
|
|
673
|
-
'Errors.InvalidWorkchain': 38296,
|
|
674
|
-
'Errors.WrongSender': 45881,
|
|
675
|
-
'Errors.PositionLocked': 48515,
|
|
676
|
-
'Errors.WrongOP': 65535,
|
|
677
|
-
};
|