Conversation
|
Changed the base to v0.11-beta.9 so it will be easier to review v0.12-specific changes |
still not working...
|
|
||
| # closing method / derivation variables | ||
| CLOSING_METHODS=("opret1st" "tapret1st") | ||
|
|
||
| # rgb-schemata variables | ||
| SCHEMATA_DIR="./rgb-schemata/schemata" | ||
| # RGB wallet types | ||
| WALLET_TYPES=("wpkh" "tapret-key-only") |
There was a problem hiding this comment.
We do not have seal types anymore. However, we have wallet types, which work in the following way: if you have a taproot wallet, it will always produce tapret commitments; all other wallet descriptor types will always do opret. Since BP so far supports only one taproot descriptor (key-only), thus, in order to produce tapret commitments you need to create a wallet with tapret-key-only descriptor.
I expect this would be the same with your changes to v0.11x
|
|
||
| # maps | ||
| declare -A CONTRACT_ID_MAP | ||
| declare -A CONTRACT_SCHEMA_MAP |
There was a problem hiding this comment.
No more schemata; now we have codexes, which are specified right inside the YAML files for contract issuance.
| declare -A CONTRACT_SCHEMA_MAP | ||
| declare -A CONTRACT_NAME_MAP | ||
| declare -A DESC_MAP | ||
| declare -A IFACE_MAP |
There was a problem hiding this comment.
No more interfaces in v0.12; contracts are using so-called APIs, which always ships with them, and since there always a default one, there is no need to specify it neither in rust APIs nor in command-line
| CONTRACT_NAME_MAP["usdt"]=USDT | ||
| CONTRACT_NAME_MAP["collectible"]=OtherToken |
There was a problem hiding this comment.
In v0.12 we have a concept of contract name. Contract directories inside the stash are organized by names (to simplify debugging), and thus, we using this index in order to do import/export with cp (as I explain below, I didn't get time to do import/export commands for rgb cli, and used simple directory cp, since contracts are now reside in independent directories - and not all in one mixed stock file as before)
| _subtit "syncing $wallet" | ||
| local wallet_id=${WLT_ID_MAP[$wallet]} | ||
| _trace "${RGB[@]}" -d "data${wallet_id}" utxos -w "$wallet" --sync | ||
| _trace "${RGB[@]}" -d "data${wallet_id}" sync "$INDEXER_CLI" "$wallet" |
There was a problem hiding this comment.
I did a dedicated sync command. Also, if a command works with wallet, you provide wallet name as an unnamed argument, instead of using -w
| _subtit "(recipient) preparing invoice" | ||
| if [ "$witness" = 1 ]; then | ||
| address_mode="-a" | ||
| address_mode="--wout" |
There was a problem hiding this comment.
pay-to-address invoices are called "witness output-invoices"
demo.sh
Outdated
| _trace "${RGB[@]}" -d "$rcpt_data" invoice "$address_mode" \ | ||
| -w "$RCPT_WLT" "$contract_id" "$send_amt" >$TRACE_OUT |
There was a problem hiding this comment.
invoicing now simpler: no need to provide interface name.
Also, no more "amounts"; invoice includes now arbitrary state, encoded as a strict value. Good news: for numbers, it is just like writing the number. And it is now a positional argument
Both contract_id and state as positional arguments are now optional, allowing creating invoices in form of "pay anything" and "pay any amount under this contract"
There was a problem hiding this comment.
This is where the script execution always fails, with
error: invalid value '' for '[CONTRACT]': invalid contract reference ''
For more information, try '--help'.
ERROR: command 'rgb-wallet/bin/rgb -n regtest -d data1 invoice -w wallet_1 contract:Ko_9~W2J-YXwpN8e-ZTY9X2l-PtqSsUN-g2Wu0ij-onReuzw 100' returned a non-zero exit code (transfer 0)
Spent a lot of time trying to figure why....
There was a problem hiding this comment.
Ok, solved this: the reason was that "$address_mode" didn't worked producing an excessive argument in a form of '' when a UTXO payment is used. Spent a day figuring that out... Pity
| CONSIGNMENT="consignment_${TRANSFER_NUM}.rgb" | ||
| PSBT=tx_${TRANSFER_NUM}.psbt | ||
| local sats=(--sats 2000) | ||
| local sats=() |
There was a problem hiding this comment.
We have a default value in sats for pay-to-address now
| # TODO: Re-enable with `rgbx` tool | ||
| # _trace "${RGB[@]}" -d "$send_data" inspect \ | ||
| # "$send_data/$CONSIGNMENT" "$CONSIGNMENT.yaml" | ||
| # _log "consignment exported to file: $CONSIGNMENT.yaml" |
There was a problem hiding this comment.
Inspection and other pro debug tasks has moved to a dedicated tool from rgb-std named rgbx. It will be good to install it alongside rgb, but this is too complex for my poor bash knowledge.
The reason is that rgb always has an internal runtime, which relies (and reads) on certain hardcoded directory structure, while rgbx allows to work with individual binary files without any runtime.
| _die "accept failed (transfer $TRANSFER_NUM)" | ||
| fi | ||
|
|
||
| ## ending situation |
There was a problem hiding this comment.
No more consignment verification command; only accept.
The real reason is the fact that consignments now are streams parsed by runtime right into stash - and the stash is an abstract object which can't be cloned in memory. Thus, there is no such thing as a "dumb run": the consignment (if valid) will always get into the stash.
| SATS=800 # TODO: This is required only for witness-out transfers. We need to account for it | ||
| FEE=260 |
There was a problem hiding this comment.
Without these changes we had non-deterministic failures since we run out of sats for transfers (at round 7 or 8)
|
|
||
| # internal functions | ||
| _check_method() { | ||
| _check_wallet_type() { |
There was a problem hiding this comment.
Now opret and tapret is not a seal closing method but a type of a wallet
| local wallet="$1" | ||
| local keychain="$2" | ||
| if [ -z "$keychain" ]; then | ||
| if [ "${WLT_CM_MAP[$wallet]}" = "opret1st" ]; then |
There was a problem hiding this comment.
no more RGB-specific keychains
| local wallet="$1" | ||
| local contract_name="$2" | ||
| local sync="$3" | ||
| local contract_id iface schema wallet_id |
There was a problem hiding this comment.
iface and schema are now the same and provided in the YAML as codex_id
| if [ "$subtit" = 0 ]; then | ||
| _tit "checking $contract_name balance for $wallet" | ||
| else | ||
| elif [ "$subtit" = 1 ]; then |
There was a problem hiding this comment.
with 2 we suppress the printout completely
| _subtit "issuing" | ||
| _trace "${RGB[@]}" -d "data${wallet_id}" issue -w "$wallet" \ | ||
| "$schema_id" "ssi:$wallet" "$contract_yaml" >$TRACE_OUT 2>&1 | ||
| _trace "${RGB[@]}" -d "data${wallet_id}" import issuers/* |
There was a problem hiding this comment.
We have a new concept of issuers which we need to import
| _trace "${RGB[@]}" -d "data${wallet_id}" interfaces -w "$wallet" | ||
| fi | ||
| fi | ||
| _trace "${RGB[@]}" -d "data${wallet_id}" init -q |
There was a problem hiding this comment.
A dedicated command to initialize persistence; -q makes it quiet if the persistence is already initialized
| _log "interfaces:" | ||
| _trace "${RGB[@]}" -d "data${wallet_id}" interfaces -w "$wallet" | ||
| fi | ||
| fi |
There was a problem hiding this comment.
Without schemata the things got much simpler
| unset BLNC_RCPT BLNC_SEND RCPT_WLT SEND_WLT | ||
| } | ||
|
|
||
| transfer_aborted() { |
There was a problem hiding this comment.
We need to sync wallet in order to abort a transfer, to make wallet see that the tx is not in a mempool anymore.
| _trace "${RGB[@]}" -d "$send_data" transfer -w "$SEND_WLT" \ | ||
| "${sats[@]}" "${fee[@]}" \ | ||
| _trace "${RGB[@]}" -d "$send_data" pay -w "$SEND_WLT" \ | ||
| "${sats[@]}" "${fee[@]}" --force \ |
There was a problem hiding this comment.
--force is needed to overwrite consignment if it already exists (like in aborted transfers)
|
All tests are passing against v0.12.0 beta 6 |
No description provided.