Skip to Content

@cfxdevkit/react


@cfxdevkit/react / ContractWriter

Function: ContractWriter()

ContractWriter(__namedParameters): Element

Defined in: components/contract/ContractWriter.tsx:72

ContractWriter Component

Headless contract write component. Use render prop for custom UI.

Parameters

__namedParameters

ContractWriterProps

Returns

Element

Example

<ContractWriter address="0x..." abi={ERC20_ABI} functionName="transfer" chain="evm" onSuccess={(hash) => console.log('Success:', hash)} > {({ write, hash, isLoading }) => ( <div> <button onClick={() => write(['0x...', '1000000000000000000'])}> Transfer </button> {isLoading && <p>Sending...</p>} {hash && <p>TX: {hash}</p>} </div> )} </ContractWriter>