Skip to content

Commit

Permalink
nft test
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Oct 31, 2024
1 parent a750038 commit 6fb3bf3
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 51 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Test Matrix
id: set-matrix
run: |
test_dirs=$(find examples/*/scripts -type f -name 'run.sh' -exec dirname {} \; | xargs dirname)
test_dirs=$(find examples/*/scripts -type f -name 'test.sh' -exec dirname {} \; | xargs dirname)
matrix_json=$(echo "$test_dirs" | jq -R '{"example-dir": .}' | jq -s . | jq -c .)
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT
Expand All @@ -39,5 +39,5 @@ jobs:
run: |
cd "${{ matrix.example-dir }}"
yarn
chmod +x ./scripts/run.sh
./scripts/run.sh
chmod +x ./scripts/test.sh
./scripts/test.sh
40 changes: 0 additions & 40 deletions examples/hello/scripts/run.sh

This file was deleted.

4 changes: 2 additions & 2 deletions examples/nft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@types/node": ">=12.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@zetachain/localnet": "4.0.0-rc1",
"@zetachain/localnet": "4.0.0-rc2",
"@zetachain/toolkit": "13.0.0-rc4",
"axios": "^1.3.6",
"chai": "^4.2.0",
Expand Down Expand Up @@ -58,4 +58,4 @@
"@solana/web3.js": "^1.95.2",
"@zetachain/protocol-contracts": "11.0.0-rc3"
}
}
}
11 changes: 10 additions & 1 deletion examples/nft/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -e

npx hardhat localnet --exit-on-error &

function nft_balance() {
echo -e "\n🖼️ NFT Balance"
echo "---------------------------------------------"
Expand Down Expand Up @@ -42,23 +44,30 @@ npx hardhat universal-set-counterparty --network localhost --contract "$CONTRACT
npx hardhat universal-set-counterparty --network localhost --contract "$CONTRACT_ZETACHAIN" --counterparty "$CONTRACT_BNB" --zrc20 "$ZRC20_BNB" --json &>/dev/null

nft_balance
npx hardhat localnet-check

NFT_ID=$(npx hardhat mint --network localhost --json --contract "$CONTRACT_ZETACHAIN" --token-uri https://example.com/nft/metadata/1 | jq -r '.tokenId')
echo -e "\nMinted NFT with ID: $NFT_ID on ZetaChain."

nft_balance
npx hardhat localnet-check

echo -e "\nTransferring NFT: ZetaChain → Ethereum..."
npx hardhat transfer --network localhost --json --token-id "$NFT_ID" --from "$CONTRACT_ZETACHAIN" --to "$ZRC20_ETHEREUM"

nft_balance
npx hardhat localnet-check

echo -e "\nTransferring NFT: Ethereum → BNB..."
npx hardhat transfer --network localhost --json --token-id "$NFT_ID" --from "$CONTRACT_ETHEREUM" --to "$ZRC20_BNB" --gas-amount 0.1

nft_balance
npx hardhat localnet-check

echo -e "\nTransferring NFT: BNB → ZetaChain..."
npx hardhat transfer --network localhost --json --token-id "$NFT_ID" --from "$CONTRACT_BNB"

nft_balance
nft_balance
npx hardhat localnet-check

npx hardhat localnet-stop
45 changes: 40 additions & 5 deletions examples/nft/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2532,6 +2532,13 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469"
integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==

"@types/[email protected]":
version "22.7.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.5.tgz#cfde981727a7ab3611a481510b473ae54442b92b"
integrity sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==
dependencies:
undici-types "~6.19.2"

"@types/node@^10.0.3":
version "10.17.60"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b"
Expand Down Expand Up @@ -2743,15 +2750,15 @@
typescript "5.5.4"
zod "3.22.4"

"@zetachain/[email protected]rc1":
version "4.0.0-rc1"
resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc1.tgz#0476fc28f184849ccd170927bc9fe6cd6768ca76"
integrity sha512-IWyw+FcrCQ0wCDKs8D2eEdj+L2aBZne81Y2o3e23l1lZ+v7P95cXEmHvHNILF96awKRWvaadregwk8LWdCJcDA==
"@zetachain/[email protected]rc2":
version "4.0.0-rc2"
resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc2.tgz#b5c9ff118c4e7e9ff0c82915292b77659b920e3e"
integrity sha512-Ic2ohIJvFau6stF4HFF5fpI219RxBSago0dKiro9k7tVnOIsi8hnnGZ5snxBaLNCHsiSntZNAAoRfm7crHG3bA==
dependencies:
"@inquirer/prompts" "^5.5.0"
"@uniswap/v2-core" "^1.0.1"
"@uniswap/v2-periphery" "^1.1.0-beta.0"
"@zetachain/protocol-contracts" "11.0.0-rc3"
"@zetachain/protocol-contracts" "10.0.0-rc11"
ansis "^3.3.2"
concurrently "^8.2.2"
ethers "^6.13.2"
Expand All @@ -2765,6 +2772,16 @@
dependencies:
dotenv "^16.1.4"

"@zetachain/[email protected]":
version "10.0.0-rc11"
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-10.0.0-rc11.tgz#53f55ead492f7b5802b1feae4e51abc75730af33"
integrity sha512-qWazjqnIGRngf4OmyeSIv7sHICQRdMQ1CKPIQIqxA8qFR+gHhDHSfvMdRAvgWbsfkimXOIFiHVIATypyWhviJw==
dependencies:
"@openzeppelin/contracts" "^5.0.2"
"@openzeppelin/contracts-upgradeable" "^5.0.2"
"@zetachain/networks" "^10.0.0"
ethers "^6.13.1"

"@zetachain/[email protected]":
version "11.0.0-rc3"
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-11.0.0-rc3.tgz#9b719391d0728fd1b4e046c5f496180a45ecf0d5"
Expand Down Expand Up @@ -4708,6 +4725,19 @@ ethers@^4.0.40:
uuid "2.0.1"
xmlhttprequest "1.8.0"

ethers@^6.13.1:
version "6.13.4"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.4.tgz#bd3e1c3dc1e7dc8ce10f9ffb4ee40967a651b53c"
integrity sha512-21YtnZVg4/zKkCQPjrDj38B1r4nQvTZLopUGMLQ1ePU2zV/joCfDC3t3iKQjWRzjjjbzR+mdAIoikeBRNkdllA==
dependencies:
"@adraffy/ens-normalize" "1.10.1"
"@noble/curves" "1.2.0"
"@noble/hashes" "1.3.2"
"@types/node" "22.7.5"
aes-js "4.0.0-beta.5"
tslib "2.7.0"
ws "8.17.1"

ethers@^6.13.2:
version "6.13.2"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.2.tgz#4b67d4b49e69b59893931a032560999e5e4419fe"
Expand Down Expand Up @@ -7876,6 +7906,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==

[email protected]:
version "2.7.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01"
integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==

tslib@^1.8.1, tslib@^1.9.3:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
Expand Down

0 comments on commit 6fb3bf3

Please sign in to comment.