@defillama/sdk 5.0.236 → 5.0.240
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/package.json +3 -3
- package/build/Balances.d.ts +0 -139
- package/build/Balances.js +0 -363
- package/build/ChainApi.d.ts +0 -142
- package/build/ChainApi.js +0 -297
- package/build/abi/abi2.d.ts +0 -5
- package/build/abi/abi2.js +0 -215
- package/build/abi/cachedABIs.d.ts +0 -4
- package/build/abi/cachedABIs.js +0 -8
- package/build/abi/convertResults.d.ts +0 -5
- package/build/abi/convertResults.js +0 -60
- package/build/abi/index.d.ts +0 -31
- package/build/abi/index.js +0 -327
- package/build/abi/multicall.d.ts +0 -23
- package/build/abi/multicall.js +0 -382
- package/build/abi/multicall3.d.ts +0 -7
- package/build/abi/multicall3.js +0 -397
- package/build/abi/rpcCall.d.ts +0 -4
- package/build/abi/rpcCall.js +0 -62
- package/build/abi/tron.d.ts +0 -33
- package/build/abi/tron.js +0 -110
- package/build/api.d.ts +0 -10
- package/build/api.js +0 -45
- package/build/api2.d.ts +0 -5
- package/build/api2.js +0 -41
- package/build/chains/algorand.d.ts +0 -277
- package/build/chains/algorand.js +0 -618
- package/build/chains/aptos.d.ts +0 -230
- package/build/chains/aptos.js +0 -612
- package/build/chains/cardano.d.ts +0 -242
- package/build/chains/cardano.js +0 -407
- package/build/chains/cosmos.d.ts +0 -252
- package/build/chains/cosmos.js +0 -618
- package/build/chains/icp.d.ts +0 -235
- package/build/chains/icp.js +0 -1040
- package/build/chains/index.d.ts +0 -23
- package/build/chains/index.js +0 -59
- package/build/chains/near.d.ts +0 -192
- package/build/chains/near.js +0 -446
- package/build/chains/rpc.d.ts +0 -125
- package/build/chains/rpc.js +0 -326
- package/build/chains/starknet.d.ts +0 -205
- package/build/chains/starknet.js +0 -884
- package/build/chains/stellar.d.ts +0 -410
- package/build/chains/stellar.js +0 -1082
- package/build/chains/substrate.d.ts +0 -333
- package/build/chains/substrate.js +0 -1042
- package/build/chains/sui.d.ts +0 -365
- package/build/chains/sui.js +0 -1135
- package/build/chains/svm.d.ts +0 -340
- package/build/chains/svm.js +0 -760
- package/build/chains/tezos.d.ts +0 -225
- package/build/chains/tezos.js +0 -412
- package/build/chains/ton.d.ts +0 -353
- package/build/chains/ton.js +0 -788
- package/build/chains/tron.d.ts +0 -45
- package/build/chains/tron.js +0 -110
- package/build/chains/utxo.d.ts +0 -202
- package/build/chains/utxo.js +0 -592
- package/build/chains/xrpl.d.ts +0 -179
- package/build/chains/xrpl.js +0 -467
- package/build/computeTVL/blocks.d.ts +0 -1
- package/build/computeTVL/blocks.js +0 -12
- package/build/computeTVL/humanizeNumber.d.ts +0 -1
- package/build/computeTVL/humanizeNumber.js +0 -19
- package/build/erc20/index.d.ts +0 -31
- package/build/erc20/index.js +0 -56
- package/build/eth/index.d.ts +0 -22
- package/build/eth/index.js +0 -118
- package/build/general.d.ts +0 -5
- package/build/general.js +0 -20
- package/build/generalUtil.d.ts +0 -8
- package/build/generalUtil.js +0 -73
- package/build/index.d.ts +0 -32
- package/build/index.js +0 -74
- package/build/providers.json +0 -1
- package/build/types.d.ts +0 -76
- package/build/types.js +0 -2
- package/build/util/LlamaProvider.d.ts +0 -46
- package/build/util/LlamaProvider.js +0 -365
- package/build/util/blocks.d.ts +0 -36
- package/build/util/blocks.js +0 -292
- package/build/util/cache.d.ts +0 -45
- package/build/util/cache.js +0 -309
- package/build/util/chainUtils/data.json +0 -1356
- package/build/util/chainUtils/index.d.ts +0 -11
- package/build/util/chainUtils/index.js +0 -136
- package/build/util/coins.d.ts +0 -19
- package/build/util/coins.js +0 -113
- package/build/util/common.d.ts +0 -34
- package/build/util/common.js +0 -373
- package/build/util/computeTVL.d.ts +0 -19
- package/build/util/computeTVL.js +0 -102
- package/build/util/cosmos.d.ts +0 -1
- package/build/util/cosmos.js +0 -8
- package/build/util/debugLog.d.ts +0 -4
- package/build/util/debugLog.js +0 -18
- package/build/util/discord.d.ts +0 -1
- package/build/util/discord.js +0 -33
- package/build/util/elastic.d.ts +0 -43
- package/build/util/elastic.js +0 -113
- package/build/util/env.d.ts +0 -19
- package/build/util/env.js +0 -158
- package/build/util/graph.d.ts +0 -8
- package/build/util/graph.js +0 -50
- package/build/util/index.d.ts +0 -32
- package/build/util/index.js +0 -227
- package/build/util/indexer.compatibility.d.ts +0 -6
- package/build/util/indexer.compatibility.js +0 -64
- package/build/util/indexer.d.ts +0 -92
- package/build/util/indexer.js +0 -744
- package/build/util/indexerSql.d.ts +0 -9
- package/build/util/indexerSql.js +0 -102
- package/build/util/internal-cache.d.ts +0 -11
- package/build/util/internal-cache.js +0 -77
- package/build/util/logs.d.ts +0 -55
- package/build/util/logs.decode.shared.d.ts +0 -8
- package/build/util/logs.decode.shared.js +0 -289
- package/build/util/logs.js +0 -401
- package/build/util/promisePool.d.ts +0 -8
- package/build/util/promisePool.js +0 -31
- package/build/util/r2.d.ts +0 -4
- package/build/util/r2.js +0 -52
- package/build/util/removeRedundantRPCs.d.ts +0 -1
- package/build/util/removeRedundantRPCs.js +0 -49
- package/build/util/transactions.d.ts +0 -35
- package/build/util/transactions.js +0 -22
- package/build/util/updateChainLabels.d.ts +0 -1
- package/build/util/updateChainLabels.js +0 -5
- package/build/util/updateProviderList.d.ts +0 -1
- package/build/util/updateProviderList.js +0 -274
package/build/chains/sui.d.ts
DELETED
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sui (GraphQL RPC + hand-rolled BCS codec) and IOTA (Sui fork, JSON-RPC) client.
|
|
3
|
-
*
|
|
4
|
-
* Replaces / consolidates:
|
|
5
|
-
* - DefiLlama-Adapters `projects/helper/chain/sui.js` (BCS codec, GraphQL object / event /
|
|
6
|
-
* dynamic-field readers, `devInspectTransactionBlock`, `getInitialSharedVersion`, `getTokenSupply`,
|
|
7
|
-
* `normalizeCoinType`; the TVL-specific `dexExport` / `sumTokens` are intentionally not ported)
|
|
8
|
-
* - DefiLlama-Adapters `projects/helper/chain/iota.js` (IOTA JSON-RPC `call` / `getObject` / `getObjects`)
|
|
9
|
-
* - defillama-server `coins/src/adapters/utils/sui.ts` (`getAllBalances`, `getTokenInfo`, `queryEvents`, `getObjects`)
|
|
10
|
-
* - peggedassets-server `src/adapters/peggedAssets/helper/sui.ts` (`getDynamicFieldObject` with `nameBcs`, `EMPTY_STRUCT_BCS`)
|
|
11
|
-
* - dimension-adapters `helpers/sui.ts` (`graphqlCall` retry, windowed `queryEvents`, `eventModule` filter, `toParsedJson`)
|
|
12
|
-
*
|
|
13
|
-
* Endpoints: `SUI_GRAPH_RPC` (GraphQL, default `https://graphql.mainnet.sui.io/graphql`), `SUI_RPC`
|
|
14
|
-
* (JSON-RPC, default `https://sui-rpc.publicnode.com`) and `IOTA_RPC` (default `https://api.mainnet.iota.cafe`).
|
|
15
|
-
* Chains without a GraphQL endpoint (iota) transparently fall back to JSON-RPC for the reader helpers.
|
|
16
|
-
*
|
|
17
|
-
* Usage: `sdk.chains.sui.getObject({ objectId: '0x6' })`, `sdk.chains.sui.call({ chain: 'iota', method: 'iota_getLatestCheckpointSequenceNumber', params: [] })`
|
|
18
|
-
*
|
|
19
|
-
* Refs: https://docs.sui.io/concepts/data-access/graphql-rpc, https://docs.sui.io/develop/accessing-data/json-rpc-migration#method-mapping
|
|
20
|
-
*/
|
|
21
|
-
import { sliceIntoChunks } from "./rpc";
|
|
22
|
-
export declare const suiChains: string[];
|
|
23
|
-
export declare const DEFAULT_GRAPHQL_ENDPOINTS: Record<string, string>;
|
|
24
|
-
export declare const DEFAULT_RPC_ENDPOINTS: Record<string, string>;
|
|
25
|
-
export declare const DUMMY_SENDER: string;
|
|
26
|
-
/** BCS of a Move struct whose only member is `dummy_field: bool` (Wormhole-style `Key<T>` witness structs) */
|
|
27
|
-
export declare const EMPTY_STRUCT_BCS = "AA==";
|
|
28
|
-
export interface ChainOptions {
|
|
29
|
-
/** 'sui' (default) or 'iota' */
|
|
30
|
-
chain?: string;
|
|
31
|
-
}
|
|
32
|
-
export declare function getGraphqlEndpoints({ chain }?: ChainOptions): string[];
|
|
33
|
-
export declare function getGraphqlEndpoint(options?: ChainOptions): string;
|
|
34
|
-
export declare function getRpcEndpoints({ chain }?: ChainOptions): string[];
|
|
35
|
-
export declare function getRpcEndpoint(options?: ChainOptions): string;
|
|
36
|
-
/** true when the chain has a GraphQL endpoint (built-in default or `<CHAIN>_GRAPH_RPC`) */
|
|
37
|
-
export declare function hasGraphql(chain?: string): boolean;
|
|
38
|
-
export type Bytes = number[] | Uint8Array;
|
|
39
|
-
export type IntLike = number | string | bigint;
|
|
40
|
-
/** Hex string (with or without 0x) to a fixed-size byte array, left padded with zeros. Default size is a 32 byte address. */
|
|
41
|
-
export declare function hexToBytes(hex: string, size?: number): number[];
|
|
42
|
-
export declare function bytesToHex(bytes: Bytes): string;
|
|
43
|
-
export declare function textToBytes(value: string): number[];
|
|
44
|
-
export declare function bytesToBase64(bytes: Bytes): string;
|
|
45
|
-
export declare function base64ToBytes(value: string): number[];
|
|
46
|
-
export declare function uleb128Encode(value: IntLike): number[];
|
|
47
|
-
/** Decode a uleb128 at `offset`; returns the value and how many bytes it consumed. */
|
|
48
|
-
export declare function uleb128Decode(data: Bytes, offset?: number): {
|
|
49
|
-
value: number;
|
|
50
|
-
length: number;
|
|
51
|
-
};
|
|
52
|
-
/** Alias kept for parity with the adapters helper */
|
|
53
|
-
export declare const uleb128: typeof uleb128Encode;
|
|
54
|
-
export declare function toLittleEndian(value: IntLike, size: number): number[];
|
|
55
|
-
export declare const toU16: (value: IntLike) => number[];
|
|
56
|
-
export declare const toU32: (value: IntLike) => number[];
|
|
57
|
-
export declare const toU64: (value: IntLike) => number[];
|
|
58
|
-
export declare const toU128: (value: IntLike) => number[];
|
|
59
|
-
export declare const toU256: (value: IntLike) => number[];
|
|
60
|
-
export declare function fromLittleEndian(data: Bytes, offset?: number, size?: number): bigint;
|
|
61
|
-
export declare const fromU16: (data: Bytes, offset?: number) => bigint;
|
|
62
|
-
export declare const fromU32: (data: Bytes, offset?: number) => bigint;
|
|
63
|
-
export declare const fromU64: (data: Bytes, offset?: number) => bigint;
|
|
64
|
-
export declare const fromU128: (data: Bytes, offset?: number) => bigint;
|
|
65
|
-
export declare const fromU256: (data: Bytes, offset?: number) => bigint;
|
|
66
|
-
/** Lower-cased, 0x-prefixed, zero padded 64 hex char address */
|
|
67
|
-
export declare function normalizeSuiAddress(address: string): string;
|
|
68
|
-
/**
|
|
69
|
-
* GraphQL returns coin types with the address zero padded to 64 hex chars (0x000...002::sui::SUI)
|
|
70
|
-
* while configs commonly use the short form (0x2::sui::SUI); this maps both to the padded form.
|
|
71
|
-
*/
|
|
72
|
-
export declare function normalizeCoinType(coinType: string): string;
|
|
73
|
-
/** Split a comma separated generic argument list, respecting nested `<...>` */
|
|
74
|
-
export declare function splitTypeArgs(value: string): string[];
|
|
75
|
-
export interface StructTag {
|
|
76
|
-
address: string;
|
|
77
|
-
module: string;
|
|
78
|
-
name: string;
|
|
79
|
-
typeParams: string[];
|
|
80
|
-
}
|
|
81
|
-
export declare function parseStructTag(type: string): StructTag;
|
|
82
|
-
/** BCS `TypeTag` */
|
|
83
|
-
export declare function typeTagToBytes(type: string): number[];
|
|
84
|
-
export interface SharedObjectRef {
|
|
85
|
-
objectId: string;
|
|
86
|
-
initialSharedVersion: IntLike;
|
|
87
|
-
mutable?: boolean;
|
|
88
|
-
}
|
|
89
|
-
export type MoveCallArgument = number | {
|
|
90
|
-
Input?: number;
|
|
91
|
-
input?: number;
|
|
92
|
-
};
|
|
93
|
-
export interface MoveCallParams {
|
|
94
|
-
packageId: string;
|
|
95
|
-
module: string;
|
|
96
|
-
functionName: string;
|
|
97
|
-
typeArguments?: string[];
|
|
98
|
-
/** shared objects become the transaction inputs, in order */
|
|
99
|
-
sharedObjects?: SharedObjectRef[];
|
|
100
|
-
/** defaults to one `Input(i)` per shared object */
|
|
101
|
-
arguments?: MoveCallArgument[];
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* BCS `TransactionKind::ProgrammableTransaction` with a single `MoveCall` command whose inputs are
|
|
105
|
-
* shared objects (enough for read-only view functions inspected through `devInspectTransactionBlock`).
|
|
106
|
-
*/
|
|
107
|
-
export declare function buildProgrammableMoveCallBytes({ packageId, module, functionName, typeArguments, sharedObjects, arguments: moveArguments }: MoveCallParams): Uint8Array;
|
|
108
|
-
export interface TransactionDataOptions {
|
|
109
|
-
sender?: string;
|
|
110
|
-
gasPrice?: IntLike;
|
|
111
|
-
gasBudget?: IntLike;
|
|
112
|
-
}
|
|
113
|
-
/** BCS `TransactionData::V1` wrapping `kindBytes` with dummy gas data (gas payment left empty for `doGasSelection`) */
|
|
114
|
-
export declare function buildTransactionDataBytes(kindBytes: Bytes, { sender, gasPrice, gasBudget }?: TransactionDataOptions): Uint8Array;
|
|
115
|
-
/** BCS (base64) of a dynamic field name of the given Move type */
|
|
116
|
-
export declare function bcsDynamicFieldName(nameType: string, value: any): string;
|
|
117
|
-
export interface SuiObject {
|
|
118
|
-
/** object address (from the query key, or the UID inside `fields.id`) */
|
|
119
|
-
id?: string;
|
|
120
|
-
type: string;
|
|
121
|
-
fields: any;
|
|
122
|
-
dataType: 'moveObject';
|
|
123
|
-
/** dynamic field key (`name.json`) when read via `getDynamicFieldObject(s)` */
|
|
124
|
-
name?: any;
|
|
125
|
-
version?: number | string;
|
|
126
|
-
owner?: any;
|
|
127
|
-
[key: string]: any;
|
|
128
|
-
}
|
|
129
|
-
/** Mirror the JSON-RPC type display: strip leading zeros from addresses, but keep a single leading zero on 64-char addresses */
|
|
130
|
-
export declare function shortenTypeAddresses(type: string): string;
|
|
131
|
-
/**
|
|
132
|
-
* Shape GraphQL `MoveObject.contents` / `MoveValue` (`{ json, type: { repr, layout? } }`) like the
|
|
133
|
-
* JSON-RPC `content` (`{ dataType, type, fields }`), nested structs wrapped as `{ type, fields }`.
|
|
134
|
-
* With a layout, Option / TypeName / UID / ID / String are rewrapped exactly; without it (`skipLayout`)
|
|
135
|
-
* only the generic struct wrapping is applied.
|
|
136
|
-
*/
|
|
137
|
-
export declare function formatObject(contents: any, address?: string): SuiObject | null;
|
|
138
|
-
/** Prefix a bare hex object id with 0x */
|
|
139
|
-
export declare function toAddr(id: string): string;
|
|
140
|
-
/** Shape GraphQL `json` like the JSON-RPC `parsedJson` of an event (TypeName -> `{ name }`, String / ID unwrapped, UID -> `{ id }`) */
|
|
141
|
-
export declare function toParsedJson(value: any, layout: any): any;
|
|
142
|
-
export declare class SuiGraphqlError extends Error {
|
|
143
|
-
errors: any[];
|
|
144
|
-
constructor(message: string, errors?: any[]);
|
|
145
|
-
}
|
|
146
|
-
export interface GraphqlCallOptions extends ChainOptions {
|
|
147
|
-
query: string;
|
|
148
|
-
variables?: Record<string, any>;
|
|
149
|
-
/** total attempts, default 3 (at least one per endpoint) */
|
|
150
|
-
retries?: number;
|
|
151
|
-
timeout?: number;
|
|
152
|
-
}
|
|
153
|
-
/** POST a GraphQL query; returns `data`, throws `SuiGraphqlError` on `errors` / empty data. Rotates endpoints and retries. */
|
|
154
|
-
export declare function graphqlCall({ chain, query, variables, retries, timeout }: GraphqlCallOptions): Promise<any>;
|
|
155
|
-
export interface CallOptions extends ChainOptions {
|
|
156
|
-
method: string;
|
|
157
|
-
params?: any;
|
|
158
|
-
retries?: number;
|
|
159
|
-
timeout?: number;
|
|
160
|
-
}
|
|
161
|
-
/** Raw JSON-RPC call (`sui_*` / `suix_*` / `iota_*` / `iotax_*`); returns `result` */
|
|
162
|
-
export declare function call({ chain, method, params, retries, timeout }: CallOptions): Promise<any>;
|
|
163
|
-
export interface RpcGetObjectOptions extends ChainOptions {
|
|
164
|
-
objectId: string;
|
|
165
|
-
}
|
|
166
|
-
/** `<prefix>_getObject` shaped like `getObject` (`{ id, type, fields, dataType, version, owner }`), null when missing */
|
|
167
|
-
export declare function rpcGetObject({ chain, objectId }: RpcGetObjectOptions): Promise<SuiObject | null>;
|
|
168
|
-
export interface RpcGetObjectsOptions extends ChainOptions {
|
|
169
|
-
objectIds: string[];
|
|
170
|
-
}
|
|
171
|
-
/** `<prefix>_multiGetObjects` in chunks of 9, order preserving (null for missing objects) */
|
|
172
|
-
export declare function rpcGetObjects({ chain, objectIds }: RpcGetObjectsOptions): Promise<(SuiObject | null)[]>;
|
|
173
|
-
export interface GetObjectOptions extends ChainOptions {
|
|
174
|
-
objectId: string;
|
|
175
|
-
/** drop the layout blob (~3.5x the json payload); only safe when reading plain fields */
|
|
176
|
-
skipLayout?: boolean;
|
|
177
|
-
}
|
|
178
|
-
/** Move object contents shaped like the JSON-RPC `content` (`{ id, type, fields, dataType }`), null when missing */
|
|
179
|
-
export declare function getObject({ chain, objectId, skipLayout }: GetObjectOptions): Promise<SuiObject | null>;
|
|
180
|
-
export interface GetObjectsOptions extends ChainOptions {
|
|
181
|
-
objectIds: string[];
|
|
182
|
-
skipLayout?: boolean;
|
|
183
|
-
/** parallel chunks of 50, default 5 */
|
|
184
|
-
concurrency?: number;
|
|
185
|
-
/** ms to wait between chunks (forces sequential chunks) */
|
|
186
|
-
sleep?: number;
|
|
187
|
-
}
|
|
188
|
-
/** `multiGetObjects` in chunks of 50, order preserving (null for missing objects) */
|
|
189
|
-
export declare function getObjects({ chain, objectIds, skipLayout, concurrency, sleep: sleepTime }: GetObjectsOptions): Promise<(SuiObject | null)[]>;
|
|
190
|
-
export interface GetObjectsByTypeOptions<T = SuiObject> extends ChainOptions {
|
|
191
|
-
type: string;
|
|
192
|
-
owner?: string;
|
|
193
|
-
skipLayout?: boolean;
|
|
194
|
-
/** stop after this many objects */
|
|
195
|
-
limit?: number;
|
|
196
|
-
transform?: (obj: SuiObject) => T;
|
|
197
|
-
}
|
|
198
|
-
/** All live objects of a Move type (optionally owned by `owner`), walking every page */
|
|
199
|
-
export declare function getObjectsByType<T = SuiObject>({ chain, type, owner, skipLayout, limit, transform }: GetObjectsByTypeOptions<T>): Promise<T[]>;
|
|
200
|
-
export interface GetOwnedObjectsOptions<T = SuiObject> extends ChainOptions {
|
|
201
|
-
owner: string;
|
|
202
|
-
/** struct type filter, e.g. `0x2::coin::Coin` */
|
|
203
|
-
type?: string;
|
|
204
|
-
skipLayout?: boolean;
|
|
205
|
-
limit?: number;
|
|
206
|
-
transform?: (obj: SuiObject) => T;
|
|
207
|
-
}
|
|
208
|
-
/** Objects owned by an address, walking every page */
|
|
209
|
-
export declare function getOwnedObjects<T = SuiObject>({ chain, owner, type, skipLayout, limit, transform }: GetOwnedObjectsOptions<T>): Promise<T[]>;
|
|
210
|
-
export interface SuiEvent {
|
|
211
|
-
type: string;
|
|
212
|
-
/** unix seconds */
|
|
213
|
-
timestamp: number;
|
|
214
|
-
sender?: string;
|
|
215
|
-
/** parsed event payload */
|
|
216
|
-
json: any;
|
|
217
|
-
}
|
|
218
|
-
export interface QueryEventsOptions<T = any> extends ChainOptions {
|
|
219
|
-
/** full event struct type, e.g. `0x...::pool::SwapEvent` */
|
|
220
|
-
eventType?: string;
|
|
221
|
-
/** emitting module, `package::module` or `{ package, module }` */
|
|
222
|
-
eventModule?: string | {
|
|
223
|
-
package: string;
|
|
224
|
-
module: string;
|
|
225
|
-
};
|
|
226
|
-
sender?: string;
|
|
227
|
-
/** unix seconds, inclusive. With a window the newest events are walked backwards until `startTimestamp`. */
|
|
228
|
-
startTimestamp?: number;
|
|
229
|
-
/** unix seconds, exclusive */
|
|
230
|
-
endTimestamp?: number;
|
|
231
|
-
/** stop after this many events */
|
|
232
|
-
limit?: number;
|
|
233
|
-
/** return raw `json` without the layout based `parsedJson` shaping (smaller responses) */
|
|
234
|
-
skipLayout?: boolean;
|
|
235
|
-
/** return `{ type, timestamp, sender, json }` instead of the bare payload */
|
|
236
|
-
withMetadata?: boolean;
|
|
237
|
-
transform?: (item: any) => T;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Events matching a type / module / sender filter, cursor walking all pages (oldest first).
|
|
241
|
-
* With `startTimestamp` / `endTimestamp` the newest events are walked backwards and only the
|
|
242
|
-
* half-open window `[start, end)` is returned (as dimension-adapters did).
|
|
243
|
-
*/
|
|
244
|
-
export declare function queryEvents<T = any>(options: QueryEventsOptions<T>): Promise<T[]>;
|
|
245
|
-
export interface GetDynamicFieldObjectOptions extends ChainOptions {
|
|
246
|
-
parent: string;
|
|
247
|
-
/** field name value (alias: `id`) */
|
|
248
|
-
name?: any;
|
|
249
|
-
id?: any;
|
|
250
|
-
/** Move type of the name (alias: `idType`), default `0x2::object::ID` */
|
|
251
|
-
nameType?: string;
|
|
252
|
-
idType?: string;
|
|
253
|
-
/** pre-encoded BCS (base64) of the name; overrides `name`. Defaults to `EMPTY_STRUCT_BCS` when no name is given. */
|
|
254
|
-
nameBcs?: string;
|
|
255
|
-
skipLayout?: boolean;
|
|
256
|
-
}
|
|
257
|
-
/** One dynamic field (or dynamic object field) of `parent` by name; null when missing */
|
|
258
|
-
export declare function getDynamicFieldObject({ chain, parent, name, id, nameType, idType, nameBcs, skipLayout }: GetDynamicFieldObjectOptions): Promise<SuiObject | null>;
|
|
259
|
-
export interface DynamicFieldFilterInput {
|
|
260
|
-
objectId: string;
|
|
261
|
-
objectType: string;
|
|
262
|
-
/** `fields.name` of the value, when present */
|
|
263
|
-
name?: any;
|
|
264
|
-
/** the dynamic field key (`name.json`) */
|
|
265
|
-
key?: any;
|
|
266
|
-
}
|
|
267
|
-
export interface GetDynamicFieldObjectsOptions extends ChainOptions {
|
|
268
|
-
parent: string;
|
|
269
|
-
/** resume from this cursor */
|
|
270
|
-
cursor?: string | null;
|
|
271
|
-
/** stop after this many objects (all pages by default) */
|
|
272
|
-
limit?: number;
|
|
273
|
-
/** page size, max 50 */
|
|
274
|
-
pageSize?: number;
|
|
275
|
-
idFilter?: (input: DynamicFieldFilterInput) => any;
|
|
276
|
-
skipLayout?: boolean;
|
|
277
|
-
/** ms to wait before each page */
|
|
278
|
-
sleep?: number;
|
|
279
|
-
/** receive each page as it arrives; the return value is then empty */
|
|
280
|
-
onPage?: (items: SuiObject[]) => any;
|
|
281
|
-
}
|
|
282
|
-
/** All dynamic fields of `parent` (Table / Bag / ObjectTable entries), walking every page. Each item carries `name` (the field key). */
|
|
283
|
-
export declare function getDynamicFieldObjects({ chain, parent, cursor, limit, pageSize, idFilter, skipLayout, sleep: sleepTime, onPage }: GetDynamicFieldObjectsOptions): Promise<SuiObject[]>;
|
|
284
|
-
export interface CoinTypeOptions extends ChainOptions {
|
|
285
|
-
coinType: string;
|
|
286
|
-
}
|
|
287
|
-
export interface CoinMetadata {
|
|
288
|
-
decimals: number;
|
|
289
|
-
symbol: string;
|
|
290
|
-
name: string;
|
|
291
|
-
description?: string;
|
|
292
|
-
iconUrl?: string;
|
|
293
|
-
/** total supply in base units, when the endpoint knows it */
|
|
294
|
-
supply?: string;
|
|
295
|
-
}
|
|
296
|
-
/** `coinMetadata` (GraphQL) or `<prefix>x_getCoinMetadata` + `<prefix>x_getTotalSupply` (JSON-RPC) */
|
|
297
|
-
export declare function getCoinMetadata({ chain, coinType }: CoinTypeOptions): Promise<CoinMetadata>;
|
|
298
|
-
export interface TokenSupply {
|
|
299
|
-
/** base units */
|
|
300
|
-
supply: string;
|
|
301
|
-
decimals: number;
|
|
302
|
-
/** supply / 10 ** decimals */
|
|
303
|
-
normalized: number;
|
|
304
|
-
}
|
|
305
|
-
export declare function getTokenSupply({ chain, coinType }: CoinTypeOptions): Promise<TokenSupply>;
|
|
306
|
-
export interface OwnerOptions extends ChainOptions {
|
|
307
|
-
owner: string;
|
|
308
|
-
}
|
|
309
|
-
export interface CoinBalance {
|
|
310
|
-
/** zero padded coin type as returned by GraphQL */
|
|
311
|
-
coinType: string;
|
|
312
|
-
totalBalance: string;
|
|
313
|
-
}
|
|
314
|
-
/** Every coin balance of `owner`, walking all pages */
|
|
315
|
-
export declare function getAllBalances({ chain, owner }: OwnerOptions): Promise<CoinBalance[]>;
|
|
316
|
-
export interface GetBalanceOptions extends OwnerOptions {
|
|
317
|
-
coinType: string;
|
|
318
|
-
}
|
|
319
|
-
/** Balance of one coin type for `owner` (base units, '0' when none) */
|
|
320
|
-
export declare function getBalance({ chain, owner, coinType }: GetBalanceOptions): Promise<string>;
|
|
321
|
-
export interface Checkpoint {
|
|
322
|
-
sequenceNumber: number;
|
|
323
|
-
/** unix seconds */
|
|
324
|
-
timestamp: number;
|
|
325
|
-
digest?: string;
|
|
326
|
-
}
|
|
327
|
-
export interface GetCheckpointOptions extends ChainOptions {
|
|
328
|
-
sequenceNumber: number | string;
|
|
329
|
-
}
|
|
330
|
-
/** A checkpoint by sequence number; null when the endpoint no longer has it */
|
|
331
|
-
export declare function getCheckpoint({ chain, sequenceNumber }: GetCheckpointOptions): Promise<Checkpoint | null>;
|
|
332
|
-
export declare function getLatestCheckpoint({ chain }?: ChainOptions): Promise<Checkpoint>;
|
|
333
|
-
export interface GetCheckpointAtTimestampOptions extends ChainOptions {
|
|
334
|
-
/** unix seconds */
|
|
335
|
-
timestamp: number;
|
|
336
|
-
}
|
|
337
|
-
/** Last checkpoint with `timestamp <= target` (binary search over sequence numbers, ~30 requests) */
|
|
338
|
-
export declare function getCheckpointAtTimestamp({ chain, timestamp }: GetCheckpointAtTimestampOptions): Promise<Checkpoint>;
|
|
339
|
-
export interface DevInspectOptions extends ChainOptions {
|
|
340
|
-
/** BCS `TransactionKind` bytes, e.g. from `buildProgrammableMoveCallBytes` */
|
|
341
|
-
txBytes: Bytes;
|
|
342
|
-
sender?: string;
|
|
343
|
-
}
|
|
344
|
-
export interface DevInspectResult {
|
|
345
|
-
/** per command: `[bcsBytes, typeRepr]` per return value */
|
|
346
|
-
results: {
|
|
347
|
-
returnValues: [number[], string | undefined][];
|
|
348
|
-
}[];
|
|
349
|
-
effects: any;
|
|
350
|
-
}
|
|
351
|
-
/** Simulate a transaction kind and return the BCS return values of every command (GraphQL `simulateTransaction`, JSON-RPC `devInspectTransactionBlock`) */
|
|
352
|
-
export declare function devInspectTransactionBlock({ chain, txBytes, sender }: DevInspectOptions): Promise<DevInspectResult>;
|
|
353
|
-
export interface GetInitialSharedVersionOptions extends ChainOptions {
|
|
354
|
-
objectId: string;
|
|
355
|
-
}
|
|
356
|
-
/** `initialSharedVersion` of a shared object (needed to reference it as a transaction input) */
|
|
357
|
-
export declare function getInitialSharedVersion({ chain, objectId }: GetInitialSharedVersionOptions): Promise<number>;
|
|
358
|
-
export interface ViewFunctionOptions extends ChainOptions, Omit<MoveCallParams, 'sharedObjects'> {
|
|
359
|
-
/** shared object ids (or refs); `initialSharedVersion` is looked up when missing */
|
|
360
|
-
sharedObjects?: (string | SharedObjectRef)[];
|
|
361
|
-
sender?: string;
|
|
362
|
-
}
|
|
363
|
-
/** Build a single MoveCall over shared objects, simulate it and return `[bcsBytes, typeRepr]` per return value */
|
|
364
|
-
export declare function callViewFunction({ chain, sharedObjects, sender, ...moveCall }: ViewFunctionOptions): Promise<[number[], string | undefined][]>;
|
|
365
|
-
export { sliceIntoChunks };
|