Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EthereumHelpers

Ethereum Util class for Ethereum related Atomex helper functions

Hierarchy

Index

Constructors

constructor

  • new EthereumHelpers(web3: Web3, jsonInterface: AbiItem[], contractAddress: string, timeBetweenBlocks: number, gasLimit: number): EthereumHelpers
  • Parameters

    • web3: Web3
    • jsonInterface: AbiItem[]
    • contractAddress: string
    • timeBetweenBlocks: number
    • gasLimit: number

    Returns EthereumHelpers

Methods

buildActivateTransaction

  • Get the tx data for Atomex Contract Activate Swap call

    Parameters

    • secretHash: string

    Returns PartialTransactionBody

    contract address and tx data that can be used to make a contract call

buildAddTransaction

buildInitiateTransaction

buildRedeemTransaction

buildRefundTransaction

encodePublicKey

  • encodePublicKey(pubKey: string): string

encodeSignature

  • encodeSignature(signature: string): string

estimateInitiateFees

  • estimateInitiateFees(source: string): Promise<number>

estimateRedeemFees

  • estimateRedeemFees(recipient: string): Promise<RedeemFees>

getAuthMessage

  • getAuthMessage(message: string, address?: undefined | string): AuthMessage

isValidAddress

  • isValidAddress(address: string): boolean

parseInitiateParameters

recoverPublicKey

  • recoverPublicKey(msg: string, signature: string): string
  • Recover Ethereum Account Public Key from RLC signature

    Parameters

    • msg: string

      original message, msgToSign parameter generated using getAuthMessage

    • signature: string

      signed message

    Returns string

    ethereum public key

validateInitiateTransaction

  • validateInitiateTransaction(blockHeight: number, txID: string, secretHash: string, receivingAddress: string, netAmount: number, minRefundTimestamp: number, minConfirmations: number): Promise<SwapTransactionStatus>

Static create

  • create(network: "mainnet" | "testnet", rpcUri?: undefined | string): Promise<EthereumHelpers>
  • Connects to the supported ethereum chain

    Parameters

    • network: "mainnet" | "testnet"
    • Optional rpcUri: undefined | string

    Returns Promise<EthereumHelpers>

    chain id of the connected chain

Generated using TypeDoc