@getomnichain/omnichain 0.6.3 → 0.7.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/CHANGELOG.md +38 -0
- package/dist/cjs/chain_ids.js +2 -2
- package/dist/cjs/chain_ids.js.map +1 -1
- package/dist/cjs/errors.js +6 -0
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/ton/index.js +12 -0
- package/dist/cjs/ton/index.js.map +1 -1
- package/dist/cjs/ton/ton_address.js +72 -14
- package/dist/cjs/ton/ton_address.js.map +1 -1
- package/dist/cjs/ton/ton_asset.js +21 -0
- package/dist/cjs/ton/ton_asset.js.map +1 -0
- package/dist/cjs/ton/ton_assets.js +10 -0
- package/dist/cjs/ton/ton_assets.js.map +1 -0
- package/dist/cjs/ton/ton_chain.js +483 -0
- package/dist/cjs/ton/ton_chain.js.map +1 -0
- package/dist/cjs/ton/ton_chains.js +21 -0
- package/dist/cjs/ton/ton_chains.js.map +1 -0
- package/dist/cjs/ton/ton_jetton_metadata.js +107 -0
- package/dist/cjs/ton/ton_jetton_metadata.js.map +1 -0
- package/dist/cjs/ton/ton_messages.js +174 -0
- package/dist/cjs/ton/ton_messages.js.map +1 -0
- package/dist/cjs/ton/ton_provider.js +456 -0
- package/dist/cjs/ton/ton_provider.js.map +1 -0
- package/dist/cjs/ton/ton_tonapi.js +243 -0
- package/dist/cjs/ton/ton_tonapi.js.map +1 -0
- package/dist/cjs/ton/ton_toncenter.js +252 -0
- package/dist/cjs/ton/ton_toncenter.js.map +1 -0
- package/dist/cjs/ton/ton_transaction_status.js +231 -0
- package/dist/cjs/ton/ton_transaction_status.js.map +1 -0
- package/dist/cjs/ton/ton_transactions.js +107 -0
- package/dist/cjs/ton/ton_transactions.js.map +1 -0
- package/dist/cjs/ton/ton_wallet.js +285 -0
- package/dist/cjs/ton/ton_wallet.js.map +1 -0
- package/dist/esm/chain_ids.js +2 -2
- package/dist/esm/chain_ids.js.map +1 -1
- package/dist/esm/errors.d.ts +3 -0
- package/dist/esm/errors.d.ts.map +1 -1
- package/dist/esm/errors.js +5 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/ton/index.d.ts +12 -0
- package/dist/esm/ton/index.d.ts.map +1 -1
- package/dist/esm/ton/index.js +12 -0
- package/dist/esm/ton/index.js.map +1 -1
- package/dist/esm/ton/ton_address.d.ts +26 -2
- package/dist/esm/ton/ton_address.d.ts.map +1 -1
- package/dist/esm/ton/ton_address.js +70 -14
- package/dist/esm/ton/ton_address.js.map +1 -1
- package/dist/esm/ton/ton_asset.d.ts +12 -0
- package/dist/esm/ton/ton_asset.d.ts.map +1 -0
- package/dist/esm/ton/ton_asset.js +17 -0
- package/dist/esm/ton/ton_asset.js.map +1 -0
- package/dist/esm/ton/ton_assets.d.ts +6 -0
- package/dist/esm/ton/ton_assets.d.ts.map +1 -0
- package/dist/esm/ton/ton_assets.js +7 -0
- package/dist/esm/ton/ton_assets.js.map +1 -0
- package/dist/esm/ton/ton_chain.d.ts +205 -0
- package/dist/esm/ton/ton_chain.d.ts.map +1 -0
- package/dist/esm/ton/ton_chain.js +479 -0
- package/dist/esm/ton/ton_chain.js.map +1 -0
- package/dist/esm/ton/ton_chains.d.ts +11 -0
- package/dist/esm/ton/ton_chains.d.ts.map +1 -0
- package/dist/esm/ton/ton_chains.js +18 -0
- package/dist/esm/ton/ton_chains.js.map +1 -0
- package/dist/esm/ton/ton_jetton_metadata.d.ts +36 -0
- package/dist/esm/ton/ton_jetton_metadata.d.ts.map +1 -0
- package/dist/esm/ton/ton_jetton_metadata.js +103 -0
- package/dist/esm/ton/ton_jetton_metadata.js.map +1 -0
- package/dist/esm/ton/ton_messages.d.ts +133 -0
- package/dist/esm/ton/ton_messages.d.ts.map +1 -0
- package/dist/esm/ton/ton_messages.js +159 -0
- package/dist/esm/ton/ton_messages.js.map +1 -0
- package/dist/esm/ton/ton_provider.d.ts +261 -0
- package/dist/esm/ton/ton_provider.d.ts.map +1 -0
- package/dist/esm/ton/ton_provider.js +432 -0
- package/dist/esm/ton/ton_provider.js.map +1 -0
- package/dist/esm/ton/ton_tonapi.d.ts +39 -0
- package/dist/esm/ton/ton_tonapi.d.ts.map +1 -0
- package/dist/esm/ton/ton_tonapi.js +239 -0
- package/dist/esm/ton/ton_tonapi.js.map +1 -0
- package/dist/esm/ton/ton_toncenter.d.ts +25 -0
- package/dist/esm/ton/ton_toncenter.d.ts.map +1 -0
- package/dist/esm/ton/ton_toncenter.js +248 -0
- package/dist/esm/ton/ton_toncenter.js.map +1 -0
- package/dist/esm/ton/ton_transaction_status.d.ts +116 -0
- package/dist/esm/ton/ton_transaction_status.d.ts.map +1 -0
- package/dist/esm/ton/ton_transaction_status.js +226 -0
- package/dist/esm/ton/ton_transaction_status.js.map +1 -0
- package/dist/esm/ton/ton_transactions.d.ts +54 -0
- package/dist/esm/ton/ton_transactions.d.ts.map +1 -0
- package/dist/esm/ton/ton_transactions.js +100 -0
- package/dist/esm/ton/ton_transactions.js.map +1 -0
- package/dist/esm/ton/ton_wallet.d.ts +134 -0
- package/dist/esm/ton/ton_wallet.d.ts.map +1 -0
- package/dist/esm/ton/ton_wallet.js +278 -0
- package/dist/esm/ton/ton_wallet.js.map +1 -0
- package/docs/README.md +2 -1
- package/docs/ton.md +164 -0
- package/package.json +5 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { Cell, loadTransaction } from '@ton/core';
|
|
2
|
+
import { ChainErrorKinds } from "../errors.js";
|
|
3
|
+
import { tonRawAddress } from "./ton_address.js";
|
|
4
|
+
import { TonProviderError, asAccountStatus, asBigInt, asRecord, asRequiredInteger, asStatedAccountStatus, assertTonTxHash, assertTraceConsistent, assertTraceOf, definiteError, errorMessageOf, jettonWalletDataOf, stackCellOf, tonBroadcastReply, tonTransactionOutcome, tonHttpJson, tonTraceMessageOf, } from "./ton_provider.js";
|
|
5
|
+
const NAME = 'TonAPI';
|
|
6
|
+
/** The get-method exit code for an account with no code to run. */
|
|
7
|
+
const NO_CODE_EXIT_CODE = -13;
|
|
8
|
+
const BLOCK_ID_REGEX = /^\((-?\d+),([0-9a-fA-F]+),(\d+)\)$/;
|
|
9
|
+
/** TonAPI (`/v2`), the fallback provider. */
|
|
10
|
+
export class TonapiProvider {
|
|
11
|
+
endpoint;
|
|
12
|
+
name = NAME;
|
|
13
|
+
constructor(endpoint) {
|
|
14
|
+
this.endpoint = endpoint;
|
|
15
|
+
}
|
|
16
|
+
async getAccountState(address) {
|
|
17
|
+
// TonAPI states `nonexist` for a never-used address; no reply says nothing.
|
|
18
|
+
const reply = await this.get(`/v2/accounts/${encodeURIComponent(tonRawAddress(address))}`);
|
|
19
|
+
if (reply === null)
|
|
20
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} returned no account for ${address}`, true);
|
|
21
|
+
const account = asRecord(reply, 'account');
|
|
22
|
+
return {
|
|
23
|
+
status: asStatedAccountStatus(account.status),
|
|
24
|
+
balance: asBigInt(account.balance, 'balance'),
|
|
25
|
+
codeHash: typeof account.code_hash === 'string' ? account.code_hash : null,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async getSeqno(address) {
|
|
29
|
+
const reply = await this.get(`/v2/wallet/${encodeURIComponent(tonRawAddress(address))}/seqno`);
|
|
30
|
+
if (reply === null)
|
|
31
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} has no seqno for ${address}`, true);
|
|
32
|
+
return asRequiredInteger(asRecord(reply, 'seqno').seqno, 'seqno');
|
|
33
|
+
}
|
|
34
|
+
async getJettonWalletAddress(jettonMaster, owner) {
|
|
35
|
+
const result = await this.runGetMethod(jettonMaster, 'get_wallet_address', [tonRawAddress(owner)]);
|
|
36
|
+
const decoded = result === null ? null : result.decoded;
|
|
37
|
+
if (decoded === null || typeof decoded !== 'object' || typeof decoded.jetton_wallet_address !== 'string') {
|
|
38
|
+
throw definiteError(ChainErrorKinds.InvalidTokenIdentifier, `${jettonMaster} is not a jetton master`);
|
|
39
|
+
}
|
|
40
|
+
return tonRawAddress(String(decoded.jetton_wallet_address));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 0 only for a jetton wallet with no code: TonAPI answers a get-method on
|
|
44
|
+
* one with 404 (or exit code -13), which other failures can also produce, so
|
|
45
|
+
* the account state confirms it. Any other failure throws.
|
|
46
|
+
*/
|
|
47
|
+
async getJettonBalance(jettonWallet) {
|
|
48
|
+
const reply = await this.get(this.getMethodPath(jettonWallet, 'get_wallet_data', []));
|
|
49
|
+
const result = reply === null ? null : asRecord(reply, 'get_wallet_data');
|
|
50
|
+
if (result === null || (result.success !== true && Number(result.exit_code) === NO_CODE_EXIT_CODE)) {
|
|
51
|
+
const state = await this.getAccountState(jettonWallet);
|
|
52
|
+
if (state.status === 'nonexist' || state.status === 'uninit')
|
|
53
|
+
return 0n;
|
|
54
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} could not run get_wallet_data on ${jettonWallet}, which is ${state.status}`, true);
|
|
55
|
+
}
|
|
56
|
+
if (result.success !== true || Number(result.exit_code ?? 0) !== 0) {
|
|
57
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} could not run get_wallet_data on ${jettonWallet}`, true);
|
|
58
|
+
}
|
|
59
|
+
const stack = Array.isArray(result.stack) ? result.stack : [];
|
|
60
|
+
const first = stack[0] === undefined ? null : asRecord(stack[0], 'stack item');
|
|
61
|
+
if (first === null || first.type !== 'num')
|
|
62
|
+
throw definiteError(ChainErrorKinds.RpcError, `${NAME} returned no jetton balance`);
|
|
63
|
+
return asBigInt(first.num, 'jetton balance');
|
|
64
|
+
}
|
|
65
|
+
async getJettonContent(jettonMaster) {
|
|
66
|
+
const reply = await this.get(this.getMethodPath(jettonMaster, 'get_jetton_data', []));
|
|
67
|
+
const result = reply === null ? null : asRecord(reply, 'get_jetton_data');
|
|
68
|
+
if (result === null || result.success !== true || Number(result.exit_code ?? 0) !== 0) {
|
|
69
|
+
throw definiteError(ChainErrorKinds.InvalidTokenIdentifier, `${jettonMaster} is not a jetton master`);
|
|
70
|
+
}
|
|
71
|
+
return stackCellOf((Array.isArray(result.stack) ? result.stack : [])[3], 'jetton content');
|
|
72
|
+
}
|
|
73
|
+
/** `null` only for a jetton wallet with no code, confirmed by the account state as for the balance. */
|
|
74
|
+
async getJettonWalletData(jettonWallet) {
|
|
75
|
+
const reply = await this.get(this.getMethodPath(jettonWallet, 'get_wallet_data', []));
|
|
76
|
+
const result = reply === null ? null : asRecord(reply, 'get_wallet_data');
|
|
77
|
+
if (result === null || (result.success !== true && Number(result.exit_code) === NO_CODE_EXIT_CODE)) {
|
|
78
|
+
const state = await this.getAccountState(jettonWallet);
|
|
79
|
+
if (state.status === 'nonexist' || state.status === 'uninit')
|
|
80
|
+
return null;
|
|
81
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} could not run get_wallet_data on ${jettonWallet}, which is ${state.status}`, true);
|
|
82
|
+
}
|
|
83
|
+
if (result.success !== true || Number(result.exit_code ?? 0) !== 0) {
|
|
84
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} could not run get_wallet_data on ${jettonWallet}`, true);
|
|
85
|
+
}
|
|
86
|
+
return jettonWalletDataOf(result.stack);
|
|
87
|
+
}
|
|
88
|
+
async sendBoc(boc) {
|
|
89
|
+
const reply = await tonBroadcastReply(NAME, tonHttpJson(NAME, this.endpoint, '/v2/blockchain/message', { method: 'POST', body: { boc }, headers: this.headers() }));
|
|
90
|
+
const error = errorMessageOf(reply);
|
|
91
|
+
if (error !== null)
|
|
92
|
+
throw definiteError(ChainErrorKinds.BroadcastRejected, `${NAME} refused the message: ${error}`);
|
|
93
|
+
}
|
|
94
|
+
async getTrace(hash) {
|
|
95
|
+
// TonAPI answers a hash it has no trace for with 404.
|
|
96
|
+
const reply = await this.get(`/v2/traces/${encodeURIComponent(assertTonTxHash(hash))}`);
|
|
97
|
+
if (reply === null)
|
|
98
|
+
return null;
|
|
99
|
+
// TonAPI answers a message still in flight with its emulation; only what
|
|
100
|
+
// is on chain counts, and a predicted hop leaves the trace incomplete.
|
|
101
|
+
if (reply.emulated === true)
|
|
102
|
+
return null;
|
|
103
|
+
const root = withoutEmulated(reply);
|
|
104
|
+
const transactions = await this.withMasterchainSeqnos(flatten(root));
|
|
105
|
+
return assertTraceOf(NAME, hash, assertTraceConsistent(NAME, { complete: isComplete(root), transactions }));
|
|
106
|
+
}
|
|
107
|
+
async emulate(boc) {
|
|
108
|
+
const reply = await tonHttpJson(NAME, this.endpoint, '/v2/traces/emulate?ignore_signature_check=true', {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
body: { boc },
|
|
111
|
+
headers: this.headers(),
|
|
112
|
+
});
|
|
113
|
+
const error = errorMessageOf(reply);
|
|
114
|
+
if (error !== null)
|
|
115
|
+
throw definiteError(ChainErrorKinds.SimulationFailed, `${NAME} emulation failed: ${error}`);
|
|
116
|
+
const root = reply;
|
|
117
|
+
// An emulation is judged whole or not at all.
|
|
118
|
+
if (!isComplete(root))
|
|
119
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} returned an emulation cut short`, true);
|
|
120
|
+
return assertTraceConsistent(NAME, { complete: true, transactions: flatten(root).map(({ tx, parent }) => toTransaction(tx, parent, null)) });
|
|
121
|
+
}
|
|
122
|
+
async getMasterchainHead() {
|
|
123
|
+
const reply = asRecord(await this.get('/v2/blockchain/masterchain-head'), 'masterchain-head');
|
|
124
|
+
return { seqno: asRequiredInteger(reply.seqno, 'masterchain seqno'), utime: asRequiredInteger(reply.gen_utime, 'masterchain gen_utime') };
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Resolves each transaction's masterchain block: its own block on the
|
|
128
|
+
* masterchain, the shard block's `master_ref` otherwise. TonAPI serves only
|
|
129
|
+
* committed blocks, so a transaction it returns is final; `master_ref` is the
|
|
130
|
+
* masterchain block the shard block points back to, which can be a few
|
|
131
|
+
* blocks before the one TON Center reports as committing it.
|
|
132
|
+
*/
|
|
133
|
+
async withMasterchainSeqnos(transactions) {
|
|
134
|
+
const masterRefs = new Map();
|
|
135
|
+
for (const { tx } of transactions) {
|
|
136
|
+
const block = String(tx.block ?? '');
|
|
137
|
+
if (!masterRefs.has(block))
|
|
138
|
+
masterRefs.set(block, await this.masterchainSeqnoOf(block));
|
|
139
|
+
}
|
|
140
|
+
return transactions.map(({ tx, parent }) => toTransaction(tx, parent, masterRefs.get(String(tx.block ?? '')) ?? null));
|
|
141
|
+
}
|
|
142
|
+
async masterchainSeqnoOf(block) {
|
|
143
|
+
const match = BLOCK_ID_REGEX.exec(block);
|
|
144
|
+
if (match === null)
|
|
145
|
+
return null;
|
|
146
|
+
if (Number(match[1]) === -1)
|
|
147
|
+
return Number(match[3]);
|
|
148
|
+
const reply = await this.get(`/v2/blockchain/blocks/${encodeURIComponent(block)}`);
|
|
149
|
+
const masterRef = reply === null ? null : BLOCK_ID_REGEX.exec(String(asRecord(reply, 'block').master_ref ?? ''));
|
|
150
|
+
return masterRef === null ? null : Number(masterRef[3]);
|
|
151
|
+
}
|
|
152
|
+
/** The reply of a get-method that ran, or `null` when the account has no code to run it. */
|
|
153
|
+
async runGetMethod(address, method, args) {
|
|
154
|
+
const reply = await this.get(this.getMethodPath(address, method, args));
|
|
155
|
+
if (reply === null)
|
|
156
|
+
return null;
|
|
157
|
+
const result = asRecord(reply, method);
|
|
158
|
+
return result.success === true && Number(result.exit_code ?? 0) === 0 ? result : null;
|
|
159
|
+
}
|
|
160
|
+
getMethodPath(address, method, args) {
|
|
161
|
+
const query = args.map((arg) => `args=${encodeURIComponent(arg)}`).join('&');
|
|
162
|
+
return `/v2/blockchain/accounts/${encodeURIComponent(tonRawAddress(address))}/methods/${method}${query.length > 0 ? `?${query}` : ''}`;
|
|
163
|
+
}
|
|
164
|
+
get(path) {
|
|
165
|
+
return tonHttpJson(NAME, this.endpoint, path, { headers: this.headers() });
|
|
166
|
+
}
|
|
167
|
+
headers() {
|
|
168
|
+
return { authorization: `Bearer ${this.endpoint.apiKey}` };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function flatten(root) {
|
|
172
|
+
const ordered = [];
|
|
173
|
+
const queue = [{ node: root, parent: null }];
|
|
174
|
+
while (queue.length > 0) {
|
|
175
|
+
const { node, parent } = queue.shift();
|
|
176
|
+
const tx = asRecord(node.transaction, 'transaction');
|
|
177
|
+
ordered.push({ tx, parent });
|
|
178
|
+
const hash = rawTransactionOf(tx).hash().toString('hex');
|
|
179
|
+
queue.push(...(node.children ?? []).map((child) => ({ node: child, parent: hash })));
|
|
180
|
+
}
|
|
181
|
+
return ordered;
|
|
182
|
+
}
|
|
183
|
+
function withoutEmulated(node) {
|
|
184
|
+
return { ...node, children: (node.children ?? []).filter((child) => child.emulated !== true).map(withoutEmulated) };
|
|
185
|
+
}
|
|
186
|
+
/** Every internal message a transaction sent has reached its destination's transaction. */
|
|
187
|
+
function isComplete(node) {
|
|
188
|
+
const children = node.children ?? [];
|
|
189
|
+
const sent = rawTransactionOf(asRecord(node.transaction, 'transaction'))
|
|
190
|
+
.outMessages.values()
|
|
191
|
+
.filter((message) => message.info.type === 'internal').length;
|
|
192
|
+
return sent <= children.length && children.every(isComplete);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* TonAPI's trace transactions carry no `out_msgs`; the messages are read from
|
|
196
|
+
* the transaction's own BOC (`raw`), which also gives the exact values and
|
|
197
|
+
* forward fees.
|
|
198
|
+
*/
|
|
199
|
+
function rawTransactionOf(tx) {
|
|
200
|
+
if (typeof tx.raw !== 'string')
|
|
201
|
+
throw definiteError(ChainErrorKinds.RpcError, `${NAME} trace transaction has no raw BOC`);
|
|
202
|
+
return loadTransaction(Cell.fromBoc(Buffer.from(tx.raw, 'hex'))[0].beginParse());
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The phases from the transaction's own BOC, the chain's record — not
|
|
206
|
+
* TonAPI's JSON phase fields, which are optional.
|
|
207
|
+
*/
|
|
208
|
+
function phasesOf(raw) {
|
|
209
|
+
const description = raw.description;
|
|
210
|
+
if (description.type !== 'generic' && description.type !== 'tick-tock') {
|
|
211
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} trace holds a ${description.type} transaction`, true);
|
|
212
|
+
}
|
|
213
|
+
const compute = description.computePhase;
|
|
214
|
+
const action = description.actionPhase ?? null;
|
|
215
|
+
return {
|
|
216
|
+
computeSkipped: compute.type === 'skipped' ? compute.reason.replace('-', '_') : null,
|
|
217
|
+
computeSuccess: compute.type === 'vm' && compute.success,
|
|
218
|
+
computeExitCode: compute.type === 'vm' ? compute.exitCode : null,
|
|
219
|
+
action: action === null ? null : { success: action.success, resultCode: action.resultCode, skippedActions: action.skippedActions },
|
|
220
|
+
aborted: description.aborted,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function toTransaction(tx, parent, mcSeqno) {
|
|
224
|
+
const raw = rawTransactionOf(tx);
|
|
225
|
+
return {
|
|
226
|
+
hash: raw.hash().toString('hex'),
|
|
227
|
+
parent,
|
|
228
|
+
account: tonRawAddress(String(asRecord(tx.account, 'account').address)),
|
|
229
|
+
...tonTransactionOutcome(phasesOf(raw)),
|
|
230
|
+
totalFees: raw.totalFees.coins,
|
|
231
|
+
origStatus: asAccountStatus(tx.orig_status),
|
|
232
|
+
endStatus: asAccountStatus(tx.end_status),
|
|
233
|
+
inMsg: raw.inMessage === undefined || raw.inMessage === null ? null : tonTraceMessageOf(raw.inMessage),
|
|
234
|
+
outMsgs: raw.outMessages.values().map(tonTraceMessageOf),
|
|
235
|
+
mcSeqno,
|
|
236
|
+
utime: raw.now,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=ton_tonapi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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AE,MAAM,CAAC,UAAU,EAAE,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE;QAClI,OAAO,EAAE,WAAW,CAAC,OAAO;KAC7B,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,EAA2B,EAAE,MAAqB,EAAE,OAAsB;IAC/F,MAAM,GAAG,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACjC,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChC,MAAM;QACN,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC;QACvE,GAAG,qBAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACvC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK;QAC9B,UAAU,EAAE,eAAe,CAAC,EAAE,CAAC,WAAW,CAAC;QAC3C,SAAS,EAAE,eAAe,CAAC,EAAE,CAAC,UAAU,CAAC;QACzC,KAAK,EAAE,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,GAAG,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC;QACtG,OAAO,EAAE,GAAG,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,iBAAiB,CAAC;QACxD,OAAO;QACP,KAAK,EAAE,GAAG,CAAC,GAAG;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Cell } from '@ton/core';
|
|
2
|
+
import { type TonAccountState, type TonHttpEndpoint, type TonJettonWalletData, type TonMasterchainHead, type TonProvider, type TonTrace } from './ton_provider.ts';
|
|
3
|
+
/** TON Center's indexer API (`/api/v3`) and its emulator (`/api/emulate/v1`). */
|
|
4
|
+
export declare class ToncenterProvider implements TonProvider {
|
|
5
|
+
private readonly endpoint;
|
|
6
|
+
readonly name = "TON Center";
|
|
7
|
+
constructor(endpoint: TonHttpEndpoint);
|
|
8
|
+
getAccountState(address: string): Promise<TonAccountState>;
|
|
9
|
+
getSeqno(address: string): Promise<number>;
|
|
10
|
+
getJettonWalletAddress(jettonMaster: string, owner: string): Promise<string>;
|
|
11
|
+
/** 0 only on the explicit answer that the jetton wallet has no code; a failed read throws. */
|
|
12
|
+
getJettonBalance(jettonWallet: string): Promise<bigint>;
|
|
13
|
+
getJettonContent(jettonMaster: string): Promise<Cell>;
|
|
14
|
+
getJettonWalletData(jettonWallet: string): Promise<TonJettonWalletData | null>;
|
|
15
|
+
sendBoc(boc: string): Promise<void>;
|
|
16
|
+
getTrace(hash: string): Promise<TonTrace | null>;
|
|
17
|
+
emulate(boc: string): Promise<TonTrace>;
|
|
18
|
+
getMasterchainHead(): Promise<TonMasterchainHead>;
|
|
19
|
+
/** The stack of a get-method that ran, or `null` when the account has no code to run it. */
|
|
20
|
+
private runGetMethod;
|
|
21
|
+
private runGetMethodReply;
|
|
22
|
+
private get;
|
|
23
|
+
private headers;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ton_toncenter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ton_toncenter.d.ts","sourceRoot":"","sources":["../../../ton/ton_toncenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAa,MAAM,WAAW,CAAC;AAK5C,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAEhB,KAAK,QAAQ,EAqBd,MAAM,mBAAmB,CAAC;AAW3B,iFAAiF;AACjF,qBAAa,iBAAkB,YAAW,WAAW;IAGvC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,QAAQ,CAAC,IAAI,gBAAQ;gBAEQ,QAAQ,EAAE,eAAe;IAEhD,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAiB1D,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAU1C,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAWlF,8FAA8F;IACxF,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUvD,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWrD,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAU9E,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAsBhD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAiBvC,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAMvD,4FAA4F;YAC9E,YAAY;YAMZ,iBAAiB;YAUjB,GAAG;IAIjB,OAAO,CAAC,OAAO;CAGhB"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { Cell, beginCell } from '@ton/core';
|
|
2
|
+
import { ChainErrorKinds } from "../errors.js";
|
|
3
|
+
import { tonRawAddress } from "./ton_address.js";
|
|
4
|
+
import { parseTonAddress } from "./ton_messages.js";
|
|
5
|
+
import { TonProviderError, asAccountStatus, asBigInt, asRequiredBoolean, asRequiredInteger, asRequiredRecord, asStatedAccountStatus, assertTonTxHash, assertTraceConsistent, assertTraceOf, asRecord, definiteError, errorMessageOf, jettonWalletDataOf, stackCellOf, tonTransactionOutcome, tonBroadcastReply, tonHttpJson, } from "./ton_provider.js";
|
|
6
|
+
const NAME = 'TON Center';
|
|
7
|
+
/** TON Center's get-method exit code for an account with no code to run. */
|
|
8
|
+
const NO_CODE_EXIT_CODE = -13;
|
|
9
|
+
/** TON Center's indexer API (`/api/v3`) and its emulator (`/api/emulate/v1`). */
|
|
10
|
+
export class ToncenterProvider {
|
|
11
|
+
endpoint;
|
|
12
|
+
name = NAME;
|
|
13
|
+
constructor(endpoint) {
|
|
14
|
+
this.endpoint = endpoint;
|
|
15
|
+
}
|
|
16
|
+
async getAccountState(address) {
|
|
17
|
+
const path = `/api/v3/accountStates?address=${encodeURIComponent(tonRawAddress(address))}&include_boc=false`;
|
|
18
|
+
const reply = await tonHttpJson(NAME, this.endpoint, path, { headers: this.headers() });
|
|
19
|
+
// Only an explicit empty list means a never-used address.
|
|
20
|
+
if (reply === null || !Array.isArray(reply.accounts)) {
|
|
21
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} returned no account list for ${address}`, true);
|
|
22
|
+
}
|
|
23
|
+
const accounts = reply.accounts;
|
|
24
|
+
if (accounts.length === 0)
|
|
25
|
+
return { status: 'nonexist', balance: 0n, codeHash: null };
|
|
26
|
+
const account = asRecord(accounts[0], 'account');
|
|
27
|
+
const balance = asBigInt(account.balance, 'balance');
|
|
28
|
+
let status = asStatedAccountStatus(account.status);
|
|
29
|
+
// TON Center reports a never-touched address as `uninit`; it has no history.
|
|
30
|
+
if (status === 'uninit' && balance === 0n && (account.last_transaction_lt ?? '0') === '0')
|
|
31
|
+
status = 'nonexist';
|
|
32
|
+
return { status, balance, codeHash: typeof account.code_hash === 'string' ? account.code_hash : null };
|
|
33
|
+
}
|
|
34
|
+
async getSeqno(address) {
|
|
35
|
+
const reply = await this.runGetMethodReply(address, 'seqno', []);
|
|
36
|
+
const exitCode = Number(reply.exit_code);
|
|
37
|
+
if (errorMessageOf(reply) === null && exitCode === NO_CODE_EXIT_CODE)
|
|
38
|
+
return 0;
|
|
39
|
+
if (errorMessageOf(reply) !== null || exitCode !== 0 || !Array.isArray(reply.stack)) {
|
|
40
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} could not run seqno on ${address}`, true);
|
|
41
|
+
}
|
|
42
|
+
return asRequiredInteger(String(numAt(reply.stack, 0, 'seqno')), 'seqno');
|
|
43
|
+
}
|
|
44
|
+
async getJettonWalletAddress(jettonMaster, owner) {
|
|
45
|
+
const ownerSlice = beginCell().storeAddress(parseTonAddress(owner)).endCell().toBoc().toString('base64');
|
|
46
|
+
const result = await this.runGetMethod(jettonMaster, 'get_wallet_address', [{ type: 'slice', value: ownerSlice }]);
|
|
47
|
+
if (result === null)
|
|
48
|
+
throw definiteError(ChainErrorKinds.InvalidTokenIdentifier, `${jettonMaster} is not a jetton master`);
|
|
49
|
+
const item = result[0];
|
|
50
|
+
if (item === undefined || (item.type !== 'cell' && item.type !== 'slice')) {
|
|
51
|
+
throw definiteError(ChainErrorKinds.RpcError, `${NAME} get_wallet_address returned no address`);
|
|
52
|
+
}
|
|
53
|
+
return Cell.fromBase64(item.value).beginParse().loadAddress().toRawString();
|
|
54
|
+
}
|
|
55
|
+
/** 0 only on the explicit answer that the jetton wallet has no code; a failed read throws. */
|
|
56
|
+
async getJettonBalance(jettonWallet) {
|
|
57
|
+
const reply = await this.runGetMethodReply(jettonWallet, 'get_wallet_data', []);
|
|
58
|
+
const exitCode = Number(reply.exit_code);
|
|
59
|
+
if (errorMessageOf(reply) === null && exitCode === NO_CODE_EXIT_CODE)
|
|
60
|
+
return 0n;
|
|
61
|
+
if (errorMessageOf(reply) !== null || exitCode !== 0 || !Array.isArray(reply.stack)) {
|
|
62
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} could not run get_wallet_data on ${jettonWallet}`, true);
|
|
63
|
+
}
|
|
64
|
+
return numAt(reply.stack, 0, 'jetton balance');
|
|
65
|
+
}
|
|
66
|
+
async getJettonContent(jettonMaster) {
|
|
67
|
+
const reply = await this.runGetMethodReply(jettonMaster, 'get_jetton_data', []);
|
|
68
|
+
if (errorMessageOf(reply) !== null) {
|
|
69
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} could not run get_jetton_data on ${jettonMaster}`, true);
|
|
70
|
+
}
|
|
71
|
+
// A VM exit code is the chain's answer: no code (-13), or no such get-method.
|
|
72
|
+
if (Number(reply.exit_code) !== 0)
|
|
73
|
+
throw definiteError(ChainErrorKinds.InvalidTokenIdentifier, `${jettonMaster} is not a jetton master`);
|
|
74
|
+
const stack = Array.isArray(reply.stack) ? reply.stack : [];
|
|
75
|
+
return stackCellOf(stack[3], 'jetton content');
|
|
76
|
+
}
|
|
77
|
+
async getJettonWalletData(jettonWallet) {
|
|
78
|
+
const reply = await this.runGetMethodReply(jettonWallet, 'get_wallet_data', []);
|
|
79
|
+
const exitCode = Number(reply.exit_code);
|
|
80
|
+
if (errorMessageOf(reply) === null && exitCode === NO_CODE_EXIT_CODE)
|
|
81
|
+
return null;
|
|
82
|
+
if (errorMessageOf(reply) !== null || exitCode !== 0) {
|
|
83
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} could not run get_wallet_data on ${jettonWallet}`, true);
|
|
84
|
+
}
|
|
85
|
+
return jettonWalletDataOf(reply.stack);
|
|
86
|
+
}
|
|
87
|
+
async sendBoc(boc) {
|
|
88
|
+
const reply = await tonBroadcastReply(NAME, tonHttpJson(NAME, this.endpoint, '/api/v3/message', { method: 'POST', body: { boc }, headers: this.headers() }));
|
|
89
|
+
const error = errorMessageOf(reply);
|
|
90
|
+
if (error !== null)
|
|
91
|
+
throw definiteError(ChainErrorKinds.BroadcastRejected, `${NAME} refused the message: ${error}`);
|
|
92
|
+
}
|
|
93
|
+
async getTrace(hash) {
|
|
94
|
+
const reply = await tonHttpJson(NAME, this.endpoint, `/api/v3/traces?msg_hash=${encodeURIComponent(hexToBase64(assertTonTxHash(hash)))}`, {
|
|
95
|
+
headers: this.headers(),
|
|
96
|
+
});
|
|
97
|
+
// Only an explicit empty list means no trace; anything else says nothing.
|
|
98
|
+
if (reply === null || !Array.isArray(reply.traces)) {
|
|
99
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} returned no trace list for ${hash}`, true);
|
|
100
|
+
}
|
|
101
|
+
const traces = reply.traces;
|
|
102
|
+
if (traces.length === 0)
|
|
103
|
+
return null;
|
|
104
|
+
const trace = asRecord(traces[0], 'trace');
|
|
105
|
+
const info = asRecord(trace.trace_info ?? {}, 'trace_info');
|
|
106
|
+
const { transactions, missing } = orderedTransactions(trace.trace, asRecord(trace.transactions, 'transactions'));
|
|
107
|
+
const finished = trace.is_incomplete !== true && info.trace_state === 'complete' && Number(info.pending_messages ?? 0) === 0;
|
|
108
|
+
// A trace still running may not have every transaction yet; a finished one
|
|
109
|
+
// without them never will, so TonAPI is asked instead.
|
|
110
|
+
if (finished && missing) {
|
|
111
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} returned a finished trace with transactions left out`, true);
|
|
112
|
+
}
|
|
113
|
+
return assertTraceOf(NAME, hash, assertTraceConsistent(NAME, { complete: finished && !missing, transactions }));
|
|
114
|
+
}
|
|
115
|
+
async emulate(boc) {
|
|
116
|
+
const reply = await tonHttpJson(NAME, this.endpoint, '/api/emulate/v1/emulateTrace', {
|
|
117
|
+
method: 'POST',
|
|
118
|
+
body: { boc, ignore_chksig: true },
|
|
119
|
+
headers: this.headers(),
|
|
120
|
+
});
|
|
121
|
+
const error = errorMessageOf(reply);
|
|
122
|
+
if (error !== null)
|
|
123
|
+
throw definiteError(ChainErrorKinds.SimulationFailed, `${NAME} emulation failed: ${error}`);
|
|
124
|
+
const result = asRecord(reply, 'emulation');
|
|
125
|
+
const { transactions, missing } = orderedTransactions(result.trace, asRecord(result.transactions, 'transactions'));
|
|
126
|
+
// An emulation is judged whole or not at all; one cut short is asked of TonAPI.
|
|
127
|
+
if (missing || result.is_incomplete === true) {
|
|
128
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} returned an emulation cut short`, true);
|
|
129
|
+
}
|
|
130
|
+
return assertTraceConsistent(NAME, { complete: true, transactions });
|
|
131
|
+
}
|
|
132
|
+
async getMasterchainHead() {
|
|
133
|
+
const reply = asRecord(await this.get('/api/v3/masterchainInfo'), 'masterchainInfo');
|
|
134
|
+
const last = asRecord(reply.last, 'last');
|
|
135
|
+
return { seqno: asRequiredInteger(last.seqno, 'masterchain seqno'), utime: asRequiredInteger(last.gen_utime, 'masterchain gen_utime') };
|
|
136
|
+
}
|
|
137
|
+
/** The stack of a get-method that ran, or `null` when the account has no code to run it. */
|
|
138
|
+
async runGetMethod(address, method, stack) {
|
|
139
|
+
const reply = await this.runGetMethodReply(address, method, stack);
|
|
140
|
+
if (errorMessageOf(reply) !== null || Number(reply.exit_code ?? 0) !== 0)
|
|
141
|
+
return null;
|
|
142
|
+
return Array.isArray(reply.stack) ? reply.stack : [];
|
|
143
|
+
}
|
|
144
|
+
async runGetMethodReply(address, method, stack) {
|
|
145
|
+
const reply = await tonHttpJson(NAME, this.endpoint, '/api/v3/runGetMethod', {
|
|
146
|
+
method: 'POST',
|
|
147
|
+
body: { address: tonRawAddress(address), method, stack },
|
|
148
|
+
headers: this.headers(),
|
|
149
|
+
});
|
|
150
|
+
if (reply === null)
|
|
151
|
+
throw new TonProviderError(ChainErrorKinds.RpcError, `${NAME} runGetMethod returned nothing`, true);
|
|
152
|
+
return asRecord(reply, 'runGetMethod');
|
|
153
|
+
}
|
|
154
|
+
async get(path) {
|
|
155
|
+
return (await tonHttpJson(NAME, this.endpoint, path, { headers: this.headers() })) ?? {};
|
|
156
|
+
}
|
|
157
|
+
headers() {
|
|
158
|
+
return { 'X-API-Key': this.endpoint.apiKey };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function numAt(stack, index, what) {
|
|
162
|
+
const item = stack[index];
|
|
163
|
+
if (item === undefined || item.type !== 'num')
|
|
164
|
+
throw definiteError(ChainErrorKinds.RpcError, `${NAME} returned no ${what}`);
|
|
165
|
+
return asBigInt(item.value, what);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The trace's transactions, root first then breadth-first along the trace
|
|
169
|
+
* tree. A node whose transaction the reply left out stays the parent of its
|
|
170
|
+
* children, and makes the trace `missing` a part.
|
|
171
|
+
*/
|
|
172
|
+
function orderedTransactions(tree, byHash) {
|
|
173
|
+
const ordered = [];
|
|
174
|
+
let missing = false;
|
|
175
|
+
const queue = tree === undefined || tree === null ? [] : [{ node: tree, parent: null }];
|
|
176
|
+
while (queue.length > 0) {
|
|
177
|
+
const { node: raw, parent } = queue.shift();
|
|
178
|
+
const node = asRecord(raw, 'trace node');
|
|
179
|
+
const tx = byHash[String(node.tx_hash)];
|
|
180
|
+
if (tx === undefined)
|
|
181
|
+
missing = true;
|
|
182
|
+
else
|
|
183
|
+
ordered.push(toTransaction(asRecord(tx, 'transaction'), parent));
|
|
184
|
+
const children = Array.isArray(node.children) ? node.children : [];
|
|
185
|
+
queue.push(...children.map((child) => ({ node: child, parent: base64ToHex(String(node.tx_hash)) })));
|
|
186
|
+
}
|
|
187
|
+
return { transactions: ordered, missing };
|
|
188
|
+
}
|
|
189
|
+
/** The phases from TON Center's `description`, every field the judgment reads required. */
|
|
190
|
+
function phasesOf(tx) {
|
|
191
|
+
const description = asRequiredRecord(tx.description, 'transaction description');
|
|
192
|
+
const compute = asRequiredRecord(description.compute_ph, 'compute_ph');
|
|
193
|
+
const skipped = asRequiredBoolean(compute.skipped, 'compute_ph.skipped');
|
|
194
|
+
const action = description.action === undefined || description.action === null ? null : asRequiredRecord(description.action, 'action');
|
|
195
|
+
return {
|
|
196
|
+
computeSkipped: skipped ? String(compute.reason) : null,
|
|
197
|
+
computeSuccess: skipped ? false : asRequiredBoolean(compute.success, 'compute_ph.success'),
|
|
198
|
+
computeExitCode: skipped ? null : asRequiredInteger(compute.exit_code, 'compute_ph.exit_code'),
|
|
199
|
+
action: action === null
|
|
200
|
+
? null
|
|
201
|
+
: {
|
|
202
|
+
success: asRequiredBoolean(action.success, 'action.success'),
|
|
203
|
+
resultCode: asRequiredInteger(action.result_code, 'action.result_code'),
|
|
204
|
+
skippedActions: asRequiredInteger(action.skipped_actions, 'action.skipped_actions'),
|
|
205
|
+
},
|
|
206
|
+
aborted: asRequiredBoolean(description.aborted, 'description.aborted'),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function toTransaction(tx, parent) {
|
|
210
|
+
const finalized = tx.finality === undefined || tx.finality === 'finalized';
|
|
211
|
+
return {
|
|
212
|
+
hash: base64ToHex(String(tx.hash)),
|
|
213
|
+
parent,
|
|
214
|
+
account: tonRawAddress(String(tx.account)),
|
|
215
|
+
...tonTransactionOutcome(phasesOf(tx)),
|
|
216
|
+
totalFees: asBigInt(tx.total_fees, 'total_fees'),
|
|
217
|
+
origStatus: asAccountStatus(tx.orig_status),
|
|
218
|
+
endStatus: asAccountStatus(tx.end_status),
|
|
219
|
+
inMsg: tx.in_msg === null || tx.in_msg === undefined ? null : toMessage(asRecord(tx.in_msg, 'in_msg')),
|
|
220
|
+
outMsgs: (Array.isArray(tx.out_msgs) ? tx.out_msgs : []).map((m) => toMessage(asRecord(m, 'out_msg'))),
|
|
221
|
+
mcSeqno: finalized && typeof tx.mc_block_seqno === 'number' ? tx.mc_block_seqno : null,
|
|
222
|
+
utime: Number(tx.now ?? 0),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function toMessage(msg) {
|
|
226
|
+
const content = msg.message_content === null || msg.message_content === undefined ? null : asRecord(msg.message_content, 'message_content');
|
|
227
|
+
const cell = content !== null && typeof content.body === 'string' ? Cell.fromBase64(content.body) : null;
|
|
228
|
+
// An empty body is no body, as TonAPI's decoded messages read it.
|
|
229
|
+
const body = cell === null || (cell.bits.length === 0 && cell.refs.length === 0) ? null : cell;
|
|
230
|
+
return {
|
|
231
|
+
source: typeof msg.source === 'string' ? tonRawAddress(msg.source) : null,
|
|
232
|
+
destination: typeof msg.destination === 'string' ? tonRawAddress(msg.destination) : null,
|
|
233
|
+
value: asBigInt(msg.value, 'value'),
|
|
234
|
+
fwdFee: asBigInt(msg.fwd_fee, 'fwd_fee'),
|
|
235
|
+
bounce: msg.bounce === true,
|
|
236
|
+
bounced: msg.bounced === true,
|
|
237
|
+
opcode: typeof msg.opcode === 'string' ? Number(BigInt(msg.opcode)) >>> 0 : null,
|
|
238
|
+
createdLt: msg.created_lt === null || msg.created_lt === undefined ? null : asBigInt(msg.created_lt, 'created_lt'),
|
|
239
|
+
body,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function hexToBase64(hex) {
|
|
243
|
+
return Buffer.from(hex, 'hex').toString('base64');
|
|
244
|
+
}
|
|
245
|
+
function base64ToHex(base64) {
|
|
246
|
+
return Buffer.from(base64, 'base64').toString('hex');
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=ton_toncenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ton_toncenter.js","sourceRoot":"","sources":["../../../ton/ton_toncenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAUL,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,QAAQ,EACR,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,MAAM,IAAI,GAAG,YAAY,CAAC;AAC1B,4EAA4E;AAC5E,MAAM,iBAAiB,GAAG,CAAC,EAAE,CAAC;AAO9B,iFAAiF;AACjF,MAAM,OAAO,iBAAiB;IAG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