@aeternity/aepp-sdk 13.0.1 → 13.2.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 (322) hide show
  1. package/README.md +4 -2
  2. package/bin/aesophia_cli +0 -0
  3. package/dist/aepp-sdk.browser-script.js +1 -1
  4. package/dist/aepp-sdk.browser-script.js.map +1 -1
  5. package/dist/aepp-sdk.browser.js +1 -1
  6. package/dist/aepp-sdk.browser.js.map +1 -1
  7. package/dist/aepp-sdk.js +28490 -17706
  8. package/dist/aepp-sdk.js.map +1 -1
  9. package/es/AeSdkAepp.mjs.map +1 -1
  10. package/es/AeSdkBase.d.ts +21 -3
  11. package/es/AeSdkBase.mjs +51 -3
  12. package/es/AeSdkBase.mjs.map +1 -1
  13. package/es/AeSdkMethods.d.ts +9 -14
  14. package/es/AeSdkMethods.mjs +20 -49
  15. package/es/AeSdkMethods.mjs.map +1 -1
  16. package/es/AeSdkWallet.d.ts +1 -1
  17. package/es/AeSdkWallet.mjs +79 -23
  18. package/es/AeSdkWallet.mjs.map +1 -1
  19. package/es/Middleware.d.ts +38 -0
  20. package/es/Middleware.mjs +90 -0
  21. package/es/Middleware.mjs.map +1 -0
  22. package/es/MiddlewareSubscriber.d.ts +30 -0
  23. package/es/MiddlewareSubscriber.mjs +198 -0
  24. package/es/MiddlewareSubscriber.mjs.map +1 -0
  25. package/es/Node.d.ts +1 -1
  26. package/es/Node.mjs.map +1 -1
  27. package/es/account/Base.d.ts +57 -3
  28. package/es/account/Base.mjs +95 -1
  29. package/es/account/Base.mjs.map +1 -1
  30. package/es/account/Generalized.d.ts +4 -0
  31. package/es/account/Generalized.mjs +20 -0
  32. package/es/account/Generalized.mjs.map +1 -1
  33. package/es/account/Ledger.d.ts +4 -0
  34. package/es/account/Ledger.mjs +20 -0
  35. package/es/account/Ledger.mjs.map +1 -1
  36. package/es/account/LedgerFactory.mjs.map +1 -1
  37. package/es/account/Memory.d.ts +12 -0
  38. package/es/account/Memory.mjs +52 -0
  39. package/es/account/Memory.mjs.map +1 -1
  40. package/es/account/Rpc.d.ts +5 -6
  41. package/es/account/Rpc.mjs +53 -10
  42. package/es/account/Rpc.mjs.map +1 -1
  43. package/es/aens.d.ts +1 -1
  44. package/es/aens.mjs +1 -1
  45. package/es/aens.mjs.map +1 -1
  46. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  47. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  48. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  49. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
  50. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -2
  51. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  52. package/es/aepp-wallet-communication/rpc/types.d.ts +19 -0
  53. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  54. package/es/aepp-wallet-communication/schema.d.ts +2 -8
  55. package/es/aepp-wallet-communication/schema.mjs +21 -33
  56. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  57. package/es/aepp-wallet-communication/wallet-detector.d.ts +1 -1
  58. package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
  59. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  60. package/es/apis/compiler/compiler.mjs +15 -1
  61. package/es/apis/compiler/compiler.mjs.map +1 -1
  62. package/es/apis/compiler/models/index.d.ts +1 -7
  63. package/es/apis/compiler/models/index.mjs.map +1 -1
  64. package/es/apis/compiler/models/mappers.d.ts +0 -1
  65. package/es/apis/compiler/models/mappers.mjs +0 -43
  66. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  67. package/es/apis/middleware/index.d.ts +2 -0
  68. package/es/apis/middleware/index.mjs +3 -0
  69. package/es/apis/middleware/index.mjs.map +1 -0
  70. package/es/apis/middleware/middleware.d.ts +309 -0
  71. package/es/apis/middleware/middleware.mjs +1527 -0
  72. package/es/apis/middleware/middleware.mjs.map +1 -0
  73. package/es/apis/middleware/models/index.d.ts +1496 -0
  74. package/es/apis/middleware/models/index.mjs +580 -0
  75. package/es/apis/middleware/models/index.mjs.map +1 -0
  76. package/es/apis/middleware/models/mappers.d.ts +102 -0
  77. package/es/apis/middleware/models/mappers.mjs +3334 -0
  78. package/es/apis/middleware/models/mappers.mjs.map +1 -0
  79. package/es/apis/middleware/models/parameters.d.ts +43 -0
  80. package/es/apis/middleware/models/parameters.mjs +417 -0
  81. package/es/apis/middleware/models/parameters.mjs.map +1 -0
  82. package/es/apis/node/node.mjs.map +1 -1
  83. package/es/chain.d.ts +2 -1
  84. package/es/chain.mjs +5 -3
  85. package/es/chain.mjs.map +1 -1
  86. package/es/channel/Base.d.ts +1 -1
  87. package/es/channel/Base.mjs +1 -4
  88. package/es/channel/Base.mjs.map +1 -1
  89. package/es/channel/Contract.mjs.map +1 -1
  90. package/es/channel/Spend.mjs.map +1 -1
  91. package/es/channel/handlers.mjs +2 -2
  92. package/es/channel/handlers.mjs.map +1 -1
  93. package/es/channel/internal.mjs +7 -5
  94. package/es/channel/internal.mjs.map +1 -1
  95. package/es/contract/Contract.mjs +2 -2
  96. package/es/contract/Contract.mjs.map +1 -1
  97. package/es/contract/compiler/Base.d.ts +21 -0
  98. package/es/contract/compiler/Base.mjs.map +1 -1
  99. package/es/contract/compiler/Cli.d.ts +2 -0
  100. package/es/contract/compiler/Cli.mjs +24 -3
  101. package/es/contract/compiler/Cli.mjs.map +1 -1
  102. package/es/contract/compiler/Http.d.ts +2 -0
  103. package/es/contract/compiler/Http.mjs +22 -2
  104. package/es/contract/compiler/Http.mjs.map +1 -1
  105. package/es/contract/compiler/HttpNode.d.ts +1 -0
  106. package/es/contract/compiler/HttpNode.mjs +5 -0
  107. package/es/contract/compiler/HttpNode.mjs.map +1 -1
  108. package/es/contract/delegation-signature.d.ts +2 -1
  109. package/es/contract/delegation-signature.mjs +39 -8
  110. package/es/contract/delegation-signature.mjs.map +1 -1
  111. package/es/contract/ga.mjs.map +1 -1
  112. package/es/deprecated.d.ts +14 -0
  113. package/es/deprecated.mjs +22 -0
  114. package/es/deprecated.mjs.map +1 -0
  115. package/es/index-browser.d.ts +20 -14
  116. package/es/index-browser.mjs +19 -15
  117. package/es/index-browser.mjs.map +1 -1
  118. package/es/oracle.mjs.map +1 -1
  119. package/es/spend.d.ts +2 -1
  120. package/es/spend.mjs +4 -2
  121. package/es/spend.mjs.map +1 -1
  122. package/es/tx/builder/constants.d.ts +0 -1
  123. package/es/tx/builder/constants.mjs +26 -24
  124. package/es/tx/builder/constants.mjs.map +1 -1
  125. package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
  126. package/es/tx/builder/field-types/coin-amount.d.ts +1 -1
  127. package/es/tx/builder/field-types/coin-amount.mjs +2 -1
  128. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  129. package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
  130. package/es/tx/builder/field-types/deposit.d.ts +1 -1
  131. package/es/tx/builder/field-types/deposit.mjs.map +1 -1
  132. package/es/tx/builder/field-types/entry.mjs +2 -1
  133. package/es/tx/builder/field-types/entry.mjs.map +1 -1
  134. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  135. package/es/tx/builder/field-types/field.mjs.map +1 -1
  136. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  137. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  138. package/es/tx/builder/field-types/index.d.ts +28 -150
  139. package/es/tx/builder/field-types/index.mjs +28 -56
  140. package/es/tx/builder/field-types/index.mjs.map +1 -1
  141. package/es/tx/builder/field-types/map.mjs.map +1 -1
  142. package/es/tx/builder/field-types/mptree.mjs +3 -3
  143. package/es/tx/builder/field-types/mptree.mjs.map +1 -1
  144. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  145. package/es/tx/builder/field-types/pointers.mjs.map +1 -1
  146. package/es/tx/builder/field-types/string.mjs.map +1 -1
  147. package/es/tx/builder/field-types/ttl.mjs.map +1 -1
  148. package/es/tx/builder/field-types/u-int.mjs +1 -1
  149. package/es/tx/builder/field-types/u-int.mjs.map +1 -1
  150. package/es/tx/builder/helpers.d.ts +8 -1
  151. package/es/tx/builder/helpers.mjs +53 -9
  152. package/es/tx/builder/helpers.mjs.map +1 -1
  153. package/es/tx/builder/index.d.ts +4 -2
  154. package/es/tx/builder/index.mjs +0 -1
  155. package/es/tx/builder/index.mjs.map +1 -1
  156. package/es/tx/builder/schema.d.ts +9 -9
  157. package/es/tx/builder/schema.mjs +11 -10
  158. package/es/tx/builder/schema.mjs.map +1 -1
  159. package/es/tx/execution-cost.mjs.map +1 -1
  160. package/es/tx/transaction-signer.mjs.map +1 -1
  161. package/es/tx/validator.mjs +6 -3
  162. package/es/tx/validator.mjs.map +1 -1
  163. package/es/utils/amount-formatter.mjs +7 -7
  164. package/es/utils/amount-formatter.mjs.map +1 -1
  165. package/es/utils/autorest.mjs +6 -8
  166. package/es/utils/autorest.mjs.map +1 -1
  167. package/es/utils/bignumber.mjs.map +1 -1
  168. package/es/utils/bytes.mjs.map +1 -1
  169. package/es/utils/crypto.d.ts +1 -0
  170. package/es/utils/crypto.mjs +12 -2
  171. package/es/utils/crypto.mjs.map +1 -1
  172. package/es/utils/encoder-types.mjs +3 -3
  173. package/es/utils/encoder-types.mjs.map +1 -1
  174. package/es/utils/encoder.mjs.map +1 -1
  175. package/es/utils/errors.d.ts +2 -2
  176. package/es/utils/errors.mjs.map +1 -1
  177. package/es/utils/hd-wallet.mjs.map +1 -1
  178. package/es/utils/keystore.mjs.map +1 -1
  179. package/es/utils/other.d.ts +1 -0
  180. package/es/utils/other.mjs +5 -0
  181. package/es/utils/other.mjs.map +1 -1
  182. package/es/utils/semver-satisfies.mjs.map +1 -1
  183. package/es/utils/string.mjs.map +1 -1
  184. package/es/utils/typed-data.d.ts +45 -0
  185. package/es/utils/typed-data.mjs +70 -0
  186. package/es/utils/typed-data.mjs.map +1 -0
  187. package/package.json +56 -37
  188. package/src/AeSdkBase.ts +66 -5
  189. package/src/AeSdkMethods.ts +31 -50
  190. package/src/AeSdkWallet.ts +63 -17
  191. package/src/Middleware.ts +141 -0
  192. package/src/MiddlewareSubscriber.ts +207 -0
  193. package/src/Node.ts +1 -1
  194. package/src/account/Base.ts +102 -4
  195. package/src/account/Generalized.ts +20 -0
  196. package/src/account/Ledger.ts +20 -0
  197. package/src/account/Memory.ts +68 -1
  198. package/src/account/Rpc.ts +54 -7
  199. package/src/aens.ts +1 -1
  200. package/src/aepp-wallet-communication/rpc/RpcClient.ts +11 -3
  201. package/src/aepp-wallet-communication/rpc/types.ts +21 -0
  202. package/src/aepp-wallet-communication/schema.ts +3 -17
  203. package/src/aepp-wallet-communication/wallet-detector.ts +1 -2
  204. package/src/apis/compiler/compiler.ts +8 -1
  205. package/src/apis/compiler/models/index.ts +1 -8
  206. package/src/apis/compiler/models/mappers.ts +0 -36
  207. package/src/apis/middleware/index.ts +2 -0
  208. package/src/apis/middleware/middleware.ts +1807 -0
  209. package/src/apis/middleware/models/index.ts +1747 -0
  210. package/src/apis/middleware/models/mappers.ts +3370 -0
  211. package/src/apis/middleware/models/parameters.ts +463 -0
  212. package/src/chain.ts +4 -3
  213. package/src/channel/Base.ts +5 -5
  214. package/src/channel/internal.ts +2 -0
  215. package/src/contract/Contract.ts +2 -1
  216. package/src/contract/compiler/Base.ts +26 -0
  217. package/src/contract/compiler/Cli.ts +27 -3
  218. package/src/contract/compiler/Http.ts +21 -2
  219. package/src/contract/compiler/HttpNode.ts +6 -0
  220. package/src/contract/delegation-signature.ts +37 -11
  221. package/src/deprecated.ts +23 -0
  222. package/src/index-browser.ts +77 -15
  223. package/src/spend.ts +2 -2
  224. package/src/tx/builder/constants.ts +0 -1
  225. package/src/tx/builder/field-types/coin-amount.ts +2 -1
  226. package/src/tx/builder/field-types/entry.ts +1 -1
  227. package/src/tx/builder/field-types/index.ts +28 -58
  228. package/src/tx/builder/field-types/u-int.ts +1 -1
  229. package/src/tx/builder/helpers.ts +54 -9
  230. package/src/tx/builder/index.ts +6 -9
  231. package/src/tx/validator.ts +4 -2
  232. package/src/utils/autorest.ts +5 -10
  233. package/src/utils/crypto.ts +12 -2
  234. package/src/utils/errors.ts +2 -2
  235. package/src/utils/other.ts +5 -0
  236. package/src/utils/typed-data.ts +95 -0
  237. package/types-legacy/ts4.2/AeSdkBase.d.ts +21 -3
  238. package/types-legacy/ts4.2/AeSdkMethods.d.ts +9 -14
  239. package/types-legacy/ts4.2/AeSdkWallet.d.ts +1 -1
  240. package/types-legacy/ts4.2/Middleware.d.ts +46 -0
  241. package/types-legacy/ts4.2/MiddlewareSubscriber.d.ts +30 -0
  242. package/types-legacy/ts4.2/Node.d.ts +1 -1
  243. package/types-legacy/ts4.2/account/Base.d.ts +57 -3
  244. package/types-legacy/ts4.2/account/Generalized.d.ts +4 -0
  245. package/types-legacy/ts4.2/account/Ledger.d.ts +4 -0
  246. package/types-legacy/ts4.2/account/Memory.d.ts +12 -0
  247. package/types-legacy/ts4.2/account/Rpc.d.ts +5 -6
  248. package/types-legacy/ts4.2/aens.d.ts +1 -1
  249. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +19 -0
  250. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +2 -8
  251. package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +1 -1
  252. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -7
  253. package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +0 -1
  254. package/types-legacy/ts4.2/apis/middleware/index.d.ts +2 -0
  255. package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +309 -0
  256. package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +1496 -0
  257. package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +102 -0
  258. package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +43 -0
  259. package/types-legacy/ts4.2/chain.d.ts +2 -1
  260. package/types-legacy/ts4.2/channel/Base.d.ts +1 -1
  261. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +21 -0
  262. package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +2 -0
  263. package/types-legacy/ts4.2/contract/compiler/Http.d.ts +2 -0
  264. package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +1 -0
  265. package/types-legacy/ts4.2/contract/delegation-signature.d.ts +2 -1
  266. package/types-legacy/ts4.2/deprecated.d.ts +14 -0
  267. package/types-legacy/ts4.2/index-browser.d.ts +20 -14
  268. package/types-legacy/ts4.2/spend.d.ts +2 -1
  269. package/types-legacy/ts4.2/tx/builder/constants.d.ts +0 -1
  270. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +1 -1
  271. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +1 -1
  272. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +28 -153
  273. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +8 -1
  274. package/types-legacy/ts4.2/tx/builder/index.d.ts +4 -2
  275. package/types-legacy/ts4.2/tx/builder/schema.d.ts +9 -9
  276. package/types-legacy/ts4.2/utils/crypto.d.ts +1 -0
  277. package/types-legacy/ts4.2/utils/errors.d.ts +2 -2
  278. package/types-legacy/ts4.2/utils/other.d.ts +1 -0
  279. package/types-legacy/ts4.2/utils/typed-data.d.ts +60 -0
  280. package/types-legacy/ts4.5/AeSdkBase.d.ts +21 -3
  281. package/types-legacy/ts4.5/AeSdkMethods.d.ts +9 -14
  282. package/types-legacy/ts4.5/AeSdkWallet.d.ts +1 -1
  283. package/types-legacy/ts4.5/Middleware.d.ts +46 -0
  284. package/types-legacy/ts4.5/MiddlewareSubscriber.d.ts +30 -0
  285. package/types-legacy/ts4.5/Node.d.ts +1 -1
  286. package/types-legacy/ts4.5/account/Base.d.ts +57 -3
  287. package/types-legacy/ts4.5/account/Generalized.d.ts +4 -0
  288. package/types-legacy/ts4.5/account/Ledger.d.ts +4 -0
  289. package/types-legacy/ts4.5/account/Memory.d.ts +12 -0
  290. package/types-legacy/ts4.5/account/Rpc.d.ts +5 -6
  291. package/types-legacy/ts4.5/aens.d.ts +1 -1
  292. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +19 -0
  293. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +2 -8
  294. package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +1 -1
  295. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -7
  296. package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +0 -1
  297. package/types-legacy/ts4.5/apis/middleware/index.d.ts +2 -0
  298. package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +309 -0
  299. package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +1496 -0
  300. package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +102 -0
  301. package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +43 -0
  302. package/types-legacy/ts4.5/chain.d.ts +2 -1
  303. package/types-legacy/ts4.5/channel/Base.d.ts +1 -1
  304. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +21 -0
  305. package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +2 -0
  306. package/types-legacy/ts4.5/contract/compiler/Http.d.ts +2 -0
  307. package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +1 -0
  308. package/types-legacy/ts4.5/contract/delegation-signature.d.ts +2 -1
  309. package/types-legacy/ts4.5/deprecated.d.ts +14 -0
  310. package/types-legacy/ts4.5/index-browser.d.ts +20 -14
  311. package/types-legacy/ts4.5/spend.d.ts +2 -1
  312. package/types-legacy/ts4.5/tx/builder/constants.d.ts +0 -1
  313. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +1 -1
  314. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +1 -1
  315. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +28 -153
  316. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +8 -1
  317. package/types-legacy/ts4.5/tx/builder/index.d.ts +4 -2
  318. package/types-legacy/ts4.5/tx/builder/schema.d.ts +9 -9
  319. package/types-legacy/ts4.5/utils/crypto.d.ts +1 -0
  320. package/types-legacy/ts4.5/utils/errors.d.ts +2 -2
  321. package/types-legacy/ts4.5/utils/other.d.ts +1 -0
  322. package/types-legacy/ts4.5/utils/typed-data.d.ts +60 -0
