tronwb 6.0.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.
Files changed (318) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +201 -0
  3. package/dist/TronWeb.js +3 -0
  4. package/dist/TronWeb.js.LICENSE.txt +12 -0
  5. package/dist/TronWeb.js.map +1 -0
  6. package/dist/TronWeb.node.js +2 -0
  7. package/dist/TronWeb.node.js.map +1 -0
  8. package/kj9btptx.cjs +1 -0
  9. package/lib/commonjs/index.d.ts +64 -0
  10. package/lib/commonjs/index.js +37 -0
  11. package/lib/commonjs/index.js.map +1 -0
  12. package/lib/commonjs/lib/TransactionBuilder/TransactionBuilder.d.ts +127 -0
  13. package/lib/commonjs/lib/TransactionBuilder/TransactionBuilder.js +1771 -0
  14. package/lib/commonjs/lib/TransactionBuilder/TransactionBuilder.js.map +1 -0
  15. package/lib/commonjs/lib/TransactionBuilder/helper.d.ts +28 -0
  16. package/lib/commonjs/lib/TransactionBuilder/helper.js +122 -0
  17. package/lib/commonjs/lib/TransactionBuilder/helper.js.map +1 -0
  18. package/lib/commonjs/lib/contract/index.d.ts +29 -0
  19. package/lib/commonjs/lib/contract/index.js +124 -0
  20. package/lib/commonjs/lib/contract/index.js.map +1 -0
  21. package/lib/commonjs/lib/contract/method.d.ts +50 -0
  22. package/lib/commonjs/lib/contract/method.js +238 -0
  23. package/lib/commonjs/lib/contract/method.js.map +1 -0
  24. package/lib/commonjs/lib/event.d.ts +85 -0
  25. package/lib/commonjs/lib/event.js +137 -0
  26. package/lib/commonjs/lib/event.js.map +1 -0
  27. package/lib/commonjs/lib/plugin.d.ts +28 -0
  28. package/lib/commonjs/lib/plugin.js +84 -0
  29. package/lib/commonjs/lib/plugin.js.map +1 -0
  30. package/lib/commonjs/lib/providers/HttpProvider.d.ts +15 -0
  31. package/lib/commonjs/lib/providers/HttpProvider.js +63 -0
  32. package/lib/commonjs/lib/providers/HttpProvider.js.map +1 -0
  33. package/lib/commonjs/lib/providers/index.d.ts +6 -0
  34. package/lib/commonjs/lib/providers/index.js +8 -0
  35. package/lib/commonjs/lib/providers/index.js.map +1 -0
  36. package/lib/commonjs/lib/trx.d.ts +315 -0
  37. package/lib/commonjs/lib/trx.js +965 -0
  38. package/lib/commonjs/lib/trx.js.map +1 -0
  39. package/lib/commonjs/package.json +1 -0
  40. package/lib/commonjs/paramValidator/index.d.ts +19 -0
  41. package/lib/commonjs/paramValidator/index.js +110 -0
  42. package/lib/commonjs/paramValidator/index.js.map +1 -0
  43. package/lib/commonjs/protocol/core/Tron_pb.cjs +7524 -0
  44. package/lib/commonjs/protocol/core/contract/account_contract_pb.cjs +961 -0
  45. package/lib/commonjs/protocol/core/contract/asset_issue_contract_pb.cjs +2196 -0
  46. package/lib/commonjs/protocol/core/contract/balance_contract_pb.cjs +3826 -0
  47. package/lib/commonjs/protocol/core/contract/common_pb.cjs +34 -0
  48. package/lib/commonjs/protocol/core/contract/exchange_contract_pb.cjs +1268 -0
  49. package/lib/commonjs/protocol/core/contract/proposal_contract_pb.cjs +675 -0
  50. package/lib/commonjs/protocol/core/contract/smart_contract_pb.cjs +2960 -0
  51. package/lib/commonjs/protocol/core/contract/storage_contract_pb.cjs +848 -0
  52. package/lib/commonjs/protocol/core/contract/vote_asset_contract_pb.cjs +340 -0
  53. package/lib/commonjs/protocol/core/contract/witness_contract_pb.cjs +956 -0
  54. package/lib/commonjs/tronweb.d.ts +111 -0
  55. package/lib/commonjs/tronweb.js +365 -0
  56. package/lib/commonjs/tronweb.js.map +1 -0
  57. package/lib/commonjs/types/ABI.d.ts +59 -0
  58. package/lib/commonjs/types/ABI.js +3 -0
  59. package/lib/commonjs/types/ABI.js.map +1 -0
  60. package/lib/commonjs/types/APIResponse.d.ts +31 -0
  61. package/lib/commonjs/types/APIResponse.js +3 -0
  62. package/lib/commonjs/types/APIResponse.js.map +1 -0
  63. package/lib/commonjs/types/Contract.d.ts +287 -0
  64. package/lib/commonjs/types/Contract.js +63 -0
  65. package/lib/commonjs/types/Contract.js.map +1 -0
  66. package/lib/commonjs/types/Providers.d.ts +8 -0
  67. package/lib/commonjs/types/Providers.js +3 -0
  68. package/lib/commonjs/types/Providers.js.map +1 -0
  69. package/lib/commonjs/types/Transaction.d.ts +65 -0
  70. package/lib/commonjs/types/Transaction.js +3 -0
  71. package/lib/commonjs/types/Transaction.js.map +1 -0
  72. package/lib/commonjs/types/TransactionBuilder.d.ts +270 -0
  73. package/lib/commonjs/types/TransactionBuilder.js +3 -0
  74. package/lib/commonjs/types/TransactionBuilder.js.map +1 -0
  75. package/lib/commonjs/types/TronWeb.d.ts +20 -0
  76. package/lib/commonjs/types/TronWeb.js +3 -0
  77. package/lib/commonjs/types/TronWeb.js.map +1 -0
  78. package/lib/commonjs/types/Trx.d.ts +263 -0
  79. package/lib/commonjs/types/Trx.js +42 -0
  80. package/lib/commonjs/types/Trx.js.map +1 -0
  81. package/lib/commonjs/types/UtilsTypes.d.ts +23 -0
  82. package/lib/commonjs/types/UtilsTypes.js +3 -0
  83. package/lib/commonjs/types/UtilsTypes.js.map +1 -0
  84. package/lib/commonjs/types/index.d.ts +9 -0
  85. package/lib/commonjs/types/index.js +13 -0
  86. package/lib/commonjs/types/index.js.map +1 -0
  87. package/lib/commonjs/utils/abi.d.ts +5 -0
  88. package/lib/commonjs/utils/abi.js +251 -0
  89. package/lib/commonjs/utils/abi.js.map +1 -0
  90. package/lib/commonjs/utils/accounts.d.ts +22 -0
  91. package/lib/commonjs/utils/accounts.js +51 -0
  92. package/lib/commonjs/utils/accounts.js.map +1 -0
  93. package/lib/commonjs/utils/address.d.ts +12 -0
  94. package/lib/commonjs/utils/address.js +91 -0
  95. package/lib/commonjs/utils/address.js.map +1 -0
  96. package/lib/commonjs/utils/base58.d.ts +3 -0
  97. package/lib/commonjs/utils/base58.js +68 -0
  98. package/lib/commonjs/utils/base58.js.map +1 -0
  99. package/lib/commonjs/utils/base64.d.ts +10 -0
  100. package/lib/commonjs/utils/base64.js +173 -0
  101. package/lib/commonjs/utils/base64.js.map +1 -0
  102. package/lib/commonjs/utils/bytes.d.ts +7 -0
  103. package/lib/commonjs/utils/bytes.js +61 -0
  104. package/lib/commonjs/utils/bytes.js.map +1 -0
  105. package/lib/commonjs/utils/code.d.ts +12 -0
  106. package/lib/commonjs/utils/code.js +166 -0
  107. package/lib/commonjs/utils/code.js.map +1 -0
  108. package/lib/commonjs/utils/crypto.d.ts +25 -0
  109. package/lib/commonjs/utils/crypto.js +222 -0
  110. package/lib/commonjs/utils/crypto.js.map +1 -0
  111. package/lib/commonjs/utils/ethersUtils.d.ts +14 -0
  112. package/lib/commonjs/utils/ethersUtils.js +39 -0
  113. package/lib/commonjs/utils/ethersUtils.js.map +1 -0
  114. package/lib/commonjs/utils/fragments.d.ts +465 -0
  115. package/lib/commonjs/utils/fragments.js +1342 -0
  116. package/lib/commonjs/utils/fragments.js.map +1 -0
  117. package/lib/commonjs/utils/help.d.ts +8 -0
  118. package/lib/commonjs/utils/help.js +61 -0
  119. package/lib/commonjs/utils/help.js.map +1 -0
  120. package/lib/commonjs/utils/index.d.ts +56 -0
  121. package/lib/commonjs/utils/index.js +43 -0
  122. package/lib/commonjs/utils/index.js.map +1 -0
  123. package/lib/commonjs/utils/interface.d.ts +381 -0
  124. package/lib/commonjs/utils/interface.js +1121 -0
  125. package/lib/commonjs/utils/interface.js.map +1 -0
  126. package/lib/commonjs/utils/message.d.ts +4 -0
  127. package/lib/commonjs/utils/message.js +38 -0
  128. package/lib/commonjs/utils/message.js.map +1 -0
  129. package/lib/commonjs/utils/transaction.d.ts +17 -0
  130. package/lib/commonjs/utils/transaction.js +678 -0
  131. package/lib/commonjs/utils/transaction.js.map +1 -0
  132. package/lib/commonjs/utils/typedData.d.ts +148 -0
  133. package/lib/commonjs/utils/typedData.js +498 -0
  134. package/lib/commonjs/utils/typedData.js.map +1 -0
  135. package/lib/commonjs/utils/validations.d.ts +22 -0
  136. package/lib/commonjs/utils/validations.js +128 -0
  137. package/lib/commonjs/utils/validations.js.map +1 -0
  138. package/lib/esm/index.d.ts +64 -0
  139. package/lib/esm/index.js +33 -0
  140. package/lib/esm/index.js.map +1 -0
  141. package/lib/esm/lib/TransactionBuilder/TransactionBuilder.d.ts +127 -0
  142. package/lib/esm/lib/TransactionBuilder/TransactionBuilder.js +1767 -0
  143. package/lib/esm/lib/TransactionBuilder/TransactionBuilder.js.map +1 -0
  144. package/lib/esm/lib/TransactionBuilder/helper.d.ts +28 -0
  145. package/lib/esm/lib/TransactionBuilder/helper.js +112 -0
  146. package/lib/esm/lib/TransactionBuilder/helper.js.map +1 -0
  147. package/lib/esm/lib/contract/index.d.ts +29 -0
  148. package/lib/esm/lib/contract/index.js +118 -0
  149. package/lib/esm/lib/contract/index.js.map +1 -0
  150. package/lib/esm/lib/contract/method.d.ts +50 -0
  151. package/lib/esm/lib/contract/method.js +233 -0
  152. package/lib/esm/lib/contract/method.js.map +1 -0
  153. package/lib/esm/lib/event.d.ts +85 -0
  154. package/lib/esm/lib/event.js +132 -0
  155. package/lib/esm/lib/event.js.map +1 -0
  156. package/lib/esm/lib/plugin.d.ts +28 -0
  157. package/lib/esm/lib/plugin.js +79 -0
  158. package/lib/esm/lib/plugin.js.map +1 -0
  159. package/lib/esm/lib/providers/HttpProvider.d.ts +15 -0
  160. package/lib/esm/lib/providers/HttpProvider.js +59 -0
  161. package/lib/esm/lib/providers/HttpProvider.js.map +1 -0
  162. package/lib/esm/lib/providers/index.d.ts +6 -0
  163. package/lib/esm/lib/providers/index.js +4 -0
  164. package/lib/esm/lib/providers/index.js.map +1 -0
  165. package/lib/esm/lib/trx.d.ts +315 -0
  166. package/lib/esm/lib/trx.js +960 -0
  167. package/lib/esm/lib/trx.js.map +1 -0
  168. package/lib/esm/package.json +1 -0
  169. package/lib/esm/paramValidator/index.d.ts +19 -0
  170. package/lib/esm/paramValidator/index.js +106 -0
  171. package/lib/esm/paramValidator/index.js.map +1 -0
  172. package/lib/esm/protocol/core/Tron_pb.cjs +7524 -0
  173. package/lib/esm/protocol/core/contract/account_contract_pb.cjs +961 -0
  174. package/lib/esm/protocol/core/contract/asset_issue_contract_pb.cjs +2196 -0
  175. package/lib/esm/protocol/core/contract/balance_contract_pb.cjs +3826 -0
  176. package/lib/esm/protocol/core/contract/common_pb.cjs +34 -0
  177. package/lib/esm/protocol/core/contract/exchange_contract_pb.cjs +1268 -0
  178. package/lib/esm/protocol/core/contract/proposal_contract_pb.cjs +675 -0
  179. package/lib/esm/protocol/core/contract/smart_contract_pb.cjs +2960 -0
  180. package/lib/esm/protocol/core/contract/storage_contract_pb.cjs +848 -0
  181. package/lib/esm/protocol/core/contract/vote_asset_contract_pb.cjs +340 -0
  182. package/lib/esm/protocol/core/contract/witness_contract_pb.cjs +956 -0
  183. package/lib/esm/tronweb.d.ts +111 -0
  184. package/lib/esm/tronweb.js +360 -0
  185. package/lib/esm/tronweb.js.map +1 -0
  186. package/lib/esm/types/ABI.d.ts +59 -0
  187. package/lib/esm/types/ABI.js +2 -0
  188. package/lib/esm/types/ABI.js.map +1 -0
  189. package/lib/esm/types/APIResponse.d.ts +31 -0
  190. package/lib/esm/types/APIResponse.js +2 -0
  191. package/lib/esm/types/APIResponse.js.map +1 -0
  192. package/lib/esm/types/Contract.d.ts +287 -0
  193. package/lib/esm/types/Contract.js +60 -0
  194. package/lib/esm/types/Contract.js.map +1 -0
  195. package/lib/esm/types/Providers.d.ts +8 -0
  196. package/lib/esm/types/Providers.js +2 -0
  197. package/lib/esm/types/Providers.js.map +1 -0
  198. package/lib/esm/types/Transaction.d.ts +65 -0
  199. package/lib/esm/types/Transaction.js +2 -0
  200. package/lib/esm/types/Transaction.js.map +1 -0
  201. package/lib/esm/types/TransactionBuilder.d.ts +270 -0
  202. package/lib/esm/types/TransactionBuilder.js +2 -0
  203. package/lib/esm/types/TransactionBuilder.js.map +1 -0
  204. package/lib/esm/types/TronWeb.d.ts +20 -0
  205. package/lib/esm/types/TronWeb.js +2 -0
  206. package/lib/esm/types/TronWeb.js.map +1 -0
  207. package/lib/esm/types/Trx.d.ts +263 -0
  208. package/lib/esm/types/Trx.js +39 -0
  209. package/lib/esm/types/Trx.js.map +1 -0
  210. package/lib/esm/types/UtilsTypes.d.ts +23 -0
  211. package/lib/esm/types/UtilsTypes.js +2 -0
  212. package/lib/esm/types/UtilsTypes.js.map +1 -0
  213. package/lib/esm/types/index.d.ts +9 -0
  214. package/lib/esm/types/index.js +10 -0
  215. package/lib/esm/types/index.js.map +1 -0
  216. package/lib/esm/utils/abi.d.ts +5 -0
  217. package/lib/esm/utils/abi.js +245 -0
  218. package/lib/esm/utils/abi.js.map +1 -0
  219. package/lib/esm/utils/accounts.d.ts +22 -0
  220. package/lib/esm/utils/accounts.js +46 -0
  221. package/lib/esm/utils/accounts.js.map +1 -0
  222. package/lib/esm/utils/address.d.ts +12 -0
  223. package/lib/esm/utils/address.js +82 -0
  224. package/lib/esm/utils/address.js.map +1 -0
  225. package/lib/esm/utils/base58.d.ts +3 -0
  226. package/lib/esm/utils/base58.js +64 -0
  227. package/lib/esm/utils/base58.js.map +1 -0
  228. package/lib/esm/utils/base64.d.ts +10 -0
  229. package/lib/esm/utils/base64.js +169 -0
  230. package/lib/esm/utils/base64.js.map +1 -0
  231. package/lib/esm/utils/bytes.d.ts +7 -0
  232. package/lib/esm/utils/bytes.js +53 -0
  233. package/lib/esm/utils/bytes.js.map +1 -0
  234. package/lib/esm/utils/code.d.ts +12 -0
  235. package/lib/esm/utils/code.js +149 -0
  236. package/lib/esm/utils/code.js.map +1 -0
  237. package/lib/esm/utils/crypto.d.ts +25 -0
  238. package/lib/esm/utils/crypto.js +198 -0
  239. package/lib/esm/utils/crypto.js.map +1 -0
  240. package/lib/esm/utils/ethersUtils.d.ts +14 -0
  241. package/lib/esm/utils/ethersUtils.js +17 -0
  242. package/lib/esm/utils/ethersUtils.js.map +1 -0
  243. package/lib/esm/utils/fragments.d.ts +465 -0
  244. package/lib/esm/utils/fragments.js +1330 -0
  245. package/lib/esm/utils/fragments.js.map +1 -0
  246. package/lib/esm/utils/help.d.ts +8 -0
  247. package/lib/esm/utils/help.js +51 -0
  248. package/lib/esm/utils/help.js.map +1 -0
  249. package/lib/esm/utils/index.d.ts +56 -0
  250. package/lib/esm/utils/index.js +40 -0
  251. package/lib/esm/utils/index.js.map +1 -0
  252. package/lib/esm/utils/interface.d.ts +381 -0
  253. package/lib/esm/utils/interface.js +1112 -0
  254. package/lib/esm/utils/interface.js.map +1 -0
  255. package/lib/esm/utils/message.d.ts +4 -0
  256. package/lib/esm/utils/message.js +32 -0
  257. package/lib/esm/utils/message.js.map +1 -0
  258. package/lib/esm/utils/transaction.d.ts +17 -0
  259. package/lib/esm/utils/transaction.js +669 -0
  260. package/lib/esm/utils/transaction.js.map +1 -0
  261. package/lib/esm/utils/typedData.d.ts +148 -0
  262. package/lib/esm/utils/typedData.js +493 -0
  263. package/lib/esm/utils/typedData.js.map +1 -0
  264. package/lib/esm/utils/validations.d.ts +22 -0
  265. package/lib/esm/utils/validations.js +108 -0
  266. package/lib/esm/utils/validations.js.map +1 -0
  267. package/package.json +110 -0
  268. package/src/index.ts +42 -0
  269. package/src/lib/TransactionBuilder/TransactionBuilder.ts +2272 -0
  270. package/src/lib/TransactionBuilder/helper.ts +139 -0
  271. package/src/lib/contract/index.ts +151 -0
  272. package/src/lib/contract/method.ts +336 -0
  273. package/src/lib/event.ts +248 -0
  274. package/src/lib/plugin.ts +102 -0
  275. package/src/lib/providers/HttpProvider.ts +66 -0
  276. package/src/lib/providers/index.ts +6 -0
  277. package/src/lib/trx.ts +1463 -0
  278. package/src/paramValidator/index.ts +136 -0
  279. package/src/protocol/core/Tron_pb.cjs +7524 -0
  280. package/src/protocol/core/contract/account_contract_pb.cjs +961 -0
  281. package/src/protocol/core/contract/asset_issue_contract_pb.cjs +2196 -0
  282. package/src/protocol/core/contract/balance_contract_pb.cjs +3826 -0
  283. package/src/protocol/core/contract/common_pb.cjs +34 -0
  284. package/src/protocol/core/contract/exchange_contract_pb.cjs +1268 -0
  285. package/src/protocol/core/contract/proposal_contract_pb.cjs +675 -0
  286. package/src/protocol/core/contract/smart_contract_pb.cjs +2960 -0
  287. package/src/protocol/core/contract/storage_contract_pb.cjs +848 -0
  288. package/src/protocol/core/contract/vote_asset_contract_pb.cjs +340 -0
  289. package/src/protocol/core/contract/witness_contract_pb.cjs +956 -0
  290. package/src/tronweb.ts +437 -0
  291. package/src/types/ABI.ts +82 -0
  292. package/src/types/APIResponse.ts +34 -0
  293. package/src/types/Contract.ts +352 -0
  294. package/src/types/Providers.ts +7 -0
  295. package/src/types/Transaction.ts +70 -0
  296. package/src/types/TransactionBuilder.ts +281 -0
  297. package/src/types/TronWeb.ts +23 -0
  298. package/src/types/Trx.ts +285 -0
  299. package/src/types/UtilsTypes.ts +25 -0
  300. package/src/types/index.ts +9 -0
  301. package/src/types/interface.d.ts +1 -0
  302. package/src/utils/abi.ts +257 -0
  303. package/src/utils/accounts.ts +60 -0
  304. package/src/utils/address.ts +89 -0
  305. package/src/utils/base58.ts +78 -0
  306. package/src/utils/base64.ts +200 -0
  307. package/src/utils/bytes.ts +68 -0
  308. package/src/utils/code.ts +172 -0
  309. package/src/utils/crypto.ts +264 -0
  310. package/src/utils/ethersUtils.ts +60 -0
  311. package/src/utils/fragments.ts +1738 -0
  312. package/src/utils/help.ts +59 -0
  313. package/src/utils/index.ts +42 -0
  314. package/src/utils/interface.ts +1362 -0
  315. package/src/utils/message.ts +38 -0
  316. package/src/utils/transaction.ts +991 -0
  317. package/src/utils/typedData.ts +688 -0
  318. package/src/utils/validations.ts +130 -0
