-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
95 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SOROBAN_NETWORK_PASSPHRASE="Standalone Network ; February 2017" | ||
SOROBAN_RPC_URL="http://localhost:8000/soroban/rpc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
# read .env file, but prefer explicitly set environment variables | ||
IFS=$'\n' | ||
for l in $(cat .env); do | ||
IFS='=' read -ra VARVAL <<< "$l" | ||
# If variable with such name already exists, preserves its value | ||
eval "export ${VARVAL[0]}=\${${VARVAL[0]}:-${VARVAL[1]}}" | ||
done | ||
unset IFS | ||
|
||
echo Network | ||
echo " RPC: $SOROBAN_RPC_URL" | ||
echo " Passphrase: \"$SOROBAN_NETWORK_PASSPHRASE\"" | ||
|
||
# Print command before executing, from https://stackoverflow.com/a/23342259/249801 | ||
# Discussion: https://github.com/stellar/soroban-tools/pull/1034#pullrequestreview-1690667116 | ||
exe() { echo"${@/eval/}" ; "$@" ; } | ||
|
||
function fund_all() { | ||
exe eval "./soroban config identity fund" | ||
exe eval "./soroban config identity generate alice" | ||
exe eval "./soroban config identity fund alice" | ||
} | ||
function upload() { | ||
exe eval "(./soroban contract $1 --wasm $2) > $3" | ||
} | ||
function deploy() { | ||
exe eval "(./soroban contract deploy --wasm-hash $(cat $1)) > $2" | ||
} | ||
function deploy_all() { | ||
upload deploy ../../../../target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm contract-id-custom-types.txt | ||
upload deploy ../../../../target/wasm32-unknown-unknown/test-wasms/test_hello_world.wasm contract-id-hello-world.txt | ||
upload deploy ../../../../target/wasm32-unknown-unknown/test-wasms/test_swap.wasm contract-id-swap.txt | ||
upload install ../../../../target/wasm32-unknown-unknown/test-wasms/test_token.wasm contract-token-hash.txt | ||
deploy contract-token-hash.txt contract-id-token-a.txt | ||
deploy contract-token-hash.txt contract-id-token-b.txt | ||
} | ||
function initialize() { | ||
exe eval "./soroban contract invoke --id $(cat $1) -- initialize --admin $(./soroban config identity address) --decimal 0 --name 'Token $2' --symbol '$2'" | ||
} | ||
function initialize_all() { | ||
initialize contract-id-token-a.txt A | ||
initialize contract-id-token-b.txt B | ||
} | ||
function bind() { | ||
exe eval "./soroban contract bindings typescript --contract-id $(cat $1) --output-dir ./node_modules/$2 --overwrite" | ||
} | ||
function bind_all() { | ||
bind contract-id-custom-types.txt test-custom-types | ||
bind contract-id-hello-world.txt test-hello-world | ||
bind contract-id-swap.txt test-swap | ||
bind contract-id-token-a.txt token | ||
} | ||
|
||
curl -X POST "http://localhost:8000/soroban/rpc" || { echo "Make sure you're running standalone RPC network on localhost:8000" && exit 1; } | ||
fund_all | ||
deploy_all | ||
initialize_all | ||
bind_all |
13 changes: 13 additions & 0 deletions
13
cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters