@aptos-labs/wallet-adapter-core 5.5.1 → 5.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/WalletCore.d.ts +2 -0
- package/dist/WalletCore.d.ts.map +1 -1
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -9
- package/dist/index.mjs.map +1 -1
- package/dist/sdkWallets.d.ts.map +1 -1
- package/dist/utils/types.d.ts +1 -0
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/WalletCore.ts +43 -27
- package/src/sdkWallets.ts +4 -2
- package/src/utils/types.ts +2 -0
- package/src/version.ts +1 -1
package/dist/sdkWallets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkWallets.d.ts","sourceRoot":"","sources":["../src/sdkWallets.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEzD,wBAAgB,aAAa,CAAC,UAAU,CAAC,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"sdkWallets.d.ts","sourceRoot":"","sources":["../src/sdkWallets.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEzD,wBAAgB,aAAa,CAAC,UAAU,CAAC,EAAE,UAAU,mBA2CpD"}
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface AptosStandardSupportedWallet {
|
|
|
8
8
|
readyState: WalletReadyState.NotDetected;
|
|
9
9
|
isAIP62Standard: true;
|
|
10
10
|
deeplinkProvider?: string;
|
|
11
|
+
isAptosNativeWallet?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export type AvailableWallets = "Continue with Apple" | "Continue with Google" | "MSafe" | "Mizu Wallet" | "Nightly" | "OKX Wallet" | "Petra" | "Pontem Wallet" | "Rimosafe" | "T wallet";
|
|
13
14
|
export type InputTransactionData = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,+BAA+B,EAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mCAAmC,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,4BAA4B;IAE3C,IAAI,EAAE,MAAM,CAAC;IAEb,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,EAAE,cAAc,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,WAAW,MAAM,EAAE,CAAC;IAG1E,UAAU,EAAE,gBAAgB,CAAC,WAAW,CAAC;IAGzC,eAAe,EAAE,IAAI,CAAC;IAGtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,+BAA+B,EAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mCAAmC,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,4BAA4B;IAE3C,IAAI,EAAE,MAAM,CAAC;IAEb,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,EAAE,cAAc,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,WAAW,MAAM,EAAE,CAAC;IAG1E,UAAU,EAAE,gBAAgB,CAAC,WAAW,CAAC;IAGzC,eAAe,EAAE,IAAI,CAAC;IAGtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAGD,MAAM,MAAM,gBAAgB,GACxB,qBAAqB,GACrB,sBAAsB,GACtB,OAAO,GACP,aAAa,GACb,SAAS,GACT,YAAY,GACZ,OAAO,GACP,eAAe,GACf,UAAU,GACV,UAAU,CAAC;AAEf,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,CAAC,EAAE,+BAA+B,GAAG;QAC1C,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAClC,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;IACF,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const WALLET_ADAPTER_CORE_VERSION = "5.
|
|
1
|
+
export declare const WALLET_ADAPTER_CORE_VERSION = "5.6.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
package/src/WalletCore.ts
CHANGED
|
@@ -98,6 +98,7 @@ import {
|
|
|
98
98
|
// An adapter wallet types is a wallet that is compatible with the wallet standard and the wallet adapter properties
|
|
99
99
|
export type AdapterWallet = AptosWallet & {
|
|
100
100
|
readyState?: WalletReadyState;
|
|
101
|
+
isAptosNativeWallet?: boolean;
|
|
101
102
|
};
|
|
102
103
|
|
|
103
104
|
// An adapter not detected wallet types is a wallet that is compatible with the wallet standard but not detected
|
|
@@ -234,12 +235,8 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
234
235
|
return;
|
|
235
236
|
}
|
|
236
237
|
|
|
237
|
-
// Remove optional duplications in the _all_wallets array
|
|
238
|
-
this._standard_wallets = this._standard_wallets.filter(
|
|
239
|
-
(item) => item.name !== wallet.name
|
|
240
|
-
);
|
|
241
|
-
|
|
242
238
|
const isValid = isWalletWithRequiredFeatureSet(wallet);
|
|
239
|
+
|
|
243
240
|
if (isValid) {
|
|
244
241
|
// check if we already have this wallet as a not detected wallet
|
|
245
242
|
const index = this._standard_not_detected_wallets.findIndex(
|
|
@@ -250,9 +247,16 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
250
247
|
this._standard_not_detected_wallets.splice(index, 1);
|
|
251
248
|
}
|
|
252
249
|
|
|
253
|
-
wallet
|
|
254
|
-
this._standard_wallets.
|
|
255
|
-
|
|
250
|
+
// ✅ Check if wallet already exists in _standard_wallets
|
|
251
|
+
const alreadyExists = this._standard_wallets.some(
|
|
252
|
+
(w) => w.name === wallet.name
|
|
253
|
+
);
|
|
254
|
+
if (!alreadyExists) {
|
|
255
|
+
wallet.readyState = WalletReadyState.Installed;
|
|
256
|
+
wallet.isAptosNativeWallet = this.isAptosNativeWallet(wallet);
|
|
257
|
+
this._standard_wallets.push(wallet);
|
|
258
|
+
this.emit("standardWalletsAdded", wallet);
|
|
259
|
+
}
|
|
256
260
|
}
|
|
257
261
|
});
|
|
258
262
|
}
|
|
@@ -269,37 +273,49 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
269
273
|
|
|
270
274
|
if (isValid) {
|
|
271
275
|
wallet.readyState = WalletReadyState.Installed;
|
|
276
|
+
wallet.isAptosNativeWallet = this.isAptosNativeWallet(wallet);
|
|
272
277
|
this._standard_wallets.push(wallet);
|
|
273
278
|
}
|
|
274
279
|
});
|
|
275
280
|
}
|
|
276
281
|
|
|
282
|
+
// Aptos native wallets do not have an authenticationFunction property
|
|
283
|
+
private isAptosNativeWallet(wallet: AptosWallet): boolean {
|
|
284
|
+
return !("authenticationFunction" in wallet);
|
|
285
|
+
}
|
|
286
|
+
|
|
277
287
|
// Since we can't discover AIP-62 wallets that are not installed on the user machine,
|
|
278
288
|
// we hold a AIP-62 wallets registry to show on the wallet selector modal for the users.
|
|
279
289
|
// Append wallets from wallet standard support registry to the `_standard_not_detected_wallets` array
|
|
280
290
|
// when wallet is not installed on the user machine
|
|
281
291
|
private appendNotDetectedStandardSupportedWallets(): void {
|
|
282
292
|
// Loop over the registry map
|
|
283
|
-
aptosStandardSupportedWalletList.map(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
293
|
+
aptosStandardSupportedWalletList.map(
|
|
294
|
+
(supportedWallet: AptosStandardSupportedWallet) => {
|
|
295
|
+
// Check if we already have this wallet as a detected AIP-62 wallet standard
|
|
296
|
+
const existingStandardWallet = this._standard_wallets.find(
|
|
297
|
+
(wallet) => wallet.name == supportedWallet.name
|
|
298
|
+
);
|
|
299
|
+
// If it is detected, it means the user has the wallet installed, so dont add it to the wallets array
|
|
300
|
+
if (existingStandardWallet) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
// If AIP-62 wallet detected but it is excluded by the dapp, dont add it to the wallets array
|
|
304
|
+
if (this.excludeWallet(supportedWallet)) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
// If AIP-62 wallet does not exist, append it to the wallet selector modal
|
|
308
|
+
// as an undetected wallet
|
|
309
|
+
if (!existingStandardWallet) {
|
|
310
|
+
// Aptos native wallets do not have an authenticationFunction property
|
|
311
|
+
supportedWallet.isAptosNativeWallet = !(
|
|
312
|
+
"authenticationFunction" in supportedWallet
|
|
313
|
+
);
|
|
314
|
+
this._standard_not_detected_wallets.push(supportedWallet);
|
|
315
|
+
this.emit("standardNotDetectedWalletAdded", supportedWallet);
|
|
316
|
+
}
|
|
301
317
|
}
|
|
302
|
-
|
|
318
|
+
);
|
|
303
319
|
}
|
|
304
320
|
|
|
305
321
|
/**
|
package/src/sdkWallets.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "@aptos-connect/wallet-adapter-plugin";
|
|
5
5
|
import { Network } from "@aptos-labs/ts-sdk";
|
|
6
6
|
import { DevTWallet, TWallet } from "@atomrigslab/aptos-wallet-adapter";
|
|
7
|
-
import { MSafeWallet } from "@msafe/aptos-aip62-wallet";
|
|
7
|
+
import { inMSafeWallet, MSafeWallet } from "@msafe/aptos-aip62-wallet";
|
|
8
8
|
import { DappConfig, AdapterWallet } from "./WalletCore";
|
|
9
9
|
|
|
10
10
|
export function getSDKWallets(dappConfig?: DappConfig) {
|
|
@@ -35,7 +35,9 @@ export function getSDKWallets(dappConfig?: DappConfig) {
|
|
|
35
35
|
sdkWallets.push(new DevTWallet() as any);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
if
|
|
38
|
+
// MSafe only works if the dapp is open within the MSafe App store
|
|
39
|
+
// https://doc.m-safe.io/aptos/developers/integrate-with-msafe-dapp/faq
|
|
40
|
+
if (dappConfig?.msafeWalletConfig && dappConfig.network && inMSafeWallet()) {
|
|
39
41
|
sdkWallets.push(
|
|
40
42
|
new MSafeWallet({
|
|
41
43
|
...dappConfig?.msafeWalletConfig,
|
package/src/utils/types.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface AptosStandardSupportedWallet {
|
|
|
21
21
|
// An optional deeplink provider for the wallet. If the wallet is not installed, we can redirect the user to the wallet's deeplink provider
|
|
22
22
|
// @example "https://myWallet.app/explore?link="
|
|
23
23
|
deeplinkProvider?: string;
|
|
24
|
+
// A flag to indicate that this AptosStandardSupportedWallet is an Aptos native wallet.
|
|
25
|
+
isAptosNativeWallet?: boolean;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
// Update this with the name of your wallet when you create a new wallet plugin.
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const WALLET_ADAPTER_CORE_VERSION = "5.
|
|
1
|
+
export const WALLET_ADAPTER_CORE_VERSION = "5.6.0";
|