Near-One / bridge-sdk-js

0 stars 0 forks source link

[OmniBridge] Implement essential Bridge SDK JS library #1

Open karim-en opened 2 days ago

karim-en commented 2 days ago

We need to implement essential bridge SDK in Typescript; the library should include basic functions to be able to create and track transfers.

This is just a nominal description of the, it is subject to change during the development if needed.

interface TransferMessage {
  tokenAddress: OmniAddress,
  amount: BigNumber,
  fee: BigNumber,
  nativeFee: BigNumber,
  recipient: OmniAddress,
  message: string | null
}

interface OmniTransfer {
  txId: string,
  nonce: BigNumber,
  transferMessage: TransferMessage
}

function omniTransfer(
  wallet: ethers.Wallet | NearWalletConnection | solWalletAdapter, 
  transferMessage: TransferMessage
): Promise<OmniTransfer>;

function findOmniTransfers(sender: OmniAddress): Promise<OmniTransfer[]>; 
function getFee(sender: OmniAddress, recipient: OmniAddress): Promise<Fee>;
function getTransferStatus(originChain: ChainKind, nonce: BigNumber): Promise<Status>;

function initDeployToken(tokenAddress: OmniAddress, destinationChain: ChainKind): Promise;
function finDeployToken(txId: OmniTranscationId): Promise;
function bindToken(txId: OmniTranscationId): Promise;

Notes:

karim-en commented 7 hours ago

To init the deployment:

To finalize it:

To bind the deployed token on Near: