@ton-agent-kit/plugin-escrow 1.0.0 → 1.0.2

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,1406 @@
1
+ import {
2
+ Cell,
3
+ Slice,
4
+ Address,
5
+ Builder,
6
+ beginCell,
7
+ ComputeError,
8
+ TupleItem,
9
+ TupleReader,
10
+ Dictionary,
11
+ contractAddress,
12
+ address,
13
+ ContractProvider,
14
+ Sender,
15
+ Contract,
16
+ ContractABI,
17
+ ABIType,
18
+ ABIGetter,
19
+ ABIReceiver,
20
+ TupleBuilder,
21
+ DictionaryValue
22
+ } from '@ton/core';
23
+
24
+ export type DataSize = {
25
+ $$type: 'DataSize';
26
+ cells: bigint;
27
+ bits: bigint;
28
+ refs: bigint;
29
+ }
30
+
31
+ export function storeDataSize(src: DataSize) {
32
+ return (builder: Builder) => {
33
+ const b_0 = builder;
34
+ b_0.storeInt(src.cells, 257);
35
+ b_0.storeInt(src.bits, 257);
36
+ b_0.storeInt(src.refs, 257);
37
+ };
38
+ }
39
+
40
+ export function loadDataSize(slice: Slice) {
41
+ const sc_0 = slice;
42
+ const _cells = sc_0.loadIntBig(257);
43
+ const _bits = sc_0.loadIntBig(257);
44
+ const _refs = sc_0.loadIntBig(257);
45
+ return { $$type: 'DataSize' as const, cells: _cells, bits: _bits, refs: _refs };
46
+ }
47
+
48
+ export function loadTupleDataSize(source: TupleReader) {
49
+ const _cells = source.readBigNumber();
50
+ const _bits = source.readBigNumber();
51
+ const _refs = source.readBigNumber();
52
+ return { $$type: 'DataSize' as const, cells: _cells, bits: _bits, refs: _refs };
53
+ }
54
+
55
+ export function loadGetterTupleDataSize(source: TupleReader) {
56
+ const _cells = source.readBigNumber();
57
+ const _bits = source.readBigNumber();
58
+ const _refs = source.readBigNumber();
59
+ return { $$type: 'DataSize' as const, cells: _cells, bits: _bits, refs: _refs };
60
+ }
61
+
62
+ export function storeTupleDataSize(source: DataSize) {
63
+ const builder = new TupleBuilder();
64
+ builder.writeNumber(source.cells);
65
+ builder.writeNumber(source.bits);
66
+ builder.writeNumber(source.refs);
67
+ return builder.build();
68
+ }
69
+
70
+ export function dictValueParserDataSize(): DictionaryValue<DataSize> {
71
+ return {
72
+ serialize: (src, builder) => {
73
+ builder.storeRef(beginCell().store(storeDataSize(src)).endCell());
74
+ },
75
+ parse: (src) => {
76
+ return loadDataSize(src.loadRef().beginParse());
77
+ }
78
+ }
79
+ }
80
+
81
+ export type SignedBundle = {
82
+ $$type: 'SignedBundle';
83
+ signature: Buffer;
84
+ signedData: Slice;
85
+ }
86
+
87
+ export function storeSignedBundle(src: SignedBundle) {
88
+ return (builder: Builder) => {
89
+ const b_0 = builder;
90
+ b_0.storeBuffer(src.signature);
91
+ b_0.storeBuilder(src.signedData.asBuilder());
92
+ };
93
+ }
94
+
95
+ export function loadSignedBundle(slice: Slice) {
96
+ const sc_0 = slice;
97
+ const _signature = sc_0.loadBuffer(64);
98
+ const _signedData = sc_0;
99
+ return { $$type: 'SignedBundle' as const, signature: _signature, signedData: _signedData };
100
+ }
101
+
102
+ export function loadTupleSignedBundle(source: TupleReader) {
103
+ const _signature = source.readBuffer();
104
+ const _signedData = source.readCell().asSlice();
105
+ return { $$type: 'SignedBundle' as const, signature: _signature, signedData: _signedData };
106
+ }
107
+
108
+ export function loadGetterTupleSignedBundle(source: TupleReader) {
109
+ const _signature = source.readBuffer();
110
+ const _signedData = source.readCell().asSlice();
111
+ return { $$type: 'SignedBundle' as const, signature: _signature, signedData: _signedData };
112
+ }
113
+
114
+ export function storeTupleSignedBundle(source: SignedBundle) {
115
+ const builder = new TupleBuilder();
116
+ builder.writeBuffer(source.signature);
117
+ builder.writeSlice(source.signedData.asCell());
118
+ return builder.build();
119
+ }
120
+
121
+ export function dictValueParserSignedBundle(): DictionaryValue<SignedBundle> {
122
+ return {
123
+ serialize: (src, builder) => {
124
+ builder.storeRef(beginCell().store(storeSignedBundle(src)).endCell());
125
+ },
126
+ parse: (src) => {
127
+ return loadSignedBundle(src.loadRef().beginParse());
128
+ }
129
+ }
130
+ }
131
+
132
+ export type StateInit = {
133
+ $$type: 'StateInit';
134
+ code: Cell;
135
+ data: Cell;
136
+ }
137
+
138
+ export function storeStateInit(src: StateInit) {
139
+ return (builder: Builder) => {
140
+ const b_0 = builder;
141
+ b_0.storeRef(src.code);
142
+ b_0.storeRef(src.data);
143
+ };
144
+ }
145
+
146
+ export function loadStateInit(slice: Slice) {
147
+ const sc_0 = slice;
148
+ const _code = sc_0.loadRef();
149
+ const _data = sc_0.loadRef();
150
+ return { $$type: 'StateInit' as const, code: _code, data: _data };
151
+ }
152
+
153
+ export function loadTupleStateInit(source: TupleReader) {
154
+ const _code = source.readCell();
155
+ const _data = source.readCell();
156
+ return { $$type: 'StateInit' as const, code: _code, data: _data };
157
+ }
158
+
159
+ export function loadGetterTupleStateInit(source: TupleReader) {
160
+ const _code = source.readCell();
161
+ const _data = source.readCell();
162
+ return { $$type: 'StateInit' as const, code: _code, data: _data };
163
+ }
164
+
165
+ export function storeTupleStateInit(source: StateInit) {
166
+ const builder = new TupleBuilder();
167
+ builder.writeCell(source.code);
168
+ builder.writeCell(source.data);
169
+ return builder.build();
170
+ }
171
+
172
+ export function dictValueParserStateInit(): DictionaryValue<StateInit> {
173
+ return {
174
+ serialize: (src, builder) => {
175
+ builder.storeRef(beginCell().store(storeStateInit(src)).endCell());
176
+ },
177
+ parse: (src) => {
178
+ return loadStateInit(src.loadRef().beginParse());
179
+ }
180
+ }
181
+ }
182
+
183
+ export type Context = {
184
+ $$type: 'Context';
185
+ bounceable: boolean;
186
+ sender: Address;
187
+ value: bigint;
188
+ raw: Slice;
189
+ }
190
+
191
+ export function storeContext(src: Context) {
192
+ return (builder: Builder) => {
193
+ const b_0 = builder;
194
+ b_0.storeBit(src.bounceable);
195
+ b_0.storeAddress(src.sender);
196
+ b_0.storeInt(src.value, 257);
197
+ b_0.storeRef(src.raw.asCell());
198
+ };
199
+ }
200
+
201
+ export function loadContext(slice: Slice) {
202
+ const sc_0 = slice;
203
+ const _bounceable = sc_0.loadBit();
204
+ const _sender = sc_0.loadAddress();
205
+ const _value = sc_0.loadIntBig(257);
206
+ const _raw = sc_0.loadRef().asSlice();
207
+ return { $$type: 'Context' as const, bounceable: _bounceable, sender: _sender, value: _value, raw: _raw };
208
+ }
209
+
210
+ export function loadTupleContext(source: TupleReader) {
211
+ const _bounceable = source.readBoolean();
212
+ const _sender = source.readAddress();
213
+ const _value = source.readBigNumber();
214
+ const _raw = source.readCell().asSlice();
215
+ return { $$type: 'Context' as const, bounceable: _bounceable, sender: _sender, value: _value, raw: _raw };
216
+ }
217
+
218
+ export function loadGetterTupleContext(source: TupleReader) {
219
+ const _bounceable = source.readBoolean();
220
+ const _sender = source.readAddress();
221
+ const _value = source.readBigNumber();
222
+ const _raw = source.readCell().asSlice();
223
+ return { $$type: 'Context' as const, bounceable: _bounceable, sender: _sender, value: _value, raw: _raw };
224
+ }
225
+
226
+ export function storeTupleContext(source: Context) {
227
+ const builder = new TupleBuilder();
228
+ builder.writeBoolean(source.bounceable);
229
+ builder.writeAddress(source.sender);
230
+ builder.writeNumber(source.value);
231
+ builder.writeSlice(source.raw.asCell());
232
+ return builder.build();
233
+ }
234
+
235
+ export function dictValueParserContext(): DictionaryValue<Context> {
236
+ return {
237
+ serialize: (src, builder) => {
238
+ builder.storeRef(beginCell().store(storeContext(src)).endCell());
239
+ },
240
+ parse: (src) => {
241
+ return loadContext(src.loadRef().beginParse());
242
+ }
243
+ }
244
+ }
245
+
246
+ export type SendParameters = {
247
+ $$type: 'SendParameters';
248
+ mode: bigint;
249
+ body: Cell | null;
250
+ code: Cell | null;
251
+ data: Cell | null;
252
+ value: bigint;
253
+ to: Address;
254
+ bounce: boolean;
255
+ }
256
+
257
+ export function storeSendParameters(src: SendParameters) {
258
+ return (builder: Builder) => {
259
+ const b_0 = builder;
260
+ b_0.storeInt(src.mode, 257);
261
+ if (src.body !== null && src.body !== undefined) { b_0.storeBit(true).storeRef(src.body); } else { b_0.storeBit(false); }
262
+ if (src.code !== null && src.code !== undefined) { b_0.storeBit(true).storeRef(src.code); } else { b_0.storeBit(false); }
263
+ if (src.data !== null && src.data !== undefined) { b_0.storeBit(true).storeRef(src.data); } else { b_0.storeBit(false); }
264
+ b_0.storeInt(src.value, 257);
265
+ b_0.storeAddress(src.to);
266
+ b_0.storeBit(src.bounce);
267
+ };
268
+ }
269
+
270
+ export function loadSendParameters(slice: Slice) {
271
+ const sc_0 = slice;
272
+ const _mode = sc_0.loadIntBig(257);
273
+ const _body = sc_0.loadBit() ? sc_0.loadRef() : null;
274
+ const _code = sc_0.loadBit() ? sc_0.loadRef() : null;
275
+ const _data = sc_0.loadBit() ? sc_0.loadRef() : null;
276
+ const _value = sc_0.loadIntBig(257);
277
+ const _to = sc_0.loadAddress();
278
+ const _bounce = sc_0.loadBit();
279
+ return { $$type: 'SendParameters' as const, mode: _mode, body: _body, code: _code, data: _data, value: _value, to: _to, bounce: _bounce };
280
+ }
281
+
282
+ export function loadTupleSendParameters(source: TupleReader) {
283
+ const _mode = source.readBigNumber();
284
+ const _body = source.readCellOpt();
285
+ const _code = source.readCellOpt();
286
+ const _data = source.readCellOpt();
287
+ const _value = source.readBigNumber();
288
+ const _to = source.readAddress();
289
+ const _bounce = source.readBoolean();
290
+ return { $$type: 'SendParameters' as const, mode: _mode, body: _body, code: _code, data: _data, value: _value, to: _to, bounce: _bounce };
291
+ }
292
+
293
+ export function loadGetterTupleSendParameters(source: TupleReader) {
294
+ const _mode = source.readBigNumber();
295
+ const _body = source.readCellOpt();
296
+ const _code = source.readCellOpt();
297
+ const _data = source.readCellOpt();
298
+ const _value = source.readBigNumber();
299
+ const _to = source.readAddress();
300
+ const _bounce = source.readBoolean();
301
+ return { $$type: 'SendParameters' as const, mode: _mode, body: _body, code: _code, data: _data, value: _value, to: _to, bounce: _bounce };
302
+ }
303
+
304
+ export function storeTupleSendParameters(source: SendParameters) {
305
+ const builder = new TupleBuilder();
306
+ builder.writeNumber(source.mode);
307
+ builder.writeCell(source.body);
308
+ builder.writeCell(source.code);
309
+ builder.writeCell(source.data);
310
+ builder.writeNumber(source.value);
311
+ builder.writeAddress(source.to);
312
+ builder.writeBoolean(source.bounce);
313
+ return builder.build();
314
+ }
315
+
316
+ export function dictValueParserSendParameters(): DictionaryValue<SendParameters> {
317
+ return {
318
+ serialize: (src, builder) => {
319
+ builder.storeRef(beginCell().store(storeSendParameters(src)).endCell());
320
+ },
321
+ parse: (src) => {
322
+ return loadSendParameters(src.loadRef().beginParse());
323
+ }
324
+ }
325
+ }
326
+
327
+ export type MessageParameters = {
328
+ $$type: 'MessageParameters';
329
+ mode: bigint;
330
+ body: Cell | null;
331
+ value: bigint;
332
+ to: Address;
333
+ bounce: boolean;
334
+ }
335
+
336
+ export function storeMessageParameters(src: MessageParameters) {
337
+ return (builder: Builder) => {
338
+ const b_0 = builder;
339
+ b_0.storeInt(src.mode, 257);
340
+ if (src.body !== null && src.body !== undefined) { b_0.storeBit(true).storeRef(src.body); } else { b_0.storeBit(false); }
341
+ b_0.storeInt(src.value, 257);
342
+ b_0.storeAddress(src.to);
343
+ b_0.storeBit(src.bounce);
344
+ };
345
+ }
346
+
347
+ export function loadMessageParameters(slice: Slice) {
348
+ const sc_0 = slice;
349
+ const _mode = sc_0.loadIntBig(257);
350
+ const _body = sc_0.loadBit() ? sc_0.loadRef() : null;
351
+ const _value = sc_0.loadIntBig(257);
352
+ const _to = sc_0.loadAddress();
353
+ const _bounce = sc_0.loadBit();
354
+ return { $$type: 'MessageParameters' as const, mode: _mode, body: _body, value: _value, to: _to, bounce: _bounce };
355
+ }
356
+
357
+ export function loadTupleMessageParameters(source: TupleReader) {
358
+ const _mode = source.readBigNumber();
359
+ const _body = source.readCellOpt();
360
+ const _value = source.readBigNumber();
361
+ const _to = source.readAddress();
362
+ const _bounce = source.readBoolean();
363
+ return { $$type: 'MessageParameters' as const, mode: _mode, body: _body, value: _value, to: _to, bounce: _bounce };
364
+ }
365
+
366
+ export function loadGetterTupleMessageParameters(source: TupleReader) {
367
+ const _mode = source.readBigNumber();
368
+ const _body = source.readCellOpt();
369
+ const _value = source.readBigNumber();
370
+ const _to = source.readAddress();
371
+ const _bounce = source.readBoolean();
372
+ return { $$type: 'MessageParameters' as const, mode: _mode, body: _body, value: _value, to: _to, bounce: _bounce };
373
+ }
374
+
375
+ export function storeTupleMessageParameters(source: MessageParameters) {
376
+ const builder = new TupleBuilder();
377
+ builder.writeNumber(source.mode);
378
+ builder.writeCell(source.body);
379
+ builder.writeNumber(source.value);
380
+ builder.writeAddress(source.to);
381
+ builder.writeBoolean(source.bounce);
382
+ return builder.build();
383
+ }
384
+
385
+ export function dictValueParserMessageParameters(): DictionaryValue<MessageParameters> {
386
+ return {
387
+ serialize: (src, builder) => {
388
+ builder.storeRef(beginCell().store(storeMessageParameters(src)).endCell());
389
+ },
390
+ parse: (src) => {
391
+ return loadMessageParameters(src.loadRef().beginParse());
392
+ }
393
+ }
394
+ }
395
+
396
+ export type DeployParameters = {
397
+ $$type: 'DeployParameters';
398
+ mode: bigint;
399
+ body: Cell | null;
400
+ value: bigint;
401
+ bounce: boolean;
402
+ init: StateInit;
403
+ }
404
+
405
+ export function storeDeployParameters(src: DeployParameters) {
406
+ return (builder: Builder) => {
407
+ const b_0 = builder;
408
+ b_0.storeInt(src.mode, 257);
409
+ if (src.body !== null && src.body !== undefined) { b_0.storeBit(true).storeRef(src.body); } else { b_0.storeBit(false); }
410
+ b_0.storeInt(src.value, 257);
411
+ b_0.storeBit(src.bounce);
412
+ b_0.store(storeStateInit(src.init));
413
+ };
414
+ }
415
+
416
+ export function loadDeployParameters(slice: Slice) {
417
+ const sc_0 = slice;
418
+ const _mode = sc_0.loadIntBig(257);
419
+ const _body = sc_0.loadBit() ? sc_0.loadRef() : null;
420
+ const _value = sc_0.loadIntBig(257);
421
+ const _bounce = sc_0.loadBit();
422
+ const _init = loadStateInit(sc_0);
423
+ return { $$type: 'DeployParameters' as const, mode: _mode, body: _body, value: _value, bounce: _bounce, init: _init };
424
+ }
425
+
426
+ export function loadTupleDeployParameters(source: TupleReader) {
427
+ const _mode = source.readBigNumber();
428
+ const _body = source.readCellOpt();
429
+ const _value = source.readBigNumber();
430
+ const _bounce = source.readBoolean();
431
+ const _init = loadTupleStateInit(source);
432
+ return { $$type: 'DeployParameters' as const, mode: _mode, body: _body, value: _value, bounce: _bounce, init: _init };
433
+ }
434
+
435
+ export function loadGetterTupleDeployParameters(source: TupleReader) {
436
+ const _mode = source.readBigNumber();
437
+ const _body = source.readCellOpt();
438
+ const _value = source.readBigNumber();
439
+ const _bounce = source.readBoolean();
440
+ const _init = loadGetterTupleStateInit(source);
441
+ return { $$type: 'DeployParameters' as const, mode: _mode, body: _body, value: _value, bounce: _bounce, init: _init };
442
+ }
443
+
444
+ export function storeTupleDeployParameters(source: DeployParameters) {
445
+ const builder = new TupleBuilder();
446
+ builder.writeNumber(source.mode);
447
+ builder.writeCell(source.body);
448
+ builder.writeNumber(source.value);
449
+ builder.writeBoolean(source.bounce);
450
+ builder.writeTuple(storeTupleStateInit(source.init));
451
+ return builder.build();
452
+ }
453
+
454
+ export function dictValueParserDeployParameters(): DictionaryValue<DeployParameters> {
455
+ return {
456
+ serialize: (src, builder) => {
457
+ builder.storeRef(beginCell().store(storeDeployParameters(src)).endCell());
458
+ },
459
+ parse: (src) => {
460
+ return loadDeployParameters(src.loadRef().beginParse());
461
+ }
462
+ }
463
+ }
464
+
465
+ export type StdAddress = {
466
+ $$type: 'StdAddress';
467
+ workchain: bigint;
468
+ address: bigint;
469
+ }
470
+
471
+ export function storeStdAddress(src: StdAddress) {
472
+ return (builder: Builder) => {
473
+ const b_0 = builder;
474
+ b_0.storeInt(src.workchain, 8);
475
+ b_0.storeUint(src.address, 256);
476
+ };
477
+ }
478
+
479
+ export function loadStdAddress(slice: Slice) {
480
+ const sc_0 = slice;
481
+ const _workchain = sc_0.loadIntBig(8);
482
+ const _address = sc_0.loadUintBig(256);
483
+ return { $$type: 'StdAddress' as const, workchain: _workchain, address: _address };
484
+ }
485
+
486
+ export function loadTupleStdAddress(source: TupleReader) {
487
+ const _workchain = source.readBigNumber();
488
+ const _address = source.readBigNumber();
489
+ return { $$type: 'StdAddress' as const, workchain: _workchain, address: _address };
490
+ }
491
+
492
+ export function loadGetterTupleStdAddress(source: TupleReader) {
493
+ const _workchain = source.readBigNumber();
494
+ const _address = source.readBigNumber();
495
+ return { $$type: 'StdAddress' as const, workchain: _workchain, address: _address };
496
+ }
497
+
498
+ export function storeTupleStdAddress(source: StdAddress) {
499
+ const builder = new TupleBuilder();
500
+ builder.writeNumber(source.workchain);
501
+ builder.writeNumber(source.address);
502
+ return builder.build();
503
+ }
504
+
505
+ export function dictValueParserStdAddress(): DictionaryValue<StdAddress> {
506
+ return {
507
+ serialize: (src, builder) => {
508
+ builder.storeRef(beginCell().store(storeStdAddress(src)).endCell());
509
+ },
510
+ parse: (src) => {
511
+ return loadStdAddress(src.loadRef().beginParse());
512
+ }
513
+ }
514
+ }
515
+
516
+ export type VarAddress = {
517
+ $$type: 'VarAddress';
518
+ workchain: bigint;
519
+ address: Slice;
520
+ }
521
+
522
+ export function storeVarAddress(src: VarAddress) {
523
+ return (builder: Builder) => {
524
+ const b_0 = builder;
525
+ b_0.storeInt(src.workchain, 32);
526
+ b_0.storeRef(src.address.asCell());
527
+ };
528
+ }
529
+
530
+ export function loadVarAddress(slice: Slice) {
531
+ const sc_0 = slice;
532
+ const _workchain = sc_0.loadIntBig(32);
533
+ const _address = sc_0.loadRef().asSlice();
534
+ return { $$type: 'VarAddress' as const, workchain: _workchain, address: _address };
535
+ }
536
+
537
+ export function loadTupleVarAddress(source: TupleReader) {
538
+ const _workchain = source.readBigNumber();
539
+ const _address = source.readCell().asSlice();
540
+ return { $$type: 'VarAddress' as const, workchain: _workchain, address: _address };
541
+ }
542
+
543
+ export function loadGetterTupleVarAddress(source: TupleReader) {
544
+ const _workchain = source.readBigNumber();
545
+ const _address = source.readCell().asSlice();
546
+ return { $$type: 'VarAddress' as const, workchain: _workchain, address: _address };
547
+ }
548
+
549
+ export function storeTupleVarAddress(source: VarAddress) {
550
+ const builder = new TupleBuilder();
551
+ builder.writeNumber(source.workchain);
552
+ builder.writeSlice(source.address.asCell());
553
+ return builder.build();
554
+ }
555
+
556
+ export function dictValueParserVarAddress(): DictionaryValue<VarAddress> {
557
+ return {
558
+ serialize: (src, builder) => {
559
+ builder.storeRef(beginCell().store(storeVarAddress(src)).endCell());
560
+ },
561
+ parse: (src) => {
562
+ return loadVarAddress(src.loadRef().beginParse());
563
+ }
564
+ }
565
+ }
566
+
567
+ export type BasechainAddress = {
568
+ $$type: 'BasechainAddress';
569
+ hash: bigint | null;
570
+ }
571
+
572
+ export function storeBasechainAddress(src: BasechainAddress) {
573
+ return (builder: Builder) => {
574
+ const b_0 = builder;
575
+ if (src.hash !== null && src.hash !== undefined) { b_0.storeBit(true).storeInt(src.hash, 257); } else { b_0.storeBit(false); }
576
+ };
577
+ }
578
+
579
+ export function loadBasechainAddress(slice: Slice) {
580
+ const sc_0 = slice;
581
+ const _hash = sc_0.loadBit() ? sc_0.loadIntBig(257) : null;
582
+ return { $$type: 'BasechainAddress' as const, hash: _hash };
583
+ }
584
+
585
+ export function loadTupleBasechainAddress(source: TupleReader) {
586
+ const _hash = source.readBigNumberOpt();
587
+ return { $$type: 'BasechainAddress' as const, hash: _hash };
588
+ }
589
+
590
+ export function loadGetterTupleBasechainAddress(source: TupleReader) {
591
+ const _hash = source.readBigNumberOpt();
592
+ return { $$type: 'BasechainAddress' as const, hash: _hash };
593
+ }
594
+
595
+ export function storeTupleBasechainAddress(source: BasechainAddress) {
596
+ const builder = new TupleBuilder();
597
+ builder.writeNumber(source.hash);
598
+ return builder.build();
599
+ }
600
+
601
+ export function dictValueParserBasechainAddress(): DictionaryValue<BasechainAddress> {
602
+ return {
603
+ serialize: (src, builder) => {
604
+ builder.storeRef(beginCell().store(storeBasechainAddress(src)).endCell());
605
+ },
606
+ parse: (src) => {
607
+ return loadBasechainAddress(src.loadRef().beginParse());
608
+ }
609
+ }
610
+ }
611
+
612
+ export type Deploy = {
613
+ $$type: 'Deploy';
614
+ queryId: bigint;
615
+ }
616
+
617
+ export function storeDeploy(src: Deploy) {
618
+ return (builder: Builder) => {
619
+ const b_0 = builder;
620
+ b_0.storeUint(2490013878, 32);
621
+ b_0.storeUint(src.queryId, 64);
622
+ };
623
+ }
624
+
625
+ export function loadDeploy(slice: Slice) {
626
+ const sc_0 = slice;
627
+ if (sc_0.loadUint(32) !== 2490013878) { throw Error('Invalid prefix'); }
628
+ const _queryId = sc_0.loadUintBig(64);
629
+ return { $$type: 'Deploy' as const, queryId: _queryId };
630
+ }
631
+
632
+ export function loadTupleDeploy(source: TupleReader) {
633
+ const _queryId = source.readBigNumber();
634
+ return { $$type: 'Deploy' as const, queryId: _queryId };
635
+ }
636
+
637
+ export function loadGetterTupleDeploy(source: TupleReader) {
638
+ const _queryId = source.readBigNumber();
639
+ return { $$type: 'Deploy' as const, queryId: _queryId };
640
+ }
641
+
642
+ export function storeTupleDeploy(source: Deploy) {
643
+ const builder = new TupleBuilder();
644
+ builder.writeNumber(source.queryId);
645
+ return builder.build();
646
+ }
647
+
648
+ export function dictValueParserDeploy(): DictionaryValue<Deploy> {
649
+ return {
650
+ serialize: (src, builder) => {
651
+ builder.storeRef(beginCell().store(storeDeploy(src)).endCell());
652
+ },
653
+ parse: (src) => {
654
+ return loadDeploy(src.loadRef().beginParse());
655
+ }
656
+ }
657
+ }
658
+
659
+ export type DeployOk = {
660
+ $$type: 'DeployOk';
661
+ queryId: bigint;
662
+ }
663
+
664
+ export function storeDeployOk(src: DeployOk) {
665
+ return (builder: Builder) => {
666
+ const b_0 = builder;
667
+ b_0.storeUint(2952335191, 32);
668
+ b_0.storeUint(src.queryId, 64);
669
+ };
670
+ }
671
+
672
+ export function loadDeployOk(slice: Slice) {
673
+ const sc_0 = slice;
674
+ if (sc_0.loadUint(32) !== 2952335191) { throw Error('Invalid prefix'); }
675
+ const _queryId = sc_0.loadUintBig(64);
676
+ return { $$type: 'DeployOk' as const, queryId: _queryId };
677
+ }
678
+
679
+ export function loadTupleDeployOk(source: TupleReader) {
680
+ const _queryId = source.readBigNumber();
681
+ return { $$type: 'DeployOk' as const, queryId: _queryId };
682
+ }
683
+
684
+ export function loadGetterTupleDeployOk(source: TupleReader) {
685
+ const _queryId = source.readBigNumber();
686
+ return { $$type: 'DeployOk' as const, queryId: _queryId };
687
+ }
688
+
689
+ export function storeTupleDeployOk(source: DeployOk) {
690
+ const builder = new TupleBuilder();
691
+ builder.writeNumber(source.queryId);
692
+ return builder.build();
693
+ }
694
+
695
+ export function dictValueParserDeployOk(): DictionaryValue<DeployOk> {
696
+ return {
697
+ serialize: (src, builder) => {
698
+ builder.storeRef(beginCell().store(storeDeployOk(src)).endCell());
699
+ },
700
+ parse: (src) => {
701
+ return loadDeployOk(src.loadRef().beginParse());
702
+ }
703
+ }
704
+ }
705
+
706
+ export type FactoryDeploy = {
707
+ $$type: 'FactoryDeploy';
708
+ queryId: bigint;
709
+ cashback: Address;
710
+ }
711
+
712
+ export function storeFactoryDeploy(src: FactoryDeploy) {
713
+ return (builder: Builder) => {
714
+ const b_0 = builder;
715
+ b_0.storeUint(1829761339, 32);
716
+ b_0.storeUint(src.queryId, 64);
717
+ b_0.storeAddress(src.cashback);
718
+ };
719
+ }
720
+
721
+ export function loadFactoryDeploy(slice: Slice) {
722
+ const sc_0 = slice;
723
+ if (sc_0.loadUint(32) !== 1829761339) { throw Error('Invalid prefix'); }
724
+ const _queryId = sc_0.loadUintBig(64);
725
+ const _cashback = sc_0.loadAddress();
726
+ return { $$type: 'FactoryDeploy' as const, queryId: _queryId, cashback: _cashback };
727
+ }
728
+
729
+ export function loadTupleFactoryDeploy(source: TupleReader) {
730
+ const _queryId = source.readBigNumber();
731
+ const _cashback = source.readAddress();
732
+ return { $$type: 'FactoryDeploy' as const, queryId: _queryId, cashback: _cashback };
733
+ }
734
+
735
+ export function loadGetterTupleFactoryDeploy(source: TupleReader) {
736
+ const _queryId = source.readBigNumber();
737
+ const _cashback = source.readAddress();
738
+ return { $$type: 'FactoryDeploy' as const, queryId: _queryId, cashback: _cashback };
739
+ }
740
+
741
+ export function storeTupleFactoryDeploy(source: FactoryDeploy) {
742
+ const builder = new TupleBuilder();
743
+ builder.writeNumber(source.queryId);
744
+ builder.writeAddress(source.cashback);
745
+ return builder.build();
746
+ }
747
+
748
+ export function dictValueParserFactoryDeploy(): DictionaryValue<FactoryDeploy> {
749
+ return {
750
+ serialize: (src, builder) => {
751
+ builder.storeRef(beginCell().store(storeFactoryDeploy(src)).endCell());
752
+ },
753
+ parse: (src) => {
754
+ return loadFactoryDeploy(src.loadRef().beginParse());
755
+ }
756
+ }
757
+ }
758
+
759
+ export type ChangeOwner = {
760
+ $$type: 'ChangeOwner';
761
+ queryId: bigint;
762
+ newOwner: Address;
763
+ }
764
+
765
+ export function storeChangeOwner(src: ChangeOwner) {
766
+ return (builder: Builder) => {
767
+ const b_0 = builder;
768
+ b_0.storeUint(2174598809, 32);
769
+ b_0.storeUint(src.queryId, 64);
770
+ b_0.storeAddress(src.newOwner);
771
+ };
772
+ }
773
+
774
+ export function loadChangeOwner(slice: Slice) {
775
+ const sc_0 = slice;
776
+ if (sc_0.loadUint(32) !== 2174598809) { throw Error('Invalid prefix'); }
777
+ const _queryId = sc_0.loadUintBig(64);
778
+ const _newOwner = sc_0.loadAddress();
779
+ return { $$type: 'ChangeOwner' as const, queryId: _queryId, newOwner: _newOwner };
780
+ }
781
+
782
+ export function loadTupleChangeOwner(source: TupleReader) {
783
+ const _queryId = source.readBigNumber();
784
+ const _newOwner = source.readAddress();
785
+ return { $$type: 'ChangeOwner' as const, queryId: _queryId, newOwner: _newOwner };
786
+ }
787
+
788
+ export function loadGetterTupleChangeOwner(source: TupleReader) {
789
+ const _queryId = source.readBigNumber();
790
+ const _newOwner = source.readAddress();
791
+ return { $$type: 'ChangeOwner' as const, queryId: _queryId, newOwner: _newOwner };
792
+ }
793
+
794
+ export function storeTupleChangeOwner(source: ChangeOwner) {
795
+ const builder = new TupleBuilder();
796
+ builder.writeNumber(source.queryId);
797
+ builder.writeAddress(source.newOwner);
798
+ return builder.build();
799
+ }
800
+
801
+ export function dictValueParserChangeOwner(): DictionaryValue<ChangeOwner> {
802
+ return {
803
+ serialize: (src, builder) => {
804
+ builder.storeRef(beginCell().store(storeChangeOwner(src)).endCell());
805
+ },
806
+ parse: (src) => {
807
+ return loadChangeOwner(src.loadRef().beginParse());
808
+ }
809
+ }
810
+ }
811
+
812
+ export type ChangeOwnerOk = {
813
+ $$type: 'ChangeOwnerOk';
814
+ queryId: bigint;
815
+ newOwner: Address;
816
+ }
817
+
818
+ export function storeChangeOwnerOk(src: ChangeOwnerOk) {
819
+ return (builder: Builder) => {
820
+ const b_0 = builder;
821
+ b_0.storeUint(846932810, 32);
822
+ b_0.storeUint(src.queryId, 64);
823
+ b_0.storeAddress(src.newOwner);
824
+ };
825
+ }
826
+
827
+ export function loadChangeOwnerOk(slice: Slice) {
828
+ const sc_0 = slice;
829
+ if (sc_0.loadUint(32) !== 846932810) { throw Error('Invalid prefix'); }
830
+ const _queryId = sc_0.loadUintBig(64);
831
+ const _newOwner = sc_0.loadAddress();
832
+ return { $$type: 'ChangeOwnerOk' as const, queryId: _queryId, newOwner: _newOwner };
833
+ }
834
+
835
+ export function loadTupleChangeOwnerOk(source: TupleReader) {
836
+ const _queryId = source.readBigNumber();
837
+ const _newOwner = source.readAddress();
838
+ return { $$type: 'ChangeOwnerOk' as const, queryId: _queryId, newOwner: _newOwner };
839
+ }
840
+
841
+ export function loadGetterTupleChangeOwnerOk(source: TupleReader) {
842
+ const _queryId = source.readBigNumber();
843
+ const _newOwner = source.readAddress();
844
+ return { $$type: 'ChangeOwnerOk' as const, queryId: _queryId, newOwner: _newOwner };
845
+ }
846
+
847
+ export function storeTupleChangeOwnerOk(source: ChangeOwnerOk) {
848
+ const builder = new TupleBuilder();
849
+ builder.writeNumber(source.queryId);
850
+ builder.writeAddress(source.newOwner);
851
+ return builder.build();
852
+ }
853
+
854
+ export function dictValueParserChangeOwnerOk(): DictionaryValue<ChangeOwnerOk> {
855
+ return {
856
+ serialize: (src, builder) => {
857
+ builder.storeRef(beginCell().store(storeChangeOwnerOk(src)).endCell());
858
+ },
859
+ parse: (src) => {
860
+ return loadChangeOwnerOk(src.loadRef().beginParse());
861
+ }
862
+ }
863
+ }
864
+
865
+ export type Deposit = {
866
+ $$type: 'Deposit';
867
+ queryId: bigint;
868
+ }
869
+
870
+ export function storeDeposit(src: Deposit) {
871
+ return (builder: Builder) => {
872
+ const b_0 = builder;
873
+ b_0.storeUint(4171902866, 32);
874
+ b_0.storeUint(src.queryId, 64);
875
+ };
876
+ }
877
+
878
+ export function loadDeposit(slice: Slice) {
879
+ const sc_0 = slice;
880
+ if (sc_0.loadUint(32) !== 4171902866) { throw Error('Invalid prefix'); }
881
+ const _queryId = sc_0.loadUintBig(64);
882
+ return { $$type: 'Deposit' as const, queryId: _queryId };
883
+ }
884
+
885
+ export function loadTupleDeposit(source: TupleReader) {
886
+ const _queryId = source.readBigNumber();
887
+ return { $$type: 'Deposit' as const, queryId: _queryId };
888
+ }
889
+
890
+ export function loadGetterTupleDeposit(source: TupleReader) {
891
+ const _queryId = source.readBigNumber();
892
+ return { $$type: 'Deposit' as const, queryId: _queryId };
893
+ }
894
+
895
+ export function storeTupleDeposit(source: Deposit) {
896
+ const builder = new TupleBuilder();
897
+ builder.writeNumber(source.queryId);
898
+ return builder.build();
899
+ }
900
+
901
+ export function dictValueParserDeposit(): DictionaryValue<Deposit> {
902
+ return {
903
+ serialize: (src, builder) => {
904
+ builder.storeRef(beginCell().store(storeDeposit(src)).endCell());
905
+ },
906
+ parse: (src) => {
907
+ return loadDeposit(src.loadRef().beginParse());
908
+ }
909
+ }
910
+ }
911
+
912
+ export type Release = {
913
+ $$type: 'Release';
914
+ queryId: bigint;
915
+ }
916
+
917
+ export function storeRelease(src: Release) {
918
+ return (builder: Builder) => {
919
+ const b_0 = builder;
920
+ b_0.storeUint(408342921, 32);
921
+ b_0.storeUint(src.queryId, 64);
922
+ };
923
+ }
924
+
925
+ export function loadRelease(slice: Slice) {
926
+ const sc_0 = slice;
927
+ if (sc_0.loadUint(32) !== 408342921) { throw Error('Invalid prefix'); }
928
+ const _queryId = sc_0.loadUintBig(64);
929
+ return { $$type: 'Release' as const, queryId: _queryId };
930
+ }
931
+
932
+ export function loadTupleRelease(source: TupleReader) {
933
+ const _queryId = source.readBigNumber();
934
+ return { $$type: 'Release' as const, queryId: _queryId };
935
+ }
936
+
937
+ export function loadGetterTupleRelease(source: TupleReader) {
938
+ const _queryId = source.readBigNumber();
939
+ return { $$type: 'Release' as const, queryId: _queryId };
940
+ }
941
+
942
+ export function storeTupleRelease(source: Release) {
943
+ const builder = new TupleBuilder();
944
+ builder.writeNumber(source.queryId);
945
+ return builder.build();
946
+ }
947
+
948
+ export function dictValueParserRelease(): DictionaryValue<Release> {
949
+ return {
950
+ serialize: (src, builder) => {
951
+ builder.storeRef(beginCell().store(storeRelease(src)).endCell());
952
+ },
953
+ parse: (src) => {
954
+ return loadRelease(src.loadRef().beginParse());
955
+ }
956
+ }
957
+ }
958
+
959
+ export type Refund = {
960
+ $$type: 'Refund';
961
+ queryId: bigint;
962
+ }
963
+
964
+ export function storeRefund(src: Refund) {
965
+ return (builder: Builder) => {
966
+ const b_0 = builder;
967
+ b_0.storeUint(2214270485, 32);
968
+ b_0.storeUint(src.queryId, 64);
969
+ };
970
+ }
971
+
972
+ export function loadRefund(slice: Slice) {
973
+ const sc_0 = slice;
974
+ if (sc_0.loadUint(32) !== 2214270485) { throw Error('Invalid prefix'); }
975
+ const _queryId = sc_0.loadUintBig(64);
976
+ return { $$type: 'Refund' as const, queryId: _queryId };
977
+ }
978
+
979
+ export function loadTupleRefund(source: TupleReader) {
980
+ const _queryId = source.readBigNumber();
981
+ return { $$type: 'Refund' as const, queryId: _queryId };
982
+ }
983
+
984
+ export function loadGetterTupleRefund(source: TupleReader) {
985
+ const _queryId = source.readBigNumber();
986
+ return { $$type: 'Refund' as const, queryId: _queryId };
987
+ }
988
+
989
+ export function storeTupleRefund(source: Refund) {
990
+ const builder = new TupleBuilder();
991
+ builder.writeNumber(source.queryId);
992
+ return builder.build();
993
+ }
994
+
995
+ export function dictValueParserRefund(): DictionaryValue<Refund> {
996
+ return {
997
+ serialize: (src, builder) => {
998
+ builder.storeRef(beginCell().store(storeRefund(src)).endCell());
999
+ },
1000
+ parse: (src) => {
1001
+ return loadRefund(src.loadRef().beginParse());
1002
+ }
1003
+ }
1004
+ }
1005
+
1006
+ export type EscrowData = {
1007
+ $$type: 'EscrowData';
1008
+ depositor: Address;
1009
+ beneficiary: Address;
1010
+ arbiter: Address;
1011
+ amount: bigint;
1012
+ deadline: bigint;
1013
+ released: boolean;
1014
+ refunded: boolean;
1015
+ }
1016
+
1017
+ export function storeEscrowData(src: EscrowData) {
1018
+ return (builder: Builder) => {
1019
+ const b_0 = builder;
1020
+ b_0.storeAddress(src.depositor);
1021
+ b_0.storeAddress(src.beneficiary);
1022
+ b_0.storeAddress(src.arbiter);
1023
+ b_0.storeCoins(src.amount);
1024
+ b_0.storeUint(src.deadline, 32);
1025
+ b_0.storeBit(src.released);
1026
+ b_0.storeBit(src.refunded);
1027
+ };
1028
+ }
1029
+
1030
+ export function loadEscrowData(slice: Slice) {
1031
+ const sc_0 = slice;
1032
+ const _depositor = sc_0.loadAddress();
1033
+ const _beneficiary = sc_0.loadAddress();
1034
+ const _arbiter = sc_0.loadAddress();
1035
+ const _amount = sc_0.loadCoins();
1036
+ const _deadline = sc_0.loadUintBig(32);
1037
+ const _released = sc_0.loadBit();
1038
+ const _refunded = sc_0.loadBit();
1039
+ return { $$type: 'EscrowData' as const, depositor: _depositor, beneficiary: _beneficiary, arbiter: _arbiter, amount: _amount, deadline: _deadline, released: _released, refunded: _refunded };
1040
+ }
1041
+
1042
+ export function loadTupleEscrowData(source: TupleReader) {
1043
+ const _depositor = source.readAddress();
1044
+ const _beneficiary = source.readAddress();
1045
+ const _arbiter = source.readAddress();
1046
+ const _amount = source.readBigNumber();
1047
+ const _deadline = source.readBigNumber();
1048
+ const _released = source.readBoolean();
1049
+ const _refunded = source.readBoolean();
1050
+ return { $$type: 'EscrowData' as const, depositor: _depositor, beneficiary: _beneficiary, arbiter: _arbiter, amount: _amount, deadline: _deadline, released: _released, refunded: _refunded };
1051
+ }
1052
+
1053
+ export function loadGetterTupleEscrowData(source: TupleReader) {
1054
+ const _depositor = source.readAddress();
1055
+ const _beneficiary = source.readAddress();
1056
+ const _arbiter = source.readAddress();
1057
+ const _amount = source.readBigNumber();
1058
+ const _deadline = source.readBigNumber();
1059
+ const _released = source.readBoolean();
1060
+ const _refunded = source.readBoolean();
1061
+ return { $$type: 'EscrowData' as const, depositor: _depositor, beneficiary: _beneficiary, arbiter: _arbiter, amount: _amount, deadline: _deadline, released: _released, refunded: _refunded };
1062
+ }
1063
+
1064
+ export function storeTupleEscrowData(source: EscrowData) {
1065
+ const builder = new TupleBuilder();
1066
+ builder.writeAddress(source.depositor);
1067
+ builder.writeAddress(source.beneficiary);
1068
+ builder.writeAddress(source.arbiter);
1069
+ builder.writeNumber(source.amount);
1070
+ builder.writeNumber(source.deadline);
1071
+ builder.writeBoolean(source.released);
1072
+ builder.writeBoolean(source.refunded);
1073
+ return builder.build();
1074
+ }
1075
+
1076
+ export function dictValueParserEscrowData(): DictionaryValue<EscrowData> {
1077
+ return {
1078
+ serialize: (src, builder) => {
1079
+ builder.storeRef(beginCell().store(storeEscrowData(src)).endCell());
1080
+ },
1081
+ parse: (src) => {
1082
+ return loadEscrowData(src.loadRef().beginParse());
1083
+ }
1084
+ }
1085
+ }
1086
+
1087
+ export type Escrow$Data = {
1088
+ $$type: 'Escrow$Data';
1089
+ depositor: Address;
1090
+ beneficiary: Address;
1091
+ arbiter: Address;
1092
+ amount: bigint;
1093
+ deadline: bigint;
1094
+ released: boolean;
1095
+ refunded: boolean;
1096
+ }
1097
+
1098
+ export function storeEscrow$Data(src: Escrow$Data) {
1099
+ return (builder: Builder) => {
1100
+ const b_0 = builder;
1101
+ b_0.storeAddress(src.depositor);
1102
+ b_0.storeAddress(src.beneficiary);
1103
+ b_0.storeAddress(src.arbiter);
1104
+ b_0.storeCoins(src.amount);
1105
+ b_0.storeUint(src.deadline, 32);
1106
+ b_0.storeBit(src.released);
1107
+ b_0.storeBit(src.refunded);
1108
+ };
1109
+ }
1110
+
1111
+ export function loadEscrow$Data(slice: Slice) {
1112
+ const sc_0 = slice;
1113
+ const _depositor = sc_0.loadAddress();
1114
+ const _beneficiary = sc_0.loadAddress();
1115
+ const _arbiter = sc_0.loadAddress();
1116
+ const _amount = sc_0.loadCoins();
1117
+ const _deadline = sc_0.loadUintBig(32);
1118
+ const _released = sc_0.loadBit();
1119
+ const _refunded = sc_0.loadBit();
1120
+ return { $$type: 'Escrow$Data' as const, depositor: _depositor, beneficiary: _beneficiary, arbiter: _arbiter, amount: _amount, deadline: _deadline, released: _released, refunded: _refunded };
1121
+ }
1122
+
1123
+ export function loadTupleEscrow$Data(source: TupleReader) {
1124
+ const _depositor = source.readAddress();
1125
+ const _beneficiary = source.readAddress();
1126
+ const _arbiter = source.readAddress();
1127
+ const _amount = source.readBigNumber();
1128
+ const _deadline = source.readBigNumber();
1129
+ const _released = source.readBoolean();
1130
+ const _refunded = source.readBoolean();
1131
+ return { $$type: 'Escrow$Data' as const, depositor: _depositor, beneficiary: _beneficiary, arbiter: _arbiter, amount: _amount, deadline: _deadline, released: _released, refunded: _refunded };
1132
+ }
1133
+
1134
+ export function loadGetterTupleEscrow$Data(source: TupleReader) {
1135
+ const _depositor = source.readAddress();
1136
+ const _beneficiary = source.readAddress();
1137
+ const _arbiter = source.readAddress();
1138
+ const _amount = source.readBigNumber();
1139
+ const _deadline = source.readBigNumber();
1140
+ const _released = source.readBoolean();
1141
+ const _refunded = source.readBoolean();
1142
+ return { $$type: 'Escrow$Data' as const, depositor: _depositor, beneficiary: _beneficiary, arbiter: _arbiter, amount: _amount, deadline: _deadline, released: _released, refunded: _refunded };
1143
+ }
1144
+
1145
+ export function storeTupleEscrow$Data(source: Escrow$Data) {
1146
+ const builder = new TupleBuilder();
1147
+ builder.writeAddress(source.depositor);
1148
+ builder.writeAddress(source.beneficiary);
1149
+ builder.writeAddress(source.arbiter);
1150
+ builder.writeNumber(source.amount);
1151
+ builder.writeNumber(source.deadline);
1152
+ builder.writeBoolean(source.released);
1153
+ builder.writeBoolean(source.refunded);
1154
+ return builder.build();
1155
+ }
1156
+
1157
+ export function dictValueParserEscrow$Data(): DictionaryValue<Escrow$Data> {
1158
+ return {
1159
+ serialize: (src, builder) => {
1160
+ builder.storeRef(beginCell().store(storeEscrow$Data(src)).endCell());
1161
+ },
1162
+ parse: (src) => {
1163
+ return loadEscrow$Data(src.loadRef().beginParse());
1164
+ }
1165
+ }
1166
+ }
1167
+
1168
+ type Escrow_init_args = {
1169
+ $$type: 'Escrow_init_args';
1170
+ depositor: Address;
1171
+ beneficiary: Address;
1172
+ arbiter: Address;
1173
+ deadline: bigint;
1174
+ }
1175
+
1176
+ function initEscrow_init_args(src: Escrow_init_args) {
1177
+ return (builder: Builder) => {
1178
+ const b_0 = builder;
1179
+ b_0.storeAddress(src.depositor);
1180
+ b_0.storeAddress(src.beneficiary);
1181
+ b_0.storeAddress(src.arbiter);
1182
+ const b_1 = new Builder();
1183
+ b_1.storeInt(src.deadline, 257);
1184
+ b_0.storeRef(b_1.endCell());
1185
+ };
1186
+ }
1187
+
1188
+ async function Escrow_init(depositor: Address, beneficiary: Address, arbiter: Address, deadline: bigint) {
1189
+ const __code = Cell.fromHex('b5ee9c7241020f0100033600022cff008e88f4a413f4bcf2c80bed53208e8130e1ed43d90106020378e00204017bb96c0ed44d0d200018e12fa40fa40fa40fa00d31fd200d20055606c178e1afa40fa40fa40d401d0810101d7003014433004d1550270017070e2db3c6c718030008f8276f10017bbbed2ed44d0d200018e12fa40fa40fa40fa00d31fd200d20055606c178e1afa40fa40fa40d401d0810101d7003014433004d1550270017070e2db3c6c77805000e5476545476542604f201d072d721d200d200fa4021103450666f04f86102f862ed44d0d200018e12fa40fa40fa40fa00d31fd200d20055606c178e1afa40fa40fa40d401d0810101d7003014433004d1550270017070e208925f08e006d70d1ff2e082218210f8aa2f92bae3022182101856d189bae30221821083fb1615bae3020107080b0e00705b81247e26b39227b39170e2f2f4f8416f24135f0312a010461035443302c87f01ca0055605067ce14ce12ce01fa02cb1fca00ca00c9ed5402f45bf8428200a5c35316c70592317f945114c705e2f2f481165906b39226b39170e216f2f48200a1c721c200f2f47f218208989680a18306708827553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb0010461035440302090a002600000000457363726f772072656c65617365640034c87f01ca0055605067ce14ce12ce01fa02cb1fca00ca00c9ed5402fe5bf842f82322bc8126195327c70592327f945125c705e292307fdef2f481165926b39207b3923770e217f2f48200a1c721c200f2f47f218208989680a18306708828553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb00104610350c0d002600000000457363726f7720726566756e64656400384430c87f01ca0055605067ce14ce12ce01fa02cb1fca00ca00c9ed5400ca8210946a98b6ba8e56d33f30c8018210aff90f5758cb1fcb3fc91057104610354430f84270705003804201503304c8cf8580ca00cf8440ce01fa02806acf40f400c901fb00c87f01ca0055605067ce14ce12ce01fa02cb1fca00ca00c9ed54e05f08f2c082351f8573');
1190
+ const builder = beginCell();
1191
+ builder.storeUint(0, 1);
1192
+ initEscrow_init_args({ $$type: 'Escrow_init_args', depositor, beneficiary, arbiter, deadline })(builder);
1193
+ const __data = builder.endCell();
1194
+ return { code: __code, data: __data };
1195
+ }
1196
+
1197
+ export const Escrow_errors = {
1198
+ 2: { message: "Stack underflow" },
1199
+ 3: { message: "Stack overflow" },
1200
+ 4: { message: "Integer overflow" },
1201
+ 5: { message: "Integer out of expected range" },
1202
+ 6: { message: "Invalid opcode" },
1203
+ 7: { message: "Type check error" },
1204
+ 8: { message: "Cell overflow" },
1205
+ 9: { message: "Cell underflow" },
1206
+ 10: { message: "Dictionary error" },
1207
+ 11: { message: "'Unknown' error" },
1208
+ 12: { message: "Fatal error" },
1209
+ 13: { message: "Out of gas error" },
1210
+ 14: { message: "Virtualization error" },
1211
+ 32: { message: "Action list is invalid" },
1212
+ 33: { message: "Action list is too long" },
1213
+ 34: { message: "Action is invalid or not supported" },
1214
+ 35: { message: "Invalid source address in outbound message" },
1215
+ 36: { message: "Invalid destination address in outbound message" },
1216
+ 37: { message: "Not enough Toncoin" },
1217
+ 38: { message: "Not enough extra currencies" },
1218
+ 39: { message: "Outbound message does not fit into a cell after rewriting" },
1219
+ 40: { message: "Cannot process a message" },
1220
+ 41: { message: "Library reference is null" },
1221
+ 42: { message: "Library change action error" },
1222
+ 43: { message: "Exceeded maximum number of cells in the library or the maximum depth of the Merkle tree" },
1223
+ 50: { message: "Account state size exceeded limits" },
1224
+ 128: { message: "Null reference exception" },
1225
+ 129: { message: "Invalid serialization prefix" },
1226
+ 130: { message: "Invalid incoming message" },
1227
+ 131: { message: "Constraints error" },
1228
+ 132: { message: "Access denied" },
1229
+ 133: { message: "Contract stopped" },
1230
+ 134: { message: "Invalid argument" },
1231
+ 135: { message: "Code of a contract was not found" },
1232
+ 136: { message: "Invalid standard address" },
1233
+ 138: { message: "Not a basechain address" },
1234
+ 5721: { message: "Already settled" },
1235
+ 9342: { message: "Escrow already settled" },
1236
+ 9753: { message: "Not authorized and deadline not passed" },
1237
+ 41415: { message: "No funds" },
1238
+ 42435: { message: "Not authorized" },
1239
+ } as const
1240
+
1241
+ export const Escrow_errors_backward = {
1242
+ "Stack underflow": 2,
1243
+ "Stack overflow": 3,
1244
+ "Integer overflow": 4,
1245
+ "Integer out of expected range": 5,
1246
+ "Invalid opcode": 6,
1247
+ "Type check error": 7,
1248
+ "Cell overflow": 8,
1249
+ "Cell underflow": 9,
1250
+ "Dictionary error": 10,
1251
+ "'Unknown' error": 11,
1252
+ "Fatal error": 12,
1253
+ "Out of gas error": 13,
1254
+ "Virtualization error": 14,
1255
+ "Action list is invalid": 32,
1256
+ "Action list is too long": 33,
1257
+ "Action is invalid or not supported": 34,
1258
+ "Invalid source address in outbound message": 35,
1259
+ "Invalid destination address in outbound message": 36,
1260
+ "Not enough Toncoin": 37,
1261
+ "Not enough extra currencies": 38,
1262
+ "Outbound message does not fit into a cell after rewriting": 39,
1263
+ "Cannot process a message": 40,
1264
+ "Library reference is null": 41,
1265
+ "Library change action error": 42,
1266
+ "Exceeded maximum number of cells in the library or the maximum depth of the Merkle tree": 43,
1267
+ "Account state size exceeded limits": 50,
1268
+ "Null reference exception": 128,
1269
+ "Invalid serialization prefix": 129,
1270
+ "Invalid incoming message": 130,
1271
+ "Constraints error": 131,
1272
+ "Access denied": 132,
1273
+ "Contract stopped": 133,
1274
+ "Invalid argument": 134,
1275
+ "Code of a contract was not found": 135,
1276
+ "Invalid standard address": 136,
1277
+ "Not a basechain address": 138,
1278
+ "Already settled": 5721,
1279
+ "Escrow already settled": 9342,
1280
+ "Not authorized and deadline not passed": 9753,
1281
+ "No funds": 41415,
1282
+ "Not authorized": 42435,
1283
+ } as const
1284
+
1285
+ const Escrow_types: ABIType[] = [
1286
+ {"name":"DataSize","header":null,"fields":[{"name":"cells","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"bits","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"refs","type":{"kind":"simple","type":"int","optional":false,"format":257}}]},
1287
+ {"name":"SignedBundle","header":null,"fields":[{"name":"signature","type":{"kind":"simple","type":"fixed-bytes","optional":false,"format":64}},{"name":"signedData","type":{"kind":"simple","type":"slice","optional":false,"format":"remainder"}}]},
1288
+ {"name":"StateInit","header":null,"fields":[{"name":"code","type":{"kind":"simple","type":"cell","optional":false}},{"name":"data","type":{"kind":"simple","type":"cell","optional":false}}]},
1289
+ {"name":"Context","header":null,"fields":[{"name":"bounceable","type":{"kind":"simple","type":"bool","optional":false}},{"name":"sender","type":{"kind":"simple","type":"address","optional":false}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"raw","type":{"kind":"simple","type":"slice","optional":false}}]},
1290
+ {"name":"SendParameters","header":null,"fields":[{"name":"mode","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"body","type":{"kind":"simple","type":"cell","optional":true}},{"name":"code","type":{"kind":"simple","type":"cell","optional":true}},{"name":"data","type":{"kind":"simple","type":"cell","optional":true}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"to","type":{"kind":"simple","type":"address","optional":false}},{"name":"bounce","type":{"kind":"simple","type":"bool","optional":false}}]},
1291
+ {"name":"MessageParameters","header":null,"fields":[{"name":"mode","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"body","type":{"kind":"simple","type":"cell","optional":true}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"to","type":{"kind":"simple","type":"address","optional":false}},{"name":"bounce","type":{"kind":"simple","type":"bool","optional":false}}]},
1292
+ {"name":"DeployParameters","header":null,"fields":[{"name":"mode","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"body","type":{"kind":"simple","type":"cell","optional":true}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"bounce","type":{"kind":"simple","type":"bool","optional":false}},{"name":"init","type":{"kind":"simple","type":"StateInit","optional":false}}]},
1293
+ {"name":"StdAddress","header":null,"fields":[{"name":"workchain","type":{"kind":"simple","type":"int","optional":false,"format":8}},{"name":"address","type":{"kind":"simple","type":"uint","optional":false,"format":256}}]},
1294
+ {"name":"VarAddress","header":null,"fields":[{"name":"workchain","type":{"kind":"simple","type":"int","optional":false,"format":32}},{"name":"address","type":{"kind":"simple","type":"slice","optional":false}}]},
1295
+ {"name":"BasechainAddress","header":null,"fields":[{"name":"hash","type":{"kind":"simple","type":"int","optional":true,"format":257}}]},
1296
+ {"name":"Deploy","header":2490013878,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}}]},
1297
+ {"name":"DeployOk","header":2952335191,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}}]},
1298
+ {"name":"FactoryDeploy","header":1829761339,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"cashback","type":{"kind":"simple","type":"address","optional":false}}]},
1299
+ {"name":"ChangeOwner","header":2174598809,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"newOwner","type":{"kind":"simple","type":"address","optional":false}}]},
1300
+ {"name":"ChangeOwnerOk","header":846932810,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}},{"name":"newOwner","type":{"kind":"simple","type":"address","optional":false}}]},
1301
+ {"name":"Deposit","header":4171902866,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}}]},
1302
+ {"name":"Release","header":408342921,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}}]},
1303
+ {"name":"Refund","header":2214270485,"fields":[{"name":"queryId","type":{"kind":"simple","type":"uint","optional":false,"format":64}}]},
1304
+ {"name":"EscrowData","header":null,"fields":[{"name":"depositor","type":{"kind":"simple","type":"address","optional":false}},{"name":"beneficiary","type":{"kind":"simple","type":"address","optional":false}},{"name":"arbiter","type":{"kind":"simple","type":"address","optional":false}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"deadline","type":{"kind":"simple","type":"uint","optional":false,"format":32}},{"name":"released","type":{"kind":"simple","type":"bool","optional":false}},{"name":"refunded","type":{"kind":"simple","type":"bool","optional":false}}]},
1305
+ {"name":"Escrow$Data","header":null,"fields":[{"name":"depositor","type":{"kind":"simple","type":"address","optional":false}},{"name":"beneficiary","type":{"kind":"simple","type":"address","optional":false}},{"name":"arbiter","type":{"kind":"simple","type":"address","optional":false}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"deadline","type":{"kind":"simple","type":"uint","optional":false,"format":32}},{"name":"released","type":{"kind":"simple","type":"bool","optional":false}},{"name":"refunded","type":{"kind":"simple","type":"bool","optional":false}}]},
1306
+ ]
1307
+
1308
+ const Escrow_opcodes = {
1309
+ "Deploy": 2490013878,
1310
+ "DeployOk": 2952335191,
1311
+ "FactoryDeploy": 1829761339,
1312
+ "ChangeOwner": 2174598809,
1313
+ "ChangeOwnerOk": 846932810,
1314
+ "Deposit": 4171902866,
1315
+ "Release": 408342921,
1316
+ "Refund": 2214270485,
1317
+ }
1318
+
1319
+ const Escrow_getters: ABIGetter[] = [
1320
+ {"name":"escrowData","methodId":130770,"arguments":[],"returnType":{"kind":"simple","type":"EscrowData","optional":false}},
1321
+ {"name":"balance","methodId":104128,"arguments":[],"returnType":{"kind":"simple","type":"int","optional":false,"format":257}},
1322
+ ]
1323
+
1324
+ export const Escrow_getterMapping: { [key: string]: string } = {
1325
+ 'escrowData': 'getEscrowData',
1326
+ 'balance': 'getBalance',
1327
+ }
1328
+
1329
+ const Escrow_receivers: ABIReceiver[] = [
1330
+ {"receiver":"internal","message":{"kind":"typed","type":"Deposit"}},
1331
+ {"receiver":"internal","message":{"kind":"typed","type":"Release"}},
1332
+ {"receiver":"internal","message":{"kind":"typed","type":"Refund"}},
1333
+ {"receiver":"internal","message":{"kind":"typed","type":"Deploy"}},
1334
+ ]
1335
+
1336
+
1337
+ export class Escrow implements Contract {
1338
+
1339
+ public static readonly storageReserve = 0n;
1340
+ public static readonly errors = Escrow_errors_backward;
1341
+ public static readonly opcodes = Escrow_opcodes;
1342
+
1343
+ static async init(depositor: Address, beneficiary: Address, arbiter: Address, deadline: bigint) {
1344
+ return await Escrow_init(depositor, beneficiary, arbiter, deadline);
1345
+ }
1346
+
1347
+ static async fromInit(depositor: Address, beneficiary: Address, arbiter: Address, deadline: bigint) {
1348
+ const __gen_init = await Escrow_init(depositor, beneficiary, arbiter, deadline);
1349
+ const address = contractAddress(0, __gen_init);
1350
+ return new Escrow(address, __gen_init);
1351
+ }
1352
+
1353
+ static fromAddress(address: Address) {
1354
+ return new Escrow(address);
1355
+ }
1356
+
1357
+ readonly address: Address;
1358
+ readonly init?: { code: Cell, data: Cell };
1359
+ readonly abi: ContractABI = {
1360
+ types: Escrow_types,
1361
+ getters: Escrow_getters,
1362
+ receivers: Escrow_receivers,
1363
+ errors: Escrow_errors,
1364
+ };
1365
+
1366
+ constructor(address: Address, init?: { code: Cell, data: Cell }) {
1367
+ this.address = address;
1368
+ this.init = init;
1369
+ }
1370
+
1371
+ async send(provider: ContractProvider, via: Sender, args: { value: bigint, bounce?: boolean| null | undefined }, message: Deposit | Release | Refund | Deploy) {
1372
+
1373
+ let body: Cell | null = null;
1374
+ if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'Deposit') {
1375
+ body = beginCell().store(storeDeposit(message)).endCell();
1376
+ }
1377
+ if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'Release') {
1378
+ body = beginCell().store(storeRelease(message)).endCell();
1379
+ }
1380
+ if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'Refund') {
1381
+ body = beginCell().store(storeRefund(message)).endCell();
1382
+ }
1383
+ if (message && typeof message === 'object' && !(message instanceof Slice) && message.$$type === 'Deploy') {
1384
+ body = beginCell().store(storeDeploy(message)).endCell();
1385
+ }
1386
+ if (body === null) { throw new Error('Invalid message type'); }
1387
+
1388
+ await provider.internal(via, { ...args, body: body });
1389
+
1390
+ }
1391
+
1392
+ async getEscrowData(provider: ContractProvider) {
1393
+ const builder = new TupleBuilder();
1394
+ const source = (await provider.get('escrowData', builder.build())).stack;
1395
+ const result = loadGetterTupleEscrowData(source);
1396
+ return result;
1397
+ }
1398
+
1399
+ async getBalance(provider: ContractProvider) {
1400
+ const builder = new TupleBuilder();
1401
+ const source = (await provider.get('balance', builder.build())).stack;
1402
+ const result = source.readBigNumber();
1403
+ return result;
1404
+ }
1405
+
1406
+ }