The Baseball Card Store Dapp sells baseball cards as NFT tokens in exchange for tokens.
Install the prerequisites.
Switch to the community-dev
branch of the agoric-sdk:
# Use the root directory of the agoric-sdk checkout
cd agoric-sdk
# Switch the community-dev stable branch
git checkout community-dev
# Build the dependencies
yarn && yarn build
To run the dapp, you'll use 3 separate terminal windows
# Terminal 1
# Use the root directory of the dapp-card-store checkout
cd dapp-card-store
# Install the dapp into a directory named demo
agoric init --dapp-template dapp-card-store demo
# Use the new dapp's directory
cd demo
# Install the project dependencies
agoric install community-dev
# Start the Agoric simulated blockchain & VM.
# This will take a few minutes to complete. Wait for the output to settle.
agoric start --reset --verbose
# Terminal 2
# Use the demo directory in the dapp-card-store checkout
cd dapp-card-store/demo
# Open the Agoric solo wallet and repl
# This should open a new browser tab to http://127.0.0.1:8000
agoric open --repl
# Terminal 2
# Use the demo directory in the the dapp-card-store checkout
cd dapp-card-store/demo
# Deploy a new instance of the contract to the VM
agoric deploy ./contract/deploy.js
# Deploy a new instance of the API to the VM
agoric deploy ./api/deploy.js
# Terminal 3
# Use the demo directory in the the dapp-card-store checkout
cd dapp-card-store/demo
# Start the user interface
cd ui && yarn start
-
agoric open
will have opened your wallet at http://127.0.0.1:8000/ -
yarn start
will open the dapp at http://127.0.0.1:3000. The dapp will ask you to switch to the wallet toAccept
theDapp Connection
. -
Open a new tab from your and go to https://wallet.agoric.app/locator/ and enter http://127.0.0.1:8000/ into the dialog as shown below.
-
In the wallet,
Accept
theDapp Connection
between cardStore and the wallet. -
In the dapp, you should be able to click on a baseball card to
BID
on it in an action. EnterBid ammount
to submit an offer to buy the card. -
In the wallet,
Approve
theProposed
offer to bid on a card. -
In the wallet, the offer will be in a
Pending
state while the auction for the card to complete. The auction takes up to 300 seconds. -
In the wallet, your offer will transition to an
Accepted
state when the auction ends. YourcardStore.Card
purse will now contain a card
To learn more about how to build Agoric Dapps, please see the Dapp Guide.