@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,542 @@
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 {};