BySig Operations

This section covers the BySig functionality for gasless operations using signatures.

bySig

Executes a signed call with a signature.

function bySig(address signer, BySig.SignedCall memory sig, bytes signature) external payable returns (bytes memory ret)

Parameters

  • signer (address): The address that signed the call

  • sig (BySig.SignedCall): The signed call data containing:

    • traits (uint256): The BySig traits

    • data (bytes): The call data

  • signature (bytes): The signature for the call

Description

Executes a call that was signed off-chain. This allows for gasless interactions where users sign messages off-chain and others can execute them on-chain.

Example

// Execute a signed call
const result = await papayaContract.bySig(
  signerAddress,
  signedCallData,
  signature,
  { value: ethers.utils.parseEther("0.1") }
);

hashBySig

Computes the hash of a BySig call.

Parameters

  • sig (BySig.SignedCall): The signed call data

Description

Computes the hash of a BySig call for signature verification.

Example

useBySigAccountNonce

Advances the account nonce for BySig operations.

Parameters

  • advance (uint32): The number of nonces to advance

Description

Advances the account nonce used for BySig operations. This is useful for invalidating old signatures.

Example

useBySigSelectorNonce

Advances the selector nonce for BySig operations.

Parameters

  • selector (bytes4): The function selector

  • advance (uint32): The number of nonces to advance

Description

Advances the selector-specific nonce used for BySig operations.

Example

useBySigUniqueNonce

Uses a unique nonce for BySig operations.

Parameters

  • nonce (uint256): The unique nonce to use

Description

Uses a specific unique nonce for BySig operations. This allows for precise control over signature replay protection.

Example

Last updated