@aeternity/aepp-sdk 13.2.1 → 13.3.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 (509) 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 +7288 -9464
  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.d.ts +1 -1
  26. package/es/Middleware.mjs +32 -28
  27. package/es/Middleware.mjs.map +1 -1
  28. package/es/MiddlewareSubscriber.mjs +5 -14
  29. package/es/MiddlewareSubscriber.mjs.map +1 -1
  30. package/es/Node.d.ts +11 -3
  31. package/es/Node.mjs +65 -57
  32. package/es/Node.mjs.map +1 -1
  33. package/es/account/Base.d.ts +39 -3
  34. package/es/account/Base.mjs +35 -1
  35. package/es/account/Base.mjs.map +1 -1
  36. package/es/account/Generalized.d.ts +2 -0
  37. package/es/account/Generalized.mjs +15 -6
  38. package/es/account/Generalized.mjs.map +1 -1
  39. package/es/account/Ledger.d.ts +2 -0
  40. package/es/account/Ledger.mjs +14 -5
  41. package/es/account/Ledger.mjs.map +1 -1
  42. package/es/account/LedgerFactory.mjs +4 -6
  43. package/es/account/LedgerFactory.mjs.map +1 -1
  44. package/es/account/Memory.d.ts +15 -4
  45. package/es/account/Memory.mjs +96 -31
  46. package/es/account/Memory.mjs.map +1 -1
  47. package/es/account/Rpc.d.ts +16 -5
  48. package/es/account/Rpc.mjs +94 -21
  49. package/es/account/Rpc.mjs.map +1 -1
  50. package/es/aens.d.ts +17 -44
  51. package/es/aens.mjs +32 -71
  52. package/es/aens.mjs.map +1 -1
  53. package/es/aepp-wallet-communication/connection/Browser.mjs +3 -4
  54. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  55. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
  56. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +7 -5
  57. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  58. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +8 -9
  59. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  60. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +7 -7
  61. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  62. package/es/aepp-wallet-communication/rpc/types.d.ts +14 -0
  63. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  64. package/es/aepp-wallet-communication/schema.d.ts +2 -0
  65. package/es/aepp-wallet-communication/schema.mjs +2 -0
  66. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  67. package/es/aepp-wallet-communication/wallet-detector.d.ts +2 -5
  68. package/es/aepp-wallet-communication/wallet-detector.mjs +13 -9
  69. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  70. package/es/apis/compiler/compiler.mjs.map +1 -1
  71. package/es/apis/compiler/models/index.d.ts +1 -0
  72. package/es/apis/compiler/models/index.mjs.map +1 -1
  73. package/es/apis/compiler/models/mappers.mjs +13 -0
  74. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  75. package/es/apis/compiler/models/parameters.mjs.map +1 -1
  76. package/es/apis/middleware/middleware.d.ts +23 -5
  77. package/es/apis/middleware/middleware.mjs +114 -18
  78. package/es/apis/middleware/middleware.mjs.map +1 -1
  79. package/es/apis/middleware/models/index.d.ts +164 -15
  80. package/es/apis/middleware/models/index.mjs +53 -3
  81. package/es/apis/middleware/models/index.mjs.map +1 -1
  82. package/es/apis/middleware/models/mappers.d.ts +8 -1
  83. package/es/apis/middleware/models/mappers.mjs +376 -3
  84. package/es/apis/middleware/models/mappers.mjs.map +1 -1
  85. package/es/apis/middleware/models/parameters.d.ts +6 -3
  86. package/es/apis/middleware/models/parameters.mjs +38 -11
  87. package/es/apis/middleware/models/parameters.mjs.map +1 -1
  88. package/es/apis/node/models/index.d.ts +66 -2
  89. package/es/apis/node/models/index.mjs.map +1 -1
  90. package/es/apis/node/models/mappers.d.ts +5 -1
  91. package/es/apis/node/models/mappers.mjs +229 -7
  92. package/es/apis/node/models/mappers.mjs.map +1 -1
  93. package/es/apis/node/models/parameters.d.ts +2 -2
  94. package/es/apis/node/models/parameters.mjs +2 -2
  95. package/es/apis/node/models/parameters.mjs.map +1 -1
  96. package/es/apis/node/node.d.ts +24 -3
  97. package/es/apis/node/node.mjs +135 -3
  98. package/es/apis/node/node.mjs.map +1 -1
  99. package/es/chain.d.ts +14 -44
  100. package/es/chain.mjs +125 -219
  101. package/es/chain.mjs.map +1 -1
  102. package/es/channel/Base.d.ts +3 -47
  103. package/es/channel/Base.mjs +21 -54
  104. package/es/channel/Base.mjs.map +1 -1
  105. package/es/channel/Contract.d.ts +16 -25
  106. package/es/channel/Contract.mjs +39 -63
  107. package/es/channel/Contract.mjs.map +1 -1
  108. package/es/channel/Spend.d.ts +0 -8
  109. package/es/channel/Spend.mjs +17 -29
  110. package/es/channel/Spend.mjs.map +1 -1
  111. package/es/channel/handlers.mjs +1 -1
  112. package/es/channel/handlers.mjs.map +1 -1
  113. package/es/channel/internal.d.ts +104 -5
  114. package/es/channel/internal.mjs +26 -34
  115. package/es/channel/internal.mjs.map +1 -1
  116. package/es/contract/Contract.d.ts +10 -2
  117. package/es/contract/Contract.mjs +83 -79
  118. package/es/contract/Contract.mjs.map +1 -1
  119. package/es/contract/compiler/Base.d.ts +14 -8
  120. package/es/contract/compiler/Base.mjs.map +1 -1
  121. package/es/contract/compiler/Cli.d.ts +12 -11
  122. package/es/contract/compiler/Cli.mjs +52 -25
  123. package/es/contract/compiler/Cli.mjs.map +1 -1
  124. package/es/contract/compiler/Cli8.d.ts +13 -0
  125. package/es/contract/compiler/Cli8.mjs +22 -0
  126. package/es/contract/compiler/Cli8.mjs.map +1 -0
  127. package/es/contract/compiler/Http.d.ts +3 -9
  128. package/es/contract/compiler/Http.mjs +28 -16
  129. package/es/contract/compiler/Http.mjs.map +1 -1
  130. package/es/contract/compiler/HttpNode.d.ts +2 -5
  131. package/es/contract/compiler/HttpNode.mjs.map +1 -1
  132. package/es/contract/delegation-signature.d.ts +2 -1
  133. package/es/contract/delegation-signature.mjs +18 -14
  134. package/es/contract/delegation-signature.mjs.map +1 -1
  135. package/es/contract/ga.d.ts +1 -2
  136. package/es/contract/ga.mjs +23 -25
  137. package/es/contract/ga.mjs.map +1 -1
  138. package/es/deprecated.d.ts +48 -0
  139. package/es/deprecated.mjs +66 -1
  140. package/es/deprecated.mjs.map +1 -1
  141. package/es/index-browser.d.ts +11 -6
  142. package/es/index-browser.mjs +10 -6
  143. package/es/index-browser.mjs.map +1 -1
  144. package/es/index.d.ts +1 -0
  145. package/es/index.mjs +1 -0
  146. package/es/index.mjs.map +1 -1
  147. package/es/oracle.d.ts +6 -37
  148. package/es/oracle.mjs +32 -66
  149. package/es/oracle.mjs.map +1 -1
  150. package/es/send-transaction.d.ts +53 -0
  151. package/es/send-transaction.mjs +109 -0
  152. package/es/send-transaction.mjs.map +1 -0
  153. package/es/spend.d.ts +4 -3
  154. package/es/spend.mjs +6 -1
  155. package/es/spend.mjs.map +1 -1
  156. package/es/tx/builder/common.d.ts +29 -0
  157. package/es/tx/builder/common.mjs +42 -0
  158. package/es/tx/builder/common.mjs.map +1 -0
  159. package/es/tx/builder/constants.d.ts +6 -5
  160. package/es/tx/builder/constants.mjs +7 -15
  161. package/es/tx/builder/constants.mjs.map +1 -1
  162. package/es/tx/builder/delegation/index.d.ts +20 -0
  163. package/es/tx/builder/delegation/index.mjs +24 -0
  164. package/es/tx/builder/delegation/index.mjs.map +1 -0
  165. package/es/tx/builder/delegation/schema.d.ts +130 -0
  166. package/es/tx/builder/delegation/schema.generated.d.ts +141 -0
  167. package/es/tx/builder/delegation/schema.generated.mjs +2 -0
  168. package/es/tx/builder/delegation/schema.generated.mjs.map +1 -0
  169. package/es/tx/builder/delegation/schema.mjs +54 -0
  170. package/es/tx/builder/delegation/schema.mjs.map +1 -0
  171. package/es/tx/builder/field-types/abi-version.mjs +8 -11
  172. package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
  173. package/es/tx/builder/field-types/address.mjs +1 -4
  174. package/es/tx/builder/field-types/address.mjs.map +1 -1
  175. package/es/tx/builder/field-types/coin-amount.d.ts +2 -2
  176. package/es/tx/builder/field-types/coin-amount.mjs +6 -6
  177. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  178. package/es/tx/builder/field-types/ct-version.d.ts +1 -1
  179. package/es/tx/builder/field-types/ct-version.mjs +4 -5
  180. package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
  181. package/es/tx/builder/field-types/entry.mjs +7 -13
  182. package/es/tx/builder/field-types/entry.mjs.map +1 -1
  183. package/es/tx/builder/field-types/fee.d.ts +19 -11
  184. package/es/tx/builder/field-types/fee.mjs +57 -39
  185. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  186. package/es/tx/builder/field-types/gas-limit.mjs +13 -15
  187. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  188. package/es/tx/builder/field-types/gas-price.d.ts +10 -2
  189. package/es/tx/builder/field-types/gas-price.mjs +53 -4
  190. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  191. package/es/tx/builder/field-types/index.d.ts +31 -29
  192. package/es/tx/builder/field-types/index.mjs +31 -29
  193. package/es/tx/builder/field-types/index.mjs.map +1 -1
  194. package/es/tx/builder/field-types/map.mjs +20 -31
  195. package/es/tx/builder/field-types/map.mjs.map +1 -1
  196. package/es/tx/builder/field-types/mptree.mjs +14 -29
  197. package/es/tx/builder/field-types/mptree.mjs.map +1 -1
  198. package/es/tx/builder/field-types/name-fee.d.ts +1 -1
  199. package/es/tx/builder/field-types/name-fee.mjs +1 -1
  200. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  201. package/es/tx/builder/field-types/nonce.d.ts +1 -0
  202. package/es/tx/builder/field-types/nonce.mjs +2 -0
  203. package/es/tx/builder/field-types/nonce.mjs.map +1 -1
  204. package/es/tx/builder/field-types/pointers.mjs +4 -7
  205. package/es/tx/builder/field-types/pointers.mjs.map +1 -1
  206. package/es/tx/builder/field-types/pointers2.d.ts +23 -0
  207. package/es/tx/builder/field-types/pointers2.mjs +65 -0
  208. package/es/tx/builder/field-types/pointers2.mjs.map +1 -0
  209. package/es/tx/builder/field-types/query-fee.d.ts +19 -0
  210. package/es/tx/builder/field-types/query-fee.mjs +20 -0
  211. package/es/tx/builder/field-types/query-fee.mjs.map +1 -0
  212. package/es/tx/builder/field-types/ttl.d.ts +9 -1
  213. package/es/tx/builder/field-types/ttl.mjs +19 -8
  214. package/es/tx/builder/field-types/ttl.mjs.map +1 -1
  215. package/es/tx/builder/field-types/with-default.d.ts +7 -0
  216. package/es/tx/builder/field-types/with-default.mjs +9 -0
  217. package/es/tx/builder/field-types/with-default.mjs.map +1 -0
  218. package/es/tx/builder/field-types/with-formatting.d.ts +7 -0
  219. package/es/tx/builder/field-types/with-formatting.mjs +9 -0
  220. package/es/tx/builder/field-types/with-formatting.mjs.map +1 -0
  221. package/es/tx/builder/field-types/wrapped.mjs +6 -8
  222. package/es/tx/builder/field-types/wrapped.mjs.map +1 -1
  223. package/es/tx/builder/helpers.d.ts +2 -2
  224. package/es/tx/builder/helpers.mjs +12 -21
  225. package/es/tx/builder/helpers.mjs.map +1 -1
  226. package/es/tx/builder/index.d.ts +17 -10
  227. package/es/tx/builder/index.mjs +39 -65
  228. package/es/tx/builder/index.mjs.map +1 -1
  229. package/es/tx/builder/schema.d.ts +478 -257
  230. package/es/tx/builder/schema.generated.d.ts +39 -3
  231. package/es/tx/builder/schema.generated.mjs.map +1 -1
  232. package/es/tx/builder/schema.mjs +48 -36
  233. package/es/tx/builder/schema.mjs.map +1 -1
  234. package/es/tx/execution-cost.d.ts +6 -5
  235. package/es/tx/execution-cost.mjs +16 -17
  236. package/es/tx/execution-cost.mjs.map +1 -1
  237. package/es/tx/transaction-signer.mjs +1 -4
  238. package/es/tx/transaction-signer.mjs.map +1 -1
  239. package/es/tx/validator.mjs +61 -42
  240. package/es/tx/validator.mjs.map +1 -1
  241. package/es/utils/amount-formatter.mjs +15 -22
  242. package/es/utils/amount-formatter.mjs.map +1 -1
  243. package/es/utils/autorest.d.ts +2 -3
  244. package/es/utils/autorest.mjs +41 -25
  245. package/es/utils/autorest.mjs.map +1 -1
  246. package/es/utils/bytes.mjs +1 -2
  247. package/es/utils/bytes.mjs.map +1 -1
  248. package/es/utils/crypto.d.ts +9 -5
  249. package/es/utils/crypto.mjs +18 -14
  250. package/es/utils/crypto.mjs.map +1 -1
  251. package/es/utils/errors.d.ts +6 -0
  252. package/es/utils/errors.mjs +12 -6
  253. package/es/utils/errors.mjs.map +1 -1
  254. package/es/utils/hd-wallet.d.ts +2 -0
  255. package/es/utils/hd-wallet.mjs +6 -5
  256. package/es/utils/hd-wallet.mjs.map +1 -1
  257. package/es/utils/json-big.mjs +2 -10
  258. package/es/utils/json-big.mjs.map +1 -1
  259. package/es/utils/jwt.d.ts +53 -0
  260. package/es/utils/jwt.mjs +120 -0
  261. package/es/utils/jwt.mjs.map +1 -0
  262. package/es/utils/keystore.d.ts +6 -2
  263. package/es/utils/keystore.mjs +8 -16
  264. package/es/utils/keystore.mjs.map +1 -1
  265. package/es/utils/typed-data.d.ts +0 -2
  266. package/es/utils/typed-data.mjs +8 -23
  267. package/es/utils/typed-data.mjs.map +1 -1
  268. package/es/utils/wrap-proxy.d.ts +2 -0
  269. package/es/utils/wrap-proxy.mjs +15 -0
  270. package/es/utils/wrap-proxy.mjs.map +1 -0
  271. package/package.json +57 -51
  272. package/src/AeSdk.ts +3 -0
  273. package/src/AeSdkAepp.ts +0 -1
  274. package/src/AeSdkBase.ts +97 -10
  275. package/src/AeSdkMethods.ts +37 -33
  276. package/src/AeSdkWallet.ts +22 -3
  277. package/src/Middleware.ts +17 -9
  278. package/src/MiddlewareSubscriber.ts +1 -1
  279. package/src/Node.ts +51 -21
  280. package/src/account/Base.ts +62 -3
  281. package/src/account/Generalized.ts +10 -0
  282. package/src/account/Ledger.ts +10 -0
  283. package/src/account/Memory.ts +83 -9
  284. package/src/account/Rpc.ts +69 -6
  285. package/src/aens.ts +35 -56
  286. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +3 -0
  287. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +2 -2
  288. package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -2
  289. package/src/aepp-wallet-communication/rpc/types.ts +14 -1
  290. package/src/aepp-wallet-communication/schema.ts +2 -0
  291. package/src/aepp-wallet-communication/wallet-detector.ts +10 -10
  292. package/src/apis/compiler/compiler.ts +93 -93
  293. package/src/apis/compiler/models/index.ts +1 -0
  294. package/src/apis/compiler/models/mappers.ts +178 -165
  295. package/src/apis/compiler/models/parameters.ts +18 -18
  296. package/src/apis/middleware/middleware.ts +462 -341
  297. package/src/apis/middleware/models/index.ts +258 -56
  298. package/src/apis/middleware/models/mappers.ts +2357 -1919
  299. package/src/apis/middleware/models/parameters.ts +172 -142
  300. package/src/apis/node/models/index.ts +79 -2
  301. package/src/apis/node/models/mappers.ts +1529 -1302
  302. package/src/apis/node/models/parameters.ts +51 -51
  303. package/src/apis/node/node.ts +420 -275
  304. package/src/chain.ts +42 -128
  305. package/src/channel/Base.ts +14 -47
  306. package/src/channel/Contract.ts +18 -26
  307. package/src/channel/Spend.ts +0 -8
  308. package/src/channel/internal.ts +115 -13
  309. package/src/contract/Contract.ts +36 -12
  310. package/src/contract/compiler/Base.ts +15 -8
  311. package/src/contract/compiler/Cli.ts +44 -23
  312. package/src/contract/compiler/Cli8.ts +17 -0
  313. package/src/contract/compiler/Http.ts +24 -14
  314. package/src/contract/compiler/HttpNode.ts +2 -2
  315. package/src/contract/delegation-signature.ts +11 -5
  316. package/src/contract/ga.ts +4 -3
  317. package/src/deprecated.ts +55 -1
  318. package/src/index-browser.ts +18 -11
  319. package/src/index.ts +1 -0
  320. package/src/oracle.ts +11 -54
  321. package/src/send-transaction.ts +136 -0
  322. package/src/spend.ts +25 -11
  323. package/src/tx/builder/common.ts +74 -0
  324. package/src/tx/builder/constants.ts +7 -9
  325. package/src/tx/builder/delegation/index.ts +28 -0
  326. package/src/tx/builder/delegation/schema.generated.ts +143 -0
  327. package/src/tx/builder/delegation/schema.ts +61 -0
  328. package/src/tx/builder/field-types/coin-amount.ts +3 -2
  329. package/src/tx/builder/field-types/ct-version.ts +1 -1
  330. package/src/tx/builder/field-types/entry.ts +1 -4
  331. package/src/tx/builder/field-types/fee.ts +72 -44
  332. package/src/tx/builder/field-types/gas-limit.ts +4 -4
  333. package/src/tx/builder/field-types/gas-price.ts +59 -3
  334. package/src/tx/builder/field-types/index.ts +31 -59
  335. package/src/tx/builder/field-types/name-fee.ts +1 -1
  336. package/src/tx/builder/field-types/nonce.ts +7 -1
  337. package/src/tx/builder/field-types/pointers2.ts +62 -0
  338. package/src/tx/builder/field-types/query-fee.ts +25 -0
  339. package/src/tx/builder/field-types/ttl.ts +13 -3
  340. package/src/tx/builder/field-types/with-default.ts +18 -0
  341. package/src/tx/builder/field-types/with-formatting.ts +18 -0
  342. package/src/tx/builder/helpers.ts +2 -2
  343. package/src/tx/builder/index.ts +42 -59
  344. package/src/tx/builder/schema.generated.ts +39 -3
  345. package/src/tx/builder/schema.ts +55 -29
  346. package/src/tx/execution-cost.ts +6 -5
  347. package/src/tx/validator.ts +31 -5
  348. package/src/utils/autorest.ts +37 -28
  349. package/src/utils/crypto.ts +24 -14
  350. package/src/utils/errors.ts +10 -0
  351. package/src/utils/hd-wallet.ts +2 -0
  352. package/src/utils/jwt.ts +126 -0
  353. package/src/utils/keystore.ts +6 -2
  354. package/src/utils/typed-data.ts +4 -30
  355. package/src/utils/wrap-proxy.ts +24 -0
  356. package/types-legacy/ts4.2/AeSdk.d.ts +3 -0
  357. package/types-legacy/ts4.2/AeSdkAepp.d.ts +0 -1
  358. package/types-legacy/ts4.2/AeSdkBase.d.ts +61 -6
  359. package/types-legacy/ts4.2/AeSdkMethods.d.ts +19 -7
  360. package/types-legacy/ts4.2/Middleware.d.ts +1 -1
  361. package/types-legacy/ts4.2/Node.d.ts +15 -2
  362. package/types-legacy/ts4.2/account/Base.d.ts +39 -3
  363. package/types-legacy/ts4.2/account/Generalized.d.ts +2 -0
  364. package/types-legacy/ts4.2/account/Ledger.d.ts +2 -0
  365. package/types-legacy/ts4.2/account/Memory.d.ts +15 -4
  366. package/types-legacy/ts4.2/account/Rpc.d.ts +16 -5
  367. package/types-legacy/ts4.2/aens.d.ts +17 -44
  368. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
  369. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +14 -0
  370. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +2 -0
  371. package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +2 -5
  372. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -0
  373. package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +23 -5
  374. package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +164 -15
  375. package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +8 -1
  376. package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +6 -3
  377. package/types-legacy/ts4.2/apis/node/models/index.d.ts +66 -2
  378. package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +5 -1
  379. package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
  380. package/types-legacy/ts4.2/apis/node/node.d.ts +24 -3
  381. package/types-legacy/ts4.2/chain.d.ts +14 -44
  382. package/types-legacy/ts4.2/channel/Base.d.ts +3 -47
  383. package/types-legacy/ts4.2/channel/Contract.d.ts +16 -25
  384. package/types-legacy/ts4.2/channel/Spend.d.ts +0 -8
  385. package/types-legacy/ts4.2/channel/internal.d.ts +104 -5
  386. package/types-legacy/ts4.2/contract/Contract.d.ts +10 -2
  387. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +14 -8
  388. package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +12 -11
  389. package/types-legacy/ts4.2/contract/compiler/Cli8.d.ts +13 -0
  390. package/types-legacy/ts4.2/contract/compiler/Http.d.ts +3 -9
  391. package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +2 -5
  392. package/types-legacy/ts4.2/contract/delegation-signature.d.ts +2 -1
  393. package/types-legacy/ts4.2/contract/ga.d.ts +1 -2
  394. package/types-legacy/ts4.2/deprecated.d.ts +48 -0
  395. package/types-legacy/ts4.2/index-browser.d.ts +11 -6
  396. package/types-legacy/ts4.2/index.d.ts +1 -0
  397. package/types-legacy/ts4.2/oracle.d.ts +6 -37
  398. package/types-legacy/ts4.2/send-transaction.d.ts +53 -0
  399. package/types-legacy/ts4.2/spend.d.ts +4 -3
  400. package/types-legacy/ts4.2/tx/builder/common.d.ts +32 -0
  401. package/types-legacy/ts4.2/tx/builder/constants.d.ts +6 -5
  402. package/types-legacy/ts4.2/tx/builder/delegation/index.d.ts +20 -0
  403. package/types-legacy/ts4.2/tx/builder/delegation/schema.d.ts +136 -0
  404. package/types-legacy/ts4.2/tx/builder/delegation/schema.generated.d.ts +141 -0
  405. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +2 -2
  406. package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +1 -1
  407. package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +19 -11
  408. package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +10 -2
  409. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +31 -29
  410. package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -1
  411. package/types-legacy/ts4.2/tx/builder/field-types/nonce.d.ts +1 -0
  412. package/types-legacy/ts4.2/tx/builder/field-types/pointers2.d.ts +26 -0
  413. package/types-legacy/ts4.2/tx/builder/field-types/query-fee.d.ts +19 -0
  414. package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +9 -1
  415. package/types-legacy/ts4.2/tx/builder/field-types/with-default.d.ts +7 -0
  416. package/types-legacy/ts4.2/tx/builder/field-types/with-formatting.d.ts +7 -0
  417. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +2 -2
  418. package/types-legacy/ts4.2/tx/builder/index.d.ts +17 -10
  419. package/types-legacy/ts4.2/tx/builder/schema.d.ts +482 -257
  420. package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +39 -3
  421. package/types-legacy/ts4.2/tx/execution-cost.d.ts +6 -5
  422. package/types-legacy/ts4.2/utils/autorest.d.ts +2 -3
  423. package/types-legacy/ts4.2/utils/crypto.d.ts +9 -5
  424. package/types-legacy/ts4.2/utils/errors.d.ts +6 -0
  425. package/types-legacy/ts4.2/utils/hd-wallet.d.ts +2 -0
  426. package/types-legacy/ts4.2/utils/jwt.d.ts +53 -0
  427. package/types-legacy/ts4.2/utils/keystore.d.ts +6 -2
  428. package/types-legacy/ts4.2/utils/typed-data.d.ts +0 -2
  429. package/types-legacy/ts4.2/utils/wrap-proxy.d.ts +2 -0
  430. package/types-legacy/ts4.5/AeSdk.d.ts +3 -0
  431. package/types-legacy/ts4.5/AeSdkAepp.d.ts +0 -1
  432. package/types-legacy/ts4.5/AeSdkBase.d.ts +61 -6
  433. package/types-legacy/ts4.5/AeSdkMethods.d.ts +19 -7
  434. package/types-legacy/ts4.5/Middleware.d.ts +1 -1
  435. package/types-legacy/ts4.5/Node.d.ts +15 -2
  436. package/types-legacy/ts4.5/account/Base.d.ts +39 -3
  437. package/types-legacy/ts4.5/account/Generalized.d.ts +2 -0
  438. package/types-legacy/ts4.5/account/Ledger.d.ts +2 -0
  439. package/types-legacy/ts4.5/account/Memory.d.ts +15 -4
  440. package/types-legacy/ts4.5/account/Rpc.d.ts +16 -5
  441. package/types-legacy/ts4.5/aens.d.ts +17 -44
  442. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
  443. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +14 -0
  444. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +2 -0
  445. package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +2 -5
  446. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -0
  447. package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +23 -5
  448. package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +164 -15
  449. package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +8 -1
  450. package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +6 -3
  451. package/types-legacy/ts4.5/apis/node/models/index.d.ts +66 -2
  452. package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +5 -1
  453. package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
  454. package/types-legacy/ts4.5/apis/node/node.d.ts +24 -3
  455. package/types-legacy/ts4.5/chain.d.ts +14 -44
  456. package/types-legacy/ts4.5/channel/Base.d.ts +3 -47
  457. package/types-legacy/ts4.5/channel/Contract.d.ts +16 -25
  458. package/types-legacy/ts4.5/channel/Spend.d.ts +0 -8
  459. package/types-legacy/ts4.5/channel/internal.d.ts +104 -5
  460. package/types-legacy/ts4.5/contract/Contract.d.ts +10 -2
  461. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +14 -8
  462. package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +12 -11
  463. package/types-legacy/ts4.5/contract/compiler/Cli8.d.ts +13 -0
  464. package/types-legacy/ts4.5/contract/compiler/Http.d.ts +3 -9
  465. package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +2 -5
  466. package/types-legacy/ts4.5/contract/delegation-signature.d.ts +2 -1
  467. package/types-legacy/ts4.5/contract/ga.d.ts +1 -2
  468. package/types-legacy/ts4.5/deprecated.d.ts +48 -0
  469. package/types-legacy/ts4.5/index-browser.d.ts +11 -6
  470. package/types-legacy/ts4.5/index.d.ts +1 -0
  471. package/types-legacy/ts4.5/oracle.d.ts +6 -37
  472. package/types-legacy/ts4.5/send-transaction.d.ts +53 -0
  473. package/types-legacy/ts4.5/spend.d.ts +4 -3
  474. package/types-legacy/ts4.5/tx/builder/common.d.ts +32 -0
  475. package/types-legacy/ts4.5/tx/builder/constants.d.ts +6 -5
  476. package/types-legacy/ts4.5/tx/builder/delegation/index.d.ts +20 -0
  477. package/types-legacy/ts4.5/tx/builder/delegation/schema.d.ts +136 -0
  478. package/types-legacy/ts4.5/tx/builder/delegation/schema.generated.d.ts +141 -0
  479. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +2 -2
  480. package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +1 -1
  481. package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +19 -11
  482. package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +10 -2
  483. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +31 -29
  484. package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -1
  485. package/types-legacy/ts4.5/tx/builder/field-types/nonce.d.ts +1 -0
  486. package/types-legacy/ts4.5/tx/builder/field-types/pointers2.d.ts +26 -0
  487. package/types-legacy/ts4.5/tx/builder/field-types/query-fee.d.ts +19 -0
  488. package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +9 -1
  489. package/types-legacy/ts4.5/tx/builder/field-types/with-default.d.ts +7 -0
  490. package/types-legacy/ts4.5/tx/builder/field-types/with-formatting.d.ts +7 -0
  491. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +2 -2
  492. package/types-legacy/ts4.5/tx/builder/index.d.ts +17 -10
  493. package/types-legacy/ts4.5/tx/builder/schema.d.ts +482 -257
  494. package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +39 -3
  495. package/types-legacy/ts4.5/tx/execution-cost.d.ts +6 -5
  496. package/types-legacy/ts4.5/utils/autorest.d.ts +2 -3
  497. package/types-legacy/ts4.5/utils/crypto.d.ts +9 -5
  498. package/types-legacy/ts4.5/utils/errors.d.ts +6 -0
  499. package/types-legacy/ts4.5/utils/hd-wallet.d.ts +2 -0
  500. package/types-legacy/ts4.5/utils/jwt.d.ts +53 -0
  501. package/types-legacy/ts4.5/utils/keystore.d.ts +6 -2
  502. package/types-legacy/ts4.5/utils/typed-data.d.ts +0 -2
  503. package/types-legacy/ts4.5/utils/wrap-proxy.d.ts +2 -0
  504. package/es/tx/builder/field-types/deposit.d.ts +0 -15
  505. package/es/tx/builder/field-types/deposit.mjs +0 -18
  506. package/es/tx/builder/field-types/deposit.mjs.map +0 -1
  507. package/src/tx/builder/field-types/deposit.ts +0 -23
  508. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +0 -15
  509. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +0 -15
