Questions tagged [javascript-sdk]

For questions specifically regarding the JavaScript Software Development Kit (SDK) for Stellar client applications.

Filter by
Sorted by
Tagged with
10 votes
3 answers
287 views

How do I keep track of payments to an address with JS SDK?

Let's say I have a service that requires that a user send some XLM to another account in order to activate their account, what's the best way to actually verify when it's been paid? I can think of a ...
Paul's user avatar
  • 1,184
9 votes
3 answers
342 views

How to close a stream event?

I just opened a stream to listen for transactions. I'd like to know, how to close it, once I get what I am looking for. I can't find the close method in channel, or any of the objects for setting the ...
Kuyawa's user avatar
  • 1,328
8 votes
1 answer
220 views

Is there a way to unset home domain and inflation destination options?

Using the Javascript SDK I'm trying different ways of unsetting the home domain and inflation destination options without success. Is this something that is supported at all on the network, is it just ...
Dupe's user avatar
  • 335
8 votes
1 answer
267 views

Getting the 'offerId' on a new Offer and any documentation on 'xdr.ManageOfferOp'?

I'm using the JS-SDK to make offers. An issue I am having though is getting the offerId from a new offer. The offerId is required to manage a pre-existing offer. As such, it seems that the offerId ...
Luk3's user avatar
  • 81
7 votes
1 answer
464 views

Why is the memo hash different from the one I specify during tx building?

I'm converting IPFS multi hash to hex, and after throwing away its prefix I want to attach that hash to a stellar transaction (something like here). I build it this way: let transaction = new ...
Maxim Gaina's user avatar
6 votes
2 answers
609 views

How to serialize, send over network, deserialize a transaction envelope for multiple signatures?

I'm trying to send over the network a base64 encoded string representing a partly signed envelope. I need to parse the string back to the original javascript object in order to add a new signature to ...
phra's user avatar
  • 161
5 votes
3 answers
1k views

How to get friendbot to fund my new account using a HTTP request?

On the Stellar development guides it states that using the following code, you can achieve the following: To create a test account, send Friendbot the public key you created. It’ll create and fund ...
cloe's user avatar
  • 51
5 votes
4 answers
704 views

How to control fees in stellar?

Hello is there any class or function where I can control the fees of stellar? How much fee and where it goes ... etc
Ys3's user avatar
  • 171
5 votes
1 answer
2k views

Convert XDR to text

I want to convert the XDR fromat of the transaction to text using JS or java SDK in stellar.Or if there are any methods outside stellar also fine.
Sharmilan's user avatar
  • 421
5 votes
1 answer
90 views

Send Lumens and receive custom tokens in a single transaction?

How do I implement the issuance of a loan with a pledge? I want to send a loan from a multi-signature account and receive a pledge in the form of custom tokens in a single transaction. At the moment ...
Tim Golovchak's user avatar
5 votes
1 answer
56 views

Stellar address prefix bitwise operator rationale

Stellar prefixes public keys with G. Why do they use a bitwise operation VersionByteAccountID VersionByte = 6 << 3 to get the base 10 value 48? Javascript "returns the default numerical values", ...
aroooo's user avatar
  • 267
5 votes
1 answer
260 views

How to add a signature using Ledger Nano

I'm trying to add a signature using a Ledger Nano HW wallet but I could not find a question about it. I'm going to research the topic and post a working solution for that.
phra's user avatar
  • 161
5 votes
1 answer
158 views

Error: no PRNG in Safari web workers

Hey guys I'm working on a vanity address generator using the Stellar JS SDK inside web workers to relief the main thread from heavy computations. However, it is giving me an error 'no PRNG' regarding ...
Kuyawa's user avatar
  • 1,328
5 votes
1 answer
181 views

Is there a way to watch for balance?

How can I programmatically watch for change in balance for a account or just new incoming transactions? looking for js-stellar-sdk method
niksmac's user avatar
  • 243
4 votes
1 answer
385 views

How can I convert the built 'transaction' in XDR format?

Before I submit the transaction to the network I want to convert the 'transaction' in XDR format so that I can save it to database for future reference. I am using Stellar JS library. How to do it?
Prashant Abhishek's user avatar
4 votes
1 answer
278 views

Is it possible to make a request to an account other than "Friendbot" to receive Lumens?

From the documentation you can make a request using Javascript to the "Friendbot" to receive test Lumens for an account: // The SDK does not have tools for creating test accounts, so you'll have to //...
John Murphy's user avatar
4 votes
1 answer
126 views

(Dup for different SDK) How can I build a transaction with a dynamic list of mutators or operations using the JS SDK?

