@trinaryex/sdk 3.9.0 → 5.0.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.
Files changed (47) hide show
  1. package/DESIGN.md +253 -71
  2. package/README.md +220 -16
  3. package/dist/ReadOnlyClient.d.ts +42 -8
  4. package/dist/TriexClient.d.ts +73 -8
  5. package/dist/armature/OrgClient.d.ts +372 -0
  6. package/dist/armature/OrgClientGroups.d.ts +186 -0
  7. package/dist/armature/OrgsApi.d.ts +69 -0
  8. package/dist/armature/actions.d.ts +75 -0
  9. package/dist/armature/create.d.ts +27 -0
  10. package/dist/armature/currency.d.ts +64 -0
  11. package/dist/armature/executors.d.ts +44 -0
  12. package/dist/armature/governance.d.ts +194 -0
  13. package/dist/armature/harness.d.ts +96 -0
  14. package/dist/armature/lifecycle.d.ts +84 -0
  15. package/dist/armature/plan.d.ts +39 -0
  16. package/dist/armature/proposals.d.ts +51 -0
  17. package/dist/armature/queries.d.ts +16 -0
  18. package/dist/armature/schemas.d.ts +559 -0
  19. package/dist/armature/trading.d.ts +114 -0
  20. package/dist/armature/transactions.d.ts +160 -0
  21. package/dist/armature/treasury.d.ts +41 -0
  22. package/dist/armature/tree.d.ts +13 -0
  23. package/dist/armature/types.d.ts +59 -0
  24. package/dist/armature/upgrade.d.ts +27 -0
  25. package/dist/armature/vault.d.ts +94 -0
  26. package/dist/coins/CoinsApi.d.ts +53 -0
  27. package/dist/coins/funding.d.ts +6 -0
  28. package/dist/coins/money.d.ts +36 -0
  29. package/dist/coins/onchain.d.ts +162 -0
  30. package/dist/coins/schemas.d.ts +456 -0
  31. package/dist/coins/transactions.d.ts +82 -0
  32. package/dist/coins/types.d.ts +115 -0
  33. package/dist/errors.d.ts +11 -1
  34. package/dist/funding.d.ts +2 -2
  35. package/dist/http.d.ts +3 -0
  36. package/dist/index.d.ts +63 -8
  37. package/dist/index.js +10620 -959
  38. package/dist/money.d.ts +15 -0
  39. package/dist/moveAbort.d.ts +28 -0
  40. package/dist/moveAbortCatalog.generated.d.ts +9 -0
  41. package/dist/onchain.d.ts +55 -3
  42. package/dist/paging.d.ts +9 -3
  43. package/dist/queries.d.ts +35 -7
  44. package/dist/schemas.d.ts +2257 -50
  45. package/dist/transactions.d.ts +63 -1
  46. package/dist/types.d.ts +118 -7
  47. package/package.json +3 -1
@@ -1,12 +1,24 @@
1
1
  import { Transaction, TransactionResult, TransactionObjectArgument } from '@mysten/sui/transactions';
2
2
  import { PackageIds } from './types';
3
- export declare function newBalanceManager(tx: Transaction, ids: PackageIds): TransactionResult;
3
+ export declare function newTradingAccount(tx: Transaction, ids: PackageIds): TransactionResult;
4
+ export declare function newTradingAccountWithOwner(tx: Transaction, ids: PackageIds, owner: string): TransactionResult;
5
+ export declare function newTradingAccountWithOwnerAndCaps(tx: Transaction, ids: PackageIds, owner: string): TransactionResult;
6
+ export declare function registerTradingAccount(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument): void;
7
+ export type TradingAccountCapKind = 'trade' | 'deposit' | 'withdraw';
8
+ export declare function mintTradingAccountCap(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, kind: TradingAccountCapKind): TransactionResult;
9
+ export declare function revokeTradingAccountCap(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, capId: string): void;
10
+ export declare function generateProofAsTrader(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, tradeCap: TransactionObjectArgument): TransactionResult;
4
11
  export declare function generateProofAsOwner(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument): TransactionResult;
5
12
  export declare function depositCoin(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, coin: TransactionObjectArgument, coinType?: string): void;
6
13
  export declare function depositMulticoinObject(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, itemObjectId: string): void;
14
+ export declare function depositCoinWithCap(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, depositCap: TransactionObjectArgument, coin: TransactionObjectArgument, coinType?: string): void;
15
+ export declare function depositMulticoinWithCap(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, depositCap: TransactionObjectArgument, balance: TransactionObjectArgument): void;
7
16
  export declare function withdrawCoin(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, amount: bigint, coinType?: string): TransactionResult;
