Giter VIP home page Giter VIP logo

typescript-sdk's Introduction

Maestro Logo

TypeScript SDK for the Maestro Dapp Platform

Getting Started

Installation

NPM

npm i @maestro-org/typescript-sdk

Usage

import { MaestroClient, Configuration } from "@maestro-org/typescript-sdk";

let maestroClient = new MaestroClient(
  new Configuration({
    apiKey: "<PROJECT_API_KEY>",
    network: "Preprod",
  })
);
  • To generate an API key, create a free account here!
  • Network options: Preview, Preprod, Mainnet, Sanchonet

Example

import { MaestroClient, Configuration } from "@maestro-org/typescript-sdk";

let maestroClient = new MaestroClient(
  new Configuration({
    apiKey: "<PROJECT_API_KEY>",
    network: "Preprod",
  })
);

maestroClient.addresses
  .utxosByAddress(
    "adaddr_test1wpgexmeunzsykesf42d4eqet5yvzeap6trjnflxqtkcf66g0kpnxt"
  )
  .then((x) => console.log(x.data))
  .catch((error) => {
    if (error.response) {
      // The request was made and the server responded with a status code
      // that falls out of the range of 2xx
      console.log(error.response.data);
      console.log(error.response.status);
      console.log(error.response.headers);
    } else if (error.request) {
      // The request was made but no response was received
      // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
      // http.ClientRequest in node.js
      console.log(error.request);
    } else {
      // Something happened in setting up the request that triggered an Error
      console.log("Error", error.message);
    }
  });
maestroClient.addresses
  .utxosByAddresses([
    "addr_test1wpgexmeunzsykesf42d4eqet5yvzeap6trjnflxqtkcf66g0kpnxt",
  ])
  .then((x) => console.log(x.data));

Documentation

Contributing

Meastro welcomes all contributors! Please see our contributing guidelines and code of conduct.

typescript-sdk's People

Contributors

alexdochioiu avatar chrissiwaffler avatar github-actions[bot] avatar sidanwhatever avatar sourabhxyz avatar vardominator avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

typescript-sdk's Issues

Implement Asset Policy endpoints

Maestro will award you 4 Million Compute credits per 5 endpoints integrated/updated in the SDK, to use in Maestro services!!

Implement querying and articulating with Maestro Asset Policy endpoints as documented at https://docs.gomaestro.org/category/asset-policy

Specific endpoints:

Refer here for a matrix of all Maesto APIs<>SDKs:
https://docs.gomaestro.org/SDKs/Introduction

Implement Maestro DeFi Market API SDK

Maestro will award you 4 Million Compute credits per 5 endpoints integrated/updated in the SDK, to use in Maestro services!!

Implement querying and articulating with Maestro DeFi Market API as documented at https://docs.gomaestro.org/category/defi-market-api

Refer here for a matrix of all Maesto APIs<>SDKs:
https://docs.gomaestro.org/SDKs/Introduction

Specific endpoints:

Change Query Param to Accept Typed Objects

Problem

When using the SDK for calling specific endpoints with customized query param, it has a hard time to just pass in one desired query param as it has to follow the specific orders. For example if I only want to restrict the number of utxos returned by Address UTxO, I have to do something like this, which is really annoying:

maestroClient.addresses.utxosByAddress(address, undefined, undefined, 100);

Possible Solution

To change all query param with an object, where the query param key to be the object key and the query param value to be the object value

maestroClient.addresses.utxosByAddress(address, {count: 100});

It is also good to make the query param object typed with default value same as the actual api behaviour.

Side Note

  • If I understand the SDK correctly, this.maestroClient.addresses.utxosByAddress equal to this endpoint, while the SDK has not updated yet to accept asset as parameter.
  • As this is a systematic breaking change, I might better only contribute after the decision is made.

Mesh and Lucid providers

The purpose of this spike is to scope out the work required to support both the Mesh and Lucid Cardano off-chain frameworks:

Implement Transactions by multiple payment credentials endpoint and Balance by payment credential endpoint

Maestro will award you 4 Million Compute credits per 5 endpoints integrated/updated in the SDK, to use in Maestro services!!

Implement Transactions by multiple payment credentials endpoint and Balance by payment credential endpoint linked below:

Refer here for a matrix of all Maesto APIs<>SDKs:
https://docs.gomaestro.org/SDKs/Introduction

Remove `*Factory` classes

This class doesn't extend BaseAPI and allows one to construct by directly giving involved parameters. Perhaps it's not of use to us.

Add code style checking and formatting

I'd suggest adding a configuration file(s) for prettier and eslint for better and more structured code.

Additionally, GitHub actions for linting, code formatting and testing could be added.

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.