Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New nfts driver #11433

Merged
merged 45 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
6a3ae94
WIP commit for the new NFT spec
matt-o-how Apr 25, 2022
8b0062a
Update to optimized singleton
Quexington Apr 25, 2022
ccb95da
flesh out ownership layer
matt-o-how Apr 25, 2022
ebe6ade
Generalize the Offer class to more than CATs
Quexington Apr 15, 2022
bfa0c6c
Remove CAT dependencies from trade_manager
Quexington Apr 16, 2022
a417767
Fix offer RPC
Quexington Apr 16, 2022
4a8ae25
isort
Quexington Apr 18, 2022
b69cfcb
Further generalize the Offer drivers
Quexington Apr 21, 2022
a31737e
Update trade manager with new generalizations
Quexington Apr 21, 2022
d79d57d
Fix offer RPC again
Quexington Apr 21, 2022
70b8d26
Move outer_puzzles.py
Quexington Apr 21, 2022
390edb2
pivot from string to clvm for dict entries
Quexington Apr 21, 2022
28d5740
add test coverage for driver dict in RPC
Quexington Apr 22, 2022
e26fc45
Remove some CAT specific stuff from tm
Quexington Apr 22, 2022
2d27c55
Add comments explaining the changes
Quexington Apr 25, 2022
1f24ec9
Minor fixes
Quexington Apr 25, 2022
f9a68f5
isort and flake8
Quexington Apr 25, 2022
8963e83
More linting
Quexington Apr 25, 2022
ac8bf76
Include drivers in offer summary
Quexington Apr 25, 2022
5c97b1c
Better autodetection of drivers on offer creation
Quexington Apr 25, 2022
53b6789
Forgot to update rpc test
Quexington Apr 26, 2022
89c5c6f
checkpoint
matt-o-how Apr 26, 2022
a5ba0db
fix test and optimise state_layer puz
matt-o-how Apr 27, 2022
571e667
metadata checkpoint
matt-o-how Apr 28, 2022
6573ac7
fix state layer for metadata updater
matt-o-how Apr 28, 2022
8363322
add test for metadata updating
matt-o-how Apr 28, 2022
a0f18b2
Merge pull request #11197 from Chia-Network/offer_generalization
matt-o-how Apr 28, 2022
b1fa967
almost generates a new nft
trepca May 2, 2022
e12332f
generating nfts
trepca May 3, 2022
7d02c47
rpc fix
trepca May 3, 2022
bcda9a7
Implement nft transfer program
ytx1991 May 3, 2022
0330037
Resolve comment
ytx1991 May 4, 2022
093b275
transfer wip
trepca May 3, 2022
ee8eda2
checkpoint
trepca May 4, 2022
523c676
basic rpc api working
trepca May 4, 2022
297767f
resolved conflicts
trepca May 5, 2022
c470401
pre commit hooks passing, tests pass
trepca May 5, 2022
150f244
removed old NFT tests
trepca May 5, 2022
8a32eee
workflow files?
trepca May 5, 2022
694b737
Attempt to fix workflows.
AmineKhaldi May 5, 2022
bddd7e8
Workflows?
AmineKhaldi May 5, 2022
2566f68
Prepare test blocks and plots for NFT wallet tests.
AmineKhaldi May 5, 2022
b69323e
Reflect the previous commit into workflows.
AmineKhaldi May 5, 2022
4df1f46
clvm compilation fix
trepca May 5, 2022
61bb87f
future proof create_coin in nft state layer
trepca May 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test-macos-wallet-did_wallet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
- name: Test wallet-did_wallet code with pytest
run: |
. ./activate
venv/bin/coverage run --rcfile=.coveragerc --module pytest --durations=10 -n 0 -m "not benchmark" tests/wallet/did_wallet/test_did.py tests/wallet/did_wallet/test_did_rpc.py tests/wallet/did_wallet/test_nft_clvm.py tests/wallet/did_wallet/test_nft_rpc.py tests/wallet/did_wallet/test_nft_wallet.py
venv/bin/coverage run --rcfile=.coveragerc --module pytest --durations=10 -n 0 -m "not benchmark" tests/wallet/did_wallet/test_did.py tests/wallet/did_wallet/test_did_rpc.py

- name: Process coverage data
run: |
Expand Down
115 changes: 115 additions & 0 deletions .github/workflows/build-test-macos-wallet-nft_wallet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
#
name: MacOS wallet-nft_wallet Test

on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- '**'

concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
cancel-in-progress: true

jobs:
build:
name: MacOS wallet-nft_wallet Tests
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version: ['3.9', '3.10']
os: [macOS-latest]
env:
CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet
JOB_FILE_NAME: tests_${{ matrix.os }}_python-${{ matrix.python-version }}_wallet-nft_wallet

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Create keychain for CI use
run: |
security create-keychain -p foo chiachain
security default-keychain -s chiachain
security unlock-keychain -p foo chiachain
security set-keychain-settings -t 7200 -u chiachain

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"

- name: Cache pip
uses: actions/cache@v3
with:
# Note that new runners may break this https://github.com/actions/cache/issues/292
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Cache test blocks and plots
uses: actions/cache@v2
id: test-blocks-plots
with:
path: |
${{ github.workspace }}/.chia/blocks
${{ github.workspace }}/.chia/test-plots
key: 0.29.0

