Skip to content

Commit

Permalink
modernize code examples for v0.11.0 beta 8
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Sep 7, 2024
1 parent 7c8cf9d commit 412ac50
Show file tree
Hide file tree
Showing 11 changed files with 294 additions and 224 deletions.
6 changes: 3 additions & 3 deletions content/install/cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ Next, you need to install developer components, which are OS-specific:
### Installing from crates.io

```
$ cargo install rgb-contracts --all-features
$ cargo install rgb-wallet --all-features --locked
```

Before the final RGB release it might be required to specify concrete
pre-release version as an argument:

```
$ cargo install rgb-contracts --all-features --version 0.11.0-beta.7
$ cargo install rgb-wallet --all-features --locked
```


Expand All @@ -60,6 +60,6 @@ By building from the master tip you can get the latest nightly version of
```console
$ git clone https://github.com/RGB-WG/rgb
$ cd rgb
$ git checkout v0.11.0-beta.7
$ git checkout v0.11.0
$ cargo install --path . --all-features
```
4 changes: 2 additions & 2 deletions content/install/wallets.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ RGB wallets are developed by community and independent vendors. Please keep
in mind that there is no "official" RGB GUI wallet.

**NB: All existing wallets were not yet updated to the latest RGB protocol
version v0.10 and are not compatible with the modern RGB contracts. If you are
interested in trying the new RGB v0.10 features please use [command-line tool].**
version v0.11 and are not compatible with the modern RGB contracts. If you are
interested in trying the new RGB v0.11 features please use [command-line tool].**

* ### [Iris](https://play.google.com/store/apps/details?id=com.iriswallet.testnet&pli=1)

Expand Down
38 changes: 17 additions & 21 deletions content/power-user/contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,44 +33,40 @@ $ rgb import contract.rgb
```

To list contracts which are part of the stash you need to run `rgb` commands
with no arguments provided (or `rgb info` as an alternative to this)
with no arguments provided (or `rgb contracts` as an alternative to this)

```sh
$ rgb
$ rgb contracts
```

Which should output something like

```
Schemata:
---------
marina-karl-basic-4h3xkAmiRdQs2HwQmnFVqoj5DG3NhGkJRpNZXjNrJT2N: RGB20
Interfaces:
---------
RGB20 complex-field-union-DbwzvSu4BZU81jEpE9FVZ3xjcyuTKWWy2gmdnaxtACrS
Contracts:
---------
rgb:BasilYellowGrand0BgHH3yYaCUvaw5Tc8KfrVB1aWN4vBvCXCuMfK98N3o6Z
rgb:D4RN7r4$-ZNt43c$-ymINZ1r-M$bJPPf-SWp9193-OLIdtv0 bitcoin 2024-09-07 rgb:sch:RDYhMTR!9gv8Y2GLv9UNBEK1hcrCmdLDFk9Qd5fnO8k#brave-dinner-banana
Developer: ssi:anonymous
```

Here you see your imported contract id, plus a schema, used by this contract
which implements RGB20 interface. Now, you can read the state of the contract
through this interface:

```shell
$ rgb state BasilYellowGrand0BgHH3yYaCUvaw5Tc8KfrVB1aWN4vBvCXCuMfK98N3o6Z RGB20
$ rgb state 'D4RN7r4$-ZNt43c$-ymINZ1r-M$bJPPf-SWp9193-OLIdtv0' RGB20Fixed
```

```
Global state:
Nominal:=(ticker=("TEST"), name=("Test asset"), details=~, precision=8)
Owned state:
(amount=100000000000000, owner=913d9a55efd7748ee89b577328a8f22189432c04275a106c4915cd1dac543562:0, witness=~)
Global:
spec := (ticker=("DBG"), name=("Debug asset"), details=1(("Pay attention: the asset has no value")), precision=2)
terms := (text=("SUBJECT TO, AND WITHOUT IN ANY WAY LIMITING, THE REPRESENTATIONS AND WARRANTIES OF ANY SELLER EXPRESSLY SET FORTH IN THIS AGREEMENT OR ANY OTHER EXPRESS OBLIGATION OF SELLERS PURSUANT TO THE TERMS HEREOF, AND ACKNOWLEDGING THE PRIOR USE OF THE PROPERTY AND PURCHASER’S OPPORTUNITY TO INSPECT THE PROPERTY, PURCHASER AGREES TO PURCHASE THE PROPERTY “AS IS”, “WHERE IS”, WITH ALL FAULTS AND CONDITIONS THEREON. ANY WRITTEN OR ORAL INFORMATION, REPORTS, STATEMENTS, DOCUMENTS OR RECORDS CONCERNING THE PROPERTY PROVIDED OR MADE AVAILABLE TO PURCHASER, ITS AGENTS OR CONSTITUENTS BY ANY SELLER, ANY SELLER’S AGENTS, EMPLOYEES OR THIRD PARTIES REPRESENTING OR PURPORTING TO REPRESENT ANY SELLER, SHALL NOT BE REPRESENTATIONS OR WARRANTIES, UNLESS SPECIFICALLY SET FORTH HEREIN. IN PURCHASING THE PROPERTY OR TAKING OTHER ACTION HEREUNDER, PURCHASER HAS NOT AND SHALL NOT RELY ON ANY SUCH DISCLOSURES, BUT RATHER, PURCHASER SHALL RELY ONLY ON PURCHASER’S OWN INSPECTION OF THE PROPERTY AND THE REPRESENTATIONS AND WARRANTIES HEREIN. PURCHASER ACKNOWLEDGES THAT THE PURCHASE PRICE REFLECTS AND TAKES INTO ACCOUNT THAT THE PROPERTY IS BEING SOLD “AS IS”.
"), media=~)
issuedSupply := (100000000)
Owned:
assetOwner:
value=100000000, utxo=bc:tapret1st:b449f7eaa3f98c145b27ad0eeb7b5679ceb567faef7a52479bc995792b65f804:1, witness=~ -- owner unknown
```

Here you see that the contract has both global state, representing the
information about RGB20 token, and an owned state – certain amount of that token
assigned to a UTXO.
information about RGB20 token, and an owned state – certain amount of that
token assigned to an UTXO. Since we do not use any wallet, it shows that the
owner of this output is not known.
Loading

0 comments on commit 412ac50

Please sign in to comment.