Files
Rafael Cárdenas e348ac05b3 fix: domain migration (#1596) (#1597)
* fix(domain-migration): change `stacks.co` to `hiro.so` in toml files

* fix(domain-migration): change `stacks.co` to `hiro.so` in doc files

* chore: update api endpoint in generated client code

Co-authored-by: Matthew Little <zone117x@gmail.com>
2023-03-24 09:41:46 -06:00

30 lines
1.0 KiB
TypeScript

import fetch from 'cross-fetch';
import { Configuration, BlocksApi, SmartContractsApi, AccountsApi } from '../src/index';
(async () => {
const apiConfig = new Configuration({
fetchApi: fetch, // `fetch` lib must be specified in Node.js environments
basePath: 'https://api.mainnet.hiro.so', // defaults to http://localhost:3999
});
const blockApi = new BlocksApi(apiConfig);
const blocks = await blockApi.getBlockList({ offset: 0, limit: 10 });
const smartContractsApi = new SmartContractsApi(apiConfig);
const mapEntry = await smartContractsApi.getContractDataMapEntry({
contractAddress: 'ST000000000000000000002AMW42H',
contractName: 'pox',
mapName: 'reward-cycle-total-stacked',
key: '0x0c000000010c7265776172642d6379636c650100000000000000000000000000000001',
});
const accountsApi = new AccountsApi(apiConfig);
const txs = await accountsApi.getAccountTransactions({
principal: 'ST000000000000000000002AMW42H',
});
})().catch(e => {
console.error(e);
process.exit(1);
});