@aptos-labs/wallet-adapter-core 4.4.0 → 4.6.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/index.js +54 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -41
- package/dist/index.mjs.map +1 -1
- package/dist/utils/aptosConnect.d.ts +9 -0
- package/dist/utils/aptosConnect.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/utils/aptosConnect.ts +14 -0
- package/src/utils/index.ts +3 -2
- package/src/version.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -26,6 +26,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
26
26
|
// src/index.ts
|
|
27
27
|
var src_exports = {};
|
|
28
28
|
__export(src_exports, {
|
|
29
|
+
APTOS_CONNECT_ACCOUNT_URL: () => APTOS_CONNECT_ACCOUNT_URL,
|
|
30
|
+
APTOS_CONNECT_BASE_URL: () => APTOS_CONNECT_BASE_URL,
|
|
29
31
|
ChainIdToAnsSupportedNetworkMap: () => ChainIdToAnsSupportedNetworkMap,
|
|
30
32
|
NetworkName: () => NetworkName,
|
|
31
33
|
TxnBuilderTypes: () => import_aptos3.TxnBuilderTypes,
|
|
@@ -43,6 +45,7 @@ __export(src_exports, {
|
|
|
43
45
|
generateTransactionPayloadFromV1Input: () => generateTransactionPayloadFromV1Input,
|
|
44
46
|
getAptosConfig: () => getAptosConfig,
|
|
45
47
|
getLocalStorage: () => getLocalStorage,
|
|
48
|
+
isAptosConnectWallet: () => isAptosConnectWallet,
|
|
46
49
|
isAptosNetwork: () => isAptosNetwork,
|
|
47
50
|
isInAppBrowser: () => isInAppBrowser,
|
|
48
51
|
isMobile: () => isMobile,
|
|
@@ -54,7 +57,7 @@ __export(src_exports, {
|
|
|
54
57
|
module.exports = __toCommonJS(src_exports);
|
|
55
58
|
|
|
56
59
|
// src/version.ts
|
|
57
|
-
var WALLET_ADAPTER_CORE_VERSION = "4.
|
|
60
|
+
var WALLET_ADAPTER_CORE_VERSION = "4.6.0";
|
|
58
61
|
|
|
59
62
|
// src/WalletCore.ts
|
|
60
63
|
var import_aptos4 = require("aptos");
|
|
@@ -275,46 +278,11 @@ async function generateTransactionPayloadFromV1Input(aptosConfig, inputV1) {
|
|
|
275
278
|
throw new Error("Payload type not supported");
|
|
276
279
|
}
|
|
277
280
|
|
|
278
|
-
// src/utils/
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
function detectAndDispose() {
|
|
284
|
-
const detected = detect();
|
|
285
|
-
if (detected) {
|
|
286
|
-
for (const dispose of disposers) {
|
|
287
|
-
dispose();
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
const interval = setInterval(detectAndDispose, 1e3);
|
|
292
|
-
disposers.push(() => clearInterval(interval));
|
|
293
|
-
if (document.readyState === "loading") {
|
|
294
|
-
document.addEventListener("DOMContentLoaded", detectAndDispose, {
|
|
295
|
-
once: true
|
|
296
|
-
});
|
|
297
|
-
disposers.push(
|
|
298
|
-
() => document.removeEventListener("DOMContentLoaded", detectAndDispose)
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
if (document.readyState !== "complete") {
|
|
302
|
-
window.addEventListener("load", detectAndDispose, { once: true });
|
|
303
|
-
disposers.push(() => window.removeEventListener("load", detectAndDispose));
|
|
304
|
-
}
|
|
305
|
-
detectAndDispose();
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// src/utils/localStorage.ts
|
|
309
|
-
var LOCAL_STORAGE_ITEM_KEY = "AptosWalletName";
|
|
310
|
-
function setLocalStorage(walletName) {
|
|
311
|
-
localStorage.setItem(LOCAL_STORAGE_ITEM_KEY, walletName);
|
|
312
|
-
}
|
|
313
|
-
function removeLocalStorage() {
|
|
314
|
-
localStorage.removeItem(LOCAL_STORAGE_ITEM_KEY);
|
|
315
|
-
}
|
|
316
|
-
function getLocalStorage() {
|
|
317
|
-
localStorage.getItem(LOCAL_STORAGE_ITEM_KEY);
|
|
281
|
+
// src/utils/aptosConnect.ts
|
|
282
|
+
var APTOS_CONNECT_BASE_URL = "https://aptosconnect.app";
|
|
283
|
+
var APTOS_CONNECT_ACCOUNT_URL = "https://aptosconnect.app/dashboard/main-account";
|
|
284
|
+
function isAptosConnectWallet(wallet) {
|
|
285
|
+
return wallet.url.startsWith(APTOS_CONNECT_BASE_URL);
|
|
318
286
|
}
|
|
319
287
|
|
|
320
288
|
// src/utils/helpers.ts
|
|
@@ -373,6 +341,48 @@ var fetchDevnetChainId = async () => {
|
|
|
373
341
|
return await aptos.getChainId();
|
|
374
342
|
};
|
|
375
343
|
|
|
344
|
+
// src/utils/localStorage.ts
|
|
345
|
+
var LOCAL_STORAGE_ITEM_KEY = "AptosWalletName";
|
|
346
|
+
function setLocalStorage(walletName) {
|
|
347
|
+
localStorage.setItem(LOCAL_STORAGE_ITEM_KEY, walletName);
|
|
348
|
+
}
|
|
349
|
+
function removeLocalStorage() {
|
|
350
|
+
localStorage.removeItem(LOCAL_STORAGE_ITEM_KEY);
|
|
351
|
+
}
|
|
352
|
+
function getLocalStorage() {
|
|
353
|
+
localStorage.getItem(LOCAL_STORAGE_ITEM_KEY);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// src/utils/scopePollingDetectionStrategy.ts
|
|
357
|
+
function scopePollingDetectionStrategy(detect) {
|
|
358
|
+
if (typeof window === "undefined" || typeof document === "undefined")
|
|
359
|
+
return;
|
|
360
|
+
const disposers = [];
|
|
361
|
+
function detectAndDispose() {
|
|
362
|
+
const detected = detect();
|
|
363
|
+
if (detected) {
|
|
364
|
+
for (const dispose of disposers) {
|
|
365
|
+
dispose();
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
const interval = setInterval(detectAndDispose, 1e3);
|
|
370
|
+
disposers.push(() => clearInterval(interval));
|
|
371
|
+
if (document.readyState === "loading") {
|
|
372
|
+
document.addEventListener("DOMContentLoaded", detectAndDispose, {
|
|
373
|
+
once: true
|
|
374
|
+
});
|
|
375
|
+
disposers.push(
|
|
376
|
+
() => document.removeEventListener("DOMContentLoaded", detectAndDispose)
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
if (document.readyState !== "complete") {
|
|
380
|
+
window.addEventListener("load", detectAndDispose, { once: true });
|
|
381
|
+
disposers.push(() => window.removeEventListener("load", detectAndDispose));
|
|
382
|
+
}
|
|
383
|
+
detectAndDispose();
|
|
384
|
+
}
|
|
385
|
+
|
|
376
386
|
// src/LegacyWalletPlugins/WalletCoreV1.ts
|
|
377
387
|
var WalletCoreV1 = class extends import_eventemitter3.default {
|
|
378
388
|
async connect(wallet) {
|
|
@@ -1271,6 +1281,8 @@ if (typeof window !== "undefined") {
|
|
|
1271
1281
|
}
|
|
1272
1282
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1273
1283
|
0 && (module.exports = {
|
|
1284
|
+
APTOS_CONNECT_ACCOUNT_URL,
|
|
1285
|
+
APTOS_CONNECT_BASE_URL,
|
|
1274
1286
|
ChainIdToAnsSupportedNetworkMap,
|
|
1275
1287
|
NetworkName,
|
|
1276
1288
|
TxnBuilderTypes,
|
|
@@ -1288,6 +1300,7 @@ if (typeof window !== "undefined") {
|
|
|
1288
1300
|
generateTransactionPayloadFromV1Input,
|
|
1289
1301
|
getAptosConfig,
|
|
1290
1302
|
getLocalStorage,
|
|
1303
|
+
isAptosConnectWallet,
|
|
1291
1304
|
isAptosNetwork,
|
|
1292
1305
|
isInAppBrowser,
|
|
1293
1306
|
isMobile,
|