Skip to content

Commit

Permalink
fix(tyeps): set types to objects rather than top level params for eas…
Browse files Browse the repository at this point in the history
…ier readability
  • Loading branch information
dtfiedler committed Mar 27, 2024
1 parent dc4fc50 commit edfd77b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/common/ant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ export class ANT implements ANTContract, BaseContract<ANTState> {
/**
* Returns the current state of the contract.
*/
async getState(params: EvaluationParameters = {}): Promise<ANTState> {
const state = await this.contract.getState(params);
async getState({
evaluationOptions,
}: EvaluationParameters = {}): Promise<ANTState> {
const state = await this.contract.getState({ evaluationOptions });
return state;
}

Expand Down
6 changes: 4 additions & 2 deletions src/common/ar-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ export class ArIO implements ArIOContract, BaseContract<ArIOState> {
/**
* Returns the current state of the contract.
*/
async getState(params: EvaluationParameters): Promise<ArIOState> {
const state = await this.contract.getState(params);
async getState({
evaluationOptions,
}: EvaluationParameters): Promise<ArIOState> {
const state = await this.contract.getState({ evaluationOptions });
return state;
}
/**
Expand Down
5 changes: 1 addition & 4 deletions src/common/contracts/remote-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ export class RemoteContract<T> implements BaseContract<T>, ReadContract {
contractTxId: this.contractTxId,
evaluationOptions,
});
const { state } = await this.http.get<
{ sortKey: string } | { blockHeight: number } | Record<string, never>,
{ state: T }
>({
const { state } = await this.http.get<EvaluationParameters, { state: T }>({
endpoint: ``,
params: {
...evaluationOptions?.evalTo,
Expand Down

0 comments on commit edfd77b

Please sign in to comment.