useExecuteOnRemoteModule
Import
import { useExecuteOnRemoteModule } from '@abstract-money/react'
Usage
import { useExecuteOnRemoteModule } from '@abstract-money/react'
import { stringToAccountId } from '@abstract-money/core'
function App() {
const executeOnRemoteModule = useExecuteOnRemoteModule({
accountId: stringToAccountId('pion-1'),
chainName: 'pion',
})
return (
<button
onClick={() =>
executeOnRemoteModule.mutate({
fee: 'auto',
funds: [
{
denom: 'uatom',
amount: '1000000',
},
],
args: {
hostChainName: 'cosmoshub-4',
moduleId: 'counter',
moduleMsg: {
count: {
type: 'add',
value: '1',
},
},
},
})
}
>
execute on remote module
</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
fee
number | StdFee | "auto"
The fee to be paid for the transaction. Can be a number, a StdFee
object, or "auto" for automatic fee calculation.
memo (optional)
string | undefined
An optional memo to attach to the transaction.
funds
An array of coin objects representing the funds to be sent with the transaction. Each object contains:
denom
: The denomination of the coinamount
: The amount of the coin
args
Arguments passed to the mutation. This includes:
hostChainName
string
The name of the host chain where the remote module is located.
moduleId
string
The unique identifier of the module to be executed.
moduleType (optional)
ModuleType | undefined
The type of the module. Can be one of the following:
- 'account'
- 'native'
- 'adapter'
- 'app'
- 'standalone'
- 'service'
moduleMsg
Record<string, unknown> | string
The message to be executed on the remote module. This can be either a JSON object (Record<string, unknown>
) or a string representing the message.