- name: Checkout test blocks and plots
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
run: |
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
mkdir ${{ github.workspace }}/.chia
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia

- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
brew install boost
sh install.sh -d

# Omitted installing Timelord

- name: Test wallet-nft_wallet code with pytest
run: |
. ./activate
venv/bin/coverage run --rcfile=.coveragerc --module pytest --durations=10 -n 0 -m "not benchmark" tests/wallet/nft_wallet/test_nft_clvm.py tests/wallet/nft_wallet/test_nft_wallet.py

- name: Process coverage data
run: |
venv/bin/coverage combine --rcfile=.coveragerc .coverage.*
venv/bin/coverage xml --rcfile=.coveragerc -o coverage.xml
mkdir coverage_reports
cp .coverage "coverage_reports/.coverage.${{ env.JOB_FILE_NAME }}"
cp coverage.xml "coverage_reports/coverage.${{ env.JOB_FILE_NAME }}.xml"
venv/bin/coverage report --rcfile=.coveragerc --show-missing

- name: Publish coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage_reports/*
if-no-files-found: error
#
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
#
2 changes: 1 addition & 1 deletion .github/workflows/build-test-ubuntu-wallet-did_wallet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
- name: Test wallet-did_wallet code with pytest
run: |
. ./activate
venv/bin/coverage run --rcfile=.coveragerc --module pytest --durations=10 -n 0 -m "not benchmark" -p no:monitor tests/wallet/did_wallet/test_did.py tests/wallet/did_wallet/test_did_rpc.py tests/wallet/did_wallet/test_nft_clvm.py tests/wallet/did_wallet/test_nft_rpc.py tests/wallet/did_wallet/test_nft_wallet.py
venv/bin/coverage run --rcfile=.coveragerc --module pytest --durations=10 -n 0 -m "not benchmark" -p no:monitor tests/wallet/did_wallet/test_did.py tests/wallet/did_wallet/test_did_rpc.py

- name: Process coverage data
run: |
Expand Down
117 changes: 117 additions & 0 deletions .github/workflows/build-test-ubuntu-wallet-nft_wallet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
#
name: Ubuntu wallet-nft_wallet Test

on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- '**'

concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
cancel-in-progress: true

jobs:
build:
name: Ubuntu wallet-nft_wallet Test
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
os: [ubuntu-latest]
env:
CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet
JOB_FILE_NAME: tests_${{ matrix.os }}_python-${{ matrix.python-version }}_wallet-nft_wallet

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache npm
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"

- name: Cache pip
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Cache test blocks and plots
uses: actions/cache@v2
id: test-blocks-plots
with:
path: |
${{ github.workspace }}/.chia/blocks
${{ github.workspace }}/.chia/test-plots
key: 0.29.0

- name: Checkout test blocks and plots
if: steps.test-blocks-plots.outputs.cache-hit != 'true'
run: |
wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/0.29.0.tar.gz | tar xzf -
mkdir ${{ github.workspace }}/.chia
mv ${{ github.workspace }}/test-cache-0.29.0/* ${{ github.workspace }}/.chia

- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}
run: |
sh install.sh -d

# Omitted installing Timelord

- name: Test wallet-nft_wallet code with pytest
run: |
. ./activate
venv/bin/coverage run --rcfile=.coveragerc --module pytest --durations=10 -n 0 -m "not benchmark" -p no:monitor tests/wallet/nft_wallet/test_nft_clvm.py tests/wallet/nft_wallet/test_nft_wallet.py

- name: Process coverage data
run: |
venv/bin/coverage combine --rcfile=.coveragerc .coverage.*
venv/bin/coverage xml --rcfile=.coveragerc -o coverage.xml
mkdir coverage_reports
cp .coverage "coverage_reports/.coverage.${{ env.JOB_FILE_NAME }}"
cp coverage.xml "coverage_reports/coverage.${{ env.JOB_FILE_NAME }}.xml"
venv/bin/coverage report --rcfile=.coveragerc --show-missing

- name: Publish coverage
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage_reports/*
if-no-files-found: error

# Omitted resource usage check

#
# THIS FILE IS GENERATED. SEE https://github.com/Chia-Network/chia-blockchain/tree/main/tests#readme
#
4 changes: 2 additions & 2 deletions chia/cmds/wallet_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ async def print_trade_record(record, wallet_client: WalletRpcClient, summaries:
if summaries:
print("Summary:")
offer = Offer.from_bytes(record.offer)
offered, requested = offer.summary()
offered, requested, _ = offer.summary()
outbound_balances: Dict[str, int] = offer.get_pending_amounts()
fees: Decimal = Decimal(offer.bundle.fees())
cat_name_resolver = wallet_client.cat_asset_id_to_name
Expand Down Expand Up @@ -452,7 +452,7 @@ async def take_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in
print("Please enter a valid offer file or hex blob")
return

offered, requested = offer.summary()
offered, requested, _ = offer.summary()
cat_name_resolver = wallet_client.cat_asset_id_to_name
print("Summary:")
print(" OFFERED:")
Expand Down
Loading