Skip to Content
Symmio Trading-SDK — the SDK surface for builders on Arbitrum
CoreGaslessrelayGrantDelegation

relayGrantDelegation

Grant an Instant Layer delegation through the gasless relayer — session-key onboarding with no native gas.

import { GASLESS_SESSION_KEY_SELECTORS, relayGrantDelegation } from "@symmio/trading-core"; const receipt = await relayGrantDelegation(config, { account: subAccount, delegatedSigner: sessionKeyAddress, selectors: GASLESS_SESSION_KEY_SELECTORS, expiryTimestamp: BigInt(Math.floor(Date.now() / 1000) + 30 * 24 * 3600), });

A delegation grant is an ordinary owner-signed operation: the SDK encodes InstantLayer.grantDelegation(DelegationInfo), targets the InstantLayer, signs under the InstantLayer EIP-712 domain with a fresh sequential nonce, and submits it through relay-instant with operationType: "grantDelegation" and walletIds: ["0"] — a grant is an ordinary InstantLayer operation, so it never relays from a GaslessWallet. The account owner’s wallet signs — a grant is always owner-signed.

The service’s old standalone delegation-relay endpoint and its SignedDelegation payload no longer exist — their signature digest differs and cannot be converted. Do not port code built on them. The wallet-paid alternative is the plain grantDelegation write.

Pair it with GASLESS_SESSION_KEY_SELECTORS to onboard a session key that can then sign gasless account management without further wallet prompts.

This action is a submit: it resolves with the 202 acceptance. React consumers do not need to follow it by hand — the matching hook in @symmio/trading-react confirms the request before it resolves and invalidates the reads this action changes. See the React gasless guide.

Prefer grantDelegation with gasless: true. A grant is a relayable write like any other, so the ordinary action relays it and returns a transaction hash — no separate code path, and the receipt wait and cache invalidation work unchanged. This action stays as the low-level escape hatch, for when you want the requestId and the fee figures from the acceptance receipt, exactly as relayInstantOperations sits beside the transparent path.

Parameters

accountAddressrequired

The sub-account granting the delegation. The connected wallet must be its owner.

delegatedSignerAddressrequired

The signer being delegated to (e.g. a session key address).

selectorsreadonly Hex[]required

Function selectors the delegate may sign for.

expiryTimestampbigintrequired

Unix timestamp (seconds) when the delegation expires.

chainIdnumberoptional

Target chain id. Defaults to the config’s defaultChainId.

fromAddressoptional

Signer override for the wallet-client resolver.

idempotencyKeystringoptional

Your key for one user action, 1–128 characters, from generateGaslessIdempotencyKey. Reuse it on every attempt of that action. Defaults to a key generated for this call alone.

Returns

Promise<GaslessSubmitReceipt>

The acceptance receipt — persist requestId and poll it with getGaslessRequest to a terminal status.

Pass idempotencyKey to make the grant retryable. A later call under the same key never waits for its own earlier submit, returns that submit’s receipt when this config saw it accepted, and is otherwise accepted by the service at most once. The signature’s deadline is fixed when the call starts. See Recovering gasless writes.

Throws

  • SymmError("validation", "GASLESS_IDEMPOTENCY_KEY_INVALID") — the key is blank or longer than 128 characters. Thrown before any read or prompt.
  • SymmError("config", "GASLESS_NOT_CONFIGURED") / ("config", "GASLESS_UNSUPPORTED_CONTRACTS_VERSION").
  • SymmApiError with code GASLESS_RELAY_SUBMIT_FAILED on HTTP failure.
  • SymmApiError with code GASLESS_SUBMIT_UNCONFIRMED — the outcome could not be established; call again under the same idempotencyKey, or replay it with resubmitGaslessRequest.
  • Everything the wallet-client resolver throws (NO_WALLET_CLIENT, a user’s signature rejection).
Last updated on