Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Recipe — Gas-less commit (Biconomy) · Boson Protocol
Skip to content

Recipe: Gas-less commit (Biconomy)

The buyer never pays gas. They sign an EIP-712 envelope; a Biconomy relayer pays the gas, calls the Diamond's executeMetaTransaction, and the commit happens.

For the full signing reference, see Concepts → Signing & meta-transactions → Boson meta-tx (Biconomy).

Buyer side

import { CoreSDK } from "@bosonprotocol/core-sdk"
 
const sdk = CoreSDK.fromDefaultConfig({
  web3Lib,
  envName: "production",
  configId: "production-137-0",
})
 
// The meta-tx helpers live on the top-level SDK (not under a `metaTx` namespace).
//
// 1. Build and sign the meta-tx envelope
const signedMetaTx = await sdk.signMetaTxCommitToOffer({
  buyer: wallet.address,
  offerId,
})
 
// 2. Relay it through the configured Biconomy endpoint
const txHash = await sdk.relayMetaTransaction(signedMetaTx)
console.log("commit relayed:", txHash)

relayMetaTransaction calls the configured Biconomy endpoint. The buyer's wallet never broadcasts; only the signature crosses the wire.

For ERC-20 offers

You also need the token allowance. Two options:

  1. Pre-approve with a one-time on-chain tx (buyer pays gas once, never again).
  2. Use the token-auth meta-tx flow to combine approve + commit in one signed envelope:
const signed = await sdk.signMetaTxWithTokenTransferAuthorization({
  functionName: "commitToOffer",
  functionArgs: { buyer, offerId },
  tokenAuth: { type: "ERC3009", /* USDC etc. */ },
})
await sdk.relayForwardedMetaTransaction(signed)

See Concepts → Signing → Token-auth meta-tx and Reference → Core SDK → MetaTx mixin.

Common gotchas

  • Biconomy may rate-limit your relayer. Have a fallback to direct on-chain.
  • The buyer's wallet must support EIP-712 signing. Most modern wallets do; hardware wallets need firmware updates for some payloads.

Related