Skip to main content

Module eip712

Module eip712 

Source
Expand description

EIP-712 typed-data hashing and signing for Derive self-custodial actions.

action_hash = keccak256(abi.encode(
    [bytes32, uint256, uint256, address, bytes32, uint256, address, address],
    [ACTION_TYPEHASH, subaccount_id, nonce, module_address,
     keccak256(module_data_abi_encoded), signature_expiry_sec, owner, signer],
))
typed_data_hash = keccak256(0x1901 || DOMAIN_SEPARATOR || action_hash)
signature = secp256k1_sign(typed_data_hash, signer_key)

Structs§

ActionContext
Inputs to the EIP-712 action hash, common across all module variants.
SignedAction
A self-custodial action ready to be sent to the venue once signed.

Enums§

TypedDataError
Errors raised while building or signing an EIP-712 action.

Functions§

compute_action_hash
Computes the EIP-712 action hash for a Derive self-custodial action.
compute_typed_data_hash
Composes the final EIP-712 typed-data hash to be signed by the session key.