跳到主要内容
NoveraSwap
zh-Hans

API

本网站背后的公共 API。完整的机器可读描述以 OpenAPI 3.1 格式提供,地址为 https://api.noveraswap.com/v1/openapi.json。

集成指南

从一个链接到完整的服务器集成,有三种方式为您的用户提供私密兑换。

推荐链接

在推广计划页面获取推荐码。同时您会获得一个以 aff_ 开头的仪表板密钥;它只显示一次,请妥善保管。

分享 https://noveraswap.com/?ref=YOURCODE(将 YOURCODE 替换为您的推荐码),或在首页或任一兑换页面(/swap/…)的地址后加上 ?ref=YOURCODE;推荐码在有兑换表单的页面上生效。

通过您的链接创建的每一笔订单,都会让您获得本服务就该订单实际收到款项的一部分分成。您只能看到总计数据,永远看不到关于您所推荐的人的任何信息。

在您于仪表板中申请付款后,收益将以 USDC 支付。大多数付款会在几分钟内自动发送;有时某笔付款需要等待我们的团队处理,可能需要几天时间。

小组件

使用 iframe 将兑换表单嵌入您的页面。访客是在框架中的本站页面上完成兑换,因此您的网站从不经手他们的币或地址。

<iframe
  src="https://noveraswap.com/widget?from=usdt-eth&to=usdc-base&ref=YOURCODE&theme=auto"
  title="NoveraSwap"
  width="420"
  height="680"
  allow="clipboard-write"
  style="border:0"
  loading="lazy"
></iframe>

查询参数(均为可选):

  • from — 要发送的资产,使用其在本网站上的 ID(例如 usdt-eth)
  • to — 要接收的资产,使用其 ID
  • amount — 要发送的金额,以点作为小数分隔符
  • mode — private 或 standard
  • ref — 您的推荐码,使通过小组件创建的订单计入您的名下
  • theme — dark、light 或 auto(跟随访客的系统设置)
  • lockTo — 1 表示固定要接收的资产;需要同时设置 to

小组件通过 postMessage 向您的页面通报进度:novera:order_created 携带订单号,novera:phase_changed 携带订单号及其公开阶段。使用消息前,请先确认它来自本网站(event.origin)。

window.addEventListener('message', (event) => {
  if (event.origin !== 'https://noveraswap.com') return;
  if (event.data?.type === 'novera:order_created') {
    // event.data.orderId
  }
  if (event.data?.type === 'novera:phase_changed') {
    // event.data.orderId, event.data.phase
  }
});
宿主页面永远无法预填目标地址或退款地址,无论是通过 URL 还是 postMessage:只有访客本人输入币的去向。如果您需要自行设置目标地址,请使用服务器对服务器 API。

服务器对服务器 API

在推广伙伴面板中创建您的密钥(请先在推广计划页面获取代码)。用它创建的每一笔订单都会为您带来推广分成,与通过您的推荐链接下的订单完全相同。再次创建密钥会立即替换之前的密钥。

请从您自己的服务器调用 API,使用以 nsk_ 开头的集成方密钥,并通过 X-Api-Key 请求头发送。切勿在浏览器中使用该密钥:带有 Origin 请求头的请求会被拒绝。

请求速率限制按密钥执行。请像保管密码一样把密钥保存在您的服务器上:持有密钥的人就能以您的名义创建订单。

新密钥起初与没有密钥的访客适用相同的限制(包括偶尔需要的工作量证明),且只能保留少量等待存款的订单;在其部分订单完成付款后,即获得完整限额。订单几乎从未付款的密钥会被封禁;支持团队可以重新启用。

完整参考是位于 https://api.noveraswap.com/v1/openapi.json 的 OpenAPI 文档。

集成方使用同一个 API,以服务器对服务器的方式调用,并使用自己的密钥。浏览器永远无法使用集成方密钥。

Affiliates

