Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Skip to Content
ensforgeSDK

plan.send

Sends any plan: one prepared by a write's .prepare, or several combined with Plan.merge. Options, result, errors and examples for plan.send.

Writestable
Since v1.0.0View source

Sends any plan: one prepared by a write's .prepare, or several combined with Plan.merge. Resolves once the transaction is submitted.

When to use

Use to review a plan before sending it, or to send several writes as one flow. Use sendSync to wait for the receipt.

Details

  • The plan is simulated, then sent step by step; consecutive steps share one wallet bundle when the wallet supports atomic batches (maxBundleCalls), never across a chain-time wait.
  • Progress is saved to the client's storage, so a failed or interrupted plan continues with plan.resume; failures carry context.planId.
  • onStep reports each step as it waits, is submitted, confirmed or fails.
  • A plan for one of the client's chains (an L2 primary name) is simulated and sent there.

Signature

function send(
  client: Like,
  options: send.Options & Write.Options,
): Promise<send.ReturnType>

Call it as ens.plan.send(options) on a client, or Actions.plan.send(client, options).

Parameters

OptionTypeDefaultDescription
plan (required)PlanThe plan to send, for this client's chain and signer.

Also takes the write options.

Returns

Resolves to Write.Result. Submitted transaction hashes and the plan that produced them.

FieldTypeDescription
hashHexHash of the last transaction.
hashesreadonly Hex[]Every submitted transaction, in order.
idstringEIP-5792 bundle id when the calls were sent as one batch.
planPlanThe plan the write executed: its steps, in order, as they were submitted.

Errors

ErrorCodesWhen
PlanErrorPLAN_CHAIN_MISMATCH, PLAN_ACCOUNT_MISMATCHa plan prepared elsewhere.
PlanErrorPLAN_STALEa token it transfers was reissued since it was prepared.
ContractRevertErrorCONTRACT_REVERTED, or the failing step's own error (Errors.AnyError: a plan can hold any step), with context.planId and context.step.
UserRejectedErrorUSER_REJECTEDthe user rejects the request.
WalletErrorCHAIN_MISMATCH, ACCOUNT_NOT_FOUNDthe wallet is on another chain or has no account to sign with.
UnsupportedErrorWALLET_BATCH_UNSUPPORTEDwith mode: "batch" or a paymaster when the wallet cannot send calls as one batch.

It can also fail with the errors every write can (Errors.WriteError: the common errors plus InsufficientFundsError, TransactionError, UnsupportedError, UserRejectedError, WalletError).

See How errors work.

Examples

Sending a merged plan
import { Plan } from "@ensforge/sdk"

const { hash } = await ens.plan.send({ plan: Plan.merge([recordsPlan, primaryNamePlan]) })

Plan methods

Each method takes the same options as plan.send and sends nothing. See Preview before sending.

MethodDescription
plan.send.prepare(options)Builds the plan without sending anything.
plan.send.simulate(options)Simulates the plan with eth_call, reporting each step.
plan.send.estimateGas(options)Estimates the gas and ETH the plan needs.

Wait for the receipt with sendSync

Sends any plan: one prepared by a write's .prepare, or several combined with Plan.merge. Resolves once the receipt is in.

Use when the next step depends on the change being on-chain.

plan.sendSync takes the same options plus confirmations and timeout.

Resolves to Write.SyncResult. Receipts plus the submitted hashes and plan.

Sending a merged plan and waiting
import { Plan } from "@ensforge/sdk"

const { receipt } = await ens.plan.sendSync({ plan: Plan.merge([recordsPlan, primaryNamePlan]) })

See also

Was this page helpful?