From 885090073e93616809aec89046b859ec511715c6 Mon Sep 17 00:00:00 2001 From: naz_dou Date: Wed, 25 Sep 2019 12:57:46 +0300 Subject: [PATCH 1/7] feat(AENS): Add ability to spend by name --- es/ae/aens.js | 7 ++----- es/tx/builder/index.js | 4 ++++ es/tx/builder/schema.js | 12 ++++++------ test/integration/aens.js | 8 ++++++++ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/es/ae/aens.js b/es/ae/aens.js index 9419d5febb..76e8cbdf06 100644 --- a/es/ae/aens.js +++ b/es/ae/aens.js @@ -173,11 +173,8 @@ async function claim (name, salt, options = {}) { })) const result = await this.send(claimTx, opt) - - return { - ...result, - ...opt.waitMined && await this.aensQuery(name, opt) - } + const nameInter = this.Chain.defaults.waitMined ? await this.aensQuery(name, opt) : {} + return Object.assign(result, nameInter) } /** diff --git a/es/tx/builder/index.js b/es/tx/builder/index.js index beb2635232..1e32e77bfc 100644 --- a/es/tx/builder/index.js +++ b/es/tx/builder/index.js @@ -141,6 +141,10 @@ function validateField (value, key, type, prefix) { return assert((!isNaN(value) || BigNumber.isBigNumber(value)) && BigNumber(value).gte(0), { value, isMinusValue }) } case FIELD_TYPES.id: + if (Array.isArray(prefix)) { + const p = prefix.find(p => p === value.split('_')[0]) + return assert(p && PREFIX_ID_TAG[value.split('_')[0]], { value, prefix }) + } return assert(assertedType(value, prefix) && PREFIX_ID_TAG[value.split('_')[0]] && value.split('_')[0] === prefix, { value, prefix }) case FIELD_TYPES.binary: return assert(value.split('_')[0] === prefix, { prefix, value }) diff --git a/es/tx/builder/schema.js b/es/tx/builder/schema.js index 8ece8f1727..8febfc3c8d 100644 --- a/es/tx/builder/schema.js +++ b/es/tx/builder/schema.js @@ -374,14 +374,14 @@ const ACCOUNT_TX_2 = [ TX_FIELD('flags', FIELD_TYPES.int), TX_FIELD('nonce', FIELD_TYPES.int), TX_FIELD('balance', FIELD_TYPES.int), - TX_FIELD('gaContract', FIELD_TYPES.id, 'ct'), + TX_FIELD('gaContract', FIELD_TYPES.id, ['ct', 'nm']), TX_FIELD('gaAuthFun', FIELD_TYPES.binary, 'cb') ] const SPEND_TX = [ ...BASE_TX, TX_FIELD('senderId', FIELD_TYPES.id, 'ak'), - TX_FIELD('recipientId', FIELD_TYPES.id, 'ak'), + TX_FIELD('recipientId', FIELD_TYPES.id, ['ak', 'nm']), TX_FIELD('amount', FIELD_TYPES.int), TX_FIELD('fee', FIELD_TYPES.int), TX_FIELD('ttl', FIELD_TYPES.int), @@ -431,7 +431,7 @@ const NAME_TRANSFER_TX = [ TX_FIELD('accountId', FIELD_TYPES.id, 'ak'), TX_FIELD('nonce', FIELD_TYPES.int), TX_FIELD('nameId', FIELD_TYPES.id, 'nm'), - TX_FIELD('recipientId', FIELD_TYPES.id, 'ak'), + TX_FIELD('recipientId', FIELD_TYPES.id, ['ak', 'nm']), TX_FIELD('fee', FIELD_TYPES.int), TX_FIELD('ttl', FIELD_TYPES.int) ] @@ -501,7 +501,7 @@ const CONTRACT_CALL_TX = [ ...BASE_TX, TX_FIELD('callerId', FIELD_TYPES.id, 'ak'), TX_FIELD('nonce', FIELD_TYPES.int), - TX_FIELD('contractId', FIELD_TYPES.id, 'ct'), + TX_FIELD('contractId', FIELD_TYPES.id, ['ct', 'nm']), TX_FIELD('abiVersion', FIELD_TYPES.int), TX_FIELD('fee', FIELD_TYPES.int), TX_FIELD('ttl', FIELD_TYPES.int), @@ -541,7 +541,7 @@ const ORACLE_REGISTER_TX = [ const ORACLE_EXTEND_TX = [ ...BASE_TX, - TX_FIELD('oracleId', FIELD_TYPES.id, 'ok'), + TX_FIELD('oracleId', FIELD_TYPES.id, ['ok', 'nm']), TX_FIELD('nonce', FIELD_TYPES.int), TX_FIELD('oracleTtlType', FIELD_TYPES.int), TX_FIELD('oracleTtlValue', FIELD_TYPES.int), @@ -553,7 +553,7 @@ const ORACLE_QUERY_TX = [ ...BASE_TX, TX_FIELD('senderId', FIELD_TYPES.id, 'ak'), TX_FIELD('nonce', FIELD_TYPES.int), - TX_FIELD('oracleId', FIELD_TYPES.id, 'ok'), + TX_FIELD('oracleId', FIELD_TYPES.id, ['ok', 'nm']), TX_FIELD('query', FIELD_TYPES.string), TX_FIELD('queryFee', FIELD_TYPES.int), TX_FIELD('queryTtlType', FIELD_TYPES.int), diff --git a/test/integration/aens.js b/test/integration/aens.js index f88165b3c2..8ccdfa9761 100644 --- a/test/integration/aens.js +++ b/test/integration/aens.js @@ -30,6 +30,7 @@ describe('Aens', function () { configure(this) let aens + let nameHash const account = generateKeyPair() const name = randomName() @@ -68,12 +69,19 @@ describe('Aens', function () { it('updates names', async () => { const claim = await aens.aensQuery(name) + nameHash = claim.id const address = await aens.address() return claim.update(address).should.eventually.deep.include({ pointers: [R.fromPairs([['key', 'account_pubkey'], ['id', address]])] }) }) + it('Spend by name', async () => { + const current = await aens.address() + const onAccount = aens.addresses().find(acc => acc !== current) + await aens.spend(100, nameHash, { onAccount }).catch(async e => console.log(await e.verifyTx())) + }) + it('transfers names', async () => { const claim = await aens.aensQuery(name) From 8a640e1462c7d6c14eba08fe347180576fbea5a8 Mon Sep 17 00:00:00 2001 From: naz_dou Date: Wed, 25 Sep 2019 13:29:37 +0300 Subject: [PATCH 2/7] feat(AENS): Spend by name --- es/ae/aens.js | 10 +++++++--- es/ae/index.js | 22 ++++++++++++++++++++-- es/tx/builder/helpers.js | 19 +++++++++++++++++-- es/tx/builder/schema.js | 6 ++++++ test/integration/aens.js | 2 +- 5 files changed, 51 insertions(+), 8 deletions(-) diff --git a/es/ae/aens.js b/es/ae/aens.js index 76e8cbdf06..da772755a7 100644 --- a/es/ae/aens.js +++ b/es/ae/aens.js @@ -28,8 +28,9 @@ import * as R from 'ramda' import { encodeBase58Check, salt } from '../utils/crypto' -import { commitmentHash } from '../tx/builder/helpers' +import { commitmentHash, isNameValid } from '../tx/builder/helpers' import Ae from './' +import { CLIENT_TTL, NAME_TTL } from '../tx/builder/schema' /** * Transfer a domain to another account @@ -132,6 +133,7 @@ async function update (nameId, target, options = {}) { * @return {Promise} */ async function query (name, opt = {}) { + isNameValid(name) const o = await this.getName(name) const nameId = o.id @@ -165,6 +167,7 @@ async function query (name, opt = {}) { * @return {Promise} the result of the claim */ async function claim (name, salt, options = {}) { + isNameValid(name) const opt = R.merge(this.Ae.defaults, options) const claimTx = await this.nameClaimTx(R.merge(opt, { accountId: await this.address(opt), @@ -187,6 +190,7 @@ async function claim (name, salt, options = {}) { * @return {Promise} */ async function preclaim (name, options = {}) { + isNameValid(name) const opt = R.merge(this.Ae.defaults, options) const _salt = salt() const height = await this.height() @@ -231,8 +235,8 @@ const Aens = Ae.compose({ deepProps: { Ae: { defaults: { - clientTtl: 1, - nameTtl: 50000 // aec_governance:name_claim_max_expiration() => 50000 + clientTtl: CLIENT_TTL, + nameTtl: NAME_TTL // aec_governance:name_claim_max_expiration() => 50000 } } } diff --git a/es/ae/index.js b/es/ae/index.js index bb74446258..0b4d120a96 100644 --- a/es/ae/index.js +++ b/es/ae/index.js @@ -29,6 +29,8 @@ import Account from '../account' import TxBuilder from '../tx/builder' import * as R from 'ramda' import { BigNumber } from 'bignumber.js' +import { isAddressValid } from '../utils/crypto' +import { isNameValid } from '../tx/builder/helpers' /** * Sign and post a transaction to the chain @@ -69,10 +71,26 @@ async function signUsingGA (tx, options = {}) { */ async function spend (amount, recipientId, options = {}) { const opt = R.merge(this.Ae.defaults, options) - const spendTx = await this.spendTx(R.merge(opt, { senderId: await this.address(opt), recipientId, amount: amount })) + const senderId = resolveSenderName(await this.address(opt), 'ak') + const spendTx = await this.spendTx(R.merge(opt, { senderId, recipientId, amount })) return this.send(spendTx, opt) } +/** + * Get the next nonce to be used for a transaction for an account + * + * @param {String} nameOrAddress + * @param {String} pointerPrefix + * @return {Address} Address or AENS name hash + */ +async function resolveSenderName (nameOrAddress, pointerPrefix = 'ak') { + if (isAddressValid(nameOrAddress) || isNameValid(nameOrAddress)) return nameOrAddress + // Validation + // const { id: nameHash, pointers } = await this.getName(nameOrAddress) + // if (pointers.find(({ id }) => id.split('_')[0] === pointerPrefix)) return nameHash + // throw new Error(`Can't find pointers with prefix ${pointerPrefix} for name ${nameOrAddress}`) +} + /** * Send a percentage of funds to another account * @instance @@ -135,7 +153,7 @@ function destroyInstance () { * @return {Object} Ae instance */ const Ae = stampit(Tx, Account, Chain, { - methods: { send, spend, transferFunds, destroyInstance }, + methods: { send, spend, transferFunds, destroyInstance, resolveSenderName }, deepProps: { Ae: { defaults: {} } } // Todo Enable GA // deepConfiguration: { Ae: { methods: ['signUsingGA'] } } diff --git a/es/tx/builder/helpers.js b/es/tx/builder/helpers.js index 0d1f6f3c32..802d0d9694 100644 --- a/es/tx/builder/helpers.js +++ b/es/tx/builder/helpers.js @@ -1,3 +1,4 @@ +import * as R from 'ramda' import { assertedType, decodeBase58Check, @@ -8,7 +9,7 @@ import { salt } from '../../utils/crypto' import { toBytes } from '../../utils/bytes' -import { ID_TAG_PREFIX, PREFIX_ID_TAG } from './schema' +import { ID_TAG_PREFIX, PREFIX_ID_TAG, AENS_NAME_DOMAINS } from './schema' import { BigNumber } from 'bignumber.js' /** @@ -205,6 +206,19 @@ export function readPointers (pointers) { ) } +/** + * Is name valid + * @function + * @alias module:@aeternity/aepp-sdk/es/ae/aens + * @param {string} name + * @return void + * @throws Error + */ +export function isNameValid (name) { + if (typeof name !== 'string') throw new Error('AENS: Name must be a string') + if (!AENS_NAME_DOMAINS.includes(R.last(name.split('.')))) throw new Error(`AENS: Invalid name domain. Possible domains [${AENS_NAME_DOMAINS}]`) +} + export default { readPointers, buildPointers, @@ -219,5 +233,6 @@ export default { formatSalt, oracleQueryId, createSalt, - buildHash + buildHash, + isNameValid } diff --git a/es/tx/builder/schema.js b/es/tx/builder/schema.js index 8febfc3c8d..0fdf886c81 100644 --- a/es/tx/builder/schema.js +++ b/es/tx/builder/schema.js @@ -11,6 +11,12 @@ import BigNumber from 'bignumber.js' export const VSN = 1 +export const VSN_2 = 2 + +// # AENS +export const AENS_NAME_DOMAINS = ['aet', 'test'] +export const CLIENT_TTL = 1 +export const NAME_TTL = 50000 // # Tag constant for ids (type uint8) // # see https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type diff --git a/test/integration/aens.js b/test/integration/aens.js index 8ccdfa9761..f5e352cb6c 100644 --- a/test/integration/aens.js +++ b/test/integration/aens.js @@ -79,7 +79,7 @@ describe('Aens', function () { it('Spend by name', async () => { const current = await aens.address() const onAccount = aens.addresses().find(acc => acc !== current) - await aens.spend(100, nameHash, { onAccount }).catch(async e => console.log(await e.verifyTx())) + await aens.spend(100, name, { onAccount }).catch(async e => console.log(await e.verifyTx())) }) it('transfers names', async () => { From 7398f36f024bcbd92d99c410442766d5cb50f854 Mon Sep 17 00:00:00 2001 From: naz_dou Date: Wed, 25 Sep 2019 13:42:00 +0300 Subject: [PATCH 3/7] feat(Lima): add check for abi/vm <-> backend(FATE/AEVM) --- es/tx/builder/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/es/tx/builder/index.js b/es/tx/builder/index.js index 1e32e77bfc..cad82af043 100644 --- a/es/tx/builder/index.js +++ b/es/tx/builder/index.js @@ -141,8 +141,12 @@ function validateField (value, key, type, prefix) { return assert((!isNaN(value) || BigNumber.isBigNumber(value)) && BigNumber(value).gte(0), { value, isMinusValue }) } case FIELD_TYPES.id: + console.log('-----') + console.log(prefix) if (Array.isArray(prefix)) { const p = prefix.find(p => p === value.split('_')[0]) + console.log(prefix) + console.log('-----') return assert(p && PREFIX_ID_TAG[value.split('_')[0]], { value, prefix }) } return assert(assertedType(value, prefix) && PREFIX_ID_TAG[value.split('_')[0]] && value.split('_')[0] === prefix, { value, prefix }) From c1306656c67d1da68227a785b7fc1568f2135fb7 Mon Sep 17 00:00:00 2001 From: naz_dou Date: Wed, 25 Sep 2019 13:45:46 +0300 Subject: [PATCH 4/7] debugg --- es/tx/builder/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/es/tx/builder/index.js b/es/tx/builder/index.js index cad82af043..3be1d74437 100644 --- a/es/tx/builder/index.js +++ b/es/tx/builder/index.js @@ -294,6 +294,7 @@ export function validateParams (params, schema, { excludeKeys = [] }) { export function buildRawTx (params, schema, { excludeKeys = [] } = {}) { // Transform params(reason is for do not break current interface of `tx`) params = transformParams(params) + console.log(schema) // Validation const valid = validateParams(params, schema, { excludeKeys }) if (Object.keys(valid).length) { From 6fb9d6bffc20f59d631237ad1a461fca2150e160 Mon Sep 17 00:00:00 2001 From: naz_dou Date: Wed, 25 Sep 2019 13:51:51 +0300 Subject: [PATCH 5/7] feat(AENS): Fix spend by name --- es/ae/index.js | 10 +++++----- es/tx/builder/index.js | 5 ----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/es/ae/index.js b/es/ae/index.js index 0b4d120a96..a0aeb6b148 100644 --- a/es/ae/index.js +++ b/es/ae/index.js @@ -71,8 +71,8 @@ async function signUsingGA (tx, options = {}) { */ async function spend (amount, recipientId, options = {}) { const opt = R.merge(this.Ae.defaults, options) - const senderId = resolveSenderName(await this.address(opt), 'ak') - const spendTx = await this.spendTx(R.merge(opt, { senderId, recipientId, amount })) + recipientId = this.resolveRecipientName(recipientId, 'ak') + const spendTx = await this.spendTx(R.merge(opt, { senderId: await this.address(opt), recipientId, amount })) return this.send(spendTx, opt) } @@ -81,9 +81,9 @@ async function spend (amount, recipientId, options = {}) { * * @param {String} nameOrAddress * @param {String} pointerPrefix - * @return {Address} Address or AENS name hash + * @return {String} Address or AENS name hash */ -async function resolveSenderName (nameOrAddress, pointerPrefix = 'ak') { +async function resolveRecipientName (nameOrAddress, pointerPrefix = 'ak') { if (isAddressValid(nameOrAddress) || isNameValid(nameOrAddress)) return nameOrAddress // Validation // const { id: nameHash, pointers } = await this.getName(nameOrAddress) @@ -153,7 +153,7 @@ function destroyInstance () { * @return {Object} Ae instance */ const Ae = stampit(Tx, Account, Chain, { - methods: { send, spend, transferFunds, destroyInstance, resolveSenderName }, + methods: { send, spend, transferFunds, destroyInstance, resolveRecipientName }, deepProps: { Ae: { defaults: {} } } // Todo Enable GA // deepConfiguration: { Ae: { methods: ['signUsingGA'] } } diff --git a/es/tx/builder/index.js b/es/tx/builder/index.js index 3be1d74437..1e32e77bfc 100644 --- a/es/tx/builder/index.js +++ b/es/tx/builder/index.js @@ -141,12 +141,8 @@ function validateField (value, key, type, prefix) { return assert((!isNaN(value) || BigNumber.isBigNumber(value)) && BigNumber(value).gte(0), { value, isMinusValue }) } case FIELD_TYPES.id: - console.log('-----') - console.log(prefix) if (Array.isArray(prefix)) { const p = prefix.find(p => p === value.split('_')[0]) - console.log(prefix) - console.log('-----') return assert(p && PREFIX_ID_TAG[value.split('_')[0]], { value, prefix }) } return assert(assertedType(value, prefix) && PREFIX_ID_TAG[value.split('_')[0]] && value.split('_')[0] === prefix, { value, prefix }) @@ -294,7 +290,6 @@ export function validateParams (params, schema, { excludeKeys = [] }) { export function buildRawTx (params, schema, { excludeKeys = [] } = {}) { // Transform params(reason is for do not break current interface of `tx`) params = transformParams(params) - console.log(schema) // Validation const valid = validateParams(params, schema, { excludeKeys }) if (Object.keys(valid).length) { From d987b8b0db4522d25466fac2a1f3d84e5db1995a Mon Sep 17 00:00:00 2001 From: naz_dou Date: Wed, 25 Sep 2019 13:51:51 +0300 Subject: [PATCH 6/7] feat(AENS): Fix spend by name --- es/ae/index.js | 18 +++++++++++------- es/tx/builder/index.js | 5 ----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/es/ae/index.js b/es/ae/index.js index 0b4d120a96..baacf2f86a 100644 --- a/es/ae/index.js +++ b/es/ae/index.js @@ -71,20 +71,24 @@ async function signUsingGA (tx, options = {}) { */ async function spend (amount, recipientId, options = {}) { const opt = R.merge(this.Ae.defaults, options) - const senderId = resolveSenderName(await this.address(opt), 'ak') - const spendTx = await this.spendTx(R.merge(opt, { senderId, recipientId, amount })) + recipientId = await this.resolveRecipientName(recipientId, 'ak') + const spendTx = await this.spendTx(R.merge(opt, { senderId: await this.address(opt), recipientId, amount })) return this.send(spendTx, opt) } /** - * Get the next nonce to be used for a transaction for an account + * Resolve AENS name and return name hash * * @param {String} nameOrAddress * @param {String} pointerPrefix - * @return {Address} Address or AENS name hash + * @return {String} Address or AENS name hash */ -async function resolveSenderName (nameOrAddress, pointerPrefix = 'ak') { - if (isAddressValid(nameOrAddress) || isNameValid(nameOrAddress)) return nameOrAddress +async function resolveRecipientName (nameOrAddress, pointerPrefix = 'ak') { + if (isAddressValid(nameOrAddress)) return nameOrAddress + if (isNameValid(nameOrAddress)) { + const { id } = this.getName(nameOrAddress) + return id + } // Validation // const { id: nameHash, pointers } = await this.getName(nameOrAddress) // if (pointers.find(({ id }) => id.split('_')[0] === pointerPrefix)) return nameHash @@ -153,7 +157,7 @@ function destroyInstance () { * @return {Object} Ae instance */ const Ae = stampit(Tx, Account, Chain, { - methods: { send, spend, transferFunds, destroyInstance, resolveSenderName }, + methods: { send, spend, transferFunds, destroyInstance, resolveRecipientName }, deepProps: { Ae: { defaults: {} } } // Todo Enable GA // deepConfiguration: { Ae: { methods: ['signUsingGA'] } } diff --git a/es/tx/builder/index.js b/es/tx/builder/index.js index 3be1d74437..1e32e77bfc 100644 --- a/es/tx/builder/index.js +++ b/es/tx/builder/index.js @@ -141,12 +141,8 @@ function validateField (value, key, type, prefix) { return assert((!isNaN(value) || BigNumber.isBigNumber(value)) && BigNumber(value).gte(0), { value, isMinusValue }) } case FIELD_TYPES.id: - console.log('-----') - console.log(prefix) if (Array.isArray(prefix)) { const p = prefix.find(p => p === value.split('_')[0]) - console.log(prefix) - console.log('-----') return assert(p && PREFIX_ID_TAG[value.split('_')[0]], { value, prefix }) } return assert(assertedType(value, prefix) && PREFIX_ID_TAG[value.split('_')[0]] && value.split('_')[0] === prefix, { value, prefix }) @@ -294,7 +290,6 @@ export function validateParams (params, schema, { excludeKeys = [] }) { export function buildRawTx (params, schema, { excludeKeys = [] } = {}) { // Transform params(reason is for do not break current interface of `tx`) params = transformParams(params) - console.log(schema) // Validation const valid = validateParams(params, schema, { excludeKeys }) if (Object.keys(valid).length) { From 13eb48fa01600b5053a8ad0d4d4e71de7a26c3f4 Mon Sep 17 00:00:00 2001 From: naz_dou Date: Wed, 25 Sep 2019 15:11:47 +0300 Subject: [PATCH 7/7] feat(AENS): Fix resolve recipient by name function --- es/ae/index.js | 8 ++++---- es/tx/builder/helpers.js | 3 ++- test/integration/aens.js | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/es/ae/index.js b/es/ae/index.js index baacf2f86a..3b12da9dba 100644 --- a/es/ae/index.js +++ b/es/ae/index.js @@ -65,13 +65,13 @@ async function signUsingGA (tx, options = {}) { * @category async * @rtype (amount: Number|String, recipientId: String, options?: Object) => Promise[String] * @param {Number|String} amount - Amount to spend - * @param {String} recipientId - Address of recipient account + * @param {String} recipientId - Address or Name of recipient account * @param {Object} options - Options * @return {String|String} Transaction or transaction hash */ async function spend (amount, recipientId, options = {}) { const opt = R.merge(this.Ae.defaults, options) - recipientId = await this.resolveRecipientName(recipientId, 'ak') + recipientId = await this.resolveRecipientName(recipientId) const spendTx = await this.spendTx(R.merge(opt, { senderId: await this.address(opt), recipientId, amount })) return this.send(spendTx, opt) } @@ -83,10 +83,10 @@ async function spend (amount, recipientId, options = {}) { * @param {String} pointerPrefix * @return {String} Address or AENS name hash */ -async function resolveRecipientName (nameOrAddress, pointerPrefix = 'ak') { +async function resolveRecipientName (nameOrAddress) { if (isAddressValid(nameOrAddress)) return nameOrAddress if (isNameValid(nameOrAddress)) { - const { id } = this.getName(nameOrAddress) + const { id } = await this.getName(nameOrAddress) return id } // Validation diff --git a/es/tx/builder/helpers.js b/es/tx/builder/helpers.js index 802d0d9694..dc149c5b1f 100644 --- a/es/tx/builder/helpers.js +++ b/es/tx/builder/helpers.js @@ -211,12 +211,13 @@ export function readPointers (pointers) { * @function * @alias module:@aeternity/aepp-sdk/es/ae/aens * @param {string} name - * @return void + * @return Boolean * @throws Error */ export function isNameValid (name) { if (typeof name !== 'string') throw new Error('AENS: Name must be a string') if (!AENS_NAME_DOMAINS.includes(R.last(name.split('.')))) throw new Error(`AENS: Invalid name domain. Possible domains [${AENS_NAME_DOMAINS}]`) + return true } export default { diff --git a/test/integration/aens.js b/test/integration/aens.js index f5e352cb6c..ce32c929c1 100644 --- a/test/integration/aens.js +++ b/test/integration/aens.js @@ -79,7 +79,7 @@ describe('Aens', function () { it('Spend by name', async () => { const current = await aens.address() const onAccount = aens.addresses().find(acc => acc !== current) - await aens.spend(100, name, { onAccount }).catch(async e => console.log(await e.verifyTx())) + await aens.spend(100, name, { onAccount }) }) it('transfers names', async () => {