Run confirmed Plans on your backend with @arcanetech/privacy-sdk-automatization-service.

Wire the Stellar ports

Build every pool port from the /stellar entry. It runs on Node.js and signs with your service account.
serviceSecret signs every pool transaction, and serviceSecretSeed owns every pinned note. Keep both on the service host.
sdkWasm is the WebAssembly module of the transaction preparation library. noteSalt must stay the same for the life of every Plan you confirm. Store it with your Plans. Pass ensureNoteOwners to register the service’s private addresses before a Step spends to them.

Persist Plans

Implement each store role over your database, then combine them with composePlanStore. This role keeps Plan documents in one table. planToJson turns each bigint into a string, and restorePlanValue turns it back.
Write the other roles the same way and pass all seven to composePlanStore:
Deposit authorizations and the owner scalar of each Unspent note live in DepositMaterial and UnspentNoteStore. Keep those tables on the service host.

Collect a Deposit signature

depositToSign returns the invocation for a Deposit and the Soroban authorization entries the depositor signs. Pass a draft Plan for the Initial Deposit, or a Plan id for the next due Deposit.
depositToSign throws DepositStepNotDueError when the Plan has no Deposit waiting, and DepositRefusedError when the Fee quote is above the Step’s Free tokens or the compliance check refuses it. For a later Deposit, pass the same invocation and the signed entries to authorizeDeposit.

Count executed Steps

A Step is executed when its pinned inputs are spent and its pinned outputs are in the pool tree.
total counts every Deposit, Transfer, and withdrawal.

Read the next Step

earliestOpenStep returns the first Step that is not executed. Check it against the pool, the fee quote, and the Deposit signature.
awaitingSignature means the Deposit has no signature for the current pool root. scheduled has no dueAt until the service records when the previous Step executed. runDueSteps records it on its next pass.

Prepare the next transaction

Build the transaction for a scheduled Step without submitting it. A Deposit reuses the invocation the depositor signed. Any other Step asks your proof port.
Do not submit this preview yourself. maskedOutputs can take a new Unspent note scalar on every call, and the store keeps only the scalar submitNextStep or runDueSteps used.

Submit due Steps

runDueSteps submits the next due Step of every Plan and honors intervals. submitNextStep submits one Plan’s next Step and ignores its interval. Both store the transaction id and the Unspent note.
Run one pass at a time, so two passes never submit the same Step. A Step whose submission returns ok: false stays unsubmitted, and the next run tries it again.