pyth-crosschain/target-chains/aptos/examples/mint_nft
Stanisław Drozd 01c4661985
Repo structure refactor (#449)
* Repo structure refactor

This change introduces major codebase layout changes in three areas:
* Tilt devnet lives in tilt-devnet/ - all k8s and docker files,
scripts, local testing private keys are moved to this directory.
* pyth2wormhole becomes pyth-wormhole-attester and is relocated to
wormhole-attester/ - This long-needed rename will hopefully eradicate
most of the confusing naming around the attester. The Rust client binary
becomes pyth-wormhole-attester-client.
* Target-chain code lives in target-chain/ - This leaves just the
attester, third_party and pythnet-specific things at top-level.

Other opportunistic changes:
* Fixed rebuild trigger for Dockerfile.wasm

These items are a fraction of the necessary structure changes in the repo.

* cosmwasm: fix contract after faulty merge

* .github: remove unused dependabot config

* Fix path references in .github and .pre-commit-config.yml

* .github: Rename attester references to pyth-wormhole-attester

* .pre-commit-config.yaml: fix paths and run all commit hooks

* p2w-relay: Fix faulty merge resolution in favor of origin/main

* Dockerfile.pyth_relay: Fix Ethereum path reference

* Dockerfile.solana: Trip early cache with arbitrary change

* Dockerfile.pyth_relay: typo

* p2w-relay: fix evm build in npm script

* Dockerfile.solana: Retry invalidating cache again

* near -> target-chains/near

* wormhole-attester: bump on/off-chain major versions due to rename

Attester packages were renamed. This possibly breaks most dependees.

* Dockerfile.solana: Improve decoy-crate to have a real lib target

* .github/[...]/pyth-cosmwasm-contract.yml: typo

* rust-toolchain: Bump rust to stable 1.63

* rust-toolchain: use christmas nightly

* empty commit to trigger build

* attester-image-push.yaml: keep xc-attest image name intact

* multisig-wh-message-builder: remove accidental revert
2023-01-04 14:46:42 +01:00
..
app Repo structure refactor (#449) 2023-01-04 14:46:42 +01:00
sources Repo structure refactor (#449) 2023-01-04 14:46:42 +01:00
.gitignore Repo structure refactor (#449) 2023-01-04 14:46:42 +01:00
Move.toml Repo structure refactor (#449) 2023-01-04 14:46:42 +01:00
README.md Repo structure refactor (#449) 2023-01-04 14:46:42 +01:00

README.md

Example Full-Stack App: 1$ Mint

The example contract is deployed at : 0x19f8503273cdb5aa93ffe4539277684615242127aa2e65ef91424136a316c9c7

The goal of this contract is managing an NFT mint where the mint is paid in native currency but the cost of one NFT is always 1$. This example is intended to be run on Aptos testnet because it depends on Pyth and Wormhole existing onchain.

Important files :

  • ./sources/minting.move has the smart contract logic (the code that will run onchain)
  • ./app/src/App.tsx has the React application. The core logic of how the frontend will interact with the wallet and the blockchain. Both combined contain the key pieces of code needed to make an Aptos fullstack app using Pyth!

How to deploy the smart contract :

  • Use aptos init with rest_url : https://testnet.aptoslabs.com/ and faucet https://faucet.testnet.aptoslabs.com to generate a new keypair.
  • Use a faucet to airdrop testnet APT to your newly created account by calling aptos account fund-with-faucet --account default. If this doesn't work, I have had success importing my private key from .aptos/config.yaml into Petra and clicking the airdrop button. Otherwise send APT from another account.
  • Get your account address from .aptos/config.yaml and replace mint_nft="0x19f8503273cdb5aa93ffe4539277684615242127aa2e65ef91424136a316c9c7" by mint_nft="<ADDRESS>" in Move.toml
  • aptos move compile
  • aptos move publish

How to run the webapp :

  • In app/src/App.tsx replace const MINT_NFT_MODULE = "0x19f8503273cdb5aa93ffe4539277684615242127aa2e65ef91424136a316c9c7" by const MINT_NFT_MODULE = "<ADDRESS>" the address of your module from above.
  • npm install
  • npm run start
  • Go to http://localhost:3000/ in your browser and use Petra wallet to transact with the app.