0.5.2 • Published 28 days ago

@argoplatform/transfer-sdk v0.5.2

Weekly downloads
-
License
MIT
Repository
github
Last release
28 days ago

Transfer SDK for Web Apps

The Transfer SDK is a comprehensive Web SDK that makes interaction with the Transfer API simple.

Getting started

npm i @argoplatform/transfer-sdk

After installing, import as such:

import { Transfer } from "transfer-sdk";

To initialize:

// apiKey can be any value for now.
const settings = {
  apiKey: "DEMO",
};

const transfer = new Transfer(settings);

Functionality

These are the currently supported functions with the Transfer SDK:

  • getSupportedChains: returns a list of supported chains by the Transfer SDK.
  • getSupportedTokens: returns a list of supported tokens within a given chain.
  • getTransfer: returns route info and transaction request for a requested transfer.
  • execute: performs the transfer.

getSupportedChains()

const supportedChains = await transfer.getSupportedChains();

Returns an Array of SupportedChain object:

{
  name: string;
  chainId: number;
  logoURI?: string;
  isTestnet: boolean;
}

getSupportedTokens()

const supportedChains = await transfer.getSupportedTokens(chainId?);

chainId is the ID number of the chain you want the supported tokens from. If no chainId is provided, it will return all the supported tokens for every chain.

Returns an Array of SupportedToken object:

{
  name: string;
  chainId: number;
  address: string;
  decimals: number;
  logoURI?: string;
}

getTransfer()

Returns transactionRequest and routeInfo. Make sure to multiply the amount by the 10 ^ fromToken.decimals

const txnBody = await transfer.getTransfer(TransferRequest);

TransferRequest parameter:

{
  qty: string; // amount of `srcChainToken` transferring
  srcChainId: string; // eg 5 for ETH Goerli
  dstChainId: string;
  srcChainTokenAddress: string; // erc20 token address
  dstChainTokenAddress: string;
  fromAddress: string;
  toAddress: string;
}

Returns TransferResult:

{
  bestRoute: Route;
  alternateRoutes: Route[];
}

Route interface:

{
  dstAmountEstimate: number;
  dstChainSwapDexs: Dex[];
  srcChainSwapDexs: Dex[];
  bridgeInfo: BridgeInfo;
  transactionRequest: TransactionRequest; // ethers.js TransactionRequest object
  approvalInfo: {
    srcChainContractToApprove: string;
    srcChainTokenAddress: string;
    srcChainTokenAmount: number;
  };
}

Dex interface:

{
  name: string;
  logoURI?: string;
}

BridgeInfo interface:

{
  name: string;
  logoURI?: string;
}
0.5.2

28 days ago

0.5.1

1 month ago

0.4.9

2 months ago

0.4.8

2 months ago

0.5.0

1 month ago

0.4.5

2 months ago

0.4.7

2 months ago

0.4.6

2 months ago

0.4.4

2 months ago

0.4.1

2 months ago

0.4.3

2 months ago

0.4.2

2 months ago

0.3.9

2 months ago

0.4.0

2 months ago

0.3.8

2 months ago

0.3.7

2 months ago

0.3.5-beta.2

2 months ago

0.3.5-beta.3

2 months ago

0.3.5-beta.4

2 months ago

0.3.6

2 months ago

0.3.5-beta.1

3 months ago

0.3.5-beta.0

3 months ago

0.3.5

3 months ago

0.3.2

3 months ago

0.3.4

3 months ago

0.3.3

3 months ago

0.3.0

3 months ago

0.3.1

3 months ago

0.2.9

5 months ago

0.2.8

5 months ago

0.2.7

5 months ago

0.2.6

5 months ago

0.1.3-beta.49

6 months ago

0.1.3-beta.50

6 months ago

0.2.1

6 months ago

0.2.0

6 months ago

0.2.3

6 months ago

0.2.2

6 months ago

0.2.5

6 months ago

0.2.4

6 months ago

0.1.3-beta.48

6 months ago

0.1.3-beta.47

6 months ago

0.1.3-beta.46

6 months ago

0.1.3-beta.45

6 months ago

0.1.3-beta.44

6 months ago

0.1.3-beta.39

8 months ago

0.1.3-beta.38

10 months ago

0.1.3-beta.42

7 months ago

0.1.3-beta.41

8 months ago

0.1.3-beta.40

8 months ago

0.1.3-beta.43

7 months ago

0.1.3-beta.31

11 months ago

0.1.3-beta.30

11 months ago

0.1.3-beta.37

11 months ago

0.1.3-beta.36

11 months ago

0.1.3-beta.35

11 months ago

0.1.3-beta.34

11 months ago

0.1.3-beta.33

11 months ago

0.1.3-beta.32

11 months ago

0.1.3-beta.28

12 months ago

0.1.3-beta.27

12 months ago

0.1.3-beta.26

12 months ago

0.1.3-beta.29

11 months ago

0.1.3-beta.8

1 year ago

0.1.3-beta.7

1 year ago

0.1.3-beta.17

1 year ago

0.1.3-beta.16

1 year ago

0.1.3-beta.15

1 year ago

0.1.3-beta.14

1 year ago

0.1.3-beta.13

1 year ago

0.1.3-beta.12

1 year ago

0.1.3-beta.11

1 year ago

0.1.3-beta.10

1 year ago

0.1.3-beta.19

1 year ago

0.1.3-beta.18

1 year ago

0.1.3-beta.9

1 year ago

0.1.3-beta.20

1 year ago

0.1.3-beta.25

1 year ago

0.1.3-beta.24

1 year ago

0.1.3-beta.23

1 year ago

0.1.3-beta.22

1 year ago

0.1.3-beta.21

1 year ago

0.1.3-beta.2

1 year ago

0.1.3-beta.1

1 year ago

0.1.3-beta.4

1 year ago

0.1.3-beta.3

1 year ago

0.1.3-beta.6

1 year ago

0.1.3-beta.5

1 year ago

0.1.2

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago