Skip to content

Commit

Permalink
fix: flatten main type export and import
Browse files Browse the repository at this point in the history
  • Loading branch information
penovicp committed Nov 23, 2022
1 parent 880ef27 commit 869f470
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 53 deletions.
2 changes: 1 addition & 1 deletion __tests__/contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isBN } from 'bn.js';

import { Contract, ContractFactory, stark } from '../src';
import { DeployContractPayload } from '../src/types/lib';
import { DeployContractPayload } from '../src/types';
import { getSelectorFromName } from '../src/utils/hash';
import { BigNumberish, toBN } from '../src/utils/number';
import { compileCalldata } from '../src/utils/stark';
Expand Down
13 changes: 6 additions & 7 deletions src/account/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,22 @@ import { BlockIdentifier } from '../provider/utils';
import { Signer, SignerInterface } from '../signer';
import {
Abi,
AllowArray,
Call,
DeclareContractPayload,
DeclareContractResponse,
DeployAccountContractPayload,
DeployContractResponse,
EstimateFee,
EstimateFeeAction,
EstimateFeeDetails,
InvocationsDetails,
InvocationsSignerDetails,
InvokeFunctionResponse,
KeyPair,
Signature,
} from '../types';
import { EstimateFee, EstimateFeeDetails } from '../types/account';
import {
AllowArray,
DeclareContractPayload,
DeployAccountContractPayload,
UniversalDeployerContractPayload,
} from '../types/lib';
} from '../types';
import {
calculateContractAddressFromHash,
feeTransactionVersion,
Expand Down
10 changes: 4 additions & 6 deletions src/account/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@ import { BlockIdentifier } from '../provider/utils';
import { SignerInterface } from '../signer';
import {
Abi,
AllowArray,
Call,
DeclareContractPayload,
DeclareContractResponse,
DeployAccountContractPayload,
DeployContractResponse,
EstimateFeeAction,
EstimateFeeDetails,
EstimateFeeResponse,
InvocationsDetails,
InvokeFunctionResponse,
Signature,
} from '../types';
import {
AllowArray,
DeclareContractPayload,
DeployAccountContractPayload,
UniversalDeployerContractPayload,
} from '../types/lib';
} from '../types';
import { BigNumberish } from '../utils/number';
import { TypedData } from '../utils/typedData/types';

