@trinaryex/sdk 3.8.0 → 4.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 +218 -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 +10587 -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 +1911 -50
  45. package/dist/transactions.d.ts +63 -1
  46. package/dist/types.d.ts +116 -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, 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, CharacterLookupSchema, CharacterSchema, DisplayPriceSchema, FillDetailSchema, HubEconomicsSchema, ItemInfoSchema, OrderCharacterSchema, OrderCurrencySchema, OrderDetailFillSchema, OrderDetailSchema, OrderHubSchema, OrderPartySchema, PlatformStatsSchema, PoolFeesSchema, RecentTradeSchema, RecentTradesPageSchema, RecipeMaterialSchema, RecipeSchema, 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,33 @@ 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 Recipe = z.output<typeof RecipeSchema>;
123
+ export type RecipeMaterial = z.output<typeof RecipeMaterialSchema>;
124
+ export type Route = z.output<typeof RouteSchema>;
125
+ export type Waypoint = z.output<typeof WaypointSchema>;
126
+ export type RouteComparison = z.output<typeof RouteComparisonSchema>;
127
+ export type RoutingStats = z.output<typeof RoutingStatsSchema>;
87
128
  export interface Orderbook {
88
129
  poolId: string;
89
130
  bids: OrderbookOrder[];
@@ -103,22 +144,22 @@ export interface TradeHubDetail {
103
144
  location: HubLocation | null;
104
145
  }
105
146
  export interface TradingAccount {
106
- balanceManagerId: string;
147
+ tradingAccountId: string;
107
148
  owner: string;
108
149
  }
109
150
  export interface CurrencyBalances {
110
151
  wallet: bigint;
111
- balanceManager: bigint;
112
- balanceManagerId: string | null;
152
+ tradingAccount: bigint;
153
+ tradingAccountId: string | null;
113
154
  }
114
155
  export interface EnsureAccountResult {
115
- balanceManagerId: string;
156
+ tradingAccountId: string;
116
157
  created: boolean;
117
158
  }
118
159
  export interface DiscoveryFilters {
119
160
  storageUnitIds?: string[];
120
161
  assetId?: string;
121
- balanceManagerId?: string;
162
+ tradingAccountId?: string;
122
163
  side?: 'buy' | 'sell' | 'both';
123
164
  publicOnly?: boolean;
124
165
  cursor?: string;
@@ -170,6 +211,34 @@ export interface BalancesAtHubParams {
170
211
  inventoryKey?: string;
171
212
  vaultIds?: string[];
172
213
  }
214
+ export interface OrderLookupParams {
215
+ poolId: string;
216
+ orderId: bigint | string;
217
+ }
218
+ export interface RecentTradesParams extends HistoryPageParams {
219
+ publicOnly?: boolean;
220
+ assetId?: string;
221
+ }
222
+ export interface DisplayPricesParams {
223
+ itemIds: string[];
224
+ storageUnitIds?: string[];
225
+ fallback?: boolean;
226
+ }
227
+ export interface DisplayPriceParams {
228
+ storageUnitId?: string;
229
+ fallback?: boolean;
230
+ }
231
+ export type RouteOptimization = 'fuel' | 'time' | 'balanced';
232
+ export interface RouteShipParams {
233
+ origin: string;
234
+ destination: string;
235
+ mass?: number;
236
+ gateWeight?: number;
237
+ maxJumpRangeLy?: number;
238
+ }
239
+ export interface RouteParams extends RouteShipParams {
240
+ optimization?: RouteOptimization;
241
+ }
173
242
  export interface HistoryPageParams {
174
243
  before?: number;
175
244
  after?: number;
@@ -200,6 +269,7 @@ export interface WithdrawItemsParams {
200
269
  storageUnitId: string;
201
270
  items: {
202
271
  assetId: string;
272
+ amount?: bigint;
203
273
  }[];
204
274
  characterId?: string;
205
275
  }
@@ -237,3 +307,42 @@ export interface ModifyOrderParams extends CancelOrderParams {
237
307
  export interface ClaimSettledParams {
238
308
  poolIds?: string[];
239
309
  }
310
+ export interface CancelOrdersParams {
311
+ storageUnitId: string;
312
+ assetId: string;
313
+ orderIds: (bigint | string)[];
314
+ }
315
+ export type PoolSelector = {
316
+ storageUnitId: string;
317
+ assetId: string;
318
+ } | {
319
+ poolId: string;
320
+ };
321
+ export type TradingFeesParams = PoolSelector & {
322
+ address?: string;
323
+ };
324
+ export interface MintCapParams {
325
+ kind: TradingAccountCapKind;
326
+ recipient?: string;
327
+ }
328
+ export interface MintCapResult extends TxResult {
329
+ capId: string | null;
330
+ }
331
+ export interface RevokeCapParams {
332
+ capId: string;
333
+ }
334
+ export interface TradingAccountCaps {
335
+ tradingAccountId: string | null;
336
+ allowListed: string[];
337
+ held: OwnedTradingAccountCap[];
338
+ }
339
+ export interface CreatePoolParams {
340
+ storageUnitId: string;
341
+ assetId: string;
342
+ }
343
+ export interface CreatePoolResult extends TxResult {
344
+ poolId: string | null;
345
+ }
346
+ export interface ClaimOperatorShareParams {
347
+ poolIds: string[];
348
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trinaryex/sdk",
3
- "version": "3.8.0",
3
+ "version": "4.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",