@aptos-labs/wallet-adapter-core 4.24.0 → 4.25.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/AIP62StandardWallets/registry.d.ts.map +1 -1
- package/dist/LegacyWalletPlugins/conversion.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -8
- package/dist/index.mjs.map +1 -1
- package/dist/utils/helpers.d.ts +1 -1
- package/dist/utils/walletSelector.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/AIP62StandardWallets/WalletStandard.ts +14 -14
- package/src/AIP62StandardWallets/registry.ts +2 -1
- package/src/AIP62StandardWallets/sdkWallets.ts +2 -2
- package/src/LegacyWalletPlugins/WalletCoreV1.ts +16 -16
- package/src/LegacyWalletPlugins/conversion.ts +7 -9
- package/src/LegacyWalletPlugins/types.ts +8 -8
- package/src/WalletCore.ts +31 -31
- package/src/ga/index.ts +1 -1
- package/src/utils/helpers.ts +13 -13
- package/src/utils/scopePollingDetectionStrategy.ts +1 -1
- package/src/utils/walletSelector.ts +6 -4
- package/src/version.ts +1 -1
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare const fetchDevnetChainId: () => Promise<number>;
|
|
|
33
33
|
* as a string, this function converts the string to Uint8Array.
|
|
34
34
|
*/
|
|
35
35
|
export declare const handlePublishPackageTransaction: (transactionInput: InputTransactionData) => {
|
|
36
|
-
metadataBytes: number | bigint | boolean | Uint8Array | import("@aptos-labs/ts-sdk/dist/common/accountAddress-
|
|
36
|
+
metadataBytes: number | bigint | boolean | Uint8Array | import("@aptos-labs/ts-sdk/dist/common/accountAddress-CDtCLtJA").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<EntryFunctionArgumentTypes> | import("@aptos-labs/ts-sdk").MoveOption<EntryFunctionArgumentTypes> | import("@aptos-labs/ts-sdk").MoveString | import("@aptos-labs/ts-sdk").FixedBytes | ArrayBuffer | (EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes)[] | import("@aptos-labs/ts-sdk").MoveVector<import("@aptos-labs/ts-sdk").ScriptFunctionArgumentTypes> | import("@aptos-labs/ts-sdk").Serialized | null | undefined;
|
|
37
37
|
byteCode: (EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes)[];
|
|
38
38
|
};
|
|
39
39
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletSelector.d.ts","sourceRoot":"","sources":["../../src/utils/walletSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,EACtC,iBAAiB,GAAE,
|
|
1
|
+
{"version":3,"file":"walletSelector.d.ts","sourceRoot":"","sources":["../../src/utils/walletSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAI/C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,EACtC,iBAAiB,GAAE,CACjB,MAAM,EAAE,cAAc,KACnB,OAA+B;;;EAWrC;AAED,2DAA2D;AAC3D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,WAK3D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,WAKvD;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,sBAG1D;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,mBAAmB,WAI1D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC;;;EAM5E;AAED,MAAM,WAAW,oBAAoB;IACnC,8DAA8D;IAC9D,uBAAuB,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,KAAK,MAAM,CAAC;IAC3E,yFAAyF;IACzF,oBAAoB,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,KAAK,MAAM,CAAC;IACxE,6FAA6F;IAC7F,sBAAsB,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,KAAK,MAAM,CAAC;CAC3E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,EACtC,OAAO,CAAC,EAAE,oBAAoB;IAgB5B,2EAA2E;;IAE3E,wDAAwD;;IAExD,4DAA4D;;EAG/D"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const WALLET_ADAPTER_CORE_VERSION = "4.
|
|
1
|
+
export declare const WALLET_ADAPTER_CORE_VERSION = "4.25.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -61,14 +61,14 @@ export class WalletStandardCore {
|
|
|
61
61
|
aptos: Aptos,
|
|
62
62
|
account: AccountInfo,
|
|
63
63
|
wallet: Wallet,
|
|
64
|
-
standardWallets: ReadonlyArray<AptosStandardWallet
|
|
64
|
+
standardWallets: ReadonlyArray<AptosStandardWallet>,
|
|
65
65
|
): Promise<AptosSignAndSubmitTransactionOutput> {
|
|
66
66
|
try {
|
|
67
67
|
// need to find the standard wallet type to do the
|
|
68
68
|
// next features check
|
|
69
69
|
const standardWallet = standardWallets.find(
|
|
70
70
|
(standardWallet: AptosStandardWallet) =>
|
|
71
|
-
wallet.name === standardWallet.name
|
|
71
|
+
wallet.name === standardWallet.name,
|
|
72
72
|
);
|
|
73
73
|
|
|
74
74
|
// check for backward compatibility. before version 1.1.0 the standard expected
|
|
@@ -83,7 +83,7 @@ export class WalletStandardCore {
|
|
|
83
83
|
options: transactionInput.options,
|
|
84
84
|
});
|
|
85
85
|
const response = (await wallet.signAndSubmitTransaction!(
|
|
86
|
-
transaction
|
|
86
|
+
transaction,
|
|
87
87
|
)) as UserResponse<AptosSignAndSubmitTransactionOutput>;
|
|
88
88
|
|
|
89
89
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
@@ -101,7 +101,7 @@ export class WalletStandardCore {
|
|
|
101
101
|
payload: transactionInput.data,
|
|
102
102
|
};
|
|
103
103
|
const response = (await wallet.signAndSubmitTransaction!(
|
|
104
|
-
transaction
|
|
104
|
+
transaction,
|
|
105
105
|
)) as UserResponse<AptosSignAndSubmitTransactionOutput>;
|
|
106
106
|
|
|
107
107
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
@@ -129,20 +129,20 @@ export class WalletStandardCore {
|
|
|
129
129
|
async signTransaction(
|
|
130
130
|
transaction: AnyRawTransaction,
|
|
131
131
|
wallet: Wallet,
|
|
132
|
-
asFeePayer?: boolean
|
|
133
|
-
): Promise<AptosSignTransactionOutput
|
|
132
|
+
asFeePayer?: boolean,
|
|
133
|
+
): Promise<AptosSignTransactionOutput>;
|
|
134
134
|
async signTransaction(
|
|
135
135
|
input: AptosSignTransactionInputV1_1,
|
|
136
136
|
wallet: Wallet,
|
|
137
|
-
): Promise<AptosSignTransactionOutputV1_1
|
|
137
|
+
): Promise<AptosSignTransactionOutputV1_1>;
|
|
138
138
|
async signTransaction(
|
|
139
139
|
transactionOrInput: AnyRawTransaction | AptosSignTransactionInputV1_1,
|
|
140
140
|
wallet: Wallet,
|
|
141
|
-
asFeePayer?: boolean
|
|
141
|
+
asFeePayer?: boolean,
|
|
142
142
|
): Promise<AptosSignTransactionOutput | AptosSignTransactionOutputV1_1> {
|
|
143
143
|
const response = (await wallet.signTransaction!(
|
|
144
144
|
transactionOrInput,
|
|
145
|
-
asFeePayer
|
|
145
|
+
asFeePayer,
|
|
146
146
|
)) as UserResponse<AptosSignTransactionOutput>;
|
|
147
147
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
148
148
|
throw new WalletConnectionError("User has rejected the request").message;
|
|
@@ -159,11 +159,11 @@ export class WalletStandardCore {
|
|
|
159
159
|
*/
|
|
160
160
|
async signMessage(
|
|
161
161
|
message: AptosSignMessageInput,
|
|
162
|
-
wallet: Wallet
|
|
162
|
+
wallet: Wallet,
|
|
163
163
|
): Promise<AptosSignMessageOutput> {
|
|
164
164
|
try {
|
|
165
165
|
const response = (await wallet.signMessage(
|
|
166
|
-
message
|
|
166
|
+
message,
|
|
167
167
|
)) as UserResponse<AptosSignMessageOutput>;
|
|
168
168
|
if (response.status === UserResponseStatus.REJECTED) {
|
|
169
169
|
throw new WalletConnectionError("User has rejected the request")
|
|
@@ -183,12 +183,12 @@ export class WalletStandardCore {
|
|
|
183
183
|
*/
|
|
184
184
|
async signMessageAndVerify(
|
|
185
185
|
message: AptosSignMessageInput,
|
|
186
|
-
wallet: Wallet
|
|
186
|
+
wallet: Wallet,
|
|
187
187
|
): Promise<boolean> {
|
|
188
188
|
try {
|
|
189
189
|
// sign the message
|
|
190
190
|
const response = (await wallet.signMessage(
|
|
191
|
-
message
|
|
191
|
+
message,
|
|
192
192
|
)) as UserResponse<AptosSignMessageOutput>;
|
|
193
193
|
// standard wallet account() method is a required method
|
|
194
194
|
const account = (await wallet.account!()) as StandardAccountInfo;
|
|
@@ -211,7 +211,7 @@ export class WalletStandardCore {
|
|
|
211
211
|
if (response.args.signature instanceof MultiEd25519Signature) {
|
|
212
212
|
if (!(account.publicKey instanceof MultiEd25519PublicKey)) {
|
|
213
213
|
throw new WalletSignMessageAndVerifyError(
|
|
214
|
-
"Public key and Signature type mismatch"
|
|
214
|
+
"Public key and Signature type mismatch",
|
|
215
215
|
).message;
|
|
216
216
|
}
|
|
217
217
|
const { fullMessage, signature } = response.args;
|
|
@@ -20,10 +20,11 @@ export const aptosStandardSupportedWalletList: Array<AptosStandardSupportedWalle
|
|
|
20
20
|
[
|
|
21
21
|
{
|
|
22
22
|
name: "Nightly" as WalletName<"Nightly">,
|
|
23
|
-
url: "https://
|
|
23
|
+
url: "https://nightly.app/",
|
|
24
24
|
icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyOC4wLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iV2Fyc3R3YV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDg1MS41IDg1MS41IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA4NTEuNSA4NTEuNTsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCgkuc3Qwe2ZpbGw6IzYwNjdGOTt9DQoJLnN0MXtmaWxsOiNGN0Y3Rjc7fQ0KPC9zdHlsZT4NCjxnPg0KCTxnIGlkPSJXYXJzdHdhXzJfMDAwMDAwMTQ2MDk2NTQyNTMxODA5NDY0NjAwMDAwMDg2NDc4NTIwMDIxMTY5MTg2ODhfIj4NCgkJPHBhdGggY2xhc3M9InN0MCIgZD0iTTEyNCwwaDYwMy42YzY4LjUsMCwxMjQsNTUuNSwxMjQsMTI0djYwMy42YzAsNjguNS01NS41LDEyNC0xMjQsMTI0SDEyNGMtNjguNSwwLTEyNC01NS41LTEyNC0xMjRWMTI0DQoJCQlDMCw1NS41LDU1LjUsMCwxMjQsMHoiLz4NCgk8L2c+DQoJPGcgaWQ9IldhcnN0d2FfMyI+DQoJCTxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik02MjMuNSwxNzAuM2MtMzcuNCw1Mi4yLTg0LjIsODguNC0xMzkuNSwxMTIuNmMtMTkuMi01LjMtMzguOS04LTU4LjMtNy44Yy0xOS40LTAuMi0zOS4xLDIuNi01OC4zLDcuOA0KCQkJYy01NS4zLTI0LjMtMTAyLjEtNjAuMy0xMzkuNS0xMTIuNmMtMTEuMywyOC40LTU0LjgsMTI2LjQtMi42LDI2My40YzAsMC0xNi43LDcxLjUsMTQsMTMyLjljMCwwLDQ0LjQtMjAuMSw3OS43LDguMg0KCQkJYzM2LjksMjkuOSwyNS4xLDU4LjcsNTEuMSw4My41YzIyLjQsMjIuOSw1NS43LDIyLjksNTUuNywyMi45czMzLjMsMCw1NS43LTIyLjhjMjYtMjQuNywxNC4zLTUzLjUsNTEuMS04My41DQoJCQljMzUuMi0yOC4zLDc5LjctOC4yLDc5LjctOC4yYzMwLjYtNjEuNCwxNC0xMzIuOSwxNC0xMzIuOUM2NzguMywyOTYuNyw2MzQuOSwxOTguNyw2MjMuNSwxNzAuM3ogTTI1My4xLDQxNC44DQoJCQljLTI4LjQtNTguMy0zNi4yLTEzOC4zLTE4LjMtMjAxLjVjMjMuNyw2MCw1NS45LDg2LjksOTQuMiwxMTUuM0MzMTIuOCwzNjIuMywyODIuMywzOTQuMSwyNTMuMSw0MTQuOHogTTMzNC44LDUxNy41DQoJCQljLTIyLjQtOS45LTI3LjEtMjkuNC0yNy4xLTI5LjRjMzAuNS0xOS4yLDc1LjQtNC41LDc2LjgsNDAuOUMzNjAuOSw1MTQuNywzNTMsNTI1LjQsMzM0LjgsNTE3LjV6IE00MjUuNyw2NzguNw0KCQkJYy0xNiwwLTI5LTExLjUtMjktMjUuNnMxMy0yNS42LDI5LTI1LjZzMjksMTEuNSwyOSwyNS42QzQ1NC43LDY2Ny4zLDQ0MS43LDY3OC43LDQyNS43LDY3OC43eiBNNTE2LjcsNTE3LjUNCgkJCWMtMTguMiw4LTI2LTIuOC00OS43LDExLjVjMS41LTQ1LjQsNDYuMi02MC4xLDc2LjgtNDAuOUM1NDMuOCw0ODgsNTM5LDUwNy42LDUxNi43LDUxNy41eiBNNTk4LjMsNDE0LjgNCgkJCWMtMjkuMS0yMC43LTU5LjctNTIuNC03Ni04Ni4yYzM4LjMtMjguNCw3MC42LTU1LjQsOTQuMi0xMTUuM0M2MzQuNiwyNzYuNSw2MjYuOCwzNTYuNiw1OTguMyw0MTQuOHoiLz4NCgk8L2c+DQo8L2c+DQo8L3N2Zz4NCg==",
|
|
25
25
|
readyState: WalletReadyState.NotDetected,
|
|
26
26
|
isAIP62Standard: true,
|
|
27
|
+
deeplinkProvider: "nightly://v1?network=aptos&url=",
|
|
27
28
|
},
|
|
28
29
|
{
|
|
29
30
|
name: "Petra" as WalletName<"Petra">,
|
|
@@ -23,7 +23,7 @@ export function getSDKWallets(dappConfig?: DappConfig) {
|
|
|
23
23
|
network: dappConfig?.network,
|
|
24
24
|
dappId: dappConfig?.aptosConnectDappId,
|
|
25
25
|
...dappConfig?.aptosConnect,
|
|
26
|
-
})
|
|
26
|
+
}),
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
if (
|
|
@@ -36,7 +36,7 @@ export function getSDKWallets(dappConfig?: DappConfig) {
|
|
|
36
36
|
network: dappConfig.network as any,
|
|
37
37
|
manifestURL: dappConfig.mizuwallet.manifestURL,
|
|
38
38
|
appId: dappConfig.mizuwallet.appId,
|
|
39
|
-
}) as any
|
|
39
|
+
}) as any,
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -56,7 +56,7 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
|
56
56
|
network: NetworkInfo | null,
|
|
57
57
|
wallet: Wallet,
|
|
58
58
|
transactionInput: InputTransactionData,
|
|
59
|
-
dappConfig?: DappConfig
|
|
59
|
+
dappConfig?: DappConfig,
|
|
60
60
|
) {
|
|
61
61
|
// first check if each argument is a BCS serialized argument
|
|
62
62
|
if (areBCSArguments(payloadData.functionArguments)) {
|
|
@@ -78,7 +78,7 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
|
78
78
|
gas_unit_price: transactionInput.options?.gasUnitPrice
|
|
79
79
|
? BigInt(transactionInput.options?.gasUnitPrice)
|
|
80
80
|
: undefined,
|
|
81
|
-
}
|
|
81
|
+
},
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -105,12 +105,12 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
|
105
105
|
async signAndSubmitTransaction(
|
|
106
106
|
transaction: Types.TransactionPayload,
|
|
107
107
|
wallet: Wallet,
|
|
108
|
-
options?: TransactionOptions
|
|
108
|
+
options?: TransactionOptions,
|
|
109
109
|
): Promise<any> {
|
|
110
110
|
try {
|
|
111
111
|
const response = await (wallet as any).signAndSubmitTransaction(
|
|
112
112
|
transaction,
|
|
113
|
-
options
|
|
113
|
+
options,
|
|
114
114
|
);
|
|
115
115
|
return response;
|
|
116
116
|
} catch (error: any) {
|
|
@@ -130,17 +130,17 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
|
130
130
|
async signAndSubmitBCSTransaction(
|
|
131
131
|
transaction: TxnBuilderTypes.TransactionPayload,
|
|
132
132
|
wallet: Wallet,
|
|
133
|
-
options?: TransactionOptions
|
|
133
|
+
options?: TransactionOptions,
|
|
134
134
|
): Promise<any> {
|
|
135
135
|
if (!("signAndSubmitBCSTransaction" in wallet)) {
|
|
136
136
|
throw new WalletNotSupportedMethod(
|
|
137
|
-
`Submit a BCS Transaction is not supported by ${wallet.name}
|
|
137
|
+
`Submit a BCS Transaction is not supported by ${wallet.name}`,
|
|
138
138
|
).message;
|
|
139
139
|
}
|
|
140
140
|
try {
|
|
141
141
|
const response = await (wallet as any).signAndSubmitBCSTransaction(
|
|
142
142
|
transaction,
|
|
143
|
-
options
|
|
143
|
+
options,
|
|
144
144
|
);
|
|
145
145
|
return response;
|
|
146
146
|
} catch (error: any) {
|
|
@@ -160,12 +160,12 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
|
160
160
|
async signTransaction(
|
|
161
161
|
transaction: Types.TransactionPayload,
|
|
162
162
|
wallet: Wallet,
|
|
163
|
-
options?: TransactionOptions
|
|
163
|
+
options?: TransactionOptions,
|
|
164
164
|
): Promise<Uint8Array | null> {
|
|
165
165
|
try {
|
|
166
166
|
const response = await (wallet as any).signTransaction(
|
|
167
167
|
transaction,
|
|
168
|
-
options
|
|
168
|
+
options,
|
|
169
169
|
);
|
|
170
170
|
return response;
|
|
171
171
|
} catch (error: any) {
|
|
@@ -183,7 +183,7 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
|
183
183
|
async signMessageAndVerify(
|
|
184
184
|
message: SignMessagePayload,
|
|
185
185
|
wallet: Wallet,
|
|
186
|
-
account: AccountInfo
|
|
186
|
+
account: AccountInfo,
|
|
187
187
|
): Promise<boolean> {
|
|
188
188
|
try {
|
|
189
189
|
const response = await wallet.signMessage(message);
|
|
@@ -205,14 +205,14 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
|
205
205
|
} else {
|
|
206
206
|
// Getting an array which marks the keys signing the message with 1, while marking 0 for the keys not being used.
|
|
207
207
|
const bits = Array.from(bitmap).flatMap((n) =>
|
|
208
|
-
Array.from({ length: 8 }).map((_, i) => (n >> i) & 1)
|
|
208
|
+
Array.from({ length: 8 }).map((_, i) => (n >> i) & 1),
|
|
209
209
|
);
|
|
210
210
|
// Filter out indexes of the keys we need
|
|
211
211
|
const index = bits.map((_, i) => i).filter((i) => bits[i]);
|
|
212
212
|
|
|
213
213
|
const publicKeys = account.publicKey as string[];
|
|
214
214
|
const matchedPublicKeys = publicKeys.filter(
|
|
215
|
-
(_: string, i: number) => index.includes(i)
|
|
215
|
+
(_: string, i: number) => index.includes(i),
|
|
216
216
|
);
|
|
217
217
|
|
|
218
218
|
verified = true;
|
|
@@ -220,7 +220,7 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
|
220
220
|
const isSigVerified = nacl.sign.detached.verify(
|
|
221
221
|
Buffer.from(fullMessage),
|
|
222
222
|
Buffer.from((signature as string[])[i], "hex"),
|
|
223
|
-
Buffer.from(matchedPublicKeys[i], "hex")
|
|
223
|
+
Buffer.from(matchedPublicKeys[i], "hex"),
|
|
224
224
|
); // `isSigVerified` should be `true` for every signature
|
|
225
225
|
|
|
226
226
|
if (!isSigVerified) {
|
|
@@ -237,16 +237,16 @@ export class WalletCoreV1 extends EventEmitter<WalletCoreEvents> {
|
|
|
237
237
|
// single sig wallets
|
|
238
238
|
// support for when address doesnt have hex prefix (0x)
|
|
239
239
|
const currentAccountPublicKey = new HexString(
|
|
240
|
-
account.publicKey as string
|
|
240
|
+
account.publicKey as string,
|
|
241
241
|
);
|
|
242
242
|
// support for when address doesnt have hex prefix (0x)
|
|
243
243
|
const signature = new HexString(
|
|
244
|
-
(response as SignMessageResponse).signature as string
|
|
244
|
+
(response as SignMessageResponse).signature as string,
|
|
245
245
|
);
|
|
246
246
|
verified = nacl.sign.detached.verify(
|
|
247
247
|
Buffer.from((response as SignMessageResponse).fullMessage),
|
|
248
248
|
Buffer.from(signature.noPrefix(), "hex"),
|
|
249
|
-
Buffer.from(currentAccountPublicKey.noPrefix(), "hex")
|
|
249
|
+
Buffer.from(currentAccountPublicKey.noPrefix(), "hex"),
|
|
250
250
|
);
|
|
251
251
|
}
|
|
252
252
|
return verified;
|
|
@@ -16,7 +16,7 @@ import { NetworkInfo } from "./types";
|
|
|
16
16
|
|
|
17
17
|
// old => new
|
|
18
18
|
export function convertNetwork(
|
|
19
|
-
networkInfo: NetworkInfo | StandardNetworkInfo | null
|
|
19
|
+
networkInfo: NetworkInfo | StandardNetworkInfo | null,
|
|
20
20
|
): Network {
|
|
21
21
|
switch (networkInfo?.name) {
|
|
22
22
|
case "mainnet" as Network:
|
|
@@ -34,14 +34,14 @@ export function convertNetwork(
|
|
|
34
34
|
|
|
35
35
|
// new => old
|
|
36
36
|
export function convertV2TransactionPayloadToV1BCSPayload(
|
|
37
|
-
payload: TransactionPayload
|
|
37
|
+
payload: TransactionPayload,
|
|
38
38
|
): TxnBuilderTypes.TransactionPayload {
|
|
39
39
|
const deserializer = new BCS.Deserializer(payload.bcsToBytes());
|
|
40
40
|
return TxnBuilderTypes.TransactionPayload.deserialize(deserializer);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export function convertV2PayloadToV1JSONPayload(
|
|
44
|
-
payload: InputGenerateTransactionPayloadData
|
|
44
|
+
payload: InputGenerateTransactionPayloadData,
|
|
45
45
|
): Types.TransactionPayload {
|
|
46
46
|
if ("bytecode" in payload) {
|
|
47
47
|
// is a script payload
|
|
@@ -54,7 +54,7 @@ export function convertV2PayloadToV1JSONPayload(
|
|
|
54
54
|
return typeTag.toString();
|
|
55
55
|
}
|
|
56
56
|
return typeTag;
|
|
57
|
-
}
|
|
57
|
+
},
|
|
58
58
|
);
|
|
59
59
|
const newPayload: Types.TransactionPayload = {
|
|
60
60
|
type: "multisig_payload",
|
|
@@ -73,7 +73,7 @@ export function convertV2PayloadToV1JSONPayload(
|
|
|
73
73
|
return typeTag.toString();
|
|
74
74
|
}
|
|
75
75
|
return typeTag;
|
|
76
|
-
}
|
|
76
|
+
},
|
|
77
77
|
);
|
|
78
78
|
const newPayload: Types.TransactionPayload = {
|
|
79
79
|
type: "entry_function_payload",
|
|
@@ -86,9 +86,7 @@ export function convertV2PayloadToV1JSONPayload(
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
export function convertPayloadInputV1ToV2(
|
|
90
|
-
inputV1: Types.TransactionPayload
|
|
91
|
-
) {
|
|
89
|
+
export function convertPayloadInputV1ToV2(inputV1: Types.TransactionPayload) {
|
|
92
90
|
if ("function" in inputV1) {
|
|
93
91
|
const inputV2: InputEntryFunctionData | InputMultiSigData = {
|
|
94
92
|
function: inputV1.function as MoveFunctionId,
|
|
@@ -103,7 +101,7 @@ export function convertPayloadInputV1ToV2(
|
|
|
103
101
|
|
|
104
102
|
export async function generateTransactionPayloadFromV1Input(
|
|
105
103
|
aptosConfig: AptosConfig,
|
|
106
|
-
inputV1: Types.TransactionPayload
|
|
104
|
+
inputV1: Types.TransactionPayload,
|
|
107
105
|
): Promise<TransactionPayloadEntryFunction> {
|
|
108
106
|
if ("function" in inputV1) {
|
|
109
107
|
const inputV2 = convertPayloadInputV1ToV2(inputV1);
|
|
@@ -98,11 +98,11 @@ export interface SignMessageResponse {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
export type OnNetworkChange = (
|
|
101
|
-
callBack: (networkInfo: NetworkInfo | StandardNetworkInfo) => Promise<void
|
|
101
|
+
callBack: (networkInfo: NetworkInfo | StandardNetworkInfo) => Promise<void>,
|
|
102
102
|
) => Promise<void>;
|
|
103
103
|
|
|
104
104
|
export type OnAccountChange = (
|
|
105
|
-
callBack: (accountInfo: AccountInfo | StandardAccountInfo) => Promise<any
|
|
105
|
+
callBack: (accountInfo: AccountInfo | StandardAccountInfo) => Promise<any>,
|
|
106
106
|
) => Promise<void>;
|
|
107
107
|
|
|
108
108
|
export interface AdapterPluginEvents {
|
|
@@ -130,21 +130,21 @@ export interface AdapterPluginProps<Name extends string = string> {
|
|
|
130
130
|
| InputTransactionData
|
|
131
131
|
| AnyRawTransaction
|
|
132
132
|
| AptosSignAndSubmitTransactionInput,
|
|
133
|
-
options?: InputGenerateTransactionOptions
|
|
133
|
+
options?: InputGenerateTransactionOptions,
|
|
134
134
|
): Promise<
|
|
135
135
|
| { hash: Types.HexEncodedBytes; output?: any }
|
|
136
136
|
| PendingTransactionResponse
|
|
137
137
|
| UserResponse<AptosSignAndSubmitTransactionOutput>
|
|
138
138
|
>;
|
|
139
139
|
submitTransaction?(
|
|
140
|
-
transaction: InputSubmitTransactionData
|
|
140
|
+
transaction: InputSubmitTransactionData,
|
|
141
141
|
): Promise<PendingTransactionResponse>;
|
|
142
142
|
signMessage<T extends SignMessagePayload>(
|
|
143
|
-
message: T
|
|
143
|
+
message: T,
|
|
144
144
|
): Promise<SignMessageResponse | UserResponse<AptosSignMessageOutput>>;
|
|
145
145
|
signTransaction?( // `any` type for backwards compatibility, especially for identity connect
|
|
146
146
|
transactionOrPayload: any,
|
|
147
|
-
optionsOrAsFeePayer?: any
|
|
147
|
+
optionsOrAsFeePayer?: any,
|
|
148
148
|
): Promise<any>;
|
|
149
149
|
account?: () => Promise<AccountInfo | StandardAccountInfo>;
|
|
150
150
|
changeNetwork?: AptosChangeNetworkMethod;
|
|
@@ -177,12 +177,12 @@ export interface PluginProvider {
|
|
|
177
177
|
disconnect: () => Promise<void>;
|
|
178
178
|
signAndSubmitTransaction: (
|
|
179
179
|
transaction: any,
|
|
180
|
-
options?: any
|
|
180
|
+
options?: any,
|
|
181
181
|
) => Promise<{ hash: Types.HexEncodedBytes } | AptosWalletErrorResult>;
|
|
182
182
|
signMessage: (message: SignMessagePayload) => Promise<SignMessageResponse>;
|
|
183
183
|
network: () => Promise<NetworkInfo>;
|
|
184
184
|
onAccountChange: (
|
|
185
|
-
listener: (newAddress: AccountInfo) => Promise<void
|
|
185
|
+
listener: (newAddress: AccountInfo) => Promise<void>,
|
|
186
186
|
) => Promise<void>;
|
|
187
187
|
onNetworkChange: OnNetworkChange;
|
|
188
188
|
}
|