@metoncash/sdk-v1 0.2.0 → 0.3.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.
@@ -1,23 +1,65 @@
1
1
  /**
2
- * utils/keys.ts — wallet key generation.
2
+ * utils/keys.ts - wallet key generation.
3
3
  *
4
- * Each wallet has a SPEND key (authorizes spends; bound on-chain by address)
5
- * and a VIEW key derived one-way from it. `viewSk` decrypts incoming notes and
6
- * is safe to share with an auditor — it grants read access, not spend ability.
4
+ * Each wallet has a SPEND secret (the client-side root seed) and a VIEW key
5
+ * derived one-way from it. Only `viewPk` ever reaches the chain (Register,
6
+ * immutable once set); `viewSk` decrypts incoming notes and is safe to share
7
+ * with an auditor - it grants read access, not spend ability. There is no
8
+ * on-chain spend key: spend authority is the owner's TON address, enforced by
9
+ * the Wallet contract's sender check. `spendPk` exists for convenience only and
10
+ * is never registered or checked on-chain.
11
+ *
12
+ * Persist `spendSk` (everything else re-derives from it) and never publish it.
7
13
  */
8
14
  import { Point } from "../jubjub";
15
+ import type { SubgroupWitness, CellRef } from "../wrappers/Minter.gen";
16
+ /** A wallet's full key set. `spendSk` is the root secret; the rest derive from it. */
9
17
  export interface WalletKeys {
18
+ /** SECRET root seed in [1, L); persist it, never share it */
10
19
  spendSk: bigint;
20
+ /** sk_spend * G; not used by the protocol */
11
21
  spendPk: Point;
22
+ /** MiMC(7, spendSk) mod L, one-way from spendSk; shareable for audit */
12
23
  viewSk: bigint;
24
+ /** sk_view * G - registered on-chain, notes are encrypted to this */
13
25
  viewPk: Point;
14
26
  }
15
- /** Generate a fresh wallet keypair (random spend secret + derived view key). */
27
+ /**
28
+ * Generate a fresh wallet keypair (random spend secret + derived view key).
29
+ * The spend secret comes from randomScalar (CSPRNG, never 0), so `viewPk` is
30
+ * always a non-identity prime-order-subgroup point and passes registerWitness.
31
+ */
16
32
  export declare function generateWalletKeys(): WalletKeys;
17
- /** Derive the full key set from an existing spend secret. */
33
+ /**
34
+ * Derive the full key set from an existing spend secret (deterministic, so a
35
+ * wallet can be restored from `spendSk` alone).
36
+ * @param spendSk any integer; a sane seed is in [1, L)
37
+ */
18
38
  export declare function walletKeysFromSpend(spendSk: bigint): WalletKeys;
19
- /** Derive just the viewing keypair (read-only; shareable for audit). */
39
+ /**
40
+ * Derive just the viewing keypair (read-only; shareable for audit). Same
41
+ * derivation as walletKeysFromSpend without computing spendPk.
42
+ */
20
43
  export declare function viewKeyFromSpend(spendSk: bigint): {
21
44
  viewSk: bigint;
22
45
  viewPk: Point;
23
46
  };
47
+ /**
48
+ * The `witness` field of a `Register` message: the cofactor witness the Minter
49
+ * uses to verify `viewPk` is in the Jubjub prime-order subgroup without a
50
+ * scalar multiplication on-chain (Q = [8^-1 mod L]*pk, [2]Q, [4]Q; it checks
51
+ * [8]*Q == pk). Keys from `generateWalletKeys()` always qualify.
52
+ *
53
+ * Why the Minter insists: the transfer circuit requires every receiver key to be
54
+ * a subgroup point, and the registered key is immutable, so a torsion or
55
+ * mixed-order key would make the wallet permanently unable to receive. The
56
+ * Minter checks Q on-curve and q2 == Q (+) Q, q4 == q2 (+) q2, pk == q4 (+) q4
57
+ * with Point.verifySum (Errors.InvalidPoint on failure); the two doublings are
58
+ * shipped in refs because two points do not fit one cell.
59
+ * @param viewPk the key that goes in `Register.publicViewKey` (same message)
60
+ * @returns the `Register.witness` field, ready for the Minter wrapper
61
+ * @throws RangeError if a coordinate is not canonical (< r), the key is the
62
+ * identity, off-curve or not of prime order - the same cases the Minter
63
+ * rejects (requireField / isIdentity / isOnCurve / the doubling chain)
64
+ */
65
+ export declare function registerWitness(viewPk: Point): CellRef<SubgroupWitness>;
@@ -1,28 +1,78 @@
1
1
  "use strict";
