Skip to content

Commit

Permalink
#458: fixed filename collision, dont use .soroban, it's used by cli a…
Browse files Browse the repository at this point in the history
…lready.
  • Loading branch information
sreuland committed May 31, 2023
1 parent 6f646f5 commit f483e05
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
cache: 'npm'
- run: npm ci
- run: |
mkdir -p .soroban
echo 'a9ab643486dc0dbcdc1485e6589e8bb3bcbbd8e69ad66c703556b4d6645a6dc8' > .soroban/token_id
echo '42798d5db884626e57f96630e7d02ba8210b4629d2959ef79ebb9e6538676ef9' > .soroban/crowdfund_id
echo 'GDT2NORMZF6S2T4PT4OBJJ43OPD3GPRNTJG3WVVFB356TUHWZQMU6C3U' > .soroban/token_admin_address
echo 'SAKCFFFNCE7XAWYMYVRZQYKUK6KMUCDIINLWISJYTMYJLNR2QLCDLFVT' > .soroban/token_admin_secret
mkdir -p .soroban-example-dapp
echo 'a9ab643486dc0dbcdc1485e6589e8bb3bcbbd8e69ad66c703556b4d6645a6dc8' > .soroban-example-dapp/token_id
echo '42798d5db884626e57f96630e7d02ba8210b4629d2959ef79ebb9e6538676ef9' > .soroban-example-dapp/crowdfund_id
echo 'GDT2NORMZF6S2T4PT4OBJJ43OPD3GPRNTJG3WVVFB356TUHWZQMU6C3U' > .soroban-example-dapp/token_admin_address
echo 'SAKCFFFNCE7XAWYMYVRZQYKUK6KMUCDIINLWISJYTMYJLNR2QLCDLFVT' > .soroban-example-dapp/token_admin_secret
- run: npm run-script build
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
/.soroban-example-dapp
/.soroban

# dependencies
/node_modules
/.pnp
Expand Down
22 changes: 10 additions & 12 deletions initialize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ futurenet)
;;
esac

#if !(soroban config network ls | grep "$NETWORK" 2>&1 >/dev/null); then
# Always set a net configuration
echo Add the $NETWORK network to cli client
soroban config network add \
--rpc-url "$SOROBAN_RPC_URL" \
--network-passphrase "$SOROBAN_NETWORK_PASSPHRASE" "$NETWORK"
#fi

echo Add the $NETWORK network to cli client
soroban config network add \
--rpc-url "$SOROBAN_RPC_URL" \
--network-passphrase "$SOROBAN_NETWORK_PASSPHRASE" "$NETWORK"

if !(soroban config identity ls | grep token-admin 2>&1 >/dev/null); then
echo Create the token-admin identity
Expand All @@ -47,9 +45,9 @@ TOKEN_ADMIN_SECRET="$(soroban config identity show token-admin)"
TOKEN_ADMIN_ADDRESS="$(soroban config identity address token-admin)"

# TODO: Remove this once we can use `soroban config identity` from webpack.
mkdir -p .soroban
echo "$TOKEN_ADMIN_SECRET" > .soroban/token_admin_secret
echo "$TOKEN_ADMIN_ADDRESS" > .soroban/token_admin_address
mkdir -p .soroban-example-dapp
echo "$TOKEN_ADMIN_SECRET" > .soroban-example-dapp/token_admin_secret
echo "$TOKEN_ADMIN_ADDRESS" > .soroban-example-dapp/token_admin_address

# This will fail if the account already exists, but it'll still be fine.
echo Fund token-admin account from friendbot
Expand All @@ -66,7 +64,7 @@ echo "Token wrapped succesfully with TOKEN_ID: $TOKEN_ID"
TOKEN_ADDRESS="$(node ./address_workaround.js $TOKEN_ID)"
echo "Token Address converted to StrKey contract address format:" $TOKEN_ADDRESS

echo -n "$TOKEN_ID" > .soroban/token_id
echo -n "$TOKEN_ID" > .soroban-example-dapp/token_id

echo Build the crowdfund contract
make build
Expand All @@ -77,7 +75,7 @@ CROWDFUND_ID="$(
--wasm target/wasm32-unknown-unknown/release/soroban_crowdfund_contract.wasm
)"
echo "Contract deployed succesfully with ID: $CROWDFUND_ID"
echo "$CROWDFUND_ID" > .soroban/crowdfund_id
echo "$CROWDFUND_ID" > .soroban-example-dapp/crowdfund_id

echo "Initialize the crowdfund contract"
deadline="$(($(date +"%s") + 86400))"
Expand Down
8 changes: 4 additions & 4 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ var fs = require('fs');
module.exports = {
reactStrictMode: true,
env: {
CROWDFUND_ID: fs.readFileSync('.soroban/crowdfund_id').toString().trim(),
TOKEN_ADMIN_ADDRESS: fs.readFileSync('.soroban/token_admin_address').toString().trim(),
TOKEN_ADMIN_SECRET: fs.readFileSync('.soroban/token_admin_secret').toString().trim(),
TOKEN_ID: fs.readFileSync('.soroban/token_id').toString().trim(),
CROWDFUND_ID: fs.readFileSync('.soroban-example-dapp/crowdfund_id').toString().trim(),
TOKEN_ADMIN_ADDRESS: fs.readFileSync('.soroban-example-dapp/token_admin_address').toString().trim(),
TOKEN_ADMIN_SECRET: fs.readFileSync('.soroban-example-dapp/token_admin_secret').toString().trim(),
TOKEN_ID: fs.readFileSync('.soroban-example-dapp/token_id').toString().trim(),
},
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"setup": "./initialize.sh standalone",
"reset": "rm -rf .soroban ; npm run setup",
"reset": "rm -rf .soroban-example-dapp ; npm run setup",
"dev": "next dev",
"build": "next build",
"start": "next start",
Expand Down

0 comments on commit f483e05

Please sign in to comment.