diff --git a/__tests__/rpcProvider.test.ts b/__tests__/rpcProvider.test.ts index 5a45fcc0f..4ebdbb004 100644 --- a/__tests__/rpcProvider.test.ts +++ b/__tests__/rpcProvider.test.ts @@ -8,6 +8,7 @@ import { FeeEstimate, RPC, RPC06, + RPCResponseParser, ReceiptTx, RpcProvider, TransactionExecutionStatus, @@ -52,11 +53,11 @@ describeIfRpc('RPCProvider', () => { test('instantiate from rpcProvider', () => { const newInsRPCProvider = new RpcProvider(); - + let FinalInsRPCProvider = new RpcProvider(newInsRPCProvider); expect(FinalInsRPCProvider.channel).toBe(newInsRPCProvider.channel); expect(FinalInsRPCProvider.responseParser).toBe(newInsRPCProvider.responseParser); - + delete (newInsRPCProvider as any).responseParser; FinalInsRPCProvider = new RpcProvider(newInsRPCProvider); expect(FinalInsRPCProvider.channel).toBe(newInsRPCProvider.channel); diff --git a/src/index.ts b/src/index.ts index c4cd4d3bf..0315d3fae 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,6 +34,7 @@ export * as starknetId from './utils/starknetId'; export * as provider from './utils/provider'; export * as selector from './utils/selector'; export * as events from './utils/events/index'; +export * from './utils/responseParser'; export * from './utils/cairoDataTypes/uint256'; export * from './utils/cairoDataTypes/uint512'; export * from './utils/address'; diff --git a/src/utils/responseParser/index.ts b/src/utils/responseParser/index.ts index 9605da691..3704826da 100644 --- a/src/utils/responseParser/index.ts +++ b/src/utils/responseParser/index.ts @@ -1,33 +1,2 @@ -import { - BlockWithTxHashes, - FeeEstimate, - CallContractResponse, - DeclareContractResponse, - DeployContractResponse, - EstimateFeeResponse, - GetBlockResponse, - GetTransactionResponse, - InvokeFunctionResponse, - SimulateTransactionResponse, -} from '../../types'; -import type { GetTransactionReceiptResponse } from '../transactionReceipt'; - -export abstract class ResponseParser { - abstract parseGetBlockResponse(res: BlockWithTxHashes): GetBlockResponse; - - abstract parseGetTransactionResponse(res: any): GetTransactionResponse; - - abstract parseGetTransactionReceiptResponse(res: any): GetTransactionReceiptResponse; - - abstract parseFeeEstimateResponse(res: FeeEstimate[]): EstimateFeeResponse; - - abstract parseCallContractResponse(res: any): CallContractResponse; - - abstract parseInvokeFunctionResponse(res: any): InvokeFunctionResponse; - - abstract parseDeployContractResponse(res: any): DeployContractResponse; - - abstract parseDeclareContractResponse(res: any): DeclareContractResponse; - - abstract parseSimulateTransactionResponse(res: any): SimulateTransactionResponse; -} +export * from './interface'; +export * from './rpc'; diff --git a/src/utils/responseParser/rpc.ts b/src/utils/responseParser/rpc.ts index 4a006ed94..d2f944d81 100644 --- a/src/utils/responseParser/rpc.ts +++ b/src/utils/responseParser/rpc.ts @@ -2,7 +2,7 @@ * Map RPC Response to common interface response * Intersection (sequencer response ∩ (∪ rpc responses)) */ -import { +import type { BlockWithTxHashes, ContractClassPayload, ContractClassResponse, @@ -19,7 +19,7 @@ import { import { toBigInt } from '../num'; import { isString } from '../shortString'; import { estimateFeeToBounds, estimatedFeeToMaxFee } from '../stark'; -import { ResponseParser } from '.'; +import { ResponseParser } from './interface'; export class RPCResponseParser implements