How to Encode Calls
Brydge's contracts need to know the following:
  • The contract address(es) that will be called and their ABI
  • The function name(s) that will be called and their parameters
  • Quantity of native tokens each contract will receive (if any)
The calls prop in BrydgeWidget expects to receive an array structured like this:
const calls = [
{ _to: 'contractAddress', _value: 'nativeTokenAmount', _calldata: 'generatedCalldata'},
You'll find below an example of how to set up calls. If you prefer something more tangible, check out our Zora Marketplace integration example or our How to Integrate Brydge into an NFT Minting dApp tutorial.
const contract1 = {
address: '0x123...',
functionName: 'function1Name',
price: 234,
parameter1: 'someParameter',
parameter2: 'someParameter',
abi: //abiJSONhere
const contract2 = {
address: '0x456...',
functionName: 'function2Name',
price: 0,
parameter1: 'someParameter',
abi: //abiJSONhere
const contract1Interface = new ethers.utils.Interface(contract1.abi)
const contract2Interface = new ethers.utils.Interface(contract2.abi)
const contract1Calldata = contract1Interface.encodeFunctionData(contract1.functionName, [contract1.parameter1, contract1.parameter2]);
const contract2Calldata = contract2Interface.encodeFunctionData(contract2.functionName, [contract2.parameter1]);
const calls = [
{ _to: contract1.address, _value: contract1.price, _calldata: contract1Calldata },
{ _to: contract1.address, _value: contract2.price, _calldata: contract2Calldata },
This calls array can be passed directly into the calls prop in the BrydgeWidget component.
If you run into issues at any point, reach out to our team on Discord. We're always here to help!
Copy link