How to use the xpring-common-js.Signer.signTransaction function in xpring-common-js

To help you get started, we’ve selected a few xpring-common-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xpring-eng / Xpring-JS / src / default-xpring-client.ts View on Github external
payment.setXrpAmount(xrpAmount);
              payment.setDestination(destination);

              const transaction = new Transaction();
              transaction.setAccount(sender.getAddress());
              transaction.setFee(fee);
              transaction.setSequence(accountInfo.getSequence());
              transaction.setPayment(payment);
              transaction.setLastLedgerSequence(
                ledgerSequence + ledgerSequenceMargin
              );
              transaction.setSigningPublicKeyHex(sender.getPublicKey());

              var signedTransaction;
              try {
                signedTransaction = Signer.signTransaction(transaction, sender);
              } catch (signingError) {
                const signingErrorMessage =
                  XpringClientErrorMessages.signingFailure +
                  ". " +
                  signingError.message;
                return Promise.reject(new Error(signingErrorMessage));
              }
              if (signedTransaction == undefined) {
                return Promise.reject(
                  new Error(XpringClientErrorMessages.signingFailure)
                );
              }

              const submitSignedTransactionRequest = new SubmitSignedTransactionRequest();
              submitSignedTransactionRequest.setSignedTransaction(
                signedTransaction