@aavegotchi/sdk 中文文档教程

发布于 3年前 浏览 24 项目主页 更新于 3年前

aavegotchi-sdk ????????

Polygon 主网上 Aaveotchi 子图和合约的 Node.js 客户端!

 NPM Version

Table of content

Features

  • Ready for regular Javacript and browser environments
  • Convienient bundle of official addresses / subgraphs
  • No-frills setup with ethers or web3
  • GraphQL client for querying Aavegotchi subgraphs
  • Full developer-friendly TypeScript support

Install

添加到Node.js 项目中的npmyarn

  • Browser demo on Codesandbox
$ npm install @aavegotchi/sdk
# or
$ yarn add @aavegotchi/sdk

Usage

Subgraph Data

import { graphql } from "@aavegotchi/sdk";
const chainId = 137;
const urls = graphql.urls.diamond[chainId];
const client = graphql.client();

const main = () => {
  const userAddress = "0xfffffffffffffffffffffffffffffff";
  const res = await client(`{
    aavegotchis(first: 500, where: {
      owner: ${userAdd}
    }) {
      id
      name
    }
  }`);
  console.log(res);
};

main();

On-Chain Data

用户的Token 信息。

import {
  AavegotchiFacet__factory,
  getDefaultProvider,
  contracts,
} from "@aavegotchi/sdk";
const chainId = 137;
const diamond = contracts.addresses[chainId];
const provider = getDefaultProvider();
const aavegotchiFacet = AavegotchiFacet__factory.connect(diamond, provider);

const main = () => {
  console.log(aavegotchiFacet);
  const tokensOfOwner = await;
};

main();

Get Help

External

https://docs.aavegotchi.com

https://louper.dev/?address=0x86935F11C86623deC8a25696E1C19a8659CbF95d&network=polygon

https://thegraph.com/explorer/subgraph/aavegotchi/aavegotchi-core-matic?version=current

aavegotchi-sdk ????????

Node.js client for Aaveotchi subgraphs and contracts on Polygon mainnet!

NPM Version

Table of content

Features

  • Ready for regular Javacript and browser environments
  • Convienient bundle of official addresses / subgraphs
  • No-frills setup with ethers or web3
  • GraphQL client for querying Aavegotchi subgraphs
  • Full developer-friendly TypeScript support

Install

Add to a Node.js project with npm or yarn

  • Browser demo on Codesandbox
$ npm install @aavegotchi/sdk
# or
$ yarn add @aavegotchi/sdk

Usage

Subgraph Data

import { graphql } from "@aavegotchi/sdk";
const chainId = 137;
const urls = graphql.urls.diamond[chainId];
const client = graphql.client();

const main = () => {
  const userAddress = "0xfffffffffffffffffffffffffffffff";
  const res = await client(`{
    aavegotchis(first: 500, where: {
      owner: ${userAdd}
    }) {
      id
      name
    }
  }`);
  console.log(res);
};

main();

On-Chain Data

Token information of a user.

import {
  AavegotchiFacet__factory,
  getDefaultProvider,
  contracts,
} from "@aavegotchi/sdk";
const chainId = 137;
const diamond = contracts.addresses[chainId];
const provider = getDefaultProvider();
const aavegotchiFacet = AavegotchiFacet__factory.connect(diamond, provider);

const main = () => {
  console.log(aavegotchiFacet);
  const tokensOfOwner = await;
};

main();

Get Help

External

https://docs.aavegotchi.com

https://louper.dev/?address=0x86935F11C86623deC8a25696E1C19a8659CbF95d&network=polygon

https://thegraph.com/explorer/subgraph/aavegotchi/aavegotchi-core-matic?version=current

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文