How to use the stellar-base.Transaction function in stellar-base

To help you get started, we’ve selected a few stellar-base 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 stellar / js-stellar-sdk / src / utils.ts View on Github external
export function verifyChallengeTx(
    challengeTx: string,
    serverAccountId: string,
    networkPassphrase?: string,
  ): boolean {
    const transaction = new Transaction(challengeTx, networkPassphrase);

    const sequence = Number.parseInt(transaction.sequence, 10);

    if (sequence !== 0) {
      throw new InvalidSep10ChallengeError(
        "The transaction sequence number should be zero",
      );
    }

    if (transaction.source !== serverAccountId) {
      throw new InvalidSep10ChallengeError(
        "The transaction source account is not equal to the server's account",
      );
    }

    if (transaction.operations.length !== 1) {
github satoshipay / solar / stories / StellarGuardActivation.tsx View on Github external
id: "testid2",
    name: "My Testnet Account #2",
    publicKey: "GDNVDG37WMKPEIXSJRBAQAVPO5WGOPKZRZZBPLWXULSX6NQNLNQP6CFF",
    requiresPassword: false,
    testnet: true,
    getPrivateKey: (password: string) => Promise.resolve(password)
  }
]

const horizon = new Server("https://horizon-testnet.stellar.org")

const uri = parseStellarUri(
  "web+stellar:tx?xdr=AAAAADPMT6JWh08TPGnc5nd6eUtw0CfJA4kQjkHZzGEQqGWHAAAAZAAGXSAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAM8xPolaHTxM8adzmd3p5S3DQJ8kDiRCOQdnMYRCoZYcAAAAAAAAAAACYloAAAAAAAAAAAA%3D%3D&msg=order+number+123&callback=url%3Ahttps%3A%2F%2Fexample.com%2Fstellar&origin_domain=test.stellarguard.me&signature=TwoRggPieF6UorVeLHSYZhRRKv8mMwezVUiirms%2F8N6oe8EZOCYKSsNWAn2o1rVb8jhEVte%2FEFZcRkzyXEZdBw%3D%3D"
)

const transaction = new Transaction((uri as TransactionStellarUri).xdr)

storiesOf("StellarGuard Activation", module).add("StellarGuard Activation Dialog", () => (
  <dialog open="{true}">
     undefined}
      accounts={accounts}
      testnet={true}
      transaction={transaction}
      onClose={() =&gt; undefined}
      horizon={horizon}
    /&gt;
  </dialog>
))