import Contract from 'web3/eth/contract'; import { TransactionObject } from 'web3/eth/types'; import { IConnection } from './Connection'; import { IEnrichedTransactionParameters } from './Transaction'; /** * The token-class of the wallet */ export declare class Token { connection: IConnection; /** * initializes the class * @param connection The backend connection object. */ constructor(connection: IConnection); /** * Gets an ERC20-token instance * @param token The ERC20-token address * @returns The ERC20-token contract instance */ getErc20Instance(token: string): Promise; /** * Gets the amount of tokens in existence for the ERC20-contract * @param token The ERC20-token address * @returns THe amount of tokens in existence */ getTotalSupply(token: string): Promise; /** * Gets the amount of tokens owned by account * @param token The ERC20-token address * @param account The account whose balance should be checked * @returns THe amount of tokens owned by the account */ getBalance(token: string, account: string): Promise; /** * Moves an amount of tokens from the sender's account to recipient. * @param token The ERC20-token address * @param amount The amount of ERC20-tokens to transfer * @param to The recipient of the tokens * @returns The transaction-receipt */ transfer(token: string, amount: string, to: string): Promise>; /** * Gets the remaining number of ERC20-tokens that the spender will be allowed to spend on behalf of owner through transferFrom. * This is zero by default. * @param token The ERC20-token address * @param owner THe owner of the ERC20-tokens * @param account The account whose allowance should be checked * @returns The allowance of the account */ getAllowance(token: string, owner: string, account: string): Promise; /** * Sets the provided amount as the allowance of the spender over the caller's ERC20-tokens * @param token The token address * @param spender The spender address * @param amount The allowance-amount * @returns The transaction-receipt */ setAllowance(token: string, spender: string, amount: string): Promise>; /** * Moves the amount of ERC20-tokens from sender to recipient using the allowance mechanism. The amount is then deducted from the * caller’s allowance. * @param token The token address * @param spender The spender address * @param recipient The recipient address * @param amount The allowance amount * @returns The transaction-receipt */ transferFrom(token: string, spender: string, recipient: string, amount: string): Promise>; /** * Gets the symbol of the token. `symbol()` is optional to implement on ERC20-tokens, * if `symbol()` is not defined null will be returned * @param token The address of the ERC20-token * @returns The symbol of the ERC20-token */ getSymbol(token: string): Promise; /** * Gets the name of the token. `name()` is optional to implement on ERC20-tokens, * if `name()` is not defined null will be returned * @param token The address of the ERC20-token * @returns The name of the ERC20-token */ getName(token: string): Promise; /** * Gets the decimals of the token. `decimals()` is optional to implement on ERC20-tokens, * if `decimals()` is not defined null will be returned * @param token The address of the ERC20-token * @returns the decimals of the ERC20-token */ getDecimals(token: string): Promise; /** * Prepares an IAMO-Safe transaction that moves an amount of ERC20-tokens from the Safe's account to recipient. * @param instanceAddress The IAMO-Safe instance address * @param token The ERC20-token address * @param amount The amount of ERC20-tokens to transfer * @param to The recipient of the ERC20-tokens * @returns The prepared safe-transaction-parameters to transfer */ transferErc20OverSafe(instanceAddress: string, token: string, amount: string, to: string): Promise; /** * Prepares an IAMO Safe transaction to set the amount as the allowance of spender over the Safe's ERC20-tokens. * @param instanceAddress The IAMO-Safe instance address * @param token The ERC20-token address * @param spender The spender address * @param amount The allowance-address * @returns The prepared Safe-transaction parameters to set an allowance */ setErc20AllowanceForSafe(instanceAddress: string, token: string, spender: string, amount: string): Promise; /** * Prepares an IAMO Safe transaction to set the amount as the allowance of spender over the Safe's tokens. * @param instanceAddress The IAMO-Safe instance address * @param token The ERC20-token address * @param spender The spender address * @param recipient The recipient address * @param amount The allowance amount * @returns The prepared Safe-transaction parameters to transfer from the Safe's allowance */ transferFromErc20SafeAllowance(instanceAddress: string, token: string, spender: string, recipient: string, amount: string): Promise; /** * Attempts to decode transaction data to check if the tx is a token tx * @param tx The enriched transaction parameters to check * @returns The recipient, amount and ERC20-token if the transaction is a transaction and null otherwise */ decodeTokenERC20Transfer(tx: IEnrichedTransactionParameters): { to: string; amount: string; token: string; }; } export default Token;