@@ -1 +1 @@
1
- {"version":3,"file":"RpcClient.mjs","names":["RpcError","RpcInternalError","RpcMethodNotFoundError","InvalidRpcMessageError","MissingCallbackError","_callbacks","WeakMap","_messageId","_methods","_handleMessage","WeakSet","_sendRequest","_sendResponse","_processResponse","RpcClient","constructor","connection","onDisconnect","methods","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","writable","value","Map","_classPrivateFieldSet","connect","_classPrivateMethodGet","_handleMessage2","bind","request","name","params","_sendRequest2","call","_classPrivateFieldGet","Promise","resolve","reject","set","notify","undefined","msg","origin","jsonrpc","JSON","stringify","_processResponse2","result","error","method","methodName","e","id","_sendResponse2","sendMessage","toJSON","_ref","callbacks","get","deserialize","delete"],"sources":["../../../src/aepp-wallet-communication/rpc/RpcClient.ts"],"sourcesContent":["import { RpcError, RpcInternalError, RpcMethodNotFoundError } from '../schema';\nimport BrowserConnection from '../connection/Browser';\nimport { InvalidRpcMessageError, MissingCallbackError } from '../../utils/errors';\n\ninterface JsonRpcRequest {\n jsonrpc: '2.0';\n id: number;\n method: string;\n params?: any;\n}\n\ninterface JsonRpcResponse {\n jsonrpc: '2.0';\n id: number;\n method: string;\n result?: any;\n error?: {\n code: number;\n message: string;\n data?: any;\n };\n}\n\ntype RpcApiHandler = (p?: any) => any | undefined;\ntype RpcApi<Api> = { [k in keyof Api]: RpcApiHandler };\ntype WithOrigin<Api extends RpcApi<Api>> = {\n [k in keyof Api]: (p: Parameters<Api[k]>[0], origin: string) => ReturnType<Api[k]>\n};\n\n/**\n * Contain functionality for using RPC conection\n * @category aepp wallet communication\n * @param connection - Connection object\n * @param onDisconnect - Disconnect callback\n * @param methods - Object containing handlers for each request by name\n */\nexport default class RpcClient <\n RemoteApi extends RpcApi<RemoteApi>, LocalApi extends RpcApi<LocalApi>,\n> {\n connection: BrowserConnection;\n\n #callbacks = new Map<number, { resolve: (v: any) => void; reject: (e: Error) => void }>();\n\n #messageId = 0;\n\n #methods: WithOrigin<LocalApi>;\n\n constructor(\n connection: BrowserConnection,\n onDisconnect: () => void,\n methods: WithOrigin<LocalApi>,\n ) {\n this.connection = connection;\n this.#methods = methods;\n connection.connect(this.#handleMessage.bind(this), onDisconnect);\n }\n\n async #handleMessage(msg: JsonRpcRequest | JsonRpcResponse, origin: string): Promise<void> {\n if (msg?.jsonrpc !== '2.0') throw new InvalidRpcMessageError(JSON.stringify(msg));\n if ('result' in msg || 'error' in msg) {\n this.#processResponse(msg);\n return;\n }\n\n const request = msg as JsonRpcRequest;\n let result;\n let error;\n try {\n if (!(request.method in this.#methods)) throw new RpcMethodNotFoundError();\n const methodName = request.method as keyof LocalApi;\n result = await this.#methods[methodName](request.params, origin);\n } catch (e) {\n error = e instanceof RpcError ? e : new RpcInternalError();\n }\n if (request.id != null) {\n this.#sendResponse(request.id, request.method as keyof LocalApi, result, error);\n }\n }\n\n #sendRequest(\n id: number | undefined,\n method: keyof RemoteApi | keyof LocalApi,\n params?: any,\n ): void {\n this.connection.sendMessage({\n jsonrpc: '2.0',\n ...id != null ? { id } : {},\n method,\n ...params != null ? { params } : {},\n });\n }\n\n #sendResponse(\n id: number,\n method: keyof RemoteApi | keyof LocalApi, // TODO: remove as far it is not required in JSON RPC\n result?: any,\n error?: RpcError,\n ): void {\n this.connection.sendMessage({\n jsonrpc: '2.0',\n id,\n method,\n ...error != null ? { error: error.toJSON() } : { result },\n });\n }\n\n /**\n * Make a request\n * @param name - Method name\n * @param params - Method params\n * @returns Promise which will be resolved after receiving response message\n */\n async request<Name extends keyof RemoteApi>(\n name: Name,\n params: Parameters<RemoteApi[Name]>[0],\n ): Promise<ReturnType<RemoteApi[Name]>> {\n this.#sendRequest(this.#messageId += 1, name, params);\n return new Promise((resolve, reject) => {\n this.#callbacks.set(this.#messageId, { resolve, reject });\n });\n }\n\n /**\n * Make a notification\n * @param name - Method name\n * @param params - Method params\n */\n notify<Name extends keyof RemoteApi>(name: Name, params: Parameters<RemoteApi[Name]>[0]): void {\n this.#sendRequest(undefined, name, params);\n }\n\n /**\n * Process response message\n * @param msg - Message object\n */\n #processResponse({ id, error, result }: { id: number; error?: any; result?: any }): void {\n const callbacks = this.#callbacks.get(id);\n if (callbacks == null) throw new MissingCallbackError(id);\n if (error != null) callbacks.reject(RpcError.deserialize(error));\n else callbacks.resolve(result);\n this.#callbacks.delete(id);\n }\n}\n"],"mappings":";;;;;;SAASA,QAAQ,EAAEC,gBAAgB,EAAEC,sBAAsB;AAAA,SAElDC,sBAAsB,EAAEC,oBAAoB;AAAA,IAAAC,UAAA,oBAAAC,OAAA;AAAA,IAAAC,UAAA,oBAAAD,OAAA;AAAA,IAAAE,QAAA,oBAAAF,OAAA;AAAA,IAAAG,cAAA,oBAAAC,OAAA;AAAA,IAAAC,YAAA,oBAAAD,OAAA;AAAA,IAAAE,aAAA,oBAAAF,OAAA;AAAA,IAAAG,gBAAA,oBAAAH,OAAA;AA2BrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMI,SAAS,CAE5B;EASAC,WAAWA,CACTC,UAA6B,EAC7BC,YAAwB,EACxBC,OAA6B,EAC7B;IAgFF;AACF;AACA;AACA;IAHEC,2BAAA,OAAAN,gBAAA;IAAAM,2BAAA,OAAAP,aAAA;IAAAO,2BAAA,OAAAR,YAAA;IAAAQ,2BAAA,OAAAV,cAAA;IAAAW,0BAAA,OAAAf,UAAA;MAAAgB,QAAA;MAAAC,KAAA,EA1Fa,IAAIC,GAAG;IAAqE;IAAAH,0BAAA,OAAAb,UAAA;MAAAc,QAAA;MAAAC,KAAA,EAE5E;IAAC;IAAAF,0BAAA,OAAAZ,QAAA;MAAAa,QAAA;MAAAC,K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ACsC,WAAW,CAAC;IAC1BX,OAAO,EAAE,KAAK;IACdS,EAAE;IACFH,MAAM;IACN,IAAGD,KAAK,IAAI,IAAI,GAAG;MAAEA,KAAK,EAAEA,KAAK,CAACO,MAAM;IAAG,CAAC,GAAG;MAAER;IAAO,CAAC;EAC3D,CAAC,CAAC;AACJ;AAAC,SAAAD,kBAAAU,IAAA,EA+BwF;EAAA,IAAxE;IAAEJ,EAAE;IAAEJ,KAAK;IAAED;EAAkD,CAAC,GAAAS,IAAA;EAC/E,MAAMC,SAAS,GAAGvB,qBAAA,KAAI,EAAA7B,UAAA,EAAYqD,GAAG,CAACN,EAAE,CAAC;EACzC,IAAIK,SAAS,IAAI,IAAI,EAAE,MAAM,IAAIrD,oBAAoB,CAACgD,EAAE,CAAC;EACzD,IAAIJ,KAAK,IAAI,IAAI,EAAES,SAAS,CAACpB,MAAM,CAACrC,QAAQ,CAAC2D,WAAW,CAACX,KAAK,CAAC,CAAC,CAAC,KAC5DS,SAAS,CAACrB,OAAO,CAACW,MAAM,CAAC;EAC9Bb,qBAAA,KAAI,EAAA7B,UAAA,EAAYuD,MAAM,CAACR,EAAE,CAAC;AAC5B"}
1
+ {"version":3,"file":"RpcClient.mjs","names":["RpcError","RpcInternalError","RpcMethodNotFoundError","InvalidRpcMessageError","MissingCallbackError","ensureError","_callbacks","WeakMap","_messageId","_methods","_handleMessage","WeakSet","_sendRequest","_sendResponse","_processResponse","RpcClient","constructor","connection","onDisconnect","methods","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","writable","value","Map","_classPrivateFieldSet","connect","_classPrivateMethodGet","_handleMessage2","bind","request","name","params","_sendRequest2","call","_classPrivateFieldGet","Promise","resolve","reject","set","notify","undefined","msg","origin","jsonrpc","JSON","stringify","_processResponse2","result","error","method","methodName","e","id","_sendResponse2","sendMessage","toJSON","_ref","callbacks","get","deserialize","delete"],"sources":["../../../src/aepp-wallet-communication/rpc/RpcClient.ts"],"sourcesContent":["import { RpcError, RpcInternalError, RpcMethodNotFoundError } from '../schema';\nimport BrowserConnection from '../connection/Browser';\nimport { InvalidRpcMessageError, MissingCallbackError } from '../../utils/errors';\nimport { ensureError } from '../../utils/other';\n\ninterface JsonRpcRequest {\n jsonrpc: '2.0';\n id: number;\n method: string;\n params?: any;\n}\n\ninterface JsonRpcResponse {\n jsonrpc: '2.0';\n id: number;\n method: string;\n result?: any;\n error?: {\n code: number;\n message: string;\n data?: any;\n };\n}\n\ntype RpcApiHandler = (p?: any) => any | undefined;\ntype RpcApi<Api> = { [k in keyof Api]: RpcApiHandler };\ntype WithOrigin<Api extends RpcApi<Api>> = {\n [k in keyof Api]: (p: Parameters<Api[k]>[0], origin: string) => ReturnType<Api[k]>\n};\n\n/**\n * Contain functionality for using RPC conection\n * @category aepp wallet communication\n * @param connection - Connection object\n * @param onDisconnect - Disconnect callback\n * @param methods - Object containing handlers for each request by name\n */\nexport default class RpcClient <\n RemoteApi extends RpcApi<RemoteApi>, LocalApi extends RpcApi<LocalApi>,\n> {\n connection: BrowserConnection;\n\n #callbacks = new Map<number, { resolve: (v: any) => void; reject: (e: Error) => void }>();\n\n #messageId = 0;\n\n #methods: WithOrigin<LocalApi>;\n\n constructor(\n connection: BrowserConnection,\n onDisconnect: () => void,\n methods: WithOrigin<LocalApi>,\n ) {\n this.connection = connection;\n this.#methods = methods;\n connection.connect(this.#handleMessage.bind(this), onDisconnect);\n }\n\n async #handleMessage(msg: JsonRpcRequest | JsonRpcResponse, origin: string): Promise<void> {\n if (msg?.jsonrpc !== '2.0') throw new InvalidRpcMessageError(JSON.stringify(msg));\n if ('result' in msg || 'error' in msg) {\n this.#processResponse(msg);\n return;\n }\n\n const request = msg as JsonRpcRequest;\n let result;\n let error: Error | undefined;\n try {\n if (!(request.method in this.#methods)) throw new RpcMethodNotFoundError();\n const methodName = request.method as keyof LocalApi;\n result = await this.#methods[methodName](request.params, origin);\n } catch (e) {\n ensureError(e);\n error = e;\n }\n if (request.id != null) {\n this.#sendResponse(\n request.id,\n request.method as keyof LocalApi,\n result,\n error == null || error instanceof RpcError ? error : new RpcInternalError(),\n );\n }\n if (error != null && !(error instanceof RpcError)) throw error;\n }\n\n #sendRequest(\n id: number | undefined,\n method: keyof RemoteApi | keyof LocalApi,\n params?: any,\n ): void {\n this.connection.sendMessage({\n jsonrpc: '2.0',\n ...id != null ? { id } : {},\n method,\n ...params != null ? { params } : {},\n });\n }\n\n #sendResponse(\n id: number,\n method: keyof RemoteApi | keyof LocalApi, // TODO: remove as far it is not required in JSON RPC\n result?: any,\n error?: RpcError,\n ): void {\n this.connection.sendMessage({\n jsonrpc: '2.0',\n id,\n method,\n ...error != null ? { error: error.toJSON() } : { result },\n });\n }\n\n /**\n * Make a request\n * @param name - Method name\n * @param params - Method params\n * @returns Promise which will be resolved after receiving response message\n */\n async request<Name extends keyof RemoteApi>(\n name: Name,\n params: Parameters<RemoteApi[Name]>[0],\n ): Promise<ReturnType<RemoteApi[Name]>> {\n this.#sendRequest(this.#messageId += 1, name, params);\n return new Promise((resolve, reject) => {\n this.#callbacks.set(this.#messageId, { resolve, reject });\n });\n }\n\n /**\n * Make a notification\n * @param name - Method name\n * @param params - Method params\n */\n notify<Name extends keyof RemoteApi>(name: Name, params: Parameters<RemoteApi[Name]>[0]): void {\n this.#sendRequest(undefined, name, params);\n }\n\n /**\n * Process response message\n * @param msg - Message object\n */\n #processResponse({ id, error, result }: { id: number; error?: any; result?: any }): void {\n const callbacks = this.#callbacks.get(id);\n if (callbacks == null) throw new MissingCallbackError(id);\n if (error != null) callbacks.reject(RpcError.deserialize(error));\n else callbacks.resolve(result);\n this.#callbacks.delete(id);\n }\n}\n"],"mappings":";;;;;;SAASA,QAAQ,EAAEC,gBAAgB,EAAEC,sBAAsB;AAAA,SAElDC,sBAAsB,EAAEC,oBAAoB;AAAA,SAC5CC,WAAW;AAAA,IAAAC,UAAA,oBAAAC,OAAA;AAAA,IAAAC,UAAA,oBAAAD,OAAA;AAAA,IAAAE,QAAA,oBAAAF,OAAA;AAA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AoB,CAACiD,EAAE,CAAC;EACzD,IAAIJ,KAAK,IAAI,IAAI,EAAES,SAAS,CAACpB,MAAM,CAACtC,QAAQ,CAAC4D,WAAW,CAACX,KAAK,CAAC,CAAC,CAAC,KAC5DS,SAAS,CAACrB,OAAO,CAACW,MAAM,CAAC;EAC9Bb,qBAAA,KAAI,EAAA7B,UAAA,EAAYuD,MAAM,CAACR,EAAE,CAAC;AAC5B"}
@@ -1,7 +1,9 @@
1
1
  import { Encoded } from '../../utils/encoder';
