Send Transactions
Human Wallet makes it easy to send transactions across all supported EVM-compatible blockchains. The SDK abstracts away cryptographic complexity and gas management, while remaining fully compatible with standard Ethereum interfaces.
Overviewβ
- Transaction Sending: Send EVM transactions (including contract calls and token transfers) with a unified interface.
- Multi-Chain Support: Works seamlessly across all supported EVM chains, with automatic chain switching and gas management via the Gas Tank.
Usageβ
All transaction methods are available via the SilkProvider
object returned by initSilk()
from the @silk-wallet/silk-wallet-sdk
package.
import { initSilk } from "@silk-wallet/silk-wallet-sdk";
initSilk();
Sending Transactionsβ
wallet_switchEthereumChain
β
Wallet's current chain can be switched easily by calling wallet_switchEthereumChain
.
Before calling eth_sendTransaction
, the intended chain needs to be set.
Refer to https://chainlist.org/ for chain IDs.
// switch chain - get chainId at https://chainlist.org/
await window.silk.request({
method: "wallet_switchEthereumChain",
params: [{ chainId: 11155111 }], // sepolia testnet
});
π Demo
eth_chainId
β
To get the wallet's current chain ID, call eth_chainId
. It returns chain ID in lowercase Hex.
// get current chainId
// it returns chainId as lowercase Hex
const chainId = await window.silk.request({
method: "eth_chainId"
});
π Demo
eth_sendTransaction
β
Send a transaction (ETH transfer, contract call, etc.) from the userβs Human Wallet.
// get address of the user
const accounts = await window.silk.request({
method: "eth_requestAccounts",
});
const address = accounts[0];
// switch chain - get chainId at https://chainlist.org/
await window.silk.request({
method: "wallet_switchEthereumChain",
params: [{ chainId: 11155111 }], // sepolia testnet
});
// get current chainId
// it returns chainId as lowercase Hex
const chainId = await window.silk.request({
method: "eth_chainId"
});
// send transaction
const txHash = await window.silk.request({
method: "eth_sendTransaction",
params: [
{
from: address,
to: "0x...", // EOA or contract address
value: "0x...", // hex-encoded value in wei
data: "0x...", // optional, for contract calls
gas: "0x...", // optional, estimated automatically if omitted
// optional, defaults to current chain
// chainId needs to be in lowercase hex
chainId: "0x1",
},
],
});
- from: The userβs address (must match the logged-in Human Wallet).
- to: The recipient address (EOA or contract).
- value: Amount of ETH (in wei, hex-encoded).
- data: (Optional) Contract call data.
- gas: (Optional) Gas limit.
- chainId: (Optional) EVM chain ID in lowercase Hex.
Refer to https://chainlist.org/ for chain IDs.
Features:
- Human Wallet will prompt the user to review and approve the transaction.
- Works across all supported chains.
- Gas fees can automatically managed via the Gas Tank (no need to hold native tokens).
π Demo
Sending Sponsored Transactionsβ
Human Wallet supports sponsoring transactions across all supported chains for seamless user experience. Gas sponsorship can be configured to a specific contract or a specific contract method.
Please refer to the Gas Tank guide to see how to configure the gas tank for your project.
For demo below, the project is setup with Gas Tank for sponsoring calls to this specific contract on Optimism Mainnet.
π Demo
Security and User Experienceβ
- User Consent: All signing and transaction actions require explicit user approval via the Human Wallet modal.
- No Private Key Exposure: Private keys never leave the secure enclave; all signing is performed in a secure, isolated environment.
- Multi-Chain: The SDK handles chain switching and ensures transactions are sent to the correct network.