@trinaryex/sdk 2.0.0 → 3.1.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/DESIGN.md +22 -21
- package/README.md +6 -3
- package/dist/ReadOnlyClient.d.ts +2 -2
- package/dist/TriexClient.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +225 -192
- package/dist/money.d.ts +1 -1
- package/dist/queries.d.ts +6 -1
- package/dist/schemas.d.ts +181 -0
- package/dist/types.d.ts +9 -2
- package/package.json +2 -2
package/dist/money.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const TRIEX_PRICE_SCALING = 1000000000n;
|
|
2
2
|
export declare const MULTICOIN_PRICE_SCALING = 1n;
|
|
3
3
|
export declare const FEE_RATE_SCALING = 1000000000n;
|
|
4
4
|
export declare const GTC_EXPIRE = 18446744073709551615n;
|
package/dist/queries.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BalancesAtHubParams, CollectionHub, DiscoveryFilters, DiscoveryResult, FillsPage, FillsParams, HistoryPageParams, HubItemsPage, HubLocation, HubVaultInfo, InventoryBalances, OpenOrdersPage, Orderbook, PoolMetadata, Sweepable, TradesPage, TradesParams } from './types';
|
|
1
|
+
import { BalancesAtHubParams, CollectionHub, DiscoveryFilters, DiscoveryResult, FillsPage, FillsParams, HistoryPageParams, HubItemMarket, HubItemsPage, HubLocation, HubVaultInfo, InventoryBalances, OpenOrdersPage, Orderbook, PoolMetadata, Sweepable, TradesPage, TradesParams } from './types';
|
|
2
2
|
export declare class IndexerClient {
|
|
3
3
|
private readonly baseUrl;
|
|
4
4
|
private readonly apiKey;
|
|
@@ -10,6 +10,11 @@ export declare class IndexerClient {
|
|
|
10
10
|
assetId: string;
|
|
11
11
|
quoteType?: string;
|
|
12
12
|
}): Promise<string | null>;
|
|
13
|
+
hubItemOrderbook(params: {
|
|
14
|
+
hubId: string;
|
|
15
|
+
assetId: string;
|
|
16
|
+
quoteType?: string;
|
|
17
|
+
}): Promise<HubItemMarket>;
|
|
13
18
|
orderbook(poolId: string): Promise<Orderbook>;
|
|
14
19
|
poolMetadata(poolId: string): Promise<PoolMetadata>;
|
|
15
20
|
hubVault(hubId: string): Promise<HubVaultInfo>;
|
package/dist/schemas.d.ts
CHANGED
|
@@ -304,6 +304,187 @@ export declare const PoolMetadataSchema: z.ZodPipe<z.ZodObject<{
|
|
|
304
304
|
fee: string | null;
|
|
305
305
|
fee_rate: number | null;
|
|
306
306
|
}>>;
|
|
307
|
+
export declare const HubItemOrderbookSchema: z.ZodPipe<z.ZodObject<{
|
|
308
|
+
hub_id: z.ZodString;
|
|
309
|
+
collection_id: z.ZodString;
|
|
310
|
+
vault_config_id: z.ZodNullable<z.ZodString>;
|
|
311
|
+
pool_id: z.ZodNullable<z.ZodString>;
|
|
312
|
+
metadata: z.ZodNullable<z.ZodPipe<z.ZodObject<{
|
|
313
|
+
pool_id: z.ZodString;
|
|
314
|
+
pool_name: z.ZodString;
|
|
315
|
+
base_asset_symbol: z.ZodString;
|
|
316
|
+
base_asset_name: z.ZodNullable<z.ZodString>;
|
|
317
|
+
base_asset_decimals: z.ZodNumber;
|
|
318
|
+
quote_asset_symbol: z.ZodString;
|
|
319
|
+
quote_asset_name: z.ZodNullable<z.ZodString>;
|
|
320
|
+
quote_asset_decimals: z.ZodNumber;
|
|
321
|
+
storage_unit_id: z.ZodNullable<z.ZodString>;
|
|
322
|
+
asset_id: z.ZodNullable<z.ZodString>;
|
|
323
|
+
collection_id: z.ZodNullable<z.ZodString>;
|
|
324
|
+
fee: z.ZodNullable<z.ZodString>;
|
|
325
|
+
fee_rate: z.ZodNullable<z.ZodNumber>;
|
|
326
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
327
|
+
poolId: string;
|
|
328
|
+
poolName: string;
|
|
329
|
+
baseAssetSymbol: string;
|
|
330
|
+
baseAssetName: string | null;
|
|
331
|
+
baseAssetDecimals: number;
|
|
332
|
+
quoteAssetSymbol: string;
|
|
333
|
+
quoteAssetName: string | null;
|
|
334
|
+
quoteAssetDecimals: number;
|
|
335
|
+
storageUnitId: string | null;
|
|
336
|
+
assetId: string | null;
|
|
337
|
+
collectionId: string | null;
|
|
338
|
+
feeRateScaled: bigint;
|
|
339
|
+
feeRate: number | null;
|
|
340
|
+
}, {
|
|
341
|
+
pool_id: string;
|
|
342
|
+
pool_name: string;
|
|
343
|
+
base_asset_symbol: string;
|
|
344
|
+
base_asset_name: string | null;
|
|
345
|
+
base_asset_decimals: number;
|
|
346
|
+
quote_asset_symbol: string;
|
|
347
|
+
quote_asset_name: string | null;
|
|
348
|
+
quote_asset_decimals: number;
|
|
349
|
+
storage_unit_id: string | null;
|
|
350
|
+
asset_id: string | null;
|
|
351
|
+
collection_id: string | null;
|
|
352
|
+
fee: string | null;
|
|
353
|
+
fee_rate: number | null;
|
|
354
|
+
}>>>;
|
|
355
|
+
bids: z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
356
|
+
encodedOrderId: z.ZodString;
|
|
357
|
+
quantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
|
|
358
|
+
filledQuantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
|
|
359
|
+
expireTimestamp: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
|
|
360
|
+
lastUpdatedTimestamp: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
|
|
361
|
+
status: z.ZodNumber;
|
|
362
|
+
price: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
|
|
363
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
364
|
+
orderId: string;
|
|
365
|
+
quantity: bigint;
|
|
366
|
+
filledQuantity: bigint;
|
|
367
|
+
remainingQuantity: bigint;
|
|
368
|
+
expireTimestamp: bigint;
|
|
369
|
+
lastUpdatedTimestamp: bigint;
|
|
370
|
+
status: number;
|
|
371
|
+
price: bigint;
|
|
372
|
+
}, {
|
|
373
|
+
encodedOrderId: string;
|
|
374
|
+
quantity: bigint;
|
|
375
|
+
filledQuantity: bigint;
|
|
376
|
+
expireTimestamp: bigint;
|
|
377
|
+
lastUpdatedTimestamp: bigint;
|
|
378
|
+
status: number;
|
|
379
|
+
price: bigint;
|
|
380
|
+
}>>>;
|
|
381
|
+
asks: z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
382
|
+
encodedOrderId: z.ZodString;
|
|
383
|
+
quantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
|
|
384
|
+
filledQuantity: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
|
|
385
|
+
expireTimestamp: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
|
|
386
|
+
lastUpdatedTimestamp: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
|
|
387
|
+
status: z.ZodNumber;
|
|
388
|
+
price: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<bigint, string | number>>;
|
|
389
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
390
|
+
orderId: string;
|
|
391
|
+
quantity: bigint;
|
|
392
|
+
filledQuantity: bigint;
|
|
393
|
+
remainingQuantity: bigint;
|
|
394
|
+
expireTimestamp: bigint;
|
|
395
|
+
lastUpdatedTimestamp: bigint;
|
|
396
|
+
status: number;
|
|
397
|
+
price: bigint;
|
|
398
|
+
}, {
|
|
399
|
+
encodedOrderId: string;
|
|
400
|
+
quantity: bigint;
|
|
401
|
+
filledQuantity: bigint;
|
|
402
|
+
expireTimestamp: bigint;
|
|
403
|
+
lastUpdatedTimestamp: bigint;
|
|
404
|
+
status: number;
|
|
405
|
+
price: bigint;
|
|
406
|
+
}>>>;
|
|
407
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
408
|
+
hubId: string;
|
|
409
|
+
collectionId: string;
|
|
410
|
+
vaultConfigId: string | null;
|
|
411
|
+
poolId: string | null;
|
|
412
|
+
metadata: {
|
|
413
|
+
poolId: string;
|
|
414
|
+
poolName: string;
|
|
415
|
+
baseAssetSymbol: string;
|
|
416
|
+
baseAssetName: string | null;
|
|
417
|
+
baseAssetDecimals: number;
|
|
418
|
+
quoteAssetSymbol: string;
|
|
419
|
+
quoteAssetName: string | null;
|
|
420
|
+
quoteAssetDecimals: number;
|
|
421
|
+
storageUnitId: string | null;
|
|
422
|
+
assetId: string | null;
|
|
423
|
+
collectionId: string | null;
|
|
424
|
+
feeRateScaled: bigint;
|
|
425
|
+
feeRate: number | null;
|
|
426
|
+
} | null;
|
|
427
|
+
bids: {
|
|
428
|
+
orderId: string;
|
|
429
|
+
quantity: bigint;
|
|
430
|
+
filledQuantity: bigint;
|
|
431
|
+
remainingQuantity: bigint;
|
|
432
|
+
expireTimestamp: bigint;
|
|
433
|
+
lastUpdatedTimestamp: bigint;
|
|
434
|
+
status: number;
|
|
435
|
+
price: bigint;
|
|
436
|
+
}[];
|
|
437
|
+
asks: {
|
|
438
|
+
orderId: string;
|
|
439
|
+
quantity: bigint;
|
|
440
|
+
filledQuantity: bigint;
|
|
441
|
+
remainingQuantity: bigint;
|
|
442
|
+
expireTimestamp: bigint;
|
|
443
|
+
lastUpdatedTimestamp: bigint;
|
|
444
|
+
status: number;
|
|
445
|
+
price: bigint;
|
|
446
|
+
}[];
|
|
447
|
+
}, {
|
|
448
|
+
hub_id: string;
|
|
449
|
+
collection_id: string;
|
|
450
|
+
vault_config_id: string | null;
|
|
451
|
+
pool_id: string | null;
|
|
452
|
+
metadata: {
|
|
453
|
+
poolId: string;
|
|
454
|
+
poolName: string;
|
|
455
|
+
baseAssetSymbol: string;
|
|
456
|
+
baseAssetName: string | null;
|
|
457
|
+
baseAssetDecimals: number;
|
|
458
|
+
quoteAssetSymbol: string;
|
|
459
|
+
quoteAssetName: string | null;
|
|
460
|
+
quoteAssetDecimals: number;
|
|
461
|
+
storageUnitId: string | null;
|
|
462
|
+
assetId: string | null;
|
|
463
|
+
collectionId: string | null;
|
|
464
|
+
feeRateScaled: bigint;
|
|
465
|
+
feeRate: number | null;
|
|
466
|
+
} | null;
|
|
467
|
+
bids: {
|
|
468
|
+
orderId: string;
|
|
469
|
+
quantity: bigint;
|
|
470
|
+
filledQuantity: bigint;
|
|
471
|
+
remainingQuantity: bigint;
|
|
472
|
+
expireTimestamp: bigint;
|
|
473
|
+
lastUpdatedTimestamp: bigint;
|
|
474
|
+
status: number;
|
|
475
|
+
price: bigint;
|
|
476
|
+
}[];
|
|
477
|
+
asks: {
|
|
478
|
+
orderId: string;
|
|
479
|
+
quantity: bigint;
|
|
480
|
+
filledQuantity: bigint;
|
|
481
|
+
remainingQuantity: bigint;
|
|
482
|
+
expireTimestamp: bigint;
|
|
483
|
+
lastUpdatedTimestamp: bigint;
|
|
484
|
+
status: number;
|
|
485
|
+
price: bigint;
|
|
486
|
+
}[];
|
|
487
|
+
}>>;
|
|
307
488
|
export declare const HubVaultSchema: z.ZodPipe<z.ZodObject<{
|
|
308
489
|
hub_id: z.ZodString;
|
|
309
490
|
collection_id: z.ZodString;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Transaction } from '@mysten/sui/transactions';
|
|
2
2
|
import { ClientWithCoreApi } from '@mysten/sui/client';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { AssetBalanceSchema, CollectionHubSchema, DiscoveryOrderSchema, DiscoveryResultSchema, FillSchema, FillsPageSchema, HubItemSchema, HubItemsPageSchema, HubLocationSchema, HubVaultSchema, InventoryBalancesSchema, OpenOrderSchema, OpenOrdersPageSchema, OrderbookOrderSchema, PoolMetadataSchema, SweepableItemSchema, SweepablePoolSchema, SweepableSchema, TradeSchema, TradesPageSchema } from './schemas';
|
|
4
|
+
import { AssetBalanceSchema, CollectionHubSchema, DiscoveryOrderSchema, DiscoveryResultSchema, FillSchema, FillsPageSchema, HubItemOrderbookSchema, HubItemSchema, HubItemsPageSchema, HubLocationSchema, HubVaultSchema, InventoryBalancesSchema, OpenOrderSchema, OpenOrdersPageSchema, OrderbookOrderSchema, PoolMetadataSchema, SweepableItemSchema, SweepablePoolSchema, SweepableSchema, TradeSchema, TradesPageSchema } from './schemas';
|
|
5
5
|
export interface ObjectChange {
|
|
6
6
|
type: string;
|
|
7
7
|
objectId?: string;
|
|
@@ -19,7 +19,7 @@ export interface TxResult {
|
|
|
19
19
|
}
|
|
20
20
|
export type TriexNetwork = 'testnet';
|
|
21
21
|
export interface PackageIds {
|
|
22
|
-
|
|
22
|
+
triex: string;
|
|
23
23
|
triexRegistry: string;
|
|
24
24
|
multicoin: string;
|
|
25
25
|
warehouseReceipts: string;
|
|
@@ -69,6 +69,13 @@ export interface Orderbook {
|
|
|
69
69
|
bids: OrderbookOrder[];
|
|
70
70
|
asks: OrderbookOrder[];
|
|
71
71
|
}
|
|
72
|
+
export type HubItemMarket = z.output<typeof HubItemOrderbookSchema>;
|
|
73
|
+
export interface HubItemOrderbook extends Orderbook {
|
|
74
|
+
hubId: string;
|
|
75
|
+
collectionId: string;
|
|
76
|
+
vaultConfigId: string | null;
|
|
77
|
+
metadata: PoolMetadata | null;
|
|
78
|
+
}
|
|
72
79
|
export interface TradeHubDetail {
|
|
73
80
|
hubId: string;
|
|
74
81
|
collectionId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trinaryex/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Trading SDK for Trinary Exchange — market data, order books, and on-chain trading (Sui) for bots, analytics tools, and CLIs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"marketplace",
|
|
105
105
|
"market-data",
|
|
106
106
|
"trading-bot",
|
|
107
|
-
"
|
|
107
|
+
"clob"
|
|
108
108
|
],
|
|
109
109
|
"sideEffects": false,
|
|
110
110
|
"repository": {
|