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 callsig
(BySig.SignedCall): The signed call data containing:traits
(uint256): The BySig traitsdata
(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.
function hashBySig(BySig.SignedCall memory sig) external view returns (bytes32)
Parameters
sig
(BySig.SignedCall): The signed call data
Description
Computes the hash of a BySig call for signature verification.
Example
// Hash a BySig call
const hash = await papayaContract.hashBySig(signedCallData);
useBySigAccountNonce
Advances the account nonce for BySig operations.
function useBySigAccountNonce(uint32 advance) external
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
// Advance account nonce by 1
await papayaContract.useBySigAccountNonce(1);
useBySigSelectorNonce
Advances the selector nonce for BySig operations.
function useBySigSelectorNonce(bytes4 selector, uint32 advance) external
Parameters
selector
(bytes4): The function selectoradvance
(uint32): The number of nonces to advance
Description
Advances the selector-specific nonce used for BySig operations.
Example
// Advance selector nonce by 1
await papayaContract.useBySigSelectorNonce("0x12345678", 1);
useBySigUniqueNonce
Uses a unique nonce for BySig operations.
function useBySigUniqueNonce(uint256 nonce) external
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
// Use a specific unique nonce
await papayaContract.useBySigUniqueNonce(12345);
Related Errors
WrongSignature: When signature is invalid
WrongNonce: When nonce is incorrect
WrongNonceType: When nonce type is invalid
Last updated