Skip to content

Commit

Permalink
fix(name full-claim): key of created pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Jan 28, 2022
1 parent 6ea69ad commit 7c278f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/actions/aens.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export async function extendName (walletPath, domain, nameTtl, options) {
}

// Create `updateName` transaction
const updateTx = await client.aensUpdate(domain, [], { ttl, fee, nonce, waitMined, nameTtl, extendPointers: true })
const updateTx = await client.aensUpdate(domain, {}, { ttl, fee, nonce, waitMined, nameTtl, extendPointers: true })
if (waitMined) {
printTransaction(
updateTx,
Expand Down Expand Up @@ -222,10 +222,8 @@ export async function nameBid (walletPath, domain, nameFee, options) {

export async function fullClaim (walletPath, domain, options) {
let { ttl, fee, nonce, nameFee, json, nameTtl, clientTtl } = options
// Validate `name`
validateName(domain)
const [aensName, namespace] = domain.split('.')
if (namespace === 'chain' && aensName.length < 13) throw new Error('Full name claiming works only with name longer then 12 symbol(Not trigger auction)')
if (domain.split('.')[0] < 13) throw new Error('Full name claiming works only with name longer then 12 symbol (not trigger auction)')

// Get `keyPair` by `walletPath`, decrypt using password and initialize `Ae` client with this `keyPair`
const client = await initClientByWalletFile(walletPath, options)
Expand All @@ -244,8 +242,10 @@ export async function fullClaim (walletPath, domain, options) {
nonce += 1
const claim = await preclaim.claim({ nonce, ttl, fee, nameFee })
nonce += 1
const updateTx = await claim.update([await client.address()], { nonce, ttl, fee, nameTtl, clientTtl })
nonce += 1
const updateTx = await claim.update(
{ account_pubkey: await client.address() },
{ nonce, ttl, fee, nameTtl, clientTtl }
)

printTransaction(
updateTx,
Expand Down
9 changes: 5 additions & 4 deletions test/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { Crypto } from '@aeternity/aepp-sdk'
import { after, before, describe, it } from 'mocha'
import { expect } from 'chai'
import { executeProgram, randomName, getSdk, WALLET_NAME } from './index'
import nameProgramFactory from '../src/commands/name'
import inspectProgramFactory from '../src/commands/inspect'
Expand Down Expand Up @@ -51,8 +52,8 @@ describe('CLI AENS Module', function () {
const address = await sdk.address()

updateTx.blockHeight.should.be.gt(0)
const isUpdated = !!updateTx.pointers.find(({ id }) => id === address)
isUpdated.should.be.equal(true)
const pointer = updateTx.pointers.find(({ id }) => id === address)
expect(pointer).to.be.eql({ id: address, key: 'account_pubkey' })
})

it('Full claim with options', async function () {
Expand All @@ -76,8 +77,8 @@ describe('CLI AENS Module', function () {
updateTx.blockHeight.should.be.gt(0)
updateTx.tx.nameTtl.should.be.equal(50)
updateTx.tx.clientTtl.should.be.equal(50)
const isUpdated = !!updateTx.pointers.find(({ id }) => id === address)
isUpdated.should.be.equal(true)
const pointer = updateTx.pointers.find(({ id }) => id === address)
expect(pointer).to.be.eql({ id: address, key: 'account_pubkey' })
})

it('Pre Claim Name', async () => {
Expand Down

0 comments on commit 7c278f1

Please sign in to comment.