Skip to content

Commit

Permalink
move tutorials to tokens dir
Browse files Browse the repository at this point in the history
  • Loading branch information
xhliu committed Oct 17, 2023
1 parent 6be8479 commit 846762f
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 32 deletions.
2 changes: 1 addition & 1 deletion docs/tokens/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"position": 15,
"position": 14,
"label": "Tokens",
"collapsible": true,
"collapsed": true
Expand Down
2 changes: 1 addition & 1 deletion docs/tokens/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ For a deeper exploration, please refer to the respective subsections:
* [Fungible Tokens (FTs)](ft/ft.md)


## `OrdProvider`
## `OrdiProvider`

When you use sCrypt 1Sat Ordinals SDK, we recommend that you use `OrdiProvider` as the [provider](../how-to-deploy-and-call-a-contract/how-to-deploy-and-call-a-contract.md#provider). This allows your transaction to be indexed instantly, instead of waiting for it to be mined into a block.

Expand Down
10 changes: 10 additions & 0 deletions docs/tokens/tutorials/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"position": 3,
"label": "Tutorials",
"collapsible": true,
"collapsed": false,
"link": {
"type": "generated-index",
"title": "Tutorials"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
sidebar_position: 8
sidebar_position: 1
---

# Tutorial 8: Inscribe Image
# Tutorial 1: Inscribe Image

## Overview

Expand Down Expand Up @@ -63,15 +63,15 @@ const mintTx = await hashLock.inscribeImage(image, 'image/png')

Execute command `npx ts-node tests/examples/inscribeImage.ts` to run this example.

![](../../static/img/inscribe-image.png)
![](../../../static/img/inscribe-image.png)

Then you can check your inscription on the explorer.

![](../../static/img/inscribe-image-inscribe-tx.png)
![](../../../static/img/inscribe-image-inscribe-tx.png)

Now that the inscription is locked to a contract instance, it is controlled by the smart contract, which means it can only be transferred when the hash lock is unlocked.

![](../../static/img/inscribe-image-transfer-tx.png)
![](../../../static/img/inscribe-image-transfer-tx.png)

This is different from using a P2PKH address to receive the inscription, where the inscription is controlled by a private key.

Expand All @@ -90,7 +90,7 @@ const receiver = new OrdiNFTP2PKH(Addr(address.toByteString()))

### Step 2. Call the Contract

Similar to [contract calling](../how-to-deploy-and-call-a-contract/how-to-deploy-and-call-a-contract.md#contract-call) before, we call the `unlock` of `HashLockNFT` as follows.
Similar to [contract calling](../../how-to-deploy-and-call-a-contract/how-to-deploy-and-call-a-contract.md#contract-call) before, we call the `unlock` of `HashLockNFT` as follows.

```ts
const { tx: transferTx } = await hashLock.methods.unlock(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
sidebar_position: 10
sidebar_position: 3
---

# Tutorial 10: Mint BSV20 V1 Token
# Tutorial 3: Mint BSV20 V1 Token

## Overview

Expand Down Expand Up @@ -94,7 +94,7 @@ const bob = new BSV20V1P2PKH(tick, max, lim, dec, addressBob)

### Step 2. Call the Contract

Just as other [contract calling](../how-to-deploy-and-call-a-contract/how-to-deploy-and-call-a-contract.md#contract-call) methods we introduced before, we call the public method `unlock` of `HashLockFT` as follows.
Just as other [contract calling](../../how-to-deploy-and-call-a-contract/how-to-deploy-and-call-a-contract.md#contract-call) methods we introduced before, we call the public method `unlock` of `HashLockFT` as follows.

```ts
// Call the contract
Expand All @@ -118,13 +118,13 @@ The default transaction builder will automatically add a token change output on

Execute command `npx ts-node tests/examples/mintBSV20.ts` to run this example.

![](../../static/img/mint-bsv20.png)
![](../../../static/img/mint-bsv20.png)

Then you can check your token transfer details on the explorer.

![](../../static/img/mint-bsv20-mint-tx.png)
![](../../../static/img/mint-bsv20-mint-tx.png)

![](../../static/img/mint-bsv20-transfer-tx.png)
![](../../../static/img/mint-bsv20-transfer-tx.png)

The UTXO model is a powerful feature of BSV20, we can send tokens to multiple receivers in a single transaction, allowing us to create complex and efficient transactions.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
sidebar_position: 9
sidebar_position: 2
---

# Tutorial 9: Mint BSV20 V2 Token
# Tutorial 2: Mint BSV20 V2 Token

## Overview

Expand Down Expand Up @@ -90,7 +90,7 @@ const bob = new BSV20V2P2PKH(toByteString(tokenId, true), max, dec, addressBob)

### Step 2. Call the Contract

Just as other [contract calling](../how-to-deploy-and-call-a-contract/how-to-deploy-and-call-a-contract.md#contract-call) methods we introduced before, we call the public method `unlock` of `HashLockFTV2` as follows.
Just as other [contract calling](../../how-to-deploy-and-call-a-contract/how-to-deploy-and-call-a-contract.md#contract-call) methods we introduced before, we call the public method `unlock` of `HashLockFTV2` as follows.

```ts
// Call the contract
Expand All @@ -114,13 +114,13 @@ The default transaction builder will automatically add a token change output on

Execute command `npx ts-node tests/examples/mintBSV20V2.ts` to run this example.

![](../../static/img/mint-bsv20v2.png)
![](../../../static/img/mint-bsv20v2.png)

Then you can check your token transfer details on the explorer.

![](../../static/img/mint-bsv20v2-mint-tx.png)
![](../../../static/img/mint-bsv20v2-mint-tx.png)

![](../../static/img/mint-bsv20v2-transfer-tx.png)
![](../../../static/img/mint-bsv20v2-transfer-tx.png)

## Conclusion

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
sidebar_position: 11
sidebar_position: 4
---

# Tutorial 11: Ordinal Lock
# Tutorial 4: Ordinal Lock

## Overview
In this tutorial, we will go over how to use [sCrypt](https://scrypt.io/) to build a full-stack dApp on Bitcoin to sell [1Sat Ordinals](https://docs.1satordinals.com/), including the smart contract and an interactive front-end.
Expand Down Expand Up @@ -159,7 +159,7 @@ Note the customized calling method `buildTxForPurchase` and `buildTxForCancel` e

## Frontend

We will add a frontend to the `OrdinalLock` smart contract accroding to this [guide](../how-to-integrate-a-frontend/how-to-integrate-a-frontend.md).
We will add a frontend to the `OrdinalLock` smart contract accroding to this [guide](../../how-to-integrate-a-frontend/how-to-integrate-a-frontend.md).

### Setup Project

Expand Down Expand Up @@ -242,9 +242,9 @@ function loadCollections() {
}
```

![](../../static/img/ordinal-lock/load1.png)
![](../../../static/img/ordinal-lock/load1.png)

![](../../static/img/ordinal-lock/load2.png)
![](../../../static/img/ordinal-lock/load2.png)

### List an Ordinal

Expand Down Expand Up @@ -275,9 +275,9 @@ async function sell() {

![](https://lucid.app/publicSegments/view/50527d66-0710-4658-b8db-b615d60232f8/image.png)

![](../../static/img/ordinal-lock/sell1.png)
![](../../../static/img/ordinal-lock/sell1.png)

![](../../static/img/ordinal-lock/sell2.png)
![](../../../static/img/ordinal-lock/sell2.png)

### Buy an Ordinal

Expand All @@ -293,13 +293,13 @@ async function buy() {

![](https://lucid.app/publicSegments/view/0b52243b-bdbc-4a13-b5b6-9386be80e155/image.png)

![](../../static/img/ordinal-lock/buy1.png)
![](../../../static/img/ordinal-lock/buy1.png)

![](../../static/img/ordinal-lock/buy2.png)
![](../../../static/img/ordinal-lock/buy2.png)

![](../../static/img/ordinal-lock/buy3.png)
![](../../../static/img/ordinal-lock/buy3.png)

![](../../static/img/ordinal-lock/buy4.png)
![](../../../static/img/ordinal-lock/buy4.png)

## Conclusion

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"position": 14,
"position": 15,
"label": "Tutorials",
"collapsible": true,
"collapsed": false,
Expand Down

0 comments on commit 846762f

Please sign in to comment.