Skip to content

Commit

Permalink
website: describe useContractWrite and useSignTypedData
Browse files Browse the repository at this point in the history
  • Loading branch information
fracek committed Nov 9, 2023
1 parent 8e68b85 commit d992ae7
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 4 deletions.
62 changes: 60 additions & 2 deletions website/content/hooks/useContractWrite.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,67 @@ export function App() {

## Options

TODO
* `calls?: Call[]`
- The list of calls to make in the transaction.
- From starknet.js

* `abis?: Abi[]`
- List of contracts abis.
- From starknet.js

* `options?: InvocationsDetails`
- Additional invocation options.
- From starknet.js

## Returns

TODO
* `write?: ({ calls: Call[], abis: Abi[], options: InvocationDetails }) => void`
- Execute the calls.

* `writeAsync?: ({ calls: Call[], abis: Abi[], options: InvocationDetails }) => Promise<InvokeFunctionResponse>`
- Execute the calls.
- Returns the RPC response.
- From starknet.js

* `data?: InvokeFunctionResponse`
- The result of sending the transaction to the network.
- From starknet.js

* `error?: Error`
- From TanStack Query.
- The error if the call was not successful.

* `variables?: { calls: Call[], abis: Abi[], options: InvocationDetails }`
- From TanStack Query.
- Variables passed to the function invocation.

* `reset: () => void`
- From TanStack Query.
- Clean the mutation internal state.

* `status: "error" | "idle" | "loading" | "success"`
- From TanStack Query.
- `idle` before sending the transaction.
- `loading` while sending the transaction.
- `success` if the last invocation was successful.
- `error` if there was an error.

* `isSuccess: boolean`
- From TanStack Query.
- Derived from `status`.

* `isError: boolean`
- From TanStack Query.
- Derived from `status`.

* `isLoading: boolean`
- From TanStack Query.
- Derived from `status`.

* `isIdle: boolean`
- From TanStack Query.
- Derived from `status`.

* `isPaused: boolean`
- From TanStack Query.
- True if the invocation has been paused.
61 changes: 59 additions & 2 deletions website/content/hooks/useSignTypedData.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,67 @@ export function App() {

## Options

TODO
* `domain: StarkNetDomain`
- TypeData's domain.

* `types: Record<string, StarkNetType[]>`
- TypeData's types.

* `message: Record<string, unkonwn>`
- TypeData's message.

* `primaryType: string`
- TypeData's primary type.

## Returns

TODO
* `signTypedData?: ({ domain, types, message, primaryType }) => void`
- Request user to sign data.

* `writeAsync?: ({ domain, types, message, primaryType }) => Promise<Signature>`
- Request user to sign data.
- Returns the signature.
- From starknet.js

* `data?: Signature`
- The signature.
- From starknet.js

* `error?: Error`
- From TanStack Query.
- The error if the call was not successful.

* `variables?: { calls: Call[], abis: Abi[], options: InvocationDetails }`
- From TanStack Query.
- Variables passed to the function invocation.

* `reset: () => void`
- From TanStack Query.
- Clean the mutation internal state.

* `status: "error" | "idle" | "loading" | "success"`
- From TanStack Query.
- `idle` before sending the transaction.
- `loading` while sending the transaction.
- `success` if the last invocation was successful.
- `error` if there was an error.

* `isSuccess: boolean`
- From TanStack Query.
- Derived from `status`.

* `isError: boolean`
- From TanStack Query.
- Derived from `status`.

* `isLoading: boolean`
- From TanStack Query.
- Derived from `status`.

* `isIdle: boolean`
- From TanStack Query.
- Derived from `status`.

* `isPaused: boolean`
- From TanStack Query.
- True if the invocation has been paused.

0 comments on commit d992ae7

Please sign in to comment.