@@ -1,4 +1,4 @@
1
- import { RestError } from '@azure/core-rest-pipeline';
1
+ import { RestError, userAgentPolicyName, setClientRequestIdPolicyName } from '@azure/core-rest-pipeline';
2
2
  import { Compiler as CompilerApi } from "../../apis/compiler/index.mjs";
3
3
  import { genErrorFormatterPolicy, genVersionCheckPolicy } from "../../utils/autorest.mjs";
4
4
  import CompilerBase from "./Base.mjs";
@@ -16,14 +16,19 @@ export default class CompilerHttp extends CompilerBase {
16
16
  * @param options - Options
17
17
  * @param options.ignoreVersion - Don't check compiler version
18
18
  */
19
- constructor(compilerUrl) {
20
- let {
21
- ignoreVersion
22
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
19
+ constructor(compilerUrl, {
20
+ ignoreVersion = false
21
+ } = {}) {
23
22
  super();
23
+ let version;
24
+ const getVersion = async opts => {
25
+ if (version != null) return version;
26
+ version = (await this.api.apiVersion(opts)).apiVersion;
27
+ return version;
28
+ };
24
29
  this.api = new CompilerApi(compilerUrl, {
25
30
  allowInsecureConnection: true,
26
- additionalPolicies: [genErrorFormatterPolicy(body => {
31
+ additionalPolicies: [...(ignoreVersion ? [] : [genVersionCheckPolicy('compiler', getVersion, '7.3.0', '9.0.0')]), genErrorFormatterPolicy(body => {
27
32
  let message = '';
28
33
  if ('reason' in body) {
29
34
  message += ` ${body.reason}${body.parameter != null ? ` in ${body.parameter}` : ''
@@ -36,24 +41,31 @@ export default class CompilerHttp extends CompilerBase {
36
41
  return message;
37
42
  })]
38
43
  });
39
- if (ignoreVersion !== true) {
40
- const versionPromise = this.api.apiVersion().then(_ref => {
41
- let {
42
- apiVersion
43
- } = _ref;
44
- return apiVersion;
45
- }, error => error);
46
- this.api.pipeline.addPolicy(genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.3.0', '8.0.0'));
47
- }
44
+ this.api.pipeline.removePolicy({
45
+ name: userAgentPolicyName
46
+ });
47
+ this.api.pipeline.removePolicy({
48
+ name: setClientRequestIdPolicyName
49
+ });
48
50
  }
49
51
  async compileBySourceCode(sourceCode, fileSystem) {
50
52
  try {
51
- const res = await this.api.compileContract({
53
+ var _cmpOut$warnings;
54
+ const cmpOut = await this.api.compileContract({
52
55
  code: sourceCode,
53
56
  options: {
54
57
  fileSystem
55
58
  }
56
59
  });
60
+ (_cmpOut$warnings = cmpOut.warnings) !== null && _cmpOut$warnings !== void 0 ? _cmpOut$warnings : cmpOut.warnings = []; // TODO: remove after requiring http compiler above or equal to 8.0.0
61
+ const warnings = cmpOut.warnings.map(({
62
+ type,
63
+ ...warning
64
+ }) => warning);
65
+ const res = {
66
+ ...cmpOut,
67
+ warnings
68
+ };
57
69
  // TODO: should be fixed when the compiledAci interface gets updated
58
70
  return res;
59
71
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"Http.mjs","names":["RestError","Compiler","CompilerApi","genErrorFormatterPolicy","genVersionCheckPolicy","CompilerBase","CompilerError","NotImplementedError","CompilerHttp","constructor","compilerUrl","ignoreVersion","arguments","length","undefined","api","allowInsecureConnection","additionalPolicies","body","message","reason","parameter","info","JSON","stringify","Array","isArray","map","e","type","pos","line","col","context","join","versionPromise","apiVersion","then","_ref","error","pipeline","addPolicy","compileBySourceCode","sourceCode","fileSystem","res","compileContract","code","options","statusCode","compile","path","generateAciBySourceCode","generateACI","generateAci","validateBySourceCode","bytecode","validateByteCode","source","validate","version"],"sources":["../../../src/contract/compiler/Http.ts"],"sourcesContent":["import { RestError } from '@azure/core-rest-pipeline';\nimport {\n Compiler as CompilerApi,\n ErrorModel,\n CompilerError as CompilerErrorApi,\n} from '../../apis/compiler';\nimport { genErrorFormatterPolicy, genVersionCheckPolicy } from '../../utils/autorest';\nimport CompilerBase, { Aci } from './Base';\nimport { Encoded } from '../../utils/encoder';\nimport { CompilerError, NotImplementedError } from '../../utils/errors';\n\ntype GeneralCompilerError = ErrorModel & {\n info?: object;\n parameter?: string;\n};\n\n/**\n * Contract Compiler over HTTP\n *\n * This class include api call's related to contract compiler functionality.\n * @category contract\n * @example CompilerHttp('COMPILER_URL')\n */\nexport default class CompilerHttp extends CompilerBase {\n readonly api: CompilerApi;\n\n /**\n * @param compilerUrl - Url for compiler API\n * @param options - Options\n * @param options.ignoreVersion - Don't check compiler version\n */\n constructor(compilerUrl: string, { ignoreVersion }: { ignoreVersion?: boolean } = {}) {\n super();\n this.api = new CompilerApi(compilerUrl, {\n allowInsecureConnection: true,\n additionalPolicies: [\n genErrorFormatterPolicy((body: GeneralCompilerError | CompilerErrorApi[]) => {\n let message = '';\n if ('reason' in body) {\n message += ` ${body.reason\n }${body.parameter != null ? ` in ${body.parameter}` : ''\n // TODO: revising after improving documentation https://github.com/aeternity/aesophia_http/issues/78\n }${body.info != null ? ` (${JSON.stringify(body.info)})` : ''}`;\n }\n if (Array.isArray(body)) {\n message += `\\n${body\n .map((e) => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context != null ? ` (${e.context})` : ''}`)\n .join('\\n')}`;\n }\n return message;\n }),\n ],\n });\n if (ignoreVersion !== true) {\n const versionPromise = this.api.apiVersion()\n .then(({ apiVersion }) => apiVersion, (error) => error);\n this.api.pipeline.addPolicy(\n genVersionCheckPolicy('compiler', '/api-version', versionPromise, '7.3.0', '8.0.0'),\n );\n }\n }\n\n async compileBySourceCode(\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<{ bytecode: Encoded.ContractBytearray; aci: Aci }> {\n try {\n const res = await this.api.compileContract({ code: sourceCode, options: { fileSystem } });\n // TODO: should be fixed when the compiledAci interface gets updated\n return res as { bytecode: Encoded.ContractBytearray; aci: Aci };\n } catch (error) {\n if (error instanceof RestError && error.statusCode === 400) {\n throw new CompilerError(error.message);\n }\n throw error;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n async compile(path: string): Promise<{ bytecode: Encoded.ContractBytearray; aci: Aci }> {\n throw new NotImplementedError('File system access, use CompilerHttpNode instead');\n }\n\n async generateAciBySourceCode(\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<Aci> {\n try {\n return await this.api.generateACI({ code: sourceCode, options: { fileSystem } });\n } catch (error) {\n if (error instanceof RestError && error.statusCode === 400) {\n throw new CompilerError(error.message);\n }\n throw error;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n async generateAci(path: string): Promise<Aci> {\n throw new NotImplementedError('File system access, use CompilerHttpNode instead');\n }\n\n async validateBySourceCode(\n bytecode: Encoded.ContractBytearray,\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<boolean> {\n try {\n await this.api.validateByteCode({ bytecode, source: sourceCode, options: { fileSystem } });\n return true;\n } catch {\n return false;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n async validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean> {\n throw new NotImplementedError('File system access, use CompilerHttpNode instead');\n }\n\n async version(): Promise<string> {\n return (await this.api.version()).version;\n }\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,2BAA2B;AAAC,SAEpDC,QAAQ,IAAIC,WAAW;AAAA,SAIhBC,uBAAuB,EAAEC,qBAAqB;AAAA,OAChDC,YAAY;AAAA,SAEVC,aAAa,EAAEC,mBAAmB;AAO3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,YAAY,SAASH,YAAY,CAAC;EAGrD;AACF;AACA;AACA;AACA;EACEI,WAAWA,CAACC,WAAmB,EAAuD;IAAA,IAArD;MAAEC;IAA2C,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAClF,KAAK,CAAC,CAAC;IACP,IAAI,CAACG,GAAG,GAAG,IAAIb,WAAW,CAACQ,WAAW,EAAE;MACtCM,uBAAuB,EAAE,IAAI;MAC7BC,kBAAkB,EAAE,CAClBd,uBAAuB,CAAEe,IAA+C,IAAK;QAC3E,IAAIC,OAAO,GAAG,EAAE;QAChB,IAAI,QAAQ,IAAID,IAAI,EAAE;UACpBC,OAAO,IAAK,IAAGD,IAAI,CAACE,MACnB,GAAEF,IAAI,CAACG,SAAS,IAAI,IAAI,GAAI,OAAMH,IAAI,CAACG,SAAU,EAAC,GAAG;UACpD;UACD,GAAEH,IAAI,CAACI,IAAI,IAA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AO,CAAC,MAAM,IAAI,CAAC7C,GAAG,CAAC6C,OAAO,CAAC,CAAC,EAAEA,OAAO;EAC3C;AACF"}
1
+ {"version":3,"file":"Http.mjs","names":["RestError","userAgentPolicyName","setClientRequestIdPolicyName","Compiler","CompilerApi","genErrorFormatterPolicy","genVersionCheckPolicy","CompilerBase","CompilerError","NotImplementedError","CompilerHttp","constructor","compilerUrl","ignoreVersion","version","getVersion","opts","api","apiVersion","allowInsecureConnection","additionalPolicies","body","message","reason","parameter","info","JSON","stringify","Array","isArray","map","e","type","pos","line","col","context","join","pipeline","removePolicy","name","compileBySourceCode","sourceCode","fileSystem","_cmpOut$warnings","cmpOut","compileContract","code","options","warnings","warning","res","error","statusCode","compile","path","generateAciBySourceCode","generateACI","generateAci","validateBySourceCode","bytecode","validateByteCode","source","validate"],"sources":["../../../src/contract/compiler/Http.ts"],"sourcesContent":["import {\n RestError, userAgentPolicyName, setClientRequestIdPolicyName,\n} from '@azure/core-rest-pipeline';\nimport { OperationOptions } from '@azure/core-client';\nimport {\n Compiler as CompilerApi,\n ErrorModel,\n CompilerError as CompilerErrorApi,\n} from '../../apis/compiler';\nimport { genErrorFormatterPolicy, genVersionCheckPolicy } from '../../utils/autorest';\nimport CompilerBase, { Aci, CompileResult } from './Base';\nimport { Encoded } from '../../utils/encoder';\nimport { CompilerError, NotImplementedError } from '../../utils/errors';\n\ntype GeneralCompilerError = ErrorModel & {\n info?: object;\n parameter?: string;\n};\n\n/**\n * Contract Compiler over HTTP\n *\n * This class include api call's related to contract compiler functionality.\n * @category contract\n * @example CompilerHttp('COMPILER_URL')\n */\nexport default class CompilerHttp extends CompilerBase {\n readonly api: CompilerApi;\n\n /**\n * @param compilerUrl - Url for compiler API\n * @param options - Options\n * @param options.ignoreVersion - Don't check compiler version\n */\n constructor(compilerUrl: string, { ignoreVersion = false }: { ignoreVersion?: boolean } = {}) {\n super();\n\n let version: string | undefined;\n const getVersion = async (opts: OperationOptions): Promise<string> => {\n if (version != null) return version;\n version = (await this.api.apiVersion(opts)).apiVersion;\n return version;\n };\n\n this.api = new CompilerApi(compilerUrl, {\n allowInsecureConnection: true,\n additionalPolicies: [\n ...ignoreVersion ? [] : [genVersionCheckPolicy('compiler', getVersion, '7.3.0', '9.0.0')],\n genErrorFormatterPolicy((body: GeneralCompilerError | CompilerErrorApi[]) => {\n let message = '';\n if ('reason' in body) {\n message += ` ${body.reason\n }${body.parameter != null ? ` in ${body.parameter}` : ''\n // TODO: revising after improving documentation https://github.com/aeternity/aesophia_http/issues/78\n }${body.info != null ? ` (${JSON.stringify(body.info)})` : ''}`;\n }\n if (Array.isArray(body)) {\n message += `\\n${body\n .map((e) => `${e.type}:${e.pos.line}:${e.pos.col}: ${e.message}${e.context != null ? ` (${e.context})` : ''}`)\n .join('\\n')}`;\n }\n return message;\n }),\n ],\n });\n this.api.pipeline.removePolicy({ name: userAgentPolicyName });\n this.api.pipeline.removePolicy({ name: setClientRequestIdPolicyName });\n }\n\n async compileBySourceCode(\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): CompileResult {\n try {\n const cmpOut = await this.api.compileContract({ code: sourceCode, options: { fileSystem } });\n cmpOut.warnings ??= []; // TODO: remove after requiring http compiler above or equal to 8.0.0\n const warnings = cmpOut.warnings.map(({ type, ...warning }) => warning);\n const res = { ...cmpOut, warnings };\n // TODO: should be fixed when the compiledAci interface gets updated\n return res as Awaited<CompileResult>;\n } catch (error) {\n if (error instanceof RestError && error.statusCode === 400) {\n throw new CompilerError(error.message);\n }\n throw error;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n async compile(path: string): CompileResult {\n throw new NotImplementedError('File system access, use CompilerHttpNode instead');\n }\n\n async generateAciBySourceCode(\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<Aci> {\n try {\n return await this.api.generateACI({ code: sourceCode, options: { fileSystem } });\n } catch (error) {\n if (error instanceof RestError && error.statusCode === 400) {\n throw new CompilerError(error.message);\n }\n throw error;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n async generateAci(path: string): Promise<Aci> {\n throw new NotImplementedError('File system access, use CompilerHttpNode instead');\n }\n\n async validateBySourceCode(\n bytecode: Encoded.ContractBytearray,\n sourceCode: string,\n fileSystem?: Record<string, string>,\n ): Promise<boolean> {\n try {\n await this.api.validateByteCode({ bytecode, source: sourceCode, options: { fileSystem } });\n return true;\n } catch {\n return false;\n }\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n async validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean> {\n throw new NotImplementedError('File system access, use CompilerHttpNode instead');\n }\n\n async version(): Promise<string> {\n return (await this.api.version()).version;\n }\n}\n"],"mappings":"AAAA,SACEA,SAAS,EAAEC,mBAAmB,EAAEC,4BAA4B,QACvD,2BAA2B;AAAC,SAGjCC,QAAQ,IAAIC,WAAW;AAAA,SAIhBC,uBAAuB,EAAEC,qBAAqB;AAAA,OAChDC,YAAY;AAAA,SAEVC,aAAa,EAAEC,mBAAmB;AAO3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,YAAY,SAASH,YAAY,CAAC;EAGrD;AACF;AACA;AACA;AACA;EACEI,WAAWA,CAACC,WAAmB,EAAE;IAAEC,aAAa,GAAG;EAAmC,CAAC,GAAG,CAAC,CAAC,EAAE;IAC5F,KAAK,CAAC,CAAC;IAEP,IAAIC,OAA2B;IAC/B,MAAMC,UAAU,GAAG,MAAOC,IAAsB,IAAsB;MACpE,IAAIF,OAAO,IAAI,IAAI,EAAE,OAAOA,OAAO;MACnCA,OAAO,GAAG,CAAC,MAAM,IAAI,CAACG,GAAG,CAACC,UAAU,CAACF,IAAI,CAAC,EAAEE,UAAU;MACtD,OAAOJ,OAAO;IAChB,CAAC;IAED,IAAI,CAACG,GAAG,GAAG,IAAIb,WAAW,CAACQ,WAAW,EAAE;MACtCO,uBAAuB,EAAE,IAAI;MAC7BC,kBAAkB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MAAMM,WAAWA,CAACH,IAAY,EAAgB;IAC5C,MAAM,IAAI9C,mBAAmB,CAAC,kDAAkD,CAAC;EACnF;EAEA,MAAMkD,oBAAoBA,CACxBC,QAAmC,EACnClB,UAAkB,EAClBC,UAAmC,EACjB;IAClB,IAAI;MACF,MAAM,IAAI,CAAC1B,GAAG,CAAC4C,gBAAgB,CAAC;QAAED,QAAQ;QAAEE,MAAM,EAAEpB,UAAU;QAAEM,OAAO,EAAE;UAAEL;QAAW;MAAE,CAAC,CAAC;MAC1F,OAAO,IAAI;IACb,CAAC,CAAC,MAAM;MACN,OAAO,KAAK;IACd;EACF;;EAEA;EACA,MAAMoB,QAAQA,CAACH,QAAmC,EAAEL,IAAY,EAAoB;IAClF,MAAM,IAAI9C,mBAAmB,CAAC,kDAAkD,CAAC;EACnF;EAEA,MAAMK,OAAOA,CAAA,EAAoB;IAC/B,OAAO,CAAC,MAAM,IAAI,CAACG,GAAG,CAACH,OAAO,CAAC,CAAC,EAAEA,OAAO;EAC3C;AACF"}
@@ -1,5 +1,5 @@
1
1
  import HttpBrowser from './Http';
2
- import { Aci } from './Base';
2
+ import { Aci, CompileResult } from './Base';
3
3
  import { Encoded } from '../../utils/encoder';
4
4
  /**
5
5
  * Contract Compiler over HTTP for Nodejs
@@ -9,10 +9,7 @@ import { Encoded } from '../../utils/encoder';
9
9
  * @example CompilerHttpNode('COMPILER_URL')
10
10
  */
11
11
  export default class CompilerHttpNode extends HttpBrowser {
12
- compile(path: string): Promise<{
13
- bytecode: Encoded.ContractBytearray;
14
- aci: Aci;
15
- }>;
12
+ compile(path: string): CompileResult;
16
13
  generateAci(path: string): Promise<Aci>;
17
14
  validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean>;
18
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"HttpNode.mjs","names":["_fsPromises","readFile","HttpBrowser","getFileSystem","CompilerHttpNode","compile","path","fileSystem","sourceCode","compileBySourceCode","generateAci","generateAciBySourceCode","validate","bytecode","validateBySourceCode"],"sources":["../../../src/contract/compiler/HttpNode.ts"],"sourcesContent":["import { readFile } from 'fs/promises';\nimport HttpBrowser from './Http';\nimport { Aci } from './Base';\nimport { Encoded } from '../../utils/encoder';\nimport getFileSystem from './getFileSystem';\n\n/**\n * Contract Compiler over HTTP for Nodejs\n *\n * Inherits CompilerHttp and implements `compile`, `validate` methods\n * @category contract\n * @example CompilerHttpNode('COMPILER_URL')\n */\nexport default class CompilerHttpNode extends HttpBrowser {\n override async compile(path: string): Promise<{ bytecode: Encoded.ContractBytearray; aci: Aci }> {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.compileBySourceCode(sourceCode, fileSystem);\n }\n\n override async generateAci(path: string): Promise<Aci> {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.generateAciBySourceCode(sourceCode, fileSystem);\n }\n\n override async validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean> {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.validateBySourceCode(bytecode, sourceCode, fileSystem);\n }\n}\n"],"mappings":"AAAA,OAAAA,WAAA,MAAyB,aAAa;AAAC;EAAAC;AAAA,IAAAD,WAAA;AAAA,OAChCE,WAAW;AAAA,OAGXC,aAAa;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,WAAW,CAAC;EACxD,MAAeG,OAAOA,CAACC,IAAY,EAA8D;IAC/F,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMP,QAAQ,CAACK,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACG,mBAAmB,CAACD,UAAU,EAAED,UAAU,CAAC;EACzD;EAEA,MAAeG,WAAWA,CAACJ,IAAY,EAAgB;IACrD,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMP,QAAQ,CAACK,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACK,uBAAuB,CAACH,UAAU,EAAED,UAAU,CAAC;EAC7D;EAEA,MAAeK,QAAQA,CAACC,QAAmC,EAAEP,IAAY,EAAoB;IAC3F,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMP,QAAQ,CAACK,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACQ,oBAAoB,CAACD,QAAQ,EAAEL,UAAU,EAAED,UAAU,CAAC;EACpE;AACF"}
1
+ {"version":3,"file":"HttpNode.mjs","names":["_fsPromises","readFile","HttpBrowser","getFileSystem","CompilerHttpNode","compile","path","fileSystem","sourceCode","compileBySourceCode","generateAci","generateAciBySourceCode","validate","bytecode","validateBySourceCode"],"sources":["../../../src/contract/compiler/HttpNode.ts"],"sourcesContent":["import { readFile } from 'fs/promises';\nimport HttpBrowser from './Http';\nimport { Aci, CompileResult } from './Base';\nimport { Encoded } from '../../utils/encoder';\nimport getFileSystem from './getFileSystem';\n\n/**\n * Contract Compiler over HTTP for Nodejs\n *\n * Inherits CompilerHttp and implements `compile`, `validate` methods\n * @category contract\n * @example CompilerHttpNode('COMPILER_URL')\n */\nexport default class CompilerHttpNode extends HttpBrowser {\n override async compile(path: string): CompileResult {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.compileBySourceCode(sourceCode, fileSystem);\n }\n\n override async generateAci(path: string): Promise<Aci> {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.generateAciBySourceCode(sourceCode, fileSystem);\n }\n\n override async validate(bytecode: Encoded.ContractBytearray, path: string): Promise<boolean> {\n const fileSystem = await getFileSystem(path);\n const sourceCode = await readFile(path, 'utf8');\n return this.validateBySourceCode(bytecode, sourceCode, fileSystem);\n }\n}\n"],"mappings":"AAAA,OAAAA,WAAA,MAAyB,aAAa;AAAC;EAAAC;AAAA,IAAAD,WAAA;AAAA,OAChCE,WAAW;AAAA,OAGXC,aAAa;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,WAAW,CAAC;EACxD,MAAeG,OAAOA,CAACC,IAAY,EAAiB;IAClD,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMP,QAAQ,CAACK,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACG,mBAAmB,CAACD,UAAU,EAAED,UAAU,CAAC;EACzD;EAEA,MAAeG,WAAWA,CAACJ,IAAY,EAAgB;IACrD,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMP,QAAQ,CAACK,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACK,uBAAuB,CAACH,UAAU,EAAED,UAAU,CAAC;EAC7D;EAEA,MAAeK,QAAQA,CAACC,QAAmC,EAAEP,IAAY,EAAoB;IAC3F,MAAMC,UAAU,GAAG,MAAMJ,aAAa,CAACG,IAAI,CAAC;IAC5C,MAAME,UAAU,GAAG,MAAMP,QAAQ,CAACK,IAAI,EAAE,MAAM,CAAC;IAC/C,OAAO,IAAI,CAACQ,oBAAoB,CAACD,QAAQ,EAAEL,UAAU,EAAED,UAAU,CAAC;EACpE;AACF"}
@@ -37,8 +37,9 @@ import Node from '../Node';
37
37
  * .createDelegationSignature(contractAddress, [oracleQueryId], { onAccount, omitAddress: true })
38
38
  * ```
39
39
  */
40
- export default function createDelegationSignature(contractAddress: Encoded.ContractAddress, ids: Array<Encoded.Any | AensName>, { onAccount, omitAddress, ...options }: {
40
+ export default function createDelegationSignature(contractAddress: Encoded.ContractAddress, ids: Array<Encoded.Any | AensName>, { onAccount, omitAddress, isOracle, ...options }: {
41
41
  omitAddress?: boolean;
42
42
  onAccount: AccountBase;
43
+ isOracle?: boolean;
43
44
  onNode: Node;
44
45
  }): Promise<Uint8Array>;
@@ -40,20 +40,28 @@ function ensureOracleQuery(oq) {
40
40
  * .createDelegationSignature(contractAddress, [oracleQueryId], { onAccount, omitAddress: true })
41
41
  * ```
42
42
  */
43
- export default async function createDelegationSignature(contractAddress, ids, _ref) {
44
- let {
45
- onAccount,
46
- omitAddress,
47
- ...options
48
- } = _ref;
43
+ export default async function createDelegationSignature(contractAddress, ids, {
44
+ onAccount,
45
+ omitAddress,
46
+ isOracle,
47
+ ...options
48
+ }) {
49
49
  if (ids.length > 1) throw new ArgumentError('ids', 'shorter than 2', ids);
50
- const networkId = await options.onNode.getNetworkId();
50
+ const {
51
+ nodeNetworkId,
52
+ consensusProtocolVersion
53
+ } = await options.onNode.getNodeInfo();
54
+ const signOpts = {
55
+ networkId: nodeNetworkId,
56
+ consensusProtocolVersion
57
+ };
51
58
  if (ids.length === 0) {
52
59
  if (omitAddress === true) {
53
60
  throw new ArgumentError('omitAddress', 'equal false', omitAddress);
54
61
  }
55
62
  return decode(await onAccount.signDelegationToContract(contractAddress, {
56
- networkId
63
+ ...signOpts,
64
+ isOracle
57
65
  }));
58
66
  }
59
67
  const [payload] = ids;
@@ -61,16 +69,12 @@ export default async function createDelegationSignature(contractAddress, ids, _r
61
69
  if (omitAddress === true) {
62
70
  throw new ArgumentError('omitAddress', 'equal false', omitAddress);
63
71
  }
64
- return decode(await onAccount.signNameDelegationToContract(contractAddress, payload, {
65
- networkId
66
- }));
72
+ return decode(await onAccount.signNameDelegationToContract(contractAddress, payload, signOpts));
67
73
  }
68
74
  ensureOracleQuery(payload);
69
75
  if (omitAddress !== true) {
70
76
  throw new ArgumentError('omitAddress', 'equal true', omitAddress);
71
77
  }
72
- return decode(await onAccount.signOracleQueryDelegationToContract(contractAddress, payload, {
73
- networkId
74
- }));
78
+ return decode(await onAccount.signOracleQueryDelegationToContract(contractAddress, payload, signOpts));
75
79
  }
76
80
  //# sourceMappingURL=delegation-signature.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"delegation-signature.mjs","names":["decode","ArgumentError","isNameValid","ensureOracleQuery","oq","startsWith","createDelegationSignature","contractAddress","ids","_ref","onAccount","omitAddress","options","length","networkId","onNode","getNetworkId","signDelegationToContract","payload","signNameDelegationToContract","signOracleQueryDelegationToContract"],"sources":["../../src/contract/delegation-signature.ts"],"sourcesContent":["import { decode, Encoded } from '../utils/encoder';\nimport { ArgumentError } from '../utils/errors';\nimport { AensName } from '../tx/builder/constants';\nimport AccountBase from '../account/Base';\nimport { isNameValid } from '../tx/builder/helpers';\nimport Node from '../Node';\n\nfunction ensureOracleQuery(oq: string): asserts oq is Encoded.OracleQueryId {\n if (!oq.startsWith('oq_')) throw new ArgumentError('oq', 'oracle query', oq);\n}\n\n/**\n * Helper to generate a signature to delegate\n * - pre-claim/claim/transfer/revoke of a name to a contract.\n * - register/extend/respond of an Oracle to a contract.\n * @category contract\n * @param contractAddress - Address of contract to delegate access\n * @param ids - The list of id's to prepend\n * @param options - Options\n * @param options.omitAddress - Prepend delegation signature with an account address\n * @param options.onAccount - Account to use\n * @param options.onNode - Node to use\n * @returns Signature\n * @deprecated use methods `sign*DelegationToContract` of Account instance instead\n * @example\n * ```js\n * const aeSdk = new AeSdk({ ... })\n * const contractAddress = 'ct_asd2ks...'\n * const aensName = 'example.chain'\n * const onAccount = new MemoryAccount(...) // Sign with a specific account\n * // Preclaim signature\n * const preclaimSig = await aeSdk.createDelegationSignature(contractAddress, [], { onAccount })\n * // Claim, transfer and revoke signature\n * const aensDelegationSig = await aeSdk\n * .createDelegationSignature(contractAddress, [aensName], { onAccount })\n *\n * const oracleQueryId = 'oq_...'\n * const onAccount = new MemoryAccount(...) // Sign with a specific account\n * // Oracle register and extend signature\n * const oracleDelegationSig = await aeSdk\n * .createDelegationSignature(contractAddress, [], { onAccount })\n * // Oracle respond signature\n * const respondSig = await aeSdk\n * .createDelegationSignature(contractAddress, [oracleQueryId], { onAccount, omitAddress: true })\n * ```\n */\nexport default async function createDelegationSignature(\n contractAddress: Encoded.ContractAddress,\n ids: Array<Encoded.Any | AensName>,\n { onAccount, omitAddress, ...options }: {\n omitAddress?: boolean;\n onAccount: AccountBase;\n onNode: Node;\n },\n): Promise<Uint8Array> {\n if (ids.length > 1) throw new ArgumentError('ids', 'shorter than 2', ids);\n const networkId = await options.onNode.getNetworkId();\n if (ids.length === 0) {\n if (omitAddress === true) {\n throw new ArgumentError('omitAddress', 'equal false', omitAddress);\n }\n return decode(await onAccount.signDelegationToContract(contractAddress, { networkId }));\n }\n\n const [payload] = ids;\n if (isNameValid(payload)) {\n if (omitAddress === true) {\n throw new ArgumentError('omitAddress', 'equal false', omitAddress);\n }\n return decode(\n await onAccount.signNameDelegationToContract(contractAddress, payload, { networkId }),\n );\n }\n\n ensureOracleQuery(payload);\n if (omitAddress !== true) {\n throw new ArgumentError('omitAddress', 'equal true', omitAddress);\n }\n return decode(\n await onAccount.signOracleQueryDelegationToContract(contractAddress, payload, { networkId }),\n );\n}\n"],"mappings":"SAASA,MAAM;AAAA,SACNC,aAAa;AAAA,SAGbC,WAAW;AAGpB,SAASC,iBAAiBA,CAACC,EAAU,EAAuC;EAC1E,IAAI,CAACA,EAAE,CAACC,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,IAAIJ,aAAa,CAAC,IAAI,EAAE,cAAc,EAAEG,EAAE,CAAC;AAC9E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAeE,yBAAyBA,CACrDC,eAAwC,EACxCC,GAAkC,EAAAC,IAAA,EAMb;EAAA,IALrB;IAAEC,SAAS;IAAEC,WAAW;IAAE,GAAGC;EAI7B,CAAC,GAAAH,IAAA;EAED,IAAID,GAAG,CAACK,MAAM,GAAG,CAAC,EAAE,MAAM,IAAIZ,aAAa,CAAC,KAAK,EAAE,gBAAgB,EAAEO,GAAG,CAAC;EACzE,MAAMM,SAAS,GAAG,MAAMF,OAAO,CAACG,MAAM,CAACC,YAAY,CAAC,CAAC;EACrD,IAAIR,GAAG,CAACK,MAAM,KAAK,CAAC,EAAE;IACpB,IAAIF,WAAW,KAAK,IAAI,EAAE;MACxB,MAAM,IAAIV,aAAa,CAAC,aAAa,EAAE,aAAa,EAAEU,WAAW,CAAC;IACpE;IACA,OAAOX,MAAM,CAAC,MAAMU,SAAS,CAACO,wBAAwB,CAACV,eAAe,EAAE;MAAEO;IAAU,CAAC,CAAC,CAAC;EACzF;EAEA,MAAM,CAACI,OAAO,CAAC,GAAGV,GAAG;EACrB,IAAIN,WAAW,CAACgB,OAAO,CAAC,EAAE;IACxB,IAAIP,WAAW,KAAK,IAAI,EAAE;MACxB,MAAM,IAAIV,aAAa,CAAC,aAAa,EAAE,aAAa,EAAEU,WAAW,CAAC;IACpE;IACA,OAAOX,MAAM,CACX,MAAMU,SAAS,CAACS,4BAA4B,CAACZ,eAAe,EAAEW,OAAO,EAAE;MAAEJ;IAAU,CAAC,CACtF,CAAC;EACH;EAEAX,iBAAiB,CAACe,OAAO,CAAC;EAC1B,IAAIP,WAAW,KAAK,IAAI,EAAE;IACxB,MAAM,IAAIV,aAAa,CAAC,aAAa,EAAE,YAAY,EAAEU,WAAW,CAAC;EACnE;EACA,OAAOX,MAAM,CACX,MAAMU,SAAS,CAACU,mCAAmC,CAACb,eAAe,EAAEW,OAAO,EAAE;IAAEJ;EAAU,CAAC,CAC7F,CAAC;AACH"}
1
+ {"version":3,"file":"delegation-signature.mjs","names":["decode","ArgumentError","isNameValid","ensureOracleQuery","oq","startsWith","createDelegationSignature","contractAddress","ids","onAccount","omitAddress","isOracle","options","length","nodeNetworkId","consensusProtocolVersion","onNode","getNodeInfo","signOpts","networkId","signDelegationToContract","payload","signNameDelegationToContract","signOracleQueryDelegationToContract"],"sources":["../../src/contract/delegation-signature.ts"],"sourcesContent":["import { decode, Encoded } from '../utils/encoder';\nimport { ArgumentError } from '../utils/errors';\nimport { AensName } from '../tx/builder/constants';\nimport AccountBase from '../account/Base';\nimport { isNameValid } from '../tx/builder/helpers';\nimport Node from '../Node';\n\nfunction ensureOracleQuery(oq: string): asserts oq is Encoded.OracleQueryId {\n if (!oq.startsWith('oq_')) throw new ArgumentError('oq', 'oracle query', oq);\n}\n\n/**\n * Helper to generate a signature to delegate\n * - pre-claim/claim/transfer/revoke of a name to a contract.\n * - register/extend/respond of an Oracle to a contract.\n * @category contract\n * @param contractAddress - Address of contract to delegate access\n * @param ids - The list of id's to prepend\n * @param options - Options\n * @param options.omitAddress - Prepend delegation signature with an account address\n * @param options.onAccount - Account to use\n * @param options.onNode - Node to use\n * @returns Signature\n * @deprecated use methods `sign*DelegationToContract` of Account instance instead\n * @example\n * ```js\n * const aeSdk = new AeSdk({ ... })\n * const contractAddress = 'ct_asd2ks...'\n * const aensName = 'example.chain'\n * const onAccount = new MemoryAccount(...) // Sign with a specific account\n * // Preclaim signature\n * const preclaimSig = await aeSdk.createDelegationSignature(contractAddress, [], { onAccount })\n * // Claim, transfer and revoke signature\n * const aensDelegationSig = await aeSdk\n * .createDelegationSignature(contractAddress, [aensName], { onAccount })\n *\n * const oracleQueryId = 'oq_...'\n * const onAccount = new MemoryAccount(...) // Sign with a specific account\n * // Oracle register and extend signature\n * const oracleDelegationSig = await aeSdk\n * .createDelegationSignature(contractAddress, [], { onAccount })\n * // Oracle respond signature\n * const respondSig = await aeSdk\n * .createDelegationSignature(contractAddress, [oracleQueryId], { onAccount, omitAddress: true })\n * ```\n */\nexport default async function createDelegationSignature(\n contractAddress: Encoded.ContractAddress,\n ids: Array<Encoded.Any | AensName>,\n {\n onAccount, omitAddress, isOracle, ...options\n }: {\n omitAddress?: boolean;\n onAccount: AccountBase;\n isOracle?: boolean;\n onNode: Node;\n },\n): Promise<Uint8Array> {\n if (ids.length > 1) throw new ArgumentError('ids', 'shorter than 2', ids);\n const { nodeNetworkId, consensusProtocolVersion } = await options.onNode.getNodeInfo();\n const signOpts = { networkId: nodeNetworkId, consensusProtocolVersion };\n if (ids.length === 0) {\n if (omitAddress === true) {\n throw new ArgumentError('omitAddress', 'equal false', omitAddress);\n }\n return decode(\n await onAccount.signDelegationToContract(contractAddress, { ...signOpts, isOracle }),\n );\n }\n\n const [payload] = ids;\n if (isNameValid(payload)) {\n if (omitAddress === true) {\n throw new ArgumentError('omitAddress', 'equal false', omitAddress);\n }\n return decode(\n await onAccount.signNameDelegationToContract(contractAddress, payload, signOpts),\n );\n }\n\n ensureOracleQuery(payload);\n if (omitAddress !== true) {\n throw new ArgumentError('omitAddress', 'equal true', omitAddress);\n }\n return decode(\n await onAccount.signOracleQueryDelegationToContract(contractAddress, payload, signOpts),\n );\n}\n"],"mappings":"SAASA,MAAM;AAAA,SACNC,aAAa;AAAA,SAGbC,WAAW;AAGpB,SAASC,iBAAiBA,CAACC,EAAU,EAAuC;EAC1E,IAAI,CAACA,EAAE,CAACC,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,IAAIJ,aAAa,CAAC,IAAI,EAAE,cAAc,EAAEG,EAAE,CAAC;AAC9E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAeE,yBAAyBA,CACrDC,eAAwC,EACxCC,GAAkC,EAClC;EACEC,SAAS;EAAEC,WAAW;EAAEC,QAAQ;EAAE,GAAGC;AAMvC,CAAC,EACoB;EACrB,IAAIJ,GAAG,CAACK,MAAM,GAAG,CAAC,EAAE,MAAM,IAAIZ,aAAa,CAAC,KAAK,EAAE,gBAAgB,EAAEO,GAAG,CAAC;EACzE,MAAM;IAAEM,aAAa;IAAEC;EAAyB,CAAC,GAAG,MAAMH,OAAO,CAACI,MAAM,CAACC,WAAW,CAAC,CAAC;EACtF,MAAMC,QAAQ,GAAG;IAAEC,SAAS,EAAEL,aAAa;IAAEC;EAAyB,CAAC;EACvE,IAAIP,GAAG,CAACK,MAAM,KAAK,CAAC,EAAE;IACpB,IAAIH,WAAW,KAAK,IAAI,EAAE;MACxB,MAAM,IAAIT,aAAa,CAAC,aAAa,EAAE,aAAa,EAAES,WAAW,CAAC;IACpE;IACA,OAAOV,MAAM,CACX,MAAMS,SAAS,CAACW,wBAAwB,CAACb,eAAe,EAAE;MAAE,GAAGW,QAAQ;MAAEP;IAAS,CAAC,CACrF,CAAC;EACH;EAEA,MAAM,CAACU,OAAO,CAAC,GAAGb,GAAG;EACrB,IAAIN,WAAW,CAACmB,OAAO,CAAC,EAAE;IACxB,IAAIX,WAAW,KAAK,IAAI,EAAE;MACxB,MAAM,IAAIT,aAAa,CAAC,aAAa,EAAE,aAAa,EAAES,WAAW,CAAC;IACpE;IACA,OAAOV,MAAM,CACX,MAAMS,SAAS,CAACa,4BAA4B,CAACf,eAAe,EAAEc,OAAO,EAAEH,QAAQ,CACjF,CAAC;EACH;EAEAf,iBAAiB,CAACkB,OAAO,CAAC;EAC1B,IAAIX,WAAW,KAAK,IAAI,EAAE;IACxB,MAAM,IAAIT,aAAa,CAAC,aAAa,EAAE,YAAY,EAAES,WAAW,CAAC;EACnE;EACA,OAAOV,MAAM,CACX,MAAMS,SAAS,CAACc,mCAAmC,CAAChB,eAAe,EAAEc,OAAO,EAAEH,QAAQ,CACxF,CAAC;AACH"}
@@ -8,13 +8,12 @@ import { Encoded } from '../utils/encoder';
8
8
  import AccountBase from '../account/Base';
9
9
  import Contract from './Contract';
10
10
  import Node from '../Node';
11
- import { SendTransactionOptions } from '../chain';
11
+ import { SendTransactionOptions } from '../send-transaction';
12
12
  import CompilerBase from './compiler/Base';
13
13
  /**
14
14
  * Convert current account to GA
15
15
  * @category contract
16
16
  * @param authFnName - Authorization function name
17
- * @param sourceCode - Auth contract source code
18
17
  * @param args - init arguments
19
18
  * @param options - Options
20
19
  * @returns General Account Object
@@ -12,29 +12,28 @@ import { decode, encode, Encoding } from "../utils/encoder.mjs";
12
12
  import { ArgumentError, IllegalArgumentError } from "../utils/errors.mjs";
13
13
  import { concatBuffers } from "../utils/other.mjs";
14
14
  import Contract from "./Contract.mjs";
15
- import { sendTransaction, getAccount } from "../chain.mjs";
15
+ import { getAccount } from "../chain.mjs";
16
+ import { sendTransaction } from "../send-transaction.mjs";
16
17
  /**
17
18
  * Convert current account to GA
18
19
  * @category contract
19
20
  * @param authFnName - Authorization function name
20
- * @param sourceCode - Auth contract source code
21
21
  * @param args - init arguments
22
22
  * @param options - Options
23
23
  * @returns General Account Object
24
24
  */
25
- export async function createGeneralizedAccount(authFnName, args, _ref) {
25
+ export async function createGeneralizedAccount(authFnName, args, {
26
+ onAccount,
27
+ onCompiler,
28
+ onNode,
29
+ bytecode,
30
+ aci,
31
+ sourceCodePath,
32
+ sourceCode,
33
+ fileSystem,
34
+ ...options
35
+ }) {
26
36
  var _options$gasLimit;
27
- let {
28
- onAccount,
29
- onCompiler,
30
- onNode,
31
- bytecode,
32
- aci,
33
- sourceCodePath,
34
- sourceCode,
35
- fileSystem,
36
- ...options
37
- } = _ref;
38
37
  const ownerId = onAccount.address;
39
38
  if ((await getAccount(ownerId, {
40
39
  onNode
@@ -52,6 +51,7 @@ export async function createGeneralizedAccount(authFnName, args, _ref) {
52
51
  fileSystem
53
52
  });
54
53
  const tx = await buildTxAsync({
54
+ _isInternalBuild: true,
55
55
  ...options,
56
56
  tag: Tag.GaAttachTx,
57
57
  onNode,
@@ -61,7 +61,6 @@ export async function createGeneralizedAccount(authFnName, args, _ref) {
61
61
  callData: contract._calldata.encode(contract._name, 'init', args),
62
62
  authFun: hash(authFnName)
63
63
  });
64
- const contractId = buildContractIdByContractTx(tx);
65
64
  const {
66
65
  hash: transaction,
67
66
  rawTx
@@ -71,6 +70,7 @@ export async function createGeneralizedAccount(authFnName, args, _ref) {
71
70
  onCompiler,
72
71
  ...options
73
72
  });
73
+ const contractId = buildContractIdByContractTx(rawTx);
74
74
  return Object.freeze({
75
75
  owner: ownerId,
76
76
  transaction,
@@ -88,12 +88,11 @@ export async function createGeneralizedAccount(authFnName, args, _ref) {
88
88
  * @param options.onNode - Node to use
89
89
  * @returns Transaction hash
90
90
  */
91
- export async function buildAuthTxHash(transaction, _ref2) {
92
- let {
93
- fee,
94
- gasPrice,
95
- onNode
96
- } = _ref2;
91
+ export async function buildAuthTxHash(transaction, {
92
+ fee,
93
+ gasPrice,
94
+ onNode
95
+ }) {
97
96
  const {
98
97
  nodeNetworkId,
99
98
  consensusProtocolVersion
@@ -120,10 +119,9 @@ export async function buildAuthTxHash(transaction, _ref2) {
120
119
  * @param options.onNode - Node to use
121
120
  * @returns Transaction hash
122
121
  */
123
- export async function buildAuthTxHashByGaMetaTx(transaction, _ref3) {
124
- let {
125
- onNode
126
- } = _ref3;
122
+ export async function buildAuthTxHashByGaMetaTx(transaction, {
123
+ onNode
124
+ }) {
127
125
  const txParams = unpackTx(transaction, Tag.SignedTx);
128
126
  if (txParams.encodedTx.tag !== Tag.GaMetaTx) {
129
127
  throw new ArgumentError('transaction', 'to include GaMetaTx', Tag[txParams.encodedTx.tag]);
@@ -1 +1 @@
1
- {"version":3,"file":"ga.mjs","names":["ConsensusProtocolVersion","Tag","buildContractIdByContractTx","buildTx","buildTxAsync","unpackTx","hash","decode","encode","Encoding","ArgumentError","IllegalArgumentError","concatBuffers","Contract","sendTransaction","getAccount","createGeneralizedAccount","authFnName","args","_ref","_options$gasLimit","onAccount","onCompiler","onNode","bytecode","aci","sourceCodePath","sourceCode","fileSystem","options","ownerId","address","kind","contract","initialize","tx","tag","GaAttachTx","code","$compile","gasLimit","_estimateGas","callData","_calldata","_name","authFun","contractId","transaction","rawTx","Object","freeze","owner","gaContractId","buildAuthTxHash","_ref2","fee","gasPrice","nodeNetworkId","consensusProtocolVersion","getNodeInfo","payload","_Buffer","from","Ceres","GaMetaTxAuthData","txHash","TxHash","buildAuthTxHashByGaMetaTx","_ref3","txParams","SignedTx","encodedTx","GaMetaTx"],"sources":["../../src/contract/ga.ts"],"sourcesContent":["/**\n * Generalized Account module - routines to use generalized account\n */\n\nimport { ConsensusProtocolVersion, Int, Tag } from '../tx/builder/constants';\nimport {\n buildContractIdByContractTx, buildTx, buildTxAsync, BuildTxOptions, unpackTx,\n} from '../tx/builder';\nimport { hash } from '../utils/crypto';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../utils/encoder';\nimport { ArgumentError, IllegalArgumentError } from '../utils/errors';\nimport { concatBuffers } from '../utils/other';\nimport AccountBase from '../account/Base';\nimport Contract from './Contract';\nimport Node from '../Node';\nimport { sendTransaction, SendTransactionOptions, getAccount } from '../chain';\nimport CompilerBase from './compiler/Base';\n\n/**\n * Convert current account to GA\n * @category contract\n * @param authFnName - Authorization function name\n * @param sourceCode - Auth contract source code\n * @param args - init arguments\n * @param options - Options\n * @returns General Account Object\n */\nexport async function createGeneralizedAccount(\n authFnName: string,\n args: any[],\n {\n onAccount, onCompiler, onNode, bytecode, aci, sourceCodePath, sourceCode, fileSystem, ...options\n }: CreateGeneralizedAccountOptions,\n): Promise<Readonly<{\n owner: Encoded.AccountAddress;\n transaction: Encoded.TxHash;\n rawTx: Encoded.Transaction;\n gaContractId: Encoded.ContractAddress;\n }>> {\n const ownerId = onAccount.address;\n if ((await getAccount(ownerId, { onNode })).kind === 'generalized') {\n throw new IllegalArgumentError(`Account ${ownerId} is already GA`);\n }\n\n const contract = await Contract.initialize<{ init: (...a: any[]) => void }>({\n onAccount, onCompiler, onNode, bytecode, aci, sourceCodePath, sourceCode, fileSystem,\n });\n\n const tx = await buildTxAsync({\n ...options,\n tag: Tag.GaAttachTx,\n onNode,\n code: await contract.$compile(),\n gasLimit: options.gasLimit ?? await contract._estimateGas('init', args, options),\n ownerId,\n callData: contract._calldata.encode(contract._name, 'init', args),\n authFun: hash(authFnName),\n });\n const contractId = buildContractIdByContractTx(tx);\n const { hash: transaction, rawTx } = await sendTransaction(tx, {\n onNode, onAccount, onCompiler, ...options,\n });\n\n return Object.freeze({\n owner: ownerId,\n transaction,\n rawTx,\n gaContractId: contractId,\n });\n}\n\ninterface CreateGeneralizedAccountOptions extends\n BuildTxOptions<Tag.GaAttachTx, 'authFun' | 'callData' | 'code' | 'ownerId' | 'gasLimit'>,\n SendTransactionOptions,\n Pick<\n Parameters<typeof Contract.initialize>[0],\n 'bytecode' | 'aci' | 'sourceCodePath' | 'sourceCode' | 'fileSystem'\n > {\n onAccount: AccountBase;\n onCompiler: CompilerBase;\n onNode: Node;\n gasLimit?: number;\n}\n\n/**\n * Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx payload\n * @category contract\n * @param transaction - tx-encoded transaction\n * @param options - Options\n * @param options.fee - GaMetaTx fee, required in Ceres\n * @param options.gasPrice - GaMetaTx gasPrice, required in Ceres\n * @param options.onNode - Node to use\n * @returns Transaction hash\n */\nexport async function buildAuthTxHash(\n transaction: Encoded.Transaction,\n { fee, gasPrice, onNode }: { fee?: Int; gasPrice?: Int; onNode: Node },\n): Promise<Buffer> {\n const { nodeNetworkId, consensusProtocolVersion } = await onNode.getNodeInfo();\n let payload = hash(concatBuffers([Buffer.from(nodeNetworkId), decode(transaction)]));\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n if (fee == null) throw new ArgumentError('fee', 'provided (in Ceres)', fee);\n if (gasPrice == null) throw new ArgumentError('gasPrice', 'provided (in Ceres)', gasPrice);\n payload = hash(decode(buildTx({\n tag: Tag.GaMetaTxAuthData,\n fee,\n gasPrice,\n txHash: encode(payload, Encoding.TxHash),\n })));\n }\n return payload;\n}\n\n/**\n * Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx\n * @category contract\n * @param transaction - tx-encoded signed GaMeta transaction\n * @param options - Options\n * @param options.onNode - Node to use\n * @returns Transaction hash\n */\nexport async function buildAuthTxHashByGaMetaTx(\n transaction: Encoded.Transaction,\n { onNode }: { onNode: Node },\n): Promise<Buffer> {\n const txParams = unpackTx(transaction, Tag.SignedTx);\n if (txParams.encodedTx.tag !== Tag.GaMetaTx) {\n throw new ArgumentError('transaction', 'to include GaMetaTx', Tag[txParams.encodedTx.tag]);\n }\n return buildAuthTxHash(buildTx(txParams.encodedTx.tx.encodedTx), {\n fee: txParams.encodedTx.fee,\n gasPrice: txParams.encodedTx.gasPrice,\n onNode,\n });\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AAFA,SAISA,wBAAwB,EAAOC,GAAG;AAAA,SAEzCC,2BAA2B,EAAEC,OAAO,EAAEC,YAAY,EAAkBC,QAAQ;AAAA,SAErEC,IAAI;AAAA,SAEXC,MAAM,EAAEC,MAAM,EAAWC,QAAQ;AAAA,SAE1BC,aAAa,EAAEC,oBAAoB;AAAA,SACnCC,aAAa;AAAA,OAEfC,QAAQ;AAAA,SAENC,eAAe,EAA0BC,UAAU;AAG5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAC5CC,UAAkB,EAClBC,IAAW,EAAAC,IAAA,EASP;EAAA,IAAAC,iBAAA;EAAA,IARJ;IACEC,SAAS;IAAEC,UAAU;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,GAAG;IAAEC,cAAc;IAAEC,UAAU;IAAEC,UAAU;IAAE,GAAGC;EAC1D,CAAC,GAAAV,IAAA;EAOlC,MAAMW,OAAO,GAAGT,SAAS,CAACU,OAAO;EACjC,IAAI,CAAC,MAAMhB,UAAU,CAACe,OAAO,EAAE;IAAEP;EAAO,CAAC,CAAC,EAAES,IAAI,KAAK,aAAa,EAAE;IAClE,MAAM,IAAIrB,oBAAoB,CAAE,WAAUmB,OAAQ,gBAAe,CAAC;EACpE;EAEA,MAAMG,QAAQ,GAAG,MAAMpB,QAAQ,CAACqB,UAAU,CAAkC;IAC1Eb,SAAS;IAAEC,UAAU;IAAEC,MAAM;IAAEC,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/DhB,GAAG,EAAEc,QAAQ,CAACE,SAAS,CAAChB,GAAG;IAC3BC,QAAQ,EAAEa,QAAQ,CAACE,SAAS,CAACf,QAAQ;IACrCjC;EACF,CAAC,CAAC;AACJ"}
1
+ {"version":3,"file":"ga.mjs","names":["ConsensusProtocolVersion","Tag","buildContractIdByContractTx","buildTx","buildTxAsync","unpackTx","hash","decode","encode","Encoding","ArgumentError","IllegalArgumentError","concatBuffers","Contract","getAccount","sendTransaction","createGeneralizedAccount","authFnName","args","onAccount","onCompiler","onNode","bytecode","aci","sourceCodePath","sourceCode","fileSystem","options","_options$gasLimit","ownerId","address","kind","contract","initialize","tx","_isInternalBuild","tag","GaAttachTx","code","$compile","gasLimit","_estimateGas","callData","_calldata","_name","authFun","transaction","rawTx","contractId","Object","freeze","owner","gaContractId","buildAuthTxHash","fee","gasPrice","nodeNetworkId","consensusProtocolVersion","getNodeInfo","payload","_Buffer","from","Ceres","GaMetaTxAuthData","txHash","TxHash","buildAuthTxHashByGaMetaTx","txParams","SignedTx","encodedTx","GaMetaTx"],"sources":["../../src/contract/ga.ts"],"sourcesContent":["/**\n * Generalized Account module - routines to use generalized account\n */\n\nimport { ConsensusProtocolVersion, Int, Tag } from '../tx/builder/constants';\nimport {\n buildContractIdByContractTx, buildTx, buildTxAsync, BuildTxOptions, unpackTx,\n} from '../tx/builder';\nimport { hash } from '../utils/crypto';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../utils/encoder';\nimport { ArgumentError, IllegalArgumentError } from '../utils/errors';\nimport { concatBuffers } from '../utils/other';\nimport AccountBase from '../account/Base';\nimport Contract from './Contract';\nimport Node from '../Node';\nimport { getAccount } from '../chain';\nimport { sendTransaction, SendTransactionOptions } from '../send-transaction';\nimport CompilerBase from './compiler/Base';\n\n/**\n * Convert current account to GA\n * @category contract\n * @param authFnName - Authorization function name\n * @param args - init arguments\n * @param options - Options\n * @returns General Account Object\n */\nexport async function createGeneralizedAccount(\n authFnName: string,\n args: any[],\n {\n onAccount, onCompiler, onNode, bytecode, aci, sourceCodePath, sourceCode, fileSystem, ...options\n }: CreateGeneralizedAccountOptions,\n): Promise<Readonly<{\n owner: Encoded.AccountAddress;\n transaction: Encoded.TxHash;\n rawTx: Encoded.Transaction;\n gaContractId: Encoded.ContractAddress;\n }>> {\n const ownerId = onAccount.address;\n if ((await getAccount(ownerId, { onNode })).kind === 'generalized') {\n throw new IllegalArgumentError(`Account ${ownerId} is already GA`);\n }\n\n const contract = await Contract.initialize<{ init: (...a: any[]) => void }>({\n onAccount, onCompiler, onNode, bytecode, aci, sourceCodePath, sourceCode, fileSystem,\n });\n\n const tx = await buildTxAsync({\n _isInternalBuild: true,\n ...options,\n tag: Tag.GaAttachTx,\n onNode,\n code: await contract.$compile(),\n gasLimit: options.gasLimit ?? await contract._estimateGas('init', args, options),\n ownerId,\n callData: contract._calldata.encode(contract._name, 'init', args),\n authFun: hash(authFnName),\n });\n const { hash: transaction, rawTx } = await sendTransaction(tx, {\n onNode, onAccount, onCompiler, ...options,\n });\n const contractId = buildContractIdByContractTx(rawTx);\n\n return Object.freeze({\n owner: ownerId,\n transaction,\n rawTx,\n gaContractId: contractId,\n });\n}\n\ninterface CreateGeneralizedAccountOptions extends\n BuildTxOptions<Tag.GaAttachTx, 'authFun' | 'callData' | 'code' | 'ownerId' | 'gasLimit'>,\n SendTransactionOptions,\n Pick<\n Parameters<typeof Contract.initialize>[0],\n 'bytecode' | 'aci' | 'sourceCodePath' | 'sourceCode' | 'fileSystem'\n > {\n onAccount: AccountBase;\n onCompiler: CompilerBase;\n onNode: Node;\n gasLimit?: number;\n}\n\n/**\n * Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx payload\n * @category contract\n * @param transaction - tx-encoded transaction\n * @param options - Options\n * @param options.fee - GaMetaTx fee, required in Ceres\n * @param options.gasPrice - GaMetaTx gasPrice, required in Ceres\n * @param options.onNode - Node to use\n * @returns Transaction hash\n */\nexport async function buildAuthTxHash(\n transaction: Encoded.Transaction,\n { fee, gasPrice, onNode }: { fee?: Int; gasPrice?: Int; onNode: Node },\n): Promise<Buffer> {\n const { nodeNetworkId, consensusProtocolVersion } = await onNode.getNodeInfo();\n let payload = hash(concatBuffers([Buffer.from(nodeNetworkId), decode(transaction)]));\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n if (fee == null) throw new ArgumentError('fee', 'provided (in Ceres)', fee);\n if (gasPrice == null) throw new ArgumentError('gasPrice', 'provided (in Ceres)', gasPrice);\n payload = hash(decode(buildTx({\n tag: Tag.GaMetaTxAuthData,\n fee,\n gasPrice,\n txHash: encode(payload, Encoding.TxHash),\n })));\n }\n return payload;\n}\n\n/**\n * Build a transaction hash the same as `Auth.tx_hash` by GaMetaTx\n * @category contract\n * @param transaction - tx-encoded signed GaMeta transaction\n * @param options - Options\n * @param options.onNode - Node to use\n * @returns Transaction hash\n */\nexport async function buildAuthTxHashByGaMetaTx(\n transaction: Encoded.Transaction,\n { onNode }: { onNode: Node },\n): Promise<Buffer> {\n const txParams = unpackTx(transaction, Tag.SignedTx);\n if (txParams.encodedTx.tag !== Tag.GaMetaTx) {\n throw new ArgumentError('transaction', 'to include GaMetaTx', Tag[txParams.encodedTx.tag]);\n }\n return buildAuthTxHash(buildTx(txParams.encodedTx.tx.encodedTx), {\n fee: txParams.encodedTx.fee,\n gasPrice: txParams.encodedTx.gasPrice,\n onNode,\n });\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AAFA,SAISA,wBAAwB,EAAOC,GAAG;AAAA,SAEzCC,2BAA2B,EAAEC,OAAO,EAAEC,YAAY,EAAkBC,QAAQ;AAAA,SAErEC,IAAI;AAAA,SAEXC,MAAM,EAAEC,MAAM,EAAWC,QAAQ;AAAA,SAE1BC,aAAa,EAAEC,oBAAoB;AAAA,SACnCC,aAAa;AAAA,OAEfC,QAAQ;AAAA,SAENC,UAAU;AAAA,SACVC,eAAe;AAGxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CA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;AACA;AACA;AACA;AACA,OAAO,eAAeO,yBAAyBA,CAC7CpB,WAAgC,EAChC;EAAEzB;AAAyB,CAAC,EACX;EACjB,MAAM8C,QAAQ,GAAG9D,QAAQ,CAACyC,WAAW,EAAE7C,GAAG,CAACmE,QAAQ,CAAC;EACpD,IAAID,QAAQ,CAACE,SAAS,CAACjC,GAAG,KAAKnC,GAAG,CAACqE,QAAQ,EAAE;IAC3C,MAAM,IAAI5D,aAAa,CAAC,aAAa,EAAE,qBAAqB,EAAET,GAAG,CAACkE,QAAQ,CAACE,SAAS,CAACjC,GAAG,CAAC,CAAC;EAC5F;EACA,OAAOiB,eAAe,CAAClD,OAAO,CAACgE,QAAQ,CAACE,SAAS,CAACnC,EAAE,CAACmC,SAAS,CAAC,EAAE;IAC/Df,GAAG,EAAEa,QAAQ,CAACE,SAAS,CAACf,GAAG;IAC3BC,QAAQ,EAAEY,QAAQ,CAACE,SAAS,CAACd,QAAQ;IACrClC;EACF,CAAC,CAAC;AACJ"}
@@ -1,4 +1,7 @@
1
+ import { AciValue } from './utils/typed-data';
2
+ import { Encoded } from './utils/encoder';
1
3
  import { RpcError } from './aepp-wallet-communication/schema';
4
+ import { ORACLE_TTL_TYPES } from './tx/builder/schema';
2
5
  /**
3
6
  * @category exception
4
7
  * @deprecated this exception is not thrown anymore
@@ -12,3 +15,48 @@ export declare class RpcBroadcastError extends RpcError {
12
15
  * @deprecated use isAuctionName instead
13
16
  */
14
17
  export declare const NAME_BID_MAX_LENGTH = 12;
18
+ /**
19
+ * @deprecated use ContractByteArrayEncoder:encodeWithType from \@aeternity/aepp-calldata
20
+ */
21
+ export declare function encodeFateValue(value: unknown, aci: AciValue): Encoded.ContractBytearray;
22
+ /**
23
+ * @deprecated use ContractByteArrayEncoder:decodeWithType from \@aeternity/aepp-calldata
24
+ */
25
+ export declare function decodeFateValue(value: Encoded.ContractBytearray, aci: AciValue): any;
26
+ /**
27
+ * @deprecated inlined in buildTx or use `180000`
28
+ */
29
+ export declare const NAME_TTL = 180000;
30
+ /**
31
+ * @deprecated inlined in buildTx or use `36000`
32
+ */
33
+ export declare const NAME_MAX_TTL = 36000;
34
+ /**
35
+ * @deprecated inlined in buildTx or use `60 * 60`
36
+ */
37
+ export declare const NAME_MAX_CLIENT_TTL: number;
38
+ /**
39
+ * @deprecated inlined in buildTx or use `60 * 60`
40
+ */
41
+ export declare const CLIENT_TTL: number;
42
+ /**
43
+ * @deprecated inlined in buildTx or use `{ type: ORACLE_TTL_TYPES.delta, value: 500 }`
44
+ */
45
+ export declare const ORACLE_TTL: {
46
+ type: ORACLE_TTL_TYPES;
47
+ value: number;
48
+ };
49
+ /**
50
+ * @deprecated inlined in buildTx or use `{ type: ORACLE_TTL_TYPES.delta, value: 10 }`
51
+ */
52
+ export declare const QUERY_TTL: {
53
+ type: ORACLE_TTL_TYPES;
54
+ value: number;
55
+ };
56
+ /**
57
+ * @deprecated inlined in buildTx or use `{ type: ORACLE_TTL_TYPES.delta, value: 10 }`
58
+ */
59
+ export declare const RESPONSE_TTL: {
60
+ type: ORACLE_TTL_TYPES;
61
+ value: number;
62
+ };
package/es/deprecated.mjs CHANGED
@@ -1,10 +1,15 @@
1
1
  import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
2
+ import _aeternityAeppCalldata from '@aeternity/aepp-calldata';
3
+ const {
4
+ TypeResolver,
5
+ ContractByteArrayEncoder
6
+ } = _aeternityAeppCalldata;
2
7
  import { RpcError } from "./aepp-wallet-communication/schema.mjs";
8
+ import { ORACLE_TTL_TYPES } from "./tx/builder/schema.mjs";
3
9
  /**
4
10
  * @category exception
5
11
  * @deprecated this exception is not thrown anymore
6
12
  */
7
- // eslint-disable-next-line import/prefer-default-export
8
13
  export class RpcBroadcastError extends RpcError {
9
14
  constructor(data) {
10
15
  super('Broadcast failed');
@@ -19,4 +24,64 @@ export class RpcBroadcastError extends RpcError {
19
24
  */
20
25
  _defineProperty(RpcBroadcastError, "code", 3);
21
26
  export const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid
27
+
28
+ /**
29
+ * @deprecated use ContractByteArrayEncoder:encodeWithType from \@aeternity/aepp-calldata
30
+ */
31
+ export function encodeFateValue(value, aci) {
32
+ const valueType = new TypeResolver().resolveType(aci, {});
33
+ return new ContractByteArrayEncoder().encodeWithType(value, valueType);
34
+ }
35
+
36
+ /**
37
+ * @deprecated use ContractByteArrayEncoder:decodeWithType from \@aeternity/aepp-calldata
38
+ */
39
+ export function decodeFateValue(value, aci) {
40
+ const valueType = new TypeResolver().resolveType(aci, {});
41
+ return new ContractByteArrayEncoder().decodeWithType(value, valueType);
42
+ }
43
+
44
+ /**
45
+ * @deprecated inlined in buildTx or use `180000`
46
+ */
47
+ export const NAME_TTL = 180000;
48
+
49
+ /**
50
+ * @deprecated inlined in buildTx or use `36000`
51
+ */
52
+ export const NAME_MAX_TTL = 36000;
53
+
54
+ /**
55
+ * @deprecated inlined in buildTx or use `60 * 60`
56
+ */
57
+ export const NAME_MAX_CLIENT_TTL = 60 * 60;
58
+
59
+ /**
60
+ * @deprecated inlined in buildTx or use `60 * 60`
61
+ */
62
+ export const CLIENT_TTL = NAME_MAX_CLIENT_TTL;
63
+
64
+ /**
65
+ * @deprecated inlined in buildTx or use `{ type: ORACLE_TTL_TYPES.delta, value: 500 }`
66
+ */
67
+ export const ORACLE_TTL = {
68
+ type: ORACLE_TTL_TYPES.delta,
69
+ value: 500
70
+ };
71
+
72
+ /**
73
+ * @deprecated inlined in buildTx or use `{ type: ORACLE_TTL_TYPES.delta, value: 10 }`
74
+ */
75
+ export const QUERY_TTL = {
76
+ type: ORACLE_TTL_TYPES.delta,
77
+ value: 10
78
+ };
79
+
80
+ /**
81
+ * @deprecated inlined in buildTx or use `{ type: ORACLE_TTL_TYPES.delta, value: 10 }`
82
+ */
83
+ export const RESPONSE_TTL = {
84
+ type: ORACLE_TTL_TYPES.delta,
85
+ value: 10
86
+ };
22
87
  //# sourceMappingURL=deprecated.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"deprecated.mjs","names":["RpcError","RpcBroadcastError","constructor","data","_defineProperty","name","NAME_BID_MAX_LENGTH"],"sources":["../src/deprecated.ts"],"sourcesContent":["import { RpcError } from './aepp-wallet-communication/schema';\n\n/**\n * @category exception\n * @deprecated this exception is not thrown anymore\n */\n// eslint-disable-next-line import/prefer-default-export\nexport class RpcBroadcastError extends RpcError {\n static override code = 3;\n\n override code = 3;\n\n constructor(data?: any) {\n super('Broadcast failed');\n this.data = data;\n this.name = 'RpcBroadcastError';\n }\n}\n\n/**\n * @deprecated use isAuctionName instead\n */\nexport const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid\n"],"mappings":";SAASA,QAAQ;AAEjB;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,SAASD,QAAQ,CAAC;EAK9CE,WAAWA,CAACC,IAAU,EAAE;IACtB,KAAK,CAAC,kBAAkB,CAAC;IAACC,eAAA,eAHZ,CAAC;IAIf,IAAI,CAACD,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACE,IAAI,GAAG,mBAAmB;EACjC;AACF;;AAEA;AACA;AACA;AAFAD,eAAA,CAZaH,iBAAiB,UACL,CAAC;AAc1B,OAAO,MAAMK,mBAAmB,GAAG,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"deprecated.mjs","names":["_aeternityAeppCalldata","TypeResolver","ContractByteArrayEncoder","RpcError","ORACLE_TTL_TYPES","RpcBroadcastError","constructor","data","_defineProperty","name","NAME_BID_MAX_LENGTH","encodeFateValue","value","aci","valueType","resolveType","encodeWithType","decodeFateValue","decodeWithType","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","ORACLE_TTL","type","delta","QUERY_TTL","RESPONSE_TTL"],"sources":["../src/deprecated.ts"],"sourcesContent":["import { TypeResolver, ContractByteArrayEncoder } from '@aeternity/aepp-calldata';\nimport { AciValue } from './utils/typed-data';\nimport { Encoded } from './utils/encoder';\nimport { RpcError } from './aepp-wallet-communication/schema';\nimport { ORACLE_TTL_TYPES } from './tx/builder/schema';\n\n/**\n * @category exception\n * @deprecated this exception is not thrown anymore\n */\nexport class RpcBroadcastError extends RpcError {\n static override code = 3;\n\n override code = 3;\n\n constructor(data?: any) {\n super('Broadcast failed');\n this.data = data;\n this.name = 'RpcBroadcastError';\n }\n}\n\n/**\n * @deprecated use isAuctionName instead\n */\nexport const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid\n\n/**\n * @deprecated use ContractByteArrayEncoder:encodeWithType from \\@aeternity/aepp-calldata\n */\nexport function encodeFateValue(value: unknown, aci: AciValue): Encoded.ContractBytearray {\n const valueType = new TypeResolver().resolveType(aci, {});\n return new ContractByteArrayEncoder().encodeWithType(value, valueType);\n}\n\n/**\n * @deprecated use ContractByteArrayEncoder:decodeWithType from \\@aeternity/aepp-calldata\n */\nexport function decodeFateValue(value: Encoded.ContractBytearray, aci: AciValue): any {\n const valueType = new TypeResolver().resolveType(aci, {});\n return new ContractByteArrayEncoder().decodeWithType(value, valueType);\n}\n\n/**\n * @deprecated inlined in buildTx or use `180000`\n */\nexport const NAME_TTL = 180000;\n\n/**\n * @deprecated inlined in buildTx or use `36000`\n */\nexport const NAME_MAX_TTL = 36000;\n\n/**\n * @deprecated inlined in buildTx or use `60 * 60`\n */\nexport const NAME_MAX_CLIENT_TTL = 60 * 60;\n\n/**\n * @deprecated inlined in buildTx or use `60 * 60`\n */\nexport const CLIENT_TTL = NAME_MAX_CLIENT_TTL;\n\n/**\n * @deprecated inlined in buildTx or use `{ type: ORACLE_TTL_TYPES.delta, value: 500 }`\n */\nexport const ORACLE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 500 };\n\n/**\n * @deprecated inlined in buildTx or use `{ type: ORACLE_TTL_TYPES.delta, value: 10 }`\n */\nexport const QUERY_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };\n\n/**\n * @deprecated inlined in buildTx or use `{ type: ORACLE_TTL_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MC,mBAAmB,GAAG,EAAE,GAAG,EAAE;;AAE1C;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAGD,mBAAmB;;AAE7C;AACA;AACA;AACA,OAAO,MAAME,UAAU,GAAG;EAAEC,IAAI,EAAEpB,gBAAgB,CAACqB,KAAK;EAAEb,KAAK,EAAE;AAAI,CAAC;;AAEtE;AACA;AACA;AACA,OAAO,MAAMc,SAAS,GAAG;EAAEF,IAAI,EAAEpB,gBAAgB,CAACqB,KAAK;EAAEb,KAAK,EAAE;AAAG,CAAC;;AAEpE;AACA;AACA;AACA,OAAO,MAAMe,YAAY,GAAG;EAAEH,IAAI,EAAEpB,gBAAgB,CAACqB,KAAK;EAAEb,KAAK,EAAE;AAAG,CAAC"}
@@ -1,19 +1,24 @@
1
- export { _getPollInterval, InvalidTxError, getHeight, poll, awaitHeight, waitForTxConfirm, sendTransaction, getAccount, getBalance, getCurrentGeneration, getGeneration, getMicroBlockTransactions, getKeyBlock, getMicroBlockHeader, txDryRun, getContractByteCode, getContract, getName, resolveName, } from './chain';
1
+ export { _getPollInterval, getHeight, poll, awaitHeight, waitForTxConfirm, getAccount, getBalance, getCurrentGeneration, getGeneration, getMicroBlockTransactions, getKeyBlock, getMicroBlockHeader, txDryRun, getContractByteCode, getContract, getName, resolveName, } from './chain';
2
+ export { InvalidTxError, sendTransaction } from './send-transaction';
2
3
  export { getAddressFromPriv, isAddressValid, genSalt, encodeUnsigned, hash, encodeContractAddress, generateKeyPairFromSecret, generateKeyPair, sign, verify, messageToHash, signMessage, verifyMessage, isValidKeypair, } from './utils/crypto';
4
+ export { signJwt, unpackJwt, verifyJwt, isJwt, ensureJwt, } from './utils/jwt';
5
+ export type { Jwt } from './utils/jwt';
3
6
  export { recover, dump } from './utils/keystore';
4
7
  export type { Keystore } from './utils/keystore';
5
8
  export { toBytes } from './utils/bytes';
6
9
  export { buildTx, buildTxAsync, buildTxHash, unpackTx, buildContractIdByContractTx, } from './tx/builder';
7
10
  export { buildContractId, oracleQueryId, produceNameId, commitmentHash, readInt, isNameValid, ensureName, getDefaultPointerKey, getMinimumNameFee, computeBidFee, computeAuctionEndBlock, isAuctionName, } from './tx/builder/helpers';
8
- export { 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, ConsensusProtocolVersion, VmVersion, AbiVersion, Tag, } from './tx/builder/constants';
11
+ export { 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, ConsensusProtocolVersion, VmVersion, AbiVersion, Tag, DRY_RUN_ACCOUNT, } from './tx/builder/constants';
9
12
  export type { Int, AensName } from './tx/builder/constants';
10
- export { ORACLE_TTL_TYPES, ORACLE_TTL, QUERY_TTL, RESPONSE_TTL, DRY_RUN_ACCOUNT, CallReturnType, } from './tx/builder/schema';
13
+ export { ORACLE_TTL_TYPES, CallReturnType } from './tx/builder/schema';
14
+ export { DelegationTag } from './tx/builder/delegation/schema';
15
+ export { packDelegation, unpackDelegation } from './tx/builder/delegation';
11
16
  export { getExecutionCost, getExecutionCostBySignedTx, getExecutionCostUsingNode, } from './tx/execution-cost';
12
17
  export { default as getTransactionSignerAddress } from './tx/transaction-signer';
13
18
  export { AE_AMOUNT_FORMATS, formatAmount, toAe, toAettos, prefixedAmount, } from './utils/amount-formatter';
14
19
  export { DerivationError, deriveChild, derivePathFromKey, getMasterKeyFromSeed, derivePathFromSeed, getKeyPair, generateSaveHDWalletFromSeed, getSaveHDWalletAccounts, getHdWalletAccountFromSeed, } from './utils/hd-wallet';
15
20
  export { encode, decode, Encoding, Encoded, } from './utils/encoder';
16
- export { encodeFateValue, decodeFateValue, hashTypedData, hashDomain, hashJson, } from './utils/typed-data';
21
+ export { hashTypedData, hashDomain, hashJson } from './utils/typed-data';
17
22
  export { aensRevoke, aensUpdate, aensTransfer, aensQuery, aensClaim, aensPreclaim, aensBid, } from './aens';
18
23
  export { default as Contract } from './contract/Contract';
19
24
  export type { ContractMethodsBase } from './contract/Contract';
@@ -42,5 +47,5 @@ export { MESSAGE_DIRECTION, WALLET_TYPE, SUBSCRIPTION_TYPES, METHODS, RPC_STATUS
42
47
  export { default as walletDetector } from './aepp-wallet-communication/wallet-detector';
43
48
  export { default as BrowserRuntimeConnection } from './aepp-wallet-communication/connection/BrowserRuntime';
44
49
  export { default as BrowserWindowMessageConnection } from './aepp-wallet-communication/connection/BrowserWindowMessage';
45
- export { BaseError, AccountError, AensError, AeppError, ChannelError, CompilerError, ContractError, CryptographyError, NodeError, TransactionError, WalletError, ArgumentError, IllegalArgumentError, ArgumentCountMismatchError, InsufficientBalanceError, MissingParamError, NoSerializerFoundError, RequestTimedOutError, TxTimedOutError, TypeError, UnsupportedPlatformError, UnsupportedProtocolError, NotImplementedError, UnsupportedVersionError, InternalError, UnexpectedTsError, UnavailableAccountError, AensPointerContextError, InsufficientNameFeeError, InvalidAensNameError, InvalidRpcMessageError, MissingCallbackError, UnAuthorizedAccountError, UnknownRpcClientError, UnsubscribedAccountError, ChannelCallError, ChannelConnectionError, ChannelPingTimedOutError, UnexpectedChannelMessageError, ChannelIncomingMessageError, UnknownChannelStateError, InvalidAuthDataError, BytecodeMismatchError, DuplicateContractError, InactiveContractError, InvalidMethodInvocationError, MissingContractAddressError, MissingContractDefError, MissingFunctionNameError, NodeInvocationError, NoSuchContractFunctionError, NotPayableFunctionError, MissingEventDefinitionError, AmbiguousEventDefinitionError, InvalidChecksumError, InvalidPasswordError, MerkleTreeHashMismatchError, MissingNodeInTreeError, UnknownNodeLengthError, UnknownPathNibbleError, DuplicateNodeError, NodeNotFoundError, DecodeError, PayloadLengthError, DryRunError, IllegalBidFeeError, InvalidSignatureError, PrefixNotFoundError, SchemaNotFoundError, TagNotFoundError, TxNotInChainError, AlreadyConnectedError, NoWalletConnectedError, RpcConnectionError, } from './utils/errors';
46
- export { RpcBroadcastError, NAME_BID_MAX_LENGTH } from './deprecated';
50
+ export { BaseError, AccountError, AensError, AeppError, ChannelError, CompilerError, ContractError, CryptographyError, NodeError, TransactionError, WalletError, ArgumentError, IllegalArgumentError, ArgumentCountMismatchError, InsufficientBalanceError, MissingParamError, NoSerializerFoundError, RequestTimedOutError, TxTimedOutError, TypeError, UnsupportedPlatformError, UnsupportedProtocolError, NotImplementedError, UnsupportedVersionError, LogicError, InternalError, UnexpectedTsError, UnavailableAccountError, AensPointerContextError, InsufficientNameFeeError, InvalidAensNameError, InvalidRpcMessageError, MissingCallbackError, UnAuthorizedAccountError, UnknownRpcClientError, UnsubscribedAccountError, ChannelCallError, ChannelConnectionError, ChannelPingTimedOutError, UnexpectedChannelMessageError, ChannelIncomingMessageError, UnknownChannelStateError, InvalidAuthDataError, BytecodeMismatchError, DuplicateContractError, InactiveContractError, InvalidMethodInvocationError, MissingContractAddressError, MissingContractDefError, MissingFunctionNameError, NodeInvocationError, NoSuchContractFunctionError, NotPayableFunctionError, MissingEventDefinitionError, AmbiguousEventDefinitionError, InvalidChecksumError, InvalidPasswordError, MerkleTreeHashMismatchError, MissingNodeInTreeError, UnknownNodeLengthError, UnknownPathNibbleError, DuplicateNodeError, NodeNotFoundError, DecodeError, PayloadLengthError, DryRunError, IllegalBidFeeError, InvalidSignatureError, PrefixNotFoundError, SchemaNotFoundError, TagNotFoundError, TxNotInChainError, AlreadyConnectedError, NoWalletConnectedError, RpcConnectionError, } from './utils/errors';
51
+ export { RpcBroadcastError, NAME_BID_MAX_LENGTH, encodeFateValue, decodeFateValue, NAME_TTL, NAME_MAX_TTL, NAME_MAX_CLIENT_TTL, CLIENT_TTL, ORACLE_TTL, QUERY_TTL, RESPONSE_TTL, } from './deprecated';