Skip to content

Commit bd580d2

Browse files
committed
minor fix
1 parent 9f8699a commit bd580d2

File tree

4 files changed

+24
-43
lines changed

4 files changed

+24
-43
lines changed

apps/extension/src/pages/ibc-swap/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,9 +937,8 @@ export const IBCSwapPage: FunctionComponent = observer(() => {
937937
destinationAsset: {
938938
chainId: outChainId,
939939
denom: outCurrency.coinMinimalDenom,
940-
expectedAmount: swapConfigs.amountConfig.outAmount
941-
.toDec()
942-
.toString(),
940+
expectedAmount:
941+
swapConfigs.amountConfig.outAmount.toCoin().amount,
943942
},
944943
simpleRoute,
945944
sender: swapConfigs.senderConfig.sender,

packages/background/src/tx-executor/service.ts

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,6 @@ export class BackgroundTxExecutorService {
159159
}
160160
}
161161
});
162-
163-
// if the key is hardware wallet, do not resume the execution automatically
164-
// user should sign the transaction manually
165-
const keyInfo = this.keyRingCosmosService.keyRingService.getKeyInfo(
166-
execution.vaultId
167-
);
168-
if (keyInfo?.type === "ledger" || keyInfo?.type === "keystone") {
169-
return;
170-
}
171-
172-
// cause new executable chain ids are available, resume the execution
173-
// CHECK: 현재 활성화되어 있는 vault에서만 실행해야 할까, 아니면 모든 vault에서 실행할 수 있어야 할까?
174-
await this.executeTxs(executionId);
175162
});
176163
}
177164

@@ -342,14 +329,13 @@ export class BackgroundTxExecutorService {
342329
runInAction(() => {
343330
execution.txIndex = i;
344331
currentTx.status = result.status;
345-
// NOTE: no need to set signedTx as it's already consumed,
346-
// just set the result of pending tx execution
347332
if (result.txHash != null) {
348333
currentTx.txHash = result.txHash;
349334
}
350335
if (result.error != null) {
351336
currentTx.error = result.error;
352337
}
338+
currentTx.signedTx = undefined; // clear the signed tx after the execution
353339
});
354340

355341
if (result.status === BackgroundTxStatus.CONFIRMED) {
@@ -377,9 +363,6 @@ export class BackgroundTxExecutorService {
377363
}
378364

379365
if (result.status === BackgroundTxStatus.FAILED) {
380-
runInAction(() => {
381-
execution.status = TxExecutionStatus.FAILED;
382-
});
383366
this.removeTxExecution(id);
384367

385368
return {
@@ -397,9 +380,7 @@ export class BackgroundTxExecutorService {
397380
}
398381

399382
// if the execution is completed successfully, record the history and remove the execution
400-
runInAction(() => {
401-
execution.status = TxExecutionStatus.COMPLETED;
402-
});
383+
403384
this.recordHistoryIfNeeded(execution);
404385
this.removeTxExecution(id);
405386

@@ -430,18 +411,18 @@ export class BackgroundTxExecutorService {
430411
status === BackgroundTxStatus.CONFIRMED ||
431412
status === BackgroundTxStatus.FAILED
432413
) {
433-
return { status, signedTx, txHash, error };
414+
return { status, txHash, error };
434415
}
435416

436417
// Check if blocked
437418
const isBlocked = !executableChainIds.includes(tx.chainId);
438419
if (isBlocked) {
439-
return { status: BackgroundTxStatus.BLOCKED, signedTx, txHash, error };
420+
return { status: BackgroundTxStatus.BLOCKED, txHash, error };
440421
}
441422

442423
// If preventAutoSign and not signed, block
443424
if (preventAutoSign && signedTx == null) {
444-
return { status: BackgroundTxStatus.BLOCKED, signedTx, txHash, error };
425+
return { status: BackgroundTxStatus.BLOCKED, txHash, error };
445426
}
446427

447428
// SIGNING
@@ -452,7 +433,6 @@ export class BackgroundTxExecutorService {
452433
console.error(`[TxExecutor] tx signing failed:`, e);
453434
return {
454435
status: BackgroundTxStatus.FAILED,
455-
signedTx,
456436
txHash,
457437
error: e.message ?? "Transaction signing failed",
458438
};
@@ -467,7 +447,6 @@ export class BackgroundTxExecutorService {
467447
console.error(`[TxExecutor] tx broadcast failed:`, e);
468448
return {
469449
status: BackgroundTxStatus.FAILED,
470-
signedTx,
471450
txHash,
472451
error: e.message ?? "Transaction broadcasting failed",
473452
};
@@ -483,7 +462,6 @@ export class BackgroundTxExecutorService {
483462
} else {
484463
return {
485464
status: BackgroundTxStatus.FAILED,
486-
signedTx,
487465
txHash,
488466
error: "Transaction failed",
489467
};
@@ -492,13 +470,12 @@ export class BackgroundTxExecutorService {
492470
console.error(`[TxExecutor] tx trace failed:`, e);
493471
return {
494472
status: BackgroundTxStatus.FAILED,
495-
signedTx,
496473
txHash,
497474
error: e.message ?? "Transaction confirmation failed",
498475
};
499476
}
500477

501-
return { status, signedTx, txHash, error };
478+
return { status, txHash, error };
502479
}
503480

504481
protected async signTx(
@@ -903,6 +880,10 @@ export class BackgroundTxExecutorService {
903880

904881
const historyData = execution.historyData;
905882

883+
const backgroundExecutionId = execution.preventAutoSign
884+
? execution.id
885+
: undefined;
886+
906887
const id = this.recentSendHistoryService.addRecentIBCTransferHistory(
907888
historyData.sourceChainId,
908889
historyData.destinationChainId,
@@ -913,7 +894,7 @@ export class BackgroundTxExecutorService {
913894
historyData.channels,
914895
historyData.notificationInfo,
915896
Buffer.from(tx.txHash, "hex"),
916-
execution.id
897+
backgroundExecutionId
917898
);
918899
this.recentSendHistoryService.trackIBCPacketForwardingRecursive(id);
919900

@@ -945,6 +926,12 @@ export class BackgroundTxExecutorService {
945926

946927
const historyData = execution.historyData;
947928

929+
// preventAutoSign means that the execution requires multiple transactions to be executed
930+
// so we need to record the history with the execution id
931+
const backgroundExecutionId = execution.preventAutoSign
932+
? execution.id
933+
: undefined;
934+
948935
const id = this.recentSendHistoryService.addRecentIBCSwapHistory(
949936
historyData.swapType,
950937
historyData.chainId,
@@ -958,7 +945,7 @@ export class BackgroundTxExecutorService {
958945
historyData.swapReceiver,
959946
historyData.notificationInfo,
960947
Buffer.from(tx.txHash, "hex"),
961-
execution.id
948+
backgroundExecutionId
962949
);
963950
this.recentSendHistoryService.trackIBCPacketForwardingRecursive(id);
964951

@@ -983,11 +970,9 @@ export class BackgroundTxExecutorService {
983970

984971
const historyData = execution.historyData;
985972

986-
// if there is a tx that is not executable, we need to record the history with requiresNextTransaction
987-
// so that the history can be displayed again once the tx is executable
988-
const requiresNextTransaction = execution.txs.some(
989-
(tx) => !execution.executableChainIds.includes(tx.chainId)
990-
);
973+
const backgroundExecutionId = execution.preventAutoSign
974+
? execution.id
975+
: undefined;
991976

992977
const id = this.recentSendHistoryService.recordTxWithSwapV2(
993978
historyData.fromChainId,
@@ -1002,8 +987,7 @@ export class BackgroundTxExecutorService {
1002987
historyData.routeDurationSeconds,
1003988
tx.txHash,
1004989
historyData.isOnlyUseBridge,
1005-
requiresNextTransaction,
1006-
execution.id
990+
backgroundExecutionId
1007991
);
1008992

1009993
execution.historyId = id;

packages/background/src/tx-executor/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export type TxExecution =
176176
*/
177177
export interface PendingTxExecutionResult {
178178
status: BackgroundTxStatus;
179-
signedTx?: string;
180179
txHash?: string;
181180
error?: string;
182181
}

packages/background/src/tx-executor/utils/evm.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ export async function fillUnsignedEVMTx(
203203
.toBigNumber()
204204
.toString(16)}`;
205205

206-
maxPriorityFeePerGasDec = maxPriorityFeePerGasDec.mul(multiplier);
207206
const maxPriorityFeePerGasHex = `0x${maxPriorityFeePerGasDec
208207
.truncate()
209208
.toBigNumber()

0 commit comments

Comments
 (0)