@aeternity/aepp-sdk 9.0.1 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/README.md +15 -14
  2. package/dist/aepp-sdk.browser-script.js +1 -1
  3. package/dist/aepp-sdk.browser-script.js.LICENSE.txt +7 -36
  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 +1 -1
  8. package/dist/aepp-sdk.js.map +1 -1
  9. package/es/account/base.mjs +179 -0
  10. package/es/account/base.mjs.map +1 -0
  11. package/es/account/memory.mjs +99 -0
  12. package/es/account/memory.mjs.map +1 -0
  13. package/es/account/multiple.mjs +179 -0
  14. package/es/account/multiple.mjs.map +1 -0
  15. package/es/ae/aens.mjs +404 -0
  16. package/es/ae/aens.mjs.map +1 -0
  17. package/es/ae/{aepp.js → aepp.mjs} +9 -9
  18. package/es/ae/aepp.mjs.map +1 -0
  19. package/es/ae/contract.mjs +159 -0
  20. package/es/ae/contract.mjs.map +1 -0
  21. package/es/ae/index.mjs +207 -0
  22. package/es/ae/index.mjs.map +1 -0
  23. package/es/ae/oracle.mjs +339 -0
  24. package/es/ae/oracle.mjs.map +1 -0
  25. package/es/ae/{universal.js → universal.mjs} +10 -10
  26. package/es/ae/universal.mjs.map +1 -0
  27. package/es/ae/{wallet.js → wallet.mjs} +10 -10
  28. package/es/ae/wallet.mjs.map +1 -0
  29. package/es/aepp-wallet-communication/schema.d.ts +74 -0
  30. package/es/bignumber.d.ts +1 -7
  31. package/es/chain/{index.js → index.mjs} +29 -9
  32. package/es/chain/index.mjs.map +1 -0
  33. package/es/chain/node.mjs +442 -0
  34. package/es/chain/node.mjs.map +1 -0
  35. package/es/channel/handlers.mjs +1110 -0
  36. package/es/channel/handlers.mjs.map +1 -0
  37. package/es/channel/{index.js → index.mjs} +245 -472
  38. package/es/channel/index.mjs.map +1 -0
  39. package/es/channel/internal.mjs +283 -0
  40. package/es/channel/internal.mjs.map +1 -0
  41. package/es/contract/aci.mjs +477 -0
  42. package/es/contract/aci.mjs.map +1 -0
  43. package/es/contract/compiler.mjs +115 -0
  44. package/es/contract/compiler.mjs.map +1 -0
  45. package/es/contract/ga/helpers.mjs +30 -0
  46. package/es/contract/ga/helpers.mjs.map +1 -0
  47. package/es/contract/ga/index.mjs +178 -0
  48. package/es/contract/ga/index.mjs.map +1 -0
  49. package/es/errors.d.ts +284 -0
  50. package/es/index.mjs +57 -0
  51. package/es/index.mjs.map +1 -0
  52. package/es/node-pool/index.mjs +188 -0
  53. package/es/node-pool/index.mjs.map +1 -0
  54. package/es/node.mjs +133 -0
  55. package/es/node.mjs.map +1 -0
  56. package/es/other.d.ts +1 -1
  57. package/es/tx/builder/field-types.mjs +74 -0
  58. package/es/tx/builder/field-types.mjs.map +1 -0
  59. package/es/tx/builder/helpers.mjs +363 -0
  60. package/es/tx/builder/helpers.mjs.map +1 -0
  61. package/es/tx/builder/index.mjs +606 -0
  62. package/es/tx/builder/index.mjs.map +1 -0
  63. package/es/tx/builder/schema.mjs +760 -0
  64. package/es/tx/builder/schema.mjs.map +1 -0
  65. package/es/tx/{index.js → index.mjs} +107 -15
  66. package/es/tx/index.mjs.map +1 -0
  67. package/es/tx/tx-object.mjs +283 -0
  68. package/es/tx/tx-object.mjs.map +1 -0
  69. package/es/tx/tx.mjs +938 -0
  70. package/es/tx/tx.mjs.map +1 -0
  71. package/es/tx/validator.mjs +247 -0
  72. package/es/tx/validator.mjs.map +1 -0
  73. package/es/typings/blakejs/index.d.mjs +2 -0
  74. package/es/typings/blakejs/{index.d.js.map → index.d.mjs.map} +1 -1
  75. package/es/utils/aepp-wallet-communication/connection/{browser-runtime.js → browser-runtime.mjs} +27 -29
  76. package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +1 -0
  77. package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs +183 -0
  78. package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +1 -0
  79. package/es/utils/aepp-wallet-communication/connection/{index.js → index.mjs} +7 -3
  80. package/es/utils/aepp-wallet-communication/connection/index.mjs.map +1 -0
  81. package/es/utils/aepp-wallet-communication/{content-script-bridge.js → content-script-bridge.mjs} +29 -23
  82. package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +1 -0
  83. package/es/utils/aepp-wallet-communication/helpers.mjs +92 -0
  84. package/es/utils/aepp-wallet-communication/helpers.mjs.map +1 -0
  85. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs +375 -0
  86. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +1 -0
  87. package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs +275 -0
  88. package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +1 -0
  89. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs +541 -0
  90. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +1 -0
  91. package/es/utils/aepp-wallet-communication/schema.mjs +102 -0
  92. package/es/utils/aepp-wallet-communication/schema.mjs.map +1 -0
  93. package/es/utils/aepp-wallet-communication/wallet-detector.mjs +110 -0
  94. package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
  95. package/es/utils/amount-formatter.mjs +139 -0
  96. package/es/utils/amount-formatter.mjs.map +1 -0
  97. package/es/utils/async-init.mjs +64 -0
  98. package/es/utils/async-init.mjs.map +1 -0
  99. package/es/utils/bignumber.mjs +21 -0
  100. package/es/utils/bignumber.mjs.map +1 -0
  101. package/es/utils/{bytes.js → bytes.mjs} +16 -12
  102. package/es/utils/bytes.mjs.map +1 -0
  103. package/es/utils/{crypto-ts.js → crypto-ts.mjs} +11 -3
  104. package/es/utils/crypto-ts.mjs.map +1 -0
  105. package/es/utils/crypto.mjs +239 -0
  106. package/es/utils/crypto.mjs.map +1 -0
  107. package/es/utils/errors.mjs +689 -0
  108. package/es/utils/errors.mjs.map +1 -0
  109. package/es/utils/hd-wallet.mjs +111 -0
  110. package/es/utils/hd-wallet.mjs.map +1 -0
  111. package/es/utils/json-big.mjs +45 -0
  112. package/es/utils/json-big.mjs.map +1 -0
  113. package/es/utils/keystore.mjs +240 -0
  114. package/es/utils/keystore.mjs.map +1 -0
  115. package/es/utils/mptree.mjs +161 -0
  116. package/es/utils/mptree.mjs.map +1 -0
  117. package/es/utils/other.mjs +43 -0
  118. package/es/utils/other.mjs.map +1 -0
  119. package/es/utils/semver-satisfies.mjs +16 -0
  120. package/es/utils/semver-satisfies.mjs.map +1 -0
  121. package/es/utils/{string.js → string.mjs} +5 -14
  122. package/es/utils/string.mjs.map +1 -0
  123. package/es/utils/swagger.mjs +164 -0
  124. package/es/utils/swagger.mjs.map +1 -0
  125. package/package.json +55 -62
  126. package/src/account/base.js +3 -1
  127. package/src/account/memory.js +13 -8
  128. package/src/account/multiple.js +31 -22
  129. package/src/ae/aens.js +75 -77
  130. package/src/ae/aepp.js +2 -2
  131. package/src/ae/contract.js +27 -291
  132. package/src/ae/index.js +9 -7
  133. package/src/ae/oracle.js +51 -28
  134. package/src/ae/universal.js +4 -2
  135. package/src/ae/wallet.js +2 -2
  136. package/src/chain/index.js +29 -6
  137. package/src/chain/node.js +95 -67
  138. package/src/channel/handlers.js +30 -21
  139. package/src/channel/index.js +44 -20
  140. package/src/channel/internal.js +30 -24
  141. package/src/contract/aci.js +376 -0
  142. package/src/contract/compiler.js +41 -91
  143. package/src/contract/ga/helpers.js +10 -13
  144. package/src/contract/ga/index.js +42 -33
  145. package/src/index.js +9 -10
  146. package/src/node-pool/index.js +29 -17
  147. package/src/node.js +33 -36
  148. package/src/tx/builder/field-types.js +61 -0
  149. package/src/tx/builder/helpers.js +126 -84
  150. package/src/tx/builder/index.js +83 -41
  151. package/src/tx/builder/schema.js +50 -40
  152. package/src/tx/index.js +101 -12
  153. package/src/tx/tx-object.js +35 -15
  154. package/src/tx/tx.js +232 -153
  155. package/src/tx/validator.js +34 -12
  156. package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +11 -5
  157. package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +35 -13
  158. package/src/utils/aepp-wallet-communication/connection/index.js +2 -1
  159. package/src/utils/aepp-wallet-communication/content-script-bridge.js +14 -7
  160. package/src/utils/aepp-wallet-communication/helpers.js +6 -14
  161. package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +107 -60
  162. package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +24 -11
  163. package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +98 -56
  164. package/src/utils/aepp-wallet-communication/schema.ts +80 -0
  165. package/src/utils/aepp-wallet-communication/wallet-detector.js +6 -2
  166. package/src/utils/amount-formatter.ts +4 -3
  167. package/src/utils/async-init.js +10 -6
  168. package/src/utils/bignumber.ts +3 -10
  169. package/src/utils/bytes.ts +3 -2
  170. package/src/utils/crypto-ts.ts +2 -2
  171. package/src/utils/crypto.js +10 -144
  172. package/src/utils/errors.ts +683 -0
  173. package/src/utils/hd-wallet.js +11 -26
  174. package/src/utils/keystore.js +57 -53
  175. package/src/utils/mptree.ts +12 -6
  176. package/src/utils/other.ts +1 -1
  177. package/src/utils/semver-satisfies.ts +1 -1
  178. package/src/utils/swagger.js +75 -45
  179. package/es/account/base.js +0 -259
  180. package/es/account/base.js.map +0 -1
  181. package/es/account/memory.js +0 -86
  182. package/es/account/memory.js.map +0 -1
  183. package/es/account/multiple.js +0 -267
  184. package/es/account/multiple.js.map +0 -1
  185. package/es/ae/aens.js +0 -829
  186. package/es/ae/aens.js.map +0 -1
  187. package/es/ae/aepp.js.map +0 -1
  188. package/es/ae/contract.js +0 -985
  189. package/es/ae/contract.js.map +0 -1
  190. package/es/ae/index.js +0 -442
  191. package/es/ae/index.js.map +0 -1
  192. package/es/ae/oracle.js +0 -690
  193. package/es/ae/oracle.js.map +0 -1
  194. package/es/ae/universal.js.map +0 -1
  195. package/es/ae/wallet.js.map +0 -1
  196. package/es/chain/index.js.map +0 -1
  197. package/es/chain/node.js +0 -1119
  198. package/es/chain/node.js.map +0 -1
  199. package/es/channel/handlers.js +0 -1601
  200. package/es/channel/handlers.js.map +0 -1
  201. package/es/channel/index.js.map +0 -1
  202. package/es/channel/internal.js +0 -438
  203. package/es/channel/internal.js.map +0 -1
  204. package/es/contract/aci/helpers.js +0 -298
  205. package/es/contract/aci/helpers.js.map +0 -1
  206. package/es/contract/aci/index.js +0 -517
  207. package/es/contract/aci/index.js.map +0 -1
  208. package/es/contract/aci/transformation.js +0 -742
  209. package/es/contract/aci/transformation.js.map +0 -1
  210. package/es/contract/compiler.js +0 -316
  211. package/es/contract/compiler.js.map +0 -1
  212. package/es/contract/ga/helpers.js +0 -120
  213. package/es/contract/ga/helpers.js.map +0 -1
  214. package/es/contract/ga/index.js +0 -307
  215. package/es/contract/ga/index.js.map +0 -1
  216. package/es/contract/index.js +0 -158
  217. package/es/contract/index.js.map +0 -1
  218. package/es/index.js +0 -57
  219. package/es/index.js.map +0 -1
  220. package/es/node-pool/index.js +0 -204
  221. package/es/node-pool/index.js.map +0 -1
  222. package/es/node.js +0 -228
  223. package/es/node.js.map +0 -1
  224. package/es/tx/builder/helpers.js +0 -355
  225. package/es/tx/builder/helpers.js.map +0 -1
  226. package/es/tx/builder/index.js +0 -686
  227. package/es/tx/builder/index.js.map +0 -1
  228. package/es/tx/builder/schema.js +0 -695
  229. package/es/tx/builder/schema.js.map +0 -1
  230. package/es/tx/index.js.map +0 -1
  231. package/es/tx/tx-object.js +0 -297
  232. package/es/tx/tx-object.js.map +0 -1
  233. package/es/tx/tx.js +0 -1757
  234. package/es/tx/tx.js.map +0 -1
  235. package/es/tx/validator.js +0 -344
  236. package/es/tx/validator.js.map +0 -1
  237. package/es/typings/blakejs/index.d.js +0 -2
  238. package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +0 -1
  239. package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -211
  240. package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +0 -1
  241. package/es/utils/aepp-wallet-communication/connection/index.js.map +0 -1
  242. package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +0 -1
  243. package/es/utils/aepp-wallet-communication/helpers.js +0 -148
  244. package/es/utils/aepp-wallet-communication/helpers.js.map +0 -1
  245. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -652
  246. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +0 -1
  247. package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -285
  248. package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +0 -1
  249. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -763
  250. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +0 -1
  251. package/es/utils/aepp-wallet-communication/schema.js +0 -103
  252. package/es/utils/aepp-wallet-communication/schema.js.map +0 -1
  253. package/es/utils/aepp-wallet-communication/wallet-detector.js +0 -135
  254. package/es/utils/aepp-wallet-communication/wallet-detector.js.map +0 -1
  255. package/es/utils/amount-formatter.js +0 -152
  256. package/es/utils/amount-formatter.js.map +0 -1
  257. package/es/utils/async-init.js +0 -103
  258. package/es/utils/async-init.js.map +0 -1
  259. package/es/utils/bignumber.js +0 -36
  260. package/es/utils/bignumber.js.map +0 -1
  261. package/es/utils/bytes.js.map +0 -1
  262. package/es/utils/crypto-ts.js.map +0 -1
  263. package/es/utils/crypto.js +0 -358
  264. package/es/utils/crypto.js.map +0 -1
  265. package/es/utils/hd-wallet.js +0 -148
  266. package/es/utils/hd-wallet.js.map +0 -1
  267. package/es/utils/json-big.js +0 -78
  268. package/es/utils/json-big.js.map +0 -1
  269. package/es/utils/keystore.js +0 -393
  270. package/es/utils/keystore.js.map +0 -1
  271. package/es/utils/mptree.js +0 -198
  272. package/es/utils/mptree.js.map +0 -1
  273. package/es/utils/other.js +0 -93
  274. package/es/utils/other.js.map +0 -1
  275. package/es/utils/semver-satisfies.js +0 -35
  276. package/es/utils/semver-satisfies.js.map +0 -1
  277. package/es/utils/string.js.map +0 -1
  278. package/es/utils/swagger.js +0 -269
  279. package/es/utils/swagger.js.map +0 -1
  280. package/src/contract/aci/helpers.js +0 -140
  281. package/src/contract/aci/index.js +0 -191
  282. package/src/contract/aci/transformation.js +0 -464
  283. package/src/contract/index.js +0 -159
  284. package/src/utils/aepp-wallet-communication/schema.js +0 -110
