Skip to main content

Overview

Starknet deposits are simple to execute because the Layerswap API returns a pre-built array of Starknet calls in call_data. You parse the JSON and pass it directly to the account’s execute method, which handles multicall execution natively. Prerequisites:
  • starknet.js for account interaction and transaction execution
Supported networks: Starknet Mainnet, Starknet Sepolia

call_data Format

For Starknet, call_data is a JSON-encoded array of call objects. Layerswap always returns two calls:
  1. A transfer call on the token contract (ETH on Starknet is also an ERC-20).
  2. A watch call on the Layerswap Watchdog contract, which the backend uses to match the deposit.
Both calls must execute atomically — pass the whole array to account.execute() as shown below; Starknet handles them as a single multicall transaction.

Transaction Construction

1

Parse call_data

Deserialize the JSON string into an array of Starknet call objects.
2

Execute via Account

Pass the calls array to account.execute(). Starknet natively supports multicall, so all calls in the array are executed atomically in a single transaction.
3

Return the transaction hash

The execute method returns an object with transaction_hash.

Full Example

Pick the flavor that matches your setup. The Server-side tab signs with a raw private key via starknet.js. The Browser tab connects to an injected wallet like ArgentX or Braavos via get-starknet. The starknet-react tab wraps it as a hook for React apps.

Next Step

After the transaction is submitted, notify Layerswap so it can match your deposit faster:
See the full deposit flow for details.