举报投诉联系我们 手机版 热门标签 鳄鱼CMS
您的位置:鳄鱼CMS > Moralis Web3API.resolve

Moralis Web3API.resolve

2023-03-28 16:31

 Moralis Web3API.resolve

resolveDomain

解析 Unstoppable 域并返回地址(异步)。

选项:

  • currency​(可选):要查询的货币。 可用值:eth、0x1。 默认值:eth。
  • domain ​(必填): 需要解析的域。

你可以使用​JS​、​React​、​curl​、​Unity​来实现

// get polygon NFTs for address
const options = { currency: "eth", domain: "brad.crypto" };
const resolve = await Moralis.Web3API.resolve.resolveDomain(options);
import React from "react";
import { useMoralisWeb3Api } from "react-moralis";

const Web3Api = useMoralisWeb3Api();

const fetchDomain = async () => {
  // get polygon NFTs for address
  const options = { currency: "eth", domain: "brad.crypto" };
  const resolve = await Web3Api.resolve.resolveDomain(options);
  console.log(resolve);
};
curl -X "GET" 
  "https://deep-index.moralis.io/api/v2/resolve/brad.crypto?currency=eth" 
  -H "accept: application/json" 
  -H "X-API-Key: MY-API-KEY"
using System.Collections.Generic;
using Moralis.Web3Api.Models;
using MoralisWeb3ApiSdk;

  public async void fetchDomain()
  {
    Resolve resolve = await MoralisInterface.GetClient().Web3Api.Resolve.ResolveDomain(domain: "brad.crypto" currency: "eth");
    print(resolve.ToJson());
  }

示例结果

{
  "address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e"
}

resolveAddress

反向解析地址并返回 ENS 域(如果存在)。

选项:

  • address​(必填):要反向解析的以太坊地址。

你可以使用​JS​、​React​、​curl​、​Unity​来实现

// get ENS domain of an address
const options = { address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" };
const resolve = await Moralis.Web3API.resolve.resolveAddress(options);
import React from "react";
import { useMoralisWeb3Api } from "react-moralis";

const Web3Api = useMoralisWeb3Api();

const fetchAddress = async () => {
  // get ENS domain of an address
  const options = { address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" };
  const resolve = await Web3Api.resolve.resolveAddress(options);
  console.log(resolve);
};
curl -X "GET" 
  "https://deep-index.moralis.io/api/v2/resolve/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/reverse" 
  -H "accept: application/json" 
  -H "X-API-Key: MY-API-KEY"
using System.Collections.Generic;
using Moralis.Web3Api.Models;
using MoralisWeb3ApiSdk;

  public async void fetchAddress()
  {
    Ens result = await MoralisInterface.GetClient().Web3Api.Resolve.ResolveAddress(address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
    print(result.ToJson());
  }

示例结果:

{
  "name": "vitalik.eth"
}


阅读全文
以上是鳄鱼CMS为你收集整理的 Moralis Web3API.resolve全部内容。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
相关文章
© 2024 鳄鱼CMS eyucms.com 版权所有 联系我们