diff --git a/README.md b/README.md index 4ea3f99..5e9561a 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,18 @@ This repository contains Flow transaction scripts that the Dapper wallet will su ```shell $ bash render.sh [TEMPLATE_NAME] [NETWORK] ``` +or +```shell +$ bash all.sh [NETWORK] // loops directories +``` + +## Rendering Transaction Environment -Check out the templates and find the one that fits your use case best. Let's say it's `create-listing`, and you'd like to render a transaction template for use on `testnet`. +Overlay environment with each folder `/.env` and shared `./.env` both optional -1. Open `create-listing/testnet.env` and fill in the missing template variables. -2. Run the folowing command to render the template using the variables you set in `testnet.env` +Example +1. Open `create-listing/testnet.env` or `./testnet.env` and fill in the missing template variables. +2. Run the folowing command to render `testnet.env` ```shell $ bash render.sh create-listing testnet ``` diff --git a/all.sh b/all.sh new file mode 100755 index 0000000..e810472 --- /dev/null +++ b/all.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Make sure the arguments look valid +if [ -z $1 ] || ([ $1 != "testnet" ] && [ $1 != "mainnet" ]) +then + echo "Usage: bash all.sh [NETWORK]" + exit 1 +fi +for dir in */; do + DIRNAME=${dir%/} + /bin/bash render.sh $DIRNAME $1 +done \ No newline at end of file diff --git a/render.sh b/render.sh old mode 100644 new mode 100755 index 566be95..3d7b967 --- a/render.sh +++ b/render.sh @@ -8,12 +8,16 @@ then fi # Compute paths to the .env file and the template file -env_file="$1/$2.env" template_file="$1/$1.cdc.tmpl" output_file="$1/$1-$2.cdc" -# Populate environment with values from the .env file -export $(cat $env_file | xargs) +# overlay model +if test -f "$2.env"; then + export $(cat "$2.env" | xargs) +fi +if test -f "$1/$2.env"; then + export $(cat "$1/$2.env" | xargs) +fi # Render the template envsubst < $template_file > $output_file diff --git a/testnet.env b/testnet.env new file mode 100644 index 0000000..af1cb59 --- /dev/null +++ b/testnet.env @@ -0,0 +1,11 @@ +FungibleTokenContractAddress=0x9a0766d93b6608b7 +NonFungibleTokenContractAddress=0x631e88ae7f1d7c20 +DapperUtilityCoinContractAddress=0x82ec283f88a62e65 +NFTStorefrontContractAddress=0x94b06cfca1d8a476 +PackNFTContractAddress=0x4dfd62c88d1b6462 +IPackNFTContractAddress=0x5e3c1eb7f25e3c99 +NFTContractName= +NFTContractAddress= +RoyaltyReceiverAddress= + +