@s2kael/invariant-sdk
Version:
### Prerequisites
56 lines (55 loc) • 3.27 kB
TypeScript
import { GearApi } from '@gear-js/api';
import { TypeRegistry } from '@polkadot/types';
import { TransactionBuilder } from 'sails-js';
export declare class Erc20Token {
api: GearApi;
programId?: `0x${string}` | undefined;
readonly registry: TypeRegistry;
readonly vft: Vft;
constructor(api: GearApi, programId?: `0x${string}` | undefined);
newCtorFromCode(code: Uint8Array | any, name: string, symbol: string, decimals: number): TransactionBuilder<null>;
newCtorFromCodeId(codeId: `0x${string}`, name: string, symbol: string, decimals: number): TransactionBuilder<null>;
}
export declare class Vft {
private _program;
constructor(_program: Erc20Token);
burn(from: string, value: number | string): TransactionBuilder<boolean>;
grantAdminRole(to: string): TransactionBuilder<null>;
grantBurnerRole(to: string): TransactionBuilder<null>;
grantMinterRole(to: string): TransactionBuilder<null>;
mint(to: string, value: number | string): TransactionBuilder<boolean>;
revokeAdminRole(from: string): TransactionBuilder<null>;
revokeBurnerRole(from: string): TransactionBuilder<null>;
revokeMinterRole(from: string): TransactionBuilder<null>;
setTransferFail(flag: boolean): TransactionBuilder<null>;
transfer(to: string, value: number | string): TransactionBuilder<boolean>;
transferFrom(from: string, to: string, value: number | string): TransactionBuilder<boolean>;
approve(spender: string, value: number | string): TransactionBuilder<boolean>;
admins(originAddress: string, value?: number | string | bigint, atBlock?: `0x${string}`): Promise<Array<string>>;
burners(originAddress: string, value?: number | string | bigint, atBlock?: `0x${string}`): Promise<Array<string>>;
minters(originAddress: string, value?: number | string | bigint, atBlock?: `0x${string}`): Promise<Array<string>>;
allowance(owner: string, spender: string, originAddress: string, value?: number | string | bigint, atBlock?: `0x${string}`): Promise<bigint>;
balanceOf(account: string, originAddress: string, value?: number | string | bigint, atBlock?: `0x${string}`): Promise<bigint>;
decimals(originAddress: string, value?: number | string | bigint, atBlock?: `0x${string}`): Promise<number>;
name(originAddress: string, value?: number | string | bigint, atBlock?: `0x${string}`): Promise<string>;
symbol(originAddress: string, value?: number | string | bigint, atBlock?: `0x${string}`): Promise<string>;
totalSupply(originAddress: string, value?: number | string | bigint, atBlock?: `0x${string}`): Promise<bigint>;
subscribeToMintedEvent(callback: (data: {
to: string;
value: number | string;
}) => void | Promise<void>): Promise<() => void>;
subscribeToBurnedEvent(callback: (data: {
from: string;
value: number | string;
}) => void | Promise<void>): Promise<() => void>;
subscribeToApprovalEvent(callback: (data: {
owner: string;
spender: string;
value: number | string;
}) => void | Promise<void>): Promise<() => void>;
subscribeToTransferEvent(callback: (data: {
from: string;
to: string;
value: number | string;
}) => void | Promise<void>): Promise<() => void>;
}