From f70f585803b94c060b1beb6ddc17f4c5d7e3a794 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 11 Jan 2024 21:21:26 +0000 Subject: [PATCH 1/3] Bump version to 20.2.0 --- Cargo.lock | 24 +++++++++---------- Cargo.toml | 10 ++++---- cmd/crates/soroban-test/Cargo.toml | 2 +- .../tests/fixtures/hello/Cargo.toml | 2 +- .../test-wasms/custom_type/Cargo.toml | 2 +- .../test-wasms/hello_world/Cargo.toml | 2 +- cmd/soroban-cli/Cargo.toml | 2 +- cmd/soroban-rpc/lib/preflight/Cargo.toml | 2 +- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5bb334ead..75beae488 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1907,7 +1907,7 @@ dependencies = [ [[package]] name = "preflight" -version = "20.1.1" +version = "20.2.0" dependencies = [ "anyhow", "base64 0.21.5", @@ -2492,7 +2492,7 @@ dependencies = [ [[package]] name = "soroban-cli" -version = "20.1.1" +version = "20.2.0" dependencies = [ "assert_cmd", "assert_fs", @@ -2622,7 +2622,7 @@ dependencies = [ [[package]] name = "soroban-hello" -version = "20.1.1" +version = "20.2.0" [[package]] name = "soroban-ledger-snapshot" @@ -2699,7 +2699,7 @@ dependencies = [ [[package]] name = "soroban-spec-json" -version = "20.1.1" +version = "20.2.0" dependencies = [ "pretty_assertions", "serde", @@ -2743,7 +2743,7 @@ dependencies = [ [[package]] name = "soroban-spec-tools" -version = "20.1.1" +version = "20.2.0" dependencies = [ "base64 0.21.5", "ethnum", @@ -2761,7 +2761,7 @@ dependencies = [ [[package]] name = "soroban-spec-typescript" -version = "20.1.1" +version = "20.2.0" dependencies = [ "base64 0.21.5", "heck", @@ -2782,7 +2782,7 @@ dependencies = [ [[package]] name = "soroban-test" -version = "20.1.1" +version = "20.2.0" dependencies = [ "assert_cmd", "assert_fs", @@ -2990,28 +2990,28 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "test_custom_types" -version = "20.1.1" +version = "20.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_hello_world" -version = "20.1.1" +version = "20.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_swap" -version = "20.1.1" +version = "20.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_token" -version = "20.1.1" +version = "20.2.0" dependencies = [ "soroban-sdk", "soroban-token-sdk", @@ -3019,7 +3019,7 @@ dependencies = [ [[package]] name = "test_udt" -version = "20.1.1" +version = "20.2.0" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 0a74153e1..fd9212d7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ default-members = ["cmd/soroban-cli", "cmd/crates/soroban-test"] exclude = ["cmd/crates/soroban-test/tests/fixtures/hello"] [workspace.package] -version = "20.1.1" +version = "20.2.0" rust-version = "1.74.0" [workspace.dependencies.soroban-env-host] @@ -32,15 +32,15 @@ rev = "93b09e42e4efa841cbd034c0bff0dc362765086c" # path = "../rs-soroban-sdk/soroban-spec-rust" [workspace.dependencies.soroban-spec-json] -version = "20.1.1" +version = "20.2.0" path = "./cmd/crates/soroban-spec-json" [workspace.dependencies.soroban-spec-typescript] -version = "20.1.1" +version = "20.2.0" path = "./cmd/crates/soroban-spec-typescript" [workspace.dependencies.soroban-spec-tools] -version = "20.1.1" +version = "20.2.0" path = "./cmd/crates/soroban-spec-tools" [workspace.dependencies.soroban-sdk] @@ -59,7 +59,7 @@ git = "https://github.com/stellar/rs-soroban-sdk" rev = "811ce3da801c03a21d5fa80fda187c0f1012240f" [workspace.dependencies.soroban-cli] -version = "20.1.1" +version = "20.2.0" path = "cmd/soroban-cli" [workspace.dependencies.stellar-xdr] diff --git a/cmd/crates/soroban-test/Cargo.toml b/cmd/crates/soroban-test/Cargo.toml index b4cde0508..649a37e57 100644 --- a/cmd/crates/soroban-test/Cargo.toml +++ b/cmd/crates/soroban-test/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/stellar/soroban-test" authors = ["Stellar Development Foundation "] license = "Apache-2.0" readme = "README.md" -version = "20.1.1" +version = "20.2.0" edition = "2021" rust-version.workspace = true autobins = false diff --git a/cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml index 8b08d0076..01b80b0f6 100644 --- a/cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/hello/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "soroban-hello" -version = "20.1.1" +version = "20.2.0" edition = "2021" publish = false diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml index fd0cedf59..67df45b69 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test_custom_types" -version = "20.1.1" +version = "20.2.0" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml index 8f79f9767..e5ced55fa 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test_hello_world" -version = "20.1.1" +version = "20.2.0" authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index 972e832a7..ad60c827a 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/stellar/soroban-cli" authors = ["Stellar Development Foundation "] license = "Apache-2.0" readme = "README.md" -version = "20.1.1" +version = "20.2.0" edition = "2021" rust-version.workspace = true autobins = false diff --git a/cmd/soroban-rpc/lib/preflight/Cargo.toml b/cmd/soroban-rpc/lib/preflight/Cargo.toml index e78939588..c80b61abb 100644 --- a/cmd/soroban-rpc/lib/preflight/Cargo.toml +++ b/cmd/soroban-rpc/lib/preflight/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "preflight" -version = "20.1.1" +version = "20.2.0" publish = false [lib] From d7b3376a28d9e4b32c4175a610ab64b99600fd2f Mon Sep 17 00:00:00 2001 From: George Date: Thu, 11 Jan 2024 13:46:40 -0800 Subject: [PATCH 2/3] Bump Core and dependency versions to the official tags/images (#1164) --- .github/workflows/e2e.yml | 4 +- .github/workflows/soroban-rpc.yml | 2 +- Cargo.lock | 44 ++++--------------- Cargo.toml | 8 ++-- .../internal/test/docker-compose.yml | 2 +- 5 files changed, 17 insertions(+), 43 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2c1900e0a..0ca517d07 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -22,7 +22,7 @@ jobs: # core git ref should be latest commit for stable soroban functionality # the core bin can either be compiled in-line here as part of ci, - SYSTEM_TEST_CORE_GIT_REF: https://github.com/stellar/stellar-core.git#114b833e755400178a57142f45b7fb892ddb034f + SYSTEM_TEST_CORE_GIT_REF: https://github.com/stellar/stellar-core.git#v20.1.0 SYSTEM_TEST_CORE_COMPILE_CONFIGURE_FLAGS: "--disable-tests" # or set SYSTEM_TEST_CORE_GIT_REF to empty, and set SYSTEM_TEST_CORE_IMAGE # to pull a pre-compiled image from dockerhub instead @@ -44,7 +44,7 @@ jobs: SYSTEM_TEST_JS_STELLAR_SDK_GH_REF: # the version of rs-stellar-xdr to use for quickstart - SYSTEM_TEST_RS_XDR_GIT_REF: v20.0.1 + SYSTEM_TEST_RS_XDR_GIT_REF: v20.0.2 # system test will build quickstart image internally to use for running the service stack # configured in standalone network mode(core, rpc) diff --git a/.github/workflows/soroban-rpc.yml b/.github/workflows/soroban-rpc.yml index ae5eff188..459b391e6 100644 --- a/.github/workflows/soroban-rpc.yml +++ b/.github/workflows/soroban-rpc.yml @@ -112,7 +112,7 @@ jobs: env: SOROBAN_RPC_INTEGRATION_TESTS_ENABLED: true SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core - PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 20.0.3-1655.114b833e7.focal + PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 20.1.0-1656.114b833e7.focal steps: - uses: actions/checkout@v3 with: diff --git a/Cargo.lock b/Cargo.lock index 75beae488..47f19c47c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2533,9 +2533,9 @@ dependencies = [ "soroban-env-host", "soroban-ledger-snapshot", "soroban-sdk", - "soroban-spec 20.0.3", + "soroban-spec", "soroban-spec-json", - "soroban-spec-rust 20.0.3", + "soroban-spec-rust", "soroban-spec-tools", "soroban-spec-typescript", "stellar-strkey 0.0.7", @@ -2669,23 +2669,12 @@ dependencies = [ "rustc_version", "sha2 0.10.8", "soroban-env-common", - "soroban-spec 20.1.0", - "soroban-spec-rust 20.1.0", + "soroban-spec", + "soroban-spec-rust", "stellar-xdr", "syn 2.0.39", ] -[[package]] -name = "soroban-spec" -version = "20.0.3" -source = "git+https://github.com/stellar/rs-soroban-sdk?rev=93b09e42e4efa841cbd034c0bff0dc362765086c#93b09e42e4efa841cbd034c0bff0dc362765086c" -dependencies = [ - "base64 0.13.1", - "stellar-xdr", - "thiserror", - "wasmparser 0.88.0", -] - [[package]] name = "soroban-spec" version = "20.1.0" @@ -2706,26 +2695,11 @@ dependencies = [ "serde_derive", "serde_json", "sha2 0.9.9", - "soroban-spec 20.0.3", + "soroban-spec", "stellar-xdr", "thiserror", ] -[[package]] -name = "soroban-spec-rust" -version = "20.0.3" -source = "git+https://github.com/stellar/rs-soroban-sdk?rev=93b09e42e4efa841cbd034c0bff0dc362765086c#93b09e42e4efa841cbd034c0bff0dc362765086c" -dependencies = [ - "prettyplease", - "proc-macro2", - "quote", - "sha2 0.10.8", - "soroban-spec 20.0.3", - "stellar-xdr", - "syn 2.0.39", - "thiserror", -] - [[package]] name = "soroban-spec-rust" version = "20.1.0" @@ -2735,7 +2709,7 @@ dependencies = [ "proc-macro2", "quote", "sha2 0.10.8", - "soroban-spec 20.1.0", + "soroban-spec", "stellar-xdr", "syn 2.0.39", "thiserror", @@ -2750,7 +2724,7 @@ dependencies = [ "hex", "itertools 0.10.5", "serde_json", - "soroban-spec 20.0.3", + "soroban-spec", "stellar-strkey 0.0.7", "stellar-xdr", "thiserror", @@ -2773,7 +2747,7 @@ dependencies = [ "serde_derive", "serde_json", "sha2 0.9.9", - "soroban-spec 20.0.3", + "soroban-spec", "stellar-xdr", "temp-dir", "thiserror", @@ -2795,7 +2769,7 @@ dependencies = [ "soroban-env-host", "soroban-ledger-snapshot", "soroban-sdk", - "soroban-spec 20.0.3", + "soroban-spec", "soroban-spec-tools", "stellar-strkey 0.0.7", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index fd9212d7c..e8b58311e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,15 +20,15 @@ git = "https://github.com/stellar/rs-soroban-env" rev = "c1b238b65bfd13666be4ac14e0e390c31b549caf" [workspace.dependencies.soroban-spec] -version = "=20.0.3" +version = "=20.1.0" git = "https://github.com/stellar/rs-soroban-sdk" -rev = "93b09e42e4efa841cbd034c0bff0dc362765086c" +rev = "811ce3da801c03a21d5fa80fda187c0f1012240f" # path = "../rs-soroban-sdk/soroban-spec" [workspace.dependencies.soroban-spec-rust] -version = "=20.0.3" +version = "=20.1.0" git = "https://github.com/stellar/rs-soroban-sdk" -rev = "93b09e42e4efa841cbd034c0bff0dc362765086c" +rev = "811ce3da801c03a21d5fa80fda187c0f1012240f" # path = "../rs-soroban-sdk/soroban-spec-rust" [workspace.dependencies.soroban-spec-json] diff --git a/cmd/soroban-rpc/internal/test/docker-compose.yml b/cmd/soroban-rpc/internal/test/docker-compose.yml index 2d6236afc..b7309cdca 100644 --- a/cmd/soroban-rpc/internal/test/docker-compose.yml +++ b/cmd/soroban-rpc/internal/test/docker-compose.yml @@ -15,7 +15,7 @@ services: # Note: Please keep the image pinned to an immutable tag matching the Captive Core version. # This avoids implicit updates which break compatibility between # the Core container and captive core. - image: ${CORE_IMAGE:-stellar/unsafe-stellar-core:20.0.3-1655.114b833e7.focal} + image: ${CORE_IMAGE:-stellar/unsafe-stellar-core:20.1.0-1656.114b833e7.focal} depends_on: - core-postgres restart: on-failure From 827623867e84a28c1d7bf55775280947cd41cd03 Mon Sep 17 00:00:00 2001 From: Chad Ostrowski <221614+chadoh@users.noreply.github.com> Date: Thu, 11 Jan 2024 19:28:00 -0500 Subject: [PATCH 3/3] Update the Stellar SDK for the latest TypeScript bindings (#1037) * Add tests from https://github.com/AhaLabs/soroban-tools/pull/11 which didn't make it into https://github.com/stellar/soroban-tools/pull/973 due to the quickstart image not starting properly in CI. * Update for latest changes from `soroban config identity` to `soroban keys` --- .github/workflows/bindings-ts.yml | 43 ++++++++++++ .../dist/cjs/assembled-tx.d.ts | 4 +- .../dist/cjs/assembled-tx.js | 2 +- .../test_custom_types/dist/cjs/index.d.ts | 2 +- .../test_custom_types/dist/cjs/index.js | 2 +- .../dist/esm/assembled-tx.d.ts | 4 +- .../dist/esm/assembled-tx.js | 2 +- .../test_custom_types/dist/esm/index.d.ts | 2 +- .../test_custom_types/dist/esm/index.js | 2 +- .../dist/types/assembled-tx.d.ts | 4 +- .../test_custom_types/dist/types/index.d.ts | 2 +- .../test_custom_types/package-lock.json | 66 +++++++++---------- .../fixtures/test_custom_types/package.json | 4 +- .../test_custom_types/src/assembled-tx.ts | 4 +- .../fixtures/test_custom_types/src/index.ts | 2 +- .../src/project_template/package.json | 4 +- .../src/project_template/src/assembled-tx.ts | 4 +- .../src/project_template/src/index.ts | 2 +- .../soroban-spec-typescript/ts-tests/.nvmrc | 1 - .../ts-tests/initialize.sh | 25 ++++--- .../ts-tests/package-lock.json | 48 +++++++------- .../ts-tests/package.json | 4 +- .../ts-tests/src/test-custom-types.ts | 34 +++++----- .../ts-tests/src/test-hello-world.ts | 2 +- .../ts-tests/src/test-swap.ts | 2 +- .../ts-tests/src/util.ts | 8 +-- 26 files changed, 165 insertions(+), 114 deletions(-) create mode 100644 .github/workflows/bindings-ts.yml delete mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/.nvmrc diff --git a/.github/workflows/bindings-ts.yml b/.github/workflows/bindings-ts.yml new file mode 100644 index 000000000..62469fd7d --- /dev/null +++ b/.github/workflows/bindings-ts.yml @@ -0,0 +1,43 @@ + +name: bindings typescript + +on: + push: + branches: [main, release/**] + pull_request: + +jobs: + test: + name: test generated libraries + runs-on: ubuntu-22.04 + services: + rpc: + image: stellar/quickstart:soroban-dev@sha256:0ad51035cf7caba2fd99c7c1fad0945df6932be7d5c893e1520ccdef7d6a6ffe + ports: + - 8000:8000 + env: + ENABLE_LOGS: true + NETWORK: local + ENABLE_SOROBAN_RPC: true + options: >- + --health-cmd "curl --no-progress-meter --fail-with-body -X POST \"http://localhost:8000/soroban/rpc\" -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"id\":8675309,\"method\":\"getNetwork\"}' && curl --no-progress-meter \"http://localhost:8000/friendbot\" | grep '\"invalid_field\": \"addr\"'" + --health-interval 10s + --health-timeout 5s + --health-retries 50 + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - run: rustup update + - run: cargo build + - run: rustup target add wasm32-unknown-unknown + - run: make build-test-wasms + - run: npm ci && npm run test + working-directory: cmd/crates/soroban-spec-typescript/ts-tests diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/assembled-tx.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/assembled-tx.d.ts index 8297cbf3c..1d5e6f5ee 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/assembled-tx.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/assembled-tx.d.ts @@ -1,5 +1,5 @@ -import { Account, Address, Operation, SorobanRpc, xdr } from "stellar-sdk"; -import type { Memo, MemoType, Transaction } from "stellar-sdk"; +import { Account, Address, Operation, SorobanRpc, xdr } from "@stellar/stellar-sdk"; +import type { Memo, MemoType, Transaction } from "@stellar/stellar-sdk"; import type { ClassOptions, MethodOptions, Wallet, XDR_BASE64 } from "./method-options.js"; export type Tx = Transaction, Operation[]>; export declare class ExpiredStateError extends Error { diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/assembled-tx.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/assembled-tx.js index 5d2128f47..c60a6e5f8 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/assembled-tx.js +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/assembled-tx.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AssembledTransaction = exports.NULL_ACCOUNT = exports.contractErrorPattern = exports.Err = exports.Ok = exports.Address = exports.NoUnsignedNonInvokerAuthEntriesError = exports.SendFailedError = exports.SendResultOnlyError = exports.WalletDisconnectedError = exports.NeedsMoreSignaturesError = exports.ExpiredStateError = void 0; -const stellar_sdk_1 = require("stellar-sdk"); +const stellar_sdk_1 = require("@stellar/stellar-sdk"); Object.defineProperty(exports, "Address", { enumerable: true, get: function () { return stellar_sdk_1.Address; } }); const buffer_1 = require("buffer"); class ExpiredStateError extends Error { diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.d.ts index d32b06f97..66d3d5959 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.d.ts @@ -1,4 +1,4 @@ -import { ContractSpec } from 'stellar-sdk'; +import { ContractSpec } from '@stellar/stellar-sdk'; import { Buffer } from "buffer"; import { AssembledTransaction, Ok, Err } from './assembled-tx.js'; import type { u32, i32, i64, i128, Option, Error_ } from './assembled-tx.js'; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.js index 735f2fa29..d6e27aa85 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.js +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.js @@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Contract = exports.Errors = exports.RoyalCard = exports.networks = void 0; -const stellar_sdk_1 = require("stellar-sdk"); +const stellar_sdk_1 = require("@stellar/stellar-sdk"); const buffer_1 = require("buffer"); const assembled_tx_js_1 = require("./assembled-tx.js"); __exportStar(require("./assembled-tx.js"), exports); diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/assembled-tx.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/assembled-tx.d.ts index 8297cbf3c..1d5e6f5ee 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/assembled-tx.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/assembled-tx.d.ts @@ -1,5 +1,5 @@ -import { Account, Address, Operation, SorobanRpc, xdr } from "stellar-sdk"; -import type { Memo, MemoType, Transaction } from "stellar-sdk"; +import { Account, Address, Operation, SorobanRpc, xdr } from "@stellar/stellar-sdk"; +import type { Memo, MemoType, Transaction } from "@stellar/stellar-sdk"; import type { ClassOptions, MethodOptions, Wallet, XDR_BASE64 } from "./method-options.js"; export type Tx = Transaction, Operation[]>; export declare class ExpiredStateError extends Error { diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/assembled-tx.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/assembled-tx.js index 24168acf4..79b7c01d9 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/assembled-tx.js +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/assembled-tx.js @@ -1,4 +1,4 @@ -import { Account, Address, Contract, Operation, SorobanRpc, StrKey, TimeoutInfinite, TransactionBuilder, authorizeEntry, hash, xdr, BASE_FEE, } from "stellar-sdk"; +import { Account, Address, Contract, Operation, SorobanRpc, StrKey, TimeoutInfinite, TransactionBuilder, authorizeEntry, hash, xdr, BASE_FEE, } from "@stellar/stellar-sdk"; import { Buffer } from "buffer"; export class ExpiredStateError extends Error { } diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.d.ts index d32b06f97..66d3d5959 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.d.ts @@ -1,4 +1,4 @@ -import { ContractSpec } from 'stellar-sdk'; +import { ContractSpec } from '@stellar/stellar-sdk'; import { Buffer } from "buffer"; import { AssembledTransaction, Ok, Err } from './assembled-tx.js'; import type { u32, i32, i64, i128, Option, Error_ } from './assembled-tx.js'; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.js index bfd8b1823..b97cff55c 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.js +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.js @@ -1,4 +1,4 @@ -import { ContractSpec, Address } from 'stellar-sdk'; +import { ContractSpec, Address } from '@stellar/stellar-sdk'; import { Buffer } from "buffer"; import { AssembledTransaction, Ok, Err } from './assembled-tx.js'; export * from './assembled-tx.js'; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/assembled-tx.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/assembled-tx.d.ts index 8297cbf3c..1d5e6f5ee 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/assembled-tx.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/assembled-tx.d.ts @@ -1,5 +1,5 @@ -import { Account, Address, Operation, SorobanRpc, xdr } from "stellar-sdk"; -import type { Memo, MemoType, Transaction } from "stellar-sdk"; +import { Account, Address, Operation, SorobanRpc, xdr } from "@stellar/stellar-sdk"; +import type { Memo, MemoType, Transaction } from "@stellar/stellar-sdk"; import type { ClassOptions, MethodOptions, Wallet, XDR_BASE64 } from "./method-options.js"; export type Tx = Transaction, Operation[]>; export declare class ExpiredStateError extends Error { diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/index.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/index.d.ts index d32b06f97..66d3d5959 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/index.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/index.d.ts @@ -1,4 +1,4 @@ -import { ContractSpec } from 'stellar-sdk'; +import { ContractSpec } from '@stellar/stellar-sdk'; import { Buffer } from "buffer"; import { AssembledTransaction, Ok, Err } from './assembled-tx.js'; import type { u32, i32, i64, i128, Option, Error_ } from './assembled-tx.js'; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json index bd71e5951..44332a410 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json @@ -9,11 +9,11 @@ "version": "0.0.0", "dependencies": { "@stellar/freighter-api": "1.7.1", - "buffer": "6.0.3", - "stellar-sdk": "11.1.0" + "@stellar/stellar-sdk": "11.2.0", + "buffer": "6.0.3" }, "devDependencies": { - "typescript": "5.1.6" + "typescript": "5.3.3" } }, "node_modules/@stellar/freighter-api": { @@ -42,17 +42,31 @@ "sodium-native": "^4.0.1" } }, + "node_modules/@stellar/stellar-sdk": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@stellar/stellar-sdk/-/stellar-sdk-11.2.0.tgz", + "integrity": "sha512-qInRR+mLLl9O/AI6Q+Sr19RZeYJtlNoJQJi3pch5BYoMvVhjO8IU8AhHADP//Zmc2osyogwPuqXBiFdaGlfHWA==", + "dependencies": { + "@stellar/stellar-base": "10.0.1", + "axios": "^1.6.5", + "bignumber.js": "^9.1.2", + "eventsource": "^2.0.2", + "randombytes": "^2.1.0", + "toml": "^3.0.0", + "urijs": "^1.19.1" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", + "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.4", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -143,9 +157,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "funding": [ { "type": "individual", @@ -218,9 +232,9 @@ } }, "node_modules/node-gyp-build": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.7.1.tgz", - "integrity": "sha512-wTSrZ+8lsRRa3I3H8Xr65dLWSgCvY2l4AOnaeKdPA9TB/WYMPaTcrzf3rXvFoVvjKNVnu0CcWSx54qq9GKRUYg==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.0.tgz", + "integrity": "sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==", "optional": true, "bin": { "node-gyp-build": "bin.js", @@ -273,29 +287,15 @@ } }, "node_modules/sodium-native": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.0.4.tgz", - "integrity": "sha512-faqOKw4WQKK7r/ybn6Lqo1F9+L5T6NlBJJYvpxbZPetpWylUVqz449mvlwIBKBqxEHbWakWuOlUt8J3Qpc4sWw==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.0.5.tgz", + "integrity": "sha512-YGimGhy7Ho6pTAAvuNdn3Tv9C2MD7HP89X1omReHat0Fd1mMnapGqwzb5YoHTAbIEh8tQmKP6+uLlwYCkf+EOA==", "hasInstallScript": true, "optional": true, "dependencies": { "node-gyp-build": "^4.6.0" } }, - "node_modules/stellar-sdk": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/stellar-sdk/-/stellar-sdk-11.1.0.tgz", - "integrity": "sha512-fIdo77ogpU+ecHgs59pk9velpXd4F/ch0DzOI4QZw8zVZApc3oeNWP3+X6ui7BWpeRHAGsP2CHQzBLxm0JTIgg==", - "dependencies": { - "@stellar/stellar-base": "10.0.1", - "axios": "^1.6.0", - "bignumber.js": "^9.1.2", - "eventsource": "^2.0.2", - "randombytes": "^2.1.0", - "toml": "^3.0.0", - "urijs": "^1.19.1" - } - }, "node_modules/toml": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", @@ -307,9 +307,9 @@ "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json index 557c8b364..1f63968ae 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json @@ -4,7 +4,7 @@ "dependencies": { "@stellar/freighter-api": "1.7.1", "buffer": "6.0.3", - "stellar-sdk": "11.1.0" + "@stellar/stellar-sdk": "11.2.0" }, "scripts": { "build": "node ./scripts/build.mjs" @@ -15,6 +15,6 @@ }, "typings": "dist/types/index.d.ts", "devDependencies": { - "typescript": "5.1.6" + "typescript": "5.3.3" } } diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/assembled-tx.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/assembled-tx.ts index 58476807f..f4f892d4d 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/assembled-tx.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/assembled-tx.ts @@ -12,8 +12,8 @@ import { nativeToScVal, xdr, BASE_FEE, -} from "stellar-sdk"; -import type { Memo, MemoType, Transaction } from "stellar-sdk"; +} from "@stellar/stellar-sdk"; +import type { Memo, MemoType, Transaction } from "@stellar/stellar-sdk"; import { Buffer } from "buffer"; import type { ClassOptions, diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/index.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/index.ts index 5dee944fa..e31192254 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/index.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/index.ts @@ -1,4 +1,4 @@ -import { ContractSpec, Address } from 'stellar-sdk'; +import { ContractSpec, Address } from '@stellar/stellar-sdk'; import { Buffer } from "buffer"; import { AssembledTransaction, Ok, Err } from './assembled-tx.js'; import type { diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/package.json b/cmd/crates/soroban-spec-typescript/src/project_template/package.json index 3c6b89642..e32d0f5e5 100644 --- a/cmd/crates/soroban-spec-typescript/src/project_template/package.json +++ b/cmd/crates/soroban-spec-typescript/src/project_template/package.json @@ -4,7 +4,7 @@ "dependencies": { "@stellar/freighter-api": "1.7.1", "buffer": "6.0.3", - "stellar-sdk": "11.1.0" + "@stellar/stellar-sdk": "11.2.0" }, "scripts": { "build": "node ./scripts/build.mjs" @@ -15,6 +15,6 @@ }, "typings": "dist/types/index.d.ts", "devDependencies": { - "typescript": "5.1.6" + "typescript": "5.3.3" } } diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/src/assembled-tx.ts b/cmd/crates/soroban-spec-typescript/src/project_template/src/assembled-tx.ts index 58476807f..f4f892d4d 100644 --- a/cmd/crates/soroban-spec-typescript/src/project_template/src/assembled-tx.ts +++ b/cmd/crates/soroban-spec-typescript/src/project_template/src/assembled-tx.ts @@ -12,8 +12,8 @@ import { nativeToScVal, xdr, BASE_FEE, -} from "stellar-sdk"; -import type { Memo, MemoType, Transaction } from "stellar-sdk"; +} from "@stellar/stellar-sdk"; +import type { Memo, MemoType, Transaction } from "@stellar/stellar-sdk"; import { Buffer } from "buffer"; import type { ClassOptions, diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/src/index.ts b/cmd/crates/soroban-spec-typescript/src/project_template/src/index.ts index 271f25e63..f7ad0b66c 100644 --- a/cmd/crates/soroban-spec-typescript/src/project_template/src/index.ts +++ b/cmd/crates/soroban-spec-typescript/src/project_template/src/index.ts @@ -1,4 +1,4 @@ -import { ContractSpec, Address } from 'stellar-sdk'; +import { ContractSpec, Address } from '@stellar/stellar-sdk'; import { Buffer } from "buffer"; import { AssembledTransaction, Ok, Err } from './assembled-tx.js'; import type { diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/.nvmrc b/cmd/crates/soroban-spec-typescript/ts-tests/.nvmrc deleted file mode 100644 index 03db17dcc..000000000 --- a/cmd/crates/soroban-spec-typescript/ts-tests/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v20.6.0 diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/initialize.sh b/cmd/crates/soroban-spec-typescript/ts-tests/initialize.sh index 9a2a83b63..621be2bc3 100755 --- a/cmd/crates/soroban-spec-typescript/ts-tests/initialize.sh +++ b/cmd/crates/soroban-spec-typescript/ts-tests/initialize.sh @@ -16,22 +16,28 @@ echo " Passphrase: \"$SOROBAN_NETWORK_PASSPHRASE\"" NETWORK_STATUS=$(curl -s -X POST "http://localhost:8000/soroban/rpc" -H "Content-Type: application/json" -d '{ "jsonrpc": "2.0", "id": 8675309, "method": "getHealth" }' | sed 's/.*"status":"\(.*\)".*/\1/') || { echo "Make sure you're running local RPC network on localhost:8000" && exit 1; } echo " Status: $NETWORK_STATUS" +if [[ "$NETWORK_STATUS" != "healthy" ]]; then + echo "Network is not healthy (not running?), exiting" + exit 1 +fi + # 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" - exe eval "./soroban config identity generate bob" - exe eval "./soroban config identity fund bob" + exe eval "./soroban keys generate root" + exe eval "./soroban keys fund root" + exe eval "./soroban keys generate alice" + exe eval "./soroban keys fund alice" + exe eval "./soroban keys generate bob" + exe eval "./soroban keys fund bob" } function upload() { - exe eval "(./soroban contract $1 --wasm $2 --ignore-checks) > $3" + exe eval "(./soroban contract $1 --source root --wasm $2 --ignore-checks) > $3" } function deploy() { - exe eval "(./soroban contract deploy --wasm-hash $(cat $1) --ignore-checks) > $2" + exe eval "(./soroban contract deploy --source root --wasm-hash $(cat $1) --ignore-checks) > $2" } function deploy_all() { upload deploy ../../../../target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm contract-id-custom-types.txt @@ -42,7 +48,7 @@ function deploy_all() { 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'" + exe eval "./soroban contract invoke --source root --id $(cat $1) -- initialize --admin $(./soroban keys address root) --decimal 0 --name 'Token $2' --symbol '$2'" } function initialize_all() { initialize contract-id-token-a.txt A @@ -59,14 +65,13 @@ function bind_all() { } function mint() { - exe eval "./soroban contract invoke --id $(cat $1) -- mint --amount 2000000 --to $(./soroban config identity address $2)" + exe eval "./soroban contract invoke --source root --id $(cat $1) -- mint --amount 2000000 --to $(./soroban keys address $2)" } function mint_all() { mint contract-id-token-a.txt alice mint contract-id-token-b.txt bob } -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 diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json b/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json index 1ed2de71f..36f5cdd63 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json +++ b/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json @@ -7,14 +7,14 @@ "hasInstallScript": true, "devDependencies": { "@ava/typescript": "^4.1.0", + "@stellar/stellar-sdk": "11.2.0", "@types/node": "^20.4.9", "@typescript-eslint/eslint-plugin": "^6.10.0", "@typescript-eslint/parser": "^6.10.0", "ava": "^5.3.1", "dotenv": "^16.3.1", "eslint": "^8.53.0", - "stellar-sdk": "11.1.0", - "typescript": "^5.1.6" + "typescript": "^5.3.3" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -186,6 +186,21 @@ "sodium-native": "^4.0.1" } }, + "node_modules/@stellar/stellar-sdk": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@stellar/stellar-sdk/-/stellar-sdk-11.2.0.tgz", + "integrity": "sha512-qInRR+mLLl9O/AI6Q+Sr19RZeYJtlNoJQJi3pch5BYoMvVhjO8IU8AhHADP//Zmc2osyogwPuqXBiFdaGlfHWA==", + "dev": true, + "dependencies": { + "@stellar/stellar-base": "10.0.1", + "axios": "^1.6.5", + "bignumber.js": "^9.1.2", + "eventsource": "^2.0.2", + "randombytes": "^2.1.0", + "toml": "^3.0.0", + "urijs": "^1.19.1" + } + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -649,12 +664,12 @@ } }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", + "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", "dev": true, "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.4", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -1586,9 +1601,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "dev": true, "funding": [ { @@ -2922,21 +2937,6 @@ "node": ">=8" } }, - "node_modules/stellar-sdk": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/stellar-sdk/-/stellar-sdk-11.1.0.tgz", - "integrity": "sha512-fIdo77ogpU+ecHgs59pk9velpXd4F/ch0DzOI4QZw8zVZApc3oeNWP3+X6ui7BWpeRHAGsP2CHQzBLxm0JTIgg==", - "dev": true, - "dependencies": { - "@stellar/stellar-base": "10.0.1", - "axios": "^1.6.0", - "bignumber.js": "^9.1.2", - "eventsource": "^2.0.2", - "randombytes": "^2.1.0", - "toml": "^3.0.0", - "urijs": "^1.19.1" - } - }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/package.json b/cmd/crates/soroban-spec-typescript/ts-tests/package.json index 37633c7d4..c06446de3 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/package.json +++ b/cmd/crates/soroban-spec-typescript/ts-tests/package.json @@ -14,8 +14,8 @@ "ava": "^5.3.1", "dotenv": "^16.3.1", "eslint": "^8.53.0", - "stellar-sdk": "11.1.0", - "typescript": "^5.1.6" + "@stellar/stellar-sdk": "11.2.0", + "typescript": "^5.3.3" }, "ava": { "typescript": { diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/src/test-custom-types.ts b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-custom-types.ts index 75f261d94..3b07dc3d4 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/src/test-custom-types.ts +++ b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-custom-types.ts @@ -2,7 +2,6 @@ import test from 'ava' import { root, rpcUrl, wallet } from './util.js' import { Contract, Ok, Err, networks } from 'test-custom-types' -const addr = root.address; const publicKey = root.keypair.publicKey(); const contract = new Contract({ ...networks.standalone, rpcUrl, wallet }); @@ -50,18 +49,21 @@ test("strukt", async (t) => { }) test('simple first', async t => { - const simple = { tag: 'First', values: undefined } as const - t.deepEqual((await contract.simple({ simple })).result, simple) + const arg = { tag: 'First', values: undefined } as const + const ret = { tag: 'First' } + t.deepEqual((await contract.simple({ simple: arg })).result, ret) }) test('simple second', async t => { - const simple = { tag: 'Second', values: undefined } as const - t.deepEqual((await contract.simple({ simple })).result, simple) + const arg = { tag: 'Second', values: undefined } as const + const ret = { tag: 'Second' } + t.deepEqual((await contract.simple({ simple: arg })).result, ret) }) test('simple third', async t => { - const simple = { tag: 'Third', values: undefined } as const - t.deepEqual((await contract.simple({ simple })).result, simple) + const arg = { tag: 'Third', values: undefined } as const + const ret = { tag: 'Third' } + t.deepEqual((await contract.simple({ simple: arg })).result, ret) }) test('complex with struct', async t => { @@ -72,29 +74,30 @@ test('complex with struct', async t => { test('complex with tuple', async t => { const arg = { tag: 'Tuple', values: [[{ a: 0, b: true, c: 'hello' }, { tag: 'First', values: undefined }]] } as const - const ret = { tag: 'Tuple', values: [[{ a: 0, b: true, c: 'hello' }, { tag: 'First', values: undefined }]] } + const ret = { tag: 'Tuple', values: [[{ a: 0, b: true, c: 'hello' }, { tag: 'First' }]] } t.deepEqual((await contract.complex({ complex: arg })).result, ret) }) test('complex with enum', async t => { const arg = { tag: 'Enum', values: [{ tag: 'First', values: undefined }] } as const - const ret = { tag: 'Enum', values: [{ tag: 'First', values: undefined }] } + const ret = { tag: 'Enum', values: [{ tag: 'First' }] } t.deepEqual((await contract.complex({ complex: arg })).result, ret) }) test('complex with asset', async t => { const arg = { tag: 'Asset', values: [publicKey, 1n] } as const - const ret = { tag: 'Asset', values: [addr, 1n] } + const ret = { tag: 'Asset', values: [publicKey, 1n] } t.deepEqual((await contract.complex({ complex: arg })).result, ret) }) test('complex with void', async t => { - const complex = { tag: 'Void', values: undefined } as const - t.deepEqual((await contract.complex({ complex })).result, complex) + const arg = { tag: 'Void', values: undefined } as const + const ret = { tag: 'Void' } + t.deepEqual((await contract.complex({ complex: arg })).result, ret) }) test('addresse', async t => { - t.deepEqual((await contract.addresse({ addresse: publicKey })).result, addr) + t.deepEqual((await contract.addresse({ addresse: publicKey })).result, publicKey) }) test('bytes', async t => { @@ -138,7 +141,8 @@ test('map', async t => { map.set(1, true) map.set(2, false) // map.set(3, 'hahaha') // should throw an error - t.deepEqual((await contract.map({ map })).result, map) + const ret = Array.from(map.entries()) + t.deepEqual((await contract.map({ map })).result, ret) }) test('vec', async t => { @@ -178,6 +182,6 @@ test('string', async t => { test('tuple_strukt', async t => { const arg = [{ a: 0, b: true, c: 'hello' }, { tag: 'First', values: undefined }] as const - const res = [{ a: 0, b: true, c: 'hello' }, { tag: 'First', values: undefined }] + const res = [{ a: 0, b: true, c: 'hello' }, { tag: 'First' }] t.deepEqual((await contract.tupleStrukt({ tuple_strukt: arg })).result, res) }) diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/src/test-hello-world.ts b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-hello-world.ts index 5ccdde788..e658c4552 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/src/test-hello-world.ts +++ b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-hello-world.ts @@ -14,7 +14,7 @@ test("auth", async (t) => { addr: root.keypair.publicKey(), world: 'lol' })).result, - root.address + root.keypair.publicKey() ) }); diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/src/test-swap.ts b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-swap.ts index 41871839c..a473cb4d8 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/src/test-swap.ts +++ b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-swap.ts @@ -1,5 +1,5 @@ import test from "ava" -import { SorobanRpc, xdr } from 'stellar-sdk' +import { SorobanRpc, xdr } from '@stellar/stellar-sdk' import { wallet, rpcUrl, alice, bob, networkPassphrase, root, Wallet } from "./util.js" import { Contract as Token } from "token" import { Contract as Swap, networks, NeedsMoreSignaturesError } from "test-swap" diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts b/cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts index 69c15350e..d5539fd12 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts +++ b/cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts @@ -1,10 +1,10 @@ import { spawnSync } from "node:child_process"; -import { Keypair, TransactionBuilder, hash } from "stellar-sdk"; +import { Keypair, TransactionBuilder, hash } from "@stellar/stellar-sdk"; import { Address } from 'test-custom-types' -const rootKeypair = Keypair.fromSecret(spawnSync("./soroban", ["config", "identity", "show"], { shell: true, encoding: "utf8" }).stdout.trim()); -const aliceKeypair = Keypair.fromSecret(spawnSync("./soroban", ["config", "identity", "show", "alice"], { shell: true, encoding: "utf8" }).stdout.trim()); -const bobKeypair = Keypair.fromSecret(spawnSync("./soroban", ["config", "identity", "show", "bob"], { shell: true, encoding: "utf8" }).stdout.trim()); +const rootKeypair = Keypair.fromSecret(spawnSync("./soroban", ["keys", "show", "root"], { shell: true, encoding: "utf8" }).stdout.trim()); +const aliceKeypair = Keypair.fromSecret(spawnSync("./soroban", ["keys", "show", "alice"], { shell: true, encoding: "utf8" }).stdout.trim()); +const bobKeypair = Keypair.fromSecret(spawnSync("./soroban", ["keys", "show", "bob"], { shell: true, encoding: "utf8" }).stdout.trim()); export const root = { keypair: rootKeypair,