diff --git a/.cargo/config.toml b/.cargo/config.toml index 90410e20..a1a83b00 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,7 +1,7 @@ # paths = ["/path/to/override"] # path dependency overrides [alias] # command aliases -install_soroban = "install --git https://github.com/stellar/soroban-tools --rev cb3c44f9d8080917a7cb019d6be25019f6cf78c3 --root ./target soroban-cli --debug" +install_stellar = "install --locked stellar-cli --version 21.0.0 --force --root ./target stellar-cli --debug" b = "build --target wasm32-unknown-unknown --release" # c = "check" # t = "test" diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..f3c54b5f --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +package-lock.json linguist-generated=true -diff diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 0aacbff6..c2549ea2 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -6,34 +6,35 @@ on: pull_request: jobs: - complete: if: always() needs: [build-and-test] runs-on: ubuntu-latest steps: - - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') - run: exit 1 + - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + run: exit 1 build-and-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: stellar/actions/rust-cache@main - - run: rustup update - - run: rustup target add wasm32-unknown-unknown - - run: make build - - run: cargo install_soroban - - uses: actions/setup-node@v3 - with: - node-version: 18.x - cache: 'npm' - - run: | - mkdir -p .soroban-example-dapp - echo 'futurenet' > .soroban-example-dapp/network - echo 'CC757WDV3G442WQCNPNOA2UEXOC7UJD5VP4BLLCRDW5LRM6UZZR6ISVU' > .soroban-example-dapp/abundance_token_id - echo 'CCHCPXECLYGX4QU34ZZOHP6C6KVAPIDTUNPIUA6GF4SP6ECFF5BX57OG' > .soroban-example-dapp/crowdfund_id - echo 'Standalone Network ; February 2017' > .soroban-example-dapp/passphrase - echo 'https://rpc-futurenet.stellar.org/' > .soroban-example-dapp/rpc-url - - run: npm ci - - run: npm run build + - uses: actions/checkout@v3 + - uses: stellar/actions/rust-cache@main + - run: rustup update + - run: rustup target add wasm32-unknown-unknown + - run: make build + - run: cargo install --locked soroban-cli --version 21.0.0-rc.1 + - uses: actions/setup-node@v3 + with: + node-version: 18.14.2 + cache: 'npm' + - run: | + mkdir -p .soroban-example-dapp + echo 'futurenet' > .soroban-example-dapp/network + echo 'CAU23MVDEW7VMB3AXC5PL5GZO3HBYZPEIP2P46X4T3AIC4Y7FXYZWES5' > .soroban-example-dapp/abundance_token_id + echo 'CDJPYH5HNGZ24SEWXFJOW6RXXHHNKU4XPCPBMB2VRTDPTMVPLYFQKZIE' > .soroban-example-dapp/crowdfund_id + echo 'Test SDF Future Network ; October 2022' > .soroban-example-dapp/passphrase + echo 'https://rpc-futurenet.stellar.org/' > .soroban-example-dapp/rpc-url + echo '{"network":"futurenet","rpcUrl":"https://rpc-futurenet.stellar.org","networkPassphrase":"Test SDF Future Network ; October 2022"}' > shared/config.json + + - run: npm ci + - run: npm run build diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 19de7116..050583d4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -5,9 +5,6 @@ on: branches: [main] pull_request: -env: - RUSTFLAGS: -Wclippy::all -Wclippy::pedantic - jobs: # complete: @@ -28,6 +25,7 @@ jobs: build-and-test: strategy: matrix: + rust: [msrv, latest] sys: - os: ubuntu-latest target: wasm32-unknown-unknown @@ -39,7 +37,21 @@ jobs: steps: - uses: actions/checkout@v3 - uses: stellar/actions/rust-cache@main + - name: Use the minimum supported Rust version + if: matrix.rust == 'msrv' + run: | + msrv="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages | map(.rust_version) | map(values) | min')" + rustup override set $msrv + rustup component add clippy --toolchain $msrv + - name: Error on warnings and clippy checks + # Only error on warnings and checks for the msrv, because new versions of + # Rust will frequently add new warnings and checks. + if: matrix.rust == 'msrv' + run: echo RUSTFLAGS='-Wclippy::all -Wclippy::pedantic' >> $GITHUB_ENV + # TODO: Deny warnings when the warnings have been cleaned up. + # run: echo RUSTFLAGS='-Dwarnings -Wclippy::all -Wclippy::pedantic' >> $GITHUB_ENV - run: rustup update + - run: cargo version - run: rustup target add ${{ matrix.sys.target }} - run: cargo clippy --target ${{ matrix.sys.target }} --lib - if: matrix.sys.target != 'wasm32-unknown-unknown' diff --git a/.gitignore b/.gitignore index 47d52602..5c6985fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. /.soroban-example-dapp /.soroban +/shared/config.json # dependencies /node_modules /.pnp diff --git a/.nvmrc b/.nvmrc index 3c032078..72e4a483 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18 +18.14.2 diff --git a/Cargo.lock b/Cargo.lock index 90949982..c48220b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,9 +12,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.19.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -36,9 +36,9 @@ dependencies = [ [[package]] name = "arbitrary" -version = "1.3.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" dependencies = [ "derive_arbitrary", ] @@ -51,9 +51,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -84,9 +84,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -94,15 +94,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -118,12 +109,6 @@ version = "3.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - [[package]] name = "bytes-lit" version = "0.0.5" @@ -133,7 +118,7 @@ dependencies = [ "num-bigint", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] @@ -232,22 +217,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f34ba9a9bcb8645379e9de8cb3ecfcf4d1c85ba66d90deb3259206fa5aa193b" dependencies = [ "quote", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] name = "curve25519-dalek" -version = "3.2.0" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "platforms", + "rustc_version", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "cxx" version = "1.0.94" @@ -272,7 +272,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] @@ -289,7 +289,7 @@ checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] @@ -313,7 +313,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] @@ -324,7 +324,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" dependencies = [ "darling_core", "quote", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] @@ -339,22 +339,13 @@ dependencies = [ [[package]] name = "derive_arbitrary" -version = "1.3.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cdeb9ec472d588e539a818b2dee436825730da08ad0017c4b1a17676bdc8b7" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", + "syn 2.0.39", ] [[package]] @@ -363,7 +354,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "const-oid", "crypto-common", "subtle", @@ -382,33 +373,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" dependencies = [ "der", - "digest 0.10.7", + "digest", "elliptic-curve", "rfc6979", - "signature 2.1.0", + "signature", "spki", ] [[package]] name = "ed25519" -version = "1.5.3" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" dependencies = [ - "signature 1.6.4", + "pkcs8", + "signature", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ "curve25519-dalek", "ed25519", - "rand", + "rand_core 0.6.4", "serde", - "sha2 0.9.9", + "sha2", "zeroize", ] @@ -426,7 +418,7 @@ checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" dependencies = [ "base16ct", "crypto-bigint", - "digest 0.10.7", + "digest", "ff", "generic-array", "group", @@ -437,11 +429,23 @@ dependencies = [ "zeroize", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "escape-bytes" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bfcf67fea2815c2fc3b90873fae90957be12ff417335dfadc7f52927feb03b2" + [[package]] name = "ethnum" -version = "1.3.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0198b9d0078e0f30dedc7acbb21c974e838fc8fae3ee170128658a98cb2c1c04" +checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" [[package]] name = "ff" @@ -453,6 +457,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" + [[package]] name = "fnv" version = "1.0.7" @@ -483,9 +493,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "js-sys", @@ -496,9 +506,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "group" @@ -517,6 +527,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + [[package]] name = "hex" version = "0.4.3" @@ -526,13 +542,19 @@ dependencies = [ "serde", ] +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + [[package]] name = "hmac" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest 0.10.7", + "digest", ] [[package]] @@ -572,27 +594,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", "serde", ] [[package]] -name = "indexmap-nostd" -version = "0.4.0" +name = "indexmap" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", + "serde", +] [[package]] -name = "intx" -version = "0.1.0" +name = "indexmap-nostd" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] @@ -622,8 +649,8 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2 0.10.7", - "signature 2.1.0", + "sha2", + "signature", ] [[package]] @@ -637,9 +664,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.147" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -673,9 +700,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", ] @@ -693,13 +720,13 @@ dependencies = [ [[package]] name = "num-derive" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] @@ -714,18 +741,18 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] [[package]] name = "object" -version = "0.30.3" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -736,12 +763,6 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - [[package]] name = "paste" version = "1.0.13" @@ -758,6 +779,12 @@ dependencies = [ "spki", ] +[[package]] +name = "platforms" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -771,23 +798,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ceca8aaf45b5c46ec7ed39fff75f57290368c1846d33d24a122ca81416ab058" dependencies = [ "proc-macro2", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -800,11 +827,22 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ "getrandom 0.1.16", "libc", - "rand_chacha", + "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + [[package]] name = "rand_chacha" version = "0.2.2" @@ -815,6 +853,16 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.5.1" @@ -830,7 +878,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.11", ] [[package]] @@ -901,29 +949,29 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.162" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.162" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -932,15 +980,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.0.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02d8aa6e3c385bf084924f660ce2a3a6bd333ba55b35e8590b321f35d88513" +checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" dependencies = [ - "base64 0.21.0", + "base64 0.22.1", "chrono", "hex", - "indexmap", + "indexmap 1.9.3", + "indexmap 2.2.6", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -948,38 +998,25 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.0.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc7d5d3932fb12ce722ee5e64dd38c504efba37567f0c402f6ca728c3b8b070" +checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] @@ -988,23 +1025,17 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest 0.10.7", + "digest", "keccak", ] -[[package]] -name = "signature" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" - [[package]] name = "signature" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ - "digest 0.10.7", + "digest", "rand_core 0.6.4", ] @@ -1015,24 +1046,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] -name = "soroban-crowdfund-contract" -version = "0.0.0" +name = "soroban-builtin-sdk-macros" +version = "20.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc32c6e817f3ca269764ec0d7d14da6210b74a5bf14d4e745aa3ee860558900" dependencies = [ - "rand", - "soroban-sdk", + "itertools", + "proc-macro2", + "quote", + "syn 2.0.39", ] [[package]] name = "soroban-env-common" -version = "0.0.17" +version = "20.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e28d297d1172c2a020660728ac24ca3af7118de85ad547d071f96221111dfb" +checksum = "c14e18d879c520ff82612eaae0590acaf6a7f3b977407e1abb1c9e31f94c7814" dependencies = [ "arbitrary", "crate-git-revision", "ethnum", "num-derive", - "num-integer", "num-traits", "serde", "soroban-env-macros", @@ -1043,9 +1077,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "0.0.17" +version = "20.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fbccdce4f74778cfe79e6ca8b6df2d094237d0bedf4aa167a73bfdaa7388fed" +checksum = "5122ca2abd5ebcc1e876a96b9b44f87ce0a0e06df8f7c09772ddb58b159b7454" dependencies = [ "soroban-env-common", "static_assertions", @@ -1053,26 +1087,26 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "0.0.17" +version = "20.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35eef83232686c48fc8c8bfc560ee2e065bdd18ac31da8cb570e93f3fd78fea0" +checksum = "114a0fa0d0cc39d0be16b1ee35b6e5f4ee0592ddcf459bde69391c02b03cf520" dependencies = [ "backtrace", "curve25519-dalek", "ed25519-dalek", - "getrandom 0.2.10", - "hex", + "getrandom 0.2.11", + "hex-literal", + "hmac", "k256", - "log", "num-derive", "num-integer", "num-traits", - "rand", - "rand_chacha", - "sha2 0.9.9", + "rand 0.8.5", + "rand_chacha 0.3.1", + "sha2", "sha3", + "soroban-builtin-sdk-macros", "soroban-env-common", - "soroban-native-sdk-macros", "soroban-wasmi", "static_assertions", "stellar-strkey", @@ -1080,9 +1114,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "0.0.17" +version = "20.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fcab4ca9be166587dd84939576634f2f7bccf213fe9f6aced9561ab4238be1" +checksum = "b13e3f8c86f812e0669e78fcb3eae40c385c6a9dd1a4886a1de733230b4fcf27" dependencies = [ "itertools", "proc-macro2", @@ -1090,46 +1124,36 @@ dependencies = [ "serde", "serde_json", "stellar-xdr", - "syn 2.0.15", - "thiserror", + "syn 2.0.39", ] [[package]] name = "soroban-ledger-snapshot" -version = "0.9.2" +version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c379a73e5d14b0b9ba41157161c5362427a2ca75c936d1b737d41bca91ef252f" +checksum = "61a54708f44890e0546180db6b4f530e2a88d83b05a9b38a131caa21d005e25a" dependencies = [ "serde", "serde_json", + "serde_with", "soroban-env-common", "soroban-env-host", "thiserror", ] -[[package]] -name = "soroban-native-sdk-macros" -version = "0.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d891b456b0f6897ccbb8b67388ed7ce921fd47d19ff3ae8d8b1edca08339639" -dependencies = [ - "itertools", - "proc-macro2", - "quote", - "syn 2.0.15", -] - [[package]] name = "soroban-sdk" -version = "0.9.2" +version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1cf449f8c53d905ac41d4c264442f26aa559d4a0ef451569a7739bd4d747595" +checksum = "84fc8be9068dd4e0212d8b13ad61089ea87e69ac212c262914503a961c8dc3a3" dependencies = [ "arbitrary", "bytes-lit", "ctor", "ed25519-dalek", - "rand", + "rand 0.8.5", + "serde", + "serde_json", "soroban-env-guest", "soroban-env-host", "soroban-ledger-snapshot", @@ -1139,9 +1163,9 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "0.9.2" +version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ab0a02c265c41a44311e3e6271e0fccd518bda0c8383c7ff8aee478541d3b" +checksum = "db20def4ead836663633f58d817d0ed8e1af052c9650a04adf730525af85b964" dependencies = [ "crate-git-revision", "darling", @@ -1149,19 +1173,19 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "sha2 0.9.9", + "sha2", "soroban-env-common", "soroban-spec", "soroban-spec-rust", "stellar-xdr", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] name = "soroban-spec" -version = "0.9.2" +version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfd732ef1613e5ec919410fddd842d8cb804effb63c43acbf5ec6d77e6d0633" +checksum = "3eefeb5d373b43f6828145d00f0c5cc35e96db56a6671ae9614f84beb2711cab" dependencies = [ "base64 0.13.1", "stellar-xdr", @@ -1171,36 +1195,35 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "0.9.2" +version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde0592863f1f34c1eff8bdbe35a6557adb6abadfc57804217fe035bec7421ef" +checksum = "3152bca4737ef734ac37fe47b225ee58765c9095970c481a18516a2b287c7a33" dependencies = [ "prettyplease", "proc-macro2", "quote", - "sha2 0.9.9", + "sha2", "soroban-spec", "stellar-xdr", - "syn 2.0.15", + "syn 2.0.39", "thiserror", ] [[package]] name = "soroban-token-sdk" -version = "0.9.2" +version = "20.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38fabcf7f14b0a9b471d1663d3b29e32ca374a86dc8da6fe6536b5d3842def45" +checksum = "ee8ed0ae2e5d5e67b7939200bba3712b4c81dcf87b2ccd68bba049bec64c780f" dependencies = [ "soroban-sdk", ] [[package]] name = "soroban-wasmi" -version = "0.30.0-soroban" +version = "0.31.1-soroban.20.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c193640a103c4fc81163feca877bbea234dc20150015428ecc4e010f025f82bf" +checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" dependencies = [ - "intx", "smallvec", "spin", "wasmi_arena", @@ -1230,28 +1253,39 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "stellar-crowdfund-contract" +version = "0.0.0" +dependencies = [ + "rand 0.7.3", + "soroban-sdk", +] + [[package]] name = "stellar-strkey" -version = "0.0.7" +version = "0.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0689070126ca7f2effc2c5726584446db52190f0cef043c02eb4040a711c11" +checksum = "12d2bf45e114117ea91d820a846fd1afbe3ba7d717988fee094ce8227a3bf8bd" dependencies = [ "base32", + "crate-git-revision", "thiserror", ] [[package]] name = "stellar-xdr" -version = "0.0.17" +version = "20.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae197b4edde8835ab0ba018f1b5cdab0c47d0f28848f3f75d2951a1c9c7cdb48" +checksum = "e59cdf3eb4467fb5a4b00b52e7de6dca72f67fac6f9b700f55c95a5d86f09c9d" dependencies = [ "arbitrary", "base64 0.13.1", "crate-git-revision", + "escape-bytes", "hex", "serde", "serde_with", + "stellar-strkey", ] [[package]] @@ -1279,9 +1313,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -1314,7 +1348,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.39", ] [[package]] @@ -1442,9 +1476,9 @@ checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" [[package]] name = "wasmi_core" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624e6333e861ef49095d2d678b76ebf30b06bf37effca845be7e5b87c90071b7" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" dependencies = [ "downcast-rs", "libm", @@ -1458,7 +1492,7 @@ version = "0.88.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb8cf7dd82407fe68161bedcd57fde15596f32ebf6e9b3bdbf3ae1da20e38e5e" dependencies = [ - "indexmap", + "indexmap 1.9.3", ] [[package]] @@ -1572,17 +1606,3 @@ name = "zeroize" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] diff --git a/Cargo.toml b/Cargo.toml index 3106b429..0ccfa126 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,9 @@ members = [ "contracts/*", ] +[workspace.package] +rust-version = "1.74.0" + [profile.release] opt-level = "z" overflow-checks = true @@ -16,5 +19,5 @@ codegen-units = 1 lto = true [workspace.dependencies] -soroban-sdk = "0.9.2" -soroban-token-sdk = "0.9.2" +soroban-sdk = "20.0.0-rc2" +soroban-token-sdk = "20.0.0-rc2" diff --git a/Dockerfile b/Dockerfile index cadb8e4d..2c34eceb 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Based on Preview 7 # https://soroban.stellar.org/docs/reference/releases -FROM ubuntu:20.04 +FROM ubuntu:22.04 RUN apt update && apt install -y curl diff --git a/README.md b/README.md index b9c85db3..e38f7edd 100755 --- a/README.md +++ b/README.md @@ -1,123 +1,123 @@ -Soroban Crowdfunding Dapp Example -================================= +# Soroban Crowdfunding Dapp Example ![Screenshot of the Example Dapp](screenshot.png) This is a [Next.js](https://nextjs.org/) project, demoing how to build a dapp frontend backed by smart contracts on Stellar. -Getting Started -=============== +# Getting Started -Install Dependencies --------------------- +## Install Dependencies -1. `soroban-cli`. See https://soroban.stellar.org/docs/getting-started/setup#install-the-soroban-cli, but instead of `cargo install soroban-cli`, run `cargo install_soroban`. This is an alias set up in [.cargo/config.toml](./.cargo/config.toml), which pins the local soroban-cli to a specific version. If you add `./target/bin/` [to your PATH](https://linuxize.com/post/how-to-add-directory-to-path-in-linux/), then you'll automatically use this version of `soroban-cli` when you're in this directory. -2. If you want to run everything locally: `docker` (you can run both Standalone and Futurenet backends with it) -3. Node.js v18 -4. [Freighter Wallet](https://www.freighter.app/) ≥[v5.0.2](https://github.com/stellar/freighter/releases/tag/2.9.1). Or from the Firefox / Chrome extension store. Once installed, enable "Experimental Mode" in the settings (gear icon). -5. If you want to run everything locally, build the `soroban-preview` docker image: +1. `rustc` >= 1.71.0 with the `wasm32-unknown-unknown` target installed. See https://soroban.stellar.org/docs/getting-started/setup#install-rust . If you have already a lower version, the easiest way to upgrade is to uninstall (`rustup self uninstall`) and install it again. +2. `soroban-cli`. See https://soroban.stellar.org/docs/getting-started/setup#install-the-soroban-cli +3. If you want to run everything locally: `docker` (you can run both Standalone and Futurenet backends with it) +4. Node.js v18 +5. [Freighter Wallet](https://www.freighter.app/) ≥[v5.0.2](https://github.com/stellar/freighter/releases/tag/2.9.1). Or from the Firefox / Chrome extension store. Once installed, enable "Experimental Mode" in the settings (gear icon). +6. If you want to skip step (1) and (2) and avoid installing specific `rustc` or `soroban-cli` versions, build the `soroban-preview` docker image: - make build-docker + make build-docker - Building the docker image lets you avoid installing the specific version of soroban-cli in step (1), if desired. -6. **NOTE** - Follow the instructions below for Futurenet or Standalone and ensure that you have funded your wallet address that you intend to use from browser, otherwise the dapp display will be blank and a 'Account not found' will be printed on browser's console only. +7. **NOTE** - Follow the instructions below for Futurenet or Standalone and ensure that you have funded your wallet address that you intend to use from browser, otherwise the dapp display will be blank and a 'Account not found' will be printed on browser's console only. -Run Backend ------------ +## Run Backend + +Make sure to start from a clean setup: + +``` +npm run clean +``` You have three options: 1. Deploy on [Futurenet](https://soroban.stellar.org/docs/getting-started/deploy-to-futurenet) using a remote [RPC](https://soroban.stellar.org/docs/getting-started/run-rpc) endpoint, 2. Run your own Futerenet RPC node with Docker and deploy to it, 3. run in [localnet/standalone](https://soroban.stellar.org/docs/getting-started/deploy-to-a-local-network) mode. ### Option 1: Deploy on Futurenet -0. Make sure you have soroban-cli installed, as explained above +0. Make sure you have soroban-cli installed, as explained above -1. Deploy the contracts and initialize them +1. Deploy the contracts and initialize them - npm run setup + npm run setup - This runs `./initialize.sh futurenet` behind the scenes, which will create a `token-admin` identity for you (`soroban config identity create token-admin`) and deploy a Fungible Token contract as well as the [crowdfund contract](./contracts/crowdfund), with this account as admin. + This runs `./initialize.sh futurenet` behind the scenes, which will create a `token-admin` identity for you (`soroban keys create token-admin`) and deploy a Fungible Token contract as well as the [crowdfund contract](./contracts/crowdfund), with this account as admin. -2. Select the Futurenet network in your Freighter browser extension +2. Select the Futurenet network in your Freighter browser extension ### Option 2: Run your own Futurenet node -1. Run the backend docker container with `./quickstart.sh futurenet`, and wait for it to start. +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. The quickstart container also prints console statements on start status, it will print `soroban rpc: waiting for ready state...` at first and then `soroban rpc: up and ready` when network sync has been reached. + **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. The quickstart container also prints console statements on start status, it will print `soroban rpc: waiting for ready state...` at first and then `soroban rpc: up and ready` when network sync has been reached. -2. Load the contracts and initialize them +2. Load the contracts and initialize them - Use your own local soroban-cli: + Use your own local soroban-cli: - ./initialize.sh futurenet http://localhost:8000 + ./initialize.sh futurenet http://localhost:8000 - Or run it inside the soroban-preview docker container: + Or run it inside the soroban-preview docker container: - docker exec soroban-preview ./initialize.sh futurenet + docker exec soroban-preview ./initialize.sh futurenet -3. Add the Futurenet custom network in Freighter (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): +3. Add the Futurenet custom network in Freighter (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 Local RPC| - | URL | http://localhost:8000/soroban/rpc | - | Passphrase | Test SDF Future Network ; October 2022 | - | Allow HTTP connection | Enabled | - | Switch to this network | Enabled | + | | | + | ---------------------- | -------------------------------------- | + | Name | Futurenet Local RPC | + | 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. +4. Add some Futurenet network lumens to your Freighter wallet. - Visit https://laboratory.stellar.org/#create-account, and follow the instructions to create your freighter account on Futurenet. + Visit https://laboratory.stellar.org/#create-account, and follow the instructions to create your freighter account on Futurenet. ### Option 3: Localnet/Standalone -0. If you didn't yet, build the `soroban-preview` docker image, as described above: - - make build-docker +0. If you didn't yet, build the `soroban-preview` docker image, as described above: -1. In one terminal, run the backend docker containers and wait for them to start: + make build-docker - ./quickstart.sh standalone +1. In one terminal, run the backend docker containers and wait for them to start: - You know that it fully started if it goes into a loop publishing & syncing checkpoints. + ./quickstart.sh standalone - You can stop this process with ctrlc + You know that it fully started if it goes into a loop publishing & syncing checkpoints. -2. Keep that running, then deploy the contracts and initialize them: + You can stop this process with ctrlc - You can use your own local soroban-cli: +2. Keep that running, then deploy the contracts and initialize them: - NETWORK=standalone npm run setup + You can use your own local soroban-cli: - Or run it inside the soroban-preview docker container: + NETWORK=standalone npm run setup - docker exec soroban-preview ./initialize.sh standalone + Or run it inside the soroban-preview docker container: - **Note:** this state will be lost if the quickstart docker container is removed, which will happen if you stop the `quickstart.sh` process. You will need to re-run `./initialize.sh` every time you restart the container. + docker exec soroban-preview ./initialize.sh standalone -3. Add the Standalone custom network in Freighter + **Note:** this state will be lost if the quickstart docker container is removed, which will happen if you stop the `quickstart.sh` process. You will need to re-run `./initialize.sh` every time you restart the container. - | | | - |---|---| - | Name | Standalone | - | URL | http://localhost:8000/soroban/rpc | - | Passphrase | Standalone Network ; February 2017 | - | Allow HTTP connection | Enabled | - | Switch to this network | Enabled | +3. Add the Standalone custom network in Freighter -4. Add some Standalone network lumens to your Freighter wallet. + | | | + | ---------------------- | ---------------------------------- | + | Name | Standalone | + | URL | http://localhost:8000/soroban/rpc | + | Passphrase | Standalone Network ; February 2017 | + | Allow HTTP connection | Enabled | + | Switch to this network | Enabled | - 1. Copy the address for your freighter wallet. - 2. Visit `http://localhost:8000/friendbot?addr=` +4. Add some Standalone network lumens to your Freighter wallet. + 1. Copy the address for your freighter wallet. + 2. Visit `http://localhost:8000/friendbot?addr=` -Frontend --------- +## Frontend Now that you're running the backend, you can run the development server: @@ -129,8 +129,7 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the token) in your freighter wallet. There is a "Mint 100 EXT" button, which will gift you 100 EXT tokens for that purpose. -User Workflows -============== +# User Workflows The contract dev should be able to: diff --git a/components/molecules/deposits/index.tsx b/components/molecules/deposits/index.tsx index a42fb63b..1245ea0f 100644 --- a/components/molecules/deposits/index.tsx +++ b/components/molecules/deposits/index.tsx @@ -2,24 +2,22 @@ import React from 'react' import styles from './style.module.css' import { Utils } from '../../../shared/utils' import { Spacer } from '../../atoms/spacer' -import { balance as getBalance } from 'crowdfund-contract' +import { crowdfund } from '../../../shared/contracts' export interface IDepositsProps { address: string decimals: number name?: string symbol?: string - idCrowdfund: string } export function Deposits(props: IDepositsProps) { const [balance, setBalance] = React.useState(BigInt(0)) React.useEffect(() => { - getBalance({ user: props.address }).then(setBalance) + crowdfund.balance({ user: props.address }).then(tx => setBalance(tx.result)) }, [props.address]) - if (Number(balance) <= 0) { return } diff --git a/components/molecules/form-pledge/index.tsx b/components/molecules/form-pledge/index.tsx index 22addf5b..ff2f1139 100644 --- a/components/molecules/form-pledge/index.tsx +++ b/components/molecules/form-pledge/index.tsx @@ -4,8 +4,8 @@ import { TransactionModal } from '../../molecules/transaction-modal' import { Utils } from '../../../shared/utils' import styles from './style.module.css' import { Spacer } from '../../atoms/spacer' -import { deposit } from 'crowdfund-contract' -import * as abundance from 'abundance-token' +import { abundance, crowdfund } from '../../../shared/contracts' +import { signTransaction } from '@stellar/freighter-api' export interface IFormPledgeProps { account: string @@ -25,18 +25,29 @@ export interface IResultSubmit { /** * Mint 100.0000000 tokens to the user's wallet for testing */ -function MintButton({ account, symbol, onComplete, decimals }: { decimals: number, account: string; symbol: string, onComplete: () => void }) { +function MintButton({ + account, + symbol, + onComplete, + decimals, +}: { + decimals: number + account: string + symbol: string + onComplete: () => void +}) { const [isSubmitting, setSubmitting] = useState(false) const displayAmount = 100 - const amount = BigInt(displayAmount * 10**decimals) + const amount = BigInt(displayAmount * 10 ** decimals) return (