tx-sender). The vault begins in the active state with last-heartbeat set to the current stacks-block-time. No assets are deposited during creation — use deposit-sbtc and deposit-usdcx after the vault is created.
Function signature
Parameters
The number of seconds of inactivity that must elapse before the vault enters the grace period. Once
stacks-block-time − last-heartbeat reaches this value, heirs can call guardian-pause and the vault transitions to grace state.Example: u31536000 (1 year in seconds).Additional seconds after the heartbeat interval before heirs can claim. The vault becomes claimable when
elapsed >= heartbeat-interval + grace-period. A grace period gives the owner extra time to recover access and send a heartbeat.Example: u2592000 (30 days in seconds).A list of up to 10
{ heir: principal, split-bps: uint } tuples. Each entry specifies an heir’s Stacks address and their share of the vault in basis points (1 bp = 0.01%). The sum of all split-bps values must equal exactly 10000 (100%). At least one heir is required.Example: [{ heir: 'SP1ABC..., split-bps: u6000 }, { heir: 'SP2DEF..., split-bps: u4000 }] (60% / 40% split).An optional Stacks address that can call
guardian-pause to extend the vault’s effective deadline by 30 days during the grace period. Pass none if no guardian is needed.The guardian cannot deposit, withdraw, send heartbeats, or modify heirs.Return value
Returns
(ok true) on success.Returns
(err uint) on failure. See error codes below.Error codes
| Code | Constant | When returned |
|---|---|---|
| u106 | ERR-INVALID-SPLITS | heirs-data is empty, or the sum of all split-bps values is not exactly 10000 |
| u109 | ERR-VAULT-ALREADY-EXISTS | The calling address already has an active (non-distributed) vault |
Basis-point validation
The contract folds over the heir list to sum allsplit-bps values and asserts the total equals 10000 exactly:
Re-creation policy
Each Stacks principal can hold at most one vault at a time.create-vault blocks creation if an active vault already exists for the calling address. However, once a vault is fully distributed (all heirs have claimed) or cancelled via emergency-withdraw, the owner may create a new vault:
reset-heir-claim so previous records do not block new heirs.
JavaScript example
contracts.ts
none for the guardian if the argument is omitted:
contracts.ts
last-heartbeat is set to stacks-block-time at the moment of creation. The countdown starts immediately — there is no separate activation step. Send a heartbeat periodically to keep the vault in the active state.