@firmachain/firma-js
Version:
The Official FirmaChain Javascript SDK written in Typescript
111 lines (110 loc) • 8.78 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 Cw20Minter {
minter: string;
cap: string;
}
export interface Cw20MarketingInfo {
project: string;
description: string;
logo: {
url: string;
};
marketing: string;
}
export interface Cw20TokenInfo {
name: string;
symbol: string;
decimals: number;
total_supply: string;
}
export interface ExpiresAtHeight {
at_height: number;
}
export interface ExpiresAtTime {
at_time: string;
}
export interface ExpiresNever {
never: {};
}
export declare type Expires = ExpiresAtHeight | ExpiresAtTime | ExpiresNever;
export interface Cw20Allowance {
allowance: string;
expires: Expires;
}
export interface Cw20SpenderAllowance {
allowance: string;
expires: Expires;
spender: string;
}
export declare class Cw20MsgData {
static getMsgDataTransfer(recipient: string, amount: string): string;
static getMsgDataTransferFrom(owner: string, recipient: string, amount: string): string;
static getMsgDataMint(recipient: string, amount: string): string;
static getMsgDataBurn(amount: string): string;
static getMsgDataBurnFrom(owner: string, amount: string): string;
static getMsgDataIncreaseAllowance(spender: string, amount: string, expires: Expires): string;
static getMsgDataDecreaseAllowance(spender: string, amount: string, expires: Expires): string;
static getMsgDataUpdateMinter(new_minter: string): string;
static getMsgDataUpdateMarketing(description: string, marketing: string, project: string): string;
static getMsgDataUploadLogo(url: string): string;
static getMsgDataSend(contract: string, amount: string, msg: any): string;
static getMsgDataSendFrom(contract: string, owner: string, amount: string, msg: any): string;
}
export declare class FirmaCosmWasmCw20Service {
private readonly config;
private readonly cosmwasmService;
constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService);
transfer(wallet: FirmaWalletService, contractAddress: string, recipient: string, amount: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxTransfer(wallet: FirmaWalletService, contractAddress: string, recipient: string, amount: string): Promise<EncodeObject>;
transferFrom(wallet: FirmaWalletService, contractAddress: string, owner: string, recipient: string, amount: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxTransferFrom(wallet: FirmaWalletService, contractAddress: string, owner: string, recipient: string, amount: string): Promise<EncodeObject>;
mint(wallet: FirmaWalletService, contractAddress: string, recipient: string, amount: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxMint(wallet: FirmaWalletService, contractAddress: string, recipient: string, amount: string): Promise<EncodeObject>;
burn(wallet: FirmaWalletService, contractAddress: string, amount: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxBurn(wallet: FirmaWalletService, contractAddress: string, amount: string): Promise<EncodeObject>;
burnFrom(wallet: FirmaWalletService, contractAddress: string, owner: string, amount: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxBurnFrom(wallet: FirmaWalletService, contractAddress: string, owner: string, amount: string): Promise<EncodeObject>;
increaseAllowance(wallet: FirmaWalletService, contractAddress: string, spender: string, amount: string, expires: Expires, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxIncreaseAllowance(wallet: FirmaWalletService, contractAddress: string, spender: string, amount: string, expires: Expires): Promise<EncodeObject>;
decreaseAllowance(wallet: FirmaWalletService, contractAddress: string, spender: string, amount: string, expires: Expires, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxDecreaseAllowance(wallet: FirmaWalletService, contractAddress: string, spender: string, amount: string, expires: Expires): Promise<EncodeObject>;
updateMinter(wallet: FirmaWalletService, contractAddress: string, new_minter: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxUpdateMinter(wallet: FirmaWalletService, contractAddress: string, new_minter: string): Promise<EncodeObject>;
updateMarketing(wallet: FirmaWalletService, contractAddress: string, description: string, marketing: string, project: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxUpdateMarketing(wallet: FirmaWalletService, contractAddress: string, description: string, marketing: string, project: string): Promise<EncodeObject>;
uploadLogo(wallet: FirmaWalletService, contractAddress: string, url: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxUploadLogo(wallet: FirmaWalletService, contractAddress: string, url: string): Promise<EncodeObject>;
send(wallet: FirmaWalletService, contractAddress: string, targetContractAddress: string, amount: string, msg: any, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxSend(wallet: FirmaWalletService, contractAddress: string, targetContractAddress: string, amount: string, msg: any): Promise<EncodeObject>;
sendFrom(wallet: FirmaWalletService, contractAddress: string, targetContractAddress: string, owner: string, amount: string, msg: any, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxSendFrom(wallet: FirmaWalletService, contractAddress: string, targetContractAddress: string, owner: string, amount: string, msg: any): Promise<EncodeObject>;
signAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getGasEstimationSignAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<number>;
getGasEstimationTransfer(wallet: FirmaWalletService, contractAddress: string, recipient: string, amount: string): Promise<number>;
getGasEstimationTransferFrom(wallet: FirmaWalletService, contractAddress: string, owner: string, recipient: string, amount: string): Promise<number>;
getGasEstimationMint(wallet: FirmaWalletService, contractAddress: string, recipient: string, amount: string): Promise<number>;
getGasEstimationBurn(wallet: FirmaWalletService, contractAddress: string, amount: string): Promise<number>;
getGasEstimationBurnFrom(wallet: FirmaWalletService, contractAddress: string, owner: string, amount: string): Promise<number>;
getGasEstimationIncreaseAllowance(wallet: FirmaWalletService, contractAddress: string, spender: string, amount: string, expires: Expires): Promise<number>;
getGasEstimationDecreaseAllowance(wallet: FirmaWalletService, contractAddress: string, spender: string, amount: string, expires: Expires): Promise<number>;
getGasEstimationUpdateMinter(wallet: FirmaWalletService, contractAddress: string, new_minter: string): Promise<number>;
getGasEstimationUpdateMarketing(wallet: FirmaWalletService, contractAddress: string, description: string, marketing: string, project: string): Promise<number>;
getGasEstimationUploadLogo(wallet: FirmaWalletService, contractAddress: string, logo: string): Promise<number>;
getGasEstimationSend(wallet: FirmaWalletService, contractAddress: string, targetContractAddress: string, amount: string, msg: any): Promise<number>;
getGasEstimationSendFrom(wallet: FirmaWalletService, contractAddress: string, targetContractAddress: string, owner: string, amount: string, msg: any): Promise<number>;
getBalance(contractAddress: string, address: string): Promise<string>;
getTotalSupply(contractAddress: string): Promise<string>;
getTokenInfo(contractAddress: string): Promise<Cw20TokenInfo>;
getMinter(contractAddress: string): Promise<Cw20Minter>;
getAllowance(contractAddress: string, owner: string, spender: string): Promise<Cw20Allowance>;
getAllAllowances(contractAddress: string, owner: string, limit?: number, start_after?: string | null): Promise<Cw20SpenderAllowance[]>;
getAllSpenderAllowances(contractAddress: string, spender: string, limit?: number, start_after?: string | null): Promise<Cw20SpenderAllowance[]>;
getAllAccounts(contractAddress: string, limit?: number, start_after?: string | null): Promise<string[]>;
getMarketingInfo(contractAddress: string): Promise<Cw20MarketingInfo>;
getDownloadLogo(contractAddress: string): Promise<string>;
}