This is exactly what I am after but in JS. How can I build a transaction with a dynamic list of mutators or operations using the Go SDK? Something like this would be great, and then it'd be easy to ...
Tyler Citrin's user avatar
4 votes
1 answer
110 views

How to find cursor of a specific timestamp?

I need to find what's the cursor of a specific timestamp in order to let my users see their transactions by date. Is there any function in an SDK or any endpoint on horizon server?
AndreaBorio's user avatar
4 votes
2 answers
106 views

Is it possible to retrieve last N transactions or all transactions since a given timestamp?

The dapp I'm building can not rely on the paging mechanism described here, since after a short amount of time I will have a lot of transactions for a given account. Retrieving them all to only select ...
Maxim Gaina's user avatar
4 votes
1 answer
357 views

Stellar channel implementation is giving an error "this.source.sequenceNumber is not a function"

i am trying to implement stellar channel concept. i am following stellar channel link. I have created 6 channel accounts. Below is the programme i wrote var destinationId = '...
Suman Raj's user avatar
4 votes
3 answers
647 views

How should the changeTrust Operation be used?

If I want to create a trustline between my issuing account and new users accounts, how do I do this. I tried with this code: const StellarSdk = require('stellar-sdk'); StellarSdk.Network....
John Murphy's user avatar
3 votes
1 answer
130 views

How to post multiple transactions to the network without giving back the same `transaction_hash`?

I'm trying to post multiple transactions of payment to the network. Let's say 10 at a time. I used javascript in this context. Problems: If I try to post all of 10 transactions at the same time ...
Him Hah's user avatar
  • 131
3 votes
1 answer
820 views

Creating an account, adding a trust line and transferring the asset in a single transaction

I want to send non-native assets to new stellar accounts. To do this, I understand that I need to create a new account by funding it with XLM (1 XLM minimum), add a trust line to the asset issuer and ...
NBC's user avatar
  • 51
3 votes
2 answers
210 views

How do I get the public keys from a transaction javascript

I am developing a site as college project and I cannot seem to understand how to implement StrKey to get the public key from a transaction. I can decode the xdr but cannot seem to understand how to ...
KyleMcCann's user avatar
3 votes
1 answer
53 views

Error when including 2 deps that both have stellar-base as a subdependency

When I include both stellar-hd-wallet and stellar-sdk in my project I get errors when requiring them both as stellar-base is included twice which also imports the generated XDR types twice causing the ...
Smixx's user avatar
  • 133
3 votes
1 answer
353 views

How to create and fund a stellar account on live network?

