@metamask/connect-multichain 0.3.2 → 0.5.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/CHANGELOG.md +55 -15
- package/README.md +1 -1
- package/dist/browser/es/connect-multichain.d.mts +26 -12
- package/dist/browser/es/connect-multichain.mjs +846 -598
- package/dist/browser/es/connect-multichain.mjs.map +1 -1
- package/dist/browser/es/metafile-esm.json +1 -1
- package/dist/browser/iife/connect-multichain.d.ts +26 -12
- package/dist/browser/iife/connect-multichain.js +4793 -2291
- package/dist/browser/iife/connect-multichain.js.map +1 -1
- package/dist/browser/iife/metafile-iife.json +1 -1
- package/dist/browser/umd/connect-multichain.d.ts +26 -12
- package/dist/browser/umd/connect-multichain.js +846 -598
- package/dist/browser/umd/connect-multichain.js.map +1 -1
- package/dist/browser/umd/metafile-cjs.json +1 -1
- package/dist/node/cjs/connect-multichain.d.ts +26 -12
- package/dist/node/cjs/connect-multichain.js +846 -609
- package/dist/node/cjs/connect-multichain.js.map +1 -1
- package/dist/node/cjs/metafile-cjs.json +1 -1
- package/dist/node/es/connect-multichain.d.mts +26 -12
- package/dist/node/es/connect-multichain.mjs +844 -607
- package/dist/node/es/connect-multichain.mjs.map +1 -1
- package/dist/node/es/metafile-esm.json +1 -1
- package/dist/react-native/es/connect-multichain.d.mts +26 -12
- package/dist/react-native/es/connect-multichain.mjs +827 -592
- package/dist/react-native/es/connect-multichain.mjs.map +1 -1
- package/dist/react-native/es/metafile-esm.json +1 -1
- package/dist/src/domain/multichain/index.d.ts +4 -4
- package/dist/src/domain/multichain/index.d.ts.map +1 -1
- package/dist/src/domain/multichain/index.js.map +1 -1
- package/dist/src/domain/multichain/types.d.ts +4 -6
- package/dist/src/domain/multichain/types.d.ts.map +1 -1
- package/dist/src/domain/ui/types.d.ts +7 -0
- package/dist/src/domain/ui/types.d.ts.map +1 -1
- package/dist/src/domain/ui/types.js.map +1 -1
- package/dist/src/index.browser.d.ts +1 -1
- package/dist/src/index.browser.d.ts.map +1 -1
- package/dist/src/index.browser.js +1 -1
- package/dist/src/index.browser.js.map +1 -1
- package/dist/src/index.native.d.ts +1 -1
- package/dist/src/index.native.d.ts.map +1 -1
- package/dist/src/index.native.js +2 -2
- package/dist/src/index.native.js.map +1 -1
- package/dist/src/index.node.d.ts +1 -1
- package/dist/src/index.node.d.ts.map +1 -1
- package/dist/src/index.node.js +1 -1
- package/dist/src/index.node.js.map +1 -1
- package/dist/src/multichain/index.d.ts +8 -27
- package/dist/src/multichain/index.d.ts.map +1 -1
- package/dist/src/multichain/index.js +480 -427
- package/dist/src/multichain/index.js.map +1 -1
- package/dist/src/multichain/rpc/requestRouter.d.ts.map +1 -1
- package/dist/src/multichain/rpc/requestRouter.js +8 -15
- package/dist/src/multichain/rpc/requestRouter.js.map +1 -1
- package/dist/src/multichain/transports/default/index.d.ts +2 -1
- package/dist/src/multichain/transports/default/index.d.ts.map +1 -1
- package/dist/src/multichain/transports/default/index.js +1 -0
- package/dist/src/multichain/transports/default/index.js.map +1 -1
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.d.ts +21 -0
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.d.ts.map +1 -0
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.js +159 -0
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.js.map +1 -0
- package/dist/src/multichain/transports/mwp/index.d.ts +4 -1
- package/dist/src/multichain/transports/mwp/index.d.ts.map +1 -1
- package/dist/src/multichain/transports/mwp/index.js +76 -6
- package/dist/src/multichain/transports/mwp/index.js.map +1 -1
- package/dist/src/ui/ModalFactory.d.ts +54 -0
- package/dist/src/ui/ModalFactory.d.ts.map +1 -0
- package/dist/src/ui/ModalFactory.js +171 -0
- package/dist/src/ui/ModalFactory.js.map +1 -0
- package/dist/src/ui/index.d.ts +11 -39
- package/dist/src/ui/index.d.ts.map +1 -1
- package/dist/src/ui/index.js +20 -179
- package/dist/src/ui/index.js.map +1 -1
- package/dist/src/ui/index.native.d.ts +13 -0
- package/dist/src/ui/index.native.d.ts.map +1 -0
- package/dist/src/ui/index.native.js +24 -0
- package/dist/src/ui/index.native.js.map +1 -0
- package/dist/src/ui/modals/base/AbstractInstallModal.d.ts.map +1 -1
- package/dist/src/ui/modals/base/AbstractInstallModal.js +0 -4
- package/dist/src/ui/modals/base/AbstractInstallModal.js.map +1 -1
- package/dist/src/ui/modals/node/install.js +2 -2
- package/dist/src/ui/modals/node/install.js.map +1 -1
- package/dist/types/connect-multichain.d.ts +26 -12
- package/package.json +10 -8
- package/dist/src/ui/qr.d.ts +0 -3
- package/dist/src/ui/qr.d.ts.map +0 -1
- package/dist/src/ui/qr.js +0 -32
- package/dist/src/ui/qr.js.map +0 -1
package/dist/src/ui/index.js
CHANGED
|
@@ -7,194 +7,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
/* eslint-disable @typescript-eslint/no-shadow */
|
|
11
|
-
/* eslint-disable @typescript-eslint/no-misused-promises */
|
|
12
|
-
/* eslint-disable no-restricted-globals */
|
|
13
|
-
/* eslint-disable jsdoc/require-returns */
|
|
14
|
-
/* eslint-disable @typescript-eslint/parameter-properties */
|
|
15
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
16
|
-
/* eslint-disable no-restricted-syntax */
|
|
17
|
-
/* eslint-disable promise/no-return-wrap */
|
|
18
|
-
/* eslint-disable require-atomic-updates */
|
|
19
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
20
|
-
import MetaMaskOnboarding from '@metamask/onboarding';
|
|
21
|
-
import { METAMASK_CONNECT_BASE_URL, METAMASK_DEEPLINK_BASE } from '../config';
|
|
22
|
-
import { getPlatformType, getVersion, PlatformType, } from '../domain';
|
|
23
|
-
import { preloadQR } from './qr';
|
|
24
|
-
import { compressString } from '../multichain/utils';
|
|
25
|
-
let __instance;
|
|
26
10
|
/**
|
|
27
|
-
*
|
|
11
|
+
* Browser/Web UI module entry point
|
|
12
|
+
*/
|
|
13
|
+
import { BaseModalFactory } from './ModalFactory';
|
|
14
|
+
/**
|
|
15
|
+
* Web-specific preload that loads Stencil custom elements
|
|
28
16
|
*/
|
|
29
17
|
export function preload() {
|
|
30
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
/**
|
|
32
|
-
* We use a literal specifier for ESM/Vite builds (so Rollup can resolve it), and guard non-ESM builds (UMD/IIFE/Node)
|
|
33
|
-
* by computing the specifier at runtime or marking it external so the bundler doesn’t try to split. This avoids the
|
|
34
|
-
* IIFE failure while keeping Vite happy.
|
|
35
|
-
*/
|
|
36
|
-
if (typeof __ESM_BUILD__ !== 'undefined' && __ESM_BUILD__) {
|
|
37
|
-
__instance !== null && __instance !== void 0 ? __instance : (__instance = yield import('@metamask/multichain-ui/dist/loader/index.js')
|
|
38
|
-
.then((loader) => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
if (typeof (loader === null || loader === void 0 ? void 0 : loader.defineCustomElements) === 'function') {
|
|
40
|
-
loader.defineCustomElements();
|
|
41
|
-
}
|
|
42
|
-
return Promise.resolve(loader);
|
|
43
|
-
}))
|
|
44
|
-
.catch((error) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
console.error(`Gracefully Failed to load modal customElements:`, error);
|
|
46
|
-
return Promise.resolve(undefined);
|
|
47
|
-
})));
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
// Avoid bundler static analysis in non-ESM builds, to avoid IIFE build failure
|
|
51
|
-
const dynamicImport = (0, eval)('import');
|
|
52
|
-
__instance !== null && __instance !== void 0 ? __instance : (__instance = yield dynamicImport('@metamask/multichain-ui/dist/loader/index.js')
|
|
53
|
-
.then((loader) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
if (typeof (loader === null || loader === void 0 ? void 0 : loader.defineCustomElements) === 'function') {
|
|
55
|
-
loader.defineCustomElements();
|
|
56
|
-
}
|
|
57
|
-
return Promise.resolve(loader);
|
|
58
|
-
}))
|
|
59
|
-
.catch((error) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
console.error(`Gracefully Failed to load modal customElements:`, error);
|
|
61
|
-
return Promise.resolve(undefined);
|
|
62
|
-
})));
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
export class ModalFactory {
|
|
67
|
-
/**
|
|
68
|
-
* Creates a new modal factory instance.
|
|
69
|
-
*
|
|
70
|
-
* @param options - The modals configuration object
|
|
71
|
-
*/
|
|
72
|
-
constructor(options) {
|
|
73
|
-
this.options = options;
|
|
74
|
-
this.platform = getPlatformType();
|
|
75
|
-
this.validateModals();
|
|
76
|
-
}
|
|
77
|
-
validateModals() {
|
|
78
|
-
const requiredModals = ['InstallModal', 'OTPCodeModal'];
|
|
79
|
-
const missingModals = requiredModals.filter((modal) => !this.options[modal]);
|
|
80
|
-
if (missingModals.length > 0) {
|
|
81
|
-
throw new Error(`Missing required modals: ${missingModals.join(', ')}`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
unload(error) {
|
|
85
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
var _a, _b;
|
|
87
|
-
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
88
|
-
yield ((_b = this.successCallback) === null || _b === void 0 ? void 0 : _b.call(this, error));
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Determines if the current platform is a mobile native environment.
|
|
93
|
-
* Currently only includes React Native.
|
|
94
|
-
*/
|
|
95
|
-
get isMobile() {
|
|
96
|
-
return this.platform === PlatformType.ReactNative;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Determines if the current platform is a Node.js environment.
|
|
100
|
-
* Used for server-side or non-browser environments.
|
|
101
|
-
*/
|
|
102
|
-
get isNode() {
|
|
103
|
-
return this.platform === PlatformType.NonBrowser;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Determines if the current platform is a web environment.
|
|
107
|
-
* Includes desktop web, MetaMask mobile webview, and mobile web.
|
|
108
|
-
*/
|
|
109
|
-
get isWeb() {
|
|
110
|
-
return (this.platform === PlatformType.DesktopWeb ||
|
|
111
|
-
this.platform === PlatformType.MetaMaskMobileWebview ||
|
|
112
|
-
this.platform === PlatformType.MobileWeb);
|
|
113
|
-
}
|
|
114
|
-
getContainer() {
|
|
115
|
-
return typeof document === 'undefined'
|
|
116
|
-
? undefined
|
|
117
|
-
: document.createElement('div');
|
|
118
|
-
}
|
|
119
|
-
getMountedContainer() {
|
|
120
19
|
if (typeof document === 'undefined') {
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
const container = this.getContainer();
|
|
124
|
-
if (container) {
|
|
125
|
-
document.body.appendChild(container);
|
|
20
|
+
return;
|
|
126
21
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (!connectionRequest) {
|
|
131
|
-
throw new Error('createConnectionDeeplink can only be called with a connection request');
|
|
22
|
+
try {
|
|
23
|
+
const { defineCustomElements } = yield import('@metamask/multichain-ui/loader');
|
|
24
|
+
yield defineCustomElements();
|
|
132
25
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const urlEncoded = encodeURIComponent(compressed);
|
|
136
|
-
return `${METAMASK_DEEPLINK_BASE}/mwp?p=${urlEncoded}&c=1`;
|
|
137
|
-
}
|
|
138
|
-
createConnectionUniversalLink(connectionRequest) {
|
|
139
|
-
if (!connectionRequest) {
|
|
140
|
-
return `${METAMASK_CONNECT_BASE_URL}`;
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error('Failed to load customElements:', error);
|
|
141
28
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
onStartDesktopOnboarding() {
|
|
153
|
-
new MetaMaskOnboarding().startOnboarding();
|
|
154
|
-
}
|
|
155
|
-
renderInstallModal(showInstallModal, createConnectionRequest, successCallback) {
|
|
156
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
var _a;
|
|
158
|
-
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
159
|
-
yield Promise.all([preload(), preloadQR()]);
|
|
160
|
-
this.successCallback = successCallback;
|
|
161
|
-
const parentElement = this.getMountedContainer();
|
|
162
|
-
const connectionRequest = yield createConnectionRequest();
|
|
163
|
-
const qrCodeLink = this.createConnectionDeeplink(connectionRequest);
|
|
164
|
-
const modal = new this.options.InstallModal({
|
|
165
|
-
expiresIn: (connectionRequest.sessionRequest.expiresAt - Date.now()) / 1000,
|
|
166
|
-
connectionRequest,
|
|
167
|
-
parentElement,
|
|
168
|
-
showInstallModal,
|
|
169
|
-
link: qrCodeLink,
|
|
170
|
-
sdkVersion: getVersion(),
|
|
171
|
-
generateQRCode: (request) => __awaiter(this, void 0, void 0, function* () { return this.createConnectionDeeplink(request); }),
|
|
172
|
-
onClose: this.onCloseModal.bind(this),
|
|
173
|
-
startDesktopOnboarding: this.onStartDesktopOnboarding.bind(this),
|
|
174
|
-
createConnectionRequest,
|
|
175
|
-
});
|
|
176
|
-
this.modal = modal;
|
|
177
|
-
modal.mount();
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
renderOTPCodeModal(createOTPCode, successCallback, updateOTPCode) {
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* ModalFactory for browser/web environments.
|
|
33
|
+
* Loads Stencil web components via dynamic import.
|
|
34
|
+
*/
|
|
35
|
+
export class ModalFactory extends BaseModalFactory {
|
|
36
|
+
preload() {
|
|
181
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
-
|
|
183
|
-
(_a = this.modal) === null || _a === void 0 ? void 0 : _a.unmount();
|
|
184
|
-
yield Promise.all([preload(), preloadQR()]);
|
|
185
|
-
this.successCallback = successCallback;
|
|
186
|
-
const container = this.getMountedContainer();
|
|
187
|
-
const otpCode = yield createOTPCode();
|
|
188
|
-
const modal = new this.options.OTPCodeModal({
|
|
189
|
-
parentElement: container,
|
|
190
|
-
sdkVersion: getVersion(),
|
|
191
|
-
otpCode,
|
|
192
|
-
onClose: this.onCloseModal.bind(this),
|
|
193
|
-
createOTPCode,
|
|
194
|
-
updateOTPCode: (otpCode) => updateOTPCode(otpCode, modal),
|
|
195
|
-
});
|
|
196
|
-
this.modal = modal;
|
|
197
|
-
modal.mount();
|
|
38
|
+
return preload();
|
|
198
39
|
});
|
|
199
40
|
}
|
|
200
41
|
}
|
package/dist/src/ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;GAEG;AACH,MAAM,UAAgB,OAAO;;QAC3B,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;YACpC,OAAO;QACT,CAAC;QACD,IAAI,CAAC;YACH,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,MAAM,CAC3C,gCAAgC,CACjC,CAAC;YACF,MAAM,oBAAoB,EAAE,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,OAAO,YAEX,SAAQ,gBAAmB;IACX,OAAO;;YACrB,OAAO,OAAO,EAAE,CAAC;QACnB,CAAC;KAAA;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native UI module entry point
|
|
3
|
+
*/
|
|
4
|
+
import { BaseModalFactory } from './ModalFactory';
|
|
5
|
+
import type { FactoryModals } from './modals/types';
|
|
6
|
+
/**
|
|
7
|
+
* ModalFactory for React Native environments.
|
|
8
|
+
* No-op preload since Stencil web components are not used.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ModalFactory<T extends FactoryModals = FactoryModals> extends BaseModalFactory<T> {
|
|
11
|
+
protected preload(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/ui/index.native.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;GAGG;AACH,qBAAa,YAAY,CACvB,CAAC,SAAS,aAAa,GAAG,aAAa,CACvC,SAAQ,gBAAgB,CAAC,CAAC,CAAC;cAEX,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CACzC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* React Native UI module entry point
|
|
12
|
+
*/
|
|
13
|
+
import { BaseModalFactory } from './ModalFactory';
|
|
14
|
+
/**
|
|
15
|
+
* ModalFactory for React Native environments.
|
|
16
|
+
* No-op preload since Stencil web components are not used.
|
|
17
|
+
*/
|
|
18
|
+
export class ModalFactory extends BaseModalFactory {
|
|
19
|
+
// No-op for React Native - web components are not applicable
|
|
20
|
+
preload() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../../../src/ui/index.native.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;;GAGG;AACH,MAAM,OAAO,YAEX,SAAQ,gBAAmB;IAC3B,6DAA6D;IAC7C,OAAO;8DAAmB,CAAC;KAAA;CAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractInstallModal.d.ts","sourceRoot":"","sources":["../../../../../src/ui/modals/base/AbstractInstallModal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,kBAAkB,EACvB,KAAK,EACL,KAAK,MAAM,EACZ,MAAM,iBAAiB,CAAC;AAKzB,8BAAsB,oBAAqB,SAAQ,KAAK,CACtD,kBAAkB,EAClB,MAAM,CACP;IACC,SAAS,CAAC,QAAQ,CAAC,EAAE,yBAAyB,GAAG,SAAS,CAAC;IAC3D,OAAO,CAAC,kBAAkB,CAA+B;IACzD,OAAO,CAAC,mBAAmB,CAAc;IAEzC,QAAQ,CAAC,YAAY,CACnB,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,iBAAiB,GACnC,IAAI;IAEP,IAAI,IAAI,IAIO,MAAM,CAFpB;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,EAEpB;IAED,IAAI,iBAAiB,IAIoB,iBAAiB,CAFzD;IAED,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,iBAAiB,EAEzD;IAED,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM;IAOjC,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM;IAM3C,SAAS,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,iBAAiB;
|
|
1
|
+
{"version":3,"file":"AbstractInstallModal.d.ts","sourceRoot":"","sources":["../../../../../src/ui/modals/base/AbstractInstallModal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,kBAAkB,EACvB,KAAK,EACL,KAAK,MAAM,EACZ,MAAM,iBAAiB,CAAC;AAKzB,8BAAsB,oBAAqB,SAAQ,KAAK,CACtD,kBAAkB,EAClB,MAAM,CACP;IACC,SAAS,CAAC,QAAQ,CAAC,EAAE,yBAAyB,GAAG,SAAS,CAAC;IAC3D,OAAO,CAAC,kBAAkB,CAA+B;IACzD,OAAO,CAAC,mBAAmB,CAAc;IAEzC,QAAQ,CAAC,YAAY,CACnB,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,iBAAiB,GACnC,IAAI;IAEP,IAAI,IAAI,IAIO,MAAM,CAFpB;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,EAEpB;IAED,IAAI,iBAAiB,IAIoB,iBAAiB,CAFzD;IAED,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,iBAAiB,EAEzD;IAED,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM;IAOjC,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM;IAM3C,SAAS,CAAC,oBAAoB,CAAC,iBAAiB,EAAE,iBAAiB;IAqDnE,SAAS,CAAC,mBAAmB;CAS9B"}
|
|
@@ -73,10 +73,6 @@ export class AbstractInstallModal extends Modal {
|
|
|
73
73
|
logger(`[UI: InstallModal-nodejs()] ❌ Error generating new QR code: ${error}`);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
else {
|
|
77
|
-
const generateQRCode = yield this.options.generateQRCode(currentConnectionRequest);
|
|
78
|
-
this.renderQRCode(generateQRCode, currentConnectionRequest);
|
|
79
|
-
}
|
|
80
76
|
}), 1000);
|
|
81
77
|
}
|
|
82
78
|
stopExpirationCheck() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractInstallModal.js","sourceRoot":"","sources":["../../../../../src/ui/modals/base/AbstractInstallModal.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAEL,YAAY,EAEZ,KAAK,GAEN,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElE,MAAM,MAAM,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAC;AAE/C,MAAM,OAAgB,oBAAqB,SAAQ,KAGlD;IAHD;;QAKU,uBAAkB,GAA0B,IAAI,CAAC;QACjD,wBAAmB,GAAW,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"AbstractInstallModal.js","sourceRoot":"","sources":["../../../../../src/ui/modals/base/AbstractInstallModal.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
2
2
|
/* eslint-disable no-restricted-syntax */
|
|
3
3
|
import { createLogger, } from '../../../domain';
|
|
4
|
-
import
|
|
4
|
+
import encodeQR from '@paulmillr/qr';
|
|
5
5
|
import { AbstractInstallModal } from '../base/AbstractInstallModal';
|
|
6
6
|
import { formatRemainingTime, shouldLogCountdown } from '../base/utils';
|
|
7
7
|
const logger = createLogger('metamask-sdk:ui');
|
|
@@ -9,7 +9,7 @@ export class InstallModal extends AbstractInstallModal {
|
|
|
9
9
|
displayQRWithCountdown(qrCodeLink, expiresInMs) {
|
|
10
10
|
const isExpired = expiresInMs <= 0;
|
|
11
11
|
const formattedTime = formatRemainingTime(expiresInMs);
|
|
12
|
-
const qrCode =
|
|
12
|
+
const qrCode = encodeQR(qrCodeLink, 'ascii');
|
|
13
13
|
// Clear console and display QR code with live countdown
|
|
14
14
|
console.clear();
|
|
15
15
|
console.log(qrCode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../../../src/ui/modals/node/install.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,yCAAyC;AACzC,OAAO,EAEL,YAAY,GAEb,MAAM,iBAAiB,CAAC;AACzB,OAAO,
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../../../src/ui/modals/node/install.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,yCAAyC;AACzC,OAAO,EAEL,YAAY,GAEb,MAAM,iBAAiB,CAAC;AACzB,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAExE,MAAM,MAAM,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAC;AAE/C,MAAM,OAAO,YAAa,SAAQ,oBAAoB;IAC5C,sBAAsB,CAAC,UAAkB,EAAE,WAAmB;QACpE,MAAM,SAAS,GAAG,WAAW,IAAI,CAAC,CAAC;QACnC,MAAM,aAAa,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAE7C,wDAAwD;QACxD,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEpB,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,eAAe,aAAa,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,YAAY,CAAC,IAAY,EAAE,iBAAoC;QAC7D,MAAM,EAAE,cAAc,EAAE,GAAG,iBAAiB,CAAC;QAC7C,MAAM,SAAS,GAAG,cAAc,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACxD,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;QACtD,MAAM,SAAS,GAAG,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;QACvD,MAAM,aAAa,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QAE7C,IAAI,CAAC,sBAAsB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAE7C,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,CACJ,mDAAmD,aAAa,KAAK,SAAS,KAAK,CACpF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC;QACzC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO;QACL,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import debug from 'debug';
|
|
2
|
-
import { SessionData, Transport, TransportRequest, TransportResponse, MultichainApiClient } from '@metamask/multichain-api-client';
|
|
2
|
+
import { SessionData, Transport, SessionProperties, TransportRequest, TransportResponse, MultichainApiClient } from '@metamask/multichain-api-client';
|
|
3
3
|
export { SessionData } from '@metamask/multichain-api-client';
|
|
4
4
|
import { CaipAccountId, Json } from '@metamask/utils';
|
|
5
5
|
import { SessionRequest, Session } from '@metamask/mobile-wallet-protocol-core';
|
|
@@ -296,17 +296,26 @@ type FactoryModals = {
|
|
|
296
296
|
OTPCodeModal: new (options: OTPCodeWidgetProps) => AbstractOTPCodeModal;
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
-
|
|
299
|
+
/**
|
|
300
|
+
* Base ModalFactory class that accepts a preload function.
|
|
301
|
+
* Platform-specific implementations should extend this class.
|
|
302
|
+
*/
|
|
303
|
+
declare abstract class BaseModalFactory<T extends FactoryModals = FactoryModals> {
|
|
300
304
|
protected readonly options: T;
|
|
301
305
|
modal: Modal<any>;
|
|
302
306
|
private readonly platform;
|
|
303
307
|
private successCallback;
|
|
308
|
+
private displayUriCallback?;
|
|
304
309
|
/**
|
|
305
310
|
* Creates a new modal factory instance.
|
|
306
311
|
*
|
|
307
312
|
* @param options - The modals configuration object
|
|
308
313
|
*/
|
|
309
314
|
constructor(options: T);
|
|
315
|
+
/**
|
|
316
|
+
* Platform-specific preload function to be implemented by subclasses.
|
|
317
|
+
*/
|
|
318
|
+
protected abstract preload(): Promise<void>;
|
|
310
319
|
private validateModals;
|
|
311
320
|
unload(error?: Error): Promise<void>;
|
|
312
321
|
/**
|
|
@@ -330,7 +339,7 @@ declare class ModalFactory<T extends FactoryModals = FactoryModals> {
|
|
|
330
339
|
createConnectionUniversalLink(connectionRequest?: ConnectionRequest): string;
|
|
331
340
|
private onCloseModal;
|
|
332
341
|
private onStartDesktopOnboarding;
|
|
333
|
-
renderInstallModal(showInstallModal: boolean, createConnectionRequest: () => Promise<ConnectionRequest>, successCallback: (error?: Error) => Promise<void
|
|
342
|
+
renderInstallModal(showInstallModal: boolean, createConnectionRequest: () => Promise<ConnectionRequest>, successCallback: (error?: Error) => Promise<void>, onDisplayUri?: (uri: string) => void): Promise<void>;
|
|
334
343
|
renderOTPCodeModal(createOTPCode: () => Promise<OTPCode>, successCallback: (error?: Error) => Promise<void>, updateOTPCode: (otpCode: OTPCode, modal: AbstractOTPCodeModal) => void): Promise<void>;
|
|
335
344
|
}
|
|
336
345
|
|
|
@@ -393,16 +402,13 @@ type MultichainOptions = {
|
|
|
393
402
|
};
|
|
394
403
|
/** Analytics configuration */
|
|
395
404
|
analytics?: {
|
|
396
|
-
enabled: false;
|
|
397
|
-
} | {
|
|
398
|
-
enabled: true;
|
|
399
405
|
integrationType: string;
|
|
400
406
|
};
|
|
401
407
|
/** Storage client for persisting SDK data */
|
|
402
408
|
storage: StoreClient;
|
|
403
409
|
/** UI configuration options */
|
|
404
410
|
ui: {
|
|
405
|
-
factory:
|
|
411
|
+
factory: BaseModalFactory;
|
|
406
412
|
headless?: boolean;
|
|
407
413
|
preferExtension?: boolean;
|
|
408
414
|
showInstallModal?: boolean;
|
|
@@ -439,6 +445,7 @@ type ExtendedTransport = Omit<Transport, 'connect'> & {
|
|
|
439
445
|
connect: (props?: {
|
|
440
446
|
scopes: Scope[];
|
|
441
447
|
caipAccountIds: CaipAccountId[];
|
|
448
|
+
sessionProperties?: SessionProperties;
|
|
442
449
|
forceRequest?: boolean;
|
|
443
450
|
}) => Promise<void>;
|
|
444
451
|
sendEip1193Message: <TRequest extends TransportRequest, TResponse extends TransportResponse>(request: TRequest, options?: {
|
|
@@ -453,7 +460,7 @@ declare const SDK_HANDLED_METHODS: Set<string>;
|
|
|
453
460
|
|
|
454
461
|
declare function getInfuraRpcUrls(infuraAPIKey: string): RpcUrlsMap;
|
|
455
462
|
|
|
456
|
-
type
|
|
463
|
+
type ConnectionStatus = 'pending' | 'loaded' | 'disconnected' | 'connected' | 'connecting';
|
|
457
464
|
declare enum TransportType {
|
|
458
465
|
Browser = "browser",
|
|
459
466
|
MWP = "mwp",
|
|
@@ -468,7 +475,7 @@ declare enum TransportType {
|
|
|
468
475
|
declare abstract class MultichainCore extends EventEmitter<SDKEvents> {
|
|
469
476
|
protected readonly options: MultichainOptions;
|
|
470
477
|
abstract storage: StoreClient;
|
|
471
|
-
abstract
|
|
478
|
+
abstract status: ConnectionStatus;
|
|
472
479
|
abstract provider: MultichainApiClient<RPCAPI>;
|
|
473
480
|
abstract transport: ExtendedTransport;
|
|
474
481
|
abstract transportType: TransportType;
|
|
@@ -477,7 +484,7 @@ declare abstract class MultichainCore extends EventEmitter<SDKEvents> {
|
|
|
477
484
|
*
|
|
478
485
|
* @returns Promise that resolves to the session data
|
|
479
486
|
*/
|
|
480
|
-
abstract connect(scopes: Scope[], caipAccountIds: CaipAccountId[], forceRequest?: boolean): Promise<void>;
|
|
487
|
+
abstract connect(scopes: Scope[], caipAccountIds: CaipAccountId[], sessionProperties?: SessionProperties, forceRequest?: boolean): Promise<void>;
|
|
481
488
|
/**
|
|
482
489
|
* Disconnects from the multichain provider.
|
|
483
490
|
*
|
|
@@ -581,6 +588,13 @@ type InstallWidgetProps = Components.MmInstallModal & {
|
|
|
581
588
|
startDesktopOnboarding: () => void;
|
|
582
589
|
createConnectionRequest: () => Promise<ConnectionRequest>;
|
|
583
590
|
generateQRCode: (connectionRequest: ConnectionRequest) => Promise<QRLink>;
|
|
591
|
+
/**
|
|
592
|
+
* Callback invoked when a QR code link is generated or regenerated.
|
|
593
|
+
* This allows consumers to display their own custom QR code UI.
|
|
594
|
+
*
|
|
595
|
+
* @param uri - The deeplink URI to be displayed as a QR code
|
|
596
|
+
*/
|
|
597
|
+
onDisplayUri?: (uri: QRLink) => void;
|
|
584
598
|
};
|
|
585
599
|
type OTPCodeWidgetProps = Components.MmOtpModal & {
|
|
586
600
|
parentElement?: Element;
|
|
@@ -635,6 +649,6 @@ declare function getWalletActionAnalyticsProperties(options: MultichainOptions,
|
|
|
635
649
|
*/
|
|
636
650
|
declare function getVersion(): string;
|
|
637
651
|
|
|
638
|
-
declare const
|
|
652
|
+
declare const createMultichainClient: CreateMultichainFN;
|
|
639
653
|
|
|
640
|
-
export { type ConnectionRequest, type CreateMultichainFN, type DappSettings, type DataType, type DomainErrorCodes, type Enumerate, type ErrorCodeRange, type ErrorCodes, EventEmitter, type EventTypes, type ExtendedTransport, type InstallWidgetProps, type InvokeMethodOptions, type LoggerNameSpaces, Modal, type ModalFactoryConnectOptions, type ModalFactoryOptions, MultichainCore, type MultichainOptions, type NotificationCallback, type OTPCode, type OTPCodeWidgetProps, PlatformType, type QRLink, type RPCAPI, type RPCErrorCodes, RPCHttpErr, RPCInvokeMethodErr, RPCReadonlyRequestErr, RPCReadonlyResponseErr, type RPCResponse, RPC_HANDLED_METHODS, type RpcMethod, type RpcUrlsMap, type SDKEvents,
|
|
654
|
+
export { type ConnectionRequest, type ConnectionStatus, type CreateMultichainFN, type DappSettings, type DataType, type DomainErrorCodes, type Enumerate, type ErrorCodeRange, type ErrorCodes, EventEmitter, type EventTypes, type ExtendedTransport, type InstallWidgetProps, type InvokeMethodOptions, type LoggerNameSpaces, Modal, type ModalFactoryConnectOptions, type ModalFactoryOptions, MultichainCore, type MultichainOptions, type NotificationCallback, type OTPCode, type OTPCodeWidgetProps, PlatformType, type QRLink, type RPCAPI, type RPCErrorCodes, RPCHttpErr, RPCInvokeMethodErr, RPCReadonlyRequestErr, RPCReadonlyResponseErr, type RPCResponse, RPC_HANDLED_METHODS, type RpcMethod, type RpcUrlsMap, type SDKEvents, SDK_HANDLED_METHODS, type Scope, type StorageErrorCodes, StoreAdapter, StoreClient, type StoreOptions, TransportType, createLogger, createMultichainClient, enableDebug, getInfuraRpcUrls, getPlatformType, getTransportType, getVersion, getWalletActionAnalyticsProperties, hasExtension, infuraRpcUrls, isEnabled, isMetamaskExtensionInstalled, isRejectionError, isSecure };
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/connect-multichain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Multichain package for MetaMask Connect",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
7
7
|
"Ethereum"
|
|
8
8
|
],
|
|
9
|
-
"homepage": "https://github.com/MetaMask/
|
|
9
|
+
"homepage": "https://github.com/MetaMask/connect-monorepo/tree/main/packages/multichain#readme",
|
|
10
10
|
"bugs": {
|
|
11
|
-
"url": "https://github.com/MetaMask/
|
|
11
|
+
"url": "https://github.com/MetaMask/connect-monorepo/issues"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/MetaMask/
|
|
15
|
+
"url": "https://github.com/MetaMask/connect-monorepo.git"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"sideEffects": false,
|
|
@@ -63,15 +63,17 @@
|
|
|
63
63
|
"test:ci": "yarn pretest:ci && vitest run --coverage --coverage.reporter=text --silent",
|
|
64
64
|
"test:unit": "vitest run",
|
|
65
65
|
"test:verbose": "vitest run --reporter=verbose",
|
|
66
|
-
"test:watch": "vitest watch"
|
|
66
|
+
"test:watch": "vitest watch",
|
|
67
|
+
"allow-scripts": ""
|
|
67
68
|
},
|
|
68
69
|
"dependencies": {
|
|
69
70
|
"@metamask/analytics": "^0.2.0",
|
|
70
71
|
"@metamask/mobile-wallet-protocol-core": "^0.3.0",
|
|
71
72
|
"@metamask/mobile-wallet-protocol-dapp-client": "^0.2.1",
|
|
72
73
|
"@metamask/multichain-api-client": "^0.10.1",
|
|
73
|
-
"@metamask/multichain-ui": "^0.
|
|
74
|
+
"@metamask/multichain-ui": "^0.3.0",
|
|
74
75
|
"@metamask/onboarding": "^1.0.1",
|
|
76
|
+
"@metamask/rpc-errors": "^7.0.3",
|
|
75
77
|
"@metamask/utils": "^11.8.1",
|
|
76
78
|
"@paulmillr/qr": "^0.2.1",
|
|
77
79
|
"bowser": "^2.11.0",
|
|
@@ -98,14 +100,14 @@
|
|
|
98
100
|
"tsup": "^8.4.0",
|
|
99
101
|
"typedoc": "^0.28.14",
|
|
100
102
|
"typedoc-plugin-missing-exports": "^4.1.2",
|
|
101
|
-
"typescript": "
|
|
103
|
+
"typescript": "^5.9.3",
|
|
102
104
|
"vitest": "^3.1.2"
|
|
103
105
|
},
|
|
104
106
|
"peerDependencies": {
|
|
105
107
|
"@react-native-async-storage/async-storage": "^1.23"
|
|
106
108
|
},
|
|
107
109
|
"engines": {
|
|
108
|
-
"node": "
|
|
110
|
+
"node": ">=20.19.0"
|
|
109
111
|
},
|
|
110
112
|
"publishConfig": {
|
|
111
113
|
"access": "public",
|
package/dist/src/ui/qr.d.ts
DELETED
package/dist/src/ui/qr.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../../../src/ui/qr.ts"],"names":[],"mappings":"AAWA,wBAAsB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ/C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD"}
|
package/dist/src/ui/qr.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/* eslint-disable require-atomic-updates */
|
|
2
|
-
/* eslint-disable jsdoc/require-jsdoc */
|
|
3
|
-
/*
|
|
4
|
-
QR adapter that hides ESM import details and exposes a sync API.
|
|
5
|
-
Consumers must call preloadQR() once before first use.
|
|
6
|
-
*/
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
let encodeQRImpl = null;
|
|
17
|
-
export function preloadQR() {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
if (encodeQRImpl) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const mod = (yield import('@paulmillr/qr'));
|
|
23
|
-
encodeQRImpl = mod.default;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
export function encodeQRSync(input) {
|
|
27
|
-
if (!encodeQRImpl) {
|
|
28
|
-
throw new Error('QR module not preloaded. Call preloadQR() first.');
|
|
29
|
-
}
|
|
30
|
-
return encodeQRImpl(input, 'ascii');
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=qr.js.map
|
package/dist/src/ui/qr.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"qr.js","sourceRoot":"","sources":["../../../src/ui/qr.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,wCAAwC;AACxC;;;EAGE;;;;;;;;;;AAEF,IAAI,YAAY,GAAsD,IAAI,CAAC;AAI3E,MAAM,UAAgB,SAAS;;QAC7B,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QACD,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,eAAe,CAAC,CAEzC,CAAC;QACF,YAAY,GAAG,GAAG,CAAC,OAAO,CAAC;IAC7B,CAAC;CAAA;AAED,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC"}
|