@aptos-labs/wallet-adapter-core 5.2.0 → 5.4.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 +4 -0
- package/dist/WalletCore.d.ts.map +1 -1
- package/dist/index.js +2213 -1000
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2073 -980
- 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/version.d.ts +1 -1
- package/package.json +6 -4
- package/src/WalletCore.ts +25 -48
- package/src/sdkWallets.ts +10 -0
- package/src/utils/types.ts +4 -1
- package/src/version.ts +1 -1
|
@@ -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,SAAS,GACT,OAAO,GACP,UAAU,GACV,eAAe,GACf,aAAa,GACb,sBAAsB,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;CAC3B;AAGD,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,OAAO,GACP,UAAU,GACV,eAAe,GACf,aAAa,GACb,YAAY,GACZ,sBAAsB,GACtB,qBAAqB,GACrB,cAAc,CAAC;AAEnB,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;CACH,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.4.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/wallet-adapter-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Aptos Wallet Adapter Core",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
9
|
"exports": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"require": "./dist/index.js",
|
|
11
|
-
"import": "./dist/index.mjs"
|
|
12
|
-
"types": "./dist/index.d.ts"
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
"Aptos Wallet"
|
|
29
29
|
],
|
|
30
30
|
"devDependencies": {
|
|
31
|
+
"@swc/core": "^1.11.16",
|
|
31
32
|
"@types/jest": "^29.2.4",
|
|
32
33
|
"@types/node": "^20.10.4",
|
|
33
34
|
"eslint": "^8.15.0",
|
|
34
35
|
"jest": "^29.3.1",
|
|
35
36
|
"ts-jest": "^29.0.3",
|
|
36
|
-
"tsup": "^
|
|
37
|
+
"tsup": "^8.4.0",
|
|
37
38
|
"typescript": "^4.5.3",
|
|
38
39
|
"@aptos-labs/eslint-config-adapter": "0.0.2",
|
|
39
40
|
"@aptos-labs/wallet-adapter-tsconfig": "0.0.2"
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"@aptos-labs/wallet-standard": "^0.3.0",
|
|
44
45
|
"@atomrigslab/aptos-wallet-adapter": "^0.1.20",
|
|
45
46
|
"@mizuwallet-sdk/aptos-wallet-adapter": "^0.3.2",
|
|
47
|
+
"@msafe/aptos-aip62-wallet": "^1.0.17",
|
|
46
48
|
"buffer": "^6.0.3",
|
|
47
49
|
"eventemitter3": "^4.0.7",
|
|
48
50
|
"tweetnacl": "^1.0.3"
|
package/src/WalletCore.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
AnyPublicKeyVariant,
|
|
7
7
|
AnyRawTransaction,
|
|
8
8
|
Aptos,
|
|
9
|
+
Ed25519PublicKey,
|
|
9
10
|
InputSubmitTransactionData,
|
|
10
11
|
MultiEd25519PublicKey,
|
|
11
12
|
MultiEd25519Signature,
|
|
@@ -116,6 +117,10 @@ export interface DappConfig {
|
|
|
116
117
|
manifestURL: string;
|
|
117
118
|
appId?: string;
|
|
118
119
|
};
|
|
120
|
+
msafeWalletConfig?: {
|
|
121
|
+
appId?: string;
|
|
122
|
+
appUrl?: string;
|
|
123
|
+
};
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
export declare interface WalletCoreEvents {
|
|
@@ -1039,57 +1044,29 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
|
|
|
1039
1044
|
this.ensureAccountExists(this._account);
|
|
1040
1045
|
this.recordEvent("sign_message_and_verify");
|
|
1041
1046
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
].signMessage(message)) as UserResponse<AptosSignMessageOutput>;
|
|
1047
|
-
|
|
1048
|
-
if (response.status === UserResponseStatus.REJECTED) {
|
|
1049
|
-
throw new WalletConnectionError("Failed to sign a message").message;
|
|
1050
|
-
}
|
|
1047
|
+
// sign the message
|
|
1048
|
+
const response = (await this._wallet.features[
|
|
1049
|
+
"aptos:signMessage"
|
|
1050
|
+
].signMessage(message)) as UserResponse<AptosSignMessageOutput>;
|
|
1051
1051
|
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
this._account.publicKey instanceof AnyPublicKey &&
|
|
1056
|
-
this._account.publicKey.variant === AnyPublicKeyVariant.Keyless
|
|
1057
|
-
) {
|
|
1058
|
-
return true;
|
|
1059
|
-
}
|
|
1052
|
+
if (response.status === UserResponseStatus.REJECTED) {
|
|
1053
|
+
throw new WalletConnectionError("Failed to sign a message").message;
|
|
1054
|
+
}
|
|
1060
1055
|
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
const bitmap = signature.bitmap;
|
|
1071
|
-
if (bitmap) {
|
|
1072
|
-
const minKeysRequired = this._account.publicKey.threshold;
|
|
1073
|
-
if (signature.signatures.length < minKeysRequired) {
|
|
1074
|
-
verified = false;
|
|
1075
|
-
} else {
|
|
1076
|
-
verified = this._account.publicKey.verifySignature({
|
|
1077
|
-
message: new TextEncoder().encode(fullMessage),
|
|
1078
|
-
signature,
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
} else {
|
|
1083
|
-
verified = this._account.publicKey.verifySignature({
|
|
1084
|
-
message: new TextEncoder().encode(response.args.fullMessage),
|
|
1085
|
-
signature: response.args.signature,
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
return verified;
|
|
1089
|
-
} catch (error: any) {
|
|
1090
|
-
const errMsg = generalizedErrorMessage(error);
|
|
1091
|
-
throw new WalletSignMessageAndVerifyError(errMsg).message;
|
|
1056
|
+
const aptosConfig = getAptosConfig(this._network, this._dappConfig);
|
|
1057
|
+
const signingMessage = new TextEncoder().encode(response.args.fullMessage);
|
|
1058
|
+
if ("verifySignatureAsync" in (this._account.publicKey as Object)) {
|
|
1059
|
+
return await this._account.publicKey.verifySignatureAsync({
|
|
1060
|
+
aptosConfig,
|
|
1061
|
+
message: signingMessage,
|
|
1062
|
+
signature: response.args.signature,
|
|
1063
|
+
options: { throwErrorWithReason: true }
|
|
1064
|
+
});
|
|
1092
1065
|
}
|
|
1066
|
+
return this._account.publicKey.verifySignature({
|
|
1067
|
+
message: signingMessage,
|
|
1068
|
+
signature: response.args.signature,
|
|
1069
|
+
});
|
|
1093
1070
|
} catch (error: any) {
|
|
1094
1071
|
const errMsg = generalizedErrorMessage(error);
|
|
1095
1072
|
throw new WalletSignMessageAndVerifyError(errMsg).message;
|
package/src/sdkWallets.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
import { Network } from "@aptos-labs/ts-sdk";
|
|
6
6
|
import { DevTWallet, TWallet } from "@atomrigslab/aptos-wallet-adapter";
|
|
7
7
|
import { MizuWallet } from "@mizuwallet-sdk/aptos-wallet-adapter";
|
|
8
|
+
import { MSafeWallet } from "@msafe/aptos-aip62-wallet";
|
|
8
9
|
import { DappConfig, AdapterWallet } from "./WalletCore";
|
|
9
10
|
|
|
10
11
|
export function getSDKWallets(dappConfig?: DappConfig) {
|
|
@@ -50,6 +51,15 @@ export function getSDKWallets(dappConfig?: DappConfig) {
|
|
|
50
51
|
sdkWallets.push(new DevTWallet() as any);
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
if (dappConfig?.network) {
|
|
55
|
+
sdkWallets.push(
|
|
56
|
+
new MSafeWallet({
|
|
57
|
+
...dappConfig?.msafeWalletConfig,
|
|
58
|
+
network: dappConfig.network,
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
53
63
|
// Add new SDK wallet plugins (ones that should be installed as packages) here:
|
|
54
64
|
// Ex. sdkWallets.push(new YourSDKWallet(dappConfig))
|
|
55
65
|
|
package/src/utils/types.ts
CHANGED
|
@@ -30,7 +30,10 @@ export type AvailableWallets =
|
|
|
30
30
|
| "T wallet"
|
|
31
31
|
| "Pontem Wallet"
|
|
32
32
|
| "Mizu Wallet"
|
|
33
|
-
| "
|
|
33
|
+
| "OKX Wallet"
|
|
34
|
+
| "Continue with Google"
|
|
35
|
+
| "Continue with Apple"
|
|
36
|
+
| "MSafe Wallet";
|
|
34
37
|
|
|
35
38
|
export type InputTransactionData = {
|
|
36
39
|
sender?: AccountAddressInput;
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const WALLET_ADAPTER_CORE_VERSION = "5.
|
|
1
|
+
export const WALLET_ADAPTER_CORE_VERSION = "5.4.0";
|