@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.
- package/README.md +15 -14
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +7 -36
- package/dist/aepp-sdk.browser-script.js.map +1 -1
- package/dist/aepp-sdk.browser.js +1 -1
- package/dist/aepp-sdk.browser.js.map +1 -1
- package/dist/aepp-sdk.js +1 -1
- package/dist/aepp-sdk.js.map +1 -1
- package/es/account/base.mjs +179 -0
- package/es/account/base.mjs.map +1 -0
- package/es/account/memory.mjs +99 -0
- package/es/account/memory.mjs.map +1 -0
- package/es/account/multiple.mjs +179 -0
- package/es/account/multiple.mjs.map +1 -0
- package/es/ae/aens.mjs +404 -0
- package/es/ae/aens.mjs.map +1 -0
- package/es/ae/{aepp.js → aepp.mjs} +9 -9
- package/es/ae/aepp.mjs.map +1 -0
- package/es/ae/contract.mjs +159 -0
- package/es/ae/contract.mjs.map +1 -0
- package/es/ae/index.mjs +207 -0
- package/es/ae/index.mjs.map +1 -0
- package/es/ae/oracle.mjs +339 -0
- package/es/ae/oracle.mjs.map +1 -0
- package/es/ae/{universal.js → universal.mjs} +10 -10
- package/es/ae/universal.mjs.map +1 -0
- package/es/ae/{wallet.js → wallet.mjs} +10 -10
- package/es/ae/wallet.mjs.map +1 -0
- package/es/aepp-wallet-communication/schema.d.ts +74 -0
- package/es/bignumber.d.ts +1 -7
- package/es/chain/{index.js → index.mjs} +29 -9
- package/es/chain/index.mjs.map +1 -0
- package/es/chain/node.mjs +442 -0
- package/es/chain/node.mjs.map +1 -0
- package/es/channel/handlers.mjs +1110 -0
- package/es/channel/handlers.mjs.map +1 -0
- package/es/channel/{index.js → index.mjs} +245 -472
- package/es/channel/index.mjs.map +1 -0
- package/es/channel/internal.mjs +283 -0
- package/es/channel/internal.mjs.map +1 -0
- package/es/contract/aci.mjs +477 -0
- package/es/contract/aci.mjs.map +1 -0
- package/es/contract/compiler.mjs +115 -0
- package/es/contract/compiler.mjs.map +1 -0
- package/es/contract/ga/helpers.mjs +30 -0
- package/es/contract/ga/helpers.mjs.map +1 -0
- package/es/contract/ga/index.mjs +178 -0
- package/es/contract/ga/index.mjs.map +1 -0
- package/es/errors.d.ts +284 -0
- package/es/index.mjs +57 -0
- package/es/index.mjs.map +1 -0
- package/es/node-pool/index.mjs +188 -0
- package/es/node-pool/index.mjs.map +1 -0
- package/es/node.mjs +133 -0
- package/es/node.mjs.map +1 -0
- package/es/other.d.ts +1 -1
- package/es/tx/builder/field-types.mjs +74 -0
- package/es/tx/builder/field-types.mjs.map +1 -0
- package/es/tx/builder/helpers.mjs +363 -0
- package/es/tx/builder/helpers.mjs.map +1 -0
- package/es/tx/builder/index.mjs +606 -0
- package/es/tx/builder/index.mjs.map +1 -0
- package/es/tx/builder/schema.mjs +760 -0
- package/es/tx/builder/schema.mjs.map +1 -0
- package/es/tx/{index.js → index.mjs} +107 -15
- package/es/tx/index.mjs.map +1 -0
- package/es/tx/tx-object.mjs +283 -0
- package/es/tx/tx-object.mjs.map +1 -0
- package/es/tx/tx.mjs +938 -0
- package/es/tx/tx.mjs.map +1 -0
- package/es/tx/validator.mjs +247 -0
- package/es/tx/validator.mjs.map +1 -0
- package/es/typings/blakejs/index.d.mjs +2 -0
- package/es/typings/blakejs/{index.d.js.map → index.d.mjs.map} +1 -1
- package/es/utils/aepp-wallet-communication/connection/{browser-runtime.js → browser-runtime.mjs} +27 -29
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs +183 -0
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/connection/{index.js → index.mjs} +7 -3
- package/es/utils/aepp-wallet-communication/connection/index.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/{content-script-bridge.js → content-script-bridge.mjs} +29 -23
- package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/helpers.mjs +92 -0
- package/es/utils/aepp-wallet-communication/helpers.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs +375 -0
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs +275 -0
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs +541 -0
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/schema.mjs +102 -0
- package/es/utils/aepp-wallet-communication/schema.mjs.map +1 -0
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs +110 -0
- package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
- package/es/utils/amount-formatter.mjs +139 -0
- package/es/utils/amount-formatter.mjs.map +1 -0
- package/es/utils/async-init.mjs +64 -0
- package/es/utils/async-init.mjs.map +1 -0
- package/es/utils/bignumber.mjs +21 -0
- package/es/utils/bignumber.mjs.map +1 -0
- package/es/utils/{bytes.js → bytes.mjs} +16 -12
- package/es/utils/bytes.mjs.map +1 -0
- package/es/utils/{crypto-ts.js → crypto-ts.mjs} +11 -3
- package/es/utils/crypto-ts.mjs.map +1 -0
- package/es/utils/crypto.mjs +239 -0
- package/es/utils/crypto.mjs.map +1 -0
- package/es/utils/errors.mjs +689 -0
- package/es/utils/errors.mjs.map +1 -0
- package/es/utils/hd-wallet.mjs +111 -0
- package/es/utils/hd-wallet.mjs.map +1 -0
- package/es/utils/json-big.mjs +45 -0
- package/es/utils/json-big.mjs.map +1 -0
- package/es/utils/keystore.mjs +240 -0
- package/es/utils/keystore.mjs.map +1 -0
- package/es/utils/mptree.mjs +161 -0
- package/es/utils/mptree.mjs.map +1 -0
- package/es/utils/other.mjs +43 -0
- package/es/utils/other.mjs.map +1 -0
- package/es/utils/semver-satisfies.mjs +16 -0
- package/es/utils/semver-satisfies.mjs.map +1 -0
- package/es/utils/{string.js → string.mjs} +5 -14
- package/es/utils/string.mjs.map +1 -0
- package/es/utils/swagger.mjs +164 -0
- package/es/utils/swagger.mjs.map +1 -0
- package/package.json +55 -62
- package/src/account/base.js +3 -1
- package/src/account/memory.js +13 -8
- package/src/account/multiple.js +31 -22
- package/src/ae/aens.js +75 -77
- package/src/ae/aepp.js +2 -2
- package/src/ae/contract.js +27 -291
- package/src/ae/index.js +9 -7
- package/src/ae/oracle.js +51 -28
- package/src/ae/universal.js +4 -2
- package/src/ae/wallet.js +2 -2
- package/src/chain/index.js +29 -6
- package/src/chain/node.js +95 -67
- package/src/channel/handlers.js +30 -21
- package/src/channel/index.js +44 -20
- package/src/channel/internal.js +30 -24
- package/src/contract/aci.js +376 -0
- package/src/contract/compiler.js +41 -91
- package/src/contract/ga/helpers.js +10 -13
- package/src/contract/ga/index.js +42 -33
- package/src/index.js +9 -10
- package/src/node-pool/index.js +29 -17
- package/src/node.js +33 -36
- package/src/tx/builder/field-types.js +61 -0
- package/src/tx/builder/helpers.js +126 -84
- package/src/tx/builder/index.js +83 -41
- package/src/tx/builder/schema.js +50 -40
- package/src/tx/index.js +101 -12
- package/src/tx/tx-object.js +35 -15
- package/src/tx/tx.js +232 -153
- package/src/tx/validator.js +34 -12
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +11 -5
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +35 -13
- package/src/utils/aepp-wallet-communication/connection/index.js +2 -1
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +14 -7
- package/src/utils/aepp-wallet-communication/helpers.js +6 -14
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +107 -60
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +24 -11
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +98 -56
- package/src/utils/aepp-wallet-communication/schema.ts +80 -0
- package/src/utils/aepp-wallet-communication/wallet-detector.js +6 -2
- package/src/utils/amount-formatter.ts +4 -3
- package/src/utils/async-init.js +10 -6
- package/src/utils/bignumber.ts +3 -10
- package/src/utils/bytes.ts +3 -2
- package/src/utils/crypto-ts.ts +2 -2
- package/src/utils/crypto.js +10 -144
- package/src/utils/errors.ts +683 -0
- package/src/utils/hd-wallet.js +11 -26
- package/src/utils/keystore.js +57 -53
- package/src/utils/mptree.ts +12 -6
- package/src/utils/other.ts +1 -1
- package/src/utils/semver-satisfies.ts +1 -1
- package/src/utils/swagger.js +75 -45
- package/es/account/base.js +0 -259
- package/es/account/base.js.map +0 -1
- package/es/account/memory.js +0 -86
- package/es/account/memory.js.map +0 -1
- package/es/account/multiple.js +0 -267
- package/es/account/multiple.js.map +0 -1
- package/es/ae/aens.js +0 -829
- package/es/ae/aens.js.map +0 -1
- package/es/ae/aepp.js.map +0 -1
- package/es/ae/contract.js +0 -985
- package/es/ae/contract.js.map +0 -1
- package/es/ae/index.js +0 -442
- package/es/ae/index.js.map +0 -1
- package/es/ae/oracle.js +0 -690
- package/es/ae/oracle.js.map +0 -1
- package/es/ae/universal.js.map +0 -1
- package/es/ae/wallet.js.map +0 -1
- package/es/chain/index.js.map +0 -1
- package/es/chain/node.js +0 -1119
- package/es/chain/node.js.map +0 -1
- package/es/channel/handlers.js +0 -1601
- package/es/channel/handlers.js.map +0 -1
- package/es/channel/index.js.map +0 -1
- package/es/channel/internal.js +0 -438
- package/es/channel/internal.js.map +0 -1
- package/es/contract/aci/helpers.js +0 -298
- package/es/contract/aci/helpers.js.map +0 -1
- package/es/contract/aci/index.js +0 -517
- package/es/contract/aci/index.js.map +0 -1
- package/es/contract/aci/transformation.js +0 -742
- package/es/contract/aci/transformation.js.map +0 -1
- package/es/contract/compiler.js +0 -316
- package/es/contract/compiler.js.map +0 -1
- package/es/contract/ga/helpers.js +0 -120
- package/es/contract/ga/helpers.js.map +0 -1
- package/es/contract/ga/index.js +0 -307
- package/es/contract/ga/index.js.map +0 -1
- package/es/contract/index.js +0 -158
- package/es/contract/index.js.map +0 -1
- package/es/index.js +0 -57
- package/es/index.js.map +0 -1
- package/es/node-pool/index.js +0 -204
- package/es/node-pool/index.js.map +0 -1
- package/es/node.js +0 -228
- package/es/node.js.map +0 -1
- package/es/tx/builder/helpers.js +0 -355
- package/es/tx/builder/helpers.js.map +0 -1
- package/es/tx/builder/index.js +0 -686
- package/es/tx/builder/index.js.map +0 -1
- package/es/tx/builder/schema.js +0 -695
- package/es/tx/builder/schema.js.map +0 -1
- package/es/tx/index.js.map +0 -1
- package/es/tx/tx-object.js +0 -297
- package/es/tx/tx-object.js.map +0 -1
- package/es/tx/tx.js +0 -1757
- package/es/tx/tx.js.map +0 -1
- package/es/tx/validator.js +0 -344
- package/es/tx/validator.js.map +0 -1
- package/es/typings/blakejs/index.d.js +0 -2
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -211
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +0 -1
- package/es/utils/aepp-wallet-communication/connection/index.js.map +0 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +0 -1
- package/es/utils/aepp-wallet-communication/helpers.js +0 -148
- package/es/utils/aepp-wallet-communication/helpers.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -652
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -285
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +0 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -763
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +0 -1
- package/es/utils/aepp-wallet-communication/schema.js +0 -103
- package/es/utils/aepp-wallet-communication/schema.js.map +0 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.js +0 -135
- package/es/utils/aepp-wallet-communication/wallet-detector.js.map +0 -1
- package/es/utils/amount-formatter.js +0 -152
- package/es/utils/amount-formatter.js.map +0 -1
- package/es/utils/async-init.js +0 -103
- package/es/utils/async-init.js.map +0 -1
- package/es/utils/bignumber.js +0 -36
- package/es/utils/bignumber.js.map +0 -1
- package/es/utils/bytes.js.map +0 -1
- package/es/utils/crypto-ts.js.map +0 -1
- package/es/utils/crypto.js +0 -358
- package/es/utils/crypto.js.map +0 -1
- package/es/utils/hd-wallet.js +0 -148
- package/es/utils/hd-wallet.js.map +0 -1
- package/es/utils/json-big.js +0 -78
- package/es/utils/json-big.js.map +0 -1
- package/es/utils/keystore.js +0 -393
- package/es/utils/keystore.js.map +0 -1
- package/es/utils/mptree.js +0 -198
- package/es/utils/mptree.js.map +0 -1
- package/es/utils/other.js +0 -93
- package/es/utils/other.js.map +0 -1
- package/es/utils/semver-satisfies.js +0 -35
- package/es/utils/semver-satisfies.js.map +0 -1
- package/es/utils/string.js.map +0 -1
- package/es/utils/swagger.js +0 -269
- package/es/utils/swagger.js.map +0 -1
- package/src/contract/aci/helpers.js +0 -140
- package/src/contract/aci/index.js +0 -191
- package/src/contract/aci/transformation.js +0 -464
- package/src/contract/index.js +0 -159
- package/src/utils/aepp-wallet-communication/schema.js +0 -110
package/es/ae/aens.js
DELETED
|
@@ -1,829 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
2
|
-
import _fromPairs from "ramda/src/fromPairs";
|
|
3
|
-
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
4
|
-
import _merge from "ramda/src/merge";
|
|
5
|
-
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context17; _forEachInstanceProperty(_context17 = ownKeys(Object(source), true)).call(_context17, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context18; _forEachInstanceProperty(_context18 = ownKeys(Object(source))).call(_context18, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10
|
-
|
|
11
|
-
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
12
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
13
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
14
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
15
|
-
import _Object$freeze from "@babel/runtime-corejs3/core-js-stable/object/freeze";
|
|
16
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
17
|
-
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
18
|
-
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
19
|
-
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
20
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
21
|
-
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
22
|
-
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
23
|
-
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
24
|
-
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
25
|
-
import { salt } from '../utils/crypto';
|
|
26
|
-
import { commitmentHash, ensureNameValid, getMinimumNameFee, classify, isAuctionName, validatePointers, encode, produceNameId } from '../tx/builder/helpers';
|
|
27
|
-
import Ae from './';
|
|
28
|
-
import { CLIENT_TTL, NAME_FEE, NAME_TTL } from '../tx/builder/schema';
|
|
29
|
-
/**
|
|
30
|
-
* Revoke a name
|
|
31
|
-
* @instance
|
|
32
|
-
* @function
|
|
33
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
34
|
-
* @category async
|
|
35
|
-
* @param {String} name Name hash
|
|
36
|
-
* @param {Object} [options={}] options
|
|
37
|
-
* @param {(String|Object)} [options.onAccount] onAccount Make operation on specific account from sdk(you pass publickKey) or
|
|
38
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
39
|
-
* @param {(Number|String|BigNumber)} [options.fee] fee
|
|
40
|
-
* @param {(Number|String|BigNumber)} [options.ttl] ttl
|
|
41
|
-
* @param {(Number|String|BigNumber)} [options.nonce] nonce
|
|
42
|
-
* @return {Promise<Object>} Transaction result
|
|
43
|
-
* @example
|
|
44
|
-
* const name = 'test.chain'
|
|
45
|
-
* const nameObject = await sdkInstance.aensQuery(name)
|
|
46
|
-
*
|
|
47
|
-
* await sdkInstance.aensRevoke(name, { fee, ttl , nonce })
|
|
48
|
-
* // or
|
|
49
|
-
* await nameObject.revoke({ fee, ttl, nonce })
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
function revoke(_x) {
|
|
53
|
-
return _revoke.apply(this, arguments);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Update a name
|
|
57
|
-
* @instance
|
|
58
|
-
* @function
|
|
59
|
-
* @category async
|
|
60
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
61
|
-
* @param {String} name AENS name
|
|
62
|
-
* @param {String[]} pointers Array of name pointers. Can be oracle|account|contract|channel public key
|
|
63
|
-
* @param {Object} [options={}]
|
|
64
|
-
* @param {Boolean} [options.extendPointers=false] extendPointers Get the pointers from the node and merge with provided one. Pointers with the same type will be overwrited
|
|
65
|
-
* @param {(String|Object)} [options.onAccount] onAccount Make operation on specific account from sdk(you pass publickKey) or
|
|
66
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
67
|
-
* @param {(Number|String|BigNumber)} [options.fee] fee
|
|
68
|
-
* @param {(Number|String|BigNumber)} [options.ttl] ttl
|
|
69
|
-
* @param {(Number|String|BigNumber)} [options.nonce] nonce
|
|
70
|
-
* @param {(Number|String|BigNumber)} [options.nameTtl=50000] nameTtl Name ttl represented in number of blocks (Max value is 50000 blocks)
|
|
71
|
-
* @param {(Number|String|BigNumber)} [options.clientTtl=84600] clientTtl a suggestion as to how long any clients should cache this information
|
|
72
|
-
* @return {Promise<Object>}
|
|
73
|
-
* @throws Invalid pointer array error
|
|
74
|
-
* @example
|
|
75
|
-
* const name = 'test.chain'
|
|
76
|
-
* const pointersArray = ['ak_asd23dasdas...,' 'ct_asdf34fasdasd...']
|
|
77
|
-
* const nameObject = await sdkInstance.aensQuery(name)
|
|
78
|
-
*
|
|
79
|
-
* await sdkInstance.aensUpdate(name, pointersArray, { nameTtl, ttl, fee, nonce, clientTtl })
|
|
80
|
-
* // or
|
|
81
|
-
* await nameObject.update(pointersArray, { nameTtl, ttl, fee, nonce, clientTtl })
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
function _revoke() {
|
|
86
|
-
_revoke = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(name) {
|
|
87
|
-
var options,
|
|
88
|
-
opt,
|
|
89
|
-
nameRevokeTx,
|
|
90
|
-
_args = arguments;
|
|
91
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
92
|
-
while (1) {
|
|
93
|
-
switch (_context.prev = _context.next) {
|
|
94
|
-
case 0:
|
|
95
|
-
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
96
|
-
ensureNameValid(name);
|
|
97
|
-
opt = _merge(this.Ae.defaults, options);
|
|
98
|
-
_context.t0 = this;
|
|
99
|
-
_context.t1 = _merge;
|
|
100
|
-
_context.t2 = opt;
|
|
101
|
-
_context.t3 = produceNameId(name);
|
|
102
|
-
_context.next = 9;
|
|
103
|
-
return this.address(opt);
|
|
104
|
-
|
|
105
|
-
case 9:
|
|
106
|
-
_context.t4 = _context.sent;
|
|
107
|
-
_context.t5 = {
|
|
108
|
-
nameId: _context.t3,
|
|
109
|
-
accountId: _context.t4
|
|
110
|
-
};
|
|
111
|
-
_context.t6 = (0, _context.t1)(_context.t2, _context.t5);
|
|
112
|
-
_context.next = 14;
|
|
113
|
-
return _context.t0.nameRevokeTx.call(_context.t0, _context.t6);
|
|
114
|
-
|
|
115
|
-
case 14:
|
|
116
|
-
nameRevokeTx = _context.sent;
|
|
117
|
-
return _context.abrupt("return", this.send(nameRevokeTx, opt));
|
|
118
|
-
|
|
119
|
-
case 16:
|
|
120
|
-
case "end":
|
|
121
|
-
return _context.stop();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}, _callee, this);
|
|
125
|
-
}));
|
|
126
|
-
return _revoke.apply(this, arguments);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function update(_x2) {
|
|
130
|
-
return _update.apply(this, arguments);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Transfer a domain to another account
|
|
134
|
-
* @instance
|
|
135
|
-
* @function
|
|
136
|
-
* @category async
|
|
137
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
138
|
-
* @param {String} name AENS name
|
|
139
|
-
* @param {String} account Recipient account publick key
|
|
140
|
-
* @param {Object} [options={}]
|
|
141
|
-
* @param {(String|Object)} [options.onAccount] onAccount Make operation on specific account from sdk(you pass publickKey) or
|
|
142
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
143
|
-
* @param {(Number|String|BigNumber)} [options.fee] fee
|
|
144
|
-
* @param {(Number|String|BigNumber)} [options.ttl] ttl
|
|
145
|
-
* @param {(Number|String|BigNumber)} [options.nonce] nonce
|
|
146
|
-
* @return {Promise<Object>} Transaction result
|
|
147
|
-
* @example
|
|
148
|
-
* const name = 'test.chain'
|
|
149
|
-
* const recipientPub = 'ak_asd23dasdas...'
|
|
150
|
-
* const nameObject = await sdkInstance.aensQuery(name)
|
|
151
|
-
*
|
|
152
|
-
* await sdkInstance.aensTransfer(name, recipientPub, { ttl, fee, nonce })
|
|
153
|
-
* // or
|
|
154
|
-
* await nameObject.transfer(recipientPub, { ttl, fee, nonce })
|
|
155
|
-
*/
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
function _update() {
|
|
159
|
-
_update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(name) {
|
|
160
|
-
var _context2, _context3;
|
|
161
|
-
|
|
162
|
-
var pointers,
|
|
163
|
-
options,
|
|
164
|
-
opt,
|
|
165
|
-
nameUpdateTx,
|
|
166
|
-
_args2 = arguments;
|
|
167
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context5) {
|
|
168
|
-
while (1) {
|
|
169
|
-
switch (_context5.prev = _context5.next) {
|
|
170
|
-
case 0:
|
|
171
|
-
pointers = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : [];
|
|
172
|
-
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {
|
|
173
|
-
extendPointers: false
|
|
174
|
-
};
|
|
175
|
-
ensureNameValid(name);
|
|
176
|
-
opt = _merge(this.Ae.defaults, options);
|
|
177
|
-
|
|
178
|
-
if (validatePointers(pointers)) {
|
|
179
|
-
_context5.next = 6;
|
|
180
|
-
break;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
throw new Error('Invalid pointers array');
|
|
184
|
-
|
|
185
|
-
case 6:
|
|
186
|
-
_context5.t0 = _reduceInstanceProperty;
|
|
187
|
-
_context5.t1 = _concatInstanceProperty(_context3 = []);
|
|
188
|
-
_context5.t2 = _context3;
|
|
189
|
-
_context5.t3 = _toConsumableArray;
|
|
190
|
-
|
|
191
|
-
if (!options.extendPointers) {
|
|
192
|
-
_context5.next = 16;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
_context5.next = 13;
|
|
197
|
-
return this.getName(name);
|
|
198
|
-
|
|
199
|
-
case 13:
|
|
200
|
-
_context5.t4 = _context5.sent.pointers;
|
|
201
|
-
_context5.next = 17;
|
|
202
|
-
break;
|
|
203
|
-
|
|
204
|
-
case 16:
|
|
205
|
-
_context5.t4 = [];
|
|
206
|
-
|
|
207
|
-
case 17:
|
|
208
|
-
_context5.t5 = _context5.t4;
|
|
209
|
-
_context5.t6 = (0, _context5.t3)(_context5.t5);
|
|
210
|
-
_context5.t7 = _toConsumableArray(_mapInstanceProperty(pointers).call(pointers, function (p) {
|
|
211
|
-
return _fromPairs([['id', p], ['key', classify(p)]]);
|
|
212
|
-
}));
|
|
213
|
-
_context5.t8 = _context2 = _context5.t1.call.call(_context5.t1, _context5.t2, _context5.t6, _context5.t7);
|
|
214
|
-
pointers = (0, _context5.t0)(_context5.t8).call(_context2, function (acc, el) {
|
|
215
|
-
var _context4;
|
|
216
|
-
|
|
217
|
-
return _concatInstanceProperty(_context4 = []).call(_context4, _toConsumableArray(_filterInstanceProperty(acc).call(acc, function (p) {
|
|
218
|
-
return p.key !== el.key;
|
|
219
|
-
})), [el]);
|
|
220
|
-
}, []);
|
|
221
|
-
_context5.t9 = this;
|
|
222
|
-
_context5.t10 = _merge;
|
|
223
|
-
_context5.t11 = opt;
|
|
224
|
-
_context5.t12 = produceNameId(name);
|
|
225
|
-
_context5.next = 28;
|
|
226
|
-
return this.address(opt);
|
|
227
|
-
|
|
228
|
-
case 28:
|
|
229
|
-
_context5.t13 = _context5.sent;
|
|
230
|
-
_context5.t14 = pointers;
|
|
231
|
-
_context5.t15 = {
|
|
232
|
-
nameId: _context5.t12,
|
|
233
|
-
accountId: _context5.t13,
|
|
234
|
-
pointers: _context5.t14
|
|
235
|
-
};
|
|
236
|
-
_context5.t16 = (0, _context5.t10)(_context5.t11, _context5.t15);
|
|
237
|
-
_context5.next = 34;
|
|
238
|
-
return _context5.t9.nameUpdateTx.call(_context5.t9, _context5.t16);
|
|
239
|
-
|
|
240
|
-
case 34:
|
|
241
|
-
nameUpdateTx = _context5.sent;
|
|
242
|
-
return _context5.abrupt("return", this.send(nameUpdateTx, opt));
|
|
243
|
-
|
|
244
|
-
case 36:
|
|
245
|
-
case "end":
|
|
246
|
-
return _context5.stop();
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}, _callee2, this);
|
|
250
|
-
}));
|
|
251
|
-
return _update.apply(this, arguments);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function transfer(_x3, _x4) {
|
|
255
|
-
return _transfer.apply(this, arguments);
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Query the AENS name info from the node
|
|
259
|
-
* and return the object with info and predefined functions for manipulating name
|
|
260
|
-
* @instance
|
|
261
|
-
* @function
|
|
262
|
-
* @category async
|
|
263
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
264
|
-
* @param {String} name
|
|
265
|
-
* @param {Object} opt Options
|
|
266
|
-
* @return {Promise<Object>}
|
|
267
|
-
* @example
|
|
268
|
-
* const nameObject = sdkInstance.aensQuery('test.chain')
|
|
269
|
-
* console.log(nameObject)
|
|
270
|
-
* {
|
|
271
|
-
* id, // name hash
|
|
272
|
-
* pointers, // array of pointers
|
|
273
|
-
* update, // Update name function
|
|
274
|
-
* extendTtl, // Extend Ttl name function
|
|
275
|
-
* transfer, // Transfer name function
|
|
276
|
-
* revoke // Revoke name function
|
|
277
|
-
* }
|
|
278
|
-
*/
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
function _transfer() {
|
|
282
|
-
_transfer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(name, account) {
|
|
283
|
-
var options,
|
|
284
|
-
opt,
|
|
285
|
-
nameTransferTx,
|
|
286
|
-
_args3 = arguments;
|
|
287
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context6) {
|
|
288
|
-
while (1) {
|
|
289
|
-
switch (_context6.prev = _context6.next) {
|
|
290
|
-
case 0:
|
|
291
|
-
options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
|
|
292
|
-
ensureNameValid(name);
|
|
293
|
-
opt = _merge(this.Ae.defaults, options);
|
|
294
|
-
_context6.t0 = this;
|
|
295
|
-
_context6.t1 = _merge;
|
|
296
|
-
_context6.t2 = opt;
|
|
297
|
-
_context6.t3 = produceNameId(name);
|
|
298
|
-
_context6.next = 9;
|
|
299
|
-
return this.address(opt);
|
|
300
|
-
|
|
301
|
-
case 9:
|
|
302
|
-
_context6.t4 = _context6.sent;
|
|
303
|
-
_context6.t5 = account;
|
|
304
|
-
_context6.t6 = {
|
|
305
|
-
nameId: _context6.t3,
|
|
306
|
-
accountId: _context6.t4,
|
|
307
|
-
recipientId: _context6.t5
|
|
308
|
-
};
|
|
309
|
-
_context6.t7 = (0, _context6.t1)(_context6.t2, _context6.t6);
|
|
310
|
-
_context6.next = 15;
|
|
311
|
-
return _context6.t0.nameTransferTx.call(_context6.t0, _context6.t7);
|
|
312
|
-
|
|
313
|
-
case 15:
|
|
314
|
-
nameTransferTx = _context6.sent;
|
|
315
|
-
return _context6.abrupt("return", this.send(nameTransferTx, opt));
|
|
316
|
-
|
|
317
|
-
case 17:
|
|
318
|
-
case "end":
|
|
319
|
-
return _context6.stop();
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}, _callee3, this);
|
|
323
|
-
}));
|
|
324
|
-
return _transfer.apply(this, arguments);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function query(_x5) {
|
|
328
|
-
return _query.apply(this, arguments);
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Claim a previously preclaimed registration. This can only be done after the
|
|
332
|
-
* preclaim step
|
|
333
|
-
* @instance
|
|
334
|
-
* @function
|
|
335
|
-
* @category async
|
|
336
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
337
|
-
* @param {String} name
|
|
338
|
-
* @param {Number} salt Salt from pre-claim, or 0 if it's a bid
|
|
339
|
-
* @param {Object} [options] options
|
|
340
|
-
* @param {String|Object} [options.onAccount] onAccount Make operation on specific account from sdk(you pass publickKey) or
|
|
341
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
342
|
-
* @param {Number|String|BigNumber} [options.fee] fee
|
|
343
|
-
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
344
|
-
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
345
|
-
* @param {Number|String} [options.nameFee] Name Fee (By default calculated by sdk)
|
|
346
|
-
* @return {Promise<Object>} the result of the claim
|
|
347
|
-
* @example
|
|
348
|
-
* const name = 'test.chain'
|
|
349
|
-
* const salt = preclaimResult.salt // salt from pre-claim transaction
|
|
350
|
-
*
|
|
351
|
-
* await sdkInstance.aensClaim(name, salt, { ttl, fee, nonce, nameFee })
|
|
352
|
-
*/
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
function _query() {
|
|
356
|
-
_query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(name) {
|
|
357
|
-
var _this = this;
|
|
358
|
-
|
|
359
|
-
var opt,
|
|
360
|
-
o,
|
|
361
|
-
_args8 = arguments;
|
|
362
|
-
return _regeneratorRuntime.wrap(function _callee8$(_context12) {
|
|
363
|
-
while (1) {
|
|
364
|
-
switch (_context12.prev = _context12.next) {
|
|
365
|
-
case 0:
|
|
366
|
-
opt = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
|
|
367
|
-
ensureNameValid(name);
|
|
368
|
-
_context12.next = 4;
|
|
369
|
-
return this.getName(name);
|
|
370
|
-
|
|
371
|
-
case 4:
|
|
372
|
-
o = _context12.sent;
|
|
373
|
-
return _context12.abrupt("return", _Object$freeze(_Object$assign(o, {
|
|
374
|
-
pointers: o.pointers || [],
|
|
375
|
-
update: function () {
|
|
376
|
-
var _update2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
377
|
-
var pointers,
|
|
378
|
-
options,
|
|
379
|
-
_args4 = arguments;
|
|
380
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context7) {
|
|
381
|
-
while (1) {
|
|
382
|
-
switch (_context7.prev = _context7.next) {
|
|
383
|
-
case 0:
|
|
384
|
-
pointers = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : [];
|
|
385
|
-
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
386
|
-
_context7.t0 = _objectSpread;
|
|
387
|
-
_context7.t1 = _objectSpread;
|
|
388
|
-
_context7.t2 = {};
|
|
389
|
-
_context7.next = 7;
|
|
390
|
-
return _this.aensUpdate(name, pointers, _merge(opt, options));
|
|
391
|
-
|
|
392
|
-
case 7:
|
|
393
|
-
_context7.t3 = _context7.sent;
|
|
394
|
-
_context7.t4 = (0, _context7.t1)(_context7.t2, _context7.t3);
|
|
395
|
-
_context7.next = 11;
|
|
396
|
-
return _this.aensQuery(name);
|
|
397
|
-
|
|
398
|
-
case 11:
|
|
399
|
-
_context7.t5 = _context7.sent;
|
|
400
|
-
return _context7.abrupt("return", (0, _context7.t0)(_context7.t4, _context7.t5));
|
|
401
|
-
|
|
402
|
-
case 13:
|
|
403
|
-
case "end":
|
|
404
|
-
return _context7.stop();
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}, _callee4);
|
|
408
|
-
}));
|
|
409
|
-
|
|
410
|
-
function update() {
|
|
411
|
-
return _update2.apply(this, arguments);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
return update;
|
|
415
|
-
}(),
|
|
416
|
-
transfer: function () {
|
|
417
|
-
var _transfer2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(account) {
|
|
418
|
-
var options,
|
|
419
|
-
_args5 = arguments;
|
|
420
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context8) {
|
|
421
|
-
while (1) {
|
|
422
|
-
switch (_context8.prev = _context8.next) {
|
|
423
|
-
case 0:
|
|
424
|
-
options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
|
|
425
|
-
_context8.t0 = _objectSpread;
|
|
426
|
-
_context8.t1 = _objectSpread;
|
|
427
|
-
_context8.t2 = {};
|
|
428
|
-
_context8.next = 6;
|
|
429
|
-
return _this.aensTransfer(name, account, _merge(opt, options));
|
|
430
|
-
|
|
431
|
-
case 6:
|
|
432
|
-
_context8.t3 = _context8.sent;
|
|
433
|
-
_context8.t4 = (0, _context8.t1)(_context8.t2, _context8.t3);
|
|
434
|
-
_context8.next = 10;
|
|
435
|
-
return _this.aensQuery(name);
|
|
436
|
-
|
|
437
|
-
case 10:
|
|
438
|
-
_context8.t5 = _context8.sent;
|
|
439
|
-
return _context8.abrupt("return", (0, _context8.t0)(_context8.t4, _context8.t5));
|
|
440
|
-
|
|
441
|
-
case 12:
|
|
442
|
-
case "end":
|
|
443
|
-
return _context8.stop();
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}, _callee5);
|
|
447
|
-
}));
|
|
448
|
-
|
|
449
|
-
function transfer(_x11) {
|
|
450
|
-
return _transfer2.apply(this, arguments);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
return transfer;
|
|
454
|
-
}(),
|
|
455
|
-
revoke: function () {
|
|
456
|
-
var _revoke2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
457
|
-
var options,
|
|
458
|
-
_args6 = arguments;
|
|
459
|
-
return _regeneratorRuntime.wrap(function _callee6$(_context9) {
|
|
460
|
-
while (1) {
|
|
461
|
-
switch (_context9.prev = _context9.next) {
|
|
462
|
-
case 0:
|
|
463
|
-
options = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
464
|
-
return _context9.abrupt("return", _this.aensRevoke(name, _merge(opt, options)));
|
|
465
|
-
|
|
466
|
-
case 2:
|
|
467
|
-
case "end":
|
|
468
|
-
return _context9.stop();
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}, _callee6);
|
|
472
|
-
}));
|
|
473
|
-
|
|
474
|
-
function revoke() {
|
|
475
|
-
return _revoke2.apply(this, arguments);
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
return revoke;
|
|
479
|
-
}(),
|
|
480
|
-
extendTtl: function () {
|
|
481
|
-
var _extendTtl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
482
|
-
var _context10;
|
|
483
|
-
|
|
484
|
-
var nameTtl,
|
|
485
|
-
options,
|
|
486
|
-
_args7 = arguments;
|
|
487
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context11) {
|
|
488
|
-
while (1) {
|
|
489
|
-
switch (_context11.prev = _context11.next) {
|
|
490
|
-
case 0:
|
|
491
|
-
nameTtl = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : NAME_TTL;
|
|
492
|
-
options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
493
|
-
|
|
494
|
-
if (!(!nameTtl || typeof nameTtl !== 'number' || nameTtl > NAME_TTL)) {
|
|
495
|
-
_context11.next = 4;
|
|
496
|
-
break;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
throw new Error('Ttl must be an number and less then 180000 blocks');
|
|
500
|
-
|
|
501
|
-
case 4:
|
|
502
|
-
_context11.t0 = _objectSpread;
|
|
503
|
-
_context11.t1 = _objectSpread;
|
|
504
|
-
_context11.t2 = {};
|
|
505
|
-
_context11.next = 9;
|
|
506
|
-
return _this.aensUpdate(name, _mapInstanceProperty(_context10 = o.pointers).call(_context10, function (p) {
|
|
507
|
-
return p.id;
|
|
508
|
-
}), _objectSpread(_objectSpread({}, _merge(opt, options)), {}, {
|
|
509
|
-
nameTtl: nameTtl
|
|
510
|
-
}));
|
|
511
|
-
|
|
512
|
-
case 9:
|
|
513
|
-
_context11.t3 = _context11.sent;
|
|
514
|
-
_context11.t4 = (0, _context11.t1)(_context11.t2, _context11.t3);
|
|
515
|
-
_context11.next = 13;
|
|
516
|
-
return _this.aensQuery(name);
|
|
517
|
-
|
|
518
|
-
case 13:
|
|
519
|
-
_context11.t5 = _context11.sent;
|
|
520
|
-
return _context11.abrupt("return", (0, _context11.t0)(_context11.t4, _context11.t5));
|
|
521
|
-
|
|
522
|
-
case 15:
|
|
523
|
-
case "end":
|
|
524
|
-
return _context11.stop();
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
}, _callee7);
|
|
528
|
-
}));
|
|
529
|
-
|
|
530
|
-
function extendTtl() {
|
|
531
|
-
return _extendTtl.apply(this, arguments);
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
return extendTtl;
|
|
535
|
-
}()
|
|
536
|
-
})));
|
|
537
|
-
|
|
538
|
-
case 6:
|
|
539
|
-
case "end":
|
|
540
|
-
return _context12.stop();
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}, _callee8, this);
|
|
544
|
-
}));
|
|
545
|
-
return _query.apply(this, arguments);
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
function claim(_x6, _x7, _x8) {
|
|
549
|
-
return _claim.apply(this, arguments);
|
|
550
|
-
}
|
|
551
|
-
/**
|
|
552
|
-
* Preclaim a name. Sends a hash of the name and a random salt to the node
|
|
553
|
-
* @instance
|
|
554
|
-
* @function
|
|
555
|
-
* @category async
|
|
556
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
557
|
-
* @param {String} name
|
|
558
|
-
* @param {Object} [options={}]
|
|
559
|
-
* @param {String|Object} [options.onAccount] onAccount Make operation on specific account from sdk(you pass publickKey) or
|
|
560
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
561
|
-
* @param {Number|String|BigNumber} [options.fee] fee
|
|
562
|
-
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
563
|
-
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
564
|
-
* @return {Promise<Object>}
|
|
565
|
-
* @example
|
|
566
|
-
* const name = 'test.chain'
|
|
567
|
-
* const salt = preclaimResult.salt // salt from pre-claim transaction
|
|
568
|
-
*
|
|
569
|
-
* await sdkInstance.aensPreclaim(name, { ttl, fee, nonce })
|
|
570
|
-
* {
|
|
571
|
-
* ...transactionResult,
|
|
572
|
-
* claim, // Claim function (options={}) => claimTransactionResult
|
|
573
|
-
* salt,
|
|
574
|
-
* commitmentId
|
|
575
|
-
* }
|
|
576
|
-
*/
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
function _claim() {
|
|
580
|
-
_claim = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(name, salt, options) {
|
|
581
|
-
var opt, minNameFee, _context13, claimTx, result, nameInter;
|
|
582
|
-
|
|
583
|
-
return _regeneratorRuntime.wrap(function _callee9$(_context14) {
|
|
584
|
-
while (1) {
|
|
585
|
-
switch (_context14.prev = _context14.next) {
|
|
586
|
-
case 0:
|
|
587
|
-
ensureNameValid(name);
|
|
588
|
-
opt = _merge(this.Ae.defaults, options);
|
|
589
|
-
minNameFee = getMinimumNameFee(name);
|
|
590
|
-
|
|
591
|
-
if (!(opt.nameFee !== this.Ae.defaults.nameFee && minNameFee.gt(opt.nameFee))) {
|
|
592
|
-
_context14.next = 5;
|
|
593
|
-
break;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
throw new Error(_concatInstanceProperty(_context13 = "the provided fee ".concat(opt.nameFee, " is not enough to execute the claim, required: ")).call(_context13, minNameFee));
|
|
597
|
-
|
|
598
|
-
case 5:
|
|
599
|
-
opt.nameFee = opt.nameFee !== this.Ae.defaults.nameFee ? opt.nameFee : minNameFee;
|
|
600
|
-
_context14.t0 = this;
|
|
601
|
-
_context14.t1 = _merge;
|
|
602
|
-
_context14.t2 = opt;
|
|
603
|
-
_context14.next = 11;
|
|
604
|
-
return this.address(opt);
|
|
605
|
-
|
|
606
|
-
case 11:
|
|
607
|
-
_context14.t3 = _context14.sent;
|
|
608
|
-
_context14.t4 = salt;
|
|
609
|
-
_context14.t5 = encode(name, 'nm');
|
|
610
|
-
_context14.t6 = {
|
|
611
|
-
accountId: _context14.t3,
|
|
612
|
-
nameSalt: _context14.t4,
|
|
613
|
-
name: _context14.t5
|
|
614
|
-
};
|
|
615
|
-
_context14.t7 = (0, _context14.t1)(_context14.t2, _context14.t6);
|
|
616
|
-
_context14.next = 18;
|
|
617
|
-
return _context14.t0.nameClaimTx.call(_context14.t0, _context14.t7);
|
|
618
|
-
|
|
619
|
-
case 18:
|
|
620
|
-
claimTx = _context14.sent;
|
|
621
|
-
_context14.next = 21;
|
|
622
|
-
return this.send(claimTx, opt);
|
|
623
|
-
|
|
624
|
-
case 21:
|
|
625
|
-
result = _context14.sent;
|
|
626
|
-
|
|
627
|
-
if (isAuctionName(name)) {
|
|
628
|
-
_context14.next = 32;
|
|
629
|
-
break;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
if (!opt.waitMined) {
|
|
633
|
-
_context14.next = 29;
|
|
634
|
-
break;
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
_context14.next = 26;
|
|
638
|
-
return this.aensQuery(name, opt);
|
|
639
|
-
|
|
640
|
-
case 26:
|
|
641
|
-
_context14.t8 = _context14.sent;
|
|
642
|
-
_context14.next = 30;
|
|
643
|
-
break;
|
|
644
|
-
|
|
645
|
-
case 29:
|
|
646
|
-
_context14.t8 = {};
|
|
647
|
-
|
|
648
|
-
case 30:
|
|
649
|
-
nameInter = _context14.t8;
|
|
650
|
-
return _context14.abrupt("return", _Object$assign(result, nameInter));
|
|
651
|
-
|
|
652
|
-
case 32:
|
|
653
|
-
return _context14.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
654
|
-
nameFee: opt.nameFee
|
|
655
|
-
}));
|
|
656
|
-
|
|
657
|
-
case 33:
|
|
658
|
-
case "end":
|
|
659
|
-
return _context14.stop();
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}, _callee9, this);
|
|
663
|
-
}));
|
|
664
|
-
return _claim.apply(this, arguments);
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
function preclaim(_x9) {
|
|
668
|
-
return _preclaim.apply(this, arguments);
|
|
669
|
-
}
|
|
670
|
-
/**
|
|
671
|
-
* Bid to name auction
|
|
672
|
-
* @instance
|
|
673
|
-
* @function
|
|
674
|
-
* @category async
|
|
675
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
676
|
-
* @param {String} name Domain name
|
|
677
|
-
* @param {String|Number} nameFee Name fee (bid fee)
|
|
678
|
-
* @param {Object} [options={}]
|
|
679
|
-
* @param {String|Object} [options.onAccount] onAccount Make operation on specific account from sdk(you pass publickKey) or
|
|
680
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
681
|
-
* @param {Number|String|BigNumber} [options.fee] fee
|
|
682
|
-
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
683
|
-
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
684
|
-
* @return {Promise<Object>} Transaction result
|
|
685
|
-
* @example
|
|
686
|
-
* const name = 'test.chain'
|
|
687
|
-
* const bidFee = computeBidFee(name, startFee, incrementPercentage)
|
|
688
|
-
*
|
|
689
|
-
* await sdkInstance.aensBid(name, 213109412839123, { ttl, fee, nonce })
|
|
690
|
-
*/
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
function _preclaim() {
|
|
694
|
-
_preclaim = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(name) {
|
|
695
|
-
var _this2 = this;
|
|
696
|
-
|
|
697
|
-
var options,
|
|
698
|
-
opt,
|
|
699
|
-
_salt,
|
|
700
|
-
height,
|
|
701
|
-
commitmentId,
|
|
702
|
-
preclaimTx,
|
|
703
|
-
result,
|
|
704
|
-
_args10 = arguments;
|
|
705
|
-
|
|
706
|
-
return _regeneratorRuntime.wrap(function _callee10$(_context15) {
|
|
707
|
-
while (1) {
|
|
708
|
-
switch (_context15.prev = _context15.next) {
|
|
709
|
-
case 0:
|
|
710
|
-
options = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
|
|
711
|
-
ensureNameValid(name);
|
|
712
|
-
opt = _merge(this.Ae.defaults, options);
|
|
713
|
-
_salt = salt();
|
|
714
|
-
_context15.next = 6;
|
|
715
|
-
return this.height();
|
|
716
|
-
|
|
717
|
-
case 6:
|
|
718
|
-
height = _context15.sent;
|
|
719
|
-
commitmentId = commitmentHash(name, _salt);
|
|
720
|
-
_context15.t0 = this;
|
|
721
|
-
_context15.t1 = _merge;
|
|
722
|
-
_context15.t2 = opt;
|
|
723
|
-
_context15.next = 13;
|
|
724
|
-
return this.address(opt);
|
|
725
|
-
|
|
726
|
-
case 13:
|
|
727
|
-
_context15.t3 = _context15.sent;
|
|
728
|
-
_context15.t4 = commitmentId;
|
|
729
|
-
_context15.t5 = {
|
|
730
|
-
accountId: _context15.t3,
|
|
731
|
-
commitmentId: _context15.t4
|
|
732
|
-
};
|
|
733
|
-
_context15.t6 = (0, _context15.t1)(_context15.t2, _context15.t5);
|
|
734
|
-
_context15.next = 19;
|
|
735
|
-
return _context15.t0.namePreclaimTx.call(_context15.t0, _context15.t6);
|
|
736
|
-
|
|
737
|
-
case 19:
|
|
738
|
-
preclaimTx = _context15.sent;
|
|
739
|
-
_context15.next = 22;
|
|
740
|
-
return this.send(preclaimTx, opt);
|
|
741
|
-
|
|
742
|
-
case 22:
|
|
743
|
-
result = _context15.sent;
|
|
744
|
-
return _context15.abrupt("return", _Object$freeze(_objectSpread(_objectSpread({}, result), {}, {
|
|
745
|
-
height: height,
|
|
746
|
-
claim: function claim(options) {
|
|
747
|
-
return _this2.aensClaim(name, _salt, _objectSpread(_objectSpread({}, options), {}, {
|
|
748
|
-
onAccount: opt.onAccount
|
|
749
|
-
}));
|
|
750
|
-
},
|
|
751
|
-
salt: _salt,
|
|
752
|
-
commitmentId: commitmentId
|
|
753
|
-
})));
|
|
754
|
-
|
|
755
|
-
case 24:
|
|
756
|
-
case "end":
|
|
757
|
-
return _context15.stop();
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
}, _callee10, this);
|
|
761
|
-
}));
|
|
762
|
-
return _preclaim.apply(this, arguments);
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
function bid(_x10) {
|
|
766
|
-
return _bid.apply(this, arguments);
|
|
767
|
-
}
|
|
768
|
-
/**
|
|
769
|
-
* Aens Stamp
|
|
770
|
-
*
|
|
771
|
-
* Aens provides name-system related methods atop
|
|
772
|
-
* {@link module:@aeternity/aepp-sdk/es/ae--Ae} clients.
|
|
773
|
-
* @function
|
|
774
|
-
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
775
|
-
* @rtype Stamp
|
|
776
|
-
* @param {Object} [options={}] - Initializer object
|
|
777
|
-
* @return {Object} Aens instance
|
|
778
|
-
*/
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
function _bid() {
|
|
782
|
-
_bid = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(name) {
|
|
783
|
-
var nameFee,
|
|
784
|
-
options,
|
|
785
|
-
_args11 = arguments;
|
|
786
|
-
return _regeneratorRuntime.wrap(function _callee11$(_context16) {
|
|
787
|
-
while (1) {
|
|
788
|
-
switch (_context16.prev = _context16.next) {
|
|
789
|
-
case 0:
|
|
790
|
-
nameFee = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : NAME_FEE;
|
|
791
|
-
options = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
|
|
792
|
-
return _context16.abrupt("return", this.aensClaim(name, 0, _objectSpread(_objectSpread({}, options), {}, {
|
|
793
|
-
nameFee: nameFee,
|
|
794
|
-
vsn: 2
|
|
795
|
-
})));
|
|
796
|
-
|
|
797
|
-
case 3:
|
|
798
|
-
case "end":
|
|
799
|
-
return _context16.stop();
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
}, _callee11, this);
|
|
803
|
-
}));
|
|
804
|
-
return _bid.apply(this, arguments);
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
var Aens = Ae.compose({
|
|
808
|
-
methods: {
|
|
809
|
-
aensQuery: query,
|
|
810
|
-
aensPreclaim: preclaim,
|
|
811
|
-
aensClaim: claim,
|
|
812
|
-
aensUpdate: update,
|
|
813
|
-
aensTransfer: transfer,
|
|
814
|
-
aensRevoke: revoke,
|
|
815
|
-
aensBid: bid
|
|
816
|
-
},
|
|
817
|
-
deepProps: {
|
|
818
|
-
Ae: {
|
|
819
|
-
defaults: {
|
|
820
|
-
clientTtl: CLIENT_TTL,
|
|
821
|
-
nameTtl: NAME_TTL,
|
|
822
|
-
// aec_governance:name_claim_max_expiration() => 50000
|
|
823
|
-
nameFee: NAME_FEE
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
});
|
|
828
|
-
export default Aens;
|
|
829
|
-
//# sourceMappingURL=aens.js.map
|