@aptos-labs/wallet-adapter-core 8.0.0-xchaininit.0 → 8.0.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/WalletCore.d.ts +17 -1
- package/dist/WalletCore.d.ts.map +1 -1
- package/dist/constants.d.ts +8 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.mts +42 -17
- package/dist/index.js +111 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -12
- package/dist/index.mjs.map +1 -1
- package/dist/sdkWallets.d.ts.map +1 -1
- package/dist/utils/types.d.ts +1 -1
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/utils/walletSelector.d.ts +29 -4
- package/dist/utils/walletSelector.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/WalletCore.ts +83 -36
- package/src/constants.ts +11 -0
- package/src/sdkWallets.ts +6 -0
- package/src/utils/types.ts +1 -0
- package/src/utils/walletSelector.ts +116 -19
- package/src/version.ts +1 -1
- package/dist/CrossChainCore.d.ts +0 -28
- package/dist/CrossChainCore.d.ts.map +0 -1
- package/dist/WalletCoreNew.d.ts +0 -194
- package/dist/WalletCoreNew.d.ts.map +0 -1
- package/dist/index.cjs +0 -2376
- package/dist/index.cjs.map +0 -1
- package/dist/utils/aptosConnect.d.ts +0 -18
- package/dist/utils/aptosConnect.d.ts.map +0 -1
- package/dist/utils/crossChain/chains/mainnet/index.d.ts +0 -45
- package/dist/utils/crossChain/chains/mainnet/index.d.ts.map +0 -1
- package/dist/utils/crossChain/chains/testnet/index.d.ts +0 -50
- package/dist/utils/crossChain/chains/testnet/index.d.ts.map +0 -1
- package/dist/utils/crossChain/tokens/mainnet.d.ts +0 -15
- package/dist/utils/crossChain/tokens/mainnet.d.ts.map +0 -1
- package/dist/utils/crossChain/tokens/testnet.d.ts +0 -11
- package/dist/utils/crossChain/tokens/testnet.d.ts.map +0 -1
- package/dist/utils/logger.d.ts +0 -6
- package/dist/utils/logger.d.ts.map +0 -1
package/dist/WalletCore.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import { AvailableWallets, InputTransactionData } from "./utils/types";
|
|
|
9
9
|
export type AdapterWallet = AptosWallet & {
|
|
10
10
|
readyState?: WalletReadyState;
|
|
11
11
|
isAptosNativeWallet?: boolean;
|
|
12
|
+
/** A fallback wallet to use when this wallet is not installed */
|
|
13
|
+
fallbackWallet?: AdapterWallet;
|
|
12
14
|
};
|
|
13
15
|
export type AdapterNotDetectedWallet = Omit<AdapterWallet, "features" | "version" | "chains" | "accounts"> & {
|
|
14
16
|
readyState: WalletReadyState.NotDetected;
|
|
@@ -51,6 +53,7 @@ export declare interface WalletCoreEvents {
|
|
|
51
53
|
connect(account: AccountInfo | null): void;
|
|
52
54
|
disconnect(): void;
|
|
53
55
|
standardWalletsAdded(wallets: AdapterWallet): void;
|
|
56
|
+
standardWalletsHiddenAdded(wallets: AdapterWallet): void;
|
|
54
57
|
standardNotDetectedWalletAdded(wallets: AdapterNotDetectedWallet): void;
|
|
55
58
|
networkChange(network: NetworkInfo | null): void;
|
|
56
59
|
accountChange(account: AccountInfo | null): void;
|
|
@@ -63,15 +66,17 @@ export declare class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
63
66
|
private readonly _sdkWallets;
|
|
64
67
|
private _standard_wallets;
|
|
65
68
|
private _standard_not_detected_wallets;
|
|
69
|
+
private _standard_wallets_hidden;
|
|
66
70
|
private _network;
|
|
67
71
|
private _connected;
|
|
68
72
|
private _connecting;
|
|
69
73
|
private _account;
|
|
70
74
|
private _dappConfig;
|
|
71
75
|
private _optInWallets;
|
|
76
|
+
private _hideWallets;
|
|
72
77
|
private _disableTelemetry;
|
|
73
78
|
private readonly ga4;
|
|
74
|
-
constructor(optInWallets?: ReadonlyArray<AvailableWallets>, dappConfig?: DappConfig, disableTelemetry?: boolean);
|
|
79
|
+
constructor(optInWallets?: ReadonlyArray<AvailableWallets>, dappConfig?: DappConfig, disableTelemetry?: boolean, hideWallets?: ReadonlyArray<AvailableWallets>);
|
|
75
80
|
private fetchExtensionAIP62AptosWallets;
|
|
76
81
|
/**
|
|
77
82
|
* Set AIP-62 extension wallets
|
|
@@ -92,6 +97,13 @@ export declare class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
92
97
|
* @returns boolean
|
|
93
98
|
*/
|
|
94
99
|
excludeWallet(wallet: AdapterWallet | AdapterNotDetectedWallet): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* A function that hides an AIP-62 compatible wallet from normal display.
|
|
102
|
+
*
|
|
103
|
+
* @param wallet AdapterWallet | AdapterNotDetectedWallet
|
|
104
|
+
* @returns boolean
|
|
105
|
+
*/
|
|
106
|
+
hideWallet(wallet: AdapterWallet | AdapterNotDetectedWallet): boolean;
|
|
95
107
|
private recordEvent;
|
|
96
108
|
/**
|
|
97
109
|
* Helper function to ensure wallet exists
|
|
@@ -146,6 +158,10 @@ export declare class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
146
158
|
* Getter to fetch all detected wallets
|
|
147
159
|
*/
|
|
148
160
|
get wallets(): ReadonlyArray<AptosWallet>;
|
|
161
|
+
/**
|
|
162
|
+
* Getter to fetch all hidden wallets
|
|
163
|
+
*/
|
|
164
|
+
get hiddenWallets(): ReadonlyArray<AdapterWallet>;
|
|
149
165
|
get notDetectedWallets(): ReadonlyArray<AdapterNotDetectedWallet>;
|
|
150
166
|
/**
|
|
151
167
|
* Getter for the current connected wallet
|
package/dist/WalletCore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletCore.d.ts","sourceRoot":"","sources":["../src/WalletCore.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAEL,oBAAoB,EACpB,iBAAiB,EAEjB,0BAA0B,EAC1B,OAAO,EAEP,0BAA0B,EAC1B,oBAAoB,EACrB,MAAM,oBAA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;;;OAIG;IACG,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;CAoC7E"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -21,6 +21,14 @@ export declare const ChainIdToAnsSupportedNetworkMap: Record<string, string>;
|
|
|
21
21
|
export declare const APTOS_CONNECT_BASE_URL = "https://aptosconnect.app";
|
|
22
22
|
/** The base URL for all Petra Web wallets. */
|
|
23
23
|
export declare const PETRA_WEB_BASE_URL = "https://web.petra.app";
|
|
24
|
+
/** The name of the generic wallet for Petra Web. */
|
|
25
|
+
export declare const PETRA_WEB_GENERIC_WALLET_NAME = "Petra Web";
|
|
26
|
+
/** The name of the Petra wallet. */
|
|
27
|
+
export declare const PETRA_WALLET_NAME = "Petra";
|
|
28
|
+
/** The default connection fallbacks for wallets that are not installed. */
|
|
29
|
+
export declare const DEFAULT_WALLET_CONNECTION_FALLBACKS: {
|
|
30
|
+
Petra: string;
|
|
31
|
+
};
|
|
24
32
|
/**
|
|
25
33
|
* The URL to the Aptos Connect account page if the user is signed in to Aptos Connect.
|
|
26
34
|
*
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B;;;;OAIG;IACH,SAAS,cAAc;IACvB,WAAW,gBAAgB;CAC5B;AAED,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGlE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,6BAA6B,CAAC;AAEjE,8CAA8C;AAC9C,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,oDACa,CAAC;AAEpD,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,iDACc,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B;;;;OAIG;IACH,SAAS,cAAc;IACvB,WAAW,gBAAgB;CAC5B;AAED,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAGlE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,6BAA6B,CAAC;AAEjE,8CAA8C;AAC9C,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,oDAAoD;AACpD,eAAO,MAAM,6BAA6B,cAAc,CAAC;AAEzD,oCAAoC;AACpC,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAEzC,2EAA2E;AAC3E,eAAO,MAAM,mCAAmC;;CAE/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,oDACa,CAAC;AAEpD,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,iDACc,CAAC"}
|
package/dist/index.d.mts
CHANGED
|
@@ -29,6 +29,14 @@ declare const ChainIdToAnsSupportedNetworkMap: Record<string, string>;
|
|
|
29
29
|
declare const APTOS_CONNECT_BASE_URL = "https://aptosconnect.app";
|
|
30
30
|
/** The base URL for all Petra Web wallets. */
|
|
31
31
|
declare const PETRA_WEB_BASE_URL = "https://web.petra.app";
|
|
32
|
+
/** The name of the generic wallet for Petra Web. */
|
|
33
|
+
declare const PETRA_WEB_GENERIC_WALLET_NAME = "Petra Web";
|
|
34
|
+
/** The name of the Petra wallet. */
|
|
35
|
+
declare const PETRA_WALLET_NAME = "Petra";
|
|
36
|
+
/** The default fallbacks for wallets that are not installed. */
|
|
37
|
+
declare const DEFAULT_WALLET_FALLBACKS: {
|
|
38
|
+
Petra: string;
|
|
39
|
+
};
|
|
32
40
|
/**
|
|
33
41
|
* The URL to the Aptos Connect account page if the user is signed in to Aptos Connect.
|
|
34
42
|
*
|
|
@@ -76,6 +84,8 @@ type WalletInfo = {
|
|
|
76
84
|
type AdapterWallet = AptosWallet & {
|
|
77
85
|
readyState?: WalletReadyState;
|
|
78
86
|
isAptosNativeWallet?: boolean;
|
|
87
|
+
/** A fallback wallet to use when this wallet is not installed */
|
|
88
|
+
fallbackWallet?: AdapterWallet;
|
|
79
89
|
};
|
|
80
90
|
type AdapterNotDetectedWallet = Omit<AdapterWallet, "features" | "version" | "chains" | "accounts"> & {
|
|
81
91
|
readyState: WalletReadyState.NotDetected;
|
|
@@ -104,15 +114,7 @@ interface DappConfig {
|
|
|
104
114
|
appId?: string;
|
|
105
115
|
appUrl?: string;
|
|
106
116
|
};
|
|
107
|
-
|
|
108
|
-
* A flag to indicate that the dapp supports cross-chain transactions.
|
|
109
|
-
* If enabled, the adapter will show cross-chain wallets in the wallet selector modal.
|
|
110
|
-
* @default false
|
|
111
|
-
*/
|
|
112
|
-
crossChainWallets?: {
|
|
113
|
-
solana?: boolean;
|
|
114
|
-
evm?: boolean;
|
|
115
|
-
};
|
|
117
|
+
crossChainWallets?: boolean;
|
|
116
118
|
}
|
|
117
119
|
declare interface WalletCoreEvents {
|
|
118
120
|
connect(account: AccountInfo | null): void;
|
|
@@ -387,12 +389,13 @@ declare function getLocalStorage(): void;
|
|
|
387
389
|
* By default, the wallets will be partitioned by whether or not they are installed or loadable.
|
|
388
390
|
* You can pass your own partition function if you wish to customize this behavior.
|
|
389
391
|
*/
|
|
390
|
-
declare function partitionWallets(wallets: ReadonlyArray<AdapterWallet | AdapterNotDetectedWallet>, partitionFunction?: (wallet: AdapterWallet | AdapterNotDetectedWallet) => boolean): {
|
|
392
|
+
declare function partitionWallets(wallets: ReadonlyArray<AdapterWallet | AdapterNotDetectedWallet>, partitionFunction?: (wallet: AdapterWallet | AdapterNotDetectedWallet) => boolean, hideWallets?: (wallet: AdapterWallet | AdapterNotDetectedWallet) => boolean): {
|
|
391
393
|
defaultWallets: AdapterWallet[];
|
|
392
394
|
moreWallets: AdapterNotDetectedWallet[];
|
|
395
|
+
hiddenWallets: (AdapterWallet | AdapterNotDetectedWallet)[];
|
|
393
396
|
};
|
|
394
397
|
/** Returns true if the wallet is installed or loadable. */
|
|
395
|
-
declare function isInstalledOrLoadable(wallet: AdapterWallet | AdapterNotDetectedWallet):
|
|
398
|
+
declare function isInstalledOrLoadable(wallet: AdapterWallet | AdapterNotDetectedWallet): wallet is AdapterWallet;
|
|
396
399
|
/**
|
|
397
400
|
* Returns true if the user is on desktop and the provided wallet requires installation of a browser extension.
|
|
398
401
|
* This can be used to decide whether to show a "Connect" button or "Install" link in the UI.
|
|
@@ -406,8 +409,12 @@ declare function truncateAddress(address: string | undefined): string | undefine
|
|
|
406
409
|
* @deprecated Use {@link isPetraWebWallet} instead.
|
|
407
410
|
*/
|
|
408
411
|
declare function isAptosConnectWallet(wallet: WalletInfo | AdapterWallet): boolean;
|
|
409
|
-
/** Returns `true` if the provided wallet is a Petra Web wallet. */
|
|
410
|
-
declare function isPetraWebWallet(wallet: WalletInfo | AdapterWallet): boolean;
|
|
412
|
+
/** Returns `true` if the provided wallet is a Petra Web wallet. This will automatically exclude the generic wallet. */
|
|
413
|
+
declare function isPetraWebWallet(wallet: WalletInfo | AdapterWallet, ignoreGenericWallet?: boolean): boolean;
|
|
414
|
+
/** Returns true if the wallet is a generic wallet. */
|
|
415
|
+
declare function isPetraWebGenericWallet(wallet: AdapterWallet | AdapterNotDetectedWallet | WalletInfo): boolean;
|
|
416
|
+
/** Returns true if the wallet is a Petra wallet. */
|
|
417
|
+
declare function isPetraWallet(wallet: WalletInfo | AdapterWallet): boolean;
|
|
411
418
|
/**
|
|
412
419
|
* Partitions the `wallets` array so that Aptos Connect wallets are grouped separately from the rest.
|
|
413
420
|
* Petra Web is a web wallet that uses social login to create accounts on the blockchain.
|
|
@@ -439,6 +446,21 @@ interface WalletSortingOptions {
|
|
|
439
446
|
sortAvailableWallets?: (a: AdapterWallet | AdapterNotDetectedWallet, b: AdapterWallet | AdapterNotDetectedWallet) => number;
|
|
440
447
|
/** An optional function for sorting wallets that are NOT currently installed or loadable. */
|
|
441
448
|
sortInstallableWallets?: (a: AdapterWallet | AdapterNotDetectedWallet, b: AdapterWallet | AdapterNotDetectedWallet) => number;
|
|
449
|
+
/** An optional function for hiding wallets from the UI. */
|
|
450
|
+
hideWallets?: (wallet: AdapterWallet | AdapterNotDetectedWallet) => boolean;
|
|
451
|
+
/**
|
|
452
|
+
* A map of wallet names to fallback wallet names.
|
|
453
|
+
* If a wallet is not installed and has a fallback wallet that IS installed,
|
|
454
|
+
* the fallback wallet will be attached to the not-installed wallet and it will
|
|
455
|
+
* be moved to the available wallets list.
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* ```ts
|
|
459
|
+
* // Override the default fallbacks
|
|
460
|
+
* fallbacks: { "Petra": "Petra Web", "OtherWallet": "OtherFallback" }
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
fallbacks?: Record<string, string>;
|
|
442
464
|
}
|
|
443
465
|
/**
|
|
444
466
|
* Partitions the `wallets` array into three distinct groups:
|
|
@@ -460,10 +482,14 @@ declare function groupAndSortWallets(wallets: ReadonlyArray<AdapterWallet | Adap
|
|
|
460
482
|
aptosConnectWallets: AdapterWallet[];
|
|
461
483
|
/** Wallets that use social login to create an account on the blockchain */
|
|
462
484
|
petraWebWallets: AdapterWallet[];
|
|
463
|
-
/** Wallets that are currently installed or loadable. */
|
|
485
|
+
/** Wallets that are currently installed or loadable or have a fallback wallet. */
|
|
464
486
|
availableWallets: AdapterWallet[];
|
|
487
|
+
/** Wallets that are currently uninstalled that have a fallback wallet. */
|
|
488
|
+
availableWalletsWithFallbacks: (AdapterWallet | AdapterNotDetectedWallet)[];
|
|
465
489
|
/** Wallets that are NOT currently installed or loadable. */
|
|
466
490
|
installableWallets: AdapterNotDetectedWallet[];
|
|
491
|
+
/** Wallets that should be hidden from the UI. */
|
|
492
|
+
hiddenWallets: (AdapterWallet | AdapterNotDetectedWallet)[];
|
|
467
493
|
};
|
|
468
494
|
|
|
469
495
|
declare function getSDKWallets(dappConfig?: DappConfig): AdapterWallet[];
|
|
@@ -483,12 +509,11 @@ declare function getSDKWallets(dappConfig?: DappConfig): AdapterWallet[];
|
|
|
483
509
|
* @example "https://myWallet.app/explore?link="
|
|
484
510
|
*/
|
|
485
511
|
declare const aptosStandardSupportedWalletList: Array<AptosStandardSupportedWallet>;
|
|
486
|
-
declare const
|
|
487
|
-
declare const evmStandardSupportedWalletList: Array<AptosStandardSupportedWallet>;
|
|
512
|
+
declare const crossChainStandardSupportedWalletList: Array<AptosStandardSupportedWallet>;
|
|
488
513
|
|
|
489
514
|
/**
|
|
490
515
|
* @deprecated Use `AptosSignInBoundFields` instead. This will be removed in future versions.
|
|
491
516
|
*/
|
|
492
517
|
type AptosSignInRequiredFields = AptosSignInBoundFields;
|
|
493
518
|
|
|
494
|
-
export { APTOS_CONNECT_ACCOUNT_URL, APTOS_CONNECT_BASE_URL, type AdapterAccountInfo, type AdapterNotDetectedWallet, type AdapterWallet, type AptosSignInRequiredFields, type AptosStandardSupportedWallet, type AvailableWallets, ChainIdToAnsSupportedNetworkMap, type DappConfig, type InputTransactionData, NetworkName, PETRA_WEB_ACCOUNT_URL, PETRA_WEB_BASE_URL, WalletCore, type WalletCoreEvents, type WalletInfo, WalletReadyState, type WalletSortingOptions, aptosStandardSupportedWalletList, convertNetwork,
|
|
519
|
+
export { APTOS_CONNECT_ACCOUNT_URL, APTOS_CONNECT_BASE_URL, type AdapterAccountInfo, type AdapterNotDetectedWallet, type AdapterWallet, type AptosSignInRequiredFields, type AptosStandardSupportedWallet, type AvailableWallets, ChainIdToAnsSupportedNetworkMap, DEFAULT_WALLET_FALLBACKS, type DappConfig, type InputTransactionData, NetworkName, PETRA_WALLET_NAME, PETRA_WEB_ACCOUNT_URL, PETRA_WEB_BASE_URL, PETRA_WEB_GENERIC_WALLET_NAME, WalletCore, type WalletCoreEvents, type WalletInfo, WalletReadyState, type WalletSortingOptions, aptosStandardSupportedWalletList, convertNetwork, crossChainStandardSupportedWalletList, fetchDevnetChainId, generalizedErrorMessage, getAptosConfig, getAptosConnectWallets, getLocalStorage, getPetraWebWallets, getSDKWallets, groupAndSortWallets, handlePublishPackageTransaction, isAptosConnectWallet, isAptosLiveNetwork, isAptosNetwork, isInAppBrowser, isInstallRequired, isInstalledOrLoadable, isMobile, isPetraWallet, isPetraWebGenericWallet, isPetraWebWallet, isRedirectable, partitionWallets, removeLocalStorage, setLocalStorage, truncateAddress };
|
package/dist/index.js
CHANGED
|
@@ -389,15 +389,24 @@ __export(index_exports, {
|
|
|
389
389
|
ChainIdToAnsSupportedNetworkMap: function() {
|
|
390
390
|
return ChainIdToAnsSupportedNetworkMap;
|
|
391
391
|
},
|
|
392
|
+
DEFAULT_WALLET_CONNECTION_FALLBACKS: function() {
|
|
393
|
+
return DEFAULT_WALLET_CONNECTION_FALLBACKS;
|
|
394
|
+
},
|
|
392
395
|
NetworkName: function() {
|
|
393
396
|
return NetworkName;
|
|
394
397
|
},
|
|
398
|
+
PETRA_WALLET_NAME: function() {
|
|
399
|
+
return PETRA_WALLET_NAME;
|
|
400
|
+
},
|
|
395
401
|
PETRA_WEB_ACCOUNT_URL: function() {
|
|
396
402
|
return PETRA_WEB_ACCOUNT_URL;
|
|
397
403
|
},
|
|
398
404
|
PETRA_WEB_BASE_URL: function() {
|
|
399
405
|
return PETRA_WEB_BASE_URL;
|
|
400
406
|
},
|
|
407
|
+
PETRA_WEB_GENERIC_WALLET_NAME: function() {
|
|
408
|
+
return PETRA_WEB_GENERIC_WALLET_NAME;
|
|
409
|
+
},
|
|
401
410
|
WalletCore: function() {
|
|
402
411
|
return WalletCore;
|
|
403
412
|
},
|
|
@@ -461,6 +470,9 @@ __export(index_exports, {
|
|
|
461
470
|
isMobile: function() {
|
|
462
471
|
return isMobile;
|
|
463
472
|
},
|
|
473
|
+
isPetraWebGenericWallet: function() {
|
|
474
|
+
return isPetraWebGenericWallet;
|
|
475
|
+
},
|
|
464
476
|
isPetraWebWallet: function() {
|
|
465
477
|
return isPetraWebWallet;
|
|
466
478
|
},
|
|
@@ -476,6 +488,9 @@ __export(index_exports, {
|
|
|
476
488
|
setLocalStorage: function() {
|
|
477
489
|
return setLocalStorage;
|
|
478
490
|
},
|
|
491
|
+
shouldUseFallbackWallet: function() {
|
|
492
|
+
return shouldUseFallbackWallet;
|
|
493
|
+
},
|
|
479
494
|
solanaStandardSupportedWalletList: function() {
|
|
480
495
|
return solanaStandardSupportedWalletList;
|
|
481
496
|
},
|
|
@@ -485,7 +500,7 @@ __export(index_exports, {
|
|
|
485
500
|
});
|
|
486
501
|
module.exports = __toCommonJS(index_exports);
|
|
487
502
|
// src/version.ts
|
|
488
|
-
var WALLET_ADAPTER_CORE_VERSION = "
|
|
503
|
+
var WALLET_ADAPTER_CORE_VERSION = "8.0.0";
|
|
489
504
|
// src/WalletCore.ts
|
|
490
505
|
var import_eventemitter3 = __toESM(require("eventemitter3"));
|
|
491
506
|
var import_ts_sdk2 = require("@aptos-labs/ts-sdk");
|
|
@@ -494,7 +509,7 @@ var import_wallet_standard = require("@aptos-labs/wallet-standard");
|
|
|
494
509
|
var GA4 = /*#__PURE__*/ function() {
|
|
495
510
|
function GA4() {
|
|
496
511
|
_class_call_check(this, GA4);
|
|
497
|
-
this.aptosGAID =
|
|
512
|
+
this.aptosGAID = true;
|
|
498
513
|
this.injectGA(this.aptosGAID);
|
|
499
514
|
}
|
|
500
515
|
_create_class(GA4, [
|
|
@@ -746,6 +761,9 @@ var ChainIdToAnsSupportedNetworkMap = {
|
|
|
746
761
|
};
|
|
747
762
|
var APTOS_CONNECT_BASE_URL = "https://aptosconnect.app";
|
|
748
763
|
var PETRA_WEB_BASE_URL = "https://web.petra.app";
|
|
764
|
+
var PETRA_WEB_GENERIC_WALLET_NAME = "Petra Web";
|
|
765
|
+
var PETRA_WALLET_NAME = "Petra";
|
|
766
|
+
var DEFAULT_WALLET_CONNECTION_FALLBACKS = _define_property({}, PETRA_WALLET_NAME, PETRA_WEB_GENERIC_WALLET_NAME);
|
|
749
767
|
var APTOS_CONNECT_ACCOUNT_URL = "https://aptosconnect.app/dashboard/main-account";
|
|
750
768
|
var PETRA_WEB_ACCOUNT_URL = "https://web.petra.app/dashboard/main-account";
|
|
751
769
|
// src/utils/helpers.ts
|
|
@@ -893,8 +911,11 @@ function partitionWallets(wallets) {
|
|
|
893
911
|
try {
|
|
894
912
|
for(var _iterator = wallets[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
895
913
|
var wallet = _step.value;
|
|
896
|
-
if (partitionFunction(wallet))
|
|
897
|
-
|
|
914
|
+
if (partitionFunction(wallet)) {
|
|
915
|
+
defaultWallets.push(wallet);
|
|
916
|
+
} else {
|
|
917
|
+
moreWallets.push(wallet);
|
|
918
|
+
}
|
|
898
919
|
}
|
|
899
920
|
} catch (err) {
|
|
900
921
|
_didIteratorError = true;
|
|
@@ -923,6 +944,9 @@ function isInstallRequired(wallet) {
|
|
|
923
944
|
var isMobile2 = !isWalletReady && isRedirectable();
|
|
924
945
|
return !isMobile2 && !isWalletReady;
|
|
925
946
|
}
|
|
947
|
+
function shouldUseFallbackWallet(wallet) {
|
|
948
|
+
return !!wallet.fallbackWallet && isInstallRequired(wallet) && isInstalledOrLoadable(wallet.fallbackWallet);
|
|
949
|
+
}
|
|
926
950
|
function truncateAddress(address) {
|
|
927
951
|
if (!address) return;
|
|
928
952
|
return "".concat(address.slice(0, 6), "...").concat(address.slice(-5));
|
|
@@ -931,9 +955,16 @@ function isAptosConnectWallet(wallet) {
|
|
|
931
955
|
return isPetraWebWallet(wallet);
|
|
932
956
|
}
|
|
933
957
|
function isPetraWebWallet(wallet) {
|
|
958
|
+
var ignoreGenericWallet = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
934
959
|
if (!wallet.url) return false;
|
|
960
|
+
if (ignoreGenericWallet && isPetraWebGenericWallet(wallet)) {
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
935
963
|
return wallet.url.startsWith(APTOS_CONNECT_BASE_URL) || wallet.url.startsWith(PETRA_WEB_BASE_URL);
|
|
936
964
|
}
|
|
965
|
+
function isPetraWebGenericWallet(wallet) {
|
|
966
|
+
return wallet.name === PETRA_WEB_GENERIC_WALLET_NAME;
|
|
967
|
+
}
|
|
937
968
|
function getAptosConnectWallets(wallets) {
|
|
938
969
|
var _partitionWallets = partitionWallets(wallets, isAptosConnectWallet), defaultWallets = _partitionWallets.defaultWallets, moreWallets = _partitionWallets.moreWallets;
|
|
939
970
|
return {
|
|
@@ -949,9 +980,30 @@ function getPetraWebWallets(wallets) {
|
|
|
949
980
|
};
|
|
950
981
|
}
|
|
951
982
|
function groupAndSortWallets(wallets, options) {
|
|
983
|
+
var _ref = options !== null && options !== void 0 ? options : {}, tmp = _ref.fallbacks, _ref1 = tmp === void 0 ? {} : tmp, fallbackConnections = _ref1.connections, additionalFallbackWallets = _ref1.additionalFallbackWallets;
|
|
952
984
|
var aptosConnectWallets = getAptosConnectWallets(wallets).aptosConnectWallets;
|
|
953
985
|
var _getPetraWebWallets = getPetraWebWallets(wallets), otherWallets = _getPetraWebWallets.otherWallets, petraWebWallets = _getPetraWebWallets.petraWebWallets;
|
|
954
986
|
var _partitionWallets = partitionWallets(otherWallets), defaultWallets = _partitionWallets.defaultWallets, moreWallets = _partitionWallets.moreWallets;
|
|
987
|
+
var availableWalletsWithFallbacks = [];
|
|
988
|
+
if (fallbackConnections && Object.keys(fallbackConnections).length > 0) {
|
|
989
|
+
var _loop = function(i) {
|
|
990
|
+
var wallet = moreWallets[i];
|
|
991
|
+
var fallbackName = fallbackConnections[wallet.name];
|
|
992
|
+
if (fallbackName) {
|
|
993
|
+
var fallbackWallet = _to_consumable_array(wallets).concat(_to_consumable_array(additionalFallbackWallets !== null && additionalFallbackWallets !== void 0 ? additionalFallbackWallets : [])).find(function(w) {
|
|
994
|
+
return w.name === fallbackName && isInstalledOrLoadable(w);
|
|
995
|
+
});
|
|
996
|
+
if (fallbackWallet) {
|
|
997
|
+
var walletWithFallback = _object_spread_props(_object_spread({}, wallet), {
|
|
998
|
+
fallbackWallet: fallbackWallet
|
|
999
|
+
});
|
|
1000
|
+
moreWallets.splice(i, 1);
|
|
1001
|
+
availableWalletsWithFallbacks.push(walletWithFallback);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
for(var i = moreWallets.length - 1; i >= 0; i--)_loop(i);
|
|
1006
|
+
}
|
|
955
1007
|
if (options === null || options === void 0 ? void 0 : options.sortAptosConnectWallets) {
|
|
956
1008
|
aptosConnectWallets.sort(options.sortAptosConnectWallets);
|
|
957
1009
|
}
|
|
@@ -968,6 +1020,7 @@ function groupAndSortWallets(wallets, options) {
|
|
|
968
1020
|
/** @deprecated Use {@link petraWebWallets} instead. */ aptosConnectWallets: aptosConnectWallets,
|
|
969
1021
|
/** Wallets that use social login to create an account on the blockchain */ petraWebWallets: petraWebWallets,
|
|
970
1022
|
/** Wallets that are currently installed or loadable. */ availableWallets: defaultWallets,
|
|
1023
|
+
/** Wallets that are currently uninstalled that have a fallback wallet. */ availableWalletsWithFallbacks: availableWalletsWithFallbacks,
|
|
971
1024
|
/** Wallets that are NOT currently installed or loadable. */ installableWallets: moreWallets
|
|
972
1025
|
};
|
|
973
1026
|
}
|
|
@@ -1096,6 +1149,9 @@ function getSDKWallets(dappConfig) {
|
|
|
1096
1149
|
}, dappConfig === null || dappConfig === void 0 ? void 0 : dappConfig.aptosConnect)), new import_wallet_adapter_plugin.AptosConnectAppleWallet(_object_spread({
|
|
1097
1150
|
network: dappConfig === null || dappConfig === void 0 ? void 0 : dappConfig.network,
|
|
1098
1151
|
dappId: dappConfig === null || dappConfig === void 0 ? void 0 : dappConfig.aptosConnectDappId
|
|
1152
|
+
}, dappConfig === null || dappConfig === void 0 ? void 0 : dappConfig.aptosConnect)), new import_wallet_adapter_plugin.AptosConnectGenericWallet(_object_spread({
|
|
1153
|
+
network: dappConfig === null || dappConfig === void 0 ? void 0 : dappConfig.network,
|
|
1154
|
+
dappId: dappConfig === null || dappConfig === void 0 ? void 0 : dappConfig.aptosConnectDappId
|
|
1099
1155
|
}, dappConfig === null || dappConfig === void 0 ? void 0 : dappConfig.aptosConnect)));
|
|
1100
1156
|
}
|
|
1101
1157
|
return sdkWallets;
|
|
@@ -1104,6 +1160,9 @@ function getSDKWallets(dappConfig) {
|
|
|
1104
1160
|
var WalletCore = /*#__PURE__*/ function(_import_eventemitter3_default) {
|
|
1105
1161
|
_inherits(WalletCore, _import_eventemitter3_default);
|
|
1106
1162
|
function WalletCore(optInWallets, dappConfig, disableTelemetry) {
|
|
1163
|
+
var hideWallets = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [
|
|
1164
|
+
"Petra Web"
|
|
1165
|
+
];
|
|
1107
1166
|
_class_call_check(this, WalletCore);
|
|
1108
1167
|
var _this;
|
|
1109
1168
|
_this = _call_super(this, WalletCore);
|
|
@@ -1115,6 +1174,8 @@ var WalletCore = /*#__PURE__*/ function(_import_eventemitter3_default) {
|
|
|
1115
1174
|
_this._standard_wallets = [];
|
|
1116
1175
|
// Local array that holds all the wallets that are AIP-62 standard compatible but are not installed on the user machine
|
|
1117
1176
|
_this._standard_not_detected_wallets = [];
|
|
1177
|
+
// Local array that holds all the wallets that are AIP-62 standard compatible but are hidden from normal display and that are installed on the user machine
|
|
1178
|
+
_this._standard_wallets_hidden = [];
|
|
1118
1179
|
// Local private variable to hold the network that is currently connected
|
|
1119
1180
|
_this._network = null;
|
|
1120
1181
|
// Local private variable to hold the wallet connected state
|
|
@@ -1125,11 +1186,14 @@ var WalletCore = /*#__PURE__*/ function(_import_eventemitter3_default) {
|
|
|
1125
1186
|
_this._account = null;
|
|
1126
1187
|
// Private array that holds all the Wallets a dapp decided to opt-in to
|
|
1127
1188
|
_this._optInWallets = [];
|
|
1189
|
+
// Private array that holds all the Wallets a dapp decided to hide from normal display
|
|
1190
|
+
_this._hideWallets = [];
|
|
1128
1191
|
// Local flag to disable the adapter telemetry tool
|
|
1129
1192
|
_this._disableTelemetry = false;
|
|
1130
1193
|
// Google Analytics 4 module
|
|
1131
1194
|
_this.ga4 = null;
|
|
1132
1195
|
_this._optInWallets = optInWallets || [];
|
|
1196
|
+
_this._hideWallets = hideWallets;
|
|
1133
1197
|
_this._dappConfig = dappConfig;
|
|
1134
1198
|
_this._disableTelemetry = disableTelemetry !== null && disableTelemetry !== void 0 ? disableTelemetry : false;
|
|
1135
1199
|
_this._sdkWallets = getSDKWallets(_this._dappConfig);
|
|
@@ -1184,12 +1248,19 @@ var WalletCore = /*#__PURE__*/ function(_import_eventemitter3_default) {
|
|
|
1184
1248
|
}
|
|
1185
1249
|
var alreadyExists = _this._standard_wallets.some(function(w) {
|
|
1186
1250
|
return w.name === wallet.name;
|
|
1251
|
+
}) || _this._standard_wallets_hidden.some(function(w) {
|
|
1252
|
+
return w.name === wallet.name;
|
|
1187
1253
|
});
|
|
1188
1254
|
if (!alreadyExists) {
|
|
1189
1255
|
wallet.readyState = "Installed" /* Installed */ ;
|
|
1190
1256
|
wallet.isAptosNativeWallet = _this.isAptosNativeWallet(wallet);
|
|
1191
|
-
_this.
|
|
1192
|
-
|
|
1257
|
+
if (!_this.hideWallet(wallet)) {
|
|
1258
|
+
_this._standard_wallets.push(wallet);
|
|
1259
|
+
_this.emit("standardWalletsAdded", wallet);
|
|
1260
|
+
} else {
|
|
1261
|
+
_this._standard_wallets_hidden.push(wallet);
|
|
1262
|
+
_this.emit("standardWalletsHiddenAdded", wallet);
|
|
1263
|
+
}
|
|
1193
1264
|
}
|
|
1194
1265
|
}
|
|
1195
1266
|
});
|
|
@@ -1209,7 +1280,11 @@ var WalletCore = /*#__PURE__*/ function(_import_eventemitter3_default) {
|
|
|
1209
1280
|
if (isValid) {
|
|
1210
1281
|
wallet.readyState = "Installed" /* Installed */ ;
|
|
1211
1282
|
wallet.isAptosNativeWallet = _this.isAptosNativeWallet(wallet);
|
|
1212
|
-
_this.
|
|
1283
|
+
if (!_this.hideWallet(wallet)) {
|
|
1284
|
+
_this._standard_wallets.push(wallet);
|
|
1285
|
+
} else {
|
|
1286
|
+
_this._standard_wallets_hidden.push(wallet);
|
|
1287
|
+
}
|
|
1213
1288
|
}
|
|
1214
1289
|
});
|
|
1215
1290
|
}
|
|
@@ -1241,7 +1316,9 @@ var WalletCore = /*#__PURE__*/ function(_import_eventemitter3_default) {
|
|
|
1241
1316
|
}
|
|
1242
1317
|
walletRegistry.map(function(supportedWallet) {
|
|
1243
1318
|
var existingStandardWallet = _this._standard_wallets.find(function(wallet) {
|
|
1244
|
-
return wallet.name
|
|
1319
|
+
return wallet.name === supportedWallet.name;
|
|
1320
|
+
}) || _this._standard_wallets_hidden.find(function(wallet) {
|
|
1321
|
+
return wallet.name === supportedWallet.name;
|
|
1245
1322
|
});
|
|
1246
1323
|
if (existingStandardWallet) {
|
|
1247
1324
|
return;
|
|
@@ -1271,6 +1348,17 @@ var WalletCore = /*#__PURE__*/ function(_import_eventemitter3_default) {
|
|
|
1271
1348
|
return false;
|
|
1272
1349
|
}
|
|
1273
1350
|
},
|
|
1351
|
+
{
|
|
1352
|
+
/**
|
|
1353
|
+
* A function that hides an AIP-62 compatible wallet from normal display.
|
|
1354
|
+
*
|
|
1355
|
+
* @param wallet AdapterWallet | AdapterNotDetectedWallet
|
|
1356
|
+
* @returns boolean
|
|
1357
|
+
*/ key: "hideWallet",
|
|
1358
|
+
value: function hideWallet(wallet) {
|
|
1359
|
+
return this._hideWallets.length > 0 && this._hideWallets.includes(wallet.name);
|
|
1360
|
+
}
|
|
1361
|
+
},
|
|
1274
1362
|
{
|
|
1275
1363
|
key: "recordEvent",
|
|
1276
1364
|
value: function recordEvent(eventName, additionalInfo) {
|
|
@@ -1280,7 +1368,7 @@ var WalletCore = /*#__PURE__*/ function(_import_eventemitter3_default) {
|
|
|
1280
1368
|
network: (_this__network = this._network) === null || _this__network === void 0 ? void 0 : _this__network.name,
|
|
1281
1369
|
network_url: (_this__network1 = this._network) === null || _this__network1 === void 0 ? void 0 : _this__network1.url,
|
|
1282
1370
|
adapter_core_version: WALLET_ADAPTER_CORE_VERSION,
|
|
1283
|
-
send_to:
|
|
1371
|
+
send_to: true
|
|
1284
1372
|
}, additionalInfo));
|
|
1285
1373
|
}
|
|
1286
1374
|
},
|
|
@@ -1437,6 +1525,14 @@ var WalletCore = /*#__PURE__*/ function(_import_eventemitter3_default) {
|
|
|
1437
1525
|
return this._standard_wallets;
|
|
1438
1526
|
}
|
|
1439
1527
|
},
|
|
1528
|
+
{
|
|
1529
|
+
key: "hiddenWallets",
|
|
1530
|
+
get: /**
|
|
1531
|
+
* Getter to fetch all hidden wallets
|
|
1532
|
+
*/ function get() {
|
|
1533
|
+
return this._standard_wallets_hidden;
|
|
1534
|
+
}
|
|
1535
|
+
},
|
|
1440
1536
|
{
|
|
1441
1537
|
key: "notDetectedWallets",
|
|
1442
1538
|
get: function get() {
|
|
@@ -1527,7 +1623,7 @@ var WalletCore = /*#__PURE__*/ function(_import_eventemitter3_default) {
|
|
|
1527
1623
|
}
|
|
1528
1624
|
}
|
|
1529
1625
|
}
|
|
1530
|
-
allDetectedWallets = _this._standard_wallets;
|
|
1626
|
+
allDetectedWallets = _to_consumable_array(_this._standard_wallets).concat(_to_consumable_array(_this._standard_wallets_hidden));
|
|
1531
1627
|
selectedWallet = allDetectedWallets.find(function(wallet) {
|
|
1532
1628
|
return wallet.name === walletName;
|
|
1533
1629
|
});
|
|
@@ -2428,9 +2524,12 @@ if (typeof window !== "undefined") {
|
|
|
2428
2524
|
APTOS_CONNECT_ACCOUNT_URL: APTOS_CONNECT_ACCOUNT_URL,
|
|
2429
2525
|
APTOS_CONNECT_BASE_URL: APTOS_CONNECT_BASE_URL,
|
|
2430
2526
|
ChainIdToAnsSupportedNetworkMap: ChainIdToAnsSupportedNetworkMap,
|
|
2527
|
+
DEFAULT_WALLET_CONNECTION_FALLBACKS: DEFAULT_WALLET_CONNECTION_FALLBACKS,
|
|
2431
2528
|
NetworkName: NetworkName,
|
|
2529
|
+
PETRA_WALLET_NAME: PETRA_WALLET_NAME,
|
|
2432
2530
|
PETRA_WEB_ACCOUNT_URL: PETRA_WEB_ACCOUNT_URL,
|
|
2433
2531
|
PETRA_WEB_BASE_URL: PETRA_WEB_BASE_URL,
|
|
2532
|
+
PETRA_WEB_GENERIC_WALLET_NAME: PETRA_WEB_GENERIC_WALLET_NAME,
|
|
2434
2533
|
WalletCore: WalletCore,
|
|
2435
2534
|
WalletReadyState: WalletReadyState,
|
|
2436
2535
|
aptosStandardSupportedWalletList: aptosStandardSupportedWalletList,
|
|
@@ -2452,11 +2551,13 @@ if (typeof window !== "undefined") {
|
|
|
2452
2551
|
isInstallRequired: isInstallRequired,
|
|
2453
2552
|
isInstalledOrLoadable: isInstalledOrLoadable,
|
|
2454
2553
|
isMobile: isMobile,
|
|
2554
|
+
isPetraWebGenericWallet: isPetraWebGenericWallet,
|
|
2455
2555
|
isPetraWebWallet: isPetraWebWallet,
|
|
2456
2556
|
isRedirectable: isRedirectable,
|
|
2457
2557
|
partitionWallets: partitionWallets,
|
|
2458
2558
|
removeLocalStorage: removeLocalStorage,
|
|
2459
2559
|
setLocalStorage: setLocalStorage,
|
|
2560
|
+
shouldUseFallbackWallet: shouldUseFallbackWallet,
|
|
2460
2561
|
solanaStandardSupportedWalletList: solanaStandardSupportedWalletList,
|
|
2461
2562
|
truncateAddress: truncateAddress
|
|
2462
2563
|
});
|