Skip to content

Commit

Permalink
Merge pull request #103 from ar-io/arns-observe
Browse files Browse the repository at this point in the history
fix(observe): set `Accept-Encoding` header when fetching arns data, update reference gateway
  • Loading branch information
kunstmusik authored Nov 4, 2024
2 parents 60f5f31 + 4de5435 commit a9e7bfe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

* Updated header style of cards
* Observations: Updated to use arweave.net for reference domain when generating observation report

## [1.3.0] - 2024-10-21

Expand Down
5 changes: 5 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ export const EAY_TOOLTIP_FORMULA =

export const OPERATOR_EAY_TOOLTIP_FORMULA =
'\\(EAY = \\frac{OperatorRewardsPerEpoch}{OperatorStake} * EpochsPerYear\\)';

// OBSERVATION ASSESSMENT CONSTANTS
export const NAME_PASS_THRESHOLD = 0.8;
export const REFERENCE_GATEWAY_FQDN =
process.env.VITE_REFERENCE_GATEWAY_FQDN ?? 'arweave.net';
4 changes: 4 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export const fetchWithTimeout = async (resource:string, options?:RequestInit, ti

const response = await fetch(resource, {
...options,
headers: {
...options?.headers,
'Accept-Encoding': 'identity'
},
signal: controller.signal
});
clearTimeout(id);
Expand Down
5 changes: 1 addition & 4 deletions src/utils/observations.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
/* Based on code by elliotsayes from https://github.com/elliotsayes/gateway-explorer */

import { AoGatewayWithAddress } from '@ar.io/sdk/web';
import { log } from '@src/constants';
import { log, NAME_PASS_THRESHOLD, REFERENCE_GATEWAY_FQDN } from '@src/constants';
import { ArNSAssessment, Assessment, OwnershipAssessment } from '@src/types';
import { arrayBufferToBase64Url, fetchWithTimeout } from '.';

const NAME_PASS_THRESHOLD = 0.8;
const REFERENCE_GATEWAY_FQDN = 'ar-io.dev';

export const assessOwnership = async (
gateway: AoGatewayWithAddress,
): Promise<OwnershipAssessment> => {
Expand Down

0 comments on commit a9e7bfe

Please sign in to comment.