Skip to main content
This example shows the standalone helpers used across every Pods flow: reading a wallet’s positions, and following an action to completion by polling, webhook, or WebSocket.

Overview

This example covers:
  • PositionsGET /v2/wallets/{address}?include=earn
  • Poll an actionGET /actions/{id} (INITIAL → PENDING → SUCCESS/FAILED/REFUNDED/EXPIRED)
  • Webhook — receive ACTION_UPDATE events (push)
  • WebSocket — subscribe to wss://api.pods.finance/updates (push)

Prerequisites

  • Node.js 18+
  • Pods API key
  • For webhook/WebSocket modes: npm install express ws

Installation

Environment Variables

Step-by-Step Walkthrough

1. Check Positions

2. Poll an Action

3. Webhook (push alternative)

Configure your customer webhook URL with Pods (or pass webhookURL per quote). Deframe signs every delivery — verify the signature over the raw body before trusting it, then consume the { messageType, data } envelope (this is different from the WebSocket { type, action } shape). Ack quickly and do heavy work asynchronously.

4. WebSocket (push alternative)

Connect, subscribe to the wallet channel, and handle action_update events. Re-subscribe on reconnect.

Running the Example

See the full runnable script: track-and-positions.js.

Next Steps

Strategy Deposit

Deposit into yield strategies

Ondo Global Markets

Buy/sell tokenized stocks with async orders

Check Positions Guide

Full wallet/position response shape

API Reference

View complete API documentation