Skip to content

Commit

Permalink
fix: typings
Browse files Browse the repository at this point in the history
  • Loading branch information
janek26 committed Apr 20, 2022
1 parent 598bcd0 commit 1fadf41
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/account/default.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/account/interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ProviderInterface } from '../provider';
import { SignerInterface } from '../signer';
import {
Abi,
AddTransactionResponse,
Expand All @@ -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
*
Expand Down
6 changes: 4 additions & 2 deletions src/provider/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1fadf41

Please sign in to comment.