Skip to content

Commit 0958c8f

Browse files
authored
Merge pull request #230 from ardriveapp/change_contract_reader
fix(contract reader): switch to a PDS managed default contract cache
2 parents d0a2adb + e1270b4 commit 0958c8f

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ardrive-core-js",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "ArDrive Core contains the essential back end application features to support the ArDrive CLI and Desktop apps, such as file management, Permaweb upload/download, wallet management and other common functions.",
55
"main": "./lib/exports.js",
66
"types": "./lib/exports.d.ts",

src/community/ardrive_community_oracle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { CommunityOracle } from './community_oracle';
44
import { ArDriveContractOracle } from './ardrive_contract_oracle';
55
import Arweave from 'arweave';
66
import { SmartweaveContractReader } from './smartweave_contract_oracle';
7-
import { VertoContractReader } from './verto_contract_oracle';
7+
import { PDSContractCacheServiceContractReader } from './pds_contract_oracle';
88
import { ADDR, ArweaveAddress, W, Winston } from '../types';
99

1010
/**
@@ -29,7 +29,7 @@ export class ArDriveCommunityOracle implements CommunityOracle {
2929
private readonly contractOracle: ContractOracle;
3030

3131
private defaultContractReaders: ContractReader[] = [
32-
new VertoContractReader(),
32+
new PDSContractCacheServiceContractReader(),
3333
new SmartweaveContractReader(this.arweave)
3434
];
3535

src/community/verto_contract_oracle.ts renamed to src/community/pds_contract_oracle.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { ContractReader } from './contract_oracle';
44

55
/**
66
* Oracle class responsible for retrieving and
7-
* reading Smartweave Contracts from the Verto cache
7+
* reading Smartweave Contracts from the PDS Contract Cache Microservice
88
*/
9-
export class VertoContractReader implements ContractReader {
9+
export class PDSContractCacheServiceContractReader implements ContractReader {
1010
/** Fetches smartweave contracts from the Verto cache */
1111
public async readContract(txId: TransactionID): Promise<unknown> {
12-
const response: AxiosResponse = await axios.get(`https://v2.cache.verto.exchange/${txId}`);
12+
const response: AxiosResponse = await axios.get(`https://api.arns.app/v1/contract/${txId}`);
1313
const contract = response.data;
1414
return contract.state;
1515
}

src/exports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export * from './community/community_oracle';
3535
export * from './community/contract_oracle';
3636
export * from './community/contract_types';
3737
export * from './community/smartweave_contract_oracle';
38-
export * from './community/verto_contract_oracle';
38+
export * from './community/pds_contract_oracle';
3939

4040
// Pricing
4141
export * from './pricing/ar_data_price';

tests/integration/arlocal.int.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ import {
7070
assertFolderMetaDataJson,
7171
assertFolderMetaDataGqlTags
7272
} from '../helpers/arlocal_test_assertions';
73-
import { CustomMetaData, CustomMetaDataJsonFields, VertoContractReader } from '../../src/exports';
73+
import { CustomMetaData, CustomMetaDataJsonFields, PDSContractCacheServiceContractReader } from '../../src/exports';
7474

7575
describe('ArLocal Integration Tests', function () {
7676
const wallet = readJWKFile('./test_wallet.json');
@@ -84,7 +84,7 @@ describe('ArLocal Integration Tests', function () {
8484
const fakeVersion = 'FAKE_VERSION';
8585

8686
const arweaveOracle = new GatewayOracle(gatewayUrlForArweave(arweave));
87-
const fakeContractReader = new VertoContractReader();
87+
const fakeContractReader = new PDSContractCacheServiceContractReader();
8888
stub(fakeContractReader, 'readContract').resolves(stubCommunityContract);
8989

9090
const communityOracle = new ArDriveCommunityOracle(arweave, [fakeContractReader]);

0 commit comments

Comments
 (0)