@aeternity/aepp-sdk 10.0.0 → 12.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 (424) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +15 -14
  3. package/dist/aepp-sdk.browser-script.js +1 -1
  4. package/dist/aepp-sdk.browser-script.js.LICENSE.txt +13 -40
  5. package/dist/aepp-sdk.browser-script.js.map +1 -1
  6. package/dist/aepp-sdk.browser.js +1 -1
  7. package/dist/aepp-sdk.browser.js.map +1 -1
  8. package/dist/aepp-sdk.js +1 -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 +69 -0
  14. package/es/AeSdkAepp.mjs +175 -0
  15. package/es/AeSdkAepp.mjs.map +1 -0
  16. package/es/AeSdkBase.d.ts +212 -0
  17. package/es/AeSdkBase.mjs +310 -0
  18. package/es/AeSdkBase.mjs.map +1 -0
  19. package/es/AeSdkWallet.d.ts +103 -0
  20. package/es/AeSdkWallet.mjs +322 -0
  21. package/es/AeSdkWallet.mjs.map +1 -0
  22. package/es/Node.d.ts +44 -0
  23. package/es/Node.mjs +141 -0
  24. package/es/Node.mjs.map +1 -0
  25. package/es/account/Base.d.ts +65 -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 +25 -0
  29. package/es/account/Memory.mjs +81 -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 +79 -0
  33. package/es/account/Rpc.mjs.map +1 -0
  34. package/es/aens.d.ts +209 -0
  35. package/es/aens.mjs +332 -0
  36. package/es/aens.mjs.map +1 -0
  37. package/es/aepp-wallet-communication/connection/Browser.d.ts +32 -0
  38. package/es/aepp-wallet-communication/connection/Browser.mjs +70 -0
  39. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -0
  40. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +17 -0
  41. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +57 -0
  42. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -0
  43. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +35 -0
  44. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +142 -0
  45. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -0
  46. package/es/aepp-wallet-communication/connection-proxy.d.ts +10 -0
  47. package/{src/utils/crypto-ts.ts → es/aepp-wallet-communication/connection-proxy.mjs} +15 -11
  48. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -0
  49. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +33 -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 +118 -0
  56. package/es/aepp-wallet-communication/schema.mjs +214 -0
  57. package/es/aepp-wallet-communication/schema.mjs.map +1 -0
  58. package/es/aepp-wallet-communication/wallet-detector.d.ts +24 -0
  59. package/es/aepp-wallet-communication/wallet-detector.mjs +63 -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 +1061 -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 +4164 -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 +220 -0
  92. package/es/chain.mjs +524 -0
  93. package/es/chain.mjs.map +1 -0
  94. package/es/channel/handlers.d.ts +34 -0
  95. package/es/channel/{handlers.js → handlers.mjs} +163 -130
  96. package/es/channel/handlers.mjs.map +1 -0
  97. package/es/channel/index.d.ts +634 -0
  98. package/es/channel/index.mjs +978 -0
  99. package/es/channel/index.mjs.map +1 -0
  100. package/es/channel/internal.d.ts +100 -0
  101. package/es/channel/internal.mjs +328 -0
  102. package/es/channel/internal.mjs.map +1 -0
  103. package/es/contract/Compiler.d.ts +17 -0
  104. package/es/contract/Compiler.mjs +67 -0
  105. package/es/contract/Compiler.mjs.map +1 -0
  106. package/es/contract/aci.d.ts +125 -0
  107. package/es/contract/aci.mjs +496 -0
  108. package/es/contract/aci.mjs.map +1 -0
  109. package/es/contract/ga.d.ts +68 -0
  110. package/es/contract/ga.mjs +190 -0
  111. package/es/contract/ga.mjs.map +1 -0
  112. package/es/contract/methods.d.ts +68 -0
  113. package/es/contract/methods.mjs +101 -0
  114. package/es/contract/methods.mjs.map +1 -0
  115. package/es/index.d.ts +32 -0
  116. package/es/index.mjs +49 -0
  117. package/es/index.mjs.map +1 -0
  118. package/es/oracle.d.ts +154 -0
  119. package/es/oracle.mjs +288 -0
  120. package/es/oracle.mjs.map +1 -0
  121. package/es/spend.d.ts +61 -0
  122. package/es/spend.mjs +122 -0
  123. package/es/spend.mjs.map +1 -0
  124. package/es/tx/builder/constants.d.ts +41 -0
  125. package/es/tx/builder/constants.mjs +100 -0
  126. package/es/tx/builder/constants.mjs.map +1 -0
  127. package/es/tx/builder/field-types.d.ts +62 -0
  128. package/es/tx/builder/field-types.mjs +126 -0
  129. package/es/tx/builder/field-types.mjs.map +1 -0
  130. package/es/tx/builder/helpers.d.ts +131 -0
  131. package/es/tx/builder/helpers.mjs +223 -0
  132. package/es/tx/builder/helpers.mjs.map +1 -0
  133. package/es/tx/builder/index.d.ts +75 -0
  134. package/es/tx/builder/index.mjs +424 -0
  135. package/es/tx/builder/index.mjs.map +1 -0
  136. package/es/tx/builder/schema.d.ts +350 -0
  137. package/es/tx/builder/schema.mjs +320 -0
  138. package/es/tx/builder/schema.mjs.map +1 -0
  139. package/es/tx/index.d.ts +63 -0
  140. package/es/tx/index.mjs +209 -0
  141. package/es/tx/index.mjs.map +1 -0
  142. package/es/tx/min-fee.d.ts +20 -0
  143. package/es/tx/min-fee.mjs +148 -0
  144. package/es/tx/min-fee.mjs.map +1 -0
  145. package/es/tx/validator.d.ts +19 -0
  146. package/es/tx/validator.mjs +240 -0
  147. package/es/tx/validator.mjs.map +1 -0
  148. package/es/typings/@aeternity__argon2-browser/index.d.mjs +2 -0
  149. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -0
  150. package/es/typings/@aeternity__uuid/index.d.mjs +2 -0
  151. package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -0
  152. package/es/typings/bip32-path/index.d.mjs +2 -0
  153. package/es/typings/bip32-path/index.d.mjs.map +1 -0
  154. package/es/typings/blakejs/index.d.mjs +2 -0
  155. package/es/typings/blakejs/index.d.mjs.map +1 -0
  156. package/es/typings/tweetnacl-auth/index.d.mjs +2 -0
  157. package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -0
  158. package/es/utils/amount-formatter.d.ts +42 -0
  159. package/es/utils/{amount-formatter.js → amount-formatter.mjs} +38 -44
  160. package/es/utils/amount-formatter.mjs.map +1 -0
  161. package/es/utils/autorest.d.ts +6 -0
  162. package/es/utils/autorest.mjs +97 -0
  163. package/es/utils/autorest.mjs.map +1 -0
  164. package/es/utils/bignumber.d.ts +13 -0
  165. package/es/utils/bignumber.mjs +23 -0
  166. package/es/utils/bignumber.mjs.map +1 -0
  167. package/es/{bytes.d.ts → utils/bytes.d.ts} +10 -13
  168. package/es/utils/{bytes.js → bytes.mjs} +26 -22
  169. package/es/utils/bytes.mjs.map +1 -0
  170. package/es/utils/crypto.d.ts +103 -0
  171. package/es/utils/crypto.mjs +221 -0
  172. package/es/utils/crypto.mjs.map +1 -0
  173. package/es/utils/encoder.d.ts +26 -0
  174. package/es/utils/encoder.mjs +102 -0
  175. package/es/utils/encoder.mjs.map +1 -0
  176. package/es/utils/errors.d.ts +481 -0
  177. package/es/utils/errors.mjs +882 -0
  178. package/es/utils/errors.mjs.map +1 -0
  179. package/es/utils/hd-wallet.d.ts +34 -0
  180. package/es/utils/hd-wallet.mjs +122 -0
  181. package/es/utils/hd-wallet.mjs.map +1 -0
  182. package/es/utils/json-big.d.ts +5 -0
  183. package/es/utils/json-big.mjs +41 -0
  184. package/es/utils/json-big.mjs.map +1 -0
  185. package/es/utils/keystore.d.ts +51 -0
  186. package/es/utils/keystore.mjs +145 -0
  187. package/es/utils/keystore.mjs.map +1 -0
  188. package/es/{mptree.d.ts → utils/mptree.d.ts} +5 -8
  189. package/es/utils/{mptree.js → mptree.mjs} +33 -25
  190. package/es/utils/mptree.mjs.map +1 -0
  191. package/es/utils/other.d.ts +14 -0
  192. package/es/utils/other.mjs +28 -0
  193. package/es/utils/other.mjs.map +1 -0
  194. package/es/{semver-satisfies.d.ts → utils/semver-satisfies.d.ts} +0 -0
  195. package/es/utils/{semver-satisfies.js → semver-satisfies.mjs} +1 -1
  196. package/es/utils/semver-satisfies.mjs.map +1 -0
  197. package/es/utils/string.d.ts +24 -0
  198. package/es/utils/{string.js → string.mjs} +9 -11
  199. package/es/utils/string.mjs.map +1 -0
  200. package/package.json +67 -64
  201. package/src/AeSdk.ts +65 -0
  202. package/src/AeSdkAepp.ts +167 -0
  203. package/src/AeSdkBase.ts +320 -0
  204. package/src/AeSdkWallet.ts +332 -0
  205. package/src/Node.ts +167 -0
  206. package/src/account/Base.ts +114 -0
  207. package/src/account/Memory.ts +83 -0
  208. package/src/account/Rpc.ts +67 -0
  209. package/src/aens.ts +391 -0
  210. package/src/aepp-wallet-communication/connection/Browser.ts +68 -0
  211. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +58 -0
  212. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +111 -0
  213. package/{es/utils/crypto-ts.js → src/aepp-wallet-communication/connection-proxy.ts} +16 -9
  214. package/src/aepp-wallet-communication/rpc/RpcClient.ts +137 -0
  215. package/src/aepp-wallet-communication/rpc/types.ts +66 -0
  216. package/src/aepp-wallet-communication/schema.ts +181 -0
  217. package/src/aepp-wallet-communication/wallet-detector.ts +71 -0
  218. package/src/apis/compiler/code-model-v4.yaml +2649 -0
  219. package/src/apis/compiler/compiler.ts +585 -0
  220. package/src/apis/compiler/index.ts +2 -0
  221. package/src/apis/compiler/models/index.ts +301 -0
  222. package/src/apis/compiler/models/mappers.ts +583 -0
  223. package/src/apis/compiler/models/parameters.ts +93 -0
  224. package/src/apis/node/code-model-v4.yaml +10046 -0
  225. package/src/apis/node/index.ts +2 -0
  226. package/src/apis/node/models/index.ts +1253 -0
  227. package/src/apis/node/models/mappers.ts +4278 -0
  228. package/src/apis/node/models/parameters.ts +188 -0
  229. package/src/apis/node/node.ts +1299 -0
  230. package/src/chain.ts +444 -0
  231. package/src/channel/{handlers.js → handlers.ts} +238 -143
  232. package/src/channel/index.ts +991 -0
  233. package/src/channel/internal.ts +345 -0
  234. package/src/contract/Compiler.ts +66 -0
  235. package/src/contract/aci.ts +529 -0
  236. package/src/contract/ga.ts +178 -0
  237. package/src/contract/methods.ts +118 -0
  238. package/src/index.ts +51 -0
  239. package/src/oracle.ts +342 -0
  240. package/src/spend.ts +152 -0
  241. package/src/tx/builder/constants.ts +96 -0
  242. package/src/tx/builder/field-types.ts +111 -0
  243. package/src/tx/builder/helpers.ts +253 -0
  244. package/src/tx/builder/index.ts +394 -0
  245. package/src/tx/builder/schema.ts +771 -0
  246. package/src/tx/index.ts +199 -0
  247. package/src/tx/min-fee.ts +136 -0
  248. package/src/tx/validator.ts +226 -0
  249. package/src/typings/@aeternity__argon2-browser/index.d.ts +3 -0
  250. package/src/typings/@aeternity__uuid/index.d.ts +3 -0
  251. package/src/typings/bip32-path/index.d.ts +33 -0
  252. package/src/typings/tweetnacl-auth/index.d.ts +14 -0
  253. package/src/utils/amount-formatter.ts +29 -41
  254. package/src/utils/autorest.ts +90 -0
  255. package/src/utils/bignumber.ts +9 -19
  256. package/src/utils/bytes.ts +15 -16
  257. package/src/utils/crypto.ts +217 -0
  258. package/src/utils/encoder.ts +98 -0
  259. package/src/utils/errors.ts +817 -0
  260. package/src/utils/hd-wallet.ts +134 -0
  261. package/src/utils/json-big.ts +26 -0
  262. package/src/utils/keystore.ts +179 -0
  263. package/src/utils/mptree.ts +26 -20
  264. package/src/utils/other.ts +28 -43
  265. package/src/utils/string.ts +8 -10
  266. package/CHANGELOG.md +0 -1603
  267. package/es/account/base.js +0 -169
  268. package/es/account/base.js.map +0 -1
  269. package/es/account/memory.js +0 -84
  270. package/es/account/memory.js.map +0 -1
  271. package/es/account/multiple.js +0 -178
  272. package/es/account/multiple.js.map +0 -1
  273. package/es/ae/aens.js +0 -408
  274. package/es/ae/aens.js.map +0 -1
  275. package/es/ae/aepp.js +0 -45
  276. package/es/ae/aepp.js.map +0 -1
  277. package/es/ae/contract.js +0 -312
  278. package/es/ae/contract.js.map +0 -1
  279. package/es/ae/index.js +0 -206
  280. package/es/ae/index.js.map +0 -1
  281. package/es/ae/oracle.js +0 -322
  282. package/es/ae/oracle.js.map +0 -1
  283. package/es/ae/universal.js +0 -45
  284. package/es/ae/universal.js.map +0 -1
  285. package/es/ae/wallet.js +0 -50
  286. package/es/ae/wallet.js.map +0 -1
  287. package/es/amount-formatter.d.ts +0 -58
  288. package/es/bignumber.d.ts +0 -24
  289. package/es/chain/index.js +0 -256
  290. package/es/chain/index.js.map +0 -1
  291. package/es/chain/node.js +0 -394
  292. package/es/chain/node.js.map +0 -1
  293. package/es/channel/handlers.js.map +0 -1
  294. package/es/channel/index.js +0 -980
  295. package/es/channel/index.js.map +0 -1
  296. package/es/channel/internal.js +0 -266
  297. package/es/channel/internal.js.map +0 -1
  298. package/es/contract/aci/helpers.js +0 -298
  299. package/es/contract/aci/helpers.js.map +0 -1
  300. package/es/contract/aci/index.js +0 -361
  301. package/es/contract/aci/index.js.map +0 -1
  302. package/es/contract/aci/transformation.js +0 -66
  303. package/es/contract/aci/transformation.js.map +0 -1
  304. package/es/contract/compiler.js +0 -244
  305. package/es/contract/compiler.js.map +0 -1
  306. package/es/contract/ga/helpers.js +0 -22
  307. package/es/contract/ga/helpers.js.map +0 -1
  308. package/es/contract/ga/index.js +0 -170
  309. package/es/contract/ga/index.js.map +0 -1
  310. package/es/contract/index.js +0 -162
  311. package/es/contract/index.js.map +0 -1
  312. package/es/crypto-ts.d.ts +0 -9
  313. package/es/index.js +0 -57
  314. package/es/index.js.map +0 -1
  315. package/es/node-pool/index.js +0 -187
  316. package/es/node-pool/index.js.map +0 -1
  317. package/es/node.js +0 -132
  318. package/es/node.js.map +0 -1
  319. package/es/other.d.ts +0 -31
  320. package/es/string.d.ts +0 -26
  321. package/es/tx/builder/helpers.js +0 -305
  322. package/es/tx/builder/helpers.js.map +0 -1
  323. package/es/tx/builder/index.js +0 -595
  324. package/es/tx/builder/index.js.map +0 -1
  325. package/es/tx/builder/schema.js +0 -814
  326. package/es/tx/builder/schema.js.map +0 -1
  327. package/es/tx/index.js +0 -300
  328. package/es/tx/index.js.map +0 -1
  329. package/es/tx/tx-object.js +0 -276
  330. package/es/tx/tx-object.js.map +0 -1
  331. package/es/tx/tx.js +0 -937
  332. package/es/tx/tx.js.map +0 -1
  333. package/es/tx/validator.js +0 -208
  334. package/es/tx/validator.js.map +0 -1
  335. package/es/typings/blakejs/index.d.js +0 -2
  336. package/es/typings/blakejs/index.d.js.map +0 -1
  337. package/es/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -131
  338. package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +0 -1
  339. package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -184
  340. package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +0 -1
  341. package/es/utils/aepp-wallet-communication/connection/index.js +0 -84
  342. package/es/utils/aepp-wallet-communication/connection/index.js.map +0 -1
  343. package/es/utils/aepp-wallet-communication/content-script-bridge.js +0 -97
  344. package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +0 -1
  345. package/es/utils/aepp-wallet-communication/helpers.js +0 -103
  346. package/es/utils/aepp-wallet-communication/helpers.js.map +0 -1
  347. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -329
  348. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +0 -1
  349. package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -270
  350. package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +0 -1
  351. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -533
  352. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +0 -1
  353. package/es/utils/aepp-wallet-communication/schema.js +0 -107
  354. package/es/utils/aepp-wallet-communication/schema.js.map +0 -1
  355. package/es/utils/aepp-wallet-communication/wallet-detector.js +0 -109
  356. package/es/utils/aepp-wallet-communication/wallet-detector.js.map +0 -1
  357. package/es/utils/amount-formatter.js.map +0 -1
  358. package/es/utils/async-init.js +0 -67
  359. package/es/utils/async-init.js.map +0 -1
  360. package/es/utils/bignumber.js +0 -28
  361. package/es/utils/bignumber.js.map +0 -1
  362. package/es/utils/bytes.js.map +0 -1
  363. package/es/utils/crypto-ts.js.map +0 -1
  364. package/es/utils/crypto.js +0 -304
  365. package/es/utils/crypto.js.map +0 -1
  366. package/es/utils/hd-wallet.js +0 -112
  367. package/es/utils/hd-wallet.js.map +0 -1
  368. package/es/utils/json-big.js +0 -45
  369. package/es/utils/json-big.js.map +0 -1
  370. package/es/utils/keystore.js +0 -228
  371. package/es/utils/keystore.js.map +0 -1
  372. package/es/utils/mptree.js.map +0 -1
  373. package/es/utils/other.js +0 -43
  374. package/es/utils/other.js.map +0 -1
  375. package/es/utils/semver-satisfies.js.map +0 -1
  376. package/es/utils/string.js.map +0 -1
  377. package/es/utils/swagger.js +0 -132
  378. package/es/utils/swagger.js.map +0 -1
  379. package/src/account/base.js +0 -153
  380. package/src/account/memory.js +0 -78
  381. package/src/account/multiple.js +0 -154
  382. package/src/ae/aens.js +0 -366
  383. package/src/ae/aepp.js +0 -45
  384. package/src/ae/contract.js +0 -285
  385. package/src/ae/index.js +0 -167
  386. package/src/ae/oracle.js +0 -296
  387. package/src/ae/universal.js +0 -47
  388. package/src/ae/wallet.js +0 -50
  389. package/src/chain/index.js +0 -250
  390. package/src/chain/node.js +0 -293
  391. package/src/channel/index.js +0 -898
  392. package/src/channel/internal.js +0 -231
  393. package/src/contract/aci/index.js +0 -317
  394. package/src/contract/aci/transformation.js +0 -72
  395. package/src/contract/compiler.js +0 -195
  396. package/src/contract/ga/helpers.js +0 -17
  397. package/src/contract/ga/index.js +0 -147
  398. package/src/contract/index.js +0 -163
  399. package/src/index.js +0 -90
  400. package/src/node-pool/index.js +0 -171
  401. package/src/node.js +0 -118
  402. package/src/tx/builder/helpers.js +0 -325
  403. package/src/tx/builder/index.js +0 -460
  404. package/src/tx/builder/schema.js +0 -1211
  405. package/src/tx/index.js +0 -301
  406. package/src/tx/tx-object.js +0 -186
  407. package/src/tx/tx.js +0 -622
  408. package/src/tx/validator.js +0 -161
  409. package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -114
  410. package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -161
  411. package/src/utils/aepp-wallet-communication/connection/index.js +0 -85
  412. package/src/utils/aepp-wallet-communication/content-script-bridge.js +0 -85
  413. package/src/utils/aepp-wallet-communication/helpers.js +0 -70
  414. package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -268
  415. package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -223
  416. package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -390
  417. package/src/utils/aepp-wallet-communication/schema.js +0 -108
  418. package/src/utils/aepp-wallet-communication/wallet-detector.js +0 -91
  419. package/src/utils/async-init.js +0 -41
  420. package/src/utils/crypto.js +0 -312
  421. package/src/utils/hd-wallet.js +0 -115
  422. package/src/utils/json-big.js +0 -26
  423. package/src/utils/keystore.js +0 -223
  424. package/src/utils/swagger.js +0 -133
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spend.mjs","names":["sendTransaction","getAccount","getBalance","resolveName","_buildTx","buildTxHash","unpackTx","BigNumber","ArgumentError","createMetaTx","TX_TYPE","send","tx","options","contractId","authFun","undefined","innerTx","onAccount","address","signed","signUsingGA","authData","signTransaction","hash","rawTx","spend","amount","recipientIdOrName","senderId","recipientId","transferFunds","fraction","balance","bind","desiredAmount","times","integerValue","ROUND_HALF_UP","fee","plus","gt","minus","payForTransaction","transaction","payingFor","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 { sendTransaction, getAccount, getBalance, resolveName } from './chain'\nimport { _buildTx, BuildTxOptions } from './tx'\nimport { buildTxHash, unpackTx } from './tx/builder'\nimport BigNumber from 'bignumber.js'\nimport { ArgumentError } from './utils/errors'\nimport { EncodedData } from './utils/encoder'\nimport { createMetaTx } from './contract/ga'\nimport { TX_TYPE, AensName } from './tx/builder/schema'\nimport AccountBase from './account/Base'\n\n/**\n * Sign and post a transaction to the 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 (tx: EncodedData<'tx'>, options: SendOptions): Promise<SendReturnType> {\n const { contractId, authFun = undefined } = options.innerTx === true\n ? { contractId: null }\n : await getAccount(await options.onAccount.address(options), options)\n\n const signed = contractId != null\n // TODO: not required arguments become required depending on account type, can ga be extracted?\n ? await signUsingGA(tx, { authData: {}, ...options, authFun: authFun as string })\n : await options.onAccount.signTransaction(tx, options)\n\n return options.innerTx === true\n ? { hash: buildTxHash(signed), rawTx: signed }\n : await sendTransaction(signed, options)\n}\n\ntype SendOptionsType = Parameters<AccountBase['signTransaction']>[1] & Parameters<typeof sendTransaction>[1]\n& Partial<Omit<Parameters<typeof signUsingGA>[1], 'onAccount' | 'onCompiler'>>\n& Pick<Parameters<typeof signUsingGA>[1], 'onAccount' | 'onCompiler'>\nexport interface SendOptions extends SendOptionsType {}\ninterface SendReturnType extends Awaited<ReturnType<typeof sendTransaction>> {}\n\nexport async function signUsingGA (\n tx: EncodedData<'tx'>,\n { authData, authFun, ...options }: {\n authData: Parameters<typeof createMetaTx>[1]\n authFun: Parameters<typeof createMetaTx>[2]\n } & Parameters<typeof createMetaTx>[3]\n): Promise<EncodedData<'tx'>> {\n return await createMetaTx(tx, authData, authFun, options)\n}\n\n/**\n * Send coins to another account\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: EncodedData<'ak'> | AensName,\n options: SpendOptions\n): ReturnType<typeof send> {\n return await send(\n await _buildTx(TX_TYPE.spend, {\n ...options,\n senderId: await options.onAccount.address(options),\n recipientId: await resolveName(recipientIdOrName, 'account_pubkey', options),\n amount\n }),\n options\n )\n}\n\ntype SpendOptionsType = BuildTxOptions<TX_TYPE.spend, '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 * @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 | EncodedData<'ak'>,\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<'ak'>(recipientIdOrName, 'account_pubkey', options)\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(TX_TYPE.spend, { ...options, senderId, recipientId, amount: desiredAmount }),\n TX_TYPE.spend\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 await send(\n await _buildTx(TX_TYPE.spend, { ...options, senderId, recipientId, amount }),\n options\n )\n}\n\ntype TransferFundsOptionsType = BuildTxOptions<TX_TYPE.spend, '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 * @param transaction - tx_<base64>-encoded transaction\n * @param options - Options\n * @returns Object Transaction\n */\nexport async function payForTransaction (\n transaction: EncodedData<'tx'>, options: PayForTransactionOptions\n): ReturnType<typeof send> {\n return await send(\n await _buildTx(\n TX_TYPE.payingFor,\n { ...options, payerId: await options.onAccount.address(options), tx: transaction }\n ),\n options\n )\n}\n\ninterface PayForTransactionOptions extends\n BuildTxOptions<TX_TYPE.payingFor, '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;SACSA,e,EAAiBC,U,EAAYC,U,EAAYC,W;SACzCC,Q;SACAC,W,EAAaC,Q;AACtB,OAAOC,SAAP,MAAsB,cAAtB;SACSC,a;SAEAC,Y;SACAC,O;;AAGT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,IAAf,CAAqBC,EAArB,EAA4CC,OAA5C,EAA2F;EAChG,MAAM;IAAEC,UAAF;IAAcC,OAAO,GAAGC;EAAxB,IAAsCH,OAAO,CAACI,OAAR,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E,GAAGb,OAAL;IAAcgB,QAAd;IAAwBC,WAAxB;IAAqCH;EAArC,CAAhB,CADC,EAEfd,OAFe,CAAjB;AAID;;AAMD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAe8B,iBAAf,CACLC,WADK,EAC2B/B,OAD3B,EAEoB;EACzB,OAAO,MAAMF,IAAI,CACf,MAAMP,QAAQ,CACZM,OAAO,CAACmC,SADI,EAEZ,EAAE,GAAGhC,OAAL;IAAciC,OAAO,EAAE,MAAMjC,OAAO,CAACK,SAAR,CAAkBC,OAAlB,CAA0BN,OAA1B,CAA7B;IAAiED,EAAE,EAAEgC;EAArE,CAFY,CADC,EAKf/B,OALe,CAAjB;AAOD"}
@@ -0,0 +1,41 @@
1
+ import { EncodingType } from './../../utils/encoder';
2
+ import BigNumber from 'bignumber.js';
3
+ export declare type AensName = `${string}.chain`;
4
+ export declare const NAME_TTL = 180000;
5
+ export declare const NAME_MAX_TTL = 36000;
6
+ export declare const NAME_MAX_CLIENT_TTL = 84600;
7
+ export declare const CLIENT_TTL = 84600;
8
+ export declare const MIN_GAS_PRICE = 1000000000;
9
+ export declare const NAME_FEE_MULTIPLIER = 100000000000000;
10
+ export declare const NAME_FEE_BID_INCREMENT = 0.05;
11
+ export declare const NAME_BID_TIMEOUT_BLOCKS = 480;
12
+ export declare const NAME_MAX_LENGTH_FEE = 31;
13
+ export declare const NAME_BID_MAX_LENGTH = 12;
14
+ export declare enum POINTER_KEY_BY_PREFIX {
15
+ ak = "account_pubkey",
16
+ ok = "oracle_pubkey",
17
+ ct = "contract_pubkey",
18
+ ch = "channel"
19
+ }
20
+ export declare const NAME_BID_RANGES: {
21
+ [k: string]: BigNumber;
22
+ };
23
+ export declare const ID_TAG: {
24
+ account: number;
25
+ name: number;
26
+ commitment: number;
27
+ oracle: number;
28
+ contract: number;
29
+ channel: number;
30
+ };
31
+ export declare const PREFIX_ID_TAG: {
32
+ readonly ak: number;
33
+ readonly nm: number;
34
+ readonly cm: number;
35
+ readonly ok: number;
36
+ readonly ct: number;
37
+ readonly ch: number;
38
+ };
39
+ export declare const ID_TAG_PREFIX: {
40
+ [k: string]: EncodingType;
41
+ };
@@ -0,0 +1,100 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { mapObject } from "../../utils/other.mjs"; // # AENS
3
+
4
+ export const NAME_TTL = 180000; // # max number of block into the future that the name is going to be available
5
+ // # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update
6
+ // # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry
7
+
8
+ export const NAME_MAX_TTL = 36000;
9
+ export const NAME_MAX_CLIENT_TTL = 84600;
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
12
+
13
+ export const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000
14
+
15
+ export const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage
16
+ // # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272
17
+
18
+ export const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day
19
+ // # this is the max length for a domain that requires a base fee to be paid
20
+
21
+ export const NAME_MAX_LENGTH_FEE = 31;
22
+ export const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid
23
+
24
+ export let POINTER_KEY_BY_PREFIX; // # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290
25
+ // # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times
26
+ // # bid ranges:
27
+
28
+ (function (POINTER_KEY_BY_PREFIX) {
29
+ POINTER_KEY_BY_PREFIX["ak"] = "account_pubkey";
30
+ POINTER_KEY_BY_PREFIX["ok"] = "oracle_pubkey";
31
+ POINTER_KEY_BY_PREFIX["ct"] = "contract_pubkey";
32
+ POINTER_KEY_BY_PREFIX["ch"] = "channel";
33
+ })(POINTER_KEY_BY_PREFIX || (POINTER_KEY_BY_PREFIX = {}));
34
+
35
+ export const NAME_BID_RANGES = mapObject({
36
+ 31: 3,
37
+ 30: 5,
38
+ 29: 8,
39
+ 28: 13,
40
+ 27: 21,
41
+ 26: 34,
42
+ 25: 55,
43
+ 24: 89,
44
+ 23: 144,
45
+ 22: 233,
46
+ 21: 377,
47
+ 20: 610,
48
+ 19: 987,
49
+ 18: 1597,
50
+ 17: 2584,
51
+ 16: 4181,
52
+ 15: 6765,
53
+ 14: 10946,
54
+ 13: 17711,
55
+ 12: 28657,
56
+ 11: 46368,
57
+ 10: 75025,
58
+ 9: 121393,
59
+ 8: 196418,
60
+ 7: 317811,
61
+ 6: 514229,
62
+ 5: 832040,
63
+ 4: 1346269,
64
+ 3: 2178309,
65
+ 2: 3524578,
66
+ 1: 5702887
67
+ }, _ref => {
68
+ let [key, value] = _ref;
69
+ return [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)];
70
+ }); // # Tag constant for ids (type uint8)
71
+ // # see https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type
72
+ // # <<Tag:1/unsigned-integer-unit:8, Hash:32/binary-unit:8>>
73
+
74
+ const ID_TAG_ACCOUNT = 1;
75
+ const ID_TAG_NAME = 2;
76
+ const ID_TAG_COMMITMENT = 3;
77
+ const ID_TAG_ORACLE = 4;
78
+ const ID_TAG_CONTRACT = 5;
79
+ const ID_TAG_CHANNEL = 6;
80
+ export const ID_TAG = {
81
+ account: ID_TAG_ACCOUNT,
82
+ name: ID_TAG_NAME,
83
+ commitment: ID_TAG_COMMITMENT,
84
+ oracle: ID_TAG_ORACLE,
85
+ contract: ID_TAG_CONTRACT,
86
+ channel: ID_TAG_CHANNEL
87
+ };
88
+ export const PREFIX_ID_TAG = {
89
+ ak: ID_TAG.account,
90
+ nm: ID_TAG.name,
91
+ cm: ID_TAG.commitment,
92
+ ok: ID_TAG.oracle,
93
+ ct: ID_TAG.contract,
94
+ ch: ID_TAG.channel
95
+ };
96
+ export const ID_TAG_PREFIX = mapObject(PREFIX_ID_TAG, _ref2 => {
97
+ let [key, value] = _ref2;
98
+ return [value, key];
99
+ });
100
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
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","POINTER_KEY_BY_PREFIX","NAME_BID_RANGES","key","value","times","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","ak","nm","cm","ok","ct","ch","ID_TAG_PREFIX"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import { EncodingType } from './../../utils/encoder'\nimport 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\nexport enum 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// # 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} as const\n\nexport const ID_TAG_PREFIX = mapObject(\n PREFIX_ID_TAG, ([key, value]: [EncodingType, number]) => [value, key]\n)\n"],"mappings":"AACA,OAAOA,SAAP,MAAsB,cAAtB;SACSC,S,iCAET;;AAEA,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;AACP,OAAO,MAAME,aAAa,GAAG,GAAtB,C,CACP;;AACA,OAAO,MAAMC,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,WAAYC,qBAAZ,C,CAMA;AACA;AACA;;WARYA,qB;EAAAA,qB;EAAAA,qB;EAAAA,qB;EAAAA,qB;GAAAA,qB,KAAAA,qB;;AASZ,OAAO,MAAMC,eAAe,GAAGZ,SAAS,CAAC;EACvC,IAAI,CADmC;EAEvC,IAAI,CAFmC;EAGvC,IAAI,CAHmC;EAIvC,IAAI,EAJmC;EAKvC,IAAI,EALmC;EAMvC,IAAI,EANmC;EAOvC,IAAI,EAPmC;EAQvC,IAAI,EARmC;EASvC,I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CAACG,UAHgB;EAI3BQ,EAAE,EAAEX,MAAM,CAACI,MAJgB;EAK3BQ,EAAE,EAAEZ,MAAM,CAACK,QALgB;EAM3BQ,EAAE,EAAEb,MAAM,CAACM;AANgB,CAAtB;AASP,OAAO,MAAMQ,aAAa,GAAGpC,SAAS,CACpC6B,aADoC,EACrB;EAAA,IAAC,CAAChB,GAAD,EAAMC,KAAN,CAAD;EAAA,OAA0C,CAACA,KAAD,EAAQD,GAAR,CAA1C;AAAA,CADqB,CAA/B"}
@@ -0,0 +1,62 @@
1
+ /// <reference types="node" />
2
+ import BigNumber from 'bignumber.js';
3
+ import { AensName } from './constants';
4
+ import { EncodedData } from '../../utils/encoder';
5
+ declare type Int = number | string | BigNumber;
6
+ export declare class Field {
7
+ prototype: any;
8
+ static serialize(value: any, _txFields?: object): Buffer;
9
+ static deserialize(value: Buffer): any;
10
+ }
11
+ export declare class Name extends Field {
12
+ /**
13
+ * @param value - AENS name
14
+ */
15
+ static serialize(value: AensName): Buffer;
16
+ /**
17
+ * @param value - AENS name
18
+ */
19
+ static deserialize(value: Buffer): string;
20
+ }
21
+ export declare class NameId extends Field {
22
+ /**
23
+ * @param value - AENS name ID
24
+ */
25
+ static serialize(value: AensName | EncodedData<'nm'>): Buffer;
26
+ /**
27
+ * @param value - AENS name ID Buffer
28
+ */
29
+ static deserialize(value: Buffer): string;
30
+ }
31
+ export declare class NameFee extends Field {
32
+ /**
33
+ * @param value - AENS name fee Buffer
34
+ * @param txFields - Transaction fields
35
+ * @param txFields.name - AENS Name in transaction
36
+ */
37
+ static serialize(value: Int | undefined, { name }: {
38
+ name: AensName;
39
+ }): Buffer;
40
+ /**
41
+ * @param value - AENS name fee Buffer
42
+ * @returns AENS name fee
43
+ */
44
+ static deserialize(value: Buffer): string;
45
+ }
46
+ export declare class Deposit extends Field {
47
+ /**
48
+ * @param value - Deposit value in string format. Should be equal to '0'.
49
+ * @returns Deposit value Buffer.
50
+ */
51
+ static serialize(value?: string): Buffer;
52
+ /**
53
+ * @param value - Deposit value Buffer.
54
+ * @returns Deposit value.
55
+ */
56
+ static deserialize(value: Buffer): string;
57
+ }
58
+ export declare class GasPrice extends Field {
59
+ static serialize(value?: Int): Buffer;
60
+ static deserialize(value: Buffer): string;
61
+ }
62
+ export {};
@@ -0,0 +1,126 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+ import { writeId, readId, produceNameId, getMinimumNameFee, readInt, writeInt, isNameValid } from "./helpers.mjs";
6
+ import { InsufficientNameFeeError, IllegalArgumentError } from "../../utils/errors.mjs";
7
+ import BigNumber from 'bignumber.js';
8
+ import { MIN_GAS_PRICE } from "./constants.mjs";
9
+ // todo: update me
10
+ // ? This is a TS workaround because this has to be a class with only static methods
11
+ export class Field {
12
+ static serialize(value) {
13
+ let _txFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
14
+
15
+ return _Buffer.from(value);
16
+ }
17
+
18
+ static deserialize(value) {
19
+ return value.toString();
20
+ }
21
+
22
+ }
23
+ export class Name extends Field {
24
+ /**
25
+ * @param value - AENS name
26
+ */
27
+ static serialize(value) {
28
+ return _Buffer.from(value);
29
+ }
30
+ /**
31
+ * @param value - AENS name
32
+ */
33
+
34
+
35
+ static deserialize(value) {
36
+ return value.toString();
37
+ }
38
+
39
+ }
40
+ export class NameId extends Field {
41
+ /**
42
+ * @param value - AENS name ID
43
+ */
44
+ static serialize(value) {
45
+ return writeId(isNameValid(value) ? produceNameId(value) : value);
46
+ }
47
+ /**
48
+ * @param value - AENS name ID Buffer
49
+ */
50
+
51
+
52
+ static deserialize(value) {
53
+ return readId(value);
54
+ }
55
+
56
+ }
57
+ export class NameFee extends Field {
58
+ /**
59
+ * @param value - AENS name fee Buffer
60
+ * @param txFields - Transaction fields
61
+ * @param txFields.name - AENS Name in transaction
62
+ */
63
+ static serialize(value, _ref) {
64
+ var _value;
65
+
66
+ let {
67
+ name
68
+ } = _ref;
69
+ const minNameFee = getMinimumNameFee(name);
70
+ (_value = value) !== null && _value !== void 0 ? _value : value = minNameFee;
71
+
72
+ if (minNameFee.gt(value)) {
73
+ throw new InsufficientNameFeeError(new BigNumber(value), minNameFee);
74
+ }
75
+
76
+ return writeInt(value);
77
+ }
78
+ /**
79
+ * @param value - AENS name fee Buffer
80
+ * @returns AENS name fee
81
+ */
82
+
83
+
84
+ static deserialize(value) {
85
+ return readInt(value);
86
+ }
87
+
88
+ }
89
+ export class Deposit extends Field {
90
+ /**
91
+ * @param value - Deposit value in string format. Should be equal to '0'.
92
+ * @returns Deposit value Buffer.
93
+ */
94
+ static serialize() {
95
+ let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '0';
96
+ if (parseInt(value) !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);
97
+ return writeInt(0);
98
+ }
99
+ /**
100
+ * @param value - Deposit value Buffer.
101
+ * @returns Deposit value.
102
+ */
103
+
104
+
105
+ static deserialize(value) {
106
+ return readInt(value);
107
+ }
108
+
109
+ }
110
+ export class GasPrice extends Field {
111
+ static serialize() {
112
+ let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MIN_GAS_PRICE;
113
+
114
+ if (+value < MIN_GAS_PRICE) {
115
+ throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger then ${MIN_GAS_PRICE}`);
116
+ }
117
+
118
+ return writeInt(value);
119
+ }
120
+
121
+ static deserialize(value) {
122
+ return readInt(value);
123
+ }
124
+
125
+ }
126
+ //# sourceMappingURL=field-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-types.mjs","names":["writeId","readId","produceNameId","getMinimumNameFee","readInt","writeInt","isNameValid","InsufficientNameFeeError","IllegalArgumentError","BigNumber","MIN_GAS_PRICE","Field","serialize","value","_txFields","from","deserialize","toString","Name","NameId","NameFee","name","minNameFee","gt","Deposit","parseInt","GasPrice"],"sources":["../../../src/tx/builder/field-types.ts"],"sourcesContent":["import {\n writeId, readId, produceNameId, getMinimumNameFee, readInt, writeInt, isNameValid\n} from './helpers'\nimport { InsufficientNameFeeError, IllegalArgumentError } from '../../utils/errors'\nimport BigNumber from 'bignumber.js'\nimport { MIN_GAS_PRICE, AensName } from './constants'\nimport { EncodedData } from '../../utils/encoder'\n\ntype Int = number | string | BigNumber\n\n// todo: update me\n// ? This is a TS workaround because this has to be a class with only static methods\nexport class Field {\n public prototype: any\n\n static serialize (value: any, _txFields: object = {}): Buffer {\n return Buffer.from(value)\n }\n\n static deserialize (value: Buffer): any {\n return value.toString()\n }\n}\n\nexport class Name extends Field {\n /**\n * @param value - AENS name\n */\n static serialize (value: AensName): Buffer {\n return Buffer.from(value)\n }\n\n /**\n * @param value - AENS name\n */\n static deserialize (value: Buffer): string {\n return value.toString()\n }\n}\n\nexport class NameId extends Field {\n /**\n * @param value - AENS name ID\n */\n static serialize (value: AensName | EncodedData<'nm'>): Buffer {\n return writeId(isNameValid(value) ? produceNameId(value) : value)\n }\n\n /**\n * @param value - AENS name ID Buffer\n */\n static deserialize (value: Buffer): string {\n return readId(value)\n }\n}\n\nexport class NameFee extends Field {\n /**\n * @param value - AENS name fee Buffer\n * @param txFields - Transaction fields\n * @param txFields.name - AENS Name in transaction\n */\n static serialize (value: Int | undefined, { name }: { name: AensName }): Buffer {\n const minNameFee = getMinimumNameFee(name)\n value ??= minNameFee\n if (minNameFee.gt(value)) {\n throw new InsufficientNameFeeError(new BigNumber(value), minNameFee)\n }\n return writeInt(value)\n }\n\n /**\n * @param value - AENS name fee Buffer\n * @returns AENS name fee\n */\n static deserialize (value: Buffer): string {\n return readInt(value)\n }\n}\n\nexport class Deposit extends Field {\n /**\n * @param value - Deposit value in string format. Should be equal to '0'.\n * @returns Deposit value Buffer.\n */\n static serialize (value: string = '0'): Buffer {\n if (parseInt(value) !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`)\n return writeInt(0)\n }\n\n /**\n * @param value - Deposit value Buffer.\n * @returns Deposit value.\n */\n static deserialize (value: Buffer): string {\n return readInt(value)\n }\n}\n\nexport class GasPrice extends Field {\n static serialize (value: Int = MIN_GAS_PRICE): Buffer {\n if (+value < MIN_GAS_PRICE) {\n throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger then ${MIN_GAS_PRICE}`)\n }\n return writeInt(value)\n }\n\n static deserialize (value: Buffer): string {\n return readInt(value)\n }\n}\n"],"mappings":";;;;SACEA,O,EAASC,M,EAAQC,a,EAAeC,iB,EAAmBC,O,EAASC,Q,EAAUC,W;SAE/DC,wB,EAA0BC,oB;AACnC,OAAOC,SAAP,MAAsB,cAAtB;SACSC,a;AAKT;AACA;AACA,OAAO,MAAMC,KAAN,CAAY;EAGD,OAATC,SAAS,CAAEC,KAAF,EAA8C;IAAA,IAAhCC,SAAgC,uEAAZ,EAAY;;IAC5D,OAAO,QAAOC,IAAP,CAAYF,KAAZ,CAAP;EACD;;EAEiB,OAAXG,WAAW,CAAEH,KAAF,EAAsB;IACtC,OAAOA,KAAK,CAACI,QAAN,EAAP;EACD;;AATgB;AAYnB,OAAO,MAAMC,IAAN,SAAmBP,KAAnB,CAAyB;EAC9B;AACF;AACA;EACkB,OAATC,SAAS,CAAEC,KAAF,EAA2B;IACzC,OAAO,QAAOE,IAAP,CAAYF,KAAZ,CAAP;EACD;EAED;AACF;AACA;;;EACoB,OAAXG,WAAW,CAAEH,KAAF,EAAyB;IACzC,OAAOA,KAAK,CAACI,QAAN,EAAP;EACD;;AAb6B;AAgBhC,OAAO,MAAME,MAAN,SAAqBR,KAArB,CAA2B;EAChC;AACF;AACA;EACkB,OAATC,SAAS,CAAEC,KAAF,EAA+C;IAC7D,OAAOb,OAAO,CAACM,WAAW,CAACO,KAAD,CAAX,GAAqBX,aAAa,CAACW,KAAD,CAAlC,GAA4CA,KAA7C,CAAd;EACD;EAED;AACF;AACA;;;EACoB,OAAXG,WAAW,CAAEH,KAAF,EAAyB;IACzC,OAAOZ,MAAM,CAACY,KAAD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K,CAACI,QAAN,EAAiB,wBAAuBP,aAAc,EAA5F,CAAN;IACD;;IACD,OAAOL,QAAQ,CAACQ,KAAD,CAAf;EACD;;EAEiB,OAAXG,WAAW,CAAEH,KAAF,EAAyB;IACzC,OAAOT,OAAO,CAACS,KAAD,CAAd;EACD;;AAViC"}
@@ -0,0 +1,131 @@
1
+ /// <reference types="node" />
2
+ import BigNumber from 'bignumber.js';
3
+ import { salt } from '../../utils/crypto';
4
+ import { encode, decode, EncodedData } from '../../utils/encoder';
5
+ import { POINTER_KEY_BY_PREFIX, AensName } from './constants';
6
+ /**
7
+ * JavaScript-based Transaction builder helper function's
8
+ */
9
+ export declare const createSalt: typeof salt;
10
+ export { encode, decode };
11
+ export interface Pointer {
12
+ key: string;
13
+ id: string;
14
+ }
15
+ /**
16
+ * Build a contract public key
17
+ * @param ownerId - The public key of the owner account
18
+ * @param nonce - the nonce of the transaction
19
+ * @returns Contract public key
20
+ */
21
+ export declare function buildContractId(ownerId: EncodedData<'ak'>, nonce: number | BigNumber): EncodedData<'ct'>;
22
+ /**
23
+ * Build a oracle query id
24
+ * @param senderId - The public key of the sender account
25
+ * @param nonce - the nonce of the transaction
26
+ * @param oracleId - The oracle public key
27
+ * @returns Contract public key
28
+ */
29
+ export declare function oracleQueryId(senderId: EncodedData<'ak'>, nonce: number | BigNumber | string, oracleId: EncodedData<'ok'>): EncodedData<'oq'>;
30
+ /**
31
+ * Format the salt into a 64-byte hex string
32
+ * @param salt - Random number
33
+ * @returns Zero-padded hex string of salt
34
+ */
35
+ export declare function formatSalt(salt: number): Buffer;
36
+ /**
37
+ * Encode an AENS name
38
+ *
39
+ * @param name - Name to encode
40
+ * @returns `nm_` prefixed encoded AENS name
41
+ */
42
+ export declare function produceNameId(name: AensName): EncodedData<'nm'>;
43
+ /**
44
+ * Generate the commitment hash by hashing the formatted salt and
45
+ * name, base 58 encoding the result and prepending 'cm_'
46
+ *
47
+ * @param name - Name to be registered
48
+ * @param salt - Random salt
49
+ * @returns Commitment hash
50
+ */
51
+ export declare function commitmentHash(name: AensName, salt?: number): EncodedData<'cm'>;
52
+ /**
53
+ * Utility function to create and _id type
54
+ * @param hashId - Encoded hash
55
+ * @returns Buffer Buffer with ID tag and decoded HASh
56
+ */
57
+ export declare function writeId(hashId: string): Buffer;
58
+ /**
59
+ * Utility function to read and _id type
60
+ * @param buf - Data
61
+ * @returns Encoided hash string with prefix
62
+ */
63
+ export declare function readId(buf: Buffer): string;
64
+ /**
65
+ * Utility function to convert int to bytes
66
+ * @param val - Value
67
+ * @returns Buffer Buffer from number(BigEndian)
68
+ */
69
+ export declare function writeInt(val: number | string | BigNumber): Buffer;
70
+ /**
71
+ * Utility function to convert bytes to int
72
+ * @param buf - Value
73
+ * @returns Buffer Buffer from number(BigEndian)
74
+ */
75
+ export declare function readInt(buf?: Buffer): string;
76
+ /**
77
+ * Helper function to build pointers for name update TX
78
+ * @param pointers - Array of pointers
79
+ * `([ { key: 'account_pubkey', id: 'ak_32klj5j23k23j5423l434l2j3423'} ])`
80
+ * @returns Serialized pointers array
81
+ */
82
+ export declare function buildPointers(pointers: Pointer[]): Buffer[][];
83
+ /**
84
+ * Helper function to read pointers from name update TX
85
+ * @param pointers - Array of pointers
86
+ * @returns Deserialize pointer array
87
+ */
88
+ export declare function readPointers(pointers: Array<[key: string, id: Buffer]>): Pointer[];
89
+ /**
90
+ * Is AENS name valid
91
+ * @param name - AENS name
92
+ */
93
+ export declare function isNameValid(name: string): name is AensName;
94
+ /**
95
+ * @param identifier - account/oracle/contract address, or channel
96
+ * @returns default AENS pointer key
97
+ */
98
+ export declare function getDefaultPointerKey(identifier: EncodedData<keyof typeof POINTER_KEY_BY_PREFIX>): POINTER_KEY_BY_PREFIX;
99
+ /**
100
+ * Get the minimum AENS name fee
101
+ *
102
+ * @param name - the AENS name to get the fee for
103
+ * @returns the minimum fee for the AENS name auction
104
+ */
105
+ export declare function getMinimumNameFee(name: AensName): BigNumber;
106
+ /**
107
+ * Compute bid fee for AENS auction
108
+ *
109
+ * @param name - the AENS name to get the fee for
110
+ * @param options - Options
111
+ * @param options.startFee - Auction start fee
112
+ * @param options.increment - Bid multiplier(In percentage, must be between 0 and 1)
113
+ * @returns Bid fee
114
+ */
115
+ export declare function computeBidFee(name: AensName, { startFee, increment }?: {
116
+ startFee?: number | string | BigNumber;
117
+ increment?: number;
118
+ }): BigNumber;
119
+ /**
120
+ * Compute auction end height
121
+ *
122
+ * @param name - Name to compute auction end for
123
+ * @param claimHeight - Auction starting height
124
+ * @see {@link https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L273}
125
+ * @returns Auction end height
126
+ */
127
+ export declare function computeAuctionEndBlock(name: AensName, claimHeight: number): number;
128
+ /**
129
+ * Is name accept going to auction
130
+ */
131
+ export declare function isAuctionName(name: AensName): boolean;