13

No, you can't. If we look at the XDR definition of setOptionsOp, we can see all the fields are optional, if a field is not None then the corresponding value will be set. So what can you do? Home domain From the SQL definition of the accounts table we see that homedomain cannot be null, by default it's the empty string. To unset it we simply set it to ''. ...


11

Call the returned object itself. In your case: channel();


9

While I'm not sure why this happens, this is not a different hash, its just encoded in base64 >>> import base64 >>> base64.b64decode('jDOeFb2J5/jH1sdUuAFqICu6EqjNtKq+OcbJ4wUHqPM=').hex() '8c339e15bd89e7f8c7d6c754b8016a202bba12a8cdb4aabe39c6c9e30507a8f3'


8

The streaming API is good for that job, you could get the last token from the network just when the user sends the payment and open the stream channel using that token so it looks only for transactions after that particular point in time. You won't miss a payment, and in case the user doesn't get the confirmation due to internet problems just reopen the ...


6

In browser you can use Fetch API for this purpose: fetch('https://horizon-testnet.stellar.org/friendbot?addr=<account-address>') .then(res=>res.json()) .then(res=>console.log(res))


5

Here's the process in action: https://github.com/shredding/stellar-bot/blob/master/src/stellar/index.js


5

XDR is a binary encoding of structured data. It is represented as a base 64 encoded String in transaction responses. Some options: You can decode base 64 encoded XDR using the laboratory. The JavaScript SDK provides instructions to deserialise the Base 64 XDR into JSON. If you can use the Scala SDK you can call SignedTransaction.decodeXDR(base64)(...


4

As described in the docs, TransactionCallBuilder.stream returns a function you can call to close a stream: Returns: Type: function Close function. Run to close the connection and stop listening for new events.


4

To use this commands you have to import the SDK in your javascript or java application and define the horizon-server you wanna use for javascript (nodejs) its like: var StellarSdk = require('stellar-sdk'); var server = new StellarSdk.Server('https://horizon-testnet.stellar.org'); for pure clientside javascript its like <script src="./stellarsdk/...


4

if you are using JS-Stellar-SDK, you may refer to this format: (for example, fee=478) var StellarSdk = require('stellar-sdk'); var server = new StellarSdk.Server('https://horizon-testnet.stellar.org'); new StellarSdk.TransactionBuilder(sourceAccount, opts={fee:478}) .addOperation(StellarSdk.Operation.payment({ destination: destinationId, asset: StellarSdk....


4

Given transaction is a Transaction object then this will give you base64 encoded XDR: transaction.toEnvelope().toXDR().toString("base64")


4

Stellar JavaScript SDK features one undeniable advantage – it gives an ability to create a Stellar app that will work directly in a browser. Browser-based apps are easier to promote (no need to install anything on your smartphone/laptop), easier to support (single implementation for all modern browsers), and you can safely forget about versions hell (users ...


4

const transaction = new Stellar.TransactionBuilder(loan) .addOperation(Stellar.Operation.payment({ destination: borrowerPublicKey, asset: Stellar.Asset.native(), amount })) .addOperation(Stellar.Operation.payment({ destination: loan, asset: new Stellar.Asset('LOAN', loan), amount, source: ...


3

The first serialization can be done via: const base64str = transaction.toEnvelope().toXDR().toString('base64') Then you have a base64 encoded string that can be safely transmitted over the network. To restore it back to the original object you can do: const tx = new Transaction(base64str)


3

I had the same problem with offer id after the ManageOffer operation, and I came to the same solution. If you don't have a lot of orders and don't mind to make an extra request, you can also pull account offers endpoint after submitting the ManageOffer to get all active offers and update you client-side offers state. Since OfferCreated/OfferRemoved effects ...


3

The field result_xdr decodes to txBadSeq indicating that you've got a bad sequence number on that transaction.


3

The simplest one, show balances: server.loadAccount(publicKey) .then(function(account) { account.balances.forEach(function(balance) { // show them }); }); Next in line, show last payments: server.payments() .forAccount(publicKey) .limit(20) .order('desc') .call() .then(function(...


3

As others have mentioned, it sounds like a conflict rather than an import issue. That said, I'm fairly certain I've seen that error before, a long time ago, and I have not used node-crc. For Angular 6, I use the following configuration: After installing, you need to add it to angular.json under: "architect": { "build": { "scripts": [ ...


3

createAccount is an operation that you can include in a transaction. It works like a payment from your account to the account specified in the operation. But it has a side-effect of creating the destination account. As such, it will only succeed if the account doesn't already exist and the payment amount is greater than the reserve balance. payment is also ...


3

I know that you got the answer on github, but for anyone else looking I'll link it here: https://github.com/stellar/js-stellar-sdk/issues/191 This is fixed in: js-xdr@1.0.4 stellar-base@0.8.2 stellar-sdk@0.10.2


3

I'd let the SDK decode the XDR for you, and take it from there. const tx = new StellarSdk.Transaction(tx_xdr); From here on you have the source accounts in tx.source and tx.operations[i].source, for 0 < i < tx.operations.length. Easy peasy!


3

Each time your call the Wallet function it generates a new keypair. You should save the invocation result into a variable: var keypair = Wallet() console.log(keypair1.secret, keypair2.public) var anotherKeypair = Wallet()


3

The strkey format is a base32 encoding given by RFC4648. The first output character of the encoding is determined by the top five bits of the first byte. So the value 6 is the value corresponding to 'G' in RFC4648, and it is shifted by 3 to make it the top five bits. Here's a more complete specification of strkey format in a SEP.


3

1. Prepare keypairs for all participating accounts - source account and destination account. let source = StellarSdk.Keypair.fromSecret(sourceAccountSecretKey) let dest = StellarSdk.Keypair.fromSecret(destinationAccountSecretKey) Keypair for the destination account can be generated using StellarSdk.Keypair.random(). 2. Load current source account state ...


3

const transaction = new StellarSdk.Transaction(txenv); This will decode an transaction envelope XDR object to a Transaction object (https://github.com/stellar/js-stellar-base/blob/master/src/transaction.js), which has all of the properties you need.


3

The error itself contains all the information you need for the troubleshooting. Probably you wrapped this code in some function (i.e. function testPayment() {...}). To make it work, add async keyword before the function declaration. Like async function testPayment() {...}. Documentation on async/await usage in JS can be found here.


3

For a transaction to be successful, it has to have a sequence number one greater than the current sequence number of the account funding the transaction. Therefore, if you want to submit 10 transactions, they need distinct sequence numbers, and each one can only succeed if their sequence number is one greater than the current sequence number of the account ...


3

Horizon provides an orderbook endpoint that takes buying and selling assets as arguments. You can use this to get all offers for any asset pair. Is there something I'm misunderstanding about your question?


2

I think the issue is with the limitations of web workers in Safari. I already commented your issue in GitHub.


2

Your code is missing to set Keypair before send to friendbot. var StellarSdk = require('stellar-sdk'); var pair = StellarSdk.Keypair.random(); pair.secret(); console.log('secret => '+pair.secret()); new_addr=pair.publicKey(); console.log('public => '+new_addr);


Only top voted, non community-wiki answers of a minimum length are eligible