-
-
Notifications
You must be signed in to change notification settings - Fork 930
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: experimental EIP-5792 Actions (#3878)
* wip: getCapabilities * wip: sendCalls * wip: up * wip: writeContracts * wip: getCallsStatus * wip * bump viem * update * update * wip: showCallsStatus * docs * wip: docs * chore: changeset
- Loading branch information
Showing
62 changed files
with
3,435 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"wagmi": minor | ||
"@wagmi/core": minor | ||
--- | ||
|
||
Added experimental EIP-5792 Actions & Hooks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<script setup> | ||
const packageName = '@wagmi/core/experimental' | ||
const actionName = 'getCallsStatus' | ||
const typeName = 'GetCallsStatus' | ||
</script> | ||
|
||
# getCallsStatus | ||
|
||
Action to fetch the status and receipts of a call batch that was sent via [`sendCalls`](/core/api/actions/sendCalls). | ||
|
||
[Read more.](https://github.com/ethereum/EIPs/blob/1663ea2e7a683285f977eda51c32cec86553f585/EIPS/eip-5792.md#wallet_getcallsstatus) | ||
|
||
::: warning | ||
This is an experimental action that is not supported in most wallets. It is recommended to have a fallback mechanism if using this in production. | ||
::: | ||
|
||
## Import | ||
|
||
```ts | ||
import { getCallsStatus } from '@wagmi/core/experimental' | ||
``` | ||
|
||
## Usage | ||
|
||
::: code-group | ||
```ts [index.ts] | ||
import { getCallsStatus } from '@wagmi/core/experimental' | ||
import { config } from './config' | ||
|
||
const status = await getCallsStatus(config, { | ||
id: '0x1234567890abcdef', | ||
}) | ||
``` | ||
<<< @/snippets/core/config.ts[config.ts] | ||
::: | ||
|
||
## Parameters | ||
|
||
```ts | ||
import { type GetCallsStatusParameters } from '@wagmi/core/experimental' | ||
``` | ||
|
||
### connector | ||
|
||
`Connector | undefined` | ||
|
||
Connector to get call statuses with. | ||
|
||
::: code-group | ||
```ts [index.ts] | ||
import { getConnections, getCallsStatus } from '@wagmi/core/experimental' | ||
import { config } from './config' | ||
|
||
const connections = getConnections(config) | ||
const status = await getCallsStatus(config, { | ||
connector: connections[0]?.connector, // [!code focus] | ||
id: '0x1234567890abcdef', | ||
}) | ||
``` | ||
<<< @/snippets/core/config.ts[config.ts] | ||
::: | ||
|
||
### id | ||
|
||
`string` | ||
|
||
Identifier of the call batch. | ||
|
||
::: code-group | ||
```ts [index.ts] | ||
import { getCallsStatus } from '@wagmi/core/experimental' | ||
import { config } from './config' | ||
|
||
const status = await getCallsStatus(config, { | ||
id: '0x1234567890abcdef', // [!code focus] | ||
}) | ||
``` | ||
<<< @/snippets/core/config.ts[config.ts] | ||
::: | ||
|
||
## Return Type | ||
|
||
```ts | ||
import { type GetCallsStatusReturnType } from '@wagmi/core/experimental' | ||
``` | ||
|
||
`bigint` | ||
|
||
Most recent block number seen. | ||
|
||
## Error | ||
|
||
```ts | ||
import { type GetCallsStatusErrorType } from '@wagmi/core/experimental' | ||
``` | ||
|
||
<!--@include: @shared/query-imports.md--> | ||
|
||
## Viem | ||
|
||
- [`getCallsStatus`](https://viem.sh/experimental/eip5792/getCallsStatus) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<script setup> | ||
const packageName = '@wagmi/core/experimental' | ||
const actionName = 'getCapabilities' | ||
const typeName = 'GetCapabilities' | ||
</script> | ||
|
||
# getCapabilities | ||
|
||
Action to extract capabilities (grouped by chain ID) that a connected wallet supports (e.g. paymasters, session keys, etc). | ||
|
||
[Read more.](https://github.com/ethereum/EIPs/blob/815028dc634463e1716fc5ce44c019a6040f0bef/EIPS/eip-5792.md#wallet_getcapabilities) | ||
|
||
::: warning | ||
This is an experimental action that is not supported in most wallets. It is recommended to have a fallback mechanism if using this in production. | ||
::: | ||
|
||
## Import | ||
|
||
```ts | ||
import { getCapabilities } from '@wagmi/core/experimental' | ||
``` | ||
|
||
## Usage | ||
|
||
::: code-group | ||
```ts [index.ts] | ||
import { getCapabilities } from '@wagmi/core/experimental' | ||
import { config } from './config' | ||
|
||
const capabilities = await getCapabilities(config) | ||
``` | ||
<<< @/snippets/core/config.ts[config.ts] | ||
::: | ||
|
||
## Parameters | ||
|
||
```ts | ||
import { type GetCapabilitiesParameters } from '@wagmi/core/experimental' | ||
``` | ||
|
||
### account | ||
|
||
`Account | Address | undefined` | ||
|
||
Fetch capabilities for the provided account. | ||
|
||
::: code-group | ||
```ts [index.ts] | ||
import { getCapabilities } from '@wagmi/core/experimental' | ||
import { config } from './config' | ||
|
||
const capabilities = await getCapabilities(config, { | ||
account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus] | ||
}) | ||
``` | ||
<<< @/snippets/core/config.ts[config.ts] | ||
::: | ||
|
||
### connector | ||
|
||
`Connector | undefined` | ||
|
||
Connector to get capabilities from. | ||
|
||
::: code-group | ||
```ts [index.ts] | ||
import { getConnections, getCapabilities } from '@wagmi/core/experimental' | ||
import { config } from './config' | ||
|
||
const connections = getConnections(config) | ||
const capabilities = await getCapabilities(config, { | ||
connector: connections[0]?.connector, // [!code focus] | ||
}) | ||
``` | ||
<<< @/snippets/core/config.ts[config.ts] | ||
::: | ||
|
||
## Return Type | ||
|
||
```ts | ||
import { type GetCapabilitiesReturnType } from '@wagmi/core/experimental' | ||
``` | ||
|
||
`bigint` | ||
|
||
Most recent block number seen. | ||
|
||
## Error | ||
|
||
```ts | ||
import { type GetCapabilitiesErrorType } from '@wagmi/core/experimental' | ||
``` | ||
|
||
<!--@include: @shared/query-imports.md--> | ||
|
||
## Viem | ||
|
||
- [`getCapabilities`](https://viem.sh/experimental/eip5792/getCapabilities) |
Oops, something went wrong.