Skip to content

Commit 0baa6b9

Browse files
authored
Merge pull request #7 from maestro-org/release-v1
release v1
2 parents 5569863 + 45feffe commit 0baa6b9

File tree

4 files changed

+70
-4427
lines changed

4 files changed

+70
-4427
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,5 @@ dist
102102

103103
# TernJS port file
104104
.tern-port
105+
106+
package-lock.json

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,78 @@
1919
<a href="https://discord.gg/ES2rDhBJt3">
2020
<img src="https://img.shields.io/badge/-Discord-414EEC?style=flat-square&logo=discord&logoColor=white" />
2121
</a>
22+
<a href="https://www.npmjs.com/package/@maestro-org/typescript-sdk">
23+
<img src="https://img.shields.io/npm/dm/typescript-sdk?style=flat-square&logo=npm&labelColor=black&color=pink&link=https%3A%2F%2F" />
24+
</a>
2225
</p>
2326
</p>
2427

2528
# Getting Started
2629

30+
## Installation
31+
32+
### [NPM](https://www.npmjs.com/package/@maestro-org/typescript-sdk)
33+
```bash
34+
npm i @maestro-org/typescript-sdk
35+
```
36+
37+
## Usage
38+
39+
```ts
40+
import { MaestroClient, Configuration } from "@maestro-org/typescript-sdk";
41+
42+
let maestroClient = new MaestroClient(
43+
new Configuration({
44+
apiKey: "<PROJECT_API_KEY>",
45+
network: "Preprod",
46+
})
47+
);
48+
```
49+
* To generate an API key, create a free account [here](https://dashboard.gomaestro.org/)!
50+
* Network options: `Preview`, `Preprod`, `Mainnet`, `Sanchonet`
51+
52+
## Example
53+
54+
```ts
55+
import { MaestroClient, Configuration } from "@maestro-org/typescript-sdk";
56+
57+
let maestroClient = new MaestroClient(
58+
new Configuration({
59+
apiKey: "<PROJECT_API_KEY>",
60+
network: "Preprod",
61+
})
62+
);
63+
64+
maestroClient.addresses
65+
.utxosByAddress(
66+
"aasdddr_test1qqe9k9zmswzx9h9vaaf49shun82t8nr52h0ptpgumzxjjqm6wlgjpw0gdtwuwwydhwcm6g6sfy9h69q2kg6q8p3jxdxsrrxrdm"
67+
)
68+
.then((x) => console.log(x.data))
69+
.catch((error) => {
70+
if (error.response) {
71+
// The request was made and the server responded with a status code
72+
// that falls out of the range of 2xx
73+
console.log(error.response.data);
74+
console.log(error.response.status);
75+
console.log(error.response.headers);
76+
} else if (error.request) {
77+
// The request was made but no response was received
78+
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
79+
// http.ClientRequest in node.js
80+
console.log(error.request);
81+
} else {
82+
// Something happened in setting up the request that triggered an Error
83+
console.log("Error", error.message);
84+
}
85+
});
86+
maestroClient.addresses
87+
.utxosByAddresses([
88+
"addr_test1qqe9k9zmswzx9h9vaaf49shun82t8nr52h0ptpgumzxjjqm6wlgjpw0gdtwuwwydhwcm6g6sfy9h69q2kg6q8p3jxdxsrrxrdm",
89+
])
90+
.then((x) => console.log(x.data));
91+
92+
```
93+
2794
# Documentation
2895

2996
* [Maestro public docs](https://docs.gomaestro.org/)

0 commit comments

Comments
 (0)