Skip to content

Commit

Permalink
feat(react): update hook docs (#458)
Browse files Browse the repository at this point in the history
## Description

Update hook docs with v2 sdk version.

## What type of PR is this? (check all applicable)

- [ ] 🍕 Feature (`feat:`)
- [ ] 🐛 Bug Fix (`fix:`)
- [x] 📝 Documentation Update (`docs:`)
- [ ] 🎨 Style (`style:`)
- [ ] 🧑‍💻 Code Refactor (`refactor:`)
- [ ] 🔥 Performance Improvements (`perf:`)
- [ ] ✅ Test (`test:`)
- [ ] 🤖 Build (`build:`)
- [ ] 🔁 CI (`ci:`)
- [ ] 📦 Chore (`chore:`)
- [ ] ⏩ Revert (`revert:`)
- [ ] 🚀 Breaking Changes (`BREAKING CHANGE:`)

## Related Tickets & Documents

<!--
Please use this format to link related issues: Fixes #<issue_number>
More info:
https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->

## Added tests?

- [ ] 👍 yes
- [ ] 🙅 no, because they aren't needed
- [ ] 🙋 no, because I need help

## Added to documentation?

- [ ] 📜 README.md
- [ ] 📓 Documentation
- [ ] 🙅 no documentation needed

## [optional] Are there any post-deployment tasks we need to perform?

<!-- Describe any additional tasks, if any, and provide steps. -->

## [optional] What gif best describes this PR or how it makes you feel?

<!-- Share a fun gif related to your PR! -->

### PR Title and Description Guidelines:

- Ensure your PR title follows semantic versioning standards. This helps
automate releases and changelogs.
- Use types like `feat:`, `fix:`, `chore:`, `BREAKING CHANGE:` etc. in
your PR title.
- Your PR title will be used as a commit message when merging. Make sure
it adheres to [Conventional Commits
standards](https://www.conventionalcommits.org/).

## Closing Issues

<!--
Use keywords to close related issues. This ensures that the associated
issues will automatically close when the PR is merged.

- `Fixes #123` will close issue 123 when the PR is merged.
- `Closes #123` will also close issue 123 when the PR is merged.
- `Resolves #123` will also close issue 123 when the PR is merged.

You can also use multiple keywords in one comment:
- `Fixes #123, Resolves #456`

More info:
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->
  • Loading branch information
gershon authored Sep 17, 2024
1 parent a65ef72 commit 06145e7
Show file tree
Hide file tree
Showing 26 changed files with 983 additions and 972 deletions.
46 changes: 0 additions & 46 deletions apps/docs/src/app/sdk-core/cancel-collection-offer/page.mdx

This file was deleted.

77 changes: 54 additions & 23 deletions apps/docs/src/app/sdk-core/cancel-order/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,69 @@ import { cancelOrder } from '@arkproject/core'

## Usage

```typescript
import { cancelOrder } from '@arkproject/core'
import { config, parameters } from './config'

await cancelOrder(config, {
starknetAccount: sellerAccount,
cancelInfo: {
orderHash: '0x...',
tokenAddress: '0x...',
tokenId: BigInt(1),
},
<CodeGroup>

```ts {{ title: "example.ts" }}
import { cancel } from '@arkproject/core'
import { config, buyer, brokerAddress } from './config'

const { orderHash } = await createOffer(config, {
account: buyer,
brokerAddress,
tokenAddress:
'0x02acee8c430f62333cf0e0e7a94b2347b5513b4c25f699461dd8d7b23c072478',
tokenId: BigInt(1),
amount: BigInt(10),
})

const { transactionHash } = await cancelOrder(config, {
account: buyer,
orderHash,
tokenAddress:
'0x02acee8c430f62333cf0e0e7a94b2347b5513b4c25f699461dd8d7b23c072478',
tokenId: BigInt(1),
})
```

## Parameters
```ts {{ title: 'config.ts' }}
import { createConfig, networks, contracts } from '@arkproject/core'

### starknetAccount
export const config = createConfig({
starknetNetwork: networks.mainnet,
starknetExecutorContract: contracts.executor,
starknetCurrencyContract: contracts.eth,
})

`AccountInterface`
const buyer = new Account(config.starknetProvider, '0x', '0x')

The Starknet account used for the transaction.
export const brokerAddress = '0x'
```

### cancelInfo
</CodeGroup>

`CancelInfo`
## Returns

Informations about the order to cancel, includes :
[`CancelOrderResult`](https://github.com/ArkProjectNFTs/ark-project/core/src/actions/order/cancel.ts)

- `orderHash: bigint`
- `tokenAddress: string`
- `tokenId: bigint`
The result of the cancel order action.

## Function Description
## Parameters

`cancelOrder` begins by extracting details from the provided parameters, including Starknet and Arkchain accounts, and cancellation information. It then compiles the cancellation details into a `FullCancelInfo` object, compiles and signs the order data, and constructs the calldata for the cancellation. The function executes the transaction and waits for its completion. An error is thrown if the contract ABI is not found or the transaction fails.
<Properties>
<Property name="account" type="AccountInterface">
The account responsible for executing the transaction.
</Property>
<Property name="orderHash" type="bigint">
The `orderHash` of the order.
</Property>
<Property name="tokenAddress" type="string">
The contract address of the token.
</Property>
<Property name="tokenId" type="bigint">
The ID of the token.
</Property>
<Property name="waitForTransaction (optional)" type="boolean">
If `false`, the function will return immediately after sending the
transaction. Defaults to `true`.
</Property>
</Properties>
105 changes: 24 additions & 81 deletions apps/docs/src/app/sdk-core/configuration/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,25 @@ import { createConfig } from '@arkproject/core'

## Usage

Create a mainnet configuration using [pre-deployed contracts](https://github.com/ArkProjectNFTs/ark-project?tab=readme-ov-file#networks).
Create a configuration using mainnet [pre-deployed contracts](https://github.com/ArkProjectNFTs/ark-project?tab=readme-ov-file#networks).

```typescript
import { createConfig, networks } from '@arkproject/core'

export const config = createConfig({
starknetNetwork: networks.mainnet,
arkchainNetwork: networks.mainnet,
network: networks.mainnet,
})
```

Create a local configuration with development contracts. See [development quickstart](https://github.com/ArkProjectNFTs/ark-project) for more information.
Create a configuration with local contracts, see [development quickstart](https://github.com/ArkProjectNFTs/ark-project).

```typescript
import { createConfig, networks } from '@arkproject/core'

export const config = createConfig({
starknetNetwork: networks.dev,
starknetExecutorContract: '0x0',
starknetCurrencyContract: '0x0',
arkchainNetwork: networks.dev,
arkchainOrderbookContract: '0x0',
network: networks.dev,
executorContract: '0x0',
currencyContract: '0x0',
})
```

Expand All @@ -50,65 +47,35 @@ export const config = createConfig({
import { type ConfigParameters } from '@arkproject/core'
```

### starknetNetwork
### network

`mainnet | sepolia | dev`

Specifies the Starknet network to be used.

### starknetRpcUrl
### rpcUrl (optional)

`string | undefined`

Custom RPC URL for the Starknet network. If not provided, a default URL based on the specified `starknetNetwork` is used.

### starknetProvider

`ProviderInterface | undefined`

The provider interface for Starknet. If not provided, a new `RpcProvider` instance is created using the `starknetRpcUrl`.

### arkchainNetwork

`mainnet | sepolia | dev`

Specifies Arkchain network to be used.

### arkchainRpcUrl

`string | undefined`

Custom RPC URL for the Arkchain network. If not provided, a default URL based on the specified `arkchainNetwork` is used.

### arkProvider

`ProviderInterface | undefined`

The provider interface for Arkchain. If not provided, a new `RpcProvider` instance is created using the `arkchainRpcUrl`.

### starknetExecutorContract

`string | undefined`
`string`

The address of the Starknet executor contract. If not provided, a default contract address based on the `starknetNetwork` is used.
Custom RPC URL for the Starknet network. If not provided, a default URL based on the specified `network` is used.

### starknetCurrencyContract
### provider (optional)

`string | undefined`
`ProviderInterface`

The address of the Starknet currency contract. If not provided, a default contract address based on the `starknetNetwork` is used.
The provider interface for Starknet. If not provided, a new `RpcProvider` instance is created using the `rpcUrl`.

### starknetCurrencyAddress
### executorContract (optional)

`string | undefined`
`string`

The address of the currency contract on Starknet. If not provided, defaults to a eth address.
The address of the Starknet executor contract. If not provided, a default contract address based on the `network` is used.

### arkchainOrderbookContract
### currencyContract (optional)

`string | undefined`
`string`

The address of the Arkchain orderbook contract. If not provided, a default contract address based on the `arkchainNetwork` is used.
The address of the Starknet currency contract. If not provided, a default contract address based on the `network` is used.

## Return Type

Expand All @@ -124,56 +91,32 @@ Object responsible for managing the configuration of the SDK.
import { type Config } from '@arkproject/core'
```

### starknetNetwork
### network

`mainnet | sepolia | dev`

`Network` passed to `createConfig`.

### starknetRpcUrl
### rpcUrl

`string`

Current Starknet RPC url.

### starknetProvider
### provider

`ProviderInterface`

Current Starknet Provider.

### arkchainNetwork

`mainnet | sepolia | dev`

Current arkchain network.

### arkchainRpcUrl

`string`

Current Arkchain RPC url.

### arkProvider

`ProviderInterface`

Current Arkchain Provider.

### starknetExecutorContract
### executorContract

`string`

Current Starknet executor contract address.

### starknetCurrencyContract
### currencyContract

`string`

Current Starknet currency contract address.

### arkchainOrderbookContract

`string`

Current Arkchain orderbook contract address.
Loading

0 comments on commit 06145e7

Please sign in to comment.