Coder Social home page Coder Social logo

zeriontech / defi-sdk-js Goto Github PK

View Code? Open in Web Editor NEW
48.0 9.0 18.0 2.21 MB

JavaScript/TypeScript wrapper for DeFi SDK

Home Page: https://docs.zerion.io

License: MIT License

JavaScript 1.21% Shell 0.06% HTML 0.35% TypeScript 98.37%
defi ethereum dapp defi-sdk

defi-sdk-js's People

Contributors

dependabot[bot] avatar everdimension avatar evgeth avatar rockfridrich avatar vyorkin avatar zerts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

defi-sdk-js's Issues

SyntaxError: Cannot use import statement outside a module

I'm trying to use the SDK and execute this script

import {client} from 'defi-sdk';

const BASE_URL = 'wss://api-v4.zerion.io/';

client.configure({url: BASE_URL, apiToken: 'my_token'});

client.subscribe({
  namespace: 'address',
  body: {
    scope: ['transactions'],
    payload: {
      address: 'my_address',
      currency: 'usd',
    },
  },
  onMessage: (event, data) => {
    console.log(data);
    return;
  },
});

but when I try to execute the script via npx ts-node server/zerion2.ts I get this error

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1032:15)
    at Module._compile (node:internal/modules/cjs/loader:1067:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Object.require.extensions.<computed> [as .js] (/Users/zerion/node_modules/ts-node/src/index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/zerion/server/zerion2.ts:1:1)

I want all list of scopes..

HI, Kindly can you please help me out, is there any possibility to get assets of different chains such as FTM, AVAX, BNB etc. Thank You

onAnyMessage callback called more than once for paginated hooks

Code example:

  const entry = useAddressActions(
    {
      ...params,
      currency: 'usd',
      actions_search_query: searchQuery,
    },
    {
      limit: 30,
      listenForUpdates: true,
      paginatedCacheMode: 'first-page',
      onAnyMessage: useCallback((a, b, c) => {
        console.log('onAnyMessage', { a, b, c }); // this is called more than once for each item
      }, []),
    }
  );

It's called twice for each item for first "page" and then increases for each next page load.

Export interfaces

It could be great if you could export types in the main export so we can use them in our typescript codes.

I'm using this for now as a workaround:

import { ProtocolBalanceInterface } from 'defi-sdk/dist/protocols/interfaces'

Maker not supported

Maker seems not supported
In output of getProtocolNames there is "Maker Governance" but no "Maker" or "Maker Dao"

Tried this code that works for "Compound"

var protocol = "Maker";
defiSdk.getProtocolBalance(account, protocol).then(function (balance) {
    console.log('\n\ngetProtocolBalance "Maker"');
    console.log(JSON.stringify(balance, null, 2));
});

I got exception
(node:7444) UnhandledPromiseRejectionWarning: ProtocolDoesNotExistError: Protocol [Maker] does not exists get exception

Please provide solution or workaround

Regards
Jayanta

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.