@ar.io/sdk 3.9.0-alpha.5 → 3.9.0-alpha.6
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/bundles/web.bundle.min.js +77 -59
- package/lib/cjs/common/io.js +12 -6
- package/lib/cjs/utils/arweave.js +87 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/io.js +13 -7
- package/lib/esm/utils/arweave.js +83 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/contracts/ao-process.d.ts +1 -1
- package/lib/types/utils/arweave.d.ts +18 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/common/io.js
CHANGED
|
@@ -84,10 +84,11 @@ class ARIOReadable {
|
|
|
84
84
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
85
85
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
86
86
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
87
|
-
const epochData = await (0, arweave_js_1.
|
|
87
|
+
const epochData = await (0, arweave_js_1.getEpochDataFromGqlWithCUFallback)({
|
|
88
88
|
arweave: this.arweave,
|
|
89
89
|
epochIndex: epochIndex,
|
|
90
90
|
processId: this.process.processId,
|
|
91
|
+
ao: this.process.ao,
|
|
91
92
|
});
|
|
92
93
|
return (0, arweave_js_1.removeEligibleRewardsFromEpochData)(epochData);
|
|
93
94
|
}
|
|
@@ -211,7 +212,8 @@ class ARIOReadable {
|
|
|
211
212
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
212
213
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
213
214
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
214
|
-
const epochData = await (0, arweave_js_1.
|
|
215
|
+
const epochData = await (0, arweave_js_1.getEpochDataFromGqlWithCUFallback)({
|
|
216
|
+
ao: this.process.ao,
|
|
215
217
|
arweave: this.arweave,
|
|
216
218
|
epochIndex: epochIndex,
|
|
217
219
|
processId: this.process.processId,
|
|
@@ -233,10 +235,11 @@ class ARIOReadable {
|
|
|
233
235
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
234
236
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
235
237
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
236
|
-
const epochData = await (0, arweave_js_1.
|
|
238
|
+
const epochData = await (0, arweave_js_1.getEpochDataFromGqlWithCUFallback)({
|
|
237
239
|
arweave: this.arweave,
|
|
238
240
|
epochIndex: epochIndex,
|
|
239
241
|
processId: this.process.processId,
|
|
242
|
+
ao: this.process.ao,
|
|
240
243
|
});
|
|
241
244
|
return epochData?.prescribedNames;
|
|
242
245
|
}
|
|
@@ -256,10 +259,11 @@ class ARIOReadable {
|
|
|
256
259
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
257
260
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
258
261
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
259
|
-
const epochData = await (0, arweave_js_1.
|
|
262
|
+
const epochData = await (0, arweave_js_1.getEpochDataFromGqlWithCUFallback)({
|
|
260
263
|
arweave: this.arweave,
|
|
261
264
|
epochIndex: epochIndex,
|
|
262
265
|
processId: this.process.processId,
|
|
266
|
+
ao: this.process.ao,
|
|
263
267
|
});
|
|
264
268
|
return epochData?.observations;
|
|
265
269
|
}
|
|
@@ -279,10 +283,11 @@ class ARIOReadable {
|
|
|
279
283
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
280
284
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
281
285
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
282
|
-
const epochData = await (0, arweave_js_1.
|
|
286
|
+
const epochData = await (0, arweave_js_1.getEpochDataFromGqlWithCUFallback)({
|
|
283
287
|
arweave: this.arweave,
|
|
284
288
|
epochIndex: epochIndex,
|
|
285
289
|
processId: this.process.processId,
|
|
290
|
+
ao: this.process.ao,
|
|
286
291
|
});
|
|
287
292
|
return epochData?.distributions;
|
|
288
293
|
}
|
|
@@ -302,10 +307,11 @@ class ARIOReadable {
|
|
|
302
307
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
303
308
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
304
309
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
305
|
-
const epochData = await (0, arweave_js_1.
|
|
310
|
+
const epochData = await (0, arweave_js_1.getEpochDataFromGqlWithCUFallback)({
|
|
306
311
|
arweave: this.arweave,
|
|
307
312
|
epochIndex: epochIndex,
|
|
308
313
|
processId: this.process.processId,
|
|
314
|
+
ao: this.process.ao,
|
|
309
315
|
});
|
|
310
316
|
return (0, arweave_js_1.sortAndPaginateEpochDataIntoEligibleDistributions)(epochData, params);
|
|
311
317
|
}
|
package/lib/cjs/utils/arweave.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeEligibleRewardsFromEpochData = exports.sortAndPaginateEpochDataIntoEligibleDistributions = exports.epochDistributionNoticeGqlQuery = exports.getEpochDataFromGql = exports.paginationParamsToTags = exports.pruneTags = exports.isBlockHeight = exports.validateArweaveId = void 0;
|
|
3
|
+
exports.removeEligibleRewardsFromEpochData = exports.sortAndPaginateEpochDataIntoEligibleDistributions = exports.epochDistributionNoticeGqlQueryFallback = exports.epochDistributionNoticeGqlQuery = exports.getEpochDataFromGqlFallback = exports.getEpochDataFromGqlWithCUFallback = exports.getEpochDataFromGql = exports.paginationParamsToTags = exports.pruneTags = exports.isBlockHeight = exports.validateArweaveId = void 0;
|
|
4
4
|
const constants_js_1 = require("../constants.js");
|
|
5
5
|
const io_js_1 = require("../types/io.js");
|
|
6
6
|
const ao_js_1 = require("./ao.js");
|
|
@@ -69,6 +69,66 @@ const getEpochDataFromGql = async ({ arweave, epochIndex, processId = constants_
|
|
|
69
69
|
return undefined;
|
|
70
70
|
};
|
|
71
71
|
exports.getEpochDataFromGql = getEpochDataFromGql;
|
|
72
|
+
const getEpochDataFromGqlWithCUFallback = async ({ arweave, ao, epochIndex, processId = constants_js_1.ARIO_MAINNET_PROCESS_ID, }) => {
|
|
73
|
+
const gqlResult = await (0, exports.getEpochDataFromGql)({
|
|
74
|
+
arweave,
|
|
75
|
+
epochIndex,
|
|
76
|
+
processId,
|
|
77
|
+
});
|
|
78
|
+
if (gqlResult) {
|
|
79
|
+
return gqlResult;
|
|
80
|
+
}
|
|
81
|
+
const gqlFallbackResult = await (0, exports.getEpochDataFromGqlFallback)({
|
|
82
|
+
ao,
|
|
83
|
+
epochIndex,
|
|
84
|
+
processId,
|
|
85
|
+
});
|
|
86
|
+
if (gqlFallbackResult) {
|
|
87
|
+
return gqlFallbackResult;
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
};
|
|
91
|
+
exports.getEpochDataFromGqlWithCUFallback = getEpochDataFromGqlWithCUFallback;
|
|
92
|
+
const getEpochDataFromGqlFallback = async ({ ao, epochIndex, processId = constants_js_1.ARIO_MAINNET_PROCESS_ID, gqlUrl = 'https://arweave-search.goldsky.com/graphql', }) => {
|
|
93
|
+
const query = (0, exports.epochDistributionNoticeGqlQueryFallback)({
|
|
94
|
+
epochIndex,
|
|
95
|
+
processId,
|
|
96
|
+
});
|
|
97
|
+
const response = await fetch(gqlUrl, {
|
|
98
|
+
method: 'POST',
|
|
99
|
+
body: query,
|
|
100
|
+
headers: {
|
|
101
|
+
'Content-Type': 'application/json',
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
const responseJson = (await response.json());
|
|
105
|
+
if (responseJson.data.transactions.edges.length === 0) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
for (const edge of responseJson.data.transactions.edges) {
|
|
109
|
+
const id = edge.node.id;
|
|
110
|
+
const messageResult = await ao
|
|
111
|
+
.result({
|
|
112
|
+
message: id,
|
|
113
|
+
process: processId,
|
|
114
|
+
})
|
|
115
|
+
.catch(() => undefined);
|
|
116
|
+
if (!messageResult) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
for (const message of messageResult.Messages) {
|
|
120
|
+
const data = JSON.parse(message.Data);
|
|
121
|
+
const tags = message.Tags;
|
|
122
|
+
// check if the message results include epoch-distribution-notice for the requested epoch index
|
|
123
|
+
if (tags.some((tag) => tag.name === 'Action' && tag.value === 'Epoch-Distribution-Notice') &&
|
|
124
|
+
tags.some((tag) => tag.name === 'Epoch-Index' && tag.value === epochIndex.toString())) {
|
|
125
|
+
return (0, ao_js_1.parseAoEpochData)(data);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
};
|
|
131
|
+
exports.getEpochDataFromGqlFallback = getEpochDataFromGqlFallback;
|
|
72
132
|
/**
|
|
73
133
|
* Get the epoch with distribution data for the current epoch
|
|
74
134
|
* @param arweave - The Arweave instance
|
|
@@ -104,6 +164,32 @@ const epochDistributionNoticeGqlQuery = ({ epochIndex, processId = constants_js_
|
|
|
104
164
|
return gqlQuery;
|
|
105
165
|
};
|
|
106
166
|
exports.epochDistributionNoticeGqlQuery = epochDistributionNoticeGqlQuery;
|
|
167
|
+
// fallback query if the distribution notice does not get cranked
|
|
168
|
+
const epochDistributionNoticeGqlQueryFallback = ({ processId = constants_js_1.ARIO_MAINNET_PROCESS_ID, owners = ['OAb-n-ZugyN598kZNpfOy0ACelGVmwCQ0kYbgNGDUK8'], // ar.io team wallet ticks once a day
|
|
169
|
+
}) => {
|
|
170
|
+
return JSON.stringify({
|
|
171
|
+
query: `
|
|
172
|
+
query {
|
|
173
|
+
transactions(
|
|
174
|
+
tags: [
|
|
175
|
+
{ name: "Action", values: ["Tick"] }
|
|
176
|
+
],
|
|
177
|
+
first: 100,
|
|
178
|
+
owners: [${owners.map((a) => `"${a}"`).join(',')}],
|
|
179
|
+
recipients: ["${processId}"],
|
|
180
|
+
sort: HEIGHT_DESC
|
|
181
|
+
) {
|
|
182
|
+
edges {
|
|
183
|
+
node {
|
|
184
|
+
id
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
`,
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
exports.epochDistributionNoticeGqlQueryFallback = epochDistributionNoticeGqlQueryFallback;
|
|
107
193
|
function sortAndPaginateEpochDataIntoEligibleDistributions(epochData, params) {
|
|
108
194
|
const rewards = [];
|
|
109
195
|
const sortBy = params?.sortBy ?? 'eligibleReward';
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/io.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ARIO_MAINNET_PROCESS_ID } from '../constants.js';
|
|
2
2
|
import { isProcessConfiguration, isProcessIdConfiguration, } from '../types/io.js';
|
|
3
3
|
import { createAoSigner } from '../utils/ao.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getEpochDataFromGqlWithCUFallback, paginationParamsToTags, pruneTags, removeEligibleRewardsFromEpochData, sortAndPaginateEpochDataIntoEligibleDistributions, } from '../utils/arweave.js';
|
|
5
5
|
import { defaultArweave } from './arweave.js';
|
|
6
6
|
import { AOProcess } from './contracts/ao-process.js';
|
|
7
7
|
import { InvalidContractConfigurationError } from './error.js';
|
|
@@ -80,10 +80,11 @@ export class ARIOReadable {
|
|
|
80
80
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
81
81
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
82
82
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
83
|
-
const epochData = await
|
|
83
|
+
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
84
84
|
arweave: this.arweave,
|
|
85
85
|
epochIndex: epochIndex,
|
|
86
86
|
processId: this.process.processId,
|
|
87
|
+
ao: this.process.ao,
|
|
87
88
|
});
|
|
88
89
|
return removeEligibleRewardsFromEpochData(epochData);
|
|
89
90
|
}
|
|
@@ -207,7 +208,8 @@ export class ARIOReadable {
|
|
|
207
208
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
208
209
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
209
210
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
210
|
-
const epochData = await
|
|
211
|
+
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
212
|
+
ao: this.process.ao,
|
|
211
213
|
arweave: this.arweave,
|
|
212
214
|
epochIndex: epochIndex,
|
|
213
215
|
processId: this.process.processId,
|
|
@@ -229,10 +231,11 @@ export class ARIOReadable {
|
|
|
229
231
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
230
232
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
231
233
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
232
|
-
const epochData = await
|
|
234
|
+
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
233
235
|
arweave: this.arweave,
|
|
234
236
|
epochIndex: epochIndex,
|
|
235
237
|
processId: this.process.processId,
|
|
238
|
+
ao: this.process.ao,
|
|
236
239
|
});
|
|
237
240
|
return epochData?.prescribedNames;
|
|
238
241
|
}
|
|
@@ -252,10 +255,11 @@ export class ARIOReadable {
|
|
|
252
255
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
253
256
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
254
257
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
255
|
-
const epochData = await
|
|
258
|
+
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
256
259
|
arweave: this.arweave,
|
|
257
260
|
epochIndex: epochIndex,
|
|
258
261
|
processId: this.process.processId,
|
|
262
|
+
ao: this.process.ao,
|
|
259
263
|
});
|
|
260
264
|
return epochData?.observations;
|
|
261
265
|
}
|
|
@@ -275,10 +279,11 @@ export class ARIOReadable {
|
|
|
275
279
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
276
280
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
277
281
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
278
|
-
const epochData = await
|
|
282
|
+
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
279
283
|
arweave: this.arweave,
|
|
280
284
|
epochIndex: epochIndex,
|
|
281
285
|
processId: this.process.processId,
|
|
286
|
+
ao: this.process.ao,
|
|
282
287
|
});
|
|
283
288
|
return epochData?.distributions;
|
|
284
289
|
}
|
|
@@ -298,10 +303,11 @@ export class ARIOReadable {
|
|
|
298
303
|
const epochIndex = await this.computeEpochIndex(epoch);
|
|
299
304
|
const currentIndex = await this.computeCurrentEpochIndex();
|
|
300
305
|
if (epochIndex !== undefined && epochIndex < currentIndex) {
|
|
301
|
-
const epochData = await
|
|
306
|
+
const epochData = await getEpochDataFromGqlWithCUFallback({
|
|
302
307
|
arweave: this.arweave,
|
|
303
308
|
epochIndex: epochIndex,
|
|
304
309
|
processId: this.process.processId,
|
|
310
|
+
ao: this.process.ao,
|
|
305
311
|
});
|
|
306
312
|
return sortAndPaginateEpochDataIntoEligibleDistributions(epochData, params);
|
|
307
313
|
}
|
package/lib/esm/utils/arweave.js
CHANGED
|
@@ -61,6 +61,64 @@ export const getEpochDataFromGql = async ({ arweave, epochIndex, processId = ARI
|
|
|
61
61
|
}
|
|
62
62
|
return undefined;
|
|
63
63
|
};
|
|
64
|
+
export const getEpochDataFromGqlWithCUFallback = async ({ arweave, ao, epochIndex, processId = ARIO_MAINNET_PROCESS_ID, }) => {
|
|
65
|
+
const gqlResult = await getEpochDataFromGql({
|
|
66
|
+
arweave,
|
|
67
|
+
epochIndex,
|
|
68
|
+
processId,
|
|
69
|
+
});
|
|
70
|
+
if (gqlResult) {
|
|
71
|
+
return gqlResult;
|
|
72
|
+
}
|
|
73
|
+
const gqlFallbackResult = await getEpochDataFromGqlFallback({
|
|
74
|
+
ao,
|
|
75
|
+
epochIndex,
|
|
76
|
+
processId,
|
|
77
|
+
});
|
|
78
|
+
if (gqlFallbackResult) {
|
|
79
|
+
return gqlFallbackResult;
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
};
|
|
83
|
+
export const getEpochDataFromGqlFallback = async ({ ao, epochIndex, processId = ARIO_MAINNET_PROCESS_ID, gqlUrl = 'https://arweave-search.goldsky.com/graphql', }) => {
|
|
84
|
+
const query = epochDistributionNoticeGqlQueryFallback({
|
|
85
|
+
epochIndex,
|
|
86
|
+
processId,
|
|
87
|
+
});
|
|
88
|
+
const response = await fetch(gqlUrl, {
|
|
89
|
+
method: 'POST',
|
|
90
|
+
body: query,
|
|
91
|
+
headers: {
|
|
92
|
+
'Content-Type': 'application/json',
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
const responseJson = (await response.json());
|
|
96
|
+
if (responseJson.data.transactions.edges.length === 0) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
for (const edge of responseJson.data.transactions.edges) {
|
|
100
|
+
const id = edge.node.id;
|
|
101
|
+
const messageResult = await ao
|
|
102
|
+
.result({
|
|
103
|
+
message: id,
|
|
104
|
+
process: processId,
|
|
105
|
+
})
|
|
106
|
+
.catch(() => undefined);
|
|
107
|
+
if (!messageResult) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
for (const message of messageResult.Messages) {
|
|
111
|
+
const data = JSON.parse(message.Data);
|
|
112
|
+
const tags = message.Tags;
|
|
113
|
+
// check if the message results include epoch-distribution-notice for the requested epoch index
|
|
114
|
+
if (tags.some((tag) => tag.name === 'Action' && tag.value === 'Epoch-Distribution-Notice') &&
|
|
115
|
+
tags.some((tag) => tag.name === 'Epoch-Index' && tag.value === epochIndex.toString())) {
|
|
116
|
+
return parseAoEpochData(data);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return undefined;
|
|
121
|
+
};
|
|
64
122
|
/**
|
|
65
123
|
* Get the epoch with distribution data for the current epoch
|
|
66
124
|
* @param arweave - The Arweave instance
|
|
@@ -95,6 +153,31 @@ export const epochDistributionNoticeGqlQuery = ({ epochIndex, processId = ARIO_M
|
|
|
95
153
|
});
|
|
96
154
|
return gqlQuery;
|
|
97
155
|
};
|
|
156
|
+
// fallback query if the distribution notice does not get cranked
|
|
157
|
+
export const epochDistributionNoticeGqlQueryFallback = ({ processId = ARIO_MAINNET_PROCESS_ID, owners = ['OAb-n-ZugyN598kZNpfOy0ACelGVmwCQ0kYbgNGDUK8'], // ar.io team wallet ticks once a day
|
|
158
|
+
}) => {
|
|
159
|
+
return JSON.stringify({
|
|
160
|
+
query: `
|
|
161
|
+
query {
|
|
162
|
+
transactions(
|
|
163
|
+
tags: [
|
|
164
|
+
{ name: "Action", values: ["Tick"] }
|
|
165
|
+
],
|
|
166
|
+
first: 100,
|
|
167
|
+
owners: [${owners.map((a) => `"${a}"`).join(',')}],
|
|
168
|
+
recipients: ["${processId}"],
|
|
169
|
+
sort: HEIGHT_DESC
|
|
170
|
+
) {
|
|
171
|
+
edges {
|
|
172
|
+
node {
|
|
173
|
+
id
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
`,
|
|
179
|
+
});
|
|
180
|
+
};
|
|
98
181
|
export function sortAndPaginateEpochDataIntoEligibleDistributions(epochData, params) {
|
|
99
182
|
const rewards = [];
|
|
100
183
|
const sortBy = params?.sortBy ?? 'eligibleReward';
|
package/lib/esm/version.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AOContract, AoClient, AoSigner } from '../../types/index.js';
|
|
|
2
2
|
import { ILogger } from '../logger.js';
|
|
3
3
|
export declare class AOProcess implements AOContract {
|
|
4
4
|
private logger;
|
|
5
|
-
|
|
5
|
+
readonly ao: AoClient;
|
|
6
6
|
readonly processId: string;
|
|
7
7
|
constructor({ processId, ao, logger, }: {
|
|
8
8
|
processId: string;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import Arweave from 'arweave';
|
|
17
|
-
import { BlockHeight } from '../types/common.js';
|
|
17
|
+
import { AoClient, BlockHeight } from '../types/common.js';
|
|
18
18
|
import { AoEligibleDistribution, AoEpochData, AoEpochDistributed, PaginationParams, PaginationResult } from '../types/io.js';
|
|
19
19
|
export declare const validateArweaveId: (id: string) => boolean;
|
|
20
20
|
export declare function isBlockHeight(height: string | number): height is BlockHeight;
|
|
@@ -46,6 +46,18 @@ export declare const getEpochDataFromGql: ({ arweave, epochIndex, processId, ret
|
|
|
46
46
|
retries?: number;
|
|
47
47
|
gqlUrl?: string;
|
|
48
48
|
}) => Promise<AoEpochData<AoEpochDistributed> | undefined>;
|
|
49
|
+
export declare const getEpochDataFromGqlWithCUFallback: ({ arweave, ao, epochIndex, processId, }: {
|
|
50
|
+
arweave: Arweave;
|
|
51
|
+
ao: AoClient;
|
|
52
|
+
epochIndex: number;
|
|
53
|
+
processId?: string;
|
|
54
|
+
}) => Promise<AoEpochData<AoEpochDistributed> | undefined>;
|
|
55
|
+
export declare const getEpochDataFromGqlFallback: ({ ao, epochIndex, processId, gqlUrl, }: {
|
|
56
|
+
ao: AoClient;
|
|
57
|
+
epochIndex: number;
|
|
58
|
+
processId?: string;
|
|
59
|
+
gqlUrl?: string;
|
|
60
|
+
}) => Promise<AoEpochData<AoEpochDistributed> | undefined>;
|
|
49
61
|
/**
|
|
50
62
|
* Get the epoch with distribution data for the current epoch
|
|
51
63
|
* @param arweave - The Arweave instance
|
|
@@ -58,5 +70,10 @@ export declare const epochDistributionNoticeGqlQuery: ({ epochIndex, processId,
|
|
|
58
70
|
processId?: string | undefined;
|
|
59
71
|
authorities?: string[] | undefined;
|
|
60
72
|
}) => string;
|
|
73
|
+
export declare const epochDistributionNoticeGqlQueryFallback: ({ processId, owners, }: {
|
|
74
|
+
epochIndex: number;
|
|
75
|
+
processId?: string;
|
|
76
|
+
owners?: string[];
|
|
77
|
+
}) => string;
|
|
61
78
|
export declare function sortAndPaginateEpochDataIntoEligibleDistributions(epochData?: AoEpochData, params?: PaginationParams<AoEligibleDistribution>): PaginationResult<AoEligibleDistribution>;
|
|
62
79
|
export declare function removeEligibleRewardsFromEpochData(epochData?: AoEpochData): AoEpochData | undefined;
|
package/lib/types/version.d.ts
CHANGED