Finalizes the activation of a vault that is inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/natureloved/DeadMan-Vault/llms.txt
Use this file to discover all available pages before exploring further.
funding status. After the owner sends the specified USDCx amount to the vault’s keeperAddress (obtained from POST /api/vaults), they call this endpoint with the transaction ID of that transfer. The server decrypts the keeper’s private key, calls FlowVault.setRoutingRules() to configure the lock parameters, then calls FlowVault.deposit() to lock the USDCx balance on-chain. Once confirmed, the vault’s database record is updated to active status with the recorded heartbeat baseline and deadline block.
Endpoint
This route has a
maxDuration of 60 seconds. On-chain confirmation retries via retryWithBackoff can take up to ~40 seconds while waiting for the owner’s funding transfer to confirm on the Stacks testnet.Request Parameters
Path Parameters
The UUID of the vault to activate. The vault must be in
funding status or already active (idempotent — returns the existing activation data). Any other status throws an error and returns 400.Request Body
The transaction ID of the USDCx transfer the owner sent to the vault’s
keeperAddress (e.g. 0xabc123def456...). The server uses this to verify the on-chain balance before proceeding with the FlowVault deposit call.Response
Returns200 OK with a JSON object confirming the on-chain activation.
UUID of the vault that was activated.
The transaction ID of the
FlowVault.deposit() call submitted by the keeper. Store this value — it is saved to the vault record as the canonical deposit txId.The Stacks block height at the time the deposit was confirmed on-chain. This becomes the vault’s
lastHeartbeatBlock baseline.The block height by which the first heartbeat must arrive, calculated as:144 blocks per day approximates the Stacks block time of ~10 minutes. This value is stored as
heartbeat_deadline_block in the vault record.Activation Flow
The following steps occur server-side when this endpoint is called:- Fetch vault — Load the vault from the database and check its status. If already
active, immediately return the existingvaultId,txId,currentBlock, anddeadlineBlock(idempotent). Reject with400if the status is neitherfundingnoractive. - Decrypt keeper key — Decrypt
keeper_key_ciphertextfrom the vault record to recover the keeper’s Stacks private key. - Set routing rules — Call
FlowVault.setRoutingRules()with the lock amount and the calculated deadline block. - Deposit — Call
FlowVault.deposit()using the keeper keypair to lock the USDCx balance on-chain. UsesretryWithBackoffto retry until the funding transfer confirms. - Update DB — Set vault
statustoactive, recordlastHeartbeatBlock,heartbeatDeadlineBlock, andtxIdin the vault row.
Example Request
Example Response
heartbeatIntervalDays is 90. The deadline is calculated as 148200 + (90 × 144) = 161160.
Error Responses
| Status | Error | Description |
|---|---|---|
400 | Missing funding transaction ID — send the transfer to the keeper address first | The txId field was absent from the request body. |
400 | Vault is in unexpected status "X" to be funded. | The vault’s current status is not funding (e.g. warning, grace_period, triggered, or claimed). Only funding vaults can be activated; an already-active vault returns 200 idempotently instead of this error. |
400 | Error message from finalizeVaultFunding | The on-chain transfer could not be verified after all retries, or another error occurred during the FlowVault contract calls. The full error message is returned verbatim. |