@aptos-labs/wallet-adapter-core 4.24.0 → 4.25.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/AIP62StandardWallets/registry.d.ts.map +1 -1
- package/dist/LegacyWalletPlugins/conversion.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -8
- package/dist/index.mjs.map +1 -1
- package/dist/utils/helpers.d.ts +1 -1
- package/dist/utils/walletSelector.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/AIP62StandardWallets/WalletStandard.ts +14 -14
- package/src/AIP62StandardWallets/registry.ts +2 -1
- package/src/AIP62StandardWallets/sdkWallets.ts +2 -2
- package/src/LegacyWalletPlugins/WalletCoreV1.ts +16 -16
- package/src/LegacyWalletPlugins/conversion.ts +7 -9
- package/src/LegacyWalletPlugins/types.ts +8 -8
- package/src/WalletCore.ts +31 -31
- package/src/ga/index.ts +1 -1
- package/src/utils/helpers.ts +13 -13
- package/src/utils/scopePollingDetectionStrategy.ts +1 -1
- package/src/utils/walletSelector.ts +6 -4
- package/src/version.ts +1 -1
package/src/WalletCore.ts
CHANGED
|
@@ -174,7 +174,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
174
174
|
plugins: ReadonlyArray<Wallet>,
|
|
175
175
|
optInWallets: ReadonlyArray<AvailableWallets>,
|
|
176
176
|
dappConfig?: DappConfig,
|
|
177
|
-
disableTelemetry?: boolean
|
|
177
|
+
disableTelemetry?: boolean,
|
|
178
178
|
) {
|
|
179
179
|
super();
|
|
180
180
|
|
|
@@ -207,7 +207,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
207
207
|
// new standard version installed. Pontem uses "Pontem" wallet name for previous versions and
|
|
208
208
|
// "Pontem Wallet" with new version
|
|
209
209
|
const existingStandardPontemWallet = this._standard_wallets.find(
|
|
210
|
-
(wallet) => wallet.name == "Pontem Wallet"
|
|
210
|
+
(wallet) => wallet.name == "Pontem Wallet",
|
|
211
211
|
);
|
|
212
212
|
if (wallet.name === "Pontem" && existingStandardPontemWallet) {
|
|
213
213
|
return;
|
|
@@ -219,7 +219,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
219
219
|
* include the plugin wallet (i.e npm package)
|
|
220
220
|
*/
|
|
221
221
|
const existingWalletIndex = this._standard_wallets.findIndex(
|
|
222
|
-
(standardWallet) => standardWallet.name == wallet.name
|
|
222
|
+
(standardWallet) => standardWallet.name == wallet.name,
|
|
223
223
|
);
|
|
224
224
|
if (existingWalletIndex !== -1) return;
|
|
225
225
|
|
|
@@ -274,7 +274,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
274
274
|
aptosStandardSupportedWalletList.map((supportedWallet) => {
|
|
275
275
|
// Check if we already have this wallet as an installed plugin
|
|
276
276
|
const existingPluginWalletIndex = this.wallets.findIndex(
|
|
277
|
-
(wallet) => wallet.name === supportedWallet.name
|
|
277
|
+
(wallet) => wallet.name === supportedWallet.name,
|
|
278
278
|
);
|
|
279
279
|
|
|
280
280
|
// If the plugin wallet is installed, dont append and dont show it on the selector modal
|
|
@@ -285,7 +285,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
285
285
|
// new standard version installed. Pontem uses "Pontem" wallet name for previous versions and
|
|
286
286
|
// "Pontem Wallet" with new version
|
|
287
287
|
const existingStandardPontemWallet = this.wallets.find(
|
|
288
|
-
(wallet) => wallet.name == "Pontem"
|
|
288
|
+
(wallet) => wallet.name == "Pontem",
|
|
289
289
|
);
|
|
290
290
|
if (
|
|
291
291
|
supportedWallet.name === "Pontem Wallet" &&
|
|
@@ -296,7 +296,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
296
296
|
|
|
297
297
|
// Check if we already have this wallet as a AIP-62 wallet standard
|
|
298
298
|
const existingStandardWallet = this._standard_wallets.find(
|
|
299
|
-
(wallet) => wallet.name == supportedWallet.name
|
|
299
|
+
(wallet) => wallet.name == supportedWallet.name,
|
|
300
300
|
);
|
|
301
301
|
|
|
302
302
|
// If AIP-62 wallet detected but it is excluded by the dapp, dont add it to the wallets array
|
|
@@ -334,7 +334,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
334
334
|
// Twallet SDK fires a register event so the adapter assumes it is an extension wallet
|
|
335
335
|
// so filter out t wallet, remove it when twallet fixes it
|
|
336
336
|
const wallets = extensionwWallets.filter(
|
|
337
|
-
(wallet) => wallet.name !== "Dev T wallet" && wallet.name !== "T wallet"
|
|
337
|
+
(wallet) => wallet.name !== "Dev T wallet" && wallet.name !== "T wallet",
|
|
338
338
|
);
|
|
339
339
|
|
|
340
340
|
wallets.map((wallet: AptosStandardWallet) => {
|
|
@@ -392,7 +392,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
392
392
|
* @param standardWallet An AIP-62 standard compatible wallet
|
|
393
393
|
*/
|
|
394
394
|
private standardizeStandardWalletToPluginWalletType = (
|
|
395
|
-
standardWallet: AptosStandardWallet
|
|
395
|
+
standardWallet: AptosStandardWallet,
|
|
396
396
|
) => {
|
|
397
397
|
let standardWalletConvertedToWallet: Wallet = {
|
|
398
398
|
name: standardWallet.name as WalletName,
|
|
@@ -425,7 +425,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
425
425
|
|
|
426
426
|
// Remove optional duplications in the _all_wallets array
|
|
427
427
|
this._all_wallets = this._all_wallets.filter(
|
|
428
|
-
(item) => item.name !== standardWalletConvertedToWallet.name
|
|
428
|
+
(item) => item.name !== standardWalletConvertedToWallet.name,
|
|
429
429
|
);
|
|
430
430
|
this._all_wallets.push(standardWalletConvertedToWallet);
|
|
431
431
|
|
|
@@ -467,7 +467,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
467
467
|
* @param account An account
|
|
468
468
|
*/
|
|
469
469
|
private ensureAccountExists(
|
|
470
|
-
account: AccountInfo | null
|
|
470
|
+
account: AccountInfo | null,
|
|
471
471
|
): asserts account is AccountInfo {
|
|
472
472
|
if (!account) {
|
|
473
473
|
throw new WalletAccountError("Account is not set").name;
|
|
@@ -553,7 +553,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
553
553
|
| AccountInfo
|
|
554
554
|
| StandardAccountInfo
|
|
555
555
|
| UserResponse<StandardAccountInfo>
|
|
556
|
-
| null
|
|
556
|
+
| null,
|
|
557
557
|
): void {
|
|
558
558
|
if (account === null) {
|
|
559
559
|
this._account = null;
|
|
@@ -722,7 +722,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
722
722
|
const allDetectedWallets = this._all_wallets as Array<Wallet>;
|
|
723
723
|
|
|
724
724
|
const selectedWallet = allDetectedWallets.find(
|
|
725
|
-
(wallet: Wallet) => wallet.name === walletName
|
|
725
|
+
(wallet: Wallet) => wallet.name === walletName,
|
|
726
726
|
);
|
|
727
727
|
if (!selectedWallet) return;
|
|
728
728
|
|
|
@@ -731,7 +731,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
731
731
|
// if the selected wallet is already connected, we don't need to connect again
|
|
732
732
|
if (this._wallet?.name === walletName)
|
|
733
733
|
throw new WalletConnectionError(
|
|
734
|
-
`${walletName} wallet is already connected
|
|
734
|
+
`${walletName} wallet is already connected`,
|
|
735
735
|
).message;
|
|
736
736
|
}
|
|
737
737
|
|
|
@@ -843,7 +843,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
843
843
|
* @returns The pending transaction hash (V1 output) | PendingTransactionResponse (V2 output)
|
|
844
844
|
*/
|
|
845
845
|
async signAndSubmitTransaction(
|
|
846
|
-
transactionInput: InputTransactionData
|
|
846
|
+
transactionInput: InputTransactionData,
|
|
847
847
|
): Promise<
|
|
848
848
|
{ hash: Types.HexEncodedBytes; output?: any } | PendingTransactionResponse
|
|
849
849
|
> {
|
|
@@ -885,7 +885,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
885
885
|
aptos,
|
|
886
886
|
this._account,
|
|
887
887
|
this._wallet,
|
|
888
|
-
this._standard_wallets
|
|
888
|
+
this._standard_wallets,
|
|
889
889
|
);
|
|
890
890
|
return { hash, output };
|
|
891
891
|
} else {
|
|
@@ -896,7 +896,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
896
896
|
this._network,
|
|
897
897
|
this._wallet,
|
|
898
898
|
transactionInput,
|
|
899
|
-
this._dappConfig
|
|
899
|
+
this._dappConfig,
|
|
900
900
|
);
|
|
901
901
|
return { hash, output };
|
|
902
902
|
}
|
|
@@ -937,7 +937,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
937
937
|
async signTransaction(
|
|
938
938
|
transactionOrPayload: AnyRawTransaction | Types.TransactionPayload,
|
|
939
939
|
asFeePayer?: boolean,
|
|
940
|
-
options?: InputGenerateTransactionOptions
|
|
940
|
+
options?: InputGenerateTransactionOptions,
|
|
941
941
|
): Promise<AccountAuthenticator> {
|
|
942
942
|
try {
|
|
943
943
|
this.ensureWalletExists(this._wallet);
|
|
@@ -954,7 +954,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
954
954
|
return await this.walletStandardCore.signTransaction(
|
|
955
955
|
transactionOrPayload,
|
|
956
956
|
this._wallet,
|
|
957
|
-
asFeePayer
|
|
957
|
+
asFeePayer,
|
|
958
958
|
);
|
|
959
959
|
} else if (this._wallet.isSignTransactionV1_1) {
|
|
960
960
|
// This wallet is AIP-62 compliant and supports transaction inputs
|
|
@@ -979,7 +979,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
979
979
|
? { address: AccountAddress.from(optionsV1.sender) }
|
|
980
980
|
: undefined,
|
|
981
981
|
},
|
|
982
|
-
this._wallet
|
|
982
|
+
this._wallet,
|
|
983
983
|
);
|
|
984
984
|
return authenticator;
|
|
985
985
|
} else {
|
|
@@ -988,7 +988,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
988
988
|
const sender = this._account.address;
|
|
989
989
|
const payload = await generateTransactionPayloadFromV1Input(
|
|
990
990
|
aptosConfig,
|
|
991
|
-
transactionOrPayload
|
|
991
|
+
transactionOrPayload,
|
|
992
992
|
);
|
|
993
993
|
const optionsV1 = options as CompatibleTransactionOptions;
|
|
994
994
|
const optionsV2 = {
|
|
@@ -1009,7 +1009,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1009
1009
|
return await this.walletStandardCore.signTransaction(
|
|
1010
1010
|
new SimpleTransaction(rawTransaction),
|
|
1011
1011
|
this._wallet,
|
|
1012
|
-
false
|
|
1012
|
+
false,
|
|
1013
1013
|
);
|
|
1014
1014
|
}
|
|
1015
1015
|
}
|
|
@@ -1020,7 +1020,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1020
1020
|
if ("rawTransaction" in transactionOrPayload) {
|
|
1021
1021
|
const accountAuthenticator = (await this._wallet.signTransaction(
|
|
1022
1022
|
transactionOrPayload,
|
|
1023
|
-
asFeePayer
|
|
1023
|
+
asFeePayer,
|
|
1024
1024
|
)) as AccountAuthenticator;
|
|
1025
1025
|
|
|
1026
1026
|
return accountAuthenticator;
|
|
@@ -1035,7 +1035,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1035
1035
|
gas_unit_price: options?.gasUnitPrice
|
|
1036
1036
|
? BigInt(options?.gasUnitPrice)
|
|
1037
1037
|
: undefined,
|
|
1038
|
-
}
|
|
1038
|
+
},
|
|
1039
1039
|
);
|
|
1040
1040
|
|
|
1041
1041
|
if (!response) {
|
|
@@ -1054,7 +1054,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1054
1054
|
|
|
1055
1055
|
const accountAuthenticator = new AccountAuthenticatorEd25519(
|
|
1056
1056
|
new Ed25519PublicKey(publicKey),
|
|
1057
|
-
new Ed25519Signature(signature)
|
|
1057
|
+
new Ed25519Signature(signature),
|
|
1058
1058
|
);
|
|
1059
1059
|
return accountAuthenticator;
|
|
1060
1060
|
}
|
|
@@ -1062,7 +1062,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1062
1062
|
|
|
1063
1063
|
// If we are here it means this wallet does not support signTransaction
|
|
1064
1064
|
throw new WalletNotSupportedMethod(
|
|
1065
|
-
`Sign Transaction is not supported by ${this.wallet?.name}
|
|
1065
|
+
`Sign Transaction is not supported by ${this.wallet?.name}`,
|
|
1066
1066
|
).message;
|
|
1067
1067
|
} catch (error: any) {
|
|
1068
1068
|
const errMsg = generalizedErrorMessage(error);
|
|
@@ -1099,7 +1099,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1099
1099
|
* @returns PendingTransactionResponse
|
|
1100
1100
|
*/
|
|
1101
1101
|
async submitTransaction(
|
|
1102
|
-
transaction: InputSubmitTransactionData
|
|
1102
|
+
transaction: InputSubmitTransactionData,
|
|
1103
1103
|
): Promise<PendingTransactionResponse> {
|
|
1104
1104
|
try {
|
|
1105
1105
|
this.ensureWalletExists(this._wallet);
|
|
@@ -1152,7 +1152,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1152
1152
|
await this.setAnsName();
|
|
1153
1153
|
this.recordEvent("account_change");
|
|
1154
1154
|
this.emit("accountChange", this._account);
|
|
1155
|
-
}
|
|
1155
|
+
},
|
|
1156
1156
|
);
|
|
1157
1157
|
} catch (error: any) {
|
|
1158
1158
|
const errMsg = generalizedErrorMessage(error);
|
|
@@ -1173,7 +1173,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1173
1173
|
this.setNetwork(data);
|
|
1174
1174
|
await this.setAnsName();
|
|
1175
1175
|
this.emit("networkChange", this._network);
|
|
1176
|
-
}
|
|
1176
|
+
},
|
|
1177
1177
|
);
|
|
1178
1178
|
} catch (error: any) {
|
|
1179
1179
|
const errMsg = generalizedErrorMessage(error);
|
|
@@ -1211,7 +1211,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1211
1211
|
return response.args;
|
|
1212
1212
|
}
|
|
1213
1213
|
throw new WalletChangeNetworkError(
|
|
1214
|
-
`${this._wallet.name} does not support changing network request
|
|
1214
|
+
`${this._wallet.name} does not support changing network request`,
|
|
1215
1215
|
).message;
|
|
1216
1216
|
} catch (error: any) {
|
|
1217
1217
|
const errMsg = generalizedErrorMessage(error);
|
|
@@ -1233,14 +1233,14 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1233
1233
|
if (this._wallet.isAIP62Standard) {
|
|
1234
1234
|
return this.walletStandardCore.signMessageAndVerify(
|
|
1235
1235
|
message,
|
|
1236
|
-
this._wallet
|
|
1236
|
+
this._wallet,
|
|
1237
1237
|
);
|
|
1238
1238
|
}
|
|
1239
1239
|
|
|
1240
1240
|
return await this.walletCoreV1.signMessageAndVerify(
|
|
1241
1241
|
message,
|
|
1242
1242
|
this._wallet,
|
|
1243
|
-
this._account
|
|
1243
|
+
this._account,
|
|
1244
1244
|
);
|
|
1245
1245
|
} catch (error: any) {
|
|
1246
1246
|
const errMsg = generalizedErrorMessage(error);
|
package/src/ga/index.ts
CHANGED
package/src/utils/helpers.ts
CHANGED
|
@@ -19,17 +19,17 @@ import { WalletSignAndSubmitMessageError } from "../error";
|
|
|
19
19
|
|
|
20
20
|
export function isMobile(): boolean {
|
|
21
21
|
return /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/i.test(
|
|
22
|
-
navigator.userAgent
|
|
22
|
+
navigator.userAgent,
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function isInAppBrowser(): boolean {
|
|
27
27
|
const isIphone = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(
|
|
28
|
-
navigator.userAgent
|
|
28
|
+
navigator.userAgent,
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
const isAndroid = /(Android).*Version\/[\d.]+.*Chrome\/[^\s]+ Mobile/i.test(
|
|
32
|
-
navigator.userAgent
|
|
32
|
+
navigator.userAgent,
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
return isIphone || isAndroid;
|
|
@@ -55,14 +55,14 @@ export function generalizedErrorMessage(error: any): string {
|
|
|
55
55
|
// Serializable, so if each argument is of an instance of a class
|
|
56
56
|
// the extends Serializable - we know these are BCS arguments
|
|
57
57
|
export const areBCSArguments = (
|
|
58
|
-
args: Array<EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes
|
|
58
|
+
args: Array<EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes>,
|
|
59
59
|
): boolean => {
|
|
60
60
|
// `every` returns true if the array is empty, so
|
|
61
61
|
// first check the array length
|
|
62
62
|
if (args.length === 0) return false;
|
|
63
63
|
return args.every(
|
|
64
64
|
(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes) =>
|
|
65
|
-
arg instanceof Serializable
|
|
65
|
+
arg instanceof Serializable,
|
|
66
66
|
);
|
|
67
67
|
};
|
|
68
68
|
|
|
@@ -75,7 +75,7 @@ export const areBCSArguments = (
|
|
|
75
75
|
*/
|
|
76
76
|
export const getAptosConfig = (
|
|
77
77
|
networkInfo: NetworkInfo | StandardNetworkInfo | null,
|
|
78
|
-
dappConfig: DappConfig | undefined
|
|
78
|
+
dappConfig: DappConfig | undefined,
|
|
79
79
|
): AptosConfig => {
|
|
80
80
|
if (!networkInfo) {
|
|
81
81
|
throw new Error("Undefined network");
|
|
@@ -97,10 +97,10 @@ export const getAptosConfig = (
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
// Custom networks are not supported, please ensure that the wallet is returning the appropriate network Mainnet, Testnet, Devnet, Local
|
|
101
|
+
throw new Error(
|
|
102
|
+
"Invalid network, custom network not supported with Aptos wallet adapter to prevent user from using an unexpected network.",
|
|
103
|
+
);
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
/**
|
|
@@ -110,7 +110,7 @@ export const getAptosConfig = (
|
|
|
110
110
|
* @returns boolean
|
|
111
111
|
*/
|
|
112
112
|
export const isAptosNetwork = (
|
|
113
|
-
networkInfo: NetworkInfo | StandardNetworkInfo | null
|
|
113
|
+
networkInfo: NetworkInfo | StandardNetworkInfo | null,
|
|
114
114
|
): boolean => {
|
|
115
115
|
if (!networkInfo) {
|
|
116
116
|
throw new Error("Undefined network");
|
|
@@ -140,7 +140,7 @@ export const fetchDevnetChainId = async (): Promise<number> => {
|
|
|
140
140
|
* as a string, this function converts the string to Uint8Array.
|
|
141
141
|
*/
|
|
142
142
|
export const handlePublishPackageTransaction = (
|
|
143
|
-
transactionInput: InputTransactionData
|
|
143
|
+
transactionInput: InputTransactionData,
|
|
144
144
|
) => {
|
|
145
145
|
// convert the first argument, metadataBytes, to uint8array if is a string
|
|
146
146
|
let metadataBytes = transactionInput.data.functionArguments[0];
|
|
@@ -159,7 +159,7 @@ export const handlePublishPackageTransaction = (
|
|
|
159
159
|
});
|
|
160
160
|
} else {
|
|
161
161
|
throw new WalletSignAndSubmitMessageError(
|
|
162
|
-
"The bytecode argument must be an array."
|
|
162
|
+
"The bytecode argument must be an array.",
|
|
163
163
|
).message;
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -28,7 +28,7 @@ export function scopePollingDetectionStrategy(detect: () => boolean): void {
|
|
|
28
28
|
once: true,
|
|
29
29
|
});
|
|
30
30
|
disposers.push(() =>
|
|
31
|
-
document.removeEventListener("DOMContentLoaded", detectAndDispose)
|
|
31
|
+
document.removeEventListener("DOMContentLoaded", detectAndDispose),
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -11,7 +11,9 @@ import { isRedirectable } from "./helpers";
|
|
|
11
11
|
*/
|
|
12
12
|
export function partitionWallets(
|
|
13
13
|
wallets: ReadonlyArray<AnyAptosWallet>,
|
|
14
|
-
partitionFunction: (
|
|
14
|
+
partitionFunction: (
|
|
15
|
+
wallet: AnyAptosWallet,
|
|
16
|
+
) => boolean = isInstalledOrLoadable,
|
|
15
17
|
) {
|
|
16
18
|
const defaultWallets: Array<AnyAptosWallet> = [];
|
|
17
19
|
const moreWallets: Array<AnyAptosWallet> = [];
|
|
@@ -51,7 +53,7 @@ export function truncateAddress(address: string | undefined) {
|
|
|
51
53
|
|
|
52
54
|
/** Returns `true` if the provided wallet is an Aptos Connect wallet. */
|
|
53
55
|
export function isAptosConnectWallet(
|
|
54
|
-
wallet: WalletInfo | AnyAptosWallet | AptosStandardWallet
|
|
56
|
+
wallet: WalletInfo | AnyAptosWallet | AptosStandardWallet,
|
|
55
57
|
) {
|
|
56
58
|
if (!wallet.url) return false;
|
|
57
59
|
return wallet.url.startsWith(APTOS_CONNECT_BASE_URL);
|
|
@@ -64,7 +66,7 @@ export function isAptosConnectWallet(
|
|
|
64
66
|
export function getAptosConnectWallets(wallets: ReadonlyArray<AnyAptosWallet>) {
|
|
65
67
|
const { defaultWallets, moreWallets } = partitionWallets(
|
|
66
68
|
wallets,
|
|
67
|
-
isAptosConnectWallet
|
|
69
|
+
isAptosConnectWallet,
|
|
68
70
|
);
|
|
69
71
|
return { aptosConnectWallets: defaultWallets, otherWallets: moreWallets };
|
|
70
72
|
}
|
|
@@ -93,7 +95,7 @@ export interface WalletSortingOptions {
|
|
|
93
95
|
*/
|
|
94
96
|
export function groupAndSortWallets(
|
|
95
97
|
wallets: ReadonlyArray<AnyAptosWallet>,
|
|
96
|
-
options?: WalletSortingOptions
|
|
98
|
+
options?: WalletSortingOptions,
|
|
97
99
|
) {
|
|
98
100
|
const { aptosConnectWallets, otherWallets } = getAptosConnectWallets(wallets);
|
|
99
101
|
const { defaultWallets, moreWallets } = partitionWallets(otherWallets);
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const WALLET_ADAPTER_CORE_VERSION = "4.
|
|
1
|
+
export const WALLET_ADAPTER_CORE_VERSION = "4.25.0";
|