@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.
@@ -0,0 +1,588 @@
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 (0xd53276db) ExcessMessage {
12
+ > queryId: uint64
13
+ > }
14
+ */
15
+ export interface ExcessMessage {
16
+ readonly $: 'ExcessMessage';
17
+ queryId: uint64;
18
+ }
19
+ export declare const ExcessMessage: {
20
+ PREFIX: number;
21
+ create(args: {
22
+ queryId: uint64;
23
+ }): ExcessMessage;
24
+ fromSlice(s: c.Slice): ExcessMessage;
25
+ store(self: ExcessMessage, b: c.Builder): void;
26
+ toCell(self: ExcessMessage): c.Cell;
27
+ };
28
+ /**
29
+ > struct WalletRuntimeStorage {
30
+ > locked: bool
31
+ > minter: address
32
+ > owner: address
33
+ > seqNo: uint32
34
+ > publicViewKey: Point
35
+ > commitment: Point
36
+ > }
37
+ */
38
+ export interface WalletRuntimeStorage {
39
+ readonly $: 'WalletRuntimeStorage';
40
+ locked: boolean;
41
+ minter: c.Address;
42
+ owner: c.Address;
43
+ seqNo: uint32;
44
+ publicViewKey: Point;
45
+ commitment: Point;
46
+ }
47
+ export declare const WalletRuntimeStorage: {
48
+ create(args: {
49
+ locked: boolean;
50
+ minter: c.Address;
51
+ owner: c.Address;
52
+ seqNo: uint32;
53
+ publicViewKey: Point;
54
+ commitment: Point;
55
+ }): WalletRuntimeStorage;
56
+ fromSlice(s: c.Slice): WalletRuntimeStorage;
57
+ store(self: WalletRuntimeStorage, b: c.Builder): void;
58
+ toCell(self: WalletRuntimeStorage): c.Cell;
59
+ };
60
+ /**
61
+ > struct WalletStorage {
62
+ > locked: bool
63
+ > minter: address
64
+ > owner: address
65
+ > seqNo: uint32
66
+ > publicViewKey: Cell<Point>
67
+ > commitment: Cell<Point>
68
+ > }
69
+ */
70
+ export interface WalletStorage {
71
+ readonly $: 'WalletStorage';
72
+ locked: boolean;
73
+ minter: c.Address;
74
+ owner: c.Address;
75
+ seqNo: uint32;
76
+ publicViewKey: CellRef<Point>;
77
+ commitment: CellRef<Point>;
78
+ }
79
+ export declare const WalletStorage: {
80
+ create(args: {
81
+ locked?: boolean;
82
+ minter: c.Address;
83
+ owner: c.Address;
84
+ seqNo?: uint32;
85
+ publicViewKey: CellRef<Point>;
86
+ commitment: CellRef<Point>;
87
+ }): WalletStorage;
88
+ fromSlice(s: c.Slice): WalletStorage;
89
+ store(self: WalletStorage, b: c.Builder): void;
90
+ toCell(self: WalletStorage): c.Cell;
91
+ };
92
+ /**
93
+ > struct TransferAdditionalData2 {
94
+ > excess: address
95
+ > fwdValue: coins
96
+ > fwdPayload: cell?
97
+ > }
98
+ */
99
+ export interface TransferAdditionalData2 {
100
+ readonly $: 'TransferAdditionalData2';
101
+ excess: c.Address;
102
+ fwdValue: coins;
103
+ fwdPayload: c.Cell | null;
104
+ }
105
+ export declare const TransferAdditionalData2: {
106
+ create(args: {
107
+ excess: c.Address;
108
+ fwdValue: coins;
109
+ fwdPayload: c.Cell | null;
110
+ }): TransferAdditionalData2;
111
+ fromSlice(s: c.Slice): TransferAdditionalData2;
112
+ store(self: TransferAdditionalData2, b: c.Builder): void;
113
+ toCell(self: TransferAdditionalData2): c.Cell;
114
+ };
115
+ /**
116
+ > struct TransferAdditionalData {
117
+ > ephemeral: Point
118
+ > encAmount: uint256
119
+ > encBlind: Cell<uint256>
120
+ > ad2: Cell<TransferAdditionalData2>
121
+ > }
122
+ */
123
+ export interface TransferAdditionalData {
124
+ readonly $: 'TransferAdditionalData';
125
+ ephemeral: Point;
126
+ encAmount: uint256;
127
+ encBlind: CellRef<uint256>;
128
+ ad2: CellRef<TransferAdditionalData2>;
129
+ }
130
+ export declare const TransferAdditionalData: {
131
+ create(args: {
132
+ ephemeral: Point;
133
+ encAmount: uint256;
134
+ encBlind: CellRef<uint256>;
135
+ ad2: CellRef<TransferAdditionalData2>;
136
+ }): TransferAdditionalData;
137
+ fromSlice(s: c.Slice): TransferAdditionalData;
138
+ store(self: TransferAdditionalData, b: c.Builder): void;
139
+ toCell(self: TransferAdditionalData): c.Cell;
140
+ };
141
+ /**
142
+ > struct (0x886055ac) InitTransfer {
143
+ > queryId: uint64
144
+ > to: address
145
+ > receiverViewKey: Point
146
+ > newCommitment: Cell<Point>
147
+ > amountCommit: Cell<Point>
148
+ > proof: Cell<Proof>
149
+ > ad: Cell<TransferAdditionalData>
150
+ > }
151
+ */
152
+ export interface InitTransfer {
153
+ readonly $: 'InitTransfer';
154
+ queryId: uint64;
155
+ to: c.Address;
156
+ receiverViewKey: Point;
157
+ newCommitment: CellRef<Point>;
158
+ amountCommit: CellRef<Point>;
159
+ proof: CellRef<Proof>;
160
+ ad: CellRef<TransferAdditionalData>;
161
+ }
162
+ export declare const InitTransfer: {
163
+ PREFIX: number;
164
+ create(args: {
165
+ queryId: uint64;
166
+ to: c.Address;
167
+ receiverViewKey: Point;
168
+ newCommitment: CellRef<Point>;
169
+ amountCommit: CellRef<Point>;
170
+ proof: CellRef<Proof>;
171
+ ad: CellRef<TransferAdditionalData>;
172
+ }): InitTransfer;
173
+ fromSlice(s: c.Slice): InitTransfer;
174
+ store(self: InitTransfer, b: c.Builder): void;
175
+ toCell(self: InitTransfer): c.Cell;
176
+ };
177
+ /**
178
+ > struct InternalTransferAdditionalData {
179
+ > ephemeral: Point
180
+ > encBlind: uint256
181
+ > ad2: Cell<TransferAdditionalData2>
182
+ > }
183
+ */
184
+ export interface InternalTransferAdditionalData {
185
+ readonly $: 'InternalTransferAdditionalData';
186
+ ephemeral: Point;
187
+ encBlind: uint256;
188
+ ad2: CellRef<TransferAdditionalData2>;
189
+ }
190
+ export declare const InternalTransferAdditionalData: {
191
+ create(args: {
192
+ ephemeral: Point;
193
+ encBlind: uint256;
194
+ ad2: CellRef<TransferAdditionalData2>;
195
+ }): InternalTransferAdditionalData;
196
+ fromSlice(s: c.Slice): InternalTransferAdditionalData;
197
+ store(self: InternalTransferAdditionalData, b: c.Builder): void;
198
+ toCell(self: InternalTransferAdditionalData): c.Cell;
199
+ };
200
+ /**
201
+ > struct (0xc22d1aa0) InternalTransfer {
202
+ > queryId: uint64
203
+ > from: address
204
+ > receiverViewKey: Point
205
+ > encAmount: Cell<uint256>
206
+ > amountCommit: Cell<Point>
207
+ > oldStorageCommitment: Cell<Point>
208
+ > ad: Cell<InternalTransferAdditionalData>
209
+ > }
210
+ */
211
+ export interface InternalTransfer {
212
+ readonly $: 'InternalTransfer';
213
+ queryId: uint64;
214
+ from: c.Address;
215
+ receiverViewKey: Point;
216
+ encAmount: CellRef<uint256>;
217
+ amountCommit: CellRef<Point>;
218
+ oldStorageCommitment: CellRef<Point>;
219
+ ad: CellRef<InternalTransferAdditionalData>;
220
+ }
221
+ export declare const InternalTransfer: {
222
+ PREFIX: number;
223
+ create(args: {
224
+ queryId: uint64;
225
+ from: c.Address;
226
+ receiverViewKey: Point;
227
+ encAmount: CellRef<uint256>;
228
+ amountCommit: CellRef<Point>;
229
+ oldStorageCommitment: CellRef<Point>;
230
+ ad: CellRef<InternalTransferAdditionalData>;
231
+ }): InternalTransfer;
232
+ fromSlice(s: c.Slice): InternalTransfer;
233
+ store(self: InternalTransfer, b: c.Builder): void;
234
+ toCell(self: InternalTransfer): c.Cell;
235
+ };
236
+ /**
237
+ > struct (0x5c4dfe3b) TransferCallback {
238
+ > queryId: uint64
239
+ > from: address
240
+ > excess: address
241
+ > }
242
+ */
243
+ export interface TransferCallback {
244
+ readonly $: 'TransferCallback';
245
+ queryId: uint64;
246
+ from: c.Address;
247
+ excess: c.Address;
248
+ }
249
+ export declare const TransferCallback: {
250
+ PREFIX: number;
251
+ create(args: {
252
+ queryId: uint64;
253
+ from: c.Address;
254
+ excess: c.Address;
255
+ }): TransferCallback;
256
+ fromSlice(s: c.Slice): TransferCallback;
257
+ store(self: TransferCallback, b: c.Builder): void;
258
+ toCell(self: TransferCallback): c.Cell;
259
+ };
260
+ /**
261
+ > struct (0xde913221) InternalDeposit {
262
+ > queryId: uint64
263
+ > amount: coins
264
+ > commitment: Point
265
+ > proof: Cell<Proof>
266
+ > }
267
+ */
268
+ export interface InternalDeposit {
269
+ readonly $: 'InternalDeposit';
270
+ queryId: uint64;
271
+ amount: coins;
272
+ commitment: Point;
273
+ proof: CellRef<Proof>;
274
+ }
275
+ export declare const InternalDeposit: {
276
+ PREFIX: number;
277
+ create(args: {
278
+ queryId: uint64;
279
+ amount: coins;
280
+ commitment: Point;
281
+ proof: CellRef<Proof>;
282
+ }): InternalDeposit;
283
+ fromSlice(s: c.Slice): InternalDeposit;
284
+ store(self: InternalDeposit, b: c.Builder): void;
285
+ toCell(self: InternalDeposit): c.Cell;
286
+ };
287
+ /**
288
+ > struct (0xa71f12ae) InitWithdraw {
289
+ > queryId: uint64
290
+ > amount: coins
291
+ > newCommitment: Cell<Point>
292
+ > proof: Cell<Proof>
293
+ > }
294
+ */
295
+ export interface InitWithdraw {
296
+ readonly $: 'InitWithdraw';
297
+ queryId: uint64;
298
+ amount: coins;
299
+ newCommitment: CellRef<Point>;
300
+ proof: CellRef<Proof>;
301
+ }
302
+ export declare const InitWithdraw: {
303
+ PREFIX: number;
304
+ create(args: {
305
+ queryId: uint64;
306
+ amount: coins;
307
+ newCommitment: CellRef<Point>;
308
+ proof: CellRef<Proof>;
309
+ }): InitWithdraw;
310
+ fromSlice(s: c.Slice): InitWithdraw;
311
+ store(self: InitWithdraw, b: c.Builder): void;
312
+ toCell(self: InitWithdraw): c.Cell;
313
+ };
314
+ /**
315
+ > struct (0xdde0f974) InternalRegister {
316
+ > queryId: uint64
317
+ > publicViewKey: Point
318
+ > }
319
+ */
320
+ export interface InternalRegister {
321
+ readonly $: 'InternalRegister';
322
+ queryId: uint64;
323
+ publicViewKey: Point;
324
+ }
325
+ export declare const InternalRegister: {
326
+ PREFIX: number;
327
+ create(args: {
328
+ queryId: uint64;
329
+ publicViewKey: Point;
330
+ }): InternalRegister;
331
+ fromSlice(s: c.Slice): InternalRegister;
332
+ store(self: InternalRegister, b: c.Builder): void;
333
+ toCell(self: InternalRegister): c.Cell;
334
+ };
335
+ /**
336
+ > struct (0x158bd66b) InternalFlipWalletStatus {
337
+ > queryId: uint64
338
+ > excess: address
339
+ > }
340
+ */
341
+ export interface InternalFlipWalletStatus {
342
+ readonly $: 'InternalFlipWalletStatus';
343
+ queryId: uint64;
344
+ excess: c.Address;
345
+ }
346
+ export declare const InternalFlipWalletStatus: {
347
+ PREFIX: number;
348
+ create(args: {
349
+ queryId: uint64;
350
+ excess: c.Address;
351
+ }): InternalFlipWalletStatus;
352
+ fromSlice(s: c.Slice): InternalFlipWalletStatus;
353
+ store(self: InternalFlipWalletStatus, b: c.Builder): void;
354
+ toCell(self: InternalFlipWalletStatus): c.Cell;
355
+ };
356
+ /**
357
+ > struct (0x3a28d825) TransferNotification {
358
+ > queryId: uint64
359
+ > from: address
360
+ > oldCommitment: Cell<Point>
361
+ > amountCommitment: Cell<Point>
362
+ > payload: cell?
363
+ > }
364
+ */
365
+ export interface TransferNotification {
366
+ readonly $: 'TransferNotification';
367
+ queryId: uint64;
368
+ from: c.Address;
369
+ oldCommitment: CellRef<Point>;
370
+ amountCommitment: CellRef<Point>;
371
+ payload: c.Cell | null;
372
+ }
373
+ export declare const TransferNotification: {
374
+ PREFIX: number;
375
+ create(args: {
376
+ queryId: uint64;
377
+ from: c.Address;
378
+ oldCommitment: CellRef<Point>;
379
+ amountCommitment: CellRef<Point>;
380
+ payload: c.Cell | null;
381
+ }): TransferNotification;
382
+ fromSlice(s: c.Slice): TransferNotification;
383
+ store(self: TransferNotification, b: c.Builder): void;
384
+ toCell(self: TransferNotification): c.Cell;
385
+ };
386
+ /**
387
+ > struct Point {
388
+ > x: uint256
389
+ > y: uint256
390
+ > }
391
+ */
392
+ export interface Point {
393
+ readonly $: 'Point';
394
+ x: uint256;
395
+ y: uint256;
396
+ }
397
+ export declare const Point: {
398
+ create(args: {
399
+ x: uint256;
400
+ y: uint256;
401
+ }): Point;
402
+ fromSlice(s: c.Slice): Point;
403
+ store(self: Point, b: c.Builder): void;
404
+ toCell(self: Point): c.Cell;
405
+ };
406
+ /**
407
+ > struct Proof {
408
+ > piA: cell
409
+ > piB: cell
410
+ > piC: cell
411
+ > }
412
+ */
413
+ export interface Proof {
414
+ readonly $: 'Proof';
415
+ piA: c.Cell;
416
+ piB: c.Cell;
417
+ piC: c.Cell;
418
+ }
419
+ export declare const Proof: {
420
+ create(args: {
421
+ piA: c.Cell;
422
+ piB: c.Cell;
423
+ piC: c.Cell;
424
+ }): Proof;
425
+ fromSlice(s: c.Slice): Proof;
426
+ store(self: Proof, b: c.Builder): void;
427
+ toCell(self: Proof): c.Cell;
428
+ };
429
+ /**
430
+ > struct (0x37c7e6fe) InternalWithdraw {
431
+ > queryId: uint64
432
+ > from: address
433
+ > amount: coins
434
+ > }
435
+ */
436
+ export interface InternalWithdraw {
437
+ readonly $: 'InternalWithdraw';
438
+ queryId: uint64;
439
+ from: c.Address;
440
+ amount: coins;
441
+ }
442
+ export declare const InternalWithdraw: {
443
+ PREFIX: number;
444
+ create(args: {
445
+ queryId: uint64;
446
+ from: c.Address;
447
+ amount: coins;
448
+ }): InternalWithdraw;
449
+ fromSlice(s: c.Slice): InternalWithdraw;
450
+ store(self: InternalWithdraw, b: c.Builder): void;
451
+ toCell(self: InternalWithdraw): c.Cell;
452
+ };
453
+ interface ExtraSendOptions {
454
+ bounce?: boolean;
455
+ sendMode?: SendMode;
456
+ extraCurrencies?: c.ExtraCurrency;
457
+ }
458
+ interface DeployedAddrOptions {
459
+ workchain?: number;
460
+ toShard?: {
461
+ fixedPrefixLength: number;
462
+ closeTo: c.Address;
463
+ };
464
+ overrideContractCode?: c.Cell;
465
+ }
466
+ export declare class Wallet implements c.Contract {
467
+ static Errors: {
468
+ 'DepositErrors.InvalidInputs': number;
469
+ 'TransferErrors.InvalidInputs': number;
470
+ 'WithdrawErrors.InvalidInputs': number;
471
+ 'TransferErrors.IndexOutOfRange': number;
472
+ 'Errors.InvalidProof': number;
473
+ 'Errors.InvalidAmount': number;
474
+ 'Errors.AlreadyInitialized': number;
475
+ 'Errors.NotAlreadyInitialized': number;
476
+ 'Errors.NotEnoughGas': number;
477
+ 'Errors.InvalidPoint': number;
478
+ 'Errors.InvalidWorkchain': number;
479
+ 'Errors.WrongSender': number;
480
+ 'Errors.PositionLocked': number;
481
+ 'Errors.WrongOp': number;
482
+ };
483
+ readonly address: c.Address;
484
+ readonly init: {
485
+ code: c.Cell;
486
+ data: c.Cell;
487
+ } | undefined;
488
+ protected constructor(address: c.Address, init?: {
489
+ code: c.Cell;
490
+ data: c.Cell;
491
+ });
492
+ static fromAddress(address: c.Address): Wallet;
493
+ static createCellOfInternalDeposit(body: {
494
+ queryId: uint64;
495
+ amount: coins;
496
+ commitment: Point;
497
+ proof: CellRef<Proof>;
498
+ }): c.Cell;
499
+ static createCellOfInitTransfer(body: {
500
+ queryId: uint64;
501
+ to: c.Address;
502
+ receiverViewKey: Point;
503
+ newCommitment: CellRef<Point>;
504
+ amountCommit: CellRef<Point>;
505
+ proof: CellRef<Proof>;
506
+ ad: CellRef<TransferAdditionalData>;
507
+ }): c.Cell;
508
+ static createCellOfInternalTransfer(body: {
509
+ queryId: uint64;
510
+ from: c.Address;
511
+ receiverViewKey: Point;
512
+ encAmount: CellRef<uint256>;
513
+ amountCommit: CellRef<Point>;
514
+ oldStorageCommitment: CellRef<Point>;
515
+ ad: CellRef<InternalTransferAdditionalData>;
516
+ }): c.Cell;
517
+ static createCellOfTransferCallback(body: {
518
+ queryId: uint64;
519
+ from: c.Address;
520
+ excess: c.Address;
521
+ }): c.Cell;
522
+ static createCellOfInitWithdraw(body: {
523
+ queryId: uint64;
524
+ amount: coins;
525
+ newCommitment: CellRef<Point>;
526
+ proof: CellRef<Proof>;
527
+ }): c.Cell;
528
+ static createCellOfInternalRegister(body: {
529
+ queryId: uint64;
530
+ publicViewKey: Point;
531
+ }): c.Cell;
532
+ static createCellOfInternalFlipWalletStatus(body: {
533
+ queryId: uint64;
534
+ excess: c.Address;
535
+ }): c.Cell;
536
+ sendDeploy(provider: ContractProvider, via: Sender, msgValue: coins, extraOptions?: ExtraSendOptions): Promise<void>;
537
+ sendInternalDeposit(provider: ContractProvider, via: Sender, msgValue: coins, body: {
538
+ queryId: uint64;
539
+ amount: coins;
540
+ commitment: Point;
541
+ proof: CellRef<Proof>;
542
+ }, extraOptions?: ExtraSendOptions): Promise<void>;
543
+ sendInitTransfer(provider: ContractProvider, via: Sender, msgValue: coins, body: {
544
+ queryId: uint64;
545
+ to: c.Address;
546
+ receiverViewKey: Point;
547
+ newCommitment: CellRef<Point>;
548
+ amountCommit: CellRef<Point>;
549
+ proof: CellRef<Proof>;
550
+ ad: CellRef<TransferAdditionalData>;
551
+ }, extraOptions?: ExtraSendOptions): Promise<void>;
552
+ sendInternalTransfer(provider: ContractProvider, via: Sender, msgValue: coins, body: {
553
+ queryId: uint64;
554
+ from: c.Address;
555
+ receiverViewKey: Point;
556
+ encAmount: CellRef<uint256>;
557
+ amountCommit: CellRef<Point>;
558
+ oldStorageCommitment: CellRef<Point>;
559
+ ad: CellRef<InternalTransferAdditionalData>;
560
+ }, extraOptions?: ExtraSendOptions): Promise<void>;
561
+ sendTransferCallback(provider: ContractProvider, via: Sender, msgValue: coins, body: {
562
+ queryId: uint64;
563
+ from: c.Address;
564
+ excess: c.Address;
565
+ }, extraOptions?: ExtraSendOptions): Promise<void>;
566
+ sendInitWithdraw(provider: ContractProvider, via: Sender, msgValue: coins, body: {
567
+ queryId: uint64;
568
+ amount: coins;
569
+ newCommitment: CellRef<Point>;
570
+ proof: CellRef<Proof>;
571
+ }, extraOptions?: ExtraSendOptions): Promise<void>;
572
+ sendInternalRegister(provider: ContractProvider, via: Sender, msgValue: coins, body: {
573
+ queryId: uint64;
574
+ publicViewKey: Point;
575
+ }, extraOptions?: ExtraSendOptions): Promise<void>;
576
+ sendInternalFlipWalletStatus(provider: ContractProvider, via: Sender, msgValue: coins, body: {
577
+ queryId: uint64;
578
+ excess: c.Address;
579
+ }, extraOptions?: ExtraSendOptions): Promise<void>;
580
+ getWalletState(provider: ContractProvider): Promise<WalletRuntimeStorage>;
581
+ getWalletData(provider: ContractProvider): Promise<[
582
+ bigint,
583
+ c.Address,
584
+ c.Address,
585
+ c.Cell
586
+ ]>;
587
+ }
588
+ export {};