@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
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.normalizeV4Row = normalizeV4Row;
|
|
7
|
-
exports.parseTransferResponse = parseTransferResponse;
|
|
8
|
-
const stream_1 = require("stream");
|
|
9
|
-
const promises_1 = require("stream/promises");
|
|
10
|
-
const stream_json_1 = require("stream-json");
|
|
11
|
-
const Assembler_1 = __importDefault(require("stream-json/Assembler"));
|
|
12
|
-
const numericFields = {
|
|
13
|
-
logs: ["chain", "block_number", "log_index"],
|
|
14
|
-
transfers: ["chain", "block_number", "log_index", "value", "id"],
|
|
15
|
-
transactions: ["chain", "block_number", "transaction_index", "value", "gas", "gas_price",
|
|
16
|
-
"gas_used", "effective_gas_price", "max_fee_per_gas", "max_priority_fee_per_gas",
|
|
17
|
-
"base_fee_per_gas", "nonce", "transaction_type", "cumulative_gas_used"],
|
|
18
|
-
};
|
|
19
|
-
const addressFields = {
|
|
20
|
-
logs: ["source", "address"],
|
|
21
|
-
transfers: ["from_address", "to_address", "token", "operator"],
|
|
22
|
-
transactions: ["from_address", "to_address", "contract_created"],
|
|
23
|
-
};
|
|
24
|
-
const hashFields = {
|
|
25
|
-
logs: ["transaction_hash", "topic0", "topic1", "topic2", "topic3"],
|
|
26
|
-
transfers: ["transaction_hash"],
|
|
27
|
-
transactions: ["hash", "block_hash"],
|
|
28
|
-
};
|
|
29
|
-
function fixedHex(value, bytes) {
|
|
30
|
-
// Empty/absent values are not the zero address or the zero topic.
|
|
31
|
-
if (typeof value !== "string" || !/^0x[0-9a-f]+$/i.test(value))
|
|
32
|
-
return value;
|
|
33
|
-
const hex = value.slice(2);
|
|
34
|
-
return hex.length <= bytes * 2 ? `0x${hex.toLowerCase().padStart(bytes * 2, "0")}` : value;
|
|
35
|
-
}
|
|
36
|
-
/** Preserve v2 REST field types and padding; never applied to SQL results. */
|
|
37
|
-
function normalizeV4Row(row, kind) {
|
|
38
|
-
for (const key of numericFields[kind]) {
|
|
39
|
-
// The exact transfer id is captured for the cursor before restoring the public Number.
|
|
40
|
-
if (typeof row[key] === "string" && /^-?\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i.test(row[key]))
|
|
41
|
-
row[key] = Number(row[key]);
|
|
42
|
-
}
|
|
43
|
-
for (const key of addressFields[kind])
|
|
44
|
-
if (key in row)
|
|
45
|
-
row[key] = fixedHex(row[key], 20);
|
|
46
|
-
for (const key of hashFields[kind])
|
|
47
|
-
if (key in row)
|
|
48
|
-
row[key] = fixedHex(row[key], 32);
|
|
49
|
-
if (kind === "logs" && row.source === undefined && row.address !== undefined)
|
|
50
|
-
row.source = row.address;
|
|
51
|
-
return row;
|
|
52
|
-
}
|
|
53
|
-
/** Capture an unquoted UInt256 id before JSON.parse can round it. */
|
|
54
|
-
async function parseTransferResponse(text) {
|
|
55
|
-
const assembler = new Assembler_1.default();
|
|
56
|
-
// Assembler only needs packed values, not intermediate string/number chunks.
|
|
57
|
-
await (0, promises_1.pipeline)(stream_1.Readable.from([text]), (0, stream_json_1.parser)({ streamValues: false }), async (tokens) => {
|
|
58
|
-
for await (const token of tokens) {
|
|
59
|
-
assembler.consume(token.name === "numberValue" && assembler.key === "id"
|
|
60
|
-
? { name: "stringValue", value: token.value } : token);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return assembler.current;
|
|
64
|
-
}
|
package/build/util/indexer.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Address } from "../types";
|
|
2
|
-
import { GetTransactionOptions } from "./transactions";
|
|
3
|
-
export type IndexerVersion = "v2" | "v4";
|
|
4
|
-
export declare function getChainIndexerVersion(chain: string): IndexerVersion;
|
|
5
|
-
export declare const supportedChainSet2: Set<string>;
|
|
6
|
-
export type IndexerGetLogsOptions = {
|
|
7
|
-
target?: Address;
|
|
8
|
-
topic?: string;
|
|
9
|
-
fromBlock?: number;
|
|
10
|
-
toBlock?: number;
|
|
11
|
-
topics?: (string | null)[];
|
|
12
|
-
extraTopics?: string[];
|
|
13
|
-
chain?: string;
|
|
14
|
-
eventAbi?: string | any;
|
|
15
|
-
fromTimestamp?: number;
|
|
16
|
-
toTimestamp?: number;
|
|
17
|
-
entireLog?: boolean;
|
|
18
|
-
cacheInCloud?: boolean;
|
|
19
|
-
onlyArgs?: boolean;
|
|
20
|
-
targets?: Address[];
|
|
21
|
-
flatten?: boolean;
|
|
22
|
-
all?: boolean;
|
|
23
|
-
limit?: number;
|
|
24
|
-
offset?: number;
|
|
25
|
-
debugMode?: boolean;
|
|
26
|
-
noTarget?: boolean;
|
|
27
|
-
collect?: boolean;
|
|
28
|
-
parseLog?: boolean;
|
|
29
|
-
processor?: (logs: any[]) => Promise<void> | void;
|
|
30
|
-
maxBlockRange?: number;
|
|
31
|
-
allowParseFailure?: boolean;
|
|
32
|
-
/** Opt in to streaming /logs instead of paginated requests. */
|
|
33
|
-
clientStreaming?: boolean;
|
|
34
|
-
/** Decoder type: 'viem' (faster) or 'ethers' (fallback) */
|
|
35
|
-
decoderType?: "viem" | "ethers";
|
|
36
|
-
/** Metrics hooks (optional) */
|
|
37
|
-
onWireStats?: (s: {
|
|
38
|
-
chunkSize: number;
|
|
39
|
-
bytesReceived: number;
|
|
40
|
-
itemsProcessed: number;
|
|
41
|
-
}) => void;
|
|
42
|
-
onDecodeStats?: (s: {
|
|
43
|
-
batchSize: number;
|
|
44
|
-
decodeTime: number;
|
|
45
|
-
itemsDecoded: number;
|
|
46
|
-
}) => void;
|
|
47
|
-
};
|
|
48
|
-
export type IndexerGetTokenTransfersOptions = {
|
|
49
|
-
target?: Address;
|
|
50
|
-
targets?: Address[];
|
|
51
|
-
fromBlock?: number;
|
|
52
|
-
toBlock?: number;
|
|
53
|
-
chain?: string;
|
|
54
|
-
fromTimestamp?: number;
|
|
55
|
-
toTimestamp?: number;
|
|
56
|
-
flatten?: boolean;
|
|
57
|
-
all?: boolean;
|
|
58
|
-
limit?: number;
|
|
59
|
-
offset?: number;
|
|
60
|
-
debugMode?: boolean;
|
|
61
|
-
fromAddressFilter?: string | string[];
|
|
62
|
-
transferType?: "in" | "out" | "all";
|
|
63
|
-
tokens?: string | string[];
|
|
64
|
-
token?: string;
|
|
65
|
-
};
|
|
66
|
-
export declare function getLogs(options: IndexerGetLogsOptions): Promise<any[]>;
|
|
67
|
-
export declare function getTokenTransfers({ chain, fromAddressFilter, fromBlock, toBlock, all, limit, offset, target, targets, flatten, fromTimestamp, toTimestamp, debugMode, transferType, token, tokens, }: IndexerGetTokenTransfersOptions): Promise<any[]>;
|
|
68
|
-
export declare function getTransactions({ chain, addresses, transaction_hashes, from_block, to_block, all, limit, offset, debugMode, transactionType, }: GetTransactionOptions): Promise<{
|
|
69
|
-
hash: any;
|
|
70
|
-
blockNumber: number;
|
|
71
|
-
transactionIndex: number;
|
|
72
|
-
from: any;
|
|
73
|
-
to: any;
|
|
74
|
-
value: any;
|
|
75
|
-
gasPrice: any;
|
|
76
|
-
gas: any;
|
|
77
|
-
input: any;
|
|
78
|
-
nonce: number;
|
|
79
|
-
data: any;
|
|
80
|
-
type: any;
|
|
81
|
-
maxFeePerGas: any;
|
|
82
|
-
maxPriorityFeePerGas: any;
|
|
83
|
-
baseFeePerGas: any;
|
|
84
|
-
effectiveGasPrice: any;
|
|
85
|
-
gasUsed: any;
|
|
86
|
-
cumulativeGasUsed: any;
|
|
87
|
-
status: number;
|
|
88
|
-
contractCreated: any;
|
|
89
|
-
timestamp: any;
|
|
90
|
-
}[] | null>;
|
|
91
|
-
export declare function isIndexerEnabled(chain?: string): boolean;
|
|
92
|
-
export declare function isIndexer2Enabled(chain?: string): boolean;
|