Portal’s Web SDK provides token delegation capabilities through theDocumentation Index
Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
Use this file to discover all available pages before exploring further.
portal.delegations API. This enables approving token spending, revoking approvals, checking delegation status, and transferring tokens as a delegate on both EVM and Solana chains.
Overview
The delegations functionality allows you to:- Approve other addresses to spend tokens on behalf of your wallet
- Revoke existing delegations to remove spending permissions
- Check status of active delegations and balances
- Transfer tokens as a delegate from another address
- Approve, revoke, and transfer in one step using the high-level submit helpers (
approveAndSubmit,revokeAndSubmit,transferAndSubmit)
Prerequisites
Before using delegation operations, ensure you have:- A properly initialized Portal client
- An active wallet with tokens on the target network (see Create a wallet)
- Understanding of token delegations concepts
High-Level Methods
These methods provide auto-submit behavior. For most use cases, these helpers are the recommended starting point. They call the matching delegation API method, then sign and broadcast each returned transaction in order — all in a single call. The low-level methods (approve, revoke, transferFrom) only build delegation transactions via the API. You receive EVM transaction objects or Solana-encoded payloads and must call portal.request with the correct method yourself (eth_sendTransaction or sol_signAndSendTransaction). The high-level methods handle that signing and submission step for you, resolving to transaction hashes only — they do not wait for on-chain confirmation.
When you use the standard Portal client, portal.delegations is automatically wired with a default signAndSendTransaction implementation that picks eth_sendTransaction vs sol_signAndSendTransaction based on whether the chain id starts with solana.
The signer is resolved in priority order:
- Per-call override —
options.signAndSendTransactionwhen provided - Instance-level default — configured on
Portal(automatic when you constructPortal) - Error — thrown if neither is available:
[Delegations] No signer configured. Call setSignAndSendTransaction() on the instance or pass signAndSendTransaction in options.
TypeScript request and options shapes (
ApproveDelegationRequest, RevokeDelegationRequest, TransferFromRequest, DelegationSubmitOptions, DelegationSubmitProgress) are listed in Delegations — Web SDK reference. Types are exported from @portal-hq/web.approveAndSubmit
Overview
Callsapprove, then signs and sends every transaction in the response. Use it when you want a single step from approval intent to submitted transactions instead of manually calling portal.request after approve.
Example
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
params | object | Yes | Same shape as approve. |
params.chain | string | Yes | Chain CAIP ID (EVM eip155:… or Solana solana:…). |
params.token | string | Yes | Token symbol for the delegations API. |
params.delegateAddress | string | Yes | Address allowed to spend on your behalf. |
params.amount | string | Yes | Approval amount as a positive decimal string. |
options | object | No | Optional callbacks and configuration. |
options.signAndSendTransaction | function | No | Per-call signer override. Auto-configured by Portal when using the default client. |
options.onProgress | (event) => void | No | See Progress events below. |
onProgress is set): the callback is invoked twice per transaction — once with step: 'signing' (fields: index, total) before signing begins, and once with step: 'submitted' (fields: index, total, hash) after signAndSendTransaction resolves. For a batch of n transactions, onProgress is called 2n times in total.
Returns
{ hashes: string[] }— One entry per submitted transaction, in the same order astransactions(EVM) orencodedTransactions(Solana) from the API. Each value is the hash returned bysignAndSendTransactionfor that item.
Notes / Gotchas
- Transactions are submitted sequentially (not batched in one RPC call). If the API returns multiple payloads, the second is only sent after the first send resolves.
- The method returns as soon as transactions are submitted; waiting for confirmations is your app’s responsibility.
- Each step triggers a wallet / signing flow through the Portal provider.
- For Solana responses, encoded payloads are used when
transactionsis missing or empty (same selection rules as the implementation). - If the API response includes no
transactionsand noencodedTransactions, the method throws:No transactions in delegation response.
revokeAndSubmit
Overview
Callsrevoke, then signs and sends each returned transaction. Use it to remove spending permission and broadcast the revocation in one flow.
Example
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
params | object | Yes | Same shape as revoke. |
params.chain | string | Yes | Chain CAIP ID. |
params.token | string | Yes | Token symbol. |
params.delegateAddress | string | Yes | Delegate address whose approval you revoke. |
options | object | No | Same as approveAndSubmit (signAndSendTransaction, onProgress). |
Returns
{ hashes: string[] }— Same semantics asapproveAndSubmit: ordered hashes from eachsignAndSendTransactioncall.
Notes / Gotchas
- Same execution, signing, confirmation, chain-routing, and empty-response behavior as
approveAndSubmit.
transferAndSubmit
Overview
CallstransferFrom, then signs and sends each returned transaction. Use it when your wallet is the delegate moving funds from an owner you were approved for.
Example
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
params | object | Yes | Same shape as transferFrom. |
params.chain | string | Yes | Chain CAIP ID. |
params.token | string | Yes | Token symbol. |
params.fromAddress | string | Yes | Owner who delegated to your wallet. |
params.toAddress | string | Yes | Recipient of the transfer. |
params.amount | string | Yes | Amount to move. |
options | object | No | Same as approveAndSubmit (signAndSendTransaction, onProgress). |
Returns
{ hashes: string[] }— Same ordering rules as the other submit helpers.
Notes / Gotchas
- Same sequential submit, no confirmation wait, signing, chain routing, and empty-response error as above.
- Unlike
transferFrom,transferAndSubmitdoes not return APImetadata(for exampleTransferAsDelegateMetadata); only{ hashes }is exposed after broadcast.
Overriding the transaction sender
When usingPortal, the default signAndSendTransaction is automatically configured, so you don’t need to provide it. For custom signing logic (for example a different submission path), pass signAndSendTransaction in the options:
tx is the same shape the default signer passes through: an EVM transaction object from transactions[], or a Solana payload from encodedTransactions[].
Low-level methods
The following methods return raw API responses — transaction objects for EVM or base64-encoded payloads for Solana — which you sign and broadcast yourself viaportal.request. Use these when you need full control over the signing or submission step.
Approving Delegations
Useapprove to grant another address permission to spend tokens on your behalf. This method works for both EVM and Solana chains.
EVM Approval
Checking Delegation Status
UsegetStatus to check current delegations and token balances for a specific delegate address.
EVM Status Check
Revoking Delegations
Userevoke to remove spending permissions from a delegate address.
EVM Revoke
Transferring as a Delegate
UsetransferFrom to transfer tokens from another address that has delegated spending permission to you.
EVM Transfer From
Delegation Roles:
fromAddress is the token owner who approved the delegation. Your wallet (the delegate) signs the transaction to transfer tokens from the owner to the toAddress recipient.Supported Networks
Delegations work on all Portal-supported EVM and Solana chains:- EVM: Ethereum, Polygon, Base, Arbitrum, Optimism, Monad, and all other EVM-compatible chains
- Solana: Solana Mainnet and Devnet
Next Steps
- Learn about signing transactions
- Explore Portal API methods
- Review delegation concepts
- Check out wallet lifecycle management