Skip to content

Commit

Permalink
Merge pull request #86 from terra-money/edits
Browse files Browse the repository at this point in the history
Edits to notes
  • Loading branch information
emidev98 authored Mar 8, 2024
2 parents 4582c35 + 72d7375 commit 780cc0d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
50 changes: 28 additions & 22 deletions src/client/lcd/api/AllianceAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class AllianceAPI extends BaseAPI {
}

/**
* Query the alliance module params
* Query the alliance module params.
*
* @tags Query
* @name params
Expand All @@ -36,7 +36,7 @@ export class AllianceAPI extends BaseAPI {
}

/**
* Query all available alliances with pagination
* Query all available alliances with pagination.
*
* @tags Query
* @name alliances
Expand Down Expand Up @@ -84,14 +84,14 @@ export class AllianceAPI extends BaseAPI {
/**
* Query all paginated alliance delegations with **OPTIONAL** delAddr, valAddr and denom parameters
* **BUT** dependent on each previous value. Which means that you cannot use this method to query
* the validator delegations without providing the delegator address. The denom in the query will be
* the validator's delegations without providing the delegator's address. The denom in the query will be
* URL encoded to allow querying for alliance assets with "/" or other special characters in their denom.
*
* - When no values are provided returns all delegations.
* - When **delAddr** is provided return the delegations for that specific address.
* - When **delAddr**, **valAddr** are provided return the delegations for that specific address and validator.
* - When **delAddr**, **valAddr** and **denom** are provided return the delegations for that specific address, validator and denom.
* ¡WARNING!: for efficiency reasons provide all specified parameters, if not the query will be slower.
* - When no values are provided, this query returns all delegations.
* - When **delAddr** is provided, this query returns the delegations for the provided address.
* - When **delAddr** and **valAddr** are provided, this query returns the delegations for the specified address and validator.
* - When **delAddr**, **valAddr** and **denom** are provided, this query returns the delegations for the specified address, validator and denom.
* ¡WARNING!: for efficiency reasons, provide all specified parameters, otherwise the query will be slower.
* @tags Query
* @name queryAllianceDelegations
* @summary Query all paginated alliance delegations
Expand All @@ -118,7 +118,7 @@ export class AllianceAPI extends BaseAPI {
if (valAddr) {
if (!delAddr) {
throw new Error(
'DELEGATOR ADDRESS must be provided when VALIDATOR ADDRESS is provided!!'
'A DELEGATOR ADDRESS must be provided if a VALIDATOR ADDRESS is provided!!'
);
}

Expand All @@ -127,14 +127,14 @@ export class AllianceAPI extends BaseAPI {
if (denom) {
if (!valAddr) {
throw new Error(
'VALIDATOR ADDRESS must be provided when ALLIANCE DENOM is provided!!'
'A VALIDATOR ADDRESS must be provided if an ALLIANCE DENOM is provided!!'
);
}
url += `/${encodeURIComponent(encodeURIComponent(denom))}`;
}

// If all parameters are provided, the response will be a single delegation
// but in order to fit the return type, we will return an array of delegations
// If all parameters are provided, the response will be a single delegation.
// In order to fit the return type, an array of delegations is returned.
if (delAddr && valAddr && denom) {
const res = await this.getReqFromChainID(chainID).get<{
delegation: AllianceDelegation.Data;
Expand Down Expand Up @@ -165,16 +165,16 @@ export class AllianceAPI extends BaseAPI {
}

/**
* Query paginated redelegations by delAddr and optionally you can also provide
* the denom parameter that will improve the query response time. The denom in
* Query paginated redelegations by delAddr. Optionally, you can also provide
* the denom parameter which will improve the query response time. The denom in
* the query will be URL encoded to allow querying for alliance assets with "/"
* or other special characters in their denom.
*
* @tags Query
* @name queryAllianceRedelegations
* @summary Query for redelegations by delegator addr and denom
* @request GET:/terra/alliances/redelegations/{delAddr} or
* GET:/terra/alliances/redelegations/{denm}/{delAddr}
* GET:/terra/alliances/redelegations/{denom}/{delAddr}
*/
public async queryAllianceRedelegations(
delAddr: string,
Expand Down Expand Up @@ -230,12 +230,18 @@ export class AllianceAPI extends BaseAPI {
/**
* Query alliances unbondings by delAddr where denom and valAddr are optional parameters,
* that valAddr depend on the denom. When all values are provided the query will be faster,
* Any denom send to this query will be URL encoded to allow querying for alliance assets
* Any denom specified in this query will be URL encoded to allow querying for alliance assets
* with "/" or other special characters in their denom.
*
* - When **delAddr** is provided, this query returns the unbondings for the provided address.
* - When **denom** and **delAddr** are provided, this query returns the unbondings for the
* specified address and denom.
* - When **delAddr**, **valAddr** and **denom** are provided, this query returns the unbondings
* for the specified address, validator and denom.
*
* @tags Query
* @name queryAllianceUnbondings
* @summary Query alliance rewards by delegator addr, validator_addr and denom
* @summary Query alliance unbondings by delegator addr, validator_addr and denom
* @request GET:/terra/alliances/unbondings/{delAddr}
* GET:/terra/alliances/unbondings/{denom}/{delAddr}
* GET:/terra/alliances/unbondings/{denom}/{delAddr}/{valAddr}
Expand All @@ -248,7 +254,7 @@ export class AllianceAPI extends BaseAPI {
) {
let url = '/terra/alliances/unbondings';

// Since the url is different when denom is provided, we will build the url
// Since the url is different when denom is provided, the url will be built
// based on the parameters provided
if (denom && valAddr) {
url += `/${encodeURIComponent(
Expand All @@ -268,10 +274,10 @@ export class AllianceAPI extends BaseAPI {
}

/**
* Query the validators where at least one user delegated to it with an optional parameter
* being valAddr taht will query a single validator. When providing the validatorAddr the
* response is delivered faster. This query return data about the delegations shares, validator
* shares and total staked tokens.
* Query all validators that have at least one user delegation. You can optionally provide valAddr
* to query a single validator. Providing the validatorAddr will deliver a faster response.
* This query returns data about the delegations shares, validator shares,
* and total staked tokens.
*
* @tags Query
* @name queryAllianceValidators
Expand Down
4 changes: 2 additions & 2 deletions src/core/alliance/models/AllianceAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export class AllianceAsset {
/** Denom of the asset. It could either be a native token or an IBC token */
public denom: string,
/** The reward weight specifies the ratio of rewards that will be given to each alliance asset
It does not need to sum to 1. rate = weight / total_weight Native asset is always assumed to have a weight of 1.s */
It does not need to sum to 1. rate = weight / total_weight. Native staking asset is always assumed to have a weight of 1. */
public rewardWeight: Dec,
/** A positive take rate is used for liquid staking derivatives. It defines an rate that is
/** A positive take rate is a "tax" used for liquid staking derivatives. It defines a rate that is
applied per take_rate_interval that will be redirected to the distribution rewards pool */
public takeRate: Dec,
// The total amount of tokens that are bonded to the alliance
Expand Down

0 comments on commit 780cc0d

Please sign in to comment.