Set up the client, compose and edit a draft Plan, and sign its Deposits.
Draft, edit, and sign a Plan from the depositor’s app. Every edit runs on your automation service and returns a new Plan. Amounts are bigint in the asset’s smallest unit: 30 USDC is 300_000_000n.
A DepositSigner signs the text depositSigningMessage builds from a Deposit. Return the depositor key’s Ed25519 signature over that text, base64-encoded.
import { depositSigningMessage, type DepositSigner,} from '@arcanetech/privacy-sdk-automatization-client';export function walletDepositSigner(signMessage: (message: string) => Promise<string>): DepositSigner { return { sign: (invocation) => signMessage(depositSigningMessage(invocation)) };}
In Node scripts and tests, sign with a secret key instead:
coverFees raises any Step whose fee quote is above its Free tokens, and adds the increase to the Deposit that funds it. Call it after every edit, before the depositor signs.
const following = stepsOf(plan)[stepIndex + 1];if (following === undefined) throw new Error('No Step follows that index');const revised = await planClient.replaceStepInterval(plan, following.place, interval);
The interval starts when the earlier Step executes, in the unit of the service clock. The Initial Deposit always has interval 0, and replaceStepInterval throws InitialDepositIntervalError for it.