Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions __tests__/config/jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ if (process.env.DEBUG === 'true') {

response(response) {
const cloned = response.clone();
cloned.json().then(({ result }) => {
const match: any = combiner.find((it: any) => typeof it.result === 'undefined');
cloned.json().then((res) => {
const { result } = res;
const match: any = combiner.find((it: any) => it.request.body.id === res.id);
if (match && 'request' in match) {
match.result = result;
console.log(util.inspect(match, false, null, true /* enable colors */));
Expand Down
5 changes: 4 additions & 1 deletion src/channel/rpc_0_6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export class RpcChannel {

readonly retries: number;

public requestId: number;

readonly blockIdentifier: BlockIdentifier;

private chainId?: StarknetChainId;
Expand All @@ -65,6 +67,7 @@ export class RpcChannel {
this.blockIdentifier = blockIdentifier || defaultOptions.blockIdentifier;
this.chainId = chainId;
this.waitMode = waitMode || false;
this.requestId = 0;
}

public fetch(method: string, params?: object, id: string | number = 0) {
Expand Down Expand Up @@ -102,7 +105,7 @@ export class RpcChannel {
params?: RPC.Methods[T]['params']
): Promise<RPC.Methods[T]['result']> {
try {
const rawResult = await this.fetch(method, params);
const rawResult = await this.fetch(method, params, (this.requestId += 1));
const { error, result } = await rawResult.json();
this.errorHandler(method, params, error);
return result as RPC.Methods[T]['result'];
Expand Down