Skip to content

Commit 34bb409

Browse files
feat: 0.4.0 update
1 parent 9f1c69d commit 34bb409

File tree

9 files changed

+1854
-439
lines changed

9 files changed

+1854
-439
lines changed

README.md

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,60 @@ Example usage:
109109

110110
```html
111111
<script>
112-
import { web3Modal } from 'svelte-wagmi';
112+
import { web3Modal } from 'svelte-wagmi';
113113
</script>
114114

115115
{#if $web3Modal}
116-
<button on:click={() => $web3Modal.openModal()}>
117-
Connect to Ethereum
118-
</button>
116+
<button on:click="{()" ="">$web3Modal.openModal()}> Connect to Ethereum</button>
119117
{:else}
120118

121-
<p>Web3Modal not yet available</p>
119+
<p>Web3Modal not yet available</p>
122120
{/if}
123121
```
124122

125-
### configureWagmi
123+
### defaultConfig
124+
125+
The `defaultConfig` function is used to configure the `@wagmi/core` library and initialize the Svelte stores. It takes an optional options object that can be used to configure the behavior of the function.
126+
127+
- `autoConnect` (boolean, default: `true`): Specifies whether the Ethereum client should automatically connect to a provider upon initialization. If set to `true`, the client will attempt to connect automatically.
128+
- `appName` (string, default: `'Erc.Kit'`): Specifies the name of the application using the Ethereum client.
129+
- `appIcon` (string): Specifies the URL or path to an icon representing the application.
130+
- `appDescription` (string): Specifies the description of the application.
131+
- `appUrl` (string): Specifies the URL of the application.
132+
- `chains` (array, default: `defaultChains`): An array of chain configurations to connect with. If not provided, the function will use default chain configurations.
133+
- `alchemyId` (string): The API key for the Alchemy provider, used for connecting to the Alchemy service.
134+
- `infuraId` (string): The API key for the Infura provider, used for connecting to the Infura service.
135+
- `connectors` (object): An object containing customized connector configurations for the Ethereum client.
136+
- `publicClient` (object): Specifies a pre-configured public client object.
137+
- `stallTimeout` (number): Specifies the stall timeout value for the Ethereum client.
138+
- `walletConnectProjectId` (string): The project ID used for the WalletConnect integration.
139+
140+
### Return Value:
141+
142+
The `defaultConfig` function returns an object with the following properties:
143+
144+
- `init`: A function that can be called to initialize the Ethereum client and set up the connections based on the provided configurations.
145+
146+
Example usage:
147+
148+
```html
149+
<script>
150+
import { defaultConfig } from 'svelte-wagmi';
151+
import { onMount } from 'svelte';
152+
import { PUBLIC_WALLETCONNECT_ID, PUBLIC_ALCHEMY_ID } from '$env/static/public';
153+
154+
onMount(async () => {
155+
const erckit = defaultConfig({
156+
appName: 'erc.kit',
157+
walletConnectProjectId: PUBLIC_WALLETCONNECT_ID,
158+
alchemyId: PUBLIC_ALCHEMY_ID
159+
});
160+
161+
await erckit.init();
162+
</script>
163+
```
164+
165+
### configureWagmi (deprecated)
126166
127167
The `configureWagmi` function is used to configure the `@wagmi/core` library and initialize the Svelte stores. It takes an optional options object that can be used to configure the behavior of the function.
128168
@@ -146,6 +186,25 @@ Example usage:
146186
});
147187
</script>
148188
```
189+
### configuredConnectors
190+
191+
The `configuredConnectors` are store value array
192+
193+
194+
195+
Example usage:
196+
197+
```html
198+
<script>
199+
import { configuredConnectors } from 'svelte-wagmi';
200+
201+
for (const connector of $configuredConnectors) {
202+
console.log(connector)
203+
}
204+
</script>
205+
206+
<button on:click="{connectToEthereum}">Connect to Ethereum</button>
207+
```
149208
150209
### connection
151210
@@ -161,7 +220,7 @@ The `connection` function is used to connect to an Ethereum provider using the I
161220
import { connection } from 'svelte-wagmi';
162221
163222
async function connectToEthereum() {
164-
await connection(1, 'Sign in to the app with Ethereum');
223+
await connection();
165224
}
166225
</script>
167226

0 commit comments

Comments
 (0)