Neighbor's Preppy Maltese

    @rsksmart/rns-resolver

    2.0.0 • Public • Published

    logo

    rns-resolver

    RNS Resolver

    CircleCI npm docs specs

    npm i @rsksmart/rns-resolver
    

    Deployments:

    Features

    Supported resolution protocols:

    Architecture:

    • Upgradeable contracts using OpenZeppelin Upgrades OpenZeppelin Upgrades.
    • Use setAuthorisation to enable others set your records.
    • Use multicall to perform multiple operations in one call/transaction.

    Usage

    pragma solidity ^0.5.0;
    
    import "@rsksmart/rns-registry/contracts/AbstractRNS.sol";
    import "@rsksmart/rns-resolver/contracts/RSKAddrResolver.sol";
    
    contract RNSTransfer {
      AbstractRNS rns;
    
      constructor(AbstractRNS _rns) public {
        rns = _rns;
      }
    
      function transfer(bytes32 node) public {
        address resolver = RSKAddrResolver(rns.resolver(node));
        address addr = resolver.addr(node);
    
        addr.transfer(msg.value);
      }
    }
    const Web3 = require('web3');
    const ResolverData = require('@rsksmart/rns-resolver/ResolverData.json');
    
    const web3 = new Web3('https://public-node.rsk.co')
    const Resolver = new web3.eth.Contract(ResolverData.abi, ResolverData.address.rskMainnet);

    Types

    There are TypeScript typing definitions of the contracts published together with the original contracts. Supported contract's libraries are:

    • web3 version 1.* - web3-v1-contracts
    • web3 version 2.* - web3-v2-contracts
    • truffle - truffle-contracts
    • ethers - ethers-contracts

    You can use them as follow:

    import Web3 from 'web3'
    import AddrResolver from '@rsksmart/rns-resolver/types/web3-v1-contracts/ResolverV1.d.ts'
    import ResolverData from '@rsksmart/rns-resolver/ResolverData.json'
    
    const web3 = new Web3('https://public-node.rsk.co')
    const resolver = new web3.eth.Contract(ResolverData.abi, ResolverData.address.rskMainnet) as AddrResolver

    Replace web3-v1-contracts with the proper library version.


    Legacy contracts:

    Usage

    pragma solidity ^0.5.0;
    
    import "@rsksmart/rns-registry/contracts/legacy/AbstractRNS.sol";
    import "@rsksmart/rns-resolver/contracts/legacy/AbstractAddrResolver.sol";
    
    contract RNSTransfer {
      AbstractRNS rns;
    
      constructor(AbstractRNS _rns) public {
        rns = _rns;
      }
    
      function transfer(bytes32 node) public {
        address resolver = AbstractAddrResolver(rns.resolver(node));
        address addr = resolver.addr(node);
    
        addr.transfer(msg.value);
      }
    }
    const Web3 = require('web3');
    const AddrResolverData = require('@rsksmart/rns-resolver/AddrResolverData.json');
    
    const web3 = new Web3('https://public-node.rsk.co')
    const AddrResolver = new web3.eth.Contract(AddrResolverData.abi, AddrResolverData.address.rskMainnet);

    Types

    import Web3 from 'web3'
    import AddrResolver from '@rsksmart/rns-resolver/types/web3-v1-contracts/AddrResolverData.d.ts'
    import AddrResolverData from '@rsksmart/rns-resolver/AddrResolverData.json'
    
    const web3 = new Web3('https://public-node.rsk.co')
    const resolver = new web3.eth.Contract(AddrResolverData.abi, AddrResolverData.address.rskMainnet) as AddrResolver

    Replace web3-v1-contracts with the proper library version.

    Old deployments

    Keywords

    Install

    npm i @rsksmart/rns-resolver

    DownloadsWeekly Downloads

    56

    Version

    2.0.0

    License

    ISC

    Unpacked Size

    232 kB

    Total Files

    40

    Last publish

    Collaborators

    • icalisalvo-iovlabs
    • ilanolkies
    • jessgusclark