@pasosdejesus/m 0.24.0 → 0.26.0
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/dist/CHANGELOG.md +75 -1
- package/dist/base-model/baseline.generated.d.ts +48 -0
- package/dist/base-model/baseline.generated.d.ts.map +1 -0
- package/dist/base-model/baseline.generated.js +930 -0
- package/dist/base-model/baseline.generated.js.map +1 -0
- package/dist/base-model/check.d.ts +6 -0
- package/dist/base-model/check.d.ts.map +1 -0
- package/dist/base-model/check.js +195 -0
- package/dist/base-model/check.js.map +1 -0
- package/dist/base-model/generate.d.ts +42 -0
- package/dist/base-model/generate.d.ts.map +1 -0
- package/dist/base-model/generate.js +241 -0
- package/dist/base-model/generate.js.map +1 -0
- package/dist/base-model/guidelines.d.ts +13 -0
- package/dist/base-model/guidelines.d.ts.map +1 -0
- package/dist/base-model/guidelines.js +61 -0
- package/dist/base-model/guidelines.js.map +1 -0
- package/dist/base-model/index.d.ts +22 -0
- package/dist/base-model/index.d.ts.map +1 -0
- package/dist/base-model/index.js +26 -0
- package/dist/base-model/index.js.map +1 -0
- package/dist/base-model/parse-structure.d.ts +4 -0
- package/dist/base-model/parse-structure.d.ts.map +1 -0
- package/dist/base-model/parse-structure.js +170 -0
- package/dist/base-model/parse-structure.js.map +1 -0
- package/dist/base-model/queries.d.ts +34 -0
- package/dist/base-model/queries.d.ts.map +1 -0
- package/dist/base-model/queries.js +118 -0
- package/dist/base-model/queries.js.map +1 -0
- package/dist/base-model/references/learn-tg.d.ts +21 -0
- package/dist/base-model/references/learn-tg.d.ts.map +1 -0
- package/dist/base-model/references/learn-tg.js +65 -0
- package/dist/base-model/references/learn-tg.js.map +1 -0
- package/dist/base-model/references/msip.d.ts +29 -0
- package/dist/base-model/references/msip.d.ts.map +1 -0
- package/dist/base-model/references/msip.js +33 -0
- package/dist/base-model/references/msip.js.map +1 -0
- package/dist/base-model/types.d.ts +207 -0
- package/dist/base-model/types.d.ts.map +1 -0
- package/dist/base-model/types.js +10 -0
- package/dist/base-model/types.js.map +1 -0
- package/dist/base-model/version.d.ts +19 -0
- package/dist/base-model/version.d.ts.map +1 -0
- package/dist/base-model/version.js +26 -0
- package/dist/base-model/version.js.map +1 -0
- package/dist/base-model/wallet-link.d.ts +69 -0
- package/dist/base-model/wallet-link.d.ts.map +1 -0
- package/dist/base-model/wallet-link.js +220 -0
- package/dist/base-model/wallet-link.js.map +1 -0
- package/dist/base-model/wallet-link.test.d.ts +2 -0
- package/dist/base-model/wallet-link.test.d.ts.map +1 -0
- package/dist/base-model/wallet-link.test.js +147 -0
- package/dist/base-model/wallet-link.test.js.map +1 -0
- package/dist/e2e/full-wallet.d.ts +19 -0
- package/dist/e2e/full-wallet.d.ts.map +1 -1
- package/dist/e2e/full-wallet.js +12 -4
- package/dist/e2e/full-wallet.js.map +1 -1
- package/dist/e2e/full-wallet.test.js +26 -0
- package/dist/e2e/full-wallet.test.js.map +1 -1
- package/dist/e2e/in-app-wallet.d.ts +23 -0
- package/dist/e2e/in-app-wallet.d.ts.map +1 -0
- package/dist/e2e/in-app-wallet.js +40 -0
- package/dist/e2e/in-app-wallet.js.map +1 -0
- package/dist/e2e/in-app-wallet.test.d.ts +2 -0
- package/dist/e2e/in-app-wallet.test.d.ts.map +1 -0
- package/dist/e2e/in-app-wallet.test.js +52 -0
- package/dist/e2e/in-app-wallet.test.js.map +1 -0
- package/dist/e2e/index.d.ts +5 -1
- package/dist/e2e/index.d.ts.map +1 -1
- package/dist/e2e/index.js +2 -0
- package/dist/e2e/index.js.map +1 -1
- package/dist/e2e/warmup.d.ts +38 -0
- package/dist/e2e/warmup.d.ts.map +1 -0
- package/dist/e2e/warmup.js +84 -0
- package/dist/e2e/warmup.js.map +1 -0
- package/dist/e2e/warmup.test.d.ts +2 -0
- package/dist/e2e/warmup.test.d.ts.map +1 -0
- package/dist/e2e/warmup.test.js +67 -0
- package/dist/e2e/warmup.test.js.map +1 -0
- package/dist/i18n/locales/cli.d.ts.map +1 -1
- package/dist/i18n/locales/cli.js +10 -0
- package/dist/i18n/locales/cli.js.map +1 -1
- package/dist/m.js +19 -1
- package/dist/m.js.map +1 -1
- package/dist/tasks/base-model.d.ts +4 -0
- package/dist/tasks/base-model.d.ts.map +1 -0
- package/dist/tasks/base-model.js +260 -0
- package/dist/tasks/base-model.js.map +1 -0
- package/dist/tasks/db.d.ts.map +1 -1
- package/dist/tasks/db.js +27 -0
- package/dist/tasks/db.js.map +1 -1
- package/dist/tasks/e2e-summary.d.ts +13 -0
- package/dist/tasks/e2e-summary.d.ts.map +1 -0
- package/dist/tasks/e2e-summary.js +117 -0
- package/dist/tasks/e2e-summary.js.map +1 -0
- package/dist/tasks/e2e.d.ts +29 -0
- package/dist/tasks/e2e.d.ts.map +1 -1
- package/dist/tasks/e2e.js +130 -36
- package/dist/tasks/e2e.js.map +1 -1
- package/dist/tasks/e2e.test.d.ts +2 -0
- package/dist/tasks/e2e.test.d.ts.map +1 -0
- package/dist/tasks/e2e.test.js +108 -0
- package/dist/tasks/e2e.test.js.map +1 -0
- package/dist/tasks/warmup.d.ts +4 -0
- package/dist/tasks/warmup.d.ts.map +1 -0
- package/dist/tasks/warmup.js +67 -0
- package/dist/tasks/warmup.js.map +1 -0
- package/dist/tasks/warmup.test.d.ts +2 -0
- package/dist/tasks/warmup.test.d.ts.map +1 -0
- package/dist/tasks/warmup.test.js +40 -0
- package/dist/tasks/warmup.test.js.map +1 -0
- package/dist/templates/apps/nextjs/package.json.hbs +1 -1
- package/dist/test-utils/console.d.ts +37 -0
- package/dist/test-utils/console.d.ts.map +1 -0
- package/dist/test-utils/console.js +52 -0
- package/dist/test-utils/console.js.map +1 -0
- package/dist/test-utils/console.test.d.ts +2 -0
- package/dist/test-utils/console.test.d.ts.map +1 -0
- package/dist/test-utils/console.test.js +57 -0
- package/dist/test-utils/console.test.js.map +1 -0
- package/dist/test-utils/index.d.ts +1 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +1 -0
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/kysely-mocks.d.ts +163 -33
- package/dist/test-utils/kysely-mocks.d.ts.map +1 -1
- package/dist/test-utils/kysely-mocks.js +147 -18
- package/dist/test-utils/kysely-mocks.js.map +1 -1
- package/dist/test-utils/kysely-mocks.test.d.ts +2 -0
- package/dist/test-utils/kysely-mocks.test.d.ts.map +1 -0
- package/dist/test-utils/kysely-mocks.test.js +94 -0
- package/dist/test-utils/kysely-mocks.test.js.map +1 -0
- package/dist/wallet/next/components/InAppWalletSetup.d.ts +11 -0
- package/dist/wallet/next/components/InAppWalletSetup.d.ts.map +1 -0
- package/dist/wallet/next/components/InAppWalletSetup.js +55 -0
- package/dist/wallet/next/components/InAppWalletSetup.js.map +1 -0
- package/dist/wallet/next/components/InAppWalletUnlock.d.ts +9 -0
- package/dist/wallet/next/components/InAppWalletUnlock.d.ts.map +1 -0
- package/dist/wallet/next/components/InAppWalletUnlock.js +29 -0
- package/dist/wallet/next/components/InAppWalletUnlock.js.map +1 -0
- package/dist/wallet/next/components.test.d.ts +2 -0
- package/dist/wallet/next/components.test.d.ts.map +1 -0
- package/dist/wallet/next/components.test.js +122 -0
- package/dist/wallet/next/components.test.js.map +1 -0
- package/dist/wallet/next/i18n.d.ts +63 -0
- package/dist/wallet/next/i18n.d.ts.map +1 -0
- package/dist/wallet/next/i18n.js +64 -0
- package/dist/wallet/next/i18n.js.map +1 -0
- package/dist/wallet/next/index.d.ts +7 -0
- package/dist/wallet/next/index.d.ts.map +1 -0
- package/dist/wallet/next/index.js +12 -0
- package/dist/wallet/next/index.js.map +1 -0
- package/dist/wallet/next/namespaces.d.ts +17 -0
- package/dist/wallet/next/namespaces.d.ts.map +1 -0
- package/dist/wallet/next/namespaces.js +17 -0
- package/dist/wallet/next/namespaces.js.map +1 -0
- package/dist/wallet/next/useInAppWallet.d.ts +55 -0
- package/dist/wallet/next/useInAppWallet.d.ts.map +1 -0
- package/dist/wallet/next/useInAppWallet.js +261 -0
- package/dist/wallet/next/useInAppWallet.js.map +1 -0
- package/dist/wallet/next/useInAppWallet.test.d.ts +2 -0
- package/dist/wallet/next/useInAppWallet.test.d.ts.map +1 -0
- package/dist/wallet/next/useInAppWallet.test.js +261 -0
- package/dist/wallet/next/useInAppWallet.test.js.map +1 -0
- package/package.json +9 -1
- package/src/e2e/README.md +58 -0
- package/src/tasks/README.md +1 -0
- package/src/test-utils/README.md +28 -0
- package/src/wallet/README.md +25 -2
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// @vitest-environment jsdom
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
5
|
+
afterEach(cleanup);
|
|
6
|
+
const walletMock = vi.hoisted(() => ({
|
|
7
|
+
hasWallet: vi.fn(),
|
|
8
|
+
getWalletInfo: vi.fn(),
|
|
9
|
+
createWallet: vi.fn(),
|
|
10
|
+
importWallet: vi.fn(),
|
|
11
|
+
unlockWallet: vi.fn(),
|
|
12
|
+
lockWallet: vi.fn(),
|
|
13
|
+
deleteWallet: vi.fn(),
|
|
14
|
+
getInAppWalletProvider: vi.fn(),
|
|
15
|
+
// Misma regla que el core (R-#251): clave de 8+ caracteres.
|
|
16
|
+
isValidPassword: (value) => value.trim().length >= 8,
|
|
17
|
+
setWalletDbName: vi.fn(),
|
|
18
|
+
setDestinationsPrefix: vi.fn(),
|
|
19
|
+
setRpName: vi.fn(),
|
|
20
|
+
}));
|
|
21
|
+
vi.mock('../index.js', () => walletMock);
|
|
22
|
+
import { InAppWalletSetup } from './components/InAppWalletSetup.js';
|
|
23
|
+
import { InAppWalletUnlock } from './components/InAppWalletUnlock.js';
|
|
24
|
+
const ADDRESS = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266';
|
|
25
|
+
const INFO = { address: ADDRESS, chain: 'celoSepolia', createdAt: 1 };
|
|
26
|
+
describe('InAppWalletSetup', () => {
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
vi.clearAllMocks();
|
|
29
|
+
window.indexedDB = {};
|
|
30
|
+
walletMock.hasWallet.mockResolvedValue(false);
|
|
31
|
+
});
|
|
32
|
+
it('renders the form with the recovery warning', async () => {
|
|
33
|
+
render(_jsx(InAppWalletSetup, {}));
|
|
34
|
+
await waitFor(() => expect(screen.getByTestId('in-app-wallet-setup')).toBeTruthy());
|
|
35
|
+
expect(screen.getByTestId('recovery-warning').textContent).toMatch(/recovery phrase/i);
|
|
36
|
+
});
|
|
37
|
+
it('offers to import while creating, with the guide link when the app provides it', async () => {
|
|
38
|
+
render(_jsx(InAppWalletSetup, { migrationHref: "/en/migration-in-app-wallet" }));
|
|
39
|
+
await waitFor(() => expect(screen.getByTestId('in-app-wallet-setup')).toBeTruthy());
|
|
40
|
+
expect(screen.getByTestId('import-hint').textContent).toMatch(/already have a wallet/i);
|
|
41
|
+
fireEvent.click(screen.getByTestId('switch-to-import'));
|
|
42
|
+
expect(screen.getByTestId('import-security').textContent).toMatch(/never leaves this device/i);
|
|
43
|
+
expect(screen.getByTestId('migration-guide').getAttribute('href')).toBe('/en/migration-in-app-wallet');
|
|
44
|
+
});
|
|
45
|
+
it('does not invent a guide link when the app does not provide one', async () => {
|
|
46
|
+
render(_jsx(InAppWalletSetup, {}));
|
|
47
|
+
await waitFor(() => expect(screen.getByTestId('in-app-wallet-setup')).toBeTruthy());
|
|
48
|
+
fireEvent.click(screen.getByTestId('switch-to-import'));
|
|
49
|
+
expect(screen.queryByTestId('migration-guide')).toBeNull();
|
|
50
|
+
});
|
|
51
|
+
it('creates a wallet and shows the recovery phrase', async () => {
|
|
52
|
+
walletMock.createWallet.mockResolvedValue({ walletInfo: INFO, mnemonic: 'alpha beta gamma' });
|
|
53
|
+
const onDone = vi.fn();
|
|
54
|
+
render(_jsx(InAppWalletSetup, { onDone: onDone }));
|
|
55
|
+
await waitFor(() => expect(screen.getByTestId('in-app-wallet-setup')).toBeTruthy());
|
|
56
|
+
fireEvent.change(screen.getByLabelText('Password (8+ characters)'), { target: { value: '12345678' } });
|
|
57
|
+
fireEvent.change(screen.getByLabelText('Repeat the password'), { target: { value: '12345678' } });
|
|
58
|
+
fireEvent.click(screen.getByTestId('submit'));
|
|
59
|
+
await waitFor(() => expect(screen.getByTestId('recovery-phrase').textContent).toMatch(/alpha beta gamma/));
|
|
60
|
+
expect(walletMock.createWallet).toHaveBeenCalledWith({ password: '12345678' });
|
|
61
|
+
expect(onDone).toHaveBeenCalledWith(ADDRESS);
|
|
62
|
+
});
|
|
63
|
+
it('rejects a password mismatch before calling the core', async () => {
|
|
64
|
+
render(_jsx(InAppWalletSetup, {}));
|
|
65
|
+
await waitFor(() => expect(screen.getByTestId('in-app-wallet-setup')).toBeTruthy());
|
|
66
|
+
fireEvent.change(screen.getByLabelText('Password (8+ characters)'), { target: { value: '12345678' } });
|
|
67
|
+
fireEvent.change(screen.getByLabelText('Repeat the password'), { target: { value: '87654321' } });
|
|
68
|
+
fireEvent.click(screen.getByTestId('submit'));
|
|
69
|
+
await waitFor(() => expect(screen.getByRole('alert').textContent).toMatch(/do not match/i));
|
|
70
|
+
expect(walletMock.createWallet).not.toHaveBeenCalled();
|
|
71
|
+
});
|
|
72
|
+
it('imports an existing mnemonic', async () => {
|
|
73
|
+
walletMock.importWallet.mockResolvedValue(INFO);
|
|
74
|
+
render(_jsx(InAppWalletSetup, {}));
|
|
75
|
+
await waitFor(() => expect(screen.getByTestId('in-app-wallet-setup')).toBeTruthy());
|
|
76
|
+
fireEvent.click(screen.getByTestId('mode-import'));
|
|
77
|
+
fireEvent.change(screen.getByLabelText('Recovery phrase'), {
|
|
78
|
+
target: { value: 'test test test test test test test test test test test junk' },
|
|
79
|
+
});
|
|
80
|
+
fireEvent.change(screen.getByLabelText('Password (8+ characters)'), { target: { value: '12345678' } });
|
|
81
|
+
fireEvent.change(screen.getByLabelText('Repeat the password'), { target: { value: '12345678' } });
|
|
82
|
+
fireEvent.click(screen.getByTestId('submit'));
|
|
83
|
+
await waitFor(() => expect(walletMock.importWallet).toHaveBeenCalledWith({
|
|
84
|
+
password: '12345678',
|
|
85
|
+
mnemonic: 'test test test test test test test test test test test junk',
|
|
86
|
+
privateKey: undefined,
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
it('translates the labels to Spanish', async () => {
|
|
90
|
+
render(_jsx(InAppWalletSetup, { lang: "es" }));
|
|
91
|
+
await waitFor(() => expect(screen.getByRole('heading', { name: 'Crear billetera en la aplicación' })).toBeTruthy());
|
|
92
|
+
});
|
|
93
|
+
it('accepts injected messages from the host', async () => {
|
|
94
|
+
render(_jsx(InAppWalletSetup, { messages: { createTitle: 'Abrir cartera', create: 'Crear', import: 'Cargar' } }));
|
|
95
|
+
await waitFor(() => expect(screen.getByRole('heading', { name: 'Abrir cartera' })).toBeTruthy());
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
describe('InAppWalletUnlock', () => {
|
|
99
|
+
beforeEach(() => {
|
|
100
|
+
vi.clearAllMocks();
|
|
101
|
+
window.indexedDB = {};
|
|
102
|
+
walletMock.hasWallet.mockResolvedValue(true);
|
|
103
|
+
walletMock.getWalletInfo.mockResolvedValue(INFO);
|
|
104
|
+
});
|
|
105
|
+
it('unlocks with the right password', async () => {
|
|
106
|
+
walletMock.unlockWallet.mockResolvedValue(INFO);
|
|
107
|
+
const onUnlocked = vi.fn();
|
|
108
|
+
render(_jsx(InAppWalletUnlock, { onUnlocked: onUnlocked }));
|
|
109
|
+
fireEvent.change(screen.getByLabelText('Password (8+ characters)'), { target: { value: '12345678' } });
|
|
110
|
+
fireEvent.click(screen.getByRole('button', { name: 'Unlock' }));
|
|
111
|
+
await waitFor(() => expect(onUnlocked).toHaveBeenCalledWith(ADDRESS));
|
|
112
|
+
expect(walletMock.unlockWallet).toHaveBeenCalledWith('12345678');
|
|
113
|
+
});
|
|
114
|
+
it('shows an error with the wrong password', async () => {
|
|
115
|
+
walletMock.unlockWallet.mockRejectedValue(new Error('Wrong password or corrupted wallet data'));
|
|
116
|
+
render(_jsx(InAppWalletUnlock, {}));
|
|
117
|
+
fireEvent.change(screen.getByLabelText('Password (8+ characters)'), { target: { value: '00000000' } });
|
|
118
|
+
fireEvent.click(screen.getByRole('button', { name: 'Unlock' }));
|
|
119
|
+
await waitFor(() => expect(screen.getByRole('alert').textContent).toMatch(/wrong password/i));
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=components.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.test.js","sourceRoot":"","sources":["../../../src/wallet/next/components.test.tsx"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEpF,SAAS,CAAC,OAAO,CAAC,CAAA;AAElB,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACnC,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE;IAClB,aAAa,EAAE,EAAE,CAAC,EAAE,EAAE;IACtB,YAAY,EAAE,EAAE,CAAC,EAAE,EAAE;IACrB,YAAY,EAAE,EAAE,CAAC,EAAE,EAAE;IACrB,YAAY,EAAE,EAAE,CAAC,EAAE,EAAE;IACrB,UAAU,EAAE,EAAE,CAAC,EAAE,EAAE;IACnB,YAAY,EAAE,EAAE,CAAC,EAAE,EAAE;IACrB,sBAAsB,EAAE,EAAE,CAAC,EAAE,EAAE;IAC/B,4DAA4D;IAC5D,eAAe,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,IAAI,CAA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EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;QACtG,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;QAC/D,MAAM,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC/F,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type Lang = 'en' | 'es';
|
|
2
|
+
declare const MESSAGES: {
|
|
3
|
+
readonly en: {
|
|
4
|
+
readonly createTitle: "Create an in-app wallet";
|
|
5
|
+
readonly importTitle: "Import an existing wallet";
|
|
6
|
+
readonly password: "Password (8+ characters)";
|
|
7
|
+
readonly passwordConfirm: "Repeat the password";
|
|
8
|
+
readonly passwordMismatch: "The passwords do not match";
|
|
9
|
+
readonly passwordTooShort: "The password must have at least 8 characters";
|
|
10
|
+
readonly create: "Create wallet";
|
|
11
|
+
readonly import: "Import wallet";
|
|
12
|
+
readonly mnemonic: "Recovery phrase";
|
|
13
|
+
readonly privateKey: "Private key (0x…)";
|
|
14
|
+
readonly warning: "Write down your recovery phrase on paper, in order, and keep that paper somewhere safe: whoever has those 12 words owns the funds of the wallet. Never share it and do not keep it as a screenshot or a digital note.";
|
|
15
|
+
readonly copy: "Copy";
|
|
16
|
+
readonly copied: "Copied";
|
|
17
|
+
readonly done: "Continue";
|
|
18
|
+
readonly unlockTitle: "Unlock your in-app wallet";
|
|
19
|
+
readonly unlock: "Unlock";
|
|
20
|
+
readonly wrongPassword: "Wrong password";
|
|
21
|
+
readonly useInAppWallet: "Use in-app wallet";
|
|
22
|
+
readonly alreadyHave: "Already have a wallet? Import your recovery phrase to keep your history.";
|
|
23
|
+
readonly importSecurity: "Your recovery phrase never leaves this device.";
|
|
24
|
+
readonly migrationGuide: "Step-by-step guide";
|
|
25
|
+
};
|
|
26
|
+
readonly es: {
|
|
27
|
+
readonly createTitle: "Crear billetera en la aplicación";
|
|
28
|
+
readonly importTitle: "Importar una billetera existente";
|
|
29
|
+
readonly password: "Clave (8+ caracteres)";
|
|
30
|
+
readonly passwordConfirm: "Repite la clave";
|
|
31
|
+
readonly passwordMismatch: "Las claves no coinciden";
|
|
32
|
+
readonly passwordTooShort: "La clave debe tener al menos 8 caracteres";
|
|
33
|
+
readonly create: "Crear billetera";
|
|
34
|
+
readonly import: "Importar billetera";
|
|
35
|
+
readonly mnemonic: "Frase de recuperación";
|
|
36
|
+
readonly privateKey: "Clave privada (0x…)";
|
|
37
|
+
readonly warning: "Escribe tu frase de recuperación en papel, en orden, y guarda ese papel en un lugar seguro: quien tenga esas 12 palabras tiene los fondos de la billetera. No la compartas ni la guardes como captura de pantalla o nota digital.";
|
|
38
|
+
readonly copy: "Copiar";
|
|
39
|
+
readonly copied: "Copiado";
|
|
40
|
+
readonly done: "Continuar";
|
|
41
|
+
readonly unlockTitle: "Desbloquea tu billetera de la aplicación";
|
|
42
|
+
readonly unlock: "Desbloquear";
|
|
43
|
+
readonly wrongPassword: "Clave incorrecta";
|
|
44
|
+
readonly useInAppWallet: "Usar billetera de la aplicación";
|
|
45
|
+
readonly alreadyHave: "¿Ya tienes billetera? Importa tu frase de recuperación para conservar tu historial.";
|
|
46
|
+
readonly importSecurity: "Tu frase de recuperación nunca sale de este dispositivo.";
|
|
47
|
+
readonly migrationGuide: "Guía paso a paso";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export type MessageKey = keyof (typeof MESSAGES)['en'];
|
|
51
|
+
/** Full set of texts (one per key). A host may override any subset. */
|
|
52
|
+
export type WalletReactMessages = Record<MessageKey, string>;
|
|
53
|
+
export declare function t(lang: Lang, key: MessageKey): string;
|
|
54
|
+
/** Built-in texts for a language (English keys as fallback). */
|
|
55
|
+
export declare function defaultMessages(lang: Lang): WalletReactMessages;
|
|
56
|
+
/**
|
|
57
|
+
* Texts for a language with the host's overrides on top. The components accept this
|
|
58
|
+
* as a `messages` prop so a consumer can inject its own wording without forking the
|
|
59
|
+
* package (`m/REQ/37`).
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveMessages(lang: Lang, override?: Partial<WalletReactMessages>): WalletReactMessages;
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../src/wallet/next/i18n.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAE9B,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CJ,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAA;AAEtD,uEAAuE;AACvE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;AAE5D,wBAAgB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,GAAG,MAAM,CAErD;AAED,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,mBAAmB,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,EACV,QAAQ,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACtC,mBAAmB,CAErB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const MESSAGES = {
|
|
2
|
+
en: {
|
|
3
|
+
createTitle: 'Create an in-app wallet',
|
|
4
|
+
importTitle: 'Import an existing wallet',
|
|
5
|
+
password: 'Password (8+ characters)',
|
|
6
|
+
passwordConfirm: 'Repeat the password',
|
|
7
|
+
passwordMismatch: 'The passwords do not match',
|
|
8
|
+
passwordTooShort: 'The password must have at least 8 characters',
|
|
9
|
+
create: 'Create wallet',
|
|
10
|
+
import: 'Import wallet',
|
|
11
|
+
mnemonic: 'Recovery phrase',
|
|
12
|
+
privateKey: 'Private key (0x…)',
|
|
13
|
+
warning: 'Write down your recovery phrase on paper, in order, and keep that paper somewhere safe: whoever has those 12 words owns the funds of the wallet. Never share it and do not keep it as a screenshot or a digital note.',
|
|
14
|
+
copy: 'Copy',
|
|
15
|
+
copied: 'Copied',
|
|
16
|
+
done: 'Continue',
|
|
17
|
+
unlockTitle: 'Unlock your in-app wallet',
|
|
18
|
+
unlock: 'Unlock',
|
|
19
|
+
wrongPassword: 'Wrong password',
|
|
20
|
+
useInAppWallet: 'Use in-app wallet',
|
|
21
|
+
alreadyHave: 'Already have a wallet? Import your recovery phrase to keep your history.',
|
|
22
|
+
importSecurity: 'Your recovery phrase never leaves this device.',
|
|
23
|
+
migrationGuide: 'Step-by-step guide',
|
|
24
|
+
},
|
|
25
|
+
es: {
|
|
26
|
+
createTitle: 'Crear billetera en la aplicación',
|
|
27
|
+
importTitle: 'Importar una billetera existente',
|
|
28
|
+
password: 'Clave (8+ caracteres)',
|
|
29
|
+
passwordConfirm: 'Repite la clave',
|
|
30
|
+
passwordMismatch: 'Las claves no coinciden',
|
|
31
|
+
passwordTooShort: 'La clave debe tener al menos 8 caracteres',
|
|
32
|
+
create: 'Crear billetera',
|
|
33
|
+
import: 'Importar billetera',
|
|
34
|
+
mnemonic: 'Frase de recuperación',
|
|
35
|
+
privateKey: 'Clave privada (0x…)',
|
|
36
|
+
warning: 'Escribe tu frase de recuperación en papel, en orden, y guarda ese papel en un lugar seguro: quien tenga esas 12 palabras tiene los fondos de la billetera. No la compartas ni la guardes como captura de pantalla o nota digital.',
|
|
37
|
+
copy: 'Copiar',
|
|
38
|
+
copied: 'Copiado',
|
|
39
|
+
done: 'Continuar',
|
|
40
|
+
unlockTitle: 'Desbloquea tu billetera de la aplicación',
|
|
41
|
+
unlock: 'Desbloquear',
|
|
42
|
+
wrongPassword: 'Clave incorrecta',
|
|
43
|
+
useInAppWallet: 'Usar billetera de la aplicación',
|
|
44
|
+
alreadyHave: '¿Ya tienes billetera? Importa tu frase de recuperación para conservar tu historial.',
|
|
45
|
+
importSecurity: 'Tu frase de recuperación nunca sale de este dispositivo.',
|
|
46
|
+
migrationGuide: 'Guía paso a paso',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
export function t(lang, key) {
|
|
50
|
+
return MESSAGES[lang]?.[key] ?? MESSAGES.en[key];
|
|
51
|
+
}
|
|
52
|
+
/** Built-in texts for a language (English keys as fallback). */
|
|
53
|
+
export function defaultMessages(lang) {
|
|
54
|
+
return { ...MESSAGES.en, ...MESSAGES[lang] };
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Texts for a language with the host's overrides on top. The components accept this
|
|
58
|
+
* as a `messages` prop so a consumer can inject its own wording without forking the
|
|
59
|
+
* package (`m/REQ/37`).
|
|
60
|
+
*/
|
|
61
|
+
export function resolveMessages(lang, override) {
|
|
62
|
+
return { ...defaultMessages(lang), ...override };
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../../src/wallet/next/i18n.ts"],"names":[],"mappings":"AAEA,MAAM,QAAQ,GAAG;IACf,EAAE,EAAE;QACF,WAAW,EAAE,yBAAyB;QACtC,WAAW,EAAE,2BAA2B;QACxC,QAAQ,EAAE,0BAA0B;QACpC,eAAe,EAAE,qBAAqB;QACtC,gBAAgB,EAAE,4BAA4B;QAC9C,gBAAgB,EAAE,8CAA8C;QAChE,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,eAAe;QACvB,QAAQ,EAAE,iBAAiB;QAC3B,UAAU,EAAE,mBAAmB;QAC/B,OAAO,EAAE,uNAAuN;QAChO,IAAI,EAAE,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AEvC,OAAO,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useInAppWallet, resetInAppWalletStoreForTests, INACTIVITY_LOCK_MS, type InAppWalletStatus, type InAppWalletLockReason, type UseInAppWalletResult, } from './useInAppWallet.js';
|
|
2
|
+
export { InAppWalletSetup, type InAppWalletSetupProps } from './components/InAppWalletSetup.js';
|
|
3
|
+
export { InAppWalletUnlock, type InAppWalletUnlockProps } from './components/InAppWalletUnlock.js';
|
|
4
|
+
export { t, defaultMessages, resolveMessages, type Lang, type MessageKey, type WalletReactMessages, } from './i18n.js';
|
|
5
|
+
export { configureInAppWallet, type InAppWalletNamespaces } from './namespaces.js';
|
|
6
|
+
export { isValidPassword } from '../index.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wallet/next/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,cAAc,EACd,6BAA6B,EAC7B,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC/F,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAClG,OAAO,EACL,CAAC,EACD,eAAe,EACf,eAAe,EACf,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,mBAAmB,GACzB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @pasosdejesus/m/wallet/next — React layer of the in-app wallet (`m/REQ/37`).
|
|
2
|
+
//
|
|
3
|
+
// Graduated from `learn.tg/packages/pdj-wallet-next`. Texts and storage namespaces are
|
|
4
|
+
// injected by the host; React is an optional peer, so importing the core barrel does
|
|
5
|
+
// not pull this in.
|
|
6
|
+
export { useInAppWallet, resetInAppWalletStoreForTests, INACTIVITY_LOCK_MS, } from './useInAppWallet.js';
|
|
7
|
+
export { InAppWalletSetup } from './components/InAppWalletSetup.js';
|
|
8
|
+
export { InAppWalletUnlock } from './components/InAppWalletUnlock.js';
|
|
9
|
+
export { t, defaultMessages, resolveMessages, } from './i18n.js';
|
|
10
|
+
export { configureInAppWallet } from './namespaces.js';
|
|
11
|
+
export { isValidPassword } from '../index.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wallet/next/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,EAAE;AACF,uFAAuF;AACvF,qFAAqF;AACrF,oBAAoB;AACpB,OAAO,EACL,cAAc,EACd,6BAA6B,EAC7B,kBAAkB,GAInB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAA8B,MAAM,kCAAkC,CAAA;AAC/F,OAAO,EAAE,iBAAiB,EAA+B,MAAM,mCAAmC,CAAA;AAClG,OAAO,EACL,CAAC,EACD,eAAe,EACf,eAAe,GAIhB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,oBAAoB,EAA8B,MAAM,iBAAiB,CAAA;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface InAppWalletNamespaces {
|
|
2
|
+
/** IndexedDB database name (core default: `pasosdejesus-m-wallet`). */
|
|
3
|
+
dbName?: string;
|
|
4
|
+
/** `localStorage` prefix for known destinations. */
|
|
5
|
+
destinationsPrefix?: string;
|
|
6
|
+
/** WebAuthn relying-party display name. */
|
|
7
|
+
rpName?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Applies the host's storage namespaces to the shared wallet core (`m/REQ/37`).
|
|
11
|
+
*
|
|
12
|
+
* A host that already has wallets **must** call this with its own values before the
|
|
13
|
+
* wallet is used, or existing records become unreadable (IndexedDB name, destination
|
|
14
|
+
* prefix and passkey RP name are the identity of the stored funds).
|
|
15
|
+
*/
|
|
16
|
+
export declare function configureInAppWallet(namespaces: InAppWalletNamespaces): void;
|
|
17
|
+
//# sourceMappingURL=namespaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespaces.d.ts","sourceRoot":"","sources":["../../../src/wallet/next/namespaces.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAqB;IACpC,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oDAAoD;IACpD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,qBAAqB,GAAG,IAAI,CAI5E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { setDestinationsPrefix, setRpName, setWalletDbName } from '../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Applies the host's storage namespaces to the shared wallet core (`m/REQ/37`).
|
|
4
|
+
*
|
|
5
|
+
* A host that already has wallets **must** call this with its own values before the
|
|
6
|
+
* wallet is used, or existing records become unreadable (IndexedDB name, destination
|
|
7
|
+
* prefix and passkey RP name are the identity of the stored funds).
|
|
8
|
+
*/
|
|
9
|
+
export function configureInAppWallet(namespaces) {
|
|
10
|
+
if (namespaces.dbName)
|
|
11
|
+
setWalletDbName(namespaces.dbName);
|
|
12
|
+
if (namespaces.destinationsPrefix)
|
|
13
|
+
setDestinationsPrefix(namespaces.destinationsPrefix);
|
|
14
|
+
if (namespaces.rpName)
|
|
15
|
+
setRpName(namespaces.rpName);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=namespaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespaces.js","sourceRoot":"","sources":["../../../src/wallet/next/namespaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAW/E;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAiC;IACpE,IAAI,UAAU,CAAC,MAAM;QAAE,eAAe,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;IACzD,IAAI,UAAU,CAAC,kBAAkB;QAAE,qBAAqB,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAA;IACvF,IAAI,UAAU,CAAC,MAAM;QAAE,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;AACrD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type Eip1193Provider, type ImportWalletOptions, type WalletInfo } from '../index.js';
|
|
2
|
+
export type InAppWalletStatus = 'loading' | 'no-wallet' | 'locked' | 'unlocked';
|
|
3
|
+
/**
|
|
4
|
+
* Why the wallet is locked. `user` is the header ✕ (which signs out), `idle` is
|
|
5
|
+
* the inactivity auto-lock (which must NOT sign the user out).
|
|
6
|
+
*/
|
|
7
|
+
export type InAppWalletLockReason = 'initial' | 'user' | 'idle' | 'deleted';
|
|
8
|
+
/**
|
|
9
|
+
* Auto-lock after this much inactivity, like OneKey and OKX Web3 (R-#246).
|
|
10
|
+
* Dropping the key means the next action asks for the gesture (or the password on
|
|
11
|
+
* devices without WebAuthn).
|
|
12
|
+
*
|
|
13
|
+
* One hour, not ten minutes: the operator's mobile test had to unlock again
|
|
14
|
+
* while donating on `/[lang]/gdcluster/ranking` less than ten minutes after
|
|
15
|
+
* unlocking, and OneKey waits about an hour after its own fingerprint prompt.
|
|
16
|
+
* The value only bounds how long the in-memory key survives a pause; moving
|
|
17
|
+
* funds is always gated by layer L1 (a fresh gesture), so a longer pause cannot
|
|
18
|
+
* make a transfer silent. An operator or the user changing the value is
|
|
19
|
+
* https://github.com/pasosdeJesus/learn.tg/issues/248.
|
|
20
|
+
*/
|
|
21
|
+
export declare const INACTIVITY_LOCK_MS: number;
|
|
22
|
+
export interface UseInAppWalletResult {
|
|
23
|
+
status: InAppWalletStatus;
|
|
24
|
+
walletInfo: WalletInfo | null;
|
|
25
|
+
error: string | null;
|
|
26
|
+
/** The device can verify the user (Face ID / fingerprint): layers L1/L2 of R-#246. */
|
|
27
|
+
biometricAvailable: boolean;
|
|
28
|
+
/** A key sealed with the PRF secret is stored: one gesture unlocks it. */
|
|
29
|
+
biometricEnabled: boolean;
|
|
30
|
+
/** Why the wallet got locked: the ✕ (`user`) signs out, `idle` does not. */
|
|
31
|
+
lockReason: InAppWalletLockReason;
|
|
32
|
+
create: (password: string) => Promise<{
|
|
33
|
+
walletInfo: WalletInfo;
|
|
34
|
+
mnemonic: string;
|
|
35
|
+
}>;
|
|
36
|
+
importExisting: (options: ImportWalletOptions) => Promise<WalletInfo>;
|
|
37
|
+
unlock: (password: string) => Promise<WalletInfo>;
|
|
38
|
+
/** Unlocks with one user-verified WebAuthn gesture (needs `biometricEnabled`). */
|
|
39
|
+
unlockWithBiometric: () => Promise<WalletInfo>;
|
|
40
|
+
/** Registers a passkey and seals the key with its PRF secret. Needs the password. */
|
|
41
|
+
enableBiometric: (password: string) => Promise<void>;
|
|
42
|
+
disableBiometric: () => Promise<void>;
|
|
43
|
+
lock: () => Promise<void>;
|
|
44
|
+
remove: () => Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* The EIP-1193 provider of the unlocked wallet. `rpcUrl` is required for
|
|
47
|
+
* anything that talks to the chain: reads (`eth_call`, `eth_getBalance`…) and
|
|
48
|
+
* broadcasts are forwarded to it.
|
|
49
|
+
*/
|
|
50
|
+
getProvider: (rpcUrl?: string) => Eip1193Provider | null;
|
|
51
|
+
}
|
|
52
|
+
/** Test-only: forgets the shared state and the "already initialized" flag. */
|
|
53
|
+
export declare function resetInAppWalletStoreForTests(): void;
|
|
54
|
+
export declare function useInAppWallet(): UseInAppWalletResult;
|
|
55
|
+
//# sourceMappingURL=useInAppWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInAppWallet.d.ts","sourceRoot":"","sources":["../../../src/wallet/next/useInAppWallet.ts"],"names":[],"mappings":"AAGA,OAAO,EAeL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAChB,MAAM,aAAa,CAAA;AAEpB,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAA;AAE/E;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAE3E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,QAAiB,CAAA;AAYhD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,iBAAiB,CAAA;IACzB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAA;IAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,sFAAsF;IACtF,kBAAkB,EAAE,OAAO,CAAA;IAC3B,0EAA0E;IAC1E,gBAAgB,EAAE,OAAO,CAAA;IACzB,4EAA4E;IAC5E,UAAU,EAAE,qBAAqB,CAAA;IACjC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACnF,cAAc,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;IACrE,MAAM,EAAE,CAAC,QAAQ,EAAE,M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