@aptos-labs/wallet-adapter-react 1.3.2 → 2.0.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 +34 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +25 -30
- package/dist/index.mjs +25 -30
- package/package.json +4 -2
- package/src/WalletProvider.tsx +41 -33
- package/src/index.tsx +1 -1
- package/src/useWallet.tsx +23 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @aptos-labs/wallet-adapter-react
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 31e0084: Support TypeScript SDK V2. Fully compatible with existing SDK V1 and Wallet Adapter V1
|
|
8
|
+
but with a full SDK V2 support for the dapp.
|
|
9
|
+
|
|
10
|
+
- Add support for SDK V2 input types
|
|
11
|
+
- `signAndSubmitTransaction()` accept only SDK V2 transaction input type
|
|
12
|
+
- Implement a `submitTransaction()` function for multi signers transactions
|
|
13
|
+
- `signTransaction()` to support both SDK V1 and V2 versions
|
|
14
|
+
- Convert wallet `SignedTransaction` response from `signTransaction()` to TS SDK V2 `AccountAuthenticator`
|
|
15
|
+
- Demo app to demonstrate different trnsaction flows - single signer, sponsor and multi agent transactions
|
|
16
|
+
- Reject promise on core and/or provider errors instead of just returning `false`
|
|
17
|
+
- Use `@aptos-labs/ts-sdk@experimental` version `0.0.7`
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [31e0084]
|
|
22
|
+
- @aptos-labs/wallet-adapter-core@3.0.0
|
|
23
|
+
|
|
24
|
+
## 1.4.0
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- 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.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- dd6e1ed: Moves dependencies to peer dependencies as needed
|
|
33
|
+
- Updated dependencies [7acfa69]
|
|
34
|
+
- Updated dependencies [dd6e1ed]
|
|
35
|
+
- @aptos-labs/wallet-adapter-core@2.6.0
|
|
36
|
+
|
|
3
37
|
## 1.3.2
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountInfo, NetworkInfo, WalletName, WalletInfo, Wallet, Types,
|
|
1
|
+
import { AccountInfo, NetworkInfo, WalletName, WalletInfo, Wallet, InputGenerateTransactionData, InputGenerateTransactionOptions, AnyRawTransaction, Types, 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,10 +11,10 @@ interface WalletContextState {
|
|
|
11
11
|
disconnect(): void;
|
|
12
12
|
wallet: WalletInfo | null;
|
|
13
13
|
wallets: ReadonlyArray<Wallet>;
|
|
14
|
-
signAndSubmitTransaction
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
signMessage(message: SignMessagePayload): Promise<SignMessageResponse
|
|
14
|
+
signAndSubmitTransaction(transaction: InputGenerateTransactionData, options?: InputGenerateTransactionOptions): Promise<any>;
|
|
15
|
+
signTransaction(transactionOrPayload: AnyRawTransaction | Types.TransactionPayload, asFeePayer?: boolean, options?: InputGenerateTransactionOptions): Promise<AccountAuthenticator>;
|
|
16
|
+
submitTransaction(transaction: InputSubmitTransactionData): Promise<PendingTransactionResponse>;
|
|
17
|
+
signMessage(message: SignMessagePayload): Promise<SignMessageResponse>;
|
|
18
18
|
signMessageAndVerify(message: SignMessagePayload): Promise<boolean>;
|
|
19
19
|
}
|
|
20
20
|
declare function useWallet(): WalletContextState;
|
package/dist/index.js
CHANGED
|
@@ -33,11 +33,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
33
33
|
// src/useWallet.tsx
|
|
34
34
|
var import_wallet_adapter_core = require("@aptos-labs/wallet-adapter-core");
|
|
35
35
|
var import_react = require("react");
|
|
36
|
-
var
|
|
36
|
+
var DEFAULT_CONTEXT = {
|
|
37
37
|
connected: false
|
|
38
38
|
};
|
|
39
39
|
var WalletContext = (0, import_react.createContext)(
|
|
40
|
-
|
|
40
|
+
DEFAULT_CONTEXT
|
|
41
41
|
);
|
|
42
42
|
function useWallet() {
|
|
43
43
|
const context = (0, import_react.useContext)(WalletContext);
|
|
@@ -77,8 +77,7 @@ var AptosWalletAdapterProvider = ({
|
|
|
77
77
|
console.log("connect error", error);
|
|
78
78
|
if (onError)
|
|
79
79
|
onError(error);
|
|
80
|
-
|
|
81
|
-
throw error;
|
|
80
|
+
return Promise.reject(error);
|
|
82
81
|
} finally {
|
|
83
82
|
setIsLoading(false);
|
|
84
83
|
}
|
|
@@ -86,59 +85,55 @@ var AptosWalletAdapterProvider = ({
|
|
|
86
85
|
const disconnect = async () => {
|
|
87
86
|
try {
|
|
88
87
|
await walletCore.disconnect();
|
|
89
|
-
} catch (
|
|
90
|
-
console.log("disconnect error", e);
|
|
88
|
+
} catch (error) {
|
|
91
89
|
if (onError)
|
|
92
|
-
onError(
|
|
90
|
+
onError(error);
|
|
91
|
+
return Promise.reject(error);
|
|
93
92
|
}
|
|
94
93
|
};
|
|
95
|
-
const
|
|
94
|
+
const signTransaction = async (transaction, asFeePayer, options) => {
|
|
96
95
|
try {
|
|
97
|
-
return await walletCore.
|
|
96
|
+
return await walletCore.signTransaction(transaction, asFeePayer, options);
|
|
98
97
|
} catch (error) {
|
|
99
98
|
if (onError)
|
|
100
99
|
onError(error);
|
|
101
|
-
|
|
102
|
-
throw error;
|
|
100
|
+
return Promise.reject(error);
|
|
103
101
|
}
|
|
104
102
|
};
|
|
105
|
-
const
|
|
103
|
+
const signMessage = async (message) => {
|
|
106
104
|
try {
|
|
107
|
-
return await walletCore.
|
|
105
|
+
return await walletCore.signMessage(message);
|
|
108
106
|
} catch (error) {
|
|
109
|
-
|
|
107
|
+
if (onError)
|
|
108
|
+
onError(error);
|
|
109
|
+
return Promise.reject(error);
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
|
-
const
|
|
112
|
+
const signMessageAndVerify = async (message) => {
|
|
113
113
|
try {
|
|
114
|
-
return await walletCore.
|
|
114
|
+
return await walletCore.signMessageAndVerify(message);
|
|
115
115
|
} catch (error) {
|
|
116
116
|
if (onError)
|
|
117
117
|
onError(error);
|
|
118
|
-
|
|
119
|
-
throw error;
|
|
118
|
+
return Promise.reject(error);
|
|
120
119
|
}
|
|
121
120
|
};
|
|
122
|
-
const
|
|
121
|
+
const submitTransaction = async (transaction) => {
|
|
123
122
|
try {
|
|
124
|
-
return await walletCore.
|
|
123
|
+
return await walletCore.submitTransaction(transaction);
|
|
125
124
|
} catch (error) {
|
|
126
125
|
if (onError)
|
|
127
126
|
onError(error);
|
|
128
|
-
|
|
129
|
-
throw error;
|
|
130
|
-
return null;
|
|
127
|
+
return Promise.reject(error);
|
|
131
128
|
}
|
|
132
129
|
};
|
|
133
|
-
const
|
|
130
|
+
const signAndSubmitTransaction = async (transaction, options) => {
|
|
134
131
|
try {
|
|
135
|
-
return await walletCore.
|
|
132
|
+
return await walletCore.signAndSubmitTransaction(transaction, options);
|
|
136
133
|
} catch (error) {
|
|
137
134
|
if (onError)
|
|
138
135
|
onError(error);
|
|
139
|
-
|
|
140
|
-
throw error;
|
|
141
|
-
return false;
|
|
136
|
+
return Promise.reject(error);
|
|
142
137
|
}
|
|
143
138
|
};
|
|
144
139
|
(0, import_react2.useEffect)(() => {
|
|
@@ -231,11 +226,11 @@ var AptosWalletAdapterProvider = ({
|
|
|
231
226
|
wallet,
|
|
232
227
|
wallets,
|
|
233
228
|
signAndSubmitTransaction,
|
|
234
|
-
signAndSubmitBCSTransaction,
|
|
235
229
|
signTransaction,
|
|
236
230
|
signMessage,
|
|
237
231
|
signMessageAndVerify,
|
|
238
|
-
isLoading
|
|
232
|
+
isLoading,
|
|
233
|
+
submitTransaction
|
|
239
234
|
},
|
|
240
235
|
children
|
|
241
236
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
isMobile
|
|
8
8
|
} from "@aptos-labs/wallet-adapter-core";
|
|
9
9
|
import { createContext, useContext } from "react";
|
|
10
|
-
var
|
|
10
|
+
var DEFAULT_CONTEXT = {
|
|
11
11
|
connected: false
|
|
12
12
|
};
|
|
13
13
|
var WalletContext = createContext(
|
|
14
|
-
|
|
14
|
+
DEFAULT_CONTEXT
|
|
15
15
|
);
|
|
16
16
|
function useWallet() {
|
|
17
17
|
const context = useContext(WalletContext);
|
|
@@ -56,8 +56,7 @@ var AptosWalletAdapterProvider = ({
|
|
|
56
56
|
console.log("connect error", error);
|
|
57
57
|
if (onError)
|
|
58
58
|
onError(error);
|
|
59
|
-
|
|
60
|
-
throw error;
|
|
59
|
+
return Promise.reject(error);
|
|
61
60
|
} finally {
|
|
62
61
|
setIsLoading(false);
|
|
63
62
|
}
|
|
@@ -65,59 +64,55 @@ var AptosWalletAdapterProvider = ({
|
|
|
65
64
|
const disconnect = async () => {
|
|
66
65
|
try {
|
|
67
66
|
await walletCore.disconnect();
|
|
68
|
-
} catch (
|
|
69
|
-
console.log("disconnect error", e);
|
|
67
|
+
} catch (error) {
|
|
70
68
|
if (onError)
|
|
71
|
-
onError(
|
|
69
|
+
onError(error);
|
|
70
|
+
return Promise.reject(error);
|
|
72
71
|
}
|
|
73
72
|
};
|
|
74
|
-
const
|
|
73
|
+
const signTransaction = async (transaction, asFeePayer, options) => {
|
|
75
74
|
try {
|
|
76
|
-
return await walletCore.
|
|
75
|
+
return await walletCore.signTransaction(transaction, asFeePayer, options);
|
|
77
76
|
} catch (error) {
|
|
78
77
|
if (onError)
|
|
79
78
|
onError(error);
|
|
80
|
-
|
|
81
|
-
throw error;
|
|
79
|
+
return Promise.reject(error);
|
|
82
80
|
}
|
|
83
81
|
};
|
|
84
|
-
const
|
|
82
|
+
const signMessage = async (message) => {
|
|
85
83
|
try {
|
|
86
|
-
return await walletCore.
|
|
84
|
+
return await walletCore.signMessage(message);
|
|
87
85
|
} catch (error) {
|
|
88
|
-
|
|
86
|
+
if (onError)
|
|
87
|
+
onError(error);
|
|
88
|
+
return Promise.reject(error);
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
const
|
|
91
|
+
const signMessageAndVerify = async (message) => {
|
|
92
92
|
try {
|
|
93
|
-
return await walletCore.
|
|
93
|
+
return await walletCore.signMessageAndVerify(message);
|
|
94
94
|
} catch (error) {
|
|
95
95
|
if (onError)
|
|
96
96
|
onError(error);
|
|
97
|
-
|
|
98
|
-
throw error;
|
|
97
|
+
return Promise.reject(error);
|
|
99
98
|
}
|
|
100
99
|
};
|
|
101
|
-
const
|
|
100
|
+
const submitTransaction = async (transaction) => {
|
|
102
101
|
try {
|
|
103
|
-
return await walletCore.
|
|
102
|
+
return await walletCore.submitTransaction(transaction);
|
|
104
103
|
} catch (error) {
|
|
105
104
|
if (onError)
|
|
106
105
|
onError(error);
|
|
107
|
-
|
|
108
|
-
throw error;
|
|
109
|
-
return null;
|
|
106
|
+
return Promise.reject(error);
|
|
110
107
|
}
|
|
111
108
|
};
|
|
112
|
-
const
|
|
109
|
+
const signAndSubmitTransaction = async (transaction, options) => {
|
|
113
110
|
try {
|
|
114
|
-
return await walletCore.
|
|
111
|
+
return await walletCore.signAndSubmitTransaction(transaction, options);
|
|
115
112
|
} catch (error) {
|
|
116
113
|
if (onError)
|
|
117
114
|
onError(error);
|
|
118
|
-
|
|
119
|
-
throw error;
|
|
120
|
-
return false;
|
|
115
|
+
return Promise.reject(error);
|
|
121
116
|
}
|
|
122
117
|
};
|
|
123
118
|
useEffect(() => {
|
|
@@ -210,11 +205,11 @@ var AptosWalletAdapterProvider = ({
|
|
|
210
205
|
wallet,
|
|
211
206
|
wallets,
|
|
212
207
|
signAndSubmitTransaction,
|
|
213
|
-
signAndSubmitBCSTransaction,
|
|
214
208
|
signTransaction,
|
|
215
209
|
signMessage,
|
|
216
210
|
signMessageAndVerify,
|
|
217
|
-
isLoading
|
|
211
|
+
isLoading,
|
|
212
|
+
submitTransaction
|
|
218
213
|
},
|
|
219
214
|
children
|
|
220
215
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/wallet-adapter-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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": "
|
|
40
|
+
"@aptos-labs/wallet-adapter-core": "3.0.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
41
43
|
"react": "^18"
|
|
42
44
|
},
|
|
43
45
|
"scripts": {
|
package/src/WalletProvider.tsx
CHANGED
|
@@ -13,9 +13,14 @@ import type {
|
|
|
13
13
|
SignMessagePayload,
|
|
14
14
|
Wallet,
|
|
15
15
|
WalletInfo,
|
|
16
|
+
InputGenerateTransactionOptions,
|
|
17
|
+
AnyRawTransaction,
|
|
18
|
+
InputGenerateTransactionData,
|
|
19
|
+
InputSubmitTransactionData,
|
|
20
|
+
AccountAuthenticator,
|
|
21
|
+
PendingTransactionResponse,
|
|
22
|
+
SignMessageResponse,
|
|
16
23
|
WalletName,
|
|
17
|
-
TransactionOptions,
|
|
18
|
-
TxnBuilderTypes,
|
|
19
24
|
Types,
|
|
20
25
|
} from "@aptos-labs/wallet-adapter-core";
|
|
21
26
|
import { WalletCore } from "@aptos-labs/wallet-adapter-core";
|
|
@@ -64,7 +69,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
|
|
|
64
69
|
} catch (error: any) {
|
|
65
70
|
console.log("connect error", error);
|
|
66
71
|
if (onError) onError(error);
|
|
67
|
-
|
|
72
|
+
return Promise.reject(error);
|
|
68
73
|
} finally {
|
|
69
74
|
setIsLoading(false);
|
|
70
75
|
}
|
|
@@ -73,64 +78,67 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
|
|
|
73
78
|
const disconnect = async () => {
|
|
74
79
|
try {
|
|
75
80
|
await walletCore.disconnect();
|
|
76
|
-
} catch (
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (onError) onError(error);
|
|
83
|
+
return Promise.reject(error);
|
|
79
84
|
}
|
|
80
85
|
};
|
|
81
86
|
|
|
82
|
-
const
|
|
83
|
-
transaction: Types.TransactionPayload,
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
const signTransaction = async (
|
|
88
|
+
transaction: AnyRawTransaction | Types.TransactionPayload,
|
|
89
|
+
asFeePayer?: boolean,
|
|
90
|
+
options?: InputGenerateTransactionOptions
|
|
91
|
+
): Promise<AccountAuthenticator> => {
|
|
86
92
|
try {
|
|
87
|
-
return await walletCore.
|
|
93
|
+
return await walletCore.signTransaction(transaction, asFeePayer, options);
|
|
88
94
|
} catch (error: any) {
|
|
89
95
|
if (onError) onError(error);
|
|
90
|
-
|
|
96
|
+
return Promise.reject(error);
|
|
91
97
|
}
|
|
92
98
|
};
|
|
93
99
|
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
) => {
|
|
100
|
+
const signMessage = async (
|
|
101
|
+
message: SignMessagePayload
|
|
102
|
+
): Promise<SignMessageResponse> => {
|
|
98
103
|
try {
|
|
99
|
-
return await walletCore.
|
|
104
|
+
return await walletCore.signMessage(message);
|
|
100
105
|
} catch (error: any) {
|
|
101
|
-
|
|
106
|
+
if (onError) onError(error);
|
|
107
|
+
return Promise.reject(error);
|
|
102
108
|
}
|
|
103
109
|
};
|
|
104
110
|
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
) => {
|
|
111
|
+
const signMessageAndVerify = async (
|
|
112
|
+
message: SignMessagePayload
|
|
113
|
+
): Promise<boolean> => {
|
|
109
114
|
try {
|
|
110
|
-
return await walletCore.
|
|
115
|
+
return await walletCore.signMessageAndVerify(message);
|
|
111
116
|
} catch (error: any) {
|
|
112
117
|
if (onError) onError(error);
|
|
113
|
-
|
|
118
|
+
return Promise.reject(error);
|
|
114
119
|
}
|
|
115
120
|
};
|
|
116
121
|
|
|
117
|
-
const
|
|
122
|
+
const submitTransaction = async (
|
|
123
|
+
transaction: InputSubmitTransactionData
|
|
124
|
+
): Promise<PendingTransactionResponse> => {
|
|
118
125
|
try {
|
|
119
|
-
return await walletCore.
|
|
126
|
+
return await walletCore.submitTransaction(transaction);
|
|
120
127
|
} catch (error: any) {
|
|
121
128
|
if (onError) onError(error);
|
|
122
|
-
|
|
123
|
-
return null;
|
|
129
|
+
return Promise.reject(error);
|
|
124
130
|
}
|
|
125
131
|
};
|
|
126
132
|
|
|
127
|
-
const
|
|
133
|
+
const signAndSubmitTransaction = async (
|
|
134
|
+
transaction: InputGenerateTransactionData,
|
|
135
|
+
options?: InputGenerateTransactionOptions
|
|
136
|
+
) => {
|
|
128
137
|
try {
|
|
129
|
-
return await walletCore.
|
|
138
|
+
return await walletCore.signAndSubmitTransaction(transaction, options);
|
|
130
139
|
} catch (error: any) {
|
|
131
140
|
if (onError) onError(error);
|
|
132
|
-
|
|
133
|
-
return false;
|
|
141
|
+
return Promise.reject(error);
|
|
134
142
|
}
|
|
135
143
|
};
|
|
136
144
|
|
|
@@ -236,11 +244,11 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
|
|
|
236
244
|
wallet,
|
|
237
245
|
wallets,
|
|
238
246
|
signAndSubmitTransaction,
|
|
239
|
-
signAndSubmitBCSTransaction,
|
|
240
247
|
signTransaction,
|
|
241
248
|
signMessage,
|
|
242
249
|
signMessageAndVerify,
|
|
243
250
|
isLoading,
|
|
251
|
+
submitTransaction,
|
|
244
252
|
}}
|
|
245
253
|
>
|
|
246
254
|
{children}
|
package/src/index.tsx
CHANGED
package/src/useWallet.tsx
CHANGED
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
AccountInfo,
|
|
3
3
|
NetworkInfo,
|
|
4
4
|
WalletInfo,
|
|
5
|
-
WalletName,
|
|
6
5
|
SignMessagePayload,
|
|
7
6
|
SignMessageResponse,
|
|
8
7
|
Wallet,
|
|
@@ -11,19 +10,24 @@ import {
|
|
|
11
10
|
isInAppBrowser,
|
|
12
11
|
isRedirectable,
|
|
13
12
|
isMobile,
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
InputGenerateTransactionOptions,
|
|
14
|
+
InputGenerateTransactionData,
|
|
15
|
+
AnyRawTransaction,
|
|
16
|
+
InputSubmitTransactionData,
|
|
17
|
+
PendingTransactionResponse,
|
|
18
|
+
AccountAuthenticator,
|
|
16
19
|
Types,
|
|
20
|
+
WalletName,
|
|
17
21
|
} from "@aptos-labs/wallet-adapter-core";
|
|
18
22
|
import { createContext, useContext } from "react";
|
|
19
23
|
|
|
20
|
-
export type {
|
|
24
|
+
export type { Wallet, WalletName };
|
|
21
25
|
export {
|
|
22
26
|
WalletReadyState,
|
|
23
|
-
NetworkName,
|
|
24
27
|
isInAppBrowser,
|
|
25
28
|
isRedirectable,
|
|
26
29
|
isMobile,
|
|
30
|
+
NetworkName,
|
|
27
31
|
};
|
|
28
32
|
|
|
29
33
|
export interface WalletContextState {
|
|
@@ -35,28 +39,28 @@ export interface WalletContextState {
|
|
|
35
39
|
disconnect(): void;
|
|
36
40
|
wallet: WalletInfo | null;
|
|
37
41
|
wallets: ReadonlyArray<Wallet>;
|
|
38
|
-
signAndSubmitTransaction
|
|
39
|
-
transaction:
|
|
40
|
-
options?:
|
|
41
|
-
): Promise<any>;
|
|
42
|
-
signAndSubmitBCSTransaction<T extends TxnBuilderTypes.TransactionPayload>(
|
|
43
|
-
transaction: T,
|
|
44
|
-
options?: TransactionOptions
|
|
45
|
-
): Promise<any>;
|
|
46
|
-
signTransaction<T extends Types.TransactionPayload>(
|
|
47
|
-
transaction: T,
|
|
48
|
-
options?: TransactionOptions
|
|
42
|
+
signAndSubmitTransaction(
|
|
43
|
+
transaction: InputGenerateTransactionData,
|
|
44
|
+
options?: InputGenerateTransactionOptions
|
|
49
45
|
): Promise<any>;
|
|
50
|
-
|
|
46
|
+
signTransaction(
|
|
47
|
+
transactionOrPayload: AnyRawTransaction | Types.TransactionPayload,
|
|
48
|
+
asFeePayer?: boolean,
|
|
49
|
+
options?: InputGenerateTransactionOptions
|
|
50
|
+
): Promise<AccountAuthenticator>;
|
|
51
|
+
submitTransaction(
|
|
52
|
+
transaction: InputSubmitTransactionData
|
|
53
|
+
): Promise<PendingTransactionResponse>;
|
|
54
|
+
signMessage(message: SignMessagePayload): Promise<SignMessageResponse>;
|
|
51
55
|
signMessageAndVerify(message: SignMessagePayload): Promise<boolean>;
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
const
|
|
58
|
+
const DEFAULT_CONTEXT = {
|
|
55
59
|
connected: false,
|
|
56
60
|
};
|
|
57
61
|
|
|
58
62
|
export const WalletContext = createContext<WalletContextState>(
|
|
59
|
-
|
|
63
|
+
DEFAULT_CONTEXT as WalletContextState
|
|
60
64
|
);
|
|
61
65
|
|
|
62
66
|
export function useWallet(): WalletContextState {
|