wan-ton-sdk 0.0.6
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/Bridge.compile.ts +8 -0
- package/Bridge.ts +645 -0
- package/Bridge.ts.org +647 -0
- package/Fake.compile.ts +8 -0
- package/GroupApprove.compile.ts +6 -0
- package/GroupApprove.ts +274 -0
- package/JettonMinter.compile.ts +5 -0
- package/JettonMinter.ts +135 -0
- package/JettonWallet.compile.ts +5 -0
- package/JettonWallet.ts +127 -0
- package/README.md +24 -0
- package/Signature.compile.ts +6 -0
- package/Signature.ts +105 -0
- package/address.compile.ts +8 -0
- package/client/1.json +1730 -0
- package/client/client.ts +73 -0
- package/client/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +15 -0
- package/client/log/wan-ton-sdk.out.2024-12-19 +0 -0
- package/code/decode.spec.ts +81 -0
- package/code/encode-decode.ts +622 -0
- package/code/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +20 -0
- package/code/log/wan-ton-sdk.out.2025-01-15 +0 -0
- package/code/log/wan-ton-sdk.out.2025-01-20 +0 -0
- package/code/userLock.ts +291 -0
- package/common.ts +62 -0
- package/config/config-ex.ts +25 -0
- package/config/config.ts +1 -0
- package/const/const-value.ts +33 -0
- package/contractAccess/bridgeAccess.ts +60 -0
- package/contractAccess/groupApproveAccess.ts +59 -0
- package/data/EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs.json +7348 -0
- package/db/Db.spec.ts +193 -0
- package/db/Db.ts +736 -0
- package/db/DbAccess.spec.ts +23 -0
- package/db/DbAccess.ts +174 -0
- package/db/common.ts +94 -0
- package/db/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +15 -0
- package/db/log/wan-ton-sdk.out.2025-04-21 +0 -0
- package/event/getEvents.ts +441 -0
- package/event/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +15 -0
- package/event/log/wan-ton-sdk.out.2024-12-19 +0 -0
- package/example/0:1.txt +1 -0
- package/example/AddToken-ex.ts +148 -0
- package/example/README.md +21 -0
- package/example/addSmg-ex.ts +78 -0
- package/example/addTokenPair-ex.ts +73 -0
- package/example/compileContract-ex.ts +10 -0
- package/example/converTranToTonTran.ts +43 -0
- package/example/createDb-ex.ts +8 -0
- package/example/dbFeedTrans-ex.ts +20 -0
- package/example/delTokenPair-ex.ts +63 -0
- package/example/deploy-ex.ts +68 -0
- package/example/getAllEvents-ex.ts +61 -0
- package/example/getAllTrans.ts +32 -0
- package/example/getContractState-ex.ts +33 -0
- package/example/getEventByHash-ex.ts +39 -0
- package/example/getEvents-ex.ts +55 -0
- package/example/getJettonInfo-ex.ts +44 -0
- package/example/getTokenPair-ex.ts +47 -0
- package/example/getTransByRange-ex.ts +81 -0
- package/example/getTransaction-ex.ts +62 -0
- package/example/isTranSuccess-ex.ts +33 -0
- package/example/locateTx-ex.ts +44 -0
- package/example/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +55 -0
- package/example/log/wan-ton-sdk.out.2025-04-21 +447 -0
- package/example/log/wan-ton-sdk.out.2025-04-22 +1918 -0
- package/example/log/wan-ton-sdk.out.2025-04-23 +4216 -0
- package/example/log/wan-ton-sdk.out.2025-04-24.gz +0 -0
- package/example/log/wan-ton-sdk.out.2025-04-25 +46814 -0
- package/example/log/wan-ton-sdk.out.2025-04-27.gz +0 -0
- package/example/log/wan-ton-sdk.out.2025-04-28 +4966 -0
- package/example/log/wan-ton-sdk.out.2025-04-29 +1328 -0
- package/example/log/wan-ton-sdk.out.2025-04-30 +9 -0
- package/example/mintToken-ex.ts +82 -0
- package/example/setFee-ex.ts +82 -0
- package/example/setFeeProxy.ts +70 -0
- package/example/smgRelease-ex.ts +173 -0
- package/example/upgradeBridgeSc-ex.ts +49 -0
- package/example/userLock-ex.ts +78 -0
- package/fee/fee.ts +23 -0
- package/index.ts +67 -0
- package/jest.config.ts +9 -0
- package/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +20 -0
- package/log/wan-ton-sdk.out.2025-04-21 +0 -0
- package/log/wan-ton-sdk.out.2025-04-30 +10 -0
- package/opcodes.ts +58 -0
- package/package.json +34 -0
- package/publish.sh +78 -0
- package/sign/buildHash.ts +47 -0
- package/sign/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +15 -0
- package/sign/log/wan-ton-sdk.out.2025-04-14 +3 -0
- package/sign/rawTrans.spec.ts +117 -0
- package/sign/rawTrans.ts +122 -0
- package/sign/tools-secp256k1.js +210 -0
- package/testData/JettonMinter.compile.func.ts +8 -0
- package/testData/JettonWallet.compile.func.ts +8 -0
- package/testData/addressList.json +6 -0
- package/testData/bridge.compile.func.ts +8 -0
- package/testData/bridge.compiled.json +1 -0
- package/testData/contractAddress.json +7 -0
- package/testData/jettonTokenInfo.json +14 -0
- package/testData/prvlist.json +6 -0
- package/testData/smg.json +5 -0
- package/testData/tokenInfo.json +23 -0
- package/transResult/transResult.ts +621 -0
- package/tsconfig.json +19 -0
- package/utils/.compiled.json +1 -0
- package/utils/compileContract.ts +60 -0
- package/utils/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +15 -0
- package/utils/log/wan-ton-sdk.out.2025-01-08 +0 -0
- package/utils/logger.spec.ts +14 -0
- package/utils/logger.ts +96 -0
- package/utils/utils.spec.ts +21 -0
- package/utils/utils.ts +295 -0
- package/wallet/balance.ts +29 -0
- package/wallet/jetton.spec.ts +27 -0
- package/wallet/jetton.ts +159 -0
- package/wallet/walletContract.spec.ts +111 -0
- package/wallet/walletContract.ts +105 -0
@@ -0,0 +1,622 @@
|
|
1
|
+
import {
|
2
|
+
OP_CROSS_SmgRelease,
|
3
|
+
OP_FEE_SetSmgFeeProxy,
|
4
|
+
OP_GROUPAPPROVE_Execute,
|
5
|
+
OP_GROUPAPPROVE_Proposol_SetSmgFeeProxy
|
6
|
+
} from "../opcodes";
|
7
|
+
import {Address, beginCell, Cell, SendMode} from "@ton/core";
|
8
|
+
import * as opcodes from "../opcodes";
|
9
|
+
import {BIP44_CHAINID, TON_COIN_ACCOUT, TON_COIN_ACCOUNT_STR, WK_CHIANID} from "../const/const-value";
|
10
|
+
|
11
|
+
import {logger} from '../utils/logger'
|
12
|
+
import {add0x, BufferrToHexString, int64ToByte32} from "../utils/utils";
|
13
|
+
import {bigIntReplacer} from "../utils/utils";
|
14
|
+
const formatUtil = require('util');
|
15
|
+
|
16
|
+
export const codeTable = {
|
17
|
+
[opcodes.OP_CROSS_UserLock]:{
|
18
|
+
"enCode": function (opts: any): Cell{
|
19
|
+
let retCell = Cell.EMPTY
|
20
|
+
return retCell;
|
21
|
+
},
|
22
|
+
"deCode": function (cell: Cell): any{
|
23
|
+
let slice = cell.beginParse();
|
24
|
+
let opCode = slice.loadUint(32);
|
25
|
+
let queryID = slice.loadUint(64);
|
26
|
+
console.log("33333");
|
27
|
+
let smgID = slice.loadUintBig(256); // why not use .loadUintBig(256)? should change all loadUint(256) to loadUintBig(256)?
|
28
|
+
console.log("4444");
|
29
|
+
let tokenPairID = slice.loadUint(32);
|
30
|
+
let crossValue = slice.loadUintBig(256);
|
31
|
+
|
32
|
+
let dstUserAccountLen = slice.loadUint(8);
|
33
|
+
let dstUserAccountBuff = slice.loadBuffer(dstUserAccountLen);
|
34
|
+
console.log("22222");
|
35
|
+
let extraCell = slice.loadRef().beginParse();
|
36
|
+
let addrTokenAccount = extraCell.loadAddress();
|
37
|
+
let jwAddrSrc = extraCell.loadAddress();
|
38
|
+
let jwAddrBridgeSc = extraCell.loadAddress();
|
39
|
+
extraCell.endParse();
|
40
|
+
|
41
|
+
let extraCell2 = slice.loadRef().beginParse();
|
42
|
+
let senderAccount = extraCell2.loadAddress();
|
43
|
+
console.log("1111111");
|
44
|
+
let fee = extraCell2.loadUintBig(256);
|
45
|
+
extraCell2.endParse();
|
46
|
+
|
47
|
+
slice.endParse();
|
48
|
+
|
49
|
+
return {
|
50
|
+
uniqueID:queryID,
|
51
|
+
smgID:int64ToByte32(smgID),
|
52
|
+
tokenPairID,
|
53
|
+
crossValue,
|
54
|
+
dstUserAccount: add0x(dstUserAccountBuff.toString('hex')),
|
55
|
+
addrTokenAccount: addrTokenAccount.toString(),
|
56
|
+
jwAddrSrc,
|
57
|
+
jwAddrBridgeSc,
|
58
|
+
senderAccount,
|
59
|
+
fee,
|
60
|
+
}
|
61
|
+
},
|
62
|
+
"emitEvent": function (opts){
|
63
|
+
return {
|
64
|
+
eventName:"UserLockLogger",
|
65
|
+
uniqueID:opts.uniqueID,
|
66
|
+
smgID:opts.smgID,
|
67
|
+
tokenPairID:opts.tokenPairID,
|
68
|
+
value:opts.crossValue,
|
69
|
+
fee:opts.fee,
|
70
|
+
userAccount:opts.dstUserAccount,
|
71
|
+
txHashBase64:opts.txHashBase64,
|
72
|
+
txHash:opts.txHash,
|
73
|
+
lt:opts?.lt,
|
74
|
+
from:opts?.origin,
|
75
|
+
prevTransactionHash:opts?.prevTransactionHash,
|
76
|
+
prevTransactionLt:opts?.prevTransactionLt,
|
77
|
+
}
|
78
|
+
}
|
79
|
+
},
|
80
|
+
[opcodes.OP_CROSS_SmgRelease]: {
|
81
|
+
"enCode": function (opts: any): Cell {
|
82
|
+
logger.info(formatUtil.format("Entering enCode Function OP_CROSS_SmgRelease"));
|
83
|
+
logger.info(formatUtil.format("op_cross_smgRelease opts %s",JSON.stringify(opts,bigIntReplacer)));
|
84
|
+
let part2Cell = beginCell()
|
85
|
+
.storeUint(opts.fee, 256)
|
86
|
+
.storeAddress(opts.userAccount)
|
87
|
+
.endCell();
|
88
|
+
|
89
|
+
let part3Cell = beginCell()
|
90
|
+
.storeUint(opts.e, 256)
|
91
|
+
.storeUint(opts.p, 256)
|
92
|
+
.storeUint(opts.s, 256)
|
93
|
+
.endCell();
|
94
|
+
|
95
|
+
let part4Cell = beginCell()
|
96
|
+
.storeAddress(opts.bridgeJettonWalletAddr)
|
97
|
+
.storeUint(opts.fwTonAmount,256)
|
98
|
+
.storeUint(opts.totalTonAmount,256)
|
99
|
+
.endCell();
|
100
|
+
|
101
|
+
return beginCell()
|
102
|
+
.storeUint(opcodes.OP_CROSS_SmgRelease, 32)
|
103
|
+
.storeUint(opts.queryID ?? 0, 64)
|
104
|
+
.storeUint(BigInt(opts.uniqueID), 256)
|
105
|
+
.storeUint(BigInt(opts.smgID), 256)
|
106
|
+
.storeUint(opts.tokenPairID, 32)
|
107
|
+
.storeUint(opts.releaseValue, 256)
|
108
|
+
.storeRef(part2Cell)
|
109
|
+
.storeRef(part3Cell)
|
110
|
+
.storeRef(part4Cell)
|
111
|
+
.endCell()
|
112
|
+
},
|
113
|
+
"deCode": function (cell: Cell): any {
|
114
|
+
let slice = cell.beginParse();
|
115
|
+
let opCode = slice.loadUint(32);
|
116
|
+
let queryID = slice.loadUint(64);
|
117
|
+
let uniqueID = slice.loadUintBig(256);
|
118
|
+
let smgID = slice.loadUintBig(256);
|
119
|
+
let tokenPairID = slice.loadUint(32);
|
120
|
+
let releaseValue = slice.loadUintBig(256);
|
121
|
+
|
122
|
+
let part2Slice = slice.loadRef().beginParse();
|
123
|
+
let fee = part2Slice.loadUintBig(256);
|
124
|
+
let userAccount = part2Slice.loadAddress();
|
125
|
+
part2Slice.endParse();
|
126
|
+
|
127
|
+
let part3Slice = slice.loadRef().beginParse();
|
128
|
+
let e = part3Slice.loadUintBig(256);
|
129
|
+
let p = part3Slice.loadUintBig(256);
|
130
|
+
let s = part3Slice.loadUintBig(256);
|
131
|
+
part3Slice.endParse();
|
132
|
+
|
133
|
+
let part4Slice = slice.loadRef().beginParse();
|
134
|
+
let bridgeJettonWalletAddr = part4Slice.loadAddress();
|
135
|
+
let fwTonAmount = part4Slice.loadUintBig(256);
|
136
|
+
let totalTonAmount = part4Slice.loadUintBig(256);
|
137
|
+
part4Slice.endParse();
|
138
|
+
|
139
|
+
slice.endParse();
|
140
|
+
return {
|
141
|
+
opCode,
|
142
|
+
queryID,
|
143
|
+
uniqueID,
|
144
|
+
smgID:int64ToByte32(BigInt(smgID)),
|
145
|
+
tokenPairID,
|
146
|
+
releaseValue,
|
147
|
+
fee,
|
148
|
+
userAccount,
|
149
|
+
e,
|
150
|
+
p,
|
151
|
+
s,
|
152
|
+
bridgeJettonWalletAddr,
|
153
|
+
fwTonAmount,
|
154
|
+
totalTonAmount,
|
155
|
+
};
|
156
|
+
},
|
157
|
+
"emitEvent": function (opts){
|
158
|
+
return {
|
159
|
+
eventName:"SmgReleaseLogger",
|
160
|
+
uniqueID:opts.uniqueID,
|
161
|
+
smgID:opts.smgID.toString(16),
|
162
|
+
tokenPairID:opts.tokenPairID,
|
163
|
+
value:opts.releaseValue,
|
164
|
+
fee:opts.fee,
|
165
|
+
userAccount:opts.userAccount,
|
166
|
+
txHashBase64:opts.txHashBase64,
|
167
|
+
txHash:opts.txHash,
|
168
|
+
lt:opts?.lt,
|
169
|
+
}
|
170
|
+
}
|
171
|
+
},
|
172
|
+
[opcodes.OP_FEE_SetTokenPairFee]: {
|
173
|
+
"enCode": function (opts: any): Cell {
|
174
|
+
logger.info(formatUtil.format("Entering enCode Function OP_CROSS_SmgRelease"));
|
175
|
+
return beginCell()
|
176
|
+
.storeUint(opcodes.OP_FEE_SetTokenPairFee, 32)
|
177
|
+
.storeUint(opts.queryID ?? 0, 64)
|
178
|
+
.storeUint(opts.tokenPairID, 32)
|
179
|
+
.storeUint(opts.fee, 32)
|
180
|
+
.endCell()
|
181
|
+
},
|
182
|
+
"deCode": function (cell: Cell): any {
|
183
|
+
return 0;
|
184
|
+
}
|
185
|
+
},
|
186
|
+
[opcodes.OP_FEE_SetSmgFeeProxy]: {
|
187
|
+
"enCode": function (opts: any): Cell {
|
188
|
+
logger.info(formatUtil.format("Entering enCode Function OP_FEE_SetSmgFeeProxy"));
|
189
|
+
return beginCell()
|
190
|
+
.storeUint(opcodes.OP_FEE_SetSmgFeeProxy, 32)
|
191
|
+
.storeUint(opts.queryID ?? 0, 64)
|
192
|
+
.storeAddress(opts.feeProxy)
|
193
|
+
.endCell()
|
194
|
+
},
|
195
|
+
"deCode": function (cell: Cell): any {
|
196
|
+
return 0;
|
197
|
+
}
|
198
|
+
},
|
199
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_SetSmgFeeProxy]: {
|
200
|
+
"enCode": function (opts: any): Cell {
|
201
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_SetSmgFeeProxy"));
|
202
|
+
let msg = beginCell()
|
203
|
+
.storeUint(opcodes.OP_FEE_SetSmgFeeProxy, 32) // op (op #1 = increment)
|
204
|
+
.storeAddress(opts.feeProxy)
|
205
|
+
.endCell()
|
206
|
+
return beginCell()
|
207
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
208
|
+
.storeUint(opts.queryID ?? 0, 64)
|
209
|
+
.storeUint(opts.chainId, 64) // chainId
|
210
|
+
.storeAddress(opts.toAddr)
|
211
|
+
.storeRef(msg)
|
212
|
+
.endCell()
|
213
|
+
},
|
214
|
+
"deCode": function (cell: Cell): any {
|
215
|
+
return 0;
|
216
|
+
}
|
217
|
+
},
|
218
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_AddCrossAdmin]: {
|
219
|
+
"enCode": function (opts: any): Cell {
|
220
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_AddCrossAdmin"));
|
221
|
+
let msg = beginCell()
|
222
|
+
.storeUint(opcodes.OP_FEE_AddCrossAdmin, 32) // op (op #1 = increment)
|
223
|
+
.storeAddress(opts.admin)
|
224
|
+
.endCell()
|
225
|
+
return beginCell()
|
226
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
227
|
+
.storeUint(opts.queryID ?? 0, 64)
|
228
|
+
.storeUint(opts.chainId, 64) // chainId
|
229
|
+
.storeAddress(opts.toAddr)
|
230
|
+
.storeRef(msg)
|
231
|
+
.endCell()
|
232
|
+
},
|
233
|
+
"deCode": function (cell: Cell): any {
|
234
|
+
return 0;
|
235
|
+
}
|
236
|
+
},
|
237
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_DelCrossAdmin]: {
|
238
|
+
"enCode": function (opts: any): Cell {
|
239
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_AddCrossAdmin"));
|
240
|
+
let msg = beginCell()
|
241
|
+
.storeUint(opcodes.OP_FEE_DelCrossAdmin, 32) // op (op #1 = increment)
|
242
|
+
.storeAddress(opts.admin)
|
243
|
+
.endCell()
|
244
|
+
return beginCell()
|
245
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
246
|
+
.storeUint(opts.queryID ?? 0, 64)
|
247
|
+
.storeUint(opts.chainId, 64) // chainId
|
248
|
+
.storeAddress(opts.toAddr)
|
249
|
+
.storeRef(msg)
|
250
|
+
.endCell()
|
251
|
+
},
|
252
|
+
"deCode": function (cell: Cell): any {
|
253
|
+
return 0;
|
254
|
+
}
|
255
|
+
},
|
256
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_TransferOwner]: {
|
257
|
+
"enCode": function (opts: any): Cell {
|
258
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_AddCrossAdmin"));
|
259
|
+
let msg = beginCell()
|
260
|
+
.storeUint(opcodes.OP_COMMON_TransferOwner, 32) // op (op #1 = increment)
|
261
|
+
.storeAddress(opts.owner)
|
262
|
+
.endCell()
|
263
|
+
return beginCell()
|
264
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
265
|
+
.storeUint(opts.queryID ?? 0, 64)
|
266
|
+
.storeUint(opts.chainId, 64) // chainId
|
267
|
+
.storeAddress(opts.toAddr)
|
268
|
+
.storeRef(msg)
|
269
|
+
.endCell()
|
270
|
+
},
|
271
|
+
"deCode": function (cell: Cell): any {
|
272
|
+
return 0;
|
273
|
+
}
|
274
|
+
},
|
275
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_TransferOperator]: {
|
276
|
+
"enCode": function (opts: any): Cell {
|
277
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_TransferOperator"));
|
278
|
+
let msg = beginCell()
|
279
|
+
.storeUint(opcodes.OP_FEE_SetFeeOperator, 32) // op (op #1 = increment)
|
280
|
+
.storeAddress(opts.operator)
|
281
|
+
.endCell()
|
282
|
+
return beginCell()
|
283
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
284
|
+
.storeUint(opts.queryID ?? 0, 64)
|
285
|
+
.storeUint(opts.chainId, 64) // chainId
|
286
|
+
.storeAddress(opts.toAddr)
|
287
|
+
.storeRef(msg)
|
288
|
+
.endCell()
|
289
|
+
},
|
290
|
+
"deCode": function (cell: Cell): any {
|
291
|
+
return 0;
|
292
|
+
}
|
293
|
+
},
|
294
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_SetHalt]: {
|
295
|
+
"enCode": function (opts: any): Cell {
|
296
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_AddCrossAdmin"));
|
297
|
+
let msg = beginCell()
|
298
|
+
.storeUint(opcodes.OP_COMMON_SetHalt, 32)
|
299
|
+
.storeUint(opts.halt, 2)
|
300
|
+
.endCell()
|
301
|
+
return beginCell()
|
302
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
303
|
+
.storeUint(opts.queryID ?? 0, 64)
|
304
|
+
.storeUint(opts.chainId, 64) // chainId
|
305
|
+
.storeAddress(opts.toAddr)
|
306
|
+
.storeRef(msg)
|
307
|
+
.endCell()
|
308
|
+
},
|
309
|
+
"deCode": function (cell: Cell): any {
|
310
|
+
return 0;
|
311
|
+
}
|
312
|
+
},
|
313
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_TOKENPAIR_Upsert]: {
|
314
|
+
"enCode": function (opts: any): Cell {
|
315
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_TOKENPAIR_Upsert"));
|
316
|
+
let toBuffer, fromBuffer
|
317
|
+
if(opts.fromChainID == BIP44_CHAINID) {
|
318
|
+
let fromAddr = Address.parseFriendly(opts.fromAccount)
|
319
|
+
fromBuffer = fromAddr.address.hash
|
320
|
+
toBuffer = Buffer.from(opts.toAccount.startsWith("0x")?opts.toAccount.slice(2):opts.toAccount,'hex')
|
321
|
+
} else if(opts.toChainID == BIP44_CHAINID) {
|
322
|
+
let toAddr = Address.parseFriendly(opts.toAccount)
|
323
|
+
toBuffer = toAddr.address.hash
|
324
|
+
fromBuffer = Buffer.from(opts.fromAccount.startsWith("0x")?opts.fromAccount.slice(2):opts.fromAccount,'hex')
|
325
|
+
} else {
|
326
|
+
throw("Error chain ID.")
|
327
|
+
}
|
328
|
+
let jettonAdminAddr = Address.parseFriendly(opts.jettonAdminAddr)
|
329
|
+
let jettonAdminAddrBuffer = jettonAdminAddr.address.hash
|
330
|
+
logger.info(formatUtil.format("fromBuffer,toBuffer:", fromBuffer.toString('hex'), toBuffer.toString('hex')));
|
331
|
+
|
332
|
+
let msg = beginCell()
|
333
|
+
.storeUint(opcodes.OP_TOKENPAIR_Upsert, 32)
|
334
|
+
.storeUint(opts.tokenPairId, 32)
|
335
|
+
.storeUint(opts.fromChainID, 32)
|
336
|
+
.storeUint(opts.toChainID, 32)
|
337
|
+
.storeUint(fromBuffer.length, 8)
|
338
|
+
.storeUint(toBuffer.length, 8)
|
339
|
+
.storeBuffer(jettonAdminAddrBuffer)
|
340
|
+
.storeRef(beginCell().storeBuffer(fromBuffer).endCell())
|
341
|
+
.storeRef(beginCell().storeBuffer(toBuffer).endCell())
|
342
|
+
.endCell()
|
343
|
+
return beginCell()
|
344
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
345
|
+
.storeUint(opts.queryID ?? 0, 64)
|
346
|
+
.storeUint(opts.chainId, 64) // chainId
|
347
|
+
.storeAddress(opts.toAddr)
|
348
|
+
.storeRef(msg)
|
349
|
+
.endCell()
|
350
|
+
},
|
351
|
+
"deCode": function (cell: Cell): any {
|
352
|
+
return 0;
|
353
|
+
}
|
354
|
+
},
|
355
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_TOKENPAIR_Remove]: {
|
356
|
+
"enCode": function (opts: any): Cell {
|
357
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_TOKENPAIR_Remove"));
|
358
|
+
let msg = beginCell()
|
359
|
+
.storeUint(opcodes.OP_TOKENPAIR_Remove, 32) // op (op #1 = increment)
|
360
|
+
.storeUint(opts.tokenPairId, 32)
|
361
|
+
.endCell()
|
362
|
+
return beginCell()
|
363
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
364
|
+
.storeUint(opts.queryID ?? 0, 64)
|
365
|
+
.storeUint(opts.chainId, 64) // chainId
|
366
|
+
.storeAddress(opts.toAddr)
|
367
|
+
.storeRef(msg)
|
368
|
+
.endCell()
|
369
|
+
},
|
370
|
+
"deCode": function (cell: Cell): any {
|
371
|
+
return 0;
|
372
|
+
}
|
373
|
+
},
|
374
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_TranferFoundation]: {
|
375
|
+
"enCode": function (opts: any): Cell {
|
376
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_TranferFoundation"));
|
377
|
+
let msg = beginCell()
|
378
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_TranferFoundation, 32) // op (op #1 = increment)
|
379
|
+
.storeAddress(opts.foundation)
|
380
|
+
.endCell()
|
381
|
+
return beginCell()
|
382
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
383
|
+
.storeUint(opts.queryID ?? 0, 64)
|
384
|
+
.storeUint(opts.chainId, 64) // chainId
|
385
|
+
.storeAddress(opts.toAddr)
|
386
|
+
.storeRef(msg)
|
387
|
+
.endCell()
|
388
|
+
},
|
389
|
+
"deCode": function (cell: Cell): any {
|
390
|
+
return 0;
|
391
|
+
}
|
392
|
+
},
|
393
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_TransferOracleAdmin]: {
|
394
|
+
"enCode": function (opts: any): Cell {
|
395
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_TransferOracleAdmin"));
|
396
|
+
let msg = beginCell()
|
397
|
+
.storeUint(opcodes.OP_ORACLE_TransferOracleAdmin, 32) // op (op #1 = increment)
|
398
|
+
.storeAddress(opts.oracleAdmin)
|
399
|
+
.endCell()
|
400
|
+
return beginCell()
|
401
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
402
|
+
.storeUint(opts.queryID ?? 0, 64)
|
403
|
+
.storeUint(opts.chainId, 64) // chainId
|
404
|
+
.storeAddress(opts.toAddr)
|
405
|
+
.storeRef(msg)
|
406
|
+
.endCell()
|
407
|
+
},
|
408
|
+
"deCode": function (cell: Cell): any {
|
409
|
+
return 0;
|
410
|
+
}
|
411
|
+
},
|
412
|
+
[opcodes.OP_GROUPAPPROVE_Proposol_UpgradeSc]: {
|
413
|
+
"enCode": function (opts: any): Cell {
|
414
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Proposol_TranferFoundation"));
|
415
|
+
let msg = beginCell()
|
416
|
+
.storeUint(opcodes.OP_UPGRADE_Code, 32) // op (op #1 = increment)
|
417
|
+
.storeRef(opts.code)
|
418
|
+
.endCell()
|
419
|
+
return beginCell()
|
420
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Proposol, 32) // op (op #1 = increment)
|
421
|
+
.storeUint(opts.queryID ?? 0, 64)
|
422
|
+
.storeUint(opts.chainId, 64) // chainId
|
423
|
+
.storeAddress(opts.toAddr)
|
424
|
+
.storeRef(msg)
|
425
|
+
.endCell()
|
426
|
+
},
|
427
|
+
"deCode": function (cell: Cell): any {
|
428
|
+
return 0;
|
429
|
+
}
|
430
|
+
},
|
431
|
+
[opcodes.OP_GROUPAPPROVE_Execute]: {
|
432
|
+
"enCode": function (opts: any): Cell {
|
433
|
+
logger.info(formatUtil.format("Entering enCode Function OP_GROUPAPPROVE_Execute"));
|
434
|
+
|
435
|
+
let proof = beginCell()
|
436
|
+
.storeUint(opts.e, 256)
|
437
|
+
.storeUint(opts.p, 256)
|
438
|
+
.storeUint(opts.s, 256)
|
439
|
+
.endCell();
|
440
|
+
return beginCell()
|
441
|
+
.storeUint(opcodes.OP_GROUPAPPROVE_Execute, 32)
|
442
|
+
.storeUint(opts.queryID ?? 0, 64)
|
443
|
+
.storeUint(opts.smgId, 256)
|
444
|
+
.storeUint(opts.taskId,64)
|
445
|
+
.storeRef(proof)
|
446
|
+
.endCell()
|
447
|
+
},
|
448
|
+
"deCode": function (cell: Cell): any {
|
449
|
+
return 0;
|
450
|
+
}
|
451
|
+
},
|
452
|
+
[opcodes.OP_FEE_SetTokenPairFees]: {
|
453
|
+
"enCode": function (opts: any): Cell {
|
454
|
+
console.log("Entering enCode Function OP_CROSS_SmgReleases");
|
455
|
+
let count = opts.tokenPairID.length
|
456
|
+
let data = beginCell()
|
457
|
+
.storeUint(opcodes.OP_FEE_SetTokenPairFees, 32)
|
458
|
+
.storeUint(opts.queryID ?? 0, 64)
|
459
|
+
.storeUint(count, 32)
|
460
|
+
for(let i=0; i<count; i++) {
|
461
|
+
data.storeUint(opts.tokenPairID[i], 32)
|
462
|
+
.storeUint(opts.fee[i], 32)
|
463
|
+
}
|
464
|
+
return data.endCell()
|
465
|
+
},
|
466
|
+
"deCode": function (cell: Cell): any {
|
467
|
+
return 0;
|
468
|
+
}
|
469
|
+
},
|
470
|
+
[opcodes.OP_FEE_SetChainFee]: {
|
471
|
+
"enCode": function (opts: any): Cell {
|
472
|
+
console.log("Entering enCode Function OP_FEE_SetChainFees");
|
473
|
+
return beginCell()
|
474
|
+
.storeUint(opcodes.OP_FEE_SetChainFee, 32)
|
475
|
+
.storeUint(opts.queryID ?? 0, 64)
|
476
|
+
.storeUint(opts.srcChainId, 32)
|
477
|
+
.storeUint(opts.dstChainId, 32)
|
478
|
+
.storeUint(opts.contractFee, 32)
|
479
|
+
.storeUint(opts.agentFee, 32)
|
480
|
+
.endCell()
|
481
|
+
},
|
482
|
+
"deCode": function (cell: Cell): any {
|
483
|
+
return 0;
|
484
|
+
}
|
485
|
+
},
|
486
|
+
[opcodes.OP_FEE_SetChainFees]: {
|
487
|
+
"enCode": function (opts: any): Cell {
|
488
|
+
console.log("Entering enCode Function OP_FEE_SetChainFee");
|
489
|
+
let count = opts.srcChainId.length
|
490
|
+
|
491
|
+
let data = beginCell()
|
492
|
+
.storeUint(opcodes.OP_FEE_SetChainFees, 32)
|
493
|
+
.storeUint(opts.queryID ?? 0, 64)
|
494
|
+
.storeUint(count, 32)
|
495
|
+
for(let i=0; i<count; i++) {
|
496
|
+
data.storeUint(opts.srcChainId[i], 32)
|
497
|
+
.storeUint(opts.dstChainId[i], 32)
|
498
|
+
.storeUint(opts.contractFee[i], 32)
|
499
|
+
.storeUint(opts.agentFee[i], 32)
|
500
|
+
}
|
501
|
+
|
502
|
+
return data.endCell()
|
503
|
+
},
|
504
|
+
"deCode": function (cell: Cell): any {
|
505
|
+
return 0;
|
506
|
+
}
|
507
|
+
},
|
508
|
+
[opcodes.OP_TOKENPAIR_Upsert]: {
|
509
|
+
"enCode": function (opts: any): Cell {
|
510
|
+
let toBuffer, fromBuffer;
|
511
|
+
if (opts.fromChainID == BIP44_CHAINID) {
|
512
|
+
if (opts.fromAccount == "") {
|
513
|
+
fromBuffer = Buffer.from(TON_COIN_ACCOUT.slice(2), 'hex')
|
514
|
+
} else {
|
515
|
+
let fromAddr = Address.parseFriendly(opts.fromAccount)
|
516
|
+
fromBuffer = fromAddr.address.hash
|
517
|
+
}
|
518
|
+
toBuffer = Buffer.from(opts.toAccount.startsWith("0x")?opts.toAccount.substring(2):opts.toAccount, 'hex')
|
519
|
+
|
520
|
+
} else if (opts.toChainID == BIP44_CHAINID) {
|
521
|
+
if (opts.toAccount == "") {
|
522
|
+
toBuffer = Buffer.from(TON_COIN_ACCOUT.slice(2), 'hex')
|
523
|
+
} else {
|
524
|
+
let toAddr = Address.parseFriendly(opts.toAccount)
|
525
|
+
toBuffer = toAddr.address.hash
|
526
|
+
}
|
527
|
+
fromBuffer = Buffer.from(opts.fromAccount.startsWith("0x")?opts.fromAccount.substring(2):opts.fromAccount, 'hex')
|
528
|
+
} else {
|
529
|
+
throw ("Error chain ID.")
|
530
|
+
}
|
531
|
+
|
532
|
+
let jettonAdminBuffer;
|
533
|
+
if (opts.jettonAdminAddr == "") {
|
534
|
+
jettonAdminBuffer = Buffer.from(TON_COIN_ACCOUT.slice(2), 'hex')
|
535
|
+
} else {
|
536
|
+
jettonAdminBuffer = Address.parseFriendly(opts.jettonAdminAddr).address.hash
|
537
|
+
}
|
538
|
+
|
539
|
+
logger.info(formatUtil.format("fromBuffer,toBuffer:", fromBuffer.toString('hex'), toBuffer.toString('hex')));
|
540
|
+
return beginCell()
|
541
|
+
.storeUint(opcodes.OP_TOKENPAIR_Upsert, 32)
|
542
|
+
.storeUint(opts.queryID ?? 0, 64)
|
543
|
+
.storeUint(opts.tokenPairId, 32)
|
544
|
+
.storeUint(opts.fromChainID, 32)
|
545
|
+
.storeUint(opts.toChainID, 32)
|
546
|
+
.storeUint(fromBuffer.length, 8)
|
547
|
+
.storeUint(toBuffer.length, 8)
|
548
|
+
.storeRef(beginCell().storeBuffer(fromBuffer).endCell())
|
549
|
+
.storeRef(beginCell().storeBuffer(toBuffer).endCell())
|
550
|
+
.storeBuffer(jettonAdminBuffer)
|
551
|
+
.endCell()
|
552
|
+
},
|
553
|
+
"deCode": function (cell: Cell): any {
|
554
|
+
let slice = cell.beginParse();
|
555
|
+
let opCode = slice.loadUint(32);
|
556
|
+
let queryID = slice.loadUint(64);
|
557
|
+
let tokenPairID = slice.loadUint(32);
|
558
|
+
let fromChainID = slice.loadUint(32);
|
559
|
+
let toChainID = slice.loadUint(32);
|
560
|
+
let fromLen = slice.loadUint(8);
|
561
|
+
let toLength = slice.loadUint(8);
|
562
|
+
|
563
|
+
let sliceFrom = slice.loadRef().beginParse();
|
564
|
+
let fromBuffer = sliceFrom.loadBits(8*fromLen);
|
565
|
+
sliceFrom.endParse();
|
566
|
+
logger.info(formatUtil.format("fromBuffer=>",fromBuffer));
|
567
|
+
|
568
|
+
let sliceTo = slice.loadRef().beginParse();
|
569
|
+
let toBuffer = sliceTo.loadBits(8*toLength);
|
570
|
+
sliceTo.endParse();
|
571
|
+
logger.info(formatUtil.format("toBuffer=>",toBuffer));
|
572
|
+
let jettonAdmin = slice.loadBits(256)
|
573
|
+
slice.endParse();
|
574
|
+
|
575
|
+
return {
|
576
|
+
opCode,queryID,tokenPairID,fromChainID,toChainID,fromAccount:fromBuffer,toAccount:toBuffer,jettonAdmin:jettonAdmin
|
577
|
+
}
|
578
|
+
},
|
579
|
+
"emitEvent": function(opts){
|
580
|
+
return {
|
581
|
+
eventName:"AddTokenPair",
|
582
|
+
id:opts.tokenPairID,
|
583
|
+
fromChainID:opts.fromChainID,
|
584
|
+
fromAccount:opts.fromAccount,
|
585
|
+
toChainID:opts.toChainID,
|
586
|
+
toAccount:opts.toAccount,
|
587
|
+
txHashBase64:opts.txHashBase64,
|
588
|
+
txHash:opts.txHash,
|
589
|
+
lt:opts?.lt,
|
590
|
+
}
|
591
|
+
}
|
592
|
+
},
|
593
|
+
[opcodes.OP_TOKENPAIR_Remove]: {
|
594
|
+
"enCode": function (opts: any): Cell {
|
595
|
+
return beginCell()
|
596
|
+
.storeUint(opcodes.OP_TOKENPAIR_Remove, 32)
|
597
|
+
.storeUint(opts.queryID ?? 0, 64)
|
598
|
+
.storeUint(opts.tokenPairId, 32)
|
599
|
+
.endCell();
|
600
|
+
},
|
601
|
+
"deCode": function (cell: Cell): any {
|
602
|
+
let slice = cell.beginParse();
|
603
|
+
let opCode = slice.loadUint(32);
|
604
|
+
let queryID = slice.loadUint(64);
|
605
|
+
let tokenPairID = slice.loadUint(32);
|
606
|
+
slice.endParse();
|
607
|
+
|
608
|
+
return {
|
609
|
+
opCode,queryID,tokenPairID
|
610
|
+
}
|
611
|
+
},
|
612
|
+
"emitEvent": function(opts){
|
613
|
+
return {
|
614
|
+
eventName:"RemoveTokenPair",
|
615
|
+
id:opts.tokenPairID,
|
616
|
+
txHashBase64:opts.txHashBase64,
|
617
|
+
txHash:opts.txHash,
|
618
|
+
lt:opts?.lt,
|
619
|
+
}
|
620
|
+
}
|
621
|
+
}
|
622
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"keep": {
|
3
|
+
"days": true,
|
4
|
+
"amount": 10
|
5
|
+
},
|
6
|
+
"auditLog": "log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json",
|
7
|
+
"files": [
|
8
|
+
{
|
9
|
+
"date": 1736922538508,
|
10
|
+
"name": "log/wan-ton-sdk.out.2025-01-15",
|
11
|
+
"hash": "a6cce10738a23748293b14f1744294dc6ff3d6989c1ed4237bb99bb267bf2a61"
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"date": 1737368456508,
|
15
|
+
"name": "log/wan-ton-sdk.out.2025-01-20",
|
16
|
+
"hash": "2e2ae9ecf306023279a14b86c75d2dc8e7875dd9977ee0600f34376690857d4f"
|
17
|
+
}
|
18
|
+
],
|
19
|
+
"hashType": "sha256"
|
20
|
+
}
|
File without changes
|
File without changes
|