8
17
  export declare function withdrawAllCoin(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, coinType?: string): TransactionResult;
9
18
  export declare function withdrawAllMulticoin(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, collectionId: string, assetId: bigint): TransactionResult;
19
+ export declare function withdrawMulticoin(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, collectionId: string, assetId: bigint, amount: bigint): TransactionResult;
20
+ export declare function withdrawCoinWithCap(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, withdrawCap: TransactionObjectArgument, amount: bigint, coinType?: string): TransactionResult;
21
+ export declare function withdrawMulticoinWithCap(tx: Transaction, ids: PackageIds, bm: TransactionObjectArgument, withdrawCap: TransactionObjectArgument, collectionId: string, assetId: bigint, amount: bigint): TransactionResult;
10
22
  export declare function redeemReceipt(tx: Transaction, ids: PackageIds, balance: TransactionObjectArgument, args: {
11
23
  ssuObjectId: string;
12
24
  characterId: string;
@@ -61,6 +73,12 @@ export declare function cancelAllOrdersItem(tx: Transaction, ids: PackageIds, ar
61
73
  bm: TransactionObjectArgument;
62
74
  proof: TransactionObjectArgument;
63
75
  }): void;
76
+ export declare function cancelOrdersItem(tx: Transaction, ids: PackageIds, args: {
77
+ poolId: string;
78
+ bm: TransactionObjectArgument;
79
+ proof: TransactionObjectArgument;
80
+ orderIds: bigint[];
81
+ }): void;
64
82
  export declare function modifyOrderItem(tx: Transaction, ids: PackageIds, args: {
65
83
  poolId: string;
66
84
  bm: TransactionObjectArgument;
@@ -74,3 +92,47 @@ export declare function withdrawSettledAmounts(tx: Transaction, ids: PackageIds,
74
92
  proof: TransactionObjectArgument;
75
93
  quoteCoinType?: string;
76
94
  }): void;
95
+ export declare function withdrawSettledAmountsPermissionless(tx: Transaction, ids: PackageIds, args: {
96
+ poolId: string;
97
+ bm: TransactionObjectArgument;
98
+ quoteCoinType?: string;
99
+ }): void;
100
+ export declare function swapExactBaseForQuoteItem(tx: Transaction, ids: PackageIds, args: {
101
+ poolId: string;
102
+ baseIn: TransactionObjectArgument;
103
+ credIn: TransactionObjectArgument;
104
+ minQuoteOut: bigint;
105
+ }): TransactionResult;
106
+ export declare function swapExactQuoteForBaseItem(tx: Transaction, ids: PackageIds, args: {
107
+ poolId: string;
108
+ quoteIn: TransactionObjectArgument;
109
+ credIn: TransactionObjectArgument;
110
+ minBaseOut: bigint;
111
+ }): TransactionResult;
112
+ export interface SwapWithTradingAccountArgs {
113
+ poolId: string;
114
+ bm: TransactionObjectArgument;
115
+ tradeCap: TransactionObjectArgument;
116
+ depositCap: TransactionObjectArgument;
117
+ withdrawCap: TransactionObjectArgument;
118
+ }
119
+ export declare function swapExactBaseForQuoteWithTradingAccountItem(tx: Transaction, ids: PackageIds, args: SwapWithTradingAccountArgs & {
120
+ baseIn: TransactionObjectArgument;
121
+ minQuoteOut: bigint;
122
+ }): TransactionResult;
123
+ export declare function swapExactQuoteForBaseWithTradingAccountItem(tx: Transaction, ids: PackageIds, args: SwapWithTradingAccountArgs & {
124
+ quoteIn: TransactionObjectArgument;
125
+ minBaseOut: bigint;
126
+ }): TransactionResult;
127
+ export declare const POOL_CREATION_FEE = 500000000n;
128
+ export declare function createPermissionlessPoolItem(tx: Transaction, ids: PackageIds, args: {
129
+ collectionId: string;
130
+ assetId: bigint;
131
+ creationFee: TransactionObjectArgument;
132
+ }): TransactionResult;
133
+ export declare function claimOperatorShareItem(tx: Transaction, ids: PackageIds, args: {
134
+ poolId: string;
135
+ }): TransactionResult;
136
+ export declare function updatePoolAllowedVersionsItem(tx: Transaction, ids: PackageIds, args: {
137
+ poolId: string;
138
+ }): void;
package/dist/types.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { Transaction } from '@mysten/sui/transactions';
2
2
  import { ClientWithCoreApi } from '@mysten/sui/client';
3
3
  import { z } from 'zod';
4
- import { AssemblyEnrichedSchema, AssemblyOwnerSchema, AssetBalanceSchema, AutocompleteSystemsSchema, BalanceManagerOwnerSchema, BatchSystemsSchema, CoordinateSearchSchema, CoordinatesSchema, CollectionHubSchema, DiscoveryOrderSchema, DiscoveryResultSchema, FillSchema, FillsPageSchema, HubItemOrderbookSchema, HubItemSchema, HubEnrichedSchema, HubItemsPageSchema, HubLocationPageSchema, HubLocationSchema, ItemRecipeComponentSchema, ItemRecipeSchema, ItemSearchPageSchema, ItemSearchResultSchema, HubVaultSchema, InventoryBalancesSchema, OpenOrderSchema, OpenOrdersPageSchema, NearbyHubSchema, NearbySystemSchema, NearbySystemsSchema, OrderbookOrderSchema, PoolMetadataSchema, SolarSystemNameSchema, SolarSystemSchema, SolarSystemSuggestionSchema, SpatialStatsSchema, SweepableItemSchema, SweepablePoolSchema, SweepableSchema, TradeSchema, TradesPageSchema } from './schemas';
4
+ import { OwnedTradingAccountCap } from './onchain';
5
+ import { TradingAccountCapKind } from './transactions';
6
+ import { AssemblyEnrichedSchema, AssemblyOwnerSchema, AssetBalanceSchema, AutocompleteSystemsSchema, TradingAccountOwnerSchema, BatchSystemsSchema, BlueprintFacilitySchema, BlueprintItemSchema, BlueprintSchema, CoordinateSearchSchema, CoordinatesSchema, CollectionHubSchema, DiscoveryOrderSchema, DiscoveryResultSchema, FillSchema, FillsPageSchema, HubItemOrderbookSchema, HubItemSchema, HubEnrichedSchema, HubItemsPageSchema, HubLocationPageSchema, HubLocationSchema, ItemBlueprintsSchema, ItemRecipeComponentSchema, ItemRecipeSchema, ItemSearchPageSchema, ItemSearchResultSchema, HubVaultSchema, InventoryBalancesSchema, OpenOrderSchema, OpenOrdersPageSchema, NearbyHubSchema, NearbySystemSchema, NearbySystemsSchema, OrderbookOrderSchema, PoolMetadataSchema, SolarSystemNameSchema, SolarSystemSchema, SolarSystemSuggestionSchema, SpatialStatsSchema, SweepableItemSchema, SweepablePoolSchema, SweepableSchema, TradeSchema, TradesPageSchema, CharacterLookupSchema, CharacterSchema, DisplayPriceSchema, FillDetailSchema, HubEconomicsSchema, ItemInfoSchema, OrderCharacterSchema, OrderCurrencySchema, OrderDetailFillSchema, OrderDetailSchema, OrderHubSchema, OrderPartySchema, PlatformStatsSchema, PoolFeesSchema, RecentTradeSchema, RecentTradesPageSchema, RouteComparisonSchema, RouteSchema, RoutingStatsSchema, StatsQuoteVolumeSchema, StatsTopItemSchema, StatsTopOrgSchema, TribeSchema, WaypointSchema, WorldItemSchema } from './schemas';
5
7
  export interface ObjectChange {
6
8
  type: string;
7
9
  objectId?: string;
@@ -20,13 +22,24 @@ export interface TxResult {
20
22
  export type TriexNetwork = 'testnet';
21
23
  export interface PackageIds {
22
24
  triex: string;
25
+ triexOriginal: string;
23
26
  triexRegistry: string;
27
+ triexFeePolicy: string;
24
28
  multicoin: string;
25
29
  warehouseReceipts: string;
26
30
  credCoinType: string;
27
31
  world: string;
28
32
  worldOriginal: string;
29
33
  clock: string;
34
+ armature: string;
35
+ armatureOriginal: string;
36
+ armatureProposals: string;
37
+ armatureProposalsOriginal: string;
38
+ armatureTrading: string;
39
+ armatureTradingOriginal: string;
40
+ armatureVault: string;
41
+ armatureVaultOriginal: string;
42
+ ouReceiptVaultRegistry: string;
30
43
  }
31
44
  export interface TriexClientConfig {
32
45
  suiClient: ClientWithCoreApi;
@@ -42,6 +55,7 @@ export interface ReadOnlyClientConfig {
42
55
  indexerUrl?: string;
43
56
  network?: TriexNetwork;
44
57
  packageIds?: Partial<PackageIds>;
58
+ suiClient?: ClientWithCoreApi;
45
59
  }
46
60
  export type OrderSide = 'buy' | 'sell';
47
61
  export type DiscoveryOrder = z.output<typeof DiscoveryOrderSchema>;
@@ -55,7 +69,7 @@ export type NearbyHub = z.output<typeof NearbyHubSchema>;
55
69
  export type HubEnriched = z.output<typeof HubEnrichedSchema>;
56
70
  export type AssemblyOwner = z.output<typeof AssemblyOwnerSchema>;
57
71
  export type AssemblyEnriched = z.output<typeof AssemblyEnrichedSchema>;
58
- export type BalanceManagerOwner = z.output<typeof BalanceManagerOwnerSchema>;
72
+ export type TradingAccountOwner = z.output<typeof TradingAccountOwnerSchema>;
59
73
  export type SolarSystemName = z.output<typeof SolarSystemNameSchema>;
60
74
  export type Coordinates = z.output<typeof CoordinatesSchema>;
61
75
  export type SolarSystem = z.output<typeof SolarSystemSchema>;
@@ -84,6 +98,35 @@ export type TradesPage = z.output<typeof TradesPageSchema>;
84
98
  export type SweepablePool = z.output<typeof SweepablePoolSchema>;
85
99
  export type SweepableItem = z.output<typeof SweepableItemSchema>;
86
100
  export type Sweepable = z.output<typeof SweepableSchema>;
101
+ export type OrderDetail = z.output<typeof OrderDetailSchema>;
102
+ export type OrderDetailFill = z.output<typeof OrderDetailFillSchema>;
103
+ export type OrderParty = z.output<typeof OrderPartySchema>;
104
+ export type OrderCharacter = z.output<typeof OrderCharacterSchema>;
105
+ export type OrderHub = z.output<typeof OrderHubSchema>;
106
+ export type OrderCurrency = z.output<typeof OrderCurrencySchema>;
107
+ export type FillDetail = z.output<typeof FillDetailSchema>;
108
+ export type RecentTrade = z.output<typeof RecentTradeSchema>;
109
+ export type RecentTradesPage = z.output<typeof RecentTradesPageSchema>;
110
+ export type DisplayPrice = z.output<typeof DisplayPriceSchema>;
111
+ export type HubEconomics = z.output<typeof HubEconomicsSchema>;
112
+ export type PoolFees = z.output<typeof PoolFeesSchema>;
113
+ export type PlatformStats = z.output<typeof PlatformStatsSchema>;
114
+ export type StatsQuoteVolume = z.output<typeof StatsQuoteVolumeSchema>;
115
+ export type StatsTopItem = z.output<typeof StatsTopItemSchema>;
116
+ export type StatsTopOrg = z.output<typeof StatsTopOrgSchema>;
117
+ export type Character = z.output<typeof CharacterSchema>;
118
+ export type CharacterLookup = z.output<typeof CharacterLookupSchema>;
119
+ export type Tribe = z.output<typeof TribeSchema>;
120
+ export type WorldItem = z.output<typeof WorldItemSchema>;
121
+ export type ItemInfo = z.output<typeof ItemInfoSchema>;
122
+ export type Blueprint = z.output<typeof BlueprintSchema>;
123
+ export type BlueprintItem = z.output<typeof BlueprintItemSchema>;
124
+ export type BlueprintFacility = z.output<typeof BlueprintFacilitySchema>;
125
+ export type ItemBlueprints = z.output<typeof ItemBlueprintsSchema>;
126
+ export type Route = z.output<typeof RouteSchema>;
127
+ export type Waypoint = z.output<typeof WaypointSchema>;
128
+ export type RouteComparison = z.output<typeof RouteComparisonSchema>;
129
+ export type RoutingStats = z.output<typeof RoutingStatsSchema>;
87
130
  export interface Orderbook {
88
131
  poolId: string;
89
132
  bids: OrderbookOrder[];
@@ -103,22 +146,22 @@ export interface TradeHubDetail {
103
146
  location: HubLocation | null;
104
147
  }
105
148
  export interface TradingAccount {
106
- balanceManagerId: string;
149
+ tradingAccountId: string;
107
150
  owner: string;
108
151
  }
109
152
  export interface CurrencyBalances {
110
153
  wallet: bigint;
111
- balanceManager: bigint;
112
- balanceManagerId: string | null;
154
+ tradingAccount: bigint;
155
+ tradingAccountId: string | null;
113
156
  }
114
157
  export interface EnsureAccountResult {
115
- balanceManagerId: string;
158
+ tradingAccountId: string;
116
159
  created: boolean;
117
160
  }
118
161
  export interface DiscoveryFilters {
119
162
  storageUnitIds?: string[];
120
163
  assetId?: string;
121
- balanceManagerId?: string;
164
+ tradingAccountId?: string;
122
165
  side?: 'buy' | 'sell' | 'both';
123
166
  publicOnly?: boolean;
124
167
  cursor?: string;
@@ -170,6 +213,34 @@ export interface BalancesAtHubParams {
170
213
  inventoryKey?: string;
171
214
  vaultIds?: string[];
172
215
  }
216
+ export interface OrderLookupParams {
217
+ poolId: string;
218
+ orderId: bigint | string;
219
+ }
220
+ export interface RecentTradesParams extends HistoryPageParams {
221
+ publicOnly?: boolean;
222
+ assetId?: string;
223
+ }
224
+ export interface DisplayPricesParams {
225
+ itemIds: string[];
226
+ storageUnitIds?: string[];
227
+ fallback?: boolean;
228
+ }
229
+ export interface DisplayPriceParams {
230
+ storageUnitId?: string;
231
+ fallback?: boolean;
232
+ }
233
+ export type RouteOptimization = 'fuel' | 'time' | 'balanced';
234
+ export interface RouteShipParams {
235
+ origin: string;
236
+ destination: string;
237
+ mass?: number;
238
+ gateWeight?: number;
239
+ maxJumpRangeLy?: number;
240
+ }
241
+ export interface RouteParams extends RouteShipParams {
242
+ optimization?: RouteOptimization;
243
+ }
173
244
  export interface HistoryPageParams {
174
245
  before?: number;
175
246
  after?: number;
@@ -200,6 +271,7 @@ export interface WithdrawItemsParams {
200
271
  storageUnitId: string;
201
272
  items: {
202
273
  assetId: string;
274
+ amount?: bigint;
203
275
  }[];
204
276
  characterId?: string;
205
277
  }
@@ -237,3 +309,42 @@ export interface ModifyOrderParams extends CancelOrderParams {
237
309
  export interface ClaimSettledParams {
238
310
  poolIds?: string[];
239
311
  }
312
+ export interface CancelOrdersParams {
313
+ storageUnitId: string;
314
+ assetId: string;
315
+ orderIds: (bigint | string)[];
316
+ }
317
+ export type PoolSelector = {
318
+ storageUnitId: string;
319
+ assetId: string;
320
+ } | {
321
+ poolId: string;
322
+ };
323
+ export type TradingFeesParams = PoolSelector & {
324
+ address?: string;
325
+ };
326
+ export interface MintCapParams {
327
+ kind: TradingAccountCapKind;
328
+ recipient?: string;
329
+ }
330
+ export interface MintCapResult extends TxResult {
331
+ capId: string | null;
332
+ }
333
+ export interface RevokeCapParams {
334
+ capId: string;
335
+ }
336
+ export interface TradingAccountCaps {
337
+ tradingAccountId: string | null;
338
+ allowListed: string[];
339
+ held: OwnedTradingAccountCap[];
340
+ }
341
+ export interface CreatePoolParams {
342
+ storageUnitId: string;
343
+ assetId: string;
344
+ }
345
+ export interface CreatePoolResult extends TxResult {
346
+ poolId: string | null;
347
+ }
348
+ export interface ClaimOperatorShareParams {
349
+ poolIds: string[];
350
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trinaryex/sdk",
3
- "version": "3.9.0",
3
+ "version": "5.0.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",
@@ -18,6 +18,8 @@
18
18
  ],
19
19
  "scripts": {
20
20
  "build": "vite build",
21
+ "generate:error-codes": "node scripts/generate-error-codes.mjs",
22
+ "check:error-codes": "node scripts/generate-error-codes.mjs --check",
21
23
  "test": "node --experimental-vm-modules node_modules/.bin/jest",
22
24
  "test:cov": "node --experimental-vm-modules node_modules/.bin/jest --ci --coverage",
23
25
  "check:gateway": "node scripts/check-gateway.mjs",