From 87d6c90b625b8bb97d68ea89d63d7a97ea894051 Mon Sep 17 00:00:00 2001 From: Atticus Date: Thu, 21 Mar 2024 18:42:15 -0600 Subject: [PATCH] fix(types): rename signer to ContractSigner --- src/common.ts | 6 +++--- src/common/ant.ts | 6 +++--- src/common/ar-io.ts | 6 +++--- src/common/contracts/remote-contract.ts | 4 ++-- src/common/contracts/warp-contract.ts | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/common.ts b/src/common.ts index 71aeaad3..ef3f6dcd 100644 --- a/src/common.ts +++ b/src/common.ts @@ -34,9 +34,9 @@ export type SortKey = string; export type WalletAddress = string; // TODO: append this with other configuration options (e.g. local vs. remote evaluation) -export type ArIOSigner = ArweaveSigner | ArconnectSigner; +export type ContractSigner = ArweaveSigner | ArconnectSigner; export type ContractConfiguration = { - signer?: ArIOSigner; // TODO: optionally allow JWK in place of signer + signer?: ContractSigner; // TODO: optionally allow JWK in place of signer } & ( | { contract?: ContractInteractionProvider; @@ -72,7 +72,7 @@ export type EvaluationParameters> = { export interface BaseContract { getState(params: EvaluationParameters): Promise; - connect(signer: ArIOSigner): this; + connect(signer: ContractSigner): this; } export interface ReadContract { diff --git a/src/common/ant.ts b/src/common/ant.ts index 38ab8f7b..0f3cb1b6 100644 --- a/src/common/ant.ts +++ b/src/common/ant.ts @@ -18,10 +18,10 @@ import { ANTContract, ANTRecord, ANTState, - ArIOSigner, BaseContract, ContractConfiguration, ContractInteractionProvider, + ContractSigner, EvaluationOptions, EvaluationParameters, isContractConfiguration, @@ -34,7 +34,7 @@ export class ANT implements ANTContract, BaseContract { private contract: ContractInteractionProvider; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - private signer: ArIOSigner | undefined; + private signer: ContractSigner | undefined; constructor({ signer, ...config }: ContractConfiguration) { this.signer = signer; @@ -47,7 +47,7 @@ export class ANT implements ANTContract, BaseContract { } } - connect(signer: ArIOSigner): this { + connect(signer: ContractSigner): this { this.signer = signer; if (this.contract instanceof RemoteContract) { this.contract = new WarpContract({ diff --git a/src/common/ar-io.ts b/src/common/ar-io.ts index c80379e1..f4924a44 100644 --- a/src/common/ar-io.ts +++ b/src/common/ar-io.ts @@ -17,13 +17,13 @@ import { ARNS_TESTNET_REGISTRY_TX } from '../constants.js'; import { ArIOContract, - ArIOSigner, ArIOState, ArNSAuctionData, ArNSNameData, BaseContract, ContractConfiguration, ContractInteractionProvider, + ContractSigner, EpochDistributionData, EvaluationOptions, EvaluationParameters, @@ -41,7 +41,7 @@ export class ArIO implements ArIOContract, BaseContract { private contract: ContractInteractionProvider; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - private signer: ArIOSigner | undefined; + private signer: ContractSigner | undefined; constructor( { signer, ...config }: ContractConfiguration = { @@ -63,7 +63,7 @@ export class ArIO implements ArIOContract, BaseContract { } } - connect(signer: ArIOSigner): this { + connect(signer: ContractSigner): this { this.signer = signer; if (this.contract instanceof RemoteContract) { this.contract = new WarpContract({ diff --git a/src/common/contracts/remote-contract.ts b/src/common/contracts/remote-contract.ts index c058fa36..b4549c24 100644 --- a/src/common/contracts/remote-contract.ts +++ b/src/common/contracts/remote-contract.ts @@ -15,8 +15,8 @@ * along with this program. If not, see . */ import { - ArIOSigner, BaseContract, + ContractSigner, EvaluationParameters, HTTPClient, Logger, @@ -49,7 +49,7 @@ export class RemoteContract implements BaseContract, ReadContract { /* eslint-disable */ // @ts-ignore - connect(signer: ArIOSigner): this { + connect(signer: ContractSigner): this { /* eslint-enable */ throw new Error('Cannot connect to a remote contract'); } diff --git a/src/common/contracts/warp-contract.ts b/src/common/contracts/warp-contract.ts index 521dbd82..6c2d916a 100644 --- a/src/common/contracts/warp-contract.ts +++ b/src/common/contracts/warp-contract.ts @@ -24,8 +24,8 @@ import { } from 'warp-contracts'; import { - ArIOSigner, BaseContract, + ContractSigner, EvaluationParameters, ReadContract, } from '../../types.js'; @@ -51,7 +51,7 @@ export class WarpContract implements BaseContract, ReadContract { contractTxId: string; cacheUrl?: string; warp?: Warp; - signer?: ArIOSigner; + signer?: ContractSigner; }) { this.contract = warp.contract(contractTxId); this.cacheUrl = cacheUrl; @@ -59,7 +59,7 @@ export class WarpContract implements BaseContract, ReadContract { // base contract methods - connect(signer: ArIOSigner) { + connect(signer: ContractSigner) { this.contract = this.contract.connect(signer as Signer); return this; }