@trinaryex/sdk 1.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.
@@ -0,0 +1,18 @@
1
+ export declare const TRIEXBOOK_PRICE_SCALING = 1000000000n;
2
+ export declare const MULTICOIN_PRICE_SCALING = 1n;
3
+ export declare const FEE_RATE_SCALING = 1000000000n;
4
+ export declare const GTC_EXPIRE = 18446744073709551615n;
5
+ export declare function toBase(human: string | number, decimals: number): bigint;
6
+ export declare function fromBase(base: bigint, decimals: number): string;
7
+ export declare function computeItemQuote(price: bigint, quantity: bigint): bigint;
8
+ export declare function computeBidQuoteDeposit(price: bigint, quantity: bigint, feeRateScaled: bigint): bigint;
9
+ export declare function marketBuyRoundingBuffer(quantity: bigint, feeRateScaled: bigint): bigint;
10
+ export declare function estimateMarketBuyCost(asks: ReadonlyArray<{
11
+ price: bigint;
12
+ remainingQuantity: bigint;
13
+ }>, quantity: bigint, feeRateScaled: bigint): {
14
+ quote: bigint;
15
+ fee: bigint;
16
+ total: bigint;
17
+ fillable: bigint;
18
+ };
@@ -0,0 +1,45 @@
1
+ import { ClientWithCoreApi } from '@mysten/sui/client';
2
+ import { PackageIds } from './types';
3
+ export declare function serializeBalanceKey(): Uint8Array;
4
+ export declare function serializeMultiCoinBalanceKey(collectionId: string, assetId: bigint): Uint8Array;
5
+ export declare const MultiCoinBalanceBcs: import('@mysten/bcs').BcsStruct<{
6
+ id: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
7
+ collection: import('@mysten/bcs').BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
8
+ asset_id: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
9
+ amount: import('@mysten/bcs').BcsType<string, string | number | bigint, "u64">;
10
+ }, string>;
11
+ export declare function toSsuObjectId(storageUnitId: string): string;
12
+ export interface ObjectRef {
13
+ objectId: string;
14
+ version: string;
15
+ digest: string;
16
+ }
17
+ export declare function getObjectRef(suiClient: ClientWithCoreApi, objectId: string): Promise<ObjectRef>;
18
+ export declare function getWalletCurrencyBalance(suiClient: ClientWithCoreApi, address: string, coinType: string): Promise<bigint>;
19
+ export declare function getBalanceManagerCurrencyBalance(suiClient: ClientWithCoreApi, ids: PackageIds, balanceManagerId: string): Promise<bigint>;
20
+ export declare function getBalanceManagerItemBalance(suiClient: ClientWithCoreApi, ids: PackageIds, balanceManagerId: string, collectionId: string, assetId: bigint): Promise<{
21
+ hasKey: boolean;
22
+ balance: bigint;
23
+ }>;
24
+ export declare function getRegistryMulticoinCollectionId(suiClient: ClientWithCoreApi, ids: PackageIds): Promise<string>;
25
+ export interface OwnedItemReceipt {
26
+ objectId: string;
27
+ collectionId: string;
28
+ assetId: string;
29
+ amount: bigint;
30
+ }
31
+ export declare function findOwnedItemReceipts(suiClient: ClientWithCoreApi, ids: PackageIds, owner: string, filter?: {
32
+ assetId?: string;
33
+ }): Promise<OwnedItemReceipt[]>;
34
+ export interface CharacterInfo {
35
+ characterId: string;
36
+ ownerCapId: string;
37
+ }
38
+ export declare function fetchCharacterInfo(suiClient: ClientWithCoreApi, ids: PackageIds, ownerAddress: string): Promise<CharacterInfo | null>;
39
+ export interface SsuOwnerInfo {
40
+ ssuOwnerCapId: string;
41
+ characterId: string;
42
+ charOwnerCapId: string;
43
+ }
44
+ export declare function fetchSsuOwnerInfo(suiClient: ClientWithCoreApi, ssuObjectId: string, accountAddress: string): Promise<SsuOwnerInfo | null>;
45
+ export declare function fetchInventorySlotQuantity(suiClient: ClientWithCoreApi, ssuObjectId: string, ownerCapId: string, assetId: string): Promise<bigint>;
@@ -0,0 +1,8 @@
1
+ import { IndexerClient } from './queries';
2
+ import { DiscoveryFilters, DiscoveryOrder, Fill, FillsParams, Trade, TradesParams } from './types';
3
+ export interface IterateOptions {
4
+ maxItems?: number;
5
+ }
6
+ export declare function iterateDiscovery(indexer: IndexerClient, filters?: DiscoveryFilters, options?: IterateOptions): AsyncGenerator<DiscoveryOrder>;
7
+ export declare function iterateFills(indexer: IndexerClient, balanceManagerId: string, params?: FillsParams, options?: IterateOptions): AsyncGenerator<Fill>;
8
+ export declare function iterateTrades(indexer: IndexerClient, balanceManagerId: string, params?: TradesParams, options?: IterateOptions): AsyncGenerator<Trade>;
@@ -0,0 +1,26 @@
1
+ import { BalancesAtHubParams, CollectionHub, DiscoveryFilters, DiscoveryResult, FillsPage, FillsParams, HistoryPageParams, HubItemsPage, HubLocation, HubVaultInfo, InventoryBalances, OpenOrdersPage, Orderbook, PoolMetadata, Sweepable, TradesPage, TradesParams } from './types';
2
+ export declare class IndexerClient {
3
+ private readonly baseUrl;
4
+ private readonly apiKey;
5
+ constructor(baseUrl: string, apiKey: string);
6
+ private get;
7
+ discovery(filters?: DiscoveryFilters): Promise<DiscoveryResult>;
8
+ resolvePool(params: {
9
+ collectionId: string;
10
+ assetId: string;
11
+ quoteType?: string;
12
+ }): Promise<string | null>;
13
+ orderbook(poolId: string): Promise<Orderbook>;
14
+ poolMetadata(poolId: string): Promise<PoolMetadata>;
15
+ hubVault(hubId: string): Promise<HubVaultInfo>;
16
+ hubLocation(hubId: string): Promise<HubLocation | null>;
17
+ hubItems(hubId: string): Promise<HubItemsPage>;
18
+ collectionHub(collectionId: string): Promise<CollectionHub>;
19
+ inventoryBalances(params: BalancesAtHubParams & {
20
+ balanceManagerId?: string;
21
+ }): Promise<InventoryBalances>;
22
+ openOrders(balanceManagerId: string, params?: HistoryPageParams): Promise<OpenOrdersPage>;
23
+ fills(balanceManagerId: string, params?: FillsParams): Promise<FillsPage>;
24
+ sweepable(balanceManagerId: string): Promise<Sweepable>;
25
+ trades(balanceManagerId: string, params?: TradesParams): Promise<TradesPage>;
26
+ }