Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/change query param to accept typed objects #22

Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fd4d374
feat: building first example of the refactoring
HinsonSIDAN Oct 7, 2023
86cb3a2
docs: updating docs for accountsAddresses
HinsonSIDAN Oct 7, 2023
970f250
docs: updating docs for accountsAddresses
HinsonSIDAN Oct 7, 2023
4c68c12
feat: refactoring accountAssets
HinsonSIDAN Oct 7, 2023
78cae12
feat: refactoring accountHistory
HinsonSIDAN Oct 7, 2023
40e699a
feat: refactoring accountRewards
HinsonSIDAN Oct 7, 2023
7fc6ed8
feat: refactoring accountUpdates
HinsonSIDAN Oct 7, 2023
b95d0a7
feat: refactoring txsByAddress
HinsonSIDAN Oct 7, 2023
df53007
feat: refactoring txsByPaymentCred
HinsonSIDAN Oct 7, 2023
dc55751
feat: refactoring utxoRefsAtAddress
HinsonSIDAN Oct 7, 2023
5f5b93f
feat: refactoring utxosByAddress
HinsonSIDAN Oct 7, 2023
f458220
feat: refactoring utxosByAddresses
HinsonSIDAN Oct 7, 2023
43a9305
feat: refactoring utxosByPaymentCred
HinsonSIDAN Oct 7, 2023
ebffa13
feat: adding type support for asset in address queries
HinsonSIDAN Oct 7, 2023
bd7f6cd
feat: refactoring assetAccounts
HinsonSIDAN Oct 7, 2023
546a61f
feat: refactoring assetAddresses
HinsonSIDAN Oct 7, 2023
a5e02fb
feat: refactoring assetTxs
HinsonSIDAN Oct 7, 2023
7eac9f2
feat: refactoring assetUpdates
HinsonSIDAN Oct 7, 2023
711764a
feat: refactoring assetUtxos
HinsonSIDAN Oct 7, 2023
5790f5e
feat: refactoring policyAccounts
HinsonSIDAN Oct 7, 2023
11a7c67
feat: refactoring policyAddresses
HinsonSIDAN Oct 7, 2023
c8faa88
feat: refactoring policyInfo
HinsonSIDAN Oct 7, 2023
6b254b9
feat: refactoring policyTxs
HinsonSIDAN Oct 7, 2023
323e1dc
feat: refactoring policyUtxos
HinsonSIDAN Oct 7, 2023
c845eab
feat: refactoring listPools
HinsonSIDAN Oct 7, 2023
bc9abab
feat: refactoring poolBlocks
HinsonSIDAN Oct 7, 2023
5cd881a
feat: refactoring poolDelegators
HinsonSIDAN Oct 7, 2023
089a7a9
feat: refactoring poolHistory
HinsonSIDAN Oct 7, 2023
12b8fb7
feat: refactoring txManagerHistory
HinsonSIDAN Oct 7, 2023
ecf58ca
feat: adding tx submission standard on turbo submit with docs added
HinsonSIDAN Oct 7, 2023
8adac3a
feat: refactoring txoByTxoRef
HinsonSIDAN Oct 7, 2023
5dc8d91
feat: refactoring txosByTxoRefs
HinsonSIDAN Oct 7, 2023
8b6ae46
feat: bump package version
HinsonSIDAN Oct 7, 2023
b44688d
feat: bump package version
HinsonSIDAN Oct 11, 2023
04569da
Merge branch 'main' into feature/change-query-param-to-accept-typed-o…
Vardominator Oct 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@maestro-org/typescript-sdk",
"version": "1.1.1",
"version": "1.2.0",
Vardominator marked this conversation as resolved.
Show resolved Hide resolved
"description": "TypeScript SDK for the Maestro Dapp Platform",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
389 changes: 148 additions & 241 deletions src/api/accounts/helpers.ts

Large diffs are not rendered by default.

69 changes: 24 additions & 45 deletions src/api/accounts/index.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,66 +20,48 @@ 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)
.accountAddresses(stakeAddr, queryParams, options)
.then((request) => request(this.axios));
}

/**
* 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)
.accountAssets(stakeAddr, queryParams, options)
.then((request) => request(this.axios));
}

/**
* 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)
.accountHistory(stakeAddr, queryParams, options)
.then((request) => request(this.axios));
}

Expand All @@ -94,41 +83,31 @@ export class AccountsApi extends BaseAPI {
* 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)
.accountRewards(stakeAddr, queryParams, options)
.then((request) => request(this.axios));
}

/**
* 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)
.accountUpdates(stakeAddr, queryParams, options)
.then((request) => request(this.axios));
}
}

export * from './type';
116 changes: 116 additions & 0 deletions src/api/accounts/type.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Loading