Skip to content

Commit

Permalink
Merge branch 'develop' into refactor/tx-review
Browse files Browse the repository at this point in the history
  • Loading branch information
banklesss authored Dec 19, 2024
2 parents 7ac7cde + d506c77 commit d286093
Show file tree
Hide file tree
Showing 13 changed files with 1,285 additions and 381 deletions.
2 changes: 1 addition & 1 deletion apps/wallet-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"@emurgo/csl-mobile-bridge": "^7.1.0",
"@emurgo/msl-mobile-bridge": "^1.0.4",
"@emurgo/react-native-hid": "5.15.8",
"@emurgo/yoroi-lib": "2.2.2",
"@emurgo/yoroi-lib": "^2.2.3",
"@formatjs/intl-datetimeformat": "^6.7.0",
"@formatjs/intl-getcanonicallocales": "^2.1.0",
"@formatjs/intl-locale": "^3.2.1",
Expand Down
12 changes: 12 additions & 0 deletions apps/wallet-mobile/src/features/Discover/common/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,15 @@ export async function toLedgerSignRequest(
additionalRequiredSigners: Array<string> = [],
): Promise<SignTransactionRequest> {
const parsedCbor = await cbor.decode(rawTxBody)
const tagsState = await csl.hasTransactionSetTag(
await (await csl.FixedTransaction.newFromBodyBytes(await txBody.toBytes())).toBytes(),
)

if (tagsState === csl.TransactionSetsState.MixedSets) {
throw new Error('Transaction with mixed sets cannot be signed by Ledger')
}

const txHasSetTags = tagsState === csl.TransactionSetsState.AllSetsHaveTag

async function formatInputs(inputs: TransactionInputs): Promise<Array<TxInput>> {
const formatted = []
Expand Down Expand Up @@ -533,6 +542,9 @@ export async function toLedgerSignRequest(
referenceInputs: formattedReferenceInputs,
},
additionalWitnessPaths,
options: {
tagCborSets: txHasSetTags,
},
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export const useSignTxWithHW = () => {

const mutation = useMutation<Transaction, Error, {cbor: string; partial?: boolean}>({
mutationFn,
useErrorBoundary: (error) => !isUserRejectedError(error),
useErrorBoundary: (error) => !isUserRejectedError(error) && !error.message.toLowerCase().includes('rejected'),
mutationKey: ['useSignTxWithHW'],
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ export const useStrings = () => {
operationsLogTitle: intl.formatMessage(messages.operationsLogTitle),
operationsLogWarningText: intl.formatMessage(messages.operationsLogWarningText),
operationsLogWarningTitle: intl.formatMessage(messages.operationsLogWarningTitle),
operationsNoticeText: intl.formatMessage(messages.operationsNoticeText),
operationsNoticeButton: intl.formatMessage(messages.operationsNoticeButton),
operationsNoticeTitle: intl.formatMessage(messages.operationsNoticeTitle),
}
}

Expand Down Expand Up @@ -397,4 +400,17 @@ const messages = defineMessages({
id: 'txReview.createdBy',
defaultMessage: '!!!Created by',
},
operationsNoticeText: {
id: 'txReview.overview.operationsNoticeText',
defaultMessage:
'!!!You are about to interact with operations, which are key components used in governance and various blockchain activities. These include Cardano Governance Certificates, as outlined in CIP-0095, which facilitate governance transactions.',
},
operationsNoticeButton: {
id: 'txReview.overview.operationsNoticeButton',
defaultMessage: '!!!Ok',
},
operationsNoticeTitle: {
id: 'txReview.overview.operationsNoticeTitle',
defaultMessage: '!!!What are operations?',
},
})
Loading

0 comments on commit d286093

Please sign in to comment.