-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2796 from build-5/add/swap-how-to
Add swap example
- Loading branch information
Showing
3 changed files
with
55 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,48 @@ | ||
--- | ||
title: Create Swap | ||
tags: | ||
- how-to | ||
- swap | ||
- nft | ||
- token | ||
--- | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
import DeepLink from '../../_admonitions/_deep_link.md' | ||
|
||
<Tabs> | ||
<TabItem value="otr" label="OTR"> | ||
To create a swap order, you must call [`create`](../../reference-api/classes/SwapOtrDataset.md#create) on `dataset(Dataset.SWAP)`. | ||
[`create`](../../reference-api/classes/SwapOtrDataset.md#create) takes an object of type [`SwapCreateTangleRequest`](../../reference-api/interfaces/SwapCreateTangleRequest.md) as parameter, in which you can specify the recipient, native tokens, NFTs and base token you are interested in. | ||
|
||
```tsx file=../../../../packages/sdk/examples/swap/otr/create.ts#L21-L27 | ||
``` | ||
|
||
<DeepLink/> | ||
</TabItem> | ||
<TabItem value="https" label="HTTPS"> | ||
To create a swap order, you must call [`create`](../../reference-api/classes/SwapDataset.md#create) on `dataset(Dataset.SWAP)`. | ||
[`create`](../../reference-api/classes/SwapDataset.md#create) takes an object of type [`SwapCreateRequest`](../../reference-api/interfaces/SwapCreateRequest.md) as parameter, in which you can specify the recipient, native tokens, NFTs and base token you are interested in. | ||
|
||
```tsx file=../../../../packages/sdk/examples/swap/https/create.ts#L14-L29 | ||
``` | ||
|
||
afterwards you need to fund a specific address: | ||
|
||
```tsx file=../../../../packages/sdk/examples/swap/https/create.ts#L31 | ||
``` | ||
|
||
and set the order as funded: | ||
|
||
```tsx file=../../../../packages/sdk/examples/swap/https/create.ts#L35-L46 | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
:::info setFunded | ||
|
||
With `setFunded`, you can specify if you, as the bidder, are giving your final bid or keeping it open. | ||
|
||
::: |
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