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
package/db/Db.spec.ts
ADDED
@@ -0,0 +1,193 @@
|
|
1
|
+
const DB = require("../db/Db").DB;
|
2
|
+
const RangeOpen = require("../db/Db").RangeOpen;
|
3
|
+
let testDB;
|
4
|
+
|
5
|
+
const parentTx = {
|
6
|
+
hash: "0x1234",
|
7
|
+
lt: 1n,
|
8
|
+
raw: '',
|
9
|
+
in: {
|
10
|
+
src: 'src',
|
11
|
+
inMsgHash: 'inMsgHash',
|
12
|
+
inBodyHash: 'inMsgBodyHash',
|
13
|
+
createdLt: 1234n,
|
14
|
+
createAt: 4n,
|
15
|
+
},
|
16
|
+
out: [{
|
17
|
+
dst: 'src1',
|
18
|
+
outMsgHash: 'outMsgHash1',
|
19
|
+
outBodyHash: 'outBodyHash1',
|
20
|
+
createdLt: 1234n,
|
21
|
+
createAt: 3n,
|
22
|
+
}, {
|
23
|
+
dst: 'src2',
|
24
|
+
outMsgHash: 'outMsgHash2',
|
25
|
+
outBodyHash: 'outBodyHash2',
|
26
|
+
createdLt: 5678n,
|
27
|
+
createAt: 3n,
|
28
|
+
}],
|
29
|
+
emitEventOrNot: false,
|
30
|
+
}
|
31
|
+
|
32
|
+
const childTx1 = {
|
33
|
+
hash: "0x5678",
|
34
|
+
lt: 1n,
|
35
|
+
raw: '',
|
36
|
+
in: {
|
37
|
+
src: 'src1',
|
38
|
+
inMsgHash: 'outMsgHash1',
|
39
|
+
inBodyHash: 'outBodyHash1',
|
40
|
+
createdLt: 1234n,
|
41
|
+
createAt: 4n,
|
42
|
+
},
|
43
|
+
out: [{
|
44
|
+
dst: 'dst',
|
45
|
+
outMsgHash: 'outMsgHash',
|
46
|
+
outBodyHash: 'outBodyHash',
|
47
|
+
createdLt: 2n,
|
48
|
+
createAt: 3n,
|
49
|
+
}],
|
50
|
+
emitEventOrNot: false,
|
51
|
+
}
|
52
|
+
|
53
|
+
const childTx2 = {
|
54
|
+
hash: "0x9abc",
|
55
|
+
lt: 1n,
|
56
|
+
raw: '',
|
57
|
+
in: {
|
58
|
+
src: 'src2',
|
59
|
+
inMsgHash: 'outMsgHash2',
|
60
|
+
inBodyHash: 'outBodyHash2',
|
61
|
+
createdLt: 5678n,
|
62
|
+
createAt: 4n,
|
63
|
+
},
|
64
|
+
out: [{
|
65
|
+
dst: 'dst',
|
66
|
+
outMsgHash: 'outMsgHash',
|
67
|
+
outBodyHash: 'outBodyHash',
|
68
|
+
createdLt: 2n,
|
69
|
+
createAt: 3n,
|
70
|
+
}],
|
71
|
+
emitEventOrNot: false,
|
72
|
+
};
|
73
|
+
|
74
|
+
const ParentTrans = [
|
75
|
+
parentTx, childTx1, childTx2
|
76
|
+
]
|
77
|
+
|
78
|
+
describe('DB', () => {
|
79
|
+
|
80
|
+
|
81
|
+
beforeEach(async () => {
|
82
|
+
console.log("DB beforeAll");
|
83
|
+
testDB = new DB('test');
|
84
|
+
await testDB.init('testDb');
|
85
|
+
}, 50000);
|
86
|
+
|
87
|
+
afterEach(async () => {
|
88
|
+
console.log("clear DB");
|
89
|
+
await testDB.clearDb();
|
90
|
+
testDB = null;
|
91
|
+
}, 50000);
|
92
|
+
|
93
|
+
it('DB setScanStarted', async () => {
|
94
|
+
console.log("DB setScanStarted");
|
95
|
+
await testDB.setScanStarted();
|
96
|
+
}, 500000);
|
97
|
+
|
98
|
+
it('DB updateTasks', async () => {
|
99
|
+
console.log("DB setScanStarted");
|
100
|
+
let tasks = [
|
101
|
+
{
|
102
|
+
rangeStart: 2n,
|
103
|
+
rangeEnd: 5n,
|
104
|
+
rangeOpen: RangeOpen.RightOpenRange,
|
105
|
+
},
|
106
|
+
{
|
107
|
+
rangeStart: 5n,
|
108
|
+
rangeEnd: 6n,
|
109
|
+
rangeOpen: RangeOpen.RightOpenRange,
|
110
|
+
},
|
111
|
+
]
|
112
|
+
await testDB.updateTask(tasks);
|
113
|
+
}, 500000);
|
114
|
+
|
115
|
+
it('DB updateTasks', async () => {
|
116
|
+
console.log("DB updateTasks");
|
117
|
+
let tasks = await testDB.getTasks();
|
118
|
+
console.log(tasks);
|
119
|
+
}, 500000);
|
120
|
+
|
121
|
+
it('DB setTranHandleFlag', async () => {
|
122
|
+
console.log("DB updateTasks");
|
123
|
+
let tasks = await testDB.getTasks();
|
124
|
+
console.log(tasks);
|
125
|
+
}, 500000);
|
126
|
+
|
127
|
+
it('DB insertTans', async () => {
|
128
|
+
console.log("DB insertTans");
|
129
|
+
let trans = [
|
130
|
+
{
|
131
|
+
hash: "0x1234",
|
132
|
+
lt: 1n,
|
133
|
+
raw: '',
|
134
|
+
in: {
|
135
|
+
src: 'src',
|
136
|
+
inMsgHash: 'inMsgHash',
|
137
|
+
inBodyHash: 'inMsgBodyHash',
|
138
|
+
createdLt: 3n,
|
139
|
+
createAt: 4n,
|
140
|
+
},
|
141
|
+
out: [{
|
142
|
+
dst: 'dst',
|
143
|
+
outMsgHash: 'outMsgHash',
|
144
|
+
outBodyHash: 'outBodyHash',
|
145
|
+
createdLt: 2n,
|
146
|
+
createAt: 3n,
|
147
|
+
}],
|
148
|
+
emitEventOrNot: false,
|
149
|
+
},
|
150
|
+
{
|
151
|
+
hash: "0x5678",
|
152
|
+
lt: 1n,
|
153
|
+
raw: '',
|
154
|
+
in: {
|
155
|
+
src: 'src',
|
156
|
+
inMsgHash: 'inMsgHash',
|
157
|
+
inBodyHash: 'inMsgBodyHash',
|
158
|
+
createdLt: 3n,
|
159
|
+
createAt: 4n,
|
160
|
+
},
|
161
|
+
out: [{
|
162
|
+
dst: 'dst',
|
163
|
+
outMsgHash: 'outMsgHash',
|
164
|
+
outBodyHash: 'outBodyHash',
|
165
|
+
createdLt: 2n,
|
166
|
+
createAt: 3n,
|
167
|
+
}],
|
168
|
+
emitEventOrNot: false,
|
169
|
+
},
|
170
|
+
]
|
171
|
+
await testDB.insertTrans(trans);
|
172
|
+
|
173
|
+
}, 500000);
|
174
|
+
|
175
|
+
it('DB getParent', async () => {
|
176
|
+
console.log("DB getParent");
|
177
|
+
await testDB.insertTrans(ParentTrans);
|
178
|
+
let parent = await testDB.getParenTx(childTx1);
|
179
|
+
console.log("parent",parent);
|
180
|
+
|
181
|
+
parent = await testDB.getParenTx(childTx2);
|
182
|
+
console.log("parent",parent);
|
183
|
+
|
184
|
+
}, 500000);
|
185
|
+
|
186
|
+
it('DB getChildren', async () => {
|
187
|
+
console.log("DB getChildren");
|
188
|
+
await testDB.insertTrans(ParentTrans);
|
189
|
+
let children = await testDB.getChildTxs(parentTx);
|
190
|
+
console.log(children);
|
191
|
+
}, 500000);
|
192
|
+
|
193
|
+
});
|