Expand Down
8 changes: 3 additions & 5 deletions src/provider/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
CallContractResponse,
ContractClass,
DeclareContractResponse,
DeclareContractTransaction,
DeployAccountContractTransaction,
DeployContractPayload,
DeployContractResponse,
EstimateFeeResponse,
Expand All @@ -12,14 +14,10 @@ import {
GetTransactionReceiptResponse,
GetTransactionResponse,
Invocation,
InvocationsDetails,
InvocationsDetailsWithNonce,
InvokeFunctionResponse,
} from '../types';
import {
DeclareContractTransaction,
DeployAccountContractTransaction,
InvocationsDetails,
} from '../types/lib';
import { BigNumberish } from '../utils/number';
import { ProviderInterface } from './interface';
import { RpcProvider, RpcProviderOptions } from './rpc';
Expand Down
10 changes: 4 additions & 6 deletions src/provider/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import type {
CallContractResponse,
ContractClass,
DeclareContractResponse,
DeclareContractTransaction,
DeployAccountContractPayload,
DeployAccountContractTransaction,
DeployContractPayload,
DeployContractResponse,
EstimateFeeResponse,
Expand All @@ -12,15 +15,10 @@ import type {
GetTransactionReceiptResponse,
GetTransactionResponse,
Invocation,
InvocationsDetails,
InvocationsDetailsWithNonce,
InvokeFunctionResponse,
} from '../types';
import {
DeclareContractTransaction,
DeployAccountContractPayload,
DeployAccountContractTransaction,
InvocationsDetails,
} from '../types/lib';
import type { BigNumberish } from '../utils/number';
import { BlockIdentifier } from './utils';

Expand Down
10 changes: 4 additions & 6 deletions src/provider/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@ import {
Call,
CallContractResponse,
DeclareContractResponse,
DeclareContractTransaction,
DeployAccountContractTransaction,
DeployContractPayload,
DeployContractResponse,
EstimateFeeResponse,
GetBlockResponse,
GetCodeResponse,
GetTransactionResponse,
Invocation,
InvocationsDetails,
InvocationsDetailsWithNonce,
InvokeFunctionResponse,
RPC,
} from '../types';
import { RPC } from '../types/api';
import {
DeclareContractTransaction,
DeployAccountContractTransaction,
InvocationsDetails,
} from '../types/lib';
import fetch from '../utils/fetchPonyfill';
import { getSelectorFromName } from '../utils/hash';
import { stringify } from '../utils/json';
Expand Down
15 changes: 7 additions & 8 deletions src/provider/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@ import { StarknetChainId } from '../constants';
import {
Call,
CallContractResponse,
CallL1Handler,
ContractClass,
DeclareContractResponse,
DeclareContractTransaction,
DeployAccountContractTransaction,
DeployContractPayload,
DeployContractResponse,
EstimateFeeResponse,
GetBlockResponse,
GetContractAddressesResponse,
GetTransactionReceiptResponse,
GetTransactionResponse,
GetTransactionStatusResponse,
GetTransactionTraceResponse,
Invocation,
InvocationsDetailsWithNonce,
InvokeFunctionResponse,
} from '../types';
import {
CallL1Handler,
GetContractAddressesResponse,
GetTransactionStatusResponse,
GetTransactionTraceResponse,
Sequencer,
} from '../types/api';
import { DeclareContractTransaction, DeployAccountContractTransaction } from '../types/lib';
} from '../types';
import fetch from '../utils/fetchPonyfill';
import { getSelector, getSelectorFromName } from '../utils/hash';
import { parse, parseAlwaysAsBig, stringify } from '../utils/json';
Expand Down
2 changes: 1 addition & 1 deletion src/signer/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import {
Abi,
Call,
DeclareSignerDetails,
DeployAccountSignerDetails,
InvocationsSignerDetails,
KeyPair,
Signature,
} from '../types';
import { DeployAccountSignerDetails } from '../types/signer';
import { genKeyPair, getStarkKey, sign } from '../utils/ellipticCurve';
import {
calculateDeclareTransactionHash,
Expand Down
10 changes: 8 additions & 2 deletions src/signer/interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Abi, Call, DeclareSignerDetails, InvocationsSignerDetails, Signature } from '../types';
import { DeployAccountSignerDetails } from '../types/signer';
import {
Abi,
Call,
DeclareSignerDetails,
DeployAccountSignerDetails,
InvocationsSignerDetails,
Signature,
} from '../types';
import { TypedData } from '../utils/typedData';

export abstract class SignerInterface {
Expand Down
3 changes: 0 additions & 3 deletions src/types/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ export type Overrides = {
nonce?: BigNumberish;
signature?: Signature;
};

export * from './sequencer';
export * from './rpc';
4 changes: 0 additions & 4 deletions src/types/api/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ export type GetTransactionTraceResponse = {
signature: Signature;
};

export type RawArgs = {
[inputName: string]: string | string[] | { type: 'struct'; [k: string]: BigNumberish };
};

export type CallL1Handler = {
from_address: string;
to_address: string;
Expand Down
3 changes: 2 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export * from './lib';
export * as api from './api';
export { Calldata, Overrides } from './api';
export * from './signer';
export * from './contract';
export * from './account';
export * from './provider';
export * from './api/sequencer';
export * from './api/rpc';
2 changes: 1 addition & 1 deletion src/utils/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
TransactionHashPrefix,
ZERO,
} from '../constants';
import { RawCalldata } from '../types/lib';
import { RawCalldata } from '../types';
import { ec } from './ellipticCurve';
import { addHexPrefix, buf2hex, removeHexPrefix, utf8ToArray } from './encode';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/responseParser/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
EstimateFeeResponse,
GetBlockResponse,
GetTransactionResponse,
RPC,
} from '../../types';
import { RPC } from '../../types/api';
import { toBN } from '../number';
import { ResponseParser } from '.';

Expand Down
2 changes: 1 addition & 1 deletion src/utils/responseParser/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
GetTransactionReceiptResponse,
GetTransactionResponse,
InvokeFunctionResponse,
Sequencer,
} from '../../types';
import { Sequencer } from '../../types/api';
import { toBN } from '../number';
import { ResponseParser } from '.';

Expand Down

0 comments on commit 869f470

Please sign in to comment.