@abacus-network/sdk 中文文档教程
Abacus SDK
Abacus SDK 是一个管理系统 ethers.js 提供帮助的提供者和签名者 开发人员同时连接到多个网络。 它是一部分 Abacus 项目,但可能 对其他多链系统有用。
这个包包括 MultiProvider
,以及一个 AbacusContext
与已部署的 Abacus 系统交互。 开发、暂存和主网 Abacus 系统具有用于快速开发的预构建对象。
Intended Usage
import * as ethers from 'ethers';
import { mainnet } from '@abacus-network/sdk';
// Set up providers and signers
const someEthersProvider = ethers.providers.WsProvider('...');
const someEthersSigner = new AnySigner(...);
mainnet.registerProvider('ethereum', someEthersProvider);
mainnet.registerSigner('ethereum', someEthersSigner);
// We have shortcuts for common provider/signer types
mainnet.registerRpcProvider('celo', 'https://forno.celo.org');
mainnet.registerWalletSigner('celo', '0xabcd...');
// Interact with the Abacus Bridge
// Send ETH from ethereum to celo
await mainnet.sendNative(
'ethereum', // source
'celo', // destination
ethers.constants.WeiPerEther, // amount
'0x1234...', // recipient
);
// Send Tokens from celo to ethereum
await mainnet.send(
'celo', // source
'ethereum', // destination
{ domain: 'ethereum', id: "0xabcd..."} // token information
ethers.constants.WeiPerEther, // amount
'0x1234...' // recipient
{ gasLimit: 300_000 } // standard ethers tx overrides
);
// so easy.
Abacus SDK
Abacus SDK is a management system for ethers.js providers and signers that helps developers connect to multiple networks simultaneously. It is part of the Abacus project, but may be useful to other multi-chain systems.
This package includes the MultiProvider
, as well as an AbacusContext
for interacting with deployed Abacus systems. The dev, staging, and mainnet Abacus systems have pre-built objects for quick development.
Intended Usage
import * as ethers from 'ethers';
import { mainnet } from '@abacus-network/sdk';
// Set up providers and signers
const someEthersProvider = ethers.providers.WsProvider('...');
const someEthersSigner = new AnySigner(...);
mainnet.registerProvider('ethereum', someEthersProvider);
mainnet.registerSigner('ethereum', someEthersSigner);
// We have shortcuts for common provider/signer types
mainnet.registerRpcProvider('celo', 'https://forno.celo.org');
mainnet.registerWalletSigner('celo', '0xabcd...');
// Interact with the Abacus Bridge
// Send ETH from ethereum to celo
await mainnet.sendNative(
'ethereum', // source
'celo', // destination
ethers.constants.WeiPerEther, // amount
'0x1234...', // recipient
);
// Send Tokens from celo to ethereum
await mainnet.send(
'celo', // source
'ethereum', // destination
{ domain: 'ethereum', id: "0xabcd..."} // token information
ethers.constants.WeiPerEther, // amount
'0x1234...' // recipient
{ gasLimit: 300_000 } // standard ethers tx overrides
);
// so easy.
更多
你可能也喜欢
- 2gis-project-loader 中文文档教程
- @0xc/msteams-samesite-compatibility-validator 中文文档教程
- @1000ch/eslint-config 中文文档教程
- @100mslive/hmsvideo-web 中文文档教程
- @21kb/react-page-visible-hook 中文文档教程
- @4geit/swg-data-table-path 中文文档教程
- @7polo/editorjs-code 中文文档教程
- @_nu/vanilla-button 中文文档教程
- @aatif-packages/components 中文文档教程
- @ab-task/rtb 中文文档教程