Typescript SDK
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));