@firmachain/firma-js
Version:
The Official FirmaChain Javascript SDK written in Typescript
126 lines (125 loc) • 9.1 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";
export interface Cw721ExpiresAtHeight {
at_height: number;
}
export interface Cw721ExpiresAtTime {
at_time: string;
}
export interface Cw721ExpiresNever {
never: {};
}
export declare type Cw721Expires = Cw721ExpiresAtHeight | Cw721ExpiresAtTime | Cw721ExpiresNever;
interface OwnershipResponse {
owner: string | null;
pending_owner: string | null;
pending_expiry: Cw721Expires | null;
}
export interface Cw721NftInfo {
access: {
owner: string;
approvals: Cw721Approval[];
};
info: {
token_uri: string;
extension: Object;
};
}
export interface Cw721ContractInfo {
name: string;
symbol: string;
}
export interface Cw721Approval {
spender: string;
expires: Cw721Expires;
}
export interface Cw721Attribute {
trait_type: string;
value: string | number;
display_type?: string;
}
export interface Cw721Extension {
name: string;
description: string;
image: string;
image_data?: string;
external_url?: string;
attributes?: Cw721Attribute[];
background_color?: string;
animation_url?: string;
youtube_url?: string;
}
export declare class Cw721MsgData {
static getMsgDataMint(owner: string, token_id: string, token_uri: string): string;
static getMsgDataBurn(token_id: string): string;
static getMsgDataTransfer(recipient: string, token_id: string): string;
static getMsgDataApprove(spender: string, token_id: string, expires: Cw721Expires): string;
static getMsgDataRevoke(spender: string, token_id: string): string;
static getMsgDataApproveAll(operator: string, expires: Cw721Expires): string;
static getMsgDataRevokeAll(operator: string): string;
static getMsgDataSendNft(contract: string, token_id: string, msg: any): string;
static getMsgUpdateOwnerShipTransfer(new_owner: string, expiry: Cw721Expires): string;
static getMsgUpdateOwnerShipAccept(): string;
static getMsgUpdateOwnerShipRenounce(): string;
static getMsgDataMintWithExtension(owner: string, token_id: string, token_uri: string, extension: Cw721Extension): string;
}
export declare class FirmaCosmWasmCw721Service {
private readonly config;
private readonly cosmwasmService;
constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService);
mint(wallet: FirmaWalletService, contractAddress: string, owner: string, token_id: string, token_uri?: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
mintWithExtension(wallet: FirmaWalletService, contractAddress: string, owner: string, token_id: string, extension: Cw721Extension, token_uri?: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxMint(wallet: FirmaWalletService, contractAddress: string, owner: string, token_id: string, token_uri?: string): Promise<EncodeObject>;
burn(wallet: FirmaWalletService, contractAddress: string, token_id: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxBurn(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<EncodeObject>;
transfer(wallet: FirmaWalletService, contractAddress: string, recipient: string, token_id: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxTransfer(wallet: FirmaWalletService, contractAddress: string, recipient: string, token_id: string): Promise<EncodeObject>;
approve(wallet: FirmaWalletService, contractAddress: string, spender: string, token_id: string, expires: Cw721Expires, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxApprove(wallet: FirmaWalletService, contractAddress: string, spender: string, token_id: string, expires: Cw721Expires): Promise<EncodeObject>;
revoke(wallet: FirmaWalletService, contractAddress: string, spender: string, token_id: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxRevoke(wallet: FirmaWalletService, contractAddress: string, spender: string, token_id: string): Promise<EncodeObject>;
approveAll(wallet: FirmaWalletService, contractAddress: string, operator: string, expires: Cw721Expires, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxApproveAll(wallet: FirmaWalletService, contractAddress: string, operator: string, expires: Cw721Expires): Promise<EncodeObject>;
revokeAll(wallet: FirmaWalletService, contractAddress: string, operator: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxRevokeAll(wallet: FirmaWalletService, contractAddress: string, operator: string): Promise<EncodeObject>;
sendNft(wallet: FirmaWalletService, contractAddress: string, targetContractAddress: string, token_id: string, msg: any, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxSendNft(wallet: FirmaWalletService, contractAddress: string, targetContractAddress: string, token_id: string, msg: any): Promise<EncodeObject>;
updateOwnerShipTransfer(wallet: FirmaWalletService, contractAddress: string, new_owner: string, expiry: Cw721Expires, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxUpdateOwnerShipTransfer(wallet: FirmaWalletService, contractAddress: string, new_owner: string, expiry: Cw721Expires): Promise<EncodeObject>;
updateOwnerShipAccept(wallet: FirmaWalletService, contractAddress: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxUpdateOwnerShipAccept(wallet: FirmaWalletService, contractAddress: string): Promise<EncodeObject>;
updateOwnerShipRenounce(wallet: FirmaWalletService, contractAddress: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxUpdateOwnerShipRenounce(wallet: FirmaWalletService, contractAddress: string): Promise<EncodeObject>;
signAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getGasEstimationSignAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<number>;
getGasEstimationMint(wallet: FirmaWalletService, contractAddress: string, owner: string, token_id: string, token_uri?: string): Promise<number>;
getGasEstimationBurn(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<number>;
getGasEstimationTransfer(wallet: FirmaWalletService, contractAddress: string, recipient: string, token_id: string): Promise<number>;
getGasEstimationApprove(wallet: FirmaWalletService, contractAddress: string, spender: string, token_id: string, expires: Cw721Expires): Promise<number>;
getGasEstimationRevoke(wallet: FirmaWalletService, contractAddress: string, spender: string, token_id: string): Promise<number>;
getGasEstimationApproveAll(wallet: FirmaWalletService, contractAddress: string, operator: string, expires: Cw721Expires): Promise<number>;
getGasEstimationRevokeAll(wallet: FirmaWalletService, contractAddress: string, operator: string): Promise<number>;
getGasEstimationSendNft(wallet: FirmaWalletService, contractAddress: string, targetContractAddress: string, token_id: string, msg: any): Promise<number>;
getGasEstimationUpdateOwnerShipTransfer(wallet: FirmaWalletService, contractAddress: string, new_owner: string, expiry: Cw721Expires): Promise<number>;
getGasEstimationUpdateOwnerShipAccept(wallet: FirmaWalletService, contractAddress: string): Promise<number>;
getGasEstimationUpdateOwnerShipRenounce(wallet: FirmaWalletService, contractAddress: string): Promise<number>;
getOwnerFromNftID(contractAddress: string, tokenId: string): Promise<string>;
getApproval(contractAddress: string, tokenId: string, spender: string, isIncludeExpired?: boolean): Promise<Cw721Approval>;
getApprovals(contractAddress: string, tokenId: string, isIncludeExpired?: boolean): Promise<Cw721Approval[]>;
getAllOperators(contractAddress: string, owner: string, isIncludeExpired?: boolean, limit?: number, start_after?: string | null): Promise<Cw721Approval[]>;
getOperator(contractAddress: string, owner: string, operator: string, isIncludeExpired?: boolean): Promise<Cw721Approval>;
getTotalNfts(contractAddress: string): Promise<number>;
getContractInfo(contractAddress: string): Promise<Cw721ContractInfo>;
getNftTokenUri(contractAddress: string, tokenId: string): Promise<string>;
getNftData(contractAddress: string, tokenId: string): Promise<Cw721NftInfo>;
getNFTIdListOfOwner(contractAddress: string, owner: string, limit?: number, start_after?: string | null): Promise<string[]>;
getAllNftIdList(contractAddress: string, limit?: number, start_after?: string | null): Promise<string[]>;
getMinter(contractAddress: string): Promise<string>;
getExtension(contractAddress: string): Promise<any>;
getOwnerShip(contractAddress: string): Promise<OwnershipResponse>;
}
export {};