2
+ import { Domain, AciValue } from '../../utils/typed-data';
2
3
  import { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';
3
4
  import { TransformNodeType } from '../../Node';
4
5
  import { SignedTx } from '../../apis/node';
6
+ import { AensName } from '../../tx/builder/constants';
5
7
  export interface WalletInfo {
6
8
  id: string;
7
9
  name: string;
@@ -60,6 +62,7 @@ export interface WalletApi {
60
62
  * @see {@link https://github.com/aeternity/aepp-sdk-js/commit/153fd89a52c4eab39fcd659b356b36d32129c1ba}
61
63
  */
62
64
  networkId: string;
65
+ innerTx?: boolean;
63
66
  }) => Promise<{
64
67
  /**
65
68
  * @deprecated this is not a hash at all, will be removed later at the same time
@@ -77,6 +80,22 @@ export interface WalletApi {
77
80
  }) => Promise<{
78
81
  signature: string;
79
82
  }>;
83
+ [METHODS.signTypedData]: (p: {
84
+ domain: Domain;
85
+ aci: AciValue;
86
+ data: Encoded.ContractBytearray;
87
+ onAccount: Encoded.AccountAddress;
88
+ }) => Promise<{
89
+ signature: Encoded.Signature;
90
+ }>;
91
+ [METHODS.signDelegationToContract]: (p: {
92
+ contractAddress: Encoded.ContractAddress;
93
+ name?: AensName;
94
+ oracleQueryId?: Encoded.OracleQueryId;
95
+ onAccount: Encoded.AccountAddress;
96
+ }) => Promise<{
97
+ signature: Encoded.Signature;
98
+ }>;
80
99
  }
81
100
  export interface AeppApi {
82
101
  [METHODS.updateAddress]: (a: Accounts) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","names":["METHODS","RPC_VERSION"],"sources":["../../../src/aepp-wallet-communication/rpc/types.ts"],"sourcesContent":["import { Encoded } from '../../utils/encoder';\nimport { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';\nimport { TransformNodeType } from '../../Node';\nimport { SignedTx } from '../../apis/node';\n\nexport interface WalletInfo {\n id: string;\n name: string;\n networkId: string;\n origin: string;\n type: WALLET_TYPE;\n}\n\nexport interface Accounts {\n connected: { [pub: Encoded.AccountAddress]: {} };\n current: { [pub: Encoded.AccountAddress]: {} };\n}\n\nexport interface Node {\n // TODO: name is not used, can be removed\n name: string;\n url: string;\n}\n\nexport interface Network {\n networkId: string;\n node?: Node;\n}\n\ntype Icons = Array<{ src: string; sizes?: string; type?: string; purpose?: string }>;\n\nexport const RPC_VERSION = 1;\n\nexport interface WalletApi {\n [METHODS.connect]: (\n p: { name: string; icons?: Icons; version: typeof RPC_VERSION; connectNode: boolean }\n ) => Promise<WalletInfo & { node?: Node }>;\n\n [METHODS.closeConnection]: (p: any) => void;\n\n [METHODS.subscribeAddress]: (\n p: { type: SUBSCRIPTION_TYPES; value: 'connected' | 'current' }\n ) => Promise<{ subscription: Array<'connected' | 'current'>; address: Accounts }>;\n\n [METHODS.address]: () => Promise<Encoded.AccountAddress[]>;\n\n [METHODS.sign]: ((\n p: {\n tx: Encoded.Transaction;\n onAccount: Encoded.AccountAddress;\n returnSigned: boolean;\n /**\n * @deprecated Wallet provided networkId will be used (current network)\n * required to maintain backward compatibility with wallets using SDK v11.0.1 and below\n * @see {@link https://github.com/aeternity/aepp-sdk-js/commit/153fd89a52c4eab39fcd659b356b36d32129c1ba}\n */\n networkId: string;\n }\n ) => Promise<{\n /**\n * @deprecated this is not a hash at all, will be removed later at the same time\n * as dropping ability to broadcast transaction by wallet\n */\n transactionHash?: Partial<TransformNodeType<SignedTx>> & {\n hash: Encoded.TxHash;\n rawTx: Encoded.Transaction;\n };\n signedTransaction?: Encoded.Transaction;\n }>);\n\n [METHODS.signMessage]: (\n p: { message: string; onAccount: Encoded.AccountAddress }\n ) => Promise<{ signature: string }>;\n}\n\nexport interface AeppApi {\n [METHODS.updateAddress]: (a: Accounts) => void;\n [METHODS.updateNetwork]: (a: Network) => void;\n [METHODS.readyToConnect]: (w: WalletInfo) => void;\n [METHODS.closeConnection]: (p: any) => void;\n}\n"],"mappings":"SACSA,OAAO;AA8BhB,OAAO,MAAMC,WAAW,GAAG,CAAC"}
