@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/src/account/multiple.js
CHANGED
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
* @export AccountMultiple
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import * as R from 'ramda'
|
|
25
24
|
import AsyncInit from '../utils/async-init'
|
|
26
25
|
import MemoryAccount from './memory'
|
|
27
|
-
import {
|
|
26
|
+
import { decode } from '../tx/builder/helpers'
|
|
28
27
|
import AccountBase, { isAccountBase } from './base'
|
|
29
28
|
|
|
30
29
|
/**
|
|
@@ -42,7 +41,9 @@ import AccountBase, { isAccountBase } from './base'
|
|
|
42
41
|
* @param {String} [options.address] - Address of account to select
|
|
43
42
|
* @return {Object} AccountMultiple instance
|
|
44
43
|
* @example
|
|
45
|
-
* const accounts = await AccountMultiple({
|
|
44
|
+
* const accounts = await AccountMultiple({
|
|
45
|
+
* accounts: [MemoryAccount({ keypair: 'keypair_object' })]
|
|
46
|
+
* })
|
|
46
47
|
* await accounts.addAccount(account, { select: true }) // Add account and make it selected
|
|
47
48
|
* accounts.removeAccount(address) // Remove account
|
|
48
49
|
* accounts.selectAccount(address) // Select account
|
|
@@ -50,10 +51,11 @@ import AccountBase, { isAccountBase } from './base'
|
|
|
50
51
|
*/
|
|
51
52
|
export default AccountBase.compose(AsyncInit, {
|
|
52
53
|
async init ({ accounts = [], address }) {
|
|
53
|
-
this.accounts =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
this.accounts = Object.fromEntries(await Promise.all(
|
|
55
|
+
accounts.map(async a => [await a.address(), a])
|
|
56
|
+
))
|
|
57
|
+
address = address || Object.keys(this.accounts)[0]
|
|
58
|
+
if (address) this.selectAccount(address)
|
|
57
59
|
},
|
|
58
60
|
props: {
|
|
59
61
|
accounts: {}
|
|
@@ -122,26 +124,30 @@ export default AccountBase.compose(AsyncInit, {
|
|
|
122
124
|
* @example selectAccount('ak_xxxxxxxx')
|
|
123
125
|
*/
|
|
124
126
|
selectAccount (address) {
|
|
125
|
-
|
|
127
|
+
decode(address, 'ak')
|
|
126
128
|
if (!this.accounts[address]) throw new Error(`Account for ${address} not available`)
|
|
127
129
|
this.selectedAddress = address
|
|
128
130
|
},
|
|
129
131
|
/**
|
|
130
132
|
* Resolves an account
|
|
131
|
-
* @param account
|
|
133
|
+
* @param account account address (should exist in sdk instance), MemoryAccount or keypair
|
|
132
134
|
* @returns {AccountBase}
|
|
133
135
|
* @private
|
|
134
136
|
*/
|
|
135
137
|
_resolveAccount (account) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
138
|
+
if (account === null) {
|
|
139
|
+
throw new Error('No account or wallet configured')
|
|
140
|
+
} else {
|
|
141
|
+
switch (typeof account) {
|
|
142
|
+
case 'string':
|
|
143
|
+
decode(account, 'ak')
|
|
144
|
+
if (!this.accounts[account]) throw new Error(`Account for ${account} not available`)
|
|
145
|
+
return this.accounts[account]
|
|
146
|
+
case 'object':
|
|
147
|
+
return isAccountBase(account) ? account : MemoryAccount({ keypair: account })
|
|
148
|
+
default:
|
|
149
|
+
throw new Error(`Unknown account type: ${typeof account} (account: ${account})`)
|
|
150
|
+
}
|
|
145
151
|
}
|
|
146
152
|
}
|
|
147
153
|
}
|
package/src/ae/aens.js
CHANGED
|
@@ -26,15 +26,9 @@
|
|
|
26
26
|
* @example import { Aens } from '@aeternity/aepp-sdk'
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
import * as R from 'ramda'
|
|
30
29
|
import { salt } from '../utils/crypto'
|
|
31
30
|
import {
|
|
32
|
-
commitmentHash,
|
|
33
|
-
ensureNameValid,
|
|
34
|
-
getMinimumNameFee,
|
|
35
|
-
classify,
|
|
36
|
-
isAuctionName,
|
|
37
|
-
validatePointers, encode, produceNameId
|
|
31
|
+
commitmentHash, ensureNameValid, getMinimumNameFee, isAuctionName, encode, produceNameId
|
|
38
32
|
} from '../tx/builder/helpers'
|
|
39
33
|
import Ae from './'
|
|
40
34
|
import { CLIENT_TTL, NAME_FEE, NAME_TTL } from '../tx/builder/schema'
|
|
@@ -47,11 +41,11 @@ import { CLIENT_TTL, NAME_FEE, NAME_TTL } from '../tx/builder/schema'
|
|
|
47
41
|
* @category async
|
|
48
42
|
* @param {String} name Name hash
|
|
49
43
|
* @param {Object} [options={}] options
|
|
50
|
-
* @param {
|
|
51
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
52
|
-
* @param {
|
|
53
|
-
* @param {
|
|
54
|
-
* @param {
|
|
44
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
45
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
46
|
+
* @param {Number|String|BigNumber} [options.fee] fee
|
|
47
|
+
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
48
|
+
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
55
49
|
* @return {Promise<Object>} Transaction result
|
|
56
50
|
* @example
|
|
57
51
|
* const name = 'test.chain'
|
|
@@ -63,12 +57,13 @@ import { CLIENT_TTL, NAME_FEE, NAME_TTL } from '../tx/builder/schema'
|
|
|
63
57
|
*/
|
|
64
58
|
async function revoke (name, options = {}) {
|
|
65
59
|
ensureNameValid(name)
|
|
66
|
-
const opt =
|
|
60
|
+
const opt = { ...this.Ae.defaults, ...options }
|
|
67
61
|
|
|
68
|
-
const nameRevokeTx = await this.nameRevokeTx(
|
|
62
|
+
const nameRevokeTx = await this.nameRevokeTx({
|
|
63
|
+
...opt,
|
|
69
64
|
nameId: produceNameId(name),
|
|
70
65
|
accountId: await this.address(opt)
|
|
71
|
-
})
|
|
66
|
+
})
|
|
72
67
|
|
|
73
68
|
return this.send(nameRevokeTx, opt)
|
|
74
69
|
}
|
|
@@ -80,16 +75,19 @@ async function revoke (name, options = {}) {
|
|
|
80
75
|
* @category async
|
|
81
76
|
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
82
77
|
* @param {String} name AENS name
|
|
83
|
-
* @param {
|
|
78
|
+
* @param {Object.<string, string>} pointers Map of pointer keys to corresponding addresses
|
|
84
79
|
* @param {Object} [options={}]
|
|
85
|
-
* @param {Boolean} [options.extendPointers
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* @param {
|
|
90
|
-
* @param {
|
|
91
|
-
* @param {
|
|
92
|
-
* @param {
|
|
80
|
+
* @param {Boolean} [options.extendPointers] Get the pointers from the node and merge with provided
|
|
81
|
+
* ones. Pointers with the same type will be overwritten
|
|
82
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you
|
|
83
|
+
* pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
84
|
+
* @param {Number|String|BigNumber} [options.fee] fee
|
|
85
|
+
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
86
|
+
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
87
|
+
* @param {Number|String|BigNumber} [options.nameTtl=50000] Name ttl represented in number of
|
|
88
|
+
* blocks (Max value is 50000 blocks)
|
|
89
|
+
* @param {Number|String|BigNumber} [options.clientTtl=84600] a suggestion as to how long any
|
|
90
|
+
* clients should cache this information
|
|
93
91
|
* @return {Promise<Object>}
|
|
94
92
|
* @throws Invalid pointer array error
|
|
95
93
|
* @example
|
|
@@ -99,22 +97,24 @@ async function revoke (name, options = {}) {
|
|
|
99
97
|
*
|
|
100
98
|
* await sdkInstance.aensUpdate(name, pointersArray, { nameTtl, ttl, fee, nonce, clientTtl })
|
|
101
99
|
* // or
|
|
102
|
-
* await nameObject.update(
|
|
100
|
+
* await nameObject.update(pointers, { nameTtl, ttl, fee, nonce, clientTtl })
|
|
103
101
|
*/
|
|
104
|
-
async function update (name, pointers =
|
|
102
|
+
async function update (name, pointers = {}, options = {}) {
|
|
105
103
|
ensureNameValid(name)
|
|
106
|
-
const opt =
|
|
107
|
-
|
|
104
|
+
const opt = { ...this.Ae.defaults, ...options }
|
|
105
|
+
const allPointers = {
|
|
106
|
+
...options.extendPointers && Object.fromEntries(
|
|
107
|
+
(await this.getName(name)).pointers.map(({ key, id }) => [key, id])
|
|
108
|
+
),
|
|
109
|
+
...pointers
|
|
110
|
+
}
|
|
108
111
|
|
|
109
|
-
|
|
110
|
-
...
|
|
111
|
-
...pointers.map(p => R.fromPairs([['id', p], ['key', classify(p)]]))
|
|
112
|
-
].reduce((acc, el) => [...acc.filter(p => p.key !== el.key), el], [])
|
|
113
|
-
const nameUpdateTx = await this.nameUpdateTx(R.merge(opt, {
|
|
112
|
+
const nameUpdateTx = await this.nameUpdateTx({
|
|
113
|
+
...opt,
|
|
114
114
|
nameId: produceNameId(name),
|
|
115
115
|
accountId: await this.address(opt),
|
|
116
|
-
pointers
|
|
117
|
-
})
|
|
116
|
+
pointers: Object.entries(allPointers).map(([key, id]) => ({ key, id }))
|
|
117
|
+
})
|
|
118
118
|
|
|
119
119
|
return this.send(nameUpdateTx, opt)
|
|
120
120
|
}
|
|
@@ -128,11 +128,11 @@ async function update (name, pointers = [], options = { extendPointers: false })
|
|
|
128
128
|
* @param {String} name AENS name
|
|
129
129
|
* @param {String} account Recipient account publick key
|
|
130
130
|
* @param {Object} [options={}]
|
|
131
|
-
* @param {
|
|
132
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
133
|
-
* @param {
|
|
134
|
-
* @param {
|
|
135
|
-
* @param {
|
|
131
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
132
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
133
|
+
* @param {Number|String|BigNumber} [options.fee] fee
|
|
134
|
+
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
135
|
+
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
136
136
|
* @return {Promise<Object>} Transaction result
|
|
137
137
|
* @example
|
|
138
138
|
* const name = 'test.chain'
|
|
@@ -145,13 +145,14 @@ async function update (name, pointers = [], options = { extendPointers: false })
|
|
|
145
145
|
*/
|
|
146
146
|
async function transfer (name, account, options = {}) {
|
|
147
147
|
ensureNameValid(name)
|
|
148
|
-
const opt =
|
|
148
|
+
const opt = { ...this.Ae.defaults, ...options }
|
|
149
149
|
|
|
150
|
-
const nameTransferTx = await this.nameTransferTx(
|
|
150
|
+
const nameTransferTx = await this.nameTransferTx({
|
|
151
|
+
...opt,
|
|
151
152
|
nameId: produceNameId(name),
|
|
152
153
|
accountId: await this.address(opt),
|
|
153
154
|
recipientId: account
|
|
154
|
-
})
|
|
155
|
+
})
|
|
155
156
|
|
|
156
157
|
return this.send(nameTransferTx, opt)
|
|
157
158
|
}
|
|
@@ -184,25 +185,25 @@ async function query (name, opt = {}) {
|
|
|
184
185
|
|
|
185
186
|
return Object.freeze(Object.assign(o, {
|
|
186
187
|
pointers: o.pointers || [],
|
|
187
|
-
update: async (pointers
|
|
188
|
+
update: async (pointers, options = {}) => {
|
|
188
189
|
return {
|
|
189
|
-
...(await this.aensUpdate(name, pointers,
|
|
190
|
+
...(await this.aensUpdate(name, pointers, { ...opt, ...options })),
|
|
190
191
|
...(await this.aensQuery(name))
|
|
191
192
|
}
|
|
192
193
|
},
|
|
193
194
|
transfer: async (account, options = {}) => {
|
|
194
195
|
return {
|
|
195
|
-
...(await this.aensTransfer(name, account,
|
|
196
|
+
...(await this.aensTransfer(name, account, { ...opt, ...options })),
|
|
196
197
|
...(await this.aensQuery(name))
|
|
197
198
|
}
|
|
198
199
|
},
|
|
199
|
-
revoke: async (options = {}) => this.aensRevoke(name,
|
|
200
|
+
revoke: async (options = {}) => this.aensRevoke(name, { ...opt, ...options }),
|
|
200
201
|
extendTtl: async (nameTtl = NAME_TTL, options = {}) => {
|
|
201
202
|
if (!nameTtl || typeof nameTtl !== 'number' || nameTtl > NAME_TTL) throw new Error('Ttl must be an number and less then 180000 blocks')
|
|
202
203
|
|
|
203
204
|
return {
|
|
204
|
-
...
|
|
205
|
-
...
|
|
205
|
+
...await this.aensUpdate(name, {}, { ...opt, ...options, nameTtl, extendPointers: true }),
|
|
206
|
+
...await this.aensQuery(name)
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
}))
|
|
@@ -218,8 +219,8 @@ async function query (name, opt = {}) {
|
|
|
218
219
|
* @param {String} name
|
|
219
220
|
* @param {Number} salt Salt from pre-claim, or 0 if it's a bid
|
|
220
221
|
* @param {Object} [options] options
|
|
221
|
-
* @param {String|Object} [options.onAccount]
|
|
222
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
222
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
223
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
223
224
|
* @param {Number|String|BigNumber} [options.fee] fee
|
|
224
225
|
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
225
226
|
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
@@ -233,18 +234,19 @@ async function query (name, opt = {}) {
|
|
|
233
234
|
*/
|
|
234
235
|
async function claim (name, salt, options) {
|
|
235
236
|
ensureNameValid(name)
|
|
236
|
-
const opt =
|
|
237
|
+
const opt = { ...this.Ae.defaults, ...options }
|
|
237
238
|
|
|
238
239
|
const minNameFee = getMinimumNameFee(name)
|
|
239
240
|
if (opt.nameFee !== this.Ae.defaults.nameFee && minNameFee.gt(opt.nameFee)) {
|
|
240
241
|
throw new Error(`the provided fee ${opt.nameFee} is not enough to execute the claim, required: ${minNameFee}`)
|
|
241
242
|
}
|
|
242
243
|
opt.nameFee = opt.nameFee !== this.Ae.defaults.nameFee ? opt.nameFee : minNameFee
|
|
243
|
-
const claimTx = await this.nameClaimTx(
|
|
244
|
+
const claimTx = await this.nameClaimTx({
|
|
245
|
+
...opt,
|
|
244
246
|
accountId: await this.address(opt),
|
|
245
247
|
nameSalt: salt,
|
|
246
248
|
name: encode(name, 'nm')
|
|
247
|
-
})
|
|
249
|
+
})
|
|
248
250
|
|
|
249
251
|
const result = await this.send(claimTx, opt)
|
|
250
252
|
if (!isAuctionName(name)) {
|
|
@@ -262,8 +264,8 @@ async function claim (name, salt, options) {
|
|
|
262
264
|
* @alias module:@aeternity/aepp-sdk/es/ae/aens
|
|
263
265
|
* @param {String} name
|
|
264
266
|
* @param {Object} [options={}]
|
|
265
|
-
* @param {String|Object} [options.onAccount]
|
|
266
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
267
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
268
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
267
269
|
* @param {Number|String|BigNumber} [options.fee] fee
|
|
268
270
|
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
269
271
|
* @param {Number|String|BigNumber} [options.nonce] nonce
|
|
@@ -282,15 +284,16 @@ async function claim (name, salt, options) {
|
|
|
282
284
|
*/
|
|
283
285
|
async function preclaim (name, options = {}) {
|
|
284
286
|
ensureNameValid(name)
|
|
285
|
-
const opt =
|
|
287
|
+
const opt = { ...this.Ae.defaults, ...options }
|
|
286
288
|
const _salt = salt()
|
|
287
289
|
const height = await this.height()
|
|
288
290
|
const commitmentId = commitmentHash(name, _salt)
|
|
289
291
|
|
|
290
|
-
const preclaimTx = await this.namePreclaimTx(
|
|
292
|
+
const preclaimTx = await this.namePreclaimTx({
|
|
293
|
+
...opt,
|
|
291
294
|
accountId: await this.address(opt),
|
|
292
295
|
commitmentId
|
|
293
|
-
})
|
|
296
|
+
})
|
|
294
297
|
|
|
295
298
|
const result = await this.send(preclaimTx, opt)
|
|
296
299
|
|
|
@@ -312,8 +315,8 @@ async function preclaim (name, options = {}) {
|
|
|
312
315
|
* @param {String} name Domain name
|
|
313
316
|
* @param {String|Number} nameFee Name fee (bid fee)
|
|
314
317
|
* @param {Object} [options={}]
|
|
315
|
-
* @param {String|Object} [options.onAccount]
|
|
316
|
-
* using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
318
|
+
* @param {String|Object} [options.onAccount] Make operation on specific account from sdk (you pass
|
|
319
|
+
* publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
|
|
317
320
|
* @param {Number|String|BigNumber} [options.fee] fee
|
|
318
321
|
* @param {Number|String|BigNumber} [options.ttl] ttl
|
|
319
322
|
* @param {Number|String|BigNumber} [options.nonce] nonce
|