@reown/appkit 1.8.20-perf-imp-3.0 → 1.8.20-prerelease-v2.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/esm/exports/constants.js +1 -1
- package/dist/esm/exports/constants.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/src/auth-provider/W3MFrameProviderSingleton.js +18 -21
- package/dist/esm/src/auth-provider/W3MFrameProviderSingleton.js.map +1 -1
- package/dist/esm/src/client/appkit-base-client.js +43 -110
- package/dist/esm/src/client/appkit-base-client.js.map +1 -1
- package/dist/esm/src/client/appkit.js +13 -17
- package/dist/esm/src/client/appkit.js.map +1 -1
- package/dist/esm/src/networks/tron/tron.js +2 -1
- package/dist/esm/src/networks/tron/tron.js.map +1 -1
- package/dist/esm/src/networks/tron/tronNile.js +2 -1
- package/dist/esm/src/networks/tron/tronNile.js.map +1 -1
- package/dist/esm/src/networks/tron/tronShasta.js +2 -1
- package/dist/esm/src/networks/tron/tronShasta.js.map +1 -1
- package/dist/esm/src/universal-adapter/client.js +1 -1
- package/dist/esm/src/universal-adapter/client.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/exports/constants.d.ts +1 -1
- package/dist/types/src/auth-provider/W3MFrameProviderSingleton.d.ts +3 -4
- package/dist/types/src/client/appkit-base-client.d.ts +2 -8
- package/dist/types/src/networks/tron/tron.d.ts +3 -0
- package/dist/types/src/networks/tron/tronNile.d.ts +3 -0
- package/dist/types/src/networks/tron/tronShasta.d.ts +3 -0
- package/package.json +10 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '1.8.20-
|
|
1
|
+
export const PACKAGE_VERSION = '1.8.20-prerelease-v2.0';
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../exports/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../exports/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAA"}
|
package/dist/esm/package.json
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import { OptionsController } from '@reown/appkit-controllers';
|
|
2
|
+
import { W3mFrameProvider } from '@reown/appkit-wallet';
|
|
2
3
|
export class W3mFrameProviderSingleton {
|
|
3
4
|
// eslint-disable-next-line @typescript-eslint/no-empty-function -- This is a singleton
|
|
4
5
|
constructor() { }
|
|
5
|
-
static getInstance(
|
|
6
|
-
if (!W3mFrameProviderSingleton.instancePromise) {
|
|
7
|
-
W3mFrameProviderSingleton.instancePromise = W3mFrameProviderSingleton.createInstance(config);
|
|
8
|
-
}
|
|
9
|
-
return W3mFrameProviderSingleton.instancePromise;
|
|
10
|
-
}
|
|
11
|
-
static async createInstance({ projectId, chainId, enableLogger, onTimeout, abortController, getActiveCaipNetwork, getCaipNetworks }) {
|
|
6
|
+
static getInstance({ projectId, chainId, enableLogger, onTimeout, abortController, getActiveCaipNetwork, getCaipNetworks }) {
|
|
12
7
|
const { metadata, sdkVersion, sdkType } = OptionsController.getSnapshot();
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
if (!W3mFrameProviderSingleton.instance) {
|
|
9
|
+
W3mFrameProviderSingleton.instance = new W3mFrameProvider({
|
|
10
|
+
projectId,
|
|
11
|
+
chainId,
|
|
12
|
+
enableLogger,
|
|
13
|
+
onTimeout,
|
|
14
|
+
abortController,
|
|
15
|
+
getActiveCaipNetwork,
|
|
16
|
+
getCaipNetworks,
|
|
17
|
+
enableCloudAuthAccount: Boolean(OptionsController.state.remoteFeatures?.emailCapture),
|
|
18
|
+
metadata: metadata,
|
|
19
|
+
sdkVersion: sdkVersion,
|
|
20
|
+
sdkType
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return W3mFrameProviderSingleton.instance;
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
//# sourceMappingURL=W3MFrameProviderSingleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"W3MFrameProviderSingleton.js","sourceRoot":"","sources":["../../../../src/auth-provider/W3MFrameProviderSingleton.ts"],"names":[],"mappings":"AAOA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"W3MFrameProviderSingleton.js","sourceRoot":"","sources":["../../../../src/auth-provider/W3MFrameProviderSingleton.ts"],"names":[],"mappings":"AAOA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAYvD,MAAM,OAAO,yBAAyB;IAGpC,uFAAuF;IACvF,gBAAuB,CAAC;IAEjB,MAAM,CAAC,WAAW,CAAC,EACxB,SAAS,EACT,OAAO,EACP,YAAY,EACZ,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,eAAe,EACQ;QACvB,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,WAAW,EAAE,CAAA;QACzE,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,CAAC;YACxC,yBAAyB,CAAC,QAAQ,GAAG,IAAI,gBAAgB,CAAC;gBACxD,SAAS;gBACT,OAAO;gBACP,YAAY;gBACZ,SAAS;gBACT,eAAe;gBACf,oBAAoB;gBACpB,eAAe;gBACf,sBAAsB,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,EAAE,YAAY,CAAC;gBACrF,QAAQ,EAAE,QAAoB;gBAC9B,UAAU,EAAE,UAAwB;gBACpC,OAAO;aACR,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,yBAAyB,CAAC,QAAQ,CAAA;IAC3C,CAAC;CACF"}
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import UniversalProvider from '@walletconnect/universal-provider';
|
|
2
2
|
import { ConstantsUtil, NetworkUtil, ParseUtil } from '@reown/appkit-common';
|
|
3
|
-
import { AdapterController, AlertController, ApiController, AssetUtil, BlockchainApiController, ChainController, ConnectionController, ConnectionControllerUtil, ConnectorController, ConnectorUtil, ConstantsUtil as CoreConstantsUtil, CoreHelperUtil, EnsController, EventsController, ModalController, OnRampController, OptionsController,
|
|
4
|
-
|
|
3
|
+
import { AdapterController, AlertController, ApiController, AssetUtil, BlockchainApiController, ChainController, ConnectionController, ConnectionControllerUtil, ConnectorController, ConnectorUtil, ConstantsUtil as CoreConstantsUtil, CoreHelperUtil, EnsController, EventsController, ModalController, OnRampController, OptionsController, ProviderController, PublicStateController, RouterController, SIWXUtil, SendController, SnackController, StorageUtil, ThemeController, WalletUtil, WcHelpersUtil, getPreferredAccountType } from '@reown/appkit-controllers';
|
|
4
|
+
import { setColorTheme, setThemeVariables } from '@reown/appkit-ui';
|
|
5
5
|
import { CaipNetworksUtil, ErrorUtil, HelpersUtil, LoggerUtil, TokenUtil, ConstantsUtil as UtilConstantsUtil } from '@reown/appkit-utils';
|
|
6
6
|
import { UniversalAdapter } from '../universal-adapter/client.js';
|
|
7
7
|
import { ConfigUtil } from '../utils/ConfigUtil.js';
|
|
8
|
-
/**
|
|
9
|
-
* Yields control to the main thread to prevent long tasks from blocking the UI.
|
|
10
|
-
* Used during initialization to break up heavy synchronous work.
|
|
11
|
-
*/
|
|
12
|
-
function yieldToMainThread() {
|
|
13
|
-
return new Promise(resolve => {
|
|
14
|
-
setTimeout(resolve, 0);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
8
|
export class AppKitBaseClient {
|
|
18
9
|
constructor(options) {
|
|
19
10
|
this.chainNamespaces = [];
|
|
@@ -62,6 +53,13 @@ export class AppKitBaseClient {
|
|
|
62
53
|
this.getProviderType = (namespace) => ProviderController.getProviderId(namespace);
|
|
63
54
|
this.getPreferredAccountType = (namespace) => getPreferredAccountType(namespace);
|
|
64
55
|
this.setCaipAddress = (caipAddress, chain, shouldRefresh = false) => {
|
|
56
|
+
if (caipAddress !== null) {
|
|
57
|
+
const parts = caipAddress.split(':');
|
|
58
|
+
if (parts.length !== 3 || parts.some(p => !p)) {
|
|
59
|
+
console.warn(`[AppKit] setCaipAddress: invalid CAIP-10 address rejected: "${caipAddress}"`);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
65
63
|
ChainController.setAccountProp('caipAddress', caipAddress, chain, shouldRefresh);
|
|
66
64
|
ChainController.setAccountProp('address', CoreHelperUtil.getPlainAddress(caipAddress), chain, shouldRefresh);
|
|
67
65
|
};
|
|
@@ -211,19 +209,11 @@ export class AppKitBaseClient {
|
|
|
211
209
|
return [...new Set(networkNamespaces)];
|
|
212
210
|
}
|
|
213
211
|
async initialize(options) {
|
|
214
|
-
PerfLogger.reset();
|
|
215
|
-
PerfLogger.mark('init:start');
|
|
216
212
|
this.initializeProjectSettings(options);
|
|
217
|
-
PerfLogger.mark('init:projectSettings:done');
|
|
218
213
|
this.initControllers(options);
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
* projectId + chains which are set by initControllers. Running them in parallel
|
|
223
|
-
* with adapter init saves ~200-500ms vs the previous sequential approach.
|
|
224
|
-
*/
|
|
225
|
-
const isHeadless = options.features?.headless;
|
|
226
|
-
if (isHeadless && !ConnectorUtil.hasInjectedConnectors()) {
|
|
214
|
+
await this.initChainAdapters();
|
|
215
|
+
this.sendInitializeEvent(options);
|
|
216
|
+
if (options.features?.headless && !ConnectorUtil.hasInjectedConnectors()) {
|
|
227
217
|
ApiController.prefetch({
|
|
228
218
|
fetchNetworkImages: false,
|
|
229
219
|
fetchConnectorImages: false,
|
|
@@ -231,42 +221,17 @@ export class AppKitBaseClient {
|
|
|
231
221
|
fetchRecommendedWallets: true
|
|
232
222
|
});
|
|
233
223
|
}
|
|
234
|
-
const remoteConfigPromise = isHeadless && !options.basic && !options.manualWCControl
|
|
235
|
-
? ConfigUtil.fetchRemoteFeatures(options)
|
|
236
|
-
: null;
|
|
237
|
-
// Yield to main thread to avoid long tasks during initialization
|
|
238
|
-
await yieldToMainThread();
|
|
239
|
-
await PerfLogger.wrapAsync('init:chainAdapters', () => this.initChainAdapters());
|
|
240
|
-
await yieldToMainThread();
|
|
241
|
-
this.sendInitializeEvent(options);
|
|
242
224
|
if (OptionsController.state.enableReconnect) {
|
|
243
|
-
await
|
|
244
|
-
await
|
|
225
|
+
await this.syncExistingConnection();
|
|
226
|
+
await this.syncAdapterConnections();
|
|
245
227
|
}
|
|
246
228
|
else {
|
|
247
|
-
await
|
|
229
|
+
await this.unSyncExistingConnection();
|
|
248
230
|
}
|
|
249
231
|
if (!options.basic && !options.manualWCControl) {
|
|
250
|
-
|
|
251
|
-
// In headless mode, config fetch started early (parallel with adapters) — just await it
|
|
252
|
-
ApiController.fetchUsage();
|
|
253
|
-
this.remoteFeatures = await remoteConfigPromise;
|
|
254
|
-
}
|
|
255
|
-
else if (isHeadless) {
|
|
256
|
-
ApiController.fetchUsage();
|
|
257
|
-
this.remoteFeatures = await PerfLogger.wrapAsync('init:fetchRemoteFeatures', () => ConfigUtil.fetchRemoteFeatures(options));
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
const [remoteFeatures] = await Promise.all([
|
|
261
|
-
PerfLogger.wrapAsync('init:fetchRemoteFeatures', () => ConfigUtil.fetchRemoteFeatures(options)),
|
|
262
|
-
PerfLogger.wrapAsync('init:fetchUsage', () => ApiController.fetchUsage())
|
|
263
|
-
]);
|
|
264
|
-
this.remoteFeatures = remoteFeatures;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
await PerfLogger.wrapAsync('init:fetchUsage', () => ApiController.fetchUsage());
|
|
232
|
+
this.remoteFeatures = await ConfigUtil.fetchRemoteFeatures(options);
|
|
269
233
|
}
|
|
234
|
+
await ApiController.fetchUsage();
|
|
270
235
|
OptionsController.setRemoteFeatures(this.remoteFeatures);
|
|
271
236
|
if (this.remoteFeatures.onramp) {
|
|
272
237
|
OnRampController.setOnrampProviders(this.remoteFeatures.onramp);
|
|
@@ -275,7 +240,7 @@ export class AppKitBaseClient {
|
|
|
275
240
|
if (OptionsController.state.remoteFeatures?.email ||
|
|
276
241
|
(Array.isArray(OptionsController.state.remoteFeatures?.socials) &&
|
|
277
242
|
OptionsController.state.remoteFeatures?.socials.length > 0)) {
|
|
278
|
-
await
|
|
243
|
+
await this.checkAllowedOrigins();
|
|
279
244
|
}
|
|
280
245
|
if (OptionsController.state.features?.reownAuthentication ||
|
|
281
246
|
OptionsController.state.remoteFeatures?.reownAuthentication) {
|
|
@@ -289,8 +254,6 @@ export class AppKitBaseClient {
|
|
|
289
254
|
}
|
|
290
255
|
// If siwx is already configured for ReownAuthentication we keep the current instance
|
|
291
256
|
}
|
|
292
|
-
PerfLogger.measure('init:total', 'init:start');
|
|
293
|
-
PerfLogger.summary('AppKit Base Init');
|
|
294
257
|
}
|
|
295
258
|
async openSend(args) {
|
|
296
259
|
const namespaceToUse = args.namespace || ChainController.state.activeChain;
|
|
@@ -412,9 +375,7 @@ export class AppKitBaseClient {
|
|
|
412
375
|
initControllers(options) {
|
|
413
376
|
this.initializeOptionsController(options);
|
|
414
377
|
this.initializeChainController(options);
|
|
415
|
-
|
|
416
|
-
this.initializeThemeController(options);
|
|
417
|
-
}
|
|
378
|
+
this.initializeThemeController(options);
|
|
418
379
|
this.initializeConnectionController(options);
|
|
419
380
|
this.initializeConnectorController();
|
|
420
381
|
}
|
|
@@ -458,6 +419,7 @@ export class AppKitBaseClient {
|
|
|
458
419
|
OptionsController.setEnableWalletGuide(options.enableWalletGuide !== false);
|
|
459
420
|
OptionsController.setEnableWallets(options.enableWallets !== false);
|
|
460
421
|
OptionsController.setEIP6963Enabled(options.enableEIP6963 !== false);
|
|
422
|
+
OptionsController.setEnableInjected(options.enableInjected !== false);
|
|
461
423
|
OptionsController.setEnableCoinbase(options.enableCoinbase !== false);
|
|
462
424
|
OptionsController.setEnableNetworkSwitch(options.enableNetworkSwitch !== false);
|
|
463
425
|
OptionsController.setEnableReconnect(options.enableReconnect !== false);
|
|
@@ -585,8 +547,6 @@ export class AppKitBaseClient {
|
|
|
585
547
|
createClients() {
|
|
586
548
|
this.connectionControllerClient = {
|
|
587
549
|
connectWalletConnect: async () => {
|
|
588
|
-
// Ensure UniversalProvider is initialized (may have been deferred in headless mode)
|
|
589
|
-
await this.ensureUniversalProvider();
|
|
590
550
|
const activeChain = ChainController.state.activeChain;
|
|
591
551
|
const adapter = this.getAdapter(activeChain);
|
|
592
552
|
const chainId = this.getCaipNetwork(activeChain)?.id;
|
|
@@ -1035,29 +995,8 @@ export class AppKitBaseClient {
|
|
|
1035
995
|
if (!adapter) {
|
|
1036
996
|
throw new Error('adapter not found');
|
|
1037
997
|
}
|
|
1038
|
-
await
|
|
1039
|
-
|
|
1040
|
-
});
|
|
1041
|
-
/*
|
|
1042
|
-
* In headless mode with no existing WC session, defer UniversalProvider init
|
|
1043
|
-
* to avoid the expensive relay WebSocket connection during startup
|
|
1044
|
-
*/
|
|
1045
|
-
const shouldDeferUp = this.options.features?.headless && !this.hasExistingWcConnection();
|
|
1046
|
-
if (!shouldDeferUp) {
|
|
1047
|
-
await PerfLogger.wrapAsync(`init:adapter:${namespace}:setUniversalProvider`, () => this.createUniversalProviderForAdapter(namespace));
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
hasExistingWcConnection() {
|
|
1051
|
-
return this.chainNamespaces.some(ns => StorageUtil.getConnectedConnectorId(ns) === ConstantsUtil.CONNECTOR_ID.WALLET_CONNECT);
|
|
1052
|
-
}
|
|
1053
|
-
/**
|
|
1054
|
-
* Ensures UniversalProvider is initialized for all adapters.
|
|
1055
|
-
* Used when UP init was deferred in headless mode.
|
|
1056
|
-
*/
|
|
1057
|
-
async ensureUniversalProvider() {
|
|
1058
|
-
if (!this.universalProvider) {
|
|
1059
|
-
await Promise.all(this.chainNamespaces.map(ns => this.createUniversalProviderForAdapter(ns)));
|
|
1060
|
-
}
|
|
998
|
+
await adapter.syncConnectors();
|
|
999
|
+
await this.createUniversalProviderForAdapter(namespace);
|
|
1061
1000
|
}
|
|
1062
1001
|
async initChainAdapters() {
|
|
1063
1002
|
await Promise.all(this.chainNamespaces.map(async (namespace) => {
|
|
@@ -1145,11 +1084,11 @@ export class AppKitBaseClient {
|
|
|
1145
1084
|
address,
|
|
1146
1085
|
chainId: syncAccountChainId,
|
|
1147
1086
|
chainNamespace
|
|
1148
|
-
});
|
|
1087
|
+
}).catch(() => null);
|
|
1149
1088
|
}
|
|
1150
1089
|
else if (!isActiveChain && syncAccountChainId) {
|
|
1151
1090
|
this.syncAccountInfo(address, syncAccountChainId, chainNamespace);
|
|
1152
|
-
this.syncBalance({ address, chainId: syncAccountChainId, chainNamespace });
|
|
1091
|
+
this.syncBalance({ address, chainId: syncAccountChainId, chainNamespace }).catch(() => null);
|
|
1153
1092
|
}
|
|
1154
1093
|
else {
|
|
1155
1094
|
this.syncAccountInfo(address, chainId, chainNamespace);
|
|
@@ -1189,7 +1128,7 @@ export class AppKitBaseClient {
|
|
|
1189
1128
|
}
|
|
1190
1129
|
// -- Connection Sync ---------------------------------------------------
|
|
1191
1130
|
async syncExistingConnection() {
|
|
1192
|
-
await Promise.allSettled(this.chainNamespaces.map(namespace =>
|
|
1131
|
+
await Promise.allSettled(this.chainNamespaces.map(namespace => this.syncNamespaceConnection(namespace)));
|
|
1193
1132
|
}
|
|
1194
1133
|
async unSyncExistingConnection() {
|
|
1195
1134
|
try {
|
|
@@ -1201,7 +1140,7 @@ export class AppKitBaseClient {
|
|
|
1201
1140
|
}
|
|
1202
1141
|
}
|
|
1203
1142
|
async reconnectWalletConnect() {
|
|
1204
|
-
await
|
|
1143
|
+
await this.syncWalletConnectAccount();
|
|
1205
1144
|
const address = this.getAddress();
|
|
1206
1145
|
if (!this.getCaipAddress()) {
|
|
1207
1146
|
StorageUtil.deleteRecentWallet();
|
|
@@ -1265,11 +1204,9 @@ export class AppKitBaseClient {
|
|
|
1265
1204
|
const adapter = this.getAdapter(namespace);
|
|
1266
1205
|
const caipAddress = this.getCaipAddress(namespace);
|
|
1267
1206
|
const caipNetwork = this.getCaipNetwork(namespace);
|
|
1268
|
-
return
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
caipNetwork
|
|
1272
|
-
});
|
|
1207
|
+
return adapter?.syncConnections({
|
|
1208
|
+
connectToFirstConnector: !caipAddress,
|
|
1209
|
+
caipNetwork
|
|
1273
1210
|
});
|
|
1274
1211
|
}));
|
|
1275
1212
|
}
|
|
@@ -1431,7 +1368,7 @@ export class AppKitBaseClient {
|
|
|
1431
1368
|
address,
|
|
1432
1369
|
chainId,
|
|
1433
1370
|
chainNamespace
|
|
1434
|
-
});
|
|
1371
|
+
}).catch(() => null);
|
|
1435
1372
|
}
|
|
1436
1373
|
}
|
|
1437
1374
|
async syncAccountInfo(address, chainId, chainNamespace) {
|
|
@@ -1557,12 +1494,8 @@ export class AppKitBaseClient {
|
|
|
1557
1494
|
logger
|
|
1558
1495
|
};
|
|
1559
1496
|
OptionsController.setManualWCControl(Boolean(this.options?.manualWCControl));
|
|
1560
|
-
// Yield to main thread before heavy UniversalProvider initialization
|
|
1561
|
-
await yieldToMainThread();
|
|
1562
1497
|
this.universalProvider =
|
|
1563
|
-
this.options.universalProvider ??
|
|
1564
|
-
(await PerfLogger.wrapAsync('wc:UniversalProvider.init', () => UniversalProvider.init(universalProviderOptions)));
|
|
1565
|
-
await yieldToMainThread();
|
|
1498
|
+
this.options.universalProvider ?? (await UniversalProvider.init(universalProviderOptions));
|
|
1566
1499
|
const originalDisconnect = this.universalProvider.disconnect.bind(this.universalProvider);
|
|
1567
1500
|
this.universalProvider.disconnect = async () => {
|
|
1568
1501
|
try {
|
|
@@ -1788,9 +1721,8 @@ export class AppKitBaseClient {
|
|
|
1788
1721
|
getThemeVariables() {
|
|
1789
1722
|
return ThemeController.state.themeVariables;
|
|
1790
1723
|
}
|
|
1791
|
-
|
|
1724
|
+
setThemeMode(themeMode) {
|
|
1792
1725
|
ThemeController.setThemeMode(themeMode);
|
|
1793
|
-
const { setColorTheme } = await import('@reown/appkit-ui');
|
|
1794
1726
|
setColorTheme(ThemeController.state.themeMode);
|
|
1795
1727
|
}
|
|
1796
1728
|
setTermsConditionsUrl(termsConditionsUrl) {
|
|
@@ -1799,9 +1731,8 @@ export class AppKitBaseClient {
|
|
|
1799
1731
|
setPrivacyPolicyUrl(privacyPolicyUrl) {
|
|
1800
1732
|
OptionsController.setPrivacyPolicyUrl(privacyPolicyUrl);
|
|
1801
1733
|
}
|
|
1802
|
-
|
|
1734
|
+
setThemeVariables(themeVariables) {
|
|
1803
1735
|
ThemeController.setThemeVariables(themeVariables);
|
|
1804
|
-
const { setThemeVariables } = await import('@reown/appkit-ui');
|
|
1805
1736
|
setThemeVariables(ThemeController.state.themeVariables);
|
|
1806
1737
|
}
|
|
1807
1738
|
subscribeTheme(callback) {
|
|
@@ -1830,15 +1761,17 @@ export class AppKitBaseClient {
|
|
|
1830
1761
|
if (!namespace) {
|
|
1831
1762
|
throw new Error('AppKit:getAccount - namespace is required');
|
|
1832
1763
|
}
|
|
1764
|
+
const fallbackCaipNetwork = ChainController.getActiveCaipNetwork(namespace);
|
|
1833
1765
|
const allAccounts = connections.flatMap(connection => {
|
|
1834
|
-
const
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1766
|
+
const caipNetwork = connection.caipNetwork ?? fallbackCaipNetwork;
|
|
1767
|
+
if (!caipNetwork) {
|
|
1768
|
+
return [];
|
|
1769
|
+
}
|
|
1770
|
+
return connection.accounts.map(({ address, type, publicKey }) => CoreHelperUtil.createAccount({
|
|
1771
|
+
caipAddress: `${caipNetwork.caipNetworkId}:${address}`,
|
|
1772
|
+
type: type || 'eoa',
|
|
1773
|
+
publicKey
|
|
1774
|
+
}));
|
|
1842
1775
|
});
|
|
1843
1776
|
if (!accountState) {
|
|
1844
1777
|
return undefined;
|