1
+ {"version":3,"file":"types.mjs","names":["METHODS","RPC_VERSION"],"sources":["../../../src/aepp-wallet-communication/rpc/types.ts"],"sourcesContent":["import { Encoded } from '../../utils/encoder';\nimport { Domain, AciValue } from '../../utils/typed-data';\nimport { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';\nimport { TransformNodeType } from '../../Node';\nimport { SignedTx } from '../../apis/node';\nimport { AensName } from '../../tx/builder/constants';\n\nexport interface WalletInfo {\n id: string;\n name: string;\n networkId: string;\n origin: string;\n type: WALLET_TYPE;\n}\n\nexport interface Accounts {\n connected: { [pub: Encoded.AccountAddress]: {} };\n current: { [pub: Encoded.AccountAddress]: {} };\n}\n\nexport interface Node {\n // TODO: name is not used, can be removed\n name: string;\n url: string;\n}\n\nexport interface Network {\n networkId: string;\n node?: Node;\n}\n\ntype Icons = Array<{ src: string; sizes?: string; type?: string; purpose?: string }>;\n\nexport const RPC_VERSION = 1;\n\nexport interface WalletApi {\n [METHODS.connect]: (\n p: { name: string; icons?: Icons; version: typeof RPC_VERSION; connectNode: boolean }\n ) => Promise<WalletInfo & { node?: Node }>;\n\n [METHODS.closeConnection]: (p: any) => void;\n\n [METHODS.subscribeAddress]: (\n p: { type: SUBSCRIPTION_TYPES; value: 'connected' | 'current' }\n ) => Promise<{ subscription: Array<'connected' | 'current'>; address: Accounts }>;\n\n [METHODS.address]: () => Promise<Encoded.AccountAddress[]>;\n\n [METHODS.sign]: ((\n p: {\n tx: Encoded.Transaction;\n onAccount: Encoded.AccountAddress;\n returnSigned: boolean;\n /**\n * @deprecated Wallet provided networkId will be used (current network)\n * required to maintain backward compatibility with wallets using SDK v11.0.1 and below\n * @see {@link https://github.com/aeternity/aepp-sdk-js/commit/153fd89a52c4eab39fcd659b356b36d32129c1ba}\n */\n networkId: string;\n innerTx?: boolean;\n }\n ) => Promise<{\n /**\n * @deprecated this is not a hash at all, will be removed later at the same time\n * as dropping ability to broadcast transaction by wallet\n */\n transactionHash?: Partial<TransformNodeType<SignedTx>> & {\n hash: Encoded.TxHash;\n rawTx: Encoded.Transaction;\n };\n signedTransaction?: Encoded.Transaction;\n }>);\n\n [METHODS.signMessage]: (\n p: { message: string; onAccount: Encoded.AccountAddress }\n ) => Promise<{ signature: string }>;\n\n [METHODS.signTypedData]: (\n p: {\n domain: Domain;\n aci: AciValue;\n data: Encoded.ContractBytearray;\n onAccount: Encoded.AccountAddress;\n },\n ) => Promise<{ signature: Encoded.Signature }>;\n\n [METHODS.signDelegationToContract]: (\n p: {\n contractAddress: Encoded.ContractAddress;\n name?: AensName;\n oracleQueryId?: Encoded.OracleQueryId;\n onAccount: Encoded.AccountAddress;\n },\n ) => Promise<{ signature: Encoded.Signature }>;\n}\n\nexport interface AeppApi {\n [METHODS.updateAddress]: (a: Accounts) => void;\n [METHODS.updateNetwork]: (a: Network) => void;\n [METHODS.readyToConnect]: (w: WalletInfo) => void;\n [METHODS.closeConnection]: (p: any) => void;\n}\n"],"mappings":"SAESA,OAAO;AA+BhB,OAAO,MAAMC,WAAW,GAAG,CAAC"}
@@ -31,6 +31,8 @@ export declare const enum METHODS {
31
31
  connect = "connection.open",
32
32
  sign = "transaction.sign",
33
33
  signMessage = "message.sign",
34
+ signTypedData = "typedData.sign",
35
+ signDelegationToContract = "delegationToContract.sign",
34
36
  subscribeAddress = "address.subscribe",
35
37
  updateNetwork = "networkId.update",
36
38
  closeConnection = "connection.close"
@@ -66,14 +68,6 @@ export declare class RpcInvalidTransactionError extends RpcError {
66
68
  code: number;
67
69
  constructor(data?: any);
68
70
  }
69
- /**
70
- * @category exception
71
- */
72
- export declare class RpcBroadcastError extends RpcError {
73
- static code: number;
74
- code: number;
75
- constructor(data?: any);
76
- }
77
71
  /**
78
72
  * @category exception
79
73
  */
@@ -4,55 +4,57 @@ import { BaseError, InternalError } from "../utils/errors.mjs";
4
4
  /**
5
5
  * @category aepp wallet communication
6
6
  */
7
- export let MESSAGE_DIRECTION;
8
-
9
- /**
10
- * @category aepp wallet communication
11
- */
12
- (function (MESSAGE_DIRECTION) {
7
+ export let MESSAGE_DIRECTION = /*#__PURE__*/function (MESSAGE_DIRECTION) {
13
8
  MESSAGE_DIRECTION["to_waellet"] = "to_waellet";
14
9
  MESSAGE_DIRECTION["to_aepp"] = "to_aepp";
15
- })(MESSAGE_DIRECTION || (MESSAGE_DIRECTION = {}));
16
- export let WALLET_TYPE;
10
+ return MESSAGE_DIRECTION;
11
+ }({});
17
12
 
18
13
  /**
19
14
  * @category aepp wallet communication
20
15
  */
21
- (function (WALLET_TYPE) {
16
+ export let WALLET_TYPE = /*#__PURE__*/function (WALLET_TYPE) {
22
17
  WALLET_TYPE["window"] = "window";
23
18
  WALLET_TYPE["extension"] = "extension";
24
- })(WALLET_TYPE || (WALLET_TYPE = {}));
25
- export let SUBSCRIPTION_TYPES;
19
+ return WALLET_TYPE;
20
+ }({});
26
21
 
27
22
  /**
28
23
  * @category aepp wallet communication
29
24
  */
30
- (function (SUBSCRIPTION_TYPES) {
25
+ export let SUBSCRIPTION_TYPES = /*#__PURE__*/function (SUBSCRIPTION_TYPES) {
31
26
  SUBSCRIPTION_TYPES["subscribe"] = "subscribe";
32
27
  SUBSCRIPTION_TYPES["unsubscribe"] = "unsubscribe";
33
- })(SUBSCRIPTION_TYPES || (SUBSCRIPTION_TYPES = {}));
34
- export let METHODS;
28
+ return SUBSCRIPTION_TYPES;
29
+ }({});
35
30
 
36
31
  /**
37
32
  * @category aepp wallet communication
38
33
  */
39
- (function (METHODS) {
34
+ export let METHODS = /*#__PURE__*/function (METHODS) {
40
35
  METHODS["readyToConnect"] = "connection.announcePresence";
41
36
  METHODS["updateAddress"] = "address.update";
42
37
  METHODS["address"] = "address.get";
43
38
  METHODS["connect"] = "connection.open";
44
39
  METHODS["sign"] = "transaction.sign";
45
40
  METHODS["signMessage"] = "message.sign";
41
+ METHODS["signTypedData"] = "typedData.sign";
42
+ METHODS["signDelegationToContract"] = "delegationToContract.sign";
46
43
  METHODS["subscribeAddress"] = "address.subscribe";
47
44
  METHODS["updateNetwork"] = "networkId.update";
48
45
  METHODS["closeConnection"] = "connection.close";
49
- })(METHODS || (METHODS = {}));
50
- export let RPC_STATUS;
51
- (function (RPC_STATUS) {
46
+ return METHODS;
47
+ }({});
48
+
49
+ /**
50
+ * @category aepp wallet communication
51
+ */
52
+ export let RPC_STATUS = /*#__PURE__*/function (RPC_STATUS) {
52
53
  RPC_STATUS["CONNECTED"] = "CONNECTED";
53
54
  RPC_STATUS["DISCONNECTED"] = "DISCONNECTED";
54
55
  RPC_STATUS["WAITING_FOR_CONNECTION_REQUEST"] = "WAITING_FOR_CONNECTION_REQUEST";
55
- })(RPC_STATUS || (RPC_STATUS = {}));
56
+ return RPC_STATUS;
57
+ }({});
56
58
  const rpcErrors = [];
57
59
 
58
60
  /**
@@ -87,20 +89,6 @@ export class RpcInvalidTransactionError extends RpcError {
87
89
  _defineProperty(RpcInvalidTransactionError, "code", 2);
88
90
  rpcErrors.push(RpcInvalidTransactionError);
89
91
 
90
- /**
91
- * @category exception
92
- */
93
- export class RpcBroadcastError extends RpcError {
94
- constructor(data) {
95
- super('Broadcast failed');
96
- _defineProperty(this, "code", 3);
97
- this.data = data;
98
- this.name = 'RpcBroadcastError';
99
- }
100
- }
101
- _defineProperty(RpcBroadcastError, "code", 3);
102
- rpcErrors.push(RpcBroadcastError);
103
-
104
92
  /**
105
93
  * @category exception
106
94
  */
@@ -1 +1 @@
1
- {"version":3,"file":"schema.mjs","names":["BaseError","InternalError","MESSAGE_DIRECTION","WALLET_TYPE","SUBSCRIPTION_TYPES","METHODS","RPC_STATUS","rpcErrors","RpcError","toJSON","code","message","data","deserialize","json","RpcErr","find","cl","RpcInvalidTransactionError","constructor","_defineProperty","name","push","RpcBroadcastError","RpcRejectedByUserError","RpcUnsupportedProtocolError","RpcConnectionDenyError","RpcNotAuthorizeError","RpcPermissionDenyError","address","RpcInternalError","RpcMethodNotFoundError"],"sources":["../../src/aepp-wallet-communication/schema.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Encoded } from '../utils/encoder';\nimport { BaseError, InternalError } from '../utils/errors';\n\n/**\n * @category aepp wallet communication\n */\nexport const enum MESSAGE_DIRECTION {\n to_waellet = 'to_waellet',\n to_aepp = 'to_aepp',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum WALLET_TYPE {\n window = 'window',\n extension = 'extension',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum SUBSCRIPTION_TYPES {\n subscribe = 'subscribe',\n unsubscribe = 'unsubscribe',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum METHODS {\n readyToConnect = 'connection.announcePresence',\n updateAddress = 'address.update',\n address = 'address.get',\n connect = 'connection.open',\n sign = 'transaction.sign',\n signMessage = 'message.sign',\n subscribeAddress = 'address.subscribe',\n updateNetwork = 'networkId.update',\n closeConnection = 'connection.close',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum RPC_STATUS {\n CONNECTED = 'CONNECTED',\n DISCONNECTED = 'DISCONNECTED',\n WAITING_FOR_CONNECTION_REQUEST = 'WAITING_FOR_CONNECTION_REQUEST',\n}\n\ninterface RpcErrorAsJson {\n code: number;\n message: string;\n data?: any;\n}\n\nconst rpcErrors: Array<(new (data?: any) => RpcError) & { code: number }> = [];\n\n/**\n * @category exception\n */\nexport abstract class RpcError extends BaseError {\n static code: number;\n\n code: number;\n\n data?: any;\n\n toJSON(): RpcErrorAsJson {\n return {\n code: this.code,\n message: this.message,\n data: this.data,\n };\n }\n\n static deserialize(json: RpcErrorAsJson): RpcError {\n const RpcErr = rpcErrors.find((cl) => cl.code === json.code);\n if (RpcErr == null) throw new InternalError(`Can't find RpcError with code: ${json.code}`);\n return new RpcErr(json.data);\n }\n}\n\n/**\n * @category exception\n */\nexport class RpcInvalidTransactionError extends RpcError {\n static override code = 2;\n\n override code = 2;\n\n constructor(data?: any) {\n super('Invalid transaction');\n this.data = data;\n this.name = 'RpcInvalidTransactionError';\n }\n}\nrpcErrors.push(RpcInvalidTransactionError);\n\n/**\n * @category exception\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}\nrpcErrors.push(RpcBroadcastError);\n\n/**\n * @category exception\n */\nexport class RpcRejectedByUserError extends RpcError {\n static override code = 4;\n\n override code = 4;\n\n constructor(data?: any) {\n super('Operation rejected by user');\n this.data = data;\n this.name = 'RpcRejectedByUserError';\n }\n}\nrpcErrors.push(RpcRejectedByUserError);\n\n/**\n * @category exception\n */\nexport class RpcUnsupportedProtocolError extends RpcError {\n static override code = 5;\n\n override code = 5;\n\n constructor() {\n super('Unsupported Protocol Version');\n this.name = 'RpcUnsupportedProtocolError';\n }\n}\nrpcErrors.push(RpcUnsupportedProtocolError);\n\n/**\n * @category exception\n */\nexport class RpcConnectionDenyError extends RpcError {\n static override code = 9;\n\n override code = 9;\n\n constructor(data?: any) {\n super('Wallet deny your connection request');\n this.data = data;\n this.name = 'RpcConnectionDenyError';\n }\n}\nrpcErrors.push(RpcConnectionDenyError);\n\n/**\n * @category exception\n */\nexport class RpcNotAuthorizeError extends RpcError {\n static override code = 10;\n\n override code = 10;\n\n constructor() {\n super('You are not connected to the wallet');\n this.name = 'RpcNotAuthorizeError';\n }\n}\nrpcErrors.push(RpcNotAuthorizeError);\n\n/**\n * @category exception\n */\nexport class RpcPermissionDenyError extends RpcError {\n static override code = 11;\n\n override code = 11;\n\n constructor(address: Encoded.AccountAddress) {\n super(`You are not subscribed for account ${address}`);\n this.data = address;\n this.name = 'RpcPermissionDenyError';\n }\n}\nrpcErrors.push(RpcPermissionDenyError);\n\n/**\n * @category exception\n */\nexport class RpcInternalError extends RpcError {\n static override code = 12;\n\n override code = 12;\n\n constructor() {\n super('The peer failed to execute your request due to unknown error');\n this.name = 'RpcInternalError';\n }\n}\nrpcErrors.push(RpcInternalError);\n\n/**\n * @category exception\n */\nexport class RpcMethodNotFoundError extends RpcError {\n static override code = -32601;\n\n override code = -32601;\n\n constructor() {\n super('Method not found');\n this.name = 'RpcMethodNotFoundError';\n }\n}\nrpcErrors.push(RpcMethodNotFoundError);\n"],"mappings":";AAAA;AAAA,SAESA,SAAS,EAAEC,aAAa;AAEjC;AACA;AACA;AACA,WAAkBC,iBAAiB;;AAKnC;AACA;AACA;AAFA,WALkBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;AAAA,GAAjBA,iBAAiB,KAAjBA,iBAAiB;AAQnC,WAAkBC,WAAW;;AAK7B;AACA;AACA;AAFA,WALkBA,WAAW;EAAXA,WAAW;EAAXA,WAAW;AAAA,GAAXA,WAAW,KAAXA,WAAW;AAQ7B,WAAkBC,kBAAkB;;AAKpC;AACA;AACA;AAFA,WALkBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;AAAA,GAAlBA,kBAAkB,KAAlBA,kBAAkB;AAQpC,WAAkBC,OAAO;;AAYzB;AACA;AACA;AAFA,WAZkBA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;EAAPA,OAAO;AAAA,GAAPA,OAAO,KAAPA,OAAO;AAezB,WAAkBC,UAAU;AAI3B,WAJiBA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,KAAVA,UAAU;AAY5B,MAAMC,SAAmE,GAAG,EAAE;;AAE9E;AACA;AACA;AAC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,SAASpB,QAAQ,CAAC;EAKnDW,WAAWA,CAACU,OAA+B,EAAE;IAC3C,KAAK,CAAE,sCAAqCA,OAAQ,EAAC,CAAC;IAACT,eAAA,eAHzC,EAAE;IAIhB,IAAI,CAACR,IAAI,GAAGiB,OAAO;IACnB,IAAI,CAACR,IAAI,GAAG,wBAAwB;EACtC;AACF;AAACD,eAAA,CAVYQ,sBAAsB,UACV,EAAE;AAU3BrB,SAAS,CAACe,IAAI,CAACM,sBAAsB,CAAC;;AAEtC;AACA;AACA;AACA,OAAO,MAAME,gBAAgB,SAAStB,QAAQ,CAAC;EAK7CW,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,8DAA8D,CAAC;IAACC,eAAA,eAHxD,EAAE;IAIhB,IAAI,CAACC,IAAI,GAAG,kBAAkB;EAChC;AACF;AAACD,eAAA,CATYU,gBAAgB,UACJ,EAAE;AAS3BvB,SAAS,CAACe,IAAI,CAACQ,gBAAgB,CAAC;;AAEhC;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASvB,QAAQ,CAAC;EAKnDW,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,kBAAkB,CAAC;IAACC,eAAA,eAHZ,CAAC,KAAK;IAIpB,IAAI,CAACC,IAAI,GAAG,wBAAwB;EACtC;AACF;AAACD,eAAA,CATYW,sBAAsB,UACV,CAAC,KAAK;AAS/BxB,SAAS,CAACe,IAAI,CAACS,sBAAsB,CAAC"}
1
+ {"version":3,"file":"schema.mjs","names":["BaseError","InternalError","MESSAGE_DIRECTION","WALLET_TYPE","SUBSCRIPTION_TYPES","METHODS","RPC_STATUS","rpcErrors","RpcError","toJSON","code","message","data","deserialize","json","RpcErr","find","cl","RpcInvalidTransactionError","constructor","_defineProperty","name","push","RpcRejectedByUserError","RpcUnsupportedProtocolError","RpcConnectionDenyError","RpcNotAuthorizeError","RpcPermissionDenyError","address","RpcInternalError","RpcMethodNotFoundError"],"sources":["../../src/aepp-wallet-communication/schema.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { Encoded } from '../utils/encoder';\nimport { BaseError, InternalError } from '../utils/errors';\n\n/**\n * @category aepp wallet communication\n */\nexport const enum MESSAGE_DIRECTION {\n to_waellet = 'to_waellet',\n to_aepp = 'to_aepp',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum WALLET_TYPE {\n window = 'window',\n extension = 'extension',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum SUBSCRIPTION_TYPES {\n subscribe = 'subscribe',\n unsubscribe = 'unsubscribe',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum METHODS {\n readyToConnect = 'connection.announcePresence',\n updateAddress = 'address.update',\n address = 'address.get',\n connect = 'connection.open',\n sign = 'transaction.sign',\n signMessage = 'message.sign',\n signTypedData = 'typedData.sign',\n signDelegationToContract = 'delegationToContract.sign',\n subscribeAddress = 'address.subscribe',\n updateNetwork = 'networkId.update',\n closeConnection = 'connection.close',\n}\n\n/**\n * @category aepp wallet communication\n */\nexport const enum RPC_STATUS {\n CONNECTED = 'CONNECTED',\n DISCONNECTED = 'DISCONNECTED',\n WAITING_FOR_CONNECTION_REQUEST = 'WAITING_FOR_CONNECTION_REQUEST',\n}\n\ninterface RpcErrorAsJson {\n code: number;\n message: string;\n data?: any;\n}\n\nconst rpcErrors: Array<(new (data?: any) => RpcError) & { code: number }> = [];\n\n/**\n * @category exception\n */\nexport abstract class RpcError extends BaseError {\n static code: number;\n\n code!: number;\n\n data?: any;\n\n toJSON(): RpcErrorAsJson {\n return {\n code: this.code,\n message: this.message,\n data: this.data,\n };\n }\n\n static deserialize(json: RpcErrorAsJson): RpcError {\n const RpcErr = rpcErrors.find((cl) => cl.code === json.code);\n if (RpcErr == null) throw new InternalError(`Can't find RpcError with code: ${json.code}`);\n return new RpcErr(json.data);\n }\n}\n\n/**\n * @category exception\n */\nexport class RpcInvalidTransactionError extends RpcError {\n static override code = 2;\n\n override code = 2;\n\n constructor(data?: any) {\n super('Invalid transaction');\n this.data = data;\n this.name = 'RpcInvalidTransactionError';\n }\n}\nrpcErrors.push(RpcInvalidTransactionError);\n\n/**\n * @category exception\n */\nexport class RpcRejectedByUserError extends RpcError {\n static override code = 4;\n\n override code = 4;\n\n constructor(data?: any) {\n super('Operation rejected by user');\n this.data = data;\n this.name = 'RpcRejectedByUserError';\n }\n}\nrpcErrors.push(RpcRejectedByUserError);\n\n/**\n * @category exception\n */\nexport class RpcUnsupportedProtocolError extends RpcError {\n static override code = 5;\n\n override code = 5;\n\n constructor() {\n super('Unsupported Protocol Version');\n this.name = 'RpcUnsupportedProtocolError';\n }\n}\nrpcErrors.push(RpcUnsupportedProtocolError);\n\n/**\n * @category exception\n */\nexport class RpcConnectionDenyError extends RpcError {\n static override code = 9;\n\n override code = 9;\n\n constructor(data?: any) {\n super('Wallet deny your connection request');\n this.data = data;\n this.name = 'RpcConnectionDenyError';\n }\n}\nrpcErrors.push(RpcConnectionDenyError);\n\n/**\n * @category exception\n */\nexport class RpcNotAuthorizeError extends RpcError {\n static override code = 10;\n\n override code = 10;\n\n constructor() {\n super('You are not connected to the wallet');\n this.name = 'RpcNotAuthorizeError';\n }\n}\nrpcErrors.push(RpcNotAuthorizeError);\n\n/**\n * @category exception\n */\nexport class RpcPermissionDenyError extends RpcError {\n static override code = 11;\n\n override code = 11;\n\n constructor(address: Encoded.AccountAddress) {\n super(`You are not subscribed for account ${address}`);\n this.data = address;\n this.name = 'RpcPermissionDenyError';\n }\n}\nrpcErrors.push(RpcPermissionDenyError);\n\n/**\n * @category exception\n */\nexport class RpcInternalError extends RpcError {\n static override code = 12;\n\n override code = 12;\n\n constructor() {\n super('The peer failed to execute your request due to unknown error');\n this.name = 'RpcInternalError';\n }\n}\nrpcErrors.push(RpcInternalError);\n\n/**\n * @category exception\n */\nexport class RpcMethodNotFoundError extends RpcError {\n static override code = -32601;\n\n override code = -32601;\n\n constructor() {\n super('Method not found');\n this.name = 'RpcMethodNotFoundError';\n }\n}\nrpcErrors.push(RpcMethod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AI,GAAG,wBAAwB;EACtC;AACF;AAACD,eAAA,CATYU,sBAAsB,UACV,CAAC,KAAK;AAS/BvB,SAAS,CAACe,IAAI,CAACQ,sBAAsB,CAAC"}
@@ -20,6 +20,6 @@ interface Wallets {
20
20
  */
21
21
  declare const _default: (connection: BrowserConnection, onDetected: ({ wallets, newWallet }: {
22
22
  wallets: Wallets;
23
- newWallet?: Wallet | undefined;
23
+ newWallet: Wallet;
24
24
  }) => void) => () => void;
25
25
  export default _default;
@@ -35,9 +35,6 @@ export default ((connection, onDetected) => {
35
35
  newWallet: wallet
36
36
  });
37
37
  }, () => {});
38
- if (Object.keys(wallets).length > 0) onDetected({
39
- wallets
40
- });
41
38
  return () => connection.disconnect();
42
39
  });
