@aptos-labs/wallet-adapter-react 1.3.2 → 1.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/CHANGELOG.md +13 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +24 -0
- package/dist/index.mjs +24 -0
- package/package.json +4 -2
- package/src/WalletProvider.tsx +27 -0
- package/src/useWallet.tsx +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @aptos-labs/wallet-adapter-react
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7acfa69: Adding support for the new Typescript SDK in the package `@aptos-labs/ts-sdk`. The wallet adapter now supports submitting a basic transaction with the new SDK types.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- dd6e1ed: Moves dependencies to peer dependencies as needed
|
|
12
|
+
- Updated dependencies [7acfa69]
|
|
13
|
+
- Updated dependencies [dd6e1ed]
|
|
14
|
+
- @aptos-labs/wallet-adapter-core@2.6.0
|
|
15
|
+
|
|
3
16
|
## 1.3.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountInfo, NetworkInfo, WalletName, WalletInfo, Wallet, Types, TransactionOptions, TxnBuilderTypes, SignMessagePayload, SignMessageResponse } from '@aptos-labs/wallet-adapter-core';
|
|
1
|
+
import { AccountInfo, NetworkInfo, WalletName, WalletInfo, Wallet, Types, TransactionOptions, TxnBuilderTypes, SignMessagePayload, SignMessageResponse, InputGenerateTransactionData } from '@aptos-labs/wallet-adapter-core';
|
|
2
2
|
export { NetworkName, Wallet, WalletName, WalletReadyState, isInAppBrowser, isMobile, isRedirectable } from '@aptos-labs/wallet-adapter-core';
|
|
3
3
|
import { ReactNode, FC } from 'react';
|
|
4
4
|
|
|
@@ -16,6 +16,8 @@ interface WalletContextState {
|
|
|
16
16
|
signTransaction<T extends Types.TransactionPayload>(transaction: T, options?: TransactionOptions): Promise<any>;
|
|
17
17
|
signMessage(message: SignMessagePayload): Promise<SignMessageResponse | null>;
|
|
18
18
|
signMessageAndVerify(message: SignMessagePayload): Promise<boolean>;
|
|
19
|
+
submitTransaction(transaction: InputGenerateTransactionData): Promise<any>;
|
|
20
|
+
signMultiAgentTransaction(transaction: TxnBuilderTypes.MultiAgentRawTransaction | TxnBuilderTypes.FeePayerRawTransaction): Promise<any>;
|
|
19
21
|
}
|
|
20
22
|
declare function useWallet(): WalletContextState;
|
|
21
23
|
|
package/dist/index.js
CHANGED
|
@@ -141,6 +141,28 @@ var AptosWalletAdapterProvider = ({
|
|
|
141
141
|
return false;
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
+
const signMultiAgentTransaction = async (transaction) => {
|
|
145
|
+
try {
|
|
146
|
+
return await walletCore.signMultiAgentTransaction(transaction);
|
|
147
|
+
} catch (error) {
|
|
148
|
+
if (onError)
|
|
149
|
+
onError(error);
|
|
150
|
+
else
|
|
151
|
+
throw error;
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const submitTransaction = async (transaction) => {
|
|
156
|
+
try {
|
|
157
|
+
return await walletCore.submitTransaction(transaction);
|
|
158
|
+
} catch (error) {
|
|
159
|
+
if (onError)
|
|
160
|
+
onError(error);
|
|
161
|
+
else
|
|
162
|
+
throw error;
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
144
166
|
(0, import_react2.useEffect)(() => {
|
|
145
167
|
if (autoConnect) {
|
|
146
168
|
if (localStorage.getItem("AptosWalletName")) {
|
|
@@ -235,6 +257,8 @@ var AptosWalletAdapterProvider = ({
|
|
|
235
257
|
signTransaction,
|
|
236
258
|
signMessage,
|
|
237
259
|
signMessageAndVerify,
|
|
260
|
+
signMultiAgentTransaction,
|
|
261
|
+
submitTransaction,
|
|
238
262
|
isLoading
|
|
239
263
|
},
|
|
240
264
|
children
|
package/dist/index.mjs
CHANGED
|
@@ -120,6 +120,28 @@ var AptosWalletAdapterProvider = ({
|
|
|
120
120
|
return false;
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
+
const signMultiAgentTransaction = async (transaction) => {
|
|
124
|
+
try {
|
|
125
|
+
return await walletCore.signMultiAgentTransaction(transaction);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
if (onError)
|
|
128
|
+
onError(error);
|
|
129
|
+
else
|
|
130
|
+
throw error;
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const submitTransaction = async (transaction) => {
|
|
135
|
+
try {
|
|
136
|
+
return await walletCore.submitTransaction(transaction);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
if (onError)
|
|
139
|
+
onError(error);
|
|
140
|
+
else
|
|
141
|
+
throw error;
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
123
145
|
useEffect(() => {
|
|
124
146
|
if (autoConnect) {
|
|
125
147
|
if (localStorage.getItem("AptosWalletName")) {
|
|
@@ -214,6 +236,8 @@ var AptosWalletAdapterProvider = ({
|
|
|
214
236
|
signTransaction,
|
|
215
237
|
signMessage,
|
|
216
238
|
signMessageAndVerify,
|
|
239
|
+
signMultiAgentTransaction,
|
|
240
|
+
submitTransaction,
|
|
217
241
|
isLoading
|
|
218
242
|
},
|
|
219
243
|
children
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/wallet-adapter-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Aptos Wallet Adapter React Provider",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -37,7 +37,9 @@
|
|
|
37
37
|
"@aptos-labs/wallet-adapter-tsconfig": "0.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@aptos-labs/wallet-adapter-core": "2.
|
|
40
|
+
"@aptos-labs/wallet-adapter-core": "2.6.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
41
43
|
"react": "^18"
|
|
42
44
|
},
|
|
43
45
|
"scripts": {
|
package/src/WalletProvider.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
TransactionOptions,
|
|
18
18
|
TxnBuilderTypes,
|
|
19
19
|
Types,
|
|
20
|
+
InputGenerateTransactionData,
|
|
20
21
|
} from "@aptos-labs/wallet-adapter-core";
|
|
21
22
|
import { WalletCore } from "@aptos-labs/wallet-adapter-core";
|
|
22
23
|
|
|
@@ -134,6 +135,30 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
|
|
|
134
135
|
}
|
|
135
136
|
};
|
|
136
137
|
|
|
138
|
+
const signMultiAgentTransaction = async (
|
|
139
|
+
transaction: TxnBuilderTypes.MultiAgentRawTransaction | TxnBuilderTypes.FeePayerRawTransaction,
|
|
140
|
+
) => {
|
|
141
|
+
try {
|
|
142
|
+
return await walletCore.signMultiAgentTransaction(transaction);
|
|
143
|
+
} catch (error: any) {
|
|
144
|
+
if (onError) onError(error);
|
|
145
|
+
else throw error;
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const submitTransaction = async (
|
|
151
|
+
transaction: InputGenerateTransactionData,
|
|
152
|
+
) => {
|
|
153
|
+
try {
|
|
154
|
+
return await walletCore.submitTransaction(transaction);
|
|
155
|
+
} catch (error: any) {
|
|
156
|
+
if (onError) onError(error);
|
|
157
|
+
else throw error;
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
137
162
|
useEffect(() => {
|
|
138
163
|
if (autoConnect) {
|
|
139
164
|
if (localStorage.getItem("AptosWalletName")) {
|
|
@@ -240,6 +265,8 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
|
|
|
240
265
|
signTransaction,
|
|
241
266
|
signMessage,
|
|
242
267
|
signMessageAndVerify,
|
|
268
|
+
signMultiAgentTransaction,
|
|
269
|
+
submitTransaction,
|
|
243
270
|
isLoading,
|
|
244
271
|
}}
|
|
245
272
|
>
|
package/src/useWallet.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
TransactionOptions,
|
|
15
15
|
TxnBuilderTypes,
|
|
16
16
|
Types,
|
|
17
|
+
InputGenerateTransactionData,
|
|
17
18
|
} from "@aptos-labs/wallet-adapter-core";
|
|
18
19
|
import { createContext, useContext } from "react";
|
|
19
20
|
|
|
@@ -49,6 +50,10 @@ export interface WalletContextState {
|
|
|
49
50
|
): Promise<any>;
|
|
50
51
|
signMessage(message: SignMessagePayload): Promise<SignMessageResponse | null>;
|
|
51
52
|
signMessageAndVerify(message: SignMessagePayload): Promise<boolean>;
|
|
53
|
+
submitTransaction(transaction: InputGenerateTransactionData): Promise<any>;
|
|
54
|
+
signMultiAgentTransaction(
|
|
55
|
+
transaction: TxnBuilderTypes.MultiAgentRawTransaction | TxnBuilderTypes.FeePayerRawTransaction,
|
|
56
|
+
): Promise<any>;
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
const DEFAULT_COUNTEXT = {
|