@mysten/dapp-kit 1.0.4 → 1.0.5
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 +14 -0
- package/package.json +10 -13
- package/dist/components/AccountDropdownMenu.css.d.ts +0 -7
- package/dist/components/AccountDropdownMenu.css.d.ts.map +0 -1
- package/dist/components/AccountDropdownMenu.d.ts +0 -11
- package/dist/components/AccountDropdownMenu.d.ts.map +0 -1
- package/dist/components/ConnectButton.d.ts +0 -10
- package/dist/components/ConnectButton.d.ts.map +0 -1
- package/dist/components/SuiClientProvider.d.ts +0 -26
- package/dist/components/SuiClientProvider.d.ts.map +0 -1
- package/dist/components/WalletProvider.d.ts +0 -27
- package/dist/components/WalletProvider.d.ts.map +0 -1
- package/dist/components/connect-modal/ConnectModal.css.d.ts +0 -12
- package/dist/components/connect-modal/ConnectModal.css.d.ts.map +0 -1
- package/dist/components/connect-modal/ConnectModal.d.ts +0 -24
- package/dist/components/connect-modal/ConnectModal.d.ts.map +0 -1
- package/dist/components/connect-modal/InfoSection.css.d.ts +0 -2
- package/dist/components/connect-modal/InfoSection.css.d.ts.map +0 -1
- package/dist/components/connect-modal/InfoSection.d.ts +0 -7
- package/dist/components/connect-modal/InfoSection.d.ts.map +0 -1
- package/dist/components/connect-modal/views/ConnectionStatus.css.d.ts +0 -6
- package/dist/components/connect-modal/views/ConnectionStatus.css.d.ts.map +0 -1
- package/dist/components/connect-modal/views/ConnectionStatus.d.ts +0 -9
- package/dist/components/connect-modal/views/ConnectionStatus.d.ts.map +0 -1
- package/dist/components/connect-modal/views/GettingStarted.css.d.ts +0 -4
- package/dist/components/connect-modal/views/GettingStarted.css.d.ts.map +0 -1
- package/dist/components/connect-modal/views/GettingStarted.d.ts +0 -2
- package/dist/components/connect-modal/views/GettingStarted.d.ts.map +0 -1
- package/dist/components/connect-modal/views/WhatIsAWallet.css.d.ts +0 -3
- package/dist/components/connect-modal/views/WhatIsAWallet.css.d.ts.map +0 -1
- package/dist/components/connect-modal/views/WhatIsAWallet.d.ts +0 -2
- package/dist/components/connect-modal/views/WhatIsAWallet.d.ts.map +0 -1
- package/dist/components/connect-modal/wallet-list/WalletList.css.d.ts +0 -2
- package/dist/components/connect-modal/wallet-list/WalletList.css.d.ts.map +0 -1
- package/dist/components/connect-modal/wallet-list/WalletList.d.ts +0 -10
- package/dist/components/connect-modal/wallet-list/WalletList.d.ts.map +0 -1
- package/dist/components/connect-modal/wallet-list/WalletListItem.css.d.ts +0 -5
- package/dist/components/connect-modal/wallet-list/WalletListItem.css.d.ts.map +0 -1
- package/dist/components/connect-modal/wallet-list/WalletListItem.d.ts +0 -10
- package/dist/components/connect-modal/wallet-list/WalletListItem.d.ts.map +0 -1
- package/dist/components/icons/BackIcon.d.ts +0 -3
- package/dist/components/icons/BackIcon.d.ts.map +0 -1
- package/dist/components/icons/CheckIcon.d.ts +0 -3
- package/dist/components/icons/CheckIcon.d.ts.map +0 -1
- package/dist/components/icons/ChevronIcon.d.ts +0 -3
- package/dist/components/icons/ChevronIcon.d.ts.map +0 -1
- package/dist/components/icons/CloseIcon.d.ts +0 -3
- package/dist/components/icons/CloseIcon.d.ts.map +0 -1
- package/dist/components/styling/InjectedThemeStyles.d.ts +0 -7
- package/dist/components/styling/InjectedThemeStyles.d.ts.map +0 -1
- package/dist/components/styling/StyleMarker.css.d.ts +0 -2
- package/dist/components/styling/StyleMarker.css.d.ts.map +0 -1
- package/dist/components/styling/StyleMarker.d.ts +0 -3
- package/dist/components/styling/StyleMarker.d.ts.map +0 -1
- package/dist/components/ui/Button.css.d.ts +0 -34
- package/dist/components/ui/Button.css.d.ts.map +0 -1
- package/dist/components/ui/Button.d.ts +0 -9
- package/dist/components/ui/Button.d.ts.map +0 -1
- package/dist/components/ui/Heading.css.d.ts +0 -34
- package/dist/components/ui/Heading.css.d.ts.map +0 -1
- package/dist/components/ui/Heading.d.ts +0 -13
- package/dist/components/ui/Heading.d.ts.map +0 -1
- package/dist/components/ui/IconButton.css.d.ts +0 -2
- package/dist/components/ui/IconButton.css.d.ts.map +0 -1
- package/dist/components/ui/IconButton.d.ts +0 -7
- package/dist/components/ui/IconButton.d.ts.map +0 -1
- package/dist/components/ui/Text.css.d.ts +0 -34
- package/dist/components/ui/Text.css.d.ts.map +0 -1
- package/dist/components/ui/Text.d.ts +0 -13
- package/dist/components/ui/Text.d.ts.map +0 -1
- package/dist/constants/styleDataAttribute.d.ts +0 -6
- package/dist/constants/styleDataAttribute.d.ts.map +0 -1
- package/dist/constants/walletDefaults.d.ts +0 -7
- package/dist/constants/walletDefaults.d.ts.map +0 -1
- package/dist/constants/walletMutationKeys.d.ts +0 -14
- package/dist/constants/walletMutationKeys.d.ts.map +0 -1
- package/dist/contexts/walletContext.d.ts +0 -14
- package/dist/contexts/walletContext.d.ts.map +0 -1
- package/dist/errors/walletErrors.d.ts +0 -23
- package/dist/errors/walletErrors.d.ts.map +0 -1
- package/dist/hooks/networkConfig.d.ts +0 -11
- package/dist/hooks/networkConfig.d.ts.map +0 -1
- package/dist/hooks/useResolveSuiNSNames.d.ts +0 -4
- package/dist/hooks/useResolveSuiNSNames.d.ts.map +0 -1
- package/dist/hooks/useSuiClient.d.ts +0 -4
- package/dist/hooks/useSuiClient.d.ts.map +0 -1
- package/dist/hooks/useSuiClientInfiniteQuery.d.ts +0 -26
- package/dist/hooks/useSuiClientInfiniteQuery.d.ts.map +0 -1
- package/dist/hooks/useSuiClientMutation.d.ts +0 -5
- package/dist/hooks/useSuiClientMutation.d.ts.map +0 -1
- package/dist/hooks/useSuiClientQueries.d.ts +0 -28
- package/dist/hooks/useSuiClientQueries.d.ts.map +0 -1
- package/dist/hooks/useSuiClientQuery.d.ts +0 -39
- package/dist/hooks/useSuiClientQuery.d.ts.map +0 -1
- package/dist/hooks/wallet/useAccounts.d.ts +0 -6
- package/dist/hooks/wallet/useAccounts.d.ts.map +0 -1
- package/dist/hooks/wallet/useAutoConnectWallet.d.ts +0 -2
- package/dist/hooks/wallet/useAutoConnectWallet.d.ts.map +0 -1
- package/dist/hooks/wallet/useConnectWallet.d.ts +0 -16
- package/dist/hooks/wallet/useConnectWallet.d.ts.map +0 -1
- package/dist/hooks/wallet/useCurrentAccount.d.ts +0 -6
- package/dist/hooks/wallet/useCurrentAccount.d.ts.map +0 -1
- package/dist/hooks/wallet/useCurrentWallet.d.ts +0 -26
- package/dist/hooks/wallet/useCurrentWallet.d.ts.map +0 -1
- package/dist/hooks/wallet/useDisconnectWallet.d.ts +0 -10
- package/dist/hooks/wallet/useDisconnectWallet.d.ts.map +0 -1
- package/dist/hooks/wallet/useSignAndExecuteTransaction.d.ts +0 -30
- package/dist/hooks/wallet/useSignAndExecuteTransaction.d.ts.map +0 -1
- package/dist/hooks/wallet/useSignPersonalMessage.d.ts +0 -14
- package/dist/hooks/wallet/useSignPersonalMessage.d.ts.map +0 -1
- package/dist/hooks/wallet/useSignTransaction.d.ts +0 -18
- package/dist/hooks/wallet/useSignTransaction.d.ts.map +0 -1
- package/dist/hooks/wallet/useSlushWallet.d.ts +0 -6
- package/dist/hooks/wallet/useSlushWallet.d.ts.map +0 -1
- package/dist/hooks/wallet/useSwitchAccount.d.ts +0 -15
- package/dist/hooks/wallet/useSwitchAccount.d.ts.map +0 -1
- package/dist/hooks/wallet/useUnsafeBurnerWallet.d.ts +0 -2
- package/dist/hooks/wallet/useUnsafeBurnerWallet.d.ts.map +0 -1
- package/dist/hooks/wallet/useWalletPropertiesChanged.d.ts +0 -5
- package/dist/hooks/wallet/useWalletPropertiesChanged.d.ts.map +0 -1
- package/dist/hooks/wallet/useWalletStore.d.ts +0 -3
- package/dist/hooks/wallet/useWalletStore.d.ts.map +0 -1
- package/dist/hooks/wallet/useWallets.d.ts +0 -5
- package/dist/hooks/wallet/useWallets.d.ts.map +0 -1
- package/dist/hooks/wallet/useWalletsChanged.d.ts +0 -6
- package/dist/hooks/wallet/useWalletsChanged.d.ts.map +0 -1
- package/dist/index.d.ts +0 -26
- package/dist/index.d.ts.map +0 -1
- package/dist/themes/lightTheme.d.ts +0 -3
- package/dist/themes/lightTheme.d.ts.map +0 -1
- package/dist/themes/themeContract.d.ts +0 -141
- package/dist/themes/themeContract.d.ts.map +0 -1
- package/dist/types/utilityTypes.d.ts +0 -2
- package/dist/types/utilityTypes.d.ts.map +0 -1
- package/dist/types.d.ts +0 -3
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/assertUnreachable.d.ts +0 -5
- package/dist/utils/assertUnreachable.d.ts.map +0 -1
- package/dist/utils/stateStorage.d.ts +0 -3
- package/dist/utils/stateStorage.d.ts.map +0 -1
- package/dist/utils/walletUtils.d.ts +0 -4
- package/dist/utils/walletUtils.d.ts.map +0 -1
- package/dist/walletStore.d.ts +0 -45
- package/dist/walletStore.d.ts.map +0 -1
- package/docs/index.md +0 -91
- package/docs/llms-index.md +0 -27
- package/docs/rpc-hooks.md +0 -161
- package/docs/slush.md +0 -29
- package/docs/sui-client-provider.md +0 -191
- package/docs/themes.md +0 -115
- package/docs/wallet-components/ConnectButton.md +0 -22
- package/docs/wallet-components/ConnectModal.md +0 -66
- package/docs/wallet-hooks/useAccounts.md +0 -36
- package/docs/wallet-hooks/useAutoConnectWallet.md +0 -29
- package/docs/wallet-hooks/useConnectWallet.md +0 -48
- package/docs/wallet-hooks/useCurrentAccount.md +0 -36
- package/docs/wallet-hooks/useCurrentWallet.md +0 -59
- package/docs/wallet-hooks/useDisconnectWallet.md +0 -26
- package/docs/wallet-hooks/useSignAndExecuteTransaction.md +0 -124
- package/docs/wallet-hooks/useSignPersonalMessage.md +0 -59
- package/docs/wallet-hooks/useSignTransaction.md +0 -67
- package/docs/wallet-hooks/useSwitchAccount.md +0 -47
- package/docs/wallet-hooks/useWallets.md +0 -38
- package/docs/wallet-provider.md +0 -37
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
# useSignAndExecuteTransaction
|
|
2
|
-
|
|
3
|
-
> Sign and execute a transaction
|
|
4
|
-
|
|
5
|
-
Use the `useSignAndExecuteTransaction` hook to prompt the user to sign and execute a transaction
|
|
6
|
-
block with their wallet.
|
|
7
|
-
|
|
8
|
-
```ts
|
|
9
|
-
|
|
10
|
-
function MyComponent() {
|
|
11
|
-
const { mutate: signAndExecuteTransaction } = useSignAndExecuteTransaction();
|
|
12
|
-
const [digest, setDigest] = useState('');
|
|
13
|
-
const currentAccount = useCurrentAccount();
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div style={{ padding: 20 }}>
|
|
17
|
-
<ConnectButton />
|
|
18
|
-
{currentAccount && (
|
|
19
|
-
<>
|
|
20
|
-
<div>
|
|
21
|
-
<button
|
|
22
|
-
onClick={() => {
|
|
23
|
-
signAndExecuteTransaction(
|
|
24
|
-
{
|
|
25
|
-
transaction: new Transaction(),
|
|
26
|
-
chain: 'sui:devnet',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
onSuccess: (result) => {
|
|
30
|
-
console.log('executed transaction', result);
|
|
31
|
-
setDigest(result.digest);
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
);
|
|
35
|
-
}}
|
|
36
|
-
>
|
|
37
|
-
Sign and execute transaction
|
|
38
|
-
</button>
|
|
39
|
-
</div>
|
|
40
|
-
<div>Digest: {digest}</div>
|
|
41
|
-
</>
|
|
42
|
-
)}
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Example
|
|
49
|
-
|
|
50
|
-
## Return additional data, or executing through GraphQL
|
|
51
|
-
|
|
52
|
-
To customize how transactions are executed, and what data is returned when executing a transaction,
|
|
53
|
-
you can pass a custom `execute` function.
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
|
|
57
|
-
ConnectButton,
|
|
58
|
-
useSuiClient,
|
|
59
|
-
useCurrentAccount,
|
|
60
|
-
useSignAndExecuteTransaction,
|
|
61
|
-
} from '@mysten/dapp-kit';
|
|
62
|
-
|
|
63
|
-
function MyComponent() {
|
|
64
|
-
const client = useSuiClient();
|
|
65
|
-
const { mutate: signAndExecuteTransaction } = useSignAndExecuteTransaction({
|
|
66
|
-
execute: async ({ bytes, signature }) =>
|
|
67
|
-
await client.executeTransactionBlock({
|
|
68
|
-
transactionBlock: bytes,
|
|
69
|
-
signature,
|
|
70
|
-
options: {
|
|
71
|
-
// Raw effects are required so the effects can be reported back to the wallet
|
|
72
|
-
showRawEffects: true,
|
|
73
|
-
// Select additional data to return
|
|
74
|
-
showObjectChanges: true,
|
|
75
|
-
},
|
|
76
|
-
}),
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const [digest, setDigest] = useState('');
|
|
80
|
-
const currentAccount = useCurrentAccount();
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<div style={{ padding: 20 }}>
|
|
84
|
-
<ConnectButton />
|
|
85
|
-
{currentAccount && (
|
|
86
|
-
<>
|
|
87
|
-
<div>
|
|
88
|
-
<button
|
|
89
|
-
onClick={() => {
|
|
90
|
-
signAndExecuteTransaction(
|
|
91
|
-
{
|
|
92
|
-
transaction: new Transaction(),
|
|
93
|
-
chain: 'sui:devnet',
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
onSuccess: (result) => {
|
|
97
|
-
console.log('object changes', result.objectChanges);
|
|
98
|
-
setDigest(result.digest);
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
);
|
|
102
|
-
}}
|
|
103
|
-
>
|
|
104
|
-
Sign and execute transaction
|
|
105
|
-
</button>
|
|
106
|
-
</div>
|
|
107
|
-
<div>Digest: {digest}</div>
|
|
108
|
-
</>
|
|
109
|
-
)}
|
|
110
|
-
</div>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Arguments
|
|
116
|
-
|
|
117
|
-
- `transaction`: The transaction to sign and execute.
|
|
118
|
-
- `chain`: (optional) The chain identifier the transaction should be signed for. Defaults to the
|
|
119
|
-
active network of the dApp.
|
|
120
|
-
- `execute`: (optional) A custom function to execute the transaction
|
|
121
|
-
|
|
122
|
-
In addition to these options, you can also pass any options that the
|
|
123
|
-
[SuiJsonRpcClient.signAndExecuteTransaction](/typedoc/classes/_mysten_sui.client.SuiJsonRpcClient.html#signAndExecuteTransactionBlock)
|
|
124
|
-
method accepts.
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# useSignPersonalMessage
|
|
2
|
-
|
|
3
|
-
> Sign a personal message with the connected wallet
|
|
4
|
-
|
|
5
|
-
Use the `useSignPersonalMessage` hook to prompt the user to sign a message with their wallet.
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
|
|
9
|
-
function MyComponent() {
|
|
10
|
-
const { mutate: signPersonalMessage } = useSignPersonalMessage();
|
|
11
|
-
const [message, setMessage] = useState('hello, World!');
|
|
12
|
-
const [signature, setSignature] = useState('');
|
|
13
|
-
const currentAccount = useCurrentAccount();
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div style={{ padding: 20 }}>
|
|
17
|
-
<ConnectButton />
|
|
18
|
-
{currentAccount && (
|
|
19
|
-
<>
|
|
20
|
-
<div>
|
|
21
|
-
<label>
|
|
22
|
-
Message:{' '}
|
|
23
|
-
<input type="text" value={message} onChange={(ev) => setMessage(ev.target.value)} />
|
|
24
|
-
</label>
|
|
25
|
-
</div>
|
|
26
|
-
<button
|
|
27
|
-
onClick={() => {
|
|
28
|
-
signPersonalMessage(
|
|
29
|
-
{
|
|
30
|
-
message: new TextEncoder().encode(message),
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
onSuccess: (result) => setSignature(result.signature),
|
|
34
|
-
},
|
|
35
|
-
);
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
Sign message
|
|
39
|
-
</button>
|
|
40
|
-
<div>Signature: {signature}</div>
|
|
41
|
-
</>
|
|
42
|
-
)}
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Example
|
|
49
|
-
|
|
50
|
-
## Arguments
|
|
51
|
-
|
|
52
|
-
- `message`: The message to sign, as a `Uint8Array`.
|
|
53
|
-
- `chain`: (optional) The chain identifier the message should be signed for. Defaults to the active
|
|
54
|
-
network of the dApp.
|
|
55
|
-
|
|
56
|
-
## Result
|
|
57
|
-
|
|
58
|
-
- `signature`: The signature of the message, as a `Base64`-encoded `string`.
|
|
59
|
-
- `bytes`: The bytes of the message, as a `Base64`-encoded `string`.
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# useSignTransaction
|
|
2
|
-
|
|
3
|
-
> Sign a transaction without executing it
|
|
4
|
-
|
|
5
|
-
Use the `useSignTransaction` hook to prompt the user to sign a transaction with their wallet.
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
|
|
9
|
-
ConnectButton,
|
|
10
|
-
useCurrentAccount,
|
|
11
|
-
useSignTransaction,
|
|
12
|
-
useSuiClient,
|
|
13
|
-
} from '@mysten/dapp-kit';
|
|
14
|
-
|
|
15
|
-
function MyComponent() {
|
|
16
|
-
const { mutateAsync: signTransaction } = useSignTransaction();
|
|
17
|
-
const [signature, setSignature] = useState('');
|
|
18
|
-
const client = useSuiClient();
|
|
19
|
-
const currentAccount = useCurrentAccount();
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<div style={{ padding: 20 }}>
|
|
23
|
-
<ConnectButton />
|
|
24
|
-
{currentAccount && (
|
|
25
|
-
<>
|
|
26
|
-
<div>
|
|
27
|
-
<button
|
|
28
|
-
onClick={async () => {
|
|
29
|
-
const { bytes, signature } = await signTransaction({
|
|
30
|
-
transaction: new Transaction(),
|
|
31
|
-
chain: 'sui:devnet',
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const executeResult = await client.executeTransactionBlock({
|
|
35
|
-
transactionBlock: bytes,
|
|
36
|
-
signature,
|
|
37
|
-
options: {
|
|
38
|
-
showRawEffects: true,
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
console.log(executeResult);
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
Sign empty transaction
|
|
46
|
-
</button>
|
|
47
|
-
</div>
|
|
48
|
-
<div>Signature: {signature}</div>
|
|
49
|
-
</>
|
|
50
|
-
)}
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Example
|
|
57
|
-
|
|
58
|
-
## Arguments
|
|
59
|
-
|
|
60
|
-
- `transactionBlock`: The transaction to sign.
|
|
61
|
-
- `chain`: (optional) The chain identifier the transaction should be signed for. Defaults to the
|
|
62
|
-
active network of the dApp.
|
|
63
|
-
|
|
64
|
-
## Result
|
|
65
|
-
|
|
66
|
-
- `signature`: The signature of the message, as a Base64-encoded `string`.
|
|
67
|
-
- `bytes`: The serialized transaction bytes, as a Base64-encoded `string`.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# useSwitchAccount
|
|
2
|
-
|
|
3
|
-
> Switch the active wallet account
|
|
4
|
-
|
|
5
|
-
The `useSwitchAccount` hook is a mutation hook for establishing a connection to a specific wallet.
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
|
|
9
|
-
function MyComponent() {
|
|
10
|
-
const { mutate: switchAccount } = useSwitchAccount();
|
|
11
|
-
const accounts = useAccounts();
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div style={{ padding: 20 }}>
|
|
15
|
-
<ConnectButton />
|
|
16
|
-
<ul>
|
|
17
|
-
{accounts.map((account) => (
|
|
18
|
-
<li key={account.address}>
|
|
19
|
-
<button
|
|
20
|
-
onClick={() => {
|
|
21
|
-
switchAccount(
|
|
22
|
-
{ account },
|
|
23
|
-
{
|
|
24
|
-
onSuccess: () => console.log(`switched to ${account.address}`),
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
Switch to {account.address}
|
|
30
|
-
</button>
|
|
31
|
-
</li>
|
|
32
|
-
))}
|
|
33
|
-
</ul>
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Example
|
|
40
|
-
|
|
41
|
-
## Arguments
|
|
42
|
-
|
|
43
|
-
- `args` - Arguments passed to the `connect` function of the wallet.
|
|
44
|
-
- `account` - The account to switch to.
|
|
45
|
-
|
|
46
|
-
- `options` - Options passed the `useMutation` hook from
|
|
47
|
-
[@tanstack/react-query](https://tanstack.com/query/latest/docs/react/guides/mutations).
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# useWallets
|
|
2
|
-
|
|
3
|
-
> List available wallet extensions
|
|
4
|
-
|
|
5
|
-
The `useWallets` hook returns an array of wallets that are available to the user. The wallets are
|
|
6
|
-
sorted by their priority, with the highest priority wallet being the first in the array.
|
|
7
|
-
|
|
8
|
-
```ts
|
|
9
|
-
|
|
10
|
-
function MyComponent() {
|
|
11
|
-
const wallets = useWallets();
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div>
|
|
15
|
-
<h2>Installed wallets</h2>
|
|
16
|
-
{wallets.length === 0 && <div>No wallets installed</div>}
|
|
17
|
-
<ul>
|
|
18
|
-
{wallets.map((wallet) => (
|
|
19
|
-
<li key={wallet.name}>{wallet.name}</li>
|
|
20
|
-
))}
|
|
21
|
-
</ul>
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Example
|
|
28
|
-
|
|
29
|
-
## Wallet properties
|
|
30
|
-
|
|
31
|
-
- `name` - The name of the wallet.
|
|
32
|
-
- `version` - The version of the wallet as a string.
|
|
33
|
-
- `icon` - A data URL of the wallet icon as an SVG.
|
|
34
|
-
- `accounts` - An array of accounts that are available in the wallet.
|
|
35
|
-
- `features` - An object with all the
|
|
36
|
-
[wallet-standard](https://github.com/wallet-standard/wallet-standard) features implemented by the
|
|
37
|
-
wallet.
|
|
38
|
-
- `chains` - An array of chain identifiers that the wallet supports.
|
package/docs/wallet-provider.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# WalletProvider
|
|
2
|
-
|
|
3
|
-
> React provider for wallet connections
|
|
4
|
-
|
|
5
|
-
Use `WalletProvider` to set up the necessary context for your React app. Use it at the root of your
|
|
6
|
-
app, so that you can use any of the dApp Kit wallet components underneath it.
|
|
7
|
-
|
|
8
|
-
```tsx
|
|
9
|
-
function App() {
|
|
10
|
-
return (
|
|
11
|
-
<WalletProvider>
|
|
12
|
-
<YourApp />
|
|
13
|
-
</WalletProvider>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
The `WalletProvider` manages all wallet state for you, and makes the current wallet state available
|
|
19
|
-
to other dApp Kit hooks and components.
|
|
20
|
-
|
|
21
|
-
### Props
|
|
22
|
-
|
|
23
|
-
All props are optional.
|
|
24
|
-
|
|
25
|
-
- `preferredWallets` - A list of wallets that are sorted to the top of the wallet list.
|
|
26
|
-
- `walletFilter` - A filter function that accepts a wallet and returns a boolean. This filters the
|
|
27
|
-
list of wallets presented to users when selecting a wallet to connect from, ensuring that only
|
|
28
|
-
wallets that meet the dApp requirements can connect.
|
|
29
|
-
- `enableUnsafeBurner` - Enables the development-only unsafe burner wallet, useful for testing.
|
|
30
|
-
- `autoConnect` - Enables automatically reconnecting to the most recently used wallet account upon
|
|
31
|
-
mounting.
|
|
32
|
-
- `slushWallet` - Enables and configures the Slush wallet. Read more about how to
|
|
33
|
-
[use the Slush integration](./slush).
|
|
34
|
-
- `storage` - Configures how the most recently connected-to wallet account is stored. Set to `null`
|
|
35
|
-
to disable persisting state entirely. Defaults to using `localStorage` if it is available.
|
|
36
|
-
- `storageKey` - The key to use to store the most recently connected wallet account.
|
|
37
|
-
- `theme` - The theme to use for styling UI components. Defaults to using the light theme.
|