Two-phase transfers
Rafiki allows for two-phase transfers, which moves funds in two stages.
- Reserve funds (
pending
) - Resolve funds (
post
,void
, orexpire
)
The following transactions support two-phase transfers:
- Asset liquidity withdrawal
- Peer liquidity withdrawal
- Incoming payment withdrawal
- Outgoing payment withdrawal
- Wallet address withdrawal
When a withdraw-liquidity transaction is requested with a timeout greater than 0
, the transaction is processed as a two-phase transfer. A 0
denotes the absence of a timeout.
If the timeout interval passes before the transaction posts or is voided, the transaction expires and the full amount is returned to the original account.
Manage two-phase transfers using the Backend Admin API
Post and commit a successful transfer
mutation PostLiquidityWithdrawal($input: PostLiquidityWithdrawalInput!) {postLiquidityWithdrawal(input: $input) { error success }}
{"input": { "withdrawalId": "b4f85d5c-652d-472d-873c-4ba2a5e39052", "idempotencyKey": "a09b730d-8610-4fda-98fa-ec7acb19c775" }}
For more information about this mutation’s input object, see PostLiquidityWithdrawalInput
.
When a liquidity withdrawal post is successful, PostLiquidityWithdrawal
returns true
.
{data: { success: true }}
Void and roll-back an unsuccessful transfer
mutation VoidLiquidityWithdrawal($input: VoidLiquidityWithdrawalInput!) {voidLiquidityWithdrawal(input: $input) { error success }}
{"input": { "withdrawalId": "b4f85d5c-652d-472d-873c-4ba2a5e39052", "idempotencyKey": "a09b730d-8610-4fda-98fa-ec7acb19c775" }}
For more information about this mutation’s input object, see VoidLiquidityWithdrawalInput
.
When a liquidity withdrawal is successfully voided and rolled back, VoidLiquidityWithdrawal
returns true
.
{data: { success: true }}