Skip to content

Commit

Permalink
Merge pull request #7 from maestro-org/release-v1
Browse files Browse the repository at this point in the history
release v1
  • Loading branch information
Vardominator authored Sep 5, 2023
2 parents 5569863 + 45feffe commit 0baa6b9
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4,427 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,5 @@ dist

# TernJS port file
.tern-port

package-lock.json
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,78 @@
<a href="https://discord.gg/ES2rDhBJt3">
<img src="https://img.shields.io/badge/-Discord-414EEC?style=flat-square&logo=discord&logoColor=white" />
</a>
<a href="https://www.npmjs.com/package/@maestro-org/typescript-sdk">
<img src="https://img.shields.io/npm/dm/typescript-sdk?style=flat-square&logo=npm&labelColor=black&color=pink&link=https%3A%2F%2F" />
</a>
</p>
</p>

# Getting Started

## Installation

### [NPM](https://www.npmjs.com/package/@maestro-org/typescript-sdk)
```bash
npm i @maestro-org/typescript-sdk
```

## Usage

```ts
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](https://dashboard.gomaestro.org/)!
* Network options: `Preview`, `Preprod`, `Mainnet`, `Sanchonet`

## Example

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

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

maestroClient.addresses
.utxosByAddress(
"aasdddr_test1qqe9k9zmswzx9h9vaaf49shun82t8nr52h0ptpgumzxjjqm6wlgjpw0gdtwuwwydhwcm6g6sfy9h69q2kg6q8p3jxdxsrrxrdm"
)
.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_test1qqe9k9zmswzx9h9vaaf49shun82t8nr52h0ptpgumzxjjqm6wlgjpw0gdtwuwwydhwcm6g6sfy9h69q2kg6q8p3jxdxsrrxrdm",
])
.then((x) => console.log(x.data));

```

# Documentation

* [Maestro public docs](https://docs.gomaestro.org/)
Expand Down
Loading

0 comments on commit 0baa6b9

Please sign in to comment.