@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.
Files changed (131) hide show
  1. package/package.json +3 -3
  2. package/build/Balances.d.ts +0 -139
  3. package/build/Balances.js +0 -363
  4. package/build/ChainApi.d.ts +0 -142
  5. package/build/ChainApi.js +0 -297
  6. package/build/abi/abi2.d.ts +0 -5
  7. package/build/abi/abi2.js +0 -215
  8. package/build/abi/cachedABIs.d.ts +0 -4
  9. package/build/abi/cachedABIs.js +0 -8
  10. package/build/abi/convertResults.d.ts +0 -5
  11. package/build/abi/convertResults.js +0 -60
  12. package/build/abi/index.d.ts +0 -31
  13. package/build/abi/index.js +0 -327
  14. package/build/abi/multicall.d.ts +0 -23
  15. package/build/abi/multicall.js +0 -382
  16. package/build/abi/multicall3.d.ts +0 -7
  17. package/build/abi/multicall3.js +0 -397
  18. package/build/abi/rpcCall.d.ts +0 -4
  19. package/build/abi/rpcCall.js +0 -62
  20. package/build/abi/tron.d.ts +0 -33
  21. package/build/abi/tron.js +0 -110
  22. package/build/api.d.ts +0 -10
  23. package/build/api.js +0 -45
  24. package/build/api2.d.ts +0 -5
  25. package/build/api2.js +0 -41
  26. package/build/chains/algorand.d.ts +0 -277
  27. package/build/chains/algorand.js +0 -618
  28. package/build/chains/aptos.d.ts +0 -230
  29. package/build/chains/aptos.js +0 -612
  30. package/build/chains/cardano.d.ts +0 -242
  31. package/build/chains/cardano.js +0 -407
  32. package/build/chains/cosmos.d.ts +0 -252
  33. package/build/chains/cosmos.js +0 -618
  34. package/build/chains/icp.d.ts +0 -235
  35. package/build/chains/icp.js +0 -1040
  36. package/build/chains/index.d.ts +0 -23
  37. package/build/chains/index.js +0 -59
  38. package/build/chains/near.d.ts +0 -192
  39. package/build/chains/near.js +0 -446
  40. package/build/chains/rpc.d.ts +0 -125
  41. package/build/chains/rpc.js +0 -326
  42. package/build/chains/starknet.d.ts +0 -205
  43. package/build/chains/starknet.js +0 -884
  44. package/build/chains/stellar.d.ts +0 -410
  45. package/build/chains/stellar.js +0 -1082
  46. package/build/chains/substrate.d.ts +0 -333
  47. package/build/chains/substrate.js +0 -1042
  48. package/build/chains/sui.d.ts +0 -365
  49. package/build/chains/sui.js +0 -1135
  50. package/build/chains/svm.d.ts +0 -340
  51. package/build/chains/svm.js +0 -760
  52. package/build/chains/tezos.d.ts +0 -225
  53. package/build/chains/tezos.js +0 -412
  54. package/build/chains/ton.d.ts +0 -353
  55. package/build/chains/ton.js +0 -788
  56. package/build/chains/tron.d.ts +0 -45
  57. package/build/chains/tron.js +0 -110
  58. package/build/chains/utxo.d.ts +0 -202
  59. package/build/chains/utxo.js +0 -592
  60. package/build/chains/xrpl.d.ts +0 -179
  61. package/build/chains/xrpl.js +0 -467
  62. package/build/computeTVL/blocks.d.ts +0 -1
  63. package/build/computeTVL/blocks.js +0 -12
  64. package/build/computeTVL/humanizeNumber.d.ts +0 -1
  65. package/build/computeTVL/humanizeNumber.js +0 -19
  66. package/build/erc20/index.d.ts +0 -31
  67. package/build/erc20/index.js +0 -56
  68. package/build/eth/index.d.ts +0 -22
  69. package/build/eth/index.js +0 -118
  70. package/build/general.d.ts +0 -5
  71. package/build/general.js +0 -20
  72. package/build/generalUtil.d.ts +0 -8
  73. package/build/generalUtil.js +0 -73
  74. package/build/index.d.ts +0 -32
  75. package/build/index.js +0 -74
  76. package/build/providers.json +0 -1
  77. package/build/types.d.ts +0 -76
  78. package/build/types.js +0 -2
  79. package/build/util/LlamaProvider.d.ts +0 -46
  80. package/build/util/LlamaProvider.js +0 -365
  81. package/build/util/blocks.d.ts +0 -36
  82. package/build/util/blocks.js +0 -292
  83. package/build/util/cache.d.ts +0 -45
  84. package/build/util/cache.js +0 -309
  85. package/build/util/chainUtils/data.json +0 -1356
  86. package/build/util/chainUtils/index.d.ts +0 -11
  87. package/build/util/chainUtils/index.js +0 -136
  88. package/build/util/coins.d.ts +0 -19
  89. package/build/util/coins.js +0 -113
  90. package/build/util/common.d.ts +0 -34
  91. package/build/util/common.js +0 -373
  92. package/build/util/computeTVL.d.ts +0 -19
  93. package/build/util/computeTVL.js +0 -102
  94. package/build/util/cosmos.d.ts +0 -1
  95. package/build/util/cosmos.js +0 -8
  96. package/build/util/debugLog.d.ts +0 -4
  97. package/build/util/debugLog.js +0 -18
  98. package/build/util/discord.d.ts +0 -1
  99. package/build/util/discord.js +0 -33
  100. package/build/util/elastic.d.ts +0 -43
  101. package/build/util/elastic.js +0 -113
  102. package/build/util/env.d.ts +0 -19
  103. package/build/util/env.js +0 -158
  104. package/build/util/graph.d.ts +0 -8
  105. package/build/util/graph.js +0 -50
  106. package/build/util/index.d.ts +0 -32
  107. package/build/util/index.js +0 -227
  108. package/build/util/indexer.compatibility.d.ts +0 -6
  109. package/build/util/indexer.compatibility.js +0 -64
  110. package/build/util/indexer.d.ts +0 -92
  111. package/build/util/indexer.js +0 -744
  112. package/build/util/indexerSql.d.ts +0 -9
  113. package/build/util/indexerSql.js +0 -102
  114. package/build/util/internal-cache.d.ts +0 -11
  115. package/build/util/internal-cache.js +0 -77
  116. package/build/util/logs.d.ts +0 -55
  117. package/build/util/logs.decode.shared.d.ts +0 -8
  118. package/build/util/logs.decode.shared.js +0 -289
  119. package/build/util/logs.js +0 -401
  120. package/build/util/promisePool.d.ts +0 -8
  121. package/build/util/promisePool.js +0 -31
  122. package/build/util/r2.d.ts +0 -4
  123. package/build/util/r2.js +0 -52
  124. package/build/util/removeRedundantRPCs.d.ts +0 -1
  125. package/build/util/removeRedundantRPCs.js +0 -49
  126. package/build/util/transactions.d.ts +0 -35
  127. package/build/util/transactions.js +0 -22
  128. package/build/util/updateChainLabels.d.ts +0 -1
  129. package/build/util/updateChainLabels.js +0 -5
  130. package/build/util/updateProviderList.d.ts +0 -1
  131. package/build/util/updateProviderList.js +0 -274
@@ -1,340 +0,0 @@
1
- /** Built-in endpoints, overridable with `<CHAIN>_RPC` (also `SDK_` / `LLAMA_SDK_` prefixed). */
2
- export declare const DEFAULT_ENDPOINTS: Record<string, string>;
3
- export declare const svmChains: string[];
4
- export declare function isSvmChain(chain: string): boolean;
5
- export interface ChainOptions {
6
- /** chain key, default 'solana' */
7
- chain?: string;
8
- }
9
- export interface EndpointOptions extends ChainOptions {
10
- /** solana only: prefer `SOLANA_RPC_CLIENT` when set (mirrors adapters' getConnection) */
11
- isClient?: boolean;
12
- }
13
- /**
14
- * Endpoint list for a chain: `<CHAIN>_RPC` env wins, then `DEFAULT_ENDPOINTS`.
15
- * For solana with `isClient`, `SOLANA_RPC_CLIENT` is checked first.
16
- */
17
- export declare function getEndpoints({ chain, isClient }?: EndpointOptions): string[];
18
- export declare function getEndpoint(options?: EndpointOptions): string;
19
- export declare const TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
20
- export declare const TOKEN_2022_PROGRAM_ID = "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb";
21
- export declare const ASSOCIATED_TOKEN_PROGRAM_ID = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
22
- export declare const STAKE_PROGRAM_ID = "Stake11111111111111111111111111111111111111";
23
- export declare const SYSTEM_PROGRAM_ID = "11111111111111111111111111111111";
24
- export declare const SYSVAR_RENT_ID = "SysvarRent111111111111111111111111111111111";
25
- export declare const MINT_ACCOUNT_SIZE = 82;
26
- export declare const TOKEN_ACCOUNT_SIZE = 165;
27
- export declare const LAMPORTS_PER_SOL = 1000000000;
28
- /** Bitcoin-style base58 (leading zero bytes become leading '1's). */
29
- export declare function base58Encode(bytes: Uint8Array | Buffer): string;
30
- export declare function base58Decode(str: string): Uint8Array;
31
- export declare function isValidPublicKey(str: any): boolean;
32
- /** Little-endian u64 -> bigint, works on any Uint8Array (not only Buffer). */
33
- export declare function readBigUInt64LE(buffer: Uint8Array, offset?: number): bigint;
34
- /**
35
- * Fixed point I80F48 (signed i128, 48 fractional bits) -> number.
36
- * Accepts a bigint / decimal string, `{ val }` / `{ value }` wrappers (anchor BN
37
- * style) or the 16 little-endian bytes of the raw i128.
38
- */
39
- export declare function i80f48ToNumber(i80f48: {
40
- val?: bigint | string | number[] | Uint8Array;
41
- value?: any;
42
- } | bigint | string | number[] | Uint8Array): number;
43
- /** Little-endian I80F48 at `offset` (marginfi WrappedI80F48). */
44
- export declare function readI80F48(buf: Buffer, offset: number): number;
45
- export interface MintAccount {
46
- mintAuthority: string | null;
47
- supply: string;
48
- decimals: number;
49
- isInitialized: boolean;
50
- freezeAuthority: string | null;
51
- }
52
- export interface TokenAccount {
53
- mint: string;
54
- owner: string;
55
- amount: string;
56
- delegate: string | null;
57
- /** 0 uninitialized, 1 initialized, 2 frozen */
58
- state: number;
59
- isNative: string | null;
60
- delegatedAmount: string;
61
- closeAuthority: string | null;
62
- }
63
- /** Decode an SPL / Token-2022 mint account (first 82 bytes; extensions are ignored). */
64
- export declare function decodeMintAccount(buf: Buffer | Uint8Array): MintAccount;
65
- /** Decode an SPL / Token-2022 token account (first 165 bytes; extensions are ignored). */
66
- export declare function decodeTokenAccount(buf: Buffer | Uint8Array): TokenAccount;
67
- /**
68
- * Currently-effective UI multiplier of a Token-2022 mint with the ScaledUiAmount
69
- * extension, or 1 for a classic SPL mint / a mint without this extension.
70
- */
71
- export declare function readScaledUiMultiplier(data: Buffer, nowSeconds?: number): number;
72
- /** SPL stake pool: `total_lamports` u64 at offset 258, `pool_token_supply` u64 at 266. */
73
- export declare function decodeStakePool(buf: Buffer): {
74
- totalLamports: string;
75
- poolTokenSupply: string;
76
- };
77
- /** Read the 32-byte pubkey at `offset` of a base64 encoded account payload. */
78
- export declare function extractPubkey(base64Data: string, offset: number): string;
79
- /**
80
- * True when the 32 bytes decompress to a point on the ed25519 curve
81
- * (curve25519-dalek `CompressedEdwardsY::decompress` semantics). A PDA must be
82
- * off-curve so it can never have a private key.
83
- */
84
- export declare function isOnCurve(pubkey: string | Uint8Array | Buffer): boolean;
85
- /** True when PDA derivation is delegated to an installed `@solana/web3.js`. */
86
- export declare function usesWeb3js(): boolean;
87
- /** sha256(seeds || programId || "ProgramDerivedAddress"); throws when the result is on-curve. */
88
- export declare function createProgramAddress(seeds: (Buffer | Uint8Array | string)[], programId: string, bump?: number): string;
89
- /** Find the first off-curve address for `seeds`, walking bump 255 -> 0. */
90
- export declare function findProgramAddress(seeds: (Buffer | Uint8Array | string)[], programId: string): [string, number];
91
- export declare function getAssociatedTokenAddress({ mint, owner, programId, associatedTokenProgramId }: {
92
- mint: string;
93
- owner: string;
94
- programId?: string;
95
- associatedTokenProgramId?: string;
96
- }): string;
97
- export type Commitment = 'processed' | 'confirmed' | 'finalized';
98
- export type Encoding = 'base64' | 'base58' | 'base64+zstd' | 'jsonParsed';
99
- export interface AccountInfo<T = any> {
100
- lamports: number;
101
- owner: string;
102
- /** `[payload, encoding]` for binary encodings, an object for `jsonParsed` */
103
- data: T;
104
- executable: boolean;
105
- rentEpoch: number;
106
- space?: number;
107
- }
108
- export interface CallOptions extends ChainOptions {
109
- method: string;
110
- params?: any[];
111
- /** appended as `{ commitment }` to the last params object when set */
112
- commitment?: Commitment;
113
- timeout?: number;
114
- retries?: number;
115
- }
116
- /** Raw JSON-RPC call against the chain's endpoints (rate limited per chain, retried). */
117
- export declare function call({ chain, method, params, commitment, timeout, retries }: CallOptions): Promise<any>;
118
- export declare function getSlot({ chain, commitment }?: ChainOptions & {
119
- commitment?: Commitment;
120
- }): Promise<number>;
121
- export declare function getBlockTime({ chain, slot }: ChainOptions & {
122
- slot: number;
123
- }): Promise<number | null>;
124
- export declare function getBlockHeight({ chain, commitment }?: ChainOptions & {
125
- commitment?: Commitment;
126
- }): Promise<number>;
127
- /** Latest slot and its block time (walks back over skipped slots without a time). */
128
- export declare function getLatestBlock({ chain, commitment }?: ChainOptions & {
129
- commitment?: Commitment;
130
- }): Promise<{
131
- number: number;
132
- timestamp: number;
133
- }>;
134
- export declare function getEpochInfo({ chain, commitment }?: ChainOptions & {
135
- commitment?: Commitment;
136
- }): Promise<{
137
- absoluteSlot: number;
138
- blockHeight: number;
139
- epoch: number;
140
- slotIndex: number;
141
- slotsInEpoch: number;
142
- transactionCount?: number;
143
- }>;
144
- /** Lamport balance of a single account. */
145
- export declare function getBalance({ chain, account, commitment }: ChainOptions & {
146
- account: string;
147
- commitment?: Commitment;
148
- }): Promise<number>;
149
- /** Lamport balances of many accounts (batched `getMultipleAccounts`, 0 for missing accounts). */
150
- export declare function getBalances({ chain, accounts, commitment }: ChainOptions & {
151
- accounts: string[];
152
- commitment?: Commitment;
153
- }): Promise<number[]>;
154
- export declare function getAccountInfo({ chain, account, encoding, commitment, dataSlice }: ChainOptions & {
155
- account: string;
156
- encoding?: Encoding;
157
- commitment?: Commitment;
158
- dataSlice?: {
159
- offset: number;
160
- length: number;
161
- };
162
- }): Promise<AccountInfo | null>;
163
- /** Base64 payload of one account as a Buffer, or null when it does not exist. */
164
- export declare function getAccountBuffer({ chain, account, commitment }: ChainOptions & {
165
- account: string;
166
- commitment?: Commitment;
167
- }): Promise<Buffer | null>;
168
- export interface GetAccountsOptions extends ChainOptions {
169
- accounts: string[];
170
- encoding?: Encoding;
171
- commitment?: Commitment;
172
- dataSlice?: {
173
- offset: number;
174
- length: number;
175
- };
176
- /** accounts per `getMultipleAccounts` call, default 99 (public node max is 100) */
177
- chunkSize?: number;
178
- /** parallel chunks, default 5 */
179
- concurrency?: number;
180
- /** ms to wait between chunks when `concurrency` is 1 */
181
- sleepTime?: number;
182
- }
183
- /** Batched `getMultipleAccounts`; result is in input order with `null` for missing accounts. */
184
- export declare function getAccounts({ chain, accounts, encoding, commitment, dataSlice, chunkSize, concurrency, sleepTime }: GetAccountsOptions): Promise<(AccountInfo | null)[]>;
185
- /** Raw account payloads as Buffers, in input order (`null` for missing accounts). */
186
- export declare function getAccountBuffers(options: Omit<GetAccountsOptions, 'encoding'>): Promise<(Buffer | null)[]>;
187
- export interface ProgramAccount<T = any> {
188
- pubkey: string;
189
- account: AccountInfo<T>;
190
- }
191
- export interface GetProgramAccountsOptions extends ChainOptions {
192
- programId: string;
193
- filters?: ({
194
- memcmp: {
195
- offset: number;
196
- bytes: string;
197
- encoding?: string;
198
- };
199
- } | {
200
- dataSize: number;
201
- })[];
202
- encoding?: Encoding;
203
- dataSlice?: {
204
- offset: number;
205
- length: number;
206
- };
207
- commitment?: Commitment;
208
- withContext?: boolean;
209
- /** attempts, default 5 (public nodes rate limit this call) */
210
- retries?: number;
211
- timeout?: number;
212
- }
213
- export declare function getProgramAccounts(options: GetProgramAccountsOptions & {
214
- withContext: true;
215
- }): Promise<{
216
- context: {
217
- slot: number;
218
- };
219
- value: ProgramAccount[];
220
- }>;
221
- export declare function getProgramAccounts(options: GetProgramAccountsOptions & {
222
- withContext?: false;
223
- }): Promise<ProgramAccount[]>;
224
- export interface TokenSupply {
225
- amount: string;
226
- decimals: number;
227
- uiAmount: number;
228
- uiAmountString?: string;
229
- }
230
- export declare function getTokenSupply({ chain, token, commitment }: ChainOptions & {
231
- token: string;
232
- commitment?: Commitment;
233
- }): Promise<TokenSupply>;
234
- export interface GetTokenSuppliesOptions extends ChainOptions {
235
- tokens: string[];
236
- commitment?: Commitment;
237
- chunkSize?: number;
238
- concurrency?: number;
239
- sleepTime?: number;
240
- /** resolve failed / missing mints to `null` instead of throwing */
241
- allowError?: boolean;
242
- }
243
- /**
244
- * Supplies for many mints in input order (one batched `getMultipleAccounts` +
245
- * `decodeMintAccount`, falling back to `getTokenSupply` for mints that fail to decode).
246
- */
247
- export declare function getTokenSupplies(options: GetTokenSuppliesOptions & {
248
- allowError: true;
249
- }): Promise<(TokenSupply | null)[]>;
250
- export declare function getTokenSupplies(options: GetTokenSuppliesOptions & {
251
- allowError?: false;
252
- }): Promise<TokenSupply[]>;
253
- export interface TokenAccountBalance {
254
- mint: string;
255
- amount: string;
256
- owner: string;
257
- /** only set with `withDecimals` */
258
- decimals?: number;
259
- }
260
- export interface GetTokenAccountBalancesOptions extends ChainOptions {
261
- tokenAccounts: string[];
262
- /** return one entry per token account (input order) instead of a `{ [mint]: amount }` sum */
263
- individual?: boolean;
264
- /** skip missing / undecodable accounts instead of throwing (individual mode: `{ mint: 'error', amount: '0' }` placeholder keeps positions) */
265
- allowError?: boolean;
266
- /** individual mode: look up the mints once and fill `decimals` (one extra batched call) */
267
- withDecimals?: boolean;
268
- commitment?: Commitment;
269
- chunkSize?: number;
270
- concurrency?: number;
271
- sleepTime?: number;
272
- }
273
- /** Token balances of the given token accounts, aggregated per mint (raw amount strings) or individually. */
274
- export declare function getTokenAccountBalances(options: GetTokenAccountBalancesOptions & {
275
- individual: true;
276
- }): Promise<TokenAccountBalance[]>;
277
- export declare function getTokenAccountBalances(options: GetTokenAccountBalancesOptions & {
278
- individual?: false;
279
- }): Promise<Record<string, string>>;
280
- export interface ParsedTokenAccount {
281
- pubkey: string;
282
- mint: string;
283
- owner: string;
284
- amount: string;
285
- decimals: number;
286
- uiAmount: number;
287
- programId: string;
288
- state?: string;
289
- }
290
- /**
291
- * Token accounts of `owner` (jsonParsed). With neither `mint` nor `programId`,
292
- * both the Token and Token-2022 programs are queried.
293
- */
294
- export declare function getTokenAccountsByOwner({ chain, owner, mint, programId, commitment }: ChainOptions & {
295
- owner: string;
296
- mint?: string;
297
- programId?: string;
298
- commitment?: Commitment;
299
- }): Promise<ParsedTokenAccount[]>;
300
- /** Raw token amount (string) of `mint` held by `owner`, summed over all of the owner's token accounts. */
301
- export declare function getTokenBalance({ chain, owner, mint, commitment }: ChainOptions & {
302
- owner: string;
303
- mint: string;
304
- commitment?: Commitment;
305
- }): Promise<string>;
306
- export interface SignatureInfo {
307
- signature: string;
308
- slot: number;
309
- blockTime: number | null;
310
- err: any;
311
- memo: string | null;
312
- confirmationStatus?: string;
313
- }
314
- export declare function getSignaturesForAddress({ chain, address, before, until, limit, commitment }: ChainOptions & {
315
- address: string;
316
- before?: string;
317
- until?: string;
318
- limit?: number;
319
- commitment?: Commitment;
320
- }): Promise<SignatureInfo[]>;
321
- export declare function getTransaction({ chain, signature, encoding, maxSupportedTransactionVersion, commitment }: ChainOptions & {
322
- signature: string;
323
- encoding?: 'json' | 'jsonParsed' | 'base64' | 'base58';
324
- maxSupportedTransactionVersion?: number;
325
- commitment?: Commitment;
326
- }): Promise<any>;
327
- /**
328
- * Lamports in all stake accounts whose stake authority (default, as in the
329
- * adapters helper) or withdraw authority is `address`.
330
- */
331
- export declare function getStakedSol({ chain, address, authority, commitment }: ChainOptions & {
332
- address: string;
333
- authority?: 'staker' | 'withdrawer';
334
- commitment?: Commitment;
335
- }): Promise<number>;
336
- /** `total_lamports` of an SPL stake pool account (lamports, as number). */
337
- export declare function getSolBalanceFromStakePool({ chain, address, commitment }: ChainOptions & {
338
- address: string;
339
- commitment?: Commitment;
340
- }): Promise<number>;