@gearbox-protocol/sdk 13.0.0-next.31 → 13.0.0-next.33
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/dist/cjs/sdk/base/TokensMeta.js +19 -5
- package/dist/cjs/sdk/sdk-legacy/gearboxRewards/api.js +3 -1
- package/dist/cjs/sdk/sdk-legacy/gearboxRewards/merklAPI.js +23 -1
- package/dist/esm/sdk/base/TokensMeta.js +19 -5
- package/dist/esm/sdk/sdk-legacy/gearboxRewards/api.js +3 -1
- package/dist/esm/sdk/sdk-legacy/gearboxRewards/merklAPI.js +13 -1
- package/dist/types/sdk/sdk-legacy/gearboxRewards/api.d.ts +1 -0
- package/dist/types/sdk/sdk-legacy/gearboxRewards/merklAPI.d.ts +5 -1
- package/package.json +1 -1
|
@@ -22,6 +22,7 @@ __export(TokensMeta_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(TokensMeta_exports);
|
|
24
24
|
var import_viem = require("viem");
|
|
25
|
+
var import_iSecuritizeDegenNFT = require("../../abi/310/iSecuritizeDegenNFT.js");
|
|
25
26
|
var import_iSecuritizeKYCFactory = require("../../abi/310/iSecuritizeKYCFactory.js");
|
|
26
27
|
var import_iStateSerializer = require("../../abi/iStateSerializer.js");
|
|
27
28
|
var import_iVersion = require("../../abi/iVersion.js");
|
|
@@ -252,12 +253,25 @@ class TokensMeta extends import_utils.AddressMap {
|
|
|
252
253
|
}
|
|
253
254
|
}
|
|
254
255
|
async #loadDSTokens(kycFactories) {
|
|
256
|
+
const degenNFTs = await this.#client.multicall({
|
|
257
|
+
contracts: kycFactories.map((address) => {
|
|
258
|
+
return {
|
|
259
|
+
address,
|
|
260
|
+
abi: import_iSecuritizeKYCFactory.iSecuritizeKYCFactoryAbi,
|
|
261
|
+
functionName: "getDegenNFT"
|
|
262
|
+
};
|
|
263
|
+
}),
|
|
264
|
+
allowFailure: false,
|
|
265
|
+
batchSize: 0
|
|
266
|
+
});
|
|
255
267
|
const resp = await this.#client.multicall({
|
|
256
|
-
contracts:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
268
|
+
contracts: degenNFTs.map((address) => {
|
|
269
|
+
return {
|
|
270
|
+
address,
|
|
271
|
+
abi: import_iSecuritizeDegenNFT.iSecuritizeDegenNFTAbi,
|
|
272
|
+
functionName: "getDSTokens"
|
|
273
|
+
};
|
|
274
|
+
}),
|
|
261
275
|
allowFailure: false,
|
|
262
276
|
batchSize: 0
|
|
263
277
|
});
|
|
@@ -41,6 +41,8 @@ var import_endpoint = require("../core/endpoint.js");
|
|
|
41
41
|
var import_math = require("../utils/math.js");
|
|
42
42
|
var import_merklAPI = require("./merklAPI.js");
|
|
43
43
|
class GearboxRewardsApi {
|
|
44
|
+
constructor() {
|
|
45
|
+
}
|
|
44
46
|
static async getLmRewardsV2({
|
|
45
47
|
provider,
|
|
46
48
|
account,
|
|
@@ -186,7 +188,7 @@ class GearboxRewardsApi {
|
|
|
186
188
|
reportError
|
|
187
189
|
}) {
|
|
188
190
|
const [merkleXYZLMResponse] = await Promise.allSettled([
|
|
189
|
-
|
|
191
|
+
import_merklAPI.MerkleXYZApi.fetchWithFallback(
|
|
190
192
|
import_merklAPI.MerkleXYZApi.getUserRewardsUrl({
|
|
191
193
|
params: {
|
|
192
194
|
chainId: import_chain.chains[network].id,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,14 +17,34 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var merklAPI_exports = {};
|
|
20
30
|
__export(merklAPI_exports, {
|
|
21
31
|
MerkleXYZApi: () => MerkleXYZApi
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(merklAPI_exports);
|
|
34
|
+
var import_axios = __toESM(require("axios"));
|
|
24
35
|
class MerkleXYZApi {
|
|
25
|
-
|
|
36
|
+
constructor() {
|
|
37
|
+
}
|
|
38
|
+
static defaultDomain = "https://api.merkl.xyz";
|
|
39
|
+
static angleDomain = "https://api-merkl.angle.money";
|
|
40
|
+
static fetchWithFallback = async (getUrl) => {
|
|
41
|
+
try {
|
|
42
|
+
return await import_axios.default.get(getUrl(MerkleXYZApi.defaultDomain));
|
|
43
|
+
} catch {
|
|
44
|
+
return await import_axios.default.get(getUrl(MerkleXYZApi.angleDomain));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
static getUserRewardsUrl = (options) => (domain) => `${domain}/v4/users/${options.params.user}/rewards?chainId=${options.params.chainId}`;
|
|
26
48
|
}
|
|
27
49
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
50
|
0 && (module.exports = {
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
decodeAbiParameters,
|
|
3
3
|
erc20Abi
|
|
4
4
|
} from "viem";
|
|
5
|
+
import { iSecuritizeDegenNFTAbi } from "../../abi/310/iSecuritizeDegenNFT.js";
|
|
5
6
|
import { iSecuritizeKYCFactoryAbi } from "../../abi/310/iSecuritizeKYCFactory.js";
|
|
6
7
|
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
7
8
|
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
@@ -240,12 +241,25 @@ class TokensMeta extends AddressMap {
|
|
|
240
241
|
}
|
|
241
242
|
}
|
|
242
243
|
async #loadDSTokens(kycFactories) {
|
|
244
|
+
const degenNFTs = await this.#client.multicall({
|
|
245
|
+
contracts: kycFactories.map((address) => {
|
|
246
|
+
return {
|
|
247
|
+
address,
|
|
248
|
+
abi: iSecuritizeKYCFactoryAbi,
|
|
249
|
+
functionName: "getDegenNFT"
|
|
250
|
+
};
|
|
251
|
+
}),
|
|
252
|
+
allowFailure: false,
|
|
253
|
+
batchSize: 0
|
|
254
|
+
});
|
|
243
255
|
const resp = await this.#client.multicall({
|
|
244
|
-
contracts:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
256
|
+
contracts: degenNFTs.map((address) => {
|
|
257
|
+
return {
|
|
258
|
+
address,
|
|
259
|
+
abi: iSecuritizeDegenNFTAbi,
|
|
260
|
+
functionName: "getDSTokens"
|
|
261
|
+
};
|
|
262
|
+
}),
|
|
249
263
|
allowFailure: false,
|
|
250
264
|
batchSize: 0
|
|
251
265
|
});
|
|
@@ -8,6 +8,8 @@ import { GearboxBackendApi } from "../core/endpoint.js";
|
|
|
8
8
|
import { BigIntMath } from "../utils/math.js";
|
|
9
9
|
import { MerkleXYZApi } from "./merklAPI.js";
|
|
10
10
|
class GearboxRewardsApi {
|
|
11
|
+
constructor() {
|
|
12
|
+
}
|
|
11
13
|
static async getLmRewardsV2({
|
|
12
14
|
provider,
|
|
13
15
|
account,
|
|
@@ -153,7 +155,7 @@ class GearboxRewardsApi {
|
|
|
153
155
|
reportError
|
|
154
156
|
}) {
|
|
155
157
|
const [merkleXYZLMResponse] = await Promise.allSettled([
|
|
156
|
-
|
|
158
|
+
MerkleXYZApi.fetchWithFallback(
|
|
157
159
|
MerkleXYZApi.getUserRewardsUrl({
|
|
158
160
|
params: {
|
|
159
161
|
chainId: chains[network].id,
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import axios from "axios";
|
|
1
2
|
class MerkleXYZApi {
|
|
2
|
-
|
|
3
|
+
constructor() {
|
|
4
|
+
}
|
|
5
|
+
static defaultDomain = "https://api.merkl.xyz";
|
|
6
|
+
static angleDomain = "https://api-merkl.angle.money";
|
|
7
|
+
static fetchWithFallback = async (getUrl) => {
|
|
8
|
+
try {
|
|
9
|
+
return await axios.get(getUrl(MerkleXYZApi.defaultDomain));
|
|
10
|
+
} catch {
|
|
11
|
+
return await axios.get(getUrl(MerkleXYZApi.angleDomain));
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
static getUserRewardsUrl = (options) => (domain) => `${domain}/v4/users/${options.params.user}/rewards?chainId=${options.params.chainId}`;
|
|
3
15
|
}
|
|
4
16
|
export {
|
|
5
17
|
MerkleXYZApi
|
|
@@ -74,6 +74,7 @@ export interface ClaimLmRewardsV3Props {
|
|
|
74
74
|
signer: WalletClient;
|
|
75
75
|
}
|
|
76
76
|
export declare class GearboxRewardsApi {
|
|
77
|
+
private constructor();
|
|
77
78
|
static getLmRewardsV2({ provider, account, gearTokenAddress, network, airdropDistributorAddress, reportError, }: GetLmRewardsV2Props): Promise<GearboxLmReward[]>;
|
|
78
79
|
static getLmRewardsV3({ pools, tokensList, provider, account, reportError, }: GetLmRewardsV3Props): Promise<(GearboxLmReward | GearboxLmReward[])[]>;
|
|
79
80
|
static getLmRewardsMerkle({ pools, account, network, reportError, }: GetLmRewardsMerkleProps): Promise<GearboxLmReward[]>;
|
|
@@ -37,6 +37,10 @@ interface MerkleXYZChain {
|
|
|
37
37
|
icon: string;
|
|
38
38
|
}
|
|
39
39
|
export declare class MerkleXYZApi {
|
|
40
|
-
|
|
40
|
+
private constructor();
|
|
41
|
+
static defaultDomain: string;
|
|
42
|
+
static angleDomain: string;
|
|
43
|
+
static fetchWithFallback: <T>(getUrl: (domain: string) => string) => Promise<import("axios").AxiosResponse<T, any, {}>>;
|
|
44
|
+
static getUserRewardsUrl: (options: UserOptions) => (domain: string) => string;
|
|
41
45
|
}
|
|
42
46
|
export {};
|