-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(LIVE-7623): typings * fix(LIVE-7623): changeset fix(LIVE-7623): prettier * fix(LIVE-7623): refactor exchange body content fix(LIVE-7623): replace types fix(LIVE-7623): optional rateTypes * fix(LIVE-7623): lint * fix(LIVE-7623): spelling mistake * fix(LIVE-7623): fix tests * fix(LIVE-7623): remove @ts-expect-error
- Loading branch information
1 parent
bafa799
commit d553f79
Showing
7 changed files
with
146 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ledger-live-desktop": patch | ||
--- | ||
|
||
bugfix(LIVE-7623): typings improvement and remove @ts-expect-error comment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
...edger-live-desktop/src/renderer/modals/Platform/Exchange/CompleteExchange/BodyContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import React from "react"; | ||
import { Exchange } from "@ledgerhq/live-common/exchange/platform/types"; | ||
import { Account, AccountLike, SignedOperation } from "@ledgerhq/types-live"; | ||
import { Transaction } from "@ledgerhq/live-common/generated/types"; | ||
import connectApp from "@ledgerhq/live-common/hw/connectApp"; | ||
import { createAction } from "@ledgerhq/live-common/hw/actions/completeExchange"; | ||
import { createAction as txCreateAction } from "@ledgerhq/live-common/hw/actions/transaction"; | ||
import completeExchange from "@ledgerhq/live-common/exchange/platform/completeExchange"; | ||
import { TokenCurrency } from "@ledgerhq/types-cryptoassets"; | ||
import DeviceAction from "~/renderer/components/DeviceAction"; | ||
import BigSpinner from "~/renderer/components/BigSpinner"; | ||
import ErrorDisplay from "~/renderer/components/ErrorDisplay"; | ||
|
||
const exchangeAction = createAction(completeExchange); | ||
const sendAction = txCreateAction(connectApp); | ||
|
||
type BodyContentProps = { | ||
error?: Error; | ||
signedOperation?: SignedOperation; | ||
signRequest?: { | ||
tokenCurrency: TokenCurrency | undefined; | ||
parentAccount: Account | null | undefined; | ||
account: AccountLike; | ||
transaction: Transaction; | ||
appName: string; | ||
} | null; | ||
request: { | ||
provider: string; | ||
exchange: Exchange; | ||
transaction: Transaction; | ||
binaryPayload: string; | ||
signature: string; | ||
exchangeType: number; | ||
rateType?: number; | ||
}; | ||
onOperationSigned: (value: SignedOperation) => void; | ||
onTransactionComplete: (value: Transaction) => void; | ||
onError: (error: Error) => void; | ||
}; | ||
|
||
export const BodyContent = (props: BodyContentProps) => { | ||
if (props.error) { | ||
return <ErrorDisplay error={props.error} />; | ||
} | ||
|
||
if (props.signedOperation) { | ||
return <BigSpinner size={40} />; | ||
} | ||
|
||
if (props.signRequest) { | ||
return ( | ||
<DeviceAction | ||
key="sign" | ||
action={sendAction} | ||
request={props.signRequest} | ||
onResult={result => { | ||
if ("transactionSignError" in result) { | ||
props.onError(result.transactionSignError); | ||
} else { | ||
props.onOperationSigned(result.signedOperation); | ||
} | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
return ( | ||
<DeviceAction | ||
key="completeExchange" | ||
action={exchangeAction} | ||
request={props.request} | ||
onResult={result => { | ||
if ("completeExchangeError" in result) { | ||
props.onError(result.completeExchangeError); | ||
} else { | ||
props.onTransactionComplete(result.completeExchangeResult); | ||
} | ||
}} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d553f79
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
live-common-tools – ./
ledger-live.vercel.app
live-common-tools-git-develop-ledgerhq.vercel.app
ledger-live-tools.vercel.app
live-common-tools-ledgerhq.vercel.app
live.ledger.tools
d553f79
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Bot] Testing with 'Nitrogen' ✅ 1 txs ❌ 1 txs ($10.79) ⏲ 4min 1s
1 critical spec errors
Spec Solana failed!
❌ 1 mutation errors
Details of the 2 mutations
Spec Solana (3)
Details of the 6 uncovered mutations
Spec Solana (6)
Portfolio ($10.79) – Details of the 1 currencies
5vhAGihUC1uKucJvreCgWWXB6LEptPwkwpqhkq9M6iaz
Performance ⏲ 4min 1s
Time spent for each spec: (total across mutations)
d553f79
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Bot] Testing with 'Nitrogen' 💰 1 miss funds ($0.00) ⏲ 7.5s
Details of the 0 mutations
Spec quicksilver (failed)
Details of the 6 uncovered mutations
Spec quicksilver (6)
Portfolio ($0.00) – Details of the 1 currencies
quick1rs97j43nfyvc689y5rjvnnhrq3tes6ghscch6l
Performance ⏲ 7.5s
Time spent for each spec: (total across mutations)