diff --git a/src/account/default.ts b/src/account/default.ts index b355809b4..b591c2255 100644 --- a/src/account/default.ts +++ b/src/account/default.ts @@ -1,7 +1,7 @@ import assert from 'minimalistic-assert'; import { ZERO } from '../constants'; -import { Provider } from '../provider'; +import { Provider, ProviderInterface } from '../provider'; import { BlockIdentifier } from '../provider/utils'; import { Signer, SignerInterface } from '../signer'; import { @@ -33,9 +33,13 @@ import { AccountInterface } from './interface'; export class Account extends Provider implements AccountInterface { public address: string; - private signer: SignerInterface; + public signer: SignerInterface; - constructor(provider: Provider, address: string, keyPairOrSigner: KeyPair | SignerInterface) { + constructor( + provider: ProviderInterface, + address: string, + keyPairOrSigner: KeyPair | SignerInterface + ) { super(provider); this.signer = 'getPubKey' in keyPairOrSigner ? keyPairOrSigner : new Signer(keyPairOrSigner as KeyPair); diff --git a/src/account/interface.ts b/src/account/interface.ts index 91b4f9f88..c78aaa952 100644 --- a/src/account/interface.ts +++ b/src/account/interface.ts @@ -1,4 +1,5 @@ import { ProviderInterface } from '../provider'; +import { SignerInterface } from '../signer'; import { Abi, AddTransactionResponse, @@ -15,6 +16,8 @@ import { TypedData } from '../utils/typedData/types'; export abstract class AccountInterface extends ProviderInterface { public abstract address: string; + public abstract signer: SignerInterface; + /** * Deploys a given compiled contract (json) to starknet * diff --git a/src/provider/default.ts b/src/provider/default.ts index 47b6a2173..eeee214ef 100644 --- a/src/provider/default.ts +++ b/src/provider/default.ts @@ -52,8 +52,10 @@ export class Provider implements ProviderInterface { public chainId: StarknetChainId; - constructor(optionsOrProvider: ProviderOptions | Provider = { network: 'goerli-alpha' }) { - if (optionsOrProvider instanceof Provider) { + constructor( + optionsOrProvider: ProviderOptions | ProviderInterface = { network: 'goerli-alpha' } + ) { + if (optionsOrProvider instanceof ProviderInterface) { this.baseUrl = optionsOrProvider.baseUrl; this.feederGatewayUrl = optionsOrProvider.feederGatewayUrl; this.gatewayUrl = optionsOrProvider.gatewayUrl;