@obolnetwork/obol-sdk 2.4.1 → 2.4.2
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/package.json +1 -1
- package/dist/cjs/src/incentives.js +3 -1
- package/dist/cjs/test/incentives.test.js +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/src/incentives.js +3 -1
- package/dist/esm/test/incentives.test.js +1 -1
- package/package.json +1 -1
- package/src/incentives.ts +7 -2
package/dist/cjs/package.json
CHANGED
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Incentives = void 0;
|
|
13
13
|
const utils_1 = require("./utils");
|
|
14
|
+
const types_1 = require("./types");
|
|
14
15
|
const incentivesHalpers_1 = require("./incentivesHalpers");
|
|
15
16
|
const constants_1 = require("./constants");
|
|
16
17
|
class Incentives {
|
|
@@ -83,7 +84,8 @@ class Incentives {
|
|
|
83
84
|
*/
|
|
84
85
|
getIncentivesByAddress(address) {
|
|
85
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
const
|
|
87
|
+
const network = types_1.FORK_NAMES[this.chainId];
|
|
88
|
+
const incentives = yield this.request(`/${constants_1.DEFAULT_BASE_VERSION}/address/incentives/${network}/${address}`, {
|
|
87
89
|
method: 'GET',
|
|
88
90
|
});
|
|
89
91
|
return incentives;
|
|
@@ -163,7 +163,7 @@ describe('Client.incentives', () => {
|
|
|
163
163
|
});
|
|
164
164
|
const result = yield clientInstance.incentives.getIncentivesByAddress(mockAddress);
|
|
165
165
|
expect(result).toEqual(mockIncentives);
|
|
166
|
-
expect(global.fetch).toHaveBeenCalledWith(`${baseUrl}/${constants_1.DEFAULT_BASE_VERSION}/address/incentives/${mockAddress}`, expect.objectContaining({ method: 'GET' }));
|
|
166
|
+
expect(global.fetch).toHaveBeenCalledWith(`${baseUrl}/${constants_1.DEFAULT_BASE_VERSION}/address/incentives/holesky/${mockAddress}`, expect.objectContaining({ method: 'GET' }));
|
|
167
167
|
}));
|
|
168
168
|
test('getIncentivesByAddress should handle API errors', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
169
169
|
const mockAddress = '0x1234567890abcdef1234567890abcdef12345678';
|
package/dist/esm/package.json
CHANGED
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { isContractAvailable } from './utils';
|
|
11
|
+
import { FORK_NAMES, } from './types';
|
|
11
12
|
import { claimIncentivesFromMerkleDistributor, isClaimedFromMerkleDistributor, } from './incentivesHalpers';
|
|
12
13
|
import { DEFAULT_BASE_VERSION } from './constants';
|
|
13
14
|
export class Incentives {
|
|
@@ -80,7 +81,8 @@ export class Incentives {
|
|
|
80
81
|
*/
|
|
81
82
|
getIncentivesByAddress(address) {
|
|
82
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
const
|
|
84
|
+
const network = FORK_NAMES[this.chainId];
|
|
85
|
+
const incentives = yield this.request(`/${DEFAULT_BASE_VERSION}/address/incentives/${network}/${address}`, {
|
|
84
86
|
method: 'GET',
|
|
85
87
|
});
|
|
86
88
|
return incentives;
|
|
@@ -138,7 +138,7 @@ describe('Client.incentives', () => {
|
|
|
138
138
|
});
|
|
139
139
|
const result = yield clientInstance.incentives.getIncentivesByAddress(mockAddress);
|
|
140
140
|
expect(result).toEqual(mockIncentives);
|
|
141
|
-
expect(global.fetch).toHaveBeenCalledWith(`${baseUrl}/${DEFAULT_BASE_VERSION}/address/incentives/${mockAddress}`, expect.objectContaining({ method: 'GET' }));
|
|
141
|
+
expect(global.fetch).toHaveBeenCalledWith(`${baseUrl}/${DEFAULT_BASE_VERSION}/address/incentives/holesky/${mockAddress}`, expect.objectContaining({ method: 'GET' }));
|
|
142
142
|
}));
|
|
143
143
|
test('getIncentivesByAddress should handle API errors', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
144
|
const mockAddress = '0x1234567890abcdef1234567890abcdef12345678';
|
package/package.json
CHANGED
package/src/incentives.ts
CHANGED
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
type Signer,
|
|
7
7
|
} from 'ethers';
|
|
8
8
|
import { isContractAvailable } from './utils';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type Incentives as IncentivesType,
|
|
11
|
+
type ETH_ADDRESS,
|
|
12
|
+
FORK_NAMES,
|
|
13
|
+
} from './types';
|
|
10
14
|
import {
|
|
11
15
|
claimIncentivesFromMerkleDistributor,
|
|
12
16
|
isClaimedFromMerkleDistributor,
|
|
@@ -126,8 +130,9 @@ export class Incentives {
|
|
|
126
130
|
* @throws On not found if address not found.
|
|
127
131
|
*/
|
|
128
132
|
async getIncentivesByAddress(address: string): Promise<IncentivesType> {
|
|
133
|
+
const network = FORK_NAMES[this.chainId];
|
|
129
134
|
const incentives: IncentivesType = await this.request(
|
|
130
|
-
`/${DEFAULT_BASE_VERSION}/address/incentives/${address}`,
|
|
135
|
+
`/${DEFAULT_BASE_VERSION}/address/incentives/${network}/${address}`,
|
|
131
136
|
{
|
|
132
137
|
method: 'GET',
|
|
133
138
|
},
|