Skip to content

Commit

Permalink
update native-fungible readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ma2bd committed Feb 23, 2025
1 parent e969099 commit 2304814
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions examples/non-fungible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,44 @@ NFTs can be transferred to various destinations, including:

### Setting Up

Most of this can be referred to the [fungible app README](https://github.com/linera-io/linera-protocol/blob/main/examples/fungible/README.md#setting-up), except for at the end when compiling and publishing the bytecode, what you'll need to do will be slightly different.
Before getting started, make sure that the binary tools `linera*` corresponding to
your version of `linera-sdk` are in your PATH. For scripting purposes, we also assume
that the BASH function `linera_spawn` is defined.

From the root of Linera repository, this can be achieved as follows:

```bash
export PATH="$PWD/target/debug:$PATH"
source /dev/stdin <<<"$(linera net helper 2>/dev/null)"
```

linera_spawn_and_read_wallet_variables linera net up --testing-prng-seed 37
Next, start the local Linera network and run a faucet:

```bash
FAUCET_PORT=8079
FAUCET_URL=http://localhost:$FAUCET_PORT
linera_spawn linera net up --with-faucet --faucet-port $FAUCET_PORT

# If you're using a testnet, run this instead:
# LINERA_TMP_DIR=$(mktemp -d)
# FAUCET_URL=https://faucet.testnet-XXX.linera.net # for some value XXX
```

Compile the `non-fungible` application WebAssembly binaries, and publish them as an application bytecode:
Create the user wallet and add chains to it:

```bash
export LINERA_WALLET="$LINERA_TMP_DIR/wallet.json"
export LINERA_STORAGE="rocksdb:$LINERA_TMP_DIR/client.db"

linera wallet init --faucet $FAUCET_URL

INFO_1=($(linera wallet request-chain --faucet $FAUCET_URL))
INFO_2=($(linera wallet request-chain --faucet $FAUCET_URL))
CHAIN_1="${INFO_1[0]}"
CHAIN_2="${INFO_2[0]}"
OWNER_1="${INFO_1[3]}"
OWNER_2="${INFO_2[3]}"
```

```bash
(cd examples/non-fungible && cargo build --release --target wasm32-unknown-unknown)
Expand All @@ -52,15 +80,6 @@ Unlike fungible tokens, each NFT is unique and identified by a unique token ID.

Refer to the [fungible app README](https://github.com/linera-io/linera-protocol/blob/main/examples/fungible/README.md#creating-a-token) to figure out how to list the chains created for the test in the default wallet, as well as defining some variables corresponding to these values.

```bash
linera wallet show

CHAIN_1=aee928d4bf3880353b4a3cd9b6f88e6cc6e5ed050860abae439e7782e9b2dfe8 # default chain for the wallet
OWNER_1=de166237331a2966d8cf6778e81a8c007b4084be80dc1e0409d51f216c1deaa1 # owner of chain 1
CHAIN_2=63620ea465af9e9e0e8e4dd8d21593cc3a719feac5f096df8440f90738f4dbd8 # another chain in the wallet
OWNER_2=598d18f67709fe76ed6a36b75a7c9889012d30b896800dfd027ee10e1afd49a3 # owner of chain 2
```

To create the NFT application, run the command below:

```bash
Expand Down

0 comments on commit 2304814

Please sign in to comment.