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

StellarSdk.Server is not a constructor #1147

Closed
ChefGrizzlyBear opened this issue Feb 20, 2025 · 1 comment
Closed

StellarSdk.Server is not a constructor #1147

ChefGrizzlyBear opened this issue Feb 20, 2025 · 1 comment
Labels

Comments

@ChefGrizzlyBear
Copy link

ChefGrizzlyBear commented Feb 20, 2025

Describe the bug
StellarSdk.Server is not a constructor when trying to instantiate new object

What version are you on?
stellar-sdk-13.1.0

To Reproduce
Steps to reproduce the behavior:

Install node/npm
Copy below code to js file
Execute below code

const StellarSdk = require('stellar-sdk');

async function test() {
    const server = new StellarSdk.Server("http://test"); // Use the destructured Server
}

test();

Expected behavior
object is instantiated

@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Feb 20, 2025
@Shaptic
Copy link
Contributor

Shaptic commented Feb 20, 2025

There are two Servers now: one in the rpc namespace and the other in the Horizon namespace (which is probably the one you're looking for). This happened two major versions ago (see the v11.0.0 release notes).

You want:

import { Horizon } from "@stellar/stellar-sdk";

const server = new Horizon.Server("...");

@Shaptic Shaptic closed this as completed Feb 20, 2025
@github-project-automation github-project-automation bot moved this from Backlog (Not Ready) to Done in DevX Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

2 participants