ault-sdk-ts 0.7.1 → 0.8.0
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/README.md +6 -0
- package/dist/core/http.d.ts +8 -0
- package/dist/core/user-agent.d.ts +15 -0
- package/dist/index.cjs +558 -723
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +549 -723
- package/dist/index.js.map +1 -1
- package/dist/rest/dex-types.generated.d.ts +62 -1
- package/dist/rest/dex.generated.d.ts +81 -11
- package/dist/ws/types.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -581,9 +581,15 @@ const ws = createDexWs("wss://my-dex-api.example.com/ws", {
|
|
|
581
581
|
reconnectDelay: 1000, // default: 1000ms
|
|
582
582
|
maxReconnectDelay: 30000, // default: 30000ms
|
|
583
583
|
maxReconnectAttempts: Infinity, // default: Infinity
|
|
584
|
+
userAgent: "my-bot/1.0", // default: ault-sdk-ts/<version>; Node and Bun only
|
|
584
585
|
});
|
|
585
586
|
```
|
|
586
587
|
|
|
588
|
+
The DEX API rejects handshakes that carry no `User-Agent`. Browsers send their
|
|
589
|
+
own. Under Node or Bun the SDK sends `ault-sdk-ts/<version>`, or whatever you
|
|
590
|
+
put in `userAgent`. If you pass your own `createWebSocket` factory you are on
|
|
591
|
+
your own for the header.
|
|
592
|
+
|
|
587
593
|
### Disconnecting
|
|
588
594
|
|
|
589
595
|
```typescript
|
package/dist/core/http.d.ts
CHANGED
|
@@ -8,6 +8,14 @@ export interface FetchWithRetryOptions {
|
|
|
8
8
|
retryableMethods?: string[];
|
|
9
9
|
retryableStatuses?: number[];
|
|
10
10
|
retryOnTimeout?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* `User-Agent` sent on every request under Node or Bun (default:
|
|
13
|
+
* `ault-sdk-ts/<version>`). A `User-Agent` already present in the request
|
|
14
|
+
* headers wins. Browsers are left alone: they send their own, and a custom
|
|
15
|
+
* one would only force a CORS preflight. The hosted DEX API sits behind a
|
|
16
|
+
* WAF that rejects requests without one.
|
|
17
|
+
*/
|
|
18
|
+
userAgent?: string;
|
|
11
19
|
}
|
|
12
20
|
/** Statuses retried by default when the method is retryable. */
|
|
13
21
|
export declare const DEFAULT_RETRYABLE_STATUSES: readonly number[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const SDK_VERSION: string;
|
|
2
|
+
/**
|
|
3
|
+
* Default `User-Agent` sent on every REST request and WebSocket handshake
|
|
4
|
+
* when running under Node or Bun. The hosted DEX API sits behind a WAF that
|
|
5
|
+
* rejects requests without one. Browsers always send their own, and setting
|
|
6
|
+
* it there would only add a CORS preflight, so the SDK leaves them alone.
|
|
7
|
+
*/
|
|
8
|
+
export declare const USER_AGENT: string;
|
|
9
|
+
/**
|
|
10
|
+
* True under Node or Bun, where the SDK owns the `User-Agent`: `fetch` accepts
|
|
11
|
+
* the header and `WebSocket` accepts `{ headers }` as its second argument.
|
|
12
|
+
* False in browsers (which send their own and would preflight on a custom
|
|
13
|
+
* one) and Deno (whose `WebSocket` only takes a protocol list).
|
|
14
|
+
*/
|
|
15
|
+
export declare function isServerRuntime(): boolean;
|