Skip to main content

Withdrawal

Bob wants his 178.38 out. Mercatto registers where he wants it sent and asks Ishtaran for a withdrawal — using its own credentials, on Bob's behalf, same as Seller balance.

examples/marketplace-mercatto/withdraw.ts
const destination = await mercatto.withdrawals.createDestination(organizationId, destinationAddress, assetNetworkId);
const quote = await mercatto.withdrawals.quote(organizationId, bobAccountId, destination.withdrawalDestinationId, assetNetworkId, amount);

const withdrawal = await mercatto.withdrawals.request(organizationId, bobAccountId, destination.withdrawalDestinationId, assetNetworkId, amount);

Result — a real, honest block

422 WITHDRAWAL_DESTINATION_NOT_USABLE

This is the correct ending of this chapter, not an error in the example. A brand-new withdrawal destination is born Pending and only becomes usable 24 real hours later — a genuine security control (whitelist protection, on by default), confirmed live, and never something this Business Case bypasses or accelerates. Re-running the exact same call against the exact same destination 24 hours later is expected to succeed.

What happened under the hood

quote() never writes anything — it's a pure read, callable at any time regardless of the destination's status, which is why it succeeds even though the withdrawal itself is blocked immediately after. quote.networkExecutionCost is the same Network Execution Engine used by Settlement (Settlement and Split) — the real, quoted cost of broadcasting this withdrawal on-chain, in the resource asset's own units, never subtracted from what Bob actually receives (estimatedNetworkFee is deprecated and always null under SelfCustody). There is no official Sandbox mechanism to fast-forward this cooldown, and none should be built — see Known Limitations §F.4 for exactly why, and why that's the right call even though it makes this particular chapter slower to fully exercise.