@aeternity/aepp-sdk 11.0.1 → 12.1.1

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 (444) hide show
  1. package/LICENSE +1 -1
  2. package/dist/aepp-sdk.browser-script.js +1 -1
  3. package/dist/aepp-sdk.browser-script.js.LICENSE.txt +0 -22
  4. package/dist/aepp-sdk.browser-script.js.map +1 -1
  5. package/dist/aepp-sdk.browser.js +2 -1
  6. package/dist/aepp-sdk.browser.js.LICENSE.txt +1 -0
  7. package/dist/aepp-sdk.browser.js.map +1 -1
  8. package/dist/aepp-sdk.js +20765 -1
  9. package/dist/aepp-sdk.js.map +1 -1
  10. package/es/AeSdk.d.ts +37 -0
  11. package/es/AeSdk.mjs +81 -0
  12. package/es/AeSdk.mjs.map +1 -0
  13. package/es/AeSdkAepp.d.ts +70 -0
  14. package/es/AeSdkAepp.mjs +176 -0
  15. package/es/AeSdkAepp.mjs.map +1 -0
  16. package/es/AeSdkBase.d.ts +213 -0
  17. package/es/AeSdkBase.mjs +314 -0
  18. package/es/AeSdkBase.mjs.map +1 -0
  19. package/es/AeSdkWallet.d.ts +104 -0
  20. package/es/AeSdkWallet.mjs +326 -0
  21. package/es/AeSdkWallet.mjs.map +1 -0
  22. package/es/Node.d.ts +41 -0
  23. package/es/Node.mjs +147 -0
  24. package/es/Node.mjs.map +1 -0
  25. package/es/account/Base.d.ts +68 -0
  26. package/es/account/Base.mjs +123 -0
  27. package/es/account/Base.mjs.map +1 -0
  28. package/es/account/Memory.d.ts +26 -0
  29. package/es/account/Memory.mjs +103 -0
  30. package/es/account/Memory.mjs.map +1 -0
  31. package/es/account/Rpc.d.ts +27 -0
  32. package/es/account/Rpc.mjs +80 -0
  33. package/es/account/Rpc.mjs.map +1 -0
  34. package/es/aens.d.ts +222 -0
  35. package/es/aens.mjs +338 -0
  36. package/es/aens.mjs.map +1 -0
  37. package/es/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  38. package/es/aepp-wallet-communication/connection/Browser.mjs +73 -0
  39. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -0
  40. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +18 -0
  41. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +58 -0
  42. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -0
  43. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  44. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +146 -0
  45. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -0
  46. package/es/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  47. package/{src/utils/crypto-ts.ts → es/aepp-wallet-communication/connection-proxy.mjs} +16 -11
  48. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -0
  49. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  50. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +169 -0
  51. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -0
  52. package/es/aepp-wallet-communication/rpc/types.d.ts +77 -0
  53. package/es/aepp-wallet-communication/rpc/types.mjs +3 -0
  54. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -0
  55. package/es/aepp-wallet-communication/schema.d.ts +105 -46
  56. package/es/aepp-wallet-communication/schema.mjs +251 -0
  57. package/es/aepp-wallet-communication/schema.mjs.map +1 -0
  58. package/es/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  59. package/es/aepp-wallet-communication/wallet-detector.mjs +62 -0
  60. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
  61. package/es/apis/compiler/compiler.d.ts +92 -0
  62. package/es/apis/compiler/compiler.mjs +576 -0
  63. package/es/apis/compiler/compiler.mjs.map +1 -0
  64. package/es/apis/compiler/index.d.ts +2 -0
  65. package/es/apis/compiler/index.mjs +3 -0
  66. package/es/apis/compiler/index.mjs.map +1 -0
  67. package/es/apis/compiler/models/index.d.ts +248 -0
  68. package/es/apis/compiler/models/index.mjs +48 -0
  69. package/es/apis/compiler/models/index.mjs.map +1 -0
  70. package/es/apis/compiler/models/mappers.d.ts +23 -0
  71. package/es/apis/compiler/models/mappers.mjs +585 -0
  72. package/es/apis/compiler/models/mappers.mjs.map +1 -0
  73. package/es/apis/compiler/models/parameters.d.ts +13 -0
  74. package/es/apis/compiler/models/parameters.mjs +71 -0
  75. package/es/apis/compiler/models/parameters.mjs.map +1 -0
  76. package/es/apis/node/index.d.ts +2 -0
  77. package/es/apis/node/index.mjs +3 -0
  78. package/es/apis/node/index.mjs.map +1 -0
  79. package/es/apis/node/models/index.d.ts +1065 -0
  80. package/es/apis/node/models/index.mjs +2 -0
  81. package/es/apis/node/models/index.mjs.map +1 -0
  82. package/es/apis/node/models/mappers.d.ts +95 -0
  83. package/es/apis/node/models/mappers.mjs +4166 -0
  84. package/es/apis/node/models/mappers.mjs.map +1 -0
  85. package/es/apis/node/models/parameters.d.ts +17 -0
  86. package/es/apis/node/models/parameters.mjs +165 -0
  87. package/es/apis/node/models/parameters.mjs.map +1 -0
  88. package/es/apis/node/node.d.ts +215 -0
  89. package/es/apis/node/node.mjs +1165 -0
  90. package/es/apis/node/node.mjs.map +1 -0
  91. package/es/chain.d.ts +248 -0
  92. package/es/chain.mjs +560 -0
  93. package/es/chain.mjs.map +1 -0
  94. package/es/channel/handlers.d.ts +34 -0
  95. package/es/channel/handlers.mjs +164 -131
  96. package/es/channel/handlers.mjs.map +1 -1
  97. package/es/channel/index.d.ts +625 -0
  98. package/es/channel/index.mjs +897 -902
  99. package/es/channel/index.mjs.map +1 -1
  100. package/es/channel/internal.d.ts +101 -0
  101. package/es/channel/internal.mjs +136 -85
  102. package/es/channel/internal.mjs.map +1 -1
  103. package/es/contract/Compiler.d.ts +18 -0
  104. package/es/contract/Compiler.mjs +68 -0
  105. package/es/contract/Compiler.mjs.map +1 -0
  106. package/es/contract/aci.d.ts +127 -0
  107. package/es/contract/aci.mjs +225 -193
  108. package/es/contract/aci.mjs.map +1 -1
  109. package/es/contract/ga.d.ts +69 -0
  110. package/es/contract/ga.mjs +195 -0
  111. package/es/contract/ga.mjs.map +1 -0
  112. package/es/contract/methods.d.ts +71 -0
  113. package/es/contract/methods.mjs +104 -0
  114. package/es/contract/methods.mjs.map +1 -0
  115. package/es/deprecated/index.d.ts +143 -0
  116. package/es/deprecated/index.mjs +162 -0
  117. package/es/deprecated/index.mjs.map +1 -0
  118. package/es/deprecated/methods.d.ts +18 -0
  119. package/es/deprecated/methods.mjs +26 -0
  120. package/es/deprecated/methods.mjs.map +1 -0
  121. package/es/index.d.ts +35 -0
  122. package/es/index.mjs +35 -40
  123. package/es/index.mjs.map +1 -1
  124. package/es/oracle.d.ts +161 -0
  125. package/es/oracle.mjs +306 -0
  126. package/es/oracle.mjs.map +1 -0
  127. package/es/spend.d.ts +62 -0
  128. package/es/spend.mjs +111 -0
  129. package/es/spend.mjs.map +1 -0
  130. package/es/tx/builder/address.d.ts +25 -0
  131. package/es/tx/builder/address.mjs +45 -0
  132. package/es/tx/builder/address.mjs.map +1 -0
  133. package/es/tx/builder/constants.d.ts +70 -0
  134. package/es/tx/builder/constants.mjs +61 -47
  135. package/es/tx/builder/constants.mjs.map +1 -1
  136. package/es/tx/builder/field-types/coin-amount.d.ts +13 -0
  137. package/es/tx/builder/field-types/coin-amount.mjs +26 -0
  138. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -0
  139. package/es/tx/builder/field-types/deposit.d.ts +15 -0
  140. package/es/tx/builder/field-types/deposit.mjs +19 -0
  141. package/es/tx/builder/field-types/deposit.mjs.map +1 -0
  142. package/es/tx/builder/field-types/fee.d.ts +25 -0
  143. package/es/tx/builder/field-types/fee.mjs +150 -0
  144. package/es/tx/builder/field-types/fee.mjs.map +1 -0
  145. package/es/tx/builder/field-types/field.d.ts +6 -0
  146. package/es/tx/builder/field-types/field.mjs +15 -0
  147. package/es/tx/builder/field-types/field.mjs.map +1 -0
  148. package/es/tx/builder/field-types/gas-limit.d.ts +12 -0
  149. package/es/tx/builder/field-types/gas-limit.mjs +33 -0
  150. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -0
  151. package/es/tx/builder/field-types/gas-price.d.ts +8 -0
  152. package/es/tx/builder/field-types/gas-price.mjs +18 -0
  153. package/es/tx/builder/field-types/gas-price.mjs.map +1 -0
  154. package/es/tx/builder/field-types/index.d.ts +70 -0
  155. package/es/tx/builder/field-types/index.mjs +25 -0
  156. package/es/tx/builder/field-types/index.mjs.map +1 -0
  157. package/es/tx/builder/field-types/name-fee.d.ts +20 -0
  158. package/es/tx/builder/field-types/name-fee.mjs +24 -0
  159. package/es/tx/builder/field-types/name-fee.mjs.map +1 -0
  160. package/es/tx/builder/field-types/name-id.d.ts +14 -0
  161. package/es/tx/builder/field-types/name-id.mjs +19 -0
  162. package/es/tx/builder/field-types/name-id.mjs.map +1 -0
  163. package/es/tx/builder/field-types/name.d.ts +13 -0
  164. package/es/tx/builder/field-types/name.mjs +18 -0
  165. package/es/tx/builder/field-types/name.mjs.map +1 -0
  166. package/es/tx/builder/field-types/short-u-int.d.ts +6 -0
  167. package/es/tx/builder/field-types/short-u-int.mjs +12 -0
  168. package/es/tx/builder/field-types/short-u-int.mjs.map +1 -0
  169. package/es/tx/builder/field-types/u-int.d.ts +8 -0
  170. package/es/tx/builder/field-types/u-int.mjs +14 -0
  171. package/es/tx/builder/field-types/u-int.mjs.map +1 -0
  172. package/es/tx/builder/helpers.d.ts +125 -0
  173. package/es/tx/builder/helpers.mjs +94 -198
  174. package/es/tx/builder/helpers.mjs.map +1 -1
  175. package/es/tx/builder/index.d.ts +88 -0
  176. package/es/tx/builder/index.mjs +167 -358
  177. package/es/tx/builder/index.mjs.map +1 -1
  178. package/es/tx/builder/schema.d.ts +1201 -0
  179. package/es/tx/builder/schema.mjs +175 -561
  180. package/es/tx/builder/schema.mjs.map +1 -1
  181. package/es/tx/index.d.ts +64 -0
  182. package/es/tx/index.mjs +151 -265
  183. package/es/tx/index.mjs.map +1 -1
  184. package/es/tx/validator.d.ts +20 -0
  185. package/es/tx/validator.mjs +104 -124
  186. package/es/tx/validator.mjs.map +1 -1
  187. package/es/typings/@aeternity__argon2-browser/index.d.mjs +2 -0
  188. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -0
  189. package/es/typings/@aeternity__uuid/index.d.mjs +2 -0
  190. package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -0
  191. package/es/typings/bip32-path/index.d.mjs +2 -0
  192. package/es/typings/bip32-path/index.d.mjs.map +1 -0
  193. package/es/typings/blakejs/index.d.mjs.map +1 -1
  194. package/es/typings/sha-js/index.d.mjs +2 -0
  195. package/es/typings/sha-js/index.d.mjs.map +1 -0
  196. package/es/typings/tweetnacl-auth/index.d.mjs +2 -0
  197. package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -0
  198. package/es/utils/amount-formatter.d.ts +42 -0
  199. package/es/utils/amount-formatter.mjs +36 -49
  200. package/es/utils/amount-formatter.mjs.map +1 -1
  201. package/es/utils/autorest.d.ts +6 -0
  202. package/es/utils/autorest.mjs +97 -0
  203. package/es/utils/autorest.mjs.map +1 -0
  204. package/es/utils/bignumber.d.ts +13 -0
  205. package/es/utils/bignumber.mjs +11 -8
  206. package/es/utils/bignumber.mjs.map +1 -1
  207. package/es/{bytes.d.ts → utils/bytes.d.ts} +10 -13
  208. package/es/utils/bytes.mjs +11 -15
  209. package/es/utils/bytes.mjs.map +1 -1
  210. package/es/utils/crypto.d.ts +88 -0
  211. package/es/utils/crypto.mjs +64 -98
  212. package/es/utils/crypto.mjs.map +1 -1
  213. package/es/utils/encoder-types.d.ts +61 -0
  214. package/es/utils/encoder-types.mjs +36 -0
  215. package/es/utils/encoder-types.mjs.map +1 -0
  216. package/es/utils/encoder.d.ts +25 -0
  217. package/es/utils/encoder.mjs +71 -59
  218. package/es/utils/encoder.mjs.map +1 -1
  219. package/es/{errors.d.ts → utils/errors.d.ts} +246 -59
  220. package/es/utils/errors.mjs +313 -136
  221. package/es/utils/errors.mjs.map +1 -1
  222. package/es/utils/hd-wallet.d.ts +50 -0
  223. package/es/utils/hd-wallet.mjs +86 -45
  224. package/es/utils/hd-wallet.mjs.map +1 -1
  225. package/es/utils/json-big.d.ts +5 -0
  226. package/es/utils/json-big.mjs +12 -16
  227. package/es/utils/json-big.mjs.map +1 -1
  228. package/es/utils/keystore.d.ts +51 -0
  229. package/es/utils/keystore.mjs +101 -194
  230. package/es/utils/keystore.mjs.map +1 -1
  231. package/es/{mptree.d.ts → utils/mptree.d.ts} +6 -9
  232. package/es/utils/mptree.mjs +22 -18
  233. package/es/utils/mptree.mjs.map +1 -1
  234. package/es/utils/other.d.ts +20 -0
  235. package/es/utils/other.mjs +32 -35
  236. package/es/utils/other.mjs.map +1 -1
  237. package/es/utils/semver-satisfies.d.ts +1 -0
  238. package/es/utils/semver-satisfies.mjs +2 -2
  239. package/es/utils/semver-satisfies.mjs.map +1 -1
  240. package/es/utils/string.d.ts +24 -0
  241. package/es/utils/string.mjs +8 -10
  242. package/es/utils/string.mjs.map +1 -1
  243. package/package.json +55 -43
  244. package/src/AeSdk.ts +68 -0
  245. package/src/AeSdkAepp.ts +176 -0
  246. package/src/AeSdkBase.ts +338 -0
  247. package/src/AeSdkWallet.ts +348 -0
  248. package/src/Node.ts +173 -0
  249. package/src/account/Base.ts +124 -0
  250. package/src/account/Memory.ts +98 -0
  251. package/src/account/Rpc.ts +69 -0
  252. package/src/aens.ts +407 -0
  253. package/src/aepp-wallet-communication/connection/Browser.ts +71 -0
  254. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +59 -0
  255. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +122 -0
  256. package/{es/utils/crypto-ts.mjs → src/aepp-wallet-communication/connection-proxy.ts} +18 -18
  257. package/src/aepp-wallet-communication/rpc/RpcClient.ts +143 -0
  258. package/src/aepp-wallet-communication/rpc/types.ts +66 -0
  259. package/src/aepp-wallet-communication/schema.ts +224 -0
  260. package/src/aepp-wallet-communication/wallet-detector.ts +72 -0
  261. package/src/apis/compiler/code-model-v4.yaml +2649 -0
  262. package/src/apis/compiler/compiler.ts +585 -0
  263. package/src/apis/compiler/index.ts +2 -0
  264. package/src/apis/compiler/models/index.ts +301 -0
  265. package/src/apis/compiler/models/mappers.ts +583 -0
  266. package/src/apis/compiler/models/parameters.ts +93 -0
  267. package/src/apis/node/code-model-v4.yaml +10080 -0
  268. package/src/apis/node/index.ts +2 -0
  269. package/src/apis/node/models/index.ts +1257 -0
  270. package/src/apis/node/models/mappers.ts +4280 -0
  271. package/src/apis/node/models/parameters.ts +188 -0
  272. package/src/apis/node/node.ts +1299 -0
  273. package/src/chain.ts +502 -0
  274. package/src/channel/handlers.ts +817 -0
  275. package/src/channel/index.ts +1025 -0
  276. package/src/channel/internal.ts +361 -0
  277. package/src/contract/Compiler.ts +67 -0
  278. package/src/contract/aci.ts +538 -0
  279. package/src/contract/ga.ts +199 -0
  280. package/src/contract/methods.ts +123 -0
  281. package/src/deprecated/index.ts +172 -0
  282. package/src/deprecated/methods.ts +25 -0
  283. package/src/index.ts +56 -0
  284. package/src/oracle.ts +364 -0
  285. package/src/spend.ts +164 -0
  286. package/src/tx/builder/address.ts +50 -0
  287. package/src/tx/builder/constants.ts +126 -0
  288. package/src/tx/builder/field-types/coin-amount.ts +27 -0
  289. package/src/tx/builder/field-types/deposit.ts +21 -0
  290. package/src/tx/builder/field-types/fee.ts +143 -0
  291. package/src/tx/builder/field-types/field.ts +9 -0
  292. package/src/tx/builder/field-types/gas-limit.ts +41 -0
  293. package/src/tx/builder/field-types/gas-price.ts +16 -0
  294. package/src/tx/builder/field-types/index.ts +45 -0
  295. package/src/tx/builder/field-types/name-fee.ts +32 -0
  296. package/src/tx/builder/field-types/name-id.ts +20 -0
  297. package/src/tx/builder/field-types/name.ts +18 -0
  298. package/src/tx/builder/field-types/short-u-int.ts +11 -0
  299. package/src/tx/builder/field-types/u-int.ts +16 -0
  300. package/src/tx/builder/helpers.ts +248 -0
  301. package/src/tx/builder/index.ts +400 -0
  302. package/src/tx/builder/schema.ts +727 -0
  303. package/src/tx/index.ts +192 -0
  304. package/src/tx/validator.ts +230 -0
  305. package/src/typings/@aeternity__argon2-browser/index.d.ts +3 -0
  306. package/src/typings/@aeternity__uuid/index.d.ts +5 -0
  307. package/src/typings/bip32-path/index.d.ts +33 -0
  308. package/src/typings/blakejs/index.d.ts +4 -32
  309. package/src/typings/sha-js/index.d.ts +5 -0
  310. package/src/typings/tweetnacl-auth/index.d.ts +14 -0
  311. package/src/utils/amount-formatter.ts +56 -69
  312. package/src/utils/autorest.ts +93 -0
  313. package/src/utils/bignumber.ts +11 -12
  314. package/src/utils/bytes.ts +29 -31
  315. package/src/utils/crypto.ts +205 -0
  316. package/src/utils/encoder-types.ts +63 -0
  317. package/src/utils/encoder.ts +116 -71
  318. package/src/utils/errors.ts +482 -366
  319. package/src/utils/hd-wallet.ts +166 -0
  320. package/src/utils/json-big.ts +27 -0
  321. package/src/utils/keystore.ts +182 -0
  322. package/src/utils/mptree.ts +64 -61
  323. package/src/utils/other.ts +34 -41
  324. package/src/utils/semver-satisfies.ts +15 -11
  325. package/src/utils/string.ts +18 -20
  326. package/es/account/base.mjs +0 -179
  327. package/es/account/base.mjs.map +0 -1
  328. package/es/account/memory.mjs +0 -99
  329. package/es/account/memory.mjs.map +0 -1
  330. package/es/account/multiple.mjs +0 -179
  331. package/es/account/multiple.mjs.map +0 -1
  332. package/es/ae/aens.mjs +0 -404
  333. package/es/ae/aens.mjs.map +0 -1
  334. package/es/ae/aepp.mjs +0 -45
  335. package/es/ae/aepp.mjs.map +0 -1
  336. package/es/ae/contract.mjs +0 -159
  337. package/es/ae/contract.mjs.map +0 -1
  338. package/es/ae/index.mjs +0 -207
  339. package/es/ae/index.mjs.map +0 -1
  340. package/es/ae/oracle.mjs +0 -339
  341. package/es/ae/oracle.mjs.map +0 -1
  342. package/es/ae/universal.mjs +0 -45
  343. package/es/ae/universal.mjs.map +0 -1
  344. package/es/ae/wallet.mjs +0 -50
  345. package/es/ae/wallet.mjs.map +0 -1
  346. package/es/amount-formatter.d.ts +0 -58
  347. package/es/bignumber.d.ts +0 -18
  348. package/es/chain/index.mjs +0 -272
  349. package/es/chain/index.mjs.map +0 -1
  350. package/es/chain/node.mjs +0 -442
  351. package/es/chain/node.mjs.map +0 -1
  352. package/es/contract/compiler.mjs +0 -115
  353. package/es/contract/compiler.mjs.map +0 -1
  354. package/es/contract/ga/helpers.mjs +0 -30
  355. package/es/contract/ga/helpers.mjs.map +0 -1
  356. package/es/contract/ga/index.mjs +0 -178
  357. package/es/contract/ga/index.mjs.map +0 -1
  358. package/es/crypto-ts.d.ts +0 -9
  359. package/es/encoder.d.ts +0 -26
  360. package/es/node-pool/index.mjs +0 -188
  361. package/es/node-pool/index.mjs.map +0 -1
  362. package/es/node.mjs +0 -133
  363. package/es/node.mjs.map +0 -1
  364. package/es/other.d.ts +0 -31
  365. package/es/semver-satisfies.d.ts +0 -1
  366. package/es/string.d.ts +0 -26
  367. package/es/tx/builder/field-types.mjs +0 -74
  368. package/es/tx/builder/field-types.mjs.map +0 -1
  369. package/es/tx/tx-object.mjs +0 -283
  370. package/es/tx/tx-object.mjs.map +0 -1
  371. package/es/tx/tx.mjs +0 -938
  372. package/es/tx/tx.mjs.map +0 -1
  373. package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs +0 -132
  374. package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +0 -1
  375. package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs +0 -183
  376. package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +0 -1
  377. package/es/utils/aepp-wallet-communication/connection/index.mjs +0 -87
  378. package/es/utils/aepp-wallet-communication/connection/index.mjs.map +0 -1
  379. package/es/utils/aepp-wallet-communication/content-script-bridge.mjs +0 -98
  380. package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +0 -1
  381. package/es/utils/aepp-wallet-communication/helpers.mjs +0 -92
  382. package/es/utils/aepp-wallet-communication/helpers.mjs.map +0 -1
  383. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs +0 -375
  384. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +0 -1
  385. package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs +0 -275
  386. package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +0 -1
  387. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs +0 -541
  388. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +0 -1
  389. package/es/utils/aepp-wallet-communication/schema.mjs +0 -102
  390. package/es/utils/aepp-wallet-communication/schema.mjs.map +0 -1
  391. package/es/utils/aepp-wallet-communication/wallet-detector.mjs +0 -110
  392. package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +0 -1
  393. package/es/utils/async-init.mjs +0 -64
  394. package/es/utils/async-init.mjs.map +0 -1
  395. package/es/utils/crypto-ts.mjs.map +0 -1
  396. package/es/utils/swagger.mjs +0 -164
  397. package/es/utils/swagger.mjs.map +0 -1
  398. package/src/account/base.js +0 -153
  399. package/src/account/memory.js +0 -83
  400. package/src/account/multiple.js +0 -162
  401. package/src/ae/aens.js +0 -361
  402. package/src/ae/aepp.js +0 -45
  403. package/src/ae/contract.js +0 -148
  404. package/src/ae/index.js +0 -168
  405. package/src/ae/oracle.js +0 -311
  406. package/src/ae/universal.js +0 -47
  407. package/src/ae/wallet.js +0 -50
  408. package/src/chain/index.js +0 -269
  409. package/src/chain/node.js +0 -320
  410. package/src/channel/handlers.js +0 -673
  411. package/src/channel/index.js +0 -903
  412. package/src/channel/internal.js +0 -236
  413. package/src/contract/aci.js +0 -376
  414. package/src/contract/compiler.js +0 -100
  415. package/src/contract/ga/helpers.js +0 -19
  416. package/src/contract/ga/index.js +0 -150
  417. package/src/index.js +0 -89
  418. package/src/node-pool/index.js +0 -172
  419. package/src/node.js +0 -116
  420. package/src/tx/builder/constants.js +0 -100
  421. package/src/tx/builder/field-types.js +0 -61
  422. package/src/tx/builder/helpers.js +0 -334
  423. package/src/tx/builder/index.js +0 -465
  424. package/src/tx/builder/schema.js +0 -1100
  425. package/src/tx/index.js +0 -301
  426. package/src/tx/tx-object.js +0 -187
  427. package/src/tx/tx.js +0 -631
  428. package/src/tx/validator.js +0 -181
  429. package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -119
  430. package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -165
  431. package/src/utils/aepp-wallet-communication/connection/index.js +0 -85
  432. package/src/utils/aepp-wallet-communication/content-script-bridge.js +0 -86
  433. package/src/utils/aepp-wallet-communication/helpers.js +0 -60
  434. package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -294
  435. package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -232
  436. package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -401
  437. package/src/utils/aepp-wallet-communication/schema.ts +0 -80
  438. package/src/utils/aepp-wallet-communication/wallet-detector.js +0 -92
  439. package/src/utils/async-init.js +0 -45
  440. package/src/utils/crypto.js +0 -219
  441. package/src/utils/hd-wallet.js +0 -100
  442. package/src/utils/json-big.js +0 -26
  443. package/src/utils/keystore.js +0 -219
  444. package/src/utils/swagger.js +0 -156
