@aptos-labs/wallet-adapter-core 5.4.0 → 5.4.2
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.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/utils/helpers.d.ts +1 -1
- package/dist/utils/types.d.ts +2 -1
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/WalletCore.ts +31 -28
- package/src/sdkWallets.ts +1 -1
- package/src/utils/helpers.ts +9 -9
- package/src/utils/types.ts +8 -6
- package/src/utils/walletSelector.ts +9 -9
- package/src/version.ts +1 -1
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare const fetchDevnetChainId: () => Promise<number>;
|
|
|
32
32
|
* as a string, this function converts the string to Uint8Array.
|
|
33
33
|
*/
|
|
34
34
|
export declare const handlePublishPackageTransaction: (transactionInput: InputTransactionData) => {
|
|
35
|
-
metadataBytes: number | bigint | boolean | Uint8Array | import("@aptos-labs/ts-sdk/dist/common/accountAddress-
|
|
35
|
+
metadataBytes: number | bigint | boolean | Uint8Array | import("@aptos-labs/ts-sdk/dist/common/accountAddress-D0xKX-UM").g | import("@aptos-labs/ts-sdk").Bool | import("@aptos-labs/ts-sdk").U8 | import("@aptos-labs/ts-sdk").U16 | import("@aptos-labs/ts-sdk").U32 | import("@aptos-labs/ts-sdk").U64 | import("@aptos-labs/ts-sdk").U128 | import("@aptos-labs/ts-sdk").U256 | import("@aptos-labs/ts-sdk").MoveVector<import("@aptos-labs/ts-sdk").EntryFunctionArgumentTypes> | import("@aptos-labs/ts-sdk").MoveOption<import("@aptos-labs/ts-sdk").EntryFunctionArgumentTypes> | import("@aptos-labs/ts-sdk").MoveString | import("@aptos-labs/ts-sdk").FixedBytes | ArrayBuffer | (import("@aptos-labs/ts-sdk").EntryFunctionArgumentTypes | import("@aptos-labs/ts-sdk").SimpleEntryFunctionArgumentTypes)[] | import("@aptos-labs/ts-sdk").MoveVector<import("@aptos-labs/ts-sdk").ScriptFunctionArgumentTypes> | import("@aptos-labs/ts-sdk").Serialized | null | undefined;
|
|
36
36
|
byteCode: (import("@aptos-labs/ts-sdk").EntryFunctionArgumentTypes | import("@aptos-labs/ts-sdk").SimpleEntryFunctionArgumentTypes)[];
|
|
37
37
|
};
|
|
38
38
|
export declare function convertNetwork(networkInfo: NetworkInfo | null): Network;
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface AptosStandardSupportedWallet {
|
|
|
9
9
|
isAIP62Standard: true;
|
|
10
10
|
deeplinkProvider?: string;
|
|
11
11
|
}
|
|
12
|
-
export type AvailableWallets = "
|
|
12
|
+
export type AvailableWallets = "Continue with Apple" | "Continue with Google" | "MSafe" | "Mizu Wallet" | "Nightly" | "OKX Wallet" | "Petra" | "Pontem Wallet" | "Rimosafe" | "T wallet";
|
|
13
13
|
export type InputTransactionData = {
|
|
14
14
|
sender?: AccountAddressInput;
|
|
15
15
|
data: InputGenerateTransactionPayloadData;
|
|
@@ -17,6 +17,7 @@ export type InputTransactionData = {
|
|
|
17
17
|
expirationSecondsFromNow?: number;
|
|
18
18
|
expirationTimestamp?: number;
|
|
19
19
|
};
|
|
20
|
+
withFeePayer?: boolean;
|
|
20
21
|
};
|
|
21
22
|
export type WalletInfo = {
|
|
22
23
|
name: string;
|
|
@@ -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;CAC3B;AAGD,MAAM,MAAM,gBAAgB,GACxB,
|
|
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;CAC3B;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.4.
|
|
1
|
+
export declare const WALLET_ADAPTER_CORE_VERSION = "5.4.2";
|
|
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.4.
|
|
3
|
+
"version": "5.4.2",
|
|
4
4
|
"description": "Aptos Wallet Adapter Core",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"tweetnacl": "^1.0.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@aptos-labs/ts-sdk": "^1.
|
|
53
|
+
"@aptos-labs/ts-sdk": "^1.38.0 || ^2.0.0"
|
|
54
54
|
},
|
|
55
55
|
"files": [
|
|
56
56
|
"dist",
|
package/src/WalletCore.ts
CHANGED
|
@@ -177,7 +177,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
177
177
|
constructor(
|
|
178
178
|
optInWallets?: ReadonlyArray<AvailableWallets>,
|
|
179
179
|
dappConfig?: DappConfig,
|
|
180
|
-
disableTelemetry?: boolean
|
|
180
|
+
disableTelemetry?: boolean,
|
|
181
181
|
) {
|
|
182
182
|
super();
|
|
183
183
|
this._optInWallets = optInWallets || [];
|
|
@@ -224,7 +224,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
224
224
|
* @param extensionwWallets
|
|
225
225
|
*/
|
|
226
226
|
private setExtensionAIP62Wallets(
|
|
227
|
-
extensionwWallets: readonly AptosWallet[]
|
|
227
|
+
extensionwWallets: readonly AptosWallet[],
|
|
228
228
|
): void {
|
|
229
229
|
extensionwWallets.map((wallet: AdapterWallet) => {
|
|
230
230
|
if (this.excludeWallet(wallet)) {
|
|
@@ -233,14 +233,14 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
233
233
|
|
|
234
234
|
// Remove optional duplications in the _all_wallets array
|
|
235
235
|
this._standard_wallets = this._standard_wallets.filter(
|
|
236
|
-
(item) => item.name !== wallet.name
|
|
236
|
+
(item) => item.name !== wallet.name,
|
|
237
237
|
);
|
|
238
238
|
|
|
239
239
|
const isValid = isWalletWithRequiredFeatureSet(wallet);
|
|
240
240
|
if (isValid) {
|
|
241
241
|
// check if we already have this wallet as a not detected wallet
|
|
242
242
|
const index = this._standard_not_detected_wallets.findIndex(
|
|
243
|
-
(notDetctedWallet) => notDetctedWallet.name == wallet.name
|
|
243
|
+
(notDetctedWallet) => notDetctedWallet.name == wallet.name,
|
|
244
244
|
);
|
|
245
245
|
// if we do, remove it from the not detected wallets array as it is now become detected
|
|
246
246
|
if (index !== -1) {
|
|
@@ -280,7 +280,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
280
280
|
aptosStandardSupportedWalletList.map((supportedWallet) => {
|
|
281
281
|
// Check if we already have this wallet as a detected AIP-62 wallet standard
|
|
282
282
|
const existingStandardWallet = this._standard_wallets.find(
|
|
283
|
-
(wallet) => wallet.name == supportedWallet.name
|
|
283
|
+
(wallet) => wallet.name == supportedWallet.name,
|
|
284
284
|
);
|
|
285
285
|
// If it is detected, it means the user has the wallet installed, so dont add it to the wallets array
|
|
286
286
|
if (existingStandardWallet) {
|
|
@@ -334,7 +334,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
334
334
|
* @param wallet A wallet
|
|
335
335
|
*/
|
|
336
336
|
private ensureWalletExists(
|
|
337
|
-
wallet: AdapterWallet | null
|
|
337
|
+
wallet: AdapterWallet | null,
|
|
338
338
|
): asserts wallet is AdapterWallet {
|
|
339
339
|
if (!wallet) {
|
|
340
340
|
throw new WalletNotConnectedError().name;
|
|
@@ -349,7 +349,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
349
349
|
* @param account An account
|
|
350
350
|
*/
|
|
351
351
|
private ensureAccountExists(
|
|
352
|
-
account: AccountInfo | null
|
|
352
|
+
account: AccountInfo | null,
|
|
353
353
|
): asserts account is AccountInfo {
|
|
354
354
|
if (!account) {
|
|
355
355
|
throw new WalletAccountError("Account is not set").name;
|
|
@@ -500,7 +500,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
500
500
|
// Check if we are in a redirectable view (i.e on mobile AND not in an in-app browser)
|
|
501
501
|
if (isRedirectable()) {
|
|
502
502
|
const selectedWallet = this._standard_not_detected_wallets.find(
|
|
503
|
-
(wallet: AdapterNotDetectedWallet) => wallet.name === walletName
|
|
503
|
+
(wallet: AdapterNotDetectedWallet) => wallet.name === walletName,
|
|
504
504
|
);
|
|
505
505
|
|
|
506
506
|
if (selectedWallet) {
|
|
@@ -520,7 +520,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
520
520
|
const allDetectedWallets = this._standard_wallets;
|
|
521
521
|
|
|
522
522
|
const selectedWallet = allDetectedWallets.find(
|
|
523
|
-
(wallet: AdapterWallet) => wallet.name === walletName
|
|
523
|
+
(wallet: AdapterWallet) => wallet.name === walletName,
|
|
524
524
|
);
|
|
525
525
|
|
|
526
526
|
if (!selectedWallet) return;
|
|
@@ -530,7 +530,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
530
530
|
// if the selected wallet is already connected, we don't need to connect again
|
|
531
531
|
if (this._wallet?.name === walletName)
|
|
532
532
|
throw new WalletConnectionError(
|
|
533
|
-
`${walletName} wallet is already connected
|
|
533
|
+
`${walletName} wallet is already connected`,
|
|
534
534
|
).message;
|
|
535
535
|
}
|
|
536
536
|
|
|
@@ -563,7 +563,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
563
563
|
|
|
564
564
|
const allDetectedWallets = this._standard_wallets;
|
|
565
565
|
const selectedWallet = allDetectedWallets.find(
|
|
566
|
-
(wallet: AdapterWallet) => wallet.name === walletName
|
|
566
|
+
(wallet: AdapterWallet) => wallet.name === walletName,
|
|
567
567
|
);
|
|
568
568
|
|
|
569
569
|
if (!selectedWallet) {
|
|
@@ -572,14 +572,14 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
572
572
|
|
|
573
573
|
if (!selectedWallet.features["aptos:signIn"]) {
|
|
574
574
|
throw new WalletNotSupportedMethod(
|
|
575
|
-
`aptos:signIn is not supported by ${walletName}
|
|
575
|
+
`aptos:signIn is not supported by ${walletName}`,
|
|
576
576
|
).message;
|
|
577
577
|
}
|
|
578
578
|
|
|
579
579
|
return await this.connectWallet(selectedWallet, async () => {
|
|
580
580
|
if (!selectedWallet.features["aptos:signIn"]) {
|
|
581
581
|
throw new WalletNotSupportedMethod(
|
|
582
|
-
`aptos:signIn is not supported by ${selectedWallet.name}
|
|
582
|
+
`aptos:signIn is not supported by ${selectedWallet.name}`,
|
|
583
583
|
).message;
|
|
584
584
|
}
|
|
585
585
|
|
|
@@ -605,7 +605,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
605
605
|
*/
|
|
606
606
|
private async connectWallet<T>(
|
|
607
607
|
selectedWallet: AdapterWallet,
|
|
608
|
-
onConnect: () => Promise<{ account: AccountInfo; output: T }
|
|
608
|
+
onConnect: () => Promise<{ account: AccountInfo; output: T }>,
|
|
609
609
|
): Promise<T> {
|
|
610
610
|
try {
|
|
611
611
|
this._connecting = true;
|
|
@@ -656,7 +656,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
656
656
|
* @returns AptosSignAndSubmitTransactionOutput
|
|
657
657
|
*/
|
|
658
658
|
async signAndSubmitTransaction(
|
|
659
|
-
transactionInput: InputTransactionData
|
|
659
|
+
transactionInput: InputTransactionData,
|
|
660
660
|
): Promise<AptosSignAndSubmitTransactionOutput> {
|
|
661
661
|
try {
|
|
662
662
|
if ("function" in transactionInput.data) {
|
|
@@ -698,7 +698,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
698
698
|
});
|
|
699
699
|
|
|
700
700
|
type AptosSignAndSubmitTransactionV1Method = (
|
|
701
|
-
transaction: AnyRawTransaction
|
|
701
|
+
transaction: AnyRawTransaction,
|
|
702
702
|
) => Promise<UserResponse<AptosSignAndSubmitTransactionOutput>>;
|
|
703
703
|
|
|
704
704
|
const signAndSubmitTransactionMethod = this._wallet.features[
|
|
@@ -707,7 +707,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
707
707
|
.signAndSubmitTransaction as unknown as AptosSignAndSubmitTransactionV1Method;
|
|
708
708
|
|
|
709
709
|
const response = (await signAndSubmitTransactionMethod(
|
|
710
|
-
transaction
|
|
710
|
+
transaction,
|
|
711
711
|
)) as UserResponse<AptosSignAndSubmitTransactionOutput>;
|
|
712
712
|
|
|
713
713
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
@@ -800,7 +800,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
800
800
|
"aptos:signTransaction"
|
|
801
801
|
].signTransaction(
|
|
802
802
|
transactionOrPayload,
|
|
803
|
-
asFeePayer
|
|
803
|
+
asFeePayer,
|
|
804
804
|
)) as UserResponse<AccountAuthenticator>;
|
|
805
805
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
806
806
|
throw new WalletConnectionError("User has rejected the request")
|
|
@@ -836,7 +836,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
836
836
|
AptosSignTransactionMethodV1_1;
|
|
837
837
|
|
|
838
838
|
const response = (await walletSignTransactionMethod(
|
|
839
|
-
signTransactionV1_1StandardInput
|
|
839
|
+
signTransactionV1_1StandardInput,
|
|
840
840
|
)) as UserResponse<AptosSignTransactionOutputV1_1>;
|
|
841
841
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
842
842
|
throw new WalletConnectionError("User has rejected the request")
|
|
@@ -855,13 +855,14 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
855
855
|
sender: this._account.address,
|
|
856
856
|
data: transactionOrPayload.data,
|
|
857
857
|
options: transactionOrPayload.options,
|
|
858
|
+
withFeePayer: transactionOrPayload.withFeePayer,
|
|
858
859
|
});
|
|
859
860
|
|
|
860
861
|
const response = (await this._wallet?.features[
|
|
861
862
|
"aptos:signTransaction"
|
|
862
863
|
].signTransaction(
|
|
863
864
|
transaction,
|
|
864
|
-
asFeePayer
|
|
865
|
+
asFeePayer,
|
|
865
866
|
)) as UserResponse<AccountAuthenticator>;
|
|
866
867
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
867
868
|
throw new WalletConnectionError("User has rejected the request")
|
|
@@ -888,7 +889,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
888
889
|
* @throws WalletSignMessageError
|
|
889
890
|
*/
|
|
890
891
|
async signMessage(
|
|
891
|
-
message: AptosSignMessageInput
|
|
892
|
+
message: AptosSignMessageInput,
|
|
892
893
|
): Promise<AptosSignMessageOutput> {
|
|
893
894
|
try {
|
|
894
895
|
this.ensureWalletExists(this._wallet);
|
|
@@ -914,7 +915,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
914
915
|
* @returns PendingTransactionResponse
|
|
915
916
|
*/
|
|
916
917
|
async submitTransaction(
|
|
917
|
-
transaction: InputSubmitTransactionData
|
|
918
|
+
transaction: InputSubmitTransactionData,
|
|
918
919
|
): Promise<PendingTransactionResponse> {
|
|
919
920
|
// The standard does not support submitTransaction, so we use the adapter to submit the transaction
|
|
920
921
|
try {
|
|
@@ -960,7 +961,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
960
961
|
await this.setAnsName();
|
|
961
962
|
this.recordEvent("account_change");
|
|
962
963
|
this.emit("accountChange", this._account);
|
|
963
|
-
}
|
|
964
|
+
},
|
|
964
965
|
);
|
|
965
966
|
} catch (error: any) {
|
|
966
967
|
const errMsg = generalizedErrorMessage(error);
|
|
@@ -981,7 +982,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
981
982
|
this.setNetwork(data);
|
|
982
983
|
await this.setAnsName();
|
|
983
984
|
this.emit("networkChange", this._network);
|
|
984
|
-
}
|
|
985
|
+
},
|
|
985
986
|
);
|
|
986
987
|
} catch (error: any) {
|
|
987
988
|
const errMsg = generalizedErrorMessage(error);
|
|
@@ -1015,7 +1016,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1015
1016
|
if (this._wallet.features["aptos:changeNetwork"]) {
|
|
1016
1017
|
const response =
|
|
1017
1018
|
await this._wallet.features["aptos:changeNetwork"].changeNetwork(
|
|
1018
|
-
networkInfo
|
|
1019
|
+
networkInfo,
|
|
1019
1020
|
);
|
|
1020
1021
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
1021
1022
|
throw new WalletConnectionError("User has rejected the request")
|
|
@@ -1025,7 +1026,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1025
1026
|
}
|
|
1026
1027
|
|
|
1027
1028
|
throw new WalletChangeNetworkError(
|
|
1028
|
-
`${this._wallet.name} does not support changing network request
|
|
1029
|
+
`${this._wallet.name} does not support changing network request`,
|
|
1029
1030
|
).message;
|
|
1030
1031
|
} catch (error: any) {
|
|
1031
1032
|
const errMsg = generalizedErrorMessage(error);
|
|
@@ -1054,13 +1055,15 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1054
1055
|
}
|
|
1055
1056
|
|
|
1056
1057
|
const aptosConfig = getAptosConfig(this._network, this._dappConfig);
|
|
1057
|
-
const signingMessage = new TextEncoder().encode(
|
|
1058
|
+
const signingMessage = new TextEncoder().encode(
|
|
1059
|
+
response.args.fullMessage,
|
|
1060
|
+
);
|
|
1058
1061
|
if ("verifySignatureAsync" in (this._account.publicKey as Object)) {
|
|
1059
1062
|
return await this._account.publicKey.verifySignatureAsync({
|
|
1060
1063
|
aptosConfig,
|
|
1061
1064
|
message: signingMessage,
|
|
1062
1065
|
signature: response.args.signature,
|
|
1063
|
-
options: { throwErrorWithReason: true }
|
|
1066
|
+
options: { throwErrorWithReason: true },
|
|
1064
1067
|
});
|
|
1065
1068
|
}
|
|
1066
1069
|
return this._account.publicKey.verifySignature({
|
package/src/sdkWallets.ts
CHANGED
|
@@ -37,7 +37,7 @@ export function getSDKWallets(dappConfig?: DappConfig) {
|
|
|
37
37
|
network: dappConfig.network as Network.MAINNET | Network.TESTNET,
|
|
38
38
|
manifestURL: dappConfig.mizuwallet.manifestURL,
|
|
39
39
|
appId: dappConfig.mizuwallet.appId,
|
|
40
|
-
})
|
|
40
|
+
}) as any // TODO: fix type mismatch
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/utils/helpers.ts
CHANGED
|
@@ -16,17 +16,17 @@ import { InputTransactionData } from "./types";
|
|
|
16
16
|
|
|
17
17
|
export function isMobile(): boolean {
|
|
18
18
|
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(
|
|
19
|
-
navigator.userAgent
|
|
19
|
+
navigator.userAgent,
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function isInAppBrowser(): boolean {
|
|
24
24
|
const isIphone = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(
|
|
25
|
-
navigator.userAgent
|
|
25
|
+
navigator.userAgent,
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
const isAndroid = /(Android).*Version\/[\d.]+.*Chrome\/[^\s]+ Mobile/i.test(
|
|
29
|
-
navigator.userAgent
|
|
29
|
+
navigator.userAgent,
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
return isIphone || isAndroid;
|
|
@@ -56,7 +56,7 @@ export function generalizedErrorMessage(error: any): string {
|
|
|
56
56
|
*/
|
|
57
57
|
export const getAptosConfig = (
|
|
58
58
|
networkInfo: NetworkInfo | null,
|
|
59
|
-
dappConfig: DappConfig | undefined
|
|
59
|
+
dappConfig: DappConfig | undefined,
|
|
60
60
|
): AptosConfig => {
|
|
61
61
|
if (!networkInfo) {
|
|
62
62
|
throw new Error("Undefined network");
|
|
@@ -84,7 +84,7 @@ export const getAptosConfig = (
|
|
|
84
84
|
|
|
85
85
|
if (networkInfo.url) {
|
|
86
86
|
const isKnownNetwork = Object.values(knownNetworks).includes(
|
|
87
|
-
networkInfo.url
|
|
87
|
+
networkInfo.url,
|
|
88
88
|
);
|
|
89
89
|
|
|
90
90
|
if (isKnownNetwork) {
|
|
@@ -97,7 +97,7 @@ export const getAptosConfig = (
|
|
|
97
97
|
|
|
98
98
|
// Custom networks are not supported, please ensure that the wallet is returning the appropriate network Mainnet, Testnet, Devnet, Local
|
|
99
99
|
throw new Error(
|
|
100
|
-
`Invalid network, network ${networkInfo.name} not supported with Aptos wallet adapter to prevent user from using an unexpected network
|
|
100
|
+
`Invalid network, network ${networkInfo.name} not supported with Aptos wallet adapter to prevent user from using an unexpected network.`,
|
|
101
101
|
);
|
|
102
102
|
};
|
|
103
103
|
|
|
@@ -108,7 +108,7 @@ export const getAptosConfig = (
|
|
|
108
108
|
* @returns boolean
|
|
109
109
|
*/
|
|
110
110
|
export const isAptosNetwork = (
|
|
111
|
-
networkInfo: NetworkInfo | StandardNetworkInfo | null
|
|
111
|
+
networkInfo: NetworkInfo | StandardNetworkInfo | null,
|
|
112
112
|
): boolean => {
|
|
113
113
|
if (!networkInfo) {
|
|
114
114
|
throw new Error("Undefined network");
|
|
@@ -138,7 +138,7 @@ export const fetchDevnetChainId = async (): Promise<number> => {
|
|
|
138
138
|
* as a string, this function converts the string to Uint8Array.
|
|
139
139
|
*/
|
|
140
140
|
export const handlePublishPackageTransaction = (
|
|
141
|
-
transactionInput: InputTransactionData
|
|
141
|
+
transactionInput: InputTransactionData,
|
|
142
142
|
) => {
|
|
143
143
|
// convert the first argument, metadataBytes, to uint8array if is a string
|
|
144
144
|
let metadataBytes = transactionInput.data.functionArguments[0];
|
|
@@ -157,7 +157,7 @@ export const handlePublishPackageTransaction = (
|
|
|
157
157
|
});
|
|
158
158
|
} else {
|
|
159
159
|
throw new WalletSignAndSubmitMessageError(
|
|
160
|
-
"The bytecode argument must be an array."
|
|
160
|
+
"The bytecode argument must be an array.",
|
|
161
161
|
).message;
|
|
162
162
|
}
|
|
163
163
|
|
package/src/utils/types.ts
CHANGED
|
@@ -25,15 +25,16 @@ export interface AptosStandardSupportedWallet {
|
|
|
25
25
|
|
|
26
26
|
// Update this with the name of your wallet when you create a new wallet plugin.
|
|
27
27
|
export type AvailableWallets =
|
|
28
|
+
| "Continue with Apple"
|
|
29
|
+
| "Continue with Google"
|
|
30
|
+
| "MSafe"
|
|
31
|
+
| "Mizu Wallet"
|
|
28
32
|
| "Nightly"
|
|
33
|
+
| "OKX Wallet"
|
|
29
34
|
| "Petra"
|
|
30
|
-
| "T wallet"
|
|
31
35
|
| "Pontem Wallet"
|
|
32
|
-
| "
|
|
33
|
-
| "
|
|
34
|
-
| "Continue with Google"
|
|
35
|
-
| "Continue with Apple"
|
|
36
|
-
| "MSafe Wallet";
|
|
36
|
+
| "Rimosafe"
|
|
37
|
+
| "T wallet";
|
|
37
38
|
|
|
38
39
|
export type InputTransactionData = {
|
|
39
40
|
sender?: AccountAddressInput;
|
|
@@ -42,6 +43,7 @@ export type InputTransactionData = {
|
|
|
42
43
|
expirationSecondsFromNow?: number;
|
|
43
44
|
expirationTimestamp?: number;
|
|
44
45
|
};
|
|
46
|
+
withFeePayer?: boolean;
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
export type WalletInfo = {
|
|
@@ -11,8 +11,8 @@ import { isRedirectable } from "./helpers";
|
|
|
11
11
|
export function partitionWallets(
|
|
12
12
|
wallets: ReadonlyArray<AdapterWallet | AdapterNotDetectedWallet>,
|
|
13
13
|
partitionFunction: (
|
|
14
|
-
wallet: AdapterWallet | AdapterNotDetectedWallet
|
|
15
|
-
) => boolean = isInstalledOrLoadable
|
|
14
|
+
wallet: AdapterWallet | AdapterNotDetectedWallet,
|
|
15
|
+
) => boolean = isInstalledOrLoadable,
|
|
16
16
|
) {
|
|
17
17
|
const defaultWallets: Array<AdapterWallet> = [];
|
|
18
18
|
const moreWallets: Array<AdapterNotDetectedWallet> = [];
|
|
@@ -27,7 +27,7 @@ export function partitionWallets(
|
|
|
27
27
|
|
|
28
28
|
/** Returns true if the wallet is installed or loadable. */
|
|
29
29
|
export function isInstalledOrLoadable(
|
|
30
|
-
wallet: AdapterWallet | AdapterNotDetectedWallet
|
|
30
|
+
wallet: AdapterWallet | AdapterNotDetectedWallet,
|
|
31
31
|
) {
|
|
32
32
|
return wallet.readyState === WalletReadyState.Installed;
|
|
33
33
|
}
|
|
@@ -37,7 +37,7 @@ export function isInstalledOrLoadable(
|
|
|
37
37
|
* This can be used to decide whether to show a "Connect" button or "Install" link in the UI.
|
|
38
38
|
*/
|
|
39
39
|
export function isInstallRequired(
|
|
40
|
-
wallet: AdapterWallet | AdapterNotDetectedWallet
|
|
40
|
+
wallet: AdapterWallet | AdapterNotDetectedWallet,
|
|
41
41
|
) {
|
|
42
42
|
const isWalletReady = isInstalledOrLoadable(wallet);
|
|
43
43
|
const isMobile = !isWalletReady && isRedirectable();
|
|
@@ -62,11 +62,11 @@ export function isAptosConnectWallet(wallet: WalletInfo | AdapterWallet) {
|
|
|
62
62
|
* Aptos Connect is a web wallet that uses social login to create accounts on the blockchain.
|
|
63
63
|
*/
|
|
64
64
|
export function getAptosConnectWallets(
|
|
65
|
-
wallets: ReadonlyArray<AdapterWallet | AdapterNotDetectedWallet
|
|
65
|
+
wallets: ReadonlyArray<AdapterWallet | AdapterNotDetectedWallet>,
|
|
66
66
|
) {
|
|
67
67
|
const { defaultWallets, moreWallets } = partitionWallets(
|
|
68
68
|
wallets,
|
|
69
|
-
isAptosConnectWallet
|
|
69
|
+
isAptosConnectWallet,
|
|
70
70
|
);
|
|
71
71
|
return { aptosConnectWallets: defaultWallets, otherWallets: moreWallets };
|
|
72
72
|
}
|
|
@@ -77,12 +77,12 @@ export interface WalletSortingOptions {
|
|
|
77
77
|
/** An optional function for sorting wallets that are currently installed or loadable. */
|
|
78
78
|
sortAvailableWallets?: (
|
|
79
79
|
a: AdapterWallet | AdapterNotDetectedWallet,
|
|
80
|
-
b: AdapterWallet | AdapterNotDetectedWallet
|
|
80
|
+
b: AdapterWallet | AdapterNotDetectedWallet,
|
|
81
81
|
) => number;
|
|
82
82
|
/** An optional function for sorting wallets that are NOT currently installed or loadable. */
|
|
83
83
|
sortInstallableWallets?: (
|
|
84
84
|
a: AdapterWallet | AdapterNotDetectedWallet,
|
|
85
|
-
b: AdapterWallet | AdapterNotDetectedWallet
|
|
85
|
+
b: AdapterWallet | AdapterNotDetectedWallet,
|
|
86
86
|
) => number;
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -101,7 +101,7 @@ export interface WalletSortingOptions {
|
|
|
101
101
|
*/
|
|
102
102
|
export function groupAndSortWallets(
|
|
103
103
|
wallets: ReadonlyArray<AdapterWallet | AdapterNotDetectedWallet>,
|
|
104
|
-
options?: WalletSortingOptions
|
|
104
|
+
options?: WalletSortingOptions,
|
|
105
105
|
) {
|
|
106
106
|
const { aptosConnectWallets, otherWallets } = getAptosConnectWallets(wallets);
|
|
107
107
|
const { defaultWallets, moreWallets } = partitionWallets(otherWallets);
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const WALLET_ADAPTER_CORE_VERSION = "5.4.
|
|
1
|
+
export const WALLET_ADAPTER_CORE_VERSION = "5.4.2";
|