@polyester/sdk 0.29.1 → 0.30.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/CHANGELOG.md +20 -0
- package/dist/browser-client.d.ts +7 -34
- package/dist/browser-client.d.ts.map +1 -1
- package/dist/browser-client.js +7 -59
- package/dist/browser-client.js.map +1 -1
- package/dist/browser-core.d.ts +41 -0
- package/dist/browser-core.d.ts.map +1 -0
- package/dist/browser-core.js +71 -0
- package/dist/browser-core.js.map +1 -0
- package/dist/catalogs/index.js +2 -2
- package/dist/catalogs/readers.js +1 -1
- package/dist/client.d.ts +72 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +83 -0
- package/dist/client.js.map +1 -0
- package/dist/core-client.d.ts +18 -91
- package/dist/core-client.d.ts.map +1 -1
- package/dist/core-client.js +58 -164
- package/dist/core-client.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
- package/dist/gen/index.js +17 -17
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +6 -0
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +7 -1
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +14 -11
- package/dist/index.js +10 -6
- package/dist/realtime/snapshot-then-stream.js +1 -1
- package/dist/server-client.d.ts +7 -81
- package/dist/server-client.d.ts.map +1 -1
- package/dist/server-client.js +10 -115
- package/dist/server-client.js.map +1 -1
- package/dist/server-core.d.ts +97 -0
- package/dist/server-core.d.ts.map +1 -0
- package/dist/server-core.js +150 -0
- package/dist/server-core.js.map +1 -0
- package/dist/services/accounts/accounts.js +1 -1
- package/dist/services/accounts/accounts.schemas.d.ts +1 -1
- package/dist/services/accounts/accounts.schemas.js +1 -1
- package/dist/services/accounts/service.d.ts +8 -0
- package/dist/services/accounts/service.d.ts.map +1 -0
- package/dist/services/accounts/service.js +9 -0
- package/dist/services/accounts/service.js.map +1 -0
- package/dist/services/address-book/address-book.js +2 -2
- package/dist/services/address-book/address-book.schemas.d.ts +7 -7
- package/dist/services/address-book/address-book.schemas.js +4 -4
- package/dist/services/address-book/service.d.ts +8 -0
- package/dist/services/address-book/service.d.ts.map +1 -0
- package/dist/services/address-book/service.js +9 -0
- package/dist/services/address-book/service.js.map +1 -0
- package/dist/services/api-keys/api-keys.js +2 -2
- package/dist/services/api-keys/api-keys.schemas.d.ts +5 -5
- package/dist/services/api-keys/api-keys.schemas.js +3 -3
- package/dist/services/api-keys/service.d.ts +8 -0
- package/dist/services/api-keys/service.d.ts.map +1 -0
- package/dist/services/api-keys/service.js +9 -0
- package/dist/services/api-keys/service.js.map +1 -0
- package/dist/services/auth/account-signer-auth.d.ts +6 -4
- package/dist/services/auth/account-signer-auth.d.ts.map +1 -1
- package/dist/services/auth/account-signer-auth.js +3 -2
- package/dist/services/auth/account-signer-auth.js.map +1 -1
- package/dist/services/auth/auth.js +1 -1
- package/dist/services/auth/profile/profile.js +2 -2
- package/dist/services/balances/balances.js +1 -1
- package/dist/services/balances/balances.schemas.d.ts +3 -3
- package/dist/services/balances/balances.schemas.js +2 -2
- package/dist/services/balances/service.d.ts +8 -0
- package/dist/services/balances/service.d.ts.map +1 -0
- package/dist/services/balances/service.js +9 -0
- package/dist/services/balances/service.js.map +1 -0
- package/dist/services/candles/candles.js +1 -1
- package/dist/services/candles/candles.schemas.js +2 -2
- package/dist/services/candles/service.d.ts +8 -0
- package/dist/services/candles/service.d.ts.map +1 -0
- package/dist/services/candles/service.js +9 -0
- package/dist/services/candles/service.js.map +1 -0
- package/dist/services/chain-analytics/chain-analytics.schemas.js +2 -2
- package/dist/services/chain-analytics/service.d.ts +8 -0
- package/dist/services/chain-analytics/service.d.ts.map +1 -0
- package/dist/services/chain-analytics/service.js +9 -0
- package/dist/services/chain-analytics/service.js.map +1 -0
- package/dist/services/claims/claims.js +1 -1
- package/dist/services/claims/claims.schemas.js +1 -1
- package/dist/services/claims/service.d.ts +8 -0
- package/dist/services/claims/service.d.ts.map +1 -0
- package/dist/services/claims/service.js +9 -0
- package/dist/services/claims/service.js.map +1 -0
- package/dist/services/deposit/deposit.js +1 -1
- package/dist/services/deposit/service.d.ts +8 -0
- package/dist/services/deposit/service.d.ts.map +1 -0
- package/dist/services/deposit/service.js +9 -0
- package/dist/services/deposit/service.js.map +1 -0
- package/dist/services/fees/fees.js +1 -1
- package/dist/services/fees/service.d.ts +8 -0
- package/dist/services/fees/service.d.ts.map +1 -0
- package/dist/services/fees/service.js +9 -0
- package/dist/services/fees/service.js.map +1 -0
- package/dist/services/guard-signer/guard-signer.js +2 -2
- package/dist/services/guard-signer/guard-signer.schemas.js +1 -1
- package/dist/services/guard-signer/service.d.ts +8 -0
- package/dist/services/guard-signer/service.d.ts.map +1 -0
- package/dist/services/guard-signer/service.js +9 -0
- package/dist/services/guard-signer/service.js.map +1 -0
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/heatmap/heatmap.schemas.js +2 -2
- package/dist/services/heatmap/service.d.ts +8 -0
- package/dist/services/heatmap/service.d.ts.map +1 -0
- package/dist/services/heatmap/service.js +9 -0
- package/dist/services/heatmap/service.js.map +1 -0
- package/dist/services/internal-transfers/internal-transfers.js +2 -2
- package/dist/services/internal-transfers/internal-transfers.schemas.js +1 -1
- package/dist/services/internal-transfers/service.d.ts +8 -0
- package/dist/services/internal-transfers/service.d.ts.map +1 -0
- package/dist/services/internal-transfers/service.js +9 -0
- package/dist/services/internal-transfers/service.js.map +1 -0
- package/dist/services/lifecycle/lifecycle.js +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +96 -96
- package/dist/services/lifecycle/lifecycle.schemas.js +2 -2
- package/dist/services/lifecycle/service.d.ts +8 -0
- package/dist/services/lifecycle/service.d.ts.map +1 -0
- package/dist/services/lifecycle/service.js +9 -0
- package/dist/services/lifecycle/service.js.map +1 -0
- package/dist/services/market-data/market-data.js +2 -2
- package/dist/services/market-data/market-data.schemas.js +2 -2
- package/dist/services/market-data/service.d.ts +8 -0
- package/dist/services/market-data/service.d.ts.map +1 -0
- package/dist/services/market-data/service.js +9 -0
- package/dist/services/market-data/service.js.map +1 -0
- package/dist/services/market-overview/market-overview.js +1 -1
- package/dist/services/market-overview/market-overview.schemas.js +3 -3
- package/dist/services/market-overview/service.d.ts +8 -0
- package/dist/services/market-overview/service.d.ts.map +1 -0
- package/dist/services/market-overview/service.js +9 -0
- package/dist/services/market-overview/service.js.map +1 -0
- package/dist/services/mfa/mfa.js +1 -1
- package/dist/services/mfa/mfa.schemas.js +1 -1
- package/dist/services/mfa/service.d.ts +8 -0
- package/dist/services/mfa/service.d.ts.map +1 -0
- package/dist/services/mfa/service.js +9 -0
- package/dist/services/mfa/service.js.map +1 -0
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orderbook/orderbook.schemas.js +1 -1
- package/dist/services/orderbook/service.d.ts +8 -0
- package/dist/services/orderbook/service.d.ts.map +1 -0
- package/dist/services/orderbook/service.js +9 -0
- package/dist/services/orderbook/service.js.map +1 -0
- package/dist/services/orders/order-errors.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +45 -45
- package/dist/services/orders/orders-batch.schemas.js +5 -5
- package/dist/services/orders/orders-input.schemas.d.ts +39 -39
- package/dist/services/orders/orders-input.schemas.js +6 -6
- package/dist/services/orders/orders-modify.schemas.d.ts +18 -18
- package/dist/services/orders/orders-modify.schemas.js +4 -4
- package/dist/services/orders/orders-output.schemas.d.ts +8 -8
- package/dist/services/orders/orders-output.schemas.js +4 -4
- package/dist/services/orders/orders-risk.schemas.d.ts +15 -15
- package/dist/services/orders/orders-risk.schemas.js +3 -3
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +5 -3
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/orders/service.d.ts +8 -0
- package/dist/services/orders/service.d.ts.map +1 -0
- package/dist/services/orders/service.js +9 -0
- package/dist/services/orders/service.js.map +1 -0
- package/dist/services/policies/api-key-policies/api-key-policies.js +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.js +2 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +3 -3
- package/dist/services/rate-limits/rate-limits.js +1 -1
- package/dist/services/rate-limits/rate-limits.schemas.js +1 -1
- package/dist/services/rate-limits/service.d.ts +8 -0
- package/dist/services/rate-limits/service.d.ts.map +1 -0
- package/dist/services/rate-limits/service.js +9 -0
- package/dist/services/rate-limits/service.js.map +1 -0
- package/dist/services/social-verification/service.d.ts +8 -0
- package/dist/services/social-verification/service.d.ts.map +1 -0
- package/dist/services/social-verification/service.js +9 -0
- package/dist/services/social-verification/service.js.map +1 -0
- package/dist/services/social-verification/social-verification.schemas.js +1 -1
- package/dist/services/subaccounts/service.d.ts +8 -0
- package/dist/services/subaccounts/service.d.ts.map +1 -0
- package/dist/services/subaccounts/service.js +9 -0
- package/dist/services/subaccounts/service.js.map +1 -0
- package/dist/services/subaccounts/subaccounts.js +2 -2
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +11 -11
- package/dist/services/subaccounts/subaccounts.schemas.js +3 -3
- package/dist/services/trades/service.d.ts +8 -0
- package/dist/services/trades/service.d.ts.map +1 -0
- package/dist/services/trades/service.js +9 -0
- package/dist/services/trades/service.js.map +1 -0
- package/dist/services/trades/trades.js +1 -1
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/trades/trades.schemas.js +4 -4
- package/dist/services/trading-withdraws/service.d.ts +8 -0
- package/dist/services/trading-withdraws/service.d.ts.map +1 -0
- package/dist/services/trading-withdraws/service.js +12 -0
- package/dist/services/trading-withdraws/service.js.map +1 -0
- package/dist/services/trading-withdraws/trading-withdraws.js +3 -3
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +2 -2
- package/dist/services/trading-withdraws/wallet-message.js +1 -1
- package/dist/services/transfers/service.d.ts +8 -0
- package/dist/services/transfers/service.d.ts.map +1 -0
- package/dist/services/transfers/service.js +9 -0
- package/dist/services/transfers/service.js.map +1 -0
- package/dist/services/transfers/transfers.js +2 -2
- package/dist/services/transfers/transfers.schemas.d.ts +1 -1
- package/dist/services/transfers/transfers.schemas.js +2 -2
- package/dist/services/triggers/service.d.ts +8 -0
- package/dist/services/triggers/service.d.ts.map +1 -0
- package/dist/services/triggers/service.js +9 -0
- package/dist/services/triggers/service.js.map +1 -0
- package/dist/services/triggers/trigger-child-order.schemas.js +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +27 -27
- package/dist/services/triggers/trigger-input.schemas.js +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +17 -17
- package/dist/services/triggers/triggers-output.schemas.js +1 -1
- package/dist/services/triggers/triggers.codecs.js +1 -0
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/services/triggers/triggers.js +1 -1
- package/dist/services/vip/service.d.ts +8 -0
- package/dist/services/vip/service.d.ts.map +1 -0
- package/dist/services/vip/service.js +9 -0
- package/dist/services/vip/service.js.map +1 -0
- package/dist/services/vip/vip.js +1 -1
- package/dist/services/whiteboard/service.d.ts +8 -0
- package/dist/services/whiteboard/service.d.ts.map +1 -0
- package/dist/services/whiteboard/service.js +9 -0
- package/dist/services/whiteboard/service.js.map +1 -0
- package/dist/services/whiteboard/whiteboard.js +1 -1
- package/dist/services/whiteboard/whiteboard.schemas.js +1 -1
- package/dist/services/zipper/service.d.ts +8 -0
- package/dist/services/zipper/service.d.ts.map +1 -0
- package/dist/services/zipper/service.js +9 -0
- package/dist/services/zipper/service.js.map +1 -0
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +7 -5
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +9 -1
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +45 -96
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/auth.js +16 -0
- package/dist/shared/error-details/auth.js.map +1 -0
- package/dist/shared/error-details/claims.js +15 -0
- package/dist/shared/error-details/claims.js.map +1 -0
- package/dist/shared/error-details/internal-transfer.js +15 -0
- package/dist/shared/error-details/internal-transfer.js.map +1 -0
- package/dist/shared/error-details/ledger.js +15 -0
- package/dist/shared/error-details/ledger.js.map +1 -0
- package/dist/shared/error-details/market-overview.js +15 -0
- package/dist/shared/error-details/market-overview.js.map +1 -0
- package/dist/shared/error-details/orders.js +18 -0
- package/dist/shared/error-details/orders.js.map +1 -0
- package/dist/shared/error-details/profile.js +17 -0
- package/dist/shared/error-details/profile.js.map +1 -0
- package/dist/shared/error-details/withdraw.js +15 -0
- package/dist/shared/error-details/withdraw.js.map +1 -0
- package/dist/shared/rate-limit.schemas.d.ts +1 -1
- package/dist/shared/rate-limit.schemas.js +2 -2
- package/dist/shared/transports.d.ts.map +1 -1
- package/dist/shared/transports.js +7 -6
- package/dist/shared/transports.js.map +1 -1
- package/dist/wired-services.js +14 -14
- package/package.json +7 -1
- package/dist/services/accounts/index.d.ts +0 -3
- package/dist/services/address-book/address-book.codecs.d.ts +0 -1
- package/dist/services/address-book/index.d.ts +0 -4
- package/dist/services/balances/index.d.ts +0 -4
- package/dist/services/candles/index.d.ts +0 -3
- package/dist/services/chain-analytics/index.d.ts +0 -4
- package/dist/services/claims/index.d.ts +0 -5
- package/dist/services/deposit/index.d.ts +0 -3
- package/dist/services/fees/index.d.ts +0 -3
- package/dist/services/guard-signer/guard-signer.codecs.d.ts +0 -1
- package/dist/services/guard-signer/index.d.ts +0 -4
- package/dist/services/heatmap/index.d.ts +0 -4
- package/dist/services/internal-transfers/index.d.ts +0 -3
- package/dist/services/lifecycle/index.d.ts +0 -4
- package/dist/services/market-data/index.d.ts +0 -4
- package/dist/services/market-overview/index.d.ts +0 -4
- package/dist/services/mfa/index.d.ts +0 -4
- package/dist/services/mfa/mfa.codecs.d.ts +0 -1
- package/dist/services/orderbook/index.d.ts +0 -3
- package/dist/services/orders/index.d.ts +0 -10
- package/dist/services/rate-limits/index.d.ts +0 -4
- package/dist/services/social-verification/index.d.ts +0 -3
- package/dist/services/trades/index.d.ts +0 -3
- package/dist/services/trading-withdraws/index.d.ts +0 -4
- package/dist/services/trading-withdraws/trading-withdraws.codecs.d.ts +0 -1
- package/dist/services/transfers/index.d.ts +0 -4
- package/dist/services/triggers/index.d.ts +0 -5
- package/dist/services/vip/index.d.ts +0 -3
- package/dist/services/whiteboard/index.d.ts +0 -3
- package/dist/services/zipper/index.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @polyester/sdk
|
|
2
2
|
|
|
3
|
+
## 0.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add a `fetch` option to the client config, `createPolyesterServerClientFromCookies`, and `createPolyesterServerClientFromRequest` for sending SDK HTTP requests through a custom fetch implementation. SDK auth, error mapping, and timestamp-skew detection still apply. Defaults to the global `fetch`. ([#184](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/184))
|
|
8
|
+
|
|
9
|
+
- Add tree-shakable client cores. `PolyesterCore`, `PolyesterBrowserCore`, and `PolyesterServerCore` (plus `createPolyesterServerCoreFromCookies`/`FromRequest`) wire transports, realtime, catalogs, and auth, and reach every other service through `@polyester/sdk/services/*` accessors such as `ordersService(core)`, so bundles only include the services they call. The full clients are unchanged and return the same instances as the accessors (`client.orders === ordersService(client)`). ([#186](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/186))
|
|
10
|
+
|
|
11
|
+
Error-detail decoders and API-key signing now load on demand. SDK transports load decoders before mapping errors; call `loadErrorDetailDecoders(error)` before synchronously mapping a raw `ConnectError` that did not come through an SDK transport, or `loadErrorDetailDecoders()` to preload all of them.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Throw a retryable `NetworkError` when the global `fetch` resolves without a `Response` (for example, when a browser extension patches `fetch`) instead of crashing with a `TypeError` while checking for timestamp-skew errors. ([#184](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/184))
|
|
16
|
+
|
|
17
|
+
## 0.29.2
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Decode the `MAX_SLIPPAGE_INVALID` trigger failure as `failureReason: "max_slippage_invalid"` instead of `"unspecified"`. Triggers fail with this reason when their maximum slippage cannot produce a valid execution price bound. ([#182](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/182))
|
|
22
|
+
|
|
3
23
|
## 0.29.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/browser-client.d.ts
CHANGED
|
@@ -1,39 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { PolyesterClient, PolyesterClientBaseConfig } from "./core-client.js";
|
|
4
|
-
import { AuthTokenStorage } from "./services/auth/token-storage.js";
|
|
5
|
-
import { AccountSignerAuthService } from "./services/auth/account-signer-auth.js";
|
|
1
|
+
import { PolyesterServices } from "./client.js";
|
|
2
|
+
import { PolyesterBrowserClientConfig, PolyesterBrowserCore } from "./browser-core.js";
|
|
6
3
|
//#region src/browser-client.d.ts
|
|
7
|
-
|
|
8
|
-
/** Configuration for the browser Polyester client. */
|
|
9
|
-
type PolyesterBrowserClientConfig = BrowserClientBaseConfig<PolyesterClientBaseConfig> & {
|
|
10
|
-
/**
|
|
11
|
-
* Account signer interface for authentication.
|
|
12
|
-
* Pass a signer object or a factory function for lazy initialization.
|
|
13
|
-
*/
|
|
14
|
-
accountSigner?: AccountSignerConfig;
|
|
15
|
-
/**
|
|
16
|
-
* Storage for browser bearer tokens. Defaults to per-client memory storage.
|
|
17
|
-
* Use createCookieAuthTokenStorage() to opt into reload/SSR persistence.
|
|
18
|
-
*/
|
|
19
|
-
tokenStorage?: AuthTokenStorage;
|
|
20
|
-
};
|
|
4
|
+
interface PolyesterBrowserClient extends PolyesterServices {}
|
|
21
5
|
/**
|
|
22
|
-
* A client for interacting with the Polyester DEX in the browser
|
|
6
|
+
* A client for interacting with the Polyester DEX in the browser, with a lazy
|
|
7
|
+
* getter for every public service.
|
|
23
8
|
*/
|
|
24
|
-
declare class PolyesterBrowserClient extends
|
|
25
|
-
get auth(): AccountSignerAuthService;
|
|
26
|
-
constructor(config: PolyesterBrowserClientConfig);
|
|
27
|
-
/**
|
|
28
|
-
* Creates a resolver that defaults subaccountId to the active subaccount.
|
|
29
|
-
* The getter is called lazily when service methods are invoked.
|
|
30
|
-
*/
|
|
31
|
-
protected createSubaccountResolver(): SubaccountResolver;
|
|
32
|
-
/**
|
|
33
|
-
* Sets the account signer used for authenticated browser requests.
|
|
34
|
-
*/
|
|
35
|
-
setAccountSigner(accountSigner: AccountSigner | null): void;
|
|
36
|
-
}
|
|
9
|
+
declare class PolyesterBrowserClient extends PolyesterBrowserCore {}
|
|
37
10
|
//#endregion
|
|
38
|
-
export { PolyesterBrowserClient
|
|
11
|
+
export { PolyesterBrowserClient };
|
|
39
12
|
//# sourceMappingURL=browser-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-client.d.ts","names":[],"sources":["../src/browser-client.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"browser-client.d.ts","names":[],"sources":["../src/browser-client.ts"],"mappings":";;;UAMiB,+BAA+B;;;;;cAOnC,+BAA+B"}
|
package/dist/browser-client.js
CHANGED
|
@@ -1,65 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createMemoryAuthTokenStorage } from "./services/auth/token-storage.js";
|
|
4
|
-
import { AccountSignerAuthService } from "./services/auth/account-signer-auth.js";
|
|
1
|
+
import { installServiceGetters } from "./client.js";
|
|
2
|
+
import { PolyesterBrowserCore } from "./browser-core.js";
|
|
5
3
|
//#region src/browser-client.ts
|
|
6
4
|
/**
|
|
7
|
-
* A client for interacting with the Polyester DEX in the browser
|
|
5
|
+
* A client for interacting with the Polyester DEX in the browser, with a lazy
|
|
6
|
+
* getter for every public service.
|
|
8
7
|
*/
|
|
9
|
-
var PolyesterBrowserClient = class extends
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
constructor(config) {
|
|
14
|
-
config = parsePolyesterClientConfig(config);
|
|
15
|
-
const tokenStorage = config.tokenStorage ?? createMemoryAuthTokenStorage();
|
|
16
|
-
const sessionStore = new AuthSessionStore({ environmentFingerprint: config.environment.fingerprint });
|
|
17
|
-
const getToken = () => sessionStore.getEnvironmentBoundToken(tokenStorage);
|
|
18
|
-
super({
|
|
19
|
-
environment: config.environment,
|
|
20
|
-
interceptors: config.interceptors,
|
|
21
|
-
auth: {
|
|
22
|
-
kind: "jwt",
|
|
23
|
-
getToken
|
|
24
|
-
},
|
|
25
|
-
wireFormat: config.wireFormat,
|
|
26
|
-
...pickPolyesterCatalogConfig(config),
|
|
27
|
-
transports: config.transports,
|
|
28
|
-
realtimeClient: config.realtimeClient,
|
|
29
|
-
realtime: {
|
|
30
|
-
hasAuth: () => !!getToken(),
|
|
31
|
-
...config.realtime
|
|
32
|
-
}
|
|
33
|
-
}, { createAuth: ({ transports, realtime, subaccounts, environment }) => new AccountSignerAuthService({
|
|
34
|
-
transports,
|
|
35
|
-
accountSignerConfig: config.accountSigner,
|
|
36
|
-
environment,
|
|
37
|
-
subaccounts,
|
|
38
|
-
realtime,
|
|
39
|
-
tokenStorage,
|
|
40
|
-
sessionStore
|
|
41
|
-
}) });
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Creates a resolver that defaults subaccountId to the active subaccount.
|
|
45
|
-
* The getter is called lazily when service methods are invoked.
|
|
46
|
-
*/
|
|
47
|
-
createSubaccountResolver() {
|
|
48
|
-
return {
|
|
49
|
-
getDefaultSubaccountId: () => {
|
|
50
|
-
const state = this.auth.getState();
|
|
51
|
-
if (state.activeAccount && !state.activeAccount.isMain) return state.activeAccount.accountId;
|
|
52
|
-
return null;
|
|
53
|
-
},
|
|
54
|
-
getActiveAccountId: () => this.auth.getState().activeAccount?.accountId ?? null,
|
|
55
|
-
getMainAccountId: () => this.auth.getState().mainAccountId ?? null
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Sets the account signer used for authenticated browser requests.
|
|
60
|
-
*/
|
|
61
|
-
setAccountSigner(accountSigner) {
|
|
62
|
-
this.auth.setAccountSigner(accountSigner);
|
|
8
|
+
var PolyesterBrowserClient = class extends PolyesterBrowserCore {
|
|
9
|
+
static {
|
|
10
|
+
installServiceGetters(this);
|
|
63
11
|
}
|
|
64
12
|
};
|
|
65
13
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-client.js","names":[],"sources":["../src/browser-client.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"browser-client.js","names":[],"sources":["../src/browser-client.ts"],"sourcesContent":["import { installServiceGetters, type PolyesterServices } from \"./client.js\";\nimport { PolyesterBrowserCore } from \"./browser-core.js\";\n\nexport type { PolyesterBrowserClientConfig } from \"./browser-core.js\";\n\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- getters are installed below\nexport interface PolyesterBrowserClient extends PolyesterServices {}\n\n/**\n * A client for interacting with the Polyester DEX in the browser, with a lazy\n * getter for every public service.\n */\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- getters are installed below\nexport class PolyesterBrowserClient extends PolyesterBrowserCore {\n static {\n installServiceGetters(this);\n }\n}\n"],"mappings":";;;;;;;AAaA,IAAa,yBAAb,cAA4C,qBAAqB;CAC7D;EACI,sBAAsB,IAAI;CAC9B;AACJ"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AccountSigner, AccountSignerConfig } from "./account-signer/types.js";
|
|
2
|
+
import { SubaccountResolver } from "./services/subaccount-resolver.js";
|
|
3
|
+
import { PolyesterClientBaseConfig, PolyesterCore } from "./core-client.js";
|
|
4
|
+
import { AuthTokenStorage } from "./services/auth/token-storage.js";
|
|
5
|
+
import { AccountSignerAuthService } from "./services/auth/account-signer-auth.js";
|
|
6
|
+
//#region src/browser-core.d.ts
|
|
7
|
+
type BrowserClientBaseConfig<TConfig> = TConfig extends PolyesterClientBaseConfig ? Omit<TConfig, "auth"> : never;
|
|
8
|
+
/** Configuration for the browser Polyester client. */
|
|
9
|
+
type PolyesterBrowserClientConfig = BrowserClientBaseConfig<PolyesterClientBaseConfig> & {
|
|
10
|
+
/**
|
|
11
|
+
* Account signer interface for authentication.
|
|
12
|
+
* Pass a signer object or a factory function for lazy initialization.
|
|
13
|
+
*/
|
|
14
|
+
accountSigner?: AccountSignerConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Storage for browser bearer tokens. Defaults to per-client memory storage.
|
|
17
|
+
* Use createCookieAuthTokenStorage() to opt into reload/SSR persistence.
|
|
18
|
+
*/
|
|
19
|
+
tokenStorage?: AuthTokenStorage;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Tree-shakable browser client core: account-signer auth plus transports, realtime,
|
|
23
|
+
* and catalogs. Reach other services through `@polyester/sdk/services/*` accessors,
|
|
24
|
+
* or use `PolyesterBrowserClient` for a getter per service.
|
|
25
|
+
*/
|
|
26
|
+
declare class PolyesterBrowserCore extends PolyesterCore {
|
|
27
|
+
get auth(): AccountSignerAuthService;
|
|
28
|
+
constructor(config: PolyesterBrowserClientConfig);
|
|
29
|
+
/**
|
|
30
|
+
* Creates a resolver that defaults subaccountId to the active subaccount.
|
|
31
|
+
* The getter is called lazily when service methods are invoked.
|
|
32
|
+
*/
|
|
33
|
+
protected createSubaccountResolver(): SubaccountResolver;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the account signer used for authenticated browser requests.
|
|
36
|
+
*/
|
|
37
|
+
setAccountSigner(accountSigner: AccountSigner | null): void;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { PolyesterBrowserClientConfig, PolyesterBrowserCore };
|
|
41
|
+
//# sourceMappingURL=browser-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-core.d.ts","names":[],"sources":["../src/browser-core.ts"],"mappings":";;;;;;KAeK,wBAAwB,WAAW,gBAAgB,4BAClD,KAAK;;KAIC,+BAA+B,wBAAwB;;;;;EAK/D,gBAAgB;;;;;EAKhB,eAAe;;;;;;;cAQN,6BAA6B;MAIzB,QAAQ;EAIT,YAAA,QAAQ;;;;;YA0CD,4BAA4B;;;;EAiB/C,iBAAiB,eAAe"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { PolyesterCore, parsePolyesterClientConfig, pickPolyesterCatalogConfig } from "./core-client.js";
|
|
2
|
+
import { AuthSessionStore } from "./services/auth/session.js";
|
|
3
|
+
import { createMemoryAuthTokenStorage } from "./services/auth/token-storage.js";
|
|
4
|
+
import { AccountSignerAuthService } from "./services/auth/account-signer-auth.js";
|
|
5
|
+
//#region src/browser-core.ts
|
|
6
|
+
/**
|
|
7
|
+
* Tree-shakable browser client core: account-signer auth plus transports, realtime,
|
|
8
|
+
* and catalogs. Reach other services through `@polyester/sdk/services/*` accessors,
|
|
9
|
+
* or use `PolyesterBrowserClient` for a getter per service.
|
|
10
|
+
*/
|
|
11
|
+
var PolyesterBrowserCore = class extends PolyesterCore {
|
|
12
|
+
get auth() {
|
|
13
|
+
return super.auth;
|
|
14
|
+
}
|
|
15
|
+
constructor(config) {
|
|
16
|
+
config = parsePolyesterClientConfig(config);
|
|
17
|
+
const tokenStorage = config.tokenStorage ?? createMemoryAuthTokenStorage();
|
|
18
|
+
const sessionStore = new AuthSessionStore({ environmentFingerprint: config.environment.fingerprint });
|
|
19
|
+
const getToken = () => sessionStore.getEnvironmentBoundToken(tokenStorage);
|
|
20
|
+
super({
|
|
21
|
+
environment: config.environment,
|
|
22
|
+
interceptors: config.interceptors,
|
|
23
|
+
auth: {
|
|
24
|
+
kind: "jwt",
|
|
25
|
+
getToken
|
|
26
|
+
},
|
|
27
|
+
wireFormat: config.wireFormat,
|
|
28
|
+
fetch: config.fetch,
|
|
29
|
+
...pickPolyesterCatalogConfig(config),
|
|
30
|
+
transports: config.transports,
|
|
31
|
+
realtimeClient: config.realtimeClient,
|
|
32
|
+
realtime: {
|
|
33
|
+
hasAuth: () => !!getToken(),
|
|
34
|
+
...config.realtime
|
|
35
|
+
}
|
|
36
|
+
}, { createAuth: ({ transports, realtime, loadSubaccounts, environment }) => new AccountSignerAuthService({
|
|
37
|
+
transports,
|
|
38
|
+
accountSignerConfig: config.accountSigner,
|
|
39
|
+
environment,
|
|
40
|
+
subaccounts: loadSubaccounts,
|
|
41
|
+
realtime,
|
|
42
|
+
tokenStorage,
|
|
43
|
+
sessionStore
|
|
44
|
+
}) });
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates a resolver that defaults subaccountId to the active subaccount.
|
|
48
|
+
* The getter is called lazily when service methods are invoked.
|
|
49
|
+
*/
|
|
50
|
+
createSubaccountResolver() {
|
|
51
|
+
return {
|
|
52
|
+
getDefaultSubaccountId: () => {
|
|
53
|
+
const state = this.auth.getState();
|
|
54
|
+
if (state.activeAccount && !state.activeAccount.isMain) return state.activeAccount.accountId;
|
|
55
|
+
return null;
|
|
56
|
+
},
|
|
57
|
+
getActiveAccountId: () => this.auth.getState().activeAccount?.accountId ?? null,
|
|
58
|
+
getMainAccountId: () => this.auth.getState().mainAccountId ?? null
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Sets the account signer used for authenticated browser requests.
|
|
63
|
+
*/
|
|
64
|
+
setAccountSigner(accountSigner) {
|
|
65
|
+
this.auth.setAccountSigner(accountSigner);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { PolyesterBrowserCore };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=browser-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-core.js","names":[],"sources":["../src/browser-core.ts"],"sourcesContent":["import {\n parsePolyesterClientConfig,\n pickPolyesterCatalogConfig,\n PolyesterCore,\n type PolyesterClientBaseConfig,\n} from \"./core-client.js\";\nimport { AccountSignerAuthService } from \"./services/auth/account-signer-auth.js\";\nimport type { AccountSignerConfig, AccountSigner } from \"./account-signer/types.js\";\nimport type { SubaccountResolver } from \"./services/subaccount-resolver.js\";\nimport {\n createMemoryAuthTokenStorage,\n type AuthTokenStorage,\n} from \"./services/auth/token-storage.js\";\nimport { AuthSessionStore } from \"./services/auth/session.js\";\n\ntype BrowserClientBaseConfig<TConfig> = TConfig extends PolyesterClientBaseConfig\n ? Omit<TConfig, \"auth\">\n : never;\n\n/** Configuration for the browser Polyester client. */\nexport type PolyesterBrowserClientConfig = BrowserClientBaseConfig<PolyesterClientBaseConfig> & {\n /**\n * Account signer interface for authentication.\n * Pass a signer object or a factory function for lazy initialization.\n */\n accountSigner?: AccountSignerConfig;\n /**\n * Storage for browser bearer tokens. Defaults to per-client memory storage.\n * Use createCookieAuthTokenStorage() to opt into reload/SSR persistence.\n */\n tokenStorage?: AuthTokenStorage;\n};\n\n/**\n * Tree-shakable browser client core: account-signer auth plus transports, realtime,\n * and catalogs. Reach other services through `@polyester/sdk/services/*` accessors,\n * or use `PolyesterBrowserClient` for a getter per service.\n */\nexport class PolyesterBrowserCore extends PolyesterCore {\n // The base class builds `auth` through the `createAuth` runtime factory we\n // pass below, so the lazily-constructed instance is always an\n // AccountSignerAuthService — this override only narrows the type.\n override get auth(): AccountSignerAuthService {\n return super.auth as AccountSignerAuthService;\n }\n\n constructor(config: PolyesterBrowserClientConfig) {\n config = parsePolyesterClientConfig(config);\n const tokenStorage = config.tokenStorage ?? createMemoryAuthTokenStorage();\n const sessionStore = new AuthSessionStore({\n environmentFingerprint: config.environment.fingerprint,\n });\n const getToken = () => sessionStore.getEnvironmentBoundToken(tokenStorage);\n\n super(\n {\n environment: config.environment,\n interceptors: config.interceptors,\n auth: { kind: \"jwt\", getToken },\n wireFormat: config.wireFormat,\n fetch: config.fetch,\n ...pickPolyesterCatalogConfig(config),\n transports: config.transports,\n realtimeClient: config.realtimeClient,\n realtime: {\n hasAuth: () => !!getToken(),\n ...config.realtime,\n },\n },\n {\n createAuth: ({ transports, realtime, loadSubaccounts, environment }) =>\n new AccountSignerAuthService({\n transports,\n accountSignerConfig: config.accountSigner,\n environment,\n subaccounts: loadSubaccounts,\n realtime,\n tokenStorage,\n sessionStore,\n }),\n },\n );\n }\n\n /**\n * Creates a resolver that defaults subaccountId to the active subaccount.\n * The getter is called lazily when service methods are invoked.\n */\n protected override createSubaccountResolver(): SubaccountResolver {\n return {\n getDefaultSubaccountId: () => {\n const state = this.auth.getState();\n if (state.activeAccount && !state.activeAccount.isMain) {\n return state.activeAccount.accountId;\n }\n return null;\n },\n getActiveAccountId: () => this.auth.getState().activeAccount?.accountId ?? null,\n getMainAccountId: () => this.auth.getState().mainAccountId ?? null,\n };\n }\n\n /**\n * Sets the account signer used for authenticated browser requests.\n */\n setAccountSigner(accountSigner: AccountSigner | null): void {\n this.auth.setAccountSigner(accountSigner);\n }\n}\n"],"mappings":";;;;;;;;;;AAsCA,IAAa,uBAAb,cAA0C,cAAc;CAIpD,IAAa,OAAiC;EAC1C,OAAO,MAAM;CACjB;CAEA,YAAY,QAAsC;EAC9C,SAAS,2BAA2B,MAAM;EAC1C,MAAM,eAAe,OAAO,gBAAgB,6BAA6B;EACzE,MAAM,eAAe,IAAI,iBAAiB,EACtC,wBAAwB,OAAO,YAAY,YAC/C,CAAC;EACD,MAAM,iBAAiB,aAAa,yBAAyB,YAAY;EAEzE,MACI;GACI,aAAa,OAAO;GACpB,cAAc,OAAO;GACrB,MAAM;IAAE,MAAM;IAAO;GAAS;GAC9B,YAAY,OAAO;GACnB,OAAO,OAAO;GACd,GAAG,2BAA2B,MAAM;GACpC,YAAY,OAAO;GACnB,gBAAgB,OAAO;GACvB,UAAU;IACN,eAAe,CAAC,CAAC,SAAS;IAC1B,GAAG,OAAO;GACd;EACJ,GACA,EACI,aAAa,EAAE,YAAY,UAAU,iBAAiB,kBAClD,IAAI,yBAAyB;GACzB;GACA,qBAAqB,OAAO;GAC5B;GACA,aAAa;GACb;GACA;GACA;EACJ,CAAC,EACT,CACJ;CACJ;;;;;CAMA,2BAAkE;EAC9D,OAAO;GACH,8BAA8B;IAC1B,MAAM,QAAQ,KAAK,KAAK,SAAS;IACjC,IAAI,MAAM,iBAAiB,CAAC,MAAM,cAAc,QAC5C,OAAO,MAAM,cAAc;IAE/B,OAAO;GACX;GACA,0BAA0B,KAAK,KAAK,SAAS,CAAC,CAAC,eAAe,aAAa;GAC3E,wBAAwB,KAAK,KAAK,SAAS,CAAC,CAAC,iBAAiB;EAClE;CACJ;;;;CAKA,iBAAiB,eAA2C;EACxD,KAAK,KAAK,iBAAiB,aAAa;CAC5C;AACJ"}
|
package/dist/catalogs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CatalogConversionError, CatalogLookupError, CatalogNotReadyError, CatalogValidationFailedError } from "./types.js";
|
|
2
|
-
import { UNKNOWN_ASSET_LABEL, UNKNOWN_LEDGER_ASSET_ID, isUnknownLedgerAsset, isUnknownZipperAsset, unknownLedgerAsset, unknownZipperAsset } from "./unknown-asset.js";
|
|
3
1
|
import { PAIR_STATUSES } from "../shared/catalog-config.js";
|
|
2
|
+
import { UNKNOWN_ASSET_LABEL, UNKNOWN_LEDGER_ASSET_ID, isUnknownLedgerAsset, isUnknownZipperAsset, unknownLedgerAsset, unknownZipperAsset } from "./unknown-asset.js";
|
|
3
|
+
import { CatalogConversionError, CatalogLookupError, CatalogNotReadyError, CatalogValidationFailedError } from "./types.js";
|
|
4
4
|
import { createCatalogSnapshotReader } from "./readers.js";
|
|
5
5
|
import { buildCatalogSnapshot } from "./snapshot.js";
|
|
6
6
|
import { createPolyesterCatalog } from "./client-catalog.js";
|
package/dist/catalogs/readers.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PROTOBUF_INT64_MAX } from "../shared/wire-bounds.js";
|
|
2
2
|
import { scaledToDecimal, scaledToDisplay, significantDecimalPlaces, tryDecimalToScaled, tryNormalizeDecimalInput, tryToScaledBigInt } from "./decimal.js";
|
|
3
|
-
import { CatalogConversionError, CatalogLookupError, CatalogValidationFailedError } from "./types.js";
|
|
4
3
|
import { indexesFor } from "./indexes.js";
|
|
5
4
|
import { resolveLedgerAssetByLedgerId, resolveZipperAssetByLedgerId } from "./unknown-asset.js";
|
|
5
|
+
import { CatalogConversionError, CatalogLookupError, CatalogValidationFailedError } from "./types.js";
|
|
6
6
|
import { parseCatalogSnapshot } from "./snapshot-validation.js";
|
|
7
7
|
function isListed(pair, nowMs) {
|
|
8
8
|
if (pair.listingAt === null || pair.listingAt > nowMs) return false;
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { AccountsService } from "./services/accounts/accounts.js";
|
|
2
|
+
import { ApiKeysService } from "./services/api-keys/api-keys.js";
|
|
3
|
+
import { SubaccountsService } from "./services/subaccounts/subaccounts.js";
|
|
4
|
+
import { CandlesService } from "./services/candles/candles.js";
|
|
5
|
+
import { ChainAnalyticsService } from "./services/chain-analytics/chain-analytics.js";
|
|
6
|
+
import { MarketDataService } from "./services/market-data/market-data.js";
|
|
7
|
+
import { MarketOverviewService } from "./services/market-overview/market-overview.js";
|
|
8
|
+
import { OrderbookService } from "./services/orderbook/orderbook.js";
|
|
9
|
+
import { HeatmapService } from "./services/heatmap/heatmap.js";
|
|
10
|
+
import { LifecycleService } from "./services/lifecycle/lifecycle.js";
|
|
11
|
+
import { TradesService } from "./services/trades/trades.js";
|
|
12
|
+
import { OrdersService } from "./services/orders/orders.js";
|
|
13
|
+
import { TriggersService } from "./services/triggers/triggers.js";
|
|
14
|
+
import { BalancesService } from "./services/balances/balances.js";
|
|
15
|
+
import { TransfersService } from "./services/transfers/transfers.js";
|
|
16
|
+
import { InternalTransfersService } from "./services/internal-transfers/internal-transfers.js";
|
|
17
|
+
import { TradingWithdrawsService } from "./services/trading-withdraws/trading-withdraws.js";
|
|
18
|
+
import { DepositService } from "./services/deposit/deposit.js";
|
|
19
|
+
import { AddressBookService } from "./services/address-book/address-book.js";
|
|
20
|
+
import { GuardSignerService } from "./services/guard-signer/guard-signer.js";
|
|
21
|
+
import { SocialVerificationService } from "./services/social-verification/social-verification.js";
|
|
22
|
+
import { WhiteboardService } from "./services/whiteboard/whiteboard.js";
|
|
23
|
+
import { ZipperService } from "./services/zipper/zipper.js";
|
|
24
|
+
import { MfaService } from "./services/mfa/mfa.js";
|
|
25
|
+
import { ClaimsService } from "./services/claims/claims.js";
|
|
26
|
+
import { VipService } from "./services/vip/vip.js";
|
|
27
|
+
import { FeesService } from "./services/fees/fees.js";
|
|
28
|
+
import { RateLimitService } from "./services/rate-limits/rate-limits.js";
|
|
29
|
+
import { PolyesterCore } from "./core-client.js";
|
|
30
|
+
//#region src/client.d.ts
|
|
31
|
+
/** Every service accessor, keyed by its getter name on the full clients. */
|
|
32
|
+
declare const POLYESTER_SERVICES: {
|
|
33
|
+
accounts: (client: PolyesterCore) => AccountsService;
|
|
34
|
+
apiKeys: (client: PolyesterCore) => ApiKeysService;
|
|
35
|
+
subaccounts: (client: PolyesterCore) => SubaccountsService;
|
|
36
|
+
candles: (client: PolyesterCore) => CandlesService;
|
|
37
|
+
chainAnalytics: (client: PolyesterCore) => ChainAnalyticsService;
|
|
38
|
+
marketData: (client: PolyesterCore) => MarketDataService;
|
|
39
|
+
marketOverview: (client: PolyesterCore) => MarketOverviewService;
|
|
40
|
+
orderbook: (client: PolyesterCore) => OrderbookService;
|
|
41
|
+
heatmap: (client: PolyesterCore) => HeatmapService;
|
|
42
|
+
lifecycle: (client: PolyesterCore) => LifecycleService;
|
|
43
|
+
trades: (client: PolyesterCore) => TradesService;
|
|
44
|
+
orders: (client: PolyesterCore) => OrdersService;
|
|
45
|
+
triggers: (client: PolyesterCore) => TriggersService;
|
|
46
|
+
balances: (client: PolyesterCore) => BalancesService;
|
|
47
|
+
transfers: (client: PolyesterCore) => TransfersService;
|
|
48
|
+
internalTransfers: (client: PolyesterCore) => InternalTransfersService;
|
|
49
|
+
tradingWithdraws: (client: PolyesterCore) => TradingWithdrawsService;
|
|
50
|
+
deposit: (client: PolyesterCore) => DepositService;
|
|
51
|
+
addressBook: (client: PolyesterCore) => AddressBookService;
|
|
52
|
+
guardSigner: (client: PolyesterCore) => GuardSignerService;
|
|
53
|
+
socialVerification: (client: PolyesterCore) => SocialVerificationService;
|
|
54
|
+
whiteboard: (client: PolyesterCore) => WhiteboardService;
|
|
55
|
+
zipper: (client: PolyesterCore) => ZipperService;
|
|
56
|
+
mfa: (client: PolyesterCore) => MfaService;
|
|
57
|
+
claims: (client: PolyesterCore) => ClaimsService;
|
|
58
|
+
vip: (client: PolyesterCore) => VipService;
|
|
59
|
+
fees: (client: PolyesterCore) => FeesService;
|
|
60
|
+
tradingRateLimits: (client: PolyesterCore) => RateLimitService;
|
|
61
|
+
};
|
|
62
|
+
/** Service getters shared by the full clients; each returns the same instance as its accessor. */
|
|
63
|
+
type PolyesterServices = { readonly [K in keyof typeof POLYESTER_SERVICES]: ReturnType<(typeof POLYESTER_SERVICES)[K]>; };
|
|
64
|
+
interface PolyesterClient extends PolyesterServices {}
|
|
65
|
+
/**
|
|
66
|
+
* Base SDK client with a lazy getter for every public service. Bundles that only
|
|
67
|
+
* need a few services can use `PolyesterCore` with `@polyester/sdk/services/*` instead.
|
|
68
|
+
*/
|
|
69
|
+
declare class PolyesterClient extends PolyesterCore {}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { POLYESTER_SERVICES, PolyesterClient, PolyesterServices };
|
|
72
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../src/client.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+Ba;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCD,gCACE,kBAAkB,qBAAqB,mBAAmB,oBAAoB;UAgB3E,wBAAwB;;;;;cAO5B,wBAAwB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { PolyesterCore } from "./core-client.js";
|
|
2
|
+
import { accountsService } from "./services/accounts/service.js";
|
|
3
|
+
import { addressBookService } from "./services/address-book/service.js";
|
|
4
|
+
import { apiKeysService } from "./services/api-keys/service.js";
|
|
5
|
+
import { balancesService } from "./services/balances/service.js";
|
|
6
|
+
import { candlesService } from "./services/candles/service.js";
|
|
7
|
+
import { chainAnalyticsService } from "./services/chain-analytics/service.js";
|
|
8
|
+
import { claimsService } from "./services/claims/service.js";
|
|
9
|
+
import { depositService } from "./services/deposit/service.js";
|
|
10
|
+
import { feesService } from "./services/fees/service.js";
|
|
11
|
+
import { guardSignerService } from "./services/guard-signer/service.js";
|
|
12
|
+
import { heatmapService } from "./services/heatmap/service.js";
|
|
13
|
+
import { internalTransfersService } from "./services/internal-transfers/service.js";
|
|
14
|
+
import { lifecycleService } from "./services/lifecycle/service.js";
|
|
15
|
+
import { marketDataService } from "./services/market-data/service.js";
|
|
16
|
+
import { marketOverviewService } from "./services/market-overview/service.js";
|
|
17
|
+
import { mfaService } from "./services/mfa/service.js";
|
|
18
|
+
import { orderbookService } from "./services/orderbook/service.js";
|
|
19
|
+
import { ordersService } from "./services/orders/service.js";
|
|
20
|
+
import { tradingRateLimitsService } from "./services/rate-limits/service.js";
|
|
21
|
+
import { socialVerificationService } from "./services/social-verification/service.js";
|
|
22
|
+
import { subaccountsService } from "./services/subaccounts/service.js";
|
|
23
|
+
import { tradesService } from "./services/trades/service.js";
|
|
24
|
+
import { tradingWithdrawsService } from "./services/trading-withdraws/service.js";
|
|
25
|
+
import { transfersService } from "./services/transfers/service.js";
|
|
26
|
+
import { triggersService } from "./services/triggers/service.js";
|
|
27
|
+
import { vipService } from "./services/vip/service.js";
|
|
28
|
+
import { whiteboardService } from "./services/whiteboard/service.js";
|
|
29
|
+
import { zipperService } from "./services/zipper/service.js";
|
|
30
|
+
//#region src/client.ts
|
|
31
|
+
/** Every service accessor, keyed by its getter name on the full clients. */
|
|
32
|
+
const POLYESTER_SERVICES = {
|
|
33
|
+
accounts: accountsService,
|
|
34
|
+
apiKeys: apiKeysService,
|
|
35
|
+
subaccounts: subaccountsService,
|
|
36
|
+
candles: candlesService,
|
|
37
|
+
chainAnalytics: chainAnalyticsService,
|
|
38
|
+
marketData: marketDataService,
|
|
39
|
+
marketOverview: marketOverviewService,
|
|
40
|
+
orderbook: orderbookService,
|
|
41
|
+
heatmap: heatmapService,
|
|
42
|
+
lifecycle: lifecycleService,
|
|
43
|
+
trades: tradesService,
|
|
44
|
+
orders: ordersService,
|
|
45
|
+
triggers: triggersService,
|
|
46
|
+
balances: balancesService,
|
|
47
|
+
transfers: transfersService,
|
|
48
|
+
internalTransfers: internalTransfersService,
|
|
49
|
+
tradingWithdraws: tradingWithdrawsService,
|
|
50
|
+
deposit: depositService,
|
|
51
|
+
addressBook: addressBookService,
|
|
52
|
+
guardSigner: guardSignerService,
|
|
53
|
+
socialVerification: socialVerificationService,
|
|
54
|
+
whiteboard: whiteboardService,
|
|
55
|
+
zipper: zipperService,
|
|
56
|
+
mfa: mfaService,
|
|
57
|
+
claims: claimsService,
|
|
58
|
+
vip: vipService,
|
|
59
|
+
fees: feesService,
|
|
60
|
+
tradingRateLimits: tradingRateLimitsService
|
|
61
|
+
};
|
|
62
|
+
/** Defines a lazy getter per service, so the full clients stay in sync with the accessors. */
|
|
63
|
+
function installServiceGetters(target) {
|
|
64
|
+
for (const [name, service] of Object.entries(POLYESTER_SERVICES)) Object.defineProperty(target.prototype, name, {
|
|
65
|
+
configurable: true,
|
|
66
|
+
get() {
|
|
67
|
+
return service(this);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Base SDK client with a lazy getter for every public service. Bundles that only
|
|
73
|
+
* need a few services can use `PolyesterCore` with `@polyester/sdk/services/*` instead.
|
|
74
|
+
*/
|
|
75
|
+
var PolyesterClient = class extends PolyesterCore {
|
|
76
|
+
static {
|
|
77
|
+
installServiceGetters(this);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
export { POLYESTER_SERVICES, PolyesterClient, installServiceGetters };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../src/client.ts"],"sourcesContent":["import { PolyesterCore } from \"./core-client.js\";\nimport { accountsService } from \"./services/accounts/service.js\";\nimport { addressBookService } from \"./services/address-book/service.js\";\nimport { apiKeysService } from \"./services/api-keys/service.js\";\nimport { balancesService } from \"./services/balances/service.js\";\nimport { candlesService } from \"./services/candles/service.js\";\nimport { chainAnalyticsService } from \"./services/chain-analytics/service.js\";\nimport { claimsService } from \"./services/claims/service.js\";\nimport { depositService } from \"./services/deposit/service.js\";\nimport { feesService } from \"./services/fees/service.js\";\nimport { guardSignerService } from \"./services/guard-signer/service.js\";\nimport { heatmapService } from \"./services/heatmap/service.js\";\nimport { internalTransfersService } from \"./services/internal-transfers/service.js\";\nimport { lifecycleService } from \"./services/lifecycle/service.js\";\nimport { marketDataService } from \"./services/market-data/service.js\";\nimport { marketOverviewService } from \"./services/market-overview/service.js\";\nimport { mfaService } from \"./services/mfa/service.js\";\nimport { orderbookService } from \"./services/orderbook/service.js\";\nimport { ordersService } from \"./services/orders/service.js\";\nimport { tradingRateLimitsService } from \"./services/rate-limits/service.js\";\nimport { socialVerificationService } from \"./services/social-verification/service.js\";\nimport { subaccountsService } from \"./services/subaccounts/service.js\";\nimport { tradesService } from \"./services/trades/service.js\";\nimport { tradingWithdrawsService } from \"./services/trading-withdraws/service.js\";\nimport { transfersService } from \"./services/transfers/service.js\";\nimport { triggersService } from \"./services/triggers/service.js\";\nimport { vipService } from \"./services/vip/service.js\";\nimport { whiteboardService } from \"./services/whiteboard/service.js\";\nimport { zipperService } from \"./services/zipper/service.js\";\n\n/** Every service accessor, keyed by its getter name on the full clients. */\nexport const POLYESTER_SERVICES = {\n accounts: accountsService,\n apiKeys: apiKeysService,\n subaccounts: subaccountsService,\n candles: candlesService,\n chainAnalytics: chainAnalyticsService,\n marketData: marketDataService,\n marketOverview: marketOverviewService,\n orderbook: orderbookService,\n heatmap: heatmapService,\n lifecycle: lifecycleService,\n trades: tradesService,\n orders: ordersService,\n triggers: triggersService,\n balances: balancesService,\n transfers: transfersService,\n internalTransfers: internalTransfersService,\n tradingWithdraws: tradingWithdrawsService,\n deposit: depositService,\n addressBook: addressBookService,\n guardSigner: guardSignerService,\n socialVerification: socialVerificationService,\n whiteboard: whiteboardService,\n zipper: zipperService,\n mfa: mfaService,\n claims: claimsService,\n vip: vipService,\n fees: feesService,\n tradingRateLimits: tradingRateLimitsService,\n};\n\n/** Service getters shared by the full clients; each returns the same instance as its accessor. */\nexport type PolyesterServices = {\n readonly [K in keyof typeof POLYESTER_SERVICES]: ReturnType<(typeof POLYESTER_SERVICES)[K]>;\n};\n\n/** Defines a lazy getter per service, so the full clients stay in sync with the accessors. */\nexport function installServiceGetters(target: abstract new (...args: never[]) => PolyesterCore) {\n for (const [name, service] of Object.entries(POLYESTER_SERVICES)) {\n Object.defineProperty(target.prototype, name, {\n configurable: true,\n get(this: PolyesterCore) {\n return service(this);\n },\n });\n }\n}\n\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- getters are installed below\nexport interface PolyesterClient extends PolyesterServices {}\n\n/**\n * Base SDK client with a lazy getter for every public service. Bundles that only\n * need a few services can use `PolyesterCore` with `@polyester/sdk/services/*` instead.\n */\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- getters are installed below\nexport class PolyesterClient extends PolyesterCore {\n static {\n installServiceGetters(this);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,qBAAqB;CAC9B,UAAU;CACV,SAAS;CACT,aAAa;CACb,SAAS;CACT,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,WAAW;CACX,SAAS;CACT,WAAW;CACX,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,UAAU;CACV,WAAW;CACX,mBAAmB;CACnB,kBAAkB;CAClB,SAAS;CACT,aAAa;CACb,aAAa;CACb,oBAAoB;CACpB,YAAY;CACZ,QAAQ;CACR,KAAK;CACL,QAAQ;CACR,KAAK;CACL,MAAM;CACN,mBAAmB;AACvB;;AAQA,SAAgB,sBAAsB,QAA0D;CAC5F,KAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,kBAAkB,GAC3D,OAAO,eAAe,OAAO,WAAW,MAAM;EAC1C,cAAc;EACd,MAAyB;GACrB,OAAO,QAAQ,IAAI;EACvB;CACJ,CAAC;AAET;;;;;AAUA,IAAa,kBAAb,cAAqC,cAAc;CAC/C;EACI,sBAAsB,IAAI;CAC9B;AACJ"}
|