2
2
  /**
3
- * utils/keys.ts — wallet key generation.
3
+ * utils/keys.ts - wallet key generation.
4
4
  *
5
- * Each wallet has a SPEND key (authorizes spends; bound on-chain by address)
6
- * and a VIEW key derived one-way from it. `viewSk` decrypts incoming notes and
7
- * is safe to share with an auditor — it grants read access, not spend ability.
5
+ * Each wallet has a SPEND secret (the client-side root seed) and a VIEW key
6
+ * derived one-way from it. Only `viewPk` ever reaches the chain (Register,
7
+ * immutable once set); `viewSk` decrypts incoming notes and is safe to share
8
+ * with an auditor - it grants read access, not spend ability. There is no
9
+ * on-chain spend key: spend authority is the owner's TON address, enforced by
10
+ * the Wallet contract's sender check. `spendPk` exists for convenience only and
11
+ * is never registered or checked on-chain.
12
+ *
13
+ * Persist `spendSk` (everything else re-derives from it) and never publish it.
8
14
  */
9
15
  Object.defineProperty(exports, "__esModule", { value: true });
10
16
  exports.generateWalletKeys = generateWalletKeys;
11
17
  exports.walletKeysFromSpend = walletKeysFromSpend;
12
18
  exports.viewKeyFromSpend = viewKeyFromSpend;
19
+ exports.registerWitness = registerWitness;
13
20
  const jubjub_1 = require("../jubjub");
14
21
  const note_1 = require("../note");
15
- /** Generate a fresh wallet keypair (random spend secret + derived view key). */
22
+ /**
23
+ * Generate a fresh wallet keypair (random spend secret + derived view key).
24
+ * The spend secret comes from randomScalar (CSPRNG, never 0), so `viewPk` is
25
+ * always a non-identity prime-order-subgroup point and passes registerWitness.
26
+ */
16
27
  function generateWalletKeys() {
17
28
  return walletKeysFromSpend((0, jubjub_1.randomScalar)(252));
18
29
  }
19
- /** Derive the full key set from an existing spend secret. */
30
+ /**
31
+ * Derive the full key set from an existing spend secret (deterministic, so a
32
+ * wallet can be restored from `spendSk` alone).
33
+ * @param spendSk any integer; a sane seed is in [1, L)
34
+ */
20
35
  function walletKeysFromSpend(spendSk) {
21
36
  const { skView, pkView } = (0, note_1.deriveViewKey)(spendSk);
22
37
  return { spendSk, spendPk: (0, jubjub_1.derivePub)(spendSk), viewSk: skView, viewPk: pkView };
23
38
  }
24
- /** Derive just the viewing keypair (read-only; shareable for audit). */
39
+ /**
40
+ * Derive just the viewing keypair (read-only; shareable for audit). Same
41
+ * derivation as walletKeysFromSpend without computing spendPk.
42
+ */
25
43
  function viewKeyFromSpend(spendSk) {
26
44
  const { skView, pkView } = (0, note_1.deriveViewKey)(spendSk);
27
45
  return { viewSk: skView, viewPk: pkView };
28
46
  }
