@aeternity/aepp-sdk 10.0.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (424) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +15 -14
  3. package/dist/aepp-sdk.browser-script.js +1 -1
  4. package/dist/aepp-sdk.browser-script.js.LICENSE.txt +13 -40
  5. package/dist/aepp-sdk.browser-script.js.map +1 -1
  6. package/dist/aepp-sdk.browser.js +1 -1
  7. package/dist/aepp-sdk.browser.js.map +1 -1
  8. package/dist/aepp-sdk.js +1 -1
  9. package/dist/aepp-sdk.js.map +1 -1
  10. package/es/AeSdk.d.ts +37 -0
  11. package/es/AeSdk.mjs +81 -0
  12. package/es/AeSdk.mjs.map +1 -0
  13. package/es/AeSdkAepp.d.ts +69 -0
  14. package/es/AeSdkAepp.mjs +175 -0
  15. package/es/AeSdkAepp.mjs.map +1 -0
  16. package/es/AeSdkBase.d.ts +212 -0
  17. package/es/AeSdkBase.mjs +310 -0
  18. package/es/AeSdkBase.mjs.map +1 -0
  19. package/es/AeSdkWallet.d.ts +103 -0
  20. package/es/AeSdkWallet.mjs +322 -0
  21. package/es/AeSdkWallet.mjs.map +1 -0
  22. package/es/Node.d.ts +44 -0
  23. package/es/Node.mjs +141 -0
  24. package/es/Node.mjs.map +1 -0
  25. package/es/account/Base.d.ts +65 -0
  26. package/es/account/Base.mjs +123 -0
  27. package/es/account/Base.mjs.map +1 -0
  28. package/es/account/Memory.d.ts +25 -0
  29. package/es/account/Memory.mjs +81 -0
  30. package/es/account/Memory.mjs.map +1 -0
  31. package/es/account/Rpc.d.ts +27 -0
  32. package/es/account/Rpc.mjs +79 -0
  33. package/es/account/Rpc.mjs.map +1 -0
  34. package/es/aens.d.ts +209 -0
  35. package/es/aens.mjs +332 -0
  36. package/es/aens.mjs.map +1 -0
  37. package/es/aepp-wallet-communication/connection/Browser.d.ts +32 -0
  38. package/es/aepp-wallet-communication/connection/Browser.mjs +70 -0
  39. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -0
  40. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +17 -0
  41. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +57 -0
  42. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -0
  43. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +35 -0
  44. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +142 -0
  45. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -0
  46. package/es/aepp-wallet-communication/connection-proxy.d.ts +10 -0
  47. package/{src/utils/crypto-ts.ts → es/aepp-wallet-communication/connection-proxy.mjs} +15 -11
  48. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -0
  49. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +33 -0
  50. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +169 -0
  51. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -0
  52. package/es/aepp-wallet-communication/rpc/types.d.ts +77 -0
  53. package/es/aepp-wallet-communication/rpc/types.mjs +3 -0
  54. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -0
  55. package/es/aepp-wallet-communication/schema.d.ts +118 -0
  56. package/es/aepp-wallet-communication/schema.mjs +214 -0
  57. package/es/aepp-wallet-communication/schema.mjs.map +1 -0
  58. package/es/aepp-wallet-communication/wallet-detector.d.ts +24 -0
  59. package/es/aepp-wallet-communication/wallet-detector.mjs +63 -0
  60. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
  61. package/es/apis/compiler/compiler.d.ts +92 -0
  62. package/es/apis/compiler/compiler.mjs +576 -0
  63. package/es/apis/compiler/compiler.mjs.map +1 -0
  64. package/es/apis/compiler/index.d.ts +2 -0
  65. package/es/apis/compiler/index.mjs +3 -0
  66. package/es/apis/compiler/index.mjs.map +1 -0
  67. package/es/apis/compiler/models/index.d.ts +248 -0
  68. package/es/apis/compiler/models/index.mjs +48 -0
  69. package/es/apis/compiler/models/index.mjs.map +1 -0
  70. package/es/apis/compiler/models/mappers.d.ts +23 -0
  71. package/es/apis/compiler/models/mappers.mjs +585 -0
  72. package/es/apis/compiler/models/mappers.mjs.map +1 -0
  73. package/es/apis/compiler/models/parameters.d.ts +13 -0
  74. package/es/apis/compiler/models/parameters.mjs +71 -0
  75. package/es/apis/compiler/models/parameters.mjs.map +1 -0
  76. package/es/apis/node/index.d.ts +2 -0
  77. package/es/apis/node/index.mjs +3 -0
  78. package/es/apis/node/index.mjs.map +1 -0
  79. package/es/apis/node/models/index.d.ts +1061 -0
  80. package/es/apis/node/models/index.mjs +2 -0
  81. package/es/apis/node/models/index.mjs.map +1 -0
  82. package/es/apis/node/models/mappers.d.ts +95 -0
  83. package/es/apis/node/models/mappers.mjs +4164 -0
  84. package/es/apis/node/models/mappers.mjs.map +1 -0
  85. package/es/apis/node/models/parameters.d.ts +17 -0
  86. package/es/apis/node/models/parameters.mjs +165 -0
  87. package/es/apis/node/models/parameters.mjs.map +1 -0
  88. package/es/apis/node/node.d.ts +215 -0
  89. package/es/apis/node/node.mjs +1165 -0
  90. package/es/apis/node/node.mjs.map +1 -0
  91. package/es/chain.d.ts +220 -0
  92. package/es/chain.mjs +524 -0
  93. package/es/chain.mjs.map +1 -0
  94. package/es/channel/handlers.d.ts +34 -0
  95. package/es/channel/{handlers.js → handlers.mjs} +163 -130
  96. package/es/channel/handlers.mjs.map +1 -0
  97. package/es/channel/index.d.ts +634 -0
  98. package/es/channel/index.mjs +978 -0
  99. package/es/channel/index.mjs.map +1 -0
  100. package/es/channel/internal.d.ts +100 -0
  101. package/es/channel/internal.mjs +328 -0
  102. package/es/channel/internal.mjs.map +1 -0
  103. package/es/contract/Compiler.d.ts +17 -0
  104. package/es/contract/Compiler.mjs +67 -0
  105. package/es/contract/Compiler.mjs.map +1 -0
  106. package/es/contract/aci.d.ts +125 -0
  107. package/es/contract/aci.mjs +496 -0
  108. package/es/contract/aci.mjs.map +1 -0
  109. package/es/contract/ga.d.ts +68 -0
  110. package/es/contract/ga.mjs +190 -0
  111. package/es/contract/ga.mjs.map +1 -0
  112. package/es/contract/methods.d.ts +68 -0
  113. package/es/contract/methods.mjs +101 -0
  114. package/es/contract/methods.mjs.map +1 -0
  115. package/es/index.d.ts +32 -0
  116. package/es/index.mjs +49 -0
  117. package/es/index.mjs.map +1 -0
  118. package/es/oracle.d.ts +154 -0
  119. package/es/oracle.mjs +288 -0
  120. package/es/oracle.mjs.map +1 -0
  121. package/es/spend.d.ts +61 -0
  122. package/es/spend.mjs +122 -0
  123. package/es/spend.mjs.map +1 -0
  124. package/es/tx/builder/constants.d.ts +41 -0
  125. package/es/tx/builder/constants.mjs +100 -0
  126. package/es/tx/builder/constants.mjs.map +1 -0
  127. package/es/tx/builder/field-types.d.ts +62 -0
  128. package/es/tx/builder/field-types.mjs +126 -0
  129. package/es/tx/builder/field-types.mjs.map +1 -0
  130. package/es/tx/builder/helpers.d.ts +131 -0
  131. package/es/tx/builder/helpers.mjs +223 -0
  132. package/es/tx/builder/helpers.mjs.map +1 -0
  133. package/es/tx/builder/index.d.ts +75 -0
  134. package/es/tx/builder/index.mjs +424 -0
  135. package/es/tx/builder/index.mjs.map +1 -0
  136. package/es/tx/builder/schema.d.ts +350 -0
  137. package/es/tx/builder/schema.mjs +320 -0
  138. package/es/tx/builder/schema.mjs.map +1 -0
  139. package/es/tx/index.d.ts +63 -0
  140. package/es/tx/index.mjs +209 -0
  141. package/es/tx/index.mjs.map +1 -0
  142. package/es/tx/min-fee.d.ts +20 -0
  143. package/es/tx/min-fee.mjs +148 -0
  144. package/es/tx/min-fee.mjs.map +1 -0
  145. package/es/tx/validator.d.ts +19 -0
  146. package/es/tx/validator.mjs +240 -0
  147. package/es/tx/validator.mjs.map +1 -0
  148. package/es/typings/@aeternity__argon2-browser/index.d.mjs +2 -0
  149. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -0
  150. package/es/typings/@aeternity__uuid/index.d.mjs +2 -0
  151. package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -0
  152. package/es/typings/bip32-path/index.d.mjs +2 -0
  153. package/es/typings/bip32-path/index.d.mjs.map +1 -0
  154. package/es/typings/blakejs/index.d.mjs +2 -0
  155. package/es/typings/blakejs/index.d.mjs.map +1 -0
  156. package/es/typings/tweetnacl-auth/index.d.mjs +2 -0
  157. package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -0
  158. package/es/utils/amount-formatter.d.ts +42 -0
  159. package/es/utils/{amount-formatter.js → amount-formatter.mjs} +38 -44
  160. package/es/utils/amount-formatter.mjs.map +1 -0
  161. package/es/utils/autorest.d.ts +6 -0
  162. package/es/utils/autorest.mjs +97 -0
  163. package/es/utils/autorest.mjs.map +1 -0
  164. package/es/utils/bignumber.d.ts +13 -0
  165. package/es/utils/bignumber.mjs +23 -0
  166. package/es/utils/bignumber.mjs.map +1 -0
  167. package/es/{bytes.d.ts → utils/bytes.d.ts} +10 -13
  168. package/es/utils/{bytes.js → bytes.mjs} +26 -22
  169. package/es/utils/bytes.mjs.map +1 -0
  170. package/es/utils/crypto.d.ts +103 -0
  171. package/es/utils/crypto.mjs +221 -0
  172. package/es/utils/crypto.mjs.map +1 -0
  173. package/es/utils/encoder.d.ts +26 -0
  174. package/es/utils/encoder.mjs +102 -0
  175. package/es/utils/encoder.mjs.map +1 -0
  176. package/es/utils/errors.d.ts +481 -0
  177. package/es/utils/errors.mjs +882 -0
  178. package/es/utils/errors.mjs.map +1 -0
  179. package/es/utils/hd-wallet.d.ts +34 -0
  180. package/es/utils/hd-wallet.mjs +122 -0
  181. package/es/utils/hd-wallet.mjs.map +1 -0
  182. package/es/utils/json-big.d.ts +5 -0
  183. package/es/utils/json-big.mjs +41 -0
  184. package/es/utils/json-big.mjs.map +1 -0
  185. package/es/utils/keystore.d.ts +51 -0
  186. package/es/utils/keystore.mjs +145 -0
  187. package/es/utils/keystore.mjs.map +1 -0
  188. package/es/{mptree.d.ts → utils/mptree.d.ts} +5 -8
  189. package/es/utils/{mptree.js → mptree.mjs} +33 -25
  190. package/es/utils/mptree.mjs.map +1 -0
  191. package/es/utils/other.d.ts +14 -0
  192. package/es/utils/other.mjs +28 -0
  193. package/es/utils/other.mjs.map +1 -0
  194. package/es/{semver-satisfies.d.ts → utils/semver-satisfies.d.ts} +0 -0
  195. package/es/utils/{semver-satisfies.js → semver-satisfies.mjs} +1 -1
  196. package/es/utils/semver-satisfies.mjs.map +1 -0
  197. package/es/utils/string.d.ts +24 -0
  198. package/es/utils/{string.js → string.mjs} +9 -11
  199. package/es/utils/string.mjs.map +1 -0
  200. package/package.json +67 -64
  201. package/src/AeSdk.ts +65 -0
  202. package/src/AeSdkAepp.ts +167 -0
  203. package/src/AeSdkBase.ts +320 -0
  204. package/src/AeSdkWallet.ts +332 -0
  205. package/src/Node.ts +167 -0
  206. package/src/account/Base.ts +114 -0
  207. package/src/account/Memory.ts +83 -0
  208. package/src/account/Rpc.ts +67 -0
  209. package/src/aens.ts +391 -0
  210. package/src/aepp-wallet-communication/connection/Browser.ts +68 -0
  211. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +58 -0
  212. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +111 -0
  213. package/{es/utils/crypto-ts.js → src/aepp-wallet-communication/connection-proxy.ts} +16 -9
  214. package/src/aepp-wallet-communication/rpc/RpcClient.ts +137 -0
  215. package/src/aepp-wallet-communication/rpc/types.ts +66 -0
  216. package/src/aepp-wallet-communication/schema.ts +181 -0
  217. package/src/aepp-wallet-communication/wallet-detector.ts +71 -0
  218. package/src/apis/compiler/code-model-v4.yaml +2649 -0
  219. package/src/apis/compiler/compiler.ts +585 -0
  220. package/src/apis/compiler/index.ts +2 -0
  221. package/src/apis/compiler/models/index.ts +301 -0
  222. package/src/apis/compiler/models/mappers.ts +583 -0
  223. package/src/apis/compiler/models/parameters.ts +93 -0
  224. package/src/apis/node/code-model-v4.yaml +10046 -0
  225. package/src/apis/node/index.ts +2 -0
  226. package/src/apis/node/models/index.ts +1253 -0
  227. package/src/apis/node/models/mappers.ts +4278 -0
  228. package/src/apis/node/models/parameters.ts +188 -0
  229. package/src/apis/node/node.ts +1299 -0
  230. package/src/chain.ts +444 -0
  231. package/src/channel/{handlers.js → handlers.ts} +238 -143
  232. package/src/channel/index.ts +991 -0
  233. package/src/channel/internal.ts +345 -0
  234. package/src/contract/Compiler.ts +66 -0
  235. package/src/contract/aci.ts +529 -0
  236. package/src/contract/ga.ts +178 -0
  237. package/src/contract/methods.ts +118 -0
  238. package/src/index.ts +51 -0
  239. package/src/oracle.ts +342 -0
  240. package/src/spend.ts +152 -0
  241. package/src/tx/builder/constants.ts +96 -0
  242. package/src/tx/builder/field-types.ts +111 -0
  243. package/src/tx/builder/helpers.ts +253 -0
  244. package/src/tx/builder/index.ts +394 -0
  245. package/src/tx/builder/schema.ts +771 -0
  246. package/src/tx/index.ts +199 -0
  247. package/src/tx/min-fee.ts +136 -0
  248. package/src/tx/validator.ts +226 -0
  249. package/src/typings/@aeternity__argon2-browser/index.d.ts +3 -0
  250. package/src/typings/@aeternity__uuid/index.d.ts +3 -0
  251. package/src/typings/bip32-path/index.d.ts +33 -0
  252. package/src/typings/tweetnacl-auth/index.d.ts +14 -0
  253. package/src/utils/amount-formatter.ts +29 -41
  254. package/src/utils/autorest.ts +90 -0
  255. package/src/utils/bignumber.ts +9 -19
  256. package/src/utils/bytes.ts +15 -16
  257. package/src/utils/crypto.ts +217 -0
  258. package/src/utils/encoder.ts +98 -0
  259. package/src/utils/errors.ts +817 -0
  260. package/src/utils/hd-wallet.ts +134 -0
  261. package/src/utils/json-big.ts +26 -0
  262. package/src/utils/keystore.ts +179 -0
  263. package/src/utils/mptree.ts +26 -20
  264. package/src/utils/other.ts +28 -43
  265. package/src/utils/string.ts +8 -10
  266. package/CHANGELOG.md +0 -1603
  267. package/es/account/base.js +0 -169
  268. package/es/account/base.js.map +0 -1
  269. package/es/account/memory.js +0 -84
  270. package/es/account/memory.js.map +0 -1
  271. package/es/account/multiple.js +0 -178
  272. package/es/account/multiple.js.map +0 -1
  273. package/es/ae/aens.js +0 -408
  274. package/es/ae/aens.js.map +0 -1
  275. package/es/ae/aepp.js +0 -45
  276. package/es/ae/aepp.js.map +0 -1
  277. package/es/ae/contract.js +0 -312
  278. package/es/ae/contract.js.map +0 -1
  279. package/es/ae/index.js +0 -206
  280. package/es/ae/index.js.map +0 -1
  281. package/es/ae/oracle.js +0 -322
  282. package/es/ae/oracle.js.map +0 -1
  283. package/es/ae/universal.js +0 -45
  284. package/es/ae/universal.js.map +0 -1
  285. package/es/ae/wallet.js +0 -50
  286. package/es/ae/wallet.js.map +0 -1
  287. package/es/amount-formatter.d.ts +0 -58
  288. package/es/bignumber.d.ts +0 -24
  289. package/es/chain/index.js +0 -256
  290. package/es/chain/index.js.map +0 -1
  291. package/es/chain/node.js +0 -394
  292. package/es/chain/node.js.map +0 -1
  293. package/es/channel/handlers.js.map +0 -1
  294. package/es/channel/index.js +0 -980
  295. package/es/channel/index.js.map +0 -1
  296. package/es/channel/internal.js +0 -266
  297. package/es/channel/internal.js.map +0 -1
  298. package/es/contract/aci/helpers.js +0 -298
  299. package/es/contract/aci/helpers.js.map +0 -1
  300. package/es/contract/aci/index.js +0 -361
  301. package/es/contract/aci/index.js.map +0 -1
  302. package/es/contract/aci/transformation.js +0 -66
  303. package/es/contract/aci/transformation.js.map +0 -1
  304. package/es/contract/compiler.js +0 -244
  305. package/es/contract/compiler.js.map +0 -1
  306. package/es/contract/ga/helpers.js +0 -22
  307. package/es/contract/ga/helpers.js.map +0 -1
  308. package/es/contract/ga/index.js +0 -170
  309. package/es/contract/ga/index.js.map +0 -1
  310. package/es/contract/index.js +0 -162
  311. package/es/contract/index.js.map +0 -1
  312. package/es/crypto-ts.d.ts +0 -9
  313. package/es/index.js +0 -57
  314. package/es/index.js.map +0 -1
  315. package/es/node-pool/index.js +0 -187
  316. package/es/node-pool/index.js.map +0 -1
  317. package/es/node.js +0 -132
  318. package/es/node.js.map +0 -1
  319. package/es/other.d.ts +0 -31
  320. package/es/string.d.ts +0 -26
  321. package/es/tx/builder/helpers.js +0 -305
  322. package/es/tx/builder/helpers.js.map +0 -1
  323. package/es/tx/builder/index.js +0 -595
  324. package/es/tx/builder/index.js.map +0 -1
  325. package/es/tx/builder/schema.js +0 -814
  326. package/es/tx/builder/schema.js.map +0 -1
  327. package/es/tx/index.js +0 -300
  328. package/es/tx/index.js.map +0 -1
  329. package/es/tx/tx-object.js +0 -276
  330. package/es/tx/tx-object.js.map +0 -1
  331. package/es/tx/tx.js +0 -937
  332. package/es/tx/tx.js.map +0 -1
  333. package/es/tx/validator.js +0 -208
  334. package/es/tx/validator.js.map +0 -1
  335. package/es/typings/blakejs/index.d.js +0 -2
  336. package/es/typings/blakejs/index.d.js.map +0 -1
  337. package/es/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -131
  338. package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +0 -1
  339. package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -184
  340. package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +0 -1
  341. package/es/utils/aepp-wallet-communication/connection/index.js +0 -84
  342. package/es/utils/aepp-wallet-communication/connection/index.js.map +0 -1
  343. package/es/utils/aepp-wallet-communication/content-script-bridge.js +0 -97
  344. package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +0 -1
  345. package/es/utils/aepp-wallet-communication/helpers.js +0 -103
  346. package/es/utils/aepp-wallet-communication/helpers.js.map +0 -1
  347. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -329
  348. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +0 -1
  349. package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -270
  350. package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +0 -1
  351. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -533
  352. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +0 -1
  353. package/es/utils/aepp-wallet-communication/schema.js +0 -107
  354. package/es/utils/aepp-wallet-communication/schema.js.map +0 -1
  355. package/es/utils/aepp-wallet-communication/wallet-detector.js +0 -109
  356. package/es/utils/aepp-wallet-communication/wallet-detector.js.map +0 -1
  357. package/es/utils/amount-formatter.js.map +0 -1
  358. package/es/utils/async-init.js +0 -67
  359. package/es/utils/async-init.js.map +0 -1
  360. package/es/utils/bignumber.js +0 -28
  361. package/es/utils/bignumber.js.map +0 -1
  362. package/es/utils/bytes.js.map +0 -1
  363. package/es/utils/crypto-ts.js.map +0 -1
  364. package/es/utils/crypto.js +0 -304
  365. package/es/utils/crypto.js.map +0 -1
  366. package/es/utils/hd-wallet.js +0 -112
  367. package/es/utils/hd-wallet.js.map +0 -1
  368. package/es/utils/json-big.js +0 -45
  369. package/es/utils/json-big.js.map +0 -1
  370. package/es/utils/keystore.js +0 -228
  371. package/es/utils/keystore.js.map +0 -1
  372. package/es/utils/mptree.js.map +0 -1
  373. package/es/utils/other.js +0 -43
  374. package/es/utils/other.js.map +0 -1
  375. package/es/utils/semver-satisfies.js.map +0 -1
  376. package/es/utils/string.js.map +0 -1
  377. package/es/utils/swagger.js +0 -132
  378. package/es/utils/swagger.js.map +0 -1
  379. package/src/account/base.js +0 -153
  380. package/src/account/memory.js +0 -78
  381. package/src/account/multiple.js +0 -154
  382. package/src/ae/aens.js +0 -366
  383. package/src/ae/aepp.js +0 -45
  384. package/src/ae/contract.js +0 -285
  385. package/src/ae/index.js +0 -167
  386. package/src/ae/oracle.js +0 -296
  387. package/src/ae/universal.js +0 -47
  388. package/src/ae/wallet.js +0 -50
  389. package/src/chain/index.js +0 -250
  390. package/src/chain/node.js +0 -293
  391. package/src/channel/index.js +0 -898
  392. package/src/channel/internal.js +0 -231
  393. package/src/contract/aci/index.js +0 -317
  394. package/src/contract/aci/transformation.js +0 -72
  395. package/src/contract/compiler.js +0 -195
  396. package/src/contract/ga/helpers.js +0 -17
  397. package/src/contract/ga/index.js +0 -147
  398. package/src/contract/index.js +0 -163
  399. package/src/index.js +0 -90
  400. package/src/node-pool/index.js +0 -171
  401. package/src/node.js +0 -118
  402. package/src/tx/builder/helpers.js +0 -325
  403. package/src/tx/builder/index.js +0 -460
  404. package/src/tx/builder/schema.js +0 -1211
  405. package/src/tx/index.js +0 -301
  406. package/src/tx/tx-object.js +0 -186
  407. package/src/tx/tx.js +0 -622
  408. package/src/tx/validator.js +0 -161
  409. package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -114
  410. package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -161
  411. package/src/utils/aepp-wallet-communication/connection/index.js +0 -85
  412. package/src/utils/aepp-wallet-communication/content-script-bridge.js +0 -85
  413. package/src/utils/aepp-wallet-communication/helpers.js +0 -70
  414. package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -268
  415. package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -223
  416. package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -390
  417. package/src/utils/aepp-wallet-communication/schema.js +0 -108
  418. package/src/utils/aepp-wallet-communication/wallet-detector.js +0 -91
  419. package/src/utils/async-init.js +0 -41
  420. package/src/utils/crypto.js +0 -312
  421. package/src/utils/hd-wallet.js +0 -115
  422. package/src/utils/json-big.js +0 -26
  423. package/src/utils/keystore.js +0 -223
  424. package/src/utils/swagger.js +0 -133
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aci.mjs","names":["DRY_RUN_ACCOUNT","GAS_MAX","TX_TYPE","AMOUNT","buildContractIdByContractTx","unpackTx","_buildTx","send","decode","MissingContractDefError","MissingContractAddressError","InactiveContractError","BytecodeMismatchError","DuplicateContractError","MissingFunctionNameError","InvalidMethodInvocationError","NotPayableFunctionError","TypeError","NodeInvocationError","IllegalArgumentError","NoSuchContractFunctionError","MissingEventDefinitionError","AmbiguousEventDefinitionError","UnexpectedTsError","hash","getAccount","getContract","getContractByteCode","getKeyBlock","resolveName","txDryRun","getContractInstance","onAccount","onCompiler","onNode","source","bytecode","aci","_aci","contractAddress","fileSystem","validateBytecode","otherOptions","generateACI","code","options","resolveByNode","contract","active","instance","_name","encodedAci","name","calldata","Calldata","externalEncodedAci","deployInfo","address","amount","callStatic","compile","_options","_estimateGas","_params","deploy","call","_fn","decodeEvents","_events","methods","undefined","onChanBytecode","isValid","validateByteCode","then","compileContract","sendAndProcess","tx","txData","result","rawTx","blockHeight","callInfo","getTransactionInfoByHash","Object","assign","handleCallError","transaction","returnType","returnValue","message","decodeFateString","toString","params","gasUsed","Math","floor","opt","ownerId","contractCreate","gasLimit","callData","encode","contractId","freeze","owner","getFunctionACI","fn","functions","find","f","payable","fnACI","callerId","Promise","resolve","catch","error","pub","res","top","txOpt","nonce","contractCall","callObj","dryRunOther","decodedResult","returns","decodedEvents","log","getContractNameByEvent","nameHash","contractAddressToName","addressToName","matchedEvents","filter","event","map","variant","events","keys","flat","eventName","BigInt","length","omitUnknown","topics","t","contractName","decoded","decodeEvent","data","args","entries","e","fromEntries","arguments","aciArgs","stateful","genHandler","pop","get"],"sources":["../../src/contract/aci.ts"],"sourcesContent":["/*\n* ISC License (ISC)\n* Copyright (c) 2022 aeternity developers\n*\n* Permission to use, copy, modify, and/or distribute this software for any\n* purpose with or without fee is hereby granted, provided that the above\n* copyright notice and this permission notice appear in all copies.\n*\n* THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n* PERFORMANCE OF THIS SOFTWARE.\n*/\n// @ts-expect-error TODO remove\nimport { Encoder as Calldata } from '@aeternity/aepp-calldata'\nimport { DRY_RUN_ACCOUNT, GAS_MAX, TX_TYPE, AMOUNT, AensName } from '../tx/builder/schema'\nimport { buildContractIdByContractTx, unpackTx } from '../tx/builder'\nimport { _buildTx } from '../tx'\nimport { send } from '../spend'\nimport { decode, EncodedData, EncodingType } from '../utils/encoder'\nimport {\n MissingContractDefError,\n MissingContractAddressError,\n InactiveContractError,\n BytecodeMismatchError,\n DuplicateContractError,\n MissingFunctionNameError,\n InvalidMethodInvocationError,\n NotPayableFunctionError,\n TypeError,\n NodeInvocationError,\n IllegalArgumentError,\n NoSuchContractFunctionError,\n MissingEventDefinitionError,\n AmbiguousEventDefinitionError,\n UnexpectedTsError\n} from '../utils/errors'\nimport { hash } from '../utils/crypto'\nimport { Aci as BaseAci } from '../apis/compiler'\nimport Compiler from './Compiler'\nimport Node from '../Node'\nimport {\n getAccount, getContract, getContractByteCode, getKeyBlock, resolveName, txDryRun\n} from '../chain'\nimport AccountBase from '../account/Base'\n\ninterface FunctionACI {\n arguments: any[]\n name: string\n payable: boolean\n returns: string\n stateful: boolean\n}\n\ninterface Aci extends BaseAci {\n encodedAci: {\n contract: {\n name: string\n event: any\n kind: string\n state: any\n type_defs: any[]\n functions: FunctionACI[]\n }\n }\n externalEncodedAci: any[]\n}\n\ninterface Event {\n address: EncodedData<'ct'>\n data: string\n topics: Array<string | number>\n}\n\ninterface DecodedEvent {\n name: string\n args: unknown\n contract: {\n name: string\n address: EncodedData<'ct'>\n }\n}\n\ntype TxData = Awaited<ReturnType<typeof send>>\n\nexport interface ContractInstance {\n _aci: Aci\n _name: string\n calldata: any\n source?: string\n bytecode?: EncodedData<'cb'>\n deployInfo: {\n address?: EncodedData<'ct'>\n result?: {\n callerId: string\n callerNonce: string\n contractId: string\n gasPrice: bigint\n gasUsed: number\n height: number\n log: any[]\n returnType: string\n returnValue: string\n }\n owner?: EncodedData<'ak'>\n transaction?: string\n rawTx?: string\n txData?: TxData\n }\n options: any\n compile: (options?: {}) => Promise<EncodedData<'cb'>>\n _estimateGas: (name: string, params: any[], options: object) => Promise<number>\n deploy: (params?: any[], options?: object) => Promise<any>\n call: (fn: string, params?: any[], options?: {}) => Promise<{\n hash: string\n tx: any\n txData: TxData\n rawTx: string\n result: {\n callerId: EncodedData<'ak'>\n callerNonce: number\n contractId: EncodedData<'ct'>\n gasPrice: number\n gasUsed: number\n height: number\n log: any[]\n returnType: string\n returnValue: string\n }\n decodedResult: any\n decodedEvents: DecodedEvent[]\n }>\n decodeEvents: (\n events: Event[], options?: { omitUnknown?: boolean, contractAddressToName?: any }\n ) => DecodedEvent[]\n methods: any\n}\n\ntype ContractCallReturnType = 'ok' | 'error' | 'revert'\n\n/**\n * Generate contract ACI object with predefined js methods for contract usage - can be used for\n * creating a reference to already deployed contracts\n * @param options - Options object\n * @returns JS Contract API\n * @example\n * ```js\n * const contractIns = await aeSdk.getContractInstance({ source })\n * await contractIns.deploy([321]) or await contractIns.methods.init(321)\n * const callResult = await contractIns.call('setState', [123]) or\n * await contractIns.methods.setState.send(123, options)\n * const staticCallResult = await contractIns.call('setState', [123], { callStatic: true }) or\n * await contractIns.methods.setState.get(123, options)\n * ```\n * Also you can call contract like: `await contractIns.methods.setState(123, options)`\n * Then sdk decide to make on-chain or static call(dry-run API) transaction based on function is\n * stateful or not\n */\nexport default async function getContractInstance ({\n onAccount,\n onCompiler,\n onNode,\n source,\n bytecode,\n aci: _aci,\n contractAddress,\n fileSystem = {},\n validateBytecode,\n ...otherOptions\n}: {\n onAccount: AccountBase\n onCompiler: Compiler\n onNode: Node\n source?: string\n bytecode?: EncodedData<'cb'>\n aci?: Aci\n contractAddress?: EncodedData<'ct'> | AensName\n fileSystem?: Record<string, string>\n validateBytecode?: boolean\n [key: string]: any\n}): Promise<ContractInstance> {\n if (_aci == null && source != null) {\n // TODO: should be fixed when the compiledAci interface gets updated\n _aci = await onCompiler.generateACI({ code: source, options: { fileSystem } }) as Aci\n }\n if (_aci == null) throw new MissingContractDefError()\n\n if (contractAddress != null) {\n contractAddress = await resolveName(\n contractAddress, 'contract_pubkey', { resolveByNode: true, onNode }\n ) as EncodedData<'ct'>\n }\n\n if (contractAddress == null && source == null && bytecode == null) {\n throw new MissingContractAddressError('Can\\'t create instance by ACI without address')\n }\n\n if (contractAddress != null) {\n const contract = await getContract(contractAddress, { onNode })\n if (contract.active == null) throw new InactiveContractError(contractAddress)\n }\n\n const instance: ContractInstance = {\n _aci,\n _name: _aci.encodedAci.contract.name,\n calldata: new Calldata([_aci.encodedAci, ..._aci.externalEncodedAci]),\n source,\n bytecode,\n deployInfo: { address: contractAddress },\n options: {\n onAccount,\n onCompiler,\n onNode,\n amount: AMOUNT,\n callStatic: false,\n fileSystem,\n ...otherOptions\n },\n compile: async function (_options?: {}): Promise<any> {},\n _estimateGas: async function (\n _name: string, _params: any[], _options: object\n ): Promise<any> {},\n deploy: async function (_params?: any[], _options?: any): Promise<any> {},\n call: async function (_fn: string, _params?: any[], _options?: {}): Promise<any> {},\n decodeEvents (_events: Event[], options?: { omitUnknown?: boolean }): any {},\n methods: undefined\n }\n\n if (validateBytecode != null) {\n if (contractAddress == null) throw new MissingContractAddressError('Can\\'t validate bytecode without contract address')\n const onChanBytecode = (await getContractByteCode(contractAddress, { onNode })).bytecode\n const isValid: boolean = source != null\n ? await onCompiler.validateByteCode(\n { bytecode: onChanBytecode, source, options: instance.options }\n ).then(() => true, () => false)\n : bytecode === onChanBytecode\n if (!isValid) throw new BytecodeMismatchError(source != null ? 'source' : 'bytecode')\n }\n\n /**\n * Compile contract\n * @returns bytecode\n */\n instance.compile = async (options = {}): Promise<EncodedData<'cb'>> => {\n if (instance.bytecode != null) throw new IllegalArgumentError('Contract already compiled')\n if (instance.source == null) throw new IllegalArgumentError('Can\\'t compile without source code')\n instance.bytecode = (await onCompiler.compileContract({\n code: instance.source, options: { ...instance.options, ...options }\n })).bytecode as EncodedData<'cb'>\n return instance.bytecode\n }\n\n const sendAndProcess = async (tx: EncodedData<'tx'>, options: any): Promise<{\n result?: ContractInstance['deployInfo']['result']\n hash: TxData['hash']\n tx: Awaited<ReturnType<typeof unpackTx<TX_TYPE.contractCall | TX_TYPE.contractCreate>>>\n txData: TxData\n rawTx: EncodedData<'tx'>\n }> => {\n options = { ...instance.options, ...options }\n const txData = await send(tx, options)\n const result = {\n hash: txData.hash,\n tx: unpackTx<TX_TYPE.contractCall | TX_TYPE.contractCreate>(txData.rawTx),\n txData,\n rawTx: txData.rawTx\n }\n if (txData.blockHeight == null) return result\n const { callInfo } = await onNode.getTransactionInfoByHash(txData.hash)\n Object.assign(result.txData, callInfo) // TODO: don't duplicate data in result\n // @ts-expect-error TODO api should be updated to match types\n handleCallError(callInfo, tx)\n return { ...result, result: callInfo }\n }\n const handleCallError = (\n { returnType, returnValue }: {\n returnType: ContractCallReturnType\n returnValue: EncodedData<EncodingType>\n },\n transaction: string): void => {\n let message: string\n switch (returnType) {\n case 'ok': return\n case 'revert':\n message = instance.calldata.decodeFateString(returnValue)\n break\n case 'error':\n message = decode(returnValue).toString()\n break\n }\n throw new NodeInvocationError(message, transaction)\n }\n\n instance._estimateGas = async (\n name: string, params: any[], options: object): Promise<number> => {\n const { result: { gasUsed } } =\n await instance.call(name, params, { ...options, callStatic: true })\n // taken from https://github.com/aeternity/aepp-sdk-js/issues/1286#issuecomment-977814771\n return Math.floor(gasUsed * 1.25)\n }\n\n /**\n * Deploy contract\n * @param params - Contract init function arguments array\n * @param options - Options\n * @returns deploy info\n */\n instance.deploy = async (params = [],\n options:\n Parameters<typeof instance.compile>[0] &\n Parameters<typeof instance.call>[2] &\n Parameters<AccountBase['address']>[0] &\n Parameters<typeof sendAndProcess>[1]\n ): Promise<ContractInstance['deployInfo']> => {\n const opt = { ...instance.options, ...options }\n if (instance.bytecode == null) await instance.compile(opt)\n // @ts-expect-error\n if (opt.callStatic === true) return await instance.call('init', params, opt)\n if (instance.deployInfo.address != null) throw new DuplicateContractError()\n\n const ownerId = await opt.onAccount.address(options)\n const tx = await _buildTx(TX_TYPE.contractCreate, {\n ...opt,\n gasLimit: opt.gasLimit ?? await instance._estimateGas('init', params, opt),\n callData: instance.calldata.encode(instance._name, 'init', params),\n code: instance.bytecode,\n ownerId,\n onNode\n })\n const contractId = buildContractIdByContractTx(tx)\n const { hash, rawTx, result, txData } = await sendAndProcess(tx, opt)\n instance.deployInfo = Object.freeze({\n result,\n owner: ownerId,\n transaction: hash,\n rawTx,\n txData,\n address: contractId\n })\n return instance.deployInfo\n }\n\n /**\n * Get function schema from contract ACI object\n * @param name - Function name\n * @returns function ACI\n */\n function getFunctionACI (name: string): Partial<FunctionACI> {\n const fn = instance._aci.encodedAci.contract.functions.find(\n (f: { name: string }) => f.name === name)\n if (fn != null) {\n return fn\n }\n if (name === 'init') return { payable: false }\n throw new NoSuchContractFunctionError(`Function ${name} doesn't exist in contract`)\n }\n\n /**\n * Call contract function\n * @param fn - Function name\n * @param params - Array of function arguments\n * @param options - Array of function arguments\n * @returns CallResult\n */\n instance.call = async (fn: string, params: any[] = [], options: object = {}) => {\n const opt = { ...instance.options, ...options }\n const fnACI = getFunctionACI(fn)\n const contractId = instance.deployInfo.address\n\n if (fn == null) throw new MissingFunctionNameError()\n if (fn === 'init' && opt.callStatic === false) throw new InvalidMethodInvocationError('\"init\" can be called only via dryRun')\n if (contractId == null && fn !== 'init') throw new InvalidMethodInvocationError('You need to deploy contract before calling!')\n if (fn !== 'init' && opt.amount > 0 && fnACI.payable === false) throw new NotPayableFunctionError(opt.amount, fn)\n\n const callerId = await Promise.resolve()\n .then(() => opt.onAccount.address(opt))\n .catch((error: any) => {\n if (opt.callStatic === true) return DRY_RUN_ACCOUNT.pub\n else throw error\n }) as EncodedData<'ak'>\n const callData = instance.calldata.encode(instance._name, fn, params)\n\n let res: any\n if (opt.callStatic === true) {\n if (typeof opt.top === 'number') {\n opt.top = (await getKeyBlock(opt.top, { onNode })).hash\n }\n const txOpt = {\n ...opt,\n onNode,\n gasLimit: opt.gasLimit ?? GAS_MAX,\n callData\n }\n if (opt.nonce == null && opt.top != null) {\n opt.nonce = (await getAccount(callerId, { hash: opt.top, onNode })).nonce + 1\n }\n const tx = await (fn === 'init'\n ? _buildTx(TX_TYPE.contractCreate, { ...txOpt, code: instance.bytecode, ownerId: callerId })\n : _buildTx(TX_TYPE.contractCall, { ...txOpt, callerId, contractId }))\n\n const { callObj, ...dryRunOther } = await txDryRun(tx, callerId, { onNode, ...opt })\n if (callObj == null) throw new UnexpectedTsError()\n handleCallError({\n returnType: callObj.returnType as ContractCallReturnType,\n returnValue: callObj.returnValue as EncodedData<EncodingType>\n }, tx)\n res = { ...dryRunOther, tx: unpackTx(tx), result: callObj }\n } else {\n const tx = await _buildTx(TX_TYPE.contractCall, {\n ...opt,\n onNode,\n gasLimit: opt.gasLimit ?? await instance._estimateGas(fn, params, opt),\n callerId,\n contractId,\n callData\n })\n res = await sendAndProcess(tx, opt)\n }\n if (opt.callStatic === true || res.txData.blockHeight != null) {\n res.decodedResult = fnACI.returns != null && fnACI.returns !== 'unit' && fn !== 'init' &&\n instance.calldata.decode(instance._name, fn, res.result.returnValue)\n res.decodedEvents = instance.decodeEvents(res.result.log, opt)\n }\n return res\n }\n\n /**\n * @param address - Contract address that emitted event\n * @param nameHash - Hash of emitted event name\n * @param options - Options\n * @returns Contract name\n * @throws {@link MissingEventDefinitionError}\n * @throws {@link AmbiguousEventDefinitionError}\n */\n function getContractNameByEvent (\n address: EncodedData<'ct'>,\n nameHash: BigInt,\n { contractAddressToName }: { contractAddressToName?: { [key: EncodedData<'ct'>]: string } }\n ): string {\n const addressToName = { ...instance.options.contractAddressToName, ...contractAddressToName }\n if (addressToName[address] != null) return addressToName[address]\n\n const matchedEvents = [\n instance._aci.encodedAci,\n ...instance._aci.externalEncodedAci\n ]\n .filter(({ contract }) => contract?.event)\n .map(({ contract }) => [contract.name, contract.event.variant])\n .map(([name, events]) => events.map((event: {}) => [name, Object.keys(event)[0]]))\n .flat()\n .filter(([, eventName]) => BigInt('0x' + hash(eventName).toString('hex')) === nameHash)\n switch (matchedEvents.length) {\n case 0: throw new MissingEventDefinitionError(nameHash.toString(), address)\n case 1: return matchedEvents[0][0]\n default: throw new AmbiguousEventDefinitionError(address, matchedEvents)\n }\n }\n\n /**\n * Decode Events\n * @param events - Array of encoded events (callRes.result.log)\n * @param options - Options\n * @returns DecodedEvents\n */\n instance.decodeEvents = (\n events: Event[],\n { omitUnknown, ...opt }: { omitUnknown?: boolean } = {}\n ): DecodedEvent[] => events\n .map(event => {\n const topics = event.topics.map((t: string | number) => BigInt(t))\n let contractName\n try {\n contractName = getContractNameByEvent(event.address, topics[0], opt)\n } catch (error) {\n if ((omitUnknown ?? false) && error instanceof MissingEventDefinitionError) return null\n throw error\n }\n const decoded = instance.calldata.decodeEvent(contractName, event.data, topics)\n const [name, args] = Object.entries(decoded)[0]\n return {\n name,\n args,\n contract: {\n name: contractName,\n address: event.address\n }\n }\n }).filter((e: DecodedEvent | null): e is DecodedEvent => e != null)\n\n /**\n * Generate proto function based on contract function using Contract ACI schema\n * All function can be called like:\n * ```js\n * await contract.methods.testFunction()\n * ```\n * then sdk will decide to use dry-run or send tx\n * on-chain base on if function stateful or not.\n * Also, you can manually do that:\n * ```js\n * await contract.methods.testFunction.get() // use call-static (dry-run)\n * await contract.methods.testFunction.send() // send tx on-chain\n * ```\n */\n instance.methods = Object.fromEntries(instance._aci.encodedAci.contract.functions\n .map(({ name, arguments: aciArgs, stateful }: FunctionACI) => {\n const genHandler = (callStatic: boolean) => async (...args: any[]) => {\n const options = args.length === aciArgs.length + 1 ? args.pop() : {}\n if (typeof options !== 'object') throw new TypeError(`Options should be an object: ${options as string}`)\n if (name === 'init') return await instance.deploy(args, { callStatic, ...options })\n return await instance.call(name, args, { callStatic, ...options })\n }\n return [\n name,\n Object.assign(\n genHandler(name === 'init' ? false : !stateful),\n {\n get: genHandler(true),\n send: genHandler(false)\n }\n )\n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K,CAAP;EAUD,CAlBmC,CAAnB,CAAnB;EAqBA,OAAO9G,QAAP;AACD"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Generalized Account module - routines to use generalized account
3
+ */
4
+ import { TX_TYPE } from '../tx/builder/schema';
5
+ import { BuildTxOptions } from '../tx';
6
+ import { EncodedData } from '../utils/encoder';
7
+ import AccountBase from '../account/Base';
8
+ import { SendOptions } from '../spend';
9
+ import Node from '../Node';
10
+ import { getAccount } from '../chain';
11
+ import Compiler from './Compiler';
12
+ /**
13
+ * Check if account is GA
14
+ * @param address - Account address
15
+ * @param options - Options
16
+ * @returns if account is GA
17
+ */
18
+ export declare function isGA(address: EncodedData<'ak'>, options: Parameters<typeof getAccount>[1]): Promise<boolean>;
19
+ /**
20
+ * Convert current account to GA
21
+ * @param authFnName - Authorization function name
22
+ * @param source - Auth contract source code
23
+ * @param args - init arguments
24
+ * @param options - Options
25
+ * @returns General Account Object
26
+ */
27
+ export declare function createGeneralizedAccount(authFnName: string, source: string, args: any[], { onAccount, onCompiler, onNode, ...options }: CreateGeneralizedAccountOptions): Promise<Readonly<{
28
+ owner: EncodedData<'ak'>;
29
+ transaction: EncodedData<'th'>;
30
+ rawTx: EncodedData<'tx'>;
31
+ gaContractId: EncodedData<'ct'>;
32
+ }>>;
33
+ interface CreateGeneralizedAccountOptions extends BuildTxOptions<TX_TYPE.gaAttach, 'authFun' | 'callData' | 'code' | 'ownerId' | 'gasLimit'>, SendOptions {
34
+ onAccount: AccountBase;
35
+ onCompiler: Compiler;
36
+ onNode: Node;
37
+ gasLimit?: number;
38
+ }
39
+ /**
40
+ * Create a metaTx transaction
41
+ * @param rawTransaction - Inner transaction
42
+ * @param authData - Object with gaMeta params
43
+ * @param authFnName - Authorization function name
44
+ * @param options - Options
45
+ * @param options.onAccount - Account to use
46
+ * @returns Transaction string
47
+ */
48
+ export declare function createMetaTx(rawTransaction: EncodedData<'tx'>, authData: {
49
+ gasLimit?: number;
50
+ callData?: EncodedData<'cb'>;
51
+ source?: string;
52
+ args?: any[];
53
+ }, authFnName: string, { onAccount, onCompiler, onNode, ...options }: {
54
+ onAccount: AccountBase;
55
+ onCompiler: Compiler;
56
+ onNode: Node;
57
+ } & Parameters<AccountBase['address']>[0]): Promise<EncodedData<'tx'>>;
58
+ /**
59
+ * Build a transaction hash the same as `Auth.tx_hash`
60
+ * @param transaction - tx-encoded transaction
61
+ * @param options - Options
62
+ * @param options.onNode - Node to use
63
+ * @returns Transaction hash
64
+ */
65
+ export declare function buildAuthTxHash(transaction: EncodedData<'tx'>, { onNode }: {
66
+ onNode: Node;
67
+ }): Promise<Uint8Array>;
68
+ export {};
@@ -0,0 +1,190 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+
6
+ /*
7
+ * ISC License (ISC)
8
+ * Copyright (c) 2022 aeternity developers
9
+ *
10
+ * Permission to use, copy, modify, and/or distribute this software for any
11
+ * purpose with or without fee is hereby granted, provided that the above
12
+ * copyright notice and this permission notice appear in all copies.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
+ * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
+ * PERFORMANCE OF THIS SOFTWARE.
21
+ */
22
+
23
+ /**
24
+ * Generalized Account module - routines to use generalized account
25
+ */
26
+ import { TX_TYPE, MAX_AUTH_FUN_GAS } from "../tx/builder/schema.mjs";
27
+ import { buildContractIdByContractTx, buildTx, unpackTx } from "../tx/builder/index.mjs";
28
+ import { _buildTx, getVmVersion, prepareTxParams } from "../tx/index.mjs";
29
+ import { hash } from "../utils/crypto.mjs";
30
+ import { decode } from "../utils/encoder.mjs";
31
+ import { IllegalArgumentError, MissingParamError, InvalidAuthDataError } from "../utils/errors.mjs";
32
+ import { concatBuffers } from "../utils/other.mjs";
33
+ import { getContractInstance } from "./methods.mjs";
34
+ import { send } from "../spend.mjs";
35
+ import { getAccount } from "../chain.mjs";
36
+
37
+ /**
38
+ * Check if account is GA
39
+ * @param address - Account address
40
+ * @param options - Options
41
+ * @returns if account is GA
42
+ */
43
+ export async function isGA(address, options) {
44
+ const {
45
+ contractId
46
+ } = await getAccount(address, options);
47
+ return contractId != null;
48
+ }
49
+ /**
50
+ * Convert current account to GA
51
+ * @param authFnName - Authorization function name
52
+ * @param source - Auth contract source code
53
+ * @param args - init arguments
54
+ * @param options - Options
55
+ * @returns General Account Object
56
+ */
57
+
58
+ export async function createGeneralizedAccount(authFnName, source, args, _ref) {
59
+ var _options$gasLimit;
60
+
61
+ let {
62
+ onAccount,
63
+ onCompiler,
64
+ onNode,
65
+ ...options
66
+ } = _ref;
67
+ const ownerId = await onAccount.address(options);
68
+ if (await isGA(ownerId, {
69
+ onNode
70
+ })) throw new IllegalArgumentError(`Account ${ownerId} is already GA`);
71
+ const contract = await getContractInstance({
72
+ onAccount,
73
+ onCompiler,
74
+ onNode,
75
+ source
76
+ });
77
+ const tx = await _buildTx(TX_TYPE.gaAttach, { ...options,
78
+ onNode,
79
+ code: await contract.compile(),
80
+ gasLimit: (_options$gasLimit = options.gasLimit) !== null && _options$gasLimit !== void 0 ? _options$gasLimit : await contract._estimateGas('init', args, options),
81
+ ownerId,
82
+ callData: contract.calldata.encode(contract._name, 'init', args),
83
+ authFun: hash(authFnName)
84
+ });
85
+ const contractId = buildContractIdByContractTx(tx);
86
+ const {
87
+ hash: transaction,
88
+ rawTx
89
+ } = await send(tx, {
90
+ onNode,
91
+ onAccount,
92
+ onCompiler,
93
+ ...options
94
+ });
95
+ return Object.freeze({
96
+ owner: ownerId,
97
+ transaction,
98
+ rawTx,
99
+ gaContractId: contractId
100
+ });
101
+ }
102
+
103
+ /**
104
+ * Create a metaTx transaction
105
+ * @param rawTransaction - Inner transaction
106
+ * @param authData - Object with gaMeta params
107
+ * @param authFnName - Authorization function name
108
+ * @param options - Options
109
+ * @param options.onAccount - Account to use
110
+ * @returns Transaction string
111
+ */
112
+ export async function createMetaTx(rawTransaction, authData, authFnName, _ref2) {
113
+ var _authData$gasLimit, _authData$callData;
114
+
115
+ let {
116
+ onAccount,
117
+ onCompiler,
118
+ onNode,
119
+ ...options
120
+ } = _ref2;
121
+
122
+ const wrapInEmptySignedTx = tx => buildTx({
123
+ encodedTx: tx,
124
+ signatures: []
125
+ }, TX_TYPE.signed);
126
+
127
+ if (Object.keys(authData).length <= 0) throw new MissingParamError('authData is required');
128
+ const gasLimit = (_authData$gasLimit = authData.gasLimit) !== null && _authData$gasLimit !== void 0 ? _authData$gasLimit : MAX_AUTH_FUN_GAS;
129
+
130
+ if (gasLimit > MAX_AUTH_FUN_GAS) {
131
+ throw new InvalidAuthDataError(`the maximum gasLimit value for ga authFun is ${MAX_AUTH_FUN_GAS}, got ${gasLimit}`);
132
+ }
133
+
134
+ const authCallData = (_authData$callData = authData.callData) !== null && _authData$callData !== void 0 ? _authData$callData : await (async () => {
135
+ if (authData.source == null || authData.args == null) throw new InvalidAuthDataError('Auth data must contain source code and arguments.');
136
+ const contract = await getContractInstance({
137
+ onAccount,
138
+ onCompiler,
139
+ onNode,
140
+ source: authData.source
141
+ });
142
+ return contract.calldata.encode(contract._name, authFnName, authData.args);
143
+ })();
144
+ const {
145
+ abiVersion
146
+ } = await getVmVersion(TX_TYPE.contractCall, {
147
+ onNode
148
+ });
149
+ const wrappedTx = wrapInEmptySignedTx(unpackTx(rawTransaction));
150
+ const params = { ...options,
151
+ tx: { ...wrappedTx,
152
+ tx: wrappedTx.txObject
153
+ },
154
+ gaId: await onAccount.address(options),
155
+ abiVersion,
156
+ authData: authCallData,
157
+ gasLimit,
158
+ vsn: 2
159
+ }; // @ts-expect-error createMetaTx needs to be integrated into tx builder
160
+
161
+ const {
162
+ fee
163
+ } = await prepareTxParams(TX_TYPE.gaMeta, { ...params,
164
+ onNode
165
+ });
166
+ const {
167
+ rlpEncoded: metaTxRlp
168
+ } = buildTx({ ...params,
169
+ fee
170
+ }, TX_TYPE.gaMeta);
171
+ return wrapInEmptySignedTx(metaTxRlp).tx;
172
+ }
173
+ /**
174
+ * Build a transaction hash the same as `Auth.tx_hash`
175
+ * @param transaction - tx-encoded transaction
176
+ * @param options - Options
177
+ * @param options.onNode - Node to use
178
+ * @returns Transaction hash
179
+ */
180
+
181
+ export async function buildAuthTxHash(transaction, _ref3) {
182
+ let {
183
+ onNode
184
+ } = _ref3;
185
+ const {
186
+ networkId
187
+ } = await onNode.getStatus();
188
+ return new Uint8Array(hash(concatBuffers([_Buffer.from(networkId), decode(transaction)])));
189
+ }
190
+ //# sourceMappingURL=ga.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ga.mjs","names":["TX_TYPE","MAX_AUTH_FUN_GAS","buildContractIdByContractTx","buildTx","unpackTx","_buildTx","getVmVersion","prepareTxParams","hash","decode","IllegalArgumentError","MissingParamError","InvalidAuthDataError","concatBuffers","getContractInstance","send","getAccount","isGA","address","options","contractId","createGeneralizedAccount","authFnName","source","args","onAccount","onCompiler","onNode","ownerId","contract","tx","gaAttach","code","compile","gasLimit","_estimateGas","callData","calldata","encode","_name","authFun","transaction","rawTx","Object","freeze","owner","gaContractId","createMetaTx","rawTransaction","authData","wrapInEmptySignedTx","encodedTx","signatures","signed","keys","length","authCallData","abiVersion","contractCall","wrappedTx","params","txObject","gaId","vsn","fee","gaMeta","rlpEncoded","metaTxRlp","buildAuthTxHash","networkId","getStatus","Uint8Array","from"],"sources":["../../src/contract/ga.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Generalized Account module - routines to use generalized account\n */\n\nimport { TX_TYPE, MAX_AUTH_FUN_GAS, TxSchema } from '../tx/builder/schema'\nimport { buildContractIdByContractTx, buildTx, BuiltTx, TxUnpacked, unpackTx } from '../tx/builder'\nimport { _buildTx, BuildTxOptions, getVmVersion, prepareTxParams } from '../tx'\nimport { hash } from '../utils/crypto'\nimport { decode, EncodedData } from '../utils/encoder'\nimport { IllegalArgumentError, MissingParamError, InvalidAuthDataError } from '../utils/errors'\nimport { concatBuffers } from '../utils/other'\nimport AccountBase from '../account/Base'\nimport { getContractInstance } from './methods'\nimport { send, SendOptions } from '../spend'\nimport Node from '../Node'\nimport { getAccount } from '../chain'\nimport Compiler from './Compiler'\n\n/**\n * Check if account is GA\n * @param address - Account address\n * @param options - Options\n * @returns if account is GA\n */\nexport async function isGA (\n address: EncodedData<'ak'>, options: Parameters<typeof getAccount>[1]\n): Promise<boolean> {\n const { contractId } = await getAccount(address, options)\n return contractId != null\n}\n\n/**\n * Convert current account to GA\n * @param authFnName - Authorization function name\n * @param source - 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 source: string,\n args: any[],\n { onAccount, onCompiler, onNode, ...options }: CreateGeneralizedAccountOptions\n): Promise<Readonly<{\n owner: EncodedData<'ak'>\n transaction: EncodedData<'th'>\n rawTx: EncodedData<'tx'>\n gaContractId: EncodedData<'ct'>\n }>> {\n const ownerId = await onAccount.address(options)\n if (await isGA(ownerId, { onNode })) throw new IllegalArgumentError(`Account ${ownerId} is already GA`)\n\n const contract = await getContractInstance({ onAccount, onCompiler, onNode, source })\n\n const tx = await _buildTx(TX_TYPE.gaAttach, {\n ...options,\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 send(tx, { onNode, onAccount, onCompiler, ...options })\n\n return Object.freeze({\n owner: ownerId,\n transaction,\n rawTx,\n gaContractId: contractId\n })\n}\n\ninterface CreateGeneralizedAccountOptions extends\n BuildTxOptions<TX_TYPE.gaAttach, 'authFun' | 'callData' | 'code' | 'ownerId' | 'gasLimit'>,\n SendOptions {\n onAccount: AccountBase\n onCompiler: Compiler\n onNode: Node\n gasLimit?: number\n}\n\n/**\n * Create a metaTx transaction\n * @param rawTransaction - Inner transaction\n * @param authData - Object with gaMeta params\n * @param authFnName - Authorization function name\n * @param options - Options\n * @param options.onAccount - Account to use\n * @returns Transaction string\n */\nexport async function createMetaTx (\n rawTransaction: EncodedData<'tx'>,\n authData: {\n gasLimit?: number\n callData?: EncodedData<'cb'>\n source?: string\n args?: any[]\n },\n authFnName: string,\n { onAccount, onCompiler, onNode, ...options }:\n { onAccount: AccountBase, onCompiler: Compiler, onNode: Node }\n & Parameters<AccountBase['address']>[0]\n): Promise<EncodedData<'tx'>> {\n const wrapInEmptySignedTx = (\n tx: EncodedData<'tx'> | Uint8Array | TxUnpacked<TxSchema>\n ): BuiltTx<TxSchema, 'tx'> => buildTx({ encodedTx: tx, signatures: [] }, TX_TYPE.signed)\n\n if (Object.keys(authData).length <= 0) throw new MissingParamError('authData is required')\n\n const gasLimit = authData.gasLimit ?? MAX_AUTH_FUN_GAS\n if (gasLimit > MAX_AUTH_FUN_GAS) {\n throw new InvalidAuthDataError(`the maximum gasLimit value for ga authFun is ${MAX_AUTH_FUN_GAS}, got ${gasLimit}`)\n }\n\n const authCallData = authData.callData ?? await (async () => {\n if (authData.source == null || authData.args == null) throw new InvalidAuthDataError('Auth data must contain source code and arguments.')\n const contract = await getContractInstance({\n onAccount, onCompiler, onNode, source: authData.source\n })\n return contract.calldata.encode(contract._name, authFnName, authData.args)\n })()\n\n const { abiVersion } = await getVmVersion(TX_TYPE.contractCall, { onNode })\n const wrappedTx = wrapInEmptySignedTx(unpackTx<TX_TYPE.signed>(rawTransaction))\n const params = {\n ...options,\n tx: {\n ...wrappedTx,\n tx: wrappedTx.txObject\n },\n gaId: await onAccount.address(options),\n abiVersion,\n authData: authCallData,\n gasLimit,\n vsn: 2\n }\n // @ts-expect-error createMetaTx needs to be integrated into tx builder\n const { fee } = await prepareTxParams(TX_TYPE.gaMeta, { ...params, onNode })\n const { rlpEncoded: metaTxRlp } = buildTx({ ...params, fee }, TX_TYPE.gaMeta)\n return wrapInEmptySignedTx(metaTxRlp).tx\n}\n\n/**\n * Build a transaction hash the same as `Auth.tx_hash`\n * @param transaction - tx-encoded transaction\n * @param options - Options\n * @param options.onNode - Node to use\n * @returns Transaction hash\n */\nexport async function buildAuthTxHash (\n transaction: EncodedData<'tx'>,\n { onNode }: { onNode: Node }\n): Promise<Uint8Array> {\n const { networkId } = await onNode.getStatus()\n return new Uint8Array(hash(\n concatBuffers([Buffer.from(networkId), decode(transaction)])\n ))\n}\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;SAESA,O,EAASC,gB;S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B,CAAzC;EACA,OAAOf,mBAAmB,CAACiB,SAAD,CAAnB,CAA+BrC,EAAtC;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,eAAesC,eAAf,CACL3B,WADK,SAGgB;EAAA,IADrB;IAAEd;EAAF,CACqB;EACrB,MAAM;IAAE0C;EAAF,IAAgB,MAAM1C,MAAM,CAAC2C,SAAP,EAA5B;EACA,OAAO,IAAIC,UAAJ,CAAe/D,IAAI,CACxBK,aAAa,CAAC,CAAC,QAAO2D,IAAP,CAAYH,SAAZ,CAAD,EAAyB5D,MAAM,CAACgC,WAAD,CAA/B,CAAD,CADW,CAAnB,CAAP;AAGD"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Contract module - routines to interact with the æternity contract
3
+ *
4
+ * High level documentation of the contracts are available at
5
+ * https://github.com/aeternity/protocol/tree/master/contracts and
6
+ */
7
+ import { AensName } from '../tx/builder/schema';
8
+ import { EncodedData } from '../utils/encoder';
9
+ import AccountBase from '../account/Base';
10
+ import Node from '../Node';
11
+ export { default as getContractInstance } from './aci';
12
+ /**
13
+ * Utility method to create a delegate signature for a contract
14
+ * @param ids - The list of id's to prepend
15
+ * @param opt - Options
16
+ * @param opt.onNode - Node to use
17
+ * @param opt.onAccount - Account to use
18
+ * @returns Signature in hex representation
19
+ */
20
+ declare function delegateSignatureCommon(ids: (`th_${string}` | `ok_${string}` | `ba_${string}` | `cb_${string}` | `or_${string}` | `ov_${string}` | `pi_${string}` | `ss_${string}` | `cs_${string}` | `ck_${string}` | `cv_${string}` | `st_${string}` | `tx_${string}` | `ak_${string}` | `bf_${string}` | `bs_${string}` | `bx_${string}` | `ch_${string}` | `cm_${string}` | `ct_${string}` | `kh_${string}` | `mh_${string}` | `nm_${string}` | `oq_${string}` | `pp_${string}` | `sg_${string}`)[] | undefined, { onAccount, onNode, ...opt }: {
21
+ onAccount: AccountBase;
22
+ onNode: Node;
23
+ } & Parameters<AccountBase['sign']>[1]): Promise<string>;
24
+ /**
25
+ * Helper to generate a signature to delegate pre-claim/claim/transfer/revoke of a name to
26
+ * a contract.
27
+ * @param contractId - Contract Id
28
+ * @param opt - Options
29
+ * @param opt.name - The name
30
+ * @returns Signature for delegation
31
+ * @example
32
+ * ```js
33
+ * const aeSdk = new AeSdk({ ... })
34
+ * const contractId = 'ct_asd2ks...' // contract address
35
+ * const name = 'example.chain' // AENS name
36
+ * const onAccount = await aeSdk.address() // Sign with a specific account
37
+ * // Preclaim signature
38
+ * const preclaimSig = await aeSdk.createAensDelegationSignature(contractId, { onAccount: current })
39
+ * // Claim, transfer and revoke signature
40
+ * const aensDelegationSig = await contract.createAensDelegationSignature(
41
+ * contractId, { name, onAccount: current }
42
+ * )
43
+ * ```
44
+ */
45
+ export declare function createAensDelegationSignature(contractId: EncodedData<'ct'>, opt: Parameters<AccountBase['address']>[0] & Parameters<typeof delegateSignatureCommon>[1] & {
46
+ name?: AensName;
47
+ }): Promise<string>;
48
+ /**
49
+ * Helper to generate a signature to delegate register/extend/respond of a Oracle to a contract.
50
+ * @param contractId - Contract Id
51
+ * @param opt - Options
52
+ * @param opt.queryId - Oracle Query Id
53
+ * @returns Signature for delegation
54
+ * @example
55
+ * ```js
56
+ * const aeSdk = new AeSdk({ ... })
57
+ * const contractId = 'ct_asd2ks...' // contract address
58
+ * const queryId = 'oq_...' // Oracle Query Id
59
+ * const onAccount = await aeSdk.address() // Sign with a specific account
60
+ * // Oracle register and extend signature
61
+ * const oracleDelegationSig = await aeSdk.createOracleDelegationSignature(contractId)
62
+ * // Oracle respond signature
63
+ * const respondSig = await aeSdk.createOracleDelegationSignature(contractId, { queryId })
64
+ * ```
65
+ */
66
+ export declare function createOracleDelegationSignature(contractId: EncodedData<'ct'>, opt: Parameters<AccountBase['address']>[0] & Parameters<typeof delegateSignatureCommon>[1] & {
67
+ queryId?: EncodedData<'oq'>;
68
+ }): Promise<string>;
@@ -0,0 +1,101 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+
6
+ /*
7
+ * ISC License (ISC)
8
+ * Copyright (c) 2022 aeternity developers
9
+ *
10
+ * Permission to use, copy, modify, and/or distribute this software for any
11
+ * purpose with or without fee is hereby granted, provided that the above
12
+ * copyright notice and this permission notice appear in all copies.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
+ * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
+ * PERFORMANCE OF THIS SOFTWARE.
21
+ */
22
+
23
+ /**
24
+ * Contract module - routines to interact with the æternity contract
25
+ *
26
+ * High level documentation of the contracts are available at
27
+ * https://github.com/aeternity/protocol/tree/master/contracts and
28
+ */
29
+ import { decode, produceNameId } from "../tx/builder/helpers.mjs";
30
+ import { concatBuffers } from "../utils/other.mjs";
31
+ export { default as getContractInstance } from "./aci.mjs";
32
+ /**
33
+ * Utility method to create a delegate signature for a contract
34
+ * @param ids - The list of id's to prepend
35
+ * @param opt - Options
36
+ * @param opt.onNode - Node to use
37
+ * @param opt.onAccount - Account to use
38
+ * @returns Signature in hex representation
39
+ */
40
+
41
+ async function delegateSignatureCommon() {
42
+ let ids = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
43
+ let {
44
+ onAccount,
45
+ onNode,
46
+ ...opt
47
+ } = arguments.length > 1 ? arguments[1] : undefined;
48
+ const signature = await onAccount.sign(concatBuffers([_Buffer.from((await onNode.getStatus()).networkId), ...ids.map(e => decode(e))]), opt);
49
+ return _Buffer.from(signature).toString('hex');
50
+ }
51
+ /**
52
+ * Helper to generate a signature to delegate pre-claim/claim/transfer/revoke of a name to
53
+ * a contract.
54
+ * @param contractId - Contract Id
55
+ * @param opt - Options
56
+ * @param opt.name - The name
57
+ * @returns Signature for delegation
58
+ * @example
59
+ * ```js
60
+ * const aeSdk = new AeSdk({ ... })
61
+ * const contractId = 'ct_asd2ks...' // contract address
62
+ * const name = 'example.chain' // AENS name
63
+ * const onAccount = await aeSdk.address() // Sign with a specific account
64
+ * // Preclaim signature
65
+ * const preclaimSig = await aeSdk.createAensDelegationSignature(contractId, { onAccount: current })
66
+ * // Claim, transfer and revoke signature
67
+ * const aensDelegationSig = await contract.createAensDelegationSignature(
68
+ * contractId, { name, onAccount: current }
69
+ * )
70
+ * ```
71
+ */
72
+
73
+
74
+ export async function createAensDelegationSignature(contractId, opt) {
75
+ return await delegateSignatureCommon([await opt.onAccount.address(opt), ...(opt.name != null ? [produceNameId(opt.name)] : []), contractId], opt);
76
+ }
77
+ /**
78
+ * Helper to generate a signature to delegate register/extend/respond of a Oracle to a contract.
79
+ * @param contractId - Contract Id
80
+ * @param opt - Options
81
+ * @param opt.queryId - Oracle Query Id
82
+ * @returns Signature for delegation
83
+ * @example
84
+ * ```js
85
+ * const aeSdk = new AeSdk({ ... })
86
+ * const contractId = 'ct_asd2ks...' // contract address
87
+ * const queryId = 'oq_...' // Oracle Query Id
88
+ * const onAccount = await aeSdk.address() // Sign with a specific account
89
+ * // Oracle register and extend signature
90
+ * const oracleDelegationSig = await aeSdk.createOracleDelegationSignature(contractId)
91
+ * // Oracle respond signature
92
+ * const respondSig = await aeSdk.createOracleDelegationSignature(contractId, { queryId })
93
+ * ```
94
+ */
95
+
96
+ export async function createOracleDelegationSignature(contractId, opt) {
97
+ var _opt$queryId;
98
+
99
+ return await delegateSignatureCommon([(_opt$queryId = opt.queryId) !== null && _opt$queryId !== void 0 ? _opt$queryId : await opt.onAccount.address(opt), contractId], opt);
100
+ }
101
+ //# sourceMappingURL=methods.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"methods.mjs","names":["decode","produceNameId","concatBuffers","default","getContractInstance","delegateSignatureCommon","ids","onAccount","onNode","opt","signature","sign","from","getStatus","networkId","map","e","toString","createAensDelegationSignature","contractId","address","name","createOracleDelegationSignature","queryId"],"sources":["../../src/contract/methods.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Contract module - routines to interact with the æternity contract\n *\n * High level documentation of the contracts are available at\n * https://github.com/aeternity/protocol/tree/master/contracts and\n */\n\nimport { AensName } from '../tx/builder/schema'\nimport { decode, produceNameId } from '../tx/builder/helpers'\nimport { concatBuffers } from '../utils/other'\nimport { EncodedData, EncodingType } from '../utils/encoder'\nimport AccountBase from '../account/Base'\nimport Node from '../Node'\nexport { default as getContractInstance } from './aci'\n\n/**\n * Utility method to create a delegate signature for a contract\n * @param ids - The list of id's to prepend\n * @param opt - Options\n * @param opt.onNode - Node to use\n * @param opt.onAccount - Account to use\n * @returns Signature in hex representation\n */\nasync function delegateSignatureCommon (\n ids: Array<EncodedData<EncodingType>> = [],\n { onAccount, onNode, ...opt }:\n { onAccount: AccountBase, onNode: Node } & Parameters<AccountBase['sign']>[1]\n): Promise<string> {\n const signature = await onAccount.sign(\n concatBuffers([\n Buffer.from((await onNode.getStatus()).networkId),\n ...ids.map(e => decode(e))\n ]),\n opt\n )\n return Buffer.from(signature).toString('hex')\n}\n\n/**\n * Helper to generate a signature to delegate pre-claim/claim/transfer/revoke of a name to\n * a contract.\n * @param contractId - Contract Id\n * @param opt - Options\n * @param opt.name - The name\n * @returns Signature for delegation\n * @example\n * ```js\n * const aeSdk = new AeSdk({ ... })\n * const contractId = 'ct_asd2ks...' // contract address\n * const name = 'example.chain' // AENS name\n * const onAccount = await aeSdk.address() // Sign with a specific account\n * // Preclaim signature\n * const preclaimSig = await aeSdk.createAensDelegationSignature(contractId, { onAccount: current })\n * // Claim, transfer and revoke signature\n * const aensDelegationSig = await contract.createAensDelegationSignature(\n * contractId, { name, onAccount: current }\n * )\n * ```\n */\nexport async function createAensDelegationSignature (\n contractId: EncodedData<'ct'>,\n opt: Parameters<AccountBase['address']>[0] & Parameters<typeof delegateSignatureCommon>[1] &\n { name?: AensName }\n): Promise<string> {\n return await delegateSignatureCommon(\n [\n await opt.onAccount.address(opt),\n ...opt.name != null ? [produceNameId(opt.name)] : [],\n contractId\n ],\n opt\n )\n}\n\n/**\n * Helper to generate a signature to delegate register/extend/respond of a Oracle to a contract.\n * @param contractId - Contract Id\n * @param opt - Options\n * @param opt.queryId - Oracle Query Id\n * @returns Signature for delegation\n * @example\n * ```js\n * const aeSdk = new AeSdk({ ... })\n * const contractId = 'ct_asd2ks...' // contract address\n * const queryId = 'oq_...' // Oracle Query Id\n * const onAccount = await aeSdk.address() // Sign with a specific account\n * // Oracle register and extend signature\n * const oracleDelegationSig = await aeSdk.createOracleDelegationSignature(contractId)\n * // Oracle respond signature\n * const respondSig = await aeSdk.createOracleDelegationSignature(contractId, { queryId })\n * ```\n */\nexport async function createOracleDelegationSignature (\n contractId: EncodedData<'ct'>,\n opt: Parameters<AccountBase['address']>[0] & Parameters<typeof delegateSignatureCommon>[1] &\n { queryId?: EncodedData<'oq'> }\n): Promise<string> {\n return await delegateSignatureCommon(\n [opt.queryId ?? await opt.onAccount.address(opt), contractId], opt\n )\n}\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;SAGSA,M,EAAQC,a;SACRC,a;SAIAC,OAAO,IAAIC,mB;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeC,uBAAf,GAImB;EAAA,IAHjBC,GAGiB,uEAHuB,EAGvB;EAAA,IAFjB;IAAEC,SAAF;IAAaC,MAAb;IAAqB,GAAGC;EAAxB,CAEiB;EACjB,MAAMC,SAAS,GAAG,MAAMH,SAAS,CAACI,IAAV,CACtBT,aAAa,CAAC,CACZ,QAAOU,IAAP,CAAY,CAAC,MAAMJ,MAAM,CAACK,SAAP,EAAP,EAA2BC,SAAvC,CADY,EAEZ,GAAGR,GAAG,CAACS,GAAJ,CAAQC,CAAC,IAAIhB,MAAM,CAACgB,CAAD,CAAnB,CAFS,CAAD,CADS,EAKtBP,GALsB,CAAxB;EAOA,OAAO,QAAOG,IAAP,CAAYF,SAAZ,EAAuBO,QAAvB,CAAgC,KAAhC,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,eAAeC,6BAAf,CACLC,UADK,EAELV,GAFK,EAIY;EACjB,OAAO,MAAMJ,uBAAuB,CAClC,CACE,MAAMI,GAAG,CAACF,SAAJ,CAAca,OAAd,CAAsBX,GAAtB,CADR,EAEE,IAAGA,GAAG,CAACY,IAAJ,IAAY,IAAZ,GAAmB,CAACpB,aAAa,CAACQ,GAAG,CAACY,IAAL,CAAd,CAAnB,GAA+C,EAAlD,CAFF,EAGEF,UAHF,CADkC,EAMlCV,GANkC,CAApC;AAQD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,eAAea,+BAAf,CACLH,UADK,EAELV,GAFK,EAIY;EAAA;;EACjB,OAAO,MAAMJ,uBAAuB,CAClC,iBAACI,GAAG,CAACc,OAAL,uDAAgB,MAAMd,GAAG,CAACF,SAAJ,CAAca,OAAd,CAAsBX,GAAtB,CAAtB,EAAkDU,UAAlD,CADkC,EAC6BV,GAD7B,CAApC;AAGD"}
package/es/index.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ export * from './chain';
2
+ export * from './utils/crypto';
3
+ export * from './utils/keystore';
4
+ export * from './utils/bytes';
5
+ export * from './tx';
6
+ export * from './tx/builder';
7
+ export * from './tx/builder/helpers';
8
+ export * from './tx/builder/schema';
9
+ export * from './utils/amount-formatter';
10
+ export * from './utils/hd-wallet';
11
+ export * from './aens';
12
+ export * from './contract/methods';
13
+ export * from './oracle';
14
+ export * from './spend';
15
+ export * from './contract/ga';
16
+ export { default as AeSdkBase } from './AeSdkBase';
17
+ export { default as AeSdk } from './AeSdk';
18
+ export { default as AeSdkAepp } from './AeSdkAepp';
19
+ export { default as AeSdkWallet } from './AeSdkWallet';
20
+ export { default as Node } from './Node';
21
+ export { default as verifyTransaction } from './tx/validator';
22
+ export { default as calculateMinFee } from './tx/min-fee';
23
+ export { default as AccountBase } from './account/Base';
24
+ export { default as MemoryAccount } from './account/Memory';
25
+ export { default as Compiler } from './contract/Compiler';
26
+ export { default as Channel } from './channel';
27
+ export { default as connectionProxy } from './aepp-wallet-communication/connection-proxy';
28
+ export * from './aepp-wallet-communication/schema';
29
+ export { default as walletDetector } from './aepp-wallet-communication/wallet-detector';
30
+ export { default as BrowserRuntimeConnection } from './aepp-wallet-communication/connection/BrowserRuntime';
31
+ export { default as BrowserWindowMessageConnection } from './aepp-wallet-communication/connection/BrowserWindowMessage';
32
+ export * from './utils/errors';
package/es/index.mjs ADDED
@@ -0,0 +1,49 @@
1
+ /*
2
+ * ISC License (ISC)
3
+ * Copyright (c) 2022 aeternity developers
4
+ *
5
+ * Permission to use, copy, modify, and/or distribute this software for any
6
+ * purpose with or without fee is hereby granted, provided that the above
7
+ * copyright notice and this permission notice appear in all copies.
8
+ *
9
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ * PERFORMANCE OF THIS SOFTWARE.
16
+ */
17
+ export * from "./chain.mjs";
18
+ export * from "./utils/crypto.mjs";
19
+ export * from "./utils/keystore.mjs";
20
+ export * from "./utils/bytes.mjs";
21
+ export * from "./tx/index.mjs";
22
+ export * from "./tx/builder/index.mjs";
23
+ export * from "./tx/builder/helpers.mjs";
24
+ export * from "./tx/builder/schema.mjs";
25
+ export * from "./utils/amount-formatter.mjs";
26
+ export * from "./utils/hd-wallet.mjs";
27
+ export * from "./aens.mjs";
28
+ export * from "./contract/methods.mjs";
29
+ export * from "./oracle.mjs";
30
+ export * from "./spend.mjs";
31
+ export * from "./contract/ga.mjs";
32
+ export { default as AeSdkBase } from "./AeSdkBase.mjs";
33
+ export { default as AeSdk } from "./AeSdk.mjs";
34
+ export { default as AeSdkAepp } from "./AeSdkAepp.mjs";
35
+ export { default as AeSdkWallet } from "./AeSdkWallet.mjs";
36
+ export { default as Node } from "./Node.mjs";
37
+ export { default as verifyTransaction } from "./tx/validator.mjs";
38
+ export { default as calculateMinFee } from "./tx/min-fee.mjs";
39
+ export { default as AccountBase } from "./account/Base.mjs";
40
+ export { default as MemoryAccount } from "./account/Memory.mjs";
41
+ export { default as Compiler } from "./contract/Compiler.mjs";
42
+ export { default as Channel } from "./channel/index.mjs";
43
+ export { default as connectionProxy } from "./aepp-wallet-communication/connection-proxy.mjs";
44
+ export * from "./aepp-wallet-communication/schema.mjs";
45
+ export { default as walletDetector } from "./aepp-wallet-communication/wallet-detector.mjs";
46
+ export { default as BrowserRuntimeConnection } from "./aepp-wallet-communication/connection/BrowserRuntime.mjs";
47
+ export { default as BrowserWindowMessageConnection } from "./aepp-wallet-communication/connection/BrowserWindowMessage.mjs";
48
+ export * from "./utils/errors.mjs";
49
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["default","AeSdkBase","AeSdk","AeSdkAepp","AeSdkWallet","Node","verifyTransaction","calculateMinFee","AccountBase","MemoryAccount","Compiler","Channel","connectionProxy","walletDetector","BrowserRuntimeConnection","BrowserWindowMessageConnection"],"sources":["../src/index.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\nexport * from './chain'\nexport * from './utils/crypto'\nexport * from './utils/keystore'\nexport * from './utils/bytes'\nexport * from './tx'\nexport * from './tx/builder'\nexport * from './tx/builder/helpers'\nexport * from './tx/builder/schema'\nexport * from './utils/amount-formatter'\nexport * from './utils/hd-wallet'\nexport * from './aens'\nexport * from './contract/methods'\nexport * from './oracle'\nexport * from './spend'\nexport * from './contract/ga'\n\nexport { default as AeSdkBase } from './AeSdkBase'\nexport { default as AeSdk } from './AeSdk'\nexport { default as AeSdkAepp } from './AeSdkAepp'\nexport { default as AeSdkWallet } from './AeSdkWallet'\nexport { default as Node } from './Node'\nexport { default as verifyTransaction } from './tx/validator'\nexport { default as calculateMinFee } from './tx/min-fee'\nexport { default as AccountBase } from './account/Base'\nexport { default as MemoryAccount } from './account/Memory'\nexport { default as Compiler } from './contract/Compiler'\nexport { default as Channel } from './channel'\n\nexport { default as connectionProxy } from './aepp-wallet-communication/connection-proxy'\nexport * from './aepp-wallet-communication/schema'\nexport { default as walletDetector } from './aepp-wallet-communication/wallet-detector'\nexport { default as BrowserRuntimeConnection } from './aepp-wallet-communication/connection/BrowserRuntime'\nexport { default as BrowserWindowMessageConnection } from './aepp-wallet-communication/connection/BrowserWindowMessage'\nexport * from './utils/errors'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;SAkBSA,OAAO,IAAIC,S;SACXD,OAAO,IAAIE,K;SACXF,OAAO,IAAIG,S;SACXH,OAAO,IAAII,W;SACXJ,OAAO,IAAIK,I;SACXL,OAAO,IAAIM,iB;SACXN,OAAO,IAAIO,e;SACXP,OAAO,IAAIQ,W;SACXR,OAAO,IAAIS,a;SACXT,OAAO,IAAIU,Q;SACXV,OAAO,IAAIW,O;SAEXX,OAAO,IAAIY,e;;SAEXZ,OAAO,IAAIa,c;SACXb,OAAO,IAAIc,wB;SACXd,OAAO,IAAIe,8B"}