@aptos-labs/wallet-adapter-core 5.4.2 → 5.5.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 +3 -0
- package/dist/WalletCore.d.ts.map +1 -1
- package/dist/index.js +1 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -13
- package/dist/index.mjs.map +1 -1
- package/dist/sdkWallets.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -3
- package/src/WalletCore.ts +30 -27
- package/src/sdkWallets.ts +0 -16
- 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":"
|
|
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,mBAyCpD"}
|
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.5.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/wallet-adapter-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "Aptos Wallet Adapter Core",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -41,9 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@aptos-connect/wallet-adapter-plugin": "2.4.1",
|
|
44
|
-
"@aptos-labs/wallet-standard": "^0.
|
|
44
|
+
"@aptos-labs/wallet-standard": "^0.4.0",
|
|
45
45
|
"@atomrigslab/aptos-wallet-adapter": "^0.1.20",
|
|
46
|
-
"@mizuwallet-sdk/aptos-wallet-adapter": "^0.3.2",
|
|
47
46
|
"@msafe/aptos-aip62-wallet": "^1.0.17",
|
|
48
47
|
"buffer": "^6.0.3",
|
|
49
48
|
"eventemitter3": "^4.0.7",
|
package/src/WalletCore.ts
CHANGED
|
@@ -113,6 +113,9 @@ export interface DappConfig {
|
|
|
113
113
|
aptosApiKeys?: Partial<Record<Network, string>>;
|
|
114
114
|
aptosConnectDappId?: string;
|
|
115
115
|
aptosConnect?: Omit<AptosConnectWalletConfig, "network">;
|
|
116
|
+
/**
|
|
117
|
+
* @deprecated will be removed in a future version
|
|
118
|
+
*/
|
|
116
119
|
mizuwallet?: {
|
|
117
120
|
manifestURL: string;
|
|
118
121
|
appId?: string;
|
|
@@ -177,7 +180,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
177
180
|
constructor(
|
|
178
181
|
optInWallets?: ReadonlyArray<AvailableWallets>,
|
|
179
182
|
dappConfig?: DappConfig,
|
|
180
|
-
disableTelemetry?: boolean
|
|
183
|
+
disableTelemetry?: boolean
|
|
181
184
|
) {
|
|
182
185
|
super();
|
|
183
186
|
this._optInWallets = optInWallets || [];
|
|
@@ -224,7 +227,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
224
227
|
* @param extensionwWallets
|
|
225
228
|
*/
|
|
226
229
|
private setExtensionAIP62Wallets(
|
|
227
|
-
extensionwWallets: readonly AptosWallet[]
|
|
230
|
+
extensionwWallets: readonly AptosWallet[]
|
|
228
231
|
): void {
|
|
229
232
|
extensionwWallets.map((wallet: AdapterWallet) => {
|
|
230
233
|
if (this.excludeWallet(wallet)) {
|
|
@@ -233,14 +236,14 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
233
236
|
|
|
234
237
|
// Remove optional duplications in the _all_wallets array
|
|
235
238
|
this._standard_wallets = this._standard_wallets.filter(
|
|
236
|
-
(item) => item.name !== wallet.name
|
|
239
|
+
(item) => item.name !== wallet.name
|
|
237
240
|
);
|
|
238
241
|
|
|
239
242
|
const isValid = isWalletWithRequiredFeatureSet(wallet);
|
|
240
243
|
if (isValid) {
|
|
241
244
|
// check if we already have this wallet as a not detected wallet
|
|
242
245
|
const index = this._standard_not_detected_wallets.findIndex(
|
|
243
|
-
(notDetctedWallet) => notDetctedWallet.name == wallet.name
|
|
246
|
+
(notDetctedWallet) => notDetctedWallet.name == wallet.name
|
|
244
247
|
);
|
|
245
248
|
// if we do, remove it from the not detected wallets array as it is now become detected
|
|
246
249
|
if (index !== -1) {
|
|
@@ -280,7 +283,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
280
283
|
aptosStandardSupportedWalletList.map((supportedWallet) => {
|
|
281
284
|
// Check if we already have this wallet as a detected AIP-62 wallet standard
|
|
282
285
|
const existingStandardWallet = this._standard_wallets.find(
|
|
283
|
-
(wallet) => wallet.name == supportedWallet.name
|
|
286
|
+
(wallet) => wallet.name == supportedWallet.name
|
|
284
287
|
);
|
|
285
288
|
// If it is detected, it means the user has the wallet installed, so dont add it to the wallets array
|
|
286
289
|
if (existingStandardWallet) {
|
|
@@ -334,7 +337,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
334
337
|
* @param wallet A wallet
|
|
335
338
|
*/
|
|
336
339
|
private ensureWalletExists(
|
|
337
|
-
wallet: AdapterWallet | null
|
|
340
|
+
wallet: AdapterWallet | null
|
|
338
341
|
): asserts wallet is AdapterWallet {
|
|
339
342
|
if (!wallet) {
|
|
340
343
|
throw new WalletNotConnectedError().name;
|
|
@@ -349,7 +352,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
349
352
|
* @param account An account
|
|
350
353
|
*/
|
|
351
354
|
private ensureAccountExists(
|
|
352
|
-
account: AccountInfo | null
|
|
355
|
+
account: AccountInfo | null
|
|
353
356
|
): asserts account is AccountInfo {
|
|
354
357
|
if (!account) {
|
|
355
358
|
throw new WalletAccountError("Account is not set").name;
|
|
@@ -500,7 +503,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
500
503
|
// Check if we are in a redirectable view (i.e on mobile AND not in an in-app browser)
|
|
501
504
|
if (isRedirectable()) {
|
|
502
505
|
const selectedWallet = this._standard_not_detected_wallets.find(
|
|
503
|
-
(wallet: AdapterNotDetectedWallet) => wallet.name === walletName
|
|
506
|
+
(wallet: AdapterNotDetectedWallet) => wallet.name === walletName
|
|
504
507
|
);
|
|
505
508
|
|
|
506
509
|
if (selectedWallet) {
|
|
@@ -520,7 +523,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
520
523
|
const allDetectedWallets = this._standard_wallets;
|
|
521
524
|
|
|
522
525
|
const selectedWallet = allDetectedWallets.find(
|
|
523
|
-
(wallet: AdapterWallet) => wallet.name === walletName
|
|
526
|
+
(wallet: AdapterWallet) => wallet.name === walletName
|
|
524
527
|
);
|
|
525
528
|
|
|
526
529
|
if (!selectedWallet) return;
|
|
@@ -530,7 +533,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
530
533
|
// if the selected wallet is already connected, we don't need to connect again
|
|
531
534
|
if (this._wallet?.name === walletName)
|
|
532
535
|
throw new WalletConnectionError(
|
|
533
|
-
`${walletName} wallet is already connected
|
|
536
|
+
`${walletName} wallet is already connected`
|
|
534
537
|
).message;
|
|
535
538
|
}
|
|
536
539
|
|
|
@@ -563,7 +566,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
563
566
|
|
|
564
567
|
const allDetectedWallets = this._standard_wallets;
|
|
565
568
|
const selectedWallet = allDetectedWallets.find(
|
|
566
|
-
(wallet: AdapterWallet) => wallet.name === walletName
|
|
569
|
+
(wallet: AdapterWallet) => wallet.name === walletName
|
|
567
570
|
);
|
|
568
571
|
|
|
569
572
|
if (!selectedWallet) {
|
|
@@ -572,14 +575,14 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
572
575
|
|
|
573
576
|
if (!selectedWallet.features["aptos:signIn"]) {
|
|
574
577
|
throw new WalletNotSupportedMethod(
|
|
575
|
-
`aptos:signIn is not supported by ${walletName}
|
|
578
|
+
`aptos:signIn is not supported by ${walletName}`
|
|
576
579
|
).message;
|
|
577
580
|
}
|
|
578
581
|
|
|
579
582
|
return await this.connectWallet(selectedWallet, async () => {
|
|
580
583
|
if (!selectedWallet.features["aptos:signIn"]) {
|
|
581
584
|
throw new WalletNotSupportedMethod(
|
|
582
|
-
`aptos:signIn is not supported by ${selectedWallet.name}
|
|
585
|
+
`aptos:signIn is not supported by ${selectedWallet.name}`
|
|
583
586
|
).message;
|
|
584
587
|
}
|
|
585
588
|
|
|
@@ -605,7 +608,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
605
608
|
*/
|
|
606
609
|
private async connectWallet<T>(
|
|
607
610
|
selectedWallet: AdapterWallet,
|
|
608
|
-
onConnect: () => Promise<{ account: AccountInfo; output: T }
|
|
611
|
+
onConnect: () => Promise<{ account: AccountInfo; output: T }>
|
|
609
612
|
): Promise<T> {
|
|
610
613
|
try {
|
|
611
614
|
this._connecting = true;
|
|
@@ -656,7 +659,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
656
659
|
* @returns AptosSignAndSubmitTransactionOutput
|
|
657
660
|
*/
|
|
658
661
|
async signAndSubmitTransaction(
|
|
659
|
-
transactionInput: InputTransactionData
|
|
662
|
+
transactionInput: InputTransactionData
|
|
660
663
|
): Promise<AptosSignAndSubmitTransactionOutput> {
|
|
661
664
|
try {
|
|
662
665
|
if ("function" in transactionInput.data) {
|
|
@@ -698,7 +701,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
698
701
|
});
|
|
699
702
|
|
|
700
703
|
type AptosSignAndSubmitTransactionV1Method = (
|
|
701
|
-
transaction: AnyRawTransaction
|
|
704
|
+
transaction: AnyRawTransaction
|
|
702
705
|
) => Promise<UserResponse<AptosSignAndSubmitTransactionOutput>>;
|
|
703
706
|
|
|
704
707
|
const signAndSubmitTransactionMethod = this._wallet.features[
|
|
@@ -707,7 +710,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
707
710
|
.signAndSubmitTransaction as unknown as AptosSignAndSubmitTransactionV1Method;
|
|
708
711
|
|
|
709
712
|
const response = (await signAndSubmitTransactionMethod(
|
|
710
|
-
transaction
|
|
713
|
+
transaction
|
|
711
714
|
)) as UserResponse<AptosSignAndSubmitTransactionOutput>;
|
|
712
715
|
|
|
713
716
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
@@ -800,7 +803,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
800
803
|
"aptos:signTransaction"
|
|
801
804
|
].signTransaction(
|
|
802
805
|
transactionOrPayload,
|
|
803
|
-
asFeePayer
|
|
806
|
+
asFeePayer
|
|
804
807
|
)) as UserResponse<AccountAuthenticator>;
|
|
805
808
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
806
809
|
throw new WalletConnectionError("User has rejected the request")
|
|
@@ -836,7 +839,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
836
839
|
AptosSignTransactionMethodV1_1;
|
|
837
840
|
|
|
838
841
|
const response = (await walletSignTransactionMethod(
|
|
839
|
-
signTransactionV1_1StandardInput
|
|
842
|
+
signTransactionV1_1StandardInput
|
|
840
843
|
)) as UserResponse<AptosSignTransactionOutputV1_1>;
|
|
841
844
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
842
845
|
throw new WalletConnectionError("User has rejected the request")
|
|
@@ -862,7 +865,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
862
865
|
"aptos:signTransaction"
|
|
863
866
|
].signTransaction(
|
|
864
867
|
transaction,
|
|
865
|
-
asFeePayer
|
|
868
|
+
asFeePayer
|
|
866
869
|
)) as UserResponse<AccountAuthenticator>;
|
|
867
870
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
868
871
|
throw new WalletConnectionError("User has rejected the request")
|
|
@@ -889,7 +892,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
889
892
|
* @throws WalletSignMessageError
|
|
890
893
|
*/
|
|
891
894
|
async signMessage(
|
|
892
|
-
message: AptosSignMessageInput
|
|
895
|
+
message: AptosSignMessageInput
|
|
893
896
|
): Promise<AptosSignMessageOutput> {
|
|
894
897
|
try {
|
|
895
898
|
this.ensureWalletExists(this._wallet);
|
|
@@ -915,7 +918,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
915
918
|
* @returns PendingTransactionResponse
|
|
916
919
|
*/
|
|
917
920
|
async submitTransaction(
|
|
918
|
-
transaction: InputSubmitTransactionData
|
|
921
|
+
transaction: InputSubmitTransactionData
|
|
919
922
|
): Promise<PendingTransactionResponse> {
|
|
920
923
|
// The standard does not support submitTransaction, so we use the adapter to submit the transaction
|
|
921
924
|
try {
|
|
@@ -961,7 +964,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
961
964
|
await this.setAnsName();
|
|
962
965
|
this.recordEvent("account_change");
|
|
963
966
|
this.emit("accountChange", this._account);
|
|
964
|
-
}
|
|
967
|
+
}
|
|
965
968
|
);
|
|
966
969
|
} catch (error: any) {
|
|
967
970
|
const errMsg = generalizedErrorMessage(error);
|
|
@@ -982,7 +985,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
982
985
|
this.setNetwork(data);
|
|
983
986
|
await this.setAnsName();
|
|
984
987
|
this.emit("networkChange", this._network);
|
|
985
|
-
}
|
|
988
|
+
}
|
|
986
989
|
);
|
|
987
990
|
} catch (error: any) {
|
|
988
991
|
const errMsg = generalizedErrorMessage(error);
|
|
@@ -1016,7 +1019,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1016
1019
|
if (this._wallet.features["aptos:changeNetwork"]) {
|
|
1017
1020
|
const response =
|
|
1018
1021
|
await this._wallet.features["aptos:changeNetwork"].changeNetwork(
|
|
1019
|
-
networkInfo
|
|
1022
|
+
networkInfo
|
|
1020
1023
|
);
|
|
1021
1024
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
1022
1025
|
throw new WalletConnectionError("User has rejected the request")
|
|
@@ -1026,7 +1029,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1026
1029
|
}
|
|
1027
1030
|
|
|
1028
1031
|
throw new WalletChangeNetworkError(
|
|
1029
|
-
`${this._wallet.name} does not support changing network request
|
|
1032
|
+
`${this._wallet.name} does not support changing network request`
|
|
1030
1033
|
).message;
|
|
1031
1034
|
} catch (error: any) {
|
|
1032
1035
|
const errMsg = generalizedErrorMessage(error);
|
|
@@ -1056,7 +1059,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1056
1059
|
|
|
1057
1060
|
const aptosConfig = getAptosConfig(this._network, this._dappConfig);
|
|
1058
1061
|
const signingMessage = new TextEncoder().encode(
|
|
1059
|
-
response.args.fullMessage
|
|
1062
|
+
response.args.fullMessage
|
|
1060
1063
|
);
|
|
1061
1064
|
if ("verifySignatureAsync" in (this._account.publicKey as Object)) {
|
|
1062
1065
|
return await this._account.publicKey.verifySignatureAsync({
|
package/src/sdkWallets.ts
CHANGED
|
@@ -4,7 +4,6 @@ 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 { MizuWallet } from "@mizuwallet-sdk/aptos-wallet-adapter";
|
|
8
7
|
import { MSafeWallet } from "@msafe/aptos-aip62-wallet";
|
|
9
8
|
import { DappConfig, AdapterWallet } from "./WalletCore";
|
|
10
9
|
|
|
@@ -25,21 +24,6 @@ export function getSDKWallets(dappConfig?: DappConfig) {
|
|
|
25
24
|
...dappConfig?.aptosConnect,
|
|
26
25
|
})
|
|
27
26
|
);
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
dappConfig?.mizuwallet &&
|
|
31
|
-
dappConfig?.network &&
|
|
32
|
-
[Network.MAINNET, Network.TESTNET].includes(dappConfig.network)
|
|
33
|
-
) {
|
|
34
|
-
sdkWallets.push(
|
|
35
|
-
new MizuWallet({
|
|
36
|
-
// mizo supports only TESTNET and MAINNET and holds a custom type for network
|
|
37
|
-
network: dappConfig.network as Network.MAINNET | Network.TESTNET,
|
|
38
|
-
manifestURL: dappConfig.mizuwallet.manifestURL,
|
|
39
|
-
appId: dappConfig.mizuwallet.appId,
|
|
40
|
-
}) as any // TODO: fix type mismatch
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
27
|
}
|
|
44
28
|
|
|
45
29
|
// Push production wallet if env is production, otherwise use dev wallet
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const WALLET_ADAPTER_CORE_VERSION = "5.
|
|
1
|
+
export const WALLET_ADAPTER_CORE_VERSION = "5.5.0";
|