Skip to content

useSimulateExecuteRemoteAccount

Hook for simulating a message to be executed on a manager on a remote chain.

Import

import { useSimulateExecuteRemoteAccount } from '@abstract-money/react'

Usage

index.tsx
import { useSimulateExecuteRemoteAccount } from '@abstract-money/react'
import { stringToAccountId } from '@abstract-money/core'
 
function App() {
  const simulateExecuteRemoteAccount = useSimulateExecuteRemoteAccount({
    accountId: stringToAccountId('pion-1'),
    chainName: 'pion'
  })
 
  return (
    <button
      onClick={() =>
        simulateExecuteRemoteAccount.mutate({
          hostChainName: 'osmosis',
          accountMsg: {
            execute: {
              msgs: [
                {
                  bank: {
                    send: {
                      to_address: 'osmo1...',
                      amount: [
                        {
                          denom: 'uosmo',
                          amount: '1000000'
                        }
                      ]
                    }
                  }
                }
              ]
            }
          },
        })
      }
    >
      simulateExecuteRemoteAccount
    </button>
  )
}

Hook Parameters

accountId

AccountId | undefined

Account Id to be used to fetch the query.

chainName

string | undefined

Name of the chain to be used to fetch the query.

mutation

MutationOptions | undefined

MutationOptions to use.

Mutation Parameters

args

Arguments passed to the mutation

hostChainName

string

Host chain name to simulate execution on a remote account.

accountMsg

AccountMsg

The CosmosMsg to be executed on the remote account.