Skip to main content

Function Signature

Description

Signs typed structured data according to the EIP-712 standard using the eth_signTypedData_v4 RPC method. EIP-712 signatures are commonly used for gasless approvals, off-chain orders, and structured authentication messages. The Flutter SDK accepts the typed data payload as a JSON-encoded string. Use dart:convert’s jsonEncode to serialize a Map into the expected format.

Parameters

Returns

String — The signature as a hex string.

Example

Basic example

Permit (ERC-20 gasless approval)

A common use of EIP-712 is signing an ERC-20 permit message to grant token approvals without an on-chain transaction:

Errors

Throws a PortalException on failure:

Implementation Notes

  • The chainId value inside the domain object should match the chain you are signing on. Mismatches will produce a signature that will not verify on-chain.
  • The Portal Flutter SDK signs typed data via the eth_signTypedData_v4 RPC method — only EIP-712 v4 is supported.
  • Verify the signature server-side before using it to authorize an action.