diff --git a/README.md b/README.md index 13d2f5cd..5bf5006a 100644 --- a/README.md +++ b/README.md @@ -485,7 +485,6 @@ const previousEpochObservers = arIO.getPrescribedObservers({ Return the auction info for the supplied domain, be it in auction, registered, or available to auction. ```typescript - const auction = await arIO.getAuction({ domain }); // output @@ -592,3 +591,4 @@ For more information on how to contribute, please see [CONTRIBUTING.md]. [examples]: ./examples [arns-service]: https://github.com/ar-io/arns-service [CONTRIBUTING.md]: ./CONTRIBUTING.md +``` diff --git a/src/common.ts b/src/common.ts index 8400d324..de1d4f16 100644 --- a/src/common.ts +++ b/src/common.ts @@ -102,8 +102,17 @@ export interface ArIOContract { getDistributions({ evaluationOptions, }: EvaluationParameters): Promise; - getAuctions({ evaluationOptions }: EvaluationParameters): Promise>; - getAuction({ domain, type, evaluationOptions }: EvaluationParameters<{ domain: string; type?: RegistrationType }>): Promise + getAuctions({ + evaluationOptions, + }: EvaluationParameters): Promise>; + getAuction({ + domain, + type, + evaluationOptions, + }: EvaluationParameters<{ + domain: string; + type?: RegistrationType; + }>): Promise; } /* eslint-disable @typescript-eslint/no-explicit-any */ diff --git a/src/common/ar-io.ts b/src/common/ar-io.ts index 0b8c588c..fbd19849 100644 --- a/src/common/ar-io.ts +++ b/src/common/ar-io.ts @@ -34,11 +34,11 @@ import { RemoteContract } from './contracts/remote-contract.js'; // TODO: append this with other configuration options (e.g. local vs. remote evaluation) export type ContractConfiguration = | { - contract?: SmartWeaveContract; - } + contract?: SmartWeaveContract; + } | { - contractTxId: string; - }; + contractTxId: string; + }; function isContractConfiguration( config: ContractConfiguration, @@ -219,7 +219,14 @@ export class ArIO implements ArIOContract { return distributions; } - async getAuction({ domain, type, evaluationOptions }: EvaluationParameters<{ domain: string; type?: RegistrationType }>): Promise { + async getAuction({ + domain, + type, + evaluationOptions, + }: EvaluationParameters<{ + domain: string; + type?: RegistrationType; + }>): Promise { return this.contract.readInteraction({ functionName: 'auction', inputs: { @@ -229,11 +236,15 @@ export class ArIO implements ArIOContract { evaluationOptions, }); } - async getAuctions({ evaluationOptions }: { evaluationOptions?: EvaluationOptions | Record | undefined; }): Promise> { + async getAuctions({ + evaluationOptions, + }: { + evaluationOptions?: EvaluationOptions | Record | undefined; + }): Promise> { const { auctions } = await this.contract.getContractState({ evaluationOptions, }); - return auctions + return auctions; } } diff --git a/tests/ar-io.test.ts b/tests/ar-io.test.ts index 883c1652..2f1c6416 100644 --- a/tests/ar-io.test.ts +++ b/tests/ar-io.test.ts @@ -240,7 +240,7 @@ describe('ArIO Client', () => { `should return auction for provided evaluation options: ${JSON.stringify('%s')}`, async (evalTo) => { const auction = await arIO.getAuction({ - domain: "ardrive", + domain: 'ardrive', evaluationOptions: { evalTo }, }); expect(auction).toBeDefined(); @@ -259,5 +259,4 @@ describe('ArIO Client', () => { expect(auctions).toBeDefined(); }, ); - });