Create and pay your first deal in under 5 minutes.
Prerequisites
- A wallet with ETH — enough to cover the deal amount, Shaka’s fee, and gas
- ethers.js v6 or viem
1. Install dependencies
npm install ethers
2. Connect to the contract
import { ethers } from 'ethers';
import { SHAKA_ABI } from './shaka-abi';
const SHAKA_ADDRESS = '0x8eEb3D6053014446cD92C58E233B2a5084E54a1a'; // Ethereum mainnet
const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();
const shaka = new ethers.Contract(SHAKA_ADDRESS, SHAKA_ABI, signer);
3. Create a deal
const recipients = [
'0xRecipientA...',
'0xRecipientB...',
];
const amounts = [
ethers.parseEther('3'), // Recipient A's share, in ETH
ethers.parseEther('1.2'), // Recipient B's share, in ETH
];
const referrer = '0xYourWallet...'; // receives Shaka's automatic 1% creator bonus — use ethers.ZeroAddress if none
const affiliate = ethers.ZeroAddress; // wallet resolved from a referral link — use ethers.ZeroAddress if none
const dealReference = 'Invoice #4821';
const tx = await shaka.createDeal(recipients, amounts, referrer, affiliate, dealReference);
const receipt = await tx.wait();
// Extract dealId from event
const event = receipt.logs.find(log => /* parse DealCreated event */);
const dealId = event.args.dealId;
4. Pay a deal
quote() returns the exact amount to send — the recipient amounts plus the referrer, affiliate, and Shaka fee, all in one number. See the Fees page for how that total is broken down.
const grandTotal = await shaka.quote(dealId);
const payTx = await shaka.pay(dealId, { value: grandTotal });
await payTx.wait();
That’s it. Funds are now in the recipient wallets.