The following step make requires associated accounts transactions. For simplicity, let's run the faucet for the new account:
The following step make requires associated accounts transactions. For simplicity, let's run the faucet for the new account:
```js
```js
const faucets = new FaucetsApi(apiConfig);
async function runFaucetStx() {
const faucets = new FaucetsApi(apiConfig);
const faucetTx = await faucets.runFaucetStx({
const faucetTx = await faucets.runFaucetStx({
address: stacksAddress,
address: stacksAddress,
});
});
};
console.log(faucetTx);
console.log(faucetTx);
```
```
@ -141,11 +147,13 @@ The API will respond with a new transaction ID and confirmation that the faucet
Assuming the faucet transaction was successfully processed, you can review the account history. We are expecting at least one transactions to show up in the account history.
Assuming the faucet transaction was successfully processed, you can review the account history. We are expecting at least one transactions to show up in the account history.
```js
```js
const history = await accounts.getAccountTransactions({
async function getAccountTransactions() {
principal: stacksAddress,
const history = await accounts.getAccountTransactions({
});
principal: stacksAddress,
});
console.log(history);
console.log(history);
}
```
```
The API will respond with a paginatable list of transactions associated with the account:
The API will respond with a paginatable list of transactions associated with the account:
@ -198,11 +206,13 @@ To make API responses more compact, lists returned by the API are paginated. For
In order to paginate throughout the full result set, we can use the `limit` and `offset` request properties. Here is an example where we request transactions 50-100 for an account:
In order to paginate throughout the full result set, we can use the `limit` and `offset` request properties. Here is an example where we request transactions 50-100 for an account:
```js
```js
const history = await accounts.getAccountTransactions({
async function getAccountTransactions() {
principal: stacksAddress,
const history = await accounts.getAccountTransactions({
limit: 50,
principal: stacksAddress,
offset: 50,
limit: 50,
});
offset: 50,
});
}
```
```
## Step 5: Getting account balances
## Step 5: Getting account balances
@ -210,11 +220,13 @@ const history = await accounts.getAccountTransactions({
As mentioned above, any Stacks address can have a variety of tokens and associated balances. In order to get balances for all Stacks, fungible, and non-fungible tokens, we can use the `getAccountBalance` method:
As mentioned above, any Stacks address can have a variety of tokens and associated balances. In order to get balances for all Stacks, fungible, and non-fungible tokens, we can use the `getAccountBalance` method: