@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,333 +0,0 @@
1
- export declare const DEFAULT_ENDPOINTS: Record<string, string>;
2
- export type Bytes = Buffer | Uint8Array | number[] | string;
3
- export interface ChainOptions {
4
- /** chain key (`polkadot`, `bifrost`, ...) or a literal `https://` endpoint (comma separated list allowed) */
5
- chain: string;
6
- /** total attempts across endpoints (default: max(3, endpoints)) */
7
- retries?: number;
8
- }
9
- /** `Buffer` from a `0x` hex string, utf8 string, byte array or Buffer/Uint8Array */
10
- export declare function toBuf(value: Bytes | undefined | null): Buffer;
11
- /** `0x` prefixed lowercase hex */
12
- export declare function hex(value: Bytes): string;
13
- /** little endian u64 (8 bytes) */
14
- export declare function u64le(n: bigint | number): Buffer;
15
- /** xxHash64 of `data` with `seed` -> unsigned 64 bit bigint */
16
- export declare function xxhash64(data: Bytes, seed?: bigint | number): bigint;
17
- /** twox64: xxhash64(data, 0) as 8 LE bytes */
18
- export declare const twox64: (data: Bytes) => Buffer;
19
- /** twox128: xxhash64(data, 0) ++ xxhash64(data, 1) */
20
- export declare const twox128: (data: Bytes) => Buffer;
21
- /** twox256: xxhash64 with seeds 0..3 */
22
- export declare const twox256: (data: Bytes) => Buffer;
23
- /** blake2b digest of `data`, `outLen` bytes (1..64, default 32), no key */
24
- export declare function blake2b(data: Bytes, outLen?: number): Buffer;
25
- export declare const blake2_128: (data: Bytes) => Buffer;
26
- export declare const blake2_256: (data: Bytes) => Buffer;
27
- export declare const blake2_512: (data: Bytes) => Buffer;
28
- /** base58 (bitcoin alphabet) decode, keeps leading zero bytes */
29
- export declare function base58Decode(str: string): Buffer;
30
- /** base58 (bitcoin alphabet) encode */
31
- export declare function base58Encode(data: Bytes): string;
32
- /** ss58 address -> { prefix, pubkey } (checksum verified) */
33
- export declare function ss58DecodeFull(address: string): {
34
- prefix: number;
35
- pubkey: Buffer;
36
- };
37
- /**
38
- * ss58 address -> 32 byte account id. A Buffer / Uint8Array / `0x` hex account id is
39
- * returned as-is so callers can accept both address formats.
40
- */
41
- export declare function ss58Decode(address: string | Uint8Array): Buffer;
42
- /** account id (32 bytes) -> ss58 address with `prefix` (0 = polkadot, 2 = kusama, 42 = generic) */
43
- export declare function ss58Encode(pubkey: Bytes, prefix?: number): string;
44
- export declare const encodeU8: (n: number) => Buffer;
45
- export declare const encodeU16: (n: number) => Buffer;
46
- export declare const encodeU32: (n: number) => Buffer;
47
- export declare const encodeU64: (n: bigint | number | string) => Buffer;
48
- export declare const encodeU128: (n: bigint | number | string) => Buffer;
49
- /** little endian unsigned integer of `bytes` bytes */
50
- export declare function encodeUint(n: bigint | number | string, bytes: number): Buffer;
51
- /** SCALE Compact<uN> */
52
- export declare function encodeCompact(value: bigint | number | string): Buffer;
53
- /** little endian unsigned integer at `offset`, `bytes` wide (default u128); missing bytes read as 0 */
54
- export declare function decodeUint(value: Bytes | null | undefined, { offset, bytes }?: {
55
- offset?: number;
56
- bytes?: number;
57
- }): bigint;
58
- /** SCALE Compact<uN> at `offset` -> { value, length: bytes consumed } */
59
- export declare function decodeCompact(value: Bytes, offset?: number): {
60
- value: bigint;
61
- length: number;
62
- };
63
- /** Sequential SCALE reader for hand decoding structs */
64
- export declare class ScaleReader {
65
- buf: Buffer;
66
- offset: number;
67
- constructor(value: Bytes);
68
- get remaining(): number;
69
- private need;
70
- /** next `n` raw bytes (view, not a copy) */
71
- bytes(n: number): Buffer;
72
- skip(n: number): this;
73
- u8(): number;
74
- u16(): number;
75
- u32(): number;
76
- u64(): bigint;
77
- u128(): bigint;
78
- u256(): bigint;
79
- i32(): number;
80
- i64(): bigint;
81
- bool(): boolean;
82
- compact(): bigint;
83
- /** Option<T>: `null` when the tag byte is 0 */
84
- option<T>(fn: (r: ScaleReader) => T): T | null;
85
- /** Vec<T> */
86
- vec<T>(fn: (r: ScaleReader) => T): T[];
87
- /** Vec<u8> / BoundedVec<u8> */
88
- bytesVec(): Buffer;
89
- string(): string;
90
- /** 32 byte AccountId as `0x` hex */
91
- accountId(): string;
92
- /** H256 as `0x` hex */
93
- hash(): string;
94
- }
95
- export interface Hasher {
96
- encode: (key: Bytes) => Buffer;
97
- /** bytes preceding the raw key in a concat hasher (0 when the key is not recoverable) */
98
- hashLength: number;
99
- /** true when the raw key follows the hash (Identity / *Concat hashers) */
100
- concat: boolean;
101
- }
102
- export declare const twox64Concat: (key: Bytes) => Buffer;
103
- export declare const blake2_128Concat: (key: Bytes) => Buffer;
104
- export declare const identity: (key: Bytes) => Buffer;
105
- /** key hashers as used in pallet storage definitions (looked up case-insensitively) */
106
- export declare const hashers: Record<string, Hasher>;
107
- export declare const DEFAULT_HASHER = "Twox64Concat";
108
- export declare function getHasher(name?: string): Hasher;
109
- /** twox128(pallet) ++ twox128(item) */
110
- export declare const storagePrefix: (pallet: string, item: string) => Buffer;
111
- export interface StorageKeyParams {
112
- pallet: string;
113
- item: string;
114
- /** single map key (SCALE encoded bytes / hex); prepended to `keys` */
115
- key?: Bytes;
116
- /** hasher for `key`, default Twox64Concat */
117
- hasher?: string;
118
- /** (double / n) map keys in order */
119
- keys?: {
120
- key: Bytes;
121
- hasher?: string;
122
- }[];
123
- }
124
- /** full storage key as `0x` hex */
125
- export declare function storageKey({ pallet, item, key, hasher, keys }: StorageKeyParams): string;
126
- /** strip the hash part of a concat hasher from an entry's `rest` buffer -> raw SCALE key */
127
- export declare function stripHasher(rest: Bytes, hasher?: string): Buffer;
128
- export declare function getEndpoints({ chain }: {
129
- chain: string;
130
- }): string[];
131
- /** Raw JSON-RPC call; rotates endpoints, retries transient failures, runs under a per-chain limiter */
132
- export declare function rpc({ chain, method, params, retries }: ChainOptions & {
133
- method: string;
134
- params?: any[];
135
- }): Promise<any>;
136
- export interface Header {
137
- number: number;
138
- hash?: string;
139
- parentHash: string;
140
- stateRoot: string;
141
- extrinsicsRoot: string;
142
- digest: any;
143
- }
144
- export interface Block {
145
- number: number;
146
- hash: string;
147
- parentHash: string;
148
- /** unix seconds from the `timestamp.set` inherent (or Timestamp.Now storage); undefined when neither is available */
149
- timestamp?: number;
150
- /** raw SCALE extrinsics (`0x` hex) */
151
- extrinsics: string[];
152
- header: Header;
153
- }
154
- export interface RuntimeVersion {
155
- specName: string;
156
- implName: string;
157
- specVersion: number;
158
- implVersion: number;
159
- transactionVersion: number;
160
- authoringVersion?: number;
161
- apis?: any[];
162
- [key: string]: any;
163
- }
164
- export declare const getFinalizedHead: ({ chain, retries }: ChainOptions) => Promise<string>;
165
- /** block hash of `number` (latest best block when omitted); `null` when unknown */
166
- export declare function getBlockHash({ chain, number, retries }: ChainOptions & {
167
- number?: number;
168
- }): Promise<string | null>;
169
- /** header at `hash` (finalized head when omitted) */
170
- export declare function getHeader({ chain, hash, retries }: ChainOptions & {
171
- hash?: string;
172
- }): Promise<Header>;
173
- /** `state_getRuntimeVersion` */
174
- export declare const getRuntimeVersion: ({ chain, at, retries }: ChainOptions & {
175
- at?: string;
176
- }) => Promise<RuntimeVersion>;
177
- /**
178
- * Decode the `timestamp.set` inherent (first bare extrinsic, call index 0, Compact<u64> ms).
179
- * Returns unix seconds or undefined when the block has no recognisable timestamp inherent.
180
- */
181
- export declare function decodeTimestampInherent(extrinsics: string[] | undefined): number | undefined;
182
- /** Timestamp.Now (u64 ms) at `at` -> unix seconds */
183
- export declare function getTimestampAt({ chain, at, retries }: ChainOptions & {
184
- at?: string;
185
- }): Promise<number>;
186
- /** block by `hash` or `number` (finalized head when neither is given), with its timestamp */
187
- export declare function getBlock({ chain, hash, number, retries }: ChainOptions & {
188
- hash?: string;
189
- number?: number;
190
- }): Promise<Block>;
191
- export declare const getLatestBlock: (options: ChainOptions) => Promise<Block>;
192
- /**
193
- * Last block whose timestamp is <= `timestamp` (unix seconds, ms accepted). Brackets the
194
- * range assuming ~6s blocks then binary searches on Timestamp.Now at each block hash
195
- * (falls back to the timestamp inherent on nodes with pruned state).
196
- */
197
- export declare function getBlockAtTimestamp({ chain, timestamp, retries }: ChainOptions & {
198
- timestamp: number;
199
- }): Promise<Block>;
200
- export interface StorageOptions extends ChainOptions {
201
- /** block hash; latest when omitted */
202
- at?: string;
203
- }
204
- /** `state_getStorage` for a raw storage key -> `0x` hex value or null */
205
- export declare function getStorageRaw({ chain, key, at, retries }: StorageOptions & {
206
- key: Bytes;
207
- }): Promise<string | null>;
208
- /** plain item or a single (double) map entry -> raw `0x` hex value or null */
209
- export declare function getStorage({ chain, pallet, item, key, hasher, keys, at, retries }: StorageOptions & StorageKeyParams): Promise<string | null>;
210
- /** `state_queryStorageAt` for many keys -> values in key order (null when unset) */
211
- export declare function getStorageBatch({ chain, storageKeys, at, chunkSize, retries }: StorageOptions & {
212
- storageKeys: string[];
213
- chunkSize?: number;
214
- }): Promise<(string | null)[]>;
215
- /** one page of `state_getKeysPaged` */
216
- export declare function getKeysPaged({ chain, prefix, pageSize, startKey, at, retries }: StorageOptions & {
217
- prefix: Bytes;
218
- pageSize?: number;
219
- startKey?: string | null;
220
- }): Promise<string[]>;
221
- /** every storage key under `prefix` (paginates `state_getKeysPaged`) */
222
- export declare function getAllKeys({ chain, prefix, pageSize, at, retries }: StorageOptions & {
223
- prefix: Bytes;
224
- pageSize?: number;
225
- }): Promise<string[]>;
226
- export interface StorageEntry {
227
- /** full storage key (`0x` hex) */
228
- key: string;
229
- /** raw value (`0x` hex) or null */
230
- value: string | null;
231
- /** key bytes after the pallet/item prefix and the given partial keys (hash ++ raw key for concat hashers) */
232
- rest: Buffer;
233
- }
234
- /**
235
- * Every entry of a map (optionally under partial `keys` for double maps) -> [{ key, value, rest }].
236
- * Use `stripHasher(entry.rest, hasher)` to recover the raw SCALE key of concat hashers.
237
- */
238
- export declare function getStorageEntries({ chain, pallet, item, keys, pageSize, at, retries }: StorageOptions & {
239
- pallet: string;
240
- item: string;
241
- keys?: {
242
- key: Bytes;
243
- hasher?: string;
244
- }[];
245
- pageSize?: number;
246
- }): Promise<StorageEntry[]>;
247
- /** runtime api call (`state_call`), e.g. `stateCall({ chain, method: 'CurrenciesApi_account', data })` -> `0x` hex */
248
- export declare function stateCall({ chain, method, data, at, retries }: StorageOptions & {
249
- method: string;
250
- data: Bytes;
251
- }): Promise<string>;
252
- export interface AccountInfo {
253
- nonce: number;
254
- consumers: number;
255
- providers: number;
256
- sufficients: number;
257
- /** balances as decimal bigint strings */
258
- free: string;
259
- reserved: string;
260
- /** `frozen` (new AccountData) / `miscFrozen` (legacy AccountData) */
261
- frozen: string;
262
- miscFrozen: string;
263
- /** 4th balance field: `flags` on new runtimes, `feeFrozen` on legacy ones */
264
- feeFrozen: string;
265
- flags: string;
266
- }
267
- /**
268
- * frame_system AccountInfo: nonce u32, consumers u32, providers u32, sufficients u32,
269
- * data { free, reserved, frozen|miscFrozen, flags|feeFrozen }. Balances are u128 on most
270
- * chains; `balanceBytes: 8` for u64 balance chains (e.g. bittensor), auto-detected from
271
- * the value length when omitted.
272
- */
273
- export declare function decodeAccountInfo(value: Bytes | null | undefined, { balanceBytes }?: {
274
- balanceBytes?: number;
275
- }): AccountInfo;
276
- /** System.Account of an ss58 address (or raw 32 byte account id) */
277
- export declare function getSystemAccount({ chain, address, at, balanceBytes, retries }: StorageOptions & {
278
- address: string | Uint8Array;
279
- balanceBytes?: number;
280
- }): Promise<AccountInfo>;
281
- /** free native balance (raw units, decimal string) */
282
- export declare function getFreeBalance({ chain, address, at, balanceBytes, retries }: StorageOptions & {
283
- address: string | Uint8Array;
284
- balanceBytes?: number;
285
- }): Promise<string>;
286
- /** Balances.TotalIssuance (raw units, decimal string) */
287
- export declare function getTotalIssuance({ chain, at, pallet, retries }: StorageOptions & {
288
- pallet?: string;
289
- }): Promise<string>;
290
- export interface OrmlAccountData {
291
- free: string;
292
- reserved: string;
293
- frozen: string;
294
- }
295
- /** orml_tokens AccountData: free u128, reserved u128, frozen u128 */
296
- export declare function decodeOrmlAccountData(value: Bytes | null | undefined): OrmlAccountData;
297
- /** orml Tokens.Accounts(AccountId: Blake2_128Concat, CurrencyId: Twox64Concat); `currencyId` is the SCALE encoded id (hex / bytes) */
298
- export declare function getTokensAccount({ chain, address, currencyId, at, pallet, retries }: StorageOptions & {
299
- address: string | Uint8Array;
300
- currencyId: Bytes;
301
- pallet?: string;
302
- }): Promise<OrmlAccountData>;
303
- export interface BifrostCurrencyId {
304
- variant: string;
305
- raw: Buffer;
306
- symbol?: string;
307
- id?: number;
308
- /** mirrors polkadot.js toHuman(), e.g. { Token: 'KSM' } or { VToken2: '0' } */
309
- human?: Record<string, string>;
310
- }
311
- /** reads one CurrencyId from a ScaleReader */
312
- declare function bifrostReadCurrencyId(r: ScaleReader): BifrostCurrencyId;
313
- /** Bifrost CurrencyId SCALE codec (bifrost-primitives) */
314
- export declare const bifrost: {
315
- CURRENCY: Record<string, number>;
316
- VARIANT_NAMES: Record<number, string>;
317
- TOKEN_SYMBOLS: Record<number, string>;
318
- TOKEN_IDS: Record<string, number>;
319
- TOKEN2_SYMBOLS: Record<number, string>;
320
- /** `encodeCurrencyId('Token', 'KSM')` / `encodeCurrencyId('VToken2', 0)` -> 2 byte SCALE CurrencyId */
321
- encodeCurrencyId(variant: string, payload: number | string): Buffer;
322
- token: (symbol: string) => Buffer;
323
- vToken: (symbol: string) => Buffer;
324
- vsToken: (symbol: string) => Buffer;
325
- native: (symbol: string) => Buffer;
326
- stable: (symbol: string) => Buffer;
327
- token2: (id: number) => Buffer;
328
- vToken2: (id: number) => Buffer;
329
- vsToken2: (id: number) => Buffer;
330
- readCurrencyId: typeof bifrostReadCurrencyId;
331
- decodeCurrencyId: (value: Bytes) => BifrostCurrencyId;
332
- };
333
- export {};