Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Wallet Client

createWalletClient is used for transaction build/sign/send flows.

Create

import { accountFromPrivateKey, createWalletClient, http, mainnet } from '@ivem/core'
 
const account = accountFromPrivateKey('your_account', 'your_private_key')
 
const walletClient = createWalletClient({
  account,
  chain: mainnet,
  transport: http(),
})

http() defaults to chain.rpcUrls[0] (https://api.iost.io on mainnet). Custom URL is optional: http('https://your-rpc.example').

Core Methods

  • getAccountId()
    Returns current account id from local account or injected wallet provider.

  • signMessage(message, permission?)
    Signs arbitrary message with selected permission (default: active).

  • prepareAccountCreation(params)
    Builds account creation tx (auth.iost/signUp, optional ram.iost/buy, gas.iost/pledge).

  • prepareTransactionRequest(params)
    Builds generic ABI tx with gas, expiration, delay, chainID and approvals.

  • signTransaction(transaction, permission?)
    Signs tx (local account or injected wallet).

  • sendRawTransaction(transaction)
    Broadcasts signed tx (POST /sendTx for local account).
    If node returns time-expired error, client refreshes time diff and retries once.

  • callContract(params)
    Recommended unified contract call API.
    On local account path, this builds tx -> signs -> broadcasts.

  • writeContract(params)
    Direct write action for contract transactions.

  • readContract(params)
    Compatibility API. On IOST, contract invocation is ABI tx-oriented, so this method currently routes to callContract.

  • transfer(params)
    Convenience wrapper over token.iost/transfer.

  • refreshServerTimeDiff({ force? })
    Refreshes server time offset cache used to set tx time/expiration.