package/es/spend.mjs ADDED
@@ -0,0 +1,111 @@
1
+ /*
2
+ * ISC License (ISC)
3
+ * Copyright (c) 2022 aeternity developers
4
+ *
5
+ * Permission to use, copy, modify, and/or distribute this software for any
6
+ * purpose with or without fee is hereby granted, provided that the above
7
+ * copyright notice and this permission notice appear in all copies.
8
+ *
9
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ * PERFORMANCE OF THIS SOFTWARE.
16
+ */
17
+ import BigNumber from 'bignumber.js';
18
+ import { sendTransaction, getAccount, getBalance, resolveName } from "./chain.mjs";
19
+ import { _buildTx } from "./tx/index.mjs";
20
+ import { buildTxHash, unpackTx } from "./tx/builder/index.mjs";
21
+ import { ArgumentError } from "./utils/errors.mjs";
22
+ import { Tag } from "./tx/builder/constants.mjs";
23
+
24
+ /**
25
+ * Sign and post a transaction to the chain
26
+ * @category chain
27
+ * @param tx - Transaction
28
+ * @param options - Options
29
+ * @param options.verify - Verify transaction before broadcast, throw error if not
30
+ * valid
31
+ * @returns Transaction
32
+ */
33
+ export async function send(tx, options) {
34
+ // TODO: detect authFun in AccountGa
35
+ const authFun = options.innerTx === true ? undefined : (await getAccount(await options.onAccount.address(options), options)).authFun;
36
+ const signed = await options.onAccount.signTransaction(tx, { ...options,
37
+ authFun,
38
+ networkId: (await options.onNode.getStatus()).networkId
39
+ });
40
+ return options.innerTx === true ? {
41
+ hash: buildTxHash(signed),
42
+ rawTx: signed
43
+ } : sendTransaction(signed, options);
44
+ }
45
+
46
+ /**
47
+ * Send coins to another account
48
+ * @category chain
49
+ * @param amount - Amount to spend
50
+ * @param recipientIdOrName - Address or name of recipient account
51
+ * @param options - Options
52
+ * @returns Transaction
53
+ */
54
+ export async function spend(amount, recipientIdOrName, options) {
55
+ return send(await _buildTx(Tag.SpendTx, { ...options,
56
+ senderId: await options.onAccount.address(options),
57
+ recipientId: await resolveName(recipientIdOrName, 'account_pubkey', options),
58
+ amount
59
+ }), options);
60
+ }
61
+ // TODO: Rename to spendFraction
62
+
63
+ /**
64
+ * Send a fraction of coin balance to another account
65
+ * @category chain
66
+ * @param fraction - Fraction of balance to spend (between 0 and 1)
67
+ * @param recipientIdOrName - Address or name of recipient account
68
+ * @param options - Options
69
+ * @returns Transaction
70
+ */
71
+ export async function transferFunds(fraction, recipientIdOrName, options) {
72
+ if (fraction < 0 || fraction > 1) {
73
+ throw new ArgumentError('fraction', 'a number between 0 and 1', fraction);
74
+ }
75
+
76
+ const recipientId = await resolveName(recipientIdOrName, 'account_pubkey', options);
77
+ const senderId = await options.onAccount.address(options);
78
+ const balance = new BigNumber(await getBalance.bind(options.onAccount)(senderId, options));
79
+ const desiredAmount = balance.times(fraction).integerValue(BigNumber.ROUND_HALF_UP);
80
+ const {
81
+ tx: {
82
+ fee
83
+ }
84
+ } = unpackTx(await _buildTx(Tag.SpendTx, { ...options,
85
+ senderId,
86
+ recipientId,
87
+ amount: desiredAmount
88
+ }), Tag.SpendTx); // Reducing of the amount may reduce transaction fee, so this is not completely accurate
89
+
90
+ const amount = desiredAmount.plus(fee).gt(balance) ? balance.minus(fee) : desiredAmount;
91
+ return send(await _buildTx(Tag.SpendTx, { ...options,
92
+ senderId,
93
+ recipientId,
94
+ amount
95
+ }), options);
96
+ }
97
+
98
+ /**
99
+ * Submit transaction of another account paying for it (fee and gas)
100
+ * @category chain
101
+ * @param transaction - tx_<base64>-encoded transaction
102
+ * @param options - Options
103
+ * @returns Object Transaction
104
+ */
105
+ export async function payForTransaction(transaction, options) {
106
+ return send(await _buildTx(Tag.PayingForTx, { ...options,
107
+ payerId: await options.onAccount.address(options),
108
+ tx: transaction
109
+ }), options);
110
+ }
111
+ //# sourceMappingURL=spend.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spend.mjs","names":["BigNumber","sendTransaction","getAccount","getBalance","resolveName","_buildTx","buildTxHash","unpackTx","ArgumentError","Tag","send","tx","options","authFun","innerTx","undefined","onAccount","address","signed","signTransaction","networkId","onNode","getStatus","hash","rawTx","spend","amount","recipientIdOrName","SpendTx","senderId","recipientId","transferFunds","fraction","balance","bind","desiredAmount","times","integerValue","ROUND_HALF_UP","fee","plus","gt","minus","payForTransaction","transaction","PayingForTx","payerId"],"sources":["../src/spend.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\nimport BigNumber from 'bignumber.js';\nimport {\n sendTransaction, getAccount, getBalance, resolveName,\n} from './chain';\nimport { _buildTx, BuildTxOptions } from './tx';\nimport { buildTxHash, unpackTx } from './tx/builder';\nimport { ArgumentError } from './utils/errors';\nimport { Encoded, Encoding } from './utils/encoder';\nimport { Tag, AensName } from './tx/builder/constants';\nimport AccountBase from './account/Base';\n\n/**\n * Sign and post a transaction to the chain\n * @category chain\n * @param tx - Transaction\n * @param options - Options\n * @param options.verify - Verify transaction before broadcast, throw error if not\n * valid\n * @returns Transaction\n */\nexport async function send(\n tx: Encoded.Transaction,\n options: SendOptions,\n): Promise<SendReturnType> {\n // TODO: detect authFun in AccountGa\n const authFun = options.innerTx === true\n ? undefined\n : (await getAccount(await options.onAccount.address(options), options)).authFun;\n\n const signed = await options.onAccount.signTransaction(tx, {\n ...options,\n authFun,\n networkId: (await options.onNode.getStatus()).networkId,\n });\n\n return options.innerTx === true\n ? { hash: buildTxHash(signed), rawTx: signed }\n : sendTransaction(signed, options);\n}\n\ntype SendOptionsType = Parameters<AccountBase['signTransaction']>[1]\n& Parameters<typeof sendTransaction>[1] & { onAccount: AccountBase };\nexport interface SendOptions extends SendOptionsType {}\ninterface SendReturnType extends Awaited<ReturnType<typeof sendTransaction>> {}\n\n/**\n * Send coins to another account\n * @category chain\n * @param amount - Amount to spend\n * @param recipientIdOrName - Address or name of recipient account\n * @param options - Options\n * @returns Transaction\n */\nexport async function spend(\n amount: number | string,\n recipientIdOrName: Encoded.AccountAddress | AensName,\n options: SpendOptions,\n): ReturnType<typeof send> {\n return send(\n await _buildTx(Tag.SpendTx, {\n ...options,\n senderId: await options.onAccount.address(options),\n recipientId: await resolveName<Encoding.AccountAddress>(\n recipientIdOrName,\n 'account_pubkey',\n options,\n ),\n amount,\n }),\n options,\n );\n}\n\ntype SpendOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'>\n& Parameters<typeof resolveName>[2] & { onAccount: AccountBase } & SendOptions;\ninterface SpendOptions extends SpendOptionsType {}\n\n// TODO: Rename to spendFraction\n/**\n * Send a fraction of coin balance to another account\n * @category chain\n * @param fraction - Fraction of balance to spend (between 0 and 1)\n * @param recipientIdOrName - Address or name of recipient account\n * @param options - Options\n * @returns Transaction\n */\nexport async function transferFunds(\n fraction: number | string,\n recipientIdOrName: AensName | Encoded.AccountAddress,\n options: TransferFundsOptions,\n): ReturnType<typeof send> {\n if (fraction < 0 || fraction > 1) {\n throw new ArgumentError('fraction', 'a number between 0 and 1', fraction);\n }\n const recipientId = await resolveName<Encoding.AccountAddress>(\n recipientIdOrName,\n 'account_pubkey',\n options,\n );\n const senderId = await options.onAccount.address(options);\n const balance = new BigNumber(\n await getBalance.bind(options.onAccount)(senderId, options),\n );\n const desiredAmount = balance.times(fraction).integerValue(BigNumber.ROUND_HALF_UP);\n const { tx: { fee } } = unpackTx(\n await _buildTx(Tag.SpendTx, {\n ...options, senderId, recipientId, amount: desiredAmount,\n }),\n Tag.SpendTx,\n );\n // Reducing of the amount may reduce transaction fee, so this is not completely accurate\n const amount = desiredAmount.plus(fee).gt(balance) ? balance.minus(fee) : desiredAmount;\n return send(\n await _buildTx(Tag.SpendTx, {\n ...options, senderId, recipientId, amount,\n }),\n options,\n );\n}\n\ntype TransferFundsOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'>\n& Parameters<typeof resolveName>[2] & { onAccount: AccountBase } & SendOptions;\ninterface TransferFundsOptions extends TransferFundsOptionsType {}\n\n/**\n * Submit transaction of another account paying for it (fee and gas)\n * @category chain\n * @param transaction - tx_<base64>-encoded transaction\n * @param options - Options\n * @returns Object Transaction\n */\nexport async function payForTransaction(\n transaction: Encoded.Transaction,\n options: PayForTransactionOptions,\n): ReturnType<typeof send> {\n return send(\n await _buildTx(\n Tag.PayingForTx,\n { ...options, payerId: await options.onAccount.address(options), tx: transaction },\n ),\n options,\n );\n}\n\ninterface PayForTransactionOptions extends\n BuildTxOptions<Tag.PayingForTx, 'payerId' | 'tx'>, SendOptions {\n onAccount: AccountBase;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,cAAtB;SAEEC,e,EAAiBC,U,EAAYC,U,EAAYC,W;SAElCC,Q;SACAC,W,EAAaC,Q;SACbC,a;SAEAC,G;;AAGT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,IAAf,CACLC,EADK,EAELC,OAFK,EAGoB;EACzB;EACA,MAAMC,OAAO,GAAGD,OAAO,CAACE,OAAR,KAAoB,IAApB,GACZC,SADY,GAEZ,CAAC,MAAMb,UAAU,CAAC,MAAMU,OAAO,CAACI,SAAR,CAAkBC,OAAlB,CAA0BL,OAA1B,CAAP,EAA2CA,OAA3C,CAAjB,EAAsEC,OAF1E;EAIA,MAAMK,MAAM,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// <reference types="node" />
2
+ import { Encoded } from '../../utils/encoder';
3
+ /**
4
+ * Map of prefix to ID tag constant
5
+ * @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}
6
+ * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}
7
+ * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}
8
+ */
9
+ declare const idTagToEncoding: readonly [Encoded.Encoding.AccountAddress, Encoded.Encoding.Name, Encoded.Encoding.Commitment, Encoded.Encoding.OracleAddress, Encoded.Encoding.ContractAddress, Encoded.Encoding.Channel];
10
+ declare type AddressEncodings = typeof idTagToEncoding[number];
11
+ /**
12
+ * Utility function to create and _id type
13
+ * @category transaction builder
14
+ * @param hashId - Encoded hash
15
+ * @returns Buffer Buffer with ID tag and decoded HASh
16
+ */
17
+ export declare function writeId(hashId: Encoded.Generic<AddressEncodings>): Buffer;
18
+ /**
19
+ * Utility function to read and _id type
20
+ * @category transaction builder
21
+ * @param buf - Data
22
+ * @returns Encoided hash string with prefix
23
+ */
24
+ export declare function readId(buf: Buffer): Encoded.Generic<AddressEncodings>;
25
+ export {};
@@ -0,0 +1,45 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+ import { ArgumentError, PrefixNotFoundError, TagNotFoundError } from "../../utils/errors.mjs";
6
+ import { toBytes } from "../../utils/bytes.mjs";
7
+ import { decode, encode, Encoding } from "../../utils/encoder.mjs";
8
+ import { isItemOfArray } from "../../utils/other.mjs";
9
+ /**
10
+ * Map of prefix to ID tag constant
11
+ * @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}
12
+ * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}
13
+ * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}
14
+ */
15
+
16
+ const idTagToEncoding = [Encoding.AccountAddress, Encoding.Name, Encoding.Commitment, Encoding.OracleAddress, Encoding.ContractAddress, Encoding.Channel];
17
+
18
+ /**
19
+ * Utility function to create and _id type
20
+ * @category transaction builder
21
+ * @param hashId - Encoded hash
22
+ * @returns Buffer Buffer with ID tag and decoded HASh
23
+ */
24
+ export function writeId(hashId) {
25
+ if (typeof hashId !== 'string') throw new ArgumentError('hashId', 'a string', hashId);
26
+ const encoding = hashId.slice(0, 2);
27
+ if (!isItemOfArray(encoding, idTagToEncoding)) throw new TagNotFoundError(encoding);
28
+ const idTag = idTagToEncoding.indexOf(encoding) + 1;
29
+ return _Buffer.from([...toBytes(idTag), ...decode(hashId)]);
30
+ }
31
+ /**
32
+ * Utility function to read and _id type
33
+ * @category transaction builder
34
+ * @param buf - Data
35
+ * @returns Encoided hash string with prefix
36
+ */
37
+
38
+ export function readId(buf) {
39
+ const idTag = _Buffer.from(buf).readUIntBE(0, 1);
40
+
41
+ const encoding = idTagToEncoding[idTag - 1];
42
+ if (encoding == null) throw new PrefixNotFoundError(idTag);
43
+ return encode(buf.slice(1, buf.length), encoding);
44
+ }
45
+ //# sourceMappingURL=address.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.mjs","names":["ArgumentError","PrefixNotFoundError","TagNotFoundError","toBytes","decode","encode","Encoding","isItemOfArray","idTagToEncoding","AccountAddress","Name","Commitment","OracleAddress","ContractAddress","Channel","writeId","hashId","encoding","slice","idTag","indexOf","from","readId","buf","readUIntBE","length"],"sources":["../../../src/tx/builder/address.ts"],"sourcesContent":["import { ArgumentError, PrefixNotFoundError, TagNotFoundError } from '../../utils/errors';\nimport { toBytes } from '../../utils/bytes';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../../utils/encoder';\nimport { isItemOfArray } from '../../utils/other';\n\n/**\n * Map of prefix to ID tag constant\n * @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}\n */\nconst idTagToEncoding = [\n Encoding.AccountAddress,\n Encoding.Name,\n Encoding.Commitment,\n Encoding.OracleAddress,\n Encoding.ContractAddress,\n Encoding.Channel,\n] as const;\n\ntype AddressEncodings = typeof idTagToEncoding[number];\n\n/**\n * Utility function to create and _id type\n * @category transaction builder\n * @param hashId - Encoded hash\n * @returns Buffer Buffer with ID tag and decoded HASh\n */\nexport function writeId(hashId: Encoded.Generic<AddressEncodings>): Buffer {\n if (typeof hashId !== 'string') throw new ArgumentError('hashId', 'a string', hashId);\n const encoding = hashId.slice(0, 2);\n if (!isItemOfArray(encoding, idTagToEncoding)) throw new TagNotFoundError(encoding);\n const idTag = idTagToEncoding.indexOf(encoding) + 1;\n return Buffer.from([...toBytes(idTag), ...decode(hashId)]);\n}\n\n/**\n * Utility function to read and _id type\n * @category transaction builder\n * @param buf - Data\n * @returns Encoided hash string with prefix\n */\nexport function readId(buf: Buffer): Encoded.Generic<AddressEncodings> {\n const idTag = Buffer.from(buf).readUIntBE(0, 1);\n const encoding = idTagToEncoding[idTag - 1];\n if (encoding == null) throw new PrefixNotFoundError(idTag);\n return encode(buf.slice(1, buf.length), encoding);\n}\n"],"mappings":";;;;SAASA,a,EAAeC,mB,EAAqBC,gB;SACpCC,O;SAEPC,M,EAAQC,M,EAAiBC,Q;SAElBC,a;AAET;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,eAAe,GAAG,CACtBF,QAAQ,CAACG,cADa,EAEtBH,QAAQ,CAACI,IAFa,EAGtBJ,QAAQ,CAACK,UAHa,EAItBL,QAAQ,CAACM,aAJa,EAKtBN,QAAQ,CAACO,eALa,EAMtBP,QAAQ,CAACQ,OANa,CAAxB;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAT,CAAiBC,MAAjB,EAAoE;EACzE,IAAI,OAAOA,MAAP,KAAkB,QAAtB,EAAgC,MAAM,IAAIhB,aAAJ,CAAkB,QAAlB,EAA4B,UAA5B,EAAwCgB,MAAxC,CAAN;EAChC,MAAMC,QAAQ,GAAGD,MAAM,CAACE,KAAP,CAAa,CAAb,EAAgB,CAAhB,CAAjB;EACA,IAAI,CAACX,aAAa,CAACU,QAAD,EAAWT,eAAX,CAAlB,EAA+C,MAAM,IAAIN,gBAAJ,CAAqBe,QAArB,CAAN;EAC/C,MAAME,KAAK,GAAGX,eAAe,CAACY,OAAhB,CAAwBH,QAAxB,IAAoC,CAAlD;EACA,OAAO,QAAOI,IAAP,CAAY,CAAC,GAAGlB,OAAO,CAACgB,KAAD,CAAX,EAAoB,GAAGf,MAAM,CAACY,MAAD,CAA7B,CAAZ,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASM,MAAT,CAAgBC,GAAhB,EAAgE;EACrE,MAAMJ,KAAK,GAAG,QAAOE,IAAP,CAAYE,GAAZ,EAAiBC,UAAjB,CAA4B,CAA5B,EAA+B,CAA/B,CAAd;;EACA,MAAMP,QAAQ,GAAGT,eAAe,CAACW,KAAK,GAAG,CAAT,CAAhC;EACA,IAAIF,QAAQ,IAAI,IAAhB,EAAsB,MAAM,IAAIhB,mBAAJ,CAAwBkB,KAAxB,CAAN;EACtB,OAAOd,MAAM,CAACkB,GAAG,CAACL,KAAJ,CAAU,CAAV,EAAaK,GAAG,CAACE,MAAjB,CAAD,EAA2BR,QAA3B,CAAb;AACD"}
@@ -0,0 +1,70 @@
1
+ import BigNumber from 'bignumber.js';
2
+ export declare type AensName = `${string}.chain`;
3
+ export declare const NAME_TTL = 180000;
4
+ export declare const NAME_MAX_TTL = 36000;
5
+ export declare const NAME_MAX_CLIENT_TTL = 84600;
6
+ export declare const CLIENT_TTL = 84600;
7
+ export declare const MIN_GAS_PRICE = 1000000000;
8
+ export declare const NAME_FEE_MULTIPLIER = 100000000000000;
9
+ export declare const NAME_FEE_BID_INCREMENT = 0.05;
10
+ export declare const NAME_BID_TIMEOUT_BLOCKS = 480;
11
+ export declare const NAME_MAX_LENGTH_FEE = 31;
12
+ export declare const NAME_BID_MAX_LENGTH = 12;
13
+ export declare const NAME_BID_RANGES: {
14
+ [k: string]: BigNumber;
15
+ };
16
+ /**
17
+ * Enum with tag types
18
+ * @category transaction builder
19
+ * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}
20
+ * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}
21
+ */
22
+ export declare enum Tag {
23
+ Account = 10,
24
+ SignedTx = 11,
25
+ SpendTx = 12,
26
+ OracleRegisterTx = 22,
27
+ OracleQueryTx = 23,
28
+ OracleResponseTx = 24,
29
+ OracleExtendTx = 25,
30
+ NameClaimTx = 32,
31
+ NamePreclaimTx = 33,
32
+ NameUpdateTx = 34,
33
+ NameRevokeTx = 35,
34
+ NameTransferTx = 36,
35
+ Contract = 40,
36
+ ContractCall = 41,
37
+ ContractCreateTx = 42,
38
+ ContractCallTx = 43,
39
+ ChannelCreateTx = 50,
40
+ ChannelDepositTx = 51,
41
+ ChannelWithdrawTx = 52,
42
+ ChannelForceProgressTx = 521,
43
+ ChannelCloseMutualTx = 53,
44
+ ChannelCloseSoloTx = 54,
45
+ ChannelSlashTx = 55,
46
+ ChannelSettleTx = 56,
47
+ ChannelOffChainTx = 57,
48
+ ChannelOffChainUpdateTransfer = 570,
49
+ ChannelOffChainUpdateDeposit = 571,
50
+ ChannelOffChainUpdateWithdraw = 572,
51
+ ChannelOffChainUpdateCreateContract = 573,
52
+ ChannelOffChainUpdateCallContract = 574,
53
+ ChannelClientReconnectTx = 575,
54
+ Channel = 58,
55
+ ChannelSnapshotSoloTx = 59,
56
+ TreesPoi = 60,
57
+ StateTrees = 62,
58
+ Mtree = 63,
59
+ MtreeValue = 64,
60
+ ContractsMtree = 621,
61
+ CallsMtree = 622,
62
+ ChannelsMtree = 623,
63
+ NameserviceMtree = 624,
64
+ OraclesMtree = 625,
65
+ AccountsMtree = 626,
66
+ CompilerSophia = 70,
67
+ GaAttachTx = 80,
68
+ GaMetaTx = 81,
69
+ PayingForTx = 82
70
+ }
@@ -7,7 +7,8 @@ export const NAME_TTL = 180000; // # max number of block into the future that th
7
7
 
