@audren-xyz/sdk 1.3.1 → 1.3.3

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
@@ -7,6 +7,7 @@ export * from './layout.js';
7
7
  export * from './store.js';
8
8
  export * from './scanner.js';
9
9
  export * from './swap.js';
10
+ export * from './aggregators.js';
10
11
  export * from './relayer.js';
11
12
  export * from './instructions.js';
12
13
  export * from './token2022.js';
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export * from './layout.js';
7
7
  export * from './store.js';
8
8
  export * from './scanner.js';
9
9
  export * from './swap.js';
10
+ export * from './aggregators.js';
10
11
  export * from './relayer.js';
11
12
  export * from './instructions.js';
12
13
  export * from './token2022.js';
package/dist/relayer.js CHANGED
@@ -15,8 +15,9 @@ export const AUDREN_DEFAULT_RELAY_TIMEOUT_MS = 45_000;
15
15
  export const AUDREN_AUDITED_SWAP_ROUTERS = [
16
16
  'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4', // Jupiter Swap v1
17
17
  'DF1ow4tspfHX9JwWJsAb9epbkA8hmpSEAtxXy1V27QBH', // DFlow Trading API
18
- '6m2CDdhRgxpH4WjvdzxAYbGxwdGUz5MziiL5jek2kBma', // OKX DEX Aggregator
18
+ '6m2CDdhRgxpH4WjvdzxAYbGxwdGUz5MziiL5jek2kBma', // OKX DEX Router (v1)
19
19
  'T1TANpTeScyeqVzzgNViGDNrkQ6qHz9KrSBS4aNXvGT', // Titan Meta-Aggregator
20
+ 'proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u', // OKX DEX Aggregation Router V2/V6
20
21
  ];
21
22
  export class AudrenRelayError extends Error {
22
23
  status;
package/dist/swap.js CHANGED
@@ -52,7 +52,13 @@ export async function fetchAggregatorPrivateSwapRoute(aggregatorBaseUrl, quotePa
52
52
  ...(quoteParams.onlyDirectRoutes ? { onlyDirectRoutes: 'true' } : {}),
53
53
  ...(excluded.length > 0 ? { excludeDexes: excluded.join(',') } : {}),
54
54
  });
55
- const quoteRes = await fetch(`${base}/quote?${qs.toString()}`, { signal: makeSignal() });
55
+ const quoteRes = await fetch(`${base}/quote?${qs.toString()}`, {
56
+ signal: makeSignal(),
57
+ redirect: 'manual',
58
+ });
59
+ if (quoteRes.status >= 300 && quoteRes.status < 400) {
60
+ throw new Error(`Aggregator /quote returned unexpected HTTP ${quoteRes.status} redirect`);
61
+ }
56
62
  if (!quoteRes.ok) {
57
63
  throw new Error(`Aggregator /quote failed: HTTP ${quoteRes.status}`);
58
64
  }
@@ -61,6 +67,7 @@ export async function fetchAggregatorPrivateSwapRoute(aggregatorBaseUrl, quotePa
61
67
  method: 'POST',
62
68
  headers: { 'content-type': 'application/json' },
63
69
  signal: makeSignal(),
70
+ redirect: 'manual',
64
71
  body: JSON.stringify({
65
72
  quoteResponse: quote,
66
73
  userPublicKey: escrowAddress,
@@ -70,6 +77,9 @@ export async function fetchAggregatorPrivateSwapRoute(aggregatorBaseUrl, quotePa
70
77
  skipUserAccountsRpcCalls: true,
71
78
  }),
72
79
  });
80
+ if (swapRes.status >= 300 && swapRes.status < 400) {
81
+ throw new Error(`Aggregator /swap-instructions returned unexpected HTTP ${swapRes.status} redirect`);
82
+ }
73
83
  if (!swapRes.ok) {
74
84
  throw new Error(`Aggregator /swap-instructions failed: HTTP ${swapRes.status}`);
75
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audren-xyz/sdk",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
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)",