Documentation Index
Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
Use this file to discover all available pages before exploring further.
Function Signature
Future<String> rawSign({
required String chainId,
required String message,
String? signatureApprovalMemo,
})
Description
Signs a raw message without adding any prefix. Unlike signMessage, this does not prepend the Ethereum message prefix. Use this for signing raw data or for chains that don’t use Ethereum’s message prefix.
Parameters
| Parameter | Type | Required | Description |
|---|
chainId | String | Yes | The chain ID in CAIP-2 format |
message | String | Yes | The message to sign (must be hex-encoded) |
signatureApprovalMemo | String | No | Optional memo for signature approval |
Returns
String - The signature as a hex string.
Example
import 'package:portal_flutter/portal_flutter.dart';
final portal = Portal();
// Message must be hex-encoded
// "test" in hex is "74657374"
final signature = await portal.rawSign(
chainId: 'eip155:1',
message: '74657374',
signatureApprovalMemo: 'Signing test message',
);
print('Raw signature: $signature');
Chain-Specific Signing
The curve used for signing depends on the chain ID:
| Chain Type | Curve |
|---|
eip155:* | SECP256K1 |
solana:* | ED25519 |
// SECP256K1 signing (Ethereum)
final ethSignature = await portal.rawSign(
chainId: 'eip155:1',
message: '74657374',
);
// ED25519 signing (Solana)
final solSignature = await portal.rawSign(
chainId: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
message: '74657374',
);
Errors
| Code | Description |
|---|
NOT_INITIALIZED | Portal was not initialized |
SIGNING_FAILED | The signing operation failed |
INVALID_HEX | The message is not valid hex |