@defillama/sdk 3.0.14 → 3.0.15

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.
@@ -1,34 +1,16 @@
1
- import { Address } from "../types";
1
+ import { Block, CallOptions, MulticallOptions, FetchListOptions } from "../types";
2
2
  import { Chain } from "../general";
3
- type CallParams = string | number | (string | number)[] | undefined;
4
- type CallsParams = {
5
- target?: Address;
6
- params?: CallParams;
7
- };
8
- export declare function call(params: {
9
- target: Address;
10
- abi: string | any;
11
- block?: number | string;
12
- params?: CallParams;
3
+ export declare class ChainApi {
4
+ block?: Block;
13
5
  chain?: Chain | string;
14
- withMetadata?: boolean;
15
- }): Promise<any>;
16
- export declare function multiCall(params: {
17
- abi: string | any;
18
- calls: CallsParams[] | (string | number)[];
19
- block?: number | string;
20
- target?: Address;
21
- chain?: Chain | string;
22
- requery?: boolean;
23
- withMetadata?: boolean;
24
- }): Promise<any[]>;
25
- export declare function fetchList(params: {
26
- lengthAbi: string | any;
27
- itemAbi: string | any;
28
- block?: number | string;
29
- startFrom?: number;
30
- target: Address;
31
- chain?: Chain | string;
32
- withMetadata?: boolean;
33
- }): Promise<any[]>;
34
- export {};
6
+ constructor(params: {
7
+ block?: Block;
8
+ chain?: Chain | string;
9
+ });
10
+ call(params: CallOptions): Promise<any>;
11
+ multiCall(params: MulticallOptions): Promise<any[]>;
12
+ fetchList(params: FetchListOptions): Promise<any[]>;
13
+ }
14
+ export declare function call(params: CallOptions): Promise<any>;
15
+ export declare function multiCall(params: MulticallOptions): Promise<any[]>;
16
+ export declare function fetchList(params: FetchListOptions): Promise<any[]>;
package/build/abi/abi2.js CHANGED
@@ -81,9 +81,26 @@ var __rest = (this && this.__rest) || function (s, e) {
81
81
  return t;
82
82
  };
83
83
  Object.defineProperty(exports, "__esModule", { value: true });
84
- exports.fetchList = exports.multiCall = exports.call = void 0;
84
+ exports.fetchList = exports.multiCall = exports.call = exports.ChainApi = void 0;
85
85
  var abi1 = __importStar(require("./index"));
86
86
  var debugLog_1 = require("../util/debugLog");
87
+ var ChainApi = /** @class */ (function () {
88
+ function ChainApi(params) {
89
+ this.block = params.block;
90
+ this.chain = params.chain;
91
+ }
92
+ ChainApi.prototype.call = function (params) {
93
+ return call(__assign(__assign({}, params), { block: this.block, chain: this.chain }));
94
+ };
95
+ ChainApi.prototype.multiCall = function (params) {
96
+ return multiCall(__assign(__assign({}, params), { block: this.block, chain: this.chain }));
97
+ };
98
+ ChainApi.prototype.fetchList = function (params) {
99
+ return fetchList(__assign(__assign({}, params), { block: this.block, chain: this.chain }));
100
+ };
101
+ return ChainApi;
102
+ }());
103
+ exports.ChainApi = ChainApi;
87
104
  function call(params) {
88
105
  return __awaiter(this, void 0, void 0, function () {
89
106
  var response;
package/build/types.d.ts CHANGED
@@ -1,5 +1,39 @@
1
+ import { Chain } from "./general";
1
2
  export type Address = string;
2
3
  export type StringNumber = string;
4
+ export type Block = number | string;
3
5
  export type Balances = {
4
6
  [address: string]: StringNumber | number;
5
7
  };
8
+ type CallParams = string | number | (string | number)[] | undefined;
9
+ export type CallsParams = {
10
+ target?: Address;
11
+ params?: CallParams;
12
+ };
13
+ export type CallOptions = {
14
+ target: Address;
15
+ abi: string | any;
16
+ block?: Block;
17
+ params?: CallParams;
18
+ chain?: Chain | string;
19
+ withMetadata?: boolean;
20
+ };
21
+ export type MulticallOptions = {
22
+ abi: string | any;
23
+ calls: CallsParams[] | (string | number)[];
24
+ block?: Block;
25
+ target?: Address;
26
+ chain?: Chain | string;
27
+ requery?: boolean;
28
+ withMetadata?: boolean;
29
+ };
30
+ export type FetchListOptions = {
31
+ lengthAbi: string | any;
32
+ itemAbi: string | any;
33
+ block?: Block;
34
+ startFrom?: number;
35
+ target: Address;
36
+ chain?: Chain | string;
37
+ withMetadata?: boolean;
38
+ };
39
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "3.0.14",
3
+ "version": "3.0.15",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {