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

Combine Horizon and Soroban JS SDKs into a single repository #850

Closed
Shaptic opened this issue Jul 18, 2023 · 0 comments · Fixed by #860
Closed

Combine Horizon and Soroban JS SDKs into a single repository #850

Shaptic opened this issue Jul 18, 2023 · 0 comments · Fixed by #860

Comments

@Shaptic
Copy link
Contributor

Shaptic commented Jul 18, 2023

As part of the march to testnet, we should unify the stellar/js-soroban-client and stellar/js-stellar-sdk repositories as follows:

  • Both will share the latest stellar-base version for Soroban (as of this writing, this is v10.0.0-soroban.4)
  • RPC code will live under the SorobanRPC namespace
  • Horizon code will live under the new Horizon namespace
  • Shared code (e.g. TransactionBuilder and friends) will be merged and live together

Previously, users would have the following scripts for separate Horizon / Soroban usage. Note that it's perfectly fine to synchronously submit a Soroban-shaped transaction to Horizon's POST /tx, you will just get a different response schema.

import StellarSdk from 'stellar-sdk';
import * as SorobanClient from 'soroban-client';

const horizon = StellarSdk.Server('https://horizon.stellar.org');
const rpc = SorobanClient.Server('https://rpc-futurenet.stellar.org');

const hzTx = StellarSdk.TransactionBuilder(...).build();
const soroTx = SorobanClient.TransactionBuilder(...).build();

horizon.submitTransaction(hzTx);
rpc.sendTransaction(soroTx);

Now, we will have

import { Horizon, SorobanRPC, TransactionBuilder } from 'stellar-sdk';

const horizon = Horizon.Server('https://horizon.stellar.org');
const rpc = SorobanRPC.Server('https://rpc-futurenet.stellar.org');

const anyTx = TransactionBuilder(...).build();

// two ways to submit, but **different responses**
horizon.submitTransaction(anyTx);
rpc.sendTransaction(anyTx);

Alternatively, they can do

import StellarSdk from 'stellar-sdk';

const horizon = StellarSdk.Horizon.Server('https://horizon.stellar.org');
const rpc = StellarSdk.SorobanRPC.Server('https://rpc-futurenet.stellar.org');

const anyTx = StellarSdk.TransactionBuilder(...).build();
// etc...

if they insist on using the default import method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment