GUM Docs
Open GUM

Trading API

Track status

Follow a trade or withdrawal until it settles: poll it, or stream live updates.

Submitting returns an id plus a statusUrl and an eventsUrl. Both give the same object: status, a final flag, and, while it’s pending, a human-readable step.

statusMeaningFinal
pendingSubmitted and in progress. step says what’s happening.No
completedDone. receive (swaps) or amount (withdrawals) shows what arrived.Yes
failedDidn’t go through. reason says why. A failed swap’s funds come back on their own, and it then turns refunded.Swaps: no. Withdrawals: yes
refundedA failed swap’s funds are back in your balance.Yes
cancelledA withdrawal was cancelled and its funds returned.Yes

Stop when final is true. Most trades settle in seconds; withdrawals take about a minute, and a few minutes on Ethereum.

Poll

JavaScript
let status;
do {
  await new Promise((resolve) => setTimeout(resolve, 2000));
  status = await (await fetch(trade.statusUrl)).json();
} while (!status.final);

Stream

The /events routes are server-sent events. Each message is the full status object. The first one is the current status, so a late or reconnecting client never misses the outcome. The stream closes after the final status.

Shell
curl -N https://api.gum.ag/app/v1/swap/<id>/events

In a browser, EventSource reconnects for you:

JavaScript
const events = new EventSource(trade.eventsUrl);
events.onmessage = (event) => {
  const status = JSON.parse(event.data);
  console.log(status.status, status.step ?? "");
  if (status.final) events.close();
};

In Node, read the stream and reconnect when it drops:

JavaScript
const API = "https://api.gum.ag/app/v1";
const url = `${API}/swap/${process.argv[2]}/events`;

for (;;) {
  try {
    const response = await fetch(url);
    const decoder = new TextDecoder();
    let buffer = "";
    for await (const chunk of response.body) {
      buffer += decoder.decode(chunk, { stream: true });
      let end = buffer.indexOf("\n\n");
      while (end >= 0) {
        const data = buffer
          .slice(0, end)
          .split("\n")
          .filter((line) => line.startsWith("data: "))
          .map((line) => line.slice(6))
          .join("\n");
        buffer = buffer.slice(end + 2);
        end = buffer.indexOf("\n\n");
        if (!data) continue;
        const status = JSON.parse(data);
        console.log(status.status, status.step ?? "");
        if (status.final) process.exit(0);
      }
    }
  } catch {
    // The connection dropped; reconnect below.
  }
  await new Promise((resolve) => setTimeout(resolve, 3000));
}

Use /withdraw/{id}/events the same way for withdrawals.

Deposits

GET /v1/deposits/{address}/events streams deposits as they reach your account: one message when a deposit is seen, another when it’s credited. It’s live only, so open it before you send funds. To find past deposits, use GET /v1/history/{address}?type=deposit.

Shell
curl -N https://api.gum.ag/app/v1/deposits/<address>/events