@metoncash/sdk-v1 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +128 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +41 -0
- package/dist/jubjub.d.ts +25 -0
- package/dist/jubjub.js +121 -0
- package/dist/mimc.d.ts +4 -0
- package/dist/mimc.js +21 -0
- package/dist/note.d.ts +38 -0
- package/dist/note.js +55 -0
- package/dist/prover.d.ts +79 -0
- package/dist/prover.js +144 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/keys.d.ts +23 -0
- package/dist/utils/keys.js +28 -0
- package/dist/utils/note.d.ts +30 -0
- package/dist/utils/note.js +27 -0
- package/dist/wrappers/Account.gen.d.ts +542 -0
- package/dist/wrappers/Account.gen.js +677 -0
- package/dist/wrappers/Factory.gen.d.ts +265 -0
- package/dist/wrappers/Factory.gen.js +401 -0
- package/dist/wrappers/JettonMinter.gen.d.ts +288 -0
- package/dist/wrappers/JettonMinter.gen.js +432 -0
- package/dist/wrappers/JettonWallet.gen.d.ts +308 -0
- package/dist/wrappers/JettonWallet.gen.js +429 -0
- package/dist/wrappers/Minter.gen.d.ts +511 -0
- package/dist/wrappers/Minter.gen.js +700 -0
- package/dist/wrappers/Wallet.gen.d.ts +588 -0
- package/dist/wrappers/Wallet.gen.js +720 -0
- package/dist/wrappers/index.d.ts +15 -0
- package/dist/wrappers/index.js +21 -0
- package/package.json +26 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import * as c from '@ton/core';
|
|
2
|
+
import { ContractProvider, Sender, SendMode } from '@ton/core';
|
|
3
|
+
type RemainingBitsAndRefs = c.Slice;
|
|
4
|
+
export type CellRef<T> = {
|
|
5
|
+
ref: T;
|
|
6
|
+
};
|
|
7
|
+
type coins = bigint;
|
|
8
|
+
type uint64 = bigint;
|
|
9
|
+
/**
|
|
10
|
+
> struct JettonMinterStorage {
|
|
11
|
+
> totalSupply: coins
|
|
12
|
+
> admin: address
|
|
13
|
+
> content: cell
|
|
14
|
+
> walletCode: cell
|
|
15
|
+
> }
|
|
16
|
+
*/
|
|
17
|
+
export interface JettonMinterStorage {
|
|
18
|
+
readonly $: 'JettonMinterStorage';
|
|
19
|
+
totalSupply: coins;
|
|
20
|
+
admin: c.Address;
|
|
21
|
+
content: c.Cell;
|
|
22
|
+
walletCode: c.Cell;
|
|
23
|
+
}
|
|
24
|
+
export declare const JettonMinterStorage: {
|
|
25
|
+
create(args: {
|
|
26
|
+
totalSupply?: coins;
|
|
27
|
+
admin: c.Address;
|
|
28
|
+
content: c.Cell;
|
|
29
|
+
walletCode: c.Cell;
|
|
30
|
+
}): JettonMinterStorage;
|
|
31
|
+
fromSlice(s: c.Slice): JettonMinterStorage;
|
|
32
|
+
store(self: JettonMinterStorage, b: c.Builder): void;
|
|
33
|
+
toCell(self: JettonMinterStorage): c.Cell;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
> struct JettonMinterStorageRuntime {
|
|
37
|
+
> totalSupply: coins
|
|
38
|
+
> admin: address
|
|
39
|
+
> content: cell
|
|
40
|
+
> walletCode: cell
|
|
41
|
+
> }
|
|
42
|
+
*/
|
|
43
|
+
export interface JettonMinterStorageRuntime {
|
|
44
|
+
readonly $: 'JettonMinterStorageRuntime';
|
|
45
|
+
totalSupply: coins;
|
|
46
|
+
admin: c.Address;
|
|
47
|
+
content: c.Cell;
|
|
48
|
+
walletCode: c.Cell;
|
|
49
|
+
}
|
|
50
|
+
export declare const JettonMinterStorageRuntime: {
|
|
51
|
+
create(args: {
|
|
52
|
+
totalSupply: coins;
|
|
53
|
+
admin: c.Address;
|
|
54
|
+
content: c.Cell;
|
|
55
|
+
walletCode: c.Cell;
|
|
56
|
+
}): JettonMinterStorageRuntime;
|
|
57
|
+
fromSlice(s: c.Slice): JettonMinterStorageRuntime;
|
|
58
|
+
store(self: JettonMinterStorageRuntime, b: c.Builder): void;
|
|
59
|
+
toCell(self: JettonMinterStorageRuntime): c.Cell;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
> struct (0x642b7d07) JettonMintMessage {
|
|
63
|
+
> queryId: uint64
|
|
64
|
+
> toAddress: address
|
|
65
|
+
> jettonAmount: coins
|
|
66
|
+
> forwardTonAmount: coins
|
|
67
|
+
> }
|
|
68
|
+
*/
|
|
69
|
+
export interface JettonMintMessage {
|
|
70
|
+
readonly $: 'JettonMintMessage';
|
|
71
|
+
queryId: uint64;
|
|
72
|
+
toAddress: c.Address;
|
|
73
|
+
jettonAmount: coins;
|
|
74
|
+
forwardTonAmount: coins;
|
|
75
|
+
}
|
|
76
|
+
export declare const JettonMintMessage: {
|
|
77
|
+
PREFIX: number;
|
|
78
|
+
create(args: {
|
|
79
|
+
queryId: uint64;
|
|
80
|
+
toAddress: c.Address;
|
|
81
|
+
jettonAmount: coins;
|
|
82
|
+
forwardTonAmount: coins;
|
|
83
|
+
}): JettonMintMessage;
|
|
84
|
+
fromSlice(s: c.Slice): JettonMintMessage;
|
|
85
|
+
store(self: JettonMintMessage, b: c.Builder): void;
|
|
86
|
+
toCell(self: JettonMintMessage): c.Cell;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
> struct (0x178d4519) JettonInternalTransfer {
|
|
90
|
+
> queryId: uint64
|
|
91
|
+
> jettonAmount: coins
|
|
92
|
+
> transferInitiator: address
|
|
93
|
+
> sendExcessesTo: address?
|
|
94
|
+
> forwardTonAmount: coins
|
|
95
|
+
> forwardPayload: RemainingBitsAndRefs
|
|
96
|
+
> }
|
|
97
|
+
*/
|
|
98
|
+
export interface JettonInternalTransfer {
|
|
99
|
+
readonly $: 'JettonInternalTransfer';
|
|
100
|
+
queryId: uint64;
|
|
101
|
+
jettonAmount: coins;
|
|
102
|
+
transferInitiator: c.Address;
|
|
103
|
+
sendExcessesTo: c.Address | null;
|
|
104
|
+
forwardTonAmount: coins;
|
|
105
|
+
forwardPayload: RemainingBitsAndRefs;
|
|
106
|
+
}
|
|
107
|
+
export declare const JettonInternalTransfer: {
|
|
108
|
+
PREFIX: number;
|
|
109
|
+
create(args: {
|
|
110
|
+
queryId: uint64;
|
|
111
|
+
jettonAmount: coins;
|
|
112
|
+
transferInitiator: c.Address;
|
|
113
|
+
sendExcessesTo: c.Address | null;
|
|
114
|
+
forwardTonAmount: coins;
|
|
115
|
+
forwardPayload: RemainingBitsAndRefs;
|
|
116
|
+
}): JettonInternalTransfer;
|
|
117
|
+
fromSlice(s: c.Slice): JettonInternalTransfer;
|
|
118
|
+
store(self: JettonInternalTransfer, b: c.Builder): void;
|
|
119
|
+
toCell(self: JettonInternalTransfer): c.Cell;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
> struct (0xd53276db) JettonExcesses {
|
|
123
|
+
> queryId: uint64
|
|
124
|
+
> }
|
|
125
|
+
*/
|
|
126
|
+
export interface JettonExcesses {
|
|
127
|
+
readonly $: 'JettonExcesses';
|
|
128
|
+
queryId: uint64;
|
|
129
|
+
}
|
|
130
|
+
export declare const JettonExcesses: {
|
|
131
|
+
PREFIX: number;
|
|
132
|
+
create(args: {
|
|
133
|
+
queryId: uint64;
|
|
134
|
+
}): JettonExcesses;
|
|
135
|
+
fromSlice(s: c.Slice): JettonExcesses;
|
|
136
|
+
store(self: JettonExcesses, b: c.Builder): void;
|
|
137
|
+
toCell(self: JettonExcesses): c.Cell;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
> struct (0x7bdd97de) JettonBurnNotification {
|
|
141
|
+
> queryId: uint64
|
|
142
|
+
> jettonAmount: coins
|
|
143
|
+
> burnInitiator: address
|
|
144
|
+
> sendExcessesTo: address?
|
|
145
|
+
> }
|
|
146
|
+
*/
|
|
147
|
+
export interface JettonBurnNotification {
|
|
148
|
+
readonly $: 'JettonBurnNotification';
|
|
149
|
+
queryId: uint64;
|
|
150
|
+
jettonAmount: coins;
|
|
151
|
+
burnInitiator: c.Address;
|
|
152
|
+
sendExcessesTo: c.Address | null;
|
|
153
|
+
}
|
|
154
|
+
export declare const JettonBurnNotification: {
|
|
155
|
+
PREFIX: number;
|
|
156
|
+
create(args: {
|
|
157
|
+
queryId: uint64;
|
|
158
|
+
jettonAmount: coins;
|
|
159
|
+
burnInitiator: c.Address;
|
|
160
|
+
sendExcessesTo: c.Address | null;
|
|
161
|
+
}): JettonBurnNotification;
|
|
162
|
+
fromSlice(s: c.Slice): JettonBurnNotification;
|
|
163
|
+
store(self: JettonBurnNotification, b: c.Builder): void;
|
|
164
|
+
toCell(self: JettonBurnNotification): c.Cell;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
> struct (0x2c76b973) JettonProvideWalletAddress {
|
|
168
|
+
> queryId: uint64
|
|
169
|
+
> ownerAddress: address
|
|
170
|
+
> includeOwnerAddress: bool
|
|
171
|
+
> }
|
|
172
|
+
*/
|
|
173
|
+
export interface JettonProvideWalletAddress {
|
|
174
|
+
readonly $: 'JettonProvideWalletAddress';
|
|
175
|
+
queryId: uint64;
|
|
176
|
+
ownerAddress: c.Address;
|
|
177
|
+
includeOwnerAddress: boolean;
|
|
178
|
+
}
|
|
179
|
+
export declare const JettonProvideWalletAddress: {
|
|
180
|
+
PREFIX: number;
|
|
181
|
+
create(args: {
|
|
182
|
+
queryId: uint64;
|
|
183
|
+
ownerAddress: c.Address;
|
|
184
|
+
includeOwnerAddress: boolean;
|
|
185
|
+
}): JettonProvideWalletAddress;
|
|
186
|
+
fromSlice(s: c.Slice): JettonProvideWalletAddress;
|
|
187
|
+
store(self: JettonProvideWalletAddress, b: c.Builder): void;
|
|
188
|
+
toCell(self: JettonProvideWalletAddress): c.Cell;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
> struct (0xd1735400) TakeWalletAddress {
|
|
192
|
+
> queryId: uint64
|
|
193
|
+
> jettonWalletAddress: address
|
|
194
|
+
> ownerAddress: Cell<address>?
|
|
195
|
+
> }
|
|
196
|
+
*/
|
|
197
|
+
export interface TakeWalletAddress {
|
|
198
|
+
readonly $: 'TakeWalletAddress';
|
|
199
|
+
queryId: uint64;
|
|
200
|
+
jettonWalletAddress: c.Address;
|
|
201
|
+
ownerAddress: CellRef<c.Address> | null;
|
|
202
|
+
}
|
|
203
|
+
export declare const TakeWalletAddress: {
|
|
204
|
+
PREFIX: number;
|
|
205
|
+
create(args: {
|
|
206
|
+
queryId: uint64;
|
|
207
|
+
jettonWalletAddress: c.Address;
|
|
208
|
+
ownerAddress: CellRef<c.Address> | null;
|
|
209
|
+
}): TakeWalletAddress;
|
|
210
|
+
fromSlice(s: c.Slice): TakeWalletAddress;
|
|
211
|
+
store(self: TakeWalletAddress, b: c.Builder): void;
|
|
212
|
+
toCell(self: TakeWalletAddress): c.Cell;
|
|
213
|
+
};
|
|
214
|
+
interface ExtraSendOptions {
|
|
215
|
+
bounce?: boolean;
|
|
216
|
+
sendMode?: SendMode;
|
|
217
|
+
extraCurrencies?: c.ExtraCurrency;
|
|
218
|
+
}
|
|
219
|
+
interface DeployedAddrOptions {
|
|
220
|
+
workchain?: number;
|
|
221
|
+
toShard?: {
|
|
222
|
+
fixedPrefixLength: number;
|
|
223
|
+
closeTo: c.Address;
|
|
224
|
+
};
|
|
225
|
+
overrideContractCode?: c.Cell;
|
|
226
|
+
}
|
|
227
|
+
export declare class JettonMinter implements c.Contract {
|
|
228
|
+
static Errors: {
|
|
229
|
+
ERR_NOT_ADMIN: number;
|
|
230
|
+
ERR_NOT_FROM_WALLET: number;
|
|
231
|
+
'Errors.InvalidWorkchain': number;
|
|
232
|
+
};
|
|
233
|
+
readonly address: c.Address;
|
|
234
|
+
readonly init: {
|
|
235
|
+
code: c.Cell;
|
|
236
|
+
data: c.Cell;
|
|
237
|
+
} | undefined;
|
|
238
|
+
protected constructor(address: c.Address, init?: {
|
|
239
|
+
code: c.Cell;
|
|
240
|
+
data: c.Cell;
|
|
241
|
+
});
|
|
242
|
+
static fromAddress(address: c.Address): JettonMinter;
|
|
243
|
+
static createCellOfJettonMintMessage(body: {
|
|
244
|
+
queryId: uint64;
|
|
245
|
+
toAddress: c.Address;
|
|
246
|
+
jettonAmount: coins;
|
|
247
|
+
forwardTonAmount: coins;
|
|
248
|
+
}): c.Cell;
|
|
249
|
+
static createCellOfJettonBurnNotification(body: {
|
|
250
|
+
queryId: uint64;
|
|
251
|
+
jettonAmount: coins;
|
|
252
|
+
burnInitiator: c.Address;
|
|
253
|
+
sendExcessesTo: c.Address | null;
|
|
254
|
+
}): c.Cell;
|
|
255
|
+
static createCellOfJettonProvideWalletAddress(body: {
|
|
256
|
+
queryId: uint64;
|
|
257
|
+
ownerAddress: c.Address;
|
|
258
|
+
includeOwnerAddress: boolean;
|
|
259
|
+
}): c.Cell;
|
|
260
|
+
sendDeploy(provider: ContractProvider, via: Sender, msgValue: coins, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
261
|
+
sendJettonMintMessage(provider: ContractProvider, via: Sender, msgValue: coins, body: {
|
|
262
|
+
queryId: uint64;
|
|
263
|
+
toAddress: c.Address;
|
|
264
|
+
jettonAmount: coins;
|
|
265
|
+
forwardTonAmount: coins;
|
|
266
|
+
}, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
267
|
+
sendJettonBurnNotification(provider: ContractProvider, via: Sender, msgValue: coins, body: {
|
|
268
|
+
queryId: uint64;
|
|
269
|
+
jettonAmount: coins;
|
|
270
|
+
burnInitiator: c.Address;
|
|
271
|
+
sendExcessesTo: c.Address | null;
|
|
272
|
+
}, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
273
|
+
sendJettonProvideWalletAddress(provider: ContractProvider, via: Sender, msgValue: coins, body: {
|
|
274
|
+
queryId: uint64;
|
|
275
|
+
ownerAddress: c.Address;
|
|
276
|
+
includeOwnerAddress: boolean;
|
|
277
|
+
}, extraOptions?: ExtraSendOptions): Promise<void>;
|
|
278
|
+
getMinterStorage(provider: ContractProvider): Promise<JettonMinterStorageRuntime>;
|
|
279
|
+
getJettonData(provider: ContractProvider): Promise<[
|
|
280
|
+
coins,
|
|
281
|
+
bigint,
|
|
282
|
+
c.Address,
|
|
283
|
+
c.Cell,
|
|
284
|
+
c.Cell
|
|
285
|
+
]>;
|
|
286
|
+
getWalletAddress(provider: ContractProvider, ownerAddress: c.Address): Promise<c.Address>;
|
|
287
|
+
}
|
|
288
|
+
export {};
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// AUTO-GENERATED, do not edit
|
|
3
|
+
// It's a TypeScript wrapper for a JettonMinter contract in Tolk.
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.JettonMinter = exports.TakeWalletAddress = exports.JettonProvideWalletAddress = exports.JettonBurnNotification = exports.JettonExcesses = exports.JettonInternalTransfer = exports.JettonMintMessage = exports.JettonMinterStorageRuntime = exports.JettonMinterStorage = void 0;
|
|
40
|
+
const c = __importStar(require("@ton/core"));
|
|
41
|
+
const core_1 = require("@ton/core");
|
|
42
|
+
function makeCellFrom(self, storeFn_T) {
|
|
43
|
+
let b = (0, core_1.beginCell)();
|
|
44
|
+
storeFn_T(self, b);
|
|
45
|
+
return b.endCell();
|
|
46
|
+
}
|
|
47
|
+
function loadAndCheckPrefix32(s, expected, structName) {
|
|
48
|
+
let prefix = s.loadUint(32);
|
|
49
|
+
if (prefix !== expected) {
|
|
50
|
+
throw new Error(`Incorrect prefix for '${structName}': expected 0x${expected.toString(16).padStart(8, '0')}, got 0x${prefix.toString(16).padStart(8, '0')}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function lookupPrefix(s, expected, prefixLen) {
|
|
54
|
+
return s.remainingBits >= prefixLen && s.preloadUint(prefixLen) === expected;
|
|
55
|
+
}
|
|
56
|
+
function throwNonePrefixMatch(fieldPath) {
|
|
57
|
+
throw new Error(`Incorrect prefix for '${fieldPath}': none of variants matched`);
|
|
58
|
+
}
|
|
59
|
+
function storeCellRef(cell, b, storeFn_T) {
|
|
60
|
+
let b_ref = c.beginCell();
|
|
61
|
+
storeFn_T(cell.ref, b_ref);
|
|
62
|
+
b.storeRef(b_ref.endCell());
|
|
63
|
+
}
|
|
64
|
+
function loadCellRef(s, loadFn_T) {
|
|
65
|
+
let s_ref = s.loadRef().beginParse();
|
|
66
|
+
return { ref: loadFn_T(s_ref) };
|
|
67
|
+
}
|
|
68
|
+
function storeTolkRemaining(v, b) {
|
|
69
|
+
b.storeSlice(v);
|
|
70
|
+
}
|
|
71
|
+
function loadTolkRemaining(s) {
|
|
72
|
+
let rest = s.clone();
|
|
73
|
+
s.loadBits(s.remainingBits);
|
|
74
|
+
while (s.remainingRefs) {
|
|
75
|
+
s.loadRef();
|
|
76
|
+
}
|
|
77
|
+
return rest;
|
|
78
|
+
}
|
|
79
|
+
function storeTolkNullable(v, b, storeFn_T) {
|
|
80
|
+
if (v === null) {
|
|
81
|
+
b.storeUint(0, 1);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
b.storeUint(1, 1);
|
|
85
|
+
storeFn_T(v, b);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// ————————————————————————————————————————————
|
|
89
|
+
// parse get methods result from a TVM stack
|
|
90
|
+
//
|
|
91
|
+
class StackReader {
|
|
92
|
+
constructor(tuple) {
|
|
93
|
+
this.tuple = tuple;
|
|
94
|
+
}
|
|
95
|
+
static fromGetMethod(expectedN, getMethodResult) {
|
|
96
|
+
let tuple = [];
|
|
97
|
+
while (getMethodResult.stack.remaining) {
|
|
98
|
+
tuple.push(getMethodResult.stack.pop());
|
|
99
|
+
}
|
|
100
|
+
if (tuple.length !== expectedN) {
|
|
101
|
+
throw new Error(`expected ${expectedN} stack width, got ${tuple.length}`);
|
|
102
|
+
}
|
|
103
|
+
return new StackReader(tuple);
|
|
104
|
+
}
|
|
105
|
+
popExpecting(itemType) {
|
|
106
|
+
const item = this.tuple.shift();
|
|
107
|
+
if (item?.type === itemType) {
|
|
108
|
+
return item;
|
|
109
|
+
}
|
|
110
|
+
throw new Error(`not '${itemType}' on a stack`);
|
|
111
|
+
}
|
|
112
|
+
popCellLike() {
|
|
113
|
+
const item = this.tuple.shift();
|
|
114
|
+
if (item && (item.type === 'cell' || item.type === 'slice' || item.type === 'builder')) {
|
|
115
|
+
return item.cell;
|
|
116
|
+
}
|
|
117
|
+
throw new Error(`not cell/slice on a stack`);
|
|
118
|
+
}
|
|
119
|
+
readBigInt() {
|
|
120
|
+
return this.popExpecting('int').value;
|
|
121
|
+
}
|
|
122
|
+
readBoolean() {
|
|
123
|
+
return this.popExpecting('int').value !== 0n;
|
|
124
|
+
}
|
|
125
|
+
readCell() {
|
|
126
|
+
return this.popCellLike();
|
|
127
|
+
}
|
|
128
|
+
readSlice() {
|
|
129
|
+
return this.popCellLike().beginParse();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.JettonMinterStorage = {
|
|
133
|
+
create(args) {
|
|
134
|
+
return {
|
|
135
|
+
$: 'JettonMinterStorage',
|
|
136
|
+
totalSupply: 0n,
|
|
137
|
+
...args
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
fromSlice(s) {
|
|
141
|
+
return {
|
|
142
|
+
$: 'JettonMinterStorage',
|
|
143
|
+
totalSupply: s.loadCoins(),
|
|
144
|
+
admin: s.loadAddress(),
|
|
145
|
+
content: s.loadRef(),
|
|
146
|
+
walletCode: s.loadRef(),
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
store(self, b) {
|
|
150
|
+
b.storeCoins(self.totalSupply);
|
|
151
|
+
b.storeAddress(self.admin);
|
|
152
|
+
b.storeRef(self.content);
|
|
153
|
+
b.storeRef(self.walletCode);
|
|
154
|
+
},
|
|
155
|
+
toCell(self) {
|
|
156
|
+
return makeCellFrom(self, exports.JettonMinterStorage.store);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
exports.JettonMinterStorageRuntime = {
|
|
160
|
+
create(args) {
|
|
161
|
+
return {
|
|
162
|
+
$: 'JettonMinterStorageRuntime',
|
|
163
|
+
...args
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
fromSlice(s) {
|
|
167
|
+
return {
|
|
168
|
+
$: 'JettonMinterStorageRuntime',
|
|
169
|
+
totalSupply: s.loadCoins(),
|
|
170
|
+
admin: s.loadAddress(),
|
|
171
|
+
content: s.loadRef(),
|
|
172
|
+
walletCode: s.loadRef(),
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
|
+
store(self, b) {
|
|
176
|
+
b.storeCoins(self.totalSupply);
|
|
177
|
+
b.storeAddress(self.admin);
|
|
178
|
+
b.storeRef(self.content);
|
|
179
|
+
b.storeRef(self.walletCode);
|
|
180
|
+
},
|
|
181
|
+
toCell(self) {
|
|
182
|
+
return makeCellFrom(self, exports.JettonMinterStorageRuntime.store);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
exports.JettonMintMessage = {
|
|
186
|
+
PREFIX: 0x642b7d07,
|
|
187
|
+
create(args) {
|
|
188
|
+
return {
|
|
189
|
+
$: 'JettonMintMessage',
|
|
190
|
+
...args
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
fromSlice(s) {
|
|
194
|
+
loadAndCheckPrefix32(s, 0x642b7d07, 'JettonMintMessage');
|
|
195
|
+
return {
|
|
196
|
+
$: 'JettonMintMessage',
|
|
197
|
+
queryId: s.loadUintBig(64),
|
|
198
|
+
toAddress: s.loadAddress(),
|
|
199
|
+
jettonAmount: s.loadCoins(),
|
|
200
|
+
forwardTonAmount: s.loadCoins(),
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
store(self, b) {
|
|
204
|
+
b.storeUint(0x642b7d07, 32);
|
|
205
|
+
b.storeUint(self.queryId, 64);
|
|
206
|
+
b.storeAddress(self.toAddress);
|
|
207
|
+
b.storeCoins(self.jettonAmount);
|
|
208
|
+
b.storeCoins(self.forwardTonAmount);
|
|
209
|
+
},
|
|
210
|
+
toCell(self) {
|
|
211
|
+
return makeCellFrom(self, exports.JettonMintMessage.store);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
exports.JettonInternalTransfer = {
|
|
215
|
+
PREFIX: 0x178d4519,
|
|
216
|
+
create(args) {
|
|
217
|
+
return {
|
|
218
|
+
$: 'JettonInternalTransfer',
|
|
219
|
+
...args
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
fromSlice(s) {
|
|
223
|
+
loadAndCheckPrefix32(s, 0x178d4519, 'JettonInternalTransfer');
|
|
224
|
+
return {
|
|
225
|
+
$: 'JettonInternalTransfer',
|
|
226
|
+
queryId: s.loadUintBig(64),
|
|
227
|
+
jettonAmount: s.loadCoins(),
|
|
228
|
+
transferInitiator: s.loadAddress(),
|
|
229
|
+
sendExcessesTo: s.loadMaybeAddress(),
|
|
230
|
+
forwardTonAmount: s.loadCoins(),
|
|
231
|
+
forwardPayload: loadTolkRemaining(s),
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
store(self, b) {
|
|
235
|
+
b.storeUint(0x178d4519, 32);
|
|
236
|
+
b.storeUint(self.queryId, 64);
|
|
237
|
+
b.storeCoins(self.jettonAmount);
|
|
238
|
+
b.storeAddress(self.transferInitiator);
|
|
239
|
+
b.storeAddress(self.sendExcessesTo);
|
|
240
|
+
b.storeCoins(self.forwardTonAmount);
|
|
241
|
+
storeTolkRemaining(self.forwardPayload, b);
|
|
242
|
+
},
|
|
243
|
+
toCell(self) {
|
|
244
|
+
return makeCellFrom(self, exports.JettonInternalTransfer.store);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
exports.JettonExcesses = {
|
|
248
|
+
PREFIX: 0xd53276db,
|
|
249
|
+
create(args) {
|
|
250
|
+
return {
|
|
251
|
+
$: 'JettonExcesses',
|
|
252
|
+
...args
|
|
253
|
+
};
|
|
254
|
+
},
|
|
255
|
+
fromSlice(s) {
|
|
256
|
+
loadAndCheckPrefix32(s, 0xd53276db, 'JettonExcesses');
|
|
257
|
+
return {
|
|
258
|
+
$: 'JettonExcesses',
|
|
259
|
+
queryId: s.loadUintBig(64),
|
|
260
|
+
};
|
|
261
|
+
},
|
|
262
|
+
store(self, b) {
|
|
263
|
+
b.storeUint(0xd53276db, 32);
|
|
264
|
+
b.storeUint(self.queryId, 64);
|
|
265
|
+
},
|
|
266
|
+
toCell(self) {
|
|
267
|
+
return makeCellFrom(self, exports.JettonExcesses.store);
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
exports.JettonBurnNotification = {
|
|
271
|
+
PREFIX: 0x7bdd97de,
|
|
272
|
+
create(args) {
|
|
273
|
+
return {
|
|
274
|
+
$: 'JettonBurnNotification',
|
|
275
|
+
...args
|
|
276
|
+
};
|
|
277
|
+
},
|
|
278
|
+
fromSlice(s) {
|
|
279
|
+
loadAndCheckPrefix32(s, 0x7bdd97de, 'JettonBurnNotification');
|
|
280
|
+
return {
|
|
281
|
+
$: 'JettonBurnNotification',
|
|
282
|
+
queryId: s.loadUintBig(64),
|
|
283
|
+
jettonAmount: s.loadCoins(),
|
|
284
|
+
burnInitiator: s.loadAddress(),
|
|
285
|
+
sendExcessesTo: s.loadMaybeAddress(),
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
store(self, b) {
|
|
289
|
+
b.storeUint(0x7bdd97de, 32);
|
|
290
|
+
b.storeUint(self.queryId, 64);
|
|
291
|
+
b.storeCoins(self.jettonAmount);
|
|
292
|
+
b.storeAddress(self.burnInitiator);
|
|
293
|
+
b.storeAddress(self.sendExcessesTo);
|
|
294
|
+
},
|
|
295
|
+
toCell(self) {
|
|
296
|
+
return makeCellFrom(self, exports.JettonBurnNotification.store);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
exports.JettonProvideWalletAddress = {
|
|
300
|
+
PREFIX: 0x2c76b973,
|
|
301
|
+
create(args) {
|
|
302
|
+
return {
|
|
303
|
+
$: 'JettonProvideWalletAddress',
|
|
304
|
+
...args
|
|
305
|
+
};
|
|
306
|
+
},
|
|
307
|
+
fromSlice(s) {
|
|
308
|
+
loadAndCheckPrefix32(s, 0x2c76b973, 'JettonProvideWalletAddress');
|
|
309
|
+
return {
|
|
310
|
+
$: 'JettonProvideWalletAddress',
|
|
311
|
+
queryId: s.loadUintBig(64),
|
|
312
|
+
ownerAddress: s.loadAddress(),
|
|
313
|
+
includeOwnerAddress: s.loadBoolean(),
|
|
314
|
+
};
|
|
315
|
+
},
|
|
316
|
+
store(self, b) {
|
|
317
|
+
b.storeUint(0x2c76b973, 32);
|
|
318
|
+
b.storeUint(self.queryId, 64);
|
|
319
|
+
b.storeAddress(self.ownerAddress);
|
|
320
|
+
b.storeBit(self.includeOwnerAddress);
|
|
321
|
+
},
|
|
322
|
+
toCell(self) {
|
|
323
|
+
return makeCellFrom(self, exports.JettonProvideWalletAddress.store);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
exports.TakeWalletAddress = {
|
|
327
|
+
PREFIX: 0xd1735400,
|
|
328
|
+
create(args) {
|
|
329
|
+
return {
|
|
330
|
+
$: 'TakeWalletAddress',
|
|
331
|
+
...args
|
|
332
|
+
};
|
|
333
|
+
},
|
|
334
|
+
fromSlice(s) {
|
|
335
|
+
loadAndCheckPrefix32(s, 0xd1735400, 'TakeWalletAddress');
|
|
336
|
+
return {
|
|
337
|
+
$: 'TakeWalletAddress',
|
|
338
|
+
queryId: s.loadUintBig(64),
|
|
339
|
+
jettonWalletAddress: s.loadAddress(),
|
|
340
|
+
ownerAddress: s.loadBoolean() ? loadCellRef(s, (s) => s.loadAddress()) : null,
|
|
341
|
+
};
|
|
342
|
+
},
|
|
343
|
+
store(self, b) {
|
|
344
|
+
b.storeUint(0xd1735400, 32);
|
|
345
|
+
b.storeUint(self.queryId, 64);
|
|
346
|
+
b.storeAddress(self.jettonWalletAddress);
|
|
347
|
+
storeTolkNullable(self.ownerAddress, b, (v, b) => {
|
|
348
|
+
storeCellRef(v, b, (v, b) => b.storeAddress(v));
|
|
349
|
+
});
|
|
350
|
+
},
|
|
351
|
+
toCell(self) {
|
|
352
|
+
return makeCellFrom(self, exports.TakeWalletAddress.store);
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
class JettonMinter {
|
|
356
|
+
constructor(address, init) {
|
|
357
|
+
this.address = address;
|
|
358
|
+
this.init = init;
|
|
359
|
+
}
|
|
360
|
+
static fromAddress(address) {
|
|
361
|
+
return new JettonMinter(address);
|
|
362
|
+
}
|
|
363
|
+
static createCellOfJettonMintMessage(body) {
|
|
364
|
+
return exports.JettonMintMessage.toCell(exports.JettonMintMessage.create(body));
|
|
365
|
+
}
|
|
366
|
+
static createCellOfJettonBurnNotification(body) {
|
|
367
|
+
return exports.JettonBurnNotification.toCell(exports.JettonBurnNotification.create(body));
|
|
368
|
+
}
|
|
369
|
+
static createCellOfJettonProvideWalletAddress(body) {
|
|
370
|
+
return exports.JettonProvideWalletAddress.toCell(exports.JettonProvideWalletAddress.create(body));
|
|
371
|
+
}
|
|
372
|
+
async sendDeploy(provider, via, msgValue, extraOptions) {
|
|
373
|
+
return provider.internal(via, {
|
|
374
|
+
value: msgValue,
|
|
375
|
+
body: c.Cell.EMPTY,
|
|
376
|
+
...extraOptions
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
async sendJettonMintMessage(provider, via, msgValue, body, extraOptions) {
|
|
380
|
+
return provider.internal(via, {
|
|
381
|
+
value: msgValue,
|
|
382
|
+
body: exports.JettonMintMessage.toCell(exports.JettonMintMessage.create(body)),
|
|
383
|
+
...extraOptions
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
async sendJettonBurnNotification(provider, via, msgValue, body, extraOptions) {
|
|
387
|
+
return provider.internal(via, {
|
|
388
|
+
value: msgValue,
|
|
389
|
+
body: exports.JettonBurnNotification.toCell(exports.JettonBurnNotification.create(body)),
|
|
390
|
+
...extraOptions
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
async sendJettonProvideWalletAddress(provider, via, msgValue, body, extraOptions) {
|
|
394
|
+
return provider.internal(via, {
|
|
395
|
+
value: msgValue,
|
|
396
|
+
body: exports.JettonProvideWalletAddress.toCell(exports.JettonProvideWalletAddress.create(body)),
|
|
397
|
+
...extraOptions
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
async getMinterStorage(provider) {
|
|
401
|
+
const r = StackReader.fromGetMethod(4, await provider.get('getMinterStorage', []));
|
|
402
|
+
return ({
|
|
403
|
+
$: 'JettonMinterStorageRuntime',
|
|
404
|
+
totalSupply: r.readBigInt(),
|
|
405
|
+
admin: r.readSlice().loadAddress(),
|
|
406
|
+
content: r.readCell(),
|
|
407
|
+
walletCode: r.readCell(),
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
async getJettonData(provider) {
|
|
411
|
+
const r = StackReader.fromGetMethod(5, await provider.get('get_jetton_data', []));
|
|
412
|
+
return [
|
|
413
|
+
r.readBigInt(),
|
|
414
|
+
r.readBigInt(),
|
|
415
|
+
r.readSlice().loadAddress(),
|
|
416
|
+
r.readCell(),
|
|
417
|
+
r.readCell(),
|
|
418
|
+
];
|
|
419
|
+
}
|
|
420
|
+
async getWalletAddress(provider, ownerAddress) {
|
|
421
|
+
const r = StackReader.fromGetMethod(1, await provider.get('getWalletAddress', [
|
|
422
|
+
{ type: 'slice', cell: makeCellFrom(ownerAddress, (v, b) => b.storeAddress(v)) },
|
|
423
|
+
]));
|
|
424
|
+
return r.readSlice().loadAddress();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
exports.JettonMinter = JettonMinter;
|
|
428
|
+
JettonMinter.Errors = {
|
|
429
|
+
'ERR_NOT_ADMIN': 73,
|
|
430
|
+
'ERR_NOT_FROM_WALLET': 74,
|
|
431
|
+
'Errors.InvalidWorkchain': 38296,
|
|
432
|
+
};
|