@ravnexchange/sdk 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -30,8 +30,10 @@ export declare class RavnClient {
30
30
  }>;
31
31
  /** POST /v1/status: pass the quoteToken execute() returned (not the quote's own), and as `ref`
32
32
  * the execution's statusRef, submitSignature's statusRef, or the origin tx hash. POST, not GET:
33
- * a 2-hop quoteToken in a query string can exceed header limits and fail with 431. */
34
- getStatus(quoteToken: string, ref: string): Promise<StatusDTO>;
33
+ * a 2-hop quoteToken in a query string can exceed header limits and fail with 431. `txHash`:
34
+ * a two-hop route's hop-1 transaction, or the fee payment a DEPOSIT's `fee.transaction` asked
35
+ * for; it's how RAVN proves the fee your share is paid from. */
36
+ getStatus(quoteToken: string, ref: string, txHash?: string): Promise<StatusDTO>;
35
37
  /** GET /v1/tokens: RAVN's listed token registry for one chain. Not a per-pair routability guarantee. */
36
38
  getTokens(chainId: number): Promise<TokenDTO[]>;
37
39
  /** GET /v1/chains: every chain RAVN lists tokens for. Static; safe to cache client-side. */
package/dist/client.js CHANGED
@@ -65,11 +65,13 @@ class RavnClient {
65
65
  }
66
66
  /** POST /v1/status: pass the quoteToken execute() returned (not the quote's own), and as `ref`
67
67
  * the execution's statusRef, submitSignature's statusRef, or the origin tx hash. POST, not GET:
68
- * a 2-hop quoteToken in a query string can exceed header limits and fail with 431. */
69
- getStatus(quoteToken, ref) {
68
+ * a 2-hop quoteToken in a query string can exceed header limits and fail with 431. `txHash`:
69
+ * a two-hop route's hop-1 transaction, or the fee payment a DEPOSIT's `fee.transaction` asked
70
+ * for; it's how RAVN proves the fee your share is paid from. */
71
+ getStatus(quoteToken, ref, txHash) {
70
72
  return this.request("/status", {
71
73
  method: "POST",
72
- body: JSON.stringify({ quoteToken, ref }),
74
+ body: JSON.stringify({ quoteToken, ref, ...(txHash ? { txHash } : {}) }),
73
75
  });
74
76
  }
75
77
  /** GET /v1/tokens: RAVN's listed token registry for one chain. Not a per-pair routability guarantee. */
package/dist/types.d.ts CHANGED
@@ -154,6 +154,19 @@ export type ExecutionDTO = {
154
154
  submit?: {
155
155
  url: string;
156
156
  };
157
+ /**
158
+ * Only when your key sets a fee and the route has no fee of its own (Eco, Layerswap, Mayan's
159
+ * routes paying no referrer): RAVN's fee, a transfer of the input token to RAVN;
160
+ * `transaction` already leaves it out. Skip it and the swap still fills; no fee is owed to
161
+ * you. With no `statusRef` here (you poll with the swap's own tx hash), a wallet that batches
162
+ * atomically (EIP-5792 `wallet_sendCalls`, one transaction) may send `fee.transaction` in the
163
+ * same batch as `transaction`, and the swap's tx proves it (an ERC-20 sell only: a native coin
164
+ * batched leaves nothing to read). Otherwise — including a batch the wallet splits into
165
+ * several transactions — send it as a transaction of its own from the user's regular wallet
166
+ * once the swap has confirmed, and pass its hash as `txHash` to getStatus. A fee paid on a
167
+ * swap the venue refunds stays with RAVN.
168
+ */
169
+ fee?: DepositFeeDTO;
157
170
  } | {
158
171
  executionType: "SIGNATURE";
159
172
  /** Pass this, not the quote's own token, to submitSignature and getStatus. */
@@ -180,7 +193,33 @@ export type ExecutionDTO = {
180
193
  };
181
194
  /** Poll getStatus with this, not `deposit.address`. */
182
195
  statusRef: string;
196
+ /** Only when your key sets a fee and the venue has no fee of its own (Rift; private swaps from
197
+ * an EVM chain or Bitcoin). Skip it and the swap still fills on `deposit.amount`; no fee is
198
+ * owed to you. A fee paid on a swap the venue then refunds stays with RAVN and nothing is owed
199
+ * on it, so send an EVM fee payment once the deposit has confirmed. */
200
+ fee?: DepositFeeDTO;
183
201
  };
202
+ /** RAVN's integrator fee beside a deposit (or a transaction), in the input token, paid by your user
203
+ * to RAVN; your share is paid out as usual. `deposit.amount` (the transaction) already leaves it out. */
204
+ export interface DepositFeeDTO {
205
+ /** Base units of the input token. */
206
+ amount: string;
207
+ /** RAVN's fee address on the input chain. */
208
+ address: string;
209
+ chainId: number;
210
+ /** EVM: send this transaction too, exactly as given and as a transaction of its own from the
211
+ * user's regular wallet (it names the order, which ties the fee to this swap; bundled into a
212
+ * smart-wallet batch it can't be proven, and nothing is owed on it), then pass its hash as
213
+ * `txHash` to getStatus once it has confirmed (simplest: on every poll). Absent on Bitcoin: pay `amount` to `address`
214
+ * as an extra output of the SAME transaction that pays the deposit; RAVN finds it there once
215
+ * that transaction confirms. One deposit per Bitcoin transaction: a fee output proves one swap. */
216
+ transaction?: {
217
+ to: string;
218
+ data: string;
219
+ value: string;
220
+ chainId: number;
221
+ };
222
+ }
184
223
  export type SettlementStatus = "pending" | "processing" | "expired" | "success" | "refunded" | "failed" | "not_found" | "unknown";
185
224
  export interface StatusDTO {
186
225
  status: SettlementStatus;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ravnexchange/sdk",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Typed client for the RAVN integrator API (/api/v1): quote, execute, submit-signature, status.",
5
5
  "keywords": ["ravn", "cross-chain", "swap", "swap-api", "dex-aggregator", "bitcoin", "native-btc", "solana", "evm", "crypto", "defi", "typescript", "sdk", "api-client"],
6
6
  "main": "./dist/index.js",