Real-world integration examples.

Example 1 — Real estate commission split

A real estate deal closing with a listing agent and a buyer’s agent, paid in native ETH. The listing agent’s wallet is set as referrer, so they automatically receive Shaka’s 1% creator bonus on top of their commission — no separate claim needed.

import { ethers } from 'ethers';

const SHAKA_ADDRESS = '0x8f105b54494095373eD2573dBaFA7e546e2EbF99'; // Ethereum mainnet

async function createCommissionSplit(signer) {
  const shaka = new ethers.Contract(SHAKA_ADDRESS, SHAKA_ABI, signer);

  const recipients = [
    '0xListingAgent...',
    '0xBuyerAgent...',
  ];
  const amounts = [
    ethers.parseEther('12'), // listing agent's commission
    ethers.parseEther('6'),  // buyer's agent commission
  ];
  const referrer = '0xListingAgent...'; // gets Shaka's automatic 1% creator bonus
  const dealReference = '123 Ocean Ave — commission split';
  const verificationRequired = false; // set true to require recipient approval before payment

  const tx = await shaka.createDeal(recipients, amounts, referrer, dealReference, verificationRequired);
  const receipt = await tx.wait();
  const dealId = receipt.logs[0].args.dealId;

  console.log('Deal ID:', dealId);
  return dealId;
}

async function payDeal(signer, dealId) {
  const shaka = new ethers.Contract(SHAKA_ADDRESS, SHAKA_ABI, signer);

  // quote() returns the exact amount to send — recipient amounts plus the
  // referrer and Shaka fee. See the Fees page for the breakdown.
  const grandTotal = await shaka.quote(dealId);

  // signatures is an empty array unless the deal requires recipient approval
  const payTx = await shaka.pay(dealId, [], { value: grandTotal });
  await payTx.wait();
}

Example 2 — Cancel a deal

Creator-only. Reverts if the deal has already been paid or already cancelled — once cancelled, it can never be paid.

async function cancelDeal(signer, dealId) {
  const shaka = new ethers.Contract(SHAKA_ADDRESS, SHAKA_ABI, signer);

  const tx = await shaka.cancel(dealId);
  await tx.wait();
}

Example 3 — Read deal status

async function checkDeal(provider, dealId) {
  const shaka = new ethers.Contract(SHAKA_ADDRESS, SHAKA_ABI, provider);
  const [recipients, amounts, creator, referrer, paid, cancelled, verificationRequired, dealReference] =
    await shaka.getDeal(dealId);

  return {
    recipients,
    amounts: amounts.map(a => ethers.formatEther(a)),
    creator,
    referrer,
    paid,
    cancelled,
    verificationRequired,
    dealReference,
  };
}

Example 4 — Listen for DealPaid and DealCancelled events

shaka.on('DealPaid', (dealId, payer, referrerAmount, shakaAmount, grandTotal) => {
  console.log({
    dealId,
    payer,
    referrerAmount: ethers.formatEther(referrerAmount),
    shakaAmount: ethers.formatEther(shakaAmount),
    grandTotal: ethers.formatEther(grandTotal),
  });
});

shaka.on('DealCancelled', (dealId, creator) => {
  console.log({ dealId, creator });
});

viem example

import { createPublicClient, http } from 'viem';
import { mainnet } from 'viem/chains';

const publicClient = createPublicClient({ chain: mainnet, transport: http() });

const deal = await publicClient.readContract({
  address: SHAKA_ADDRESS,
  abi: SHAKA_ABI,
  functionName: 'getDeal',
  args: [dealId],
});

const grandTotal = await publicClient.readContract({
  address: SHAKA_ADDRESS,
  abi: SHAKA_ABI,
  functionName: 'quote',
  args: [dealId],
});

Your next deal.
Closed.

Create a deal link in two minutes. Send it. Get paid.

Splits itself Paid same day 100% onchain