Coder Social home page Coder Social logo

sdk's Introduction

Flipside SDK (formerly known as ShroomDK)

Programmatic access to the most reliable & comprehensive blockchain data in Web3.

You've found yourself at the FlipsideCrypto SDK repository, the official SDK to programmatically query all of Flipside Crypto's data.

๐Ÿงฉ The Data

Flipside Crypto's Analytics Team has curated dozens of blockchain data sets with more being added each week. All tables available to query in Flipside's Data Studio can be queried programmatically via our API and library of SDKs.

๐Ÿ“– Official Docs

https://docs.flipsidecrypto.com/flipside-api/get-started

๐Ÿ— Want access? Genrate an API Key for Free

Get your free API key here

SDKs

Language Version Status
โœ… Python 2.0.8 tests
โœ… JS/TypeScript 2.0.1 tests
โœ… R 0.2.2 Available on CRAN

sdk's People

Contributors

charlieflipside avatar doncote avatar jfmyers avatar jokersden avatar masonchain avatar poolpirate avatar suhaotian 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

Watchers

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

sdk's Issues

Query that returns 0 results throws an error in SDK

Query that returns 0 results throws an error in SDK

I would expect the behavior to be that the resulting records are and empty list and run_stats.record_count would be 0.
In the UI when a query returns no results the query still executes successfully.

Query Run Timeout Error returning incorrect time unit, minutes for all

Unclear Error Message

Description

When running a query using the Python SDK with 'TIMEOUT MINUTES' set, if the query times out the error message text returned expresses the timeout in minutes when it should either be seconds or convert seconds to minutes.

For example my query was set to run with a 2 min timeout, and ran for ~136 seconds, the error message returned was as follows:

raise QueryRunTimeoutError(elapsed_seconds)
flipside.errors.query_run_errors.QueryRunTimeoutError: QUERY_RUN_TIMEOUT_ERROR: your query has timed out after 136.0 minutes.

It seems that the timeout is being passed elapsed_seconds and not converting to minutes.

https://github.com/FlipsideCrypto/sdk/blob/73e52bf82507dc53e4026554802e13339d3e3505/python/src/errors/query_run_errors.py#LL24C8-L26C39

To Reproduce

  1. Create a query that will reliably run for longer than 2 minutes.
  2. Use the python SDK and set TIMEOUT_MINUTES to 2
  3. Issue the query and review the error message raised. The error message will show that the query has timed out after x number of 'minutes', where x is the number of seconds instead of minutes.

API ERROR

Hello we started noticing this error all of a sudden from the sdk.

Our sql query and API key still the same as before

QueryResultSetBuilder {
    error: ApiError: UnknownAPIError: message=, code=-1
        at getExceptionByErrorCode (/Users/charles/Desktop/pear-protocol/pear-backend/node_modules/@flipsidecrypto/sdk/src/errors/api-error.ts:37:12)
        at QueryIntegration.<anonymous> (/Users/charles/Desktop/pear-protocol/pear-backend/node_modules/@flipsidecrypto/sdk/src/integrations/query-integration/index.ts:62:39)
        at Generator.next (<anonymous>)
        at fulfilled (/Users/charles/Desktop/pear-protocol/pear-backend/node_modules/@flipsidecrypto/sdk/dist/src/integrations/query-integration/index.js:5:58)
        at processTicksAndRejections (node:internal/process/task_queues:95:5),
    queryId: null,
    status: null,
    columns: null,
    columnTypes: null,
    rows: null,
    runStats: null,
    records: null,
    page: null
  }

We are not sure what could be the cause

requirements.txt version constraints too strict

The version constraints on requirements.txt in the /python directory are unnecessarily strict. This breaks by environment since some packages require older versions of requests (super common package) or newer versions of pydantic (fairly popular pacakge with version 2.x out now)

I propose you lower the requests requirement to >=2.20.0 or similar

Also, pydantic is on version 2.0.2 now so something like pydantic>=1.10.9 (granted 2.0.2 passes tests) would be preferable

QUERY_RUN_EXECUTION_ERROR: SQL compilation error: Missing column specification

Python SDK: 2.0.7

Query works great on xyz studio app and has been working fine up until today:

  SELECT RECORDED_HOUR, MAX(CLOSE)
    FROM solana.core.fact_token_prices_hourly
    WHERE symbol = 'ATLAS'
    AND RECORDED_HOUR > '{timestamp}'::timestamp without time zone
    GROUP BY RECORDED_HOUR
    ORDER BY RECORDED_HOUR

We'd been using the FS SDK, 2.0.3, for last week or two and had no problems up till yesterday, everything broke this morning.

Column names don't match what is seen in Data Studio

columnNames returned by the Python SDK are all lowercase. In the Data Studio, they are uppercase, or case can be made explicit using double quotes. The behavior of shroomDK v1.0.2 matched the data studio. This change effects downstream processing, which is case sensitive for column names.

Is it possible to re-enable the old behavior?

Example:

select 
  block_timestamp::date as "Date",
  count(distinct tx_id) as tx_count,
  program_id
from
  solana.core.fact_events
where
  block_timestamp::date = '2023-05-21'
group by
  program_id,
  "Date"

Expected results

Column names:

  • Date
  • TX_COUNT
  • PROGRAM_ID

Actual results

Column names:

  • date
  • tx_count
  • program_id
  • __row_index

Note, an additional __row_index column is included even though it wasn't included in the query

Question about the pydantic version

Hi flipside team,

Wondering if there's any planned update to the pydantic version pinned in the python sdk?
Its currently at v1 which is incompatible with every other python library because they depend on pydantic v2

Thank you!

JS/TS SDK Doesn't Work with Cloudflare Workers

When used inside a Cloudflare Worker, this is the error message that appears:

Error: UNEXPECTED_SDK_ERROR: adapter is not a function

Which according to this StackOverflow post, is probably due to Axios not recognizing the environment its in and using the wrong code to try and execute the request.

Until this is fixed I'll be using the RPC API directly with fetch.

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.