Skip to content

Commit

Permalink
Update Gumball machine for v1.0 Stokenet
Browse files Browse the repository at this point in the history
  • Loading branch information
motosharpley committed Sep 27, 2023
1 parent 216b7f1 commit aa48fc3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 40 deletions.
8 changes: 4 additions & 4 deletions full-stack/dapp-toolkit-gumball-machine/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# The Gumball Machine on RCNet
# The Gumball Machine on Stokenet
This example is meant to guide you through building, deploying and using the [Gumball Machine Scrypto example](https://github.com/radixdlt/scrypto-examples/tree/main/full-stack/dapp-toolkit-gumball-machine) using the [Radix dApp Toolkit](https://github.com/radixdlt/radix-dapp-toolkit#readme)

## Pre-requisites
1. Node >= 12.17.0
2. The test wallet & Radix connector-extension browser extenstion installed. Instructions [here](https://docs-babylon.radixdlt.com/main/getting-started-developers/wallet-and-connector.html)
3. Scrypto v0.12.0. Instructions to install [here](https://docs-babylon.radixdlt.com/main/getting-started-developers/first-component/install-scrypto.html) and update [here](https://docs-babylon.radixdlt.com/main/getting-started-developers/first-component/updating-scrypto.html)
3. Scrypto v1.0.0. Instructions to install [here](https://docs.radixdlt.com/docs/getting-rust-scrypto) and update [here](https://docs.radixdlt.com/docs/updating-scrypto)

## Building the Scrypto code
1. Enter the scrypto directory in a terminal: `cd scrypto`
1. Build the code: `scrypto build`
1. Two important files (`gumball_machine.schema` and `gumball_machine.wasm`) will be generated in `scrypto/target/wasm32-unknown-unknown/release/`. You will need them for the next step.

## Deploy the package to RCnet
1. Go to the [RCnet Dashboard Website](https://rcnet-v3-dashboard.radixdlt.com/)
1. Go to the [Stokenet Developer Console Website](https://stokenet-console.radixdlt.com/deploy-package)
2. Connect the Wallet Via the Connect Button
3. Navigate to Deploy Package & choose an account and badge or have one created for you if you don't have one yet using the link below. (Which appears once you have selected an account)
4. Upload both `gumball_machine.schema` and `gumball_machine.wasm`
Expand All @@ -26,7 +26,7 @@ This example is meant to guide you through building, deploying and using the [Gu
2. Install the npm dependencies: `npm install`
3. Start the local server with `npm run dev`
4. Open up your browser at the provided url if it doesn't open automatically.
5. Make sure you created an account on the wallet and added funds via the faucet by clicking on account name and then the three dots a button to get XRD from faucet should open.
5. Make sure you created an account on the wallet and added funds via the faucet by clicking on account name and then the three dots > Dev Preferences > a button to Get XRD Test Tokens from the faucet should open.
6. Click on the connect button to fetch your wallet address. You should see your address appearing
7. Fill the package address you got in the previous section and enter a symbol name for your gumball to display in the wallet then click on "instantiate gumball machine"
8. Your wallet will again open up. Click on "sign transaction". You should now see the instantiated component address and Gumball resource address on the page.
Expand Down
24 changes: 13 additions & 11 deletions full-stack/dapp-toolkit-gumball-machine/client/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { RadixDappToolkit, DataRequestBuilder } from '@radixdlt/radix-dapp-toolkit'
// You can create a dApp definition in the dashboard at https://rcnet-v3-dashboard.radixdlt.com/dapp-metadata
import { RadixDappToolkit, DataRequestBuilder, RadixNetwork } from '@radixdlt/radix-dapp-toolkit'
// You can create a dApp definition in the dev console at https://stokenet-console.radixdlt.com/dapp-metadata
// then use that account for your dAppId
const dAppId = 'account_tdx_e_128y6f7ysmlvmn73zfjkjvrlvhqjac3gslep5xlaamg09pmcgdtrt7y'
const dAppId = 'account_tdx_2_12ys5dcytt0hc0yhq5a78stl7upchljsvs36ujdunlszlrgu90mz44d'
// Instantiate DappToolkit
const rdt = RadixDappToolkit({
dAppDefinitionAddress: dAppId,
networkId: 14,
networkId: RadixNetwork.Stokenet, // network ID 2 is for the stokenet test network 1 is for mainnet
applicationName: 'Radix Gumball dApp',
applicationVersion: '1.0.0',
})
console.log("dApp Toolkit: ", rdt)

Expand All @@ -22,14 +24,14 @@ rdt.walletApi.walletData$.subscribe((walletData) => {

// Global states
let accountAddress // User account address
let componentAddress = "component_tdx_e_1crt0ndkk0x7rexswhczacj2405tgzh0zv3t0fr7czdxnd8y8vgjuyw" //GumballMachine component address
let gum_resourceAddress = "resource_tdx_e_1t5hrjudhk4yd5m4svujx5ytvtvjaj5ufuahxaauru72ed7vrce8q34" // RCV3 GUM resource address
let xrdAddress = "resource_tdx_e_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxx8rpsmc" //RCnet v3 XRD resource address
let componentAddress = "component_tdx_2_1czgd7s0x9t0ajqhlw88s09m8pe5caefjf4jnlu8xx45sy5m2dqyq68" //GumballMachine component address on stokenet
let gum_resourceAddress = "resource_tdx_2_1tkwuc7n6udvu2sczkedwhcvaa62mfp53x932az6plyhg6v0nauqd7s" // Stokenet BABYLON resource address
let xrdAddress = "resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc" //Stokenet XRD resource address
// You receive this badge(your resource address will be different) when you instantiate the component
let admin_badge = "resource_tdx_e_1t5kmfczjh3g5vs7gj9jcarmgt0u29qfj50kngxqv2cnny9rr89fd94"
let owner_badge = "resource_tdx_e_1tk35c2pnzy4fr6ms5wpm8v4rsw76h7ptyydvqgs88jk58eqmaeqt45"
// You can use these addresses to skip package deployment steps
// RCNet v3.1 package_address = package_tdx_e_1p5xrp5rasany9nfa5ssp8skmhx4c4v2zlwmjnn7fu29yxhvhhra6l6
let admin_badge = "resource_tdx_2_1tkm4y2lknsuxch62qeg5l7rtc85qzdq66h3xeym5m8tg2yl2k9mgwg"
let owner_badge = "resource_tdx_2_1tkcw4ks7m2hkct99hxfqvfc9uz87cvcmltn925ud5smac4uuguxgul"
// You can use this address to skip package deployment step
// Stokenet package_address = package_tdx_2_1p4ccyz5jtgg0ptgddex03vn068uaz937zucky3nyp9hd6nml4ypx9a


// ************ Instantiate component and fetch component and resource addresses *************
Expand Down
38 changes: 19 additions & 19 deletions full-stack/dapp-toolkit-gumball-machine/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"vite": "^4.1.0"
},
"dependencies": {
"@radixdlt/radix-dapp-toolkit": "^0.7.0"
"@radixdlt/radix-dapp-toolkit": "^1.1.0"
}
}
10 changes: 5 additions & 5 deletions full-stack/dapp-toolkit-gumball-machine/scrypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ version = "0.1.0"
edition = "2021"

[dependencies]
sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.12.1" }
scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.12.1" }
sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.0.0" }
scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.0.0" }

[dev-dependencies]
transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.12.1" }
radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.12.1" }
scrypto-unit = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v0.12.1" }
transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.0.0" }
radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.0.0" }
scrypto-unit = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "v1.0.0" }

[profile.release]
opt-level = 'z' # Optimize for size.
Expand Down

0 comments on commit aa48fc3

Please sign in to comment.