I have used the JS SDK to create a set of keys, and then send some money to it using friendbot cfr the docs to create an account (https://www.stellar.org/developers/guides/get-started/create-account....
ZaphodBBx's user avatar
3 votes
1 answer
159 views

How can I decode the address from XDR envelope

I am trying to write a page to show all the transaction history of an account, I use StellarSdk.xdr.TransactionEnvelope.fromXDR(page.records[0].envelope_xdr, 'base64') to get the transaction envelope, ...
iDler's user avatar
  • 33
3 votes
1 answer
104 views

How to carry out compliance for transactions between customers using single compliance server?

I have set up an Anchor account and created a custom asset to have customers trade with. I want to set up some compliance for transactions sent from one customer to the other. All customers will be ...
esc758's user avatar
  • 31
2 votes
2 answers
172 views

Getting all offers for a particular Asset (pair)

For a while now I'm trying to figure out how to get all offers for a particular Asset (or pair). As an example, StellarExpert lists all offers of MOBI on the following page: https://stellar.expert/...
CodeR70's user avatar
  • 123
2 votes
1 answer
256 views

Error: XDR Write Error: not an integer while issuing the asset in stellar network

I am trying to issue an asset in stellar using the following code var StellarSdk = require('stellar-sdk'); StellarSdk.Network.useTestNetwork(); var server = new StellarSdk.Server('https://horizon-...
M Gopi's user avatar
  • 21
2 votes
2 answers
440 views

Get the operation record of a payment

Using the javascript sdk, I'm sending a payment like so: const operation = Operation.payment({ destination: toAddress, asset: asset, amount: amount.toString() }); const account = await ...
Nitzan Tomer's user avatar
2 votes
1 answer
123 views

Python vs Java(script) for stellar apps. Is it worth learning a new language?

I am starting to get into programming apps for crypto, and I would like to start on the Stellar network. My programming background lies mainly in C and Python, and I am a reasonably competent self ...
KBriggs's user avatar
  • 123
2 votes
2 answers
628 views

Error in submitting the multisig transaction

The below code is the multisig transaction to submit to stellar horizon testnet. When I am submitting the transaction, I am getting the submission failed error. var alice_public_key = '...
merklexy's user avatar
2 votes
1 answer
520 views

How can i decode and get relevant data from envelope_xdr

I know that Stellar.xdr.TransactionEnvelope.fromXDR can decode data of a record called envelope_xdr. But what I do not understand is how I can get all data I need like memo, sourceAccount etc. Because ...
Tzion buchris's user avatar
2 votes
1 answer
276 views

How do I locally manage sequence no of an account?

I am trying to successfully send a transaction but its failing whats the purpose of these two functions 1 - StellarSdk.Operation.createAccount 2 - StellarSdk.Operation.payment if I am using an ...
f4r4's user avatar
  • 199
2 votes
1 answer
533 views

Create an account on a private stellar network

I wish to create an account on a private stellar network. The network was created using this docker image https://github.com/stellar/docker-stellar-core-horizon, with the --standalone flag. When I ...
Mahmoud Khraisha's user avatar
2 votes
2 answers
134 views

How can I actually use the js-stellar-sdk?

I'm trying to figure it all my self but I cannot find any useful information on how actually use the Documentation provided. For example I see there are classes and inside Account, ...
Natoshi's user avatar
  • 31
2 votes
1 answer
83 views

How return a state after sumbit a transaction [JavaScript]

I've a dispatcher in node js called dis.js. in this dispatcher i want to call a function in makepayment.js and wait for the result of submit transaction. dis.js critical piece of code const mk = ...
AndreaBorio's user avatar
2 votes
1 answer
202 views

Messaging over Stellar - Is that right to do?

/* * Hi! * * I'm sending this tiny library for you to check. This is the basis of the * on-chain signature collection solution I'm writing. It includes collecting * signatures for multi-...
Mister Ticot's user avatar
2 votes
1 answer
80 views

operation bump sequence status

I am using latest stellar js library. However operation.BumpSequence is failing. Unhandled rejection TypeError: sdk.Operation.BumpSequence is not a function. As per the roadmap, bumpsequence ...
jagstock's user avatar
  • 539
2 votes
2 answers
681 views

How to verify a Transaction?

I sent a signed transaction through the internet to a cloud function that needs to verify that the signer is the valid one. My code: const bHMainKeys = Keypair.fromSecret(privateKey) if (...
Jesús Fuentes's user avatar
2 votes
1 answer
73 views

How can I direct stellar laboratory to my own instance of horizon?

I cloned the stellar laboratory project and edited the /src/constants/networks.js file to switch the testnet horizon url to url of my own horizon instance. This allowed me to get requests such as ...
Ron Serruya's user avatar
2 votes
1 answer
120 views

Can't close server stream

The other existing question didn't work for me. (How to close a stream event?) I set up a class to handle and switch streams. In the constructor, I define and initialize the stream this way: ...
Alex F's user avatar
  • 31
2 votes
1 answer
194 views

How to listening new XLM transaction for multiple accounts

I'm totally new in stellar network. I have experienced create transaction listener for bitcoin and ethereum by listen to every new transaction, if that transaction contain my address it send callback ...
Billy Adelphia's user avatar
2 votes
2 answers
200 views

Error while submitting change trust transaction

I created an anchor account which issues USD asset. It worked properly. But now when I modify the program where the anchor issues one more asset called INR and I am creating a trustline for both the ...
Siddharth Gupta's user avatar
2 votes
2 answers
133 views

Java SDK: Transaction object from envelope

In Javascript SDK, transaction can be built, signed and then be converted to envelope xdr/string format. This is very useful for multi sig operations since we can retrieve the transaction object from ...
jagstock's user avatar
  • 539
2 votes
1 answer
53 views

How can I encode transaction specific information on the ledger, after it has been made?

Let's say I create invoices which contains consumer products. For each invoice, I create a transaction to the supply account which contains the invoice file hash in the memo. However, when I have ...
Maxim Gaina's user avatar
2 votes
1 answer
271 views

Good methods for Stress Test to prevent tx_bad_seq?

During a manual stress test with js-stellar-sdk, some transactions may be responded slower (e.g. 10 sec). At high TPS, asynch programming possibly causes server.loadAccount() to get the same tx_seq, ...
cesarm's user avatar
  • 1,527
2 votes
1 answer
64 views

Get Public key variable from Freighter Wallet

if (window.freighterApi.isConnected()) { alert("User has Freighter!"); } const retrievePublicKey = async () => { let publicKey = ""; let error = ""; try { ...
nocodestellar's user avatar
2 votes
0 answers
46 views

How to filter only the most recent n number of operations of an account for only a specific Asset?

I had a function that returned the most recent 3 payment operations for an account. But I wante to change it so that it would only return the most recent 3 payment operations for only the asset being ...
John Murphy's user avatar