@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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/obolnetwork/obol-sdk/issues"
@@ -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 incentives = yield this.request(`/${constants_1.DEFAULT_BASE_VERSION}/address/incentives/${address}`, {
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';
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/obolnetwork/obol-sdk/issues"
@@ -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 incentives = yield this.request(`/${DEFAULT_BASE_VERSION}/address/incentives/${address}`, {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/obolnetwork/obol-sdk/issues"
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 { type Incentives as IncentivesType, type ETH_ADDRESS } from './types';
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
  },