@biconomy/hyphen
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

Hyphen SDK (Hyphen)

Introduction

Hyphen SDK, is a javascript based SDK written in typescript that helps in integrating Hyphen services easily. It provides some helper methods that makes the Hyphen integration too easy. Even though you can just interact with LiquidityPoolManager smart contract directly and deposit the tokens using depositErc20 method from your DApp and do the deposit transactions but using SDK is recommended as it provides methods like checking available liquidity before doing the transaction, checking exit transaction status, checking approvals etc.

Check out the documentation for more details.

Let’s Get Started

Import and Instantiate Hyphen

npm install @biconomy/hyphen

or

yarn add @biconomy/hyphen

import { Hyphen } from "@biconomy/hyphen";

let hyphen = new Hyphen(<Provider Object>, {
  debug: true,            // If 'true', it prints debug logs on console window
  environment: "test",    // It can be "test" or "prod"
  onFundsTransfered: (data) => {
    // Callback method which will be called when funds transfer across
    // chains will be completed
  }
});

Initialize the SDK

await hyphen.init();

Doing a Cross Chain Transfer

let depositTx = await hyphen.deposit({
    sender: "User wallet address",
    receiver: "Receiver address on toChain. Can be different than sender",
    tokenAddress: "Address of the token on fromChain to be transferred",
    depositContractAddress: "LiquidityPoolManager address on fromChain",
    amount: "Amount to be transferred. Denoted in smallest unit eg in wei",
    fromChainId: 137, // chainId of fromChain
    toChainId: 1,     // chainId of toChain
});

// Wait for 1 block confirmation
await depositTx.wait(1);

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.1.629latest
1.1.7-beta.14beta

Version History

VersionDownloads (Last 7 Days)Published
1.1.7-beta.14
1.1.629
1.1.51
1.1.41
1.1.31
1.1.21
1.1.11
1.1.01
1.0.11
1.0.01
0.0.211
0.0.201
0.0.191
0.0.181
0.0.171
0.0.161
0.0.151
0.0.141
0.0.131
0.0.121
0.0.111
0.0.101
0.0.91
0.0.81
0.0.71
0.0.61
0.0.51
0.0.41
0.0.31
0.0.21
0.0.11

Package Sidebar

Install

npm i @biconomy/hyphen

Weekly Downloads

62

Version

1.1.6

License

MIT

Unpacked Size

162 kB

Total Files

42

Last publish

Collaborators

  • divyan73
  • vgabriel45
  • joepegler
  • arcticfloyd1984
  • aboudjem
  • ankurdubey.bico
  • livingrock7
  • sachin.tomar