Skip to content

Commit

Permalink
Respect Exchange.skipRpcConfirmation everywhere (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipzeta authored Apr 15, 2024
1 parent 52ef1c2 commit 1a81047
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
Version changes are pinned to SDK releases.

## [1.26.4]

- Respect Exchange.skipRpcConfirmation everywhere. ([#384](https://github.com/zetamarkets/sdk/pull/384))

## [1.26.3]

- Add crank market generation util. ([#383](https://github.com/zetamarkets/sdk/pull/383))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zetamarkets/sdk",
"repository": "https://github.com/zetamarkets/sdk/",
"version": "1.26.3",
"version": "1.26.4",
"description": "Zeta SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
12 changes: 1 addition & 11 deletions src/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1125,17 +1125,7 @@ export class Exchange {
try {
await Promise.all(
txs.map(async (tx) => {
let txSig = await utils.processTransaction(
this._provider,
tx,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
this.skipRpcConfirmation
);
let txSig = await utils.processTransaction(this._provider, tx);
console.log(`[REBALANCE INSURANCE VAULT]: ${txSig}`);
})
);
Expand Down
5 changes: 2 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -958,8 +958,7 @@ export async function processTransaction(
useLedger: boolean = false,
lutAccs?: AddressLookupTableAccount[],
blockhash?: { blockhash: string; lastValidBlockHeight: number },
retries?: number,
skipConfirmation?: boolean
retries?: number
): Promise<TransactionSignature> {
let failures = 0;
while (true) {
Expand Down Expand Up @@ -1042,7 +1041,7 @@ export async function processTransaction(
// Poll the tx confirmation for N seconds
// Polling is more reliable than websockets using confirmTransaction()
let currentBlockHeight = 0;
if (!skipConfirmation) {
if (!Exchange.skipRpcConfirmation) {
while (currentBlockHeight < recentBlockhash.lastValidBlockHeight) {
// Keep resending to maximise the chance of confirmation
await provider.connection.sendRawTransaction(rawTx, {
Expand Down

0 comments on commit 1a81047

Please sign in to comment.