@firmachain/firma-js
Version:
The Official FirmaChain Javascript SDK written in Typescript
75 lines (74 loc) • 5.39 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";
import { FirmaCosmWasmCw20Service } from "./FirmaCosmWasmCw20";
export interface MarketplaceConfig {
owner: string;
cw721_address: string;
cw20_addresses: string[];
fee_address: string;
fee_rate: number;
firma_fee_address: string;
firma_fee_rate: number;
}
export interface MarketplaceRegisterData {
seller: string;
token_id: string;
sale_type: string;
amount: string;
cw20_address: string;
}
export declare class CwMarketplaceMsgData {
static getMsgDataChangeOwner(new_owner: string): string;
static getMsgDataRegisterSaleFCT(amount: string): {
action: string;
cw20_address: string;
amount: string;
};
static getMsgDataRegisterSaleCw20(cw20_address: string, amount: string): {
action: string;
cw20_address: string;
amount: string;
};
static getMsgDataPurchaseSaleFCT(token_id: string): string;
static getMsgDataPurchaseSaleCw20(token_id: string): {
action: string;
token_id: string;
};
static getMsgDataCancelSale(token_id: string): string;
}
export declare class FirmaCosmWasmCwMarketplaceService {
private readonly config;
private readonly cosmwasmService;
private readonly cw721Service;
private readonly cw20Service;
constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService, cw721Service: FirmaCosmWasmCw721Service, cw20Service: FirmaCosmWasmCw20Service);
getCwMarketplaceMsgData(): typeof CwMarketplaceMsgData;
changeOwner(wallet: FirmaWalletService, contractAddress: string, new_owner: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxChangeOwner(wallet: FirmaWalletService, contractAddress: string, new_owner: string): Promise<EncodeObject>;
registerSaleFCT(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, fctAmount: number, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxRegisterSaleFCT(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, fctAmount: number): Promise<EncodeObject>;
registerSaleCw20(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, cw20Address: string, cw20Amount: number, cw20Decimal: number, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
purchaseSaleFCT(wallet: FirmaWalletService, contractAddress: string, tokenId: string, fctAmount: number, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxPurchaseSaleFCT(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, fctAmount: string): Promise<EncodeObject>;
purchaseSaleCw20(wallet: FirmaWalletService, contractAddress: string, tokenId: string, cw20Address: string, cw20Amount: number, cw20Decimal: number, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxPurchaseSaleCw20(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, cw20Address: string, cw20Amount: number, cw20Decimal: number): Promise<EncodeObject>;
cancelSale(wallet: FirmaWalletService, contractAddress: string, tokenId: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
getUnsignedTxCancelSale(wallet: FirmaWalletService, contractAddress: string, tokenId: 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>;
getGasEstimationRegisterSaleFCT(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, fctAmount: number): Promise<number>;
getGasEstimationRegisterSaleCw20(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, cw20Address: string, cw20Amount: number, cw20Decimal: number): Promise<number>;
getGasEstimationPurchaseSaleFCT(wallet: FirmaWalletService, contractAddress: string, tokenId: string, fctAmount: number): Promise<number>;
getGasEstimationPurchaseSaleCw20(wallet: FirmaWalletService, contractAddress: string, tokenId: string, cw20Address: string, cw20Amount: number, cw20Decimal: number): Promise<number>;
getGasEstimationCancelSale(wallet: FirmaWalletService, contractAddress: string, tokenId: string): Promise<number>;
getConfig(contractAddress: string): Promise<MarketplaceConfig>;
getOwner(contractAddress: string): Promise<string>;
getRegisterList(contractAddress: string, limit?: number, start_after?: string | null): Promise<MarketplaceRegisterData[]>;
getRegisterListByAddress(contractAddress: string, address: string, limit?: number, start_after?: string | null): Promise<MarketplaceRegisterData[]>;
}