@metoncash/sdk-v1 0.1.0 → 0.2.1
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 +31 -8
- 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/index.d.ts +3 -2
- package/dist/index.js +21 -2
- package/dist/jubjub.d.ts +110 -6
- package/dist/jubjub.js +131 -9
- package/dist/mimc.d.ts +16 -1
- package/dist/mimc.js +16 -1
- package/dist/note.d.ts +74 -7
- package/dist/note.js +71 -10
- package/dist/prover.d.ts +115 -5
- package/dist/prover.js +145 -9
- package/dist/utils/account.d.ts +21 -0
- package/dist/utils/account.js +27 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +6 -1
- package/dist/utils/keys.d.ts +49 -7
- package/dist/utils/keys.js +57 -7
- package/dist/utils/note.d.ts +32 -9
- package/dist/utils/note.js +23 -6
- package/dist/wrappers/Minter.gen.d.ts +28 -0
- package/dist/wrappers/Minter.gen.js +27 -1
- package/dist/wrappers/Wallet.gen.d.ts +36 -0
- package/dist/wrappers/Wallet.gen.js +44 -2
- package/package.json +4 -3
- package/dist/wrappers/Account.gen.d.ts +0 -542
- package/dist/wrappers/Account.gen.js +0 -677
|
@@ -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
|
-
};
|