Skip to content

Commit

Permalink
fix(formating): format
Browse files Browse the repository at this point in the history
  • Loading branch information
Atticus committed Mar 15, 2024
1 parent faf08c5 commit 3f30f77
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
```
13 changes: 11 additions & 2 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,17 @@ export interface ArIOContract {
getDistributions({
evaluationOptions,
}: EvaluationParameters): Promise<EpochDistributionData>;
getAuctions({ evaluationOptions }: EvaluationParameters): Promise<Record<string, ArNSAuctionData>>;
getAuction({ domain, type, evaluationOptions }: EvaluationParameters<{ domain: string; type?: RegistrationType }>): Promise<ArNSAuctionData>
getAuctions({
evaluationOptions,
}: EvaluationParameters): Promise<Record<string, ArNSAuctionData>>;
getAuction({
domain,
type,
evaluationOptions,
}: EvaluationParameters<{
domain: string;
type?: RegistrationType;
}>): Promise<ArNSAuctionData>;
}

/* eslint-disable @typescript-eslint/no-explicit-any */
Expand Down
25 changes: 18 additions & 7 deletions src/common/ar-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<unknown>;
}
contract?: SmartWeaveContract<unknown>;
}
| {
contractTxId: string;
};
contractTxId: string;
};

function isContractConfiguration<T>(
config: ContractConfiguration,
Expand Down Expand Up @@ -219,7 +219,14 @@ export class ArIO implements ArIOContract {
return distributions;
}

async getAuction({ domain, type, evaluationOptions }: EvaluationParameters<{ domain: string; type?: RegistrationType }>): Promise<ArNSAuctionData> {
async getAuction({
domain,
type,
evaluationOptions,
}: EvaluationParameters<{
domain: string;
type?: RegistrationType;
}>): Promise<ArNSAuctionData> {
return this.contract.readInteraction({
functionName: 'auction',
inputs: {
Expand All @@ -229,11 +236,15 @@ export class ArIO implements ArIOContract {
evaluationOptions,
});
}
async getAuctions({ evaluationOptions }: { evaluationOptions?: EvaluationOptions | Record<string, never> | undefined; }): Promise<Record<string, ArNSAuctionData>> {
async getAuctions({
evaluationOptions,
}: {
evaluationOptions?: EvaluationOptions | Record<string, never> | undefined;
}): Promise<Record<string, ArNSAuctionData>> {
const { auctions } = await this.contract.getContractState({
evaluationOptions,
});

return auctions
return auctions;
}
}
3 changes: 1 addition & 2 deletions tests/ar-io.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -259,5 +259,4 @@ describe('ArIO Client', () => {
expect(auctions).toBeDefined();
},
);

});

0 comments on commit 3f30f77

Please sign in to comment.