@aeternity/aepp-sdk 8.2.1 → 10.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/CHANGELOG.md +216 -337
- package/README.md +16 -9
- package/dist/aepp-sdk.browser-script.js +1 -1
- package/dist/aepp-sdk.browser-script.js.LICENSE.txt +0 -9
- 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.js +36 -120
- package/es/account/base.js.map +1 -1
- package/es/account/memory.js +17 -19
- package/es/account/memory.js.map +1 -1
- package/es/account/multiple.js +79 -156
- package/es/account/multiple.js.map +1 -1
- package/es/ae/aens.js +205 -626
- package/es/ae/aens.js.map +1 -1
- package/es/ae/contract.js +114 -918
- package/es/ae/contract.js.map +1 -1
- package/es/ae/index.js +90 -250
- package/es/ae/index.js.map +1 -1
- package/es/ae/oracle.js +136 -504
- package/es/ae/oracle.js.map +1 -1
- package/es/ae/universal.js.map +1 -1
- package/es/chain/index.js +12 -27
- package/es/chain/index.js.map +1 -1
- package/es/chain/node.js +289 -1020
- package/es/chain/node.js.map +1 -1
- package/es/channel/handlers.js +597 -1086
- package/es/channel/handlers.js.map +1 -1
- package/es/channel/index.js +238 -465
- package/es/channel/index.js.map +1 -1
- package/es/channel/internal.js +129 -301
- package/es/channel/internal.js.map +1 -1
- package/es/contract/aci/index.js +328 -495
- package/es/contract/aci/index.js.map +1 -1
- package/es/contract/aci/transformation.js +35 -711
- package/es/contract/aci/transformation.js.map +1 -1
- package/es/contract/compiler.js +131 -203
- package/es/contract/compiler.js.map +1 -1
- package/es/contract/ga/helpers.js +17 -122
- package/es/contract/ga/helpers.js.map +1 -1
- package/es/contract/ga/index.js +108 -249
- package/es/contract/ga/index.js.map +1 -1
- package/es/contract/index.js +7 -3
- package/es/contract/index.js.map +1 -1
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/node-pool/index.js +57 -74
- package/es/node-pool/index.js.map +1 -1
- package/es/node.js +65 -161
- package/es/node.js.map +1 -1
- package/es/other.d.ts +1 -1
- package/es/tx/builder/helpers.js +62 -115
- package/es/tx/builder/helpers.js.map +1 -1
- package/es/tx/builder/index.js +218 -309
- package/es/tx/builder/index.js.map +1 -1
- package/es/tx/builder/schema.js +586 -573
- package/es/tx/builder/schema.js.map +1 -1
- package/es/tx/index.js +102 -13
- package/es/tx/index.js.map +1 -1
- package/es/tx/tx-object.js +114 -138
- package/es/tx/tx-object.js.map +1 -1
- package/es/tx/tx.js +810 -1586
- package/es/tx/tx.js.map +1 -1
- package/es/tx/validator.js +191 -426
- package/es/tx/validator.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js +20 -23
- package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +53 -80
- package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +1 -1
- package/es/utils/aepp-wallet-communication/connection/index.js +2 -1
- package/es/utils/aepp-wallet-communication/connection/index.js.map +1 -1
- package/es/utils/aepp-wallet-communication/content-script-bridge.js +24 -19
- package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +1 -1
- package/es/utils/aepp-wallet-communication/helpers.js +60 -105
- package/es/utils/aepp-wallet-communication/helpers.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +191 -514
- package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +78 -93
- package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +1 -1
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +381 -613
- package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +1 -1
- package/es/utils/aepp-wallet-communication/schema.js +43 -39
- package/es/utils/aepp-wallet-communication/schema.js.map +1 -1
- package/es/utils/aepp-wallet-communication/wallet-detector.js +32 -58
- package/es/utils/aepp-wallet-communication/wallet-detector.js.map +1 -1
- package/es/utils/amount-formatter.js +41 -61
- package/es/utils/amount-formatter.js.map +1 -1
- package/es/utils/async-init.js +28 -64
- package/es/utils/async-init.js.map +1 -1
- package/es/utils/bignumber.js +3 -11
- package/es/utils/bignumber.js.map +1 -1
- package/es/utils/bytes.js +5 -9
- package/es/utils/bytes.js.map +1 -1
- package/es/utils/crypto.js +41 -106
- package/es/utils/crypto.js.map +1 -1
- package/es/utils/hd-wallet.js +45 -81
- package/es/utils/hd-wallet.js.map +1 -1
- package/es/utils/json-big.js +16 -49
- package/es/utils/json-big.js.map +1 -1
- package/es/utils/keystore.js +81 -246
- package/es/utils/keystore.js.map +1 -1
- package/es/utils/mptree.js +88 -134
- package/es/utils/mptree.js.map +1 -1
- package/es/utils/other.js +10 -60
- package/es/utils/other.js.map +1 -1
- package/es/utils/semver-satisfies.js +9 -28
- package/es/utils/semver-satisfies.js.map +1 -1
- package/es/utils/string.js +4 -13
- package/es/utils/string.js.map +1 -1
- package/es/utils/swagger.js +87 -224
- package/es/utils/swagger.js.map +1 -1
- package/package.json +51 -44
- package/src/account/base.js +11 -10
- package/src/account/multiple.js +24 -18
- package/src/ae/aens.js +64 -61
- package/src/ae/contract.js +71 -248
- package/src/ae/index.js +34 -9
- package/src/ae/oracle.js +30 -22
- package/src/ae/universal.js +3 -1
- package/src/chain/index.js +10 -16
- package/src/chain/node.js +38 -38
- package/src/channel/handlers.js +10 -4
- package/src/channel/index.js +44 -20
- package/src/contract/aci/index.js +234 -112
- package/src/contract/aci/transformation.js +30 -422
- package/src/contract/compiler.js +50 -5
- package/src/contract/ga/helpers.js +6 -14
- package/src/contract/ga/index.js +28 -28
- package/src/contract/index.js +6 -2
- package/src/index.js +4 -4
- package/src/node-pool/index.js +24 -13
- package/src/node.js +29 -30
- package/src/tx/builder/helpers.js +31 -56
- package/src/tx/builder/index.js +67 -28
- package/src/tx/builder/schema.js +79 -121
- package/src/tx/index.js +101 -12
- package/src/tx/tx-object.js +25 -8
- package/src/tx/tx.js +229 -150
- package/src/tx/validator.js +134 -202
- package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +3 -2
- package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +25 -7
- package/src/utils/aepp-wallet-communication/connection/index.js +2 -1
- package/src/utils/aepp-wallet-communication/content-script-bridge.js +10 -4
- package/src/utils/aepp-wallet-communication/helpers.js +4 -2
- package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +33 -12
- package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +9 -5
- package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +59 -29
- package/src/utils/aepp-wallet-communication/schema.js +1 -3
- package/src/utils/aepp-wallet-communication/wallet-detector.js +4 -1
- package/src/utils/amount-formatter.ts +1 -1
- package/src/utils/bignumber.ts +2 -1
- package/src/utils/crypto.js +4 -68
- package/src/utils/keystore.js +10 -2
- package/src/utils/other.ts +1 -1
- package/src/utils/semver-satisfies.ts +1 -1
- package/src/utils/swagger.js +22 -10
- package/src/contract/aci/helpers.js +0 -140
package/es/ae/aens.js
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
*/
|
|
10
17
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import
|
|
20
|
-
|
|
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";
|
|
18
|
+
/**
|
|
19
|
+
* Aens module - routines to interact with the æternity naming system
|
|
20
|
+
*
|
|
21
|
+
* The high-level description of the naming system is
|
|
22
|
+
* https://github.com/aeternity/protocol/blob/master/AENS.md in the protocol
|
|
23
|
+
* repository.
|
|
24
|
+
* @module @aeternity/aepp-sdk/es/ae/aens
|
|
25
|
+
* @export Aens
|
|
26
|
+
* @example import { Aens } from '@aeternity/aepp-sdk'
|
|
27
|
+
*/
|
|
25
28
|
import { salt } from '../utils/crypto';
|
|
26
|
-
import { commitmentHash, ensureNameValid, getMinimumNameFee,
|
|
29
|
+
import { commitmentHash, ensureNameValid, getMinimumNameFee, isAuctionName, encode, produceNameId } from '../tx/builder/helpers';
|
|
27
30
|
import Ae from './';
|
|
28
31
|
import { CLIENT_TTL, NAME_FEE, NAME_TTL } from '../tx/builder/schema';
|
|
29
32
|
/**
|
|
@@ -34,11 +37,11 @@ import { CLIENT_TTL, NAME_FEE, NAME_TTL } from '../tx/builder/schema';
|
|
|
34
37
|
* @category async
|
|
35
38
|
* @param {String} name Name hash
|
|
36
39
|
* @param {Object} [options={}] options
|
|
37
|
-
* @param {
|
|
38
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
39
|
-
* @param {
|
|
40
|
-
* @param {
|
|
41
|
-
* @param {
|
|
40
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
41
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
42
|
+
* @param {Number|String|BigNumber} [options.fee] fee
|
|
43
|
+
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
44
|
+
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
42
45
|
* @return {Promise<Object>} Transaction result
|
|
43
46
|
* @example
|
|
44
47
|
* const name = 'test.chain'
|
|
@@ -49,8 +52,17 @@ import { CLIENT_TTL, NAME_FEE, NAME_TTL } from '../tx/builder/schema';
|
|
|
49
52
|
* await nameObject.revoke({ fee, ttl, nonce })
|
|
50
53
|
*/
|
|
51
54
|
|
|
52
|
-
function revoke(
|
|
53
|
-
|
|
55
|
+
async function revoke(name) {
|
|
56
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
57
|
+
ensureNameValid(name);
|
|
58
|
+
const opt = { ...this.Ae.defaults,
|
|
59
|
+
...options
|
|
60
|
+
};
|
|
61
|
+
const nameRevokeTx = await this.nameRevokeTx({ ...opt,
|
|
62
|
+
nameId: produceNameId(name),
|
|
63
|
+
accountId: await this.address(opt)
|
|
64
|
+
});
|
|
65
|
+
return this.send(nameRevokeTx, opt);
|
|
54
66
|
}
|
|
55
67
|
/**
|
|
56
68
|
* Update a name
|
|
@@ -59,16 +71,19 @@ function revoke(_x) {
|
|
|
59
71
|
* @category async
|
|
60
72
|
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
61
73
|
* @param {String} name AENS name
|
|
62
|
-
* @param {
|
|
74
|
+
* @param {Object.<string, string>} pointers Map of pointer keys to corresponding addresses
|
|
63
75
|
* @param {Object} [options={}]
|
|
64
|
-
* @param {Boolean} [options.extendPointers
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* @param {
|
|
69
|
-
* @param {
|
|
70
|
-
* @param {
|
|
71
|
-
* @param {
|
|
76
|
+
* @param {Boolean} [options.extendPointers] Get the pointers from the node and merge with provided
|
|
77
|
+
* ones. Pointers with the same type will be overwritten
|
|
78
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you
|
|
79
|
+
* pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
80
|
+
* @param {Number|String|BigNumber} [options.fee] fee
|
|
81
|
+
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
82
|
+
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
83
|
+
* @param {Number|String|BigNumber} [options.nameTtl=50000] Name ttl represented in number of
|
|
84
|
+
* blocks (Max value is 50000 blocks)
|
|
85
|
+
* @param {Number|String|BigNumber} [options.clientTtl=84600] a suggestion as to how long any
|
|
86
|
+
* clients should cache this information
|
|
72
87
|
* @return {Promise<Object>}
|
|
73
88
|
* @throws Invalid pointer array error
|
|
74
89
|
* @example
|
|
@@ -78,56 +93,38 @@ function revoke(_x) {
|
|
|
78
93
|
*
|
|
79
94
|
* await sdkInstance.aensUpdate(name, pointersArray, { nameTtl, ttl, fee, nonce, clientTtl })
|
|
80
95
|
* // or
|
|
81
|
-
* await nameObject.update(
|
|
96
|
+
* await nameObject.update(pointers, { nameTtl, ttl, fee, nonce, clientTtl })
|
|
82
97
|
*/
|
|
83
98
|
|
|
84
99
|
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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);
|
|
100
|
+
async function update(name) {
|
|
101
|
+
let pointers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
102
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
103
|
+
ensureNameValid(name);
|
|
104
|
+
const opt = { ...this.Ae.defaults,
|
|
105
|
+
...options
|
|
106
|
+
};
|
|
107
|
+
const allPointers = { ...(options.extendPointers && Object.fromEntries((await this.getName(name)).pointers.map(_ref => {
|
|
108
|
+
let {
|
|
109
|
+
key,
|
|
110
|
+
id
|
|
111
|
+
} = _ref;
|
|
112
|
+
return [key, id];
|
|
113
|
+
}))),
|
|
114
|
+
...pointers
|
|
115
|
+
};
|
|
116
|
+
const nameUpdateTx = await this.nameUpdateTx({ ...opt,
|
|
117
|
+
nameId: produceNameId(name),
|
|
118
|
+
accountId: await this.address(opt),
|
|
119
|
+
pointers: Object.entries(allPointers).map(_ref2 => {
|
|
120
|
+
let [key, id] = _ref2;
|
|
121
|
+
return {
|
|
122
|
+
key,
|
|
123
|
+
id
|
|
124
|
+
};
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
return this.send(nameUpdateTx, opt);
|
|
131
128
|
}
|
|
132
129
|
/**
|
|
133
130
|
* Transfer a domain to another account
|
|
@@ -138,11 +135,11 @@ function update(_x2) {
|
|
|
138
135
|
* @param {String} name AENS name
|
|
139
136
|
* @param {String} account Recipient account publick key
|
|
140
137
|
* @param {Object} [options={}]
|
|
141
|
-
* @param {
|
|
142
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
143
|
-
* @param {
|
|
144
|
-
* @param {
|
|
145
|
-
* @param {
|
|
138
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
139
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
140
|
+
* @param {Number|String|BigNumber} [options.fee] fee
|
|
141
|
+
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
142
|
+
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
146
143
|
* @return {Promise<Object>} Transaction result
|
|
147
144
|
* @example
|
|
148
145
|
* const name = 'test.chain'
|
|
@@ -155,104 +152,18 @@ function update(_x2) {
|
|
|
155
152
|
*/
|
|
156
153
|
|
|
157
154
|
|
|
158
|
-
function
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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);
|
|
155
|
+
async function transfer(name, account) {
|
|
156
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
157
|
+
ensureNameValid(name);
|
|
158
|
+
const opt = { ...this.Ae.defaults,
|
|
159
|
+
...options
|
|
160
|
+
};
|
|
161
|
+
const nameTransferTx = await this.nameTransferTx({ ...opt,
|
|
162
|
+
nameId: produceNameId(name),
|
|
163
|
+
accountId: await this.address(opt),
|
|
164
|
+
recipientId: account
|
|
165
|
+
});
|
|
166
|
+
return this.send(nameTransferTx, opt);
|
|
256
167
|
}
|
|
257
168
|
/**
|
|
258
169
|
* Query the AENS name info from the node
|
|
@@ -278,54 +189,49 @@ function transfer(_x3, _x4) {
|
|
|
278
189
|
*/
|
|
279
190
|
|
|
280
191
|
|
|
281
|
-
function
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
}
|
|
192
|
+
async function query(name) {
|
|
193
|
+
var _this = this;
|
|
194
|
+
|
|
195
|
+
let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
196
|
+
ensureNameValid(name);
|
|
197
|
+
const o = await this.getName(name);
|
|
198
|
+
return Object.freeze(Object.assign(o, {
|
|
199
|
+
pointers: o.pointers || [],
|
|
200
|
+
update: async function (pointers) {
|
|
201
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
202
|
+
return { ...(await _this.aensUpdate(name, pointers, { ...opt,
|
|
203
|
+
...options
|
|
204
|
+
})),
|
|
205
|
+
...(await _this.aensQuery(name))
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
transfer: async function (account) {
|
|
209
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
210
|
+
return { ...(await _this.aensTransfer(name, account, { ...opt,
|
|
211
|
+
...options
|
|
212
|
+
})),
|
|
213
|
+
...(await _this.aensQuery(name))
|
|
214
|
+
};
|
|
215
|
+
},
|
|
216
|
+
revoke: async function () {
|
|
217
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
218
|
+
return _this.aensRevoke(name, { ...opt,
|
|
219
|
+
...options
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
extendTtl: async function () {
|
|
223
|
+
let nameTtl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NAME_TTL;
|
|
224
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
225
|
+
if (!nameTtl || typeof nameTtl !== 'number' || nameTtl > NAME_TTL) throw new Error('Ttl must be an number and less then 180000 blocks');
|
|
226
|
+
return { ...(await _this.aensUpdate(name, {}, { ...opt,
|
|
227
|
+
...options,
|
|
228
|
+
nameTtl,
|
|
229
|
+
extendPointers: true
|
|
230
|
+
})),
|
|
231
|
+
...(await _this.aensQuery(name))
|
|
232
|
+
};
|
|
233
|
+
}
|
|
323
234
|
}));
|
|
324
|
-
return _transfer.apply(this, arguments);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function query(_x5) {
|
|
328
|
-
return _query.apply(this, arguments);
|
|
329
235
|
}
|
|
330
236
|
/**
|
|
331
237
|
* Claim a previously preclaimed registration. This can only be done after the
|
|
@@ -337,8 +243,8 @@ function query(_x5) {
|
|
|
337
243
|
* @param {String} name
|
|
338
244
|
* @param {Number} salt Salt from pre-claim, or 0 if it's a bid
|
|
339
245
|
* @param {Object} [options] options
|
|
340
|
-
* @param {String|Object} [options.onAccount]
|
|
341
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
246
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
247
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
342
248
|
* @param {Number|String|BigNumber} [options.fee] fee
|
|
343
249
|
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
344
250
|
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
@@ -352,201 +258,33 @@ function query(_x5) {
|
|
|
352
258
|
*/
|
|
353
259
|
|
|
354
260
|
|
|
355
|
-
function
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
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);
|
|
261
|
+
async function claim(name, salt, options) {
|
|
262
|
+
ensureNameValid(name);
|
|
263
|
+
const opt = { ...this.Ae.defaults,
|
|
264
|
+
...options
|
|
265
|
+
};
|
|
266
|
+
const minNameFee = getMinimumNameFee(name);
|
|
436
267
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
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
|
-
})));
|
|
268
|
+
if (opt.nameFee !== this.Ae.defaults.nameFee && minNameFee.gt(opt.nameFee)) {
|
|
269
|
+
throw new Error(`the provided fee ${opt.nameFee} is not enough to execute the claim, required: ${minNameFee}`);
|
|
270
|
+
}
|
|
537
271
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
272
|
+
opt.nameFee = opt.nameFee !== this.Ae.defaults.nameFee ? opt.nameFee : minNameFee;
|
|
273
|
+
const claimTx = await this.nameClaimTx({ ...opt,
|
|
274
|
+
accountId: await this.address(opt),
|
|
275
|
+
nameSalt: salt,
|
|
276
|
+
name: encode(name, 'nm')
|
|
277
|
+
});
|
|
278
|
+
const result = await this.send(claimTx, opt);
|
|
279
|
+
|
|
280
|
+
if (!isAuctionName(name)) {
|
|
281
|
+
const nameInter = opt.waitMined ? await this.aensQuery(name, opt) : {};
|
|
282
|
+
return Object.assign(result, nameInter);
|
|
283
|
+
}
|
|
547
284
|
|
|
548
|
-
|
|
549
|
-
|
|
285
|
+
return { ...result,
|
|
286
|
+
nameFee: opt.nameFee
|
|
287
|
+
};
|
|
550
288
|
}
|
|
551
289
|
/**
|
|
552
290
|
* Preclaim a name. Sends a hash of the name and a random salt to the node
|
|
@@ -556,8 +294,8 @@ function claim(_x6, _x7, _x8) {
|
|
|
556
294
|
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
557
295
|
* @param {String} name
|
|
558
296
|
* @param {Object} [options={}]
|
|
559
|
-
* @param {String|Object} [options.onAccount]
|
|
560
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
297
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
298
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
561
299
|
* @param {Number|String|BigNumber} [options.fee] fee
|
|
562
300
|
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
563
301
|
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
@@ -576,96 +314,30 @@ function claim(_x6, _x7, _x8) {
|
|
|
576
314
|
*/
|
|
577
315
|
|
|
578
316
|
|
|
579
|
-
function
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
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);
|
|
317
|
+
async function preclaim(name) {
|
|
318
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
319
|
+
ensureNameValid(name);
|
|
320
|
+
const opt = { ...this.Ae.defaults,
|
|
321
|
+
...options
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
const _salt = salt();
|
|
325
|
+
|
|
326
|
+
const height = await this.height();
|
|
327
|
+
const commitmentId = commitmentHash(name, _salt);
|
|
328
|
+
const preclaimTx = await this.namePreclaimTx({ ...opt,
|
|
329
|
+
accountId: await this.address(opt),
|
|
330
|
+
commitmentId
|
|
331
|
+
});
|
|
332
|
+
const result = await this.send(preclaimTx, opt);
|
|
333
|
+
return Object.freeze({ ...result,
|
|
334
|
+
height,
|
|
335
|
+
claim: options => this.aensClaim(name, _salt, { ...options,
|
|
336
|
+
onAccount: opt.onAccount
|
|
337
|
+
}),
|
|
338
|
+
salt: _salt,
|
|
339
|
+
commitmentId
|
|
340
|
+
});
|
|
669
341
|
}
|
|
670
342
|
/**
|
|
671
343
|
* Bid to name auction
|
|
@@ -676,8 +348,8 @@ function preclaim(_x9) {
|
|
|
676
348
|
* @param {String} name Domain name
|
|
677
349
|
* @param {String|Number} nameFee Name fee (bid fee)
|
|
678
350
|
* @param {Object} [options={}]
|
|
679
|
-
* @param {String|Object} [options.onAccount]
|
|
680
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
351
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
352
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
681
353
|
* @param {Number|String|BigNumber} [options.fee] fee
|
|
682
354
|
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
683
355
|
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
@@ -690,80 +362,13 @@ function preclaim(_x9) {
|
|
|
690
362
|
*/
|
|
691
363
|
|
|
692
364
|
|
|
693
|
-
function
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
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);
|
|
365
|
+
async function bid(name) {
|
|
366
|
+
let nameFee = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NAME_FEE;
|
|
367
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
368
|
+
return this.aensClaim(name, 0, { ...options,
|
|
369
|
+
nameFee,
|
|
370
|
+
vsn: 2
|
|
371
|
+
});
|
|
767
372
|
}
|
|
768
373
|
/**
|
|
769
374
|
* Aens Stamp
|
|
@@ -778,33 +383,7 @@ function bid(_x10) {
|
|
|
778
383
|
*/
|
|
779
384
|
|
|
780
385
|
|
|
781
|
-
|
|
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({
|
|
386
|
+
const Aens = Ae.compose({
|
|
808
387
|
methods: {
|
|
809
388
|
aensQuery: query,
|
|
810
389
|
aensPreclaim: preclaim,
|