UNPKG

@tangany/waas

Version:

node.js SDK for Tangany Wallet as a Service API

42 lines (41 loc) 2.36 kB
import { BlockchainWallet } from "./blockchain-wallet"; import { EthTransactionRequest } from "./eth-transaction-request"; import { IEthereumTransactionEstimation } from "./interfaces/ethereum"; import { IContractCall, IContractTransaction } from "./interfaces/ethereum-contract"; import { ContractCallResult } from "./types/common"; import { Waas } from "./waas"; import { Wallet } from "./wallet"; /** * Instantiates a new interface to interact with universal Ethereum Smart Contracts * @param waas - {@link Waas} instance * @param id - Asynchronous request id */ export declare class EthContractWallet extends BlockchainWallet { readonly address: string; private readonly baseUrl; constructor(waas: Waas, walletInstance: Wallet, address: string); /** * Executes known functions of arbitrary Ethereum smart contracts * @param config - Smart Contract function configuration * @see [docs]{@link https://docs.tangany.com/#945c237f-5273-4e85-bf9d-1ba2b132df17} */ sendAsync(config: IContractTransaction): Promise<EthTransactionRequest>; /** * Returns the fee estimation for a smart contract execution with the given parameters. * The fee estimation is based on the current ethereum network utilization and can fluctuate in random fashion. * Thus the estimation cannot guarantee to match the actual transaction fee. * @param config - Smart contract function configuration */ estimateFee(config: IContractTransaction): Promise<IEthereumTransactionEstimation>; /** * Executes readonly functions of arbitrary Ethereum smart contracts. * If the contract function expects exactly one parameter of type address, the overload with * separate parameters can be used for convenience. This argument is then automatically filled with the * address of the current wallet. Furthermore, the solidity variable `msg.sender` is set to this address. * In this case, the default value for the output types is `["uint256"]`. * If the function expects several parameters, the overload with the configuration object must be used. * In this case, the first argument is not automatically filled with the wallet address. */ call(config: IContractCall): Promise<ContractCallResult>; call(functionName: string, types?: string[]): Promise<ContractCallResult>; }