@metoncash/sdk-v1 0.1.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 +76 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +128 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +41 -0
- package/dist/jubjub.d.ts +25 -0
- package/dist/jubjub.js +121 -0
- package/dist/mimc.d.ts +4 -0
- package/dist/mimc.js +21 -0
- package/dist/note.d.ts +38 -0
- package/dist/note.js +55 -0
- package/dist/prover.d.ts +79 -0
- package/dist/prover.js +144 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/keys.d.ts +23 -0
- package/dist/utils/keys.js +28 -0
- package/dist/utils/note.d.ts +30 -0
- package/dist/utils/note.js +27 -0
- package/dist/wrappers/Account.gen.d.ts +542 -0
- package/dist/wrappers/Account.gen.js +677 -0
- package/dist/wrappers/Factory.gen.d.ts +265 -0
- package/dist/wrappers/Factory.gen.js +401 -0
- package/dist/wrappers/JettonMinter.gen.d.ts +288 -0
- package/dist/wrappers/JettonMinter.gen.js +432 -0
- package/dist/wrappers/JettonWallet.gen.d.ts +308 -0
- package/dist/wrappers/JettonWallet.gen.js +429 -0
- package/dist/wrappers/Minter.gen.d.ts +511 -0
- package/dist/wrappers/Minter.gen.js +700 -0
- package/dist/wrappers/Wallet.gen.d.ts +588 -0
- package/dist/wrappers/Wallet.gen.js +720 -0
- package/dist/wrappers/index.d.ts +15 -0
- package/dist/wrappers/index.js +21 -0
- package/package.json +26 -0
|
@@ -0,0 +1,720 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AUTO-GENERATED, do not edit
|
|
3
|
+
// It's a TypeScript wrapper for a Wallet 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.Wallet = exports.InternalWithdraw = exports.Proof = exports.Point = exports.TransferNotification = exports.InternalFlipWalletStatus = exports.InternalRegister = exports.InitWithdraw = exports.InternalDeposit = exports.TransferCallback = exports.InternalTransfer = exports.InternalTransferAdditionalData = exports.InitTransfer = exports.TransferAdditionalData = exports.TransferAdditionalData2 = exports.WalletStorage = exports.WalletRuntimeStorage = exports.ExcessMessage = 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.ExcessMessage = {
|
|
122
|
+
PREFIX: 0xd53276db,
|
|
123
|
+
create(args) {
|
|
124
|
+
return {
|
|
125
|
+
$: 'ExcessMessage',
|
|
126
|
+
...args
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
fromSlice(s) {
|
|
130
|
+
loadAndCheckPrefix32(s, 0xd53276db, 'ExcessMessage');
|
|
131
|
+
return {
|
|
132
|
+
$: 'ExcessMessage',
|
|
133
|
+
queryId: s.loadUintBig(64),
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
store(self, b) {
|
|
137
|
+
b.storeUint(0xd53276db, 32);
|
|
138
|
+
b.storeUint(self.queryId, 64);
|
|
139
|
+
},
|
|
140
|
+
toCell(self) {
|
|
141
|
+
return makeCellFrom(self, exports.ExcessMessage.store);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
exports.WalletRuntimeStorage = {
|
|
145
|
+
create(args) {
|
|
146
|
+
return {
|
|
147
|
+
$: 'WalletRuntimeStorage',
|
|
148
|
+
...args
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
fromSlice(s) {
|
|
152
|
+
return {
|
|
153
|
+
$: 'WalletRuntimeStorage',
|
|
154
|
+
locked: s.loadBoolean(),
|
|
155
|
+
minter: s.loadAddress(),
|
|
156
|
+
owner: s.loadAddress(),
|
|
157
|
+
seqNo: s.loadUintBig(32),
|
|
158
|
+
publicViewKey: exports.Point.fromSlice(s),
|
|
159
|
+
commitment: exports.Point.fromSlice(s),
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
store(self, b) {
|
|
163
|
+
b.storeBit(self.locked);
|
|
164
|
+
b.storeAddress(self.minter);
|
|
165
|
+
b.storeAddress(self.owner);
|
|
166
|
+
b.storeUint(self.seqNo, 32);
|
|
167
|
+
exports.Point.store(self.publicViewKey, b);
|
|
168
|
+
exports.Point.store(self.commitment, b);
|
|
169
|
+
},
|
|
170
|
+
toCell(self) {
|
|
171
|
+
return makeCellFrom(self, exports.WalletRuntimeStorage.store);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
exports.WalletStorage = {
|
|
175
|
+
create(args) {
|
|
176
|
+
return {
|
|
177
|
+
$: 'WalletStorage',
|
|
178
|
+
locked: false,
|
|
179
|
+
seqNo: 0n,
|
|
180
|
+
...args
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
fromSlice(s) {
|
|
184
|
+
return {
|
|
185
|
+
$: 'WalletStorage',
|
|
186
|
+
locked: s.loadBoolean(),
|
|
187
|
+
minter: s.loadAddress(),
|
|
188
|
+
owner: s.loadAddress(),
|
|
189
|
+
seqNo: s.loadUintBig(32),
|
|
190
|
+
publicViewKey: loadCellRef(s, exports.Point.fromSlice),
|
|
191
|
+
commitment: loadCellRef(s, exports.Point.fromSlice),
|
|
192
|
+
};
|
|
193
|
+
},
|
|
194
|
+
store(self, b) {
|
|
195
|
+
b.storeBit(self.locked);
|
|
196
|
+
b.storeAddress(self.minter);
|
|
197
|
+
b.storeAddress(self.owner);
|
|
198
|
+
b.storeUint(self.seqNo, 32);
|
|
199
|
+
storeCellRef(self.publicViewKey, b, exports.Point.store);
|
|
200
|
+
storeCellRef(self.commitment, b, exports.Point.store);
|
|
201
|
+
},
|
|
202
|
+
toCell(self) {
|
|
203
|
+
return makeCellFrom(self, exports.WalletStorage.store);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
exports.TransferAdditionalData2 = {
|
|
207
|
+
create(args) {
|
|
208
|
+
return {
|
|
209
|
+
$: 'TransferAdditionalData2',
|
|
210
|
+
...args
|
|
211
|
+
};
|
|
212
|
+
},
|
|
213
|
+
fromSlice(s) {
|
|
214
|
+
return {
|
|
215
|
+
$: 'TransferAdditionalData2',
|
|
216
|
+
excess: s.loadAddress(),
|
|
217
|
+
fwdValue: s.loadCoins(),
|
|
218
|
+
fwdPayload: s.loadBoolean() ? s.loadRef() : null,
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
store(self, b) {
|
|
222
|
+
b.storeAddress(self.excess);
|
|
223
|
+
b.storeCoins(self.fwdValue);
|
|
224
|
+
storeTolkNullable(self.fwdPayload, b, (v, b) => b.storeRef(v));
|
|
225
|
+
},
|
|
226
|
+
toCell(self) {
|
|
227
|
+
return makeCellFrom(self, exports.TransferAdditionalData2.store);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
exports.TransferAdditionalData = {
|
|
231
|
+
create(args) {
|
|
232
|
+
return {
|
|
233
|
+
$: 'TransferAdditionalData',
|
|
234
|
+
...args
|
|
235
|
+
};
|
|
236
|
+
},
|
|
237
|
+
fromSlice(s) {
|
|
238
|
+
return {
|
|
239
|
+
$: 'TransferAdditionalData',
|
|
240
|
+
ephemeral: exports.Point.fromSlice(s),
|
|
241
|
+
encAmount: s.loadUintBig(256),
|
|
242
|
+
encBlind: loadCellRef(s, (s) => s.loadUintBig(256)),
|
|
243
|
+
ad2: loadCellRef(s, exports.TransferAdditionalData2.fromSlice),
|
|
244
|
+
};
|
|
245
|
+
},
|
|
246
|
+
store(self, b) {
|
|
247
|
+
exports.Point.store(self.ephemeral, b);
|
|
248
|
+
b.storeUint(self.encAmount, 256);
|
|
249
|
+
storeCellRef(self.encBlind, b, (v, b) => b.storeUint(v, 256));
|
|
250
|
+
storeCellRef(self.ad2, b, exports.TransferAdditionalData2.store);
|
|
251
|
+
},
|
|
252
|
+
toCell(self) {
|
|
253
|
+
return makeCellFrom(self, exports.TransferAdditionalData.store);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
exports.InitTransfer = {
|
|
257
|
+
PREFIX: 0x886055ac,
|
|
258
|
+
create(args) {
|
|
259
|
+
return {
|
|
260
|
+
$: 'InitTransfer',
|
|
261
|
+
...args
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
fromSlice(s) {
|
|
265
|
+
loadAndCheckPrefix32(s, 0x886055ac, 'InitTransfer');
|
|
266
|
+
return {
|
|
267
|
+
$: 'InitTransfer',
|
|
268
|
+
queryId: s.loadUintBig(64),
|
|
269
|
+
to: s.loadAddress(),
|
|
270
|
+
receiverViewKey: exports.Point.fromSlice(s),
|
|
271
|
+
newCommitment: loadCellRef(s, exports.Point.fromSlice),
|
|
272
|
+
amountCommit: loadCellRef(s, exports.Point.fromSlice),
|
|
273
|
+
proof: loadCellRef(s, exports.Proof.fromSlice),
|
|
274
|
+
ad: loadCellRef(s, exports.TransferAdditionalData.fromSlice),
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
store(self, b) {
|
|
278
|
+
b.storeUint(0x886055ac, 32);
|
|
279
|
+
b.storeUint(self.queryId, 64);
|
|
280
|
+
b.storeAddress(self.to);
|
|
281
|
+
exports.Point.store(self.receiverViewKey, b);
|
|
282
|
+
storeCellRef(self.newCommitment, b, exports.Point.store);
|
|
283
|
+
storeCellRef(self.amountCommit, b, exports.Point.store);
|
|
284
|
+
storeCellRef(self.proof, b, exports.Proof.store);
|
|
285
|
+
storeCellRef(self.ad, b, exports.TransferAdditionalData.store);
|
|
286
|
+
},
|
|
287
|
+
toCell(self) {
|
|
288
|
+
return makeCellFrom(self, exports.InitTransfer.store);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
exports.InternalTransferAdditionalData = {
|
|
292
|
+
create(args) {
|
|
293
|
+
return {
|
|
294
|
+
$: 'InternalTransferAdditionalData',
|
|
295
|
+
...args
|
|
296
|
+
};
|
|
297
|
+
},
|
|
298
|
+
fromSlice(s) {
|
|
299
|
+
return {
|
|
300
|
+
$: 'InternalTransferAdditionalData',
|
|
301
|
+
ephemeral: exports.Point.fromSlice(s),
|
|
302
|
+
encBlind: s.loadUintBig(256),
|
|
303
|
+
ad2: loadCellRef(s, exports.TransferAdditionalData2.fromSlice),
|
|
304
|
+
};
|
|
305
|
+
},
|
|
306
|
+
store(self, b) {
|
|
307
|
+
exports.Point.store(self.ephemeral, b);
|
|
308
|
+
b.storeUint(self.encBlind, 256);
|
|
309
|
+
storeCellRef(self.ad2, b, exports.TransferAdditionalData2.store);
|
|
310
|
+
},
|
|
311
|
+
toCell(self) {
|
|
312
|
+
return makeCellFrom(self, exports.InternalTransferAdditionalData.store);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
exports.InternalTransfer = {
|
|
316
|
+
PREFIX: 0xc22d1aa0,
|
|
317
|
+
create(args) {
|
|
318
|
+
return {
|
|
319
|
+
$: 'InternalTransfer',
|
|
320
|
+
...args
|
|
321
|
+
};
|
|
322
|
+
},
|
|
323
|
+
fromSlice(s) {
|
|
324
|
+
loadAndCheckPrefix32(s, 0xc22d1aa0, 'InternalTransfer');
|
|
325
|
+
return {
|
|
326
|
+
$: 'InternalTransfer',
|
|
327
|
+
queryId: s.loadUintBig(64),
|
|
328
|
+
from: s.loadAddress(),
|
|
329
|
+
receiverViewKey: exports.Point.fromSlice(s),
|
|
330
|
+
encAmount: loadCellRef(s, (s) => s.loadUintBig(256)),
|
|
331
|
+
amountCommit: loadCellRef(s, exports.Point.fromSlice),
|
|
332
|
+
oldStorageCommitment: loadCellRef(s, exports.Point.fromSlice),
|
|
333
|
+
ad: loadCellRef(s, exports.InternalTransferAdditionalData.fromSlice),
|
|
334
|
+
};
|
|
335
|
+
},
|
|
336
|
+
store(self, b) {
|
|
337
|
+
b.storeUint(0xc22d1aa0, 32);
|
|
338
|
+
b.storeUint(self.queryId, 64);
|
|
339
|
+
b.storeAddress(self.from);
|
|
340
|
+
exports.Point.store(self.receiverViewKey, b);
|
|
341
|
+
storeCellRef(self.encAmount, b, (v, b) => b.storeUint(v, 256));
|
|
342
|
+
storeCellRef(self.amountCommit, b, exports.Point.store);
|
|
343
|
+
storeCellRef(self.oldStorageCommitment, b, exports.Point.store);
|
|
344
|
+
storeCellRef(self.ad, b, exports.InternalTransferAdditionalData.store);
|
|
345
|
+
},
|
|
346
|
+
toCell(self) {
|
|
347
|
+
return makeCellFrom(self, exports.InternalTransfer.store);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
exports.TransferCallback = {
|
|
351
|
+
PREFIX: 0x5c4dfe3b,
|
|
352
|
+
create(args) {
|
|
353
|
+
return {
|
|
354
|
+
$: 'TransferCallback',
|
|
355
|
+
...args
|
|
356
|
+
};
|
|
357
|
+
},
|
|
358
|
+
fromSlice(s) {
|
|
359
|
+
loadAndCheckPrefix32(s, 0x5c4dfe3b, 'TransferCallback');
|
|
360
|
+
return {
|
|
361
|
+
$: 'TransferCallback',
|
|
362
|
+
queryId: s.loadUintBig(64),
|
|
363
|
+
from: s.loadAddress(),
|
|
364
|
+
excess: s.loadAddress(),
|
|
365
|
+
};
|
|
366
|
+
},
|
|
367
|
+
store(self, b) {
|
|
368
|
+
b.storeUint(0x5c4dfe3b, 32);
|
|
369
|
+
b.storeUint(self.queryId, 64);
|
|
370
|
+
b.storeAddress(self.from);
|
|
371
|
+
b.storeAddress(self.excess);
|
|
372
|
+
},
|
|
373
|
+
toCell(self) {
|
|
374
|
+
return makeCellFrom(self, exports.TransferCallback.store);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
exports.InternalDeposit = {
|
|
378
|
+
PREFIX: 0xde913221,
|
|
379
|
+
create(args) {
|
|
380
|
+
return {
|
|
381
|
+
$: 'InternalDeposit',
|
|
382
|
+
...args
|
|
383
|
+
};
|
|
384
|
+
},
|
|
385
|
+
fromSlice(s) {
|
|
386
|
+
loadAndCheckPrefix32(s, 0xde913221, 'InternalDeposit');
|
|
387
|
+
return {
|
|
388
|
+
$: 'InternalDeposit',
|
|
389
|
+
queryId: s.loadUintBig(64),
|
|
390
|
+
amount: s.loadCoins(),
|
|
391
|
+
commitment: exports.Point.fromSlice(s),
|
|
392
|
+
proof: loadCellRef(s, exports.Proof.fromSlice),
|
|
393
|
+
};
|
|
394
|
+
},
|
|
395
|
+
store(self, b) {
|
|
396
|
+
b.storeUint(0xde913221, 32);
|
|
397
|
+
b.storeUint(self.queryId, 64);
|
|
398
|
+
b.storeCoins(self.amount);
|
|
399
|
+
exports.Point.store(self.commitment, b);
|
|
400
|
+
storeCellRef(self.proof, b, exports.Proof.store);
|
|
401
|
+
},
|
|
402
|
+
toCell(self) {
|
|
403
|
+
return makeCellFrom(self, exports.InternalDeposit.store);
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
exports.InitWithdraw = {
|
|
407
|
+
PREFIX: 0xa71f12ae,
|
|
408
|
+
create(args) {
|
|
409
|
+
return {
|
|
410
|
+
$: 'InitWithdraw',
|
|
411
|
+
...args
|
|
412
|
+
};
|
|
413
|
+
},
|
|
414
|
+
fromSlice(s) {
|
|
415
|
+
loadAndCheckPrefix32(s, 0xa71f12ae, 'InitWithdraw');
|
|
416
|
+
return {
|
|
417
|
+
$: 'InitWithdraw',
|
|
418
|
+
queryId: s.loadUintBig(64),
|
|
419
|
+
amount: s.loadCoins(),
|
|
420
|
+
newCommitment: loadCellRef(s, exports.Point.fromSlice),
|
|
421
|
+
proof: loadCellRef(s, exports.Proof.fromSlice),
|
|
422
|
+
};
|
|
423
|
+
},
|
|
424
|
+
store(self, b) {
|
|
425
|
+
b.storeUint(0xa71f12ae, 32);
|
|
426
|
+
b.storeUint(self.queryId, 64);
|
|
427
|
+
b.storeCoins(self.amount);
|
|
428
|
+
storeCellRef(self.newCommitment, b, exports.Point.store);
|
|
429
|
+
storeCellRef(self.proof, b, exports.Proof.store);
|
|
430
|
+
},
|
|
431
|
+
toCell(self) {
|
|
432
|
+
return makeCellFrom(self, exports.InitWithdraw.store);
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
exports.InternalRegister = {
|
|
436
|
+
PREFIX: 0xdde0f974,
|
|
437
|
+
create(args) {
|
|
438
|
+
return {
|
|
439
|
+
$: 'InternalRegister',
|
|
440
|
+
...args
|
|
441
|
+
};
|
|
442
|
+
},
|
|
443
|
+
fromSlice(s) {
|
|
444
|
+
loadAndCheckPrefix32(s, 0xdde0f974, 'InternalRegister');
|
|
445
|
+
return {
|
|
446
|
+
$: 'InternalRegister',
|
|
447
|
+
queryId: s.loadUintBig(64),
|
|
448
|
+
publicViewKey: exports.Point.fromSlice(s),
|
|
449
|
+
};
|
|
450
|
+
},
|
|
451
|
+
store(self, b) {
|
|
452
|
+
b.storeUint(0xdde0f974, 32);
|
|
453
|
+
b.storeUint(self.queryId, 64);
|
|
454
|
+
exports.Point.store(self.publicViewKey, b);
|
|
455
|
+
},
|
|
456
|
+
toCell(self) {
|
|
457
|
+
return makeCellFrom(self, exports.InternalRegister.store);
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
exports.InternalFlipWalletStatus = {
|
|
461
|
+
PREFIX: 0x158bd66b,
|
|
462
|
+
create(args) {
|
|
463
|
+
return {
|
|
464
|
+
$: 'InternalFlipWalletStatus',
|
|
465
|
+
...args
|
|
466
|
+
};
|
|
467
|
+
},
|
|
468
|
+
fromSlice(s) {
|
|
469
|
+
loadAndCheckPrefix32(s, 0x158bd66b, 'InternalFlipWalletStatus');
|
|
470
|
+
return {
|
|
471
|
+
$: 'InternalFlipWalletStatus',
|
|
472
|
+
queryId: s.loadUintBig(64),
|
|
473
|
+
excess: s.loadAddress(),
|
|
474
|
+
};
|
|
475
|
+
},
|
|
476
|
+
store(self, b) {
|
|
477
|
+
b.storeUint(0x158bd66b, 32);
|
|
478
|
+
b.storeUint(self.queryId, 64);
|
|
479
|
+
b.storeAddress(self.excess);
|
|
480
|
+
},
|
|
481
|
+
toCell(self) {
|
|
482
|
+
return makeCellFrom(self, exports.InternalFlipWalletStatus.store);
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
exports.TransferNotification = {
|
|
486
|
+
PREFIX: 0x3a28d825,
|
|
487
|
+
create(args) {
|
|
488
|
+
return {
|
|
489
|
+
$: 'TransferNotification',
|
|
490
|
+
...args
|
|
491
|
+
};
|
|
492
|
+
},
|
|
493
|
+
fromSlice(s) {
|
|
494
|
+
loadAndCheckPrefix32(s, 0x3a28d825, 'TransferNotification');
|
|
495
|
+
return {
|
|
496
|
+
$: 'TransferNotification',
|
|
497
|
+
queryId: s.loadUintBig(64),
|
|
498
|
+
from: s.loadAddress(),
|
|
499
|
+
oldCommitment: loadCellRef(s, exports.Point.fromSlice),
|
|
500
|
+
amountCommitment: loadCellRef(s, exports.Point.fromSlice),
|
|
501
|
+
payload: s.loadBoolean() ? s.loadRef() : null,
|
|
502
|
+
};
|
|
503
|
+
},
|
|
504
|
+
store(self, b) {
|
|
505
|
+
b.storeUint(0x3a28d825, 32);
|
|
506
|
+
b.storeUint(self.queryId, 64);
|
|
507
|
+
b.storeAddress(self.from);
|
|
508
|
+
storeCellRef(self.oldCommitment, b, exports.Point.store);
|
|
509
|
+
storeCellRef(self.amountCommitment, b, exports.Point.store);
|
|
510
|
+
storeTolkNullable(self.payload, b, (v, b) => b.storeRef(v));
|
|
511
|
+
},
|
|
512
|
+
toCell(self) {
|
|
513
|
+
return makeCellFrom(self, exports.TransferNotification.store);
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
exports.Point = {
|
|
517
|
+
create(args) {
|
|
518
|
+
return {
|
|
519
|
+
$: 'Point',
|
|
520
|
+
...args
|
|
521
|
+
};
|
|
522
|
+
},
|
|
523
|
+
fromSlice(s) {
|
|
524
|
+
return {
|
|
525
|
+
$: 'Point',
|
|
526
|
+
x: s.loadUintBig(256),
|
|
527
|
+
y: s.loadUintBig(256),
|
|
528
|
+
};
|
|
529
|
+
},
|
|
530
|
+
store(self, b) {
|
|
531
|
+
b.storeUint(self.x, 256);
|
|
532
|
+
b.storeUint(self.y, 256);
|
|
533
|
+
},
|
|
534
|
+
toCell(self) {
|
|
535
|
+
return makeCellFrom(self, exports.Point.store);
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
exports.Proof = {
|
|
539
|
+
create(args) {
|
|
540
|
+
return {
|
|
541
|
+
$: 'Proof',
|
|
542
|
+
...args
|
|
543
|
+
};
|
|
544
|
+
},
|
|
545
|
+
fromSlice(s) {
|
|
546
|
+
return {
|
|
547
|
+
$: 'Proof',
|
|
548
|
+
piA: s.loadRef(),
|
|
549
|
+
piB: s.loadRef(),
|
|
550
|
+
piC: s.loadRef(),
|
|
551
|
+
};
|
|
552
|
+
},
|
|
553
|
+
store(self, b) {
|
|
554
|
+
b.storeRef(self.piA);
|
|
555
|
+
b.storeRef(self.piB);
|
|
556
|
+
b.storeRef(self.piC);
|
|
557
|
+
},
|
|
558
|
+
toCell(self) {
|
|
559
|
+
return makeCellFrom(self, exports.Proof.store);
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
exports.InternalWithdraw = {
|
|
563
|
+
PREFIX: 0x37c7e6fe,
|
|
564
|
+
create(args) {
|
|
565
|
+
return {
|
|
566
|
+
$: 'InternalWithdraw',
|
|
567
|
+
...args
|
|
568
|
+
};
|
|
569
|
+
},
|
|
570
|
+
fromSlice(s) {
|
|
571
|
+
loadAndCheckPrefix32(s, 0x37c7e6fe, 'InternalWithdraw');
|
|
572
|
+
return {
|
|
573
|
+
$: 'InternalWithdraw',
|
|
574
|
+
queryId: s.loadUintBig(64),
|
|
575
|
+
from: s.loadAddress(),
|
|
576
|
+
amount: s.loadCoins(),
|
|
577
|
+
};
|
|
578
|
+
},
|
|
579
|
+
store(self, b) {
|
|
580
|
+
b.storeUint(0x37c7e6fe, 32);
|
|
581
|
+
b.storeUint(self.queryId, 64);
|
|
582
|
+
b.storeAddress(self.from);
|
|
583
|
+
b.storeCoins(self.amount);
|
|
584
|
+
},
|
|
585
|
+
toCell(self) {
|
|
586
|
+
return makeCellFrom(self, exports.InternalWithdraw.store);
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
class Wallet {
|
|
590
|
+
constructor(address, init) {
|
|
591
|
+
this.address = address;
|
|
592
|
+
this.init = init;
|
|
593
|
+
}
|
|
594
|
+
static fromAddress(address) {
|
|
595
|
+
return new Wallet(address);
|
|
596
|
+
}
|
|
597
|
+
static createCellOfInternalDeposit(body) {
|
|
598
|
+
return exports.InternalDeposit.toCell(exports.InternalDeposit.create(body));
|
|
599
|
+
}
|
|
600
|
+
static createCellOfInitTransfer(body) {
|
|
601
|
+
return exports.InitTransfer.toCell(exports.InitTransfer.create(body));
|
|
602
|
+
}
|
|
603
|
+
static createCellOfInternalTransfer(body) {
|
|
604
|
+
return exports.InternalTransfer.toCell(exports.InternalTransfer.create(body));
|
|
605
|
+
}
|
|
606
|
+
static createCellOfTransferCallback(body) {
|
|
607
|
+
return exports.TransferCallback.toCell(exports.TransferCallback.create(body));
|
|
608
|
+
}
|
|
609
|
+
static createCellOfInitWithdraw(body) {
|
|
610
|
+
return exports.InitWithdraw.toCell(exports.InitWithdraw.create(body));
|
|
611
|
+
}
|
|
612
|
+
static createCellOfInternalRegister(body) {
|
|
613
|
+
return exports.InternalRegister.toCell(exports.InternalRegister.create(body));
|
|
614
|
+
}
|
|
615
|
+
static createCellOfInternalFlipWalletStatus(body) {
|
|
616
|
+
return exports.InternalFlipWalletStatus.toCell(exports.InternalFlipWalletStatus.create(body));
|
|
617
|
+
}
|
|
618
|
+
async sendDeploy(provider, via, msgValue, extraOptions) {
|
|
619
|
+
return provider.internal(via, {
|
|
620
|
+
value: msgValue,
|
|
621
|
+
body: c.Cell.EMPTY,
|
|
622
|
+
...extraOptions
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
async sendInternalDeposit(provider, via, msgValue, body, extraOptions) {
|
|
626
|
+
return provider.internal(via, {
|
|
627
|
+
value: msgValue,
|
|
628
|
+
body: exports.InternalDeposit.toCell(exports.InternalDeposit.create(body)),
|
|
629
|
+
...extraOptions
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
async sendInitTransfer(provider, via, msgValue, body, extraOptions) {
|
|
633
|
+
return provider.internal(via, {
|
|
634
|
+
value: msgValue,
|
|
635
|
+
body: exports.InitTransfer.toCell(exports.InitTransfer.create(body)),
|
|
636
|
+
...extraOptions
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
async sendInternalTransfer(provider, via, msgValue, body, extraOptions) {
|
|
640
|
+
return provider.internal(via, {
|
|
641
|
+
value: msgValue,
|
|
642
|
+
body: exports.InternalTransfer.toCell(exports.InternalTransfer.create(body)),
|
|
643
|
+
...extraOptions
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
async sendTransferCallback(provider, via, msgValue, body, extraOptions) {
|
|
647
|
+
return provider.internal(via, {
|
|
648
|
+
value: msgValue,
|
|
649
|
+
body: exports.TransferCallback.toCell(exports.TransferCallback.create(body)),
|
|
650
|
+
...extraOptions
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
async sendInitWithdraw(provider, via, msgValue, body, extraOptions) {
|
|
654
|
+
return provider.internal(via, {
|
|
655
|
+
value: msgValue,
|
|
656
|
+
body: exports.InitWithdraw.toCell(exports.InitWithdraw.create(body)),
|
|
657
|
+
...extraOptions
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
async sendInternalRegister(provider, via, msgValue, body, extraOptions) {
|
|
661
|
+
return provider.internal(via, {
|
|
662
|
+
value: msgValue,
|
|
663
|
+
body: exports.InternalRegister.toCell(exports.InternalRegister.create(body)),
|
|
664
|
+
...extraOptions
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
async sendInternalFlipWalletStatus(provider, via, msgValue, body, extraOptions) {
|
|
668
|
+
return provider.internal(via, {
|
|
669
|
+
value: msgValue,
|
|
670
|
+
body: exports.InternalFlipWalletStatus.toCell(exports.InternalFlipWalletStatus.create(body)),
|
|
671
|
+
...extraOptions
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
async getWalletState(provider) {
|
|
675
|
+
const r = StackReader.fromGetMethod(8, await provider.get('getWalletState', []));
|
|
676
|
+
return ({
|
|
677
|
+
$: 'WalletRuntimeStorage',
|
|
678
|
+
locked: r.readBoolean(),
|
|
679
|
+
minter: r.readSlice().loadAddress(),
|
|
680
|
+
owner: r.readSlice().loadAddress(),
|
|
681
|
+
seqNo: r.readBigInt(),
|
|
682
|
+
publicViewKey: ({
|
|
683
|
+
$: 'Point',
|
|
684
|
+
x: r.readBigInt(),
|
|
685
|
+
y: r.readBigInt(),
|
|
686
|
+
}),
|
|
687
|
+
commitment: ({
|
|
688
|
+
$: 'Point',
|
|
689
|
+
x: r.readBigInt(),
|
|
690
|
+
y: r.readBigInt(),
|
|
691
|
+
}),
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
async getWalletData(provider) {
|
|
695
|
+
const r = StackReader.fromGetMethod(4, await provider.get('get_wallet_data', []));
|
|
696
|
+
return [
|
|
697
|
+
r.readBigInt(),
|
|
698
|
+
r.readSlice().loadAddress(),
|
|
699
|
+
r.readSlice().loadAddress(),
|
|
700
|
+
r.readCell(),
|
|
701
|
+
];
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
exports.Wallet = Wallet;
|
|
705
|
+
Wallet.Errors = {
|
|
706
|
+
'DepositErrors.InvalidInputs': 258,
|
|
707
|
+
'TransferErrors.InvalidInputs': 258,
|
|
708
|
+
'WithdrawErrors.InvalidInputs': 258,
|
|
709
|
+
'TransferErrors.IndexOutOfRange': 259,
|
|
710
|
+
'Errors.InvalidProof': 519,
|
|
711
|
+
'Errors.InvalidAmount': 3775,
|
|
712
|
+
'Errors.AlreadyInitialized': 16689,
|
|
713
|
+
'Errors.NotAlreadyInitialized': 22161,
|
|
714
|
+
'Errors.NotEnoughGas': 29432,
|
|
715
|
+
'Errors.InvalidPoint': 37828,
|
|
716
|
+
'Errors.InvalidWorkchain': 38296,
|
|
717
|
+
'Errors.WrongSender': 45881,
|
|
718
|
+
'Errors.PositionLocked': 48515,
|
|
719
|
+
'Errors.WrongOp': 65535,
|
|
720
|
+
};
|