meta-contract-debug
Version:
Meta Contract SDK
133 lines (132 loc) • 5.16 kB
TypeScript
export declare enum API_NET {
MAIN = "mainnet",
TEST = "testnet"
}
export declare enum API_TARGET {
MVC = "mvc"
}
export declare type NonFungibleTokenUnspent = {
txId: string;
outputIndex: number;
tokenAddress: string;
tokenIndex: string;
metaTxId: string;
metaOutputIndex: number;
};
export declare type FungibleTokenUnspent = {
txId: string;
outputIndex: number;
tokenAddress: string;
tokenAmount: string;
};
export declare type SA_utxo = {
txId: string;
outputIndex: number;
satoshis: number;
address: string;
height: number;
};
export declare type FungibleTokenSummary = {
codehash: string;
genesis: string;
sensibleId: string;
pendingBalance: string;
balance: string;
symbol: string;
decimal: number;
};
export declare type NonFungibleTokenSummary = {
codehash: string;
genesis: string;
sensibleId: string;
count: string;
pendingCount: string;
metaTxId: string;
metaOutputIndex: number;
supply: string;
};
export declare type FungibleTokenBalance = {
balance: string;
pendingBalance: string;
utxoCount: number;
decimal: number;
};
export declare type NftSellUtxo = {
codehash: string;
genesis: string;
tokenIndex: string;
txId: string;
outputIndex: number;
sellerAddress: string;
contractAddress?: string;
satoshisPrice: number;
price: number;
};
export declare type AuthorizationOption = {
/**
* should be provided in MetaSV
*/
authorization?: string;
/**
* should be provided in MetaSV
*/
privateKey?: any;
};
export declare type OutpointSpent = {
spentTxId: string;
spentInputIndex: number;
};
export interface ApiBase {
authorize: (options: AuthorizationOption) => void;
getUnspents: (address: string) => Promise<SA_utxo[]>;
getRawTxData: (txid: string) => Promise<string>;
checkTxSeen: (txid: string) => Promise<boolean>;
broadcast: (hex: string) => Promise<string>;
getFungibleTokenUnspents: (codehash: string, genesis: string, address: string, size?: number) => Promise<FungibleTokenUnspent[]>;
getFungibleTokenBalance: (codehash: string, genesis: string, address: string) => Promise<FungibleTokenBalance>;
getFungibleTokenSummary(address: string): Promise<FungibleTokenSummary[]>;
getNonFungibleTokenUnspents(codehash: string, genesis: string, address: string, cursor?: number, size?: number): Promise<NonFungibleTokenUnspent[]>;
getNonFungibleTokenUnspentDetail(codehash: string, genesis: string, tokenIndex: string): Promise<NonFungibleTokenUnspent>;
getNonFungibleTokenSummary(address: string): Promise<NonFungibleTokenSummary[]>;
getBalance(address: string): Promise<{
balance: number;
pendingBalance: number;
}>;
getNftSellUtxo(codehash: string, genesis: string, tokenIndex: string, includesNotReady?: boolean): Promise<NftSellUtxo>;
getNftSellList(codehash: string, genesis: string, cursor?: number, size?: number): Promise<NftSellUtxo[]>;
getNftSellListByAddress(address: string, cursor?: number, size?: number): Promise<NftSellUtxo[]>;
getOutpointSpent(txId: string, index: number): Promise<OutpointSpent>;
getXpubLiteUtxo(xpub: string): Promise<any>;
getXpubLiteBalance(xpub: string): Promise<any>;
}
export declare class Api implements ApiBase {
private apiTarget;
private apiHandler;
constructor(apiNet: API_NET, apiTarget?: API_TARGET, serverBase?: string);
/**
* Authorization to use MetaSV
* @param options
* @returns
*/
authorize(options: AuthorizationOption): void;
getUnspents(address: string): Promise<SA_utxo[]>;
getBalance(address: string): Promise<{
balance: number;
pendingBalance: number;
}>;
getRawTxData(txid: string): Promise<string>;
checkTxSeen(txid: string): Promise<boolean>;
broadcast(hex: string): Promise<string>;
getFungibleTokenUnspents(codehash: string, genesis: string, address: string, size?: number): Promise<FungibleTokenUnspent[]>;
getFungibleTokenBalance(codehash: string, genesis: string, address: string): Promise<FungibleTokenBalance>;
getFungibleTokenSummary(address: string): Promise<FungibleTokenSummary[]>;
getNonFungibleTokenUnspents(codehash: string, genesis: string, address: string, cursor?: number, size?: number): Promise<NonFungibleTokenUnspent[]>;
getNonFungibleTokenUnspentDetail(codehash: string, genesis: string, tokenIndex: string): Promise<NonFungibleTokenUnspent>;
getNonFungibleTokenSummary(address: string): Promise<NonFungibleTokenSummary[]>;
getNftSellUtxo(codehash: string, genesis: string, tokenIndex: string, includesNotReady?: boolean): Promise<NftSellUtxo>;
getNftSellList(codehash: string, genesis: string, cursor?: number, size?: number): Promise<NftSellUtxo[]>;
getNftSellListByAddress(address: string, cursor?: number, size?: number): Promise<NftSellUtxo[]>;
getOutpointSpent(txId: string, index: number): Promise<OutpointSpent>;
getXpubLiteUtxo(xpub: string): Promise<any>;
getXpubLiteBalance(xpub: string): Promise<any>;
}