@lucoadam/zebec-wormhole-sdk
Version:
This sdk can be use to transfer assets across chains and to interact with the Zebec's xchain bridge smart contracts for passing message from EVM chain to solana specially to utilize the features of Zebec Streaming and Zebec Multisig Streaming protocol.
62 lines (61 loc) • 3.58 kB
TypeScript
import { BigNumber, ContractReceipt, ethers } from "ethers";
import { ChainId, EVMChainId } from "@certusone/wormhole-sdk";
import { IZebecEthBridgeClient } from "./definitions";
export declare class ZebecEthBridgeClient implements IZebecEthBridgeClient {
readonly ArbitaryFee: BigNumber;
private _contractAddress;
get contractAddress(): string;
private _chainId;
private _contract;
/**
* Constructs an client instance to interact with evm bridge contract
* @param contractAddress address of the bridge contract address
* @param signer evm signer
* @param sourceChain wormhole chain id of deployed evm contract
*/
constructor(contractAddress: string, signer: ethers.Signer, sourceChain: EVMChainId);
registerEmitterAddress(chainId: ChainId, emitterAddress: string): Promise<ContractReceipt>;
depositSol(amount: string, depositor: string): Promise<ethers.ContractReceipt>;
depositToken(amount: string, depositor: string, tokenMint: string): Promise<ethers.ContractReceipt>;
withdrawSol(amount: string, sender: string): Promise<ContractReceipt>;
withdrawToken(amount: string, sender: string, tokenMint: string): Promise<ContractReceipt>;
startSolStream(startTime: string, endTime: string, amount: string, receiver: string, sender: string, canCancel: boolean, canUpdate: boolean): Promise<ethers.ContractReceipt>;
startTokenStream(startTime: string, endTime: string, amount: string, receiver: string, sender: string, canCancel: boolean, canUpdate: boolean, tokenMint: string): Promise<ethers.ContractReceipt>;
updateSolStream(startTime: string, endTime: string, amount: string, receiver: string, sender: string, dataAccount: string): Promise<ethers.ContractReceipt>;
updateTokenStream(startTime: string, endTime: string, amount: string, receiver: string, sender: string, tokenMint: string, dataAccount: string): Promise<ethers.ContractReceipt>;
withdrawFromSolStream(sender: string, withdrawer: string, dataAccount: string): Promise<ContractReceipt>;
withdrawFromTokenStream(sender: string, withdrawer: string, tokenMint: string, dataAccount: string): Promise<ContractReceipt>;
cancelSolStream(sender: string, dataAccount: string): Promise<ContractReceipt>;
cancelTokenStream(sender: string, receiver: string, tokenMint: string, dataAccount: string): Promise<ContractReceipt>;
pauseSolStream(sender: string, dataAccount: string): Promise<ContractReceipt>;
pauseTokenStream(sender: string, receiver: string, tokenMint: string, dataAccount: string): Promise<ContractReceipt>;
instantSolTransfer(amount: string, sender: string, withdrawer: string): Promise<ContractReceipt>;
instantTokenTransfer(amount: string, sender: string, withdrawer: string, tokenMint: string): Promise<ContractReceipt>;
directTokenTransfer(amount: string, sender: string, tokenMint: string, receiver: string): Promise<ContractReceipt>;
/**
* Checks if given amount is valid
* @param amount
* @returns
*/
private checkAmount;
/**
* Checks if given address is valid evm address
* @param address
* @param chainId
* @returns
*/
private checkEthAddress;
/**
* Checks if given address is valid solana address
* @param address
* @returns
*/
private checkSolanaAddress;
/**
* Checks if given start time and end time are valid
* @param startTime
* @param endTime
* @returns
*/
private checkStartTimeAndEndTime;
}