Skip to content

Commit 6349dd5

Browse files
WLT-1736 (#7)
* feat: bump android native version and bridge version * WLT-1736: fix example ui --------- Co-authored-by: valeriaFireblocks <[email protected]>
1 parent 758daa4 commit 6349dd5

File tree

11 files changed

+14109
-11255
lines changed

11 files changed

+14109
-11255
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ dependencies {
119119
//noinspection GradleDynamicVersion
120120
implementation "com.facebook.react:react-native:+"
121121
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
122-
implementation "com.fireblocks.sdk:ncw:2.5.0"
122+
implementation "com.fireblocks.sdk:ncw:2.9.2"
123123
}
124124

125125
if (isNewArchitectureEnabled()) {

example/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ dependencies {
121121
// The version of react-native is set by the React Native Gradle Plugin
122122
implementation("com.facebook.react:react-android")
123123
implementation("com.facebook.react:flipper-integration")
124-
implementation("com.fireblocks.sdk:ncw:2.5.0")
124+
implementation("com.fireblocks.sdk:ncw:2.9.2")
125125

126126
if (hermesEnabled.toBoolean()) {
127127
implementation("com.facebook.react:hermes-android")

example/ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ PODS:
6363
- GoogleUtilities/Environment (~> 7.8)
6464
- GoogleUtilities/UserDefaults (~> 7.8)
6565
- PromisesObjC (~> 2.1)
66-
- fireblocks-react-native-ncw-sdk (1.0.0):
66+
- fireblocks-react-native-ncw-sdk (1.0.2):
6767
- glog
6868
- RCT-Folly (= 2022.05.16.00)
6969
- React-Core
@@ -1545,7 +1545,7 @@ SPEC CHECKSUMS:
15451545
FirebaseCore: 28045c1560a2600d284b9c45a904fe322dc890b6
15461546
FirebaseCoreInternal: bca337352024b18424a61e478460547d46c4c753
15471547
FirebaseInstallations: 763814908793c0da14c18b3dcffdec71e29ed55e
1548-
fireblocks-react-native-ncw-sdk: 867882b558c0a3ef1c7a79d2e21af7db40a5a88e
1548+
fireblocks-react-native-ncw-sdk: 049d245e206189c1b411de132ff6052a8ba32914
15491549
Flipper: c7a0093234c4bdd456e363f2f19b2e4b27652d44
15501550
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
15511551
Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30
@@ -1622,7 +1622,7 @@ SPEC CHECKSUMS:
16221622
RNSVG: 50cf2c7018e57cf5d3522d98d0a3a4dd6bf9d093
16231623
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
16241624
VisionCamera: 36c460338692788a0d377dce7d32f8ba049fb4f2
1625-
Yoga: 805bf71192903b20fc14babe48080582fee65a80
1625+
Yoga: d17d2cc8105eed528474683b42e2ea310e1daf61
16261626

16271627
PODFILE CHECKSUM: 39734b197bfc91ffdfa5baa43576530a5725c6dd
16281628

example/src/AppStore.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import { ApiService, type ITransactionData, type IWalletAsset, type TPassphraseL
77
import { PasswordEncryptedLocalStorage } from "./services/PasswordEncryptedLocalStorage";
88
import type { IAuthManager } from "./auth/IAuthManager";
99
import { FirebaseAuthManager } from "./auth/FirebaseAuthManager";
10-
import { decode, version } from "js-base64";
10+
import { decode } from "js-base64";
1111
import type { IEventsHandler, IFireblocksNCW, IJoinWalletEvent, IKeyBackupEvent, IKeyDescriptor, IKeyRecoveryEvent, IMessagesHandler } from "@fireblocks/react-native-ncw-sdk";
1212
import type { TEvent, TMPCAlgorithm, TEnv } from "@fireblocks/react-native-ncw-sdk";
1313
import { FireblocksNCWFactory } from "@fireblocks/react-native-ncw-sdk";
1414
import { ACCESSIBLE, ACCESS_CONTROL, type Options, getGenericPassword, setGenericPassword } from "react-native-keychain";
1515
import { randomPassPhrase } from "./services/randomPassPhrase";
16+
import packageJson from '../../package.json';
1617

1718
export type TAsyncActionStatus = "not_started" | "started" | "success" | "failed";
1819
export type TFireblocksNCWStatus = "sdk_not_ready" | "initializing_sdk" | "sdk_available" | "sdk_initialization_failed";
@@ -38,7 +39,7 @@ export const useAppStore = create<IAppState>()((set, get) => {
3839
};
3940

4041
return {
41-
fireblocksNCWSdkVersion: version,
42+
fireblocksNCWSdkVersion: packageJson.version,
4243
automateInitialization: ENV_CONFIG.AUTOMATE_INITIALIZATION,
4344
joinExistingWalletMode: false,
4445
loggedUser: authManager.loggedUser,
@@ -529,7 +530,7 @@ export const useAppStore = create<IAppState>()((set, get) => {
529530
}
530531
// TODO: consolidate
531532
// const ALGORITHMS = new Set<TMPCAlgorithm>(["MPC_CMP_ECDSA_SECP256K1"]);
532-
const ALGORITHMS = new Set<TMPCAlgorithm>(["MPC_ECDSA_SECP256K1"]);
533+
const ALGORITHMS = new Set<TMPCAlgorithm>(["MPC_ECDSA_SECP256K1","MPC_EDDSA_ED25519"]);
533534
await fireblocksNCW.generateMPCKeys(ALGORITHMS);
534535
},
535536
stopMpcDeviceSetup: async () => {

example/src/components/AssetRow.tsx

Lines changed: 0 additions & 32 deletions
This file was deleted.

example/src/components/Assets.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React, { useRef } from "react";
22
import { useAppStore } from "../AppStore";
3-
import { AssetRow } from "./AssetRow";
43
// import { Autocomplete } from "./ui/Autocomplete";
54
import { Card } from "./ui/Card";
65
import { IActionButtonProps } from "./ui/ActionButton";
76
import { Row, Table } from "react-native-reanimated-table";
87
import { Button, Text, View } from "react-native";
98
import { AutocompleteDropdown, AutocompleteDropdownRef } from "react-native-autocomplete-dropdown";
109
import { SvgUri } from "react-native-svg";
10+
import { Copyable } from "./ui/Copyable";
1111

1212
export const Assets: React.FC = () => {
1313
const { accounts, refreshAccounts, addAsset, refreshSupportedAssets, supportedAssets } = useAppStore();
@@ -67,17 +67,23 @@ export const Assets: React.FC = () => {
6767
{hasAccounts &&
6868
accounts.map((account, index) => (
6969
<View key={`asset_account_${index}`}>
70-
<Table key={`account${index}`}>
70+
<Table key={`account${index}`}>
7171
<Row data={[
7272
"Asset",
7373
"Name",
74-
"Type",
7574
"Address",
7675
"Balance"
7776
]} />
78-
{Object.entries(account).map(([assetId, assetInfo]) =>
79-
<Row key={`asset_account_row_${index}_${assetId}`} data={[assetId, assetInfo.asset.name, assetInfo.asset.type, assetInfo.address?.address, assetInfo.balance?.total]} />
80-
)}
77+
{Object.entries(account).map(([assetId, assetInfo]) => (
78+
<React.Fragment key={`asset_account_row_${index}_${assetId}`}>
79+
<Row data={[
80+
assetId,
81+
assetInfo.asset.name,
82+
<Copyable value={assetInfo.address?.address ?? ""} />,
83+
<Text style={{ textAlign: 'center' }}>{assetInfo.balance?.total}</Text>
84+
]} />
85+
</React.Fragment>
86+
))}
8187
</Table>
8288
<View style={{
8389
justifyContent: "space-between",

example/src/components/DeriveAssetsList.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ export const DeriveAssetsList: React.FC<IProps> = ({ privateKey }) => {
6161
<Table>
6262
<Row data={["Asset", "Name", "Derrived Key"]}></Row>
6363
{assetsListItems.map((assetListItem) => (
64-
<Row key={`derrived_${assetListItem.id}`} data={[assetListItem.assetId, assetListItem.name, assetListItem.derivedAssetKey]} />
64+
<Row key={`derrived_${assetListItem.id}`} data={[
65+
assetListItem.assetId,
66+
assetListItem.name,
67+
<Copyable value={assetListItem.derivedAssetKey} />]} />
6568
// <tr key={assetListItem.id}>
6669
// <td className="flex items-center gap-2">
6770
// {assetListItem.iconUrl ? <img src={assetListItem.iconUrl} className="w-8 h-8"></img> : missingIcon}

example/src/components/GenerateMPCKeys.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export const GenerateMPCKeys: React.FC = () => {
6060
};
6161

6262
const secP256K1Status = keysStatus?.MPC_ECDSA_SECP256K1?.keyStatus ?? null;
63+
const ed25519Status = keysStatus?.MPC_EDDSA_ED25519?.keyStatus ?? null;
64+
6365
const statusToProgress = (status: TKeyStatus | null) => {
6466
switch (status) {
6567
case "INITIATED":
@@ -76,12 +78,13 @@ export const GenerateMPCKeys: React.FC = () => {
7678
return 0;
7779
}
7880
};
79-
const secP256K1Ready = secP256K1Status === "READY";
8081

82+
const secP256K1Ready = secP256K1Status === "READY";
83+
const ed25519Ready = ed25519Status === "READY";
8184
const generateAction: IActionButtonProps = {
8285
label: "Generate MPC Keys",
8386
action: doGenerateMPCKeys,
84-
isDisabled: isGenerateInProgress || secP256K1Ready,
87+
isDisabled: isGenerateInProgress || (secP256K1Ready && ed25519Ready),
8588
isInProgress: isGenerateInProgress,
8689
};
8790

@@ -95,7 +98,7 @@ export const GenerateMPCKeys: React.FC = () => {
9598
const approveJoinWalletAction: IActionButtonProps = {
9699
label: "Approve Join Wallet",
97100
action: () => setShowScanQr(true),
98-
isDisabled: (isStopInProgress || isGenerateInProgress) && secP256K1Ready,
101+
isDisabled: (isStopInProgress || isGenerateInProgress) && (secP256K1Ready || ed25519Ready),
99102
};
100103
const stopApproveWalletAction: IActionButtonProps = {
101104
label: "Stop Approve Join Wallet",
@@ -119,13 +122,23 @@ export const GenerateMPCKeys: React.FC = () => {
119122
"ECDSA SECP256K1",
120123
secP256K1Status ?? "N/A",
121124
]}/>
125+
<Row data={[
126+
"EDDSA_ED25519",
127+
ed25519Status ?? "N/A",
128+
]}/>
122129
</Table>
123130
</View>
124131
{ secP256K1Status && (
125132
<View>
126133
<Bar progress={statusToProgress(secP256K1Status)/100} width={null} />
127134
</View>
128135
)}
136+
<View style={{ height: 10 }} />
137+
{ ed25519Status && (
138+
<View>
139+
<Bar progress={statusToProgress(ed25519Status)/100} width={null} />
140+
</View>
141+
)}
129142
{ generateMPCKeysResult && (
130143
<View>
131144
<Text>Result: {generateMPCKeysResult}</Text>

example/src/components/ui/Copyable.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from "react";
22
import { StyleSheet, Text, View } from "react-native";
33
import Clipboard from '@react-native-clipboard/clipboard';
44
import Svg, { Path } from "react-native-svg";
5+
import { Alert } from "react-native";
6+
import { Platform } from "react-native";
57

68
function writeToClipboard(value: string) {
79
Clipboard.setString(value);
@@ -31,6 +33,9 @@ const styles = StyleSheet.create({
3133
export const Copyable: React.FC<{ value: string }> = ({ value }) => {
3234
const doCopy = () => {
3335
writeToClipboard(value);
36+
if (Platform.OS === 'ios') {
37+
Alert.alert("Copied to Clipboard", "The text has been copied to your clipboard.");
38+
}
3439
};
3540

3641
const clipboardIcon = (

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fireblocks/react-native-ncw-sdk",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "NCW SDK Native bridge",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

0 commit comments

Comments
 (0)