8
8
  export const NAME_MAX_TTL = 36000;
9
9
  export const NAME_MAX_CLIENT_TTL = 84600;
10
- export const CLIENT_TTL = NAME_MAX_CLIENT_TTL; // # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67
10
+ export const CLIENT_TTL = NAME_MAX_CLIENT_TTL;
11
+ export const MIN_GAS_PRICE = 1e9; // # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67
11
12
 
12
13
  export const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000
13
14
 
@@ -19,13 +20,7 @@ export const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day
19
20
 
20
21
  export const NAME_MAX_LENGTH_FEE = 31;
21
22
  export const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid
22
-
23
- export const POINTER_KEY_BY_PREFIX = {
24
- ak: 'account_pubkey',
25
- ok: 'oracle_pubkey',
26
- ct: 'contract_pubkey',
27
- ch: 'channel'
28
- }; // # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290
23
+ // # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290
29
24
  // # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times
30
25
  // # bid ranges:
31
26
 
@@ -64,45 +59,64 @@ export const NAME_BID_RANGES = mapObject({
64
59
  }, _ref => {
65
60
  let [key, value] = _ref;
66
61
  return [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)];
67
- }); // # ref: https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L273
68
- // # name bid timeouts
69
-
70
- export const NAME_BID_TIMEOUTS = {
71
- 13: BigNumber(0),
72
- 12: BigNumber(NAME_BID_TIMEOUT_BLOCKS),
73
- // # 480 blocks
74
- 8: BigNumber(31).times(NAME_BID_TIMEOUT_BLOCKS),
75
- // # 14880 blocks
76
- 4: BigNumber(62).times(NAME_BID_TIMEOUT_BLOCKS) // # 29760 blocks
62
+ });
63
+ /**
64
+ * Enum with tag types
65
+ * @category transaction builder
66
+ * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}
67
+ * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}
68
+ */
69
+ // TODO: implement serialisation for commented-out tags
77
70
 
