diff --git a/README.md b/README.md index 2ae9408..079cd6d 100644 --- a/README.md +++ b/README.md @@ -7,17 +7,23 @@ backed by smart contracts on Stellar. ## Getting Started -### Backend (Local Sandbox) +### Dependencies 1. Install the soroban-cli from https://soroban.stellar.org/docs/getting-started/setup#install-the-soroban-cli -2. Run the backend with `soroban-cli serve` -3. Run `./initialize.sh sandbox` to load the contracts and initialize it. +2. Install Docker for Standalone and Futurenet backends. + +### Backend (Local Sandbox) + +1. Run the backend with `soroban-cli serve` +2. Run `./initialize.sh sandbox` to load the contracts and initialize it. - Note: this will create a `.soroban` sub-directory, to contain the sandbox network data. -4. Configure Freighter +3. Configure Freighter a. Install the custom Freighter Soroban release from https://github.com/stellar/freighter/releases/tag/v2.6.0-beta.2 b. Enable "Experimental Mode" in the settings (gear icon). c. Add a custom network: + | | | + |---|---| | Name | Sandbox | | URL | http://localhost:8000/soroban/rpc | | Passphrase | Local Sandbox Stellar Network ; September 2022 | @@ -26,23 +32,48 @@ backed by smart contracts on Stellar. ### Backend (Local Standalone Network) -1. Install the soroban-cli from https://soroban.stellar.org/docs/getting-started/setup#install-the-soroban-cli -2. Run the backend docker container with `./quickstart.sh standalone`, and wait for it to start. -3. Run `./initialize.sh standalone` to load the contracts and initialize it. +1. Run the backend docker container with `./quickstart.sh standalone`, and wait for it to start. +2. Run `./initialize.sh standalone` to load the contracts and initialize it. - Note: this state will be lost if the quickstart docker container is removed. -4. Configure Freighter +3. Configure Freighter a. Install the custom Freighter Soroban release from https://github.com/stellar/freighter/releases/tag/v2.6.0-beta.2 b. Enable "Experimental Mode" in the settings (gear icon). c. Add a custom network: + | | | + |---|---| | Name | Standalone | | URL | http://localhost:8000/soroban/rpc | | Passphrase | Standalone Network ; February 2017 | | Allow HTTP connection | Enabled | | Switch to this network | Enabled | -5. Add some standalone network lumens to your Freighter wallet. +4. Add some Standalone network lumens to your Freighter wallet. a. Copy the address for your freighter wallet. b. Visit `http://localhost:8000/friendbot?addr=` +### Backend (Futurenet) + +1. Run the backend docker container with `./quickstart.sh futurenet`, and wait for it to start. + - Note: This can take up to 5 minutes to start syncing. You can tell it is + working by visiting http://localhost:8000/, and look at the + `ingest_latest_ledger`, field. If it is `0`, the quickstart image is not + ready yet. +2. Run `./initialize.sh futurenet` to load the contracts and initialize it. +3. Configure Freighter + a. Install the custom Freighter Soroban release from https://github.com/stellar/freighter/releases/tag/v2.6.0-beta.2 + b. Enable "Experimental Mode" in the settings (gear icon). + c. Add a custom network (Note, the out-of-the-box "Future Net" network in + Freighter will not work with a local quickstart container, so we need to add + our own): + | | | + |---|---| + | Name | Futurenet | + | URL | http://localhost:8000/soroban/rpc | + | Passphrase | Test SDF Future Network ; October 2022 | + | Allow HTTP connection | Enabled | + | Switch to this network | Enabled | +4. Add some Futurenet network lumens to your Freighter wallet. + - Visit https://laboratory-futurenet.stellar.org/#create-account, and follow + the instructions to create your freighter account. ### Frontend @@ -54,6 +85,10 @@ npm run dev Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. +Note: Before you can "Approve transfer & Back this project", you'll need to have +some EXT (example token) in your freighter wallet. There is a "Mint 100 EXT" +button, which will gift you 100 EXT tokens for that purpose. + ## User Workflows The contract dev should be able to: diff --git a/initialize.sh b/initialize.sh index a1332d5..4f0dd57 100755 --- a/initialize.sh +++ b/initialize.sh @@ -5,26 +5,28 @@ set -e # TODO: Set the recipient to something reasonable here. Probably whatever account # soroban is running stuff as? # TODO: Have a nicer way to build Identifiers on the CLI -TOKEN_ADMIN=GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI -TOKEN_ADMIN_IDENTIFIER="AAAABAAAAAEAAAAAAAAAAgAAAAUAAAAHQWNjb3VudAAAAAAEAAAAAQAAAAcAAAAAc3b96I5M1hzA+ylKF4az8dBh9fLxyldGX6qTIhG5RtY=" +TOKEN_ADMIN="GDT2NORMZF6S2T4PT4OBJJ43OPD3GPRNTJG3WVVFB356TUHWZQMU6C3U" +TOKEN_ADMIN_IDENTIFIER="AAAABAAAAAEAAAAAAAAAAgAAAAUAAAAHQWNjb3VudAAAAAAEAAAAAQAAAAcAAAAA56a6LMl9LU+PnxwUp5tzx7M+LZpNu1alDvvp0PbMGU8=" case "$1" in standalone) echo "Using standalone network" - export SOROBAN_RPC_URL=http://localhost:8000/soroban/rpc + export SOROBAN_RPC_HOST="http://localhost:8000" + export SOROBAN_RPC_URL="$SOROBAN_RPC_HOST/soroban/rpc" export SOROBAN_NETWORK_PASSPHRASE="Standalone Network ; February 2017" - export SOROBAN_SECRET_KEY="SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L" + export SOROBAN_SECRET_KEY="SAKCFFFNCE7XAWYMYVRZQYKUK6KMUCDIINLWISJYTMYJLNR2QLCDLFVT" echo Fund token admin account from friendbot - curl "$SOROBAN_RPC_URL/friendbot?addr=$TOKEN_ADMIN" + curl "$SOROBAN_RPC_HOST/friendbot?addr=$TOKEN_ADMIN" ;; futurenet) echo "Using Futurenet network" - export SOROBAN_RPC_URL=http://localhost:8000/soroban/rpc + export SOROBAN_RPC_HOST="http://localhost:8000" + export SOROBAN_RPC_URL="$SOROBAN_RPC_HOST/soroban/rpc" export SOROBAN_NETWORK_PASSPHRASE="Test SDF Future Network ; October 2022" - export SOROBAN_SECRET_KEY="SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L" + export SOROBAN_SECRET_KEY="SAKCFFFNCE7XAWYMYVRZQYKUK6KMUCDIINLWISJYTMYJLNR2QLCDLFVT" # TODO: Use friendbot to fund the token admin, or figure our token admin here... - # curl "$SOROBAN_RPC_URL/friendbot?addr=$TOKEN_ADMIN" + curl "https://friendbot-futurenet.stellar.org/?addr=$TOKEN_ADMIN" ;; ""|sandbox) # no-op diff --git a/pages/_app.tsx b/pages/_app.tsx index 7ba2640..99c1cc9 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -7,7 +7,7 @@ import { getDefaultWallets, } from "../wallet"; -const chains: ChainMetadata[] = [chain.sandbox, chain.standalone]; +const chains: ChainMetadata[] = [chain.sandbox, chain.standalone, chain.futurenet]; const { wallets } = getDefaultWallets({ appName: "Example Stellar App", diff --git a/quickstart.sh b/quickstart.sh index fa44bf2..4b3fff5 100755 --- a/quickstart.sh +++ b/quickstart.sh @@ -2,7 +2,7 @@ set -e -REVISION=42641a3dbc46565584e424697f042aec7d5063681cc22a0f490f78fa1f1e1de0 +REVISION=089d356c55f7e5da92d5440d29a1772c701422e6db8ac0400ef8e85518d2df9f case "$1" in standalone) diff --git a/shared/constants.tsx b/shared/constants.tsx index 7128e36..790d04d 100644 --- a/shared/constants.tsx +++ b/shared/constants.tsx @@ -1,6 +1,9 @@ +// These were randomly generated from https://laboratory.stellar.org/#account-creator +const TokenAdmin = 'GDT2NORMZF6S2T4PT4OBJJ43OPD3GPRNTJG3WVVFB356TUHWZQMU6C3U' +const TokenAdminSecretKey = 'SAKCFFFNCE7XAWYMYVRZQYKUK6KMUCDIINLWISJYTMYJLNR2QLCDLFVT' + +// Contract IDs, set up by ./initialize.sh const CrowdfundId = process.env.CROWDFUND_ID ?? '' -const TokenAdmin = 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI' -const TokenAdminSecretKey = 'SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L' const TokenId = process.env.TOKEN_ID ?? '' const Constants = {