端点功能
POST/v1/affiliatesSign up as an affiliate and reserve a referral code.
GET/v1/affiliates/meThe affiliate account and its totals (aggregates only).
PATCH/v1/affiliates/meChange the payout address or contact.
DELETE/v1/affiliates/me/api-keyRevoke the affiliate's own server-to-server API key.
POST/v1/affiliates/me/api-keyCreate (or replace) the affiliate's own server-to-server API key.
POST/v1/affiliates/me/keyReplace the affiliate key.
POST/v1/affiliates/me/payout-requestRequest a payout of the whole withdrawable balance.
POST/v1/affiliates/me/recovery-codeMake a new recovery code.
DELETE/v1/affiliates/me/recovery-emailRemove the recovery email.
POST/v1/affiliates/me/recovery-emailAdd or replace the optional recovery email.
POST/v1/affiliates/me/recovery-email/verifyConfirm the recovery email with the code mailed to it.
GET/v1/affiliates/me/statementsStatements and payout requests with their status, newest first.
GET/v1/affiliates/me/statsReferred orders and earnings per day, week or month (aggregates only).
GET/v1/affiliates/me/ticketsThe affiliate's support requests, newest first.
POST/v1/affiliates/me/ticketsOpen a support request about the affiliate account.
GET/v1/affiliates/me/tickets/{ticketId}One support request and its thread.
POST/v1/affiliates/me/tickets/{ticketId}/closeClose a support request.
POST/v1/affiliates/me/tickets/{ticketId}/messagesWrite to a support request.
POST/v1/affiliates/recoverAsk for a key recovery code (no key).
POST/v1/affiliates/recover/confirmExchange a recovery code for a new key (no key).

Catalogue

端点功能
GET/v1/assetsEnabled assets with their networks and the pricing notice copy.
GET/v1/pairs/limitsMinimum and maximum input amount for a pair.

Utilities

端点功能
GET/v1/go/{id}Redirect to the sponsor, counting the click.
GET/v1/openapi.jsonThis OpenAPI 3.1 document.
GET/v1/powProof-of-work challenge parameters for `X-Novera-PoW`.
GET/v1/sponsorsThe sponsored card for a slot, if any.
POST/v1/sponsors/{id}/impressionCount one impression of a placement.
GET/v1/statusService status, completion statistics, incidents and the signing-key manifest.
POST/v1/telemetry/client-errorsOpt-in client error reports.
POST/v1/validate-addressCheck an address for an asset, locally.

Health

端点功能
GET/v1/healthLiveness; no dependencies.
GET/v1/health/readyReadiness: `200` when ready (possibly degraded), `503` otherwise.

Orders

端点功能
POST/v1/ordersCreate an order from a quote.
GET/v1/orders/{publicId}Order status: minimal without the secret, full with it.
POST/v1/orders/{publicId}/actionAnswer the form in `actionRequired`.
POST/v1/orders/{publicId}/cancelCancel an order that is still waiting for its deposit.
DELETE/v1/orders/{publicId}/detailsDelete the order details now instead of at the automatic deletion.
GET/v1/orders/{publicId}/eventsThe full public timeline, with transaction hashes where present.
POST/v1/orders/{publicId}/notificationsOpt into status notifications by email or Telegram.
DELETE/v1/orders/{publicId}/notifications/{channel}Remove a notification channel.
POST/v1/orders/{publicId}/refund-addressRegister or replace the refund address.

Support

端点功能
GET/v1/orders/{publicId}/ticketsEvery ticket on the order with its thread.
POST/v1/orders/{publicId}/ticketsOpen a support ticket on an order.
GET/v1/orders/{publicId}/tickets/{ticketId}One ticket and its thread.
POST/v1/orders/{publicId}/tickets/{ticketId}/closeClose a ticket and release its hold on the order details.
POST/v1/orders/{publicId}/tickets/{ticketId}/messagesAdd a message to a ticket.
POST/v1/support/requestsOpen a support request without an order.
GET/v1/support/requests/{ticketId}A request without an order and its thread.
POST/v1/support/requests/{ticketId}/closeClose a request without an order.
POST/v1/support/requests/{ticketId}/messagesAdd a message to a request without an order.

Quotes

端点功能
POST/v1/quotesQuote a swap.