The home for Hyperlane core contracts, sdk packages, and other infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
hyperlane-monorepo/typescript/sdk
Asa Oines 9592b28489
Publish utils, core, apps, sdk, and deploy packages (#329)
3 years ago
..
src Remove token bridge from the monorepo (#307) 3 years ago
.eslintignore Remove abacus- prefix from directories (#267) 3 years ago
.eslintrc.json Remove abacus- prefix from directories (#267) 3 years ago
.gitignore Remove abacus- prefix from directories (#267) 3 years ago
.npmignore Remove abacus- prefix from directories (#267) 3 years ago
.prettierrc Remove abacus- prefix from directories (#267) 3 years ago
README.md Remove abacus- prefix from directories (#267) 3 years ago
package.json Publish utils, core, apps, sdk, and deploy packages (#329) 3 years ago
tsconfig.json Unbundle core, governance, and bridge in SDK (#269) 3 years ago

README.md

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.