diff --git a/src/families/cosmos/js-buildTransaction.ts b/src/families/cosmos/js-buildTransaction.ts index fae6e18eb2..c9e3b5e85b 100644 --- a/src/families/cosmos/js-buildTransaction.ts +++ b/src/families/cosmos/js-buildTransaction.ts @@ -96,7 +96,7 @@ const buildTransaction = async ( value: { validatorSrcAddress: transaction.cosmosSourceValidator, delegatorAddress: account.freshAddress, - validatorAddress: transaction.validators[0].address, + validatorDstAddress: transaction.validators[0].address, amount: { denom: account.currency.units[1].code, amount: transaction.validators[0].amount.toString(), diff --git a/src/families/cosmos/js-prepareTransaction.ts b/src/families/cosmos/js-prepareTransaction.ts index 100c1be426..0bc88f1eb7 100644 --- a/src/families/cosmos/js-prepareTransaction.ts +++ b/src/families/cosmos/js-prepareTransaction.ts @@ -42,7 +42,10 @@ const prepareTransaction = async ( patch.memo = "Ledger Live"; } - const unsignedPayload = await buildTransaction(account, transaction); + const unsignedPayload = await buildTransaction(account, { + ...transaction, + ...patch, + }); // be sure payload is complete if (unsignedPayload) { diff --git a/src/families/cosmos/js-signOperation.ts b/src/families/cosmos/js-signOperation.ts index 678b57c7ff..c045ac5b2d 100644 --- a/src/families/cosmos/js-signOperation.ts +++ b/src/families/cosmos/js-signOperation.ts @@ -1,4 +1,4 @@ -import { Account, SignOperationEvent } from "../../types"; +import { Account, OperationType, SignOperationEvent } from "../../types"; import type { Transaction } from "./types"; import { getAccount, getChainId } from "./api/Cosmos"; import { Observable } from "rxjs"; @@ -145,24 +145,31 @@ const signOperation = ({ o.next({ type: "device-signature-granted" }); - // build optimistic operation const txHash = ""; // resolved at broadcast time - const senders = [account.freshAddress]; - const recipients = [transaction.recipient]; - const accountId = account.id; + const type: OperationType = + transaction.mode === "undelegate" + ? "UNDELEGATE" + : transaction.mode === "delegate" + ? "DELEGATE" + : transaction.mode === "redelegate" + ? "REDELEGATE" + : ["claimReward", "claimRewardCompound"].includes(transaction.mode) + ? "REWARD" + : "OUT"; + // build optimistic operation const operation = { - id: encodeOperationId(accountId, txHash, "OUT"), + id: encodeOperationId(account.id, txHash, type), hash: txHash, - type: "OUT", + type: type, value: transaction.amount, fee: transaction.fees, extra: {}, blockHash: null, blockHeight: null, - senders, - recipients, - accountId, + senders: [account.freshAddress], + recipients: [transaction.recipient], + account: account.id, date: new Date(), };