@defillama/sdk 3.0.44 → 3.0.46
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/LICENSE +661 -0
- package/build/ChainApi.d.ts +5 -1
- package/build/ChainApi.js +13 -0
- package/build/providers.json +742 -1
- package/package.json +1 -1
package/build/ChainApi.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Chain } from "./general";
|
|
|
3
3
|
import { ethers } from "ethers";
|
|
4
4
|
export declare class ChainApi {
|
|
5
5
|
block?: Block;
|
|
6
|
-
chain
|
|
6
|
+
chain: Chain | string;
|
|
7
7
|
timestamp?: number;
|
|
8
8
|
provider: ethers.providers.BaseProvider;
|
|
9
9
|
_balances: Balances;
|
|
@@ -21,10 +21,14 @@ export declare class ChainApi {
|
|
|
21
21
|
add(token: string, balance: any, { skipChain }?: {
|
|
22
22
|
skipChain?: boolean | undefined;
|
|
23
23
|
}): void;
|
|
24
|
+
addToken(token: string, balance: any, { skipChain }?: {
|
|
25
|
+
skipChain?: boolean | undefined;
|
|
26
|
+
}): void;
|
|
24
27
|
addTokens(tokens: string[], balances: any[], { skipChain }?: {
|
|
25
28
|
skipChain?: boolean | undefined;
|
|
26
29
|
}): void;
|
|
27
30
|
addBalances(balances: Balances): void;
|
|
28
31
|
getBalances(): Balances;
|
|
32
|
+
getChainId(): number | undefined;
|
|
29
33
|
}
|
|
30
34
|
export default ChainApi;
|
package/build/ChainApi.js
CHANGED
|
@@ -46,11 +46,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
49
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
53
|
exports.ChainApi = void 0;
|
|
51
54
|
var general_1 = require("./general");
|
|
52
55
|
var abi2_1 = require("./abi/abi2");
|
|
53
56
|
var blocks_1 = require("./computeTVL/blocks");
|
|
57
|
+
var providers_json_1 = __importDefault(require("./providers.json"));
|
|
54
58
|
var debugLog_1 = require("./util/debugLog");
|
|
55
59
|
var generalUtil_1 = require("./generalUtil");
|
|
56
60
|
var ChainApi = /** @class */ (function () {
|
|
@@ -107,6 +111,10 @@ var ChainApi = /** @class */ (function () {
|
|
|
107
111
|
var chain = !skipChain ? this.chain : undefined;
|
|
108
112
|
(0, generalUtil_1.sumSingleBalance)(this._balances, token, balance, chain);
|
|
109
113
|
};
|
|
114
|
+
ChainApi.prototype.addToken = function (token, balance, _a) {
|
|
115
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.skipChain, skipChain = _c === void 0 ? false : _c;
|
|
116
|
+
this.add(token, balance, { skipChain: skipChain });
|
|
117
|
+
};
|
|
110
118
|
ChainApi.prototype.addTokens = function (tokens, balances, _a) {
|
|
111
119
|
var _this = this;
|
|
112
120
|
var _b = _a === void 0 ? {} : _a, _c = _b.skipChain, skipChain = _c === void 0 ? false : _c;
|
|
@@ -124,6 +132,11 @@ var ChainApi = /** @class */ (function () {
|
|
|
124
132
|
ChainApi.prototype.getBalances = function () {
|
|
125
133
|
return this._balances;
|
|
126
134
|
};
|
|
135
|
+
ChainApi.prototype.getChainId = function () {
|
|
136
|
+
var _a;
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
return (_a = providers_json_1.default[this.chain]) === null || _a === void 0 ? void 0 : _a.chainId;
|
|
139
|
+
};
|
|
127
140
|
return ChainApi;
|
|
128
141
|
}());
|
|
129
142
|
exports.ChainApi = ChainApi;
|