Skip to content

Commit

Permalink
fix(sdk): added waiting for bridge response before calling onRequestSent
Browse files Browse the repository at this point in the history
  • Loading branch information
thekiba committed Dec 2, 2023
1 parent 7294aba commit cf85057
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/sdk/src/provider/bridge/bridge-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,17 @@ export class BridgeProvider implements HTTPProvider {
hexToByteArray(this.session.walletPublicKey)
);

this.gateway
.send(encodedRequest, this.session.walletPublicKey, request.method)
.catch(reject);
this.pendingRequests.set(id.toString(), resolve);
onRequestSent?.();
try {
await this.gateway.send(
encodedRequest,
this.session.walletPublicKey,
request.method
);
onRequestSent?.();
this.pendingRequests.set(id.toString(), resolve);
} catch (e) {
reject(e);
}
});
}

Expand Down

0 comments on commit cf85057

Please sign in to comment.