npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@filfox/fnsjs

v1.1.7

Published

Library For FNS

Downloads

14

Readme

Library for FNS

FNS is Filecoin Name Service based on FEVM, developed by Filfox Team.

Homepage: https://fns.space
App: https://app.fns.space
Doc: https://fns-dao.gitbook.io/fns-doc

Installation

yarn add @filfox/fnsjs ethers

Getting Started

import FNS from '@filfox/fnsjs'
import { ethers } from 'ethers'

const fns = new FNS('calibration') // or 'mainnet'

// The fns instance has a default read-only provider, but of course, you can set your own provider :
const provider = new ethers.providers.JsonRpcProvider(RPC)
fns.setProvider(provider)

// If you are in a pure node script environment, you may need to use it like the following :
const FNS = require('@filfox/fnsjs')
const fns = new FNS('calibration') // or 'mainnet'

fns methods

  • setProvider(provider: any)
  • getProvider()
  • setSigner(signer: any)
  • getSigner()
  • name(name: string): Name
  • address(address: string): Address
  • lookupAddress(addr: string): Promise
  • getResolver(): string
  • getNameBase(name: string): Promise
  • getNameAddrs(name: string): Promise
  • getNameTexts(name: string): Promise
  • getNameInfo(name: string): Promise
  • getAvailable(name: string): Promise
  • getPrice(name: string, months = 12, unit?: 'fil' | 'usd'): Promise<BigNumberish | string>
  • getRegistrant(name: string): Promise
  • getExpires(name: string, format?: string): Promise
  • getExpired(name: string): Promise
  • getController(name: string): Promise
  • getContent(name: string): Promise
  • getText(name: string, key: string): Promise
  • getAddrOf(name: string, coin: string): Promise
  • getPrimaryName(addr: string): Promise
  • getOwnershipNames(addr: string): Promise<string []>
  • register(name: string, owner: string, months: number): Promise
  • renew(name: string, months: number): Promise
  • transferControl(name: string, addr: string): Promise
  • transferOwnership(name: string, to: string): Promise
  • setController(name: string, addr: string): Promise
  • setContent(name: string, content: string)
  • setText(name: string, key: string, val: string): Promise
  • setTexts(name: string, texts: Record<string, string>): Promise
  • setAddrOf(name: string, coin: string, addr: string): Promise
  • setAddrs(name: string, addrMap: Record<string, string>): Promise
  • setPrimaryName(name: string): Promise
  • setSubName(name: string, subname: string, owner: string): Promise

fns.name() methods

  • getBase()
  • getInfo()
  • getText()
  • getTexts()
  • getAvailable()
  • getPrice()
  • getRegistrant()
  • getController()
  • getExpires()
  • getExpired()
  • getContent()
  • getAddr()
  • getAddrs()
  • getAddrOf()
  • setController()
  • setContent()
  • setText()
  • setTexts()
  • setAddrOf()
  • setAddrs()
  • setPrimaryName()
  • setSubName()
  • register()
  • renew()
  • transferControlTo()
  • transferOwnershipTo()

getBase()

Method: getBase()
Return: Promise<object>, get name base information

Example: 
fns.name('yamy.fil').getBase()
or
fns.getBase('yamy.fil')

Result: 
{
    name: 'yamy.fil',
    available: false,
    expires: '2024-05-04 07:21',
    expired: false,
    registrant: '0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35',
    controller: '0x7e5b29792F4cAF463A7faADd028fCA53b6a2241F',
    resolver: '0xb28f7372f27dC2Ef104F2a3347FdcAaA86D2d3Cc'
}

getInfo()

Method: getInfo()
Return: Promise<object>, get name detail information

Example: 
fns.name('web3.fil').getInfo()
or
fns.getInfo('web3.fil')

Result: 
{
    name: 'yamy.fil',
    available: false,
    expires: '2024-05-04 07:21',
    expired: false,
    registrant: '0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35',
    controller: '0x7e5b29792F4cAF463A7faADd028fCA53b6a2241F',
    resolver: '0xb28f7372f27dC2Ef104F2a3347FdcAaA86D2d3Cc',
    addrs: { 
    	fil: 'f4kxv6m7a7uoe6d3qsjokw4pzkogf6ojadqdn3dhi', 
    	eth: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e', 
    	btc: '1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2', 
    	ltc: 'LdNFQrJLsCHW1zZKjGyPcqpiMuNvry7BUh', 
    	doge: 'D9yU9D8zqcRfvJSNXFfHefYnuPVaQA5M2N'
	},
    texts: {
            projectname: '',
            banner: '',
		filecoincid: 'bafybeigxj6o4gpyw5c3rhxbllyudkbld3ztt7kfq3qbrjjejbunevyd3zm',
		email: '[email protected]',
		url: 'https://example.com',
		avatar: 'https://example.com/avatar.png',
		description: 'I am a software engineer with experience in blockchain development.',
		'com.twitter': '@example',
		'com.discord': 'example#1234',
		'com.reddit': 'u/example',
		'com.telegram': '@example',
		'com.github': 'example'
	},
    content: 'CONTENT'
}