47
+ /**
48
+ * The `witness` field of a `Register` message: the cofactor witness the Minter
49
+ * uses to verify `viewPk` is in the Jubjub prime-order subgroup without a
50
+ * scalar multiplication on-chain (Q = [8^-1 mod L]*pk, [2]Q, [4]Q; it checks
51
+ * [8]*Q == pk). Keys from `generateWalletKeys()` always qualify.
52
+ *
53
+ * Why the Minter insists: the transfer circuit requires every receiver key to be
54
+ * a subgroup point, and the registered key is immutable, so a torsion or
55
+ * mixed-order key would make the wallet permanently unable to receive. The
56
+ * Minter checks Q on-curve and q2 == Q (+) Q, q4 == q2 (+) q2, pk == q4 (+) q4
57
+ * with Point.verifySum (Errors.InvalidPoint on failure); the two doublings are
58
+ * shipped in refs because two points do not fit one cell.
59
+ * @param viewPk the key that goes in `Register.publicViewKey` (same message)
60
+ * @returns the `Register.witness` field, ready for the Minter wrapper
61
+ * @throws RangeError if a coordinate is not canonical (< r), the key is the
62
+ * identity, off-curve or not of prime order - the same cases the Minter
63
+ * rejects (requireField / isIdentity / isOnCurve / the doubling chain)
64
+ */
65
+ function registerWitness(viewPk) {
66
+ const [x, y] = viewPk;
67
+ // mirror the contract's checks so a bad key fails here with a clear message
68
+ if (x < 0n || x >= jubjub_1.r || y < 0n || y >= jubjub_1.r)
69
+ throw new RangeError("registerWitness: viewPk coordinates must be canonical (< r)");
70
+ if ((0, jubjub_1.isIdentity)(x, y))
71
+ throw new RangeError("registerWitness: viewPk must not be the identity");
72
+ if (!(0, jubjub_1.isInPrimeSubgroup)(x, y)) {
73
+ throw new RangeError("registerWitness: viewPk is not a Jubjub prime-order-subgroup point");
74
+ }
75
+ const { q, q2, q4 } = (0, jubjub_1.cofactorWitness)(viewPk[0], viewPk[1]);
76
+ const pt = (p) => ({ $: "Point", x: p[0], y: p[1] });
77
+ return { ref: { $: "SubgroupWitness", q: pt(q), q2: { ref: pt(q2) }, q4: { ref: pt(q4) } } };
78
+ }
@@ -1,28 +1,51 @@
1
1
  /**
2
- * utils/note.ts — seal an encrypted note for a recipient.
2
+ * utils/note.ts - seal an encrypted note for a recipient.
3
3
  *
4
4
  * "Signing" a note here means producing the sender-side ECDH-sealed payload
5
- * (R, enc_amount, enc_blind): a fresh ephemeral key R = k·G, with the amount and
6
- * blind masked by a key derived from the ECDH shared secret k·pk_view. Only the
5
+ * (R, enc_amount, enc_blind): a fresh ephemeral key R = k*G, with the amount and
6
+ * blind masked by a key derived from the ECDH shared secret k*pk_view. Only the
7
7
  * holder of the recipient's viewing secret can open it. There is no separate
8
- * signature — authenticity/secrecy come from the ECDH to the recipient's key.
8
+ * signature - authenticity/secrecy come from the ECDH to the recipient's key.
9
9
  */
10
10
  import { Point } from "../jubjub";
11
11
  import { Note } from "../note";
12
- /** Minimal note fields needed to open it (the on-chain payload). */
13
- export type SealedNote = Pick<Note, "Rx" | "Ry" | "enc_amount" | "enc_blind">;
12
+ /** The on-chain note payload (public). Kept as an alias for API stability. */
13
+ export type SealedNote = Note;
14
+ /** Inputs for sealNote. */
14
15
  export interface SealNoteArgs {
16
+ /** the amount being transferred (64-bit) */
15
17
  amount: bigint;
18
+ /** the blinding of the amount commitment the receiver will open (252-bit) */
16
19
  amountBlind: bigint;
20
+ /** recipient's registered pk_view; must be a non-identity subgroup point */
17
21
  receiverViewPk: Point;
18
- /** Ephemeral scalar k. Defaults to fresh randomness — MUST be unique per note. */
22
+ /** Ephemeral scalar k. Defaults to fresh randomness - MUST be unique per note. */
19
23
  ephScalar?: bigint;
20
24
  }
