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.
Preview feature — pending external audit, and enabled per deployment. The React SDK does not yet expose dedicated gift hooks; use the underlying SDK via usePrivacyBoost(). Dedicated hooks are planned.

Accessing the gift API

usePrivacyBoost() returns the underlying TypeScript SDK instance, whose gift methods live on its WASM handle (sdk.wasm). The full method surface, parameter shapes, and types are documented in the TypeScript Claimable Transfers guide.
import { usePrivacyBoost } from '@sunnyside-io/privacy-boost-react';

function SendGiftButton() {
  const sdk = usePrivacyBoost();

  const sendGift = async () => {
    if (!sdk) return;
    const currentBlock = Number(await publicClient.getBlockNumber());

    const result = await sdk.wasm.giftFundToWallet({
      tokenAddress: '0x...token-address',
      amount: '1000000000000000000',
      recipientWallet: '0xRecipientEoaAddress',
      refundAfterBlock: currentBlock + 50_000,
      currentBlock,
    });

    // Persist result.giftRecord so the gift stays refundable; share result.claimLink.
    console.log('Claim link:', result.claimLink);
  };

  return <button onClick={sendGift}>Send gift</button>;
}
Claiming and refunding follow the same pattern — call sdk.wasm.getPendingGifts(), sdk.wasm.giftClaim({ index, acknowledgeUnknownSender: true }), sdk.wasm.getGiftRecords(), and sdk.wasm.giftRefundByRecord(index) from a hook or handler. See the TypeScript guide for every method.

Next steps