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

execute

Execute one or more contract messages in a single transaction, with optional funds attached and EIP-712 typed-data overrides.

Signature

function execute(
  client: Client<Signer>,
  parameters: {
    sender: Address
    execute: ExecuteMsg | ExecuteMsg[]
    gasLimit?: number
  },
): Promise<{ hash: Uint8Array } & TxData>
 
type ExecuteMsg = {
  contract: Address
  msg: Json
  funds?: Funds
  typedData?: TypedDataParameter
}

Example

import { createSignerClient, createTransport, testnet, PrivateKeySigner } from "@left-curve/sdk"
import type { Address } from "@left-curve/sdk"
 
const client = createSignerClient({
  chain: testnet,
  transport: createTransport(),
  signer: PrivateKeySigner.fromMnemonic(process.env.DANGO_MNEMONIC!),
})
const sender: Address = "0x1234567890abcdef1234567890abcdef12345678"
const contract: Address = "0xabcdef1234567890abcdef1234567890abcdef12"
 
await client.execute({
  sender,
  execute: {
    contract,
    msg: { increment: {} },
  },
})

Parameters

senderAddress. The sender account.

executeExecuteMsg | ExecuteMsg[]. One or more { contract, msg, funds?, typedData? } entries.

gasLimitnumber, optional. Skip simulation and use this limit.

ExecuteMsg fields

contractAddress. The target contract.

msgJson. The execute message (camelCase, converted to snake_case on the wire).

fundsFunds, optional. Coins attached to the call.

typedDataTypedDataParameter, optional. EIP-712 typed-data spec for the message body. Required when the message has non-trivial nested structure.

Returns

{ hash: Uint8Array } & TxData — see broadcastTxSync.

See also