Function Signature
Description
Signs and broadcasts a transaction to the network with full control over all transaction parameters.Parameters
Returns
String - The transaction hash.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Send a transaction with full parameter control.
Future<String> sendTransaction({
required String chainId,
required String to,
String? from,
String? value,
String? data,
String? gas,
String? gasPrice,
String? maxFeePerGas,
String? maxPriorityFeePerGas,
String? nonce,
})
| Parameter | Type | Required | Description |
|---|---|---|---|
chainId | String | Yes | The chain ID in CAIP-2 format |
to | String | Yes | The recipient/contract address |
from | String | No | Sender address (defaults to wallet address) |
value | String | No | Value in wei (hex string) |
data | String | No | Transaction data (hex string) |
gas | String | No | Gas limit (hex string) |
gasPrice | String | No | Gas price for legacy transactions (hex) |
maxFeePerGas | String | No | Max fee per gas for EIP-1559 (hex) |
maxPriorityFeePerGas | String | No | Max priority fee for EIP-1559 (hex) |
nonce | String | No | Transaction nonce (hex string) |
String - The transaction hash.
import 'package:portal_flutter/portal_flutter.dart';
final portal = Portal();
// Simple ETH transfer
final txHash = await portal.sendTransaction(
chainId: 'eip155:1',
to: '0xRecipientAddress',
value: '0xDE0B6B3A7640000', // 1 ETH in wei (hex)
);
print('Transaction hash: $txHash');
final txHash = await portal.sendTransaction(
chainId: 'eip155:1',
to: '0xRecipientAddress',
value: '0x10',
maxFeePerGas: '0x3B9ACA00',
maxPriorityFeePerGas: '0x3B9ACA00',
);
final txHash = await portal.sendTransaction(
chainId: 'eip155:1',
to: '0xContractAddress',
data: '0xa9059cbb...', // Encoded function call
gas: '0x5208',
);
| Code | Description |
|---|---|
NOT_INITIALIZED | Portal was not initialized |
TRANSACTION_FAILED | The transaction failed |
INSUFFICIENT_FUNDS | Not enough funds for gas or value |
Was this page helpful?