getAddrs()

Method: getAddrs()
Return: Promise<object>, get all coins addresses

Example: 
fns.name('yamy.fil').getAddrs()
or
fns.getAddrs('yamy.fil')

Result:
{ 
    fil: 'f4kxv6m7a7uoe6d3qsjokw4pzkogf6ojadqdn3dhi', 
    eth: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e', 
    btc: '1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2', 
    ltc: 'LdNFQrJLsCHW1zZKjGyPcqpiMuNvry7BUh', 
    doge: 'D9yU9D8zqcRfvJSNXFfHefYnuPVaQA5M2N'
}

getTexts()

Method: getTexts()
Return: Promise<object>, get all text informations

Example: 
fns.name('yamy.fil').getTexts()
or
fns.getTexts('yamy.fil')

Result:
{
      projectname: '',
      banner: '',
	filecoincid: 'bafybeigxj6o4gpyw5c3rhxbllyudkbld3ztt7kfq3qbrjjejbunevyd3zm',
	email: '[email protected]',
	url: 'https://example.com',
	avatar: 'https://example.com/avatar.png',
	description: 'I am a software engineer with experience in blockchain development.',
	'com.twitter': '@example',
	'com.discord': 'example#1234',
	'com.reddit': 'u/example',
	'com.telegram': '@example',
	'com.github': 'example'
}

getAvailable()

Method: getAvailable()
Return: Promise<boolean>, get if available of the name

Example: 
fns.name('yamy.fil').getAvailable()
or
fns.getAvailable('yamy.fil')

Result:
false

getPrice(months?: number)

Method: getPrice(months?: number, unit?: 'fil' | 'usd')
Params: months: register or renew months, default by 12
Return: Promise<BigNumberish|string>, get register or renew price

Example: 

fns.name('yamy.fil').getPrice(12)
or
fns.getPrice('yamy.fil', 12)

=> BigNumber { _hex: '0x0daef6dd95ac0000', _isBigNumber: true }

fns.name('yamy.fil').getPrice(12, 'fil')
or
fns.getPrice('yamy.fil', 12, 'fil')

=> 0.9859968

fns.name('yamy.fil').getPrice(12, 'usd')
or
fns.getPrice('yamy.fil', 12, 'usd')

=> 3.5241

getRegistrant()

Method: getRegistrant()
Return: Promise<string> get registrant of the name

Example:

fns.name('yamy.fil').getRegistrant()
or
fns.getRegistrant('yamy.fil')

Result:
0xf70f118432221a98fca961e65dd7303a8ba1fc76

getExpires(format?: string)

Method: getExpires(format?: string)
Params: format: time format, default by none
Return: Promise<string|number> get expires time

Example:

fns.name('yamy.fil').getExpires()
or
fns.getExpires('yamy.fil')

=> 1719991260

fns.name('yamy.fil').getExpires('YYYY-MM-DD HH:mm')
or
fns.getExpires('yamy.fil', 'YYYY-MM-DD HH:mm')

=> 2024-07-03 07:21

getExpired()

Method: getExpired()
Return: Promise<string> get if a name has expired

Example:

fns.name('yamy.fil').getExpired()
or
fns.getExpired('yamy.fil')

Result:
false

getController()

Method: getController()
Return: Promise<string> get controller address

Example:

fns.name('yamy.fil').getController()
or
fns.getController('yamy.fil')

Result:
0x00ab1c3f84a2c48f1a2d3b7fca69445c39bc6883

getContent()

Method: getContent()
Return: Promise<string> get content stirng

Example:

fns.name('yamy.fil').getContent()
or
fns.getContent('yamy.fil')

Result:
CONTENT123

getText(key: string)

Method: getText(key: string)
Params: key: text key
Return: Promise<string>, get text value of the key

Example:

fns.name('yamy.fil').getText('email')
or
fns.getText('yamy.fil', 'email')

