Coder Social home page Coder Social logo

pinkdiamond1 / ts-stellar-xdr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from satoshipay/ts-stellar-xdr

0.0 1.0 0.0 118 KB

Decoder/Encoder of XDR types used in Stellar

License: Apache License 2.0

JavaScript 7.69% TypeScript 88.59% Dockerfile 0.23% Shell 0.50% Ruby 2.99%

ts-stellar-xdr's Introduction

Typescript Stellar XDR Decoder/Encoder

This library is a decoder and encoder of all xdr types used in Stellar. It transforms JavaScript objects into XDR and vice versa.

Usage

const { TransactionEnvelope } = require("ts-stellar-xdr");

const transactionEnvelope =
  "AAAAAJM++/BQ/J83ai5alxXDK/s5oNhYQPtYDq4VtLf7qc9eAAAAZAEK1kwAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAzMnJ6" +
  "nCpdtk2mZPKKIJ9GTynIxfP58O0cQnrpz9ukBsAAAAF9nmWgAAAAAAAAAAB+6nPXgAAAEBKCwRLujMDdruWlHGpvcBYaVKqUDGbpH" +
  "ifZ7bjGmrCs7cldblBe2ZI7AGMC79QQr6peR/jf/HOSDwkXYWJczMH";

const transactionEnvelopeArrayBuffer = base64Decode(transactionEnvelope); // for some base64 decoding function

const transaction = TransactionEnvelope.fromXdr(transactionEnvelopeArrayBuffer);
console.log(transaction);

const encodedTransactionEnvelope = base64Encode(TransactionEnvelope.toXdr(transaction));

console.log(encodedTransactionEnvelope === transactionEnvelope); // true

Developers

How to run locally

Preparation

  npm install

Build typescript XDR serializer/deserializer

  npm run build-complete

ts-stellar-xdr's People

Contributors

add-license[bot] avatar torstenstueber avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.