43
40
  //# sourceMappingURL=wallet-detector.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-detector.mjs","names":["BrowserWindowMessageConnection","MESSAGE_DIRECTION","METHODS","UnsupportedPlatformError","connection","onDetected","window","wallets","connect","_ref","origin","source","method","params","readyToConnect","id","wallet","info","getConnection","isExtension","type","sendDirection","to_waellet","undefined","receiveDirection","to_aepp","target","newWallet","Object","keys","length","disconnect"],"sources":["../../src/aepp-wallet-communication/wallet-detector.ts"],"sourcesContent":["import BrowserConnection from './connection/Browser';\nimport BrowserWindowMessageConnection from './connection/BrowserWindowMessage';\nimport { MESSAGE_DIRECTION, METHODS } from './schema';\nimport { UnsupportedPlatformError } from '../utils/errors';\n\ninterface Wallet {\n info: {\n id: string;\n type: string;\n origin: string;\n };\n getConnection: () => BrowserWindowMessageConnection;\n}\ninterface Wallets { [key: string]: Wallet }\n\n/**\n * A function to detect available wallets\n * @category aepp wallet communication\n * @param connection - connection to use to detect wallets\n * @param onDetected - call-back function which trigger on new wallet\n * @returns a function to stop scanning\n */\nexport default (\n connection: BrowserConnection,\n onDetected: ({ wallets, newWallet }: { wallets: Wallets; newWallet?: Wallet }) => void,\n): () => void => {\n if (window == null) throw new UnsupportedPlatformError('Window object not found, you can run wallet detector only in browser');\n const wallets: Wallets = {};\n\n connection.connect((\n { method, params }: { method: string; params: Wallet['info'] },\n origin: string,\n source: Window,\n ) => {\n if (method !== METHODS.readyToConnect || wallets[params.id] != null) return;\n\n const wallet = {\n info: params,\n getConnection() {\n const isExtension = params.type === 'extension';\n return new BrowserWindowMessageConnection({\n sendDirection: isExtension ? MESSAGE_DIRECTION.to_waellet : undefined,\n receiveDirection: isExtension ? MESSAGE_DIRECTION.to_aepp : undefined,\n target: source,\n origin: isExtension ? window.origin : params.origin,\n });\n },\n };\n wallets[wallet.info.id] = wallet;\n onDetected({ wallets, newWallet: wallet });\n }, () => {});\n if (Object.keys(wallets).length > 0) onDetected({ wallets });\n\n return () => connection.disconnect();\n};\n"],"mappings":"OACOA,8BAA8B;AAAA,SAC5BC,iBAAiB,EAAEC,OAAO;AAAA,SAC1BC,wBAAwB;AAYjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,CACbC,UAA6B,EAC7BC,UAAsF,KACvE;EACf,IAAIC,MAAM,IAAI,IAAI,EAAE,MAAM,IAAIH,wBAAwB,CAAC,sEAAsE,CAAC;EAC9H,MAAMI,OAAgB,GAAG,CAAC,CAAC;EAE3BH,UAAU,CAACI,OAAO,CAAC,CAAAC,IAAA,EAEjBC,MAAc,EACdC,MAAc,KACX;IAAA,IAHH;MAAEC,MAAM;MAAEC;IAAmD,CAAC,GAAAJ,IAAA;IAI9D,IAAIG,MAAM,KAAKV,OAAO,CAACY,cAAc,IAAIP,OAAO,CAACM,MAAM,CAACE,EAAE,CAAC,IAAI,IAAI,EAAE;IAErE,MAAMC,MAAM,GAAG;MACbC,IAAI,EAAEJ,MAAM;MACZK,aAAaA,CAAA,EAAG;QACd,MAAMC,WAAW,GAAGN,MAAM,CAACO,IAAI,KAAK,WAAW;QAC/C,OAAO,IAAIpB,8BAA8B,CAAC;UACxCqB,aAAa,EAAEF,WAAW,GAAGlB,iBAAiB,CAACqB,UAAU,GAAGC,SAAS;UACrEC,gBAAgB,EAAEL,WAAW,GAAGlB,iBAAiB,CAACwB,OAAO,GAAGF,SAAS;UACrEG,MAAM,EAAEf,MAAM;UACdD,MAAM,EAAES,WAAW,GAAGb,MAAM,CAACI,MAAM,GAAGG,MAAM,CAACH;QAC/C,CAAC,CAAC;MACJ;IACF,CAAC;IACDH,OAAO,CAACS,MAAM,CAACC,IAAI,CAACF,EAAE,CAAC,GAAGC,MAAM;IAChCX,UAAU,CAAC;MAAEE,OAAO;MAAEoB,SAAS,EAAEX;IAAO,CAAC,CAAC;EAC5C,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;EACZ,IAAIY,MAAM,CAACC,IAAI,CAACtB,OAAO,CAAC,CAACuB,MAAM,GAAG,CAAC,EAAEzB,UAAU,CAAC;IAAEE;EAAQ,CAAC,CAAC;EAE5D,OAAO,MAAMH,UAAU,CAAC2B,UAAU,EAAE;AACtC,CAAC"}