78
- }; // # Tag constant for ids (type uint8)
79
- // # see https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type
80
- // # <<Tag:1/unsigned-integer-unit:8, Hash:32/binary-unit:8>>
71
+ export let Tag;
81
72
 
82
- const ID_TAG_ACCOUNT = 1;
83
- const ID_TAG_NAME = 2;
84
- const ID_TAG_COMMITMENT = 3;
85
- const ID_TAG_ORACLE = 4;
86
- const ID_TAG_CONTRACT = 5;
87
- const ID_TAG_CHANNEL = 6;
88
- export const ID_TAG = {
89
- account: ID_TAG_ACCOUNT,
90
- name: ID_TAG_NAME,
91
- commitment: ID_TAG_COMMITMENT,
92
- oracle: ID_TAG_ORACLE,
93
- contract: ID_TAG_CONTRACT,
94
- channel: ID_TAG_CHANNEL
95
- };
96
- export const PREFIX_ID_TAG = {
97
- ak: ID_TAG.account,
98
- nm: ID_TAG.name,
99
- cm: ID_TAG.commitment,
100
- ok: ID_TAG.oracle,
101
- ct: ID_TAG.contract,
102
- ch: ID_TAG.channel
103
- };
104
- export const ID_TAG_PREFIX = mapObject(PREFIX_ID_TAG, _ref2 => {
105
- let [key, value] = _ref2;
106
- return [value, key];
107
- });
73
+ (function (Tag) {
74
+ Tag[Tag["Account"] = 10] = "Account";
75
+ Tag[Tag["SignedTx"] = 11] = "SignedTx";
76
+ Tag[Tag["SpendTx"] = 12] = "SpendTx";
77
+ Tag[Tag["OracleRegisterTx"] = 22] = "OracleRegisterTx";
78
+ Tag[Tag["OracleQueryTx"] = 23] = "OracleQueryTx";
79
+ Tag[Tag["OracleResponseTx"] = 24] = "OracleResponseTx";
80
+ Tag[Tag["OracleExtendTx"] = 25] = "OracleExtendTx";
81
+ Tag[Tag["NameClaimTx"] = 32] = "NameClaimTx";
82
+ Tag[Tag["NamePreclaimTx"] = 33] = "NamePreclaimTx";
83
+ Tag[Tag["NameUpdateTx"] = 34] = "NameUpdateTx";
84
+ Tag[Tag["NameRevokeTx"] = 35] = "NameRevokeTx";
85
+ Tag[Tag["NameTransferTx"] = 36] = "NameTransferTx";
86
+ Tag[Tag["Contract"] = 40] = "Contract";
87
+ Tag[Tag["ContractCall"] = 41] = "ContractCall";
88
+ Tag[Tag["ContractCreateTx"] = 42] = "ContractCreateTx";
89
+ Tag[Tag["ContractCallTx"] = 43] = "ContractCallTx";
90
+ Tag[Tag["ChannelCreateTx"] = 50] = "ChannelCreateTx";
91
+ Tag[Tag["ChannelDepositTx"] = 51] = "ChannelDepositTx";
92
+ Tag[Tag["ChannelWithdrawTx"] = 52] = "ChannelWithdrawTx";
93
+ Tag[Tag["ChannelForceProgressTx"] = 521] = "ChannelForceProgressTx";
94
+ Tag[Tag["ChannelCloseMutualTx"] = 53] = "ChannelCloseMutualTx";
95
+ Tag[Tag["ChannelCloseSoloTx"] = 54] = "ChannelCloseSoloTx";
96
+ Tag[Tag["ChannelSlashTx"] = 55] = "ChannelSlashTx";
97
+ Tag[Tag["ChannelSettleTx"] = 56] = "ChannelSettleTx";
98
+ Tag[Tag["ChannelOffChainTx"] = 57] = "ChannelOffChainTx";
99
+ Tag[Tag["ChannelOffChainUpdateTransfer"] = 570] = "ChannelOffChainUpdateTransfer";
100
+ Tag[Tag["ChannelOffChainUpdateDeposit"] = 571] = "ChannelOffChainUpdateDeposit";
101
+ Tag[Tag["ChannelOffChainUpdateWithdraw"] = 572] = "ChannelOffChainUpdateWithdraw";
102
+ Tag[Tag["ChannelOffChainUpdateCreateContract"] = 573] = "ChannelOffChainUpdateCreateContract";
103
+ Tag[Tag["ChannelOffChainUpdateCallContract"] = 574] = "ChannelOffChainUpdateCallContract";
104
+ Tag[Tag["ChannelClientReconnectTx"] = 575] = "ChannelClientReconnectTx";
105
+ Tag[Tag["Channel"] = 58] = "Channel";
106
+ Tag[Tag["ChannelSnapshotSoloTx"] = 59] = "ChannelSnapshotSoloTx";
107
+ Tag[Tag["TreesPoi"] = 60] = "TreesPoi";
108
+ Tag[Tag["StateTrees"] = 62] = "StateTrees";
109
+ Tag[Tag["Mtree"] = 63] = "Mtree";
110
+ Tag[Tag["MtreeValue"] = 64] = "MtreeValue";
111
+ Tag[Tag["ContractsMtree"] = 621] = "ContractsMtree";
112
+ Tag[Tag["CallsMtree"] = 622] = "CallsMtree";
113
+ Tag[Tag["ChannelsMtree"] = 623] = "ChannelsMtree";
114
+ Tag[Tag["NameserviceMtree"] = 624] = "NameserviceMtree";
115
+ Tag[Tag["OraclesMtree"] = 625] = "OraclesMtree";
116
+ Tag[Tag["AccountsMtree"] = 626] = "AccountsMtree";
117
+ Tag[Tag["CompilerSophia"] = 70] = "CompilerSophia";
118
+ Tag[Tag["GaAttachTx"] = 80] = "GaAttachTx";
119
+ Tag[Tag["GaMetaTx"] = 81] = "GaMetaTx";
120
+ Tag[Tag["PayingForTx"] = 82] = "PayingForTx";
121
+ })(Tag || (Tag = {}));
108
122
  //# sourceMappingURL=constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/tx/builder/constants.js"],"names":["BigNumber","mapObject","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_MAX_LENGTH","POINTER_KEY_BY_PREFIX","ak","ok","ct","ch","NAME_BID_RANGES","key","value","times","NAME_BID_TIMEOUTS","ID_TAG_ACCOUNT","ID_TAG_NAME","ID_TAG_COMMITMENT","ID_TAG_ORACLE","ID_TAG_CONTRACT","ID_TAG_CHANNEL","ID_TAG","account","name","commitment","oracle","contract","channel","PREFIX_ID_TAG","nm","cm","ID_TAG_PREFIX"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,cAAtB;SACSC,S,iCAET;;AACA,OAAO,MAAMC,QAAQ,GAAG,MAAjB,C,CACP;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAG,KAArB;AACP,OAAO,MAAMC,mBAAmB,GAAG,KAA5B;AACP,OAAO,MAAMC,UAAU,GAAGD,mBAAnB,C,CACP;;AACA,OAAO,MAAME,mBAAmB,GAAG,IAA5B,C,CAAiC;;AACxC,OAAO,MAAMC,sBAAsB,GAAG,IAA/B,C,CAAoC;AAC3C;;AACA,OAAO,MAAMC,uBAAuB,GAAG,GAAhC,C,CAAoC;AAC3C;;AACA,OAAO,MAAMC,mBAAmB,GAAG,EAA5B;AACP,OAAO,MAAMC,mBAAmB,GAAG,EAA5B,C,CAA+B;;AACtC,OAAO,MAAMC,qBAAqB,GAAG;AACnCC,EAAAA,EAAE,EAAE,gBAD+B;AAEnCC,EAAAA,EAAE,EAAE,eAF+B;AAGnCC,EAAAA,EAAE,EAAE,iBAH+B;AAInCC,EAAAA,EAAE,EAAE;A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AA1B,C,CAOP;AACA;AACA;;AACA,MAAMa,cAAc,GAAG,CAAvB;AACA,MAAMC,WAAW,GAAG,CAApB;AACA,MAAMC,iBAAiB,GAAG,CAA1B;AACA,MAAMC,aAAa,GAAG,CAAtB;AACA,MAAMC,eAAe,GAAG,CAAxB;AACA,MAAMC,cAAc,GAAG,CAAvB;AAEA,OAAO,MAAMC,MAAM,GAAG;AACpBC,EAAAA,OAAO,EAAEP,cADW;AAEpBQ,EAAAA,IAAI,EAAEP,WAFc;AAGpBQ,EAAAA,UAAU,EAAEP,iBAHQ;AAIpBQ,EAAAA,MAAM,EAAEP,aAJY;AAKpBQ,EAAAA,QAAQ,EAAEP,eALU;AAMpBQ,EAAAA,OAAO,EAAEP;AANW,CAAf;AASP,OAAO,MAAMQ,aAAa,GAAG;AAC3BtB,EAAAA,EAAE,EAAEe,MAAM,CAACC,OADgB;AAE3BO,EAAAA,EAAE,EAAER,MAAM,CAACE,IAFgB;AAG3BO,EAAAA,EAAE,EAAET,MAAM,CAACG,UAHgB;AAI3BjB,EAAAA,EAAE,EAAEc,MAAM,CAACI,MAJgB;AAK3BjB,EAAAA,EAAE,EAAEa,MAAM,CAACK,QALgB;AAM3BjB,EAAAA,EAAE,EAAEY,MAAM,CAACM;AANgB,CAAtB;AASP,OAAO,MAAMI,aAAa,GAAGpC,SAAS,CAACiC,aAAD,EAAgB;AAAA,MAAC,CAACjB,GAAD,EAAMC,KAAN,CAAD;AAAA,SAAkB,CAACA,KAAD,EAAQD,GAAR,CAAlB;AAAA,CAAhB,CAA/B","sourcesContent":["import BigNumber from 'bignumber.js'\nimport { mapObject } from '../../utils/other'\n\n// # AENS\nexport const NAME_TTL = 180000\n// # max number of block into the future that the name is going to be available\n// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update\n// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry\nexport const NAME_MAX_TTL = 36000\nexport const NAME_MAX_CLIENT_TTL = 84600\nexport const CLIENT_TTL = NAME_MAX_CLIENT_TTL\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67\nexport const NAME_FEE_MULTIPLIER = 1e14 // 100000000000000\nexport const NAME_FEE_BID_INCREMENT = 0.05 // # the increment is in percentage\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272\nexport const NAME_BID_TIMEOUT_BLOCKS = 480 // # ~1 day\n// # this is the max length for a domain that requires a base fee to be paid\nexport const NAME_MAX_LENGTH_FEE = 31\nexport const NAME_BID_MAX_LENGTH = 12 // # this is the max length for a domain to be part of a bid\nexport const POINTER_KEY_BY_PREFIX = {\n ak: 'account_pubkey',\n ok: 'oracle_pubkey',\n ct: 'contract_pubkey',\n ch: 'channel'\n}\n// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290\n// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times\n// # bid ranges:\nexport const NAME_BID_RANGES = mapObject({\n 31: 3,\n 30: 5,\n 29: 8,\n 28: 13,\n 27: 21,\n 26: 34,\n 25: 55,\n 24: 89,\n 23: 144,\n 22: 233,\n 21: 377,\n 20: 610,\n 19: 987,\n 18: 1597,\n 17: 2584,\n 16: 4181,\n 15: 6765,\n 14: 10946,\n 13: 17711,\n 12: 28657,\n 11: 46368,\n 10: 75025,\n 9: 121393,\n 8: 196418,\n 7: 317811,\n 6: 514229,\n 5: 832040,\n 4: 1346269,\n 3: 2178309,\n 2: 3524578,\n 1: 5702887\n}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)])\n\n// # ref: https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L273\n// # name bid timeouts\nexport const NAME_BID_TIMEOUTS = {\n 13: BigNumber(0),\n 12: BigNumber(NAME_BID_TIMEOUT_BLOCKS), // # 480 blocks\n 8: BigNumber(31).times(NAME_BID_TIMEOUT_BLOCKS), // # 14880 blocks\n 4: BigNumber(62).times(NAME_BID_TIMEOUT_BLOCKS) // # 29760 blocks\n}\n\n// # Tag constant for ids (type uint8)\n// # see https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type\n// # <<Tag:1/unsigned-integer-unit:8, Hash:32/binary-unit:8>>\nconst ID_TAG_ACCOUNT = 1\nconst ID_TAG_NAME = 2\nconst ID_TAG_COMMITMENT = 3\nconst ID_TAG_ORACLE = 4\nconst ID_TAG_CONTRACT = 5\nconst ID_TAG_CHANNEL = 6\n\nexport const ID_TAG = {\n account: ID_TAG_ACCOUNT,\n name: ID_TAG_NAME,\n commitment: ID_TAG_COMMITMENT,\n oracle: ID_TAG_ORACLE,\n contract: ID_TAG_CONTRACT,\n channel: ID_TAG_CHANNEL\n}\n\nexport const PREFIX_ID_TAG = {\n ak: ID_TAG.account,\n nm: ID_TAG.name,\n cm: ID_TAG.commitment,\n ok: ID_TAG.oracle,\n ct: ID_TAG.contract,\n ch: ID_TAG.channel\n}\n\nexport const ID_TAG_PREFIX = mapObject(PREFIX_ID_TAG, ([key, value]) => [value, key])\n"],"file":"constants.mjs"}
