@ledgerhq/live-common 34.35.0-nightly.3 → 34.35.0-nightly.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apps/support.d.ts +1 -0
- package/lib/apps/support.d.ts.map +1 -1
- package/lib/apps/support.js +10 -1
- package/lib/apps/support.js.map +1 -1
- package/lib/e2e/enum/Account.js +5 -5
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/index.d.ts +2 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +4 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +24 -8
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/e2e/speculosCI.d.ts +5 -0
- package/lib/e2e/speculosCI.d.ts.map +1 -0
- package/lib/e2e/speculosCI.js +129 -0
- package/lib/e2e/speculosCI.js.map +1 -0
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/hw/actions/manager.d.ts +1 -1
- package/lib/hw/actions/manager.d.ts.map +1 -1
- package/lib/hw/connectApp.d.ts.map +1 -1
- package/lib/hw/connectApp.js +56 -5
- package/lib/hw/connectApp.js.map +1 -1
- package/lib/hw/connectAppEventMapper.d.ts +29 -0
- package/lib/hw/connectAppEventMapper.d.ts.map +1 -0
- package/lib/hw/connectAppEventMapper.js +300 -0
- package/lib/hw/connectAppEventMapper.js.map +1 -0
- package/lib/hw/connectManager.d.ts +3 -2
- package/lib/hw/connectManager.d.ts.map +1 -1
- package/lib/hw/connectManager.js +34 -3
- package/lib/hw/connectManager.js.map +1 -1
- package/lib/hw/connectManagerEventMapper.d.ts +16 -0
- package/lib/hw/connectManagerEventMapper.d.ts.map +1 -0
- package/lib/hw/connectManagerEventMapper.js +78 -0
- package/lib/hw/connectManagerEventMapper.js.map +1 -0
- package/lib/notifications/AnnouncementProvider/index.d.ts.map +1 -1
- package/lib/notifications/AnnouncementProvider/index.js +12 -10
- package/lib/notifications/AnnouncementProvider/index.js.map +1 -1
- package/lib/notifications/AnnouncementProvider/machine.d.ts +1 -4
- package/lib/notifications/AnnouncementProvider/machine.d.ts.map +1 -1
- package/lib/notifications/AnnouncementProvider/machine.js +9 -8
- package/lib/notifications/AnnouncementProvider/machine.js.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/index.js +5 -4
- package/lib/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib/notifications/ServiceStatusProvider/machine.d.ts +1 -4
- package/lib/notifications/ServiceStatusProvider/machine.d.ts.map +1 -1
- package/lib/notifications/ServiceStatusProvider/machine.js +4 -4
- package/lib/notifications/ServiceStatusProvider/machine.js.map +1 -1
- package/lib/wallet-api/ModularDrawer/types.d.ts +63 -0
- package/lib/wallet-api/ModularDrawer/types.d.ts.map +1 -0
- package/lib/wallet-api/ModularDrawer/types.js +25 -0
- package/lib/wallet-api/ModularDrawer/types.js.map +1 -0
- package/lib/wallet-api/ModularDrawer/utils.d.ts +5 -0
- package/lib/wallet-api/ModularDrawer/utils.d.ts.map +1 -0
- package/lib/wallet-api/ModularDrawer/utils.js +30 -0
- package/lib/wallet-api/ModularDrawer/utils.js.map +1 -0
- package/lib/wallet-api/react.d.ts +2 -0
- package/lib/wallet-api/react.d.ts.map +1 -1
- package/lib/wallet-api/react.js +2 -1
- package/lib/wallet-api/react.js.map +1 -1
- package/lib-es/apps/support.d.ts +1 -0
- package/lib-es/apps/support.d.ts.map +1 -1
- package/lib-es/apps/support.js +8 -0
- package/lib-es/apps/support.js.map +1 -1
- package/lib-es/e2e/enum/Account.js +5 -5
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/index.d.ts +2 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +4 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +24 -8
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/e2e/speculosCI.d.ts +5 -0
- package/lib-es/e2e/speculosCI.d.ts.map +1 -0
- package/lib-es/e2e/speculosCI.js +121 -0
- package/lib-es/e2e/speculosCI.js.map +1 -0
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +1 -0
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/hw/actions/manager.d.ts +1 -1
- package/lib-es/hw/actions/manager.d.ts.map +1 -1
- package/lib-es/hw/connectApp.d.ts.map +1 -1
- package/lib-es/hw/connectApp.js +57 -6
- package/lib-es/hw/connectApp.js.map +1 -1
- package/lib-es/hw/connectAppEventMapper.d.ts +29 -0
- package/lib-es/hw/connectAppEventMapper.d.ts.map +1 -0
- package/lib-es/hw/connectAppEventMapper.js +296 -0
- package/lib-es/hw/connectAppEventMapper.js.map +1 -0
- package/lib-es/hw/connectManager.d.ts +3 -2
- package/lib-es/hw/connectManager.d.ts.map +1 -1
- package/lib-es/hw/connectManager.js +34 -4
- package/lib-es/hw/connectManager.js.map +1 -1
- package/lib-es/hw/connectManagerEventMapper.d.ts +16 -0
- package/lib-es/hw/connectManagerEventMapper.d.ts.map +1 -0
- package/lib-es/hw/connectManagerEventMapper.js +74 -0
- package/lib-es/hw/connectManagerEventMapper.js.map +1 -0
- package/lib-es/notifications/AnnouncementProvider/index.d.ts.map +1 -1
- package/lib-es/notifications/AnnouncementProvider/index.js +12 -10
- package/lib-es/notifications/AnnouncementProvider/index.js.map +1 -1
- package/lib-es/notifications/AnnouncementProvider/machine.d.ts +1 -4
- package/lib-es/notifications/AnnouncementProvider/machine.d.ts.map +1 -1
- package/lib-es/notifications/AnnouncementProvider/machine.js +9 -8
- package/lib-es/notifications/AnnouncementProvider/machine.js.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.d.ts.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/index.js +5 -4
- package/lib-es/notifications/ServiceStatusProvider/index.js.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/machine.d.ts +1 -4
- package/lib-es/notifications/ServiceStatusProvider/machine.d.ts.map +1 -1
- package/lib-es/notifications/ServiceStatusProvider/machine.js +4 -4
- package/lib-es/notifications/ServiceStatusProvider/machine.js.map +1 -1
- package/lib-es/wallet-api/ModularDrawer/types.d.ts +63 -0
- package/lib-es/wallet-api/ModularDrawer/types.d.ts.map +1 -0
- package/lib-es/wallet-api/ModularDrawer/types.js +22 -0
- package/lib-es/wallet-api/ModularDrawer/types.js.map +1 -0
- package/lib-es/wallet-api/ModularDrawer/utils.d.ts +5 -0
- package/lib-es/wallet-api/ModularDrawer/utils.d.ts.map +1 -0
- package/lib-es/wallet-api/ModularDrawer/utils.js +25 -0
- package/lib-es/wallet-api/ModularDrawer/utils.js.map +1 -0
- package/lib-es/wallet-api/react.d.ts +2 -0
- package/lib-es/wallet-api/react.d.ts.map +1 -1
- package/lib-es/wallet-api/react.js +2 -1
- package/lib-es/wallet-api/react.js.map +1 -1
- package/package.json +50 -49
- package/src/apps/support.ts +11 -0
- package/src/e2e/enum/Account.ts +5 -5
- package/src/e2e/speculos.ts +29 -10
- package/src/e2e/speculosCI.ts +161 -0
- package/src/featureFlags/defaultFeatures.ts +1 -0
- package/src/hw/actions/manager.ts +1 -1
- package/src/hw/connectApp.ts +245 -178
- package/src/hw/connectAppEventMapper.ts +364 -0
- package/src/hw/connectManager.ts +116 -74
- package/src/hw/connectManagerEventMapper.ts +109 -0
- package/src/notifications/AnnouncementProvider/index.tsx +21 -17
- package/src/notifications/AnnouncementProvider/machine.ts +9 -8
- package/src/notifications/ServiceStatusProvider/index.tsx +11 -8
- package/src/notifications/ServiceStatusProvider/machine.ts +4 -4
- package/src/wallet-api/ModularDrawer/types.ts +45 -0
- package/src/wallet-api/ModularDrawer/utils.ts +37 -0
- package/src/wallet-api/react.ts +37 -31
- package/lib/index.d.ts +0 -2
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -3
- package/lib/index.js.map +0 -1
- package/lib-es/index.d.ts +0 -1
- package/lib-es/index.d.ts.map +0 -1
- package/lib-es/index.js +0 -2
- package/lib-es/index.js.map +0 -1
- package/src/index.ts +0 -0
@@ -1,5 +1,6 @@
|
|
1
1
|
import React, { createContext, useMemo, useCallback, useContext, ReactElement } from "react";
|
2
2
|
import differenceBy from "lodash/differenceBy";
|
3
|
+
import { fromPromise } from "xstate";
|
3
4
|
import { useMachine } from "@xstate/react";
|
4
5
|
import type { Announcement, AnnouncementsUserSettings, State, AnnouncementsApi } from "./types";
|
5
6
|
import { localizeAnnouncements, filterAnnouncements } from "./logic";
|
@@ -55,7 +56,8 @@ export const AnnouncementProvider = ({
|
|
55
56
|
fetchApi = defaultFetchApi,
|
56
57
|
}: Props): ReactElement => {
|
57
58
|
const fetchData = useCallback(
|
58
|
-
async ({ allIds
|
59
|
+
async (arg0: { input: { allIds: string[]; cache: Record<string, Announcement> } }) => {
|
60
|
+
const { allIds, cache } = arg0.input;
|
59
61
|
const rawAnnouncements = await fetchApi.fetchAnnouncements();
|
60
62
|
const localizedAnnouncements = localizeAnnouncements(rawAnnouncements, context);
|
61
63
|
const announcements = filterAnnouncements(localizedAnnouncements, context);
|
@@ -80,9 +82,9 @@ export const AnnouncementProvider = ({
|
|
80
82
|
[context, onNewAnnouncement, fetchApi],
|
81
83
|
);
|
82
84
|
const emitNewAnnouncement = useCallback(
|
83
|
-
({
|
85
|
+
({ context }) => {
|
84
86
|
if (onAnnouncementRead) {
|
85
|
-
onAnnouncementRead(cache[seenId]);
|
87
|
+
onAnnouncementRead(context.cache[context.seenId]);
|
86
88
|
}
|
87
89
|
},
|
88
90
|
[onAnnouncementRead],
|
@@ -96,7 +98,7 @@ export const AnnouncementProvider = ({
|
|
96
98
|
};
|
97
99
|
}, [handleLoad]);
|
98
100
|
const saveData = useCallback(
|
99
|
-
context => {
|
101
|
+
({ context }) => {
|
100
102
|
const { cache, lastUpdateTime, seenIds, allIds } = context;
|
101
103
|
const announcements = allIds.map((id: string) => cache[id]);
|
102
104
|
handleSave({
|
@@ -107,19 +109,21 @@ export const AnnouncementProvider = ({
|
|
107
109
|
},
|
108
110
|
[handleSave],
|
109
111
|
);
|
110
|
-
const [state, send] = useMachine(
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
112
|
+
const [state, send] = useMachine(
|
113
|
+
announcementMachine.provide({
|
114
|
+
actions: {
|
115
|
+
saveData,
|
116
|
+
emitNewAnnouncement,
|
117
|
+
},
|
118
|
+
actors: {
|
119
|
+
loadData: fromPromise(loadData),
|
120
|
+
fetchData: fromPromise(fetchData),
|
121
|
+
},
|
122
|
+
delays: {
|
123
|
+
AUTO_UPDATE_DELAY: autoUpdateDelay,
|
124
|
+
},
|
125
|
+
}),
|
126
|
+
);
|
123
127
|
const api = useMemo(
|
124
128
|
() => ({
|
125
129
|
updateCache: async () => {
|
@@ -20,8 +20,8 @@ export const announcementMachine = createMachine(
|
|
20
20
|
src: "loadData",
|
21
21
|
onDone: {
|
22
22
|
target: "updating",
|
23
|
-
actions: assign((
|
24
|
-
const { announcements, seenIds, lastUpdateTime } =
|
23
|
+
actions: assign(({ event }) => {
|
24
|
+
const { announcements, seenIds, lastUpdateTime } = event.output;
|
25
25
|
const cache = {};
|
26
26
|
announcements.forEach(announcement => {
|
27
27
|
cache[announcement.uuid] = announcement;
|
@@ -56,11 +56,12 @@ export const announcementMachine = createMachine(
|
|
56
56
|
updating: {
|
57
57
|
invoke: {
|
58
58
|
src: "fetchData",
|
59
|
+
input: ({ context }) => ({ allIds: context.allIds, cache: context.cache }),
|
59
60
|
onDone: {
|
60
61
|
target: "idle",
|
61
62
|
actions: [
|
62
|
-
assign((context
|
63
|
-
const { announcements, updateTime } =
|
63
|
+
assign(({ context, event }) => {
|
64
|
+
const { announcements, updateTime } = event.output;
|
64
65
|
const cache = {};
|
65
66
|
announcements.forEach(announcement => {
|
66
67
|
cache[announcement.uuid] = announcement;
|
@@ -80,8 +81,8 @@ export const announcementMachine = createMachine(
|
|
80
81
|
},
|
81
82
|
onError: {
|
82
83
|
target: "idle",
|
83
|
-
actions: assign((
|
84
|
-
error:
|
84
|
+
actions: assign(({ event }) => ({
|
85
|
+
error: event.error as Error,
|
85
86
|
})),
|
86
87
|
},
|
87
88
|
},
|
@@ -89,14 +90,14 @@ export const announcementMachine = createMachine(
|
|
89
90
|
},
|
90
91
|
on: {
|
91
92
|
SET_AS_SEEN: {
|
92
|
-
|
93
|
+
guard: ({ context, event }) => !context.seenIds.includes(event.seenId),
|
93
94
|
actions: ["setAsSeen", "saveData", "emitNewAnnouncement"],
|
94
95
|
},
|
95
96
|
},
|
96
97
|
},
|
97
98
|
{
|
98
99
|
actions: {
|
99
|
-
setAsSeen: assign((context
|
100
|
+
setAsSeen: assign(({ context, event }) => ({
|
100
101
|
seenIds: [...context.seenIds, event.seenId],
|
101
102
|
})),
|
102
103
|
},
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React, { createContext, useContext, useMemo, useCallback, ReactElement } from "react";
|
2
2
|
import type { State, ServiceStatusUserSettings, Incident, ServiceStatusApi } from "./types";
|
3
3
|
import defaultNetworkApi from "./api";
|
4
|
+
import { fromPromise } from "xstate";
|
4
5
|
import { useMachine } from "@xstate/react";
|
5
6
|
import { serviceStatusMachine } from "./machine";
|
6
7
|
type Props = {
|
@@ -74,14 +75,16 @@ export const ServiceStatusProvider = ({
|
|
74
75
|
};
|
75
76
|
}, [networkApi]);
|
76
77
|
|
77
|
-
const [state, send] = useMachine(
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
78
|
+
const [state, send] = useMachine(
|
79
|
+
serviceStatusMachine.provide({
|
80
|
+
actors: {
|
81
|
+
fetchData: fromPromise(fetchData),
|
82
|
+
},
|
83
|
+
delays: {
|
84
|
+
AUTO_UPDATE_DELAY: autoUpdateDelay,
|
85
|
+
},
|
86
|
+
}),
|
87
|
+
);
|
85
88
|
const api = useMemo(
|
86
89
|
() => ({
|
87
90
|
updateData: async () => {
|
@@ -33,8 +33,8 @@ export const serviceStatusMachine = createMachine({
|
|
33
33
|
src: "fetchData",
|
34
34
|
onDone: {
|
35
35
|
target: "idle",
|
36
|
-
actions: assign((
|
37
|
-
const { incidents, updateTime } =
|
36
|
+
actions: assign(({ event }) => {
|
37
|
+
const { incidents, updateTime } = event.output;
|
38
38
|
return {
|
39
39
|
incidents,
|
40
40
|
lastUpdateTime: updateTime,
|
@@ -45,8 +45,8 @@ export const serviceStatusMachine = createMachine({
|
|
45
45
|
},
|
46
46
|
onError: {
|
47
47
|
target: "idle",
|
48
|
-
actions: assign((
|
49
|
-
error:
|
48
|
+
actions: assign(({ event }) => ({
|
49
|
+
error: event.error as Error,
|
50
50
|
})),
|
51
51
|
},
|
52
52
|
},
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
|
3
|
+
export type ModularDrawerConfiguration = {
|
4
|
+
assets?: {
|
5
|
+
filter?: string;
|
6
|
+
leftElement?: string;
|
7
|
+
rightElement?: string;
|
8
|
+
};
|
9
|
+
networks?: {
|
10
|
+
rightElement?: string;
|
11
|
+
leftElement?: string;
|
12
|
+
};
|
13
|
+
};
|
14
|
+
|
15
|
+
const filterOptions = ["topNetworks"] as const;
|
16
|
+
const assetsLeftElementOptions = ["apy", "priceVariation"] as const;
|
17
|
+
const assetsRightElementOptions = ["balance", "marketTrend"] as const;
|
18
|
+
const networksLeftElementOptions = ["numberOfAccounts", "numberOfAccountsAndApy"] as const;
|
19
|
+
const networksRightElementOptions = ["balance"] as const;
|
20
|
+
|
21
|
+
export const EnhancedModularDrawerConfigurationSchema = z.object({
|
22
|
+
assets: z
|
23
|
+
.object({
|
24
|
+
filter: z.enum(filterOptions).optional(),
|
25
|
+
leftElement: z.enum(assetsLeftElementOptions).optional(),
|
26
|
+
rightElement: z.enum(assetsRightElementOptions).optional(),
|
27
|
+
})
|
28
|
+
.optional(),
|
29
|
+
networks: z
|
30
|
+
.object({
|
31
|
+
leftElement: z.enum(networksLeftElementOptions).optional(),
|
32
|
+
rightElement: z.enum(networksRightElementOptions).optional(),
|
33
|
+
})
|
34
|
+
.optional(),
|
35
|
+
});
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Enhanced configuration for the modular drawer.
|
39
|
+
* Extends the base configuration by allowing customization of `assets` and `networks` properties.
|
40
|
+
*/
|
41
|
+
export type EnhancedModularDrawerConfiguration = Omit<
|
42
|
+
ModularDrawerConfiguration,
|
43
|
+
"assets" | "networks"
|
44
|
+
> &
|
45
|
+
z.infer<typeof EnhancedModularDrawerConfigurationSchema>;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import {
|
2
|
+
type EnhancedModularDrawerConfiguration,
|
3
|
+
type ModularDrawerConfiguration,
|
4
|
+
EnhancedModularDrawerConfigurationSchema,
|
5
|
+
} from "./types";
|
6
|
+
|
7
|
+
export const defaultDrawerConfiguration: EnhancedModularDrawerConfiguration = {
|
8
|
+
assets: {
|
9
|
+
rightElement: "balance",
|
10
|
+
},
|
11
|
+
networks: {
|
12
|
+
leftElement: "numberOfAccounts",
|
13
|
+
},
|
14
|
+
};
|
15
|
+
|
16
|
+
export function validateAndTransformConfigurationWithZod(
|
17
|
+
config?: ModularDrawerConfiguration | EnhancedModularDrawerConfiguration,
|
18
|
+
): EnhancedModularDrawerConfiguration {
|
19
|
+
const result = EnhancedModularDrawerConfigurationSchema.safeParse(config);
|
20
|
+
|
21
|
+
if (!result.success) {
|
22
|
+
console.warn("Modulare Drawer invalid configuration received:", result.error);
|
23
|
+
return {};
|
24
|
+
}
|
25
|
+
|
26
|
+
return result.data;
|
27
|
+
}
|
28
|
+
|
29
|
+
export function createModularDrawerConfiguration(
|
30
|
+
config?: ModularDrawerConfiguration | EnhancedModularDrawerConfiguration,
|
31
|
+
): EnhancedModularDrawerConfiguration {
|
32
|
+
const validatedConfig = validateAndTransformConfigurationWithZod(config);
|
33
|
+
return {
|
34
|
+
...defaultDrawerConfiguration,
|
35
|
+
...validatedConfig,
|
36
|
+
} satisfies EnhancedModularDrawerConfiguration;
|
37
|
+
}
|
package/src/wallet-api/react.ts
CHANGED
@@ -52,6 +52,7 @@ import {
|
|
52
52
|
import { DiscoverDB } from "./types";
|
53
53
|
import { LiveAppManifest } from "../platform/types";
|
54
54
|
import { WalletState } from "@ledgerhq/live-wallet/store";
|
55
|
+
import { ModularDrawerConfiguration } from "./ModularDrawer/types";
|
55
56
|
|
56
57
|
export function safeGetRefValue<T>(ref: RefObject<T>): NonNullable<T> {
|
57
58
|
if (!ref.current) {
|
@@ -129,6 +130,7 @@ export interface UiHook {
|
|
129
130
|
"account.request": (params: {
|
130
131
|
accounts$?: Observable<WalletAPIAccount[]>;
|
131
132
|
currencies: CryptoOrTokenCurrency[];
|
133
|
+
drawerConfiguration?: ModularDrawerConfiguration;
|
132
134
|
onSuccess: (account: AccountLike, parentAccount: Account | undefined) => void;
|
133
135
|
onCancel: () => void;
|
134
136
|
}) => void;
|
@@ -354,39 +356,43 @@ export function useWalletAPIServer({
|
|
354
356
|
useEffect(() => {
|
355
357
|
if (!uiAccountRequest) return;
|
356
358
|
|
357
|
-
server.setHandler(
|
358
|
-
|
359
|
-
|
359
|
+
server.setHandler(
|
360
|
+
"account.request",
|
361
|
+
async ({ accounts$, currencies$, drawerConfiguration }) => {
|
362
|
+
tracking.requestAccountRequested(manifest);
|
363
|
+
const currencies = await firstValueFrom(currencies$);
|
364
|
+
|
365
|
+
return new Promise((resolve, reject) => {
|
366
|
+
// handle no curencies selected case
|
367
|
+
const currencyList = currencies.reduce<CryptoOrTokenCurrency[]>((prev, { id }) => {
|
368
|
+
const currency = findCryptoCurrencyById(id) || findTokenById(id);
|
369
|
+
if (currency) {
|
370
|
+
prev.push(currency);
|
371
|
+
}
|
372
|
+
return prev;
|
373
|
+
}, []);
|
360
374
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
resolve(accountToWalletAPIAccount(walletState, account, parentAccount));
|
380
|
-
},
|
381
|
-
onCancel: () => {
|
382
|
-
if (done) return;
|
383
|
-
done = true;
|
384
|
-
tracking.requestAccountFail(manifest);
|
385
|
-
reject(new Error("Canceled by user"));
|
386
|
-
},
|
375
|
+
let done = false;
|
376
|
+
uiAccountRequest({
|
377
|
+
accounts$,
|
378
|
+
currencies: currencyList,
|
379
|
+
drawerConfiguration,
|
380
|
+
onSuccess: (account: AccountLike, parentAccount: Account | undefined) => {
|
381
|
+
if (done) return;
|
382
|
+
done = true;
|
383
|
+
tracking.requestAccountSuccess(manifest);
|
384
|
+
resolve(accountToWalletAPIAccount(walletState, account, parentAccount));
|
385
|
+
},
|
386
|
+
onCancel: () => {
|
387
|
+
if (done) return;
|
388
|
+
done = true;
|
389
|
+
tracking.requestAccountFail(manifest);
|
390
|
+
reject(new Error("Canceled by user"));
|
391
|
+
},
|
392
|
+
});
|
387
393
|
});
|
388
|
-
}
|
389
|
-
|
394
|
+
},
|
395
|
+
);
|
390
396
|
}, [walletState, manifest, server, tracking, uiAccountRequest]);
|
391
397
|
|
392
398
|
useEffect(() => {
|
package/lib/index.d.ts
DELETED
package/lib/index.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/lib/index.js
DELETED
package/lib/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/lib-es/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib-es/index.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/lib-es/index.js
DELETED
package/lib-es/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/src/index.ts
DELETED
File without changes
|