diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..10b0bbc --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +support@gomaestro.org. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/package.json b/package.json index 1ced47c..f81b604 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@maestro-org/typescript-sdk", - "version": "1.1.2", + "version": "1.3.1", "description": "TypeScript SDK for the Maestro Dapp Platform", "main": "dist/index.js", "module": "dist/index.mjs", @@ -23,14 +23,12 @@ "author": "gomaestro.org", "license": "Apache-2.0", "devDependencies": { + "@changesets/cli": "^2.26.2", "@commitlint/cli": "^17.4.3", "@commitlint/config-conventional": "^17.4.3", "@typescript-eslint/eslint-plugin": "^5.59.1", "@typescript-eslint/parser": "^5.59.1", "commitlint": "^17.4.3", - "@changesets/cli": "^2.26.2", - "tsup": "^7.2.0", - "typescript": "^5.2.2", "eslint": "^8.39.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.8.0", @@ -38,10 +36,12 @@ "eslint-plugin-import": "^2.27.5", "eslint-plugin-prettier": "^4.2.1", "husky": "^8.0.3", - "prettier": "^2.8.8" + "prettier": "^2.8.8", + "tsup": "^7.2.0", + "typescript": "^5.2.2" }, "dependencies": { - "axios": "^1.5.0" + "axios": "^1.6.1" }, "lint-staged": { "src/**/*.{js,ts,},": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 52c867c..5fd7e04 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: dependencies: axios: - specifier: ^1.5.0 - version: 1.5.0 + specifier: ^1.6.1 + version: 1.6.1 devDependencies: '@changesets/cli': @@ -1146,10 +1146,10 @@ packages: engines: {node: '>= 0.4'} dev: true - /axios@1.5.0: - resolution: {integrity: sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==} + /axios@1.6.1: + resolution: {integrity: sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==} dependencies: - follow-redirects: 1.15.2 + follow-redirects: 1.15.3 form-data: 4.0.0 proxy-from-env: 1.1.0 transitivePeerDependencies: @@ -2058,8 +2058,8 @@ packages: resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} dev: true - /follow-redirects@1.15.2: - resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==} + /follow-redirects@1.15.3: + resolution: {integrity: sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==} engines: {node: '>=4.0'} peerDependencies: debug: '*' diff --git a/src/api/accounts/helpers.ts b/src/api/accounts/helpers.ts index bba46c2..c484cc1 100644 --- a/src/api/accounts/helpers.ts +++ b/src/api/accounts/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { assertParamExists, @@ -7,6 +7,7 @@ import { setSearchParams, toPathString, createRequestFunction, + HEADER_AMOUNTS_AS_STRING, } from '../../common'; import { Configuration } from '../../configuration'; import { @@ -17,6 +18,13 @@ import { PaginatedAccountReward, PaginatedAccountUpdate, } from '../type'; +import { + AccountAddressesQueryParams, + AccountAssetsQueryParams, + AccountHistoryQueryParams, + AccountRewardsQueryParams, + AccountUpdatesQueryParams, +} from './type'; /** * AccountsApi - axios parameter creator @@ -28,15 +36,13 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati * Returns a list of addresses seen on-chain which use the specified stake key * @summary Stake account addresses * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountAddressesQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ accountAddresses: async ( stakeAddr: string, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: AccountAddressesQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'stakeAddr' is not null or undefined @@ -51,19 +57,10 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -81,17 +78,13 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati * Returns a list of native assets which are owned by addresses with the specified stake key * @summary Stake account assets * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') - * @param {string | null} [policy] Filter results to only show assets of the specified policy - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountAssetsQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ accountAssets: async ( stakeAddr: string, - policy?: string | null, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: AccountAssetsQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'stakeAddr' is not null or undefined @@ -106,29 +99,17 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (policy !== undefined) { - localVarQueryParameter.policy = policy; - } - - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, }; return { @@ -140,17 +121,13 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati * Returns per-epoch history for the specified stake key * @summary Stake account history * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [epochNo] Fetch result for only a specific epoch - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountHistoryQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ accountHistory: async ( stakeAddr: string, - epochNo?: number | null, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: AccountHistoryQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'stakeAddr' is not null or undefined @@ -165,23 +142,10 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (epochNo !== undefined) { - localVarQueryParameter.epoch_no = epochNo; - } - - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -237,15 +201,13 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati * Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`) * @summary Stake account rewards * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountRewardsQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ accountRewards: async ( stakeAddr: string, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: AccountRewardsQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'stakeAddr' is not null or undefined @@ -260,19 +222,10 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -290,15 +243,13 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati * Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`) * @summary Stake account updates * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountUpdatesQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ accountUpdates: async ( stakeAddr: string, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: AccountUpdatesQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'stakeAddr' is not null or undefined @@ -313,19 +264,10 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -342,124 +284,122 @@ export const AccountsApiAxiosParamCreator = function (configuration: Configurati }; }; -/** - * AccountsApi - factory interface - * @export - */ -export const AccountsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = AccountsApiFp(configuration); - return { - /** - * Returns a list of addresses seen on-chain which use the specified stake key - * @summary Stake account addresses - * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountAddresses( - stakeAddr: string, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .accountAddresses(stakeAddr, count, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns a list of native assets which are owned by addresses with the specified stake key - * @summary Stake account assets - * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') - * @param {string | null} [policy] Filter results to only show assets of the specified policy - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountAssets( - stakeAddr: string, - policy?: string | null, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .accountAssets(stakeAddr, policy, count, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns per-epoch history for the specified stake key - * @summary Stake account history - * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [epochNo] Fetch result for only a specific epoch - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountHistory( - stakeAddr: string, - epochNo?: number | null, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .accountHistory(stakeAddr, epochNo, count, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns various information regarding a stake account - * @summary Stake account information - * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountInfo(stakeAddr: string, options?: any): AxiosPromise { - return localVarFp.accountInfo(stakeAddr, options).then((request) => request(axios, basePath)); - }, - /** - * Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`) - * @summary Stake account rewards - * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountRewards( - stakeAddr: string, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .accountRewards(stakeAddr, count, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`) - * @summary Stake account updates - * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - accountUpdates( - stakeAddr: string, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .accountUpdates(stakeAddr, count, cursor, options) - .then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * AccountsApi - factory interface +// * @export +// */ +// export const AccountsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = AccountsApiFp(configuration); +// return { +// /** +// * Returns a list of addresses seen on-chain which use the specified stake key +// * @summary Stake account addresses +// * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') +// * @param {AccountAddressesQueryParams} [queryParams] Query parameters. +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// accountAddresses( +// stakeAddr: string, +// queryParams: AccountAddressesQueryParams, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .accountAddresses(stakeAddr, queryParams, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of native assets which are owned by addresses with the specified stake key +// * @summary Stake account assets +// * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') +// * @param {string | null} [policy] Filter results to only show assets of the specified policy +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// accountAssets( +// stakeAddr: string, +// policy?: string | null, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .accountAssets(stakeAddr, policy, count, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns per-epoch history for the specified stake key +// * @summary Stake account history +// * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') +// * @param {number | null} [epochNo] Fetch result for only a specific epoch +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// accountHistory( +// stakeAddr: string, +// epochNo?: number | null, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .accountHistory(stakeAddr, epochNo, count, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns various information regarding a stake account +// * @summary Stake account information +// * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// accountInfo(stakeAddr: string, options?: any): AxiosPromise { +// return localVarFp.accountInfo(stakeAddr, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`) +// * @summary Stake account rewards +// * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// accountRewards( +// stakeAddr: string, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .accountRewards(stakeAddr, count, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`) +// * @summary Stake account updates +// * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// accountUpdates( +// stakeAddr: string, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .accountUpdates(stakeAddr, count, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// }; +// }; /** * AccountsApi - functional programming interface @@ -472,76 +412,49 @@ export const AccountsApiFp = function (configuration: Configuration) { * Returns a list of addresses seen on-chain which use the specified stake key * @summary Stake account addresses * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountAddressesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async accountAddresses( stakeAddr: string, - count?: number | null, - cursor?: string | null, + queryParams?: AccountAddressesQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.accountAddresses( - stakeAddr, - count, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.accountAddresses(stakeAddr, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of native assets which are owned by addresses with the specified stake key * @summary Stake account assets * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') - * @param {string | null} [policy] Filter results to only show assets of the specified policy - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountAssetsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async accountAssets( stakeAddr: string, - policy?: string | null, - count?: number | null, - cursor?: string | null, + queryParams?: AccountAssetsQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.accountAssets( - stakeAddr, - policy, - count, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.accountAssets(stakeAddr, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns per-epoch history for the specified stake key * @summary Stake account history * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [epochNo] Fetch result for only a specific epoch - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountHistoryQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async accountHistory( stakeAddr: string, - epochNo?: number | null, - count?: number | null, - cursor?: string | null, + queryParams?: AccountHistoryQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.accountHistory( - stakeAddr, - epochNo, - count, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.accountHistory(stakeAddr, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns various information regarding a stake account @@ -555,43 +468,39 @@ export const AccountsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.accountInfo(stakeAddr, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`) * @summary Stake account rewards * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountRewardsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async accountRewards( stakeAddr: string, - count?: number | null, - cursor?: string | null, + queryParams?: AccountRewardsQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.accountRewards(stakeAddr, count, cursor, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.accountRewards(stakeAddr, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`) * @summary Stake account updates * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountUpdatesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async accountUpdates( stakeAddr: string, - count?: number | null, - cursor?: string | null, + queryParams?: AccountUpdatesQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.accountUpdates(stakeAddr, count, cursor, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.accountUpdates(stakeAddr, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; diff --git a/src/api/accounts/index.ts b/src/api/accounts/index.ts index 2f4d259..7165119 100644 --- a/src/api/accounts/index.ts +++ b/src/api/accounts/index.ts @@ -1,6 +1,13 @@ import { AxiosRequestConfig } from 'axios'; import { BaseAPI } from '../../base'; import { AccountsApiFp } from './helpers'; +import { + AccountAddressesQueryParams, + AccountAssetsQueryParams, + AccountHistoryQueryParams, + AccountRewardsQueryParams, + AccountUpdatesQueryParams, +} from './type'; /** * AccountsApi - object-oriented interface @@ -13,67 +20,49 @@ export class AccountsApi extends BaseAPI { * Returns a list of addresses seen on-chain which use the specified stake key * @summary Stake account addresses * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountAddressesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AccountsApi */ public accountAddresses( stakeAddr: string, - count?: number | null, - cursor?: string | null, + queryParams?: AccountAddressesQueryParams, options?: AxiosRequestConfig, ) { return AccountsApiFp(this.configuration) - .accountAddresses(stakeAddr, count, cursor, options) - .then((request) => request(this.axios)); + .accountAddresses(stakeAddr, queryParams, options) + .then((request) => request()); } /** * Returns a list of native assets which are owned by addresses with the specified stake key * @summary Stake account assets * @param {string} stakeAddr Bech32 encoded reward/stake address (\'stake1...\') - * @param {string | null} [policy] Filter results to only show assets of the specified policy - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountAssetsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AccountsApi */ - public accountAssets( - stakeAddr: string, - policy?: string | null, - count?: number | null, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public accountAssets(stakeAddr: string, queryParams?: AccountAssetsQueryParams, options?: AxiosRequestConfig) { return AccountsApiFp(this.configuration) - .accountAssets(stakeAddr, policy, count, cursor, options) - .then((request) => request(this.axios)); + .accountAssets(stakeAddr, queryParams, options) + .then((request) => request()); } /** * Returns per-epoch history for the specified stake key * @summary Stake account history * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [epochNo] Fetch result for only a specific epoch - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountHistoryQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AccountsApi */ - public accountHistory( - stakeAddr: string, - epochNo?: number | null, - count?: number | null, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public accountHistory(stakeAddr: string, queryParams?: AccountHistoryQueryParams, options?: AxiosRequestConfig) { return AccountsApiFp(this.configuration) - .accountHistory(stakeAddr, epochNo, count, cursor, options) - .then((request) => request(this.axios)); + .accountHistory(stakeAddr, queryParams, options) + .then((request) => request()); } /** @@ -87,48 +76,38 @@ export class AccountsApi extends BaseAPI { public accountInfo(stakeAddr: string, options?: AxiosRequestConfig) { return AccountsApiFp(this.configuration) .accountInfo(stakeAddr, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** * Returns a list of staking-related rewards for the specified stake key (pool `member` or `leader` rewards, deposit `refund`) * @summary Stake account rewards * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountRewardsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AccountsApi */ - public accountRewards( - stakeAddr: string, - count?: number | null, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public accountRewards(stakeAddr: string, queryParams?: AccountRewardsQueryParams, options?: AxiosRequestConfig) { return AccountsApiFp(this.configuration) - .accountRewards(stakeAddr, count, cursor, options) - .then((request) => request(this.axios)); + .accountRewards(stakeAddr, queryParams, options) + .then((request) => request()); } /** * Returns a list of updates relating to the specified stake key ( `registration`, `deregistration`, `delegation`, `withdrawal`) * @summary Stake account updates * @param {string} stakeAddr Bech32 encoded stake/reward address (\'stake1...\') - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AccountUpdatesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AccountsApi */ - public accountUpdates( - stakeAddr: string, - count?: number | null, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public accountUpdates(stakeAddr: string, queryParams?: AccountUpdatesQueryParams, options?: AxiosRequestConfig) { return AccountsApiFp(this.configuration) - .accountUpdates(stakeAddr, count, cursor, options) - .then((request) => request(this.axios)); + .accountUpdates(stakeAddr, queryParams, options) + .then((request) => request()); } } + +export * from './type'; diff --git a/src/api/accounts/type.ts b/src/api/accounts/type.ts new file mode 100644 index 0000000..e2b9d09 --- /dev/null +++ b/src/api/accounts/type.ts @@ -0,0 +1,116 @@ +/** + * Query parameters for accountAddresses. + * @export + * @interface AccountAddressesQueryParams + * + */ +export interface AccountAddressesQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof AccountAddressesQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof AccountAddressesQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for accountAssets. + * @export + * @interface AccountAssetsQueryParams + * + */ +export interface AccountAssetsQueryParams { + /** + * Filter results to only show assets of the specified policy + * @type {string | null} + * @memberof AccountAssetsQueryParams + */ + policy?: string | null; + /** + * The max number of results per page. + * @type {number | null} + * @memberof AccountAssetsQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof AccountAssetsQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for accountHistory. + * @export + * @interface AccountHistoryQueryParams + * + */ +export interface AccountHistoryQueryParams { + /** + * Fetch result for only a specific epoch + * @type {string | null} + * @memberof AccountHistoryQueryParams + */ + epochNo?: number | null; + /** + * The max number of results per page. + * @type {number | null} + * @memberof AccountHistoryQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof AccountHistoryQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for accountRewards. + * @export + * @interface AccountRewardsQueryParams + * + */ +export interface AccountRewardsQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof AccountRewardsQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof AccountRewardsQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for accountUpdates. + * @export + * @interface AccountUpdatesQueryParams + * + */ +export interface AccountUpdatesQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof AccountUpdatesQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof AccountUpdatesQueryParams + */ + cursor?: string | null; +} diff --git a/src/api/addresses/helpers.ts b/src/api/addresses/helpers.ts index 742cf38..148bba1 100644 --- a/src/api/addresses/helpers.ts +++ b/src/api/addresses/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { assertParamExists, @@ -8,6 +8,7 @@ import { toPathString, serializeDataIfNeeded, createRequestFunction, + HEADER_AMOUNTS_AS_STRING, } from '../../common'; import { Configuration } from '../../configuration'; import { @@ -19,11 +20,12 @@ import { PaginatedUtxoWithSlot, } from '../type'; import { - TxsByAddressOrderEnum, - TxsByPaymentCredOrderEnum, - UtxoRefsAtAddressOrderEnum, - UtxosByAddressOrderEnum, - UtxosByPaymentCredOrderEnum, + TxsByAddressQueryParams, + TxsByPaymentCredQueryParams, + UtxoRefsAtAddressQueryParams, + UtxosByAddressQueryParams, + UtxosByAddressesQueryParams, + UtxosByPaymentCredQueryParams, } from './type'; /** @@ -112,21 +114,13 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat * Returns transactions in which the specified address spent or received funds. Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). * @summary Address transactions * @param {string} address Address in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {TxsByAddressOrderEnum} [order] The order in which the results are sorted, by transaction age) - * @param {number | null} [from] Return only transactions minted on or after a specific slot - * @param {number | null} [to] Return only transactions minted on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {TxsByAddressQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ txsByAddress: async ( address: string, - count?: number | null, - order?: TxsByAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + localVarQueryParameter?: TxsByAddressQueryParams, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'address' is not null or undefined @@ -141,31 +135,10 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (from !== undefined) { - localVarQueryParameter.from = from; - } - - if (to !== undefined) { - localVarQueryParameter.to = to; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -183,21 +156,13 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat * Returns transactions in which the specified payment credential spent or received funds. Specifically, the transactions where: the payment credential was used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). * @summary Payment credential transactions * @param {string} credential Payment credential in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {TxsByPaymentCredOrderEnum} [order] The order in which the results are sorted, by transaction age) - * @param {number | null} [from] Return only transactions minted on or after a specific slot - * @param {number | null} [to] Return only transactions minted on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {TxsByPaymentCredQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ txsByPaymentCred: async ( credential: string, - count?: number | null, - order?: TxsByPaymentCredOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + localVarQueryParameter: TxsByPaymentCredQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'credential' is not null or undefined @@ -212,31 +177,10 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (from !== undefined) { - localVarQueryParameter.from = from; - } - - if (to !== undefined) { - localVarQueryParameter.to = to; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -254,21 +198,13 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat * Returns references (pair of transaction hash and output index in transaction) for UTxOs controlled by the specified address * @summary UTxO references at an address * @param {string} address Address in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {UtxoRefsAtAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxoRefsAtAddressQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ utxoRefsAtAddress: async ( address: string, - count?: number | null, - order?: UtxoRefsAtAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + localVarQueryParameter: UtxoRefsAtAddressQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'address' is not null or undefined @@ -283,31 +219,10 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (from !== undefined) { - localVarQueryParameter.from = from; - } - - if (to !== undefined) { - localVarQueryParameter.to = to; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -325,25 +240,13 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat * Return detailed information on UTxOs controlled by an address * @summary UTxOs at an address * @param {string} address Address in bech32 format - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {UtxosByAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxosByAddressQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ utxosByAddress: async ( address: string, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - order?: UtxosByAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + localVarQueryParameter: UtxosByAddressQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'address' is not null or undefined @@ -358,45 +261,17 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (resolveDatums !== undefined) { - localVarQueryParameter.resolve_datums = resolveDatums; - } - - if (withCbor !== undefined) { - localVarQueryParameter.with_cbor = withCbor; - } - - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (from !== undefined) { - localVarQueryParameter.from = from; - } - - if (to !== undefined) { - localVarQueryParameter.to = to; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, }; return { @@ -408,19 +283,13 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat * Return detailed information on UTxOs which are controlled by some address in the specified list of addresses * @summary UTxOs at multiple addresses * @param {Array} requestBody - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxosByAddressesQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ utxosByAddresses: async ( requestBody: Array, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: UtxosByAddressesQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'requestBody' is not null or undefined @@ -432,27 +301,10 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (resolveDatums !== undefined) { - localVarQueryParameter.resolve_datums = resolveDatums; - } - - if (withCbor !== undefined) { - localVarQueryParameter.with_cbor = withCbor; - } - - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -461,6 +313,7 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, }; localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); @@ -473,25 +326,13 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat * Return detailed information on UTxOs controlled by addresses which use the specified payment credential * @summary UTxOs by payment credential * @param {string} credential Payment credential in bech32 format - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {UtxosByPaymentCredOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxosByPaymentCredQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ utxosByPaymentCred: async ( credential: string, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - order?: UtxosByPaymentCredOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + localVarQueryParameter: UtxosByPaymentCredQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'credential' is not null or undefined @@ -506,38 +347,51 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (resolveDatums !== undefined) { - localVarQueryParameter.resolve_datums = resolveDatums; - } - - if (withCbor !== undefined) { - localVarQueryParameter.with_cbor = withCbor; - } - - if (count !== undefined) { - localVarQueryParameter.count = count; - } + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, + }; - if (order !== undefined) { - localVarQueryParameter.order = order; - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Return detailed information on UTxOs which are controlled by some payment credentials in the specified list of payment credentials + * @summary UTxOs at multiple payment credentials + * @param {Array} requestBody + * @param {UtxosByAddressesQueryParams} [localVarQueryParameter] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + utxosByPaymentCreds: async ( + requestBody: Array, + localVarQueryParameter: UtxosByAddressesQueryParams = {}, + options: AxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'requestBody' is not null or undefined + assertParamExists('utxosByPaymentCreds', 'requestBody', requestBody); + const localVarPath = `/addresses/cred/utxos`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; - if (from !== undefined) { - localVarQueryParameter.from = from; - } + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as any; - if (to !== undefined) { - localVarQueryParameter.to = to; - } + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } + localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; @@ -545,7 +399,9 @@ export const AddressesApiAxiosParamCreator = function (configuration: Configurat ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, }; + localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); return { url: toPathString(localVarUrlObj), @@ -574,7 +430,7 @@ export const AddressesApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.decodeAddress(address, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns the number of transactions in which the address spent or received some funds. Specifically, the number of transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). @@ -588,394 +444,321 @@ export const AddressesApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.txCountByAddress(address, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns transactions in which the specified address spent or received funds. Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). * @summary Address transactions * @param {string} address Address in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {TxsByAddressOrderEnum} [order] The order in which the results are sorted, by transaction age) - * @param {number | null} [from] Return only transactions minted on or after a specific slot - * @param {number | null} [to] Return only transactions minted on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {TxsByAddressQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async txsByAddress( address: string, - count?: number | null, - order?: TxsByAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + queryParams?: TxsByAddressQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.txsByAddress( - address, - count, - order, - from, - to, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.txsByAddress(address, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns transactions in which the specified payment credential spent or received funds. Specifically, the transactions where: the payment credential was used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). * @summary Payment credential transactions * @param {string} credential Payment credential in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {TxsByPaymentCredOrderEnum} [order] The order in which the results are sorted, by transaction age) - * @param {number | null} [from] Return only transactions minted on or after a specific slot - * @param {number | null} [to] Return only transactions minted on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {TxsByPaymentCredQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async txsByPaymentCred( credential: string, - count?: number | null, - order?: TxsByPaymentCredOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + queryParams?: TxsByPaymentCredQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.txsByPaymentCred( credential, - count, - order, - from, - to, - cursor, + queryParams, options, ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns references (pair of transaction hash and output index in transaction) for UTxOs controlled by the specified address * @summary UTxO references at an address * @param {string} address Address in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {UtxoRefsAtAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxoRefsAtAddressQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async utxoRefsAtAddress( address: string, - count?: number | null, - order?: UtxoRefsAtAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + queryParams?: UtxoRefsAtAddressQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.utxoRefsAtAddress( - address, - count, - order, - from, - to, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.utxoRefsAtAddress(address, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Return detailed information on UTxOs controlled by an address * @summary UTxOs at an address * @param {string} address Address in bech32 format - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {UtxosByAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxosByAddressQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async utxosByAddress( address: string, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - order?: UtxosByAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + queryParams?: UtxosByAddressQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.utxosByAddress( - address, - resolveDatums, - withCbor, - count, - order, - from, - to, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.utxosByAddress(address, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Return detailed information on UTxOs which are controlled by some address in the specified list of addresses * @summary UTxOs at multiple addresses * @param {Array} requestBody - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxosByAddressesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async utxosByAddresses( requestBody: Array, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - cursor?: string | null, + queryParams?: UtxosByAddressesQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.utxosByAddresses( requestBody, - resolveDatums, - withCbor, - count, - cursor, + queryParams, options, ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Return detailed information on UTxOs controlled by addresses which use the specified payment credential * @summary UTxOs by payment credential * @param {string} credential Payment credential in bech32 format - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {UtxosByPaymentCredOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxosByPaymentCredQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async utxosByPaymentCred( credential: string, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - order?: UtxosByPaymentCredOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + queryParams?: UtxosByPaymentCredQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.utxosByPaymentCred( credential, - resolveDatums, - withCbor, - count, - order, - from, - to, - cursor, + queryParams, options, ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); - }, - }; -}; - -/** - * AddressesApi - factory interface - * @export - */ -export const AddressesApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = AddressesApiFp(configuration); - return { - /** - * Returns the different information encoded within a Cardano address, including details of the payment and delegation parts of the address - * @summary Decode address - * @param {string} address Address in bech32/hex/base58 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - decodeAddress(address: string, options?: any): AxiosPromise { - return localVarFp.decodeAddress(address, options).then((request) => request(axios, basePath)); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** - * Returns the number of transactions in which the address spent or received some funds. Specifically, the number of transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). - * @summary Address transaction count - * @param {string} address Address in bech32 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txCountByAddress(address: string, options?: any): AxiosPromise { - return localVarFp.txCountByAddress(address, options).then((request) => request(axios, basePath)); - }, - /** - * Returns transactions in which the specified address spent or received funds. Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). - * @summary Address transactions - * @param {string} address Address in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {TxsByAddressOrderEnum} [order] The order in which the results are sorted, by transaction age) - * @param {number | null} [from] Return only transactions minted on or after a specific slot - * @param {number | null} [to] Return only transactions minted on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txsByAddress( - address: string, - count?: number | null, - order?: TxsByAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .txsByAddress(address, count, order, from, to, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns transactions in which the specified payment credential spent or received funds. Specifically, the transactions where: the payment credential was used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). - * @summary Payment credential transactions - * @param {string} credential Payment credential in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {TxsByPaymentCredOrderEnum} [order] The order in which the results are sorted, by transaction age) - * @param {number | null} [from] Return only transactions minted on or after a specific slot - * @param {number | null} [to] Return only transactions minted on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txsByPaymentCred( - credential: string, - count?: number | null, - order?: TxsByPaymentCredOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .txsByPaymentCred(credential, count, order, from, to, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns references (pair of transaction hash and output index in transaction) for UTxOs controlled by the specified address - * @summary UTxO references at an address - * @param {string} address Address in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {UtxoRefsAtAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - utxoRefsAtAddress( - address: string, - count?: number | null, - order?: UtxoRefsAtAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .utxoRefsAtAddress(address, count, order, from, to, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Return detailed information on UTxOs controlled by an address - * @summary UTxOs at an address - * @param {string} address Address in bech32 format - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {UtxosByAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - utxosByAddress( - address: string, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - order?: UtxosByAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .utxosByAddress(address, resolveDatums, withCbor, count, order, from, to, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Return detailed information on UTxOs which are controlled by some address in the specified list of addresses - * @summary UTxOs at multiple addresses + * Return detailed information on UTxOs which are controlled by some payment credentials in the specified list of payment credentials + * @summary UTxOs at multiple payment credentials * @param {Array} requestBody - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxosByAddressesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - utxosByAddresses( + async utxosByPaymentCreds( requestBody: Array, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .utxosByAddresses(requestBody, resolveDatums, withCbor, count, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Return detailed information on UTxOs controlled by addresses which use the specified payment credential - * @summary UTxOs by payment credential - * @param {string} credential Payment credential in bech32 format - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {UtxosByPaymentCredOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - utxosByPaymentCred( - credential: string, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - order?: UtxosByPaymentCredOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .utxosByPaymentCred(credential, resolveDatums, withCbor, count, order, from, to, cursor, options) - .then((request) => request(axios, basePath)); + queryParams?: UtxosByAddressesQueryParams, + options?: AxiosRequestConfig, + ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.utxosByPaymentCreds( + requestBody, + queryParams, + options, + ); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; + +// /** +// * AddressesApi - factory interface +// * @export +// */ +// export const AddressesApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = AddressesApiFp(configuration); +// return { +// /** +// * Returns the different information encoded within a Cardano address, including details of the payment and delegation parts of the address +// * @summary Decode address +// * @param {string} address Address in bech32/hex/base58 format +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// decodeAddress(address: string, options?: any): AxiosPromise { +// return localVarFp.decodeAddress(address, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns the number of transactions in which the address spent or received some funds. Specifically, the number of transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). +// * @summary Address transaction count +// * @param {string} address Address in bech32 format +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txCountByAddress(address: string, options?: any): AxiosPromise { +// return localVarFp.txCountByAddress(address, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns transactions in which the specified address spent or received funds. Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). +// * @summary Address transactions +// * @param {string} address Address in bech32 format +// * @param {number | null} [count] The max number of results per page +// * @param {TxsByAddressOrderEnum} [order] The order in which the results are sorted, by transaction age) +// * @param {number | null} [from] Return only transactions minted on or after a specific slot +// * @param {number | null} [to] Return only transactions minted on or before a specific slot +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txsByAddress( +// address: string, +// count?: number | null, +// order?: TxsByAddressOrderEnum, +// from?: number | null, +// to?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .txsByAddress(address, count, order, from, to, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns transactions in which the specified payment credential spent or received funds. Specifically, the transactions where: the payment credential was used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). +// * @summary Payment credential transactions +// * @param {string} credential Payment credential in bech32 format +// * @param {number | null} [count] The max number of results per page +// * @param {TxsByPaymentCredOrderEnum} [order] The order in which the results are sorted, by transaction age) +// * @param {number | null} [from] Return only transactions minted on or after a specific slot +// * @param {number | null} [to] Return only transactions minted on or before a specific slot +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txsByPaymentCred( +// credential: string, +// count?: number | null, +// order?: TxsByPaymentCredOrderEnum, +// from?: number | null, +// to?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .txsByPaymentCred(credential, count, order, from, to, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns references (pair of transaction hash and output index in transaction) for UTxOs controlled by the specified address +// * @summary UTxO references at an address +// * @param {string} address Address in bech32 format +// * @param {number | null} [count] The max number of results per page +// * @param {UtxoRefsAtAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) +// * @param {number | null} [from] Return only UTxOs created on or after a specific slot +// * @param {number | null} [to] Return only UTxOs created before a specific slot +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// utxoRefsAtAddress( +// address: string, +// count?: number | null, +// order?: UtxoRefsAtAddressOrderEnum, +// from?: number | null, +// to?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .utxoRefsAtAddress(address, count, order, from, to, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Return detailed information on UTxOs controlled by an address +// * @summary UTxOs at an address +// * @param {string} address Address in bech32 format +// * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes +// * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response +// * @param {number | null} [count] The max number of results per page +// * @param {UtxosByAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) +// * @param {number | null} [from] Return only UTxOs created on or after a specific slot +// * @param {number | null} [to] Return only UTxOs created before a specific slot +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// utxosByAddress( +// address: string, +// resolveDatums?: boolean | null, +// withCbor?: boolean | null, +// count?: number | null, +// order?: UtxosByAddressOrderEnum, +// from?: number | null, +// to?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .utxosByAddress(address, resolveDatums, withCbor, count, order, from, to, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Return detailed information on UTxOs which are controlled by some address in the specified list of addresses +// * @summary UTxOs at multiple addresses +// * @param {Array} requestBody +// * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes +// * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// utxosByAddresses( +// requestBody: Array, +// resolveDatums?: boolean | null, +// withCbor?: boolean | null, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .utxosByAddresses(requestBody, resolveDatums, withCbor, count, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Return detailed information on UTxOs controlled by addresses which use the specified payment credential +// * @summary UTxOs by payment credential +// * @param {string} credential Payment credential in bech32 format +// * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes +// * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response +// * @param {number | null} [count] The max number of results per page +// * @param {UtxosByPaymentCredOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) +// * @param {number | null} [from] Return only UTxOs created on or after a specific slot +// * @param {number | null} [to] Return only UTxOs created on or before a specific slot +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// utxosByPaymentCred( +// credential: string, +// resolveDatums?: boolean | null, +// withCbor?: boolean | null, +// count?: number | null, +// order?: UtxosByPaymentCredOrderEnum, +// from?: number | null, +// to?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .utxosByPaymentCred(credential, resolveDatums, withCbor, count, order, from, to, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/addresses/index.ts b/src/api/addresses/index.ts index e62e9c1..4e5f469 100644 --- a/src/api/addresses/index.ts +++ b/src/api/addresses/index.ts @@ -2,11 +2,11 @@ import { AxiosRequestConfig } from 'axios'; import { BaseAPI } from '../../base'; import { AddressesApiFp } from './helpers'; import { - TxsByAddressOrderEnum, - TxsByPaymentCredOrderEnum, - UtxoRefsAtAddressOrderEnum, - UtxosByAddressOrderEnum, - UtxosByPaymentCredOrderEnum, + TxsByAddressQueryParams, + TxsByPaymentCredQueryParams, + UtxosByAddressQueryParams, + UtxosByAddressesQueryParams, + UtxosByPaymentCredQueryParams, } from './type'; /** @@ -27,7 +27,7 @@ export class AddressesApi extends BaseAPI { public decodeAddress(address: string, options?: AxiosRequestConfig) { return AddressesApiFp(this.configuration) .decodeAddress(address, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -41,174 +41,129 @@ export class AddressesApi extends BaseAPI { public txCountByAddress(address: string, options?: AxiosRequestConfig) { return AddressesApiFp(this.configuration) .txCountByAddress(address, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** * Returns transactions in which the specified address spent or received funds. Specifically, the transactions where: the address controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). * @summary Address transactions * @param {string} address Address in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {TxsByAddressOrderEnum} [order] The order in which the results are sorted, by transaction age) - * @param {number | null} [from] Return only transactions minted on or after a specific slot - * @param {number | null} [to] Return only transactions minted on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {TxsByAddressQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ - public txsByAddress( - address: string, - count?: number | null, - order?: TxsByAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public txsByAddress(address: string, queryParams?: TxsByAddressQueryParams, options?: AxiosRequestConfig) { return AddressesApiFp(this.configuration) - .txsByAddress(address, count, order, from, to, cursor, options) - .then((request) => request(this.axios)); + .txsByAddress(address, queryParams, options) + .then((request) => request()); } /** * Returns transactions in which the specified payment credential spent or received funds. Specifically, the transactions where: the payment credential was used in an address which controlled at least one of the transaction inputs and/or receives one of the outputs AND the transaction is phase-2 valid, OR, the address controlled at least one of the collateral inputs and/or receives the collateral return output AND the transaction is phase-2 invalid. [Read more](https://docs.cardano.org/plutus/collateral-mechanism/). * @summary Payment credential transactions * @param {string} credential Payment credential in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {TxsByPaymentCredOrderEnum} [order] The order in which the results are sorted, by transaction age) - * @param {number | null} [from] Return only transactions minted on or after a specific slot - * @param {number | null} [to] Return only transactions minted on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {TxsByPaymentCredQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ public txsByPaymentCred( credential: string, - count?: number | null, - order?: TxsByPaymentCredOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + queryParams?: TxsByPaymentCredQueryParams, options?: AxiosRequestConfig, ) { return AddressesApiFp(this.configuration) - .txsByPaymentCred(credential, count, order, from, to, cursor, options) - .then((request) => request(this.axios)); + .txsByPaymentCred(credential, queryParams, options) + .then((request) => request()); } /** * Returns references (pair of transaction hash and output index in transaction) for UTxOs controlled by the specified address * @summary UTxO references at an address * @param {string} address Address in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {UtxoRefsAtAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxoRefsAtAddressQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ - public utxoRefsAtAddress( - address: string, - count?: number | null, - order?: UtxoRefsAtAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public utxoRefsAtAddress(address: string, queryParams?: TxsByPaymentCredQueryParams, options?: AxiosRequestConfig) { return AddressesApiFp(this.configuration) - .utxoRefsAtAddress(address, count, order, from, to, cursor, options) - .then((request) => request(this.axios)); + .utxoRefsAtAddress(address, queryParams, options) + .then((request) => request()); } /** * Return detailed information on UTxOs controlled by an address * @summary UTxOs at an address * @param {string} address Address in bech32 format - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {UtxosByAddressOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxosByAddressQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ - public utxosByAddress( - address: string, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - order?: UtxosByAddressOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public utxosByAddress(address: string, queryParams?: UtxosByAddressQueryParams, options?: AxiosRequestConfig) { return AddressesApiFp(this.configuration) - .utxosByAddress(address, resolveDatums, withCbor, count, order, from, to, cursor, options) - .then((request) => request(this.axios)); + .utxosByAddress(address, queryParams, options) + .then((request) => request()); } /** * Return detailed information on UTxOs which are controlled by some address in the specified list of addresses * @summary UTxOs at multiple addresses * @param {Array} requestBody - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxosByAddressesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ public utxosByAddresses( requestBody: Array, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - cursor?: string | null, + queryParams?: UtxosByAddressesQueryParams, options?: AxiosRequestConfig, ) { return AddressesApiFp(this.configuration) - .utxosByAddresses(requestBody, resolveDatums, withCbor, count, cursor, options) - .then((request) => request(this.axios)); + .utxosByAddresses(requestBody, queryParams, options) + .then((request) => request()); } /** * Return detailed information on UTxOs controlled by addresses which use the specified payment credential * @summary UTxOs by payment credential * @param {string} credential Payment credential in bech32 format - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encodings of the transaction outputs in the response - * @param {number | null} [count] The max number of results per page - * @param {UtxosByPaymentCredOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created on or before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {UtxosByPaymentCredQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AddressesApi */ public utxosByPaymentCred( credential: string, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - count?: number | null, - order?: UtxosByPaymentCredOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + queryParams?: UtxosByPaymentCredQueryParams, options?: AxiosRequestConfig, ) { return AddressesApiFp(this.configuration) - .utxosByPaymentCred(credential, resolveDatums, withCbor, count, order, from, to, cursor, options) - .then((request) => request(this.axios)); + .utxosByPaymentCred(credential, queryParams, options) + .then((request) => request()); + } + + /** + * Return detailed information on UTxOs which are controlled by some payment creds in the specified list of payment creds + * @summary UTxOs at multiple payment creds + * @param {Array} requestBody + * @param {UtxosByAddressesQueryParams} [queryParams] Query parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AddressesApi + */ + public utxosByPaymentCreds( + requestBody: Array, + queryParams?: UtxosByAddressesQueryParams, + options?: AxiosRequestConfig, + ) { + return AddressesApiFp(this.configuration) + .utxosByPaymentCreds(requestBody, queryParams, options) + .then((request) => request()); } } + +export * from './type'; diff --git a/src/api/addresses/type.ts b/src/api/addresses/type.ts index b2edf56..33ba2e6 100644 --- a/src/api/addresses/type.ts +++ b/src/api/addresses/type.ts @@ -39,3 +39,267 @@ export const UtxosByPaymentCredOrderEnum = { } as const; export type UtxosByPaymentCredOrderEnum = (typeof UtxosByPaymentCredOrderEnum)[keyof typeof UtxosByPaymentCredOrderEnum]; + +/** + * Query parameters for txsByAddress. + * @export + * @interface TxsByAddressQueryParams + * + */ +export interface TxsByAddressQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof TxsByAddressQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted, by transaction age + * @type {TxsByAddressOrderEnum} + * @memberof TxsByAddressQueryParams + */ + order?: TxsByAddressOrderEnum; + /** + * Return only transactions minted on or after a specific slot + * @type {number | null} + * @memberof TxsByAddressQueryParams + */ + from?: number | null; + /** + * Return only transactions minted on or before a specific slot + * @type {number | null} + * @memberof TxsByAddressQueryParams + */ + to?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof TxsByAddressQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for txsByPaymentCred. + * @export + * @interface TxsByPaymentCredQueryParams + * + */ +export interface TxsByPaymentCredQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof TxsByPaymentCredQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted, by transaction age + * @type {TxsByPaymentCredOrderEnum} + * @memberof TxsByPaymentCredQueryParams + */ + order?: TxsByPaymentCredOrderEnum; + /** + * Return only transactions minted on or after a specific slot + * @type {number | null} + * @memberof TxsByPaymentCredQueryParams + */ + from?: number | null; + /** + * Return only transactions minted on or before a specific slot + * @type {number | null} + * @memberof TxsByPaymentCredQueryParams + */ + to?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof TxsByPaymentCredQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for utxoRefsAtAddress. + * @export + * @interface UtxoRefsAtAddressQueryParams + * + */ +export interface UtxoRefsAtAddressQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof UtxoRefsAtAddressQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted (by slot at which UTxO was produced) + * @type {UtxoRefsAtAddressOrderEnum} + * @memberof UtxoRefsAtAddressQueryParams + */ + order?: UtxoRefsAtAddressOrderEnum; + /** + * Return only UTxOs created on or after a specific slot + * @type {number | null} + * @memberof UtxoRefsAtAddressQueryParams + */ + from?: number | null; + /** + * Return only UTxOs created before a specific slot + * @type {number | null} + * @memberof UtxoRefsAtAddressQueryParams + */ + to?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof UtxoRefsAtAddressQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for utxosByAddress. + * @export + * @interface UtxosByAddressQueryParams + * + */ +export interface UtxosByAddressQueryParams { + /** + * Return only UTxOs which contain some of a specific asset (asset formatted as concatenation of hex encoded policy and asset name) + * @type {string | null} + * @memberof UtxosByAddressQueryParams + */ + asset?: string | null; + /** + * Try find and include the corresponding datums for datum hashes + * @type {boolean | null} + * @memberof UtxosByAddressQueryParams + */ + resolveDatums?: boolean | null; + /** + * Include the CBOR encodings of the transaction outputs in the response + * @type {boolean | null} + * @memberof UtxosByAddressQueryParams + */ + withCbor?: boolean | null; + /** + * The max number of results per page. + * @type {number | null} + * @memberof UtxosByAddressQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted (by slot at which UTxO was produced) + * @type {UtxosByAddressOrderEnum} + * @memberof UtxosByAddressQueryParams + */ + order?: UtxosByAddressOrderEnum; + /** + * Return only UTxOs created on or after a specific slot + * @type {number | null} + * @memberof UtxosByAddressQueryParams + */ + from?: number | null; + /** + * Return only UTxOs created before a specific slot + * @type {number | null} + * @memberof UtxosByAddressQueryParams + */ + to?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof UtxosByAddressQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for utxosByAddresses. + * @export + * @interface UtxosByAddressesQueryParams + * + */ +export interface UtxosByAddressesQueryParams { + /** + * Try find and include the corresponding datums for datum hashes + * @type {boolean | null} + * @memberof UtxosByAddressesQueryParams + */ + resolveDatums?: boolean | null; + /** + * Include the CBOR encodings of the transaction outputs in the response + * @type {boolean | null} + * @memberof UtxosByAddressesQueryParams + */ + withCbor?: boolean | null; + /** + * The max number of results per page. + * @type {number | null} + * @memberof UtxosByAddressesQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof UtxosByAddressesQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for utxosByPaymentCred. + * @export + * @interface UtxosByPaymentCredQueryParams + * + */ +export interface UtxosByPaymentCredQueryParams { + /** + * Return only UTxOs which contain some of a specific asset (asset formatted as concatenation of hex encoded policy and asset name) + * @type {string | null} + * @memberof UtxosByAddressQueryParams + */ + asset?: string | null; + /** + * Try find and include the corresponding datums for datum hashes + * @type {boolean | null} + * @memberof UtxosByPaymentCredQueryParams + */ + resolveDatums?: boolean | null; + /** + * Include the CBOR encodings of the transaction outputs in the response + * @type {boolean | null} + * @memberof UtxosByPaymentCredQueryParams + */ + withCbor?: boolean | null; + /** + * The max number of results per page. + * @type {number | null} + * @memberof UtxosByPaymentCredQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted (by slot at which UTxO was produced) + * @type {UtxosByPaymentCredOrderEnum} + * @memberof UtxosByPaymentCredQueryParams + */ + order?: UtxosByPaymentCredOrderEnum; + /** + * Return only UTxOs created on or after a specific slot + * @type {number | null} + * @memberof UtxosByPaymentCredQueryParams + */ + from?: number | null; + /** + * Return only UTxOs created on or before a specific slot + * @type {number | null} + * @memberof UtxosByPaymentCredQueryParams + */ + to?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof UtxosByPaymentCredQueryParams + */ + cursor?: string | null; +} diff --git a/src/api/assets/helpers.ts b/src/api/assets/helpers.ts index 698803c..a57f860 100644 --- a/src/api/assets/helpers.ts +++ b/src/api/assets/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { assertParamExists, @@ -22,11 +22,16 @@ import { PaginatedPolicyUtxo, } from '../type'; import { - AssetTxsOrderEnum, - AssetUpdatesOrderEnum, - AssetUtxosOrderEnum, - PolicyTxsOrderEnum, - PolicyUtxosOrderEnum, + AssetAccountsQueryParams, + AssetAddressesQueryParams, + AssetTxsQueryParams, + AssetUpdatesQueryParams, + AssetUtxosQueryParams, + PolicyAccountsQueryParams, + PolicyAddressesQueryParams, + PolicyInfoQueryParams, + PolicyTxsQueryParams, + PolicyUtxosQueryParams, } from './type'; /** @@ -39,15 +44,13 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of the specified asset; in other words, instead of returning the addresses which hold some of the asset, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). * @summary Accounts of addresses holding specific asset * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetAccountsQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ assetAccounts: async ( asset: string, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: AssetAccountsQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'asset' is not null or undefined @@ -59,19 +62,10 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -89,15 +83,13 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration * Returns a list of addresses which control some amount of the specified asset * @summary Native asset addresses * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetAddressesQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ assetAddresses: async ( asset: string, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: AssetAddressesQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'asset' is not null or undefined @@ -109,19 +101,10 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -174,19 +157,13 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration * Returns a list of transactions in which a transaction input or output contains some of the specified asset * @summary Native asset transactions * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [fromHeight] Return only transactions after supplied block height - * @param {number | null} [count] The max number of results per page - * @param {AssetTxsOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetTxsQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ assetTxs: async ( asset: string, - fromHeight?: number | null, - count?: number | null, - order?: AssetTxsOrderEnum, - cursor?: string | null, + localVarQueryParameter: AssetTxsQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'asset' is not null or undefined @@ -201,27 +178,10 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (fromHeight !== undefined) { - localVarQueryParameter.from_height = fromHeight; - } - - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -239,17 +199,13 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration * Returns a list of transactions in which some of the specified asset was minted or burned * @summary Native asset updates * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {AssetUpdatesOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetUpdatesQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ assetUpdates: async ( asset: string, - count?: number | null, - order?: AssetUpdatesOrderEnum, - cursor?: string | null, + localVarQueryParameter: AssetUpdatesQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'asset' is not null or undefined @@ -261,23 +217,10 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -295,23 +238,13 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration * Returns references for UTxOs which contain some of the specified asset, each paired with the amount of the asset contained in the UTxO * @summary Native asset UTxOs * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {string | null} [address] Return only UTxOs controlled by a specific address (bech32 encoding) - * @param {number | null} [count] The max number of results per page - * @param {AssetUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetUpdatesQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ assetUtxos: async ( asset: string, - address?: string | null, - count?: number | null, - order?: AssetUtxosOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + localVarQueryParameter: AssetUpdatesQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'asset' is not null or undefined @@ -323,35 +256,10 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (address !== undefined) { - localVarQueryParameter.address = address; - } - - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (from !== undefined) { - localVarQueryParameter.from = from; - } - - if (to !== undefined) { - localVarQueryParameter.to = to; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -369,15 +277,13 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of an asset of the specified policy; in other words, instead of returning the addresses which hold the assets, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). * @summary Accounts of addresses holding assets of specific policy * @param {string} policy Hex encoded Policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyAccountsQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ policyAccounts: async ( policy: string, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: PolicyAccountsQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'policy' is not null or undefined @@ -392,19 +298,10 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -422,15 +319,13 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration * Returns a list of addresses which hold some of an asset of the specified policy ID * @summary Addresses holding assets of specific policy * @param {string} policy Hex encoded Policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyAddressesQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ policyAddresses: async ( policy: string, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: PolicyAddressesQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'policy' is not null or undefined @@ -445,19 +340,10 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -475,15 +361,13 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration * Returns information about assets of the specified minting policy ID * @summary Information on assets of specific policy * @param {string} policy Hex encoded policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyInfoQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ policyInfo: async ( policy: string, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: PolicyInfoQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'policy' is not null or undefined @@ -495,19 +379,10 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -525,19 +400,13 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration * Returns a list of transactions in which a transaction input or output contains some of at least one asset of the specified minting policy ID * @summary Transactions moving assets of specific policy * @param {string} policy Hex encoded policy ID - * @param {number | null} [fromHeight] Return only transactions after supplied block height - * @param {number | null} [count] The max number of results per page - * @param {PolicyTxsOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyTxsQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ policyTxs: async ( policy: string, - fromHeight?: number | null, - count?: number | null, - order?: PolicyTxsOrderEnum, - cursor?: string | null, + localVarQueryParameter: PolicyTxsQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'policy' is not null or undefined @@ -552,27 +421,10 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (fromHeight !== undefined) { - localVarQueryParameter.from_height = fromHeight; - } - - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -590,21 +442,13 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration * Returns UTxO references of UTxOs which contain some of at least one asset of the specified policy ID, each paired with a list of assets of the policy contained in the UTxO and the corresponding amounts * @summary UTxOs containing assets of specific policy * @param {string} policy Hex encoded policy ID - * @param {number | null} [count] The max number of results per page - * @param {PolicyUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyUtxosQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ policyUtxos: async ( policy: string, - count?: number | null, - order?: PolicyUtxosOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + localVarQueryParameter: PolicyUtxosQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'policy' is not null or undefined @@ -619,31 +463,10 @@ export const AssetsApiAxiosParamCreator = function (configuration: Configuration const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (from !== undefined) { - localVarQueryParameter.from = from; - } - - if (to !== undefined) { - localVarQueryParameter.to = to; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -671,37 +494,33 @@ export const AssetsApiFp = function (configuration: Configuration) { * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of the specified asset; in other words, instead of returning the addresses which hold some of the asset, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). * @summary Accounts of addresses holding specific asset * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetAccountsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async assetAccounts( asset: string, - count?: number | null, - cursor?: string | null, + queryParams?: AssetAccountsQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.assetAccounts(asset, count, cursor, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.assetAccounts(asset, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of addresses which control some amount of the specified asset * @summary Native asset addresses * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetAddressesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async assetAddresses( asset: string, - count?: number | null, - cursor?: string | null, + queryParams?: AssetAddressesQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.assetAddresses(asset, count, cursor, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.assetAddresses(asset, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Return a summary of information about an asset @@ -715,440 +534,363 @@ export const AssetsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.assetInfo(asset, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of transactions in which a transaction input or output contains some of the specified asset * @summary Native asset transactions * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [fromHeight] Return only transactions after supplied block height - * @param {number | null} [count] The max number of results per page - * @param {AssetTxsOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetTxsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async assetTxs( asset: string, - fromHeight?: number | null, - count?: number | null, - order?: AssetTxsOrderEnum, - cursor?: string | null, + queryParams?: AssetTxsQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.assetTxs( - asset, - fromHeight, - count, - order, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.assetTxs(asset, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of transactions in which some of the specified asset was minted or burned * @summary Native asset updates * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {AssetUpdatesOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetUpdatesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async assetUpdates( asset: string, - count?: number | null, - order?: AssetUpdatesOrderEnum, - cursor?: string | null, + queryParams?: AssetUpdatesQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.assetUpdates( - asset, - count, - order, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.assetUpdates(asset, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns references for UTxOs which contain some of the specified asset, each paired with the amount of the asset contained in the UTxO * @summary Native asset UTxOs * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {string | null} [address] Return only UTxOs controlled by a specific address (bech32 encoding) - * @param {number | null} [count] The max number of results per page - * @param {AssetUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetUpdatesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async assetUtxos( asset: string, - address?: string | null, - count?: number | null, - order?: AssetUtxosOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + queryParams?: AssetUtxosQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.assetUtxos( - asset, - address, - count, - order, - from, - to, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.assetUtxos(asset, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of an asset of the specified policy; in other words, instead of returning the addresses which hold the assets, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). * @summary Accounts of addresses holding assets of specific policy * @param {string} policy Hex encoded Policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyAccountsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async policyAccounts( policy: string, - count?: number | null, - cursor?: string | null, + queryParams?: PolicyAccountsQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.policyAccounts(policy, count, cursor, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.policyAccounts(policy, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of addresses which hold some of an asset of the specified policy ID * @summary Addresses holding assets of specific policy * @param {string} policy Hex encoded Policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyAddressesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async policyAddresses( policy: string, - count?: number | null, - cursor?: string | null, + queryParams?: PolicyAddressesQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.policyAddresses(policy, count, cursor, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.policyAddresses(policy, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns information about assets of the specified minting policy ID * @summary Information on assets of specific policy * @param {string} policy Hex encoded policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyInfoQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async policyInfo( policy: string, - count?: number | null, - cursor?: string | null, + queryParams?: PolicyInfoQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.policyInfo(policy, count, cursor, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.policyInfo(policy, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of transactions in which a transaction input or output contains some of at least one asset of the specified minting policy ID * @summary Transactions moving assets of specific policy * @param {string} policy Hex encoded policy ID - * @param {number | null} [fromHeight] Return only transactions after supplied block height - * @param {number | null} [count] The max number of results per page - * @param {PolicyTxsOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyTxsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async policyTxs( policy: string, - fromHeight?: number | null, - count?: number | null, - order?: PolicyTxsOrderEnum, - cursor?: string | null, + queryParams?: PolicyTxsQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.policyTxs( - policy, - fromHeight, - count, - order, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.policyTxs(policy, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns UTxO references of UTxOs which contain some of at least one asset of the specified policy ID, each paired with a list of assets of the policy contained in the UTxO and the corresponding amounts * @summary UTxOs containing assets of specific policy * @param {string} policy Hex encoded policy ID - * @param {number | null} [count] The max number of results per page - * @param {PolicyUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyUtxosQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async policyUtxos( policy: string, - count?: number | null, - order?: PolicyUtxosOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, + queryParams?: PolicyUtxosQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.policyUtxos( - policy, - count, - order, - from, - to, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.policyUtxos(policy, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; -/** - * AssetsApi - factory interface - * @export - */ -export const AssetsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = AssetsApiFp(configuration); - return { - /** - * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of the specified asset; in other words, instead of returning the addresses which hold some of the asset, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). - * @summary Accounts of addresses holding specific asset - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetAccounts( - asset: string, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp.assetAccounts(asset, count, cursor, options).then((request) => request(axios, basePath)); - }, - /** - * Returns a list of addresses which control some amount of the specified asset - * @summary Native asset addresses - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetAddresses( - asset: string, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp.assetAddresses(asset, count, cursor, options).then((request) => request(axios, basePath)); - }, - /** - * Return a summary of information about an asset - * @summary Native asset information - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetInfo(asset: string, options?: any): AxiosPromise { - return localVarFp.assetInfo(asset, options).then((request) => request(axios, basePath)); - }, - /** - * Returns a list of transactions in which a transaction input or output contains some of the specified asset - * @summary Native asset transactions - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [fromHeight] Return only transactions after supplied block height - * @param {number | null} [count] The max number of results per page - * @param {AssetTxsOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetTxs( - asset: string, - fromHeight?: number | null, - count?: number | null, - order?: AssetTxsOrderEnum, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .assetTxs(asset, fromHeight, count, order, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns a list of transactions in which some of the specified asset was minted or burned - * @summary Native asset updates - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {AssetUpdatesOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetUpdates( - asset: string, - count?: number | null, - order?: AssetUpdatesOrderEnum, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .assetUpdates(asset, count, order, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns references for UTxOs which contain some of the specified asset, each paired with the amount of the asset contained in the UTxO - * @summary Native asset UTxOs - * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {string | null} [address] Return only UTxOs controlled by a specific address (bech32 encoding) - * @param {number | null} [count] The max number of results per page - * @param {AssetUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assetUtxos( - asset: string, - address?: string | null, - count?: number | null, - order?: AssetUtxosOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .assetUtxos(asset, address, count, order, from, to, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of an asset of the specified policy; in other words, instead of returning the addresses which hold the assets, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). - * @summary Accounts of addresses holding assets of specific policy - * @param {string} policy Hex encoded Policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - policyAccounts( - policy: string, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .policyAccounts(policy, count, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns a list of addresses which hold some of an asset of the specified policy ID - * @summary Addresses holding assets of specific policy - * @param {string} policy Hex encoded Policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - policyAddresses( - policy: string, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .policyAddresses(policy, count, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns information about assets of the specified minting policy ID - * @summary Information on assets of specific policy - * @param {string} policy Hex encoded policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - policyInfo( - policy: string, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp.policyInfo(policy, count, cursor, options).then((request) => request(axios, basePath)); - }, - /** - * Returns a list of transactions in which a transaction input or output contains some of at least one asset of the specified minting policy ID - * @summary Transactions moving assets of specific policy - * @param {string} policy Hex encoded policy ID - * @param {number | null} [fromHeight] Return only transactions after supplied block height - * @param {number | null} [count] The max number of results per page - * @param {PolicyTxsOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - policyTxs( - policy: string, - fromHeight?: number | null, - count?: number | null, - order?: PolicyTxsOrderEnum, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .policyTxs(policy, fromHeight, count, order, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns UTxO references of UTxOs which contain some of at least one asset of the specified policy ID, each paired with a list of assets of the policy contained in the UTxO and the corresponding amounts - * @summary UTxOs containing assets of specific policy - * @param {string} policy Hex encoded policy ID - * @param {number | null} [count] The max number of results per page - * @param {PolicyUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - policyUtxos( - policy: string, - count?: number | null, - order?: PolicyUtxosOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .policyUtxos(policy, count, order, from, to, cursor, options) - .then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * AssetsApi - factory interface +// * @export +// */ +// export const AssetsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = AssetsApiFp(configuration); +// return { +// /** +// * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of the specified asset; in other words, instead of returning the addresses which hold some of the asset, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). +// * @summary Accounts of addresses holding specific asset +// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// assetAccounts( +// asset: string, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp.assetAccounts(asset, count, cursor, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of addresses which control some amount of the specified asset +// * @summary Native asset addresses +// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// assetAddresses( +// asset: string, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp.assetAddresses(asset, count, cursor, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Return a summary of information about an asset +// * @summary Native asset information +// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// assetInfo(asset: string, options?: any): AxiosPromise { +// return localVarFp.assetInfo(asset, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of transactions in which a transaction input or output contains some of the specified asset +// * @summary Native asset transactions +// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name +// * @param {number | null} [fromHeight] Return only transactions after supplied block height +// * @param {number | null} [count] The max number of results per page +// * @param {AssetTxsOrderEnum} [order] The order in which the results are sorted (by block height) +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// assetTxs( +// asset: string, +// fromHeight?: number | null, +// count?: number | null, +// order?: AssetTxsOrderEnum, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .assetTxs(asset, fromHeight, count, order, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of transactions in which some of the specified asset was minted or burned +// * @summary Native asset updates +// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name +// * @param {number | null} [count] The max number of results per page +// * @param {AssetUpdatesOrderEnum} [order] The order in which the results are sorted (by block height) +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// assetUpdates( +// asset: string, +// count?: number | null, +// order?: AssetUpdatesOrderEnum, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .assetUpdates(asset, count, order, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns references for UTxOs which contain some of the specified asset, each paired with the amount of the asset contained in the UTxO +// * @summary Native asset UTxOs +// * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name +// * @param {string | null} [address] Return only UTxOs controlled by a specific address (bech32 encoding) +// * @param {number | null} [count] The max number of results per page +// * @param {AssetUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) +// * @param {number | null} [from] Return only UTxOs created on or after a specific slot +// * @param {number | null} [to] Return only UTxOs created before a specific slot +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// assetUtxos( +// asset: string, +// address?: string | null, +// count?: number | null, +// order?: AssetUtxosOrderEnum, +// from?: number | null, +// to?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .assetUtxos(asset, address, count, order, from, to, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of an asset of the specified policy; in other words, instead of returning the addresses which hold the assets, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). +// * @summary Accounts of addresses holding assets of specific policy +// * @param {string} policy Hex encoded Policy ID +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// policyAccounts( +// policy: string, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .policyAccounts(policy, count, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of addresses which hold some of an asset of the specified policy ID +// * @summary Addresses holding assets of specific policy +// * @param {string} policy Hex encoded Policy ID +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// policyAddresses( +// policy: string, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .policyAddresses(policy, count, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns information about assets of the specified minting policy ID +// * @summary Information on assets of specific policy +// * @param {string} policy Hex encoded policy ID +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// policyInfo( +// policy: string, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp.policyInfo(policy, count, cursor, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of transactions in which a transaction input or output contains some of at least one asset of the specified minting policy ID +// * @summary Transactions moving assets of specific policy +// * @param {string} policy Hex encoded policy ID +// * @param {number | null} [fromHeight] Return only transactions after supplied block height +// * @param {number | null} [count] The max number of results per page +// * @param {PolicyTxsOrderEnum} [order] The order in which the results are sorted (by block height) +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// policyTxs( +// policy: string, +// fromHeight?: number | null, +// count?: number | null, +// order?: PolicyTxsOrderEnum, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .policyTxs(policy, fromHeight, count, order, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns UTxO references of UTxOs which contain some of at least one asset of the specified policy ID, each paired with a list of assets of the policy contained in the UTxO and the corresponding amounts +// * @summary UTxOs containing assets of specific policy +// * @param {string} policy Hex encoded policy ID +// * @param {number | null} [count] The max number of results per page +// * @param {PolicyUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) +// * @param {number | null} [from] Return only UTxOs created on or after a specific slot +// * @param {number | null} [to] Return only UTxOs created before a specific slot +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// policyUtxos( +// policy: string, +// count?: number | null, +// order?: PolicyUtxosOrderEnum, +// from?: number | null, +// to?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .policyUtxos(policy, count, order, from, to, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/assets/index.ts b/src/api/assets/index.ts index 09b602f..e01da88 100644 --- a/src/api/assets/index.ts +++ b/src/api/assets/index.ts @@ -2,11 +2,16 @@ import { AxiosRequestConfig } from 'axios'; import { BaseAPI } from '../../base'; import { AssetsApiFp } from './helpers'; import { - AssetTxsOrderEnum, - AssetUpdatesOrderEnum, - AssetUtxosOrderEnum, - PolicyTxsOrderEnum, - PolicyUtxosOrderEnum, + AssetAccountsQueryParams, + AssetAddressesQueryParams, + AssetTxsQueryParams, + AssetUpdatesQueryParams, + AssetUtxosQueryParams, + PolicyAccountsQueryParams, + PolicyAddressesQueryParams, + PolicyInfoQueryParams, + PolicyTxsQueryParams, + PolicyUtxosQueryParams, } from './type'; /** @@ -20,32 +25,30 @@ export class AssetsApi extends BaseAPI { * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of the specified asset; in other words, instead of returning the addresses which hold some of the asset, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). * @summary Accounts of addresses holding specific asset * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetAccountsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ - public assetAccounts(asset: string, count?: number | null, cursor?: string | null, options?: AxiosRequestConfig) { + public assetAccounts(asset: string, queryParams?: AssetAccountsQueryParams, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) - .assetAccounts(asset, count, cursor, options) - .then((request) => request(this.axios)); + .assetAccounts(asset, queryParams, options) + .then((request) => request()); } /** * Returns a list of addresses which control some amount of the specified asset * @summary Native asset addresses * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetAddressesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ - public assetAddresses(asset: string, count?: number | null, cursor?: string | null, options?: AxiosRequestConfig) { + public assetAddresses(asset: string, queryParams?: AssetAddressesQueryParams, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) - .assetAddresses(asset, count, cursor, options) - .then((request) => request(this.axios)); + .assetAddresses(asset, queryParams, options) + .then((request) => request()); } /** @@ -59,188 +62,128 @@ export class AssetsApi extends BaseAPI { public assetInfo(asset: string, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) .assetInfo(asset, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** * Returns a list of transactions in which a transaction input or output contains some of the specified asset * @summary Native asset transactions * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [fromHeight] Return only transactions after supplied block height - * @param {number | null} [count] The max number of results per page - * @param {AssetTxsOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetTxsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ - public assetTxs( - asset: string, - fromHeight?: number | null, - count?: number | null, - order?: AssetTxsOrderEnum, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public assetTxs(asset: string, queryParams?: AssetTxsQueryParams, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) - .assetTxs(asset, fromHeight, count, order, cursor, options) - .then((request) => request(this.axios)); + .assetTxs(asset, queryParams, options) + .then((request) => request()); } /** * Returns a list of transactions in which some of the specified asset was minted or burned * @summary Native asset updates * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {number | null} [count] The max number of results per page - * @param {AssetUpdatesOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetUpdatesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ - public assetUpdates( - asset: string, - count?: number | null, - order?: AssetUpdatesOrderEnum, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public assetUpdates(asset: string, queryParams?: AssetUpdatesQueryParams, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) - .assetUpdates(asset, count, order, cursor, options) - .then((request) => request(this.axios)); + .assetUpdates(asset, queryParams, options) + .then((request) => request()); } /** * Returns references for UTxOs which contain some of the specified asset, each paired with the amount of the asset contained in the UTxO * @summary Native asset UTxOs * @param {string} asset Asset, encoded as concatenation of hex of policy ID and asset name - * @param {string | null} [address] Return only UTxOs controlled by a specific address (bech32 encoding) - * @param {number | null} [count] The max number of results per page - * @param {AssetUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {AssetUtxosQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ - public assetUtxos( - asset: string, - address?: string | null, - count?: number | null, - order?: AssetUtxosOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public assetUtxos(asset: string, queryParams?: AssetUtxosQueryParams, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) - .assetUtxos(asset, address, count, order, from, to, cursor, options) - .then((request) => request(this.axios)); + .assetUtxos(asset, queryParams, options) + .then((request) => request()); } /** * Returns a list of accounts (as stake/reward addresses) associated with addresses which control some of an asset of the specified policy; in other words, instead of returning the addresses which hold the assets, the addresses are merged by their delegation part/account. Assets controlled by Byron, enterprise, or pointer addresses are omitted. CAUTION: An asset being associated with a particular stake account does not necessarily mean the owner of that account controls the asset; use \"asset addresses\" unless you are sure you want to work with stake keys. Read more [here]( https://medium.com/adamant-security/multi-sig-concerns-mangled-addresses-and-the-dangers-of-using-stake-keys-in-your-cardano-project-94894319b1d8). * @summary Accounts of addresses holding assets of specific policy * @param {string} policy Hex encoded Policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyAccountsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ - public policyAccounts(policy: string, count?: number | null, cursor?: string | null, options?: AxiosRequestConfig) { + public policyAccounts(policy: string, queryParams?: PolicyAccountsQueryParams, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) - .policyAccounts(policy, count, cursor, options) - .then((request) => request(this.axios)); + .policyAccounts(policy, queryParams, options) + .then((request) => request()); } /** * Returns a list of addresses which hold some of an asset of the specified policy ID * @summary Addresses holding assets of specific policy * @param {string} policy Hex encoded Policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyAddressesQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ - public policyAddresses( - policy: string, - count?: number | null, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public policyAddresses(policy: string, queryParams?: PolicyAddressesQueryParams, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) - .policyAddresses(policy, count, cursor, options) - .then((request) => request(this.axios)); + .policyAddresses(policy, queryParams, options) + .then((request) => request()); } /** * Returns information about assets of the specified minting policy ID * @summary Information on assets of specific policy * @param {string} policy Hex encoded policy ID - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyInfoQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ - public policyInfo(policy: string, count?: number | null, cursor?: string | null, options?: AxiosRequestConfig) { + public policyInfo(policy: string, queryParams?: PolicyInfoQueryParams, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) - .policyInfo(policy, count, cursor, options) - .then((request) => request(this.axios)); + .policyInfo(policy, queryParams, options) + .then((request) => request()); } /** * Returns a list of transactions in which a transaction input or output contains some of at least one asset of the specified minting policy ID * @summary Transactions moving assets of specific policy * @param {string} policy Hex encoded policy ID - * @param {number | null} [fromHeight] Return only transactions after supplied block height - * @param {number | null} [count] The max number of results per page - * @param {PolicyTxsOrderEnum} [order] The order in which the results are sorted (by block height) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyTxsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ - public policyTxs( - policy: string, - fromHeight?: number | null, - count?: number | null, - order?: PolicyTxsOrderEnum, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public policyTxs(policy: string, queryParams?: PolicyTxsQueryParams, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) - .policyTxs(policy, fromHeight, count, order, cursor, options) - .then((request) => request(this.axios)); + .policyTxs(policy, queryParams, options) + .then((request) => request()); } /** * Returns UTxO references of UTxOs which contain some of at least one asset of the specified policy ID, each paired with a list of assets of the policy contained in the UTxO and the corresponding amounts * @summary UTxOs containing assets of specific policy * @param {string} policy Hex encoded policy ID - * @param {number | null} [count] The max number of results per page - * @param {PolicyUtxosOrderEnum} [order] The order in which the results are sorted (by slot at which UTxO was produced) - * @param {number | null} [from] Return only UTxOs created on or after a specific slot - * @param {number | null} [to] Return only UTxOs created before a specific slot - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PolicyUtxosQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AssetsApi */ - public policyUtxos( - policy: string, - count?: number | null, - order?: PolicyUtxosOrderEnum, - from?: number | null, - to?: number | null, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public policyUtxos(policy: string, queryParams?: PolicyUtxosQueryParams, options?: AxiosRequestConfig) { return AssetsApiFp(this.configuration) - .policyUtxos(policy, count, order, from, to, cursor, options) - .then((request) => request(this.axios)); + .policyUtxos(policy, queryParams, options) + .then((request) => request()); } } + +export * from './type'; diff --git a/src/api/assets/type.ts b/src/api/assets/type.ts index 7db693a..17ebccb 100644 --- a/src/api/assets/type.ts +++ b/src/api/assets/type.ts @@ -38,3 +38,285 @@ export const PolicyUtxosOrderEnum = { Desc: 'desc', } as const; export type PolicyUtxosOrderEnum = (typeof PolicyUtxosOrderEnum)[keyof typeof PolicyUtxosOrderEnum]; + +/** + * Query parameters for assetAccounts. + * @export + * @interface AssetAccountsQueryParams + * + */ +export interface AssetAccountsQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof AssetAccountsQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof AssetAccountsQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for assetAddresses. + * @export + * @interface AssetAddressesQueryParams + * + */ +export interface AssetAddressesQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof AssetAddressesQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof AssetAddressesQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for assetTxs. + * @export + * @interface AssetTxsQueryParams + * + */ +export interface AssetTxsQueryParams { + /** + * Return only transactions after supplied block height + * @type {number | null} + * @memberof AssetTxsQueryParams + */ + fromHeight?: number | null; + /** + * The max number of results per page. + * @type {number | null} + * @memberof AssetTxsQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted (by block height) + * @type {AssetTxsOrderEnum} + * @memberof AssetTxsQueryParams + */ + order?: AssetTxsOrderEnum; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof AssetTxsQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for assetUpdates. + * @export + * @interface AssetUpdatesQueryParams + * + */ +export interface AssetUpdatesQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof AssetUpdatesQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted (by block height) + * @type {AssetUpdatesOrderEnum} + * @memberof AssetUpdatesQueryParams + */ + order?: AssetUpdatesOrderEnum; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof AssetUpdatesQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for assetUtxos. + * @export + * @interface AssetUtxosQueryParams + * + */ +export interface AssetUtxosQueryParams { + /** + * Return only UTxOs controlled by a specific address (bech32 encoding) + * @type {string | null} + * @memberof AssetUtxosQueryParams + */ + address?: string | null; + /** + * The max number of results per page. + * @type {number | null} + * @memberof AssetUtxosQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted (by slot at which UTxO was produced) + * @type {AssetUtxosOrderEnum} + * @memberof AssetUtxosQueryParams + */ + order?: AssetUtxosOrderEnum; + /** + * Return only UTxOs created on or after a specific slot + * @type {number | null} + * @memberof AssetUtxosQueryParams + */ + from?: number | null; + /** + * Return only UTxOs created before a specific slot + * @type {number | null} + * @memberof AssetUtxosQueryParams + */ + to?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof AssetUtxosQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for policyAccounts. + * @export + * @interface PolicyAccountsQueryParams + * + */ +export interface PolicyAccountsQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof PolicyAccountsQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof PolicyAccountsQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for policyAddresses. + * @export + * @interface PolicyAddressesQueryParams + * + */ +export interface PolicyAddressesQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof PolicyAddressesQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof PolicyAddressesQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for policyInfo. + * @export + * @interface PolicyInfoQueryParams + * + */ +export interface PolicyInfoQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof PolicyInfoQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof PolicyInfoQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for policyTxs. + * @export + * @interface PolicyTxsQueryParams + * + */ +export interface PolicyTxsQueryParams { + /** + * Return only transactions after supplied block height + * @type {number | null} + * @memberof PolicyTxsQueryParams + */ + fromHeight?: number | null; + /** + * The max number of results per page. + * @type {number | null} + * @memberof PolicyTxsQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted (by block height) + * @type {PolicyTxsOrderEnum} + * @memberof PolicyTxsQueryParams + */ + order?: PolicyTxsOrderEnum; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof PolicyTxsQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for policyUtxos. + * @export + * @interface PolicyUtxosQueryParams + * + */ +export interface PolicyUtxosQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof PolicyUtxosQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted (by slot at which UTxO was produced) + * @type {PolicyUtxosOrderEnum} + * @memberof PolicyUtxosQueryParams + */ + order?: PolicyUtxosOrderEnum; + /** + * Return only UTxOs created on or after a specific slot + * @type {number | null} + * @memberof PolicyUtxosQueryParams + */ + from?: number | null; + /** + * Return only UTxOs created before a specific slot + * @type {number | null} + * @memberof PolicyUtxosQueryParams + */ + to?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof PolicyUtxosQueryParams + */ + cursor?: string | null; +} diff --git a/src/api/blocks/helpers.ts b/src/api/blocks/helpers.ts index cc47d6d..ff319ef 100644 --- a/src/api/blocks/helpers.ts +++ b/src/api/blocks/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { assertParamExists, @@ -77,27 +77,27 @@ export const BlocksApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.blockInfo(hashOrHeight, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; -/** - * BlocksApi - factory interface - * @export - */ -export const BlocksApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = BlocksApiFp(configuration); - return { - /** - * Returns information about the specified block including more advanced technical properties - * @summary Block information - * @param {string} hashOrHeight Block height or hex encoded block hash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - blockInfo(hashOrHeight: string, options?: any): AxiosPromise { - return localVarFp.blockInfo(hashOrHeight, options).then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * BlocksApi - factory interface +// * @export +// */ +// export const BlocksApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = BlocksApiFp(configuration); +// return { +// /** +// * Returns information about the specified block including more advanced technical properties +// * @summary Block information +// * @param {string} hashOrHeight Block height or hex encoded block hash +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// blockInfo(hashOrHeight: string, options?: any): AxiosPromise { +// return localVarFp.blockInfo(hashOrHeight, options).then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/blocks/index.ts b/src/api/blocks/index.ts index e8983b5..c2fa25d 100644 --- a/src/api/blocks/index.ts +++ b/src/api/blocks/index.ts @@ -20,6 +20,6 @@ export class BlocksApi extends BaseAPI { public blockInfo(hashOrHeight: string, options?: AxiosRequestConfig) { return BlocksApiFp(this.configuration) .blockInfo(hashOrHeight, options) - .then((request) => request(this.axios)); + .then((request) => request()); } } diff --git a/src/api/blocks/type.ts b/src/api/blocks/type.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/api/datum/helpers.ts b/src/api/datum/helpers.ts index 159ecc4..b07c137 100644 --- a/src/api/datum/helpers.ts +++ b/src/api/datum/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { assertParamExists, @@ -7,9 +7,10 @@ import { setSearchParams, toPathString, createRequestFunction, + serializeDataIfNeeded, } from '../../common'; import { Configuration } from '../../configuration'; -import { TimestampedDatum } from '../type'; +import { TimestampedDatum, TimestampedDatums } from '../type'; /** * DatumApi - axios parameter creator @@ -50,6 +51,44 @@ export const DatumApiAxiosParamCreator = function (configuration: Configuration) ...options.headers, }; + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns the datums corresponding to the specified datum hashes, for the datums which have been seen on-chain + * @summary Datums by datum hashes + * @param {Array} requestBody Array of hex encoded datum hashes + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + lookupDatums: async (requestBody: Array, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'requestBody' is not null or undefined + assertParamExists('lookupDatums', 'requestBody', requestBody); + const localVarPath = `/datums`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + const { baseOptions } = configuration; + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api-key required + setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); + return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, @@ -77,27 +116,41 @@ export const DatumApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.lookupDatum(datumHash, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, - }; -}; - -/** - * DatumApi - factory interface - * @export - */ -export const DatumApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = DatumApiFp(configuration); - return { /** - * Returns the datum corresponding to the specified datum hash, if the datum has been seen on-chain - * @summary Datum by datum hash - * @param {string} datumHash Hex encoded datum hash + * Returns the datums corresponding to the specified datum hashes, for the datums which have been seen on-chain + * @summary Datums by datum hashes + * @param {Array} requestBody Array of hex encoded datum hashes * @param {*} [options] Override http request option. * @throws {RequiredError} */ - lookupDatum(datumHash: string, options?: any): AxiosPromise { - return localVarFp.lookupDatum(datumHash, options).then((request) => request(axios, basePath)); + async lookupDatums( + requestBody: Array, + options?: AxiosRequestConfig, + ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.lookupDatums(requestBody, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; + +// /** +// * DatumApi - factory interface +// * @export +// */ +// export const DatumApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = DatumApiFp(configuration); +// return { +// /** +// * Returns the datum corresponding to the specified datum hash, if the datum has been seen on-chain +// * @summary Datum by datum hash +// * @param {string} datumHash Hex encoded datum hash +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// lookupDatum(datumHash: string, options?: any): AxiosPromise { +// return localVarFp.lookupDatum(datumHash, options).then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/datum/index.ts b/src/api/datum/index.ts index bf91e51..3c9772a 100644 --- a/src/api/datum/index.ts +++ b/src/api/datum/index.ts @@ -17,9 +17,21 @@ export class DatumApi extends BaseAPI { * @throws {RequiredError} * @memberof DatumApi */ - public lookupDatum(datumHash: string, options?: AxiosRequestConfig) { - return DatumApiFp(this.configuration) - .lookupDatum(datumHash, options) - .then((request) => request(this.axios)); + public async lookupDatum(datumHash: string, options?: AxiosRequestConfig) { + const request = await DatumApiFp(this.configuration).lookupDatum(datumHash, options); + return request(); + } + + /** + * Returns the datums corresponding to the specified datum hashes, for the datums which have been seen on-chain + * @summary Datums by datum hashes + * @param {Array} requestBody Array of hex encoded datum hashes + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DatumApi + */ + public async lookupDatums(requestBody: Array, options?: AxiosRequestConfig) { + const request = await DatumApiFp(this.configuration).lookupDatums(requestBody, options); + return request(); } } diff --git a/src/api/ecosystem/helpers.ts b/src/api/ecosystem/helpers.ts index 92a9412..a924ba7 100644 --- a/src/api/ecosystem/helpers.ts +++ b/src/api/ecosystem/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { assertParamExists, @@ -77,27 +77,27 @@ export const EcosystemApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.adahandleResolve(handle, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; -/** - * EcosystemApi - factory interface - * @export - */ -export const EcosystemApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = EcosystemApiFp(configuration); - return { - /** - * Returns the Cardano address corresponding to an ADA Handle - * @summary Resolve ADA Handle - * @param {string} handle Ada Handle to resolve - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - adahandleResolve(handle: string, options?: any): AxiosPromise { - return localVarFp.adahandleResolve(handle, options).then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * EcosystemApi - factory interface +// * @export +// */ +// export const EcosystemApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = EcosystemApiFp(configuration); +// return { +// /** +// * Returns the Cardano address corresponding to an ADA Handle +// * @summary Resolve ADA Handle +// * @param {string} handle Ada Handle to resolve +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// adahandleResolve(handle: string, options?: any): AxiosPromise { +// return localVarFp.adahandleResolve(handle, options).then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/ecosystem/index.ts b/src/api/ecosystem/index.ts index c40a9b3..2850ea0 100644 --- a/src/api/ecosystem/index.ts +++ b/src/api/ecosystem/index.ts @@ -20,6 +20,6 @@ export class EcosystemApi extends BaseAPI { public adahandleResolve(handle: string, options?: AxiosRequestConfig) { return EcosystemApiFp(this.configuration) .adahandleResolve(handle, options) - .then((request) => request(this.axios)); + .then((request) => request()); } } diff --git a/src/api/epochs/helpers.ts b/src/api/epochs/helpers.ts index 9f41dfd..d314644 100644 --- a/src/api/epochs/helpers.ts +++ b/src/api/epochs/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { DUMMY_BASE_URL, @@ -59,10 +59,7 @@ export const EpochsApiAxiosParamCreator = function (configuration: Configuration epochInfo: async (epochNo: number, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'epochNo' is not null or undefined assertParamExists('epochInfo', 'epochNo', epochNo); - const localVarPath = `/epochs/{epoch_no}/info`.replace( - `{${'epoch_no'}}`, - encodeURIComponent(String(epochNo)), - ); + const localVarPath = `/epochs/{epoch_no}`.replace(`{${'epoch_no'}}`, encodeURIComponent(String(epochNo))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); const { baseOptions } = configuration; @@ -107,7 +104,7 @@ export const EpochsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.currentEpoch(options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a summary of information about a specific epoch @@ -121,36 +118,36 @@ export const EpochsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.epochInfo(epochNo, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; -/** - * EpochsApi - factory interface - * @export - */ -export const EpochsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = EpochsApiFp(configuration); - return { - /** - * Returns a summary of information about the current epoch - * @summary Current epoch details - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - currentEpoch(options?: any): AxiosPromise { - return localVarFp.currentEpoch(options).then((request) => request(axios, basePath)); - }, - /** - * Returns a summary of information about a specific epoch - * @summary Specific epoch details - * @param {number} epochNo Epoch number to return information about - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - epochInfo(epochNo: number, options?: any): AxiosPromise { - return localVarFp.epochInfo(epochNo, options).then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * EpochsApi - factory interface +// * @export +// */ +// export const EpochsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = EpochsApiFp(configuration); +// return { +// /** +// * Returns a summary of information about the current epoch +// * @summary Current epoch details +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// currentEpoch(options?: any): AxiosPromise { +// return localVarFp.currentEpoch(options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a summary of information about a specific epoch +// * @summary Specific epoch details +// * @param {number} epochNo Epoch number to return information about +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// epochInfo(epochNo: number, options?: any): AxiosPromise { +// return localVarFp.epochInfo(epochNo, options).then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/epochs/index.ts b/src/api/epochs/index.ts index b11bb0e..8d04ebc 100644 --- a/src/api/epochs/index.ts +++ b/src/api/epochs/index.ts @@ -19,7 +19,7 @@ export class EpochsApi extends BaseAPI { public currentEpoch(options?: AxiosRequestConfig) { return EpochsApiFp(this.configuration) .currentEpoch(options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -33,6 +33,6 @@ export class EpochsApi extends BaseAPI { public epochInfo(epochNo: number, options?: AxiosRequestConfig) { return EpochsApiFp(this.configuration) .epochInfo(epochNo, options) - .then((request) => request(this.axios)); + .then((request) => request()); } } diff --git a/src/api/general/helpers.ts b/src/api/general/helpers.ts index ed59009..a0e14fc 100644 --- a/src/api/general/helpers.ts +++ b/src/api/general/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { DUMMY_BASE_URL, setApiKeyToObject, setSearchParams, toPathString, createRequestFunction } from '../../common'; import { Configuration } from '../../configuration'; @@ -163,7 +163,7 @@ export const GeneralApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.chainTip(options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns the blockchain era history @@ -175,7 +175,7 @@ export const GeneralApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.eraHistory(options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns the current blockchain protocol parameters @@ -187,7 +187,7 @@ export const GeneralApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.protocolParams(options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns the blockchain system start time @@ -199,53 +199,53 @@ export const GeneralApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.systemStart(options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; -/** - * GeneralApi - factory interface - * @export - */ -export const GeneralApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = GeneralApiFp(configuration); - return { - /** - * Returns the identifier of the most recently processed block on the network - * @summary Chain tip - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - chainTip(options?: any): AxiosPromise { - return localVarFp.chainTip(options).then((request) => request(axios, basePath)); - }, - /** - * Returns the blockchain era history - * @summary Era history - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - eraHistory(options?: any): AxiosPromise { - return localVarFp.eraHistory(options).then((request) => request(axios, basePath)); - }, - /** - * Returns the current blockchain protocol parameters - * @summary Protocol parameters - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - protocolParams(options?: any): AxiosPromise { - return localVarFp.protocolParams(options).then((request) => request(axios, basePath)); - }, - /** - * Returns the blockchain system start time - * @summary Blockchain system start - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - systemStart(options?: any): AxiosPromise { - return localVarFp.systemStart(options).then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * GeneralApi - factory interface +// * @export +// */ +// export const GeneralApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = GeneralApiFp(configuration); +// return { +// /** +// * Returns the identifier of the most recently processed block on the network +// * @summary Chain tip +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// chainTip(options?: any): AxiosPromise { +// return localVarFp.chainTip(options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns the blockchain era history +// * @summary Era history +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// eraHistory(options?: any): AxiosPromise { +// return localVarFp.eraHistory(options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns the current blockchain protocol parameters +// * @summary Protocol parameters +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// protocolParams(options?: any): AxiosPromise { +// return localVarFp.protocolParams(options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns the blockchain system start time +// * @summary Blockchain system start +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// systemStart(options?: any): AxiosPromise { +// return localVarFp.systemStart(options).then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/general/index.ts b/src/api/general/index.ts index a47f58f..3d83587 100644 --- a/src/api/general/index.ts +++ b/src/api/general/index.ts @@ -19,7 +19,7 @@ export class GeneralApi extends BaseAPI { public chainTip(options?: AxiosRequestConfig) { return GeneralApiFp(this.configuration) .chainTip(options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -32,7 +32,7 @@ export class GeneralApi extends BaseAPI { public eraHistory(options?: AxiosRequestConfig) { return GeneralApiFp(this.configuration) .eraHistory(options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -45,7 +45,7 @@ export class GeneralApi extends BaseAPI { public protocolParams(options?: AxiosRequestConfig) { return GeneralApiFp(this.configuration) .protocolParams(options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -58,6 +58,6 @@ export class GeneralApi extends BaseAPI { public systemStart(options?: AxiosRequestConfig) { return GeneralApiFp(this.configuration) .systemStart(options) - .then((request) => request(this.axios)); + .then((request) => request()); } } diff --git a/src/api/index.ts b/src/api/index.ts index fcb809e..b3de761 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -11,3 +11,4 @@ export * from './scripts'; export * from './transactions'; export * from './transactionManager'; export * from './vesting'; +export * from './type'; diff --git a/src/api/pools/helpers.ts b/src/api/pools/helpers.ts index 3e6d762..99d5294 100644 --- a/src/api/pools/helpers.ts +++ b/src/api/pools/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { DUMMY_BASE_URL, @@ -7,6 +7,7 @@ import { toPathString, assertParamExists, createRequestFunction, + HEADER_AMOUNTS_AS_STRING, } from '../../common'; import { Configuration } from '../../configuration'; import { @@ -19,7 +20,7 @@ import { TimestampedPoolRelays, TimestampedPoolUpdates, } from '../type'; -import { PoolBlocksOrderEnum, PoolHistoryOrderEnum } from './type'; +import { ListPoolsQueryParams, PoolBlocksQueryParams, PoolDelegatorsQueryParams, PoolHistoryQueryParams } from './type'; /** * PoolsApi - axios parameter creator @@ -30,14 +31,12 @@ export const PoolsApiAxiosParamCreator = function (configuration: Configuration) /** * Returns a list of currently registered stake pools * @summary List registered stake pools - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {ListPoolsQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listPools: async ( - count?: number | null, - cursor?: string | null, + localVarQueryParameter?: ListPoolsQueryParams, options: AxiosRequestConfig = {}, ): Promise => { const localVarPath = `/pools`; @@ -47,19 +46,10 @@ export const PoolsApiAxiosParamCreator = function (configuration: Configuration) const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -77,19 +67,13 @@ export const PoolsApiAxiosParamCreator = function (configuration: Configuration) * Return information about blocks minted by a given pool for all epochs (or just for epoch `epoch_no` if provided) * @summary Stake pool blocks * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [epochNo] Epoch number to fetch results for - * @param {number | null} [count] The max number of results per page - * @param {PoolBlocksOrderEnum} [order] The order in which the results are sorted (by block absolute slot) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PoolBlocksQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ poolBlocks: async ( poolId: string, - epochNo?: number | null, - count?: number | null, - order?: PoolBlocksOrderEnum, - cursor?: string | null, + localVarQueryParameter: PoolBlocksQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'poolId' is not null or undefined @@ -104,27 +88,10 @@ export const PoolsApiAxiosParamCreator = function (configuration: Configuration) const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (epochNo !== undefined) { - localVarQueryParameter.epoch_no = epochNo; - } - - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -142,15 +109,13 @@ export const PoolsApiAxiosParamCreator = function (configuration: Configuration) * Returns a list of delegators of the specified pool * @summary Stake pool delegators * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PoolDelegatorsQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ poolDelegators: async ( poolId: string, - count?: number | null, - cursor?: string | null, + localVarQueryParameter: PoolDelegatorsQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'poolId' is not null or undefined @@ -165,19 +130,10 @@ export const PoolsApiAxiosParamCreator = function (configuration: Configuration) const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -195,19 +151,13 @@ export const PoolsApiAxiosParamCreator = function (configuration: Configuration) * Returns per-epoch information about the specified pool (or just for epoch `epoch_no` if provided) * @summary Stake pool history * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [epochNo] Epoch number to fetch results for - * @param {number | null} [count] The max number of results per page - * @param {PoolHistoryOrderEnum} [order] The order in which the results are sorted (by epoch number) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PoolHistoryQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ poolHistory: async ( poolId: string, - epochNo?: number | null, - count?: number | null, - order?: PoolHistoryOrderEnum, - cursor?: string | null, + localVarQueryParameter: PoolHistoryQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'poolId' is not null or undefined @@ -222,27 +172,10 @@ export const PoolsApiAxiosParamCreator = function (configuration: Configuration) const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (epochNo !== undefined) { - localVarQueryParameter.epoch_no = epochNo; - } - - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (order !== undefined) { - localVarQueryParameter.order = order; - } - - if (cursor !== undefined) { - localVarQueryParameter.cursor = cursor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -284,6 +217,7 @@ export const PoolsApiAxiosParamCreator = function (configuration: Configuration) ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, }; return { @@ -418,94 +352,64 @@ export const PoolsApiFp = function (configuration: Configuration) { /** * Returns a list of currently registered stake pools * @summary List registered stake pools - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {ListPoolsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listPools( - count?: number | null, - cursor?: string | null, + queryParams?: ListPoolsQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.listPools(count, cursor, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.listPools(queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Return information about blocks minted by a given pool for all epochs (or just for epoch `epoch_no` if provided) * @summary Stake pool blocks * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [epochNo] Epoch number to fetch results for - * @param {number | null} [count] The max number of results per page - * @param {PoolBlocksOrderEnum} [order] The order in which the results are sorted (by block absolute slot) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PoolBlocksQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async poolBlocks( poolId: string, - epochNo?: number | null, - count?: number | null, - order?: PoolBlocksOrderEnum, - cursor?: string | null, + queryParams?: PoolBlocksQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.poolBlocks( - poolId, - epochNo, - count, - order, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.poolBlocks(poolId, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of delegators of the specified pool * @summary Stake pool delegators * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PoolDelegatorsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async poolDelegators( poolId: string, - count?: number | null, - cursor?: string | null, + queryParams?: PoolDelegatorsQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.poolDelegators(poolId, count, cursor, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.poolDelegators(poolId, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns per-epoch information about the specified pool (or just for epoch `epoch_no` if provided) * @summary Stake pool history * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [epochNo] Epoch number to fetch results for - * @param {number | null} [count] The max number of results per page - * @param {PoolHistoryOrderEnum} [order] The order in which the results are sorted (by epoch number) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PoolHistoryQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async poolHistory( poolId: string, - epochNo?: number | null, - count?: number | null, - order?: PoolHistoryOrderEnum, - cursor?: string | null, + queryParams?: PoolHistoryQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.poolHistory( - poolId, - epochNo, - count, - order, - cursor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.poolHistory(poolId, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns current information about the specified pool @@ -519,7 +423,7 @@ export const PoolsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.poolInfo(poolId, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns the metadata declared on-chain by the specified stake pool @@ -533,7 +437,7 @@ export const PoolsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.poolMetadata(poolId, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of relays declared on-chain by the specified stake pool @@ -547,7 +451,7 @@ export const PoolsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.poolRelays(poolId, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns a list of updates relating to the specified pool @@ -561,133 +465,133 @@ export const PoolsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.poolUpdates(poolId, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; -/** - * PoolsApi - factory interface - * @export - */ -export const PoolsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = PoolsApiFp(configuration); - return { - /** - * Returns a list of currently registered stake pools - * @summary List registered stake pools - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listPools(count?: number | null, cursor?: string | null, options?: any): AxiosPromise { - return localVarFp.listPools(count, cursor, options).then((request) => request(axios, basePath)); - }, - /** - * Return information about blocks minted by a given pool for all epochs (or just for epoch `epoch_no` if provided) - * @summary Stake pool blocks - * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [epochNo] Epoch number to fetch results for - * @param {number | null} [count] The max number of results per page - * @param {PoolBlocksOrderEnum} [order] The order in which the results are sorted (by block absolute slot) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolBlocks( - poolId: string, - epochNo?: number | null, - count?: number | null, - order?: PoolBlocksOrderEnum, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .poolBlocks(poolId, epochNo, count, order, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns a list of delegators of the specified pool - * @summary Stake pool delegators - * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolDelegators( - poolId: string, - count?: number | null, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .poolDelegators(poolId, count, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns per-epoch information about the specified pool (or just for epoch `epoch_no` if provided) - * @summary Stake pool history - * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [epochNo] Epoch number to fetch results for - * @param {number | null} [count] The max number of results per page - * @param {PoolHistoryOrderEnum} [order] The order in which the results are sorted (by epoch number) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolHistory( - poolId: string, - epochNo?: number | null, - count?: number | null, - order?: PoolHistoryOrderEnum, - cursor?: string | null, - options?: any, - ): AxiosPromise { - return localVarFp - .poolHistory(poolId, epochNo, count, order, cursor, options) - .then((request) => request(axios, basePath)); - }, - /** - * Returns current information about the specified pool - * @summary Stake pool information - * @param {string} poolId Pool ID in bech32 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolInfo(poolId: string, options?: any): AxiosPromise { - return localVarFp.poolInfo(poolId, options).then((request) => request(axios, basePath)); - }, - /** - * Returns the metadata declared on-chain by the specified stake pool - * @summary Stake pool metadata - * @param {string} poolId Pool ID in bech32 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolMetadata(poolId: string, options?: any): AxiosPromise { - return localVarFp.poolMetadata(poolId, options).then((request) => request(axios, basePath)); - }, - /** - * Returns a list of relays declared on-chain by the specified stake pool - * @summary Stake pool relays - * @param {string} poolId Pool ID in bech32 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolRelays(poolId: string, options?: any): AxiosPromise { - return localVarFp.poolRelays(poolId, options).then((request) => request(axios, basePath)); - }, - /** - * Returns a list of updates relating to the specified pool - * @summary Stake pool updates - * @param {string} poolId Pool ID in bech32 format - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - poolUpdates(poolId: string, options?: any): AxiosPromise { - return localVarFp.poolUpdates(poolId, options).then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * PoolsApi - factory interface +// * @export +// */ +// export const PoolsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = PoolsApiFp(configuration); +// return { +// /** +// * Returns a list of currently registered stake pools +// * @summary List registered stake pools +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// listPools(count?: number | null, cursor?: string | null, options?: any): AxiosPromise { +// return localVarFp.listPools(count, cursor, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Return information about blocks minted by a given pool for all epochs (or just for epoch `epoch_no` if provided) +// * @summary Stake pool blocks +// * @param {string} poolId Pool ID in bech32 format +// * @param {number | null} [epochNo] Epoch number to fetch results for +// * @param {number | null} [count] The max number of results per page +// * @param {PoolBlocksOrderEnum} [order] The order in which the results are sorted (by block absolute slot) +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// poolBlocks( +// poolId: string, +// epochNo?: number | null, +// count?: number | null, +// order?: PoolBlocksOrderEnum, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .poolBlocks(poolId, epochNo, count, order, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of delegators of the specified pool +// * @summary Stake pool delegators +// * @param {string} poolId Pool ID in bech32 format +// * @param {number | null} [count] The max number of results per page +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// poolDelegators( +// poolId: string, +// count?: number | null, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .poolDelegators(poolId, count, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns per-epoch information about the specified pool (or just for epoch `epoch_no` if provided) +// * @summary Stake pool history +// * @param {string} poolId Pool ID in bech32 format +// * @param {number | null} [epochNo] Epoch number to fetch results for +// * @param {number | null} [count] The max number of results per page +// * @param {PoolHistoryOrderEnum} [order] The order in which the results are sorted (by epoch number) +// * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// poolHistory( +// poolId: string, +// epochNo?: number | null, +// count?: number | null, +// order?: PoolHistoryOrderEnum, +// cursor?: string | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .poolHistory(poolId, epochNo, count, order, cursor, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Returns current information about the specified pool +// * @summary Stake pool information +// * @param {string} poolId Pool ID in bech32 format +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// poolInfo(poolId: string, options?: any): AxiosPromise { +// return localVarFp.poolInfo(poolId, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns the metadata declared on-chain by the specified stake pool +// * @summary Stake pool metadata +// * @param {string} poolId Pool ID in bech32 format +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// poolMetadata(poolId: string, options?: any): AxiosPromise { +// return localVarFp.poolMetadata(poolId, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of relays declared on-chain by the specified stake pool +// * @summary Stake pool relays +// * @param {string} poolId Pool ID in bech32 format +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// poolRelays(poolId: string, options?: any): AxiosPromise { +// return localVarFp.poolRelays(poolId, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns a list of updates relating to the specified pool +// * @summary Stake pool updates +// * @param {string} poolId Pool ID in bech32 format +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// poolUpdates(poolId: string, options?: any): AxiosPromise { +// return localVarFp.poolUpdates(poolId, options).then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/pools/index.ts b/src/api/pools/index.ts index 3efd44d..096cd8b 100644 --- a/src/api/pools/index.ts +++ b/src/api/pools/index.ts @@ -1,7 +1,7 @@ import { AxiosRequestConfig } from 'axios'; import { BaseAPI } from '../../base'; import { PoolsApiFp } from './helpers'; -import { PoolBlocksOrderEnum, PoolHistoryOrderEnum } from './type'; +import { ListPoolsQueryParams, PoolBlocksQueryParams, PoolDelegatorsQueryParams, PoolHistoryQueryParams } from './type'; /** * PoolsApi - object-oriented interface @@ -13,82 +13,60 @@ export class PoolsApi extends BaseAPI { /** * Returns a list of currently registered stake pools * @summary List registered stake pools - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {ListPoolsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PoolsApi */ - public listPools(count?: number | null, cursor?: string | null, options?: AxiosRequestConfig) { + public listPools(queryParams?: ListPoolsQueryParams, options?: AxiosRequestConfig) { return PoolsApiFp(this.configuration) - .listPools(count, cursor, options) - .then((request) => request(this.axios)); + .listPools(queryParams, options) + .then((request) => request()); } /** * Return information about blocks minted by a given pool for all epochs (or just for epoch `epoch_no` if provided) * @summary Stake pool blocks * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [epochNo] Epoch number to fetch results for - * @param {number | null} [count] The max number of results per page - * @param {PoolBlocksOrderEnum} [order] The order in which the results are sorted (by block absolute slot) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PoolBlocksQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PoolsApi */ - public poolBlocks( - poolId: string, - epochNo?: number | null, - count?: number | null, - order?: PoolBlocksOrderEnum, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public poolBlocks(poolId: string, queryParams?: PoolBlocksQueryParams, options?: AxiosRequestConfig) { return PoolsApiFp(this.configuration) - .poolBlocks(poolId, epochNo, count, order, cursor, options) - .then((request) => request(this.axios)); + .poolBlocks(poolId, queryParams, options) + .then((request) => request()); } /** * Returns a list of delegators of the specified pool * @summary Stake pool delegators * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [count] The max number of results per page - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PoolDelegatorsQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PoolsApi */ - public poolDelegators(poolId: string, count?: number | null, cursor?: string | null, options?: AxiosRequestConfig) { + public poolDelegators(poolId: string, queryParams?: PoolDelegatorsQueryParams, options?: AxiosRequestConfig) { return PoolsApiFp(this.configuration) - .poolDelegators(poolId, count, cursor, options) - .then((request) => request(this.axios)); + .poolDelegators(poolId, queryParams, options) + .then((request) => request()); } /** * Returns per-epoch information about the specified pool (or just for epoch `epoch_no` if provided) * @summary Stake pool history * @param {string} poolId Pool ID in bech32 format - * @param {number | null} [epochNo] Epoch number to fetch results for - * @param {number | null} [count] The max number of results per page - * @param {PoolHistoryOrderEnum} [order] The order in which the results are sorted (by epoch number) - * @param {string | null} [cursor] Pagination cursor string, use the cursor included in a page of results to fetch the next page + * @param {PoolHistoryQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PoolsApi */ - public poolHistory( - poolId: string, - epochNo?: number | null, - count?: number | null, - order?: PoolHistoryOrderEnum, - cursor?: string | null, - options?: AxiosRequestConfig, - ) { + public poolHistory(poolId: string, queryParams?: PoolHistoryQueryParams, options?: AxiosRequestConfig) { return PoolsApiFp(this.configuration) - .poolHistory(poolId, epochNo, count, order, cursor, options) - .then((request) => request(this.axios)); + .poolHistory(poolId, queryParams, options) + .then((request) => request()); } /** @@ -102,7 +80,7 @@ export class PoolsApi extends BaseAPI { public poolInfo(poolId: string, options?: AxiosRequestConfig) { return PoolsApiFp(this.configuration) .poolInfo(poolId, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -116,7 +94,7 @@ export class PoolsApi extends BaseAPI { public poolMetadata(poolId: string, options?: AxiosRequestConfig) { return PoolsApiFp(this.configuration) .poolMetadata(poolId, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -130,7 +108,7 @@ export class PoolsApi extends BaseAPI { public poolRelays(poolId: string, options?: AxiosRequestConfig) { return PoolsApiFp(this.configuration) .poolRelays(poolId, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -144,6 +122,8 @@ export class PoolsApi extends BaseAPI { public poolUpdates(poolId: string, options?: AxiosRequestConfig) { return PoolsApiFp(this.configuration) .poolUpdates(poolId, options) - .then((request) => request(this.axios)); + .then((request) => request()); } } + +export * from './type'; diff --git a/src/api/pools/type.ts b/src/api/pools/type.ts index c4ea012..007175b 100644 --- a/src/api/pools/type.ts +++ b/src/api/pools/type.ts @@ -14,3 +14,111 @@ export const PoolHistoryOrderEnum = { Desc: 'desc', } as const; export type PoolHistoryOrderEnum = (typeof PoolHistoryOrderEnum)[keyof typeof PoolHistoryOrderEnum]; + +/** + * Query parameters for listPools. + * @export + * @interface ListPoolsQueryParams + * + */ +export interface ListPoolsQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof ListPoolsQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof ListPoolsQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for poolBlocks. + * @export + * @interface PoolBlocksQueryParams + * + */ +export interface PoolBlocksQueryParams { + /** + * Epoch number to fetch results for + * @type {number | null} + * @memberof PoolBlocksQueryParams + */ + epochNo?: number | null; + /** + * The max number of results per page. + * @type {number | null} + * @memberof PoolBlocksQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted (by block absolute slot) + * @type {PoolBlocksOrderEnum} + * @memberof PoolBlocksQueryParams + */ + order?: PoolBlocksOrderEnum; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof PoolBlocksQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for poolDelegators. + * @export + * @interface PoolDelegatorsQueryParams + * + */ +export interface PoolDelegatorsQueryParams { + /** + * The max number of results per page. + * @type {number | null} + * @memberof PoolDelegatorsQueryParams + */ + count?: number | null; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof PoolDelegatorsQueryParams + */ + cursor?: string | null; +} + +/** + * Query parameters for poolHistory. + * @export + * @interface PoolHistoryQueryParams + * + */ +export interface PoolHistoryQueryParams { + /** + * Epoch number to fetch results for + * @type {number | null} + * @memberof PoolHistoryQueryParams + */ + epochNo?: number | null; + /** + * The max number of results per page. + * @type {number | null} + * @memberof PoolHistoryQueryParams + */ + count?: number | null; + /** + * The order in which the results are sorted (by block absolute slot) + * @type {PoolHistoryOrderEnum} + * @memberof PoolHistoryQueryParams + */ + order?: PoolHistoryOrderEnum; + /** + * Pagination cursor string, use the cursor included in a page of results to fetch the next page. + * @type {string | null} + * @memberof PoolHistoryQueryParams + */ + cursor?: string | null; +} diff --git a/src/api/scripts/helpers.ts b/src/api/scripts/helpers.ts index 27b91d1..fa6bc91 100644 --- a/src/api/scripts/helpers.ts +++ b/src/api/scripts/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { assertParamExists, @@ -77,27 +77,27 @@ export const ScriptsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.scriptByHash(scriptHash, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; -/** - * ScriptsApi - factory interface - * @export - */ -export const ScriptsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = ScriptsApiFp(configuration); - return { - /** - * Returns the script corresponding to the specified script hash, if the script has been seen on-chain - * @summary Script by script hash - * @param {string} scriptHash Hex encoded script hash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - scriptByHash(scriptHash: string, options?: any): AxiosPromise { - return localVarFp.scriptByHash(scriptHash, options).then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * ScriptsApi - factory interface +// * @export +// */ +// export const ScriptsApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = ScriptsApiFp(configuration); +// return { +// /** +// * Returns the script corresponding to the specified script hash, if the script has been seen on-chain +// * @summary Script by script hash +// * @param {string} scriptHash Hex encoded script hash +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// scriptByHash(scriptHash: string, options?: any): AxiosPromise { +// return localVarFp.scriptByHash(scriptHash, options).then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/scripts/index.ts b/src/api/scripts/index.ts index c23e0c6..1604e96 100644 --- a/src/api/scripts/index.ts +++ b/src/api/scripts/index.ts @@ -20,6 +20,6 @@ export class ScriptsApi extends BaseAPI { public scriptByHash(scriptHash: string, options?: AxiosRequestConfig) { return ScriptsApiFp(this.configuration) .scriptByHash(scriptHash, options) - .then((request) => request(this.axios)); + .then((request) => request()); } } diff --git a/src/api/transactionManager/helpers.ts b/src/api/transactionManager/helpers.ts index 7fde6b6..4fcd830 100644 --- a/src/api/transactionManager/helpers.ts +++ b/src/api/transactionManager/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { DUMMY_BASE_URL, @@ -6,11 +6,11 @@ import { setSearchParams, toPathString, assertParamExists, - serializeDataIfNeeded, createRequestFunction, } from '../../common'; import { Configuration } from '../../configuration'; import { TxManagerState } from '../type'; +import { TxManagerHistoryQueryParams } from './type'; /** * TransactionManagerApi - axios parameter creator @@ -21,14 +21,12 @@ export const TransactionManagerApiAxiosParamCreator = function (configuration: C /** * Returns the history of submitted transactions * @summary Transactions history - * @param {number} [count] The max number of results per pagination page - * @param {number} [page] Pagination page number to show results for + * @param {TxManagerHistoryQueryParams} [localVarQueryParameter] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ txManagerHistory: async ( - count?: number, - page?: number, + localVarQueryParameter: TxManagerHistoryQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { const localVarPath = `/txmanager/history`; @@ -38,19 +36,10 @@ export const TransactionManagerApiAxiosParamCreator = function (configuration: C const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (count !== undefined) { - localVarQueryParameter.count = count; - } - - if (page !== undefined) { - localVarQueryParameter.page = page; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -105,7 +94,7 @@ export const TransactionManagerApiAxiosParamCreator = function (configuration: C /** * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [monitored by Maestro](../Dapp%20Platform/Transaction%20Manager). * @summary Submit transaction - * @param {string} body CBOR encoded transaction + * @param {string | Uint8Array} body CBOR encoded transaction * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -133,7 +122,6 @@ export const TransactionManagerApiAxiosParamCreator = function (configuration: C ...headersFromBaseOptions, ...options.headers, }; - // localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration); localVarRequestOptions.data = typeof body === 'string' ? Buffer.from(body, 'hex') : Buffer.from(body); return { url: toPathString(localVarUrlObj), @@ -143,11 +131,14 @@ export const TransactionManagerApiAxiosParamCreator = function (configuration: C /** * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [Turbo Submitted and Monitored by Maestro](../Dapp%20Platform/Turbo%20Transaction). * @summary Turbo submit transaction - * @param {string} body CBOR encoded transaction + * @param {string | Uint8Array} body CBOR encoded transaction * @param {*} [options] Override http request option. * @throws {RequiredError} */ - txManagerTurboSubmit: async (body: string, options: AxiosRequestConfig = {}): Promise => { + txManagerTurboSubmit: async ( + body: string | Uint8Array, + options: AxiosRequestConfig = {}, + ): Promise => { // verify required parameter 'body' is not null or undefined assertParamExists('txManagerTurboSubmit', 'body', body); const localVarPath = `/txmanager/turbosubmit`; @@ -171,8 +162,7 @@ export const TransactionManagerApiAxiosParamCreator = function (configuration: C ...headersFromBaseOptions, ...options.headers, }; - localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration); - + localVarRequestOptions.data = typeof body === 'string' ? Buffer.from(body, 'hex') : Buffer.from(body); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, @@ -191,18 +181,16 @@ export const TransactionManagerApiFp = function (configuration: Configuration) { /** * Returns the history of submitted transactions * @summary Transactions history - * @param {number} [count] The max number of results per pagination page - * @param {number} [page] Pagination page number to show results for + * @param {TxManagerHistoryQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async txManagerHistory( - count?: number, - page?: number, + queryParams?: TxManagerHistoryQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.txManagerHistory(count, page, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.txManagerHistory(queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns the most recent state of a transaction @@ -216,12 +204,12 @@ export const TransactionManagerApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.txManagerState(txHash, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [monitored by Maestro](../Dapp%20Platform/Transaction%20Manager). * @summary Submit transaction - * @param {string} body CBOR encoded transaction + * @param {string | Uint8Array} body CBOR encoded transaction * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -230,76 +218,76 @@ export const TransactionManagerApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.txManagerSubmit(body, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [Turbo Submitted and Monitored by Maestro](../Dapp%20Platform/Turbo%20Transaction). * @summary Turbo submit transaction - * @param {string} body CBOR encoded transaction + * @param {string | Uint8Array} body CBOR encoded transaction * @param {*} [options] Override http request option. * @throws {RequiredError} */ async txManagerTurboSubmit( - body: string, + body: string | Uint8Array, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.txManagerTurboSubmit(body, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; -/** - * TransactionManagerApi - factory interface - * @export - */ -export const TransactionManagerApiFactory = function ( - configuration: Configuration, - basePath?: string, - axios?: AxiosInstance, -) { - const localVarFp = TransactionManagerApiFp(configuration); - return { - /** - * Returns the history of submitted transactions - * @summary Transactions history - * @param {number} [count] The max number of results per pagination page - * @param {number} [page] Pagination page number to show results for - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txManagerHistory(count?: number, page?: number, options?: any): AxiosPromise> { - return localVarFp.txManagerHistory(count, page, options).then((request) => request(axios, basePath)); - }, - /** - * Returns the most recent state of a transaction - * @summary Transaction state - * @param {string} txHash Hex encoded transaction hash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txManagerState(txHash: string, options?: any): AxiosPromise { - return localVarFp.txManagerState(txHash, options).then((request) => request(axios, basePath)); - }, - /** - * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [monitored by Maestro](../Dapp%20Platform/Transaction%20Manager). - * @summary Submit transaction - * @param {string} body CBOR encoded transaction - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txManagerSubmit(body: string, options?: any): AxiosPromise { - return localVarFp.txManagerSubmit(body, options).then((request) => request(axios, basePath)); - }, - /** - * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [Turbo Submitted and Monitored by Maestro](../Dapp%20Platform/Turbo%20Transaction). - * @summary Turbo submit transaction - * @param {string} body CBOR encoded transaction - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txManagerTurboSubmit(body: string, options?: any): AxiosPromise { - return localVarFp.txManagerTurboSubmit(body, options).then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * TransactionManagerApi - factory interface +// * @export +// */ +// export const TransactionManagerApiFactory = function ( +// configuration: Configuration, +// basePath?: string, +// axios?: AxiosInstance, +// ) { +// const localVarFp = TransactionManagerApiFp(configuration); +// return { +// /** +// * Returns the history of submitted transactions +// * @summary Transactions history +// * @param {number} [count] The max number of results per pagination page +// * @param {number} [page] Pagination page number to show results for +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txManagerHistory(count?: number, page?: number, options?: any): AxiosPromise> { +// return localVarFp.txManagerHistory(count, page, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns the most recent state of a transaction +// * @summary Transaction state +// * @param {string} txHash Hex encoded transaction hash +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txManagerState(txHash: string, options?: any): AxiosPromise { +// return localVarFp.txManagerState(txHash, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [monitored by Maestro](../Dapp%20Platform/Transaction%20Manager). +// * @summary Submit transaction +// * @param {string} body CBOR encoded transaction +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txManagerSubmit(body: string, options?: any): AxiosPromise { +// return localVarFp.txManagerSubmit(body, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [Turbo Submitted and Monitored by Maestro](../Dapp%20Platform/Turbo%20Transaction). +// * @summary Turbo submit transaction +// * @param {string} body CBOR encoded transaction +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txManagerTurboSubmit(body: string, options?: any): AxiosPromise { +// return localVarFp.txManagerTurboSubmit(body, options).then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/transactionManager/index.ts b/src/api/transactionManager/index.ts index bb7c17a..e3be02f 100644 --- a/src/api/transactionManager/index.ts +++ b/src/api/transactionManager/index.ts @@ -1,6 +1,7 @@ import { AxiosRequestConfig } from 'axios'; import { BaseAPI } from '../../base'; import { TransactionManagerApiFp } from './helpers'; +import { TxManagerHistoryQueryParams } from './type'; /** * TransactionManagerApi - object-oriented interface @@ -12,16 +13,15 @@ export class TransactionManagerApi extends BaseAPI { /** * Returns the history of submitted transactions * @summary Transactions history - * @param {number} [count] The max number of results per pagination page - * @param {number} [page] Pagination page number to show results for + * @param {TxManagerHistoryQueryParams} [queryParams] Query parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransactionManagerApi */ - public txManagerHistory(count?: number, page?: number, options?: AxiosRequestConfig) { + public txManagerHistory(queryParams?: TxManagerHistoryQueryParams, options?: AxiosRequestConfig) { return TransactionManagerApiFp(this.configuration) - .txManagerHistory(count, page, options) - .then((request) => request(this.axios)); + .txManagerHistory(queryParams, options) + .then((request) => request()); } /** @@ -35,13 +35,13 @@ export class TransactionManagerApi extends BaseAPI { public txManagerState(txHash: string, options?: AxiosRequestConfig) { return TransactionManagerApiFp(this.configuration) .txManagerState(txHash, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [monitored by Maestro](../Dapp%20Platform/Transaction%20Manager). * @summary Submit transaction - * @param {string} body CBOR encoded transaction + * @param {string | Uint8Array} body CBOR encoded transaction * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransactionManagerApi @@ -49,20 +49,20 @@ export class TransactionManagerApi extends BaseAPI { public txManagerSubmit(body: string | Uint8Array, options?: AxiosRequestConfig) { return TransactionManagerApiFp(this.configuration) .txManagerSubmit(body, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** * Submit a signed and serialized transaction to the network. A transaction submited with this endpoint will be [Turbo Submitted and Monitored by Maestro](../Dapp%20Platform/Turbo%20Transaction). * @summary Turbo submit transaction - * @param {string} body CBOR encoded transaction + * @param {string | Uint8Array} body CBOR encoded transaction * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransactionManagerApi */ - public txManagerTurboSubmit(body: string, options?: AxiosRequestConfig) { + public txManagerTurboSubmit(body: string | Uint8Array, options?: AxiosRequestConfig) { return TransactionManagerApiFp(this.configuration) .txManagerTurboSubmit(body, options) - .then((request) => request(this.axios)); + .then((request) => request()); } } diff --git a/src/api/transactionManager/type.ts b/src/api/transactionManager/type.ts new file mode 100644 index 0000000..7e5d175 --- /dev/null +++ b/src/api/transactionManager/type.ts @@ -0,0 +1,22 @@ +/** + * Query parameters for txManagerHistory. + * @export + * @interface TxManagerHistoryQueryParams + * + */ +export interface TxManagerHistoryQueryParams { + // * @param {number} [count] + // * @param {number} [page] + /** + * The max number of results per pagination page + * @type {number | null} + * @memberof TxManagerHistoryQueryParams + */ + count?: number | null; + /** + * Pagination page number to show results for + * @type {string | null} + * @memberof TxManagerHistoryQueryParams + */ + page?: string | null; +} diff --git a/src/api/transactions/helpers.ts b/src/api/transactions/helpers.ts index 4c0ac22..08eb7a0 100644 --- a/src/api/transactions/helpers.ts +++ b/src/api/transactions/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { assertParamExists, @@ -8,6 +8,7 @@ import { toPathString, serializeDataIfNeeded, createRequestFunction, + HEADER_AMOUNTS_AS_STRING, } from '../../common'; import { Configuration } from '../../configuration'; import { @@ -17,6 +18,7 @@ import { TimestampedUtxo, PaginatedUtxoWithBytes, } from '../type'; +import { TxoByTxoRefQueryParams, TxosByTxoRefsQueryParams } from './type'; /** * TransactionsApi - axios parameter creator @@ -145,14 +147,14 @@ export const TransactionsApiAxiosParamCreator = function (configuration: Configu * @summary Transaction output by output reference * @param {string} txHash Transaction Hash * @param {number} index Output Index - * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response + * @param {TxoByTxoRefQueryParams} [localVarQueryParameter] Query Parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ txoByTxoRef: async ( txHash: string, index: number, - withCbor?: boolean | null, + localVarQueryParameter: TxoByTxoRefQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'txHash' is not null or undefined @@ -168,15 +170,10 @@ export const TransactionsApiAxiosParamCreator = function (configuration: Configu const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (withCbor !== undefined) { - localVarQueryParameter.with_cbor = withCbor; - } - setSearchParams(localVarUrlObj, localVarQueryParameter); const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { @@ -194,15 +191,13 @@ export const TransactionsApiAxiosParamCreator = function (configuration: Configu * Returns the specified transaction outputs * @summary Transaction outputs by output references * @param {Array} requestBody - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response + * @param {TxosByTxoRefsQueryParams} [localVarQueryParameter] Query Parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ txosByTxoRefs: async ( requestBody: Array, - resolveDatums?: boolean | null, - withCbor?: boolean | null, + localVarQueryParameter: TxosByTxoRefsQueryParams = {}, options: AxiosRequestConfig = {}, ): Promise => { // verify required parameter 'requestBody' is not null or undefined @@ -214,19 +209,10 @@ export const TransactionsApiAxiosParamCreator = function (configuration: Configu const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; // authentication api-key required setApiKeyToObject(localVarHeaderParameter, 'api-key', configuration); - if (resolveDatums !== undefined) { - localVarQueryParameter.resolve_datums = resolveDatums; - } - - if (withCbor !== undefined) { - localVarQueryParameter.with_cbor = withCbor; - } - localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); @@ -235,6 +221,7 @@ export const TransactionsApiAxiosParamCreator = function (configuration: Configu ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, + ...HEADER_AMOUNTS_AS_STRING, }; localVarRequestOptions.data = serializeDataIfNeeded(requestBody, localVarRequestOptions, configuration); @@ -267,7 +254,7 @@ export const TransactionsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.addressByTxo(txHash, index, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns hex-encoded CBOR bytes of a transaction @@ -281,7 +268,7 @@ export const TransactionsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.txCborByTxHash(txHash, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns detailed information about a transaction @@ -295,129 +282,122 @@ export const TransactionsApiFp = function (configuration: Configuration) { options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.txInfo(txHash, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns the specified transaction output. * @summary Transaction output by output reference * @param {string} txHash Transaction Hash * @param {number} index Output Index - * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response + * @param {TxoByTxoRefQueryParams} [queryParams] Query Parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ async txoByTxoRef( txHash: string, index: number, - withCbor?: boolean | null, + queryParams?: TxoByTxoRefQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.txoByTxoRef(txHash, index, withCbor, options); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.txoByTxoRef(txHash, index, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Returns the specified transaction outputs * @summary Transaction outputs by output references * @param {Array} requestBody - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response + * @param {TxosByTxoRefsQueryParams} [queryParams] Query Parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ async txosByTxoRefs( requestBody: Array, - resolveDatums?: boolean | null, - withCbor?: boolean | null, + queryParams?: TxosByTxoRefsQueryParams, options?: AxiosRequestConfig, ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.txosByTxoRefs( - requestBody, - resolveDatums, - withCbor, - options, - ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + const localVarAxiosArgs = await localVarAxiosParamCreator.txosByTxoRefs(requestBody, queryParams, options); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; -/** - * TransactionsApi - factory interface - * @export - */ -export const TransactionsApiFactory = function ( - configuration: Configuration, - basePath?: string, - axios?: AxiosInstance, -) { - const localVarFp = TransactionsApiFp(configuration); - return { - /** - * Returns the address which was specified in the given transaction output. Note that if the transaction is invalid this will only return a result for the collateral return output, should one be present in the transaction. If the transaction is valid it will not return a result for the collateral return output. - * @summary Address by transaction output reference - * @param {string} txHash Transaction Hash - * @param {number} index Output Index - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - addressByTxo(txHash: string, index: number, options?: any): AxiosPromise { - return localVarFp.addressByTxo(txHash, index, options).then((request) => request(axios, basePath)); - }, - /** - * Returns hex-encoded CBOR bytes of a transaction - * @summary CBOR bytes of a transaction - * @param {string} txHash Transaction Hash - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txCborByTxHash(txHash: string, options?: any): AxiosPromise { - return localVarFp.txCborByTxHash(txHash, options).then((request) => request(axios, basePath)); - }, - /** - * Returns detailed information about a transaction - * @summary Transaction details - * @param {string} txHash Transaction hash in hex - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txInfo(txHash: string, options?: any): AxiosPromise { - return localVarFp.txInfo(txHash, options).then((request) => request(axios, basePath)); - }, - /** - * Returns the specified transaction output. - * @summary Transaction output by output reference - * @param {string} txHash Transaction Hash - * @param {number} index Output Index - * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txoByTxoRef( - txHash: string, - index: number, - withCbor?: boolean | null, - options?: any, - ): AxiosPromise { - return localVarFp.txoByTxoRef(txHash, index, withCbor, options).then((request) => request(axios, basePath)); - }, - /** - * Returns the specified transaction outputs - * @summary Transaction outputs by output references - * @param {Array} requestBody - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - txosByTxoRefs( - requestBody: Array, - resolveDatums?: boolean | null, - withCbor?: boolean | null, - options?: any, - ): AxiosPromise { - return localVarFp - .txosByTxoRefs(requestBody, resolveDatums, withCbor, options) - .then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * TransactionsApi - factory interface +// * @export +// */ +// export const TransactionsApiFactory = function ( +// configuration: Configuration, +// basePath?: string, +// axios?: AxiosInstance, +// ) { +// const localVarFp = TransactionsApiFp(configuration); +// return { +// /** +// * Returns the address which was specified in the given transaction output. Note that if the transaction is invalid this will only return a result for the collateral return output, should one be present in the transaction. If the transaction is valid it will not return a result for the collateral return output. +// * @summary Address by transaction output reference +// * @param {string} txHash Transaction Hash +// * @param {number} index Output Index +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// addressByTxo(txHash: string, index: number, options?: any): AxiosPromise { +// return localVarFp.addressByTxo(txHash, index, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns hex-encoded CBOR bytes of a transaction +// * @summary CBOR bytes of a transaction +// * @param {string} txHash Transaction Hash +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txCborByTxHash(txHash: string, options?: any): AxiosPromise { +// return localVarFp.txCborByTxHash(txHash, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns detailed information about a transaction +// * @summary Transaction details +// * @param {string} txHash Transaction hash in hex +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txInfo(txHash: string, options?: any): AxiosPromise { +// return localVarFp.txInfo(txHash, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns the specified transaction output. +// * @summary Transaction output by output reference +// * @param {string} txHash Transaction Hash +// * @param {number} index Output Index +// * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txoByTxoRef( +// txHash: string, +// index: number, +// withCbor?: boolean | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp.txoByTxoRef(txHash, index, withCbor, options).then((request) => request(axios, basePath)); +// }, +// /** +// * Returns the specified transaction outputs +// * @summary Transaction outputs by output references +// * @param {Array} requestBody +// * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes +// * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// txosByTxoRefs( +// requestBody: Array, +// resolveDatums?: boolean | null, +// withCbor?: boolean | null, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .txosByTxoRefs(requestBody, resolveDatums, withCbor, options) +// .then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/transactions/index.ts b/src/api/transactions/index.ts index 93b89e8..d3f37c5 100644 --- a/src/api/transactions/index.ts +++ b/src/api/transactions/index.ts @@ -1,6 +1,7 @@ import { AxiosRequestConfig } from 'axios'; import { BaseAPI } from '../../base'; import { TransactionsApiFp } from './helpers'; +import { TxoByTxoRefQueryParams } from './type'; /** * TransactionsApi - object-oriented interface @@ -21,7 +22,7 @@ export class TransactionsApi extends BaseAPI { public addressByTxo(txHash: string, index: number, options?: AxiosRequestConfig) { return TransactionsApiFp(this.configuration) .addressByTxo(txHash, index, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -35,7 +36,7 @@ export class TransactionsApi extends BaseAPI { public txCborByTxHash(txHash: string, options?: AxiosRequestConfig) { return TransactionsApiFp(this.configuration) .txCborByTxHash(txHash, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -49,7 +50,7 @@ export class TransactionsApi extends BaseAPI { public txInfo(txHash: string, options?: AxiosRequestConfig) { return TransactionsApiFp(this.configuration) .txInfo(txHash, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -57,35 +58,38 @@ export class TransactionsApi extends BaseAPI { * @summary Transaction output by output reference * @param {string} txHash Transaction Hash * @param {number} index Output Index - * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response + * @param {TxoByTxoRefQueryParams} [queryParams] Query Parameters * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransactionsApi */ - public txoByTxoRef(txHash: string, index: number, withCbor?: boolean | null, options?: AxiosRequestConfig) { + public txoByTxoRef( + txHash: string, + index: number, + queryParams?: TxoByTxoRefQueryParams, + options?: AxiosRequestConfig, + ) { return TransactionsApiFp(this.configuration) - .txoByTxoRef(txHash, index, withCbor, options) - .then((request) => request(this.axios)); + .txoByTxoRef(txHash, index, queryParams, options) + .then((request) => request()); } /** * Returns the specified transaction outputs * @summary Transaction outputs by output references * @param {Array} requestBody - * @param {boolean | null} [resolveDatums] Try find and include the corresponding datums for datum hashes - * @param {boolean | null} [withCbor] Include the CBOR encoding of the transaction output in the response + * @param {TxosByTxoRefsQueryParams} [queryParams] Query Parameters * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransactionsApi */ public txosByTxoRefs( requestBody: Array, - resolveDatums?: boolean | null, - withCbor?: boolean | null, + queryParams?: TxoByTxoRefQueryParams, options?: AxiosRequestConfig, ) { return TransactionsApiFp(this.configuration) - .txosByTxoRefs(requestBody, resolveDatums, withCbor, options) - .then((request) => request(this.axios)); + .txosByTxoRefs(requestBody, queryParams, options) + .then((request) => request()); } } diff --git a/src/api/transactions/type.ts b/src/api/transactions/type.ts new file mode 100644 index 0000000..7088ead --- /dev/null +++ b/src/api/transactions/type.ts @@ -0,0 +1,35 @@ +/** + * Query parameters for txoByTxoRef. + * @export + * @interface TxoByTxoRefQueryParams + * + */ +export interface TxoByTxoRefQueryParams { + /** + * Include the CBOR encoding of the transaction output in the response + * @type {boolean | null} + * @memberof TxoByTxoRefQueryParams + */ + withCbor?: boolean | null; +} + +/** + * Query parameters for txosByTxoRefs. + * @export + * @interface TxosByTxoRefsQueryParams + * + */ +export interface TxosByTxoRefsQueryParams { + /** + * Try find and include the corresponding datums for datum hashes + * @type {boolean | null} + * @memberof TxosByTxoRefsQueryParams + */ + resolveDatums?: boolean | null; + /** + * Include the CBOR encoding of the transaction output in the response + * @type {boolean | null} + * @memberof TxosByTxoRefsQueryParams + */ + withCbor?: boolean | null; +} diff --git a/src/api/type.ts b/src/api/type.ts index 171a55d..f073cc8 100644 --- a/src/api/type.ts +++ b/src/api/type.ts @@ -271,10 +271,10 @@ export interface AddressTransaction { export interface Asset { /** * Amount of the asset - * @type {number} + * @type {string} * @memberof Asset */ - amount: number; + amount: string; /** * Asset (either `lovelace` or concatenation of hex encoded policy ID and asset name for native asset) * @type {string} @@ -1028,6 +1028,18 @@ export interface DelegatorInfo { * @interface EpochInfo */ export interface EpochInfo { + /** + * Total active stake in the epoch + * @type {number} + * @memberof EpochInfo + */ + active_stake?: string | null; + /** + * Average reward in the epoch + * @type {number} + * @memberof EpochInfo + */ + average_reward?: string | null; /** * Total blocks in the epoch * @type {number} @@ -2237,10 +2249,10 @@ export interface PoolInfo { active_epoch_no: number; /** * Active stake - * @type {number} + * @type {string} * @memberof PoolInfo */ - active_stake?: number | null; + active_stake?: string | null; /** * Number of blocks created * @type {number} @@ -2249,10 +2261,10 @@ export interface PoolInfo { block_count?: number | null; /** * Pool fixed cost - * @type {number} + * @type {string} * @memberof PoolInfo */ - fixed_cost: number; + fixed_cost: string; /** * Number of current delegators * @type {number} @@ -2261,10 +2273,10 @@ export interface PoolInfo { live_delegators: number; /** * Account balance of pool owners - * @type {number} + * @type {string} * @memberof PoolInfo */ - live_pledge?: number | null; + live_pledge?: string | null; /** * Live saturation * @type {string} @@ -2273,16 +2285,16 @@ export interface PoolInfo { live_saturation?: string | null; /** * Live stake - * @type {number} + * @type {string} * @memberof PoolInfo */ - live_stake?: number | null; + live_stake?: string | null; /** * Pool margin - * @type {number} + * @type {string} * @memberof PoolInfo */ - margin: number; + margin: string; /** * Hash of the pool metadata * @type {string} @@ -2321,10 +2333,10 @@ export interface PoolInfo { owners: Array; /** * Pool pledge - * @type {number} + * @type {string} * @memberof PoolInfo */ - pledge: number; + pledge: string; /** * Bech32 encoded pool ID * @type {string} @@ -3213,6 +3225,25 @@ export interface TimestampedDatum { */ last_updated: LastUpdated; } +/** + * Timestamped response. Returns the endpoint response data along with the chain-tip of the indexer, which details at which point in the chain\'s history the data was correct as-of. + * @export + * @interface TimestampedDatums + */ +export interface TimestampedDatums { + /** + * Record of Datum by datum hash + * @type {Record} + * @memberof TimestampedDatum + */ + data: Record; + /** + * + * @type {LastUpdated} + * @memberof TimestampedDatum + */ + last_updated: LastUpdated; +} /** * Timestamped response. Returns the endpoint response data along with the chain-tip of the indexer, which details at which point in the chain\'s history the data was correct as-of. * @export diff --git a/src/api/vesting/helpers.ts b/src/api/vesting/helpers.ts index b9f5b6c..8e4c04f 100644 --- a/src/api/vesting/helpers.ts +++ b/src/api/vesting/helpers.ts @@ -1,4 +1,4 @@ -import globalAxios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; +import { AxiosRequestConfig, AxiosInstance, AxiosPromise } from 'axios'; import { RequestArgs } from '../../base'; import { assertParamExists, @@ -39,7 +39,7 @@ export const VestingApiAxiosParamCreator = function (configuration: Configuratio const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); const { baseOptions } = configuration; - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarRequestOptions: AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; @@ -169,12 +169,12 @@ export const VestingApiFp = function (configuration: Configuration) { async contractsVestingCollectBeneficiaryPost( beneficiary: string, options?: AxiosRequestConfig, - ): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + ): Promise<(basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.contractsVestingCollectBeneficiaryPost( beneficiary, options, ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Lock assets into the vesting contract @@ -191,7 +191,7 @@ export const VestingApiFp = function (configuration: Configuration) { contractsVestingLockPostRequest, options, ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, /** * Detailed list of vesting assets at a beneficiary address @@ -208,59 +208,59 @@ export const VestingApiFp = function (configuration: Configuration) { beneficiary, options, ); - return createRequestFunction(localVarAxiosArgs, globalAxios, configuration); + return createRequestFunction(localVarAxiosArgs, configuration); }, }; }; -/** - * VestingApi - factory interface - * @export - */ -export const VestingApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = VestingApiFp(configuration); - return { - /** - * Collect assets from the vesting contract - * @summary Collect assets - * @param {string} beneficiary Beneficiary\'s bech32 address - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - contractsVestingCollectBeneficiaryPost( - beneficiary: string, - options?: any, - ): AxiosPromise { - return localVarFp - .contractsVestingCollectBeneficiaryPost(beneficiary, options) - .then((request) => request(axios, basePath)); - }, - /** - * Lock assets into the vesting contract - * @summary Lock assets - * @param {ContractsVestingLockPostRequest} contractsVestingLockPostRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - contractsVestingLockPost( - contractsVestingLockPostRequest: ContractsVestingLockPostRequest, - options?: any, - ): AxiosPromise { - return localVarFp - .contractsVestingLockPost(contractsVestingLockPostRequest, options) - .then((request) => request(axios, basePath)); - }, - /** - * Detailed list of vesting assets at a beneficiary address - * @summary State of vesting assets - * @param {string} beneficiary Beneficiary bech32 address - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - contractsVestingStateBeneficiaryGet(beneficiary: string, options?: any): AxiosPromise { - return localVarFp - .contractsVestingStateBeneficiaryGet(beneficiary, options) - .then((request) => request(axios, basePath)); - }, - }; -}; +// /** +// * VestingApi - factory interface +// * @export +// */ +// export const VestingApiFactory = function (configuration: Configuration, basePath?: string, axios?: AxiosInstance) { +// const localVarFp = VestingApiFp(configuration); +// return { +// /** +// * Collect assets from the vesting contract +// * @summary Collect assets +// * @param {string} beneficiary Beneficiary\'s bech32 address +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// contractsVestingCollectBeneficiaryPost( +// beneficiary: string, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .contractsVestingCollectBeneficiaryPost(beneficiary, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Lock assets into the vesting contract +// * @summary Lock assets +// * @param {ContractsVestingLockPostRequest} contractsVestingLockPostRequest +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// contractsVestingLockPost( +// contractsVestingLockPostRequest: ContractsVestingLockPostRequest, +// options?: any, +// ): AxiosPromise { +// return localVarFp +// .contractsVestingLockPost(contractsVestingLockPostRequest, options) +// .then((request) => request(axios, basePath)); +// }, +// /** +// * Detailed list of vesting assets at a beneficiary address +// * @summary State of vesting assets +// * @param {string} beneficiary Beneficiary bech32 address +// * @param {*} [options] Override http request option. +// * @throws {RequiredError} +// */ +// contractsVestingStateBeneficiaryGet(beneficiary: string, options?: any): AxiosPromise { +// return localVarFp +// .contractsVestingStateBeneficiaryGet(beneficiary, options) +// .then((request) => request(axios, basePath)); +// }, +// }; +// }; diff --git a/src/api/vesting/index.ts b/src/api/vesting/index.ts index 6ce76c7..2180898 100644 --- a/src/api/vesting/index.ts +++ b/src/api/vesting/index.ts @@ -21,7 +21,7 @@ export class VestingApi extends BaseAPI { public contractsVestingCollectBeneficiaryPost(beneficiary: string, options?: AxiosRequestConfig) { return VestingApiFp(this.configuration) .contractsVestingCollectBeneficiaryPost(beneficiary, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -38,7 +38,7 @@ export class VestingApi extends BaseAPI { ) { return VestingApiFp(this.configuration) .contractsVestingLockPost(contractsVestingLockPostRequest, options) - .then((request) => request(this.axios)); + .then((request) => request()); } /** @@ -52,6 +52,6 @@ export class VestingApi extends BaseAPI { public contractsVestingStateBeneficiaryGet(beneficiary: string, options?: AxiosRequestConfig) { return VestingApiFp(this.configuration) .contractsVestingStateBeneficiaryGet(beneficiary, options) - .then((request) => request(this.axios)); + .then((request) => request()); } } diff --git a/src/base.ts b/src/base.ts index 1ec0f2c..ebe47d6 100644 --- a/src/base.ts +++ b/src/base.ts @@ -18,7 +18,7 @@ export interface RequestArgs { * @class BaseAPI */ export class BaseAPI { - constructor(protected configuration: Configuration, protected axios: AxiosInstance = globalAxios) {} + constructor(protected configuration: Configuration) {} } /** diff --git a/src/common.ts b/src/common.ts index 68f0de0..872f25d 100644 --- a/src/common.ts +++ b/src/common.ts @@ -1,4 +1,4 @@ -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosResponse } from 'axios'; import type { Configuration } from './configuration'; import type { RequestArgs } from './base'; import { RequiredError } from './base'; @@ -9,6 +9,15 @@ import { RequiredError } from './base'; */ export const DUMMY_BASE_URL = 'https://example.com'; +/** + * temporary header used by some endpoints to indicate that the amounts + * should be returned as strings instead of numbers + * @export + */ +export const HEADER_AMOUNTS_AS_STRING = { + 'amounts-as-strings': 'true', +}; + /** * * @throws {RequiredError} @@ -87,13 +96,9 @@ export const toPathString = function (url: URL) { * * @export */ -export const createRequestFunction = function ( - axiosArgs: RequestArgs, - globalAxios: AxiosInstance, - configuration: Configuration, -) { - return >(axios: AxiosInstance = globalAxios) => { +export const createRequestFunction = function (axiosArgs: RequestArgs, configuration: Configuration) { + return >() => { const axiosRequestArgs = { ...axiosArgs.options, url: configuration.baseUrl + axiosArgs.url }; - return axios.request(axiosRequestArgs); + return configuration.axiosInstance.request(axiosRequestArgs); }; }; diff --git a/src/configuration.ts b/src/configuration.ts index e8e56a6..58e2f24 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -1,9 +1,12 @@ +import globalAxios, { AxiosInstance, AxiosRequestConfig } from 'axios'; + export type MaestroSupportedNetworks = 'Mainnet' | 'Preprod' | 'Preview'; export interface ConfigurationParameters { - apiKey: string; - network: MaestroSupportedNetworks; - baseOptions?: any; + readonly apiKey: string; + readonly network: MaestroSupportedNetworks; + readonly baseOptions?: AxiosRequestConfig; + readonly axiosInstance?: AxiosInstance; } export class Configuration { @@ -12,7 +15,7 @@ export class Configuration { * @param name security name * @memberof Configuration */ - apiKey: string; + readonly apiKey: string; /** * base url of network request @@ -20,20 +23,23 @@ export class Configuration { * @type {string} * @memberof Configuration */ - baseUrl: string; + readonly baseUrl: string; /** * base options for axios calls * - * @type {any} + * @type {AxiosRequestConfig} * @memberof Configuration */ - baseOptions?: any; + readonly baseOptions?: AxiosRequestConfig; + + readonly axiosInstance: AxiosInstance; constructor(param: ConfigurationParameters) { this.apiKey = param.apiKey; this.baseUrl = `https://${param.network}.gomaestro-api.org/v1`; this.baseOptions = param.baseOptions; + this.axiosInstance = param.axiosInstance ?? globalAxios; } /** diff --git a/yarn.lock b/yarn.lock index bf0d503..ba3cdba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -979,10 +979,10 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -axios@^1.5.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.5.1.tgz#11fbaa11fc35f431193a9564109c88c1f27b585f" - integrity sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A== +axios@^1.6.0: + version "1.6.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.1.tgz#76550d644bf0a2d469a01f9244db6753208397d7" + integrity sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g== dependencies: follow-redirects "^1.15.0" form-data "^4.0.0"