@aptos-labs/wallet-adapter-react 2.0.0 → 2.1.1
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 +20 -0
- package/README.md +52 -54
- package/READMEV1.md +267 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
- package/src/WalletProvider.tsx +3 -4
- package/src/useWallet.tsx +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @aptos-labs/wallet-adapter-react
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6266a29: Consolidate options argument on signAndSubmitTransaction
|
|
8
|
+
- Updated dependencies [6266a29]
|
|
9
|
+
- @aptos-labs/wallet-adapter-core@3.1.1
|
|
10
|
+
|
|
11
|
+
## 2.1.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- aa3d15a: Make sender optional when sign and submit single signer transaction
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [6257015]
|
|
20
|
+
- Updated dependencies [aa3d15a]
|
|
21
|
+
- @aptos-labs/wallet-adapter-core@3.1.0
|
|
22
|
+
|
|
3
23
|
## 2.0.0
|
|
4
24
|
|
|
5
25
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> **_NOTE:_** This documentation is for Wallet Adapter `v2.0.0` and up that is fully comatible with the Aptos TypeScript SDK V2. For Wallet Adapter `v^1.*.*` refer to [this guide](./READMEV1.md)
|
|
2
|
+
|
|
1
3
|
# Wallet Adapter React Provider
|
|
2
4
|
|
|
3
5
|
A react provider wrapper for the Aptos Wallet Adapter
|
|
@@ -26,6 +28,7 @@ signMessage
|
|
|
26
28
|
signTransaction
|
|
27
29
|
signMessageAndVerify
|
|
28
30
|
signAndSubmitBCSTransaction
|
|
31
|
+
submitTransaction
|
|
29
32
|
```
|
|
30
33
|
|
|
31
34
|
### Usage
|
|
@@ -113,6 +116,13 @@ You can find it [here](../wallet-adapter-ant-design/) with instructions on how t
|
|
|
113
116
|
|
|
114
117
|
#### Examples
|
|
115
118
|
|
|
119
|
+
##### Initialize Aptos
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
const aptosConfig = new AptosConfig({ network: Network.TESTNET });
|
|
123
|
+
const aptos = new Aptos(aptosConfig);
|
|
124
|
+
```
|
|
125
|
+
|
|
116
126
|
##### connect(walletName)
|
|
117
127
|
|
|
118
128
|
```js
|
|
@@ -132,61 +142,51 @@ const onConnect = async (walletName) => {
|
|
|
132
142
|
##### signAndSubmitTransaction(payload)
|
|
133
143
|
|
|
134
144
|
```js
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
145
|
+
const onSignAndSubmitTransaction = async () => {
|
|
146
|
+
const response = await signAndSubmitTransaction({
|
|
147
|
+
sender: account.address,
|
|
148
|
+
data: {
|
|
138
149
|
function: "0x1::coin::transfer",
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
typeArguments: ["0x1::aptos_coin::AptosCoin"],
|
|
151
|
+
functionArguments: [account.address, 1],
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
// if you want to wait for transaction
|
|
155
|
+
try {
|
|
156
|
+
await aptos.waitForTransaction({ transactionHash: response.hash });
|
|
157
|
+
} catch (error) {
|
|
158
|
+
console.error(error);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
150
161
|
|
|
151
162
|
<button onClick={onSignAndSubmitTransaction}>
|
|
152
163
|
Sign and submit transaction
|
|
153
|
-
</button
|
|
164
|
+
</button>;
|
|
154
165
|
```
|
|
155
166
|
|
|
156
167
|
##### signAndSubmitBCSTransaction(payload)
|
|
157
168
|
|
|
158
169
|
```js
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
)
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
const response = await signAndSubmitBCSTransaction(entryFunctionBCSPayload);
|
|
179
|
-
// if you want to wait for transaction
|
|
180
|
-
try {
|
|
181
|
-
await aptosClient.waitForTransaction(response?.hash || "");
|
|
182
|
-
} catch (error) {
|
|
183
|
-
console.error(error);
|
|
184
|
-
}
|
|
185
|
-
};
|
|
170
|
+
const onSignAndSubmitBCSTransaction = async () => {
|
|
171
|
+
const response = await signAndSubmitTransaction({
|
|
172
|
+
sender: account.address,
|
|
173
|
+
data: {
|
|
174
|
+
function: "0x1::coin::transfer",
|
|
175
|
+
typeArguments: [parseTypeTag(APTOS_COIN)],
|
|
176
|
+
functionArguments: [AccountAddress.from(account.address), new U64(1)],
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
// if you want to wait for transaction
|
|
180
|
+
try {
|
|
181
|
+
await aptos.waitForTransaction({ transactionHash: response.hash });
|
|
182
|
+
} catch (error) {
|
|
183
|
+
console.error(error);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
186
|
|
|
187
187
|
<button onClick={onSignAndSubmitTransaction}>
|
|
188
188
|
Sign and submit BCS transaction
|
|
189
|
-
</button
|
|
189
|
+
</button>;
|
|
190
190
|
```
|
|
191
191
|
|
|
192
192
|
##### signMessage(payload)
|
|
@@ -235,19 +235,17 @@ const onSignMessage = async () => {
|
|
|
235
235
|
##### signTransaction(payload)
|
|
236
236
|
|
|
237
237
|
```js
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
};
|
|
245
|
-
const response = await signTransaction(payload);
|
|
238
|
+
const onSignTransaction = async () => {
|
|
239
|
+
const payload = {
|
|
240
|
+
type: "entry_function_payload",
|
|
241
|
+
function: "0x1::coin::transfer",
|
|
242
|
+
type_arguments: ["0x1::aptos_coin::AptosCoin"],
|
|
243
|
+
arguments: [account?.address, 1], // 1 is in Octas
|
|
246
244
|
};
|
|
245
|
+
const response = await signTransaction(payload);
|
|
246
|
+
};
|
|
247
247
|
|
|
248
|
-
<button onClick={onSignTransaction}>
|
|
249
|
-
Sign transaction
|
|
250
|
-
</button>
|
|
248
|
+
<button onClick={onSignTransaction}>Sign transaction</button>;
|
|
251
249
|
```
|
|
252
250
|
|
|
253
251
|
##### signMessageAndVerify(payload)
|
package/READMEV1.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
> **_NOTE:_** This documentation is for Wallet Adapter `v^1.*.*`
|
|
2
|
+
|
|
3
|
+
# Wallet Adapter React Provider
|
|
4
|
+
|
|
5
|
+
A react provider wrapper for the Aptos Wallet Adapter
|
|
6
|
+
|
|
7
|
+
Dapps that want to use the adapter should install this package and other supported wallet packages.
|
|
8
|
+
|
|
9
|
+
### Support
|
|
10
|
+
|
|
11
|
+
The react provider supports all [wallet standard](https://aptos.dev/guides/wallet-standard) functions and feature functions
|
|
12
|
+
|
|
13
|
+
##### Standard functions
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
connect
|
|
17
|
+
disconnect
|
|
18
|
+
connected
|
|
19
|
+
account
|
|
20
|
+
network
|
|
21
|
+
signAndSubmitTransaction
|
|
22
|
+
signMessage
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
##### Feature functions - functions that may not be supported by all wallets
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
signTransaction
|
|
29
|
+
signMessageAndVerify
|
|
30
|
+
signAndSubmitBCSTransaction
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Usage
|
|
34
|
+
|
|
35
|
+
#### Install Dependencies
|
|
36
|
+
|
|
37
|
+
Install wallet dependencies you want to include in your app.
|
|
38
|
+
To do that, you can look at our [supported wallets list](https://github.com/aptos-labs/aptos-wallet-adapter#supported-wallet-packages). Each wallet is a link to npm package where you can install it from.
|
|
39
|
+
|
|
40
|
+
Next, install the `@aptos-labs/wallet-adapter-react`
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
pnpm i @aptos-labs/wallet-adapter-react
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
using npm
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
npm i @aptos-labs/wallet-adapter-react
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Import dependencies
|
|
53
|
+
|
|
54
|
+
On the `App.jsx` file,
|
|
55
|
+
|
|
56
|
+
Import the installed wallets.
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
import { SomeAptosWallet } from "some-aptos-wallet-package";
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Import the `AptosWalletAdapterProvider`.
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import { AptosWalletAdapterProvider } from "@aptos-labs/wallet-adapter-react";
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Wrap your app with the Provider, pass it the `plugins (wallets)` you want to have on your app as an array and a `autoConnect` option (set to false by default)
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
const wallets = [new AptosWallet()];
|
|
72
|
+
|
|
73
|
+
<AptosWalletAdapterProvider
|
|
74
|
+
plugins={wallets}
|
|
75
|
+
autoConnect={true}
|
|
76
|
+
onError={(error) => {
|
|
77
|
+
console.log("error", error);
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
<App />
|
|
81
|
+
</AptosWalletAdapterProvider>;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Use Wallet
|
|
85
|
+
|
|
86
|
+
On any page you want to use the wallet props, import `useWallet` from `@aptos-labs/wallet-adapter-react`
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
import { useWallet } from "@aptos-labs/wallet-adapter-react";
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Then you can use the exported properties
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
const {
|
|
96
|
+
connect,
|
|
97
|
+
account,
|
|
98
|
+
network,
|
|
99
|
+
connected,
|
|
100
|
+
disconnect,
|
|
101
|
+
wallet,
|
|
102
|
+
wallets,
|
|
103
|
+
signAndSubmitTransaction,
|
|
104
|
+
signAndSubmitBCSTransaction,
|
|
105
|
+
signTransaction,
|
|
106
|
+
signMessage,
|
|
107
|
+
signMessageAndVerify,
|
|
108
|
+
} = useWallet();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Use a UI package (recommended)
|
|
112
|
+
|
|
113
|
+
As part of the wallet adapter repo we provide a wallet connect UI package that provides a wallet connect button and a wallet select modal.
|
|
114
|
+
You can find it [here](../wallet-adapter-ant-design/) with instructions on how to use it.
|
|
115
|
+
|
|
116
|
+
#### Examples
|
|
117
|
+
|
|
118
|
+
##### connect(walletName)
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
const onConnect = async (walletName) => {
|
|
122
|
+
await connect(walletName);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
<button onClick={() => onConnect(wallet.name)}>{wallet.name}</button>;
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
##### disconnect()
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
<button onClick={disconnect}>Disconnect</button>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
##### signAndSubmitTransaction(payload)
|
|
135
|
+
|
|
136
|
+
```js
|
|
137
|
+
const onSignAndSubmitTransaction = async () => {
|
|
138
|
+
const payload: Types.TransactionPayload = {
|
|
139
|
+
type: "entry_function_payload",
|
|
140
|
+
function: "0x1::coin::transfer",
|
|
141
|
+
type_arguments: ["0x1::aptos_coin::AptosCoin"],
|
|
142
|
+
arguments: [account?.address, 1], // 1 is in Octas
|
|
143
|
+
};
|
|
144
|
+
const response = await signAndSubmitTransaction(payload);
|
|
145
|
+
// if you want to wait for transaction
|
|
146
|
+
try {
|
|
147
|
+
await aptosClient.waitForTransaction(response?.hash || "");
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error(error);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
<button onClick={onSignAndSubmitTransaction}>
|
|
154
|
+
Sign and submit transaction
|
|
155
|
+
</button>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
##### signAndSubmitBCSTransaction(payload)
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
const onSignAndSubmitBCSTransaction = async () => {
|
|
162
|
+
const token = new TxnBuilderTypes.TypeTagStruct(
|
|
163
|
+
TxnBuilderTypes.StructTag.fromString("0x1::aptos_coin::AptosCoin")
|
|
164
|
+
);
|
|
165
|
+
const entryFunctionBCSPayload =
|
|
166
|
+
new TxnBuilderTypes.TransactionPayloadEntryFunction(
|
|
167
|
+
TxnBuilderTypes.EntryFunction.natural(
|
|
168
|
+
"0x1::coin",
|
|
169
|
+
"transfer",
|
|
170
|
+
[token],
|
|
171
|
+
[
|
|
172
|
+
BCS.bcsToBytes(
|
|
173
|
+
TxnBuilderTypes.AccountAddress.fromHex(account!.address)
|
|
174
|
+
),
|
|
175
|
+
BCS.bcsSerializeUint64(2),
|
|
176
|
+
]
|
|
177
|
+
)
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
const response = await signAndSubmitBCSTransaction(entryFunctionBCSPayload);
|
|
181
|
+
// if you want to wait for transaction
|
|
182
|
+
try {
|
|
183
|
+
await aptosClient.waitForTransaction(response?.hash || "");
|
|
184
|
+
} catch (error) {
|
|
185
|
+
console.error(error);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
<button onClick={onSignAndSubmitTransaction}>
|
|
190
|
+
Sign and submit BCS transaction
|
|
191
|
+
</button>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
##### signMessage(payload)
|
|
195
|
+
|
|
196
|
+
```js
|
|
197
|
+
const onSignMessage = async () => {
|
|
198
|
+
const payload = {
|
|
199
|
+
message: "Hello from Aptos Wallet Adapter",
|
|
200
|
+
nonce: "random_string",
|
|
201
|
+
};
|
|
202
|
+
const response = await signMessage(payload);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
<button onClick={onSignMessage}>Sign message</button>;
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
##### Account
|
|
209
|
+
|
|
210
|
+
```js
|
|
211
|
+
<div>{account?.address}</div>
|
|
212
|
+
<div>{account?.publicKey}</div>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
##### Network
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
<div>{network?.name}</div>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
##### Wallet
|
|
222
|
+
|
|
223
|
+
```js
|
|
224
|
+
<div>{wallet?.name}</div>
|
|
225
|
+
<div>{wallet?.icon}</div>
|
|
226
|
+
<div>{wallet?.url}</div>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
##### Wallets
|
|
230
|
+
|
|
231
|
+
```js
|
|
232
|
+
{
|
|
233
|
+
wallets.map((wallet) => <p>{wallet.name}</p>);
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
##### signTransaction(payload)
|
|
238
|
+
|
|
239
|
+
```js
|
|
240
|
+
const onSignTransaction = async () => {
|
|
241
|
+
const payload: Types.TransactionPayload = {
|
|
242
|
+
type: "entry_function_payload",
|
|
243
|
+
function: "0x1::coin::transfer",
|
|
244
|
+
type_arguments: ["0x1::aptos_coin::AptosCoin"],
|
|
245
|
+
arguments: [account?.address, 1], // 1 is in Octas
|
|
246
|
+
};
|
|
247
|
+
const response = await signTransaction(payload);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
<button onClick={onSignTransaction}>
|
|
251
|
+
Sign transaction
|
|
252
|
+
</button>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
##### signMessageAndVerify(payload)
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
const onSignMessageAndVerify = async () => {
|
|
259
|
+
const payload = {
|
|
260
|
+
message: "Hello from Aptos Wallet Adapter",
|
|
261
|
+
nonce: "random_string",
|
|
262
|
+
};
|
|
263
|
+
const response = await signMessageAndVerify(payload);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
<button onClick={onSignMessageAndVerify}>Sign message and verify</button>;
|
|
267
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountInfo, NetworkInfo, WalletName, WalletInfo, Wallet,
|
|
1
|
+
import { AccountInfo, NetworkInfo, WalletName, WalletInfo, Wallet, InputTransactionData, AnyRawTransaction, Types, InputGenerateTransactionOptions, AccountAuthenticator, InputSubmitTransactionData, PendingTransactionResponse, SignMessagePayload, SignMessageResponse } 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
|
|
|
@@ -11,7 +11,7 @@ interface WalletContextState {
|
|
|
11
11
|
disconnect(): void;
|
|
12
12
|
wallet: WalletInfo | null;
|
|
13
13
|
wallets: ReadonlyArray<Wallet>;
|
|
14
|
-
signAndSubmitTransaction(transaction:
|
|
14
|
+
signAndSubmitTransaction(transaction: InputTransactionData): Promise<any>;
|
|
15
15
|
signTransaction(transactionOrPayload: AnyRawTransaction | Types.TransactionPayload, asFeePayer?: boolean, options?: InputGenerateTransactionOptions): Promise<AccountAuthenticator>;
|
|
16
16
|
submitTransaction(transaction: InputSubmitTransactionData): Promise<PendingTransactionResponse>;
|
|
17
17
|
signMessage(message: SignMessagePayload): Promise<SignMessageResponse>;
|
package/dist/index.js
CHANGED
|
@@ -127,9 +127,9 @@ var AptosWalletAdapterProvider = ({
|
|
|
127
127
|
return Promise.reject(error);
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
-
const signAndSubmitTransaction = async (transaction
|
|
130
|
+
const signAndSubmitTransaction = async (transaction) => {
|
|
131
131
|
try {
|
|
132
|
-
return await walletCore.signAndSubmitTransaction(transaction
|
|
132
|
+
return await walletCore.signAndSubmitTransaction(transaction);
|
|
133
133
|
} catch (error) {
|
|
134
134
|
if (onError)
|
|
135
135
|
onError(error);
|
package/dist/index.mjs
CHANGED
|
@@ -106,9 +106,9 @@ var AptosWalletAdapterProvider = ({
|
|
|
106
106
|
return Promise.reject(error);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
const signAndSubmitTransaction = async (transaction
|
|
109
|
+
const signAndSubmitTransaction = async (transaction) => {
|
|
110
110
|
try {
|
|
111
|
-
return await walletCore.signAndSubmitTransaction(transaction
|
|
111
|
+
return await walletCore.signAndSubmitTransaction(transaction);
|
|
112
112
|
} catch (error) {
|
|
113
113
|
if (onError)
|
|
114
114
|
onError(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/wallet-adapter-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Aptos Wallet Adapter React Provider",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@aptos-labs/wallet-adapter-tsconfig": "0.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@aptos-labs/wallet-adapter-core": "3.
|
|
40
|
+
"@aptos-labs/wallet-adapter-core": "3.1.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": "^18"
|
package/src/WalletProvider.tsx
CHANGED
|
@@ -15,13 +15,13 @@ import type {
|
|
|
15
15
|
WalletInfo,
|
|
16
16
|
InputGenerateTransactionOptions,
|
|
17
17
|
AnyRawTransaction,
|
|
18
|
-
InputGenerateTransactionData,
|
|
19
18
|
InputSubmitTransactionData,
|
|
20
19
|
AccountAuthenticator,
|
|
21
20
|
PendingTransactionResponse,
|
|
22
21
|
SignMessageResponse,
|
|
23
22
|
WalletName,
|
|
24
23
|
Types,
|
|
24
|
+
InputTransactionData,
|
|
25
25
|
} from "@aptos-labs/wallet-adapter-core";
|
|
26
26
|
import { WalletCore } from "@aptos-labs/wallet-adapter-core";
|
|
27
27
|
|
|
@@ -131,11 +131,10 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
|
|
|
131
131
|
};
|
|
132
132
|
|
|
133
133
|
const signAndSubmitTransaction = async (
|
|
134
|
-
transaction:
|
|
135
|
-
options?: InputGenerateTransactionOptions
|
|
134
|
+
transaction: InputTransactionData
|
|
136
135
|
) => {
|
|
137
136
|
try {
|
|
138
|
-
return await walletCore.signAndSubmitTransaction(transaction
|
|
137
|
+
return await walletCore.signAndSubmitTransaction(transaction);
|
|
139
138
|
} catch (error: any) {
|
|
140
139
|
if (onError) onError(error);
|
|
141
140
|
return Promise.reject(error);
|
package/src/useWallet.tsx
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
isRedirectable,
|
|
12
12
|
isMobile,
|
|
13
13
|
InputGenerateTransactionOptions,
|
|
14
|
-
InputGenerateTransactionData,
|
|
15
14
|
AnyRawTransaction,
|
|
15
|
+
InputTransactionData,
|
|
16
16
|
InputSubmitTransactionData,
|
|
17
17
|
PendingTransactionResponse,
|
|
18
18
|
AccountAuthenticator,
|
|
@@ -39,10 +39,7 @@ export interface WalletContextState {
|
|
|
39
39
|
disconnect(): void;
|
|
40
40
|
wallet: WalletInfo | null;
|
|
41
41
|
wallets: ReadonlyArray<Wallet>;
|
|
42
|
-
signAndSubmitTransaction(
|
|
43
|
-
transaction: InputGenerateTransactionData,
|
|
44
|
-
options?: InputGenerateTransactionOptions
|
|
45
|
-
): Promise<any>;
|
|
42
|
+
signAndSubmitTransaction(transaction: InputTransactionData): Promise<any>;
|
|
46
43
|
signTransaction(
|
|
47
44
|
transactionOrPayload: AnyRawTransaction | Types.TransactionPayload,
|
|
48
45
|
asFeePayer?: boolean,
|