cic-client
Version:
Typescript libraries for building CIC client applications
44 lines (43 loc) • 2.17 kB
TypeScript
import { DeclaratorHelper } from "./helper";
import { EVMMethodID, EVMAddress, EVMContract, FungibleToken } from './typ';
import { FileGetter } from './file';
declare class KV {
store: {};
put(k: string, v: any): void;
get(k: string): any;
peek(k: string): any;
}
interface Registry {
getAbi(abiName: string): Promise<object>;
getContract(address: EVMAddress): Promise<EVMContract>;
getContractByName(contractName: string, abiName?: string, requireInterfaces?: EVMMethodID[]): Promise<EVMContract>;
getContractAddressByName(contractName: string, abiName?: string, requireInterfaces?: EVMMethodID[]): Promise<string>;
getToken(address: EVMAddress): Promise<FungibleToken>;
getTokenBySymbol(tokenRegistryContractName: string, symbol: string, checkInterface: boolean): Promise<FungibleToken>;
addToken(address: EVMAddress): Promise<EVMContract>;
declaratorHelper: any;
}
declare class CICRegistry {
w3: any;
fileGetter: FileGetter;
address: string;
abiName: string;
contract: any;
store: KV;
paths: string[];
onload: (a: string) => void;
declaratorHelper: DeclaratorHelper;
constructor(w3: any, address: EVMAddress, abiName: string, fileGetter: FileGetter, paths?: string[]);
load(): Promise<void>;
getAbi(abiName: string): Promise<object>;
addToken(address: EVMAddress, requireTrust?: boolean): Promise<EVMContract>;
getContract(address: EVMAddress): Promise<EVMContract>;
getToken(address: EVMAddress): Promise<EVMContract>;
getContractByName(contractName: string, abiName?: string, requireInterfaces?: EVMMethodID[]): Promise<EVMContract>;
getContractAddressByName(contractName: string, abiName?: string, requireInterfaces?: EVMMethodID[]): Promise<string>;
getFungibleToken(tokenAddress: EVMAddress, checkInterface?: boolean): Promise<FungibleToken>;
getTokenBySymbol(tokenRegistryContractName: string, symbol: string, checkInterface?: boolean): Promise<FungibleToken>;
}
declare function toRegistryKey(s: string): Promise<string>;
declare function toContractKey(s: string): string;
export { CICRegistry, Registry, toContractKey, toRegistryKey };