Skip to content

AENS

@aeternity/aepp-sdk/es/ae/aens

Aens module - routines to interact with the æternity naming system

The high-level description of the naming system is https://github.com/aeternity/protocol/blob/master/AENS.md in the protocol repository.

Example

import Aens from '@aeternity/aepp-sdk/es/ae/aens'

Aens([options]) ⇒ Object

Aens Stamp

Aens provides name-system related methods atop Ae clients.

Kind: Exported function
Returns: Object - Aens instance
rtype: Stamp

Param Type Default Description
[options] Object {} Initializer object

.update(name, pointers, [options]) ⇒ Promise.<Object>

Update a name

Kind: instance method of @aeternity/aepp-sdk/es/ae/aens
Category: async
Throws:

  • Invalid pointer array error
Param Type Default Description
name String AENS name
pointers Array.<String> Array of name pointers. Can be oracle
[options] Object {}
[options.extendPointers] Boolean false extendPointers Get the pointers from the node and merge with provided one. Pointers with the same type will be overwrited
[options.onAccount] String | Object onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
[options.fee] Number | String | BigNumber fee
[options.ttl] Number | String | BigNumber ttl
[options.nonce] Number | String | BigNumber nonce
[options.nameTtl] Number | String | BigNumber 50000 nameTtl Name ttl represented in number of blocks (Max value is 50000 blocks)
[options.clientTtl] Number | String | BigNumber 84600 clientTtl a suggestion as to how long any clients should cache this information

Example

const name = 'test.chain'
const pointersArray = ['ak_asd23dasdas...,' 'ct_asdf34fasdasd...']
const nameObject = await sdkInstance.aensQuery(name)

await sdkInstance.aensUpdate(name, pointersArray, { nameTtl, ttl, fee, nonce, clientTtl })
// or
await nameObject.update(pointersArray, { nameTtl, ttl, fee, nonce, clientTtl })

.transfer(name, account, [options]) ⇒ Promise.<Object>

Transfer a domain to another account

Kind: instance method of @aeternity/aepp-sdk/es/ae/aens
Returns: Promise.<Object> - Transaction result
Category: async

Param Type Default Description
name String AENS name
account String Recipient account publick key
[options] Object {}
[options.onAccount] String | Object onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
[options.fee] Number | String | BigNumber fee
[options.ttl] Number | String | BigNumber ttl
[options.nonce] Number | String | BigNumber nonce

Example

const name = 'test.chain'
const recipientPub = 'ak_asd23dasdas...'
const nameObject = await sdkInstance.aensQuery(name)

await sdkInstance.aensTransfer(name, recipientPub, { ttl, fee, nonce })
// or
await nameObject.transfer(recipientPub, { ttl, fee, nonce })

.query(name, opt) ⇒ Promise.<Object>

Query the AENS name info from the node and return the object with info and predefined functions for manipulating name

Kind: instance method of @aeternity/aepp-sdk/es/ae/aens
Category: async

Param Type Description
name String
opt Object Options

Example

const nameObject = sdkInstance.aensQuery('test.chain')
console.log(nameObject)
{
 id, // name hash
 pointers, // array of pointers
 update, // Update name function
 extendTtl, // Extend Ttl name function
 transfer, // Transfer name function
 revoke // Revoke name function
}

.claim(name, salt, [options]) ⇒ Promise.<Object>

Claim a previously preclaimed registration. This can only be done after the preclaim step

Kind: instance method of @aeternity/aepp-sdk/es/ae/aens
Returns: Promise.<Object> - the result of the claim
Category: async

Param Type Default Description
name String
salt Number Salt from pre-claim, or 0 if it's a bid
[options] Object {} options
[options.onAccount] String | Object onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
[options.fee] Number | String | BigNumber fee
[options.ttl] Number | String | BigNumber ttl
[options.nonce] Number | String | BigNumber nonce
[options.nameFee] Number | String Name Fee (By default calculated by sdk)
[options.vsn] Number | String 2 Transaction vsn from Lima is 2

Example

const name = 'test.chain'
const salt = preclaimResult.salt // salt from pre-claim transaction

await sdkInstance.aensClaim(name, salt, { ttl, fee, nonce, nameFee })

.preclaim(name, [options]) ⇒ Promise.<Object>

Preclaim a name. Sends a hash of the name and a random salt to the node

Kind: instance method of @aeternity/aepp-sdk/es/ae/aens
Category: async

Param Type Default Description
name String
[options] Object {}
[options.onAccount] String | Object onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
[options.fee] Number | String | BigNumber fee
[options.ttl] Number | String | BigNumber ttl
[options.nonce] Number | String | BigNumber nonce

Example

const name = 'test.chain'
const salt = preclaimResult.salt // salt from pre-claim transaction

await sdkInstance.aensPreclaim(name, { ttl, fee, nonce })
{
  ...transactionResult,
  claim, // Claim function (options={}) => claimTransactionResult
  salt,
  commitmentId
}

.bid(name, nameFee, [options]) ⇒ Promise.<Object>

Bid to name auction

Kind: instance method of @aeternity/aepp-sdk/es/ae/aens
Returns: Promise.<Object> - Transaction result
Category: async

Param Type Default Description
name String Domain name
nameFee String | Number Name fee (bid fee)
[options] Object {}
[options.onAccount] String | Object onAccount Make operation on specific account from sdk(you pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
[options.fee] Number | String | BigNumber fee
[options.ttl] Number | String | BigNumber ttl
[options.nonce] Number | String | BigNumber nonce

Example

const name = 'test.chain'
const bidFee = computeBidFee(name, startFee, incrementPercentage)

await sdkInstance.aensBid(name, 213109412839123, { ttl, fee, nonce })