Giter VIP home page Giter VIP logo

kin-sdk-node's Introduction

Kin SDK for Node

Kin SDK for Node is meant to be used as a back-end service. It can perform actions for your client apps (iOS, Android, etc.) and also operate as a server for you to build services on top of the Kin blockchain. For example, the SDK can communicate with the Kin Blockchain on behalf of the client to create accounts and whitelist transactions. It can also monitor blockchain transactions so that you can implement broader services. It is up to you how to integrate the SDK in your overall architecture and how to manage your server.

Documentation

kin-sdk-node's People

Contributors

cnotethegr8 avatar ravitb avatar sbeskin avatar yosriz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kin-sdk-node's Issues

Explicitly setting fee to 0 for whitelist

I don't know if this is relevant, but unless you explicitly set the fee to 0 before whitelisting, the service still charges you a fee. If you set it to 0 it works perfectly as expected.

(I thought the fee was an upper-bound of what the client is willing to pay)

KinClient.createPaymentListener experiences delays in production, but not testnet.

Our backend uses KinClient.createPaymentListener in order to detect user spends and disburse any required good/service/etc. We are monitoring our own account.

On testnet, everything is fine. There's a minor delay before the payment listener is triggered, but it's only 20s-30s -- manageable.

On production, it takes a variable amount of time for the payment listener to be triggered. 10 minutes, 15 minutes, etc. Sometimes it's not triggered at all.

We've confirmed via the Kin Laboratory that the transactions hit the blockchain rather quickly (as far as I can tell anyway).

We're not quite sure what the delay is about, or why the difference in speed exists between testnet and production.

How set allow http for KinClient?

How set allow http for KinClient?
It is my code.
const KinClient = require('@kinecosystem/kin-sdk-node').KinClient; let client = new KinClient(new Environment({url: http://horizonServerUrl.test:8006})); const fee = await client.getMinimumFee();
but when I call new KinClient, I get error Cannot connect to insecure horizon server
https://github.com/kinecosystem/js-kin-sdk/blob/703eb726143ca908150672195d1f6d90f815fc7b/src/server.js#L39
you every time to set allowHttp from options, and I don't understand how I can set allowHttp = true for sync with my node

Error when calling isAccountExisting for non onboarded account

Calling client.isAccountExisting with an address that does not exist on the blockchain is returning an error instead of false.

The error returned is:

{ Error: Resourcesnotfound, errorcode: 404atFunction.translateHorizonError(C: \Users\willi\OneDrive\Documents\kin- node-server\node_modules\@kinecosystem\kin-sdk-node\scripts\bin\errors.js: 241: 20)atFunction.translate(C: \Users\willi\OneDrive\Documents\kin-node-server\node_modules\@kinecosystem\kin-sdk-node\scripts\bin\errors.js: 171: 33)atAccountDataRetriever.<anonymous>(C: \Users\willi\OneDrive\Documents\kin-node-server\node_modules\@kinecosystem\kin-sdk-node\scripts\bin\blockchain\accountDataRetriever.js: 44: 45)atGenerator.throw(<anonymous>)atrejected(C: \Users\willi\OneDrive\Documents\kin-node-server\node_modules\@kinecosystem\kin-sdk-node\scripts\bin\blockchain\accountDataRetriever.js: 5: 65)atprocessTicksAndRejections(internal/process/next_tick.js: 81: 5)msg: 'Resources not found', errorBody: { type: 'https://stellar.org/horizon-errors/not_found', title: 'Resource Missing', status: 404, detail: 'The resource at the url requested was not found. This is usually occurs for one of two reasons: The url requested is not valid, or no data in our database could be found with the parameters provided.' }, title: undefined, type: 'ResourceNotFoundError', errorCode: 404, _resultTransactionCode: undefined, _resultOperationsCode: undefined }

This is for the Test environment - haven't checked production.

Handling case of network_id/ networkId in sample code

Since this sample code was originally designed for python, whitelisting transactions using the sample code and python server works perfectly.

However, a dev using the sample code and the Node.js will get get a Network Mismatch Error when trying to whitelist.

This is because the python SDK takes the netwrok id as the variable: "network_id".

However, the Node SDK takes it as "networkId"

I imagine this case issue when exchanging data will keep popping up as differing languages are added, unless it's it's standardized from the client or server side.

Add to the documentation that it's currently support on Node <=10

The latest version of NodeJS (12.x.x) doesn't support some of the functions used by the library. In particular:

    "@kinecosystem/kin-base": {
      "version": "0.20.4",
      "resolved": "https://registry.npmjs.org/@kinecosystem/kin-base/-/kin-base-0.20.4.tgz",
      "integrity": "sha512-Hb5umvYV7bqAEnAawJDaSwNygx8I4tQHVHAuUWdbOESw2Y2XzhA3Csl81xvEvrPsghvkYjwsZA9F/YuKqEIWPw==",
      "requires": {
        "base32.js": "0.1.0",
        "bignumber.js": "5.0.0",
        "crc": "3.8.0",
        "ed25519": "0.0.4",
        "js-xdr": "1.1.2",
        "lodash": "4.17.14",
        "sha.js": "2.4.11",
        "tweetnacl": "1.0.1"
      },

ed25519 is the culprit, it's an encryption library but it's pretty outdated and uses removed APIs in Node version 12.

I will create a PR to update the README to add a note :)

API to retrieve transaction history doesn't support cursors.

When retrieving an account's transaction history, the result is an array of transactions. Because the paging cursor isn't returned, it's impossible to go back through an account's history more than the max pagination limit of 200 via the Kin SDK.

Being able to paginate via cursor is necessary to locate certain types of transactions in the event that an internal system goes down for a while and it has to "catch up" by going through transaction history after it comes online again.

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.