Result:
[email protected]

getAddr()

Method: getAddr()
Return: Promise<string> get fil address

Example:

fns.name('yamy.fil').getAddr()
or
fns.getAddr('yamy.fil')

Result:
f4kxv6m7a7uoe6d3qsjokw4pzkogf6ojadqdn3dhi

getAddrOf(coin: string)

Method: getAddrOf(coin: string)
Params: coin: The coin you want to query
Return: Promise<string>, get coin address

Example:

fns.name('yamy.fil').getAddrOf('eth')
or
fns.getAddrOf('yamy.fil', 'eth')

Result:
0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35

register(owner: string, months: number)

Method: register(owner: string, months: number)
Params: owner: owner, months: number of months
Return: Promise<tx>

Example:

fns.name('yamy.fil').register('0x00ab1c3f84a2c48f1a2d3b7fca69445c39bc6883', 1)
or
fns.getAddrOf('yamy.fil', '0x00ab1c3f84a2c48f1a2d3b7fca69445c39bc6883', 1)

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 334,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x0b791bd8', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x3a03af47530000', _isBigNumber: true },
      data: '0x5692a2cf00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000ab1c3f84a2c48f1a2d3b7fca69445c39bc68830000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000b28f7372f27dc2ef104f2a3347fdcaaa86d2d3cc00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000779616d79393939000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0x3268d7a2233bd6a43886ba21009427e40cb73568d5a3ceff17db356b50869815',
      v: 1,
      r: '0x5879adb69264352c6dc0cc420fdb61464771cbf935643fe40642eeb749d91638',
      s: '0x31a97c08bf0622f4efb642330749a3634d6297396dbd0be5f9bc9e1e8564c3a8',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

renew(months: number)

Method: renew(months: number)
Params: months: the number of months you want to renew your name
Return: Promise<tx>

Example:

fns.name('yamy.fil').renew(1)
or
fns.getAddrOf('yamy.fil', 1)

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

transferControlTo(addr: string)

Method: transferControlTo(addr: string)
Params: addr: new controller
Return: Promise<tx>

Example:

fns.name('yamy.fil').transferControlTo('0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35')
or
fns.transferControl('yamy.fil', '0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35')

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

Tips:
- The purpose of this method is to transfer the controller of a name
- The method can only be called by registrant, otherwise an error will be thrown

transferOwnershipTo(to: string)

Method: transferOwnershipTo(to: string)
Params: to: new owner
Return: Promise<tx>

Example:

fns.name('yamy.fil').transferOwnershipTo('0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35')
or
fns.transferOwnership('yamy.fil', '0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35')

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

Tips:
- The purpose of this method is to transfer the ownership of a name 721 token
- The method can only be called by registrant, otherwise an error will be thrown

setController(addr: string)

Method: setController(addr: string)
Params: addr: controller address
Return: Promise<tx>

Example:

fns.name('yamy.fil').setController('0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35')
or
fns.setController('yamy.fil', '0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35')

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

Tips:
- The purpose of this method is to transfer the controller of a name
- The method can only be called by controller, otherwise an error will be thrown

setContent(content: string)

Method: setContent(content: string)
Params: content: content you want to set
Return: Promise<tx>

Example:

fns.name('yamy.fil').setContent('CONTENT123')
or
fns.setContent('yamy.fil', 'CONTENT123')

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

setText(key: string, val: string)

Method: setText(key: string, val: string)
Params: key: the key to update | val: the value of the key
Return: Promise<tx>

Example:

fns.name('yamy.fil').setText('email', '[email protected]')
or
fns.setText('yamy.fil', 'email', '[email protected]')

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

setTexts(texts: Record<string, string>)

Method: setTexts(texts: Record<string, string>)
Params: texts: texts of object
Return: Promise<tx>

Example:

fns.name('yamy.fil').setTexts({ email: '[email protected]', url: 'example.com', ... })
or
fns.setTexts('yamy.fil', { email: '[email protected]', url: 'example.com', ... })

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

setAddrOf(coin: string, addr: string)

Method: setAddrOf(coin: string, addr: string)
Params: coin: coin type name | addr: coin address
Return: Promise<tx>

Example:

fns.name('yamy.fil').setAddrOf('eth', '0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35')
or
fns.setAddrOf('yamy.fil', 'eth', '0x6FBfd1ee64Ae1c027eDa61c2e1FB975E18F68F35')

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

setAddrs(addrMap: Record<string, string>)

