Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ts-tests): update js-stellar-sdk; use it correctly #1502

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/bindings-ts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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:testing
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
24 changes: 12 additions & 12 deletions cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json

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

2 changes: 1 addition & 1 deletion cmd/crates/soroban-spec-typescript/ts-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"ava": "^5.3.1",
"dotenv": "^16.3.1",
"eslint": "^8.53.0",
"@stellar/stellar-sdk": "12.1.0",
"@stellar/stellar-sdk": "12.2.0",
"typescript": "^5.3.3"
},
"ava": {
Expand Down
15 changes: 11 additions & 4 deletions cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import { spawnSync } from "node:child_process";
import { Address, Keypair } from "@stellar/stellar-sdk";
import { basicNodeSigner } from "@stellar/stellar-sdk/ContractClient";
import { basicNodeSigner } from "@stellar/stellar-sdk/contract";

const rootKeypair = Keypair.fromSecret(spawnSync("./soroban", ["keys", "show", "root"], { shell: true, encoding: "utf8" }).stdout.trim());
const rootKeypair = Keypair.fromSecret(
spawnSync("./soroban", ["keys", "show", "root"], {
shell: true,
encoding: "utf8",
}).stdout.trim(),
);

export const root = {
keypair: rootKeypair,
address: Address.fromString(rootKeypair.publicKey()),
}
};

export const rpcUrl = process.env.SOROBAN_RPC_URL ?? "http://localhost:8000/";
export const networkPassphrase = process.env.SOROBAN_NETWORK_PASSPHRASE ?? "Standalone Network ; February 2017";
export const networkPassphrase =
process.env.SOROBAN_NETWORK_PASSPHRASE ??
"Standalone Network ; February 2017";
willemneal marked this conversation as resolved.
Show resolved Hide resolved

export const signer = basicNodeSigner(root.keypair, networkPassphrase);
Loading