@aptos-labs/wallet-adapter-core 5.4.1 → 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/utils/helpers.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -4
- package/src/WalletCore.ts +3 -0
- package/src/sdkWallets.ts +0 -16
- package/src/utils/helpers.ts +9 -9
- package/src/utils/walletSelector.ts +9 -9
- 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/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/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,16 +41,15 @@
|
|
|
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",
|
|
50
49
|
"tweetnacl": "^1.0.3"
|
|
51
50
|
},
|
|
52
51
|
"peerDependencies": {
|
|
53
|
-
"@aptos-labs/ts-sdk": "^1.38.0"
|
|
52
|
+
"@aptos-labs/ts-sdk": "^1.38.0 || ^2.0.0"
|
|
54
53
|
},
|
|
55
54
|
"files": [
|
|
56
55
|
"dist",
|
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;
|
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
|
-
})
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
27
|
}
|
|
44
28
|
|
|
45
29
|
// Push production wallet if env is production, otherwise use dev wallet
|
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
|
|
|
@@ -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.
|
|
1
|
+
export const WALLET_ADAPTER_CORE_VERSION = "5.5.0";
|