Skip to content

Commit

Permalink
bump trezor-connect
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Dec 13, 2021
1 parent 09c71e3 commit 5f0824d
Showing 1 changed file with 7 additions and 24 deletions.
31 changes: 7 additions & 24 deletions src/helpers/trezorTransformTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,6 @@ const transformAsset = (asset: Asset) => {
const transformAmount = (amount: string) =>
new BigNumber(amount).times(10000000).toString();

/**
* Transforms StellarSdk.Operation.type to TrezorConnect.StellarTransaction
* Operation.type
*/

const transformType = (type: string) => {
switch (type) {
case "pathPaymentStrictReceive":
// case 'pathPaymentStrictSend':
return "pathPayment";

case "createPassiveSellOffer":
return "createPassiveOffer";

case "manageSellOffer":
// case 'manageBuyOffer':
return "manageOffer";
default:
return type;
}
};

const transformMemo = (memo: { type: MemoType; value: MemoValue }) => {
switch (memo.type) {
case StellarSdk.MemoText:
Expand Down Expand Up @@ -132,6 +110,7 @@ export const transformTransaction = (path: string, transaction: any) => {
"destAmount",
"startingBalance",
"limit",
"buyAmount",
];
const assets = [
"asset",
Expand Down Expand Up @@ -192,8 +171,12 @@ export const transformTransaction = (path: string, transaction: any) => {
operation.value = operation.value.toString("hex");
}

// transform type
operation.type = transformType(o.type);
if (operation.type === "manageBuyOffer") {
operation.amount = operation.buyAmount;
delete operation.buyAmount;
}

operation.type = o.type;

return operation;
});
Expand Down

0 comments on commit 5f0824d

Please sign in to comment.