Giter Site home page Giter Site logo

Comments (3)

SaifRehman avatar SaifRehman commented on August 27, 2024 1

@ameeuw I am getting this error
(node:40737) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Data must be a string or a buffer
(node:40737) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

from lotion.

SaifRehman avatar SaifRehman commented on August 27, 2024

@keppel What are these function. I get these when i do this.
var connect = require('lotion')
let GCI = '91d61db1dce394931297b59d584eb723b8009c40d72bb8ec8aeccf4a9ba008b1'
async function send(){
return (await connect(GCI))
}

send().then(function(state){
var txs = async function(){
let result = await send ({ nonce: 0 }).then(function(data){
console.log(data);
})
}();
})
screen shot 2018-03-08 at 1 27 48 pm
So I can access blockchain

  1. tendermint rpc (this actually works)
  2. GCI (I can access through gci but not familiar on how to call the function to txs on blockchain, readme is not updated on this)

from lotion.

ameeuw avatar ameeuw commented on August 27, 2024

The connect() method actually returns a few methods (getState() and send()) itself which you can utilise:

let { connect } = require('lotion')

async main() => {
    // Create lightclient via lotion's connect() method
    let lc = await connect(null, { genesis, nodes })

    // Get the current state via the lightclient's getState() method
    let currentState = await(lc.getState())
    console.log(currentState)

    // Send a transaction via the send() method
    let tx = {'key': 'your_tx_object_here'}
    let response = await lc.send(tx)
    console.log(response)
}

main()

I hope this helps.

from lotion.

Related Issues (20)

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.