@aeternity/aepp-sdk 13.2.2 → 13.3.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 (494) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/bin/aesophia_cli +0 -0
  4. package/bin/aesophia_cli_8 +0 -0
  5. package/dist/aepp-sdk.browser-script.js +1 -1
  6. package/dist/aepp-sdk.browser-script.js.map +1 -1
  7. package/dist/aepp-sdk.browser.js +1 -1
  8. package/dist/aepp-sdk.browser.js.map +1 -1
  9. package/dist/aepp-sdk.js +9171 -7086
  10. package/dist/aepp-sdk.js.map +1 -1
  11. package/es/AeSdk.d.ts +3 -0
  12. package/es/AeSdk.mjs +12 -12
  13. package/es/AeSdk.mjs.map +1 -1
  14. package/es/AeSdkAepp.d.ts +0 -1
  15. package/es/AeSdkAepp.mjs +12 -16
  16. package/es/AeSdkAepp.mjs.map +1 -1
  17. package/es/AeSdkBase.d.ts +61 -6
  18. package/es/AeSdkBase.mjs +150 -69
  19. package/es/AeSdkBase.mjs.map +1 -1
  20. package/es/AeSdkMethods.d.ts +19 -7
  21. package/es/AeSdkMethods.mjs +39 -38
  22. package/es/AeSdkMethods.mjs.map +1 -1
  23. package/es/AeSdkWallet.mjs +86 -55
  24. package/es/AeSdkWallet.mjs.map +1 -1
  25. package/es/Middleware.mjs +31 -27
  26. package/es/Middleware.mjs.map +1 -1
  27. package/es/MiddlewareSubscriber.mjs +5 -14
  28. package/es/MiddlewareSubscriber.mjs.map +1 -1
  29. package/es/Node.d.ts +10 -2
  30. package/es/Node.mjs +53 -54
  31. package/es/Node.mjs.map +1 -1
  32. package/es/account/Base.d.ts +39 -3
  33. package/es/account/Base.mjs +35 -1
  34. package/es/account/Base.mjs.map +1 -1
  35. package/es/account/Generalized.d.ts +2 -0
  36. package/es/account/Generalized.mjs +15 -6
  37. package/es/account/Generalized.mjs.map +1 -1
  38. package/es/account/Ledger.d.ts +2 -0
  39. package/es/account/Ledger.mjs +14 -5
  40. package/es/account/Ledger.mjs.map +1 -1
  41. package/es/account/LedgerFactory.mjs +4 -6
  42. package/es/account/LedgerFactory.mjs.map +1 -1
  43. package/es/account/Memory.d.ts +15 -4
  44. package/es/account/Memory.mjs +96 -31
  45. package/es/account/Memory.mjs.map +1 -1
  46. package/es/account/Rpc.d.ts +16 -5
  47. package/es/account/Rpc.mjs +94 -21
  48. package/es/account/Rpc.mjs.map +1 -1
  49. package/es/aens.d.ts +17 -44
  50. package/es/aens.mjs +32 -71
  51. package/es/aens.mjs.map +1 -1
  52. package/es/aepp-wallet-communication/connection/Browser.mjs +3 -4
  53. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  54. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
  55. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +7 -5
  56. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  57. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +8 -9
  58. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  59. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +7 -7
  60. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  61. package/es/aepp-wallet-communication/rpc/types.d.ts +14 -0
  62. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  63. package/es/aepp-wallet-communication/schema.d.ts +2 -0
  64. package/es/aepp-wallet-communication/schema.mjs +2 -0
  65. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  66. package/es/aepp-wallet-communication/wallet-detector.mjs +4 -5
  67. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  68. package/es/apis/compiler/compiler.mjs.map +1 -1
  69. package/es/apis/compiler/models/index.d.ts +1 -0
  70. package/es/apis/compiler/models/index.mjs.map +1 -1
  71. package/es/apis/compiler/models/mappers.mjs +13 -0
  72. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  73. package/es/apis/compiler/models/parameters.mjs.map +1 -1
  74. package/es/apis/middleware/middleware.d.ts +23 -5
  75. package/es/apis/middleware/middleware.mjs +114 -18
  76. package/es/apis/middleware/middleware.mjs.map +1 -1
  77. package/es/apis/middleware/models/index.d.ts +164 -15
  78. package/es/apis/middleware/models/index.mjs +53 -3
  79. package/es/apis/middleware/models/index.mjs.map +1 -1
  80. package/es/apis/middleware/models/mappers.d.ts +8 -1
  81. package/es/apis/middleware/models/mappers.mjs +376 -3
  82. package/es/apis/middleware/models/mappers.mjs.map +1 -1
  83. package/es/apis/middleware/models/parameters.d.ts +6 -3
  84. package/es/apis/middleware/models/parameters.mjs +38 -11
  85. package/es/apis/middleware/models/parameters.mjs.map +1 -1
  86. package/es/apis/node/models/index.d.ts +66 -2
  87. package/es/apis/node/models/index.mjs.map +1 -1
  88. package/es/apis/node/models/mappers.d.ts +5 -1
  89. package/es/apis/node/models/mappers.mjs +229 -7
  90. package/es/apis/node/models/mappers.mjs.map +1 -1
  91. package/es/apis/node/models/parameters.d.ts +2 -2
  92. package/es/apis/node/models/parameters.mjs +2 -2
  93. package/es/apis/node/models/parameters.mjs.map +1 -1
  94. package/es/apis/node/node.d.ts +24 -3
  95. package/es/apis/node/node.mjs +135 -3
  96. package/es/apis/node/node.mjs.map +1 -1
  97. package/es/chain.d.ts +14 -44
  98. package/es/chain.mjs +125 -219
  99. package/es/chain.mjs.map +1 -1
  100. package/es/channel/Base.d.ts +3 -47
  101. package/es/channel/Base.mjs +21 -54
  102. package/es/channel/Base.mjs.map +1 -1
  103. package/es/channel/Contract.d.ts +16 -25
  104. package/es/channel/Contract.mjs +39 -63
  105. package/es/channel/Contract.mjs.map +1 -1
  106. package/es/channel/Spend.d.ts +0 -8
  107. package/es/channel/Spend.mjs +17 -29
  108. package/es/channel/Spend.mjs.map +1 -1
  109. package/es/channel/handlers.mjs +1 -1
  110. package/es/channel/handlers.mjs.map +1 -1
  111. package/es/channel/internal.d.ts +104 -5
  112. package/es/channel/internal.mjs +26 -34
  113. package/es/channel/internal.mjs.map +1 -1
  114. package/es/contract/Contract.d.ts +9 -1
  115. package/es/contract/Contract.mjs +67 -73
  116. package/es/contract/Contract.mjs.map +1 -1
  117. package/es/contract/compiler/Base.d.ts +14 -8
  118. package/es/contract/compiler/Base.mjs.map +1 -1
  119. package/es/contract/compiler/Cli.d.ts +5 -9
  120. package/es/contract/compiler/Cli.mjs +45 -23
  121. package/es/contract/compiler/Cli.mjs.map +1 -1
  122. package/es/contract/compiler/Cli8.d.ts +13 -0
  123. package/es/contract/compiler/Cli8.mjs +22 -0
  124. package/es/contract/compiler/Cli8.mjs.map +1 -0
  125. package/es/contract/compiler/Http.d.ts +3 -9
  126. package/es/contract/compiler/Http.mjs +28 -16
  127. package/es/contract/compiler/Http.mjs.map +1 -1
  128. package/es/contract/compiler/HttpNode.d.ts +2 -5
  129. package/es/contract/compiler/HttpNode.mjs.map +1 -1
  130. package/es/contract/delegation-signature.d.ts +2 -1
  131. package/es/contract/delegation-signature.mjs +18 -14
  132. package/es/contract/delegation-signature.mjs.map +1 -1
  133. package/es/contract/ga.d.ts +1 -2
  134. package/es/contract/ga.mjs +23 -25
  135. package/es/contract/ga.mjs.map +1 -1
  136. package/es/deprecated.d.ts +38 -0
  137. package/es/deprecated.mjs +45 -0
  138. package/es/deprecated.mjs.map +1 -1
  139. package/es/index-browser.d.ts +10 -5
  140. package/es/index-browser.mjs +9 -5
  141. package/es/index-browser.mjs.map +1 -1
  142. package/es/index.d.ts +1 -0
  143. package/es/index.mjs +1 -0
  144. package/es/index.mjs.map +1 -1
  145. package/es/oracle.d.ts +6 -37
  146. package/es/oracle.mjs +32 -66
  147. package/es/oracle.mjs.map +1 -1
  148. package/es/send-transaction.d.ts +53 -0
  149. package/es/send-transaction.mjs +109 -0
  150. package/es/send-transaction.mjs.map +1 -0
  151. package/es/spend.d.ts +4 -3
  152. package/es/spend.mjs +6 -1
  153. package/es/spend.mjs.map +1 -1
  154. package/es/tx/builder/common.d.ts +29 -0
  155. package/es/tx/builder/common.mjs +42 -0
  156. package/es/tx/builder/common.mjs.map +1 -0
  157. package/es/tx/builder/constants.d.ts +4 -4
  158. package/es/tx/builder/constants.mjs +6 -15
  159. package/es/tx/builder/constants.mjs.map +1 -1
  160. package/es/tx/builder/delegation/index.d.ts +20 -0
  161. package/es/tx/builder/delegation/index.mjs +24 -0
  162. package/es/tx/builder/delegation/index.mjs.map +1 -0
  163. package/es/tx/builder/delegation/schema.d.ts +130 -0
  164. package/es/tx/builder/delegation/schema.generated.d.ts +141 -0
  165. package/es/tx/builder/delegation/schema.generated.mjs +2 -0
  166. package/es/tx/builder/delegation/schema.generated.mjs.map +1 -0
  167. package/es/tx/builder/delegation/schema.mjs +54 -0
  168. package/es/tx/builder/delegation/schema.mjs.map +1 -0
  169. package/es/tx/builder/field-types/abi-version.mjs +8 -11
  170. package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
  171. package/es/tx/builder/field-types/address.mjs +1 -4
  172. package/es/tx/builder/field-types/address.mjs.map +1 -1
  173. package/es/tx/builder/field-types/coin-amount.d.ts +2 -2
  174. package/es/tx/builder/field-types/coin-amount.mjs +6 -6
  175. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  176. package/es/tx/builder/field-types/ct-version.mjs +3 -4
  177. package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
  178. package/es/tx/builder/field-types/entry.mjs +7 -13
  179. package/es/tx/builder/field-types/entry.mjs.map +1 -1
  180. package/es/tx/builder/field-types/fee.d.ts +19 -11
  181. package/es/tx/builder/field-types/fee.mjs +56 -38
  182. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  183. package/es/tx/builder/field-types/gas-limit.mjs +13 -15
  184. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  185. package/es/tx/builder/field-types/gas-price.d.ts +10 -2
  186. package/es/tx/builder/field-types/gas-price.mjs +52 -3
  187. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  188. package/es/tx/builder/field-types/index.d.ts +31 -29
  189. package/es/tx/builder/field-types/index.mjs +31 -29
  190. package/es/tx/builder/field-types/index.mjs.map +1 -1
  191. package/es/tx/builder/field-types/map.mjs +20 -31
  192. package/es/tx/builder/field-types/map.mjs.map +1 -1
  193. package/es/tx/builder/field-types/mptree.mjs +14 -29
  194. package/es/tx/builder/field-types/mptree.mjs.map +1 -1
  195. package/es/tx/builder/field-types/name-fee.d.ts +1 -1
  196. package/es/tx/builder/field-types/name-fee.mjs +1 -1
  197. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  198. package/es/tx/builder/field-types/nonce.d.ts +1 -0
  199. package/es/tx/builder/field-types/nonce.mjs +2 -0
  200. package/es/tx/builder/field-types/nonce.mjs.map +1 -1
  201. package/es/tx/builder/field-types/pointers.mjs +4 -7
  202. package/es/tx/builder/field-types/pointers.mjs.map +1 -1
  203. package/es/tx/builder/field-types/pointers2.d.ts +23 -0
  204. package/es/tx/builder/field-types/pointers2.mjs +65 -0
  205. package/es/tx/builder/field-types/pointers2.mjs.map +1 -0
  206. package/es/tx/builder/field-types/query-fee.d.ts +19 -0
  207. package/es/tx/builder/field-types/query-fee.mjs +20 -0
  208. package/es/tx/builder/field-types/query-fee.mjs.map +1 -0
  209. package/es/tx/builder/field-types/ttl.d.ts +9 -1
  210. package/es/tx/builder/field-types/ttl.mjs +19 -8
  211. package/es/tx/builder/field-types/ttl.mjs.map +1 -1
  212. package/es/tx/builder/field-types/with-default.d.ts +7 -0
  213. package/es/tx/builder/field-types/with-default.mjs +9 -0
  214. package/es/tx/builder/field-types/with-default.mjs.map +1 -0
  215. package/es/tx/builder/field-types/with-formatting.d.ts +7 -0
  216. package/es/tx/builder/field-types/with-formatting.mjs +9 -0
  217. package/es/tx/builder/field-types/with-formatting.mjs.map +1 -0
  218. package/es/tx/builder/field-types/wrapped.mjs +6 -8
  219. package/es/tx/builder/field-types/wrapped.mjs.map +1 -1
  220. package/es/tx/builder/helpers.d.ts +2 -2
  221. package/es/tx/builder/helpers.mjs +12 -21
  222. package/es/tx/builder/helpers.mjs.map +1 -1
  223. package/es/tx/builder/index.d.ts +17 -10
  224. package/es/tx/builder/index.mjs +39 -65
  225. package/es/tx/builder/index.mjs.map +1 -1
  226. package/es/tx/builder/schema.d.ts +478 -257
  227. package/es/tx/builder/schema.generated.d.ts +39 -3
  228. package/es/tx/builder/schema.generated.mjs.map +1 -1
  229. package/es/tx/builder/schema.mjs +48 -36
  230. package/es/tx/builder/schema.mjs.map +1 -1
  231. package/es/tx/execution-cost.d.ts +6 -5
  232. package/es/tx/execution-cost.mjs +16 -17
  233. package/es/tx/execution-cost.mjs.map +1 -1
  234. package/es/tx/transaction-signer.mjs +1 -4
  235. package/es/tx/transaction-signer.mjs.map +1 -1
  236. package/es/tx/validator.mjs +61 -42
  237. package/es/tx/validator.mjs.map +1 -1
  238. package/es/utils/amount-formatter.mjs +15 -22
  239. package/es/utils/amount-formatter.mjs.map +1 -1
  240. package/es/utils/autorest.d.ts +2 -3
  241. package/es/utils/autorest.mjs +40 -24
  242. package/es/utils/autorest.mjs.map +1 -1
  243. package/es/utils/bytes.mjs +1 -2
  244. package/es/utils/bytes.mjs.map +1 -1
  245. package/es/utils/crypto.d.ts +8 -4
  246. package/es/utils/crypto.mjs +17 -13
  247. package/es/utils/crypto.mjs.map +1 -1
  248. package/es/utils/errors.d.ts +6 -0
  249. package/es/utils/errors.mjs +12 -6
  250. package/es/utils/errors.mjs.map +1 -1
  251. package/es/utils/hd-wallet.d.ts +2 -0
  252. package/es/utils/hd-wallet.mjs +6 -5
  253. package/es/utils/hd-wallet.mjs.map +1 -1
  254. package/es/utils/json-big.mjs +2 -10
  255. package/es/utils/json-big.mjs.map +1 -1
  256. package/es/utils/jwt.d.ts +53 -0
  257. package/es/utils/jwt.mjs +120 -0
  258. package/es/utils/jwt.mjs.map +1 -0
  259. package/es/utils/keystore.d.ts +6 -2
  260. package/es/utils/keystore.mjs +8 -16
  261. package/es/utils/keystore.mjs.map +1 -1
  262. package/es/utils/typed-data.mjs +1 -0
  263. package/es/utils/typed-data.mjs.map +1 -1
  264. package/es/utils/wrap-proxy.d.ts +2 -0
  265. package/es/utils/wrap-proxy.mjs +15 -0
  266. package/es/utils/wrap-proxy.mjs.map +1 -0
  267. package/package.json +57 -51
  268. package/src/AeSdk.ts +3 -0
  269. package/src/AeSdkAepp.ts +0 -1
  270. package/src/AeSdkBase.ts +97 -10
  271. package/src/AeSdkMethods.ts +37 -33
  272. package/src/AeSdkWallet.ts +22 -3
  273. package/src/Middleware.ts +16 -8
  274. package/src/MiddlewareSubscriber.ts +1 -1
  275. package/src/Node.ts +37 -18
  276. package/src/account/Base.ts +62 -3
  277. package/src/account/Generalized.ts +10 -0
  278. package/src/account/Ledger.ts +10 -0
  279. package/src/account/Memory.ts +83 -9
  280. package/src/account/Rpc.ts +69 -6
  281. package/src/aens.ts +35 -56
  282. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +3 -0
  283. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +2 -2
  284. package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -2
  285. package/src/aepp-wallet-communication/rpc/types.ts +13 -0
  286. package/src/aepp-wallet-communication/schema.ts +2 -0
  287. package/src/apis/compiler/compiler.ts +93 -93
  288. package/src/apis/compiler/models/index.ts +1 -0
  289. package/src/apis/compiler/models/mappers.ts +178 -165
  290. package/src/apis/compiler/models/parameters.ts +18 -18
  291. package/src/apis/middleware/middleware.ts +462 -341
  292. package/src/apis/middleware/models/index.ts +258 -56
  293. package/src/apis/middleware/models/mappers.ts +2357 -1919
  294. package/src/apis/middleware/models/parameters.ts +172 -142
  295. package/src/apis/node/models/index.ts +79 -2
  296. package/src/apis/node/models/mappers.ts +1529 -1302
  297. package/src/apis/node/models/parameters.ts +51 -51
  298. package/src/apis/node/node.ts +420 -275
  299. package/src/chain.ts +42 -128
  300. package/src/channel/Base.ts +14 -47
  301. package/src/channel/Contract.ts +18 -26
  302. package/src/channel/Spend.ts +0 -8
  303. package/src/channel/internal.ts +115 -13
  304. package/src/contract/Contract.ts +26 -8
  305. package/src/contract/compiler/Base.ts +15 -8
  306. package/src/contract/compiler/Cli.ts +37 -21
  307. package/src/contract/compiler/Cli8.ts +17 -0
  308. package/src/contract/compiler/Http.ts +24 -14
  309. package/src/contract/compiler/HttpNode.ts +2 -2
  310. package/src/contract/delegation-signature.ts +11 -5
  311. package/src/contract/ga.ts +4 -3
  312. package/src/deprecated.ts +36 -0
  313. package/src/index-browser.ts +14 -7
  314. package/src/index.ts +1 -0
  315. package/src/oracle.ts +11 -54
  316. package/src/send-transaction.ts +136 -0
  317. package/src/spend.ts +25 -11
  318. package/src/tx/builder/common.ts +74 -0
  319. package/src/tx/builder/constants.ts +6 -9
  320. package/src/tx/builder/delegation/index.ts +28 -0
  321. package/src/tx/builder/delegation/schema.generated.ts +143 -0
  322. package/src/tx/builder/delegation/schema.ts +61 -0
  323. package/src/tx/builder/field-types/coin-amount.ts +3 -2
  324. package/src/tx/builder/field-types/entry.ts +1 -4
  325. package/src/tx/builder/field-types/fee.ts +71 -43
  326. package/src/tx/builder/field-types/gas-limit.ts +4 -4
  327. package/src/tx/builder/field-types/gas-price.ts +70 -14
  328. package/src/tx/builder/field-types/index.ts +31 -59
  329. package/src/tx/builder/field-types/name-fee.ts +1 -1
  330. package/src/tx/builder/field-types/nonce.ts +7 -1
  331. package/src/tx/builder/field-types/pointers2.ts +62 -0
  332. package/src/tx/builder/field-types/query-fee.ts +25 -0
  333. package/src/tx/builder/field-types/ttl.ts +13 -3
  334. package/src/tx/builder/field-types/with-default.ts +18 -0
  335. package/src/tx/builder/field-types/with-formatting.ts +18 -0
  336. package/src/tx/builder/helpers.ts +2 -2
  337. package/src/tx/builder/index.ts +42 -59
  338. package/src/tx/builder/schema.generated.ts +39 -3
  339. package/src/tx/builder/schema.ts +55 -29
  340. package/src/tx/execution-cost.ts +6 -5
  341. package/src/tx/validator.ts +31 -5
  342. package/src/utils/autorest.ts +36 -27
  343. package/src/utils/crypto.ts +23 -13
  344. package/src/utils/errors.ts +10 -0
  345. package/src/utils/hd-wallet.ts +2 -0
  346. package/src/utils/jwt.ts +126 -0
  347. package/src/utils/keystore.ts +6 -2
  348. package/src/utils/wrap-proxy.ts +24 -0
  349. package/types-legacy/ts4.2/AeSdk.d.ts +3 -0
  350. package/types-legacy/ts4.2/AeSdkAepp.d.ts +0 -1
  351. package/types-legacy/ts4.2/AeSdkBase.d.ts +61 -6
  352. package/types-legacy/ts4.2/AeSdkMethods.d.ts +19 -7
  353. package/types-legacy/ts4.2/Node.d.ts +14 -1
  354. package/types-legacy/ts4.2/account/Base.d.ts +39 -3
  355. package/types-legacy/ts4.2/account/Generalized.d.ts +2 -0
  356. package/types-legacy/ts4.2/account/Ledger.d.ts +2 -0
  357. package/types-legacy/ts4.2/account/Memory.d.ts +15 -4
  358. package/types-legacy/ts4.2/account/Rpc.d.ts +16 -5
  359. package/types-legacy/ts4.2/aens.d.ts +17 -44
  360. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
  361. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +14 -0
  362. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +2 -0
  363. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -0
  364. package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +23 -5
  365. package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +164 -15
  366. package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +8 -1
  367. package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +6 -3
  368. package/types-legacy/ts4.2/apis/node/models/index.d.ts +66 -2
  369. package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +5 -1
  370. package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
  371. package/types-legacy/ts4.2/apis/node/node.d.ts +24 -3
  372. package/types-legacy/ts4.2/chain.d.ts +14 -44
  373. package/types-legacy/ts4.2/channel/Base.d.ts +3 -47
  374. package/types-legacy/ts4.2/channel/Contract.d.ts +16 -25
  375. package/types-legacy/ts4.2/channel/Spend.d.ts +0 -8
  376. package/types-legacy/ts4.2/channel/internal.d.ts +104 -5
  377. package/types-legacy/ts4.2/contract/Contract.d.ts +9 -1
  378. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +14 -8
  379. package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +5 -9
  380. package/types-legacy/ts4.2/contract/compiler/Cli8.d.ts +13 -0
  381. package/types-legacy/ts4.2/contract/compiler/Http.d.ts +3 -9
  382. package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +2 -5
  383. package/types-legacy/ts4.2/contract/delegation-signature.d.ts +2 -1
  384. package/types-legacy/ts4.2/contract/ga.d.ts +1 -2
  385. package/types-legacy/ts4.2/deprecated.d.ts +38 -0
  386. package/types-legacy/ts4.2/index-browser.d.ts +10 -5
  387. package/types-legacy/ts4.2/index.d.ts +1 -0
  388. package/types-legacy/ts4.2/oracle.d.ts +6 -37
  389. package/types-legacy/ts4.2/send-transaction.d.ts +53 -0
  390. package/types-legacy/ts4.2/spend.d.ts +4 -3
  391. package/types-legacy/ts4.2/tx/builder/common.d.ts +32 -0
  392. package/types-legacy/ts4.2/tx/builder/constants.d.ts +4 -4
  393. package/types-legacy/ts4.2/tx/builder/delegation/index.d.ts +20 -0
  394. package/types-legacy/ts4.2/tx/builder/delegation/schema.d.ts +136 -0
  395. package/types-legacy/ts4.2/tx/builder/delegation/schema.generated.d.ts +141 -0
  396. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +2 -2
  397. package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +19 -11
  398. package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +10 -2
  399. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +31 -29
  400. package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -1
  401. package/types-legacy/ts4.2/tx/builder/field-types/nonce.d.ts +1 -0
  402. package/types-legacy/ts4.2/tx/builder/field-types/pointers2.d.ts +26 -0
  403. package/types-legacy/ts4.2/tx/builder/field-types/query-fee.d.ts +19 -0
  404. package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +9 -1
  405. package/types-legacy/ts4.2/tx/builder/field-types/with-default.d.ts +7 -0
  406. package/types-legacy/ts4.2/tx/builder/field-types/with-formatting.d.ts +7 -0
  407. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +2 -2
  408. package/types-legacy/ts4.2/tx/builder/index.d.ts +17 -10
  409. package/types-legacy/ts4.2/tx/builder/schema.d.ts +482 -257
  410. package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +39 -3
  411. package/types-legacy/ts4.2/tx/execution-cost.d.ts +6 -5
  412. package/types-legacy/ts4.2/utils/autorest.d.ts +2 -3
  413. package/types-legacy/ts4.2/utils/crypto.d.ts +8 -4
  414. package/types-legacy/ts4.2/utils/errors.d.ts +6 -0
  415. package/types-legacy/ts4.2/utils/hd-wallet.d.ts +2 -0
  416. package/types-legacy/ts4.2/utils/jwt.d.ts +53 -0
  417. package/types-legacy/ts4.2/utils/keystore.d.ts +6 -2
  418. package/types-legacy/ts4.2/utils/wrap-proxy.d.ts +2 -0
  419. package/types-legacy/ts4.5/AeSdk.d.ts +3 -0
  420. package/types-legacy/ts4.5/AeSdkAepp.d.ts +0 -1
  421. package/types-legacy/ts4.5/AeSdkBase.d.ts +61 -6
  422. package/types-legacy/ts4.5/AeSdkMethods.d.ts +19 -7
  423. package/types-legacy/ts4.5/Node.d.ts +14 -1
  424. package/types-legacy/ts4.5/account/Base.d.ts +39 -3
  425. package/types-legacy/ts4.5/account/Generalized.d.ts +2 -0
  426. package/types-legacy/ts4.5/account/Ledger.d.ts +2 -0
  427. package/types-legacy/ts4.5/account/Memory.d.ts +15 -4
  428. package/types-legacy/ts4.5/account/Rpc.d.ts +16 -5
  429. package/types-legacy/ts4.5/aens.d.ts +17 -44
  430. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
  431. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +14 -0
  432. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +2 -0
  433. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -0
  434. package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +23 -5
  435. package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +164 -15
  436. package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +8 -1
  437. package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +6 -3
  438. package/types-legacy/ts4.5/apis/node/models/index.d.ts +66 -2
  439. package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +5 -1
  440. package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
  441. package/types-legacy/ts4.5/apis/node/node.d.ts +24 -3
  442. package/types-legacy/ts4.5/chain.d.ts +14 -44
  443. package/types-legacy/ts4.5/channel/Base.d.ts +3 -47
  444. package/types-legacy/ts4.5/channel/Contract.d.ts +16 -25
  445. package/types-legacy/ts4.5/channel/Spend.d.ts +0 -8
  446. package/types-legacy/ts4.5/channel/internal.d.ts +104 -5
  447. package/types-legacy/ts4.5/contract/Contract.d.ts +9 -1
  448. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +14 -8
  449. package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +5 -9
  450. package/types-legacy/ts4.5/contract/compiler/Cli8.d.ts +13 -0
  451. package/types-legacy/ts4.5/contract/compiler/Http.d.ts +3 -9
  452. package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +2 -5
  453. package/types-legacy/ts4.5/contract/delegation-signature.d.ts +2 -1
  454. package/types-legacy/ts4.5/contract/ga.d.ts +1 -2
  455. package/types-legacy/ts4.5/deprecated.d.ts +38 -0
  456. package/types-legacy/ts4.5/index-browser.d.ts +10 -5
  457. package/types-legacy/ts4.5/index.d.ts +1 -0
  458. package/types-legacy/ts4.5/oracle.d.ts +6 -37
  459. package/types-legacy/ts4.5/send-transaction.d.ts +53 -0
  460. package/types-legacy/ts4.5/spend.d.ts +4 -3
  461. package/types-legacy/ts4.5/tx/builder/common.d.ts +32 -0
  462. package/types-legacy/ts4.5/tx/builder/constants.d.ts +4 -4
  463. package/types-legacy/ts4.5/tx/builder/delegation/index.d.ts +20 -0
  464. package/types-legacy/ts4.5/tx/builder/delegation/schema.d.ts +136 -0
  465. package/types-legacy/ts4.5/tx/builder/delegation/schema.generated.d.ts +141 -0
  466. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +2 -2
  467. package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +19 -11
  468. package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +10 -2
  469. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +31 -29
  470. package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -1
  471. package/types-legacy/ts4.5/tx/builder/field-types/nonce.d.ts +1 -0
  472. package/types-legacy/ts4.5/tx/builder/field-types/pointers2.d.ts +26 -0
  473. package/types-legacy/ts4.5/tx/builder/field-types/query-fee.d.ts +19 -0
  474. package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +9 -1
  475. package/types-legacy/ts4.5/tx/builder/field-types/with-default.d.ts +7 -0
  476. package/types-legacy/ts4.5/tx/builder/field-types/with-formatting.d.ts +7 -0
  477. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +2 -2
  478. package/types-legacy/ts4.5/tx/builder/index.d.ts +17 -10
  479. package/types-legacy/ts4.5/tx/builder/schema.d.ts +482 -257
  480. package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +39 -3
  481. package/types-legacy/ts4.5/tx/execution-cost.d.ts +6 -5
  482. package/types-legacy/ts4.5/utils/autorest.d.ts +2 -3
  483. package/types-legacy/ts4.5/utils/crypto.d.ts +8 -4
  484. package/types-legacy/ts4.5/utils/errors.d.ts +6 -0
  485. package/types-legacy/ts4.5/utils/hd-wallet.d.ts +2 -0
  486. package/types-legacy/ts4.5/utils/jwt.d.ts +53 -0
  487. package/types-legacy/ts4.5/utils/keystore.d.ts +6 -2
  488. package/types-legacy/ts4.5/utils/wrap-proxy.d.ts +2 -0
  489. package/es/tx/builder/field-types/deposit.d.ts +0 -15
  490. package/es/tx/builder/field-types/deposit.mjs +0 -18
  491. package/es/tx/builder/field-types/deposit.mjs.map +0 -1
  492. package/src/tx/builder/field-types/deposit.ts +0 -23
  493. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +0 -15
  494. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +0 -15
