UNPKG

btc-wallet

Version:

BTC Wallet is a toolkit that enables Bitcoin usage on the NEAR blockchain through the Satoshi protocol.

119 lines (118 loc) 3.59 kB
import type { Transaction } from '@near-wallet-selector/core'; import { type ENV } from '../config'; export declare function getNonce({ env, accountId }: { env: ENV; accountId: string; }): Promise<string>; export declare function getNearNonce({ env, accountId }: { env: ENV; accountId: string; }): Promise<string>; export declare function receiveTransaction({ env, ...data }: { env: ENV; } & any): Promise<any>; interface ReceiveDepositMsgParams { env: ENV; btcPublicKey: string; txHash: string; depositType?: number; postActions?: string; extraMsg?: string; userDepositAddress?: string; } export declare function preReceiveDepositMsg({ env, btcPublicKey, depositType, postActions, extraMsg, userDepositAddress, }: Omit<ReceiveDepositMsgParams, 'txHash'>): Promise<any>; export declare function receiveDepositMsg({ env, btcPublicKey, txHash, depositType, postActions, extraMsg, }: ReceiveDepositMsgParams): Promise<any>; export declare function hasBridgeTransaction({ env, btcAccount }: { env: ENV; btcAccount: string; }): Promise<boolean>; export declare function checkBridgeTransactionStatus({ txHash, fromChain, env, }: { txHash: string; fromChain?: 'BTC' | 'NEAR'; env: ENV; }): Promise<{ Status: number; ToTxHash: string; }>; export declare function checkBtcTransactionStatus({ signature, env, }: { signature: string; env: ENV; }): Promise<{ Status: number; NearHashList: string[]; }>; export declare function getWhitelist({ env }: { env: ENV; }): Promise<string[]>; export declare function receiveWithdrawMsg({ env, txHash }: { env: ENV; txHash: string; }): Promise<any>; export interface AccountInfo { nonce: string; gas_token: Record<string, string>; debt_info?: { gas_token_id: string; near_gas_debt_amount: string; protocol_fee_debt_amount: string; }; relayer_fee?: { amount?: string; }; } export declare function getAccountInfo({ csna, env }: { csna: string; env: ENV; }): Promise<AccountInfo>; export declare function getBridgeConfig({ env }: { env: ENV; }): Promise<{ min_withdraw_amount: string; withdraw_bridge_fee: { fee_rate: number; fee_min: string; }; max_btc_gas_fee: string; change_address: string; min_change_amount: string; deposit_bridge_fee: { fee_rate: number; fee_min: string; }; min_deposit_amount: string; }>; export declare function getTokenBalance({ csna, tokenId, env, }: { csna: string; tokenId: string; env: ENV; }): Promise<{ balance: number; rawBalance: string; }>; export declare function checkGasTokenBalance(csna: string, minAmount: string, env: ENV): Promise<void>; export declare function convertTransactionToTxHex({ transaction, accountId, publicKey, env, index, }: { transaction: Transaction; accountId: string; publicKey: string; env: ENV; index?: number; }): Promise<{ txBytes: Uint8Array<ArrayBufferLike>; txHex: string; hash: any; }>; interface CalculateGasLimitParams { transactions: Transaction[]; csna: string; env: ENV; gasStrategy?: 'auto' | 'near' | 'btc'; } export declare function calculateGasLimit(params: CalculateGasLimitParams): Promise<string>; export declare function calculateGasStrategy({ csna, transactions, env, gasStrategy, }: CalculateGasLimitParams & { gasStrategy?: 'auto' | 'near' | 'btc'; }): Promise<{ transferGasTransaction?: Transaction; useNearPayGas: boolean; gasLimit: string; }>; export {};