Code Monkey home page Code Monkey logo

kristwrap's Introduction

KristWrap

KristWrap is similar to tmpim's k.lua, but without the need to change your coding style to support jua.

Warning

This may contains bugs! I haven't yet had time to test it fully, but it should work overall.

About

Like stated above, this is similar to k.lua, but you don't need to change your coding style. Initially, this project will purely be for transactions and etc. It may get larger later (or I may forget about it, who knows?), but for now I'm building it for Simplify Shop V2.

Usage

  1. wget https://raw.githubusercontent.com/Fatboychummy-CC/KristWrap/master/KristWrap.lua or wget https://raw.githubusercontent.com/Fatboychummy-CC/KristWrap/master/minified.lua

  2. Download rxi's json library, from https://github.com/rxi/json.lua

  3. Download Anavrin's Sha256 library, from https://pastebin.com/6UV4qfNF

  4. In your program, set the endpoint

  • If you don't know what this means, or you just wish to use "the normal krist", use KristWrap.useDefaultEndPoint().
  1. In parallel, you want to run KristWrap.run with the following arguments:
  • Table of strings
    • Each string is an event you want to subscribe to, like "transactions", or "blocks"
  • (optional): Private key, in either raw or KristWalletFormat.
  1. Write your code, I recommend using parallel. Example follows:
local KristWrap = require "KristWrap"
local privatekey = "something"

parallel.waitForAny(
  function()
    KristWrap.useDefaultEndPoint()
    KristWrap.run({"transactions"}, privatekey)
  end,
  function()
    KristWrap.Initialized:Wait() -- wait for KristWrap.run to connect properly.

    while true do
      local to, from, value, metadata = KristWrap.Transaction:Wait()
      -- Do stuff with the transaction here.
    end
  end
)

For all some events, you can use either KristWrap.Event:Wait([number timeout]) or KristWrap.Event:Connect(<function callback>). Use Wait for simplicity, or Connect if you wish for a more Jua-like usage (Or more roblox-like usage, if you're used to that).

Note: Event:Connect requires KristWrap.run to be ran in parallel.

kristwrap's People

Contributors

fatboychummy avatar

Watchers

James Cloos avatar  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.