Skip to content

Commit

Permalink
Add more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
joon9823 committed Nov 8, 2024
1 parent ab07c47 commit 1ea37cd
Show file tree
Hide file tree
Showing 158 changed files with 447 additions and 161 deletions.
2 changes: 0 additions & 2 deletions src/client/rest/RESTClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ export class RESTClient {
public wasm: WasmAPI

/**
* Creates a new REST client with the specified configuration.
*
* @param config REST configuration
*/
constructor(
Expand Down
2 changes: 0 additions & 2 deletions src/core/Coin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export class Coin extends JSONSerializable<Coin.Amino, Coin.Data, Coin.Proto> {
/**
* Creates a new coin. Depending on the type of amount, it will be converted to an
* integer coin or decimal coin.
*
* @param denom denomination
* @param amount coin's amount
*/
Expand Down Expand Up @@ -77,7 +76,6 @@ export class Coin extends JSONSerializable<Coin.Amino, Coin.Data, Coin.Proto> {

/**
* Creates a new Coin adding to the current value.
*
* @param other
*/
public add(other: number | string | Coin): Coin {
Expand Down
2 changes: 0 additions & 2 deletions src/core/Coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Denom } from './Denom'
/**
* Analogous to `sdk.Coins` and `sdk.DecCoins` from Cosmos-SDK, and represents a collection
* of [[Coin]] objects.
*
*/
export class Coins
extends JSONSerializable<Coins.Amino, Coins.Data, Coins.Proto>
Expand Down Expand Up @@ -41,7 +40,6 @@ export class Coins
* Converts a comma-separated list of coins to a Coins object
*
* Eg. `1500uinit,12302uini`
*
* @param str comma-separated list of coins
*/
public static fromString(str: string): Coins {
Expand Down
3 changes: 3 additions & 0 deletions src/core/auction/AuctionParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { JSONSerializable } from '../../util/json'
import { Coin } from '../Coin'
import { Params as Params_pb } from '@initia/initia.proto/sdk/auction/v1/genesis'

/**
* AuctionParams defines the set of auction parameters.
*/
export class AuctionParams extends JSONSerializable<
AuctionParams.Amino,
AuctionParams.Data,
Expand Down
3 changes: 3 additions & 0 deletions src/core/auction/msgs/MsgAuctionBid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { Coin } from '../../Coin'
import { Any } from '@initia/initia.proto/google/protobuf/any'
import { MsgAuctionBid as MsgAuctionBid_pb } from '@initia/initia.proto/sdk/auction/v1/tx'

/**
* MsgAuctionBid defines a method for sending bids to the auction module.
*/
export class MsgAuctionBid extends JSONSerializable<
MsgAuctionBid.Amino,
MsgAuctionBid.Data,
Expand Down
3 changes: 3 additions & 0 deletions src/core/auction/msgs/MsgUpdateAuctionParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { AuctionParams } from '../AuctionParams'
import { Any } from '@initia/initia.proto/google/protobuf/any'
import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/sdk/auction/v1/tx'

/**
* MsgUpdateAuctionParams defines an operation for updating the auction module parameters.
*/
export class MsgUpdateAuctionParams extends JSONSerializable<
MsgUpdateAuctionParams.Amino,
MsgUpdateAuctionParams.Data,
Expand Down
3 changes: 3 additions & 0 deletions src/core/auth/AuthParams.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { JSONSerializable } from '../../util/json'
import { Params as Params_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/auth'

/**
* AuthParams defines the set of auth parameters.
*/
export class AuthParams extends JSONSerializable<
AuthParams.Amino,
AuthParams.Data,
Expand Down
2 changes: 0 additions & 2 deletions src/core/auth/BaseAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export class BaseAccount extends JSONSerializable<
BaseAccount.Proto
> {
/**
* Creates a new Account object, holding information about a basic account.
*
* @param address account address
* @param coins account's balance
* @param public_key account's public key information
Expand Down
1 change: 0 additions & 1 deletion src/core/auth/ModuleAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export class ModuleAccount extends JSONSerializable<
ModuleAccount.Proto
> {
/**
*
* @param base_account account information
* @param name account's name
* @param permissions account's permissions
Expand Down
3 changes: 3 additions & 0 deletions src/core/auth/msgs/MsgUpdateAuthParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { AuthParams } from '../AuthParams'
import { Any } from '@initia/initia.proto/google/protobuf/any'
import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/tx'

/**
* MsgUpdateAuthParams defines an operation for updating the auth module parameters.
*/
export class MsgUpdateAuthParams extends JSONSerializable<
MsgUpdateAuthParams.Amino,
MsgUpdateAuthParams.Data,
Expand Down
8 changes: 8 additions & 0 deletions src/core/authz/authorizations/Authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ import { TransferAuthorization } from '../../ibc/applications/transfer'
import { Any } from '@initia/initia.proto/google/protobuf/any'
import { Grant as Grant_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/authz'

/**
* AuthorizationGrant gives permissions to execute the provide method with expiration time.
*/
export class AuthorizationGrant extends JSONSerializable<
AuthorizationGrant.Amino,
AuthorizationGrant.Data,
AuthorizationGrant.Proto
> {
/**
* @param authorization
* @param expiration time when the grant will expire and will be pruned. If null, then the grant
* doesn't have a time expiration
*/
constructor(
public authorization: Authorization,
public expiration?: Date
Expand Down
6 changes: 6 additions & 0 deletions src/core/authz/authorizations/ExecuteAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ import { ExecuteAuthorization as ExecuteAuthorization_pb } from '@initia/initia.
import { ExecuteAuthorizationItem as ExecuteAuthorizationItem_pb } from '@initia/initia.proto/initia/move/v1/types'
import { Any } from '@initia/initia.proto/google/protobuf/any'

/**
* ExecuteAuthorization defines authorization for execute a move function.
*/
export class ExecuteAuthorization extends JSONSerializable<
ExecuteAuthorization.Amino,
ExecuteAuthorization.Data,
ExecuteAuthorization.Proto
> {
/**
* @param items
*/
constructor(public items: ExecuteAuthorizationItem[]) {
super()
}
Expand Down
6 changes: 6 additions & 0 deletions src/core/authz/authorizations/GenericAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ import { JSONSerializable } from '../../../util/json'
import { GenericAuthorization as GenericAuthorization_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/authz'
import { Any } from '@initia/initia.proto/google/protobuf/any'

/**
* GenericAuthorization gives the grantee unrestricted permissions to execute the provided method on behalf of the granter's account.
*/
export class GenericAuthorization extends JSONSerializable<
GenericAuthorization.Amino,
GenericAuthorization.Data,
GenericAuthorization.Proto
> {
/**
* @param msg msg, identified by it's type URL, to grant unrestricted permissions to execute
*/
constructor(public msg: string) {
super()
}
Expand Down
6 changes: 6 additions & 0 deletions src/core/authz/authorizations/PublishAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ import { JSONSerializable } from '../../../util/json'
import { PublishAuthorization as PublishAuthorization_pb } from '@initia/initia.proto/initia/move/v1/authz'
import { Any } from '@initia/initia.proto/google/protobuf/any'

/**
* PublishAuthorization defines authorization for publish a move module.
*/
export class PublishAuthorization extends JSONSerializable<
PublishAuthorization.Amino,
PublishAuthorization.Data,
PublishAuthorization.Proto
> {
/**
* @param module_names
*/
constructor(public module_names: string[]) {
super()
}
Expand Down
8 changes: 8 additions & 0 deletions src/core/authz/authorizations/SendAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ import { Coins } from '../../Coins'
import { SendAuthorization as SendAuthorization_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/authz'
import { Any } from '@initia/initia.proto/google/protobuf/any'

/**
* SendAuthorization allows the grantee to spend up to spend_limit coins from the granter's account.
*/
export class SendAuthorization extends JSONSerializable<
SendAuthorization.Amino,
SendAuthorization.Data,
SendAuthorization.Proto
> {
public spend_limit: Coins

/**
* @param spend_limit
* @param allow_list an optional list of addresses to whom the grantee can send tokens on behalf of the granter
*/
constructor(
spend_limit: Coins.Input,
public allow_list: AccAddress[]
Expand Down
9 changes: 9 additions & 0 deletions src/core/authz/authorizations/StakeAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ import {
} from '@initia/initia.proto/initia/mstaking/v1/authz'
import { Any } from '@initia/initia.proto/google/protobuf/any'

/**
* StakeAuthorization defines authorization for delegate/undelegate/redelegate.
*/
export class StakeAuthorization extends JSONSerializable<
StakeAuthorization.Amino,
StakeAuthorization.Data,
StakeAuthorization.Proto
> {
public max_tokens: Coins

/**
* @param max_tokensthe maximum amount of tokens can be delegate to a validator
* @param allow_list list of validator addresses to whom grantee can delegate tokens on behalf of granter's account
* @param deny_list list of validator addresses to whom grantee can not delegate tokens
* @param authorization_type
*/
constructor(
max_tokens: Coins.Input,
public allow_list: StakeAuthorizationValidators,
Expand Down
5 changes: 5 additions & 0 deletions src/core/authz/msgs/MsgExecAuthorized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { Msg } from '../../Msg'
import { MsgExec as MsgExec_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/tx'
import { Any } from '@initia/initia.proto/google/protobuf/any'

/**
* MsgExecAuthorized attempts to execute the provided messages using
* authorizations granted to the grantee. Each message should have only
* one signer corresponding to the granter of the authorization.
*/
export class MsgExecAuthorized extends JSONSerializable<
MsgExecAuthorized.Amino,
MsgExecAuthorized.Data,
Expand Down
5 changes: 5 additions & 0 deletions src/core/authz/msgs/MsgGrantAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { MsgGrant as MsgGrant_pb } from '@initia/initia.proto/cosmos/authz/v1bet
import { Any } from '@initia/initia.proto/google/protobuf/any'
import { Grant as Grant_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/authz'

/**
* MsgGrantAuthorization grants the provided authorization to the grantee on the granter's
* account with the provided expiration time. If there is already a grant for the given
* (granter, grantee, Authorization) triple, then the grant will be overwritten.
*/
export class MsgGrantAuthorization extends JSONSerializable<
MsgGrantAuthorization.Amino,
MsgGrantAuthorization.Data,
Expand Down
4 changes: 4 additions & 0 deletions src/core/authz/msgs/MsgRevokeAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { AccAddress } from '../../bech32'
import { MsgRevoke as MsgRevoke_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/tx'
import { Any } from '@initia/initia.proto/google/protobuf/any'

/**
* MsgRevokeAuthorization revokes any authorization corresponding to the provided method name on the
* granter's account that has been granted to the grantee.
*/
export class MsgRevokeAuthorization extends JSONSerializable<
MsgRevokeAuthorization.Amino,
MsgRevokeAuthorization.Data,
Expand Down
3 changes: 3 additions & 0 deletions src/core/bank/BankParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { JSONSerializable } from '../../util/json'
import { SendEnabled } from './SendEnabled'
import { Params as Params_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank'

/**
* Bank defines the set of bank parameters.
*/
export class BankParams extends JSONSerializable<
BankParams.Amino,
BankParams.Data,
Expand Down
3 changes: 3 additions & 0 deletions src/core/bank/DenomMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { JSONSerializable } from '../../util/json'
import { DenomUnit } from './DenomUnit'
import { Metadata as Metadata_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank'

/**
* DenomMetadata represents a struct that describes a basic token.
*/
export class DenomMetadata extends JSONSerializable<
DenomMetadata.Amino,
DenomMetadata.Data,
Expand Down
3 changes: 3 additions & 0 deletions src/core/bank/DenomUnit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { JSONSerializable } from '../../util/json'
import { Denom } from '../Denom'
import { DenomUnit as DenomUnit_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank'

/**
* DenomUnit represents a struct that describes a given denomination unit of the basic token.
*/
export class DenomUnit extends JSONSerializable<
DenomUnit.Amino,
DenomUnit.Data,
Expand Down
3 changes: 3 additions & 0 deletions src/core/bank/SendEnabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { JSONSerializable } from '../../util/json'
import { Denom } from '../Denom'
import { SendEnabled as SendEnabled_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank'

/**
* SendEnabled maps coin denom to a send_enabled status (whether a denom is sendable).
*/
export class SendEnabled extends JSONSerializable<
SendEnabled.Amino,
SendEnabled.Data,
Expand Down
4 changes: 4 additions & 0 deletions src/core/bank/msgs/MsgSetDenomMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { DenomMetadata } from '../DenomMetadata'
import { Any } from '@initia/initia.proto/google/protobuf/any'
import { MsgSetDenomMetadata as MsgSetDenomMetadata_pb } from '@initia/initia.proto/initia/bank/v1/tx'

/**
* MsgSetDenomMetadata defines a governance operation for updating the bank
* denom metadata. The authority is defined in the keeper.
*/
export class MsgSetDenomMetadata extends JSONSerializable<
MsgSetDenomMetadata.Amino,
MsgSetDenomMetadata.Data,
Expand Down
6 changes: 6 additions & 0 deletions src/core/bank/msgs/MsgSetSendEnabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import { SendEnabled } from '../SendEnabled'
import { Any } from '@initia/initia.proto/google/protobuf/any'
import { MsgSetSendEnabled as MsgSetSendEnabled_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/tx'

/**
* MsgSetSendEnabled is a governance operation for setting the SendEnabled flag
* on any number of Denoms. Only the entries to add or update should be
* included. Entries that already exist in the store, but that aren't
* included in this message, will be left unchanged.
*/
export class MsgSetSendEnabled extends JSONSerializable<
MsgSetSendEnabled.Amino,
MsgSetSendEnabled.Data,
Expand Down
3 changes: 3 additions & 0 deletions src/core/bank/msgs/MsgUpdateBankParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { BankParams } from '../BankParams'
import { Any } from '@initia/initia.proto/google/protobuf/any'
import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/tx'

/**
* MsgUpdateBankParams defines an operation for updating the bank module parameters.
*/
export class MsgUpdateBankParams extends JSONSerializable<
MsgUpdateBankParams.Amino,
MsgUpdateBankParams.Data,
Expand Down
11 changes: 5 additions & 6 deletions src/core/bech32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ function checkPrefixAndLength(
export namespace AccAddress {
/**
* Checks if a string is a valid Initia account address.
*
* @param data string to check
*/
export function validate(data: string): boolean {
Expand All @@ -43,7 +42,6 @@ export namespace AccAddress {

/**
* Converts a validator address into an account address
*
* @param address validator address
*/
export function fromValAddress(address: ValAddress): AccAddress {
Expand All @@ -52,8 +50,7 @@ export namespace AccAddress {
}

/**
* Converts a account address into a hex address
*
* Converts an account address into a hex address
* @param address account address
*/
export function toHex(address: AccAddress): string {
Expand All @@ -63,7 +60,6 @@ export namespace AccAddress {

/**
* Converts a hex address into an account address
*
* @param hexAddress hex address
*/
export function fromHex(hexAddress: string): AccAddress {
Expand All @@ -82,6 +78,10 @@ export namespace AccAddress {
}
}

/**
* Converts an account address into a Buffer
* @param address account address
*/
export function toBuffer(address: AccAddress): Buffer {
const vals = bech32.decode(address)
return Buffer.from(bech32.fromWords(vals.words))
Expand Down Expand Up @@ -111,7 +111,6 @@ export namespace AccPubKey {
export namespace ValAddress {
/**
* Checks if a string is a Initia validator address.
*
* @param data string to check
*/
export function validate(data: string): boolean {
Expand Down
5 changes: 5 additions & 0 deletions src/core/celestia/Blob.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { JSONSerializable } from '../../util/json'
import { Blob as Blob_pb } from '@initia/initia.proto/celestia/blob/v1/blob'

/**
* Blob (named after binary large object) is a chunk of data submitted by a user
* to be published to the Celestia blockchain. The data of a Blob is published
* to a namespace and is encoded into shares based on the format specified by share_version.
*/
export class Blob extends JSONSerializable<any, Blob.Data, Blob.Proto> {
/**
* @param namespace_id
Expand Down
Loading

0 comments on commit 1ea37cd

Please sign in to comment.