Skip to content

Commit

Permalink
fix: export ResponseParser and RPCResponseParser
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Jun 11, 2024
1 parent 7d5065e commit c2887ed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 37 deletions.
5 changes: 3 additions & 2 deletions __tests__/rpcProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
FeeEstimate,
RPC,
RPC06,
RPCResponseParser,
ReceiptTx,
RpcProvider,
TransactionExecutionStatus,
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
35 changes: 2 additions & 33 deletions src/utils/responseParser/index.ts
Original file line number Diff line number Diff line change
@@ -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';
4 changes: 2 additions & 2 deletions src/utils/responseParser/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Map RPC Response to common interface response
* Intersection (sequencer response ∩ (∪ rpc responses))
*/
import {
import type {
BlockWithTxHashes,
ContractClassPayload,
ContractClassResponse,
Expand All @@ -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
Expand Down

0 comments on commit c2887ed

Please sign in to comment.