21
- /** Seal (encrypt) a note to the recipient's viewing key. */
22
- export declare function sealNote(args: SealNoteArgs): Note;
25
+ /**
26
+ * Seal (encrypt) a note to the recipient's viewing key.
27
+ *
28
+ * Returns the PUBLIC note (safe to put on-chain) and, separately, the ephemeral
29
+ * scalar that was used - a secret: never publish it, it re-derives the masks.
30
+ *
31
+ * Performs no validation of `receiverViewPk` or a caller-supplied `ephScalar`;
32
+ * `MetonSDK.transfer()` builds the same note with full checks and is the normal
33
+ * path. This helper is for callers that only need the ciphertext (tests,
34
+ * re-encryption, off-line tooling).
35
+ */
36
+ export declare function sealNote(args: SealNoteArgs): {
37
+ note: SealedNote;
38
+ ephScalar: bigint;
39
+ };
23
40
  /**
24
41
  * Open a sealed note with the recipient's viewing secret, recovering the
25
42
  * transferred amount and its blinding.
43
+ *
44
+ * Validates R (non-identity subgroup point, canonical coordinates) before
45
+ * using the secret. Does NOT check the result against the on-chain amount
46
+ * commitment - a wrong key yields garbage silently; use `viewNote` when the
47
+ * commitment is available.
48
+ * @throws Error if the note's R is malformed (see decryptNote)
26
49
  */
