Skip to content

Commit

Permalink
Merge branch 'develop' into YV-47-alt
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbuedo committed Jan 14, 2025
2 parents 9ddcdb9 + 783e350 commit ce1f998
Show file tree
Hide file tree
Showing 15 changed files with 3,171 additions and 66 deletions.
4 changes: 2 additions & 2 deletions apps/wallet-mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ PODS:
- react-native-config/App (= 1.5.1)
- react-native-config/App (1.5.1):
- React-Core
- react-native-haskell-shelley (7.1.0):
- react-native-haskell-shelley (7.3.2):
- React
- react-native-message_signing-library (1.0.4):
- React
Expand Down Expand Up @@ -980,7 +980,7 @@ SPEC CHECKSUMS:
react-native-background-timer: 17ea5e06803401a379ebf1f20505b793ac44d0fe
react-native-ble-plx: f10240444452dfb2d2a13a0e4f58d7783e92d76e
react-native-config: 86038147314e2e6d10ea9972022aa171e6b1d4d8
react-native-haskell-shelley: d69d9b9a7122067b9ee36b76c78c6436d4fc1aba
react-native-haskell-shelley: db694e4d747ac375f98429204c86dedd2aa10c7b
react-native-message_signing-library: 040317fed382be05d79e2ecbe5852d1a20ce68df
react-native-mmkv: e97c0c79403fb94577e5d902ab1ebd42b0715b43
react-native-notifications: 4601a5a8db4ced6ae7cfc43b44d35fe437ac50c4
Expand Down
12 changes: 6 additions & 6 deletions apps/wallet-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@
"@cardano-foundation/ledgerjs-hw-app-cardano": "^7.1.3",
"@emurgo/cip14-js": "^3.0.1",
"@emurgo/cip4-js": "1.0.7",
"@emurgo/cross-csl-core": "^6.1.0",
"@emurgo/cross-csl-mobile": "^6.1.0",
"@emurgo/cross-csl-core": "^6.2.1",
"@emurgo/cross-csl-mobile": "^6.2.2",
"@emurgo/cross-msl-mobile": "^1.0.1",
"@emurgo/csl-mobile-bridge": "^7.1.0",
"@emurgo/csl-mobile-bridge": "^7.3.2",
"@emurgo/msl-mobile-bridge": "^1.0.4",
"@emurgo/react-native-hid": "5.15.8",
"@emurgo/yoroi-lib": "^2.2.3",
"@emurgo/yoroi-lib": "^2.2.4",
"@formatjs/intl-datetimeformat": "^6.7.0",
"@formatjs/intl-getcanonicallocales": "^2.1.0",
"@formatjs/intl-locale": "^3.2.1",
Expand Down Expand Up @@ -231,8 +231,8 @@
"@babel/preset-env": "^7.20.0",
"@babel/preset-react": "^7.16.7",
"@babel/runtime": "^7.20.0",
"@emurgo/cardano-serialization-lib-nodejs": "^13.1.0",
"@emurgo/cross-csl-nodejs": "^6.1.0",
"@emurgo/cardano-serialization-lib-nodejs": "^13.2.1",
"@emurgo/cross-csl-nodejs": "^6.2.1",
"@emurgo/cross-msl-nodejs": "^1.0.0",
"@formatjs/cli": "^6.1.0",
"@formatjs/ts-transformer": "^3.13.0",
Expand Down
14 changes: 6 additions & 8 deletions apps/wallet-mobile/src/features/Discover/common/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ import {
Certificates,
Credential,
MultiAsset,
TransactionBody,
TransactionInputs,
TransactionOutput,
WasmModuleProxy,
Withdrawals,
} from '@emurgo/cross-csl-core'
import {CardanoAddressedUtxo} from '@emurgo/yoroi-lib'
import cbor from 'cbor'
import cborUtils from 'cbor'

