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

Reconsider hardcoding Hiro RPC API in the package #1760

Closed
OxMarco opened this issue Nov 13, 2024 · 1 comment
Closed

Reconsider hardcoding Hiro RPC API in the package #1760

OxMarco opened this issue Nov 13, 2024 · 1 comment
Labels
bug Unwanted or unintended logic causing harm

Comments

@OxMarco
Copy link

OxMarco commented Nov 13, 2024

Hardcoding RPC nodes like the code snippet below should be avoided

export const HIRO_MAINNET_URL = 'https://api.mainnet.hiro.so';
export const HIRO_TESTNET_URL = 'https://api.testnet.hiro.so';

instead, provide a mandatory RPC argument for the contract calls and offer a constant that the users can provide to explicitly use Hiro API.

@OxMarco OxMarco added the bug Unwanted or unintended logic causing harm label Nov 13, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in DevTools Nov 13, 2024
@janniks
Copy link
Collaborator

janniks commented Nov 14, 2024

It's very easy to make a call target arbitrary nodes/APIs using Stacks.js. However most of the developers expect to have defaults and prefer using even more simplified arguments like 'mainnet' and 'testnet'.

While we do want to encourage everyone to host their own nodes and point calls to custom nodes, more users are annoyed by the initial frustration, so we will likely always have defaults to make the first use of Stacks.js easier. But we're always open to considering better developer experience.

e.g. to use a custom node / network

broadcastTransaction({ transaction, client: {
  baseUrl: "https://my-custom-node.com"
}})

All RPC calls accept a client argument to configure the target node/API. Or developers can add the client to their network object.

@janniks janniks closed this as completed Nov 14, 2024
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in DevTools Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unwanted or unintended logic causing harm
Projects
Status: Done
Development

No branches or pull requests

2 participants