@ar.io/sdk 3.21.0 → 3.21.1-alpha.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.
- package/README.md +224 -5
- package/bundles/web.bundle.min.js +36 -35
- package/lib/cjs/utils/arweave.js +17 -6
- package/lib/cjs/version.js +1 -1
- package/lib/esm/utils/arweave.js +17 -6
- package/lib/esm/version.js +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/utils/arweave.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.epochDistributionNoticeGqlQueryFallback = exports.epochDistributionNotic
|
|
|
4
4
|
exports.isBlockHeight = isBlockHeight;
|
|
5
5
|
exports.sortAndPaginateEpochDataIntoEligibleDistributions = sortAndPaginateEpochDataIntoEligibleDistributions;
|
|
6
6
|
exports.removeEligibleRewardsFromEpochData = removeEligibleRewardsFromEpochData;
|
|
7
|
+
const logger_js_1 = require("../common/logger.js");
|
|
7
8
|
const constants_js_1 = require("../constants.js");
|
|
8
9
|
const io_js_1 = require("../types/io.js");
|
|
9
10
|
const ao_js_1 = require("./ao.js");
|
|
@@ -122,12 +123,22 @@ const getEpochDataFromGqlFallback = async ({ ao, epochIndex, processId = constan
|
|
|
122
123
|
continue;
|
|
123
124
|
}
|
|
124
125
|
for (const message of messageResult?.Messages ?? []) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
tags
|
|
130
|
-
|
|
126
|
+
if (!message.Data) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const tags = message.Tags;
|
|
131
|
+
// check if the message results include epoch-distribution-notice for the requested epoch index
|
|
132
|
+
if (tags.some((tag) => tag.name === 'Action' &&
|
|
133
|
+
tag.value === 'Epoch-Distribution-Notice') &&
|
|
134
|
+
tags.some((tag) => tag.name === 'Epoch-Index' && tag.value === epochIndex.toString())) {
|
|
135
|
+
const data = JSON.parse(message.Data);
|
|
136
|
+
return (0, ao_js_1.parseAoEpochData)(data);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
// report but continue to next message
|
|
141
|
+
logger_js_1.Logger.default.error('Failed to parse AO epoch distribution message:', error, '\nMessage:', message);
|
|
131
142
|
}
|
|
132
143
|
}
|
|
133
144
|
}
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/utils/arweave.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Logger } from '../common/logger.js';
|
|
1
2
|
import { ARIO_MAINNET_PROCESS_ID, ARWEAVE_TX_REGEX } from '../constants.js';
|
|
2
3
|
import { isDistributedEpoch, } from '../types/io.js';
|
|
3
4
|
import { parseAoEpochData } from './ao.js';
|
|
@@ -111,12 +112,22 @@ export const getEpochDataFromGqlFallback = async ({ ao, epochIndex, processId =
|
|
|
111
112
|
continue;
|
|
112
113
|
}
|
|
113
114
|
for (const message of messageResult?.Messages ?? []) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
tags
|
|
119
|
-
|
|
115
|
+
if (!message.Data) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
const tags = message.Tags;
|
|
120
|
+
// check if the message results include epoch-distribution-notice for the requested epoch index
|
|
121
|
+
if (tags.some((tag) => tag.name === 'Action' &&
|
|
122
|
+
tag.value === 'Epoch-Distribution-Notice') &&
|
|
123
|
+
tags.some((tag) => tag.name === 'Epoch-Index' && tag.value === epochIndex.toString())) {
|
|
124
|
+
const data = JSON.parse(message.Data);
|
|
125
|
+
return parseAoEpochData(data);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
// report but continue to next message
|
|
130
|
+
Logger.default.error('Failed to parse AO epoch distribution message:', error, '\nMessage:', message);
|
|
120
131
|
}
|
|
121
132
|
}
|
|
122
133
|
}
|
package/lib/esm/version.js
CHANGED
package/lib/types/version.d.ts
CHANGED