UNPKG

@zerochain/sdk

Version:

The Züs JS SDK is a JavaScript client library that provides a convenient interface for interacting with the Züs Network. It allows developers to perform various operations such as creating and managing allocations, uploading and downloading files, executi

121 lines (120 loc) 4.45 kB
import type { ActiveWallet, NetworkDomain } from '@/types/wallet'; /** initBridge initializes the bridge client */ export declare const initBridge: ({ domain, wallet, ethereumAddress, bridgeAddress, authorizersAddress, tokenAddress, ethereumNodeURL, gasLimit, value, consensusThreshold, }: { domain: NetworkDomain; wallet: ActiveWallet; /** Ethereum address of the wallet owner */ ethereumAddress: string; /** Address of the bridge contract on the Ethereum network */ bridgeAddress: string; /** Address of the authorizers contract on the Ethereum network */ authorizersAddress: string; /** Address of the token contract on the Ethereum network */ tokenAddress: string; /** URL of the Ethereum node */ ethereumNodeURL: string; /** Gas limit for the transactions */ gasLimit: number; /** Consensus threshold for the transactions */ consensusThreshold: number; /** Value to be sent with the transaction (unused) */ value?: number; }) => Promise<void>; /** * burnZCN burns ZCN tokens * @returns the hash of the transaction */ export declare const burnZCN: ({ domain, wallet, amount, }: { domain: NetworkDomain; wallet: ActiveWallet; /** Amount of ZCN tokens to burn */ amount: number; }) => Promise<string>; /** * mintZCN Mints ZCN tokens * @returns the hash of the transaction */ export declare const mintZCN: ({ domain, wallet, burnTxnHash, timeout, }: { domain: NetworkDomain; wallet: ActiveWallet; /** Hash of the burn transaction */ burnTxnHash: string; /** * Timeout in seconds * @deprecated */ timeout: number; }) => Promise<string>; type MintPayload = { zcn_txn_id: string; amount: number; to: string; nonce: number; signatures: AuthorizerSignature[]; }; type AuthorizerSignature = { authorizer_id: string; signature: Uint8Array; }; /** getMintWZCNPayload returns the *Mint WZCN Payload* for the given burn transaction hash */ export declare const getMintWZCNPayload: ({ domain, wallet, burnTxnHash, }: { domain: NetworkDomain; wallet: ActiveWallet; /** Hash of the burn transaction */ burnTxnHash: string; }) => Promise<MintPayload>; type BurnEvent = { nonce: number; amount: number; hash: string; }; /** getUnprocessedWZCNBurnEvents returns all unprocessed WZCN burn events from the Ethereum network */ export declare const getUnprocessedWZCNBurnEvents: ({ domain, wallet, }: { domain: NetworkDomain; wallet: ActiveWallet; }) => Promise<BurnEvent[]>; /** BurnTicket represents the burn ticket of native ZCN tokens used by the bridge protocol to mint ERC20 tokens */ type BurnTicket = { hash: string; amount: number; nonce: number; }; /** getProcessedZCNBurnTickets Returns all processed ZCN burn tickets burned for a certain ethereum address */ export declare const getProcessedZCNBurnTickets: ({ domain, wallet, }: { domain: NetworkDomain; wallet: ActiveWallet; }) => Promise<BurnTicket[]>; /** estimateMintWZCNGasAmount performs gas amount estimation for the given Mint WZCN transaction. */ export declare const estimateMintWZCNGasAmount: ({ domain, wallet, from, to, zcnTransaction, amountTokens, nonce, signaturesRaw, }: { domain: NetworkDomain; wallet: ActiveWallet; /** Address of the sender */ from: string; /** Address of the receiver */ to: string; /** Hash of the ZCN transaction */ zcnTransaction: string; /** Amount of tokens to mint */ amountTokens: number; /** Nonce of the transaction */ nonce: number; /** Encoded format (base-64) of the burn signatures received from the authorizers. */ signaturesRaw: string[]; }) => Promise<string>; /** estimateBurnWZCNGasAmount performs gas amount estimation for the given burn wzcn transaction */ export declare const estimateBurnWZCNGasAmount: ({ domain, wallet, from, to, amountTokens, }: { domain: NetworkDomain; wallet: ActiveWallet; /** Address of the sender */ from: string; /** Address of the receiver */ to: string; /** Amount of tokens to burn */ amountTokens: number; }) => Promise<string>; /** estimateGasPrice performs gas estimation for the given transaction using Alchemy enhanced API returning approximate final gas fee */ export declare const estimateGasPrice: ({ domain, wallet, }: { domain: NetworkDomain; wallet: ActiveWallet; }) => Promise<string>; export {};