TESTNET ONLINE: PECORINO PECORINO

Working with Orders

Conditional transactions via Signed Orders

Signet orders use the Permit2 standard, allowing users to authorize token transfers with a single signature. This intent mechanism powers Signet’s swaps, allowing users to express intents like:

“I want to swap 5 Signet ETH for 1000 USDC on Ethereum”

Nothing happens if the exact conditions you specify are not met.

Technical Order Structure

 1// Wrapper with order ID
 2pub struct Order {
 3    /// The order id. This is the signature of the order.
 4    pub id: String,
 5    /// The order.
 6    pub order: SignedOrder,
 7}
 8
 9// Core signed order structure
10pub struct SignedOrder {
11    /// The permit batch.
12    #[serde(flatten)]
13    pub permit: Permit2Batch,
14    /// The desired outputs.
15    pub outputs: Vec<o>,
16}
17
18// Output definition
19pub struct Output {
20    pub token: Address,
21    pub amount: Uint<256, 4>,
22    pub recipient: Address,
23    pub chainId: u32,
24}

Permit2 Batches

1// Permit2 batches
2pub struct Permit2Batch {
3    pub permit: PermitBatchTransferFrom,
4    pub owner: Address,
5    pub signature: Bytes,
6}

Permit2 batches contain individually signed transactions, allowing multiple inputs (what the user provides) to map to desired outputs (what the user receives).

For Users: Working with Orders

Users interact with Signet’s order system primarily when moving assets from Signet to Ethereum.

Creating a Signed Order

To create a Signed Order, follow these steps:

  1. Decide which assets you’re willing to provide (inputs) and what you want to receive (outputs)
  2. Authorize the Permit2 contract to manage your tokens
  3. Sign the order with your wallet
  4. Submit the order to the orders cache
 1{
 2  // Inputs (what you're providing)
 3  "inputs": [
 4    {
 5      "token": "0x...", // Address of token on Signet
 6      "amount": "1000000000000000000" // 1 ETH in wei
 7    }
 8  ],
 9  // Outputs (what you want to receive)
10  "outputs": [
11    {
12      "token": "0x...", // Address of USDC on Ethereum
13      "amount": "1000000000", // 1000 USDC with 6 decimals
14      "recipient": "0x...", // Your Ethereum address
15      "chainId": 1 // Ethereum mainnet
16    }
17  ]
18}

Order Status

You can check the status of your orders:

  • Pending: Order is in the cache waiting to be filled
  • Filled: Order has been successfully executed
  • Expired: Order has passed its deadline without being filled

User Best Practices

  • Set reasonable price expectations for cross-chain swaps
  • Monitor orders that remain unfilled for extended periods
  • Consider setting a deadline to ensure stale orders don’t execute at unfavorable rates