- balance - Get Balance
Get Balance
import { XApiScraper } from "@twexapi-dev/x-api-scraper";
const xApiScraper = new XApiScraper({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await xApiScraper.account.balance();
console.log(result);
}
run();The standalone function version of this method:
import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { accountBalance } from "@twexapi-dev/x-api-scraper/funcs/account-balance.js";
// Use `XApiScraperCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const xApiScraper = new XApiScraperCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await accountBalance(xApiScraper);
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("accountBalance failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.StandardResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.XAPIScraperDefaultError | 4XX, 5XX | */* |