Skip to main content

Claimable Transfers (Gifts)

Send shielded funds to an Ethereum wallet address that has not registered with Privacy Boost yet. See Claimable Transfers for the concept and trust model.

useGifts

useGifts() wraps the sdk.gifts resource. It loads the gifts pending for the authenticated wallet and the records of gifts funded in this session, and exposes every funding, claim and refund method under one { loading, error } contract. The calls route through the key vault, so they work in the browser-default iframe vault mode as well as with a local WASM vault, and each one is async even where no network work happens. Block heights cross the vault boundary as decimal strings, so pass refundAfterBlock and currentBlock as strings rather than numbers.
Use fund when the recipient already has a privacy address, so the ciphertext is sealed to their viewing key and their own discovery finds the gift, and fundSecretBearer for a link-only gift with no wallet binding at all. Claiming and refunding follow the same pattern: claimByCGift({ cGift, acknowledgeUnknownSender: true }), claimFromLink({ link, acknowledgeUnknownSender: true }), refundByRecord(index) for a gift funded in this session, and refund(fields) for a record you persisted from an earlier one. The lists come back as pendingGifts and giftRecords, with pending() and records() for a one-off read. Gifts are bound to the chain the root SDK was configured for, so the hook reads the root client rather than the provider’s active client.

Reaching the resource directly

usePrivacyBoost() returns the underlying TypeScript SDK instance, whose gift methods live on sdk.gifts, the same resource the hook delegates to. The full method surface, parameter shapes, and types are documented in the TypeScript Claimable Transfers guide.

Next steps