-
Notifications
You must be signed in to change notification settings - Fork 918
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migration to wagmi v1 and viem (#352)
Co-authored-by: Samuel <sverps@gmail.com>
- Loading branch information
1 parent
9262e6d
commit 7d3e47b
Showing
58 changed files
with
1,041 additions
and
1,079 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
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
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
29 changes: 29 additions & 0 deletions
29
packages/nextjs/components/scaffold-eth/Contract/ContractReadMethods.tsx
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,29 @@ | ||
import { ReadOnlyFunctionForm } from "./ReadOnlyFunctionForm"; | ||
import { Abi, AbiFunction } from "abitype"; | ||
import { Contract, ContractName } from "~~/utils/scaffold-eth/contract"; | ||
|
||
export const ContractReadMethods = ({ deployedContractData }: { deployedContractData: Contract<ContractName> }) => { | ||
if (!deployedContractData) { | ||
return null; | ||
} | ||
|
||
const functionsToDisplay = ( | ||
((deployedContractData.abi || []) as Abi).filter(part => part.type === "function") as AbiFunction[] | ||
).filter(fn => { | ||
const isQueryableWithParams = | ||
(fn.stateMutability === "view" || fn.stateMutability === "pure") && fn.inputs.length > 0; | ||
return isQueryableWithParams; | ||
}); | ||
|
||
if (!functionsToDisplay.length) { | ||
return <>No read methods</>; | ||
} | ||
|
||
return ( | ||
<> | ||
{functionsToDisplay.map(fn => ( | ||
<ReadOnlyFunctionForm contractAddress={deployedContractData.address} abiFunction={fn} key={fn.name} /> | ||
))} | ||
</> | ||
); | ||
}; |
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
40 changes: 40 additions & 0 deletions
40
packages/nextjs/components/scaffold-eth/Contract/ContractVariables.tsx
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,40 @@ | ||
import { DisplayVariable } from "./DisplayVariable"; | ||
import { Abi, AbiFunction } from "abitype"; | ||
import { Contract, ContractName } from "~~/utils/scaffold-eth/contract"; | ||
|
||
export const ContractVariables = ({ | ||
refreshDisplayVariables, | ||
deployedContractData, | ||
}: { | ||
refreshDisplayVariables: boolean; | ||
deployedContractData: Contract<ContractName>; | ||
}) => { | ||
if (!deployedContractData) { | ||
return null; | ||
} | ||
|
||
const functionsToDisplay = ( | ||
(deployedContractData.abi as Abi).filter(part => part.type === "function") as AbiFunction[] | ||
).filter(fn => { | ||
const isQueryableWithNoParams = | ||
(fn.stateMutability === "view" || fn.stateMutability === "pure") && fn.inputs.length === 0; | ||
return isQueryableWithNoParams; | ||
}); | ||
|
||
if (!functionsToDisplay.length) { | ||
return <>No contract variables</>; | ||
} | ||
|
||
return ( | ||
<> | ||
{functionsToDisplay.map(fn => ( | ||
<DisplayVariable | ||
abiFunction={fn} | ||
contractAddress={deployedContractData.address} | ||
key={fn.name} | ||
refreshDisplayVariables={refreshDisplayVariables} | ||
/> | ||
))} | ||
</> | ||
); | ||
}; |
Oops, something went wrong.