wan-ton-sdk 0.0.7 → 0.0.9

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.
Files changed (247) hide show
  1. package/dist/Bridge.compile.d.ts +2 -0
  2. package/dist/Bridge.compile.js +9 -0
  3. package/dist/Bridge.d.ts +208 -0
  4. package/dist/Bridge.js +468 -0
  5. package/dist/Fake.compile.d.ts +2 -0
  6. package/dist/Fake.compile.js +9 -0
  7. package/dist/GroupApprove.compile.d.ts +2 -0
  8. package/dist/GroupApprove.compile.js +7 -0
  9. package/dist/GroupApprove.d.ts +124 -0
  10. package/dist/GroupApprove.js +181 -0
  11. package/dist/JettonMinter.compile.d.ts +2 -0
  12. package/dist/JettonMinter.compile.js +6 -0
  13. package/dist/JettonMinter.d.ts +45 -0
  14. package/dist/JettonMinter.js +124 -0
  15. package/dist/JettonWallet.compile.d.ts +2 -0
  16. package/dist/JettonWallet.compile.js +6 -0
  17. package/dist/JettonWallet.d.ts +26 -0
  18. package/dist/JettonWallet.js +103 -0
  19. package/dist/Signature.compile.d.ts +2 -0
  20. package/dist/Signature.compile.js +7 -0
  21. package/dist/Signature.d.ts +44 -0
  22. package/dist/Signature.js +106 -0
  23. package/dist/address.compile.d.ts +2 -0
  24. package/dist/address.compile.js +9 -0
  25. package/dist/client/client-interface.d.ts +35 -0
  26. package/dist/client/client-interface.js +9 -0
  27. package/dist/client/client.d.ts +22 -0
  28. package/dist/client/client.js +86 -0
  29. package/dist/client/tonapi-client.d.ts +4630 -0
  30. package/dist/client/tonapi-client.js +5376 -0
  31. package/dist/code/encode-decode.d.ts +132 -0
  32. package/dist/code/encode-decode.js +645 -0
  33. package/dist/code/userLock.d.ts +39 -0
  34. package/dist/code/userLock.js +284 -0
  35. package/dist/common.d.ts +9 -0
  36. package/dist/common.js +45 -0
  37. package/dist/config/config-ex.d.ts +7 -0
  38. package/dist/config/config-ex.js +73 -0
  39. package/dist/const/const-value.d.ts +21 -0
  40. package/dist/const/const-value.js +26 -0
  41. package/dist/contractAccess/bridgeAccess.d.ts +10 -0
  42. package/dist/contractAccess/bridgeAccess.js +55 -0
  43. package/dist/contractAccess/groupApproveAccess.d.ts +10 -0
  44. package/dist/contractAccess/groupApproveAccess.js +54 -0
  45. package/dist/db/Db.d.ts +24 -0
  46. package/dist/db/Db.js +739 -0
  47. package/dist/db/DbAccess.d.ts +24 -0
  48. package/dist/db/DbAccess.js +211 -0
  49. package/dist/db/common.d.ts +5 -0
  50. package/dist/db/common.js +114 -0
  51. package/dist/event/getEvents.d.ts +17 -0
  52. package/dist/event/getEvents.js +387 -0
  53. package/dist/example/db/createDb-ex.d.ts +1 -0
  54. package/{example/createDb-ex.ts → dist/example/db/createDb-ex.js} +3 -4
  55. package/dist/example/db/dbFeedTrans-ex.d.ts +1 -0
  56. package/{example/dbFeedTrans-ex.ts → dist/example/db/dbFeedTrans-ex.js} +9 -11
  57. package/dist/example/event/getAllEvents-ex.d.ts +1 -0
  58. package/dist/example/event/getAllEvents-ex.js +70 -0
  59. package/dist/example/event/getEventByHash-ex.d.ts +1 -0
  60. package/{example/getEventByHash-ex.ts → dist/example/event/getEventByHash-ex.js} +21 -25
  61. package/dist/example/event/getEventsByRange-ex.d.ts +1 -0
  62. package/dist/example/event/getEventsByRange-ex.js +58 -0
  63. package/dist/example/getAllTrans.d.ts +1 -0
  64. package/dist/example/getAllTrans.js +30 -0
  65. package/dist/example/jetton/getJettonInfo-ex.d.ts +1 -0
  66. package/dist/example/jetton/getJettonInfo-ex.js +32 -0
  67. package/dist/example/lock-release/smgRelease-ex.d.ts +1 -0
  68. package/dist/example/lock-release/smgRelease-ex.js +134 -0
  69. package/dist/example/lock-release/userLock-ex.d.ts +1 -0
  70. package/dist/example/lock-release/userLock-ex.js +69 -0
  71. package/dist/example/manage/addSmg-ex.d.ts +1 -0
  72. package/dist/example/manage/addSmg-ex.js +59 -0
  73. package/dist/example/manage/compileContract-ex.d.ts +1 -0
  74. package/dist/example/manage/compileContract-ex.js +11 -0
  75. package/dist/example/manage/deploy-ex.d.ts +1 -0
  76. package/dist/example/manage/deploy-ex.js +58 -0
  77. package/dist/example/manage/setFee-ex.d.ts +1 -0
  78. package/dist/example/manage/setFee-ex.js +61 -0
  79. package/dist/example/manage/setFeeProxy.d.ts +1 -0
  80. package/dist/example/manage/setFeeProxy.js +47 -0
  81. package/dist/example/manage/upgradeBridgeSc-ex.d.ts +1 -0
  82. package/dist/example/manage/upgradeBridgeSc-ex.js +44 -0
  83. package/dist/example/token/AddToken-ex.d.ts +1 -0
  84. package/dist/example/token/AddToken-ex.js +113 -0
  85. package/dist/example/token/addTokenPair-ex.d.ts +1 -0
  86. package/dist/example/token/addTokenPair-ex.js +59 -0
  87. package/dist/example/token/delTokenPair-ex.d.ts +1 -0
  88. package/dist/example/token/delTokenPair-ex.js +49 -0
  89. package/dist/example/token/getTokenPair-ex.d.ts +1 -0
  90. package/dist/example/token/getTokenPair-ex.js +39 -0
  91. package/dist/example/token/mintToken-ex.d.ts +1 -0
  92. package/dist/example/token/mintToken-ex.js +56 -0
  93. package/dist/example/tran/converTranToTonTran.d.ts +1 -0
  94. package/dist/example/tran/converTranToTonTran.js +32 -0
  95. package/dist/example/tran/getTransByRange-ex.d.ts +1 -0
  96. package/{example/getTransByRange-ex.ts → dist/example/tran/getTransByRange-ex.js} +26 -40
  97. package/dist/example/tran/getTransaction-ex.d.ts +1 -0
  98. package/dist/example/tran/getTransaction-ex.js +47 -0
  99. package/dist/example/tran/isTranSuccess-ex.d.ts +1 -0
  100. package/dist/example/tran/isTranSuccess-ex.js +27 -0
  101. package/dist/fee/fee.d.ts +12 -0
  102. package/dist/fee/fee.js +21 -0
  103. package/dist/index.d.ts +15 -0
  104. package/dist/index.js +95 -0
  105. package/dist/jest.config.d.ts +3 -0
  106. package/dist/jest.config.js +8 -0
  107. package/dist/opcodes.d.ts +55 -0
  108. package/dist/opcodes.js +59 -0
  109. package/dist/sign/buildHash.d.ts +6 -0
  110. package/dist/sign/buildHash.js +39 -0
  111. package/dist/sign/rawTrans.d.ts +36 -0
  112. package/dist/sign/rawTrans.js +89 -0
  113. package/dist/sign/tools-secp256k1.d.ts +21 -0
  114. package/{sign → dist/sign}/tools-secp256k1.js +18 -44
  115. package/dist/testData/JettonMinter.compile.func.d.ts +2 -0
  116. package/dist/testData/JettonMinter.compile.func.js +13 -0
  117. package/dist/testData/JettonWallet.compile.func.d.ts +2 -0
  118. package/dist/testData/JettonWallet.compile.func.js +13 -0
  119. package/dist/testData/bridge.compile.func.d.ts +2 -0
  120. package/dist/testData/bridge.compile.func.js +13 -0
  121. package/dist/transResult/transResult.d.ts +29 -0
  122. package/dist/transResult/transResult.js +528 -0
  123. package/dist/utils/compileContract.d.ts +13 -0
  124. package/dist/utils/compileContract.js +54 -0
  125. package/dist/utils/logger.d.ts +16 -0
  126. package/dist/utils/logger.js +94 -0
  127. package/dist/utils/utils.d.ts +26 -0
  128. package/dist/utils/utils.js +330 -0
  129. package/dist/wallet/balance.d.ts +5 -0
  130. package/dist/wallet/balance.js +29 -0
  131. package/dist/wallet/jetton.d.ts +16 -0
  132. package/dist/wallet/jetton.js +171 -0
  133. package/dist/wallet/walletContract.d.ts +31 -0
  134. package/dist/wallet/walletContract.js +106 -0
  135. package/package.json +8 -6
  136. package/Bridge.compile.ts +0 -8
  137. package/Bridge.ts +0 -645
  138. package/Bridge.ts.org +0 -647
  139. package/Fake.compile.ts +0 -8
  140. package/GroupApprove.compile.ts +0 -6
  141. package/GroupApprove.ts +0 -274
  142. package/JettonMinter.compile.ts +0 -5
  143. package/JettonMinter.ts +0 -135
  144. package/JettonWallet.compile.ts +0 -5
  145. package/JettonWallet.ts +0 -127
  146. package/Signature.compile.ts +0 -6
  147. package/Signature.ts +0 -105
  148. package/address.compile.ts +0 -8
  149. package/client/1.json +0 -1730
  150. package/client/client.ts +0 -73
  151. package/client/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +0 -15
  152. package/code/decode.spec.ts +0 -81
  153. package/code/encode-decode.ts +0 -622
  154. package/code/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +0 -20
  155. package/code/log/wan-ton-sdk.out.2025-01-20 +0 -0
  156. package/code/userLock.ts +0 -291
  157. package/common.ts +0 -62
  158. package/config/config-ex.ts +0 -25
  159. package/config/config.ts +0 -1
  160. package/const/const-value.ts +0 -33
  161. package/contractAccess/bridgeAccess.ts +0 -60
  162. package/contractAccess/groupApproveAccess.ts +0 -59
  163. package/data/EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs.json +0 -7348
  164. package/db/Db.spec.ts +0 -193
  165. package/db/Db.ts +0 -736
  166. package/db/DbAccess.spec.ts +0 -23
  167. package/db/DbAccess.ts +0 -186
  168. package/db/common.ts +0 -94
  169. package/db/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +0 -15
  170. package/db/log/wan-ton-sdk.out.2025-04-21 +0 -0
  171. package/event/getEvents.ts +0 -441
  172. package/event/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +0 -15
  173. package/event/log/wan-ton-sdk.out.2024-12-19 +0 -0
  174. package/example/0:1.txt +0 -1
  175. package/example/AddToken-ex.ts +0 -148
  176. package/example/README.md +0 -21
  177. package/example/addSmg-ex.ts +0 -78
  178. package/example/addTokenPair-ex.ts +0 -73
  179. package/example/compileContract-ex.ts +0 -10
  180. package/example/converTranToTonTran.ts +0 -43
  181. package/example/delTokenPair-ex.ts +0 -63
  182. package/example/deploy-ex.ts +0 -68
  183. package/example/getAllEvents-ex.ts +0 -61
  184. package/example/getAllTrans.ts +0 -32
  185. package/example/getContractState-ex.ts +0 -33
  186. package/example/getEvents-ex.ts +0 -55
  187. package/example/getJettonInfo-ex.ts +0 -44
  188. package/example/getTokenPair-ex.ts +0 -47
  189. package/example/getTransaction-ex.ts +0 -62
  190. package/example/isTranSuccess-ex.ts +0 -33
  191. package/example/locateTx-ex.ts +0 -44
  192. package/example/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +0 -55
  193. package/example/log/wan-ton-sdk.out.2025-04-21 +0 -447
  194. package/example/log/wan-ton-sdk.out.2025-04-22 +0 -1918
  195. package/example/log/wan-ton-sdk.out.2025-04-23 +0 -4216
  196. package/example/log/wan-ton-sdk.out.2025-04-24.gz +0 -0
  197. package/example/log/wan-ton-sdk.out.2025-04-25 +0 -46814
  198. package/example/log/wan-ton-sdk.out.2025-04-27.gz +0 -0
  199. package/example/log/wan-ton-sdk.out.2025-04-28 +0 -4966
  200. package/example/log/wan-ton-sdk.out.2025-04-29 +0 -1328
  201. package/example/log/wan-ton-sdk.out.2025-04-30 +0 -9
  202. package/example/mintToken-ex.ts +0 -82
  203. package/example/setFee-ex.ts +0 -82
  204. package/example/setFeeProxy.ts +0 -70
  205. package/example/smgRelease-ex.ts +0 -173
  206. package/example/upgradeBridgeSc-ex.ts +0 -49
  207. package/example/userLock-ex.ts +0 -78
  208. package/fee/fee.ts +0 -23
  209. package/index.ts +0 -76
  210. package/jest.config.ts +0 -9
  211. package/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +0 -20
  212. package/log/wan-ton-sdk.out.2025-04-21 +0 -0
  213. package/log/wan-ton-sdk.out.2025-04-30 +0 -10
  214. package/opcodes.ts +0 -58
  215. package/publish.sh +0 -78
  216. package/sign/buildHash.ts +0 -47
  217. package/sign/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +0 -15
  218. package/sign/log/wan-ton-sdk.out.2025-04-14 +0 -3
  219. package/sign/rawTrans.spec.ts +0 -117
  220. package/sign/rawTrans.ts +0 -122
  221. package/testData/JettonMinter.compile.func.ts +0 -8
  222. package/testData/JettonWallet.compile.func.ts +0 -8
  223. package/testData/addressList.json +0 -6
  224. package/testData/bridge.compile.func.ts +0 -8
  225. package/testData/bridge.compiled.json +0 -1
  226. package/testData/contractAddress.json +0 -7
  227. package/testData/jettonTokenInfo.json +0 -14
  228. package/testData/prvlist.json +0 -6
  229. package/testData/smg.json +0 -5
  230. package/testData/tokenInfo.json +0 -23
  231. package/transResult/transResult.ts +0 -608
  232. package/tsconfig.json +0 -19
  233. package/utils/.compiled.json +0 -1
  234. package/utils/compileContract.ts +0 -60
  235. package/utils/log/.ba8901062aebb86bf525b42c65ff84f9485419e4-audit.json +0 -15
  236. package/utils/log/wan-ton-sdk.out.2025-01-08 +0 -0
  237. package/utils/logger.spec.ts +0 -14
  238. package/utils/logger.ts +0 -96
  239. package/utils/utils.spec.ts +0 -21
  240. package/utils/utils.ts +0 -295
  241. package/wallet/balance.ts +0 -29
  242. package/wallet/jetton.spec.ts +0 -27
  243. package/wallet/jetton.ts +0 -159
  244. package/wallet/walletContract.spec.ts +0 -111
  245. package/wallet/walletContract.ts +0 -105
  246. /package/{client/log/wan-ton-sdk.out.2024-12-19 → dist/config/config.d.ts} +0 -0
  247. /package/{code/log/wan-ton-sdk.out.2025-01-15 → dist/config/config.js} +0 -0