async function toLedgerTokenBundle(assets?: MultiAsset): Promise<Array<AssetGroup> | null> {
if (assets == null) return null
Expand Down Expand Up @@ -210,19 +209,16 @@ type AddressMap = {[addressHex: string]: Array<number>}

export async function toLedgerSignRequest(
csl: WasmModuleProxy,
txBody: TransactionBody,
cbor: string,
networkId: number,
protocolMagic: number,
ownUtxoAddressMap: AddressMap,
ownStakeAddressMap: AddressMap,
addressedUtxos: Array<CardanoAddressedUtxo>,
rawTxBody: cbor.Decoder.BufferLike,
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(),
)
const hex = new Uint8Array(Buffer.from(cbor, 'hex'))
const tagsState = await csl.hasTransactionSetTag(hex)

if (tagsState === csl.TransactionSetsState.MixedSets) {
throw new Error('Transaction with mixed sets cannot be signed by Ledger')
Expand Down Expand Up @@ -399,6 +395,8 @@ export async function toLedgerSignRequest(
}
}

const txBody = await (await csl.FixedTransaction.fromHex(cbor)).body()
const parsedCbor = await cborUtils.decode(await txBody.toBytes())
const outputs: TxOutput[] = []
const nativeOutputs = await txBody.outputs()
for (let i = 0; i < (await nativeOutputs.len()); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const ConfirmRawTxWithHW = ({onConfirm, utxo, bech32Address, cancelOrder}

if (step === 'connect-transport') {
return (
<ScrollView>
<ScrollView style={styles.scroll}>
<LedgerConnect useUSB={transportType === 'USB'} onConnectBLE={onConnectBLE} onConnectUSB={onConnectUSB} />
</ScrollView>
)
Expand All @@ -87,6 +87,9 @@ const useStyles = () => {
...atoms.gap_2xl,
...atoms.px_lg,
},
scroll: {
...atoms.px_lg,
},
text: {
...atoms.body_1_lg_regular,
...atoms.text_center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,17 +882,14 @@ export const makeCardanoWallet = (networkManager: Network.Manager, implementatio
}

async signSwapCancellationWithLedger(cbor: string, useUSB: boolean, hwDeviceInfo: HW.DeviceInfo): Promise<void> {
const tx = await CardanoMobile.Transaction.fromHex(cbor)
const txBody = await tx.body()
const payload = await toLedgerSignRequest(
CardanoMobile,
txBody,
cbor,
this.networkManager.chainId,
this.networkManager.protocolMagic,
await getHexAddressingMap(CardanoMobile, this),
await getHexAddressingMap(CardanoMobile, this),
getAddressedUtxos(this),
await txBody.toBytes(),
[],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,16 @@ class CIP30LedgerExtension {
async signTx(cbor: string, partial: boolean, hwDeviceInfo: HW.DeviceInfo, useUSB: boolean): Promise<Transaction> {
const {csl, release} = wrappedCsl()
try {
const tx = await csl.Transaction.fromHex(cbor)
if (!partial) await assertHasAllSigners(cbor, this.wallet, this.meta)
const txBody = await tx.body()

const transactionSetTag = await csl.hasTransactionSetTag(await tx.toBytes())

if (transactionSetTag === csl.TransactionSetsState.MixedSets) {
throw new Error('CIP30LedgerExtension.signTx: Mixed transaction sets are not supported when using a HW wallet')
}

const payload = await toLedgerSignRequest(
csl,
txBody,
cbor,
this.wallet.networkManager.chainId,
this.wallet.networkManager.protocolMagic,
await getHexAddressingMap(csl, this.wallet),
await getHexAddressingMap(csl, this.wallet),
getAddressedUtxos(this.wallet),
await txBody.toBytes(),
[],
)

Expand Down
62 changes: 62 additions & 0 deletions translations/messages/src/AppNavigator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"id": "components.login.custompinlogin.title",
"defaultMessage": "!!!Enter PIN",
"file": "src/AppNavigator.tsx",
"start": {
"line": 254,
"column": 17,
"index": 9599
},
"end": {
"line": 257,
"column": 3,
"index": 9689
}
},
{
"id": "components.initialization.custompinscreen.title",
"defaultMessage": "!!!Set PIN",
"file": "src/AppNavigator.tsx",
"start": {
"line": 258,
"column": 18,
"index": 9709
},
"end": {
"line": 261,
"column": 3,
"index": 9807
}
},
{
"id": "global.actions.dialogs.walletKeysInvalidated.title",
"defaultMessage": "!!!Auth with OS changes",
"file": "src/AppNavigator.tsx",
"start": {
"line": 262,
"column": 25,
"index": 9834
},
"end": {
"line": 265,
"column": 3,
"index": 9948
}
},
{
"id": "global.actions.dialogs.biometricsChange.message",
"defaultMessage": "!!!Auth with OS changed detected",
"file": "src/AppNavigator.tsx",
"start": {
"line": 266,
"column": 27,
"index": 9977
},
"end": {
"line": 269,
"column": 3,
"index": 10098
}
}
]
Loading

0 comments on commit ce1f998

Please sign in to comment.