Refund a call
A call's price waits in escrow from the moment the call opens. When the enclave has not settled the call by its deadline, the whole price goes back to the caller. Nothing is charged for a call that was not answered.
When a call can be refunded#
A call has a deadline slot, set when it opens: the opening slot plus the protocol's call deadline (callDeadlineSlots in GET /v1/config). Until that slot the enclave can still settle it. After it, the call is refundable.
| The call reads | Meaning |
|---|---|
open, refund state pending-deadline | The deadline has not passed. The enclave can still answer. |
refundable | The deadline has passed with no receipt. The escrow can be taken back. |
refunded | The escrow is back with the caller. |
settled | The call was answered and paid out. There is nothing to refund. |
Take the refund#
Open /account with the wallet that made the call. Calls are listed with their state. Press Refund on a refundable call and approve the transaction. The call panel on the model's page offers the same button when the call it just made becomes refundable.
voynich refund <call address>const mine = await voynich.account()
const refunded = await voynich.refund(mine.calls.find(call => call.status === 'refundable')!.address)
console.log(refunded.status, refunded.signature)The transaction is refund_call. The escrow returns to the wallet that opened the call, whoever sends the transaction. For a price in a mint, the escrow's token account is closed and its rent returns to the caller as well.
Refunds nobody takes#
The protocol's crank sends refund_call for calls that pass their deadline, so an expired call is refunded without the caller doing anything. Taking the refund by hand is for a caller who wants it at once.
Failures#
| Error | Meaning |
|---|---|
CALL_NOT_REFUNDABLE | The deadline has not passed. |
CALL_NOT_OPEN | The call settled or was refunded already. |
CALL_NOT_FOUND | No call has this address. |
The mechanism is in Calls and receipts, the instruction in Program: Instructions.