@firmachain/firma-js
Version:
The Official FirmaChain Javascript SDK written in Typescript
78 lines (77 loc) • 5.67 kB
TypeScript
import { FirmaConfig } from "./FirmaConfig";
import { FirmaCosmWasmService } from "./FirmaCosmWasmService";
import { FirmaWalletService } from "./FirmaWalletService";
import { TxMisc } from "./firmachain/common";
import { EncodeObject } from "@cosmjs/proto-signing";
import { BroadcastTxResponse } from "./firmachain/common/stargateclient";
import { FirmaCosmWasmCw721Service } from "./FirmaCosmWasmCw721";
export interface BridgeGlobalTxCounts {
lock_count: number;
unlock_count: number;
deposit_count: number;
withdraw_count: number;
}
export interface BridgeConfig {
owner: string;
cw721_address: string;
}
export interface NftInfo {
owner: string;
token_id: string;
is_deposit: boolean;
}
export declare class CwBridgeMsgData {
static getMsgDataChangeOwner(new_owner: string): string;
static getMsgDataAddAuthorizedUser(user: string): string;
static getMsgDataRemoveAuthorizedUser(user: string): string;
static getMsgDataLock(): {
action: string;
target_addr: string;
};
static getMsgDataDeposit(toAddress: string): {
action: string;
target_addr: string;
};
static getMsgDataUnlock(token_id: string): string;
static getMsgDataWithdraw(token_id: string): string;
static getMsgDataMint(owner: string, token_id: string, token_uri: string): string;
}
export declare class FirmaCosmWasmCwBridgeService {
private readonly config;
private readonly cosmwasmService;
private readonly cw721Service;
constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService, cw721Service: FirmaCosmWasmCw721Service);
getCwBridgeMsgData(): typeof CwBridgeMsgData;
changeOwner(wallet: FirmaWalletService, contractAddress: string, new_owner: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxChangeOwner(wallet: FirmaWalletService, contractAddress: string, new_owner: string): Promise<EncodeObject>;
addAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxAddAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string): Promise<EncodeObject>;
removeAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxRemoveAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string): Promise<EncodeObject>;
lock(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxLock(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string): Promise<EncodeObject>;
deposit(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, toAddress: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxDeposit(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, toAddress: string): Promise<EncodeObject>;
unlock(wallet: FirmaWalletService, contractAddress: string, token_id: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxUnlock(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<EncodeObject>;
withdraw(wallet: FirmaWalletService, contractAddress: string, token_id: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxWithdraw(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<EncodeObject>;
signAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getGasEstimationSignAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<number>;
getGasEstimationChangeOwner(wallet: FirmaWalletService, contractAddress: string, new_owner: string): Promise<number>;
getGasEstimationAddAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string): Promise<number>;
getGasEstimationRemoveAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string): Promise<number>;
getGasEstimationLock(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string): Promise<number>;
getGasEstimationDeposit(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, toAddress: string): Promise<number>;
getGasEstimationUnlock(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<number>;
getGasEstimationWithdraw(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<number>;
getConfig(contractAddress: string): Promise<BridgeConfig>;
getOwner(contractAddress: string): Promise<string>;
getAuthorizedUsers(contractAddress: string): Promise<string[]>;
getNftInfo(contractAddress: string, tokenId: string): Promise<NftInfo>;
getOwnerNfts(contractAddress: string, ownerAddress: string, limit?: number, start_after?: string | null): Promise<string[]>;
getOwnerNftsInfo(contractAddress: string, ownerAddress: string, limit?: number, start_after?: string | null): Promise<NftInfo[]>;
getOwnerWithdrawableNfts(contractAddress: string, ownerAddress: string, limit?: number, start_after?: string | null): Promise<NftInfo[]>;
getOwnerUnlockableNfts(contractAddress: string, ownerAddress: string, limit?: number, start_after?: string | null): Promise<NftInfo[]>;
getGlobalTxCounts(contractAddress: string): Promise<BridgeGlobalTxCounts>;
}