@@ -0,0 +1,352 @@
1
+ import { Resource } from '../types/TransactionBuilder.js';
2
+ import { ContractAbiInterface } from './ABI.js';
3
+ export enum ContractType {
4
+ AccountCreateContract = 'AccountCreateContract',
5
+ TransferContract = 'TransferContract',
6
+ TransferAssetContract = 'TransferAssetContract',
7
+ VoteAssetContract = 'VoteAssetContract',
8
+ VoteWitnessContract = 'VoteWitnessContract',
9
+ WitnessCreateContract = 'WitnessCreateContract',
10
+ AssetIssueContract = 'AssetIssueContract',
11
+ WitnessUpdateContract = 'WitnessUpdateContract',
12
+ ParticipateAssetIssueContract = 'ParticipateAssetIssueContract',
13
+ AccountUpdateContract = 'AccountUpdateContract',
14
+ FreezeBalanceContract = 'FreezeBalanceContract',
15
+ UnfreezeBalanceContract = 'UnfreezeBalanceContract',
16
+ CancelAllUnfreezeV2Contract = 'CancelAllUnfreezeV2Contract',
17
+ WithdrawBalanceContract = 'WithdrawBalanceContract',
18
+ UnfreezeAssetContract = 'UnfreezeAssetContract',
19
+ UpdateAssetContract = 'UpdateAssetContract',
20
+ ProposalCreateContract = 'ProposalCreateContract',
21
+ ProposalApproveContract = 'ProposalApproveContract',
22
+ ProposalDeleteContract = 'ProposalDeleteContract',
23
+ SetAccountIdContract = 'SetAccountIdContract',
24
+ CustomContract = 'CustomContract',
25
+ CreateSmartContract = 'CreateSmartContract',
26
+ TriggerSmartContract = 'TriggerSmartContract',
27
+ GetContract = 'GetContract',
28
+ UpdateSettingContract = 'UpdateSettingContract',
29
+ ExchangeCreateContract = 'ExchangeCreateContract',
30
+ ExchangeInjectContract = 'ExchangeInjectContract',
31
+ ExchangeWithdrawContract = 'ExchangeWithdrawContract',
32
+ ExchangeTransactionContract = 'ExchangeTransactionContract',
33
+ UpdateEnergyLimitContract = 'UpdateEnergyLimitContract',
34
+ AccountPermissionUpdateContract = 'AccountPermissionUpdateContract',
35
+ ClearABIContract = 'ClearABIContract',
36
+ UpdateBrokerageContract = 'UpdateBrokerageContract',
37
+ ShieldedTransferContract = 'ShieldedTransferContract',
38
+ MarketSellAssetContract = 'MarketSellAssetContract',
39
+ MarketCancelOrderContract = 'MarketCancelOrderContract',
40
+ FreezeBalanceV2Contract = 'FreezeBalanceV2Contract',
41
+ UnfreezeBalanceV2Contract = 'UnfreezeBalanceV2Contract',
42
+ WithdrawExpireUnfreezeContract = 'WithdrawExpireUnfreezeContract',
43
+ DelegateResourceContract = 'DelegateResourceContract',
44
+ UnDelegateResourceContract = 'UnDelegateResourceContract',
45
+ UNRECOGNIZED = 'UNRECOGNIZED',
46
+ }
47
+ export enum Permission_PermissionType {
48
+ Owner = 0,
49
+ Witness = 1,
50
+ Active = 2,
51
+ UNRECOGNIZED = -1,
52
+ }
53
+
54
+ export interface Key {
55
+ address: Uint8Array;
56
+ weight: number;
57
+ }
58
+
59
+ export enum AccountType {
60
+ Normal = 0,
61
+ AssetIssue = 1,
62
+ Contract = 2,
63
+ UNRECOGNIZED = -1,
64
+ }
65
+
66
+ export interface PermissionKey {
67
+ address: string;
68
+ weight: number;
69
+ }
70
+ export interface Permission {
71
+ type: number;
72
+ /** Owner id=0, Witness id=1, Active id start by 2 */
73
+ id?: number;
74
+ permission_name: string;
75
+ threshold: number;
76
+ operations?: string;
77
+ keys: PermissionKey[];
78
+ }
79
+
80
+ export interface TransferContract {
81
+ to_address: string;
82
+ owner_address: string;
83
+ amount: number;
84
+ }
85
+
86
+ export interface TransferAssetContract {
87
+ to_address: string;
88
+ owner_address: string;
89
+ amount: number;
90
+ asset_name: string;
91
+ }
92
+
93
+ export interface ParticipateAssetIssueContract {
94
+ to_address: string;
95
+ owner_address: string;
96
+ asset_name: string;
97
+ amount: number;
98
+ }
99
+
100
+ export interface TriggerSmartContract {
101
+ owner_address: string;
102
+ contract_address: string;
103
+ call_value?: number;
104
+ call_token_value?: number;
105
+ token_id?: number;
106
+ data?: string;
107
+ }
108
+
109
+ export interface FreezeBalanceContract {
110
+ owner_address: string;
111
+ frozen_balance: number;
112
+ frozen_duration: number;
113
+ resource?: Resource;
114
+ receiver_address?: string;
115
+ }
116
+
117
+ export interface UnfreezeBalanceContract {
118
+ owner_address: string;
119
+ resource: string;
120
+ receiver_address: string;
121
+ }
122
+
123
+ export interface WithdrawBalanceContract {
124
+ owner_address: string;
125
+ }
126
+
127
+ export interface FreezeBalanceV2Contract {
128
+ owner_address: string;
129
+ frozen_balance: number;
130
+ resource?: Resource;
131
+ }
132
+
133
+ export interface CancelFreezeBalanceV2Contract {
134
+ owner_address: string;
135
+ }
136
+
137
+ export interface UnfreezeBalanceV2Contract {
138
+ owner_address: string;
139
+ unfreeze_balance: number;
140
+ resource?: Resource;
141
+ }
142
+
143
+ export interface DelegateResourceContract {
144
+ owner_address: string;
145
+ receiver_address: string;
146
+ balance: number;
147
+ resource?: Resource;
148
+ lock?: boolean;
149
+ lock_period?: number;
150
+ }
151
+
152
+ export interface UnDelegateResourceContract {
153
+ owner_address: string;
154
+ receiver_address: string;
155
+ balance: number;
156
+ resource?: Resource;
157
+ }
158
+
159
+ export interface WithdrawExpireUnfreezeContract {
160
+ owner_address: string;
161
+ }
162
+
163
+ export interface CreateSmartContract {
164
+ owner_address: string;
165
+ call_token_value: number;
166
+ token_id: string;
167
+ new_contract: {
168
+ name: string;
169
+ origin_address: string;
170
+ contract_address: string;
171
+ abi: { entrys?: ContractAbiInterface };
172
+ bytecode: string;
173
+ call_value: number;
174
+ consume_user_resource_percent: number;
175
+ origin_energy_limit: number;
176
+ };
177
+ }
178
+
179
+ export interface DeployConstantContract {
180
+ data: string;
181
+ owner_address: string;
182
+ call_value?: number;
183
+ token_id?: number | string;
184
+ call_token_value?: number | string;
185
+ }
186
+
187
+ export interface ClearABIContract {
188
+ contract_address: string;
189
+ owner_address: string;
190
+ }
191
+
192
+ export interface UpdateBrokerageContract {
193
+ brokerage: number;
194
+ owner_address: string;
195
+ }
196
+
197
+ interface FrozenSupply {
198
+ frozen_amount: number;
199
+ frozen_days: number;
200
+ }
201
+ export interface AssetIssueContract {
202
+ owner_address: string;
203
+ name: string;
204
+ abbr: string;
205
+ description: string;
206
+ url: string;
207
+ total_supply: number;
208
+ trx_num: number;
209
+ num: number;
210
+ start_time: number;
211
+ end_time: number;
212
+ precision: number;
213
+ free_asset_net_limit: number;
214
+ public_free_asset_net_limit: number;
215
+ public_free_asset_net_usage: number;
216
+ public_latest_free_net_time: number;
217
+ vote_score: number;
218
+ frozen_supply: FrozenSupply[];
219
+ }
220
+
221
+ export interface AccountCreateContract {
222
+ account_address: string;
223
+ owner_address: string;
224
+ }
225
+
226
+ export interface AccountUpdateContract {
227
+ account_name: string;
228
+ owner_address: string;
229
+ }
230
+
231
+ export interface SetAccountIdContract {
232
+ account_id: string;
233
+ owner_address: string;
234
+ }
235
+
236
+ export interface ProposalCreateContract {
237
+ owner_address: string;
238
+ parameters: Record<string, string | number>[];
239
+ }
240
+
241
+ export interface ProposalDeleteContract {
242
+ owner_address: string;
243
+ proposal_id: number;
244
+ }
245
+
246
+ export interface VoteProposalContract {
247
+ owner_address: string;
248
+ proposal_id: number;
249
+ is_add_approval: boolean;
250
+ }
251
+
252
+ export interface ExchangeCreateContract {
253
+ owner_address: string;
254
+ first_token_id: string;
255
+ first_token_balance: number;
256
+ second_token_id: string;
257
+ second_token_balance: number;
258
+ }
259
+
260
+ export interface ExchangeInjectContract {
261
+ owner_address: string;
262
+ exchange_id: number;
263
+ token_id: string;
264
+ quant: number;
265
+ }
266
+
267
+ export interface ExchangeWithdrawContract {
268
+ owner_address: string;
269
+ exchange_id: number;
270
+ token_id: string;
271
+ quant: number;
272
+ }
273
+
274
+ export interface ExchangeTransactionContract {
275
+ owner_address: string;
276
+ exchange_id: number;
277
+ token_id: string;
278
+ quant: number;
279
+ expected: number;
280
+ }
281
+
282
+ export interface UpdateSettingContract {
283
+ owner_address: string;
284
+ contract_address: string;
285
+ consume_user_resource_percent: number;
286
+ }
287
+
288
+ export interface UpdateEnergyLimitContract {
289
+ owner_address: string;
290
+ contract_address: string;
291
+ origin_energy_limit: number;
292
+ }
293
+
294
+ export interface AccountPermissionUpdateContract {
295
+ owner_address: string;
296
+ owner?: Permission;
297
+ witness?: Permission;
298
+ actives?: Permission[];
299
+ }
300
+
301
+ export interface UpdateAssetContract {
302
+ owner_address: string;
303
+ description: string;
304
+ url: string;
305
+ new_limit?: number;
306
+ new_public_limit?: number;
307
+ }
308
+
309
+ export interface WitnessCreateContract {
310
+ owner_address: string;
311
+ url: string;
312
+ }
313
+
314
+ export interface VoteWitnessContract {
315
+ owner_address: string;
316
+ votes: { vote_address: string; vote_count: number }[];
317
+ }
318
+
319
+ export type ContractParamter =
320
+ | TransferContract
321
+ | TransferAssetContract
322
+ | ParticipateAssetIssueContract
323
+ | TriggerSmartContract
324
+ | FreezeBalanceContract
325
+ | UnfreezeBalanceContract
326
+ | WithdrawBalanceContract
327
+ | FreezeBalanceV2Contract
328
+ | CancelFreezeBalanceV2Contract
329
+ | UnfreezeBalanceV2Contract
330
+ | DelegateResourceContract
331
+ | UnDelegateResourceContract
332
+ | WithdrawExpireUnfreezeContract
333
+ | CreateSmartContract
334
+ | ClearABIContract
335
+ | UpdateBrokerageContract
336
+ | AssetIssueContract
337
+ | AccountCreateContract
338
+ | AccountUpdateContract
339
+ | SetAccountIdContract
340
+ | ProposalCreateContract
341
+ | ProposalDeleteContract
342
+ | VoteProposalContract
343
+ | ExchangeCreateContract
344
+ | ExchangeInjectContract
345
+ | ExchangeWithdrawContract
346
+ | ExchangeTransactionContract
347
+ | UpdateSettingContract
348
+ | UpdateEnergyLimitContract
349
+ | AccountPermissionUpdateContract
350
+ | UpdateAssetContract
351
+ | WitnessCreateContract
352
+ | VoteWitnessContract;
@@ -0,0 +1,7 @@
1
+ import { RawAxiosRequestHeaders, AxiosHeaders, HeadersDefaults } from 'axios';
2
+ export type HeadersType = RawAxiosRequestHeaders | InstanceType<typeof AxiosHeaders> | Partial<HeadersDefaults>;
3
+ export type RequestHeaders = RawAxiosRequestHeaders;
4
+
5
+ export interface HttpProviderInstance {
6
+ request<R = unknown>(config: any): Promise<{ data: R }>;
7
+ }
@@ -0,0 +1,70 @@
1
+ import { ContractParamter, ContractType, CreateSmartContract, TriggerSmartContract } from './Contract.js';
2
+
3
+ export interface ContractParamterWrapper<T = ContractParamter> {
4
+ value: T;
5
+ type_url: string;
6
+ }
7
+ export interface TransactionContract<T = ContractParamter> {
8
+ type: ContractType;
9
+ parameter: ContractParamterWrapper<T>;
10
+ Permission_id?: number;
11
+ }
12
+
13
+ export interface Transaction<T = ContractParamter> {
14
+ visible: boolean;
15
+ txID: string;
16
+ raw_data: {
17
+ contract: TransactionContract<T>[];
18
+ ref_block_bytes: string;
19
+ ref_block_hash: string;
20
+ expiration: number;
21
+ timestamp: number;
22
+ data?: unknown;
23
+ fee_limit?: unknown;
24
+ };
25
+ raw_data_hex: string;
26
+ }
27
+
28
+ export interface CreateSmartContractTransaction extends Transaction<CreateSmartContract> {
29
+ /**
30
+ * Address of smart contract.
31
+ */
32
+ contract_address: string;
33
+ }
34
+
35
+ /**
36
+ * `TransactionWrapper` interface is returned when user trigger a smart contract.
37
+ */
38
+ export interface TransactionWrapper {
39
+ Error?: string;
40
+ result: {
41
+ result: boolean;
42
+ message?: string;
43
+ };
44
+ /**
45
+ * The transaction object created by calling contract function.
46
+ */
47
+ transaction: Transaction<TriggerSmartContract>;
48
+ /**
49
+ * Energy required for successfully deploying new contract or trigger contract.
50
+ * This is returned in `transactionBuilder.estimateEnergy()` and `transactionBuilder.deployConstantContract()`
51
+ */
52
+ energy_required?: number;
53
+ /**
54
+ * The penalty energy consumption.
55
+ */
56
+ energy_penalty?: number;
57
+ /**
58
+ * Energy used by triggering contract.
59
+ */
60
+ energy_used?: number;
61
+ /**
62
+ * Result of calling contract function which is decorated by `view` or `pure`.
63
+ */
64
+ constant_result?: any;
65
+ }
66
+
67
+ export interface SignedTransaction<T extends ContractParamter = ContractParamter> extends Transaction<T> {
68
+ signature: string[];
69
+ contract_address?: string;
70
+ }
@@ -0,0 +1,281 @@
1
+ import { AbiFragment, ContractAbiInterface } from './ABI.js';
2
+ import { Transaction } from './Transaction.js';
3
+
4
+ export interface TransactionCommonOptions {
5
+ /**
6
+ * Permission id for multi-sign.
7
+ */
8
+ permissionId?: number;
9
+ blockHeader?: Partial<Transaction['raw_data']>;
10
+ }
11
+
12
+
13
+ export type NumberLike = string | number;
14
+
15
+ export type Resource = 'BANDWIDTH' | 'ENERGY';
16
+
17
+ export interface VoteInfo {
18
+ [srAddress: string]: number;
19
+ }
20
+
21
+ export interface CreateSmartContractOptions extends TransactionCommonOptions {
22
+ /**
23
+ * The maximum TRX burns for resource consumption(1TRX = 1,000,000SUN).
24
+ */
25
+ feeLimit?: number;
26
+ /**
27
+ * The TRX transfer to the contract for each call(1TRX = 1,000,000SUN)
28
+ */
29
+ callValue?: number;
30
+ /**
31
+ * The id of trc10 token transfer to the contract (Optional)
32
+ */
33
+ tokenId?: string;
34
+ /**
35
+ * The amount of trc10 token transfer to the contract for each call (Optional)
36
+ */
37
+ tokenValue?: number;
38
+ /**
39
+ * Consume user's resource percentage. It should be an integer between [0, 100].
40
+ * if 0, means it does not consume user's resource until the developer's resource has been used up.
41
+ */
42
+ userFeePercentage?: number;
43
+ /**
44
+ * The maximum resource consumption of the creator in one execution or creation.
45
+ */
46
+ originEnergyLimit?: number;
47
+ /**
48
+ * Abi string
49
+ */
50
+ abi: string | { entrys: ContractAbiInterface } | ContractAbiInterface;
51
+ /**
52
+ * Bytecode, default hexString.
53
+ */
54
+ bytecode: string;
55
+ /**
56
+ * The list of the parameters of the constructor.
57
+ * It should be converted hexString after encoded according to ABI encoder.
58
+ * If constructor has no parameter, this can be optional
59
+ */
60
+ parameters?: unknown[];
61
+ /**
62
+ * Contract name string.
63
+ */
64
+ name?: string;
65
+ /**
66
+ * Optional. raw parameters encoded according to [ABI Specification](https://docs.soliditylang.org/en/latest/abi-spec.html)
67
+ * For example: 0x0000000000000000000000000000000000000000000000000000000000000001.
68
+ */
69
+ rawParameter?: string;
70
+ /**
71
+ * Optional. JSON format for contract function.
72
+ * For example: { "type":"function", "inputs": [{"name":"a","type":"uint256"}], "name":"foo", "outputs": [] }
73
+ */
74
+ funcABIV2?: AbiFragment;
75
+ /**
76
+ * The parameters of the function specified by `funcABIV2`.
77
+ * Required if `funcABIV2` exists.
78
+ */
79
+ parametersV2?: unknown[];
80
+ }
81
+
82
+ export interface TriggerSmartContractOptions extends TransactionCommonOptions {
83
+ /**
84
+ * The maximum TRX burns for resource consumption in SUN(1TRX = 1,000,000SUN).
85
+ */
86
+ feeLimit?: number;
87
+ /**
88
+ * The TRX transfer to the contract for each call in SUN(1TRX = 1,000,000SUN)
89
+ */
90
+ callValue?: number;
91
+ /**
92
+ * The id of trc10 token transfer to the contract (Optional)
93
+ */
94
+ tokenId?: string;
95
+ /**
96
+ * The amount of trc10 token transfer to the contract for each call (Optional)
97
+ */
98
+ tokenValue?: number;
99
+ /**
100
+ * JSON format for contract function.
101
+ * For example: `{ "type":"function", "inputs": [{"name":"a","type":"uint256"}], "name":"foo", "outputs": [] }`.
102
+ * If exists, the `parameters` will be ignored.
103
+ * Optional.
104
+ */
105
+ funcABIV2?: AbiFragment;
106
+ /**
107
+ * The parameters of the function specified by `funcABIV2`.
108
+ * Required if `funcABIV2` exists.
109
+ */
110
+ parametersV2?: unknown[];
111
+ /**
112
+ * Raw parameters encoded according to [ABI Specification](https://docs.soliditylang.org/en/latest/abi-spec.html).
113
+ * If exists, the `parametersV2` and `parameters` will be ignored.
114
+ * For example: 0x0000000000000000000000000000000000000000000000000000000000000001.
115
+ * Optional.
116
+ */
117
+ shieldedParameter?: string;
118
+ /**
119
+ * Alias of `shieldedParameter`. If exists, the `shieldedParameter`, `parametersV2` and `parameters` will be ignored.
120
+ */
121
+ rawParameter?: string;
122
+ /**
123
+ * If functionSelector is not specified, this parameter will be used as data.
124
+ */
125
+ input?: string;
126
+ /**
127
+ * Create transaction locally.
128
+ */
129
+ txLocal?: boolean;
130
+ _isConstant?: boolean;
131
+ /**
132
+ * If use solidity node to trigger smart contract.
133
+ */
134
+ confirmed?: boolean;
135
+ }
136
+ export interface TriggerConstantContractOptions extends TriggerSmartContractOptions {
137
+ _isConstant?: boolean;
138
+ /**
139
+ * Whether the request only aims to estimating energy not trigger contract actually.
140
+ */
141
+ estimateEnergy?: boolean;
142
+ /**
143
+ * If use solidity node to trigger smart contract.
144
+ */
145
+ confirmed?: boolean;
146
+ }
147
+ // @todo: more detailed type
148
+ export interface ContractFunctionParameter {
149
+ type: string;
150
+ value: unknown;
151
+ }
152
+
153
+ export interface CreateTokenOptions extends TransactionCommonOptions {
154
+ /**
155
+ * Token name, default string.
156
+ */
157
+ name: string;
158
+ /**
159
+ * Token name abbreviation, default string.
160
+ */
161
+ abbreviation: string;
162
+ /**
163
+ * Token description, default string.
164
+ */
165
+ description?: string;
166
+ /**
167
+ * Token official website url, default string.
168
+ */
169
+ url: string;
170
+ /**
171
+ * Token total supply.
172
+ */
173
+ totalSupply: number;
174
+ /**
175
+ * Define the price by the ratio of trx_num/num.
176
+ * Default is 1.
177
+ */
178
+ trxRatio: number;
179
+ /**
180
+ * Define the price by the ratio of trx_num/num.
181
+ * Default is 1.
182
+ */
183
+ tokenRatio: number;
184
+ /**
185
+ * ICO start time.
186
+ */
187
+ saleStart: number;
188
+ /**
189
+ * ICO end time.
190
+ */
191
+ saleEnd: number;
192
+ /**
193
+ * The creator's "donated" bandwidth for use by token holders.
194
+ * Default is 0.
195
+ */
196
+ freeBandwidth?: number;
197
+ /**
198
+ * Out of `totalFreeBandwidth`, the amount each token holder get.
199
+ * Default is 0.
200
+ */
201
+ freeBandwidthLimit?: number;
202
+ /**
203
+ * Token staked supply.
204
+ * Default is 0.
205
+ */
206
+ frozenAmount?: number;
207
+ /**
208
+ * Token staked duration.
209
+ * Default is 0.
210
+ */
211
+ frozenDuration?: number;
212
+ /**
213
+ * @todo: desc
214
+ */
215
+ voteScore?: number;
216
+ /**
217
+ * Precision of issued tokens.
218
+ */
219
+ precision?: number;
220
+ }
221
+
222
+ export interface UpdateTokenOptions extends TransactionCommonOptions {
223
+ /**
224
+ * The description of token.
225
+ * Optional.
226
+ */
227
+ description?: string;
228
+ /**
229
+ * The token's website url.
230
+ */
231
+ url: string;
232
+ /**
233
+ * Each token holder's free bandwidth.
234
+ * Optional.
235
+ */
236
+ freeBandwidth?: number;
237
+ /**
238
+ * The total free bandwidth of the token.
239
+ * Optional. Default is 0.
240
+ */
241
+ freeBandwidthLimit?: number;
242
+ }
243
+
244
+ export interface DeployConstantContractOptions {
245
+ /**
246
+ * The bytecode of contract to be deployed.
247
+ */
248
+ input: string;
249
+ /**
250
+ * Owner address of the new contract.
251
+ */
252
+ ownerAddress: string;
253
+ /**
254
+ * The id of token to be transfered to the new contract.
255
+ * Optional.
256
+ */
257
+ tokenId?: string | number;
258
+ /**
259
+ * The amount of token to be transfered to the new contract.
260
+ */
261
+ tokenValue?: string | number;
262
+ /**
263
+ * Amount of TRX transferred with this transaction, measured in SUN (1TRX = 1,000,000 SUN).
264
+ */
265
+ callValue?: number;
266
+ /**
267
+ * Whether send request to solidity node.
268
+ */
269
+ confirmed?: boolean;
270
+ }
271
+
272
+ export interface AlterTransactionOptions {
273
+ data?: string;
274
+ dataFormat?: string;
275
+ extension?: number;
276
+ txLocal?: boolean;
277
+ }
278
+
279
+ export interface TxLocal {
280
+ txLocal?: boolean;
281
+ }