27
50
  export declare function openNote(viewSk: bigint, note: SealedNote): {
28
51
  amount: bigint;
@@ -1,26 +1,43 @@
1
1
  "use strict";
2
2
  /**
3
- * utils/note.ts — seal an encrypted note for a recipient.
3
+ * utils/note.ts - seal an encrypted note for a recipient.
4
4
  *
5
5
  * "Signing" a note here means producing the sender-side ECDH-sealed payload
6
- * (R, enc_amount, enc_blind): a fresh ephemeral key R = k·G, with the amount and
7
- * blind masked by a key derived from the ECDH shared secret k·pk_view. Only the
6
+ * (R, enc_amount, enc_blind): a fresh ephemeral key R = k*G, with the amount and
7
+ * blind masked by a key derived from the ECDH shared secret k*pk_view. Only the
8
8
  * holder of the recipient's viewing secret can open it. There is no separate
9
- * signature — authenticity/secrecy come from the ECDH to the recipient's key.
9
+ * signature - authenticity/secrecy come from the ECDH to the recipient's key.
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.sealNote = sealNote;
13
13
  exports.openNote = openNote;
14
14
  const jubjub_1 = require("../jubjub");
15
15
  const note_1 = require("../note");
16
- /** Seal (encrypt) a note to the recipient's viewing key. */
16
+ /**
17
+ * Seal (encrypt) a note to the recipient's viewing key.
18
+ *
19
+ * Returns the PUBLIC note (safe to put on-chain) and, separately, the ephemeral
20
+ * scalar that was used - a secret: never publish it, it re-derives the masks.
21
+ *
22
+ * Performs no validation of `receiverViewPk` or a caller-supplied `ephScalar`;
23
+ * `MetonSDK.transfer()` builds the same note with full checks and is the normal
24
+ * path. This helper is for callers that only need the ciphertext (tests,
25
+ * re-encryption, off-line tooling).
26
+ */
17
27
  function sealNote(args) {
18
28
  const k = args.ephScalar ?? (0, jubjub_1.randomScalar)(252);
19
- return (0, note_1.encryptNote)(args.amount, args.amountBlind, args.receiverViewPk[0], args.receiverViewPk[1], k);
29
+ const note = (0, note_1.encryptNote)(args.amount, args.amountBlind, args.receiverViewPk[0], args.receiverViewPk[1], k);
30
+ return { note, ephScalar: k };
20
31
  }
21
32
  /**
22
33
  * Open a sealed note with the recipient's viewing secret, recovering the
23
34
  * transferred amount and its blinding.
35
+ *
36
+ * Validates R (non-identity subgroup point, canonical coordinates) before
37
+ * using the secret. Does NOT check the result against the on-chain amount
38
+ * commitment - a wrong key yields garbage silently; use `viewNote` when the
39
+ * commitment is available.
40
+ * @throws Error if the note's R is malformed (see decryptNote)
24
41
  */
25
42
  function openNote(viewSk, note) {
26
43
  return (0, note_1.decryptNote)(viewSk, note.Rx, note.Ry, note.enc_amount, note.enc_blind);
@@ -201,22 +201,48 @@ export declare const InternalInitMinter: {
201
201
  store(self: InternalInitMinter, b: c.Builder): void;
202
202
  toCell(self: InternalInitMinter): c.Cell;
203
203
  };
204
+ /**
205
+ > struct SubgroupWitness {
206
+ > q: Point
207
+ > q2: Cell<Point>
208
+ > q4: Cell<Point>
209
+ > }
210
+ */
211
+ export interface SubgroupWitness {
212
+ readonly $: 'SubgroupWitness';
213
+ q: Point;
214
+ q2: CellRef<Point>;
215
+ q4: CellRef<Point>;
216
+ }
217
+ export declare const SubgroupWitness: {
218
+ create(args: {
219
+ q: Point;
220
+ q2: CellRef<Point>;
221
+ q4: CellRef<Point>;
222
+ }): SubgroupWitness;
223
+ fromSlice(s: c.Slice): SubgroupWitness;
224
+ store(self: SubgroupWitness, b: c.Builder): void;
225
+ toCell(self: SubgroupWitness): c.Cell;
226
+ };
204
227
  /**
205
228
  > struct (0xa68f2242) Register {
206
229
  > queryId: uint64
207
230
  > publicViewKey: Point
231
+ > witness: Cell<SubgroupWitness>
208
232
  > }
209
233
  */
210
234
  export interface Register {
211
235
  readonly $: 'Register';
212
236
  queryId: uint64;
213
237
  publicViewKey: Point;
238
+ witness: CellRef<SubgroupWitness>;
214
239
  }
215
240
  export declare const Register: {
216
241
  PREFIX: number;
217
242
  create(args: {
218
243
  queryId: uint64;
219
244
  publicViewKey: Point;
245
+ witness: CellRef<SubgroupWitness>;
220
246
  }): Register;
221
247
  fromSlice(s: c.Slice): Register;
222
248
  store(self: Register, b: c.Builder): void;
@@ -449,6 +475,7 @@ export declare class Minter implements c.Contract {
449
475
  static createCellOfRegister(body: {
450
476
  queryId: uint64;
451
477
  publicViewKey: Point;
478
+ witness: CellRef<SubgroupWitness>;
452
479
  }): c.Cell;
453
480
  static createCellOfInternalWithdraw(body: {
454
481
  queryId: uint64;
@@ -481,6 +508,7 @@ export declare class Minter implements c.Contract {
481
508
  sendRegister(provider: ContractProvider, via: Sender, msgValue: coins, body: {
482
509
  queryId: uint64;
483
510
  publicViewKey: Point;
511
+ witness: CellRef<SubgroupWitness>;
484
512
  }, extraOptions?: ExtraSendOptions): Promise<void>;
485
513
  sendInternalWithdraw(provider: ContractProvider, via: Sender, msgValue: coins, body: {
486
514
  queryId: uint64;
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Minter = exports.Proof = exports.Point = exports.InternalFlipWalletStatus = exports.InternalRegister = exports.InternalDeposit = exports.InternalResetGas = exports.FlipWalletStatus = exports.InternalWithdraw = exports.Register = exports.InternalInitMinter = exports.MinterStorage = exports.MinterStorageAdditionalData = exports.MinterRuntimeStorage = exports.ExcessMessage = exports.JettonTransferNotification = exports.JettonTransfer = void 0;
39
+ exports.Minter = exports.Proof = exports.Point = exports.InternalFlipWalletStatus = exports.InternalRegister = exports.InternalDeposit = exports.InternalResetGas = exports.FlipWalletStatus = exports.InternalWithdraw = exports.Register = exports.SubgroupWitness = exports.InternalInitMinter = exports.MinterStorage = exports.MinterStorageAdditionalData = exports.MinterRuntimeStorage = exports.ExcessMessage = exports.JettonTransferNotification = exports.JettonTransfer = void 0;
40
40
  const c = __importStar(require("@ton/core"));
41
41
  const core_1 = require("@ton/core");
42
42
  function makeCellFrom(self, storeFn_T) {
@@ -344,6 +344,30 @@ exports.InternalInitMinter = {
344
344
  return makeCellFrom(self, exports.InternalInitMinter.store);
345
345
  }
346
346
  };
347
+ exports.SubgroupWitness = {
348
+ create(args) {
349
+ return {
350
+ $: 'SubgroupWitness',
351
+ ...args
352
+ };
353
+ },
354
+ fromSlice(s) {
355
+ return {
356
+ $: 'SubgroupWitness',
357
+ q: exports.Point.fromSlice(s),
358
+ q2: loadCellRef(s, exports.Point.fromSlice),
359
+ q4: loadCellRef(s, exports.Point.fromSlice),
360
+ };
361
+ },
362
+ store(self, b) {
363
+ exports.Point.store(self.q, b);
364
+ storeCellRef(self.q2, b, exports.Point.store);
365
+ storeCellRef(self.q4, b, exports.Point.store);
366
+ },
367
+ toCell(self) {
368
+ return makeCellFrom(self, exports.SubgroupWitness.store);
369
+ }
370
+ };
347
371
  exports.Register = {
348
372
  PREFIX: 0xa68f2242,
349
373
  create(args) {
@@ -358,12 +382,14 @@ exports.Register = {
358
382
  $: 'Register',
359
383
  queryId: s.loadUintBig(64),
360
384
  publicViewKey: exports.Point.fromSlice(s),
385
+ witness: loadCellRef(s, exports.SubgroupWitness.fromSlice),
361
386
  };
362
387
  },
363
388
  store(self, b) {
364
389
  b.storeUint(0xa68f2242, 32);
365
390
  b.storeUint(self.queryId, 64);
366
391
  exports.Point.store(self.publicViewKey, b);
392
+ storeCellRef(self.witness, b, exports.SubgroupWitness.store);
367
393
  },
368
394
  toCell(self) {
369
395
  return makeCellFrom(self, exports.Register.store);
@@ -25,9 +25,23 @@ export declare const ExcessMessage: {
25
25
  store(self: ExcessMessage, b: c.Builder): void;
26
26
  toCell(self: ExcessMessage): c.Cell;
27
27
  };
28
+ /**
29
+ > enum ReceiveMode { 3 variants }
30
+ */
31
+ export type ReceiveMode = bigint;
32
+ export declare const ReceiveMode: {
33
+ FromAnyone: bigint;
34
+ FromNoOne: bigint;
35
+ FromOnly: bigint;
36
+ fromSlice(s: c.Slice): ReceiveMode;
37
+ store(self: ReceiveMode, b: c.Builder): void;
38
+ toCell(self: ReceiveMode): c.Cell;
39
+ };
28
40
  /**
29
41
  > struct WalletRuntimeStorage {
30
42
  > locked: bool
43
+ > receiverMode: ReceiveMode
44
+ > receiverFrom: address?
31
45
  > minter: address
32
46
  > owner: address
33
47
  > seqNo: uint32
@@ -38,6 +52,8 @@ export declare const ExcessMessage: {
38
52
  export interface WalletRuntimeStorage {
39
53
  readonly $: 'WalletRuntimeStorage';
40
54
  locked: boolean;
55
+ receiverMode: ReceiveMode;
56
+ receiverFrom: c.Address | null;
41
57
  minter: c.Address;
42
58
  owner: c.Address;
43
59
  seqNo: uint32;
@@ -47,6 +63,8 @@ export interface WalletRuntimeStorage {
47
63
  export declare const WalletRuntimeStorage: {
48
64
  create(args: {
49
65
  locked: boolean;
66
+ receiverMode: ReceiveMode;
67
+ receiverFrom: c.Address | null;
50
68
  minter: c.Address;
51
69
  owner: c.Address;
52
70
  seqNo: uint32;
@@ -60,6 +78,8 @@ export declare const WalletRuntimeStorage: {
60
78
  /**
61
79
  > struct WalletStorage {
62
80
  > locked: bool
81
+ > receiverMode: ReceiveMode
82
+ > receiverFrom: address?
63
83
  > minter: address
64
84
  > owner: address
65
85
  > seqNo: uint32
@@ -70,6 +90,8 @@ export declare const WalletRuntimeStorage: {
70
90
  export interface WalletStorage {
71
91
  readonly $: 'WalletStorage';
72
92
  locked: boolean;
93
+ receiverMode: ReceiveMode;
94
+ receiverFrom: c.Address | null;
73
95
  minter: c.Address;
74
96
  owner: c.Address;
75
97
  seqNo: uint32;
@@ -79,6 +101,8 @@ export interface WalletStorage {
79
101
  export declare const WalletStorage: {
80
102
  create(args: {
81
103
  locked?: boolean;
104
+ receiverMode?: ReceiveMode;
105
+ receiverFrom?: c.Address | null;
82
106
  minter: c.Address;
83
107
  owner: c.Address;
84
108
  seqNo?: uint32;
@@ -311,6 +335,33 @@ export declare const InitWithdraw: {
311
335
  store(self: InitWithdraw, b: c.Builder): void;
312
336
  toCell(self: InitWithdraw): c.Cell;
313
337
  };
338
+ /**
339
+ > struct (0xd083d476) SetReceiveMode {
340
+ > queryId: uint64
341
+ > mode: ReceiveMode
342
+ > receiverFrom: address?
343
+ > excess: address
344
+ > }
345
+ */
346
+ export interface SetReceiveMode {
347
+ readonly $: 'SetReceiveMode';
348
+ queryId: uint64;
349
+ mode: ReceiveMode;
350
+ receiverFrom: c.Address | null;
351
+ excess: c.Address;
352
+ }
353
+ export declare const SetReceiveMode: {
354
+ PREFIX: number;
355
+ create(args: {
356
+ queryId: uint64;
357
+ mode: ReceiveMode;
358
+ receiverFrom: c.Address | null;
359
+ excess: c.Address;
360
+ }): SetReceiveMode;
361
+ fromSlice(s: c.Slice): SetReceiveMode;
362
+ store(self: SetReceiveMode, b: c.Builder): void;
363
+ toCell(self: SetReceiveMode): c.Cell;
364
+ };
314
365
  /**
315
366
  > struct (0xdde0f974) InternalRegister {
316
367
  > queryId: uint64
@@ -472,10 +523,12 @@ export declare class Wallet implements c.Contract {
472
523
  'Errors.InvalidProof': number;
473
524
  'Errors.InvalidAmount': number;
474
525
  'Errors.AlreadyInitialized': number;
526
+ 'Errors.ReceiveDisabled': number;
475
527
  'Errors.NotAlreadyInitialized': number;
476
528
  'Errors.NotEnoughGas': number;
477
529
  'Errors.InvalidPoint': number;
478
530
  'Errors.InvalidWorkchain': number;
531
+ 'Errors.InvalidReceiveMode': number;
479
532
  'Errors.WrongSender': number;
480
533
  'Errors.PositionLocked': number;
481
534
  'Errors.WrongOp': number;
@@ -533,6 +586,12 @@ export declare class Wallet implements c.Contract {
533
586
  queryId: uint64;
534
587
  excess: c.Address;
535
588
  }): c.Cell;
589
+ static createCellOfSetReceiveMode(body: {
590
+ queryId: uint64;
591
+ mode: ReceiveMode;
592
+ receiverFrom: c.Address | null;
593
+ excess: c.Address;
594
+ }): c.Cell;
536
595
  sendDeploy(provider: ContractProvider, via: Sender, msgValue: coins, extraOptions?: ExtraSendOptions): Promise<void>;
537
596
  sendInternalDeposit(provider: ContractProvider, via: Sender, msgValue: coins, body: {
538
597
  queryId: uint64;
@@ -577,6 +636,12 @@ export declare class Wallet implements c.Contract {
577
636
  queryId: uint64;
578
637
  excess: c.Address;
579
638
  }, extraOptions?: ExtraSendOptions): Promise<void>;
639
+ sendSetReceiveMode(provider: ContractProvider, via: Sender, msgValue: coins, body: {
640
+ queryId: uint64;
641
+ mode: ReceiveMode;
642
+ receiverFrom: c.Address | null;
643
+ excess: c.Address;
644
+ }, extraOptions?: ExtraSendOptions): Promise<void>;
580
645
  getWalletState(provider: ContractProvider): Promise<WalletRuntimeStorage>;
581
646
  getWalletData(provider: ContractProvider): Promise<[
582
647
  bigint,