1
+ {"version":3,"file":"wallet-detector.mjs","names":["BrowserWindowMessageConnection","MESSAGE_DIRECTION","METHODS","UnsupportedPlatformError","connection","onDetected","window","wallets","connect","_ref","origin","source","method","params","readyToConnect","id","wallet","info","getConnection","isExtension","type","sendDirection","to_waellet","undefined","receiveDirection","to_aepp","target","newWallet","disconnect"],"sources":["../../src/aepp-wallet-communication/wallet-detector.ts"],"sourcesContent":["import BrowserConnection from './connection/Browser';\nimport BrowserWindowMessageConnection from './connection/BrowserWindowMessage';\nimport { MESSAGE_DIRECTION, METHODS } from './schema';\nimport { UnsupportedPlatformError } from '../utils/errors';\n\ninterface Wallet {\n info: {\n id: string;\n type: string;\n origin: string;\n };\n getConnection: () => BrowserWindowMessageConnection;\n}\ninterface Wallets { [key: string]: Wallet }\n\n/**\n * A function to detect available wallets\n * @category aepp wallet communication\n * @param connection - connection to use to detect wallets\n * @param onDetected - call-back function which trigger on new wallet\n * @returns a function to stop scanning\n */\nexport default (\n connection: BrowserConnection,\n onDetected: ({ wallets, newWallet }: { wallets: Wallets; newWallet: Wallet }) => void,\n): () => void => {\n if (window == null) throw new UnsupportedPlatformError('Window object not found, you can run wallet detector only in browser');\n const wallets: Wallets = {};\n\n connection.connect((\n { method, params }: { method: string; params: Wallet['info'] },\n origin: string,\n source: Window,\n ) => {\n if (method !== METHODS.readyToConnect || wallets[params.id] != null) return;\n\n const wallet = {\n info: params,\n getConnection() {\n const isExtension = params.type === 'extension';\n return new BrowserWindowMessageConnection({\n sendDirection: isExtension ? MESSAGE_DIRECTION.to_waellet : undefined,\n receiveDirection: isExtension ? MESSAGE_DIRECTION.to_aepp : undefined,\n target: source,\n origin: isExtension ? window.origin : params.origin,\n });\n },\n };\n wallets[wallet.info.id] = wallet;\n onDetected({ wallets, newWallet: wallet });\n }, () => {});\n\n return () => connection.disconnect();\n};\n"],"mappings":"OACOA,8BAA8B;AAAA,SAC5BC,iBAAiB,EAAEC,OAAO;AAAA,SAC1BC,wBAAwB;AAYjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,CACbC,UAA6B,EAC7BC,UAAqF,KACtE;EACf,IAAIC,MAAM,IAAI,IAAI,EAAE,MAAM,IAAIH,wBAAwB,CAAC,sEAAsE,CAAC;EAC9H,MAAMI,OAAgB,GAAG,CAAC,CAAC;EAE3BH,UAAU,CAACI,OAAO,CAAC,CAAAC,IAAA,EAEjBC,MAAc,EACdC,MAAc,KACX;IAAA,IAHH;MAAEC,MAAM;MAAEC;IAAmD,CAAC,GAAAJ,IAAA;IAI9D,IAAIG,MAAM,KAAKV,OAAO,CAACY,cAAc,IAAIP,OAAO,CAACM,MAAM,CAACE,EAAE,CAAC,IAAI,IAAI,EAAE;IAErE,MAAMC,MAAM,GAAG;MACbC,IAAI,EAAEJ,MAAM;MACZK,aAAaA,CAAA,EAAG;QACd,MAAMC,WAAW,GAAGN,MAAM,CAACO,IAAI,KAAK,WAAW;QAC/C,OAAO,IAAIpB,8BAA8B,CAAC;UACxCqB,aAAa,EAAEF,WAAW,GAAGlB,iBAAiB,CAACqB,UAAU,GAAGC,SAAS;UACrEC,gBAAgB,EAAEL,WAAW,GAAGlB,iBAAiB,CAACwB,OAAO,GAAGF,SAAS;UACrEG,MAAM,EAAEf,MAAM;UACdD,MAAM,EAAES,WAAW,GAAGb,MAAM,CAACI,MAAM,GAAGG,MAAM,CAACH;QAC/C,CAAC,CAAC;MACJ;IACF,CAAC;IACDH,OAAO,CAACS,MAAM,CAACC,IAAI,CAACF,EAAE,CAAC,GAAGC,MAAM;IAChCX,UAAU,CAAC;MAAEE,OAAO;MAAEoB,SAAS,EAAEX;IAAO,CAAC,CAAC;EAC5C,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;EAEZ,OAAO,MAAMZ,UAAU,CAACwB,UAAU,CAAC,CAAC;AACtC,CAAC"}
@@ -192,7 +192,21 @@ const generateACIOperationSpec = {
192
192
  httpMethod: "POST",
193
193
  responses: {
194
194
  200: {
195
- bodyMapper: Mappers.Aci
195
+ bodyMapper: {
196
+ type: {
197
+ name: "Sequence",
198
+ element: {
199
+ type: {
200
+ name: "Dictionary",
201
+ value: {
202
+ type: {
203
+ name: "any"
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+ }
196
210
  },
197
211
  400: {
198
212
  bodyMapper: {
@@ -1 +1 @@
1
- {"version":3,"file":"compiler.mjs","names":["coreClient","Parameters","Mappers","Compiler","ServiceClient","constructor","$host","options","_ref","_options$endpoint","undefined","Error","defaults","requestContentType","packageDetails","userAgentPrefix","userAgentOptions","optionsWithDefaults","endpoint","baseUri","generateACI","body","sendOperationRequest","generateACIOperationSpec","compileContract","compileContractOperationSpec","decodeCallResult","decodeCallResultOperationSpec","decodeCallResultBytecode","decodeCallResultBytecodeOperationSpec","encodeCalldata","encodeCalldataOperationSpec","decodeCalldataBytecode","decodeCalldataBytecodeOperationSpec","decodeCalldataSource","decodeCalldataSourceOperationSpec","getFateAssemblerCode","getFateAssemblerCodeOperationSpec","validateByteCode","validateByteCodeOperationSpec","getCompilerVersion","getCompilerVersionOperationSpec","version","versionOperationSpec","apiVersion","apiVersionOperationSpec","api","apiOperationSpec","serializer","createSerializer","path","httpMethod","responses","bodyMapper","Aci","type","name","element","className","isError","requestBody","urlParameters","headerParameters","contentType","accept","mediaType","CompileResult","body1","DecodedCallresult","body2","Calldata","body3","DecodedCalldata","ErrorModel","body4","body5","FateAssembler","body6","body7","CompilerVersion","ApiVersion","value"],"sources":["../../../src/apis/compiler/compiler.ts"],"sourcesContent":["import * as coreClient from \"@azure/core-client\";\nimport * as Parameters from \"./models/parameters\";\nimport * as Mappers from \"./models/mappers\";\nimport {\n CompilerOptionalParams,\n Contract,\n GenerateACIOptionalParams,\n GenerateACIResponse,\n CompileContractOptionalParams,\n CompileContractResponse,\n SophiaCallResultInput,\n DecodeCallResultOptionalParams,\n DecodeCallResultResponse,\n BytecodeCallResultInput,\n DecodeCallResultBytecodeOptionalParams,\n DecodeCallResultBytecodeResponse,\n FunctionCallInput,\n EncodeCalldataOptionalParams,\n EncodeCalldataResponse,\n DecodeCalldataBytecode,\n DecodeCalldataBytecodeOptionalParams,\n DecodeCalldataBytecodeResponse,\n DecodeCalldataSource,\n DecodeCalldataSourceOptionalParams,\n DecodeCalldataSourceResponse,\n ByteCodeInput,\n GetFateAssemblerCodeOptionalParams,\n GetFateAssemblerCodeResponse,\n ValidateByteCodeInput,\n ValidateByteCodeOptionalParams,\n GetCompilerVersionOptionalParams,\n GetCompilerVersionResponse,\n VersionOptionalParams,\n VersionResponse,\n ApiVersionOptionalParams,\n ApiVersionResponse,\n ApiOptionalParams,\n ApiResponse\n} from \"./models\";\n\nexport class Compiler extends coreClient.ServiceClient {\n $host: string;\n\n /**\n * Initializes a new instance of the Compiler class.\n * @param $host server parameter\n * @param options The parameter options\n */\n constructor($host: string, options?: CompilerOptionalParams) {\n if ($host === undefined) {\n throw new Error(\"'$host' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: CompilerOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-compiler/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n endpoint: options.endpoint ?? options.baseUri ?? \"{$host}\"\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.$host = $host;\n }\n\n /**\n * Generate an Aeternity Contract Interface (ACI) for contract\n * @param body contract code\n * @param options The options parameters.\n */\n generateACI(\n body: Contract,\n options?: GenerateACIOptionalParams\n ): Promise<GenerateACIResponse> {\n return this.sendOperationRequest(\n { body, options },\n generateACIOperationSpec\n );\n }\n\n /**\n * Compile a sophia contract from source and return byte code and ACI\n * @param body contract code\n * @param options The options parameters.\n */\n compileContract(\n body: Contract,\n options?: CompileContractOptionalParams\n ): Promise<CompileContractResponse> {\n return this.sendOperationRequest(\n { body, options },\n compileContractOperationSpec\n );\n }\n\n /**\n * Decode the result of contract call\n * @param body Binary data in Sophia ABI format\n * @param options The options parameters.\n */\n decodeCallResult(\n body: SophiaCallResultInput,\n options?: DecodeCallResultOptionalParams\n ): Promise<DecodeCallResultResponse> {\n return this.sendOperationRequest(\n { body, options },\n decodeCallResultOperationSpec\n );\n }\n\n /**\n * Decode the result of contract call from Bytecode\n * @param body Call result + compiled contract\n * @param options The options parameters.\n */\n decodeCallResultBytecode(\n body: BytecodeCallResultInput,\n options?: DecodeCallResultBytecodeOptionalParams\n ): Promise<DecodeCallResultBytecodeResponse> {\n return this.sendOperationRequest(\n { body, options },\n decodeCallResultBytecodeOperationSpec\n );\n }\n\n /**\n * Encode Sophia function call according to sophia ABI.\n * @param body Sophia function call - contract code + function name + arguments\n * @param options The options parameters.\n */\n encodeCalldata(\n body: FunctionCallInput,\n options?: EncodeCalldataOptionalParams\n ): Promise<EncodeCalldataResponse> {\n return this.sendOperationRequest(\n { body, options },\n encodeCalldataOperationSpec\n );\n }\n\n /**\n * Identify function name and arguments in Calldata for a compiled contract\n * @param body Calldata + compiled contract\n * @param options The options parameters.\n */\n decodeCalldataBytecode(\n body: DecodeCalldataBytecode,\n options?: DecodeCalldataBytecodeOptionalParams\n ): Promise<DecodeCalldataBytecodeResponse> {\n return this.sendOperationRequest(\n { body, options },\n decodeCalldataBytecodeOperationSpec\n );\n }\n\n /**\n * Identify function name and arguments in Calldata for a (partial) contract\n * @param body Calldata + contract (stub) code\n * @param options The options parameters.\n */\n decodeCalldataSource(\n body: DecodeCalldataSource,\n options?: DecodeCalldataSourceOptionalParams\n ): Promise<DecodeCalldataSourceResponse> {\n return this.sendOperationRequest(\n { body, options },\n decodeCalldataSourceOperationSpec\n );\n }\n\n /**\n * Get FATE assembler code from bytecode\n * @param body contract byte array\n * @param options The options parameters.\n */\n getFateAssemblerCode(\n body: ByteCodeInput,\n options?: GetFateAssemblerCodeOptionalParams\n ): Promise<GetFateAssemblerCodeResponse> {\n return this.sendOperationRequest(\n { body, options },\n getFateAssemblerCodeOperationSpec\n );\n }\n\n /**\n * Verify that an encoded byte array is the result of compiling a given contract\n * @param body contract byte array and source code\n * @param options The options parameters.\n */\n validateByteCode(\n body: ValidateByteCodeInput,\n options?: ValidateByteCodeOptionalParams\n ): Promise<void> {\n return this.sendOperationRequest(\n { body, options },\n validateByteCodeOperationSpec\n );\n }\n\n /**\n * Extract compiler version from bytecode\n * @param body contract byte array\n * @param options The options parameters.\n */\n getCompilerVersion(\n body: ByteCodeInput,\n options?: GetCompilerVersionOptionalParams\n ): Promise<GetCompilerVersionResponse> {\n return this.sendOperationRequest(\n { body, options },\n getCompilerVersionOperationSpec\n );\n }\n\n /**\n * Get the version of the underlying Sophia compiler version\n * @param options The options parameters.\n */\n version(options?: VersionOptionalParams): Promise<VersionResponse> {\n return this.sendOperationRequest({ options }, versionOperationSpec);\n }\n\n /**\n * Get the version of the API\n * @param options The options parameters.\n */\n apiVersion(options?: ApiVersionOptionalParams): Promise<ApiVersionResponse> {\n return this.sendOperationRequest({ options }, apiVersionOperationSpec);\n }\n\n /**\n * Get the Api description\n * @param options The options parameters.\n */\n api(options?: ApiOptionalParams): Promise<ApiResponse> {\n return this.sendOperationRequest({ options }, apiOperationSpec);\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst generateACIOperationSpec: coreClient.OperationSpec = {\n path: \"/aci\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.Aci\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst compileContractOperationSpec: coreClient.OperationSpec = {\n path: \"/compile\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.CompileResult\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst decodeCallResultOperationSpec: coreClient.OperationSpec = {\n path: \"/decode-call-result\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: { type: { name: \"any\" } }\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body1,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst decodeCallResultBytecodeOperationSpec: coreClient.OperationSpec = {\n path: \"/decode-call-result/bytecode\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.DecodedCallresult\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body2,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst encodeCalldataOperationSpec: coreClient.OperationSpec = {\n path: \"/encode-calldata\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.Calldata\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body3,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst decodeCalldataBytecodeOperationSpec: coreClient.OperationSpec = {\n path: \"/decode-calldata/bytecode\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.DecodedCalldata\n },\n 400: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n requestBody: Parameters.body4,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst decodeCalldataSourceOperationSpec: coreClient.OperationSpec = {\n path: \"/decode-calldata/source\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.DecodedCalldata\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body5,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst getFateAssemblerCodeOperationSpec: coreClient.OperationSpec = {\n path: \"/fate-assembler\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.FateAssembler\n },\n 400: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n requestBody: Parameters.body6,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst validateByteCodeOperationSpec: coreClient.OperationSpec = {\n path: \"/validate-byte-code\",\n httpMethod: \"POST\",\n responses: {\n 200: {},\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body7,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst getCompilerVersionOperationSpec: coreClient.OperationSpec = {\n path: \"/compiler-version\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.CompilerVersion\n },\n 400: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n requestBody: Parameters.body6,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst versionOperationSpec: coreClient.OperationSpec = {\n path: \"/version\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.CompilerVersion\n },\n 500: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst apiVersionOperationSpec: coreClient.OperationSpec = {\n path: \"/api-version\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.ApiVersion\n },\n 500: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst apiOperationSpec: coreClient.OperationSpec = {\n path: \"/api\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: {\n type: { name: \"Dictionary\", value: { type: { name: \"any\" } } }\n }\n },\n 400: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.accept],\n serializer\n};\n"],"mappings":"AAAA,OAAO,KAAKA,UAAU,MAAM,oBAAoB;AAAC,OAC1C,KAAKC,UAAU;AAAA,OACf,KAAKC,OAAO;AAsCnB,OAAO,MAAMC,QAAQ,SAASH,UAAU,CAACI,aAAa,CAAC;EAGrD;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAACC,KAAa,EAAEC,OAAgC,EAAE;IAAA,IAAAC,IAAA,EAAAC,iBAAA;IAC3D,IAAIH,KAAK,KAAKI,SAAS,EAAE;MACvB,MAAM,IAAIC,KAAK,CAAC,wBAAwB,CAAC;IAC3C;;IAEA;IACA,IAAI,CAACJ,OAAO,EAAE;MACZA,OAAO,GAAG,CAAC,CAAC;IACd;IACA,MAAMK,QAAgC,GAAG;MACvCC,kBAAkB,EAAE;IACtB,CAAC;IAED,MAAMC,cAAc,GAAI,gCAA+B;IACvD,MAAMC,eAAe,GACnBR,OAAO,CAACS,gBAAgB,IAAIT,OAAO,CAACS,gBAAgB,CAACD,eAAe,GAC/D,GAAER,OAAO,CAACS,gBAAgB,CAACD,eAAgB,IAAGD,cAAe,EAAC,GAC9D,GAAEA,cAAe,EAAC;IAEzB,MAAMG,mBAAmB,GAAG;MAC1B,GAAGL,QAAQ;MACX,GAAGL,OAAO;MACVS,gBAAgB,EAAE;QAChBD;MACF,CAAC;MACDG,QAAQ,GAAAV,IAAA,IAAAC,iBAAA,GAAEF,OAAO,CAACW,QAAQ,cAAAT,iBAAA,cAAAA,iBAAA,GAAIF,OAAO,CAACY,OAAO,cAAAX,IAAA,cAAAA,IAAA,GAAI;IACnD,CAAC;IACD,KAAK,CAACS,mBAAmB,CAAC;IAC1B;IACA,IAAI,CAACX,KAAK,GAAGA,KAAK;EACpB;;EAEA;AACF;AACA;AACA;AACA;EACEc,WAAWA,CACTC,IAAc,EACdd,OAAmC,EACL;IAC9B,OAAO,IAAI,CAACe,oBAAoB,CAC9B;MAAED,IA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EAAE,CAAC7D,UAAU,CAAC+D,MAAM,CAAC;EACrChB;AACF,CAAC;AACD,MAAMD,gBAA0C,GAAG;EACjDG,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,KAAK;EACjBC,SAAS,EAAE;IACT,GAAG,EAAE;MACHC,UAAU,EAAE;QACVE,IAAI,EAAE;UAAEC,IAAI,EAAE,YAAY;UAAEyB,KAAK,EAAE;YAAE1B,IAAI,EAAE;cAAEC,IAAI,EAAE;YAAM;UAAE;QAAE;MAC/D;IACF,CAAC;IACD,GAAG,EAAE;MACHH,UAAU,EAAEnD,OAAO,CAACuE,UAAU;MAC9Bd,OAAO,EAAE;IACX;EACF,CAAC;EACDE,aAAa,EAAE,CAAC5D,UAAU,CAACK,KAAK,CAAC;EACjCwD,gBAAgB,EAAE,CAAC7D,UAAU,CAAC+D,MAAM,CAAC;EACrChB;AACF,CAAC"}
1
+ {"version":3,"file":"compiler.mjs","names":["coreClient","Parameters","Mappers","Compiler","ServiceClient","constructor","$host","options","_ref","_options$endpoint","undefined","Error","defaults","requestContentType","packageDetails","userAgentPrefix","userAgentOptions","optionsWithDefaults","endpoint","baseUri","generateACI","body","sendOperationRequest","generateACIOperationSpec","compileContract","compileContractOperationSpec","decodeCallResult","decodeCallResultOperationSpec","decodeCallResultBytecode","decodeCallResultBytecodeOperationSpec","encodeCalldata","encodeCalldataOperationSpec","decodeCalldataBytecode","decodeCalldataBytecodeOperationSpec","decodeCalldataSource","decodeCalldataSourceOperationSpec","getFateAssemblerCode","getFateAssemblerCodeOperationSpec","validateByteCode","validateByteCodeOperationSpec","getCompilerVersion","getCompilerVersionOperationSpec","version","versionOperationSpec","apiVersion","apiVersionOperationSpec","api","apiOperationSpec","serializer","createSerializer","path","httpMethod","responses","bodyMapper","type","name","element","value","className","isError","requestBody","urlParameters","headerParameters","contentType","accept","mediaType","CompileResult","body1","DecodedCallresult","body2","Calldata","body3","DecodedCalldata","ErrorModel","body4","body5","FateAssembler","body6","body7","CompilerVersion","ApiVersion"],"sources":["../../../src/apis/compiler/compiler.ts"],"sourcesContent":["import * as coreClient from \"@azure/core-client\";\nimport * as Parameters from \"./models/parameters\";\nimport * as Mappers from \"./models/mappers\";\nimport {\n CompilerOptionalParams,\n Contract,\n GenerateACIOptionalParams,\n GenerateACIResponse,\n CompileContractOptionalParams,\n CompileContractResponse,\n SophiaCallResultInput,\n DecodeCallResultOptionalParams,\n DecodeCallResultResponse,\n BytecodeCallResultInput,\n DecodeCallResultBytecodeOptionalParams,\n DecodeCallResultBytecodeResponse,\n FunctionCallInput,\n EncodeCalldataOptionalParams,\n EncodeCalldataResponse,\n DecodeCalldataBytecode,\n DecodeCalldataBytecodeOptionalParams,\n DecodeCalldataBytecodeResponse,\n DecodeCalldataSource,\n DecodeCalldataSourceOptionalParams,\n DecodeCalldataSourceResponse,\n ByteCodeInput,\n GetFateAssemblerCodeOptionalParams,\n GetFateAssemblerCodeResponse,\n ValidateByteCodeInput,\n ValidateByteCodeOptionalParams,\n GetCompilerVersionOptionalParams,\n GetCompilerVersionResponse,\n VersionOptionalParams,\n VersionResponse,\n ApiVersionOptionalParams,\n ApiVersionResponse,\n ApiOptionalParams,\n ApiResponse\n} from \"./models\";\n\nexport class Compiler extends coreClient.ServiceClient {\n $host: string;\n\n /**\n * Initializes a new instance of the Compiler class.\n * @param $host server parameter\n * @param options The parameter options\n */\n constructor($host: string, options?: CompilerOptionalParams) {\n if ($host === undefined) {\n throw new Error(\"'$host' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: CompilerOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\"\n };\n\n const packageDetails = `azsdk-js-compiler/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n endpoint: options.endpoint ?? options.baseUri ?? \"{$host}\"\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.$host = $host;\n }\n\n /**\n * Generate an Aeternity Contract Interface (ACI) for contract\n * @param body contract code\n * @param options The options parameters.\n */\n generateACI(\n body: Contract,\n options?: GenerateACIOptionalParams\n ): Promise<GenerateACIResponse> {\n return this.sendOperationRequest(\n { body, options },\n generateACIOperationSpec\n );\n }\n\n /**\n * Compile a sophia contract from source and return byte code and ACI\n * @param body contract code\n * @param options The options parameters.\n */\n compileContract(\n body: Contract,\n options?: CompileContractOptionalParams\n ): Promise<CompileContractResponse> {\n return this.sendOperationRequest(\n { body, options },\n compileContractOperationSpec\n );\n }\n\n /**\n * Decode the result of contract call\n * @param body Binary data in Sophia ABI format\n * @param options The options parameters.\n */\n decodeCallResult(\n body: SophiaCallResultInput,\n options?: DecodeCallResultOptionalParams\n ): Promise<DecodeCallResultResponse> {\n return this.sendOperationRequest(\n { body, options },\n decodeCallResultOperationSpec\n );\n }\n\n /**\n * Decode the result of contract call from Bytecode\n * @param body Call result + compiled contract\n * @param options The options parameters.\n */\n decodeCallResultBytecode(\n body: BytecodeCallResultInput,\n options?: DecodeCallResultBytecodeOptionalParams\n ): Promise<DecodeCallResultBytecodeResponse> {\n return this.sendOperationRequest(\n { body, options },\n decodeCallResultBytecodeOperationSpec\n );\n }\n\n /**\n * Encode Sophia function call according to sophia ABI.\n * @param body Sophia function call - contract code + function name + arguments\n * @param options The options parameters.\n */\n encodeCalldata(\n body: FunctionCallInput,\n options?: EncodeCalldataOptionalParams\n ): Promise<EncodeCalldataResponse> {\n return this.sendOperationRequest(\n { body, options },\n encodeCalldataOperationSpec\n );\n }\n\n /**\n * Identify function name and arguments in Calldata for a compiled contract\n * @param body Calldata + compiled contract\n * @param options The options parameters.\n */\n decodeCalldataBytecode(\n body: DecodeCalldataBytecode,\n options?: DecodeCalldataBytecodeOptionalParams\n ): Promise<DecodeCalldataBytecodeResponse> {\n return this.sendOperationRequest(\n { body, options },\n decodeCalldataBytecodeOperationSpec\n );\n }\n\n /**\n * Identify function name and arguments in Calldata for a (partial) contract\n * @param body Calldata + contract (stub) code\n * @param options The options parameters.\n */\n decodeCalldataSource(\n body: DecodeCalldataSource,\n options?: DecodeCalldataSourceOptionalParams\n ): Promise<DecodeCalldataSourceResponse> {\n return this.sendOperationRequest(\n { body, options },\n decodeCalldataSourceOperationSpec\n );\n }\n\n /**\n * Get FATE assembler code from bytecode\n * @param body contract byte array\n * @param options The options parameters.\n */\n getFateAssemblerCode(\n body: ByteCodeInput,\n options?: GetFateAssemblerCodeOptionalParams\n ): Promise<GetFateAssemblerCodeResponse> {\n return this.sendOperationRequest(\n { body, options },\n getFateAssemblerCodeOperationSpec\n );\n }\n\n /**\n * Verify that an encoded byte array is the result of compiling a given contract\n * @param body contract byte array and source code\n * @param options The options parameters.\n */\n validateByteCode(\n body: ValidateByteCodeInput,\n options?: ValidateByteCodeOptionalParams\n ): Promise<void> {\n return this.sendOperationRequest(\n { body, options },\n validateByteCodeOperationSpec\n );\n }\n\n /**\n * Extract compiler version from bytecode\n * @param body contract byte array\n * @param options The options parameters.\n */\n getCompilerVersion(\n body: ByteCodeInput,\n options?: GetCompilerVersionOptionalParams\n ): Promise<GetCompilerVersionResponse> {\n return this.sendOperationRequest(\n { body, options },\n getCompilerVersionOperationSpec\n );\n }\n\n /**\n * Get the version of the underlying Sophia compiler version\n * @param options The options parameters.\n */\n version(options?: VersionOptionalParams): Promise<VersionResponse> {\n return this.sendOperationRequest({ options }, versionOperationSpec);\n }\n\n /**\n * Get the version of the API\n * @param options The options parameters.\n */\n apiVersion(options?: ApiVersionOptionalParams): Promise<ApiVersionResponse> {\n return this.sendOperationRequest({ options }, apiVersionOperationSpec);\n }\n\n /**\n * Get the Api description\n * @param options The options parameters.\n */\n api(options?: ApiOptionalParams): Promise<ApiResponse> {\n return this.sendOperationRequest({ options }, apiOperationSpec);\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst generateACIOperationSpec: coreClient.OperationSpec = {\n path: \"/aci\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: {\n type: { name: \"Dictionary\", value: { type: { name: \"any\" } } }\n }\n }\n }\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst compileContractOperationSpec: coreClient.OperationSpec = {\n path: \"/compile\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.CompileResult\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst decodeCallResultOperationSpec: coreClient.OperationSpec = {\n path: \"/decode-call-result\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: { type: { name: \"any\" } }\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body1,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst decodeCallResultBytecodeOperationSpec: coreClient.OperationSpec = {\n path: \"/decode-call-result/bytecode\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.DecodedCallresult\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body2,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst encodeCalldataOperationSpec: coreClient.OperationSpec = {\n path: \"/encode-calldata\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.Calldata\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body3,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst decodeCalldataBytecodeOperationSpec: coreClient.OperationSpec = {\n path: \"/decode-calldata/bytecode\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.DecodedCalldata\n },\n 400: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n requestBody: Parameters.body4,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst decodeCalldataSourceOperationSpec: coreClient.OperationSpec = {\n path: \"/decode-calldata/source\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.DecodedCalldata\n },\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body5,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst getFateAssemblerCodeOperationSpec: coreClient.OperationSpec = {\n path: \"/fate-assembler\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.FateAssembler\n },\n 400: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n requestBody: Parameters.body6,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst validateByteCodeOperationSpec: coreClient.OperationSpec = {\n path: \"/validate-byte-code\",\n httpMethod: \"POST\",\n responses: {\n 200: {},\n 400: {\n bodyMapper: {\n type: {\n name: \"Sequence\",\n element: { type: { name: \"Composite\", className: \"CompilerError\" } }\n }\n },\n isError: true\n }\n },\n requestBody: Parameters.body7,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst getCompilerVersionOperationSpec: coreClient.OperationSpec = {\n path: \"/compiler-version\",\n httpMethod: \"POST\",\n responses: {\n 200: {\n bodyMapper: Mappers.CompilerVersion\n },\n 400: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n requestBody: Parameters.body6,\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.contentType, Parameters.accept],\n mediaType: \"json\",\n serializer\n};\nconst versionOperationSpec: coreClient.OperationSpec = {\n path: \"/version\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.CompilerVersion\n },\n 500: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst apiVersionOperationSpec: coreClient.OperationSpec = {\n path: \"/api-version\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.ApiVersion\n },\n 500: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst apiOperationSpec: coreClient.OperationSpec = {\n path: \"/api\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: {\n type: { name: \"Dictionary\", value: { type: { name: \"any\" } } }\n }\n },\n 400: {\n bodyMapper: Mappers.ErrorModel,\n isError: true\n }\n },\n urlParameters: [Parameters.$host],\n headerParameters: [Parameters.accept],\n serializer\n};\n"],"mappings":"AAAA,OAAO,KAAKA,UAAU,MAAM,oBAAoB;AAAC,OAC1C,KAAKC,UAAU;AAAA,OAC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wD,gBAAgB,EAAE,CAAC7D,UAAU,CAAC+D,MAAM,CAAC;EACrChB;AACF,CAAC;AACD,MAAMD,gBAA0C,GAAG;EACjDG,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,KAAK;EACjBC,SAAS,EAAE;IACT,GAAG,EAAE;MACHC,UAAU,EAAE;QACVC,IAAI,EAAE;UAAEC,IAAI,EAAE,YAAY;UAAEE,KAAK,EAAE;YAAEH,IAAI,EAAE;cAAEC,IAAI,EAAE;YAAM;UAAE;QAAE;MAC/D;IACF,CAAC;IACD,GAAG,EAAE;MACHF,UAAU,EAAEnD,OAAO,CAACuE,UAAU;MAC9Bd,OAAO,EAAE;IACX;EACF,CAAC;EACDE,aAAa,EAAE,CAAC5D,UAAU,CAACK,KAAK,CAAC;EACjCwD,gBAAgB,EAAE,CAAC7D,UAAU,CAAC+D,MAAM,CAAC;EACrChB;AACF,CAAC"}
@@ -9,12 +9,6 @@ export interface CompileOpts {
9
9
  /** Name of contract source file - only used in error messages */
10
10
  srcFile?: string;
11
11
  }
12
- export interface Aci {
13
- /** Any object */
14
- encodedAci: Record<string, unknown>;
15
- externalEncodedAci?: Record<string, unknown>[];
16
- interface: string;
17
- }
18
12
  export interface CompilerError {
19
13
  type: string;
20
14
  pos: ErrorPos;
@@ -127,7 +121,7 @@ export interface SophiaJsonData {
127
121
  export interface GenerateACIOptionalParams extends coreClient.OperationOptions {
128
122
  }
129
123
  /** Contains response data for the generateACI operation. */
130
- export type GenerateACIResponse = Aci;
124
+ export type GenerateACIResponse = Record<string, unknown>[];
131
125
  /** Optional parameters. */
132
126
  export interface CompileContractOptionalParams extends coreClient.OperationOptions {
133
127
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/apis/compiler/models/index.ts"],"sourcesContent":["import * as coreClient from \"@azure/core-client\";\n\nexport interface Contract {\n code: string;\n options?: CompileOpts;\n}\n\nexport interface CompileOpts {\n /** An explicit file system, mapping file names to file content */\n fileSystem?: Record<string, unknown>;\n /** Name of contract source file - only used in error messages */\n srcFile?: string;\n}\n\nexport interface Aci {\n /** Any object */\n encodedAci: Record<string, unknown>;\n externalEncodedAci?: Record<string, unknown>[];\n interface: string;\n}\n\nexport interface CompilerError {\n type: string;\n pos: ErrorPos;\n message: string;\n context?: string;\n}\n\nexport interface ErrorPos {\n file?: string;\n line: number;\n col: number;\n}\n\nexport interface CompileResult {\n /** Prefixed (cb_) Base64Check encoded byte array */\n bytecode: string;\n aci: Record<string, unknown>[];\n}\n\nexport interface SophiaCallResultInput {\n /** (Possibly partial) Sophia contract code/interface */\n source: string;\n options?: CompileOpts;\n /** Name of the called function */\n function: string;\n /** Call result type (ok | revert | error) */\n callResult: string;\n /** Call result value (ABI encoded data or error string) */\n callValue: string;\n}\n\nexport interface BytecodeCallResultInput {\n /** Compiled contract */\n bytecode: string;\n /** Name of the called function */\n function: string;\n /** Call result type (ok | revert | error) */\n callResult: string;\n /** Call result value (ABI encoded data or error string) */\n callValue: string;\n}\n\nexport interface DecodedCallresult {\n function: string;\n /** Any object */\n result: Record<string, unknown>;\n}\n\nexport interface FunctionCallInput {\n /** (Possibly partial) Sophia contract code */\n source: string;\n options?: CompileOpts;\n /** Name of function to call */\n function: string;\n /** Array of function call arguments */\n arguments: string[];\n}\n\nexport interface Calldata {\n /** Prefixed (cb_) Base64Check encoded byte array */\n calldata: string;\n}\n\nexport interface DecodeCalldataBytecode {\n /** Calldata to dissect */\n calldata: string;\n /** Compiled contract */\n bytecode: string;\n}\n\nexport interface DecodedCalldata {\n function: string;\n arguments: Record<string, unknown>[];\n}\n\nexport interface ErrorModel {\n reason: string;\n}\n\nexport interface DecodeCalldataSource {\n /** (Possibly partial) Sophia contract code */\n source: string;\n options?: CompileOpts;\n /** Calldata to dissect */\n calldata: string;\n /** Name of the function to call */\n function: string;\n}\n\nexport interface ByteCodeInput {\n /** Compiled contract */\n bytecode: string;\n}\n\nexport interface FateAssembler {\n /** Fate assembler code */\n fateAssembler: string;\n}\n\nexport interface ValidateByteCodeInput {\n /** Compiled contract */\n bytecode: string;\n /** Sophia contract source code */\n source: string;\n options?: CompileOpts;\n}\n\nexport interface CompilerVersion {\n /** Sophia compiler version */\n version: string;\n}\n\nexport interface ApiVersion {\n /** API compiler version */\n apiVersion: string;\n}\n\nexport interface SophiaBinaryData {\n sophiaType: string;\n data: string;\n}\n\nexport interface SophiaJsonData {\n /** Any object */\n data: Record<string, unknown>;\n}\n\n/** Optional parameters. */\nexport interface GenerateACIOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the generateACI operation. */\nexport type GenerateACIResponse = Aci;\n\n/** Optional parameters. */\nexport interface CompileContractOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the compileContract operation. */\nexport type CompileContractResponse = CompileResult;\n\n/** Optional parameters. */\nexport interface DecodeCallResultOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the decodeCallResult operation. */\nexport type DecodeCallResultResponse = {\n /** The parsed response body. */\n body: any;\n};\n\n/** Optional parameters. */\nexport interface DecodeCallResultBytecodeOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the decodeCallResultBytecode operation. */\nexport type DecodeCallResultBytecodeResponse = DecodedCallresult;\n\n/** Optional parameters. */\nexport interface EncodeCalldataOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the encodeCalldata operation. */\nexport type EncodeCalldataResponse = Calldata;\n\n/** Optional parameters. */\nexport interface DecodeCalldataBytecodeOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the decodeCalldataBytecode operation. */\nexport type DecodeCalldataBytecodeResponse = DecodedCalldata;\n\n/** Optional parameters. */\nexport interface DecodeCalldataSourceOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the decodeCalldataSource operation. */\nexport type DecodeCalldataSourceResponse = DecodedCalldata;\n\n/** Optional parameters. */\nexport interface GetFateAssemblerCodeOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the getFateAssemblerCode operation. */\nexport type GetFateAssemblerCodeResponse = FateAssembler;\n\n/** Optional parameters. */\nexport interface ValidateByteCodeOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface GetCompilerVersionOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the getCompilerVersion operation. */\nexport type GetCompilerVersionResponse = CompilerVersion;\n\n/** Optional parameters. */\nexport interface VersionOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the version operation. */\nexport type VersionResponse = CompilerVersion;\n\n/** Optional parameters. */\nexport interface ApiVersionOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the apiVersion operation. */\nexport type ApiVersionResponse = ApiVersion;\n\n/** Optional parameters. */\nexport interface ApiOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the api operation. */\nexport type ApiResponse = Record<string, unknown>;\n\n/** Optional parameters. */\nexport interface CompilerOptionalParams\n extends coreClient.ServiceClientOptions {\n /** Overrides client endpoint. */\n endpoint?: string;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/apis/compiler/models/index.ts"],"sourcesContent":["import * as coreClient from \"@azure/core-client\";\n\nexport interface Contract {\n code: string;\n options?: CompileOpts;\n}\n\nexport interface CompileOpts {\n /** An explicit file system, mapping file names to file content */\n fileSystem?: Record<string, unknown>;\n /** Name of contract source file - only used in error messages */\n srcFile?: string;\n}\n\nexport interface CompilerError {\n type: string;\n pos: ErrorPos;\n message: string;\n context?: string;\n}\n\nexport interface ErrorPos {\n file?: string;\n line: number;\n col: number;\n}\n\nexport interface CompileResult {\n /** Prefixed (cb_) Base64Check encoded byte array */\n bytecode: string;\n aci: Record<string, unknown>[];\n}\n\nexport interface SophiaCallResultInput {\n /** (Possibly partial) Sophia contract code/interface */\n source: string;\n options?: CompileOpts;\n /** Name of the called function */\n function: string;\n /** Call result type (ok | revert | error) */\n callResult: string;\n /** Call result value (ABI encoded data or error string) */\n callValue: string;\n}\n\nexport interface BytecodeCallResultInput {\n /** Compiled contract */\n bytecode: string;\n /** Name of the called function */\n function: string;\n /** Call result type (ok | revert | error) */\n callResult: string;\n /** Call result value (ABI encoded data or error string) */\n callValue: string;\n}\n\nexport interface DecodedCallresult {\n function: string;\n /** Any object */\n result: Record<string, unknown>;\n}\n\nexport interface FunctionCallInput {\n /** (Possibly partial) Sophia contract code */\n source: string;\n options?: CompileOpts;\n /** Name of function to call */\n function: string;\n /** Array of function call arguments */\n arguments: string[];\n}\n\nexport interface Calldata {\n /** Prefixed (cb_) Base64Check encoded byte array */\n calldata: string;\n}\n\nexport interface DecodeCalldataBytecode {\n /** Calldata to dissect */\n calldata: string;\n /** Compiled contract */\n bytecode: string;\n}\n\nexport interface DecodedCalldata {\n function: string;\n arguments: Record<string, unknown>[];\n}\n\nexport interface ErrorModel {\n reason: string;\n}\n\nexport interface DecodeCalldataSource {\n /** (Possibly partial) Sophia contract code */\n source: string;\n options?: CompileOpts;\n /** Calldata to dissect */\n calldata: string;\n /** Name of the function to call */\n function: string;\n}\n\nexport interface ByteCodeInput {\n /** Compiled contract */\n bytecode: string;\n}\n\nexport interface FateAssembler {\n /** Fate assembler code */\n fateAssembler: string;\n}\n\nexport interface ValidateByteCodeInput {\n /** Compiled contract */\n bytecode: string;\n /** Sophia contract source code */\n source: string;\n options?: CompileOpts;\n}\n\nexport interface CompilerVersion {\n /** Sophia compiler version */\n version: string;\n}\n\nexport interface ApiVersion {\n /** API compiler version */\n apiVersion: string;\n}\n\nexport interface SophiaBinaryData {\n sophiaType: string;\n data: string;\n}\n\nexport interface SophiaJsonData {\n /** Any object */\n data: Record<string, unknown>;\n}\n\n/** Optional parameters. */\nexport interface GenerateACIOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the generateACI operation. */\nexport type GenerateACIResponse = Record<string, unknown>[];\n\n/** Optional parameters. */\nexport interface CompileContractOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the compileContract operation. */\nexport type CompileContractResponse = CompileResult;\n\n/** Optional parameters. */\nexport interface DecodeCallResultOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the decodeCallResult operation. */\nexport type DecodeCallResultResponse = {\n /** The parsed response body. */\n body: any;\n};\n\n/** Optional parameters. */\nexport interface DecodeCallResultBytecodeOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the decodeCallResultBytecode operation. */\nexport type DecodeCallResultBytecodeResponse = DecodedCallresult;\n\n/** Optional parameters. */\nexport interface EncodeCalldataOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the encodeCalldata operation. */\nexport type EncodeCalldataResponse = Calldata;\n\n/** Optional parameters. */\nexport interface DecodeCalldataBytecodeOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the decodeCalldataBytecode operation. */\nexport type DecodeCalldataBytecodeResponse = DecodedCalldata;\n\n/** Optional parameters. */\nexport interface DecodeCalldataSourceOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the decodeCalldataSource operation. */\nexport type DecodeCalldataSourceResponse = DecodedCalldata;\n\n/** Optional parameters. */\nexport interface GetFateAssemblerCodeOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the getFateAssemblerCode operation. */\nexport type GetFateAssemblerCodeResponse = FateAssembler;\n\n/** Optional parameters. */\nexport interface ValidateByteCodeOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface GetCompilerVersionOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the getCompilerVersion operation. */\nexport type GetCompilerVersionResponse = CompilerVersion;\n\n/** Optional parameters. */\nexport interface VersionOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the version operation. */\nexport type VersionResponse = CompilerVersion;\n\n/** Optional parameters. */\nexport interface ApiVersionOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the apiVersion operation. */\nexport type ApiVersionResponse = ApiVersion;\n\n/** Optional parameters. */\nexport interface ApiOptionalParams extends coreClient.OperationOptions {}\n\n/** Contains response data for the api operation. */\nexport type ApiResponse = Record<string, unknown>;\n\n/** Optional parameters. */\nexport interface CompilerOptionalParams\n extends coreClient.ServiceClientOptions {\n /** Overrides client endpoint. */\n endpoint?: string;\n}\n"],"mappings":""}
@@ -1,7 +1,6 @@
1
1
  import * as coreClient from "@azure/core-client";
2
2
  export declare const Contract: coreClient.CompositeMapper;
3
3
  export declare const CompileOpts: coreClient.CompositeMapper;
4
- export declare const Aci: coreClient.CompositeMapper;
5
4
  export declare const CompilerError: coreClient.CompositeMapper;
6
5
  export declare const ErrorPos: coreClient.CompositeMapper;
7
6
  export declare const CompileResult: coreClient.CompositeMapper;
@@ -45,49 +45,6 @@ export const CompileOpts = {
45
45
  }
46
46
  }
47
47
  };
48
- export const Aci = {
49
- type: {
50
- name: "Composite",
51
- className: "Aci",
52
- modelProperties: {
53
- encodedAci: {
54
- serializedName: "encoded_aci",
55
- required: true,
56
- type: {
57
- name: "Dictionary",
58
- value: {
59
- type: {
60
- name: "any"
61
- }
62
- }
63
- }
64
- },
65
- externalEncodedAci: {
66
- serializedName: "external_encoded_aci",
67
- type: {
68
- name: "Sequence",
69
- element: {
70
- type: {
71
- name: "Dictionary",
72
- value: {
73
- type: {
74
- name: "any"
75
- }
76
- }
77
- }
78
- }
79
- }
80
- },
81
- interface: {
82
- serializedName: "interface",
83
- required: true,
84
- type: {
85
- name: "String"
86
- }
87
- }
88
- }
89
- }
90
- };
91
48
  export const CompilerError = {
92
49
  type: {
93
50
  name: "Composite",