Method: setAddrs(addrMap: Record<string, string>)
Params: addrMap: addresses of coins
Return: Promise<tx>

Example:

fns.name('yamy.fil').setAddrs({ 
    fil: 'f4kxv6m7a7uoe6d3qsjokw4pzkogf6ojadqdn3dhi', 
    eth: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e', 
    btc: '1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2', 
    ltc: 'LdNFQrJLsCHW1zZKjGyPcqpiMuNvry7BUh', 
    doge: 'D9yU9D8zqcRfvJSNXFfHefYnuPVaQA5M2N'
})
or
fns.setAddrs('yamy.fil', { 
    fil: 'f4kxv6m7a7uoe6d3qsjokw4pzkogf6ojadqdn3dhi', 
    eth: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e', 
    btc: '1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2', 
    ltc: 'LdNFQrJLsCHW1zZKjGyPcqpiMuNvry7BUh', 
    doge: 'D9yU9D8zqcRfvJSNXFfHefYnuPVaQA5M2N'
})

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

setSubName(subname: string, owner: string)

Method: setSubName(subname: string, owner: string)
Params: subname: subname | owner: name controller
Return: Promise<object>

Example:

fns.name('yamy.fil').setSubName('api', '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883') => api.yamy.fil
or
fns.setSubName('yamy.fil', 'api', '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883')

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

setPrimaryName()

Method: setPrimaryName()
Return: Promise<tx>

Example:

fns.name('yamy.fil').setPrimaryName()
or
fns.setPrimaryName('yamy.fil')

Result:
{
      type: 2,
      chainId: 3141,
      nonce: 333,
      maxPriorityFeePerGas: BigNumber { _hex: '0x59682f00', _isBigNumber: true },
      maxFeePerGas: BigNumber { _hex: '0x59682fc8', _isBigNumber: true },
      gasPrice: null,
      gasLimit: BigNumber { _hex: '0x02ae6daa', _isBigNumber: true },
      to: '0xcf38A805f2F5f0b9E96cE6Cfb1059D5CDEDa5cf0',
      value: BigNumber { _hex: '0x0123e9e7cc790000', _isBigNumber: true },
      data: '0xacf1a84100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000479616d7900000000000000000000000000000000000000000000000000000000',
      accessList: [],
      hash: '0xe70413acde387ae543c33fcf4f3ee932e884129a07d3bfc039605fc0d67280f4',
      v: 0,
      r: '0x70967dd5779c2c3c3118a8be53858181e1e146f50f904903640d75d303fec31c',
      s: '0x44cefa8da2dc7a5cece13583b49a468610ebfd5fca9aef7a034d4d4a37e5d98d',
      from: '0x00AB1C3F84a2c48F1a2D3b7FcA69445c39bC6883',
      confirmations: 0,
      wait: [Function (anonymous)]
}

fns.address() methods

  • getName()
  • getPrimaryName()
  • getOwnershipNames()

getName()

Method: getName()
Return: Promise<string>, get reverse resolve

Example: 
fns.address('0x00ab1c3f84a2c48f1a2d3b7fca69445c39bc6883').getName()
or
fns.address('f410facvryp4eulci6grnhn74u2kelq43y2edsyvmoca').getName()
or
fns.lookupAddress('0x00ab1c3f84a2c48f1a2d3b7fca69445c39bc6883')
or
fns.lookupAddress('f410facvryp4eulci6grnhn74u2kelq43y2edsyvmoca')

Result: 
web999.fil

getPrimaryName()

Method: getPrimaryName()
Return: Promise<string>, get primary name

Example: 
fns.address('0xf70f118432221a98fca961e65dd7303a8ba1fc76').getPrimaryName()
or
fns.getPrimaryName('0xf70f118432221a98fca961e65dd7303a8ba1fc76')

Result: 
testcontroller.fil

getOwnershipNames()

Method: getOwnershipNames()
Return: Promise<string[]>, get all ownership names

Example:
fns.address('0xf70f118432221a98fca961e65dd7303a8ba1fc76').getOwnershipNames()
or
fns.getOwnershipNames('0xf70f118432221a98fca961e65dd7303a8ba1fc76')

Result:
[
    'testapps.fil',
    'helloc.fil',
    'hellod.fil',
    'hellof.fil',
    'ghfjkddfhjksajd.fil',
    'hellog.fil',
    'hahsdhhasd.fil',
    'hahsdhhasdsdasd.fil',
    'hahsdhhasdsdsdsdawdwds.fil'
]