Skip to content

Commit

Permalink
fix: update to use use .env and store standalone in local config
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Aug 23, 2023
1 parent 16a5402 commit 7d72e5b
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ target/
!test.toml

cmd/crates/soroban-spec-typescript/fixtures/ts/package-lock.json

cmd/crates/soroban-spec-typescript/ts-tests/contract_id.txt

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

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

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

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

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

1 change: 1 addition & 0 deletions cmd/crates/soroban-spec-typescript/ts-tests/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SOROBAN_NETWORK=standalone
3 changes: 2 additions & 1 deletion cmd/crates/soroban-spec-typescript/ts-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build
node_modules
yarn.lock
yarn.lock
!.soroban/network/standalone.toml
7 changes: 5 additions & 2 deletions cmd/crates/soroban-spec-typescript/ts-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"private": true,
"type": "module",
"scripts": {
"postinstall": "curl -X POST \"http://localhost:8000/soroban/rpc\" && ./soroban config network add standalone --rpc-url \"http://localhost:8000/soroban/rpc\" --network-passphrase \"Standalone Network ; February 2017\" && ./soroban config identity fund --network standalone && export CONTRACT_ID=$(./soroban contract deploy --wasm ../../../../target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm --network standalone) && ./soroban contract bindings typescript --contract-id $CONTRACT_ID --network standalone --output-dir ./node_modules/test-custom-types --overwrite || { echo \"Make sure you're running standalone RPC network on localhost:8000\" && exit 1; }",
"postinstall": "curl -X POST \"http://localhost:8000/soroban/rpc\" && npm run fund && npm run deploy && npm run bindings || { echo \"Make sure you're running standalone RPC network on localhost:8000\" && exit 1; }",
"fund": "./soroban config identity fund",
"bindings": "./soroban contract bindings typescript --contract-id $(cat contract_id.txt) --output-dir ./node_modules/test-custom-types --overwrite",
"deploy": "(./soroban contract deploy --wasm ../../../../target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm) > contract_id.txt",
"test": "ava"
},
"devDependencies": {
Expand All @@ -14,7 +17,7 @@
"ava": {
"typescript": {
"rewritePaths": {
"src/": "build/"
"tests/": "build/"
},
"compile": "tsc"
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/crates/soroban-spec-typescript/ts-tests/soroban
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

../../../../target/debug/soroban "$@"
cargo run -p soroban-cli -- "$@"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import test from 'ava'
import { Contract, Ok, Err, networks } from 'test-custom-types'
import { Contract, Ok, Err, networks, Address } from 'test-custom-types'

const rpcUrl = 'http://localhost:8000/soroban/rpc'
const publicKey = 'GCBVOLOM32I7OD5TWZQCIXCXML3TK56MDY7ZMTAILIBQHHKPCVU42XYW'
const publicKey = 'GDIY6AQQ75WMD4W46EYB7O6UYMHOCGQHLAQGQTKHDX4J2DYQCHVCR4W4'
const addr = Address.fromString(publicKey)

const contract = new Contract({
Expand All @@ -28,7 +28,8 @@ test('woid', async t => {
t.is(await contract.woid(), undefined)
})

test('u32_fail_on_even', async t => {
// Bug in soroban client, will be fixed in next release
test.failing('u32_fail_on_even', async t => {
t.deepEqual(await contract.u32FailOnEven({ u32_: 1 }), new Ok(1))
t.deepEqual(await contract.u32FailOnEven({ u32_: 0 }), new Err({ message: "Please provide an odd number" }))
})
Expand Down

0 comments on commit 7d72e5b

Please sign in to comment.