@audren-xyz/sdk 1.3.0 → 1.3.1

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/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- export * from './constants.ts';
2
- export * from './poseidon.ts';
3
- export * from './crypto.ts';
4
- export * from './pda.ts';
5
- export * from './keys.ts';
6
- export * from './layout.ts';
7
- export * from './store.ts';
8
- export * from './scanner.ts';
9
- export * from './swap.ts';
10
- export * from './relayer.ts';
11
- export * from './instructions.ts';
12
- export * from './token2022.ts';
13
- export * from './tx-v1.ts';
1
+ export * from './constants.js';
2
+ export * from './poseidon.js';
3
+ export * from './crypto.js';
4
+ export * from './pda.js';
5
+ export * from './keys.js';
6
+ export * from './layout.js';
7
+ export * from './store.js';
8
+ export * from './scanner.js';
9
+ export * from './swap.js';
10
+ export * from './relayer.js';
11
+ export * from './instructions.js';
12
+ export * from './token2022.js';
13
+ export * from './tx-v1.js';
@@ -2,7 +2,7 @@
2
2
  * Builders for all 9 Audren v1 instructions (`0x00..=0x08`) and exact SHA-256 `ctx_hash`
3
3
  * transcripts matching `crates/client/src/instructions.rs` and `program/src/lib.rs` bit-for-bit.
4
4
  */
5
- import { type RouterAccountMeta } from './swap.ts';
5
+ import { type RouterAccountMeta } from './swap.js';
6
6
  export interface AudrenInstruction {
7
7
  programId: string;
8
8
  accounts: RouterAccountMeta[];
@@ -1 +1 @@
1
- export * from './prover.ts';
1
+ export * from './prover.js';
package/dist/prover.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * Works identically in Node.js and Browser Web Workers with zero `wasm-bindgen` glue
6
6
  * using the fixed `4,611 B` binary witness -> `384 B` proof+public-outputs ABI.
7
7
  */
8
- import { type MerklePath4Ary } from './store.ts';
8
+ import { type MerklePath4Ary } from './store.js';
9
9
  export interface JoinSplitInputWitness {
10
10
  spendSk: bigint;
11
11
  tweak: bigint;
package/dist/prover.js CHANGED
@@ -5,14 +5,6 @@
5
5
  * Works identically in Node.js and Browser Web Workers with zero `wasm-bindgen` glue
6
6
  * using the fixed `4,611 B` binary witness -> `384 B` proof+public-outputs ABI.
7
7
  */
8
- var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
9
- if (typeof path === "string" && /^\.\.?\//.test(path)) {
10
- return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
11
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
12
- });
13
- }
14
- return path;
15
- };
16
8
  import { sha256 } from '@noble/hashes/sha2.js';
17
9
  import { BN254_FR_MODULUS, CANONICAL_PK_BYTES, CANONICAL_PK_SHA256, CANONICAL_WASM_BYTES, CANONICAL_WASM_SHA256, PROVE_OUTPUT_BYTES, TOTAL_DEPTH_4ARY, WITNESS_TOTAL_BYTES, } from './constants.js';
18
10
  import { frToBeBytes } from './poseidon.js';
@@ -174,8 +166,8 @@ async function resolveDefaultAssetBytes(relPath, hint) {
174
166
  if (isNode) {
175
167
  const fsSpec = 'node:' + 'fs/promises';
176
168
  const urlSpec = 'node:' + 'url';
177
- const fsMod = (await import(__rewriteRelativeImportExtension(/* webpackIgnore: true */ fsSpec)));
178
- const urlMod = (await import(__rewriteRelativeImportExtension(/* webpackIgnore: true */ urlSpec)));
169
+ const fsMod = (await import(/* webpackIgnore: true */ fsSpec));
170
+ const urlMod = (await import(/* webpackIgnore: true */ urlSpec));
179
171
  const assetFile = urlMod.fileURLToPath(new URL(relPath, import.meta.url));
180
172
  const buf = await fsMod.readFile(assetFile);
181
173
  return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
package/dist/relayer.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * 2. `withdraw` (`ASSET_MODE_PUBLIC` / `WITHDRAW_FLAG_UNWRAP_WSOL`): public fee deduction.
8
8
  * 3. `exec_escrow` (`ExecViaEscrow` Tag 6): input-leg fee or `EXEC_FLAG_FEE_ON_OUTPUT`.
9
9
  */
10
- import type { RouterAccountMeta, RouterSwapInstruction } from './swap.ts';
10
+ import type { RouterAccountMeta, RouterSwapInstruction } from './swap.js';
11
11
  export type RelayCluster = 'mainnet' | 'devnet';
12
12
  export type RelayAggregatorId = 'jupiter' | 'bedrock' | 'dflow' | 'titan' | 'okx';
13
13
  export type RelayAggregatorProvider = 'auto' | RelayAggregatorId;
@@ -119,6 +119,8 @@ export interface RelayFeeQuoteResponse {
119
119
  /** Minimum flat fee floor in base units of `feeMint` (independent of `amount` / percentage bps). */
120
120
  minFlatFeeUnits?: string;
121
121
  feeBps: number;
122
+ /** Maximum percentage fee ceiling in bps for this mint/op, or `null` when unbounded. */
123
+ maxFeeBps?: number | null;
122
124
  estimatedRelayCostLamports: string;
123
125
  estimatedRelayCostUsd: number | null;
124
126
  validUntilUnix?: number;
@@ -279,18 +281,32 @@ export interface AudrenRelayClientOptions {
279
281
  }
280
282
  /** Audited production swap aggregator router programs supported by Audren `ExecViaEscrow`. */
281
283
  export declare const AUDREN_AUDITED_SWAP_ROUTERS: readonly string[];
284
+ export interface RelayHealthResponse {
285
+ ok: boolean;
286
+ spec?: string;
287
+ version?: string;
288
+ protocolVersion?: number;
289
+ cluster?: RelayCluster;
290
+ programId?: string;
291
+ rootsPda?: string;
292
+ timestamp?: string;
293
+ [key: string]: unknown;
294
+ }
282
295
  export declare class AudrenRelayError extends Error {
283
296
  readonly status: number;
284
297
  readonly code?: string;
285
298
  readonly retryAfterSec?: number;
286
299
  readonly signature?: string;
287
300
  readonly details?: Record<string, unknown>;
301
+ /** Lowercased HTTP response headers (e.g. `payment-required`, `www-authenticate`, `retry-after`). */
302
+ readonly headers?: Record<string, string>;
288
303
  constructor(message: string, opts: {
289
304
  status: number;
290
305
  code?: string;
291
306
  retryAfterSec?: number;
292
307
  signature?: string;
293
308
  details?: Record<string, unknown>;
309
+ headers?: Record<string, string>;
294
310
  });
295
311
  }
296
312
  export declare class AudrenRelayClient {
@@ -301,6 +317,7 @@ export declare class AudrenRelayClient {
301
317
  constructor(baseUrl?: string, options?: AudrenRelayClientOptions);
302
318
  private buildHeaders;
303
319
  private requestJson;
320
+ getHealth(): Promise<RelayHealthResponse>;
304
321
  getInfo(cluster?: RelayCluster): Promise<RelayInfoResponse>;
305
322
  /**
306
323
  * @deprecated Audren Gateway v1 (`audren-gateway/v1`) decouples DEX aggregation from the fee-payer
package/dist/relayer.js CHANGED
@@ -24,6 +24,8 @@ export class AudrenRelayError extends Error {
24
24
  retryAfterSec;
25
25
  signature;
26
26
  details;
27
+ /** Lowercased HTTP response headers (e.g. `payment-required`, `www-authenticate`, `retry-after`). */
28
+ headers;
27
29
  constructor(message, opts) {
28
30
  super(message);
29
31
  this.name = 'AudrenRelayError';
@@ -32,6 +34,7 @@ export class AudrenRelayError extends Error {
32
34
  this.retryAfterSec = opts.retryAfterSec;
33
35
  this.signature = opts.signature;
34
36
  this.details = opts.details;
37
+ this.headers = opts.headers;
35
38
  }
36
39
  }
37
40
  export class AudrenRelayClient {
@@ -135,12 +138,17 @@ export class AudrenRelayClient {
135
138
  ? Number(retryHeader)
136
139
  : undefined;
137
140
  const signature = obj && typeof obj.signature === 'string' ? obj.signature : undefined;
141
+ const responseHeaders = {};
142
+ res.headers?.forEach?.((value, key) => {
143
+ responseHeaders[key.toLowerCase()] = value;
144
+ });
138
145
  throw new AudrenRelayError(msg, {
139
146
  status: res.status,
140
147
  code,
141
148
  retryAfterSec,
142
149
  signature,
143
150
  details: obj,
151
+ ...(Object.keys(responseHeaders).length > 0 ? { headers: responseHeaders } : {}),
144
152
  });
145
153
  }
146
154
  if (parseFailed) {
@@ -148,8 +156,12 @@ export class AudrenRelayClient {
148
156
  }
149
157
  return parsed;
150
158
  }
151
- async getInfo(cluster = 'mainnet') {
152
- return this.requestJson(`/v1/info?cluster=${encodeURIComponent(cluster)}`);
159
+ async getHealth() {
160
+ return this.requestJson('/health');
161
+ }
162
+ async getInfo(cluster) {
163
+ const query = cluster ? `?cluster=${encodeURIComponent(cluster)}` : '';
164
+ return this.requestJson(`/v1/info${query}`);
153
165
  }
154
166
  /**
155
167
  * @deprecated Audren Gateway v1 (`audren-gateway/v1`) decouples DEX aggregation from the fee-payer
package/dist/scanner.d.ts CHANGED
@@ -25,9 +25,9 @@
25
25
  * (zero early-exit when 0 unspent notes exist or after the last unspent note is spent), matching
26
26
  * against an `O(owned_unspent_notes)` map and discarding stranger prefixes immediately.
27
27
  */
28
- import type { FullViewingKey } from './keys.ts';
29
- import { type DecodedGlobalRootHistory, type DecodedLaneHeader, type DecodedPoolState, type RootSnapshotChoice } from './layout.ts';
30
- import { type CompactWalletStore, type MerklePath4Ary } from './store.ts';
28
+ import type { FullViewingKey } from './keys.js';
29
+ import { type DecodedGlobalRootHistory, type DecodedLaneHeader, type DecodedPoolState, type RootSnapshotChoice } from './layout.js';
30
+ import { type CompactWalletStore, type MerklePath4Ary } from './store.js';
31
31
  /** Maximum new `MemoPage`s fetched as an incremental sync (`<= ~256 KB`). */
32
32
  export declare const INCREMENTAL_FULL_MEMO_PAGE_THRESHOLD = 25;
33
33
  /** Maximum newly synced `SubtreePage`s fetched uniformly on incremental sync in `'strict'` mode. */
package/dist/store.d.ts CHANGED
@@ -8,9 +8,9 @@
8
8
  * at 10M pool notes), unsealed frontier tail leaves, and at most one just-sealed page per lane
9
9
  * until `GlobalRootHistory.stable` crosses it.
10
10
  */
11
- import { type DecryptedMemo } from './crypto.ts';
12
- import type { FullViewingKey, SelectiveDisclosureProof } from './keys.ts';
13
- import { type DecodedGlobalRootHistory, type RootSnapshotChoice } from './layout.ts';
11
+ import { type DecryptedMemo } from './crypto.js';
12
+ import type { FullViewingKey, SelectiveDisclosureProof } from './keys.js';
13
+ import { type DecodedGlobalRootHistory, type RootSnapshotChoice } from './layout.js';
14
14
  export interface MerklePath4Ary {
15
15
  siblings: bigint[][];
16
16
  positions: number[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audren-xyz/sdk",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "TypeScript SDK for Audren — zero-indexer BN254 Groth16 global MASP core (PDAs, Poseidon, layouts, CompactWalletStore, gateway/relayer client, tx v1) plus WASM Groth16 prover (@audren-xyz/sdk/prover) and IDLs (@audren-xyz/sdk/idl)",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "https://github.com/audren-xyz/audren.git",
13
+ "url": "git+https://github.com/audren-xyz/audren.git",
14
14
  "directory": "packages/sdk"
15
15
  },
16
16
  "keywords": [