@ar.io/sdk 3.4.1-alpha.1 → 3.4.1

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.
@@ -107,17 +107,13 @@ exports.getEpoch = getEpoch;
107
107
  async function getPrescribedObservers(o) {
108
108
  const epoch = (0, utils_js_1.epochInputFromOptions)(o);
109
109
  const result = await (0, utils_js_1.readARIOFromOptions)(o).getPrescribedObservers(epoch);
110
- return result?.length
111
- ? result
112
- : { message: `No prescribed observers found for epoch ${epoch}` };
110
+ return (result ?? { message: `No prescribed observers found for epoch ${epoch}` });
113
111
  }
114
112
  exports.getPrescribedObservers = getPrescribedObservers;
115
113
  async function getPrescribedNames(o) {
116
114
  const epoch = (0, utils_js_1.epochInputFromOptions)(o);
117
115
  const result = await (0, utils_js_1.readARIOFromOptions)(o).getPrescribedNames((0, utils_js_1.epochInputFromOptions)(o));
118
- return result?.length
119
- ? result
120
- : { message: `No prescribed names found for epoch ${epoch}` };
116
+ return result ?? { message: `No prescribed names found for epoch ${epoch}` };
121
117
  }
122
118
  exports.getPrescribedNames = getPrescribedNames;
123
119
  async function getTokenCost(o) {
@@ -205,6 +205,16 @@ class ARIOReadable {
205
205
  });
206
206
  }
207
207
  async getPrescribedObservers(epoch) {
208
+ const epochIndex = await this.computeEpochIndex(epoch);
209
+ const currentIndex = await this.computeCurrentEpochIndex();
210
+ if (epochIndex !== undefined && +epochIndex < currentIndex) {
211
+ const epochData = await (0, arweave_js_1.getEpochDataFromGql)({
212
+ arweave: this.arweave,
213
+ epochIndex: +epochIndex,
214
+ processId: this.process.processId,
215
+ });
216
+ return epochData?.prescribedObservers;
217
+ }
208
218
  const allTags = [
209
219
  { name: 'Action', value: 'Epoch-Prescribed-Observers' },
210
220
  { name: 'Epoch-Index', value: await this.computeEpochIndex(epoch) },
@@ -214,6 +224,16 @@ class ARIOReadable {
214
224
  });
215
225
  }
216
226
  async getPrescribedNames(epoch) {
227
+ const epochIndex = await this.computeEpochIndex(epoch);
228
+ const currentIndex = await this.computeCurrentEpochIndex();
229
+ if (epochIndex !== undefined && +epochIndex < currentIndex) {
230
+ const epochData = await (0, arweave_js_1.getEpochDataFromGql)({
231
+ arweave: this.arweave,
232
+ epochIndex: +epochIndex,
233
+ processId: this.process.processId,
234
+ });
235
+ return epochData?.prescribedNames;
236
+ }
217
237
  const allTags = [
218
238
  { name: 'Action', value: 'Epoch-Prescribed-Names' },
219
239
  { name: 'Epoch-Index', value: await this.computeEpochIndex(epoch) },
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '3.4.1-alpha.1';
20
+ exports.version = '3.4.1';
@@ -91,16 +91,12 @@ export async function getEpoch(o) {
91
91
  export async function getPrescribedObservers(o) {
92
92
  const epoch = epochInputFromOptions(o);
93
93
  const result = await readARIOFromOptions(o).getPrescribedObservers(epoch);
94
- return result?.length
95
- ? result
96
- : { message: `No prescribed observers found for epoch ${epoch}` };
94
+ return (result ?? { message: `No prescribed observers found for epoch ${epoch}` });
97
95
  }
98
96
  export async function getPrescribedNames(o) {
99
97
  const epoch = epochInputFromOptions(o);
100
98
  const result = await readARIOFromOptions(o).getPrescribedNames(epochInputFromOptions(o));
101
- return result?.length
102
- ? result
103
- : { message: `No prescribed names found for epoch ${epoch}` };
99
+ return result ?? { message: `No prescribed names found for epoch ${epoch}` };
104
100
  }
105
101
  export async function getTokenCost(o) {
106
102
  const tokenCost = await readARIOFromOptions(o).getTokenCost(getTokenCostParamsFromOptions(o));
@@ -201,6 +201,16 @@ export class ARIOReadable {
201
201
  });
202
202
  }
203
203
  async getPrescribedObservers(epoch) {
204
+ const epochIndex = await this.computeEpochIndex(epoch);
205
+ const currentIndex = await this.computeCurrentEpochIndex();
206
+ if (epochIndex !== undefined && +epochIndex < currentIndex) {
207
+ const epochData = await getEpochDataFromGql({
208
+ arweave: this.arweave,
209
+ epochIndex: +epochIndex,
210
+ processId: this.process.processId,
211
+ });
212
+ return epochData?.prescribedObservers;
213
+ }
204
214
  const allTags = [
205
215
  { name: 'Action', value: 'Epoch-Prescribed-Observers' },
206
216
  { name: 'Epoch-Index', value: await this.computeEpochIndex(epoch) },
@@ -210,6 +220,16 @@ export class ARIOReadable {
210
220
  });
211
221
  }
212
222
  async getPrescribedNames(epoch) {
223
+ const epochIndex = await this.computeEpochIndex(epoch);
224
+ const currentIndex = await this.computeCurrentEpochIndex();
225
+ if (epochIndex !== undefined && +epochIndex < currentIndex) {
226
+ const epochData = await getEpochDataFromGql({
227
+ arweave: this.arweave,
228
+ epochIndex: +epochIndex,
229
+ processId: this.process.processId,
230
+ });
231
+ return epochData?.prescribedNames;
232
+ }
213
233
  const allTags = [
214
234
  { name: 'Action', value: 'Epoch-Prescribed-Names' },
215
235
  { name: 'Epoch-Index', value: await this.computeEpochIndex(epoch) },
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '3.4.1-alpha.1';
17
+ export const version = '3.4.1';
@@ -72,8 +72,8 @@ export declare class ARIOReadable implements AoARIORead {
72
72
  getGatewayDelegateAllowList({ address, ...pageParams }: AoPaginatedAddressParams): Promise<PaginationResult<WalletAddress>>;
73
73
  getGateways(pageParams?: PaginationParams<AoGatewayWithAddress>): Promise<PaginationResult<AoGatewayWithAddress>>;
74
74
  getCurrentEpoch(): Promise<AoEpochData>;
75
- getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[]>;
76
- getPrescribedNames(epoch?: EpochInput): Promise<string[]>;
75
+ getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[] | undefined>;
76
+ getPrescribedNames(epoch?: EpochInput): Promise<string[] | undefined>;
77
77
  getObservations(epoch?: EpochInput): Promise<AoEpochObservationData | undefined>;
78
78
  getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData | undefined>;
79
79
  getTokenCost(params: {
@@ -430,8 +430,8 @@ export interface AoARIORead {
430
430
  }): Promise<AoReturnedName | undefined>;
431
431
  getEpoch(epoch?: EpochInput): Promise<AoEpochData | undefined>;
432
432
  getCurrentEpoch(): Promise<AoEpochData>;
433
- getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[]>;
434
- getPrescribedNames(epoch?: EpochInput): Promise<string[]>;
433
+ getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[] | undefined>;
434
+ getPrescribedNames(epoch?: EpochInput): Promise<string[] | undefined>;
435
435
  getObservations(epoch?: EpochInput): Promise<AoEpochObservationData | undefined>;
436
436
  getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData | undefined>;
437
437
  getTokenCost({ intent, type, years, name, quantity, }: AoTokenCostParams): Promise<number>;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "3.4.0";
16
+ export declare const version = "3.4.1-alpha.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.4.1-alpha.1",
3
+ "version": "3.4.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"