Fund your Wallet
Now that you have a wallet, the next step is to get test tokens for it. You can fund your wallet using the Fund wallet with testnet tokens Client API endpoint. If you are looking for a greater variety of test tokens, we recommend exploring our faucets page.
The chainId will need to be a CAIP-2 compliant Chain ID. For more info on Chain ID formatting, see this doc.
curl --request POST \
--url https://api.portalhq.io/api/v3/clients/me/fund \
--header 'Authorization: Bearer [clientApiKey|clientSessionToken]' \
--header 'Content-Type: application/json' \
--data '{
"chainId": "eip155:10143",
"token": "NATIVE",
"amount": "0.01"
}'
Sending Tokens from your Wallet
Portal provides two ways to send transactions:
- The Send Asset Enclave MPC API endpoint - Simply send tokens from your Portal wallet.
- The Sign Enclave MPC API endpoint - Create and submit your own custom transactions from your Portal wallet.
For most use cases, we recommend using the Send Asset Enclave MPC API endpoint as shown in the examples below.
The below example sends 0.0001 ETH on Monad Testnet from your Portal client’s wallet.curl --request POST \
--url https://mpc-client.portalhq.io/v1/assets/send \
--header 'Authorization: Bearer [clientApiKey|clientSessionToken]' \
--header 'Content-Type: application/json' \
--data '{
"share": "SECP256K1.share",
"rpcUrl": "https://api.portalhq.io/rpc/v1/eip155/10143",
"chain": "monad-testnet",
"to": "0xDestinationAddress",
"token": "NATIVE",
"amount": ".0001"
}'
The below example sends 0.0001 SOL on Solana Devnet from your Portal client’s wallet.You will need SOL to submit a Solana transaction, which is not currently supported by POST /api/v3/clients/me/fund. You can find a faucet to get test SOL tokens here. curl --request POST \
--url https://mpc-client.portalhq.io/v1/assets/send \
--header 'Authorization: Bearer [clientApiKey|clientSessionToken]' \
--header 'Content-Type: application/json' \
--data '{
"share": "ED25519.share",
"rpcUrl": "https://api.portalhq.io/rpc/v1/solana/EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
"chain": "solana-devnet",
"to": "0xDestinationAddress",
"token": "NATIVE",
"amount": ".0001"
}'
The below example sends 0.0001 BTC on Bitcoin Testnet from your Portal client’s p2wpkh wallet.You will need BTC to submit a Solana transaction, which is not currently supported by POST /api/v3/clients/me/fund. You can find a faucet to get test BTC tokens here. The chain request body parameter for sending BTC can be one of:
bitcoin-segwit - The Portal client’s P2WPKH address on Bitcoin mainnet.
bitcoin-p2wpkh - The Portal client’s P2WPKH address on Bitcoin mainnet.
bitcoin-segwit-testnet - The Portal client’s P2WPKH address on Bitcoin testnet.
bitcoin-p2wpkh-testnet - The Portal client’s P2WPKH address on Bitcoin testnet.
curl --request POST \
--url https://mpc-client.portalhq.io/v1/assets/send \
--header 'Authorization: Bearer [clientApiKey|clientSessionToken]' \
--header 'Content-Type: application/json' \
--data '{
"share": "SECP256K1.share",
"chain": "bitcoin-segwit-testnet",
"to": "tb1qDestinationAddress",
"token": "NATIVE",
"amount": ".0001"
}'
You just sent your first token from your Portal wallet, that’s awesome! 🎉
If your client is using Account Abstraction, you can control whether Portal sponsors the gas fees for each transaction using the sponsorGas parameter.
Example: User Pays Gas
curl --request POST \
--url https://mpc-client.portalhq.io/v1/assets/send \
--header 'Authorization: Bearer [clientApiKey|clientSessionToken]' \
--header 'Content-Type: application/json' \
--data '{
"share": "SECP256K1.share",
"chain": "sepolia",
"to": "0xDestinationAddress",
"token": "NATIVE",
"amount": "0.0001",
"rpcUrl": "https://api.portalhq.io/rpc/v1/eip155/11155111",
"sponsorGas": false
}'
By setting sponsorGas: false, the Portal client will pay for the transaction fees instead of having them sponsored. This is useful for testing or when you want users to pay for specific operations.
Omitting sponsorGas or setting it to true produces the same behavior - both will sponsor gas if your environment is configured for AA on that chain. Only sponsorGas: false changes the default behavior to disable sponsorship.
Learn more about gas sponsorship control in the Account Abstraction guide.
You may have a more advanced use case than simply sending tokens from your Portal wallet. Next, we will dive into how to build your own custom transaction and also how to sign it.