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 = '0x8f105b54494095373eD2573dBaFA7e546e2EbF99'; // 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 dealReference = 'Invoice #4821';
const verificationRequired = false; // set true to require every recipient to approve before the deal can be paid
const tx = await shaka.createDeal(recipients, amounts, referrer, dealReference, verificationRequired);
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 and Shaka fee, all in one number. See the Fees page for how that total is broken down.
const grandTotal = await shaka.quote(dealId);
// signatures is an empty array unless the deal was created with verificationRequired = true
const payTx = await shaka.pay(dealId, [], { value: grandTotal });
await payTx.wait();
That’s it. Funds are now in the recipient wallets.