-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update vhs * sourcify cli plugin * parse sourcify response * fix typecheck * changeset * add docs * restore correct public assets * refactor: sourcify plugin errors * test: update snapshot --------- Co-authored-by: wslyvh <[email protected]>
- Loading branch information
Showing
9 changed files
with
767 additions
and
1 deletion.
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,5 @@ | ||
--- | ||
'@wagmi/cli': patch | ||
--- | ||
|
||
Added [Sourcify](https://sourcify.dev) CLI plugin. |
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,105 @@ | ||
--- | ||
title: 'Sourcify' | ||
description: 'Sourcify plugin' | ||
--- | ||
|
||
# Sourcify | ||
|
||
Plugin for fetching ABIs from [Sourcify](https://sourcify.dev/). Sourcify is a decentralized, open-source, smart contract verification and metadata repository. | ||
|
||
```ts | ||
import { sourcify } from '@wagmi/cli/plugins' | ||
``` | ||
|
||
## Usage | ||
|
||
```ts | ||
import { defineConfig } from '@wagmi/cli' | ||
import { sourcify } from '@wagmi/cli/plugins' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
sourcify({ | ||
contracts: [ | ||
{ | ||
name: 'deposit', | ||
address: '0x00000000219ab540356cbb839cbe05303d7705fa', | ||
}, | ||
], | ||
}), | ||
], | ||
}) | ||
``` | ||
|
||
## Configuration | ||
|
||
### contracts | ||
|
||
Contracts to fetch ABIs for. | ||
|
||
```ts {7-12} | ||
import { defineConfig } from '@wagmi/cli' | ||
import { sourcify } from '@wagmi/cli/plugins' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
sourcify({ | ||
contracts: [ | ||
{ | ||
name: 'deposit', | ||
address: '0x00000000219ab540356cbb839cbe05303d7705fa', | ||
}, | ||
], | ||
}), | ||
], | ||
}) | ||
``` | ||
|
||
### chainId | ||
|
||
Chain id to use for fetching ABI. If `address` is an object, `chainId` is used to select the address. | ||
|
||
```ts {7,16} | ||
import { defineConfig } from '@wagmi/cli' | ||
import { sourcify } from '@wagmi/cli/plugins' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
sourcify({ | ||
chainId: 100, | ||
contracts: [ | ||
{ | ||
name: 'Community', | ||
address: { | ||
100: '0xC4c622862a8F548997699bE24EA4bc504e5cA865', | ||
137: '0xC4c622862a8F548997699bE24EA4bc504e5cA865', | ||
}, | ||
}, | ||
], | ||
}), | ||
], | ||
}) | ||
``` | ||
|
||
### cacheDuration (optional) | ||
|
||
Duration in milliseconds to cache ABIs. Defaults to `1_800_000` (30 minutes). | ||
|
||
```ts {7} | ||
import { defineConfig } from '@wagmi/cli' | ||
import { sourcify } from '@wagmi/cli/plugins' | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
sourcify({ | ||
cacheDuration: 300_000, | ||
contracts: [ | ||
{ | ||
name: 'deposit', | ||
address: '0x00000000219ab540356cbb839cbe05303d7705fa', | ||
}, | ||
], | ||
}), | ||
], | ||
}) | ||
``` |
258 changes: 258 additions & 0 deletions
258
packages/cli/src/plugins/__snapshots__/sourcify.test.ts.snap
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,258 @@ | ||
// Vitest Snapshot v1 | ||
|
||
exports[`sourcify > contracts > fetches ABI 1`] = ` | ||
[ | ||
{ | ||
"abi": [ | ||
{ | ||
"inputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "constructor", | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": false, | ||
"internalType": "bytes", | ||
"name": "pubkey", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "bytes", | ||
"name": "withdrawal_credentials", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "bytes", | ||
"name": "amount", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "bytes", | ||
"name": "signature", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "bytes", | ||
"name": "index", | ||
"type": "bytes", | ||
}, | ||
], | ||
"name": "DepositEvent", | ||
"type": "event", | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bytes", | ||
"name": "pubkey", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"internalType": "bytes", | ||
"name": "withdrawal_credentials", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"internalType": "bytes", | ||
"name": "signature", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"internalType": "bytes32", | ||
"name": "deposit_data_root", | ||
"type": "bytes32", | ||
}, | ||
], | ||
"name": "deposit", | ||
"outputs": [], | ||
"stateMutability": "payable", | ||
"type": "function", | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "get_deposit_count", | ||
"outputs": [ | ||
{ | ||
"internalType": "bytes", | ||
"name": "", | ||
"type": "bytes", | ||
}, | ||
], | ||
"stateMutability": "view", | ||
"type": "function", | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "get_deposit_root", | ||
"outputs": [ | ||
{ | ||
"internalType": "bytes32", | ||
"name": "", | ||
"type": "bytes32", | ||
}, | ||
], | ||
"stateMutability": "view", | ||
"type": "function", | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bytes4", | ||
"name": "interfaceId", | ||
"type": "bytes4", | ||
}, | ||
], | ||
"name": "supportsInterface", | ||
"outputs": [ | ||
{ | ||
"internalType": "bool", | ||
"name": "", | ||
"type": "bool", | ||
}, | ||
], | ||
"stateMutability": "pure", | ||
"type": "function", | ||
}, | ||
], | ||
"address": { | ||
"1": "0x00000000219ab540356cbb839cbe05303d7705fa", | ||
}, | ||
"name": "DepositContract", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`sourcify > contracts > fetches ABI with multichain deployment 1`] = ` | ||
[ | ||
{ | ||
"abi": [ | ||
{ | ||
"inputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "constructor", | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"indexed": false, | ||
"internalType": "bytes", | ||
"name": "pubkey", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "bytes", | ||
"name": "withdrawal_credentials", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "bytes", | ||
"name": "amount", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "bytes", | ||
"name": "signature", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"indexed": false, | ||
"internalType": "bytes", | ||
"name": "index", | ||
"type": "bytes", | ||
}, | ||
], | ||
"name": "DepositEvent", | ||
"type": "event", | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bytes", | ||
"name": "pubkey", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"internalType": "bytes", | ||
"name": "withdrawal_credentials", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"internalType": "bytes", | ||
"name": "signature", | ||
"type": "bytes", | ||
}, | ||
{ | ||
"internalType": "bytes32", | ||
"name": "deposit_data_root", | ||
"type": "bytes32", | ||
}, | ||
], | ||
"name": "deposit", | ||
"outputs": [], | ||
"stateMutability": "payable", | ||
"type": "function", | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "get_deposit_count", | ||
"outputs": [ | ||
{ | ||
"internalType": "bytes", | ||
"name": "", | ||
"type": "bytes", | ||
}, | ||
], | ||
"stateMutability": "view", | ||
"type": "function", | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "get_deposit_root", | ||
"outputs": [ | ||
{ | ||
"internalType": "bytes32", | ||
"name": "", | ||
"type": "bytes32", | ||
}, | ||
], | ||
"stateMutability": "view", | ||
"type": "function", | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bytes4", | ||
"name": "interfaceId", | ||
"type": "bytes4", | ||
}, | ||
], | ||
"name": "supportsInterface", | ||
"outputs": [ | ||
{ | ||
"internalType": "bool", | ||
"name": "", | ||
"type": "bool", | ||
}, | ||
], | ||
"stateMutability": "pure", | ||
"type": "function", | ||
}, | ||
], | ||
"address": { | ||
"100": "0xC4c622862a8F548997699bE24EA4bc504e5cA865", | ||
"137": "0xC4c622862a8F548997699bE24EA4bc504e5cA865", | ||
}, | ||
"name": "Community", | ||
}, | ||
] | ||
`; |
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ it('should expose correct exports', () => { | |
"foundry", | ||
"hardhat", | ||
"react", | ||
"sourcify", | ||
] | ||
`) | ||
}) |
Oops, something went wrong.
cb707f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wagmi – ./
wagmi-git-main-wagmi-dev.vercel.app
www.wagmi.sh
wagmi-wagmi-dev.vercel.app
wagmi-xyz.vercel.app
wagmi.sh