1
+ {"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_MAX_LENGTH","NAME_BID_RANGES","key","value","times","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\n// # AENS\nexport type AensName = `${string}.chain`;\nexport const NAME_TTL = 180000;\n// # max number of block into the future that the name is going to be available\n// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update\n// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry\nexport const NAME_MAX_TTL = 36000;\nexport const NAME_MAX_CLIENT_TTL = 84600;\nexport const CLIENT_TTL = NAME_MAX_CLIENT_TTL;\nexport const MIN_GAS_PRICE = 1e9;\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67\nexport const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000\nexport const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272\nexport const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day\n// # this is the max length for a domain that requires a base fee to be paid\nexport const NAME_MAX_LENGTH_FEE = 31;\nexport const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid\n// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290\n// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times\n// # bid ranges:\nexport const NAME_BID_RANGES = mapObject({\n 31: 3,\n 30: 5,\n 29: 8,\n 28: 13,\n 27: 21,\n 26: 34,\n 25: 55,\n 24: 89,\n 23: 144,\n 22: 233,\n 21: 377,\n 20: 610,\n 19: 987,\n 18: 1597,\n 17: 2584,\n 16: 4181,\n 15: 6765,\n 14: 10946,\n 13: 17711,\n 12: 28657,\n 11: 46368,\n 10: 75025,\n 9: 121393,\n 8: 196418,\n 7: 317811,\n 6: 514229,\n 5: 832040,\n 4: 1346269,\n 3: 2178309,\n 2: 3524578,\n 1: 5702887,\n}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);\n\n/**\n * Enum with tag types\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}\n */\n// TODO: implement serialisation for commented-out tags\nexport enum Tag {\n Account = 10,\n SignedTx = 11,\n SpendTx = 12,\n // Oracle = 20,\n // OracleQuery = 21,\n OracleRegisterTx = 22,\n OracleQueryTx = 23,\n OracleResponseTx = 24,\n OracleExtendTx = 25,\n // Name = 30,\n // NameCommitment = 31,\n NameClaimTx = 32,\n NamePreclaimTx = 33,\n NameUpdateTx = 34,\n NameRevokeTx = 35,\n NameTransferTx = 36,\n // NameAuction = 37,\n Contract = 40,\n ContractCall = 41,\n ContractCreateTx = 42,\n ContractCallTx = 43,\n ChannelCreateTx = 50,\n // ChannelSetDelegatesTx = 501,\n ChannelDepositTx = 51,\n ChannelWithdrawTx = 52,\n ChannelForceProgressTx = 521,\n ChannelCloseMutualTx = 53,\n ChannelCloseSoloTx = 54,\n ChannelSlashTx = 55,\n ChannelSettleTx = 56,\n ChannelOffChainTx = 57,\n ChannelOffChainUpdateTransfer = 570,\n ChannelOffChainUpdateDeposit = 571,\n ChannelOffChainUpdateWithdraw = 572,\n ChannelOffChainUpdateCreateContract = 573,\n ChannelOffChainUpdateCallContract = 574,\n // ChannelOffChainUpdateMeta = 576,\n ChannelClientReconnectTx = 575,\n Channel = 58,\n ChannelSnapshotSoloTx = 59,\n TreesPoi = 60,\n // TreesDb = 61,\n StateTrees = 62,\n Mtree = 63,\n MtreeValue = 64,\n ContractsMtree = 621,\n CallsMtree = 622,\n ChannelsMtree = 623,\n NameserviceMtree = 624,\n OraclesMtree = 625,\n AccountsMtree = 626,\n CompilerSophia = 70,\n GaAttachTx = 80,\n GaMetaTx = 81,\n PayingForTx = 82,\n // KeyBlock = 100,\n // MicroBlock = 101,\n // LightMicroBlock = 102,\n // P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 /// <reference types="node" />
2
+ import { Int } from './u-int';
3
+ import { AE_AMOUNT_FORMATS } from '../../../utils/amount-formatter';
4
+ export interface Options {
5
+ denomination?: AE_AMOUNT_FORMATS;
6
+ }
7
+ declare const _default: {
8
+ serializeAettos(value: string | undefined): string;
9
+ serializeOptional(value: Int | undefined, { denomination, ...options }: Options): Buffer;
10
+ serialize(value: Int, options: Options): Buffer;
11
+ deserialize(value: Buffer): string;
12
+ };
13
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import uInt from "./u-int.mjs";
2
+ import { formatAmount } from "../../../utils/amount-formatter.mjs";
3
+ import { ArgumentError } from "../../../utils/errors.mjs";
4
+ export default { ...uInt,
5
+
6
+ serializeAettos(value) {
7
+ if (value == null) throw new ArgumentError('value', 'provided', value);
8
+ return value;
9
+ },
10
+
11
+ serializeOptional(value, _ref) {
12
+ let {
13
+ denomination,
14
+ ...options
15
+ } = _ref;
16
+ return uInt.serialize(this.serializeAettos(value != null ? formatAmount(value, {
17
+ denomination
18
+ }) : value, options));
19
+ },
20
+
21
+ serialize(value, options) {
22
+ return this.serializeOptional(value, options);
23
+ }
24
+
25
+ };
26
+ //# sourceMappingURL=coin-amount.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coin-amount.mjs","names":["uInt","formatAmount","ArgumentError","serializeAettos","value","serializeOptional","denomination","options","serialize"],"sources":["../../../../src/tx/builder/field-types/coin-amount.ts"],"sourcesContent":["import uInt, { Int } from './u-int';\nimport { AE_AMOUNT_FORMATS, formatAmount } from '../../../utils/amount-formatter';\nimport { ArgumentError } from '../../../utils/errors';\n\nexport interface Options { denomination?: AE_AMOUNT_FORMATS }\n\nexport default {\n ...uInt,\n\n serializeAettos(value: string | undefined): string {\n if (value == null) throw new ArgumentError('value', 'provided', value);\n return value;\n },\n\n serializeOptional(value: Int | undefined, { denomination, ...options }: Options): Buffer {\n return uInt.serialize(\n this.serializeAettos(\n value != null ? formatAmount(value, { denomination }) : value,\n options,\n ),\n );\n },\n\n serialize(value: Int, options: Options): Buffer {\n return this.serializeOptional(value, options);\n },\n};\n"],"mappings":"OAAOA,I;SACqBC,Y;SACnBC,a;AAIT,eAAe,EACb,GAAGF,IADU;;EAGbG,eAAe,CAACC,KAAD,EAAoC;IACjD,IAAIA,KAAK,IAAI,IAAb,EAAmB,MAAM,IAAIF,aAAJ,CAAkB,OAAlB,EAA2B,UAA3B,EAAuCE,KAAvC,CAAN;IACnB,OAAOA,KAAP;EACD,CANY;;EAQbC,iBAAiB,CAACD,KAAD,QAAwE;IAAA,IAA/C;MAAEE,YAAF;MAAgB,GAAGC;IAAnB,CAA+C;IACvF,OAAOP,IAAI,CAACQ,SAAL,CACL,KAAKL,eAAL,CACEC,KAAK,IAAI,IAAT,GAAgBH,YAAY,CAACG,KAAD,EAAQ;MAAEE;IAAF,CAAR,CAA5B,GAAwDF,KAD1D,EAEEG,OAFF,CADK,CAAP;EAMD,CAfY;;EAiBbC,SAAS,CAACJ,KAAD,EAAaG,OAAb,EAAuC;IAC9C,OAAO,KAAKF,iBAAL,CAAuBD,KAAvB,EAA8BG,OAA9B,CAAP;EACD;;AAnBY,CAAf"}
@@ -0,0 +1,15 @@
1
+ /// <reference types="node" />
2
+ import coinAmount from './coin-amount';
3
+ import { Int } from './u-int';
4
+ declare const _default: {
5
+ /**
6
+ * @param value - Deposit value in string format. Should be equal to '0'.
7
+ * @param options - Options
8
+ * @returns Deposit value Buffer.
9
+ */
10
+ serialize(value: Int | undefined, options: Parameters<(typeof coinAmount)['serialize']>[1]): Buffer;
11
+ serializeAettos(value: string | undefined): string;
12
+ serializeOptional(value: Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
13
+ deserialize(value: Buffer): string;
14
+ };
15
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import coinAmount from "./coin-amount.mjs";
2
+ import { IllegalArgumentError } from "../../../utils/errors.mjs";
3
+ export default { ...coinAmount,
4
+
5
+ /**
6
+ * @param value - Deposit value in string format. Should be equal to '0'.
7
+ * @param options - Options
8
+ * @returns Deposit value Buffer.
9
+ */
10
+ serialize(value, options) {
11
+ var _value;
12
+
13
+ (_value = value) !== null && _value !== void 0 ? _value : value = 0;
14
+ if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);
15
+ return coinAmount.serialize(value, options);
16
+ }
17
+
18
+ };
19
+ //# sourceMappingURL=deposit.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deposit.mjs","names":["coinAmount","IllegalArgumentError","serialize","value","options","toString"],"sources":["../../../../src/tx/builder/field-types/deposit.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { Int } from './u-int';\nimport { IllegalArgumentError } from '../../../utils/errors';\n\nexport default {\n ...coinAmount,\n\n /**\n * @param value - Deposit value in string format. Should be equal to '0'.\n * @param options - Options\n * @returns Deposit value Buffer.\n */\n serialize(\n value: Int | undefined,\n options: Parameters<typeof coinAmount['serialize']>[1],\n ): Buffer {\n value ??= 0;\n if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);\n return coinAmount.serialize(value, options);\n },\n};\n"],"mappings":"OAAOA,U;SAEEC,oB;AAET,eAAe,EACb,GAAGD,UADU;;EAGb;AACF;AACA;AACA;AACA;EACEE,SAAS,CACPC,KADO,EAEPC,OAFO,EAGC;IAAA;;IACR,UAAAD,KAAK,UAAL,iCAAAA,KAAK,GAAK,CAAV;IACA,IAAI,CAACA,KAAD,KAAW,CAAf,EAAkB,MAAM,IAAIF,oBAAJ,CAA0B,oEAAmEE,KAAK,CAACE,QAAN,EAAiB,UAA9G,CAAN;IAClB,OAAOL,UAAU,CAACE,SAAX,CAAqBC,KAArB,EAA4BC,OAA5B,CAAP;EACD;;AAfY,CAAf"}
@@ -0,0 +1,25 @@
1
+ /// <reference types="node" />
2
+ import BigNumber from 'bignumber.js';
3
+ import { Tag } from '../constants';
4
+ /**
5
+ * Calculate fee based on tx type and params
6
+ */
7
+ export declare function buildFee(txType: Tag, buildTx: any): BigNumber;
8
+ /**
9
+ * Calculate min fee
10
+ * @category transaction builder
11
+ * @param txType - Transaction type
12
+ * @param rebuildTx - Callback to get built transaction with specific fee
13
+ */
14
+ export declare function calculateMinFee(txType: Tag, rebuildTx: (value: BigNumber) => any): BigNumber;
15
+ declare const _default: {
16
+ serializeAettos(_value: string | undefined, { txType, rebuildTx, _computingMinFee }: {
17
+ txType: Tag;
18
+ rebuildTx: (params: any) => any;
19
+ _computingMinFee?: string | undefined;
20
+ }): string;
21
+ serialize: (value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options) => Buffer;
22
+ serializeOptional(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
23
+ deserialize(value: Buffer): string;
24
+ };
25
+ export default _default;