@@ -0,0 +1,109 @@
1
+ import verifyTransaction from "./tx/validator.mjs";
2
+ import { ensureError } from "./utils/other.mjs";
3
+ import { TransactionError } from "./utils/errors.mjs";
4
+ import { buildTxHash } from "./tx/builder/index.mjs";
5
+ import { poll, waitForTxConfirm } from "./chain.mjs";
6
+ /**
7
+ * @category exception
8
+ */
9
+ export class InvalidTxError extends TransactionError {
10
+ constructor(message, validation, transaction) {
11
+ super(message);
12
+ this.name = 'InvalidTxError';
13
+ this.validation = validation;
14
+ this.transaction = transaction;
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Signs and submits transaction for mining
20
+ * @category chain
21
+ * @param txUnsigned - Transaction to sign and submit
22
+ * @param options - Options
23
+ * @returns Transaction details
24
+ */
25
+ export async function sendTransaction(txUnsigned, {
26
+ onNode,
27
+ onAccount,
28
+ verify = true,
29
+ waitMined = true,
30
+ confirm,
31
+ innerTx,
32
+ ...options
33
+ }) {
34
+ const tx = await onAccount.signTransaction(txUnsigned, {
35
+ ...options,
36
+ onNode,
37
+ innerTx,
38
+ networkId: await onNode.getNetworkId()
39
+ });
40
+ if (innerTx === true) return {
41
+ hash: buildTxHash(tx),
42
+ rawTx: tx
43
+ };
44
+ if (verify) {
45
+ const validation = await verifyTransaction(tx, onNode);
46
+ if (validation.length > 0) {
47
+ const message = `Transaction verification errors: ${validation.map(v => v.message).join(', ')}`;
48
+ throw new InvalidTxError(message, validation, tx);
49
+ }
50
+ }
51
+ try {
52
+ let __queue;
53
+ try {
54
+ __queue = onAccount != null ? `tx-${onAccount.address}` : null;
55
+ } catch (error) {
56
+ __queue = null;
57
+ }
58
+ const {
59
+ txHash
60
+ } = await onNode.postTransaction({
61
+ tx
62
+ }, {
63
+ requestOptions: {
64
+ customHeaders: {
65
+ // TODO: remove __retry-code after fixing https://github.com/aeternity/aeternity/issues/3803
66
+ '__retry-code': '400',
67
+ ...(__queue != null ? {
68
+ __queue
69
+ } : {})
70
+ }
71
+ }
72
+ });
73
+ if (waitMined) {
74
+ const pollResult = await poll(txHash, {
75
+ onNode,
76
+ ...options
77
+ });
78
+ const txData = {
79
+ ...pollResult,
80
+ hash: pollResult.hash,
81
+ rawTx: tx
82
+ };
83
+ // wait for transaction confirmation
84
+ if (confirm != null && +confirm > 0) {
85
+ const c = typeof confirm === 'boolean' ? undefined : confirm;
86
+ return {
87
+ ...txData,
88
+ confirmationHeight: await waitForTxConfirm(txHash, {
89
+ onNode,
90
+ confirm: c,
91
+ ...options
92
+ })
93
+ };
94
+ }
95
+ return txData;
96
+ }
97
+ return {
98
+ hash: txHash,
99
+ rawTx: tx
100
+ };
101
+ } catch (error) {
102
+ ensureError(error);
103
+ throw Object.assign(error, {
104
+ rawTx: tx,
105
+ verifyTx: async () => verifyTransaction(tx, onNode)
106
+ });
107
+ }
108
+ }
109
+ //# sourceMappingURL=send-transaction.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-transaction.mjs","names":["verifyTransaction","ensureError","TransactionError","buildTxHash","poll","waitForTxConfirm","InvalidTxError","constructor","message","validation","transaction","name","sendTransaction","txUnsigned","onNode","onAccount","verify","waitMined","confirm","innerTx","options","tx","signTransaction","networkId","getNetworkId","hash","rawTx","length","map","v","join","__queue","address","error","txHash","postTransaction","requestOptions","customHeaders","pollResult","txData","c","undefined","confirmationHeight","Object","assign","verifyTx"],"sources":["../src/send-transaction.ts"],"sourcesContent":["import verifyTransaction, { ValidatorResult } from './tx/validator';\nimport { ensureError } from './utils/other';\nimport { TransactionError } from './utils/errors';\nimport Node, { TransformNodeType } from './Node';\nimport { SignedTx } from './apis/node';\nimport { Encoded } from './utils/encoder';\nimport AccountBase from './account/Base';\nimport { buildTxHash } from './tx/builder';\nimport { poll, waitForTxConfirm } from './chain';\n\n/**\n * @category exception\n */\nexport class InvalidTxError extends TransactionError {\n validation: ValidatorResult[];\n\n transaction: Encoded.Transaction;\n\n constructor(\n message: string,\n validation: ValidatorResult[],\n transaction: Encoded.Transaction,\n ) {\n super(message);\n this.name = 'InvalidTxError';\n this.validation = validation;\n this.transaction = transaction;\n }\n}\n\n/**\n * Signs and submits transaction for mining\n * @category chain\n * @param txUnsigned - Transaction to sign and submit\n * @param options - Options\n * @returns Transaction details\n */\nexport async function sendTransaction(\n txUnsigned: Encoded.Transaction,\n {\n onNode, onAccount, verify = true, waitMined = true, confirm, innerTx, ...options\n }:\n SendTransactionOptions,\n): Promise<SendTransactionReturnType> {\n const tx = await onAccount.signTransaction(txUnsigned, {\n ...options,\n onNode,\n innerTx,\n networkId: await onNode.getNetworkId(),\n });\n\n if (innerTx === true) return { hash: buildTxHash(tx), rawTx: tx };\n\n if (verify) {\n const validation = await verifyTransaction(tx, onNode);\n if (validation.length > 0) {\n const message = `Transaction verification errors: ${\n validation.map((v: { message: string }) => v.message).join(', ')}`;\n throw new InvalidTxError(message, validation, tx);\n }\n }\n\n try {\n let __queue;\n try {\n __queue = onAccount != null ? `tx-${onAccount.address}` : null;\n } catch (error) {\n __queue = null;\n }\n const { txHash } = await onNode.postTransaction({ tx }, {\n requestOptions: {\n customHeaders: {\n // TODO: remove __retry-code after fixing https://github.com/aeternity/aeternity/issues/3803\n '__retry-code': '400',\n ...__queue != null ? { __queue } : {},\n },\n },\n });\n\n if (waitMined) {\n const pollResult = await poll(txHash, { onNode, ...options });\n const txData = {\n ...pollResult,\n hash: pollResult.hash as Encoded.TxHash,\n rawTx: tx,\n };\n // wait for transaction confirmation\n if (confirm != null && +confirm > 0) {\n const c = typeof confirm === 'boolean' ? undefined : confirm;\n return {\n ...txData,\n confirmationHeight: await waitForTxConfirm(txHash, { onNode, confirm: c, ...options }),\n };\n }\n return txData;\n }\n return { hash: txHash, rawTx: tx };\n } catch (error) {\n ensureError(error);\n throw Object.assign(error, {\n rawTx: tx,\n verifyTx: async () => verifyTransaction(tx, onNode),\n });\n }\n}\n\ntype SendTransactionOptionsType = {\n /**\n * Node to use\n */\n onNode: Node;\n /**\n * Account to use\n */\n onAccount: AccountBase;\n /**\n * Verify transaction before broadcast, throw error if not\n */\n verify?: boolean;\n /**\n * Ensure that transaction get into block\n */\n waitMined?: boolean;\n /**\n * Number of micro blocks that should be mined after tx get included\n */\n confirm?: boolean | number;\n} & Parameters<typeof poll>[1] & Omit<Parameters<typeof waitForTxConfirm>[1], 'confirm'>\n& Parameters<AccountBase['signTransaction']>[1];\nexport interface SendTransactionOptions extends SendTransactionOptionsType {}\ninterface SendTransactionReturnType extends Partial<TransformNodeType<SignedTx>> {\n hash: Encoded.TxHash;\n // TODO: use `SignedTx.encodedTx` instead\n rawTx: Encoded.Transaction;\n confirmationHeight?: number;\n}\n"],"mappings":"OAAOA,iBAAiB;AAAA,SACfC,WAAW;AAAA,SACXC,gBAAgB;AAAA,SAKhBC,WAAW;AAAA,SACXC,IAAI,EAAEC,gBAAgB;AAE/B;AACA;AACA;AACA,OAAO,MAAMC,cAAc,SAASJ,gBAAgB,CAAC;EAKnDK,WAAWA,CACTC,OAAe,EACfC,UAA6B,EAC7BC,WAAgC,EAChC;IACA,KAAK,CAACF,OAAO,CAAC;IACd,IAAI,CAACG,IAAI,GAAG,gBAAgB;IAC5B,IAAI,CAACF,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,WAAW,GAAGA,WAAW;EAChC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeE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AEA;UAAQ,CAAC,GAAG,CAAC,CAAC;QACvC;MACF;IACF,CAAC,CAAC;IAEF,IAAId,SAAS,EAAE;MACb,MAAMqB,UAAU,GAAG,MAAMlC,IAAI,CAAC8B,MAAM,EAAE;QAAEpB,MAAM;QAAE,GAAGM;MAAQ,CAAC,CAAC;MAC7D,MAAMmB,MAAM,GAAG;QACb,GAAGD,UAAU;QACbb,IAAI,EAAEa,UAAU,CAACb,IAAsB;QACvCC,KAAK,EAAEL;MACT,CAAC;MACD;MACA,IAAIH,OAAO,IAAI,IAAI,IAAI,CAACA,OAAO,GAAG,CAAC,EAAE;QACnC,MAAMsB,CAAC,GAAG,OAAOtB,OAAO,KAAK,SAAS,GAAGuB,SAAS,GAAGvB,OAAO;QAC5D,OAAO;UACL,GAAGqB,MAAM;UACTG,kBAAkB,EAAE,MAAMrC,gBAAgB,CAAC6B,MAAM,EAAE;YAAEpB,MAAM;YAAEI,OAAO,EAAEsB,CAAC;YAAE,GAAGpB;UAAQ,CAAC;QACvF,CAAC;MACH;MACA,OAAOmB,MAAM;IACf;IACA,OAAO;MAAEd,IAAI,EAAES,MAAM;MAAER,KAAK,EAAEL;IAAG,CAAC;EACpC,CAAC,CAAC,OAAOY,KAAK,EAAE;IACdhC,WAAW,CAACgC,KAAK,CAAC;IAClB,MAAMU,MAAM,CAACC,MAAM,CAACX,KAAK,EAAE;MACzBP,KAAK,EAAEL,EAAE;MACTwB,QAAQ,EAAE,MAAAA,CAAA,KAAY7C,iBAAiB,CAACqB,EAAE,EAAEP,MAAM;IACpD,CAAC,CAAC;EACJ;AACF"}
package/es/spend.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { sendTransaction, resolveName, SendTransactionOptions } from './chain';
1
+ import { resolveName } from './chain';
2
+ import { sendTransaction, SendTransactionOptions } from './send-transaction';
2
3
  import { BuildTxOptions } from './tx/builder';
3
4
  import { Encoded } from './utils/encoder';
4
5
  import { Tag, AensName } from './tx/builder/constants';
@@ -11,7 +12,7 @@ import AccountBase from './account/Base';
11
12
  * @param options - Options
12
13
  * @returns Transaction
13
14
  */
14
- export declare function spend(amount: number | string, recipientIdOrName: Encoded.AccountAddress | AensName, options: SpendOptions): ReturnType<typeof sendTransaction>;
15
+ export declare function spend(amount: number | string, recipientIdOrName: Encoded.AccountAddress | Encoded.ContractAddress | AensName, options: SpendOptions): ReturnType<typeof sendTransaction>;
15
16
  type SpendOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'> & Parameters<typeof resolveName>[2] & {
16
17
  onAccount: AccountBase;
17
18
  } & SendTransactionOptions;
@@ -35,7 +36,7 @@ interface SpendOptions extends SpendOptionsType {
35
36
  * ```
36
37
  */
37
38
  export declare function transferFunds(fraction: number | string, // TODO: accept only number
38
- recipientIdOrName: AensName | Encoded.AccountAddress, options: TransferFundsOptions): ReturnType<typeof sendTransaction>;
39
+ recipientIdOrName: AensName | Encoded.AccountAddress | Encoded.ContractAddress, options: TransferFundsOptions): ReturnType<typeof sendTransaction>;
39
40
  type TransferFundsOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'> & Parameters<typeof resolveName>[2] & {
40
41
  onAccount: AccountBase;
41
42
  } & SendTransactionOptions;
package/es/spend.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import BigNumber from 'bignumber.js';
2
- import { sendTransaction, getBalance, resolveName } from "./chain.mjs";
2
+ import { getBalance, resolveName } from "./chain.mjs";
3
+ import { sendTransaction } from "./send-transaction.mjs";
3
4
  import { buildTxAsync, unpackTx } from "./tx/builder/index.mjs";
4
5
  import { ArgumentError } from "./utils/errors.mjs";
5
6
  import { Tag } from "./tx/builder/constants.mjs";
@@ -13,6 +14,7 @@ import { Tag } from "./tx/builder/constants.mjs";
13
14
  */
14
15
  export async function spend(amount, recipientIdOrName, options) {
15
16
  return sendTransaction(await buildTxAsync({
17
+ _isInternalBuild: true,
16
18
  ...options,
17
19
  tag: Tag.SpendTx,
18
20
  senderId: options.onAccount.address,
@@ -51,6 +53,7 @@ recipientIdOrName, options) {
51
53
  const {
52
54
  fee
53
55
  } = unpackTx(await buildTxAsync({
56
+ _isInternalBuild: true,
54
57
  ...options,
55
58
  tag: Tag.SpendTx,
56
59
  senderId,
@@ -60,6 +63,7 @@ recipientIdOrName, options) {
60
63
  // Reducing of the amount may reduce transaction fee, so this is not completely accurate
61
64
  const amount = desiredAmount.plus(fee).gt(balance) ? balance.minus(fee) : desiredAmount;
62
65
  return sendTransaction(await buildTxAsync({
66
+ _isInternalBuild: true,
63
67
  ...options,
64
68
  tag: Tag.SpendTx,
65
69
  senderId,
@@ -76,6 +80,7 @@ recipientIdOrName, options) {
76
80
  */
77
81
  export async function payForTransaction(transaction, options) {
78
82
  return sendTransaction(await buildTxAsync({
83
+ _isInternalBuild: true,
79
84
  ...options,
80
85
  tag: Tag.PayingForTx,
81
86
  payerId: options.onAccount.address,
package/es/spend.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"spend.mjs","names":["BigNumber","sendTransaction","getBalance","resolveName","buildTxAsync","unpackTx","ArgumentError","Tag","spend","amount","recipientIdOrName","options","tag","SpendTx","senderId","onAccount","address","recipientId","transferFunds","fraction","balance","bind","desiredAmount","times","integerValue","ROUND_HALF_UP","fee","plus","gt","minus","payForTransaction","transaction","PayingForTx","payerId","tx"],"sources":["../src/spend.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport {\n sendTransaction, getBalance, resolveName, SendTransactionOptions,\n} from './chain';\nimport { buildTxAsync, BuildTxOptions, 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 * 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 sendTransaction> {\n return sendTransaction(\n await buildTxAsync({\n ...options,\n tag: Tag.SpendTx,\n senderId: options.onAccount.address,\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 } & SendTransactionOptions;\ninterface SpendOptions extends SpendOptionsType {}\n\n// TODO: Rename to spendFraction\n/**\n * Spend a fraction of coin balance to another account. Useful if needed to drain account balance\n * completely, sending funds to another account (with fraction set to 1).\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 * @example\n * ```js\n * // `fraction` * 100 = % of AE to be transferred (e.g. `0.42` for 42% or `1` for 100%)\n * const { blockHeight } = await aeSdk.transferFunds(\n * 0.42,\n * 'ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E',\n * );\n * console.log('Transaction mined at', blockHeight);\n * ```\n */\nexport async function transferFunds(\n fraction: number | string, // TODO: accept only number\n recipientIdOrName: AensName | Encoded.AccountAddress,\n options: TransferFundsOptions,\n): ReturnType<typeof sendTransaction> {\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 = options.onAccount.address;\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 { fee } = unpackTx(\n await buildTxAsync({\n ...options, tag: Tag.SpendTx, 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 sendTransaction(\n await buildTxAsync({\n ...options, tag: Tag.SpendTx, senderId, recipientId, amount,\n }),\n options,\n );\n}\n\ntype TransferFundsOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'>\n& Parameters<typeof resolveName>[2] & { onAccount: AccountBase } & SendTransactionOptions;\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 sendTransaction> {\n return sendTransaction(\n await buildTxAsync({\n ...options, tag: Tag.PayingForTx, payerId: options.onAccount.address, tx: transaction,\n }),\n options,\n );\n}\n\ninterface PayForTransactionOptions extends\n BuildTxOptions<Tag.PayingForTx, 'payerId' | 'tx' | 'onNode'>, SendTransactionOptions {\n onAccount: AccountBase;\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAEnCC,eAAe,EAAEC,UAAU,EAAEC,WAAW;AAAA,SAEjCC,YAAY,EAAkBC,QAAQ;AAAA,SACtCC,aAAa;AAAA,SAEbC,GAAG;AAGZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,KAAKA,CACzBC,MAAuB,EACvBC,iBAAoD,EACpDC,OAAqB,EACe;EACpC,OAAOV,eAAe,CACpB,MAAMG,YAAY,CAAC;IACjB,GAAGO,OAAO;IACVC,GAAG,EAAEL,GAAG,CAACM,OAAO;IAChBC,QAAQ,EAAEH,OAAO,CAACI,SAAS,CAACC,OAAO;IACnCC,WAAW,EAAE,MAAMd,WAAW,CAC5BO,iBAAiB,EACjB,gBAAgB,EAChBC,OACF,CAAC;IACDF;EACF,CAAC,CAAC,EACFE,OACF,CAAC;AACH;AAMA;AACA;AACA;AACA;A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EACFE,OACF,CAAC;AACH;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAemB,iBAAiBA,CACrCC,WAAgC,EAChCpB,OAAiC,EACG;EACpC,OAAOV,eAAe,CACpB,MAAMG,YAAY,CAAC;IACjB,GAAGO,OAAO;IAAEC,GAAG,EAAEL,GAAG,CAACyB,WAAW;IAAEC,OAAO,EAAEtB,OAAO,CAACI,SAAS,CAACC,OAAO;IAAEkB,EAAE,EAAEH;EAC5E,CAAC,CAAC,EACFpB,OACF,CAAC;AACH"}
1
+ {"version":3,"file":"spend.mjs","names":["BigNumber","getBalance","resolveName","sendTransaction","buildTxAsync","unpackTx","ArgumentError","Tag","spend","amount","recipientIdOrName","options","_isInternalBuild","tag","SpendTx","senderId","onAccount","address","recipientId","transferFunds","fraction","balance","bind","desiredAmount","times","integerValue","ROUND_HALF_UP","fee","plus","gt","minus","payForTransaction","transaction","PayingForTx","payerId","tx"],"sources":["../src/spend.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { getBalance, resolveName } from './chain';\nimport { sendTransaction, SendTransactionOptions } from './send-transaction';\nimport { buildTxAsync, BuildTxOptions, unpackTx } from './tx/builder';\nimport { ArgumentError } from './utils/errors';\nimport { Encoded } from './utils/encoder';\nimport { Tag, AensName } from './tx/builder/constants';\nimport AccountBase from './account/Base';\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 | Encoded.ContractAddress | AensName,\n options: SpendOptions,\n): ReturnType<typeof sendTransaction> {\n return sendTransaction(\n await buildTxAsync({\n _isInternalBuild: true,\n ...options,\n tag: Tag.SpendTx,\n senderId: options.onAccount.address,\n recipientId: await resolveName(\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 } & SendTransactionOptions;\ninterface SpendOptions extends SpendOptionsType {}\n\n// TODO: Rename to spendFraction\n/**\n * Spend a fraction of coin balance to another account. Useful if needed to drain account balance\n * completely, sending funds to another account (with fraction set to 1).\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 * @example\n * ```js\n * // `fraction` * 100 = % of AE to be transferred (e.g. `0.42` for 42% or `1` for 100%)\n * const { blockHeight } = await aeSdk.transferFunds(\n * 0.42,\n * 'ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E',\n * );\n * console.log('Transaction mined at', blockHeight);\n * ```\n */\nexport async function transferFunds(\n fraction: number | string, // TODO: accept only number\n recipientIdOrName: AensName | Encoded.AccountAddress | Encoded.ContractAddress,\n options: TransferFundsOptions,\n): ReturnType<typeof sendTransaction> {\n if (+fraction < 0 || +fraction > 1) {\n throw new ArgumentError('fraction', 'a number between 0 and 1', fraction);\n }\n const recipientId = await resolveName(\n recipientIdOrName,\n 'account_pubkey',\n options,\n );\n const senderId = options.onAccount.address;\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 { fee } = unpackTx(\n await buildTxAsync({\n _isInternalBuild: true,\n ...options,\n tag: Tag.SpendTx,\n senderId,\n recipientId,\n 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 sendTransaction(\n await buildTxAsync({\n _isInternalBuild: true,\n ...options,\n tag: Tag.SpendTx,\n senderId,\n recipientId,\n amount,\n }),\n options,\n );\n}\n\ntype TransferFundsOptionsType = BuildTxOptions<Tag.SpendTx, 'senderId' | 'recipientId' | 'amount'>\n& Parameters<typeof resolveName>[2] & { onAccount: AccountBase } & SendTransactionOptions;\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 sendTransaction> {\n return sendTransaction(\n await buildTxAsync({\n _isInternalBuild: true,\n ...options,\n tag: Tag.PayingForTx,\n payerId: options.onAccount.address,\n tx: transaction,\n }),\n options,\n );\n}\n\ninterface PayForTransactionOptions extends\n BuildTxOptions<Tag.PayingForTx, 'payerId' | 'tx' | 'onNode'>, SendTransactionOptions {\n onAccount: AccountBase;\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,UAAU,EAAEC,WAAW;AAAA,SACvBC,eAAe;AAAA,SACfC,YAAY,EAAkBC,QAAQ;AAAA,SACtCC,aAAa;AAAA,SAEbC,GAAG;AAGZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,KAAKA,CACzBC,MAAuB,EACvBC,iBAA8E,EAC9EC,OAAqB,EACe;EACpC,OAAOR,eAAe,CACpB,MAAMC,YAAY,CAAC;IACjBQ,gBAAgB,EAAE,IAAI;IACtB,GAAGD,OAAO;IACVE,GAAG,EAAEN,GAAG,CAACO,OAAO;IAChBC,QAAQ,EAAEJ,OAAO,CAACK,SAAS,CAACC,OAAO;IACnCC,WAAW,EAAE,MAAMhB,WAAW,CAC5BQ,iBAAiB,EACjB,gBAAgB,EAChBC,OACF,CAAC;IACDF;EACF,CAAC,CAAC,EACFE,OACF,CAAC;AACH;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeQ,aAAaA,CACjCC,QAAyB;AAAE;AA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,OAAO,eAAeoB,iBAAiBA,CACrCC,WAAgC,EAChCrB,OAAiC,EACG;EACpC,OAAOR,eAAe,CACpB,MAAMC,YAAY,CAAC;IACjBQ,gBAAgB,EAAE,IAAI;IACtB,GAAGD,OAAO;IACVE,GAAG,EAAEN,GAAG,CAAC0B,WAAW;IACpBC,OAAO,EAAEvB,OAAO,CAACK,SAAS,CAACC,OAAO;IAClCkB,EAAE,EAAEH;EACN,CAAC,CAAC,EACFrB,OACF,CAAC;AACH"}
@@ -0,0 +1,29 @@
1
+ import { Field } from './field-types';
2
+ import { Encoding, Encoded } from '../../utils/encoder';
3
+ type Schemas = ReadonlyArray<{
4
+ tag: {
5
+ constValue: number;
6
+ } & Field;
7
+ version: {
8
+ constValue: number;
9
+ constValueOptional: boolean;
10
+ } & Field;
11
+ }>;
12
+ export declare function getSchema(schemas: Schemas, Tag: {
13
+ [key: number]: string;
14
+ }, tag: number, version: number | undefined): Array<[string, Field]>;
15
+ export declare function packRecord<E extends Encoding>(schemas: Schemas, Tag: {
16
+ [key: number]: string;
17
+ }, params: {
18
+ tag: number;
19
+ version?: number;
20
+ [k: string]: unknown;
21
+ }, extraParams: {
22
+ [k: string]: unknown;
23
+ }, encoding: E): Encoded.Generic<E>;
24
+ export declare function unpackRecord(schemas: Schemas, Tag: {
25
+ [key: number]: string;
26
+ }, encodedRecord: Encoded.Any, expectedTag: number | undefined, extraParams: {
27
+ [k: string]: unknown;
28
+ }): unknown;
29
+ export {};
@@ -0,0 +1,42 @@
1
+ import _rlp from 'rlp';
2
+ const {
3
+ decode: rlpDecode,
4
+ encode: rlpEncode
5
+ } = _rlp;
6
+ import { ArgumentError, DecodeError, SchemaNotFoundError, InternalError } from "../../utils/errors.mjs";
7
+ import { encode, decode } from "../../utils/encoder.mjs";
8
+ import { readInt } from "./helpers.mjs";
9
+ export function getSchema(schemas, Tag, tag, version) {
10
+ const subSchemas = schemas.filter(s => s.tag.constValue === tag);
11
+ if (subSchemas.length === 0) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, 0);
12
+ if (version == null) {
13
+ const defaultSchema = subSchemas.find(schema => schema.version.constValueOptional);
14
+ if (defaultSchema == null) throw new InternalError(`Can't find default schema of ${Tag[tag]} (${tag})`);
15
+ version = defaultSchema.version.constValue;
16
+ }
17
+ const schema = subSchemas.find(s => s.version.constValue === version);
18
+ if (schema == null) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, version);
19
+ return Object.entries(schema);
20
+ }
21
+ export function packRecord(schemas, Tag, params, extraParams, encoding) {
22
+ const schema = getSchema(schemas, Tag, params.tag, params.version);
23
+ const binary = schema.map(([key, field]) => field.serialize(params[key], {
24
+ ...params,
25
+ ...extraParams
26
+ }, params));
27
+ return encode(rlpEncode(binary), encoding);
28
+ }
29
+ export function unpackRecord(schemas, Tag, encodedRecord, expectedTag, extraParams) {
30
+ const binary = rlpDecode(decode(encodedRecord));
31
+ const tag = +readInt(binary[0]);
32
+ const version = +readInt(binary[1]);
33
+ const schema = getSchema(schemas, Tag, tag, version);
34
+ if (expectedTag != null && expectedTag !== tag) {
35
+ throw new DecodeError(`Expected ${Tag[expectedTag]} tag, got ${Tag[tag]} instead`);
36
+ }
37
+ if (binary.length !== schema.length) {
38
+ throw new ArgumentError('RLP length', schema.length, binary.length);
39
+ }
40
+ return Object.fromEntries(schema.map(([name, field], index) => [name, field.deserialize(binary[index], extraParams)]));
41
+ }
42
+ //# sourceMappingURL=common.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.mjs","names":["_rlp","decode","rlpDecode","encode","rlpEncode","ArgumentError","DecodeError","SchemaNotFoundError","InternalError","readInt","getSchema","schemas","Tag","tag","version","subSchemas","filter","s","constValue","length","defaultSchema","find","schema","constValueOptional","Object","entries","packRecord","params","extraParams","encoding","binary","map","key","field","serialize","unpackRecord","encodedRecord","expectedTag","fromEntries","name","index","deserialize"],"sources":["../../../src/tx/builder/common.ts"],"sourcesContent":["import { decode as rlpDecode, encode as rlpEncode } from 'rlp';\nimport { Field, BinaryData } from './field-types';\nimport {\n ArgumentError, DecodeError, SchemaNotFoundError, InternalError,\n} from '../../utils/errors';\nimport {\n Encoding, Encoded, encode, decode,\n} from '../../utils/encoder';\nimport { readInt } from './helpers';\n\ntype Schemas = ReadonlyArray<{\n tag: { constValue: number } & Field;\n version: { constValue: number; constValueOptional: boolean } & Field;\n}>;\n\nexport function getSchema(\n schemas: Schemas,\n Tag: { [key: number]: string },\n tag: number,\n version: number | undefined,\n): Array<[string, Field]> {\n const subSchemas = schemas.filter((s) => s.tag.constValue === tag);\n if (subSchemas.length === 0) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, 0);\n if (version == null) {\n const defaultSchema = subSchemas.find((schema) => schema.version.constValueOptional);\n if (defaultSchema == null) throw new InternalError(`Can't find default schema of ${Tag[tag]} (${tag})`);\n version = defaultSchema.version.constValue;\n }\n const schema = subSchemas.find((s) => s.version.constValue === version);\n if (schema == null) throw new SchemaNotFoundError(`${Tag[tag]} (${tag})`, version);\n return Object.entries(schema);\n}\n\nexport function packRecord<E extends Encoding>(\n schemas: Schemas,\n Tag: { [key: number]: string },\n params: {\n tag: number;\n version?: number;\n [k: string]: unknown;\n },\n extraParams: { [k: string]: unknown },\n encoding: E,\n): Encoded.Generic<E> {\n const schema = getSchema(schemas, Tag, params.tag, params.version);\n const binary = schema.map(([key, field]) => (\n field.serialize(params[key], { ...params, ...extraParams }, params)\n ));\n return encode(rlpEncode(binary), encoding);\n}\n\nexport function unpackRecord(\n schemas: Schemas,\n Tag: { [key: number]: string },\n encodedRecord: Encoded.Any,\n expectedTag: number | undefined,\n extraParams: { [k: string]: unknown },\n): unknown {\n const binary = rlpDecode(decode(encodedRecord));\n const tag = +readInt(binary[0] as Buffer);\n const version = +readInt(binary[1] as Buffer);\n const schema = getSchema(schemas, Tag, tag, version);\n if (expectedTag != null && expectedTag !== tag) {\n throw new DecodeError(`Expected ${Tag[expectedTag]} tag, got ${Tag[tag]} instead`);\n }\n if (binary.length !== schema.length) {\n throw new ArgumentError('RLP length', schema.length, binary.length);\n }\n return Object.fromEntries(\n schema.map(([name, field], index) => [\n name, field.deserialize(binary[index] as BinaryData, extraParams),\n ]),\n );\n}\n"],"mappings":"AAAA,OAAAA,IAAA,MAAyD,KAAK;AAAC;EAAAC,MAAA,EAAAC,SAAA;EAAAC,MAAA,EAAAC;AAAA,IAAAJ,IAAA;AAAA,SAG7DK,aAAa,EAAEC,WAAW,EAAEC,mBAAmB,EAAEC,aAAa;AAAA,SAG3CL,MAAM,EAAEF,MAAM;AAAA,SAE1BQ,OAAO;AAOhB,OAAO,SAASC,SAASA,CACvBC,OAAgB,EAChBC,GAA8B,EAC9BC,GAAW,EACXC,OAA2B,EACH;EACxB,MAAMC,UAAU,GAAGJ,OAAO,CAACK,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACJ,GAAG,CAACK,UAAU,KAAKL,GAAG,CAAC;EAClE,IAAIE,UAAU,CAACI,MAAM,KAAK,CAAC,EAAE,MAAM,IAAIZ,mBAAmB,CAAE,GAAEK,GAAG,CAACC,GAAG,CAAE,KAAIA,GAAI,GAAE,EAAE,CAAC,CAAC;EACrF,IAAIC,OAAO,IAAI,IAAI,EAAE;IACnB,MAAMM,aAAa,GAAGL,UAAU,CAACM,IAAI,CAAEC,MAAM,IAAKA,MAAM,CAACR,OAAO,CAACS,kBAAkB,CAAC;IACpF,IAAIH,aAAa,IAAI,IAAI,EAAE,MAAM,IAAIZ,aAAa,CAAE,gCAA+BI,GAAG,CAACC,GAAG,CAAE,KAAIA,GAAI,GAAE,CAAC;IACvGC,OAAO,GAAGM,aAAa,CAACN,OAAO,CAACI,UAAU;EAC5C;EACA,MAAMI,MAAM,GAAGP,UAAU,CAACM,IAAI,CAAEJ,CAAC,IAAKA,CAAC,CAACH,OAAO,CAACI,UAAU,KAAKJ,OAAO,CAAC;EACvE,IAAIQ,MAAM,IAAI,IAAI,EAAE,MAAM,IAAIf,mBAAmB,CAAE,GAAEK,GAAG,CAACC,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,IAAIiB,MAAM,CAACX,MAAM,KAAKG,MAAM,CAACH,MAAM,EAAE;IACnC,MAAM,IAAId,aAAa,CAAC,YAAY,EAAEiB,MAAM,CAACH,MAAM,EAAEW,MAAM,CAACX,MAAM,CAAC;EACrE;EACA,OAAOK,MAAM,CAACc,WAAW,CACvBhB,MAAM,CAACS,GAAG,CAAC,CAAC,CAACQ,IAAI,EAAEN,KAAK,CAAC,EAAEO,KAAK,KAAK,CACnCD,IAAI,EAAEN,KAAK,CAACQ,WAAW,CAACX,MAAM,CAACU,KAAK,CAAC,EAAgBZ,WAAW,CAAC,CAClE,CACH,CAAC;AACH"}
@@ -1,11 +1,11 @@
1
1
  import BigNumber from 'bignumber.js';
2
+ export declare const DRY_RUN_ACCOUNT: {
3
+ readonly pub: "ak_11111111111111111111111111111111273Yts";
4
+ readonly amount: 100000000000000000000000000000000000n;
5
+ };
2
6
  export declare const MAX_AUTH_FUN_GAS = 50000;
3
7
  export type Int = number | string | BigNumber;
4
8
  export type AensName = `${string}.chain`;
5
- export declare const NAME_TTL = 180000;
6
- export declare const NAME_MAX_TTL = 36000;
7
- export declare const NAME_MAX_CLIENT_TTL = 84600;
8
- export declare const CLIENT_TTL = 84600;
9
9
  export declare const MIN_GAS_PRICE = 1000000000;
10
10
  export declare const NAME_FEE_MULTIPLIER = 100000000000000;
11
11
  export declare const NAME_FEE_BID_INCREMENT = 0.05;
@@ -1,17 +1,11 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { mapObject } from "../../utils/other.mjs";
3
+ export const DRY_RUN_ACCOUNT = {
4
+ pub: 'ak_11111111111111111111111111111111273Yts',
5
+ amount: 100000000000000000000000000000000000n
6
+ };
3
7
  export const MAX_AUTH_FUN_GAS = 50000;
4
-
5
- // # AENS
6
-
7
- export const NAME_TTL = 180000;
8
- // # max number of block into the future that the name is going to be available
9
- // # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update
10
- // # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry
11
- export const NAME_MAX_TTL = 36000;
12
- export const NAME_MAX_CLIENT_TTL = 84600;
13
- export const CLIENT_TTL = NAME_MAX_CLIENT_TTL;
14
- export const MIN_GAS_PRICE = 1e9;
8
+ export const MIN_GAS_PRICE = 1e9; // TODO: don't use number for ae
15
9
  // # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67
16
10
  export const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000
17
11
  export const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage
@@ -54,10 +48,7 @@ export const NAME_BID_RANGES = mapObject({
54
48
  3: 2178309,
55
49
  2: 3524578,
56
50
  1: 5702887
57
- }, _ref => {
58
- let [key, value] = _ref;
59
- return [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)];
60
- });
51
+ }, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);
61
52
  export let ConsensusProtocolVersion = /*#__PURE__*/function (ConsensusProtocolVersion) {
62
53
  ConsensusProtocolVersion[ConsensusProtocolVersion["Iris"] = 5] = "Iris";
63
54
  ConsensusProtocolVersion[ConsensusProtocolVersion["Ceres"] = 6] = "Ceres";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","MAX_AUTH_FUN_GAS","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_RANGES","_ref","key","value","times","ConsensusProtocolVersion","VmVersion","AbiVersion","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\nexport const MAX_AUTH_FUN_GAS = 50000;\nexport type Int = number | string | BigNumber;\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;\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\nexport enum ConsensusProtocolVersion {\n Iris = 5,\n Ceres = 6,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum VmVersion {\n NoVm = 0,\n Sophia = 1,\n SophiaImprovementsMinerva = 3,\n SophiaImprovementsFortuna = 4,\n Fate = 5,\n SophiaImprovementsLima = 6,\n Fate2 = 7,\n Fate3 = 8,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum AbiVersion {\n NoAbi = 0,\n Sophia = 1,\n Fate = 3,\n}\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 GaMetaTxAuthData = 810,\n // KeyBlock = 100,\n // MicroBlock = 101,\n // LightMicroBlock = 102,\n // Pof = 200,\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,SAAS;AAElB,OAAO,MAAMC,gBAAgB,GAAG,KAAK;;AAErC;;AAEA,OAAO,MAAMC,QAAQ,GAAG,MAAM;AAC9B;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG,KAAK;AACjC,OAAO,MAAMC,mBAAmB,GAAG,KAAK;AACxC,OAAO,MAAMC,UAAU,GAAGD,mBAAmB;AAC7C,OAAO,MAAME,aAAa,GAAG,GAAG;AAChC;AACA,OAAO,MAAMC,mBAAmB,GAAG,IAAI,CAAC,CAAC;AACzC,OAAO,MAAMC,sBAAsB,GAAG,IAAI,CAAC,CAAC;AAC5C;AACA,OAAO,MAAMC,uBAAuB,GAAG,GAAG,CAAC,CAAC;AAC5C;AACA,OAAO,MAAMC,mBAAmB,GAAG,EAAE;AACrC;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAGX,SAAS,CAAC;EACvC,EAAE,EAAE,CAAC;EACL,EAAE,EAAE,CAAC;EACL,EAAE,EAA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CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAA,OAAHA,GAAG;AAAA,OAyDb;AACA;AACA;AACA"}
1
+ {"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","DRY_RUN_ACCOUNT","pub","amount","MAX_AUTH_FUN_GAS","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_RANGES","key","value","times","ConsensusProtocolVersion","VmVersion","AbiVersion","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\nexport const DRY_RUN_ACCOUNT = {\n pub: 'ak_11111111111111111111111111111111273Yts',\n amount: 100000000000000000000000000000000000n,\n} as const;\n\nexport const MAX_AUTH_FUN_GAS = 50000;\nexport type Int = number | string | BigNumber;\nexport type AensName = `${string}.chain`;\nexport const MIN_GAS_PRICE = 1e9; // TODO: don't use number for ae\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;\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\nexport enum ConsensusProtocolVersion {\n Iris = 5,\n Ceres = 6,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum VmVersion {\n NoVm = 0,\n Sophia = 1,\n SophiaImprovementsMinerva = 3,\n SophiaImprovementsFortuna = 4,\n Fate = 5,\n SophiaImprovementsLima = 6,\n Fate2 = 7,\n Fate3 = 8,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum AbiVersion {\n NoAbi = 0,\n Sophia = 1,\n Fate = 3,\n}\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 GaMetaTxAuthData = 810,\n // KeyBlock = 100,\n // MicroBlock = 101,\n // LightMicroBlock = 102,\n // Pof = 200,\n}\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,SAAS;AAElB,OAAO,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G;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAHA,GAAG,CAAHA,GAAG;EAAA,OAAHA,GAAG;AAAA,OAyDb;AACA;AACA;AACA"}
@@ -0,0 +1,20 @@
1
+ import { Encoded } from '../../../utils/encoder';
2
+ import { DelegationTag } from './schema';
3
+ import { DlgParams, DlgUnpacked } from './schema.generated';
4
+ /**
5
+ * Pack delegation
6
+ * @category delegation signature
7
+ * @param params - Params of delegation
8
+ * @returns Encoded delegation
9
+ */
10
+ export declare function packDelegation(params: DlgParams): Encoded.Bytearray;
11
+ /**
12
+ * Unpack delegation
13
+ * @category delegation signature
14
+ * @param encoded - Encoded delegation
15
+ * @param expectedTag - Expected delegation signature type
16
+ * @returns Params of delegation
17
+ */
18
+ export declare function unpackDelegation<T extends DelegationTag>(encoded: Encoded.Bytearray, expectedTag?: T): DlgUnpacked & {
19
+ tag: T;
20
+ };
@@ -0,0 +1,24 @@
1
+ import { Encoding } from "../../../utils/encoder.mjs";
2
+ import { packRecord, unpackRecord } from "../common.mjs";
3
+ import { DelegationTag, schemas } from "./schema.mjs";
4
+ /**
5
+ * Pack delegation
6
+ * @category delegation signature
7
+ * @param params - Params of delegation
8
+ * @returns Encoded delegation
9
+ */
10
+ export function packDelegation(params) {
11
+ return packRecord(schemas, DelegationTag, params, {}, Encoding.Bytearray);
12
+ }
13
+
14
+ /**
15
+ * Unpack delegation
16
+ * @category delegation signature
17
+ * @param encoded - Encoded delegation
18
+ * @param expectedTag - Expected delegation signature type
19
+ * @returns Params of delegation
20
+ */
21
+ export function unpackDelegation(encoded, expectedTag) {
22
+ return unpackRecord(schemas, DelegationTag, encoded, expectedTag, {});
23
+ }
24
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["Encoding","packRecord","unpackRecord","DelegationTag","schemas","packDelegation","params","Bytearray","unpackDelegation","encoded","expectedTag"],"sources":["../../../../src/tx/builder/delegation/index.ts"],"sourcesContent":["import { Encoded, Encoding } from '../../../utils/encoder';\nimport { packRecord, unpackRecord } from '../common';\nimport { DelegationTag, schemas } from './schema';\nimport { DlgParams, DlgUnpacked } from './schema.generated';\n\n/**\n * Pack delegation\n * @category delegation signature\n * @param params - Params of delegation\n * @returns Encoded delegation\n */\nexport function packDelegation(params: DlgParams): Encoded.Bytearray {\n return packRecord(schemas, DelegationTag, params, {}, Encoding.Bytearray);\n}\n\n/**\n * Unpack delegation\n * @category delegation signature\n * @param encoded - Encoded delegation\n * @param expectedTag - Expected delegation signature type\n * @returns Params of delegation\n */\nexport function unpackDelegation<T extends DelegationTag>(\n encoded: Encoded.Bytearray,\n expectedTag?: T,\n): DlgUnpacked & { tag: T } {\n return unpackRecord(schemas, DelegationTag, encoded, expectedTag, {}) as any;\n}\n"],"mappings":"SAAkBA,QAAQ;AAAA,SACjBC,UAAU,EAAEC,YAAY;AAAA,SACxBC,aAAa,EAAEC,OAAO;AAG/B;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,MAAiB,EAAqB;EACnE,OAAOL,UAAU,CAACG,OAAO,EAAED,aAAa,EAAEG,MAAM,EAAE,CAAC,CAAC,EAAEN,QAAQ,CAACO,SAAS,CAAC;AAC3E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,OAA0B,EAC1BC,WAAe,EACW;EAC1B,OAAOR,YAAY,CAACE,OAAO,EAAED,aAAa,EAAEM,OAAO,EAAEC,WAAW,EAAE,CAAC,CAAC,CAAC;AACvE"}
@@ -0,0 +1,130 @@
1
+ /// <reference types="node" />
2
+ import SchemaTypes from '../SchemaTypes';
3
+ import { Encoded } from '../../../utils/encoder';
4
+ /**
5
+ * @category delegation signature
6
+ */
7
+ export declare enum DelegationTag {
8
+ AensWildcard = 1,
9
+ AensName = 2,
10
+ AensPreclaim = 3,
11
+ Oracle = 4,
12
+ OracleResponse = 5
13
+ }
14
+ /**
15
+ * @see {@link https://github.com/aeternity/protocol/blob/8a9d1d1206174627f6aaef86159dc9c643080653/contracts/fate.md#from-ceres-serialized-signature-data}
16
+ */
17
+ export declare const schemas: readonly [{
18
+ readonly tag: {
19
+ serialize: (value: DelegationTag.AensWildcard) => Buffer;
20
+ deserialize: (value: Buffer) => DelegationTag.AensWildcard;
21
+ constValue: DelegationTag.AensWildcard;
22
+ constValueOptional: boolean;
23
+ };
24
+ readonly version: {
25
+ serialize: (value?: 1 | undefined) => Buffer;
26
+ deserialize: (value: Buffer) => 1;
27
+ constValue: 1;
28
+ constValueOptional: boolean;
29
+ };
30
+ readonly accountAddress: {
31
+ serialize: (value: `ak_${string}`) => Buffer;
32
+ deserialize: (value: Buffer) => `ak_${string}`;
33
+ };
34
+ readonly contractAddress: {
35
+ serialize: (value: `ct_${string}`) => Buffer;
36
+ deserialize: (value: Buffer) => `ct_${string}`;
37
+ };
38
+ }, {
39
+ readonly tag: {
40
+ serialize: (value: DelegationTag.AensName) => Buffer;
41
+ deserialize: (value: Buffer) => DelegationTag.AensName;
42
+ constValue: DelegationTag.AensName;
43
+ constValueOptional: boolean;
44
+ };
45
+ readonly version: {
46
+ serialize: (value?: 1 | undefined) => Buffer;
47
+ deserialize: (value: Buffer) => 1;
48
+ constValue: 1;
49
+ constValueOptional: boolean;
50
+ };
51
+ readonly accountAddress: {
52
+ serialize: (value: `ak_${string}`) => Buffer;
53
+ deserialize: (value: Buffer) => `ak_${string}`;
54
+ };
55
+ readonly nameId: {
56
+ serialize(value: `${string}.chain` | `nm_${string}`): Buffer;
57
+ deserialize: (value: Buffer) => `nm_${string}`;
58
+ };
59
+ readonly contractAddress: {
60
+ serialize: (value: `ct_${string}`) => Buffer;
61
+ deserialize: (value: Buffer) => `ct_${string}`;
62
+ };
63
+ }, {
64
+ readonly tag: {
65
+ serialize: (value: DelegationTag.AensPreclaim) => Buffer;
66
+ deserialize: (value: Buffer) => DelegationTag.AensPreclaim;
67
+ constValue: DelegationTag.AensPreclaim;
68
+ constValueOptional: boolean;
69
+ };
70
+ readonly version: {
71
+ serialize: (value?: 1 | undefined) => Buffer;
72
+ deserialize: (value: Buffer) => 1;
73
+ constValue: 1;
74
+ constValueOptional: boolean;
75
+ };
76
+ readonly accountAddress: {
77
+ serialize: (value: `ak_${string}`) => Buffer;
78
+ deserialize: (value: Buffer) => `ak_${string}`;
79
+ };
80
+ readonly contractAddress: {
81
+ serialize: (value: `ct_${string}`) => Buffer;
82
+ deserialize: (value: Buffer) => `ct_${string}`;
83
+ };
84
+ }, {
85
+ readonly tag: {
86
+ serialize: (value: DelegationTag.Oracle) => Buffer;
87
+ deserialize: (value: Buffer) => DelegationTag.Oracle;
88
+ constValue: DelegationTag.Oracle;
89
+ constValueOptional: boolean;
90
+ };
91
+ readonly version: {
92
+ serialize: (value?: 1 | undefined) => Buffer;
93
+ deserialize: (value: Buffer) => 1;
94
+ constValue: 1;
95
+ constValueOptional: boolean;
96
+ };
97
+ readonly accountAddress: {
98
+ serialize: (value: `ak_${string}`) => Buffer;
99
+ deserialize: (value: Buffer) => `ak_${string}`;
100
+ };
101
+ readonly contractAddress: {
102
+ serialize: (value: `ct_${string}`) => Buffer;
103
+ deserialize: (value: Buffer) => `ct_${string}`;
104
+ };
105
+ }, {
106
+ readonly tag: {
107
+ serialize: (value: DelegationTag.OracleResponse) => Buffer;
108
+ deserialize: (value: Buffer) => DelegationTag.OracleResponse;
109
+ constValue: DelegationTag.OracleResponse;
110
+ constValueOptional: boolean;
111
+ };
112
+ readonly version: {
113
+ serialize: (value?: 1 | undefined) => Buffer;
114
+ deserialize: (value: Buffer) => 1;
115
+ constValue: 1;
116
+ constValueOptional: boolean;
117
+ };
118
+ readonly queryId: {
119
+ readonly serialize: (value: Encoded.OracleQueryId) => Buffer;
120
+ readonly deserialize: (value: Buffer) => Encoded.OracleQueryId;
121
+ };
122
+ readonly contractAddress: {
123
+ serialize: (value: `ct_${string}`) => Buffer;
124
+ deserialize: (value: Buffer) => `ct_${string}`;
125
+ };
126
+ }];
127
+ type Schemas = SchemaTypes<typeof schemas>;
128
+ export type DlgParams = Schemas['TxParams'];
129
+ export type DlgUnpacked = Schemas['TxUnpacked'];
130
+ export {};