@@ -0,0 +1,284 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.LOCK_TYPE = void 0;
37
+ exports.buildUserLockMessages = buildUserLockMessages;
38
+ exports.getFee = getFee;
39
+ exports.getJettonWalletAddr = getJettonWalletAddr;
40
+ exports.getJettonAdminAddr = getJettonAdminAddr;
41
+ exports.getTokenPairInfo = getTokenPairInfo;
42
+ const utils_1 = require("../utils/utils");
43
+ const walletContract_1 = require("../wallet/walletContract");
44
+ const ton_1 = require("@ton/ton");
45
+ const bridgeAccess_1 = require("../contractAccess/bridgeAccess");
46
+ const core_1 = require("@ton/core");
47
+ const const_value_1 = require("../const/const-value");
48
+ const opcodes = __importStar(require("../opcodes"));
49
+ const Bridge_1 = require("../Bridge");
50
+ const fee_1 = require("../fee/fee");
51
+ const client_interface_1 = require("../client/client-interface");
52
+ const formatUtil = require('util');
53
+ const logger_1 = require("../utils/logger");
54
+ exports.LOCK_TYPE = {
55
+ coin: 1,
56
+ tokenOrg: 2,
57
+ tokenWrapped: 3
58
+ };
59
+ async function buildUserLockMessages(opts, differentQueryID) {
60
+ const { client, ...filtered } = opts;
61
+ logger_1.logger.info("buildUserLockMessages", "opts", filtered);
62
+ let queryID = await (0, utils_1.getQueryID)();
63
+ if (!core_1.Address.isAddress(core_1.Address.parse(opts.bridgeScAddr))) {
64
+ throw new Error(formatUtil.format("invalid bridgeScAddr %s", opts.bridgeScAddr));
65
+ }
66
+ if (!(await (0, walletContract_1.isAddrDepolyed)(opts.client, opts.bridgeScAddr))) {
67
+ throw new Error(formatUtil.format("contract %s is not deployed", opts.bridgeScAddr));
68
+ }
69
+ let tokenPairInfo = (await getTokenPairInfo(opts.client, core_1.Address.parse(opts.bridgeScAddr), opts.tokenPairID));
70
+ let tokenAccount = tokenPairInfo.tokenAccount;
71
+ let fromChainID = tokenPairInfo.srcChainID;
72
+ let dstChainID = tokenPairInfo.toChainID;
73
+ let lockFee = BigInt(await getFee(opts.client, core_1.Address.parse(opts.bridgeScAddr), opts.tokenPairID, fromChainID, dstChainID));
74
+ logger_1.logger.info("lockFee=%s", lockFee.toString(10));
75
+ let addrTokenAccount;
76
+ let jwAddrBridgeSc;
77
+ let jwAddrSrc;
78
+ logger_1.logger.info("tokenAccount", tokenAccount);
79
+ logger_1.logger.info("TON_COIN_ACCOUNT_STR", const_value_1.TON_COIN_ACCOUNT_STR);
80
+ if (tokenAccount == const_value_1.TON_COIN_ACCOUNT_STR) {
81
+ jwAddrBridgeSc = jwAddrSrc = addrTokenAccount = core_1.Address.parse(const_value_1.TON_COIN_ACCOUNT_STR);
82
+ return buildLockCoinMessages(opts, jwAddrBridgeSc, jwAddrSrc, addrTokenAccount, lockFee);
83
+ }
84
+ else {
85
+ addrTokenAccount = core_1.Address.parse(tokenAccount);
86
+ jwAddrBridgeSc = await getJettonWalletAddr(opts.client, addrTokenAccount, core_1.Address.parse(opts.bridgeScAddr));
87
+ jwAddrSrc = await getJettonWalletAddr(opts.client, addrTokenAccount, core_1.Address.parse(opts.senderAccount));
88
+ logger_1.logger.info("jwAddrBridgeSc(big)", (0, utils_1.AddressToBig)(jwAddrBridgeSc), "addrTokenAccount(big)", (0, utils_1.AddressToBig)(addrTokenAccount), "bridgeScAddr(big)", (0, utils_1.AddressToBig)(core_1.Address.parse(opts.bridgeScAddr)));
89
+ logger_1.logger.info("jwAddrSrc(big)", (0, utils_1.AddressToBig)(jwAddrSrc), "addrTokenAccount(big)", (0, utils_1.AddressToBig)(addrTokenAccount), "AddrSrc(big)", (0, utils_1.AddressToBig)(core_1.Address.parse(opts.senderAccount)));
90
+ let jettonAdminAddr;
91
+ jettonAdminAddr = await getJettonAdminAddr(opts.client, addrTokenAccount);
92
+ logger_1.logger.info("jettonAdminAddr from getJettonAdminAddr", jettonAdminAddr.toString());
93
+ addrTokenAccount = core_1.Address.parse(tokenAccount);
94
+ if (jettonAdminAddr.toString() == opts.bridgeScAddr.toString()) {
95
+ return buildLockWrappedTokenMessages(opts, jwAddrBridgeSc, jwAddrSrc, addrTokenAccount, lockFee, BigInt(differentQueryID | 0));
96
+ }
97
+ else {
98
+ return buildLockOriginalTokenMessages(opts, jwAddrBridgeSc, jwAddrSrc, addrTokenAccount, lockFee, BigInt(differentQueryID | 0));
99
+ }
100
+ }
101
+ throw new Error("unknown tokenAccount");
102
+ }
103
+ async function buildInternalMessage(src) {
104
+ return (0, core_1.internal)(src);
105
+ }
106
+ async function buildLockCoinMessages(opts, jwAddrBridgeSc, jwAddrSrc, addrTokenAccount, lockFee) {
107
+ logger_1.logger.info("buildLockCoinMessages", "jwAddrBridgeSc", jwAddrBridgeSc.toString(), "jwAddrSrc", jwAddrSrc.toString(), "addrTokenAccount", addrTokenAccount.toString(), "lockFee", lockFee);
108
+ let totalValue;
109
+ totalValue = opts.value + opts.crossValue;
110
+ logger_1.logger.info("totalValue=>", totalValue);
111
+ let queryId = await (0, utils_1.getQueryID)();
112
+ let dstUserAccountBuffer = Buffer.from(opts.dstUserAccount, 'hex');
113
+ let dstUserAccountBufferLen = dstUserAccountBuffer.length;
114
+ let extraCell = (0, core_1.beginCell)()
115
+ .storeAddress(addrTokenAccount)
116
+ .storeAddress(jwAddrSrc)
117
+ .storeAddress(jwAddrBridgeSc)
118
+ .endCell();
119
+ let extraCell2 = (0, core_1.beginCell)()
120
+ .storeAddress(core_1.Address.parse(opts.senderAccount))
121
+ .storeUint(lockFee, 256)
122
+ .endCell();
123
+ let body = (0, core_1.beginCell)()
124
+ .storeUint(opcodes.OP_CROSS_UserLock, 32)
125
+ .storeUint(queryId, 64)
126
+ .storeUint(BigInt(opts.smgID), 256)
127
+ .storeUint(opts.tokenPairID, 32)
128
+ .storeUint(opts.crossValue, 256)
129
+ .storeUint(dstUserAccountBufferLen, 8)
130
+ .storeBuffer(dstUserAccountBuffer, dstUserAccountBufferLen)
131
+ .storeRef(extraCell)
132
+ .storeRef(extraCell2)
133
+ .endCell();
134
+ let msg = await buildInternalMessage({ to: opts.bridgeScAddr, value: totalValue, body: body, bounce: true });
135
+ return {
136
+ internalMsg: msg,
137
+ body: body,
138
+ to: opts.bridgeScAddr,
139
+ lockType: exports.LOCK_TYPE.coin,
140
+ value: totalValue,
141
+ };
142
+ }
143
+ async function buildLockOriginalTokenMessages(opts, jwAddrBridgeSc, jwAddrSrc, addrTokenAccount, lockFee, differentQueryID) {
144
+ logger_1.logger.info("buildLockOriginalTokenMessages", "jwAddrBridgeSc", jwAddrBridgeSc.toString(), "jwAddrSrc", jwAddrSrc.toString(), "jwAddrSrcBig", (0, utils_1.AddressToBig)(jwAddrSrc), "addrTokenAccount", addrTokenAccount.toString(), "lockFee", lockFee);
145
+ if (opts.value < (lockFee + fee_1.TON_FEE.NOTIFY_FEE_USER_LOCK)) { //todo value > lockFee + transUserLockFeea
146
+ throw new Error("insufficient ton balance");
147
+ }
148
+ // forward payLoad
149
+ let queryId = await (0, utils_1.getQueryID)();
150
+ let dstUserAccountBuffer = Buffer.from((0, utils_1.remove0x)(opts.dstUserAccount), 'hex');
151
+ let dstUserAccountBufferLen = dstUserAccountBuffer.length;
152
+ let extraCell = (0, core_1.beginCell)()
153
+ .storeAddress(addrTokenAccount)
154
+ .storeAddress(jwAddrSrc)
155
+ .storeAddress(jwAddrBridgeSc)
156
+ .endCell();
157
+ let extraCell2 = (0, core_1.beginCell)()
158
+ .storeAddress(core_1.Address.parse(opts.senderAccount))
159
+ .storeUint(lockFee, 256)
160
+ .endCell();
161
+ let body = (0, core_1.beginCell)()
162
+ .storeUint(opcodes.OP_CROSS_UserLock, 32)
163
+ .storeUint(differentQueryID == BigInt(0) ? queryId : differentQueryID, 64)
164
+ .storeUint(BigInt(opts.smgID), 256)
165
+ .storeUint(opts.tokenPairID, 32)
166
+ .storeUint(opts.crossValue, 256)
167
+ .storeUint(dstUserAccountBufferLen, 8)
168
+ .storeBuffer(dstUserAccountBuffer, dstUserAccountBufferLen)
169
+ .storeRef(extraCell)
170
+ .storeRef(extraCell2)
171
+ .endCell();
172
+ // sendToken payLoad
173
+ //let forwardAmount = lockFee + toNano('0.3');
174
+ let forwardAmount = lockFee + fee_1.TON_FEE.NOTIFY_FEE_USER_LOCK;
175
+ logger_1.logger.info("forwardAmount=>", forwardAmount);
176
+ let sendTokenAmount = opts.crossValue;
177
+ let sendJettonCel = (0, core_1.beginCell)()
178
+ .storeUint(0xf8a7ea5, 32) // const int op::transfer = 0xf8a7ea5;
179
+ .storeUint(queryId, 64) // op, queryId
180
+ .storeCoins(sendTokenAmount) //jetton_amount
181
+ .storeAddress(core_1.Address.parse(opts.bridgeScAddr)) // receive address (token)
182
+ //.storeAddress(Address.parse(opts.bridgeScAddr)) //response address
183
+ .storeAddress(core_1.Address.parse(opts.senderAccount))
184
+ .storeMaybeRef(null)
185
+ .storeCoins(forwardAmount) // forward_ton_amount
186
+ .storeMaybeRef(body) //forwardPayload
187
+ .endCell();
188
+ let msg = await buildInternalMessage({ to: jwAddrSrc, value: opts.value, body: sendJettonCel, bounce: true });
189
+ return {
190
+ internalMsg: msg,
191
+ body: sendJettonCel,
192
+ to: jwAddrSrc,
193
+ lockType: exports.LOCK_TYPE.tokenOrg,
194
+ value: opts.value,
195
+ };
196
+ }
197
+ async function buildLockWrappedTokenMessages(opts, jwAddrBridgeSc, jwAddrSrc, addrTokenAccount, lockFee, differentQueryID) {
198
+ logger_1.logger.info("buildLockWrappedTokenMessages", "jwAddrBridgeSc", jwAddrBridgeSc.toString(), "jwAddrSrc", jwAddrSrc.toString(), "addrTokenAccount", addrTokenAccount.toString(), "lockFee", lockFee);
199
+ let ret = (await buildLockOriginalTokenMessages(opts, jwAddrBridgeSc, jwAddrSrc, addrTokenAccount, lockFee));
200
+ ret.lockType = exports.LOCK_TYPE.tokenWrapped;
201
+ return ret;
202
+ }
203
+ async function getFee(client, bridgeScAddr, tokenPairID, srcChainId, dstChainId) {
204
+ let fee = 0;
205
+ if ((0, client_interface_1.IsWanTonClient)(client)) {
206
+ let ba = bridgeAccess_1.BridgeAccess.create(client, bridgeScAddr.toString());
207
+ let feeTp = await ba.readContract("getChainFee", [srcChainId, dstChainId]);
208
+ if (feeTp.contractFee != 0) {
209
+ fee = feeTp.contractFee;
210
+ }
211
+ else {
212
+ fee = await ba.readContract("getTokenPairFee", [tokenPairID]);
213
+ }
214
+ }
215
+ else {
216
+ let b = await Bridge_1.Bridge.createFromAddress(bridgeScAddr);
217
+ let opened = await client.openContract(b);
218
+ let feeTp = await opened.getChainFee(srcChainId, dstChainId);
219
+ if (feeTp.contractFee != 0) {
220
+ fee = feeTp.contractFee;
221
+ }
222
+ else {
223
+ fee = await opened.getTokenPairFee(tokenPairID);
224
+ }
225
+ }
226
+ return fee;
227
+ }
228
+ async function getJettonWalletAddr(client, jettonMasterAddr, ownerAddr) {
229
+ logger_1.logger.info("in getJettonWalletAddr", "jettonMasterAddr", jettonMasterAddr.toString(), "ownerAddr", ownerAddr.toString());
230
+ if ((0, client_interface_1.IsWanTonClient)(client)) {
231
+ let jettonMasterSc = ton_1.JettonMaster.create(jettonMasterAddr);
232
+ let jettonMasterScOpened = await client.open(jettonMasterSc);
233
+ return await jettonMasterScOpened.getWalletAddress(ownerAddr);
234
+ }
235
+ else {
236
+ let jettonMasterSc = ton_1.JettonMaster.create(jettonMasterAddr);
237
+ let jettonMasterScOpened = await client.openContract(jettonMasterSc);
238
+ return await jettonMasterScOpened.getWalletAddress(ownerAddr);
239
+ }
240
+ }
241
+ async function getJettonAdminAddr(client, jettonMasterAddr) {
242
+ logger_1.logger.info("in getJettonAdminAddr", "jettonMasterAddr", jettonMasterAddr.toString());
243
+ if ((0, client_interface_1.IsWanTonClient)(client)) {
244
+ let jettonMasterSc = ton_1.JettonMaster.create(jettonMasterAddr);
245
+ let jettonMasterScOpened = await client.open(jettonMasterSc);
246
+ return (await jettonMasterScOpened.getJettonData()).adminAddress;
247
+ }
248
+ else {
249
+ let jettonMasterSc = ton_1.JettonMaster.create(jettonMasterAddr);
250
+ let jettonMasterScOpened = await client.openContract(jettonMasterSc);
251
+ return (await jettonMasterScOpened.getJettonData()).adminAddress;
252
+ }
253
+ }
254
+ async function getTokenPairInfo(client, bridgeScAddr, tokenPairID) {
255
+ let tokePairInfo;
256
+ let tokenAccount = "";
257
+ if ((0, client_interface_1.IsWanTonClient)(client)) {
258
+ logger_1.logger.info("Entering getTokenPairInfo IsWanTonClient true");
259
+ let ba = new bridgeAccess_1.BridgeAccess(client, bridgeScAddr);
260
+ tokePairInfo = await ba.readContract("getTokenPair", [tokenPairID]);
261
+ }
262
+ else {
263
+ logger_1.logger.info("Entering getTokenPairInfo IsWanTonClient false");
264
+ let b = Bridge_1.Bridge.createFromAddress(bridgeScAddr);
265
+ let opened = await client.openContract(b);
266
+ tokePairInfo = await opened.getTokenPair(tokenPairID);
267
+ }
268
+ logger_1.logger.info("in getTokenPairInfo", "tokenPairInfo", tokePairInfo, "tokenPairId", tokenPairID);
269
+ if (tokePairInfo.fromChainID == const_value_1.BIP44_CHAINID) {
270
+ tokenAccount = tokePairInfo.fromAccount;
271
+ }
272
+ else {
273
+ if (tokePairInfo.toChainID == const_value_1.BIP44_CHAINID) {
274
+ tokenAccount = tokePairInfo.toAccount;
275
+ }
276
+ else {
277
+ throw new Error(formatUtil.format("invalid TokenPair %d", tokenPairID));
278
+ }
279
+ }
280
+ if (!core_1.Address.isAddress(core_1.Address.parse(tokenAccount))) {
281
+ throw new Error(formatUtil.format("invalid tokenAccount %s", tokenAccount));
282
+ }
283
+ return { tokenAccount, srcChainID: tokePairInfo.fromChainID, toChainID: tokePairInfo.toChainID };
284
+ }
@@ -0,0 +1,9 @@
1
+ import { Address } from '@ton/core';
2
+ export declare class common {
3
+ static createFromAddress(address: Address): Address;
4
+ static computeHash(currentChainId: bigint, uniqueId: bigint, tokenPairId: bigint, value: bigint, fee: bigint, tokenAccount: Address | string, userAccount: Address): {
5
+ hashHex: string;
6
+ hashBig: bigint;
7
+ hashBuf: Buffer;
8
+ };
9
+ }
package/dist/common.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.common = void 0;
4
+ const core_1 = require("@ton/core");
5
+ const logger_1 = require("./utils/logger");
6
+ const formatUtil = require('util');
7
+ class common {
8
+ static createFromAddress(address) {
9
+ return address;
10
+ }
11
+ static computeHash(currentChainId, uniqueId, tokenPairId, value, fee, tokenAccount, userAccount) {
12
+ let tokenAccountBuf;
13
+ if (core_1.Address.isAddress(tokenAccount)) {
14
+ tokenAccountBuf = tokenAccount.hash;
15
+ }
16
+ else {
17
+ tokenAccountBuf = Buffer.from(tokenAccount.substring(0, 2).toLowerCase() == '0x' ? tokenAccount.substring(2) : tokenAccount, 'hex');
18
+ }
19
+ let userAccountBuf = userAccount.hash;
20
+ let msg = (0, core_1.beginCell)()
21
+ .storeUint(currentChainId, 64)
22
+ .storeUint(uniqueId, 256)
23
+ .storeUint(tokenPairId, 32)
24
+ .storeUint(value, 256)
25
+ .storeUint(fee, 256)
26
+ .storeRef((0, core_1.beginCell)()
27
+ .storeAddress(userAccount)
28
+ .storeBuffer(tokenAccountBuf)
29
+ .endCell());
30
+ logger_1.logger.info(formatUtil.format(" tokenAccount...", tokenAccount));
31
+ logger_1.logger.info(formatUtil.format(" tokenAccountBuf......", tokenAccountBuf.toString('hex'), tokenAccountBuf.length));
32
+ logger_1.logger.info(formatUtil.format("(bigInt) tokenAccountBuf......", BigInt("0x" + tokenAccountBuf.toString('hex'))));
33
+ logger_1.logger.info(formatUtil.format(" userAccount...", userAccount));
34
+ logger_1.logger.info(formatUtil.format(" userAccountBuf......", userAccountBuf.toString('hex'), userAccountBuf.length));
35
+ logger_1.logger.info(formatUtil.format("(bigInt) userAccountBuf......", BigInt("0x" + userAccountBuf.toString('hex'))));
36
+ logger_1.logger.info(formatUtil.format("user_account_cell(cell)", msg.endCell()));
37
+ let hashBuf = msg.endCell().hash();
38
+ return {
39
+ hashHex: hashBuf.toString('hex'),
40
+ hashBig: BigInt(`0x${hashBuf.toString('hex')}`),
41
+ hashBuf: hashBuf
42
+ };
43
+ }
44
+ }
45
+ exports.common = common;
@@ -0,0 +1,7 @@
1
+ import { TonConfig } from "../client/client";
2
+ export declare const configTestnet: TonConfig;
3
+ export declare const configTestnetObs: TonConfig;
4
+ export declare const configMainnet: TonConfig;
5
+ export declare const configTestTonApi: TonConfig;
6
+ export declare const configTestTonApiNoDb: TonConfig;
7
+ export declare const configMainTonApi: TonConfig;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configMainTonApi = exports.configTestTonApiNoDb = exports.configTestTonApi = exports.configMainnet = exports.configTestnetObs = exports.configTestnet = void 0;
4
+ exports.configTestnet = {
5
+ network: {
6
+ network: "testnet", // testnet|mainnet
7
+ },
8
+ usingDbCache: true,
9
+ urls: [
10
+ {
11
+ //url:'',
12
+ //apiKey:''
13
+ }
14
+ ]
15
+ };
16
+ exports.configTestnetObs = {
17
+ network: {
18
+ network: "testnet", // testnet|mainnet
19
+ },
20
+ usingDbCache: true,
21
+ };
22
+ exports.configMainnet = {
23
+ network: {
24
+ network: "mainnet", // testnet|mainnet
25
+ },
26
+ usingDbCache: true,
27
+ urls: [
28
+ {
29
+ //url:'',
30
+ //apiKey:''
31
+ }
32
+ ]
33
+ };
34
+ exports.configTestTonApi = {
35
+ network: {
36
+ network: "testnet", // testnet|mainnet
37
+ },
38
+ usingDbCache: true,
39
+ //scanTrans:false,
40
+ scanTrans: true,
41
+ urls: [
42
+ {
43
+ url: 'https://testnet.tonapi.io',
44
+ //apiKey:'',
45
+ vendor: 'tonapi',
46
+ }
47
+ ]
48
+ };
49
+ exports.configTestTonApiNoDb = {
50
+ network: {
51
+ network: "testnet", // testnet|mainnet
52
+ },
53
+ urls: [
54
+ {
55
+ url: 'https://testnet.tonapi.io',
56
+ //apiKey:'',
57
+ vendor: 'tonapi',
58
+ }
59
+ ]
60
+ };
61
+ exports.configMainTonApi = {
62
+ network: {
63
+ network: "mainnet", // testnet|mainnet
64
+ },
65
+ usingDbCache: true,
66
+ urls: [
67
+ {
68
+ url: 'https://tonapi.io',
69
+ //apiKey:'',
70
+ vendor: 'tonapi',
71
+ }
72
+ ]
73
+ };
@@ -0,0 +1,21 @@
1
+ export declare const BIP44_CHAINID = 2147484255;
2
+ export declare const BIP44_WANCHAIN_CHAINID = 2153201998;
3
+ export declare const TON_COIN_ACCOUT = "0x0000000000000000000000000000000000000000000000000000000000000000";
4
+ export declare const TON_COIN_ACCOUNT_STR = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c";
5
+ export declare const WK_CHIANID = "0";
6
+ export declare const ZERO_ACCOUNT_STR = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c";
7
+ export declare const REVERT_ON_ERRORS = 0;
8
+ export declare const PAY_FEES_SEPARATELY = 1;
9
+ export declare const IGNORE_ERRORS = 2;
10
+ export declare const BOUNCE_MESSAGE = 16;
11
+ export declare const SELFDESTRUCT_ON_EMPTY = 32;
12
+ export declare const NORMAL = 0;
13
+ export declare const CARRY_REMAINING_GAS = 64;
14
+ export declare const CARRY_REMAINING_BALANCE = 128;
15
+ export declare const MAX_LIMIT = 90;
16
+ export declare const MAX_RETRY = 3;
17
+ export declare const MAX_BACKTRACE_SECONDS: number;
18
+ export declare const RETRY_INTERNAL_TIME = 20;
19
+ export declare const TONCLINET_TIMEOUT: number;
20
+ export declare const MIN_SCAN_INTER: number;
21
+ export declare const MAX_SCAN_INTER: number;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_SCAN_INTER = exports.MIN_SCAN_INTER = exports.TONCLINET_TIMEOUT = exports.RETRY_INTERNAL_TIME = exports.MAX_BACKTRACE_SECONDS = exports.MAX_RETRY = exports.MAX_LIMIT = exports.CARRY_REMAINING_BALANCE = exports.CARRY_REMAINING_GAS = exports.NORMAL = exports.SELFDESTRUCT_ON_EMPTY = exports.BOUNCE_MESSAGE = exports.IGNORE_ERRORS = exports.PAY_FEES_SEPARATELY = exports.REVERT_ON_ERRORS = exports.ZERO_ACCOUNT_STR = exports.WK_CHIANID = exports.TON_COIN_ACCOUNT_STR = exports.TON_COIN_ACCOUT = exports.BIP44_WANCHAIN_CHAINID = exports.BIP44_CHAINID = void 0;
4
+ exports.BIP44_CHAINID = 0x8000025f;
5
+ exports.BIP44_WANCHAIN_CHAINID = 0x8057414e; // 2153201998
6
+ exports.TON_COIN_ACCOUT = "0x0000000000000000000000000000000000000000000000000000000000000000"; // 32 bytes
7
+ exports.TON_COIN_ACCOUNT_STR = 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c';
8
+ exports.WK_CHIANID = "0";
9
+ exports.ZERO_ACCOUNT_STR = exports.TON_COIN_ACCOUNT_STR;
10
+ // send_raw_message flags
11
+ exports.REVERT_ON_ERRORS = 0;
12
+ exports.PAY_FEES_SEPARATELY = 1;
13
+ exports.IGNORE_ERRORS = 2;
14
+ exports.BOUNCE_MESSAGE = 16;
15
+ exports.SELFDESTRUCT_ON_EMPTY = 32;
16
+ // send_raw_message MODE
17
+ exports.NORMAL = 0;
18
+ exports.CARRY_REMAINING_GAS = 64;
19
+ exports.CARRY_REMAINING_BALANCE = 128;
20
+ exports.MAX_LIMIT = 90;
21
+ exports.MAX_RETRY = 3;
22
+ exports.MAX_BACKTRACE_SECONDS = 30 * 86400;
23
+ exports.RETRY_INTERNAL_TIME = 20;
24
+ exports.TONCLINET_TIMEOUT = 60 * 1000 * 1000;
25
+ exports.MIN_SCAN_INTER = 60 * 1000;
26
+ exports.MAX_SCAN_INTER = 90 * 1000;
@@ -0,0 +1,10 @@
1
+ import { Address, Sender } from "@ton/core";
2
+ import { WanTonClient } from "../client/client-interface";
3
+ export declare class BridgeAccess {
4
+ private client;
5
+ private readonly contractAddr;
6
+ static create(client: WanTonClient, contractAddr: string): BridgeAccess;
7
+ constructor(client: WanTonClient, contractAddr: Address);
8
+ writeContract(methodName: string, via: Sender, opts: any): Promise<any>;
9
+ readContract(methodName: string, parameters: any[]): Promise<any>;
10
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BridgeAccess = void 0;
4
+ const core_2 = require("@ton/core");
5
+ const Bridge_1 = require("../Bridge");
6
+ const logger_1 = require("../utils/logger");
7
+ const utils_1 = require("../utils/utils");
8
+ const formatUtil = require('util');
9
+ class BridgeAccess {
10
+ static create(client, contractAddr) {
11
+ let addr = core_2.Address.parse(contractAddr);
12
+ return new BridgeAccess(client, addr);
13
+ }
14
+ constructor(client, contractAddr) {
15
+ this.client = client;
16
+ this.contractAddr = contractAddr;
17
+ }
18
+ async writeContract(methodName, via, opts) {
19
+ if (!methodName.startsWith('send')) {
20
+ throw new Error(`${methodName} is not supported Non send method`);
21
+ }
22
+ try {
23
+ let c = Bridge_1.Bridge.createFromAddress(this.contractAddr);
24
+ logger_1.logger.info(formatUtil.format("writeContract contractAddress", this.contractAddr));
25
+ let cOpened = this.client.open(c);
26
+ return await cOpened[methodName](via, opts);
27
+ }
28
+ catch (err) {
29
+ logger_1.logger.info(formatUtil.format("writeContract err=>", "methodName", methodName, "opts", JSON.stringify(opts, utils_1.bigIntReplacer), "err", (0, utils_1.formatError)(err)));
30
+ throw new Error(`${methodName} is not supported Non send method`);
31
+ }
32
+ }
33
+ async readContract(methodName, parameters) {
34
+ if (!methodName.startsWith('get')) {
35
+ throw new Error(`${methodName} is not supported Non send method`);
36
+ }
37
+ try {
38
+ let c = Bridge_1.Bridge.createFromAddress(this.contractAddr);
39
+ let cOpened = this.client.open(c);
40
+ logger_1.logger.info(formatUtil.format("methodName=>", methodName));
41
+ return await cOpened[methodName](...parameters);
42
+ }
43
+ catch (err) {
44
+ logger_1.logger.error(formatUtil.format((0, utils_1.formatError)(err)));
45
+ throw new Error(`${methodName} is not supported Non send method`);
46
+ }
47
+ }
48
+ }
49
+ exports.BridgeAccess = BridgeAccess;
50
+ /*
51
+ 1. put down all the getMethod
52
+ 2. for users, all the parameter value is hexString, or bigInt, or Address, or string
53
+ 3. convert the input value to the value which is used in Bridge.ts class
54
+ 4. use client's runGetMessage or use the Bridge.ts?
55
+ */
@@ -0,0 +1,10 @@
1
+ import { Address, Sender } from "@ton/core";
2
+ import { WanTonClient } from "../client/client-interface";
3
+ export declare class GroupApproveAccess {
4
+ private client;
5
+ private readonly contractAddr;
6
+ static create(client: WanTonClient, contractAddr: string): GroupApproveAccess;
7
+ constructor(client: WanTonClient, contractAddr: Address);
8
+ writeContract(methodName: string, via: Sender, opts: any): Promise<any>;
9
+ readContract(methodName: string, parameters: any[]): Promise<any>;
10
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GroupApproveAccess = void 0;
4
+ const core_2 = require("@ton/core");
5
+ const GroupApprove_1 = require("../GroupApprove");
6
+ const logger_1 = require("../utils/logger");
7
+ const formatUtil = require('util');
8
+ class GroupApproveAccess {
9
+ static create(client, contractAddr) {
10
+ let addr = core_2.Address.parse(contractAddr);
11
+ return new GroupApproveAccess(client, addr);
12
+ }
13
+ constructor(client, contractAddr) {
14
+ this.client = client;
15
+ this.contractAddr = contractAddr;
16
+ }
17
+ async writeContract(methodName, via, opts) {
18
+ if (!methodName.startsWith('send')) {
19
+ throw new Error(`${methodName} is not supported Non send method`);
20
+ }
21
+ try {
22
+ let c = GroupApprove_1.GroupApprove.createFromAddress(this.contractAddr);
23
+ logger_1.logger.info(formatUtil.format("writeContract contractAddress", this.contractAddr));
24
+ let cOpened = this.client.open(c);
25
+ return await cOpened[methodName](via, opts);
26
+ }
27
+ catch (err) {
28
+ logger_1.logger.info(formatUtil.format("err=>", err));
29
+ throw new Error(`${methodName} is not supported Non send method`);
30
+ }
31
+ }
32
+ async readContract(methodName, parameters) {
33
+ if (!methodName.startsWith('get')) {
34
+ throw new Error(`${methodName} is not supported Non send method`);
35
+ }
36
+ try {
37
+ let c = GroupApprove_1.GroupApprove.createFromAddress(this.contractAddr);
38
+ let cOpened = this.client.open(c);
39
+ logger_1.logger.info(formatUtil.format("methodName=>", methodName));
40
+ return await cOpened[methodName](...parameters);
41
+ }
42
+ catch (err) {
43
+ logger_1.logger.info(formatUtil.format(err));
44
+ throw new Error(`${methodName} is not supported Non send method`);
45
+ }
46
+ }
47
+ }
48
+ exports.GroupApproveAccess = GroupApproveAccess;
49
+ /*
50
+ 1. put down all the getMethod
51
+ 2. for users, all the parameter value is hexString, or bigInt, or Address, or string
52
+ 3. convert the input value to the value which is used in GroupApprove.ts class
53
+ 4. use client's runGetMessage or use the GroupApprove.ts?
54
+ */
@@ -0,0 +1,24 @@
1
+ export declare enum RangeOpen {
2
+ CloseRange = 0,// 0
3
+ RightOpenRange = 1
4
+ }
5
+ export type TonTransaction = {
6
+ hash: string;
7
+ lt: bigint;
8
+ raw: string;
9
+ in: {
10
+ src: string;
11
+ inMsgHash: string;
12
+ inBodyHash: string;
13
+ createdLt: bigint;
14
+ createAt: bigint;
15
+ };
16
+ out: {
17
+ dst: string;
18
+ outMsgHash: string;
19
+ outBodyHash: string;
20
+ createdLt: bigint;
21
+ createAt: bigint;
22
+ }[];
23
+ emitEventOrNot: boolean;
24
+ };