@@ -1,307 +0,0 @@
1
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
2
- import _merge from "ramda/src/merge";
3
- import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
4
-
5
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
6
-
7
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context4; _forEachInstanceProperty(_context4 = ownKeys(Object(source), true)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context5; _forEachInstanceProperty(_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
-
9
- import _Object$freeze from "@babel/runtime-corejs3/core-js-stable/object/freeze";
10
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
11
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
12
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
13
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
14
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
15
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
16
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
17
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
18
- import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
19
- import { ContractAPI } from '../../ae/contract';
20
- import { TX_TYPE } from '../../tx/builder/schema';
21
- import { buildTx, unpackTx } from '../../tx/builder';
22
- import { getContractAuthFan, prepareGaParams } from './helpers';
23
- /**
24
- * GeneralizeAccount Stamp
25
- *
26
- * Provide Generalize Account implementation
27
- * {@link module:@aeternity/aepp-sdk/es/contract/ga} clients.
28
- * @function
29
- * @alias module:@aeternity/aepp-sdk/es/contract/ga
30
- * @rtype Stamp
31
- * @param {Object} [options={}] - Initializer object
32
- * @return {Object} GeneralizeAccount instance
33
- * @example
34
- * const authContract = ``
35
- * await client.createGeneralizeAccount(authFnName, authContract, [...authFnArguments]
36
- * // Make spend using GA
37
- * const callData = 'cb_...' // encoded call data for auth contract
38
- * await client.spend(10000, receiverPub, { authData: { callData } })
39
- * // or
40
- * await client.spend(10000, receiverPub, { authData: { source: authContract, args: [...authContractArgs] } }) // sdk will prepare callData itself
41
- */
42
-
43
- export var GeneralizeAccount = ContractAPI.compose({
44
- methods: {
45
- createGeneralizeAccount: createGeneralizeAccount,
46
- createMetaTx: createMetaTx,
47
- isGA: isGA
48
- }
49
- });
50
- export default GeneralizeAccount;
51
- /**
52
- * @alias module:@aeternity/aepp-sdk/es/contract/ga
53
- * @function
54
- * Check if account is GA account
55
- * @param {String} address - Account address
56
- * @return {Boolean}
57
- */
58
-
59
- function isGA(_x) {
60
- return _isGA.apply(this, arguments);
61
- }
62
- /**
63
- * Convert current account to GA account
64
- * @alias module:@aeternity/aepp-sdk/es/contract/ga
65
- * @function
66
- * @param {String} authFnName - Authorization function name
67
- * @param {String} source - Auth contract source code
68
- * @param {Array} [args] - init arguments
69
- * @param {Object} [options] - Options
70
- * @return {Promise<Readonly<{result: *, owner: *, createdAt: Date, address, rawTx: *, transaction: *}>>}
71
- */
72
-
73
-
74
- function _isGA() {
75
- _isGA = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(address) {
76
- var _yield$this$getAccoun, contractId;
77
-
78
- return _regeneratorRuntime.wrap(function _callee$(_context) {
79
- while (1) {
80
- switch (_context.prev = _context.next) {
81
- case 0:
82
- _context.next = 2;
83
- return this.getAccount(address);
84
-
85
- case 2:
86
- _yield$this$getAccoun = _context.sent;
87
- contractId = _yield$this$getAccoun.contractId;
88
- return _context.abrupt("return", !!contractId);
89
-
90
- case 5:
91
- case "end":
92
- return _context.stop();
93
- }
94
- }
95
- }, _callee, this);
96
- }));
97
- return _isGA.apply(this, arguments);
98
- }
99
-
100
- function createGeneralizeAccount(_x2, _x3) {
101
- return _createGeneralizeAccount.apply(this, arguments);
102
- }
103
-
104
- function _createGeneralizeAccount() {
105
- _createGeneralizeAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(authFnName, source) {
106
- var args,
107
- options,
108
- opt,
109
- ownerId,
110
- _yield$getContractAut,
111
- authFun,
112
- bytecode,
113
- callData,
114
- _yield$this$gaAttachT,
115
- tx,
116
- contractId,
117
- _yield$this$send,
118
- hash,
119
- rawTx,
120
- _args2 = arguments;
121
-
122
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
123
- while (1) {
124
- switch (_context2.prev = _context2.next) {
125
- case 0:
126
- args = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : [];
127
- options = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : {};
128
- opt = _merge(this.Ae.defaults, options);
129
- _context2.next = 5;
130
- return this.address(opt);
131
-
132
- case 5:
133
- ownerId = _context2.sent;
134
- _context2.next = 8;
135
- return this.isGA(ownerId);
136
-
137
- case 8:
138
- if (!_context2.sent) {
139
- _context2.next = 10;
140
- break;
141
- }
142
-
143
- throw new Error("Account ".concat(ownerId, " is already GA"));
144
-
145
- case 10:
146
- _context2.next = 12;
147
- return getContractAuthFan(this)(source, authFnName);
148
-
149
- case 12:
150
- _yield$getContractAut = _context2.sent;
151
- authFun = _yield$getContractAut.authFun;
152
- bytecode = _yield$getContractAut.bytecode;
153
- _context2.next = 17;
154
- return this.contractEncodeCall(source, 'init', args);
155
-
156
- case 17:
157
- callData = _context2.sent;
158
- _context2.next = 20;
159
- return this.gaAttachTx(_merge(opt, {
160
- ownerId: ownerId,
161
- code: bytecode,
162
- callData: callData,
163
- authFun: authFun
164
- }));
165
-
166
- case 20:
167
- _yield$this$gaAttachT = _context2.sent;
168
- tx = _yield$this$gaAttachT.tx;
169
- contractId = _yield$this$gaAttachT.contractId;
170
- _context2.next = 25;
171
- return this.send(tx, opt);
172
-
173
- case 25:
174
- _yield$this$send = _context2.sent;
175
- hash = _yield$this$send.hash;
176
- rawTx = _yield$this$send.rawTx;
177
- return _context2.abrupt("return", _Object$freeze({
178
- owner: ownerId,
179
- transaction: hash,
180
- rawTx: rawTx,
181
- gaContractId: contractId
182
- }));
183
-
184
- case 29:
185
- case "end":
186
- return _context2.stop();
187
- }
188
- }
189
- }, _callee2, this);
190
- }));
191
- return _createGeneralizeAccount.apply(this, arguments);
192
- }
193
-
194
- var wrapInEmptySignedTx = function wrapInEmptySignedTx(tx) {
195
- return buildTx({
196
- encodedTx: tx,
197
- signatures: []
198
- }, TX_TYPE.signed);
199
- };
200
- /**
201
- * Create a metaTx transaction
202
- * @alias module:@aeternity/aepp-sdk/es/contract/ga
203
- * @function
204
- * @param {String} rawTransaction Inner transaction
205
- * @param {Object} authData Object with gaMeta params
206
- * @param {String} authFnName - Authorization function name
207
- * @param {Object} options - Options
208
- * @return {String}
209
- */
210
-
211
-
212
- function createMetaTx(_x4, _x5, _x6) {
213
- return _createMetaTx.apply(this, arguments);
214
- }
215
-
216
- function _createMetaTx() {
217
- _createMetaTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(rawTransaction, authData, authFnName) {
218
- var options,
219
- _yield$prepareGaParam,
220
- authCallData,
221
- gas,
222
- opt,
223
- _yield$this$getVmVers,
224
- abiVersion,
225
- wrappedTx,
226
- params,
227
- _yield$this$prepareTx,
228
- fee,
229
- _buildTx,
230
- metaTxRlp,
231
- _args3 = arguments;
232
-
233
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
234
- while (1) {
235
- switch (_context3.prev = _context3.next) {
236
- case 0:
237
- options = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : {};
238
-
239
- if (authData) {
240
- _context3.next = 3;
241
- break;
242
- }
243
-
244
- throw new Error('authData is required');
245
-
246
- case 3:
247
- _context3.next = 5;
248
- return prepareGaParams(this)(authData, authFnName);
249
-
250
- case 5:
251
- _yield$prepareGaParam = _context3.sent;
252
- authCallData = _yield$prepareGaParam.authCallData;
253
- gas = _yield$prepareGaParam.gas;
254
- opt = _merge(this.Ae.defaults, options);
255
- _context3.next = 11;
256
- return this.getVmVersion(TX_TYPE.contractCall);
257
-
258
- case 11:
259
- _yield$this$getVmVers = _context3.sent;
260
- abiVersion = _yield$this$getVmVers.abiVersion;
261
- wrappedTx = wrapInEmptySignedTx(unpackTx(rawTransaction));
262
- _context3.t0 = _objectSpread;
263
- _context3.t1 = _objectSpread({}, opt);
264
- _context3.t2 = {};
265
- _context3.t3 = _objectSpread(_objectSpread({}, wrappedTx), {}, {
266
- tx: wrappedTx.txObject
267
- });
268
- _context3.next = 20;
269
- return this.address(opt);
270
-
271
- case 20:
272
- _context3.t4 = _context3.sent;
273
- _context3.t5 = abiVersion;
274
- _context3.t6 = authCallData;
275
- _context3.t7 = gas;
276
- _context3.t8 = {
277
- tx: _context3.t3,
278
- gaId: _context3.t4,
279
- abiVersion: _context3.t5,
280
- authData: _context3.t6,
281
- gas: _context3.t7,
282
- vsn: 2
283
- };
284
- params = (0, _context3.t0)(_context3.t1, _context3.t2, _context3.t8);
285
- _context3.next = 28;
286
- return this.prepareTxParams(TX_TYPE.gaMeta, params);
287
-
288
- case 28:
289
- _yield$this$prepareTx = _context3.sent;
290
- fee = _yield$this$prepareTx.fee;
291
- _buildTx = buildTx(_objectSpread(_objectSpread({}, params), {}, {
292
- fee: "".concat(fee)
293
- }), TX_TYPE.gaMeta, {
294
- vsn: 2
295
- }), metaTxRlp = _buildTx.rlpEncoded;
296
- return _context3.abrupt("return", wrapInEmptySignedTx(metaTxRlp).tx);
297
-
298
- case 32:
299
- case "end":
300
- return _context3.stop();
301
- }
302
- }
303
- }, _callee3, this);
304
- }));
305
- return _createMetaTx.apply(this, arguments);
306
- }
307
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/contract/ga/index.js"],"names":["ContractAPI","TX_TYPE","buildTx","unpackTx","getContractAuthFan","prepareGaParams","GeneralizeAccount","compose","methods","createGeneralizeAccount","createMetaTx","isGA","address","getAccount","contractId","authFnName","source","args","options","opt","Ae","defaults","ownerId","Error","authFun","bytecode","contractEncodeCall","callData","gaAttachTx","code","tx","send","hash","rawTx","owner","transaction","gaContractId","wrapInEmptySignedTx","encodedTx","signatures","signed","rawTransaction","authData","authCallData","gas","getVmVersion","contractCall","abiVersion","wrappedTx","txObject","gaId","vsn","params","prepareTxParams","gaMeta","fee","metaTxRlp","rlpEncoded"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,SAASA,WAAT,QAA4B,mBAA5B;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,OAAT,EAAkBC,QAAlB,QAAkC,kBAAlC;AACA,SAASC,kBAAT,EAA6BC,eAA7B,QAAoD,WAApD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,iBAAiB,GAAGN,WAAW,CAACO,OAAZ,CAAoB;AACnDC,E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B,EAGvC;AAAEH,cAAAA,GAAG,EAAE;AAAP,aAHuC,CApB3C,EAoBsBK,SApBtB,YAoBUC,UApBV;AAAA,8CAyBSpB,mBAAmB,CAACmB,SAAD,CAAnB,CAA+B1B,EAzBxC;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2018 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Generalize Account module - routines to use generalize account\n *\n * @module @aeternity/aepp-sdk/es/contract/ga\n * @export GeneralizeAccount\n * @example import { GeneralizeAccount } from '@aeternity/aepp-sdk'\n */\nimport * as R from 'ramda'\n\nimport { ContractAPI } from '../../ae/contract'\nimport { TX_TYPE } from '../../tx/builder/schema'\nimport { buildTx, unpackTx } from '../../tx/builder'\nimport { getContractAuthFan, prepareGaParams } from './helpers'\n\n/**\n * GeneralizeAccount Stamp\n *\n * Provide Generalize Account implementation\n * {@link module:@aeternity/aepp-sdk/es/contract/ga} clients.\n * @function\n * @alias module:@aeternity/aepp-sdk/es/contract/ga\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @return {Object} GeneralizeAccount instance\n * @example\n * const authContract = ``\n * await client.createGeneralizeAccount(authFnName, authContract, [...authFnArguments]\n * // Make spend using GA\n * const callData = 'cb_...' // encoded call data for auth contract\n * await client.spend(10000, receiverPub, { authData: { callData } })\n * // or\n * await client.spend(10000, receiverPub, { authData: { source: authContract, args: [...authContractArgs] } }) // sdk will prepare callData itself\n */\nexport const GeneralizeAccount = ContractAPI.compose({\n methods: {\n createGeneralizeAccount,\n createMetaTx,\n isGA\n }\n})\nexport default GeneralizeAccount\n\n/**\n * @alias module:@aeternity/aepp-sdk/es/contract/ga\n * @function\n * Check if account is GA account\n * @param {String} address - Account address\n * @return {Boolean}\n */\nasync function isGA (address) {\n const { contractId } = await this.getAccount(address)\n return !!contractId\n}\n\n/**\n * Convert current account to GA account\n * @alias module:@aeternity/aepp-sdk/es/contract/ga\n * @function\n * @param {String} authFnName - Authorization function name\n * @param {String} source - Auth contract source code\n * @param {Array} [args] - init arguments\n * @param {Object} [options] - Options\n * @return {Promise<Readonly<{result: *, owner: *, createdAt: Date, address, rawTx: *, transaction: *}>>}\n */\nasync function createGeneralizeAccount (authFnName, source, args = [], options = {}) {\n const opt = R.merge(this.Ae.defaults, options)\n const ownerId = await this.address(opt)\n\n if (await this.isGA(ownerId)) throw new Error(`Account ${ownerId} is already GA`)\n\n const { authFun, bytecode } = await getContractAuthFan(this)(source, authFnName)\n const callData = await this.contractEncodeCall(source, 'init', args)\n\n const { tx, contractId } = await this.gaAttachTx(R.merge(opt, { ownerId, code: bytecode, callData, authFun }))\n\n const { hash, rawTx } = await this.send(tx, opt)\n\n return Object.freeze({\n owner: ownerId,\n transaction: hash,\n rawTx,\n gaContractId: contractId\n })\n}\n\nconst wrapInEmptySignedTx = (tx) => buildTx({ encodedTx: tx, signatures: [] }, TX_TYPE.signed)\n\n/**\n * Create a metaTx transaction\n * @alias module:@aeternity/aepp-sdk/es/contract/ga\n * @function\n * @param {String} rawTransaction Inner transaction\n * @param {Object} authData Object with gaMeta params\n * @param {String} authFnName - Authorization function name\n * @param {Object} options - Options\n * @return {String}\n */\nasync function createMetaTx (rawTransaction, authData, authFnName, options = {}) {\n if (!authData) throw new Error('authData is required')\n // Check if authData is callData or if it's an object prepare a callData from source and args\n const { authCallData, gas } = await prepareGaParams(this)(authData, authFnName)\n const opt = R.merge(this.Ae.defaults, options)\n const { abiVersion } = await this.getVmVersion(TX_TYPE.contractCall)\n const wrappedTx = wrapInEmptySignedTx(unpackTx(rawTransaction))\n const params = {\n ...opt,\n tx: {\n ...wrappedTx,\n tx: wrappedTx.txObject\n },\n gaId: await this.address(opt),\n abiVersion: abiVersion,\n authData: authCallData,\n gas,\n vsn: 2\n }\n const { fee } = await this.prepareTxParams(TX_TYPE.gaMeta, params)\n const { rlpEncoded: metaTxRlp } = buildTx(\n { ...params, fee: `${fee}` },\n TX_TYPE.gaMeta,\n { vsn: 2 }\n )\n return wrapInEmptySignedTx(metaTxRlp).tx\n}\n"],"file":"index.js"}
@@ -1,158 +0,0 @@
1
- /*
2
- * ISC License (ISC)
3
- * Copyright (c) 2018 aeternity developers
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software for any
6
- * purpose with or without fee is hereby granted, provided that the above
7
- * copyright notice and this permission notice appear in all copies.
8
- *
9
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- * PERFORMANCE OF THIS SOFTWARE.
16
- */
17
-
18
- /**
19
- * Contract Base module
20
- * @module @aeternity/aepp-sdk/es/contract
21
- * @export Contract
22
- * @example import ContractBase from '@aeternity/aepp-sdk/es/contract'
23
- */
24
- import stampit from '@stamp/it';
25
- import { required } from '@stamp/required';
26
- /**
27
- * Basic Contract Stamp
28
- *
29
- * This stamp include api call's related to contract functionality.
30
- * Attempting to create instances from the Stamp without overwriting all
31
- * abstract methods using composition will result in an exception.
32
- * @function
33
- * @alias module:@aeternity/aepp-sdk/es/contract
34
- * @rtype Stamp
35
- * @param {Object} [options={}] - Initializer object
36
- * @return {Object} Contract instance
37
- */
38
-
39
- var ContractBase = stampit(required({
40
- methods: {
41
- contractEncodeCallDataAPI: required,
42
- compileContractAPI: required,
43
- contractGetACI: required,
44
- setCompilerUrl: required,
45
- getCompilerVersion: required,
46
- contractDecodeCallResultAPI: required,
47
- validateByteCodeAPI: required,
48
- getFateAssembler: required,
49
- getBytecodeCompilerVersion: required
50
- }
51
- }));
52
- /**
53
- * Get contract ACI
54
- * @function contractGetACI
55
- * @instance
56
- * @abstract
57
- * @category async
58
- * @rtype (source: String, options: Array) => aciObject: Promise[Object]
59
- * @param {String} source - Contract source code
60
- * @param {Object} [options={}] Options
61
- * @param {Object} [options.filesystem] Contract external namespaces map
62
- * @return {Object} - Contract aci object
63
- */
64
-
65
- /**
66
- * Encode contract data
67
- * @function contractEncodeCallDataAPI
68
- * @instance
69
- * @abstract
70
- * @category async
71
- * @rtype (source: String, name: String, args: Array, options: Array) => callData: Promise[String]
72
- * @param {String} source - Contract source code
73
- * @param {String} name - Function name
74
- * @param {Array} args - Function argument's
75
- * @param {Object} [options={}] Options
76
- * @param {Object} [options.filesystem] Contract external namespaces map
77
- * @return {String} - Contract encoded data
78
- */
79
-
80
- /**
81
- * Decode contract call result data
82
- * @function contractDecodeCallResultAPI
83
- * @instance
84
- * @abstract
85
- * @category async
86
- * @rtype (source: String, fn: String, callValue: String, callResult: String, options: Array) => decodedResult: Promise[String]
87
- * @param {String} source - Contract source
88
- * @param {String} fn - Fn name
89
- * @param {String} callValue - result data (cb_das...)
90
- * @param {String} callResult - contract call result status('ok', 'revert', ...)
91
- * @param {Object} [options={}] Options
92
- * @param {Object} [options.filesystem] Contract external namespaces map
93
- * @return {String} - Decoded contract call result
94
- */
95
-
96
- /**
97
- * Decode call data by source
98
- * @function contractDecodeCallDataBySourceAPI
99
- * @instance
100
- * @abstract
101
- * @category async
102
- * @rtype (source: String, function: String, callData: String, options: Array) => decodedResult: Promise[String]
103
- * @param {String} source - contract source
104
- * @param {String} function - function name
105
- * @param {String} callData - Encoded contract call data
106
- * @param {Object} [options={}] Options
107
- * @param {Object} [options.filesystem] Contract external namespaces map
108
- * @return {String} - Decoded contract call data
109
- */
110
-
111
- /**
112
- * Decode call data by bytecode
113
- * @function contractDecodeCallDataByCodeAPI
114
- * @instance
115
- * @abstract
116
- * @category async
117
- * @rtype (code: String, callData: String) => decodedResult: Promise[String]
118
- * @param {String} code - contract byte code
119
- * @param {String} callData - Encoded contract call data
120
- * @return {String} - Decoded contract call data
121
- */
122
-
123
- /**
124
- * Compile contract
125
- * @function compileContractAPI
126
- * @instance
127
- * @abstract
128
- * @category async
129
- * @rtype (code: String, options?: Object) => compiledContract: Object
130
- * @param {String} code - Contract source code
131
- * @param {Object} [options={}] Options
132
- * @param {Object} [options.filesystem] Contract external namespaces map
133
- * @return {Object} Object which contain bytecode of contract
134
- */
135
-
136
- /**
137
- * Set compiler url
138
- * @function setCompilerUrl
139
- * @instance
140
- * @abstract
141
- * @category async
142
- * @rtype (url: String) => void
143
- * @param {String} url - Compiler url
144
- * @return {void}
145
- */
146
-
147
- /**
148
- * Get Compiler Version
149
- * @function getCompilerVersion
150
- * @instance
151
- * @abstract
152
- * @category async
153
- * @rtype () => String
154
- * @return {String} Compiler version
155
- */
156
-
157
- export default ContractBase;
158
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/contract/index.js"],"names":["stampit","required","ContractBase","methods","contractEncodeCallDataAPI","compileContractAPI","contractGetACI","setCompilerUrl","getCompilerVersion","contractDecodeCallResultAPI","validateByteCodeAPI","getFateAssembler","getBytecodeCompilerVersion"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAOA,OAAP,MAAoB,WAApB;AACA,SAASC,QAAT,QAAyB,iBAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,YAAY,GAAGF,OAAO,CAACC,QAAQ,CAAC;AACpCE,EAAAA,OAAO,EAAE;AACPC,IAAAA,yBAAyB,EAAEH,QADpB;AAEPI,IAAAA,kBAAkB,EAAEJ,QAFb;AAGPK,IAAAA,cAAc,EAAEL,QAHT;AAIPM,IAAAA,cAAc,EAAEN,QAJT;AAKPO,IAAAA,kBAAkB,EAAEP,QALb;AAMPQ,IAAAA,2BAA2B,EAAER,QANtB;AAOPS,IAAAA,mBAAmB,EAAET,QAPd;AAQPU,IAAAA,gBAAgB,EAAEV,QARX;AASPW,IAAAA,0BAA0B,EAAEX;AATrB;AAD2B,CAAD,CAAT,CAA5B;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAeC,YAAf","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2018 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Contract Base module\n * @module @aeternity/aepp-sdk/es/contract\n * @export Contract\n * @example import ContractBase from '@aeternity/aepp-sdk/es/contract'\n */\n\nimport stampit from '@stamp/it'\nimport { required } from '@stamp/required'\n\n/**\n * Basic Contract Stamp\n *\n * This stamp include api call's related to contract functionality.\n * Attempting to create instances from the Stamp without overwriting all\n * abstract methods using composition will result in an exception.\n * @function\n * @alias module:@aeternity/aepp-sdk/es/contract\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @return {Object} Contract instance\n */\nconst ContractBase = stampit(required({\n methods: {\n contractEncodeCallDataAPI: required,\n compileContractAPI: required,\n contractGetACI: required,\n setCompilerUrl: required,\n getCompilerVersion: required,\n contractDecodeCallResultAPI: required,\n validateByteCodeAPI: required,\n getFateAssembler: required,\n getBytecodeCompilerVersion: required\n }\n}))\n\n/**\n * Get contract ACI\n * @function contractGetACI\n * @instance\n * @abstract\n * @category async\n * @rtype (source: String, options: Array) => aciObject: Promise[Object]\n * @param {String} source - Contract source code\n * @param {Object} [options={}] Options\n * @param {Object} [options.filesystem] Contract external namespaces map\n * @return {Object} - Contract aci object\n */\n\n/**\n * Encode contract data\n * @function contractEncodeCallDataAPI\n * @instance\n * @abstract\n * @category async\n * @rtype (source: String, name: String, args: Array, options: Array) => callData: Promise[String]\n * @param {String} source - Contract source code\n * @param {String} name - Function name\n * @param {Array} args - Function argument's\n * @param {Object} [options={}] Options\n * @param {Object} [options.filesystem] Contract external namespaces map\n * @return {String} - Contract encoded data\n */\n\n/**\n * Decode contract call result data\n * @function contractDecodeCallResultAPI\n * @instance\n * @abstract\n * @category async\n * @rtype (source: String, fn: String, callValue: String, callResult: String, options: Array) => decodedResult: Promise[String]\n * @param {String} source - Contract source\n * @param {String} fn - Fn name\n * @param {String} callValue - result data (cb_das...)\n * @param {String} callResult - contract call result status('ok', 'revert', ...)\n * @param {Object} [options={}] Options\n * @param {Object} [options.filesystem] Contract external namespaces map\n * @return {String} - Decoded contract call result\n */\n\n/**\n * Decode call data by source\n * @function contractDecodeCallDataBySourceAPI\n * @instance\n * @abstract\n * @category async\n * @rtype (source: String, function: String, callData: String, options: Array) => decodedResult: Promise[String]\n * @param {String} source - contract source\n * @param {String} function - function name\n * @param {String} callData - Encoded contract call data\n * @param {Object} [options={}] Options\n * @param {Object} [options.filesystem] Contract external namespaces map\n * @return {String} - Decoded contract call data\n */\n\n/**\n * Decode call data by bytecode\n * @function contractDecodeCallDataByCodeAPI\n * @instance\n * @abstract\n * @category async\n * @rtype (code: String, callData: String) => decodedResult: Promise[String]\n * @param {String} code - contract byte code\n * @param {String} callData - Encoded contract call data\n * @return {String} - Decoded contract call data\n */\n\n/**\n * Compile contract\n * @function compileContractAPI\n * @instance\n * @abstract\n * @category async\n * @rtype (code: String, options?: Object) => compiledContract: Object\n * @param {String} code - Contract source code\n * @param {Object} [options={}] Options\n * @param {Object} [options.filesystem] Contract external namespaces map\n * @return {Object} Object which contain bytecode of contract\n */\n\n/**\n * Set compiler url\n * @function setCompilerUrl\n * @instance\n * @abstract\n * @category async\n * @rtype (url: String) => void\n * @param {String} url - Compiler url\n * @return {void}\n */\n\n/**\n * Get Compiler Version\n * @function getCompilerVersion\n * @instance\n * @abstract\n * @category async\n * @rtype () => String\n * @return {String} Compiler version\n */\n\nexport default ContractBase\n"],"file":"index.js"}
package/es/index.js DELETED
@@ -1,57 +0,0 @@
1
- /*
2
- * ISC License (ISC)
3
- * Copyright (c) 2018 aeternity developers
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software for any
6
- * purpose with or without fee is hereby granted, provided that the above
7
- * copyright notice and this permission notice appear in all copies.
8
- *
9
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- * PERFORMANCE OF THIS SOFTWARE.
16
- */
17
- import * as Crypto from './utils/crypto';
18
- import * as Keystore from './utils/keystore';
19
- import * as Bytes from './utils/bytes';
20
- import * as TxBuilder from './tx/builder';
21
- import * as TxBuilderHelper from './tx/builder/helpers';
22
- import * as SCHEMA from './tx/builder/schema';
23
- import * as ACIHelpers from './contract/aci/helpers';
24
- import * as ACITransformation from './contract/aci/transformation';
25
- import * as AmountFormatter from './utils/amount-formatter';
26
- import HdWallet from './utils/hd-wallet';
27
- import Ae from './ae';
28
- import Chain from './chain';
29
- import ChainNode from './chain/node';
30
- import Node from './node';
31
- import NodePool from './node-pool';
32
- import Tx from './tx';
33
- import Transaction from './tx/tx';
34
- import verifyTransaction from './tx/validator';
35
- import AccountBase from './account/base';
36
- import AccountMultiple from './account/multiple';
37
- import MemoryAccount from './account/memory';
38
- import Aens from './ae/aens';
39
- import Contract from './ae/contract';
40
- import GeneralizeAccount from './contract/ga';
41
- import ContractCompilerAPI from './contract/compiler';
42
- import RpcAepp from './ae/aepp';
43
- import RpcWallet from './ae/wallet';
44
- import Oracle from './ae/oracle';
45
- import genSwaggerClient from './utils/swagger';
46
- import Channel from './channel';
47
- import Universal from './ae/universal';
48
- export { default as ContentScriptBridge } from './utils/aepp-wallet-communication/content-script-bridge';
49
- import * as _AeppWalletHelpers from './utils/aepp-wallet-communication/helpers';
50
- export { _AeppWalletHelpers as AeppWalletHelpers };
51
- import * as _AeppWalletSchema from './utils/aepp-wallet-communication/schema';
52
- export { _AeppWalletSchema as AeppWalletSchema };
53
- export { default as WalletDetector } from './utils/aepp-wallet-communication/wallet-detector';
54
- export { default as BrowserRuntimeConnection } from './utils/aepp-wallet-communication/connection/browser-runtime';
55
- export { default as BrowserWindowMessageConnection } from './utils/aepp-wallet-communication/connection/browser-window-message';
56
- export { AmountFormatter, AccountBase, AccountMultiple, Ae, Aens, Bytes, Contract, ContractCompilerAPI, ACIHelpers, ACITransformation, ChainNode, RpcAepp, RpcWallet, Channel, Crypto, Keystore, Chain, GeneralizeAccount, HdWallet, MemoryAccount, Node, NodePool, Oracle, genSwaggerClient, Transaction, verifyTransaction, Tx, TxBuilder, TxBuilderHelper, Universal, SCHEMA };
57
- //# sourceMappingURL=index.js.map
package/es/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["Crypto","Keystore","Bytes","TxBuilder","TxBuilderHelper","SCHEMA","ACIHelpers","ACITransformation","AmountFormatter","HdWallet","Ae","Chain","ChainNode","Node","NodePool","Tx","Transaction","verifyTransaction","AccountBase","AccountMultiple","MemoryAccount","Aens","Contract","GeneralizeAccount","ContractCompilerAPI","RpcAepp","RpcWallet","Oracle","genSwaggerClient","Channel","Universal","default","ContentScriptBridge","AeppWalletH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AAEA,SAASC,OAAO,IAAIC,mBAApB,QAA+C,yDAA/C;oCACmC,2C;+BAAvBC,iB;mCACsB,0C;8BAAtBC,gB;AACZ,SAASH,OAAO,IAAII,cAApB,QAA0C,mDAA1C;AACA,SAASJ,OAAO,IAAIK,wBAApB,QAAoD,8DAApD;AACA,SAASL,OAAO,IAAIM,8BAApB,QAA0D,qEAA1D;AAEA,SACE7B,eADF,EAEEU,WAFF,EAGEC,eAHF,EAIET,EAJF,EAKEW,IALF,EAMEnB,KANF,EAOEoB,QAPF,EAQEE,mBARF,EASElB,UATF,EAUEC,iBAVF,EAWEK,SAXF,EAYEa,OAZF,EAaEC,SAbF,EAcEG,OAdF,EAeE7B,MAfF,EAgBEC,QAhBF,EAiBEU,KAjBF,EAkBEY,iBAlBF,EAmBEd,QAnBF,EAoBEW,aApBF,EAqBEP,IArBF,EAsBEC,QAtBF,EAuBEa,MAvBF,EAwBEC,gBAxBF,EAyBEZ,WAzBF,EA0BEC,iBA1BF,EA2BEF,EA3BF,EA4BEZ,SA5BF,EA6BEC,eA7BF,EA8BE0B,SA9BF,EA+BEzB,MA/BF","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2018 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\nimport * as Crypto from './utils/crypto'\nimport * as Keystore from './utils/keystore'\nimport * as Bytes from './utils/bytes'\nimport * as TxBuilder from './tx/builder'\nimport * as TxBuilderHelper from './tx/builder/helpers'\nimport * as SCHEMA from './tx/builder/schema'\nimport * as ACIHelpers from './contract/aci/helpers'\nimport * as ACITransformation from './contract/aci/transformation'\nimport * as AmountFormatter from './utils/amount-formatter'\nimport HdWallet from './utils/hd-wallet'\n\nimport Ae from './ae'\nimport Chain from './chain'\nimport ChainNode from './chain/node'\nimport Node from './node'\nimport NodePool from './node-pool'\nimport Tx from './tx'\nimport Transaction from './tx/tx'\nimport verifyTransaction from './tx/validator'\nimport AccountBase from './account/base'\nimport AccountMultiple from './account/multiple'\nimport MemoryAccount from './account/memory'\nimport Aens from './ae/aens'\nimport Contract from './ae/contract'\nimport GeneralizeAccount from './contract/ga'\nimport ContractCompilerAPI from './contract/compiler'\nimport RpcAepp from './ae/aepp'\nimport RpcWallet from './ae/wallet'\nimport Oracle from './ae/oracle'\nimport genSwaggerClient from './utils/swagger'\nimport Channel from './channel'\nimport Universal from './ae/universal'\n\nexport { default as ContentScriptBridge } from './utils/aepp-wallet-communication/content-script-bridge'\nexport * as AeppWalletHelpers from './utils/aepp-wallet-communication/helpers'\nexport * as AeppWalletSchema from './utils/aepp-wallet-communication/schema'\nexport { default as WalletDetector } from './utils/aepp-wallet-communication/wallet-detector'\nexport { default as BrowserRuntimeConnection } from './utils/aepp-wallet-communication/connection/browser-runtime'\nexport { default as BrowserWindowMessageConnection } from './utils/aepp-wallet-communication/connection/browser-window-message'\n\nexport {\n AmountFormatter,\n AccountBase,\n AccountMultiple,\n Ae,\n Aens,\n Bytes,\n Contract,\n ContractCompilerAPI,\n ACIHelpers,\n ACITransformation,\n ChainNode,\n RpcAepp,\n RpcWallet,\n Channel,\n Crypto,\n Keystore,\n Chain,\n GeneralizeAccount,\n HdWallet,\n MemoryAccount,\n Node,\n NodePool,\n Oracle,\n genSwaggerClient,\n Transaction,\n verifyTransaction,\n Tx,\n TxBuilder,\n TxBuilderHelper,\n Universal,\n SCHEMA\n}\n"],"file":"index.js"}