From 0a8e90b09746576167ad56ec2de7e22ada909d9c Mon Sep 17 00:00:00 2001 From: joon9823 Date: Wed, 6 Nov 2024 16:44:09 +0900 Subject: [PATCH 1/5] Add missing unit tests for rest apis --- src/client/rest/APIRequester.spec.ts | 12 +- src/client/rest/api/AuctionAPI.spec.ts | 13 ++ src/client/rest/api/AuctionAPI.ts | 2 +- src/client/rest/api/AuthAPI.spec.ts | 23 +-- src/client/rest/api/AuthAPI.ts | 2 +- src/client/rest/api/BankAPI.spec.ts | 18 +- src/client/rest/api/BankAPI.ts | 2 +- src/client/rest/api/DistributionAPI.spec.ts | 28 ++- src/client/rest/api/DistributionAPI.ts | 2 +- src/client/rest/api/EvidenceAPI.spec.ts | 15 ++ src/client/rest/api/EvmAPI.ts | 2 +- src/client/rest/api/ForwardingAPI.spec.ts | 14 ++ src/client/rest/api/ForwardingAPI.ts | 12 +- src/client/rest/api/GovAPI.spec.ts | 53 ++---- src/client/rest/api/GroupAPI.spec.ts | 15 ++ src/client/rest/api/IbcAPI.spec.ts | 35 ++-- src/client/rest/api/IbcHooksAPI.spec.ts | 20 +++ src/client/rest/api/IbcNftAPI.spec.ts | 20 +++ src/client/rest/api/IbcNftAPI.ts | 2 +- src/client/rest/api/IbcTransferAPI.spec.ts | 13 +- src/client/rest/api/IbcTransferAPI.ts | 19 +- src/client/rest/api/MarketmapAPI.spec.ts | 20 +++ src/client/rest/api/MoveAPI.spec.ts | 27 +++ src/client/rest/api/MoveAPI.ts | 38 +--- src/client/rest/api/MstakingAPI.spec.ts | 31 ++-- src/client/rest/api/MstakingAPI.ts | 16 +- src/client/rest/api/OphostAPI.spec.ts | 20 +++ src/client/rest/api/OphostAPI.ts | 2 +- src/client/rest/api/OracleAPI.spec.ts | 21 +++ src/client/rest/api/RewardAPI.spec.ts | 15 +- src/client/rest/api/RewardAPI.ts | 2 +- src/client/rest/api/SlashingAPI.spec.ts | 24 +-- src/client/rest/api/SlashingAPI.ts | 69 ++------ src/client/rest/api/TendermintAPI.spec.ts | 14 +- src/client/rest/api/TokenfactoryAPI.ts | 2 +- src/client/rest/api/TxAPI.spec.ts | 4 +- src/client/rest/api/UpgradeAPI.spec.ts | 12 +- .../authz/authorizations/Authorization.ts | 4 +- .../msgs/MsgGrantAuthorization.data.json | 4 +- .../feegrant/allowances/BasicAllowance.ts | 4 +- .../feegrant/allowances/PeriodicAllowance.ts | 4 +- src/core/ibc/applications/transfer/index.ts | 1 + .../ibc/core/client/msgs/tendermint/types.ts | 4 +- src/core/move/Module.ts | 119 +++++++++++++ src/core/move/index.ts | 1 + src/core/slashing/ValidatorSigningInfo.ts | 167 ++++++++++++++++++ src/core/slashing/index.ts | 1 + 47 files changed, 652 insertions(+), 296 deletions(-) create mode 100644 src/client/rest/api/AuctionAPI.spec.ts create mode 100644 src/client/rest/api/EvidenceAPI.spec.ts create mode 100644 src/client/rest/api/ForwardingAPI.spec.ts create mode 100644 src/client/rest/api/GroupAPI.spec.ts create mode 100644 src/client/rest/api/IbcHooksAPI.spec.ts create mode 100644 src/client/rest/api/IbcNftAPI.spec.ts create mode 100644 src/client/rest/api/MarketmapAPI.spec.ts create mode 100644 src/client/rest/api/MoveAPI.spec.ts create mode 100644 src/client/rest/api/OphostAPI.spec.ts create mode 100644 src/client/rest/api/OracleAPI.spec.ts create mode 100644 src/core/move/Module.ts create mode 100644 src/core/slashing/ValidatorSigningInfo.ts diff --git a/src/client/rest/APIRequester.spec.ts b/src/client/rest/APIRequester.spec.ts index ca0b184..f951695 100644 --- a/src/client/rest/APIRequester.spec.ts +++ b/src/client/rest/APIRequester.spec.ts @@ -13,11 +13,11 @@ describe('APIRequester', () => { it('accept a standard URL', async () => { mockedAxios.get.mockResolvedValueOnce({ data: null }) - const request = new APIRequester('https://rest.devnet.initia.xyz') + const request = new APIRequester('https://rest.testnet.initia.xyz') await request.get('/foo') expect(mockedAxios.get).toHaveBeenCalledWith( - 'https://rest.devnet.initia.xyz/foo', + 'https://rest.testnet.initia.xyz/foo', { headers: new axios.AxiosHeaders(), params: {}, @@ -28,11 +28,11 @@ describe('APIRequester', () => { it('accept a deep URL', async () => { mockedAxios.get.mockResolvedValueOnce({ data: null }) - const request = new APIRequester('https://rest.devnet.initia.xyz/bar') + const request = new APIRequester('https://rest.testnet.initia.xyz/bar') await request.get('/foo') expect(mockedAxios.get).toHaveBeenCalledWith( - 'https://rest.devnet.initia.xyz/bar/foo', + 'https://rest.testnet.initia.xyz/bar/foo', { headers: new axios.AxiosHeaders(), params: {}, @@ -43,11 +43,11 @@ describe('APIRequester', () => { it('accept an URL with search params', async () => { mockedAxios.get.mockResolvedValueOnce({ data: null }) - const request = new APIRequester('https://rest.devnet.initia.xyz?key=123') + const request = new APIRequester('https://rest.testnet.initia.xyz?key=123') await request.get('/foo') expect(mockedAxios.get).toHaveBeenCalledWith( - 'https://rest.devnet.initia.xyz/foo?key=123', + 'https://rest.testnet.initia.xyz/foo?key=123', { headers: new axios.AxiosHeaders(), params: {}, diff --git a/src/client/rest/api/AuctionAPI.spec.ts b/src/client/rest/api/AuctionAPI.spec.ts new file mode 100644 index 0000000..76d426f --- /dev/null +++ b/src/client/rest/api/AuctionAPI.spec.ts @@ -0,0 +1,13 @@ +import { APIRequester } from '../APIRequester' +import { AuctionAPI } from './AuctionAPI' +import { AuctionParams } from '../../../core' + +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new AuctionAPI(c) + +describe('AuctionAPI', () => { + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(AuctionParams)) + }) +}) diff --git a/src/client/rest/api/AuctionAPI.ts b/src/client/rest/api/AuctionAPI.ts index faee5e7..68c965c 100644 --- a/src/client/rest/api/AuctionAPI.ts +++ b/src/client/rest/api/AuctionAPI.ts @@ -8,6 +8,6 @@ export class AuctionAPI extends BaseAPI { .get<{ params: AuctionParams.Data }>(`/block-sdk/auction/v1/params`, params) - .then(({ params: d }) => AuctionParams.fromData(d)) + .then((d) => AuctionParams.fromData(d.params)) } } diff --git a/src/client/rest/api/AuthAPI.spec.ts b/src/client/rest/api/AuthAPI.spec.ts index 38a0ee2..874f565 100644 --- a/src/client/rest/api/AuthAPI.spec.ts +++ b/src/client/rest/api/AuthAPI.spec.ts @@ -1,15 +1,15 @@ import { APIRequester } from '../APIRequester' import { AuthAPI } from './AuthAPI' -import { BaseAccount } from '../../../core' +import { AuthParams, BaseAccount } from '../../../core' import { MnemonicKey } from '../../../key' -const c = new APIRequester('https://rest.devnet.initia.xyz') -const auth = new AuthAPI(c) +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new AuthAPI(c) describe('AuthAPI', () => { describe('accounts', () => { it('account exists', async () => { - const acct = await auth.accountInfo( + const acct = await api.accountInfo( 'init1hk0asaef9nxvnj7gjwawv0zz0yd7adcysktpqu' ) @@ -17,26 +17,21 @@ describe('AuthAPI', () => { }) it('invalid account', async () => { - await expect(auth.accountInfo('1234')).rejects.toThrow() + await expect(api.accountInfo('1234')).rejects.toThrow() }) it("account doesn't exist (valid but new account)", async () => { const mk = new MnemonicKey() - await expect(auth.accountInfo(mk.accAddress)).rejects.toThrow( + await expect(api.accountInfo(mk.accAddress)).rejects.toThrow( 'status code 404' ) }) }) describe('parameters', () => { - it('parameters', async () => { - const param = await auth.parameters() - - expect(param.max_memo_characters).toBeGreaterThanOrEqual(0) - expect(param.tx_sig_limit).toBeGreaterThanOrEqual(0) - expect(param.tx_size_cost_per_byte).toBeGreaterThanOrEqual(0) - expect(param.sig_verify_cost_ed25519).toBeGreaterThanOrEqual(0) - expect(param.sig_verify_cost_secp256k1).toBeGreaterThanOrEqual(0) + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(AuthParams)) }) }) }) diff --git a/src/client/rest/api/AuthAPI.ts b/src/client/rest/api/AuthAPI.ts index 3e9ccd3..e7d99dd 100644 --- a/src/client/rest/api/AuthAPI.ts +++ b/src/client/rest/api/AuthAPI.ts @@ -36,6 +36,6 @@ export class AuthAPI extends BaseAPI { public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: AuthParams.Data }>(`/cosmos/auth/v1beta1/params`, params) - .then(({ params: d }) => AuthParams.fromData(d)) + .then((d) => AuthParams.fromData(d.params)) } } diff --git a/src/client/rest/api/BankAPI.spec.ts b/src/client/rest/api/BankAPI.spec.ts index 1681e32..3e080cd 100644 --- a/src/client/rest/api/BankAPI.spec.ts +++ b/src/client/rest/api/BankAPI.spec.ts @@ -1,30 +1,30 @@ import { APIRequester } from '../APIRequester' import { BankAPI } from './BankAPI' +import { BankParams } from '../../../core' -const c = new APIRequester('https://rest.devnet.initia.xyz') -const bank = new BankAPI(c) +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new BankAPI(c) describe('BankAPI', () => { describe('balance', () => { it('account exists', async () => { - await bank.balance('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') + await api.balance('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') }) it('invalid account', async () => { - await expect(bank.balance('1234')).rejects.toThrow() + await expect(api.balance('1234')).rejects.toThrow() }) }) it('total supply', async () => { - const totalSupply = await bank.total() + const totalSupply = await api.total() expect(totalSupply[0].toArray().length).toBeGreaterThan(0) }) describe('parameters', () => { - it('parameters', async () => { - const param = await bank.parameters() - - expect(param.default_send_enabled).toBeDefined() + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(BankParams)) }) }) }) diff --git a/src/client/rest/api/BankAPI.ts b/src/client/rest/api/BankAPI.ts index 155e0e8..ee231eb 100644 --- a/src/client/rest/api/BankAPI.ts +++ b/src/client/rest/api/BankAPI.ts @@ -72,6 +72,6 @@ export class BankAPI extends BaseAPI { public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: BankParams.Data }>(`/cosmos/bank/v1beta1/params`, params) - .then(({ params: d }) => BankParams.fromData(d)) + .then((d) => BankParams.fromData(d.params)) } } diff --git a/src/client/rest/api/DistributionAPI.spec.ts b/src/client/rest/api/DistributionAPI.spec.ts index 324519e..178268e 100644 --- a/src/client/rest/api/DistributionAPI.spec.ts +++ b/src/client/rest/api/DistributionAPI.spec.ts @@ -1,35 +1,27 @@ import { APIRequester } from '../APIRequester' import { DistributionAPI } from './DistributionAPI' -import { Coins } from '../../../core' +import { Coins, DistributionParams } from '../../../core' -const c = new APIRequester('https://rest.devnet.initia.xyz') -const distribution = new DistributionAPI(c) +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new DistributionAPI(c) describe('DistributionAPI', () => { - it('parameters', async () => { - await expect(distribution.parameters()).resolves.toMatchObject({ - community_tax: expect.any(String), - withdraw_addr_enabled: expect.any(Boolean), - reward_weights: expect.arrayContaining([ - expect.objectContaining({ - denom: expect.any(String), - weight: expect.any(String), - }), - ]), - }) - }) - it('withdrawAddress', async () => { await expect( - distribution.withdrawAddress( + api.withdrawAddress( 'init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs' ) ).resolves.toEqual('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') }) it('communityPool', async () => { - await expect(distribution.communityPool()).resolves.toEqual( + await expect(api.communityPool()).resolves.toEqual( expect.any(Coins) ) }) + + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(DistributionParams)) + }) }) diff --git a/src/client/rest/api/DistributionAPI.ts b/src/client/rest/api/DistributionAPI.ts index 3bd8132..b0695c4 100644 --- a/src/client/rest/api/DistributionAPI.ts +++ b/src/client/rest/api/DistributionAPI.ts @@ -181,6 +181,6 @@ export class DistributionAPI extends BaseAPI { .get<{ params: DistributionParams.Data }>(`/initia/distribution/v1/params`, params) - .then(({ params: d }) => DistributionParams.fromData(d)) + .then((d) => DistributionParams.fromData(d.params)) } } diff --git a/src/client/rest/api/EvidenceAPI.spec.ts b/src/client/rest/api/EvidenceAPI.spec.ts new file mode 100644 index 0000000..3dce4a7 --- /dev/null +++ b/src/client/rest/api/EvidenceAPI.spec.ts @@ -0,0 +1,15 @@ +import { APIRequester } from '../APIRequester' +import { EvidenceAPI } from './EvidenceAPI' +import { Equivocation } from '../../../core' + +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new EvidenceAPI(c) + +describe('EvidenceAPI', () => { + it('evidences', async () => { + const evidences = await api.evidences() + for (const evidence of evidences[0]) { + expect(evidence).toEqual(expect.any(Equivocation)) + } + }) +}) diff --git a/src/client/rest/api/EvmAPI.ts b/src/client/rest/api/EvmAPI.ts index b575998..e8ccbc3 100644 --- a/src/client/rest/api/EvmAPI.ts +++ b/src/client/rest/api/EvmAPI.ts @@ -81,6 +81,6 @@ export class EvmAPI extends BaseAPI { public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: EvmParams.Data }>(`/minievm/evm/v1/params`, params) - .then(({ params: d }) => EvmParams.fromData(d)) + .then((d) => EvmParams.fromData(d.params)) } } diff --git a/src/client/rest/api/ForwardingAPI.spec.ts b/src/client/rest/api/ForwardingAPI.spec.ts new file mode 100644 index 0000000..c31f2c8 --- /dev/null +++ b/src/client/rest/api/ForwardingAPI.spec.ts @@ -0,0 +1,14 @@ +import { APIRequester } from '../APIRequester' +import { ForwardingAPI } from './ForwardingAPI' + +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new ForwardingAPI(c) + +describe('ForwardingAPI', () => { + it('denoms', async () => { + const denoms = await api.denoms() + for (const denom of denoms[0]) { + expect(denom).toEqual(expect.any(String)) + } + }) +}) diff --git a/src/client/rest/api/ForwardingAPI.ts b/src/client/rest/api/ForwardingAPI.ts index a4c0620..311598e 100644 --- a/src/client/rest/api/ForwardingAPI.ts +++ b/src/client/rest/api/ForwardingAPI.ts @@ -17,15 +17,25 @@ export namespace ForwardingStats { } export class ForwardingAPI extends BaseAPI { + public async denoms(params: APIParams = {}): Promise { + return this.c + .get<{ allowed_denoms: string[] }>(`/noble/forwarding/v1/denoms`, params) + .then((d) => d.allowed_denoms) + } + public async address( channel: string, recipient: string, + fallback: string, params: APIParams = {} ): Promise { return this.c .get<{ address: AccAddress - }>(`/noble/forwarding/v1/address/${channel}/${recipient}`, params) + }>( + `/noble/forwarding/v1/address/${channel}/${recipient}/${fallback}`, + params + ) .then((d) => d.address) } diff --git a/src/client/rest/api/GovAPI.spec.ts b/src/client/rest/api/GovAPI.spec.ts index 54fbe9e..686aaf1 100644 --- a/src/client/rest/api/GovAPI.spec.ts +++ b/src/client/rest/api/GovAPI.spec.ts @@ -1,57 +1,34 @@ import { APIRequester } from '../APIRequester' import { GovAPI } from './GovAPI' -import { Coins, Duration, Deposit, Proposal, TallyResult } from '../../../core' +import { Deposit, Proposal, TallyResult, GovParams } from '../../../core' -const c = new APIRequester('https://rest.devnet.initia.xyz') -const gov = new GovAPI(c) +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new GovAPI(c) describe('GovAPI', () => { - it('parameters', async () => { - await expect(gov.parameters()).resolves.toMatchObject({ - min_deposit: expect.any(Coins), - max_deposit_period: expect.any(Duration), - voting_period: expect.any(Duration), - quorum: expect.any(String), - threshold: expect.any(String), - veto_threshold: expect.any(String), - min_initial_deposit_ratio: expect.any(String), - proposal_cancel_ratio: expect.any(String), - proposal_cancel_dest: expect.any(String), - expedited_voting_period: expect.any(Duration), - expedited_threshold: expect.any(String), - expedited_min_deposit: expect.any(Coins), - burn_vote_quorum: expect.any(Boolean), - burn_proposal_deposit_prevote: expect.any(Boolean), - burn_vote_veto: expect.any(Boolean), - min_deposit_ratio: expect.any(String), - emergency_min_deposit: expect.any(Coins), - emergency_tally_interval: expect.any(Duration), - low_threshold_functions: expect.any(Array), - }) - }) - it('tally', async () => { - const tally = await gov.tally(1) + const tally = await api.tally(1) expect(tally).toEqual(expect.any(TallyResult)) }) it('proposals', async () => { - const proposals = await gov.proposals().then(v => v[0]) - expect(proposals).toContainEqual(expect.any(Proposal)) - }) - - it('proposal', async () => { - const proposalId = await gov.proposals().then(v => v[0][0].id) - const proposal = await gov.proposal(proposalId) - expect(proposal).toEqual(expect.any(Proposal)) + const proposals = await api.proposals() + for (const proposal of proposals[0]) { + expect(proposal).toEqual(expect.any(Proposal)) + } }) it('deposits', async () => { - const proposals = await gov.proposals().then(v => v[0]) + const proposals = await api.proposals().then(v => v[0]) const proposalId = proposals[0].id - const deposits = await gov.deposits(proposalId).then(v => v[0][0]) + const deposits = await api.deposits(proposalId).then(v => v[0][0]) if (deposits !== undefined) { expect(deposits).toEqual(expect.any(Deposit)) } }) + + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(GovParams)) + }) }) diff --git a/src/client/rest/api/GroupAPI.spec.ts b/src/client/rest/api/GroupAPI.spec.ts new file mode 100644 index 0000000..d95fe8f --- /dev/null +++ b/src/client/rest/api/GroupAPI.spec.ts @@ -0,0 +1,15 @@ +import { APIRequester } from '../APIRequester' +import { GroupAPI } from './GroupAPI' +import { GroupInfo } from '../../../core' + +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new GroupAPI(c) + +describe('GroupAPI', () => { + it('groups', async () => { + const groups = await api.groups() + for (const group of groups[0]) { + expect(group).toEqual(expect.any(GroupInfo)) + } + }) +}) diff --git a/src/client/rest/api/IbcAPI.spec.ts b/src/client/rest/api/IbcAPI.spec.ts index 7657ff6..fd91ea5 100644 --- a/src/client/rest/api/IbcAPI.spec.ts +++ b/src/client/rest/api/IbcAPI.spec.ts @@ -1,50 +1,44 @@ import { APIRequester } from '../APIRequester' import { IbcAPI } from './IbcAPI' -import { Height } from '../../../core' +import { Height, IbcClientParams } from '../../../core' -const c = new APIRequester('https://rest.devnet.initia.xyz') -const ibc = new IbcAPI(c) +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new IbcAPI(c) describe('IbcClientAPI', () => { - it('params', async () => { - const param = await ibc.parameters() - expect(param.allowed_clients).not.toBeNull() - expect(param.allowed_clients).not.toBeUndefined() - }) - it('client_states', async () => { - const res = await ibc.clientStates() + const res = await api.clientStates() expect(res).not.toBeNull() expect(res).not.toBeUndefined() }) it('client_state', async () => { - const res = await ibc.clientState('07-tendermint-0') + const res = await api.clientState('07-tendermint-0') expect(res).not.toBeNull() expect(res).not.toBeUndefined() }) it('client_status', async () => { - const res = await ibc.clientStatus('07-tendermint-0') + const res = await api.clientStatus('07-tendermint-0') expect(res).not.toBeNull() expect(res).not.toBeUndefined() }) it('consensus_states', async () => { - const res = await ibc.consensusStates('07-tendermint-0') + const res = await api.consensusStates('07-tendermint-0') expect(res).not.toBeNull() expect(res).not.toBeUndefined() }) it('channels', async () => { - const [res, _] = await ibc.channels() + const [res, _] = await api.channels() expect(res).not.toBeNull() expect(res).not.toBeUndefined() expect(res.length).toBeGreaterThan(0) }) it('channels for a connection', async () => { - const [res, height, _] = await ibc.connectionChannels('connection-3') + const [res, height, _] = await api.connectionChannels('connection-3') expect(res).not.toBeNull() expect(res).not.toBeUndefined() expect(height).not.toBeNull() @@ -53,7 +47,7 @@ describe('IbcClientAPI', () => { }) it('port', async () => { - const res = await ibc.port('channel-0', 'transfer') + const res = await api.port('channel-0', 'transfer') expect(res).not.toBeNull() expect(res).not.toBeUndefined() expect(res).toHaveProperty('channel') @@ -62,15 +56,20 @@ describe('IbcClientAPI', () => { }) it('connections', async () => { - const [res, _] = await ibc.connections() + const [res, _] = await api.connections() expect(res).not.toBeNull() expect(res).not.toBeUndefined() expect(res.length).toBeGreaterThan(0) }) it('a connection', async () => { - const res = await ibc.connection('connection-0') + const res = await api.connection('connection-0') expect(res).not.toBeNull() expect(res).not.toBeUndefined() }) + + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(IbcClientParams)) + }) }) diff --git a/src/client/rest/api/IbcHooksAPI.spec.ts b/src/client/rest/api/IbcHooksAPI.spec.ts new file mode 100644 index 0000000..f60b15b --- /dev/null +++ b/src/client/rest/api/IbcHooksAPI.spec.ts @@ -0,0 +1,20 @@ +import { APIRequester } from '../APIRequester' +import { IbcHooksAPI } from './IbcHooksAPI' +import { ACL, IbcHooksParams } from '../../../core' + +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new IbcHooksAPI(c) + +describe('IbcHooksAPI', () => { + it('acls', async () => { + const acls = await api.acls() + for (const acl of acls[0]) { + expect(acl).toEqual(expect.any(ACL)) + } + }) + + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(IbcHooksParams)) + }) +}) diff --git a/src/client/rest/api/IbcNftAPI.spec.ts b/src/client/rest/api/IbcNftAPI.spec.ts new file mode 100644 index 0000000..19cfff6 --- /dev/null +++ b/src/client/rest/api/IbcNftAPI.spec.ts @@ -0,0 +1,20 @@ +import { APIRequester } from '../APIRequester' +import { IbcNftAPI } from './IbcNftAPI' +import { IbcNftParams, NftClassTrace } from '../../../core' + +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new IbcNftAPI(c) + +describe('IbcNftAPI', () => { + it('class traces', async () => { + const traces = await api.classTraces() + for (const trace of traces[0]) { + expect(trace).toEqual(expect.any(NftClassTrace)) + } + }) + + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(IbcNftParams)) + }) +}) diff --git a/src/client/rest/api/IbcNftAPI.ts b/src/client/rest/api/IbcNftAPI.ts index eb13409..8355786 100644 --- a/src/client/rest/api/IbcNftAPI.ts +++ b/src/client/rest/api/IbcNftAPI.ts @@ -39,7 +39,7 @@ export class IbcNftAPI extends BaseAPI { .get<{ params: IbcNftParams.Data }>(`/ibc/apps/nft_transfer/v1/params`, params) - .then(({ params: d }) => IbcNftParams.fromData(d)) + .then((d) => IbcNftParams.fromData(d.params)) } /** Gets the escrow address for a particular port and channel id */ diff --git a/src/client/rest/api/IbcTransferAPI.spec.ts b/src/client/rest/api/IbcTransferAPI.spec.ts index 7fedd96..75fc2da 100644 --- a/src/client/rest/api/IbcTransferAPI.spec.ts +++ b/src/client/rest/api/IbcTransferAPI.spec.ts @@ -1,13 +1,13 @@ import { APIRequester } from '../APIRequester' import { IbcTransferAPI } from './IbcTransferAPI' -import { DenomTrace } from '../../../core/ibc/applications/transfer/DenomTrace' +import { DenomTrace, IbcTransferParams } from '../../../core' -const c = new APIRequester('https://rest.devnet.initia.xyz') -const ibctx = new IbcTransferAPI(c) +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new IbcTransferAPI(c) describe('IbcTransferAPI', () => { it('denomTraces', async () => { - const denomTraces = await ibctx.denomTraces().then((v) => v[0]) + const denomTraces = await api.denomTraces().then((v) => v[0]) denomTraces.forEach(function (denomTrace: DenomTrace.Data) { expect(denomTrace.path).toMatch('transfer/channel-') expect(denomTrace.base_denom).not.toBeUndefined() @@ -15,8 +15,7 @@ describe('IbcTransferAPI', () => { }) it('params', async () => { - const param = await ibctx.parameters() - expect(param.send_enabled).toEqual(expect.any(Boolean)) - expect(param.receive_enabled).toEqual(expect.any(Boolean)) + const params = await api.parameters() + expect(params).toEqual(expect.any(IbcTransferParams)) }) }) diff --git a/src/client/rest/api/IbcTransferAPI.ts b/src/client/rest/api/IbcTransferAPI.ts index 21058cb..5737c18 100644 --- a/src/client/rest/api/IbcTransferAPI.ts +++ b/src/client/rest/api/IbcTransferAPI.ts @@ -1,18 +1,6 @@ import { BaseAPI } from './BaseAPI' import { APIParams, Pagination, PaginationOptions } from '../APIRequester' -import { DenomTrace } from '../../../core' - -export interface IbcTransferParams { - send_enabled: boolean - receive_enabled: boolean -} - -export namespace IbcTransferParams { - export interface Data { - send_enabled: boolean - receive_enabled: boolean - } -} +import { DenomTrace, IbcTransferParams } from '../../../core' export class IbcTransferAPI extends BaseAPI { /** Gets a denomTrace for the hash or denom */ @@ -51,10 +39,7 @@ export class IbcTransferAPI extends BaseAPI { .get<{ params: IbcTransferParams.Data }>(`/ibc/apps/transfer/v1/params`, params) - .then(({ params: d }) => ({ - send_enabled: d.send_enabled, - receive_enabled: d.receive_enabled, - })) + .then((d) => IbcTransferParams.fromData(d.params)) } /** Gets the escrow address for a particular port and channel id */ diff --git a/src/client/rest/api/MarketmapAPI.spec.ts b/src/client/rest/api/MarketmapAPI.spec.ts new file mode 100644 index 0000000..fe3d597 --- /dev/null +++ b/src/client/rest/api/MarketmapAPI.spec.ts @@ -0,0 +1,20 @@ +import { APIRequester } from '../APIRequester' +import { MarketmapAPI } from './MarketmapAPI' +import { Market, MarketmapParams } from '../../../core' + +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new MarketmapAPI(c) + +describe('MarketmapAPI', () => { + it('market map', async () => { + const marketMap = await api.marketMap() + for (const market of Object.values(marketMap.markets)) { + expect(market).toEqual(expect.any(Market)) + } + }) + + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(MarketmapParams)) + }) +}) diff --git a/src/client/rest/api/MoveAPI.spec.ts b/src/client/rest/api/MoveAPI.spec.ts new file mode 100644 index 0000000..2b09b38 --- /dev/null +++ b/src/client/rest/api/MoveAPI.spec.ts @@ -0,0 +1,27 @@ +import { APIRequester } from '../APIRequester' +import { MoveAPI } from './MoveAPI' +import { Module, MoveParams } from '../../../core' + +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new MoveAPI(c) + +describe('MoveAPI', () => { + it('modules', async () => { + const modules = await api.modules('0x1') + for (const module of modules[0]) { + expect(module).toEqual(expect.any(Module)) + } + }) + + it('denom&metadata', async () => { + const metadata = await api.metadata('uinit') + expect(metadata).toEqual(expect.any(String)) + const denom = await api.denom(metadata) + expect(denom).toEqual('uinit') + }) + + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(MoveParams)) + }) +}) diff --git a/src/client/rest/api/MoveAPI.ts b/src/client/rest/api/MoveAPI.ts index 56ed476..71d7cd7 100644 --- a/src/client/rest/api/MoveAPI.ts +++ b/src/client/rest/api/MoveAPI.ts @@ -1,15 +1,6 @@ import { BaseAPI } from './BaseAPI' -import { AccAddress, Denom, MoveParams } from '../../../core' +import { AccAddress, Denom, Module, MoveParams } from '../../../core' import { APIParams, Pagination, PaginationOptions } from '../APIRequester' -import { UpgradePolicy } from '@initia/initia.proto/initia/move/v1/types' - -export interface Module { - address: AccAddress - module_name: string - abi: string - raw_bytes: string - upgrade_policy: UpgradePolicy -} export interface Resource { address: AccAddress @@ -60,19 +51,10 @@ export class MoveAPI extends BaseAPI { ): Promise<[Module[], Pagination]> { return this.c .get<{ - modules: Module[] + modules: Module.Data[] pagination: Pagination }>(`/initia/move/v1/accounts/${address}/modules`, params) - .then((d) => [ - d.modules.map((mod) => ({ - address: mod.address, - module_name: mod.module_name, - abi: mod.abi, - raw_bytes: mod.raw_bytes, - upgrade_policy: mod.upgrade_policy, - })), - d.pagination, - ]) + .then((d) => [d.modules.map(Module.fromData), d.pagination]) } public async module( @@ -82,15 +64,9 @@ export class MoveAPI extends BaseAPI { ): Promise { return this.c .get<{ - module: Module + module: Module.Data }>(`/initia/move/v1/accounts/${address}/modules/${moduleName}`, params) - .then(({ module: d }) => ({ - address: d.address, - module_name: d.module_name, - abi: d.abi, - raw_bytes: d.raw_bytes, - upgrade_policy: d.upgrade_policy, - })) + .then((d) => Module.fromData(d.module)) } public async viewFunction( @@ -186,7 +162,7 @@ export class MoveAPI extends BaseAPI { ...params, struct_tag: structTag, }) - .then(({ resource: d }) => JSON.parse(d.move_resource)) + .then((d) => JSON.parse(d.resource.move_resource)) } public async denom(metadata: string, params: APIParams = {}): Promise { @@ -207,7 +183,7 @@ export class MoveAPI extends BaseAPI { public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: MoveParams.Data }>(`/initia/move/v1/params`, params) - .then(({ params: d }) => MoveParams.fromData(d)) + .then((d) => MoveParams.fromData(d.params)) } public async scriptABI(codeBytes: string): Promise { diff --git a/src/client/rest/api/MstakingAPI.spec.ts b/src/client/rest/api/MstakingAPI.spec.ts index 6b5501c..20c92d6 100644 --- a/src/client/rest/api/MstakingAPI.spec.ts +++ b/src/client/rest/api/MstakingAPI.spec.ts @@ -1,33 +1,21 @@ import { APIRequester } from '../APIRequester' import { MstakingAPI } from './MstakingAPI' -import { Coins, Duration, ValConsPublicKey } from '../../../core' +import { Coins, MstakingParams, ValConsPublicKey } from '../../../core' -const c = new APIRequester('https://rest.devnet.initia.xyz') -const mstaking = new MstakingAPI(c) +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new MstakingAPI(c) describe('MstakingAPI', () => { - it('parameters', async () => { - await expect(mstaking.parameters()).resolves.toMatchObject({ - unbonding_time: expect.any(Duration), - max_validators: expect.any(Number), - max_entries: expect.any(Number), - historical_entries: expect.any(Number), - bond_denoms: expect.any(Array), - min_voting_power: expect.any(Number), - min_commission_rate: expect.any(String), - }) - }) - it('delegations without parameter should throw an error', async () => { - await expect(mstaking.delegations()).rejects.toThrowError() + await expect(api.delegations()).rejects.toThrowError() }) it('unbondingDelegations without parameter should throw an error', async () => { - await expect(mstaking.unbondingDelegations()).rejects.toThrowError() + await expect(api.unbondingDelegations()).rejects.toThrowError() }) it('validators', async () => { - const validators = await mstaking.validators().then((v) => v[0]) + const validators = await api.validators().then((v) => v[0]) expect(validators).toContainEqual({ operator_address: expect.any(String), @@ -59,9 +47,14 @@ describe('MstakingAPI', () => { }) it('pool', async () => { - await expect(mstaking.pool()).resolves.toMatchObject({ + await expect(api.pool()).resolves.toMatchObject({ bonded_tokens: expect.any(Coins), not_bonded_tokens: expect.any(Coins), }) }) + + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(MstakingParams)) + }) }) diff --git a/src/client/rest/api/MstakingAPI.ts b/src/client/rest/api/MstakingAPI.ts index 9409808..428848b 100644 --- a/src/client/rest/api/MstakingAPI.ts +++ b/src/client/rest/api/MstakingAPI.ts @@ -47,8 +47,8 @@ export class MstakingAPI extends BaseAPI { `/initia/mstaking/v1/validators/${validator}/delegations/${delegator}`, params ) - .then(({ delegation_response: data }) => [ - [Delegation.fromData(data)], + .then((d) => [ + [Delegation.fromData(d.delegation_response)], { total: 1, next_key: '' }, ]) } else if (delegator !== undefined) { @@ -110,8 +110,8 @@ export class MstakingAPI extends BaseAPI { `/initia/mstaking/v1/validators/${validator}/delegations/${delegator}/unbonding_delegation`, params ) - .then(({ unbond: data }) => [ - [UnbondingDelegation.fromData(data)], + .then((d) => [ + [UnbondingDelegation.fromData(d.unbond)], { next_key: '', total: 1 }, ]) } else if (delegator !== undefined) { @@ -240,9 +240,9 @@ export class MstakingAPI extends BaseAPI { public async pool(params: APIParams = {}): Promise { return this.c .get<{ pool: MstakingPool.Data }>(`/initia/mstaking/v1/pool`, params) - .then(({ pool: d }) => ({ - bonded_tokens: Coins.fromData(d.bonded_tokens), - not_bonded_tokens: Coins.fromData(d.not_bonded_tokens), + .then((d) => ({ + bonded_tokens: Coins.fromData(d.pool.bonded_tokens), + not_bonded_tokens: Coins.fromData(d.pool.not_bonded_tokens), })) } @@ -254,6 +254,6 @@ export class MstakingAPI extends BaseAPI { .get<{ params: MstakingParams.Data }>(`/initia/mstaking/v1/params`, params) - .then(({ params: d }) => MstakingParams.fromData(d)) + .then((d) => MstakingParams.fromData(d.params)) } } diff --git a/src/client/rest/api/OphostAPI.spec.ts b/src/client/rest/api/OphostAPI.spec.ts new file mode 100644 index 0000000..e74fec3 --- /dev/null +++ b/src/client/rest/api/OphostAPI.spec.ts @@ -0,0 +1,20 @@ +import { APIRequester } from '../APIRequester' +import { OphostAPI } from './OphostAPI' +import { BridgeInfo, OphostParams } from '../../../core' + +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new OphostAPI(c) + +describe('OphostAPI', () => { + it('bridge infos', async () => { + const bridgeInfos = await api.bridgeInfos() + for (const info of bridgeInfos[0]) { + expect(info).toEqual(expect.any(BridgeInfo)) + } + }) + + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(OphostParams)) + }) +}) diff --git a/src/client/rest/api/OphostAPI.ts b/src/client/rest/api/OphostAPI.ts index 04011fe..5369711 100644 --- a/src/client/rest/api/OphostAPI.ts +++ b/src/client/rest/api/OphostAPI.ts @@ -183,7 +183,7 @@ export class OphostAPI extends BaseAPI { public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: OphostParams.Data }>(`/opinit/opchild/v1/params`, params) + .get<{ params: OphostParams.Data }>(`/opinit/ophost/v1/params`, params) .then((d) => OphostParams.fromData(d.params)) } } diff --git a/src/client/rest/api/OracleAPI.spec.ts b/src/client/rest/api/OracleAPI.spec.ts new file mode 100644 index 0000000..69f1e62 --- /dev/null +++ b/src/client/rest/api/OracleAPI.spec.ts @@ -0,0 +1,21 @@ +import { APIRequester } from '../APIRequester' +import { OracleAPI } from './OracleAPI' +import { CurrencyPair, QuotePrice } from '../../../core' + +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new OracleAPI(c) + +describe('OracleAPI', () => { + it('currency pairs', async () => { + const pairs = await api.currencyPairs() + for (const pair of pairs) { + expect(pair).toEqual(expect.any(CurrencyPair)) + } + }) + + it('price', async () => { + const pairs = await api.currencyPairs() + const price = await api.price(pairs[0]) + expect(price).toEqual(expect.any(QuotePrice)) + }) +}) diff --git a/src/client/rest/api/RewardAPI.spec.ts b/src/client/rest/api/RewardAPI.spec.ts index f1d876e..2332255 100644 --- a/src/client/rest/api/RewardAPI.spec.ts +++ b/src/client/rest/api/RewardAPI.spec.ts @@ -1,8 +1,8 @@ -import { Duration } from '../../../core' import { APIRequester } from '../APIRequester' import { RewardAPI } from './RewardAPI' +import { RewardParams } from '../../../core' -const c = new APIRequester('https://rest.devnet.initia.xyz') +const c = new APIRequester('https://rest.testnet.initia.xyz') const api = new RewardAPI(c) describe('RewardAPI', () => { @@ -16,13 +16,8 @@ describe('RewardAPI', () => { await expect(api.annualProvisions()).resolves.toEqual(expect.any(String)) }) - it('parameters', async () => { - await expect(api.parameters()).resolves.toMatchObject({ - reward_denom: expect.any(String), - dilution_period: expect.any(Duration), - release_rate: expect.any(String), - dilution_rate: expect.any(String), - release_enabled: expect.any(Boolean), - }) + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(RewardParams)) }) }) diff --git a/src/client/rest/api/RewardAPI.ts b/src/client/rest/api/RewardAPI.ts index 7d6bc74..7e27728 100644 --- a/src/client/rest/api/RewardAPI.ts +++ b/src/client/rest/api/RewardAPI.ts @@ -33,6 +33,6 @@ export class RewardAPI extends BaseAPI { public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: RewardParams.Data }>(`/initia/reward/v1/params`, params) - .then(({ params: d }) => RewardParams.fromData(d)) + .then((d) => RewardParams.fromData(d.params)) } } diff --git a/src/client/rest/api/SlashingAPI.spec.ts b/src/client/rest/api/SlashingAPI.spec.ts index 8fdf634..e5e5af1 100644 --- a/src/client/rest/api/SlashingAPI.spec.ts +++ b/src/client/rest/api/SlashingAPI.spec.ts @@ -1,18 +1,20 @@ -import { Duration } from '../../../core' import { APIRequester } from '../APIRequester' import { SlashingAPI } from './SlashingAPI' +import { SlashingParams, ValidatorSigningInfo } from '../../../core' -const c = new APIRequester('https://rest.devnet.initia.xyz') -const slashing = new SlashingAPI(c) +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new SlashingAPI(c) describe('SlashingAPI', () => { - it('parameters', async () => { - await expect(slashing.parameters()).resolves.toMatchObject({ - signed_blocks_window: expect.any(Number), - min_signed_per_window: expect.any(String), - downtime_jail_duration: expect.any(Duration), - slash_fraction_double_sign: expect.any(String), - slash_fraction_downtime: expect.any(String), - }) + it('signing infos', async () => { + const infos = await api.signingInfos() + for (const info of infos[0]) { + expect(info).toEqual(expect.any(ValidatorSigningInfo)) + } + }) + + it('params', async () => { + const params = await api.parameters() + expect(params).toEqual(expect.any(SlashingParams)) }) }) diff --git a/src/client/rest/api/SlashingAPI.ts b/src/client/rest/api/SlashingAPI.ts index 1b8cb23..799c846 100644 --- a/src/client/rest/api/SlashingAPI.ts +++ b/src/client/rest/api/SlashingAPI.ts @@ -1,73 +1,32 @@ import { BaseAPI } from './BaseAPI' -import { ValConsAddress, SlashingParams } from '../../../core' +import { + ValConsAddress, + SlashingParams, + ValidatorSigningInfo, +} from '../../../core' import { APIParams, Pagination } from '../APIRequester' -export interface SigningInfo { - /** Validator's consensus address. */ - address: ValConsAddress - - /** Number of blocks over which missed blocks are tallied for downtime. */ - start_height: number - - /** If a validator misses more than this number, they will be penalized and jailed for downtime. */ - index_offset: number - - /** If the current validator is jailed, this value represents when they can submit a [[MsgUnjail]] to unjail themselves. */ - jailed_until: Date - - /** Whether or not the validator is "tombstoned", meaning they are forever barred from joining the validator process. */ - tombstoned: boolean - - /** Number of blocks the validator has missed for the current signed blocks window. */ - missed_blocks_counter: number -} - -export namespace SigningInfo { - export interface Data { - address: string - start_height: string - index_offset: string - jailed_until: string - tombstoned: boolean - missed_blocks_counter: string - } -} - export class SlashingAPI extends BaseAPI { public async signingInfo( valConsAddress: ValConsAddress, params: APIParams = {} - ): Promise { + ): Promise { return this.c .get<{ - val_signing_info: SigningInfo.Data + val_signing_info: ValidatorSigningInfo.Data }>(`/cosmos/slashing/v1beta1/signing_infos/${valConsAddress}`, params) - .then(({ val_signing_info: d }) => ({ - address: d.address, - start_height: parseInt(d.start_height), - index_offset: parseInt(d.index_offset), - jailed_until: new Date(d.jailed_until), - tombstoned: d.tombstoned, - missed_blocks_counter: parseInt(d.missed_blocks_counter), - })) + .then((d) => ValidatorSigningInfo.fromData(d.val_signing_info)) } - public async signingInfos(params: APIParams = {}): Promise { + public async signingInfos( + params: APIParams = {} + ): Promise<[ValidatorSigningInfo[], Pagination]> { return this.c .get<{ - info: SigningInfo.Data[] + info: ValidatorSigningInfo.Data[] pagination: Pagination }>(`/cosmos/slashing/v1beta1/signing_infos`, params) - .then((d) => - d.info.map((x) => ({ - address: x.address, - start_height: parseInt(x.start_height), - index_offset: parseInt(x.index_offset), - jailed_until: new Date(x.jailed_until), - tombstoned: x.tombstoned, - missed_blocks_counter: parseInt(x.missed_blocks_counter), - })) - ) + .then((d) => [d.info.map(ValidatorSigningInfo.fromData), d.pagination]) } /** @@ -78,6 +37,6 @@ export class SlashingAPI extends BaseAPI { .get<{ params: SlashingParams.Data }>(`/cosmos/slashing/v1beta1/params`, params) - .then(({ params: d }) => SlashingParams.fromData(d)) + .then((d) => SlashingParams.fromData(d.params)) } } diff --git a/src/client/rest/api/TendermintAPI.spec.ts b/src/client/rest/api/TendermintAPI.spec.ts index 847bbfa..4fbb793 100644 --- a/src/client/rest/api/TendermintAPI.spec.ts +++ b/src/client/rest/api/TendermintAPI.spec.ts @@ -3,12 +3,12 @@ import { TendermintAPI } from './TendermintAPI' import { Tx } from '../../../core' import { Tx as Tx_pb } from '@initia/initia.proto/cosmos/tx/v1beta1/tx' -const c = new APIRequester('https://rest.devnet.initia.xyz') -const tendermint = new TendermintAPI(c) +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new TendermintAPI(c) describe('TendermintAPI', () => { it('load block and decode txs', async () => { - const blockInfo = await tendermint.blockInfo(1) + const blockInfo = await api.blockInfo(1) if (blockInfo.block.data.txs != null) { blockInfo.block.data.txs.every((txBytes) => { const txProto = Tx_pb.decode(Buffer.from(txBytes, 'base64')) @@ -18,11 +18,11 @@ describe('TendermintAPI', () => { }) it('node info', async () => { - await expect(tendermint.nodeInfo()).resolves.toBeInstanceOf(Object) + await expect(api.nodeInfo()).resolves.toBeInstanceOf(Object) }) it('validator set (latest)', async () => { - const vals = await tendermint.validatorSet() + const vals = await api.validatorSet() expect(vals[0]).toContainEqual({ address: expect.any(String), @@ -36,7 +36,7 @@ describe('TendermintAPI', () => { }) it('validator set (1)', async () => { - const vals = await tendermint.validatorSet(1) + const vals = await api.validatorSet(1) expect(vals[0]).toContainEqual({ address: expect.any(String), @@ -50,7 +50,7 @@ describe('TendermintAPI', () => { }) it('block info', async () => { - const block = await tendermint.blockInfo() + const block = await api.blockInfo() expect(block).toMatchObject({ block: expect.any(Object), diff --git a/src/client/rest/api/TokenfactoryAPI.ts b/src/client/rest/api/TokenfactoryAPI.ts index 695f0b6..beefa98 100644 --- a/src/client/rest/api/TokenfactoryAPI.ts +++ b/src/client/rest/api/TokenfactoryAPI.ts @@ -45,6 +45,6 @@ export class TokenfactoryAPI extends BaseAPI { .get<{ params: TokenfactoryParams.Data }>(`/miniwasm/tokenfactory/v1/params`, params) - .then(({ params: d }) => TokenfactoryParams.fromData(d)) + .then((d) => TokenfactoryParams.fromData(d.params)) } } diff --git a/src/client/rest/api/TxAPI.spec.ts b/src/client/rest/api/TxAPI.spec.ts index 0bdd006..5e3aed6 100644 --- a/src/client/rest/api/TxAPI.spec.ts +++ b/src/client/rest/api/TxAPI.spec.ts @@ -1,15 +1,15 @@ import { RESTClient } from '../RESTClient' import { APIRequester } from '../APIRequester' +import { isTxError } from './TxAPI' import { MsgSend } from '../../../core' import { MnemonicKey } from '../../../key' -import { isTxError } from './TxAPI' const mk = new MnemonicKey({ mnemonic: 'sound hour era feature bacon code drift deal raw toward soldier nation winter consider tissue jewel script result mean faculty water exist lunch betray', }) const initia = new RESTClient('https://rest.devnet.initia.xyz', { - chainId: 'stone-3', + chainId: 'initiation-2', }) const wallet = initia.wallet(mk) diff --git a/src/client/rest/api/UpgradeAPI.spec.ts b/src/client/rest/api/UpgradeAPI.spec.ts index c907f88..7aa2519 100644 --- a/src/client/rest/api/UpgradeAPI.spec.ts +++ b/src/client/rest/api/UpgradeAPI.spec.ts @@ -1,28 +1,28 @@ import { APIRequester } from '../APIRequester' -import { Plan } from '../../../core' import { UpgradeAPI } from './UpgradeAPI' +import { Plan } from '../../../core' -const c = new APIRequester('https://rest.devnet.initia.xyz') -const upgrade = new UpgradeAPI(c) +const c = new APIRequester('https://rest.testnet.initia.xyz') +const api = new UpgradeAPI(c) describe('UpgradeAPI', () => { describe('applied_plan', () => { it('0 for invalid name', async () => { - const height = await upgrade.appliedPlan('there_is_no_plan_like_this') + const height = await api.appliedPlan('there_is_no_plan_like_this') expect(height).toEqual(0) }) }) describe('current_plan', () => { it('null plan', async () => { - const plan = await upgrade.currentPlan() + const plan = await api.currentPlan() expect(plan == null || plan instanceof Plan) }) }) describe('node_versions', () => { it('module count', async () => { - expect(await upgrade.moduleVersions()).toHaveLength(34) + expect(await api.moduleVersions()).toHaveLength(34) }) }) }) diff --git a/src/core/authz/authorizations/Authorization.ts b/src/core/authz/authorizations/Authorization.ts index 43ef854..0139aee 100644 --- a/src/core/authz/authorizations/Authorization.ts +++ b/src/core/authz/authorizations/Authorization.ts @@ -37,7 +37,7 @@ export class AuthorizationGrant extends JSONSerializable< const { authorization, expiration } = this return { authorization: authorization.toAmino(), - expiration: expiration?.toISOString().replace(/\.000Z$/, 'Z'), + expiration: expiration?.toISOString(), } } @@ -53,7 +53,7 @@ export class AuthorizationGrant extends JSONSerializable< const { authorization, expiration } = this return { authorization: authorization.toData(), - expiration: expiration?.toISOString().replace(/\.000Z$/, 'Z'), + expiration: expiration?.toISOString(), } } diff --git a/src/core/authz/msgs/MsgGrantAuthorization.data.json b/src/core/authz/msgs/MsgGrantAuthorization.data.json index 9f7b75b..6aec02a 100644 --- a/src/core/authz/msgs/MsgGrantAuthorization.data.json +++ b/src/core/authz/msgs/MsgGrantAuthorization.data.json @@ -13,7 +13,7 @@ }] } }, - "expiration": "2022-06-29T08:18:15Z" + "expiration": "2022-06-29T08:18:15.000Z" } } }, @@ -29,7 +29,7 @@ "msg": "/cosmos.bank.v1beta1.MsgSend" } }, - "expiration": "2022-06-29T08:18:15Z" + "expiration": "2022-06-29T08:18:15.000Z" } } } diff --git a/src/core/feegrant/allowances/BasicAllowance.ts b/src/core/feegrant/allowances/BasicAllowance.ts index f386b99..4e6f7bb 100644 --- a/src/core/feegrant/allowances/BasicAllowance.ts +++ b/src/core/feegrant/allowances/BasicAllowance.ts @@ -58,7 +58,7 @@ export class BasicAllowance extends JSONSerializable< type: 'cosmos-sdk/BasicAllowance', value: { spend_limit: spend_limit?.toAmino(), - expiration: expiration?.toISOString().replace(/\.000Z$/, 'Z'), + expiration: expiration?.toISOString(), }, } } @@ -76,7 +76,7 @@ export class BasicAllowance extends JSONSerializable< return { '@type': '/cosmos.feegrant.v1beta1.BasicAllowance', spend_limit: spend_limit?.toData(), - expiration: expiration?.toISOString().replace(/\.000Z$/, 'Z'), + expiration: expiration?.toISOString(), } } diff --git a/src/core/feegrant/allowances/PeriodicAllowance.ts b/src/core/feegrant/allowances/PeriodicAllowance.ts index 7f7c73c..8a96c06 100644 --- a/src/core/feegrant/allowances/PeriodicAllowance.ts +++ b/src/core/feegrant/allowances/PeriodicAllowance.ts @@ -72,7 +72,7 @@ export class PeriodicAllowance extends JSONSerializable< period: period.toAmino(), period_spend_limit: period_spend_limit.toAmino(), period_can_spend: period_can_spend.toAmino(), - period_reset: period_reset.toISOString().replace(/\.000Z$/, 'Z'), + period_reset: period_reset.toISOString(), }, } } @@ -108,7 +108,7 @@ export class PeriodicAllowance extends JSONSerializable< period: period.toData(), period_spend_limit: period_spend_limit.toData(), period_can_spend: period_can_spend.toData(), - period_reset: period_reset.toISOString().replace(/\.000Z$/, 'Z'), + period_reset: period_reset.toISOString(), } } diff --git a/src/core/ibc/applications/transfer/index.ts b/src/core/ibc/applications/transfer/index.ts index 3711060..c149f0e 100644 --- a/src/core/ibc/applications/transfer/index.ts +++ b/src/core/ibc/applications/transfer/index.ts @@ -2,3 +2,4 @@ export * from './authorizations' export * from './msgs' export * from './DenomTrace' export * from './FungibleTokenPacketData' +export * from './IbcTransferParams' diff --git a/src/core/ibc/core/client/msgs/tendermint/types.ts b/src/core/ibc/core/client/msgs/tendermint/types.ts index d5ec573..03a3fa7 100644 --- a/src/core/ibc/core/client/msgs/tendermint/types.ts +++ b/src/core/ibc/core/client/msgs/tendermint/types.ts @@ -107,7 +107,7 @@ export class Header extends JSONSerializable { version: version?.toData(), chain_id, height: height.toFixed(), - time: time?.toISOString().replace(/\.000Z$/, 'Z'), + time: time?.toISOString(), last_block_id: last_block_id?.toData(), last_commit_hash, data_hash, @@ -530,7 +530,7 @@ export class CommitSig extends JSONSerializable< return { block_id_flag: blockIDFlagToJSON(block_id_flag), validator_address: validator_address ?? '', - timestamp: timestamp?.toISOString().replace(/\.000Z$/, 'Z'), + timestamp: timestamp?.toISOString(), signature: signature ?? '', } } diff --git a/src/core/move/Module.ts b/src/core/move/Module.ts new file mode 100644 index 0000000..8d68caf --- /dev/null +++ b/src/core/move/Module.ts @@ -0,0 +1,119 @@ +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' +import { + Module as Module_pb, + UpgradePolicy, + upgradePolicyFromJSON, + upgradePolicyToJSON, +} from '@initia/initia.proto/initia/move/v1/types' + +export class Module extends JSONSerializable< + Module.Amino, + Module.Data, + Module.Proto +> { + /** + * @param address + * @param module_name + * @param abi + * @param raw_bytes + * @param upgrade_policy + */ + constructor( + public address: AccAddress, + public module_name: string, + public abi: string, + public raw_bytes: string, + public upgrade_policy: Module.Policy + ) { + super() + } + + public static fromAmino(data: Module.Amino): Module { + const { address, module_name, abi, raw_bytes, upgrade_policy } = data + return new Module( + address, + module_name, + abi, + raw_bytes, + upgradePolicyFromJSON(upgrade_policy) + ) + } + + public toAmino(): Module.Amino { + const { address, module_name, abi, raw_bytes, upgrade_policy } = this + return { + address, + module_name, + abi, + raw_bytes, + upgrade_policy: upgradePolicyToJSON(upgrade_policy), + } + } + + public static fromData(data: Module.Data): Module { + const { address, module_name, abi, raw_bytes, upgrade_policy } = data + return new Module( + address, + module_name, + abi, + raw_bytes, + upgradePolicyFromJSON(upgrade_policy) + ) + } + + public toData(): Module.Data { + const { address, module_name, abi, raw_bytes, upgrade_policy } = this + return { + address, + module_name, + abi, + raw_bytes, + upgrade_policy: upgradePolicyToJSON(upgrade_policy), + } + } + + public static fromProto(data: Module.Proto): Module { + return new Module( + data.address, + data.moduleName, + data.abi, + Buffer.from(data.rawBytes).toString('base64'), + data.upgradePolicy + ) + } + + public toProto(): Module.Proto { + const { address, module_name, abi, raw_bytes, upgrade_policy } = this + return Module_pb.fromPartial({ + address, + moduleName: module_name, + abi, + rawBytes: Buffer.from(raw_bytes, 'base64'), + upgradePolicy: upgrade_policy, + }) + } +} + +export namespace Module { + export type Policy = UpgradePolicy + export const Policy = UpgradePolicy + + export interface Amino { + address: AccAddress + module_name: string + abi: string + raw_bytes: string + upgrade_policy: string + } + + export interface Data { + address: AccAddress + module_name: string + abi: string + raw_bytes: string + upgrade_policy: string + } + + export type Proto = Module_pb +} diff --git a/src/core/move/index.ts b/src/core/move/index.ts index 08bbf83..eb4c978 100644 --- a/src/core/move/index.ts +++ b/src/core/move/index.ts @@ -1,2 +1,3 @@ export * from './msgs' +export * from './Module' export * from './MoveParams' diff --git a/src/core/slashing/ValidatorSigningInfo.ts b/src/core/slashing/ValidatorSigningInfo.ts new file mode 100644 index 0000000..d14aae7 --- /dev/null +++ b/src/core/slashing/ValidatorSigningInfo.ts @@ -0,0 +1,167 @@ +import { JSONSerializable } from '../../util/json' +import { ValConsAddress } from '../bech32' +import { ValidatorSigningInfo as ValidatorSigningInfo_pb } from '@initia/initia.proto/cosmos/slashing/v1beta1/slashing' + +export class ValidatorSigningInfo extends JSONSerializable< + ValidatorSigningInfo.Amino, + ValidatorSigningInfo.Data, + ValidatorSigningInfo.Proto +> { + /** + * @param address + * @param start_height height at which validator was first a candidate OR was un-jailed + * @param index_offset index which is incremented every time a validator is bonded in a block + * @param jailed_until timestamp until which the validator is jailed due to liveness downtime + * @param tombstoned whether or not a validator has been tombstoned + * @param missed_blocks_counter a counter of missed (unsigned) blocks + */ + constructor( + public address: ValConsAddress, + public start_height: number, + public index_offset: number, + public jailed_until: Date, + public tombstoned: boolean, + public missed_blocks_counter: number + ) { + super() + } + + public static fromAmino( + data: ValidatorSigningInfo.Amino + ): ValidatorSigningInfo { + const { + address, + start_height, + index_offset, + jailed_until, + tombstoned, + missed_blocks_counter, + } = data + + return new ValidatorSigningInfo( + address, + parseInt(start_height), + parseInt(index_offset), + new Date(jailed_until), + tombstoned, + parseInt(missed_blocks_counter) + ) + } + + public toAmino(): ValidatorSigningInfo.Amino { + const { + address, + start_height, + index_offset, + jailed_until, + tombstoned, + missed_blocks_counter, + } = this + + return { + address, + start_height: start_height.toFixed(), + index_offset: index_offset.toFixed(), + jailed_until: jailed_until.toISOString(), + tombstoned, + missed_blocks_counter: missed_blocks_counter.toFixed(), + } + } + + public static fromData( + data: ValidatorSigningInfo.Data + ): ValidatorSigningInfo { + const { + address, + start_height, + index_offset, + jailed_until, + tombstoned, + missed_blocks_counter, + } = data + + return new ValidatorSigningInfo( + address, + parseInt(start_height), + parseInt(index_offset), + new Date(jailed_until), + tombstoned, + parseInt(missed_blocks_counter) + ) + } + + public toData(): ValidatorSigningInfo.Data { + const { + address, + start_height, + index_offset, + jailed_until, + tombstoned, + missed_blocks_counter, + } = this + + return { + address, + start_height: start_height.toFixed(), + index_offset: index_offset.toFixed(), + jailed_until: jailed_until.toISOString(), + tombstoned, + missed_blocks_counter: missed_blocks_counter.toFixed(), + } + } + + public static fromProto( + data: ValidatorSigningInfo.Proto + ): ValidatorSigningInfo { + return new ValidatorSigningInfo( + data.address, + data.startHeight.toNumber(), + data.indexOffset.toNumber(), + data.jailedUntil as Date, + data.tombstoned, + data.missedBlocksCounter.toNumber() + ) + } + + public toProto(): ValidatorSigningInfo.Proto { + const { + address, + start_height, + index_offset, + jailed_until, + tombstoned, + missed_blocks_counter, + } = this + + return ValidatorSigningInfo_pb.fromPartial({ + address, + startHeight: start_height, + indexOffset: index_offset, + jailedUntil: jailed_until, + tombstoned, + missedBlocksCounter: missed_blocks_counter, + }) + } +} + +export namespace ValidatorSigningInfo { + export interface Amino { + address: ValConsAddress + start_height: string + index_offset: string + jailed_until: string + tombstoned: boolean + missed_blocks_counter: string + } + + export interface Data { + address: ValConsAddress + start_height: string + index_offset: string + jailed_until: string + tombstoned: boolean + missed_blocks_counter: string + } + + export type Proto = ValidatorSigningInfo_pb +} diff --git a/src/core/slashing/index.ts b/src/core/slashing/index.ts index 41867d3..079ee01 100644 --- a/src/core/slashing/index.ts +++ b/src/core/slashing/index.ts @@ -1,2 +1,3 @@ export * from './msgs' +export * from './ValidatorSigningInfo' export * from './SlashingParams' From 5e678703014332b4655a87be79843e5c29516e70 Mon Sep 17 00:00:00 2001 From: joon9823 Date: Wed, 6 Nov 2024 16:50:57 +0900 Subject: [PATCH 2/5] Remove localinitia --- src/client/LocalInitia.ts | 84 --------------------------------------- src/client/index.ts | 3 -- 2 files changed, 87 deletions(-) delete mode 100644 src/client/LocalInitia.ts diff --git a/src/client/LocalInitia.ts b/src/client/LocalInitia.ts deleted file mode 100644 index dbd4212..0000000 --- a/src/client/LocalInitia.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { RESTClient } from './rest/RESTClient' -import { Wallet } from './rest/Wallet' -import { MnemonicKey } from '../key/MnemonicKey' - -const LOCALINITIA_MNEMONICS = { - validator: - 'walk only potato reason dance meadow any milk raise inflict retreat parent force resource battle concert acquire regret drill better cabin meadow ordinary save', - test1: - 'exclude stay club ten scrap inflict wheat riot fly usage wait dog grain turtle fetch toy insect snap mimic inner juice hotel grant net', - test2: - 'explain inch inherit clean poverty crime guess material element arm night demand stem kid pool large hour soul measure scan pave error weather tragic', - test3: - 'coconut climb noble cupboard leader decide power apple twice fiber blue region present orient negative jungle blanket fat gym moon fossil bulb evil apart', - test4: - 'topic visual tide critic march unhappy thrive permit load math artwork speed only lawn effort general under cable door relief liberty avocado swallow tenant', - test5: - 'large smoke slam staff crisp any version olympic spatial broom forward detect notice pull option hundred private outdoor oven hint box interest into power', - test6: - 'private fuel exile give tribe profit waste sight primary fish rookie skirt wear broom issue gold bird process once pattern tongue rival sense reject', - test7: - 'segment hire punch same escape soap economy health what either flat diamond hammer auction index omit museum tuition decline weekend lava over time mango', - test8: - 'churn hill piece army zero random breeze ginger magnet huge fat notable ceiling yellow security chalk merry normal junior warm theme false fade later', - test9: - 'primary scale invite wife carpet roast blouse utility lyrics tank marriage science problem salmon minor grocery there ladder noise never gather aerobic neglect rigid', - test10: - 'forum shiver flush artefact analyst undo hundred mixed diamond mushroom submit city march crater fatigue deal host asthma reopen barrel virtual accuse crime dune', -} - -export class LocalInitia extends RESTClient { - public wallets: { - validator: Wallet - test1: Wallet - test2: Wallet - test3: Wallet - test4: Wallet - test5: Wallet - test6: Wallet - test7: Wallet - test8: Wallet - test9: Wallet - test10: Wallet - } - - constructor() { - super('http://localhost:1317', { chainId: 'local-initia' }) - - this.wallets = { - validator: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.validator }) - ), - test1: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test1 }) - ), - test2: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test2 }) - ), - test3: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test3 }) - ), - test4: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test4 }) - ), - test5: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test5 }) - ), - test6: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test6 }) - ), - test7: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test7 }) - ), - test8: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test8 }) - ), - test9: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test9 }) - ), - test10: this.wallet( - new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test10 }) - ), - } - } -} diff --git a/src/client/index.ts b/src/client/index.ts index 2cfb65b..33fe110 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -4,8 +4,5 @@ export * from './rest/RESTClient' export * from './rest/Wallet' export * from './rest/api' -// LocalInitia (REST Client) -export * from './LocalInitia' - // WebSocketClient export * from './WebSocketClient' From 9b3234f9d10fe4f96a9451a110a4628e0fc6afdb Mon Sep 17 00:00:00 2001 From: joon9823 Date: Thu, 7 Nov 2024 16:25:04 +0900 Subject: [PATCH 3/5] Add comments to the rest api endpoints --- src/client/rest/api/AuctionAPI.ts | 3 + src/client/rest/api/AuthAPI.ts | 8 + src/client/rest/api/AuthzAPI.ts | 15 +- src/client/rest/api/BankAPI.ts | 17 +- src/client/rest/api/DistributionAPI.ts | 18 +- src/client/rest/api/EvidenceAPI.ts | 7 + src/client/rest/api/EvmAPI.ts | 50 ++++- src/client/rest/api/FeeGrantAPI.ts | 13 ++ src/client/rest/api/ForwardingAPI.ts | 13 ++ src/client/rest/api/GovAPI.ts | 45 +++-- src/client/rest/api/GroupAPI.ts | 86 ++++++-- src/client/rest/api/IbcAPI.ts | 52 ++--- src/client/rest/api/IbcHooksAPI.ts | 10 + src/client/rest/api/IbcNftAPI.ts | 38 ++-- src/client/rest/api/IbcPermAPI.ts | 14 +- src/client/rest/api/IbcTransferAPI.ts | 22 ++- src/client/rest/api/InterTxAPI.ts | 5 + src/client/rest/api/MarketmapAPI.ts | 13 ++ src/client/rest/api/MoveAPI.ts | 263 ++++++++++++++++--------- src/client/rest/api/MstakingAPI.ts | 43 ++-- src/client/rest/api/OpchildAPI.ts | 27 ++- src/client/rest/api/OphostAPI.ts | 108 +++++++--- src/client/rest/api/OracleAPI.ts | 7 + src/client/rest/api/RewardAPI.ts | 6 +- src/client/rest/api/SlashingAPI.ts | 31 +-- src/client/rest/api/TendermintAPI.ts | 12 +- src/client/rest/api/TokenfactoryAPI.ts | 15 ++ src/client/rest/api/TxAPI.ts | 68 ++++--- src/client/rest/api/UpgradeAPI.ts | 9 +- src/client/rest/api/WasmAPI.ts | 59 +++++- 30 files changed, 760 insertions(+), 317 deletions(-) diff --git a/src/client/rest/api/AuctionAPI.ts b/src/client/rest/api/AuctionAPI.ts index 68c965c..69951ed 100644 --- a/src/client/rest/api/AuctionAPI.ts +++ b/src/client/rest/api/AuctionAPI.ts @@ -3,6 +3,9 @@ import { APIParams } from '../APIRequester' import { BaseAPI } from './BaseAPI' export class AuctionAPI extends BaseAPI { + /** + * Query the parameters of the auction module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ diff --git a/src/client/rest/api/AuthAPI.ts b/src/client/rest/api/AuthAPI.ts index e7d99dd..f434a5d 100644 --- a/src/client/rest/api/AuthAPI.ts +++ b/src/client/rest/api/AuthAPI.ts @@ -10,6 +10,7 @@ import { APIParams } from '../APIRequester' export class AuthAPI extends BaseAPI { /** + * Query the account info. * @param address address of account to look up */ public async accountInfo( @@ -22,6 +23,10 @@ export class AuthAPI extends BaseAPI { return Account.fromData(account) } + /** + * Query the module account info. + * @param address name of module account to look up + */ public async moduleAccount( name: string, params: APIParams = {} @@ -33,6 +38,9 @@ export class AuthAPI extends BaseAPI { return ModuleAccount.fromData(account) } + /** + * Query the parameters of the auth module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: AuthParams.Data }>(`/cosmos/auth/v1beta1/params`, params) diff --git a/src/client/rest/api/AuthzAPI.ts b/src/client/rest/api/AuthzAPI.ts index a2b65ae..ddb489b 100644 --- a/src/client/rest/api/AuthzAPI.ts +++ b/src/client/rest/api/AuthzAPI.ts @@ -4,12 +4,15 @@ import { APIParams, Pagination } from '../APIRequester' export class AuthzAPI extends BaseAPI { /** - * Get the message authorization grants for a specific granter and grantee + * Query the message authorization grants for a specific granter and grantee. + * @param granter address of granter + * @param grantee address of grantee + * @param msg_type_url type url of msg */ public async grants( granter: AccAddress, grantee: AccAddress, - msgTypeUrl?: string, + msg_type_url?: string, params: APIParams = {} ): Promise<[AuthorizationGrant[], Pagination]> { return this.c @@ -19,7 +22,7 @@ export class AuthzAPI extends BaseAPI { { granter, grantee, - msg_type_url: msgTypeUrl, + msg_type_url, }, params ) @@ -28,7 +31,8 @@ export class AuthzAPI extends BaseAPI { } /** - * get list of `GrantAuthorization`, granted by granter. + * Query the list of `AuthorizationGrant`, granted by granter. + * @param granter address of granter */ public async granter( granter: AccAddress, @@ -46,7 +50,8 @@ export class AuthzAPI extends BaseAPI { } /** - * get list of `GrantAuthorization`, by grantee. + * Query the list of `AuthorizationGrant`, by grantee. + * @param grantee address of grantee */ public async grantee( grantee: AccAddress, diff --git a/src/client/rest/api/BankAPI.ts b/src/client/rest/api/BankAPI.ts index ee231eb..eeec6c8 100644 --- a/src/client/rest/api/BankAPI.ts +++ b/src/client/rest/api/BankAPI.ts @@ -4,8 +4,8 @@ import { APIParams, Pagination, PaginationOptions } from '../APIRequester' export class BankAPI extends BaseAPI { /** - * Look up the balance of an account by its address. - * @param address address of account to look up. + * Query the balance of an account by its address. + * @param address address of account to look up */ public async balance( address: AccAddress, @@ -20,8 +20,8 @@ export class BankAPI extends BaseAPI { } /** - * Look up the balance of an account by its address and denom. - * @param address address of account to look up. + * Query the balance of an account by its address and denom. + * @param address address of account to look up * @param denom coin denom to look up */ public async balanceByDenom( @@ -40,7 +40,7 @@ export class BankAPI extends BaseAPI { } /** - * Get the total supply of tokens in circulation for all denominations. + * Query the total supply of tokens in circulation for all denominations. */ public async total( params: Partial = {} @@ -54,8 +54,8 @@ export class BankAPI extends BaseAPI { } /** - * Lqueries the spenable balance of all coins for a single account. - * @param address address of account to look up. + * Query the spenable balance of all coins for a single account. + * @param address address of account to look up */ public async spendableBalances( address: AccAddress, @@ -69,6 +69,9 @@ export class BankAPI extends BaseAPI { .then((d) => [Coins.fromData(d.balances), d.pagination]) } + /** + * Query the parameters of the bank module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: BankParams.Data }>(`/cosmos/bank/v1beta1/params`, params) diff --git a/src/client/rest/api/DistributionAPI.ts b/src/client/rest/api/DistributionAPI.ts index b0695c4..527f7d9 100644 --- a/src/client/rest/api/DistributionAPI.ts +++ b/src/client/rest/api/DistributionAPI.ts @@ -20,7 +20,7 @@ export namespace Pool { } /** - * Holds the response of delegator rewards query + * Holds the response of delegator rewards query. */ export interface Rewards { /** @@ -46,7 +46,7 @@ export namespace Rewards { export class DistributionAPI extends BaseAPI { /** - * Gets a delegator's rewards. + * Query a delegator's rewards. * @param delegator delegator's account address */ public async rewards( @@ -75,7 +75,7 @@ export class DistributionAPI extends BaseAPI { } /** - * Gets a delegator's rewards by validator. + * Query a delegator's rewards by validator. * @param delegator delegator's account address * @param validator validator's account address */ @@ -100,7 +100,7 @@ export class DistributionAPI extends BaseAPI { } /** - * Gets a validator's rewards. + * Query a validator's rewards. * @param validator validator's account address */ public async validatorRewards( @@ -123,7 +123,7 @@ export class DistributionAPI extends BaseAPI { } /** - * Gets a validator's commissions. + * Query a validator's commissions. * @param validator validator's operator address */ public async validatorCommission( @@ -145,8 +145,8 @@ export class DistributionAPI extends BaseAPI { } /** - * Gets the withdraw address of a delegator, the address to which rewards are withdrawn. - * @param delegator + * Query the withdraw address of a delegator, the address to which rewards are withdrawn. + * @param delegator delegator's account address */ public async withdrawAddress( delegator: AccAddress, @@ -163,7 +163,7 @@ export class DistributionAPI extends BaseAPI { } /** - * Gets the current value of the community pool. + * Query the current value of the community pool. */ public async communityPool(params: APIParams = {}): Promise { return this.c @@ -174,7 +174,7 @@ export class DistributionAPI extends BaseAPI { } /** - * Gets the current distribution parameters. + * Query the parameters of the distribution module. */ public async parameters(params: APIParams = {}): Promise { return this.c diff --git a/src/client/rest/api/EvidenceAPI.ts b/src/client/rest/api/EvidenceAPI.ts index 5683017..91a6d08 100644 --- a/src/client/rest/api/EvidenceAPI.ts +++ b/src/client/rest/api/EvidenceAPI.ts @@ -3,6 +3,9 @@ import { APIParams, Pagination, PaginationOptions } from '../APIRequester' import { Evidence } from '../../../core' export class EvidenceAPI extends BaseAPI { + /** + * Query evidences of misbehavior (e.g. equivocation). + */ public async evidences( params: Partial = {} ): Promise<[Evidence[], Pagination]> { @@ -14,6 +17,10 @@ export class EvidenceAPI extends BaseAPI { .then((d) => [d.evidence.map(Evidence.fromData), d.pagination]) } + /** + * Query evidence of a given hash. + * @param hash hash to look up + */ public async evidence( hash: string, params: APIParams = {} diff --git a/src/client/rest/api/EvmAPI.ts b/src/client/rest/api/EvmAPI.ts index e8ccbc3..b54f9bb 100644 --- a/src/client/rest/api/EvmAPI.ts +++ b/src/client/rest/api/EvmAPI.ts @@ -14,27 +14,39 @@ export interface CallResponse { } export class EvmAPI extends BaseAPI { + /** + * Query the module info of given contract address. + * @param contract_addr contract address to look up + */ public async code( - contractAddr: AccAddress, + contract_addr: AccAddress, params: APIParams = {} ): Promise { return this.c - .get<{ code: string }>(`/minievm/evm/v1/codes/${contractAddr}`, params) + .get<{ code: string }>(`/minievm/evm/v1/codes/${contract_addr}`, params) .then((d) => d.code) } + /** + * Query the state bytes of given contract address and key bytes. + * @param contract_addr contract address to look up + * @param key hex encoded hash string + */ public async state( - contractAddr: AccAddress, + contract_addr: AccAddress, key: string, params: APIParams = {} ): Promise { return this.c .get<{ value: string - }>(`/minievm/evm/v1/states/${contractAddr}/${key}`, params) + }>(`/minievm/evm/v1/states/${contract_addr}/${key}`, params) .then((d) => d.value) } + /** + * Query the ERC20Factory contract address. + */ public async erc20Factory(params: APIParams = {}): Promise { return this.c .get<{ @@ -43,6 +55,10 @@ export class EvmAPI extends BaseAPI { .then((d) => d.address) } + /** + * Query the contract address by denom. + * @param denom denom to look up + */ public async contractAddrByDenom( denom: string, params: APIParams = {} @@ -55,29 +71,43 @@ export class EvmAPI extends BaseAPI { .then((d) => d.address) } + /** + * Query the denom of the given contract address. + * @param contract_addr contract address to look up + */ public async denom( - contractAddr: AccAddress, + contract_addr: AccAddress, params: APIParams = {} ): Promise { return this.c - .get<{ denom: string }>(`/minievm/evm/v1/denoms/${contractAddr}`, params) + .get<{ denom: string }>(`/minievm/evm/v1/denoms/${contract_addr}`, params) .then((d) => d.denom) } + /** + * Executes entry function and returns the function result. + * @param sender sender address + * @param contract_addr contract address to execute + * @param input hex encoded call input + * @param with_trace whether to trace the call + */ public async call( sender: AccAddress, - contractAddr: AccAddress, + contract_addr: AccAddress, input: string, - withTrace: boolean + with_trace: boolean ): Promise { return this.c.post(`/minievm/evm/v1/call`, { sender, - contract_addr: contractAddr, + contract_addr, input, - with_trace: withTrace, + with_trace, }) } + /** + * Query the parameters of the evm module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: EvmParams.Data }>(`/minievm/evm/v1/params`, params) diff --git a/src/client/rest/api/FeeGrantAPI.ts b/src/client/rest/api/FeeGrantAPI.ts index 5ffdbaf..a139aaf 100644 --- a/src/client/rest/api/FeeGrantAPI.ts +++ b/src/client/rest/api/FeeGrantAPI.ts @@ -3,6 +3,10 @@ import { BaseAPI } from './BaseAPI' import { Pagination, PaginationOptions } from '../APIRequester' export class FeeGrantAPI extends BaseAPI { + /** + * Query all the grants for the given grantee address. + * @param grantee grantee address to look up + */ public async allowances( grantee: AccAddress, params: Partial = {} @@ -33,6 +37,11 @@ export class FeeGrantAPI extends BaseAPI { })) } + /** + * Query the granted allowance to the grantee by the granter. + * @param granter granter address to look up + * @param grantee grantee address to look up + */ public async allowance( granter: AccAddress, grantee: AccAddress @@ -48,6 +57,10 @@ export class FeeGrantAPI extends BaseAPI { .then((d) => Allowance.fromData(d.allowance.allowance)) } + /** + * Query all the grants given by an address. + * @param granter granter address to look up + */ public async allowancesByGranter( granter: AccAddress, params: Partial = {} diff --git a/src/client/rest/api/ForwardingAPI.ts b/src/client/rest/api/ForwardingAPI.ts index 311598e..022bcd7 100644 --- a/src/client/rest/api/ForwardingAPI.ts +++ b/src/client/rest/api/ForwardingAPI.ts @@ -17,12 +17,21 @@ export namespace ForwardingStats { } export class ForwardingAPI extends BaseAPI { + /** + * Query all the denoms that are allowed to be forwarded. + */ public async denoms(params: APIParams = {}): Promise { return this.c .get<{ allowed_denoms: string[] }>(`/noble/forwarding/v1/denoms`, params) .then((d) => d.allowed_denoms) } + /** + * Query the forwarding address by channel and recipient. + * @param channel + * @param recipient + * @param fallback + */ public async address( channel: string, recipient: string, @@ -39,6 +48,10 @@ export class ForwardingAPI extends BaseAPI { .then((d) => d.address) } + /** + * Query the forwarding stats by channel. + * @param channel + */ public async stats( channel: string, params: APIParams = {} diff --git a/src/client/rest/api/GovAPI.ts b/src/client/rest/api/GovAPI.ts index 42ef801..9602707 100644 --- a/src/client/rest/api/GovAPI.ts +++ b/src/client/rest/api/GovAPI.ts @@ -4,7 +4,7 @@ import { APIParams, Pagination, PaginationOptions } from '../APIRequester' export class GovAPI extends BaseAPI { /** - * Gets all proposals. + * Query all proposals. */ public async proposals( params: Partial = {} @@ -18,33 +18,33 @@ export class GovAPI extends BaseAPI { } /** - * Get a specific proposal by its ID - * @param proposalId proposal's ID + * Query a specific proposal by its ID. + * @param proposal_id proposal's ID */ public async proposal( - proposalId: number, + proposal_id: number, params: APIParams = {} ): Promise { return this.c .get<{ proposal: Proposal.Data - }>(`/initia/gov/v1/proposals/${proposalId}`, params) + }>(`/initia/gov/v1/proposals/${proposal_id}`, params) .then((d) => Proposal.fromData(d.proposal)) } /** - * Get the deposits for a proposal - * @param proposalId proposal's ID + * Query the deposits for a proposal. + * @param proposal_id proposal's ID */ public async deposits( - proposalId: number, - _params: Partial = {} + proposal_id: number, + params: Partial = {} ): Promise<[Deposit[], Pagination]> { return this.c .get<{ deposits: Deposit.Data[] pagination: Pagination - }>(`/cosmos/gov/v1/proposals/${proposalId}/deposits`, _params) + }>(`/cosmos/gov/v1/proposals/${proposal_id}/deposits`, params) .then((d) => [ d.deposits.map((deposit) => Deposit.fromData(deposit)), d.pagination, @@ -52,43 +52,48 @@ export class GovAPI extends BaseAPI { } /** - * Get the current votes for a proposal - * @param proposalId proposal's ID + * Query the current votes for a proposal. + * @param proposal_id proposal's ID */ public async votes( - proposalId: number, - _params: Partial = {} + proposal_id: number, + params: Partial = {} ): Promise<[Vote[], Pagination]> { return this.c .get<{ votes: Vote.Data[] pagination: Pagination - }>(`/cosmos/gov/v1/proposals/${proposalId}/votes`, _params) + }>(`/cosmos/gov/v1/proposals/${proposal_id}/votes`, params) .then((d) => [d.votes.map((v) => Vote.fromData(v)), d.pagination]) } /** - * Gets the current tally for a proposal. - * @param proposalId proposal's ID + * Query the current tally for a proposal. + * @param proposal_id proposal's ID */ public async tally( - proposalId: number, + proposal_id: number, params: APIParams = {} ): Promise { return this.c .get<{ tally_result: TallyResult.Data - }>(`/initia/gov/v1/proposals/${proposalId}/tally`, params) + }>(`/initia/gov/v1/proposals/${proposal_id}/tally`, params) .then((d) => TallyResult.fromData(d.tally_result)) } - /** Gets the Gov module's current parameters */ + /** + * Query the parameters of the gov module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: GovParams.Data }>(`/initia/gov/v1/params`, params) .then((d) => GovParams.fromData(d.params)) } + /** + * Query all emergency proposals. + */ public async emergencyProposals( params: Partial = {} ): Promise<[Proposal[], Pagination]> { diff --git a/src/client/rest/api/GroupAPI.ts b/src/client/rest/api/GroupAPI.ts index 4909533..db47a55 100644 --- a/src/client/rest/api/GroupAPI.ts +++ b/src/client/rest/api/GroupAPI.ts @@ -10,12 +10,20 @@ import { import { APIParams, Pagination, PaginationOptions } from '../APIRequester' export class GroupAPI extends BaseAPI { - public async groupInfo(groupId: number): Promise { + /** + * Query the group info based on group id. + * @param group_id the unique ID of the group + */ + public async groupInfo(group_id: number): Promise { return this.c - .get<{ info: GroupInfo.Data }>(`/cosmos/group/v1/group_info/${groupId}`) + .get<{ info: GroupInfo.Data }>(`/cosmos/group/v1/group_info/${group_id}`) .then((d) => GroupInfo.fromData(d.info)) } + /** + * Query the group policy info based on account address of group policy. + * @param address the account address of the group policy + */ public async groupPolicyInfo(address: AccAddress): Promise { return this.c .get<{ @@ -24,18 +32,26 @@ export class GroupAPI extends BaseAPI { .then((d) => GroupPolicyInfo.fromData(d.info)) } + /** + * Query members of a group by group id. + * @param group_id the unique ID of the group + */ public async groupMembers( - groupId: number, + group_id: number, params: Partial = {} ): Promise<[GroupMember[], Pagination]> { return this.c .get<{ members: GroupMember.Data[] pagination: Pagination - }>(`/cosmos/group/v1/group_members/${groupId}`, params) + }>(`/cosmos/group/v1/group_members/${group_id}`, params) .then((d) => [d.members.map(GroupMember.fromData), d.pagination]) } + /** + * Query groups by admin address. + * @param admin the account address of a group's admin + */ public async groupsByAdmin( admin: AccAddress, params: Partial = {} @@ -48,21 +64,29 @@ export class GroupAPI extends BaseAPI { .then((d) => [d.groups.map(GroupInfo.fromData), d.pagination]) } + /** + * Query group policies by group id. + * @param group_id the unique ID of the group + */ public async groupPoliciesByGroup( - groupId: number, + group_id: number, params: Partial = {} ): Promise<[GroupPolicyInfo[], Pagination]> { return this.c .get<{ group_policies: GroupPolicyInfo.Data[] pagination: Pagination - }>(`/cosmos/group/v1/group_policies_by_group/${groupId}`, params) + }>(`/cosmos/group/v1/group_policies_by_group/${group_id}`, params) .then((d) => [ d.group_policies.map(GroupPolicyInfo.fromData), d.pagination, ]) } + /** + * Query groups policies by admin address. + * @param admin the admin address of the group policy + */ public async groupPoliciesByAdmin( admin: AccAddress, params: Partial = {} @@ -78,14 +102,22 @@ export class GroupAPI extends BaseAPI { ]) } - public async proposal(proposalId: number): Promise { + /** + * Query proposal based on proposal id. + * @param proposal_id the unique ID of a proposal + */ + public async proposal(proposal_id: number): Promise { return this.c .get<{ proposal: GroupProposal.Data - }>(`/cosmos/group/v1/proposal/${proposalId}`) + }>(`/cosmos/group/v1/proposal/${proposal_id}`) .then((d) => GroupProposal.fromData(d.proposal)) } + /** + * Query proposals based on account address of group policy. + * @param address the account address of the group policy related to proposals + */ public async proposalsByGroupPolicy( address: AccAddress, params: Partial = {} @@ -98,29 +130,42 @@ export class GroupAPI extends BaseAPI { .then((d) => [d.proposals.map(GroupProposal.fromData), d.pagination]) } + /** + * Query a vote by proposal id and voter. + * @param proposal_id the unique ID of a proposal + * @param voter a proposal voter account address + */ public async voteByProposalVoter( - proposalId: number, + proposal_id: number, voter: AccAddress ): Promise { return this.c .get<{ vote: GroupVote.Data - }>(`/cosmos/group/v1/vote_by_proposal_voter/${proposalId}/${voter}`) + }>(`/cosmos/group/v1/vote_by_proposal_voter/${proposal_id}/${voter}`) .then((d) => GroupVote.fromData(d.vote)) } + /** + * Query votes by proposal id. + * @param proposal_id the unique ID of a proposal + */ public async votesByProposal( - proposalId: number, + proposal_id: number, params: Partial = {} ): Promise<[GroupVote[], Pagination]> { return this.c .get<{ votes: GroupVote.Data[] pagination: Pagination - }>(`/cosmos/group/v1/votes_by_proposal/${proposalId}`, params) + }>(`/cosmos/group/v1/votes_by_proposal/${proposal_id}`, params) .then((d) => [d.votes.map(GroupVote.fromData), d.pagination]) } + /** + * Query votes by voter. + * @param voter a proposal voter account address + */ public async votesByVoter( voter: AccAddress, params: Partial = {} @@ -133,6 +178,10 @@ export class GroupAPI extends BaseAPI { .then((d) => [d.votes.map(GroupVote.fromData), d.pagination]) } + /** + * Query groups by member address. + * @param address the group member address + */ public async groupsByMember( address: AccAddress, params: Partial = {} @@ -145,16 +194,25 @@ export class GroupAPI extends BaseAPI { .then((d) => [d.groups.map(GroupInfo.fromData), d.pagination]) } + /** + * Query the tally result of a proposal. + * If still in voting period, returns the current tally state. + * If proposal is final, returns the `final_tally_result`. + * @param proposal_id the unique id of a proposal + */ public async tally( - proposalId: number + proposal_id: number ): Promise { return this.c .get<{ tally: GroupProposal.FinalTallyResult - }>(`/cosmos/group/v1/proposals/${proposalId}/tally`) + }>(`/cosmos/group/v1/proposals/${proposal_id}/tally`) .then((d) => d.tally) } + /** + * Query all groups in state. + */ public async groups( params: Partial = {} ): Promise<[GroupInfo[], Pagination]> { diff --git a/src/client/rest/api/IbcAPI.ts b/src/client/rest/api/IbcAPI.ts index 13cf5d1..85de78c 100644 --- a/src/client/rest/api/IbcAPI.ts +++ b/src/client/rest/api/IbcAPI.ts @@ -39,7 +39,7 @@ export namespace Port { export class IbcAPI extends BaseAPI { /** - * query all the IBC channels of a chain + * Query all the IBC channels of a chain. */ public async channels( params: APIParams = {} @@ -53,7 +53,7 @@ export class IbcAPI extends BaseAPI { } /** - * query the information of the port at given channel + * Query the information of the port at given channel. * @param channel_id channel identifier * @param port_id port name */ @@ -78,7 +78,7 @@ export class IbcAPI extends BaseAPI { } /** - * query all the IBC connections of a chain + * Query all the IBC connections of a chain. */ public async connections( params: APIParams = {} @@ -95,7 +95,7 @@ export class IbcAPI extends BaseAPI { } /** - * query an IBC connection end + * Query an IBC connection end. * @param connection_id connection unique identifier */ public async connection( @@ -110,7 +110,7 @@ export class IbcAPI extends BaseAPI { } /** - * query all the channels associated with a connection end + * Query all the channels associated with a connection end. * @param connection_id connection unique identifier */ public async connectionChannels( @@ -131,7 +131,7 @@ export class IbcAPI extends BaseAPI { } /** - * Gets the current transfer application parameters. + * Query the parameters of the ibc module. */ public async parameters(params: APIParams = {}): Promise { return this.c @@ -142,7 +142,7 @@ export class IbcAPI extends BaseAPI { } /** - * query all the IBC light clients of a chain + * Query all the IBC light clients of a chain. */ public async clientStates( params: Partial = {} @@ -159,9 +159,8 @@ export class IbcAPI extends BaseAPI { } /** - * query an IBC light client + * Query an IBC light client. * @param client_id client state unique identifier - * @returns */ public async clientState( client_id: string, @@ -180,9 +179,8 @@ export class IbcAPI extends BaseAPI { } /** - * query the status of an IBC light client - * @param client_id client state unique identifier - * @returns + * Query the status of an IBC light client + * @param client_id client state unique ident.ifier */ public async clientStatus( client_id: string, @@ -196,9 +194,8 @@ export class IbcAPI extends BaseAPI { } /** - * query all the consensus state associated with a given client + * Query all the consensus state associated with a given client. * @param client_id client identifier - * @returns */ public async consensusStates( client_id: string, @@ -213,9 +210,8 @@ export class IbcAPI extends BaseAPI { } /** - * query the height of every consensus states associated with a given client + * Query the height of every consensus states associated with a given client. * @param client_id client identifier - * @returns */ public async consensusStateHeights( client_id: string, @@ -232,28 +228,40 @@ export class IbcAPI extends BaseAPI { ]) } + /** + * Query all the unreceived IBC packets associated with a channel and sequences. + * @param port_id port unique identifier + * @param channel_id channel unique identifier + * @param sequences list of packet sequences + */ public async unreceivedPackets( - portId: string, - channelId: string, + port_id: string, + channel_id: string, sequences: number[], params: APIParams = {} ): Promise<{ sequences: string[]; height: Height }> { return this.c.get<{ sequences: string[]; height: Height }>( - `/ibc/core/channel/v1/channels/${channelId}/ports/${portId}/packet_commitments/${sequences.join( + `/ibc/core/channel/v1/channels/${channel_id}/ports/${port_id}/packet_commitments/${sequences.join( ',' )}/unreceived_packets`, params ) } + /** + * Query all the unreceived IBC acknowledgements associated with a channel and sequences. + * @param port_id port unique identifier + * @param channel_id channel unique identifier + * @param sequences list of packet sequences + */ public async unreceivedAcks( - portId: string, - channelId: string, + port_id: string, + channel_id: string, sequences: number[], params: APIParams = {} ): Promise<{ sequences: string[]; height: Height }> { return this.c.get<{ sequences: string[]; height: Height }>( - `/ibc/core/channel/v1/channels/${channelId}/ports/${portId}/packet_commitments/${sequences.join( + `/ibc/core/channel/v1/channels/${channel_id}/ports/${port_id}/packet_commitments/${sequences.join( ',' )}/unreceived_acks`, params diff --git a/src/client/rest/api/IbcHooksAPI.ts b/src/client/rest/api/IbcHooksAPI.ts index c41fd52..432d14f 100644 --- a/src/client/rest/api/IbcHooksAPI.ts +++ b/src/client/rest/api/IbcHooksAPI.ts @@ -3,6 +3,9 @@ import { APIParams, Pagination, PaginationOptions } from '../APIRequester' import { AccAddress, ACL, IbcHooksParams } from '../../../core' export class IbcHooksAPI extends BaseAPI { + /** + * Query all the ACL entries. + */ public async acls( params: Partial = {} ): Promise<[ACL[], Pagination]> { @@ -14,12 +17,19 @@ export class IbcHooksAPI extends BaseAPI { .then((d) => [d.acls.map(ACL.fromData), d.pagination]) } + /** + * Query the ACL entry of an address. + * @param address a contract address (wasm, evm) or a contract deployer address (move) + */ public async acl(address: AccAddress, params: APIParams = {}): Promise { return this.c .get<{ acl: ACL.Data }>(`/initia/ibchooks/v1/acls/${address}`, params) .then((d) => ACL.fromData(d.acl)) } + /** + * Query the parameters of the ibc hooks module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ diff --git a/src/client/rest/api/IbcNftAPI.ts b/src/client/rest/api/IbcNftAPI.ts index 8355786..06332b6 100644 --- a/src/client/rest/api/IbcNftAPI.ts +++ b/src/client/rest/api/IbcNftAPI.ts @@ -3,7 +3,10 @@ import { APIParams, Pagination, PaginationOptions } from '../APIRequester' import { NftClassTrace, IbcNftParams } from '../../../core' export class IbcNftAPI extends BaseAPI { - /** Gets a classTrace for the hash */ + /** + * Query a denomination trace information. + * @param hash hash (in hex format) of the class id trace information + */ public async classTrace(hash: string): Promise { return this.c .get<{ @@ -12,7 +15,9 @@ export class IbcNftAPI extends BaseAPI { .then((d) => NftClassTrace.fromData(d.class_trace)) } - /** Gets a list of classTraces */ + /** + * Query all the denomination traces. + */ public async classTraces( params: Partial = {} ): Promise<[NftClassTrace[], Pagination]> { @@ -24,7 +29,10 @@ export class IbcNftAPI extends BaseAPI { .then((d) => [d.class_traces.map(NftClassTrace.fromData), d.pagination]) } - /** Gets a class id hash information */ + /** + * Query a class id hash information. + * @param trace the class id trace ([port_id]/[channel_id])+/[class_id] + */ public async classHash(trace: string): Promise { return await this.c .get<{ hash: string }>(`/ibc/apps/nft_transfer/v1/class_hashes/${trace}`) @@ -32,17 +40,10 @@ export class IbcNftAPI extends BaseAPI { } /** - * Gets the current nft transfer application parameters. + * Query the escrow address for a particular port and channel id. + * @param channel_id unique channel identifier + * @param port_id unique port identifier */ - public async parameters(params: APIParams = {}): Promise { - return this.c - .get<{ - params: IbcNftParams.Data - }>(`/ibc/apps/nft_transfer/v1/params`, params) - .then((d) => IbcNftParams.fromData(d.params)) - } - - /** Gets the escrow address for a particular port and channel id */ public async escrowAddress( channel_id: string, port_id: string, @@ -57,4 +58,15 @@ export class IbcNftAPI extends BaseAPI { ) .then((d) => d.escrow_address) } + + /** + * Query the parameters of the ibc nft transfer module. + */ + public async parameters(params: APIParams = {}): Promise { + return this.c + .get<{ + params: IbcNftParams.Data + }>(`/ibc/apps/nft_transfer/v1/params`, params) + .then((d) => IbcNftParams.fromData(d.params)) + } } diff --git a/src/client/rest/api/IbcPermAPI.ts b/src/client/rest/api/IbcPermAPI.ts index 9edc324..7c36639 100644 --- a/src/client/rest/api/IbcPermAPI.ts +++ b/src/client/rest/api/IbcPermAPI.ts @@ -9,6 +9,9 @@ export interface ChannelState { } export class IbcPermAPI extends BaseAPI { + /** + * Query all the channel states. + */ public async channelStates( params: Partial = {} ): Promise<[ChannelState[], Pagination]> { @@ -20,14 +23,19 @@ export class IbcPermAPI extends BaseAPI { .then((d) => [d.channel_states, d.pagination]) } + /** + * Query the channel state for the specific port-id:channel-id pair. + * @param channel_id unique channel identifier + * @param port_id unique port identifier + */ public async channelState( - channelId: string, - portId: string + channel_id: string, + port_id: string ): Promise { return this.c .get<{ channel_state: ChannelState - }>(`/ibc/apps/perm/v1/channel_states/${channelId}/${portId}`) + }>(`/ibc/apps/perm/v1/channel_states/${channel_id}/${port_id}`) .then((d) => d.channel_state) } } diff --git a/src/client/rest/api/IbcTransferAPI.ts b/src/client/rest/api/IbcTransferAPI.ts index 5737c18..168287b 100644 --- a/src/client/rest/api/IbcTransferAPI.ts +++ b/src/client/rest/api/IbcTransferAPI.ts @@ -3,7 +3,10 @@ import { APIParams, Pagination, PaginationOptions } from '../APIRequester' import { DenomTrace, IbcTransferParams } from '../../../core' export class IbcTransferAPI extends BaseAPI { - /** Gets a denomTrace for the hash or denom */ + /** + * Query a denomination trace information. + * @param hash hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information + */ public async denomTrace(hash: string): Promise { return this.c .get<{ @@ -12,7 +15,9 @@ export class IbcTransferAPI extends BaseAPI { .then((d) => DenomTrace.fromData(d.denom_trace)) } - /** Gets a list of denomTraces */ + /** + * Query all denomination traces. + */ public async denomTraces( params: Partial = {} ): Promise<[DenomTrace[], Pagination]> { @@ -24,7 +29,10 @@ export class IbcTransferAPI extends BaseAPI { .then((d) => [d.denom_traces.map(DenomTrace.fromData), d.pagination]) } - /** Gets a denomination hash information */ + /** + * Query a denomination hash information. + * @param trace the denomination trace ([port_id]/[channel_id])+/[denom] + */ public async denomHash(trace: string): Promise { return await this.c .get<{ hash: string }>(`/ibc/apps/transfer/v1/denom_hashes/${trace}`) @@ -32,7 +40,7 @@ export class IbcTransferAPI extends BaseAPI { } /** - * Gets the current transfer application parameters. + * Query the parameters of the ibc transfer module. */ public async parameters(params: APIParams = {}): Promise { return this.c @@ -42,7 +50,11 @@ export class IbcTransferAPI extends BaseAPI { .then((d) => IbcTransferParams.fromData(d.params)) } - /** Gets the escrow address for a particular port and channel id */ + /** + * Query the escrow address for a particular port and channel id. + * @param channel_id unique channel identifier + * @param port_id unique port identifier + */ public async escrowAddress( channel_id: string, port_id: string, diff --git a/src/client/rest/api/InterTxAPI.ts b/src/client/rest/api/InterTxAPI.ts index 0c1ec88..bfd1626 100644 --- a/src/client/rest/api/InterTxAPI.ts +++ b/src/client/rest/api/InterTxAPI.ts @@ -2,6 +2,11 @@ import { AccAddress } from '../../../core' import { BaseAPI } from './BaseAPI' export class InterTxAPI extends BaseAPI { + /** + * Query the interchain account for given owner address on a given connection pair. + * @param owner owner address + * @param connection_id unique connection identifier + */ public async interchainAccount( owner: AccAddress, connection_id: string diff --git a/src/client/rest/api/MarketmapAPI.ts b/src/client/rest/api/MarketmapAPI.ts index 6c30faf..fc7279d 100644 --- a/src/client/rest/api/MarketmapAPI.ts +++ b/src/client/rest/api/MarketmapAPI.ts @@ -13,6 +13,9 @@ export namespace MarketMap { } export class MarketmapAPI extends BaseAPI { + /** + * Query the full market map stored in the marketmap module. + */ public async marketMap(params: APIParams = {}): Promise { return this.c .get<{ @@ -27,6 +30,10 @@ export class MarketmapAPI extends BaseAPI { }) } + /** + * Query the market stored in the marketmap module. + * @param pair the currency pair associated with the market being requested + */ public async market( pair: CurrencyPair, params: APIParams = {} @@ -40,6 +47,9 @@ export class MarketmapAPI extends BaseAPI { .then((d) => Market.fromData(d.market)) } + /** + * Query the last height the market map was updated at. + */ public async lastUpdated(params: APIParams = {}): Promise { return this.c .get<{ @@ -48,6 +58,9 @@ export class MarketmapAPI extends BaseAPI { .then((d) => parseInt(d.last_updated)) } + /** + * Query the parameters of the marketmap module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ diff --git a/src/client/rest/api/MoveAPI.ts b/src/client/rest/api/MoveAPI.ts index 71d7cd7..47ea01d 100644 --- a/src/client/rest/api/MoveAPI.ts +++ b/src/client/rest/api/MoveAPI.ts @@ -45,6 +45,10 @@ export interface VMEvent { } export class MoveAPI extends BaseAPI { + /** + * Query the module infos. + * @param address the owner address of the modules to query + */ public async modules( address: AccAddress, params: Partial = {} @@ -57,52 +61,170 @@ export class MoveAPI extends BaseAPI { .then((d) => [d.modules.map(Module.fromData), d.pagination]) } + /** + * Query the module info. + * @param address the owner address of the module to query + * @param module_name the module name to query + */ public async module( address: AccAddress, - moduleName: string, + module_name: string, params: APIParams = {} ): Promise { return this.c .get<{ module: Module.Data - }>(`/initia/move/v1/accounts/${address}/modules/${moduleName}`, params) + }>(`/initia/move/v1/accounts/${address}/modules/${module_name}`, params) .then((d) => Module.fromData(d.module)) } + /** + * Query the resource infos. + * @param address the owner address of the resources to query + */ + public async resources( + address: AccAddress, + params: Partial = {} + ): Promise<[{ type: string; data: any }[], Pagination]> { + return this.c + .get<{ + resources: Resource[] + pagination: Pagination + }>(`/initia/move/v1/accounts/${address}/resources`, params) + .then((d) => [ + d.resources.map((res) => JSON.parse(res.move_resource)), + d.pagination, + ]) + } + + /** + * Query the resource info. + * @param address the owner address of the resource to query + * @param struct_tag the unique identifier of the resource to query + */ + public async resource( + address: AccAddress, + struct_tag: string, + params: APIParams = {} + ): Promise<{ type: string; data: T }> { + return this.c + .get<{ + resource: Resource + }>(`/initia/move/v1/accounts/${address}/resources/by_struct_tag`, { + ...params, + struct_tag, + }) + .then((d) => JSON.parse(d.resource.move_resource)) + } + + /** + * Query the table info of the given address. + * @param address the table handle + */ + public async tableInfo( + address: AccAddress, + params: APIParams = {} + ): Promise { + return this.c + .get<{ + table_info: TableInfo + }>(`/initia/move/v1/tables/${address}`, params) + .then((d) => d.table_info) + } + + /** + * Query the table entries of the given address. + * @param address the table handle + */ + public async tableEntries( + address: AccAddress, + params: Partial = {} + ): Promise<[TableEntry[], Pagination]> { + return this.c + .get<{ + table_entries: TableEntry[] + pagination: Pagination + }>(`/initia/move/v1/tables/${address}/entries`, params) + .then((d) => [d.table_entries, d.pagination]) + } + + /** + * Query the table entry of the given key. + * @param address the table handle + * @param key_bytes the key of the table entry + */ + public async tableEntry( + address: AccAddress, + key_bytes: string, + params: APIParams = {} + ): Promise { + return this.c + .get<{ + table_entry: TableEntry + }>(`/initia/move/v1/tables/${address}/entries/by_key_bytes`, { + ...params, + key_bytes, + }) + .then((d) => d.table_entry) + } + + /** + * Execute view function and return the view result. + * @param address the owner address of the module to query + * @param module_name the module name of the entry function to query + * @param function_name the name of a function to query + * @param type_args the type arguments of a function to execute + * @param args the arguments of a function to execute + * @deprecated Use `viewJSON` instead + */ public async viewFunction( address: AccAddress, - moduleName: string, - functionName: string, - typeArgs: string[] = [], + module_name: string, + function_name: string, + type_args: string[] = [], args: string[] = [] ): Promise { return this.c .post<{ data: string }>( - `/initia/move/v1/accounts/${address}/modules/${moduleName}/view_functions/${functionName}`, + `/initia/move/v1/accounts/${address}/modules/${module_name}/view_functions/${function_name}`, { - type_args: typeArgs, + type_args, args, } ) .then((res) => JSON.parse(res.data) as T) } + /** + * Execute view function and return the view result. + * @param address the owner address of the module to query + * @param module_name the module name of the entry function to query + * @param function_name the name of a function to query + * @param type_args the type arguments of a function to execute + * @param args the arguments of a function to execute + * @deprecated Use `viewJSON` instead + */ public async view( address: AccAddress, - moduleName: string, - functionName: string, - typeArgs: string[] = [], + module_name: string, + function_name: string, + type_args: string[] = [], args: string[] = [] ): Promise { return this.c.post(`/initia/move/v1/view`, { address, - module_name: moduleName, - function_name: functionName, - type_args: typeArgs, + module_name, + function_name, + type_args, args, }) } + /** + * Execute multiple view functions and return the view results. + * @param requests list of requests to execute view functions + * @deprecated Use `viewBatchJSON` instead + */ public async viewBatch(requests: ViewRequest[]): Promise { return this.c .post<{ responses: ViewResponse[] }>(`/initia/move/v1/view/batch`, { @@ -111,22 +233,34 @@ export class MoveAPI extends BaseAPI { .then((d) => d.responses) } + /** + * Execute view function with json arguments and return the view result. + * @param address the owner address of the module to query + * @param module_name the module name of the entry function to query + * @param function_name the name of a function to query + * @param type_args the type arguments of a function to execute + * @param args the arguments of a function to execute + */ public async viewJSON( address: AccAddress, - moduleName: string, - functionName: string, - typeArgs: string[] = [], + module_name: string, + function_name: string, + type_args: string[] = [], args: string[] = [] ): Promise { return this.c.post(`/initia/move/v1/view/json`, { address, - module_name: moduleName, - function_name: functionName, - type_args: typeArgs, + module_name, + function_name, + type_args, args, }) } + /** + * Execute multiple view functions with json arguments and return the view results + * @param requests list of requests to execute view functions + */ public async viewBatchJSON(requests: ViewRequest[]): Promise { return this.c .post<{ responses: ViewResponse[] }>(`/initia/move/v1/view/json/batch`, { @@ -135,42 +269,30 @@ export class MoveAPI extends BaseAPI { .then((d) => d.responses) } - public async resources( - address: AccAddress, - params: Partial = {} - ): Promise<[{ type: string; data: any }[], Pagination]> { - return this.c - .get<{ - resources: Resource[] - pagination: Pagination - }>(`/initia/move/v1/accounts/${address}/resources`, params) - .then((d) => [ - d.resources.map((res) => JSON.parse(res.move_resource)), - d.pagination, - ]) - } - - public async resource( - address: AccAddress, - structTag: string, - params: APIParams = {} - ): Promise<{ type: string; data: T }> { - return this.c - .get<{ - resource: Resource - }>(`/initia/move/v1/accounts/${address}/resources/by_struct_tag`, { - ...params, - struct_tag: structTag, - }) - .then((d) => JSON.parse(d.resource.move_resource)) + /** + * Decode script bytes into ABI. + * @param code_bytes the script code for query operation + */ + public async scriptABI(code_bytes: string): Promise { + return this.c.post(`/initia/move/v1/script/abi`, { + code_bytes, + }) } + /** + * Query denom which is converted from the given metadata. + * @param metadata metadata to convert + */ public async denom(metadata: string, params: APIParams = {}): Promise { return this.c .get<{ denom: Denom }>(`/initia/move/v1/denom`, { ...params, metadata }) .then((d) => d.denom) } + /** + * Query metadata which is converted from the given denom. + * @param denom denom to convert + */ public async metadata(denom: Denom, params: APIParams = {}): Promise { return this.c .get<{ metadata: string }>(`/initia/move/v1/metadata`, { @@ -180,53 +302,12 @@ export class MoveAPI extends BaseAPI { .then((d) => d.metadata) } + /** + * Query the parameters of the move module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: MoveParams.Data }>(`/initia/move/v1/params`, params) .then((d) => MoveParams.fromData(d.params)) } - - public async scriptABI(codeBytes: string): Promise { - return this.c.post(`/initia/move/v1/script/abi`, { - code_bytes: codeBytes, - }) - } - - public async tableInfo( - address: AccAddress, - params: APIParams = {} - ): Promise { - return this.c - .get<{ - table_info: TableInfo - }>(`/initia/move/v1/tables/${address}`, params) - .then((d) => d.table_info) - } - - public async tableEntries( - address: AccAddress, - params: Partial = {} - ): Promise<[TableEntry[], Pagination]> { - return this.c - .get<{ - table_entries: TableEntry[] - pagination: Pagination - }>(`/initia/move/v1/tables/${address}/entries`, params) - .then((d) => [d.table_entries, d.pagination]) - } - - public async tableEntry( - address: AccAddress, - keyBytes: string, - params: APIParams = {} - ): Promise { - return this.c - .get<{ - table_entry: TableEntry - }>(`/initia/move/v1/tables/${address}/entries/by_key_bytes`, { - ...params, - key_bytes: keyBytes, - }) - .then((d) => d.table_entry) - } } diff --git a/src/client/rest/api/MstakingAPI.ts b/src/client/rest/api/MstakingAPI.ts index 428848b..3ef1ed0 100644 --- a/src/client/rest/api/MstakingAPI.ts +++ b/src/client/rest/api/MstakingAPI.ts @@ -28,8 +28,7 @@ export namespace MstakingPool { export class MstakingAPI extends BaseAPI { /** - * Queries all delegations, filtering by delegator, validator, or both. - * + * Query all delegations, filtered by delegator, validator, or both. * At least one of the parameters must be defined. * @param delegator delegator's account address * @param validator validator's operator address @@ -79,7 +78,7 @@ export class MstakingAPI extends BaseAPI { } /** - * Gets the delegation between a delegator and validator, if it exists. + * Query the delegation between a delegator and validator, if it exists. * @param delegator delegator's account address * @param validator validator's operator address */ @@ -91,8 +90,7 @@ export class MstakingAPI extends BaseAPI { } /** - * Queries all unbonding delegations, filtering by delegator, validator, or both. - * + * Query all unbonding delegations, filtering by delegator, validator, or both. * At least one of the parameters must be defined. * @param delegator delegator's account address * @param validator validator's operator address @@ -148,7 +146,7 @@ export class MstakingAPI extends BaseAPI { } /** - * Gets the unbonding delegation between a delegator and validator, if it exists. + * Query the unbonding delegation between a delegator and validator, if it exists. * @param delegator delegator's account address * @param validator validator's operator address */ @@ -162,27 +160,26 @@ export class MstakingAPI extends BaseAPI { } /** - * Queries all redelegations, filterable by delegator, source validator, and target validator. + * Query all redelegations, filterable by delegator, source validator, and target validator. * @param delegator delegator's account address - * @param validatorSrc source validator's operator address (from). - * @param validatorDst destination validator's operator address (to). + * @param src_validator_addr source validator's operator address (from) + * @param dst_validator_addr destination validator's operator address (to) */ public async redelegations( delegator: AccAddress, - validatorSrc?: ValAddress, - validatorDst?: ValAddress, - _params: Partial = {} + src_validator_addr?: ValAddress, + dst_validator_addr?: ValAddress, + params: Partial = {} ): Promise<[Redelegation[], Pagination]> { - const params = { - ..._params, - src_validator_addr: validatorSrc, - dst_validator_addr: validatorDst, - } return this.c .get<{ redelegation_responses: Redelegation.Data[] pagination: Pagination - }>(`/initia/mstaking/v1/delegators/${delegator}/redelegations`, params) + }>(`/initia/mstaking/v1/delegators/${delegator}/redelegations`, { + ...params, + src_validator_addr, + dst_validator_addr, + }) .then((d) => [ d.redelegation_responses.map(Redelegation.fromData), d.pagination, @@ -190,7 +187,7 @@ export class MstakingAPI extends BaseAPI { } /** - * Gets all bonded validators for a delegator given its address. + * Query all bonded validators for a delegator given its address. * @param delegator delegator's account address */ public async bondedValidators( @@ -206,7 +203,7 @@ export class MstakingAPI extends BaseAPI { } /** - * Get all current registered validators, including validators that are not currently in the validating set. + * Query all current registered validators, including validators that are not currently in the validating set. */ public async validators( params: Partial = {} @@ -220,7 +217,7 @@ export class MstakingAPI extends BaseAPI { } /** - * Gets the validator information for a specific validator. + * Query the validator information for a specific validator. * @param validator validator's operator address */ public async validator( @@ -235,7 +232,7 @@ export class MstakingAPI extends BaseAPI { } /** - * Gets the current mstaking pool. + * Query the current mstaking pool. */ public async pool(params: APIParams = {}): Promise { return this.c @@ -247,7 +244,7 @@ export class MstakingAPI extends BaseAPI { } /** - * Gets the current Mstaking module's parameters. + * Query the parameters of the mstaking module. */ public async parameters(params: APIParams = {}): Promise { return this.c diff --git a/src/client/rest/api/OpchildAPI.ts b/src/client/rest/api/OpchildAPI.ts index 461b072..a86ba97 100644 --- a/src/client/rest/api/OpchildAPI.ts +++ b/src/client/rest/api/OpchildAPI.ts @@ -8,6 +8,9 @@ import { } from '../../../core' export class OpchildAPI extends BaseAPI { + /** + * Query all validators. + */ public async validators( params: Partial = {} ): Promise<[OpValidator[], Pagination]> { @@ -19,17 +22,24 @@ export class OpchildAPI extends BaseAPI { .then((d) => [d.validators.map(OpValidator.fromData), d.pagination]) } + /** + * Query the validator info for given validator address. + * @param validator_addr the validator address to query for + */ public async validator( - validatorAddr: ValAddress, + validator_addr: ValAddress, params: APIParams = {} ): Promise { return this.c .get<{ validator: OpValidator.Data - }>(`/opinit/opchild/v1/validator/${validatorAddr}`, params) + }>(`/opinit/opchild/v1/validator/${validator_addr}`, params) .then((d) => OpValidator.fromData(d.validator)) } + /** + * Query the bridge information. + */ public async bridgeInfo(params: APIParams = {}): Promise { return this.c .get<{ @@ -38,6 +48,9 @@ export class OpchildAPI extends BaseAPI { .then((d) => BridgeInfo.fromData(d.bridge_info)) } + /** + * Query the next l1 sequence number. + */ public async nextL1Sequence(params: APIParams = {}): Promise { return this.c .get<{ @@ -46,6 +59,9 @@ export class OpchildAPI extends BaseAPI { .then((d) => parseInt(d.next_l1_sequence)) } + /** + * Query the next l2 sequence number. + */ public async nextL2Sequence(params: APIParams = {}): Promise { return this.c .get<{ @@ -54,6 +70,10 @@ export class OpchildAPI extends BaseAPI { .then((d) => parseInt(d.next_l2_sequence)) } + /** + * Query the base denom of the given denom. + * @param denom denom to query + */ public async baseDenom( denom: string, params: APIParams = {} @@ -65,6 +85,9 @@ export class OpchildAPI extends BaseAPI { .then((d) => d.base_denom) } + /** + * Query the parameters of the opchild module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: OpchildParams.Data }>(`/opinit/opchild/v1/params`, params) diff --git a/src/client/rest/api/OphostAPI.ts b/src/client/rest/api/OphostAPI.ts index 5369711..2d58f56 100644 --- a/src/client/rest/api/OphostAPI.ts +++ b/src/client/rest/api/OphostAPI.ts @@ -27,6 +27,9 @@ export namespace OutputInfo { } export class OphostAPI extends BaseAPI { + /** + * Query all bridge infos. + */ public async bridgeInfos( params: Partial = {} ): Promise<[BridgeInfo[], Pagination]> { @@ -38,64 +41,86 @@ export class OphostAPI extends BaseAPI { .then((d) => [d.bridges.map(BridgeInfo.fromData), d.pagination]) } + /** + * Query bridge info of the given bridge id. + * @param bridge_id unique bridge identifier + */ public async bridgeInfo( - bridgeId: number, + bridge_id: number, params: APIParams = {} ): Promise { return this.c - .get(`/opinit/ophost/v1/bridges/${bridgeId}`, params) + .get(`/opinit/ophost/v1/bridges/${bridge_id}`, params) .then((d) => BridgeInfo.fromData(d)) } + /** + * Query all (l1 denom, l2 denom) pairs of given bridge id. + * @param bridge_id unique bridge identifier + */ public async tokenPairs( - bridgeId: number, + bridge_id: number, params: Partial = {} ): Promise<[TokenPair[], Pagination]> { return this.c .get<{ token_pairs: TokenPair[] pagination: Pagination - }>(`/opinit/ophost/v1/bridges/${bridgeId}/token_pairs`, params) + }>(`/opinit/ophost/v1/bridges/${bridge_id}/token_pairs`, params) .then((d) => [d.token_pairs, d.pagination]) } + /** + * Query token pair of given bridge id and l1 denom. + * @param bridge_id unique bridge identifier + * @param l1_denom l1 denom + */ public async tokenPairByL1Denom( - bridgeId: number, - l1Denom: string, + bridge_id: number, + l1_denom: string, params: APIParams = {} ): Promise { return this.c .get<{ token_pair: TokenPair - }>(`/opinit/ophost/v1/bridges/${bridgeId}/token_pairs/by_l1_denom`, { + }>(`/opinit/ophost/v1/bridges/${bridge_id}/token_pairs/by_l1_denom`, { ...params, - l1_denom: l1Denom, + l1_denom, }) .then((d) => d.token_pair) } + /** + * Query token pair of given bridge id and l2 denom. + * @param bridge_id unique bridge identifier + * @param l2_denom l2 denom + */ public async tokenPairByL2Denom( - bridgeId: number, - l2Denom: string, + bridge_id: number, + l2_denom: string, params: APIParams = {} ): Promise { return this.c .get<{ token_pair: TokenPair - }>(`/opinit/ophost/v1/bridges/${bridgeId}/token_pairs/by_l2_denom`, { + }>(`/opinit/ophost/v1/bridges/${bridge_id}/token_pairs/by_l2_denom`, { ...params, - l2_denom: l2Denom, + l2_denom, }) .then((d) => d.token_pair) } + /** + * Query the last finalized output. + * @param bridge_id unique bridge identifier + */ public async lastFinalizedOutput( - bridgeId: number, + bridge_id: number, params: Partial = {} ): Promise { return this.c .get( - `/opinit/ophost/v1/bridges/${bridgeId}/last_finalized_output`, + `/opinit/ophost/v1/bridges/${bridge_id}/last_finalized_output`, params ) .then((d) => ({ @@ -104,18 +129,22 @@ export class OphostAPI extends BaseAPI { })) } + /** + * Query all the output proposals. + * @param bridge_id unique bridge identifier + */ public async outputInfos( - bridgeId: number, + bridge_id: number, params: Partial = {} ): Promise<[OutputInfo[], Pagination]> { return this.c .get<{ output_proposals: OutputInfo.Data[] pagination: Pagination - }>(`/opinit/ophost/v1/bridges/${bridgeId}/outputs`, params) + }>(`/opinit/ophost/v1/bridges/${bridge_id}/outputs`, params) .then((d) => [ d.output_proposals.map((info) => ({ - bridge_id: parseInt(info.bridge_id ?? `${bridgeId}`), + bridge_id: parseInt(info.bridge_id ?? `${bridge_id}`), output_index: parseInt(info.output_index), output_proposal: Output.fromData(info.output_proposal), })), @@ -123,64 +152,85 @@ export class OphostAPI extends BaseAPI { ]) } + /** + * Query the output proposal by output index. + * @param bridge_id unique bridge identifier + * @param output_index output index + */ public async outputInfo( - bridgeId: number, - outputIndex: number, + bridge_id: number, + output_index: number, params: APIParams = {} ): Promise { return this.c .get( - `/opinit/ophost/v1/bridges/${bridgeId}/outputs/${outputIndex}`, + `/opinit/ophost/v1/bridges/${bridge_id}/outputs/${output_index}`, params ) .then((d) => ({ - bridge_id: parseInt(d.bridge_id ?? `${bridgeId}`), + bridge_id: parseInt(d.bridge_id ?? `${bridge_id}`), output_index: parseInt(d.output_index), output_proposal: Output.fromData(d.output_proposal), })) } + /** + * Query whether the output is claimed. + * @param bridge_id unique bridge identifier + * @param withdrawal_hash withdrawal hash + */ public async withdrawalClaimed( - bridgeId: number, - withdrawalHash: string, + bridge_id: number, + withdrawal_hash: string, params: APIParams = {} ): Promise { return this.c .get<{ claimed: boolean - }>(`/opinit/ophost/v1/bridges/${bridgeId}/withdrawals/claimed/by_hash`, { + }>(`/opinit/ophost/v1/bridges/${bridge_id}/withdrawals/claimed/by_hash`, { ...params, - withdrawal_hash: Buffer.from(withdrawalHash, 'hex').toString('base64'), + withdrawal_hash: Buffer.from(withdrawal_hash, 'hex').toString('base64'), }) .then((d) => d.claimed) } + /** + * Query the next l1 sequence number. + * @param bridge_id unique bridge identifier + */ public async nextL1Sequence( - bridgeId: number, + bridge_id: number, params: APIParams = {} ): Promise { return this.c .get<{ next_l1_sequence: string - }>(`/opinit/ophost/v1/bridges/${bridgeId}/next_l1_sequence`, params) + }>(`/opinit/ophost/v1/bridges/${bridge_id}/next_l1_sequence`, params) .then((d) => parseInt(d.next_l1_sequence)) } + /** + * Query all the batch infos. + * @param bridge_id unique bridge identifier + */ public async batchInfos( - bridgeId: number, + bridge_id: number, params: Partial = {} ): Promise<[BatchInfoWithOutput[], Pagination]> { return this.c .get<{ batch_infos: BatchInfoWithOutput.Data[] pagination: Pagination - }>(`/opinit/ophost/v1/bridges/${bridgeId}/batch_infos`, params) + }>(`/opinit/ophost/v1/bridges/${bridge_id}/batch_infos`, params) .then((d) => [ d.batch_infos.map((info) => BatchInfoWithOutput.fromData(info)), d.pagination, ]) } + /** + * Query the parameters of the ophost module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: OphostParams.Data }>(`/opinit/ophost/v1/params`, params) diff --git a/src/client/rest/api/OracleAPI.ts b/src/client/rest/api/OracleAPI.ts index 894e03b..3d3212c 100644 --- a/src/client/rest/api/OracleAPI.ts +++ b/src/client/rest/api/OracleAPI.ts @@ -3,6 +3,9 @@ import { APIParams } from '../APIRequester' import { CurrencyPair, QuotePrice } from '../../../core' export class OracleAPI extends BaseAPI { + /** + * Query all the currency pairs the oracle module is tracking price-data for. + */ public async currencyPairs(params: APIParams = {}): Promise { return this.c .get<{ @@ -11,6 +14,10 @@ export class OracleAPI extends BaseAPI { .then((d) => d.currency_pairs.map(CurrencyPair.fromData)) } + /** + * Query the latest quote price for the given currency pair. + * @param pair the pair that the user wishes to query + */ public async price( pair: CurrencyPair, params: APIParams = {} diff --git a/src/client/rest/api/RewardAPI.ts b/src/client/rest/api/RewardAPI.ts index 7e27728..de5d822 100644 --- a/src/client/rest/api/RewardAPI.ts +++ b/src/client/rest/api/RewardAPI.ts @@ -4,7 +4,7 @@ import { BaseAPI } from './BaseAPI' export class RewardAPI extends BaseAPI { /** - * Gets the last release rate dilution timestamp + * Query the last release rate dilution timestamp. */ public async last_dilution_timestamp( params: APIParams = {} @@ -17,7 +17,7 @@ export class RewardAPI extends BaseAPI { } /** - * Gets the current annual provisions value + * Query the current annual provisions value. */ public async annualProvisions(params: APIParams = {}): Promise { return this.c @@ -28,7 +28,7 @@ export class RewardAPI extends BaseAPI { } /** - * Gets the current reward module's parameters. + * Query the parameters of the reward module. */ public async parameters(params: APIParams = {}): Promise { return this.c diff --git a/src/client/rest/api/SlashingAPI.ts b/src/client/rest/api/SlashingAPI.ts index 799c846..c4d8630 100644 --- a/src/client/rest/api/SlashingAPI.ts +++ b/src/client/rest/api/SlashingAPI.ts @@ -7,17 +7,9 @@ import { import { APIParams, Pagination } from '../APIRequester' export class SlashingAPI extends BaseAPI { - public async signingInfo( - valConsAddress: ValConsAddress, - params: APIParams = {} - ): Promise { - return this.c - .get<{ - val_signing_info: ValidatorSigningInfo.Data - }>(`/cosmos/slashing/v1beta1/signing_infos/${valConsAddress}`, params) - .then((d) => ValidatorSigningInfo.fromData(d.val_signing_info)) - } - + /** + * Query the signing infos of all validators. + */ public async signingInfos( params: APIParams = {} ): Promise<[ValidatorSigningInfo[], Pagination]> { @@ -30,7 +22,22 @@ export class SlashingAPI extends BaseAPI { } /** - * Gets the current Slashing module's parameters. + * Query the signing info of given cons address. + * @param val_cons_address the address to query signing info of + */ + public async signingInfo( + val_cons_address: ValConsAddress, + params: APIParams = {} + ): Promise { + return this.c + .get<{ + val_signing_info: ValidatorSigningInfo.Data + }>(`/cosmos/slashing/v1beta1/signing_infos/${val_cons_address}`, params) + .then((d) => ValidatorSigningInfo.fromData(d.val_signing_info)) + } + + /** + * Query the parameters of the slashing module. */ public async parameters(params: APIParams = {}): Promise { return this.c diff --git a/src/client/rest/api/TendermintAPI.ts b/src/client/rest/api/TendermintAPI.ts index 4487c40..b6b996f 100644 --- a/src/client/rest/api/TendermintAPI.ts +++ b/src/client/rest/api/TendermintAPI.ts @@ -11,14 +11,14 @@ export interface DelegateValidator { export class TendermintAPI extends BaseAPI { /** - * Gets the node's information. + * Query the node's information. */ public async nodeInfo(params: APIParams = {}): Promise { return this.c.getRaw(`/cosmos/base/tendermint/v1beta1/node_info`, params) } /** - * Gets the node's chain id. + * Query the node's chain id. */ public async chainId(params: APIParams = {}): Promise { return this.c @@ -29,7 +29,7 @@ export class TendermintAPI extends BaseAPI { } /** - * Gets whether the node is currently in syncing mode to catch up with blocks. + * Query whether the node is currently in syncing mode to catch up with blocks. */ public async syncing(params: APIParams = {}): Promise { return this.c @@ -40,7 +40,7 @@ export class TendermintAPI extends BaseAPI { } /** - * Gets the validator (delegates) set at the specific height. If no height is given, the current set is returned. + * Query the validator (delegates) set at the specific height. If no height is given, the current set is returned. * @param height block height */ public async validatorSet( @@ -61,8 +61,8 @@ export class TendermintAPI extends BaseAPI { } /** - * Gets the block information at the specified height. If no height is given, the latest block is returned. - * @param height block height. + * Query the block information at the specified height. If no height is given, the latest block is returned. + * @param height block height */ public async blockInfo( height?: number, diff --git a/src/client/rest/api/TokenfactoryAPI.ts b/src/client/rest/api/TokenfactoryAPI.ts index beefa98..db1cf65 100644 --- a/src/client/rest/api/TokenfactoryAPI.ts +++ b/src/client/rest/api/TokenfactoryAPI.ts @@ -7,6 +7,10 @@ export interface AuthorityMetadata { } export class TokenfactoryAPI extends BaseAPI { + /** + * Query the authority metadata for a specific denom. + * @param denom denom to query + */ public async authorityMetadata( denom: string, params: APIParams = {} @@ -18,6 +22,10 @@ export class TokenfactoryAPI extends BaseAPI { .then((d) => d.authority_metadata) } + /** + * Query the address registered for the before send hook. + * @param denom denom to query + */ public async beforeSendHookAddr( denom: string, params: APIParams = {} @@ -29,6 +37,10 @@ export class TokenfactoryAPI extends BaseAPI { .then((d) => d.cosmwasm_address) } + /** + * Query all the denominations created by a specific admin/creator. + * @param creator creator address + */ public async denomsFromCreator( creator: string, params: APIParams = {} @@ -40,6 +52,9 @@ export class TokenfactoryAPI extends BaseAPI { .then((d) => d.denoms) } + /** + * Query the parameters of the tokenfactory module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ diff --git a/src/client/rest/api/TxAPI.ts b/src/client/rest/api/TxAPI.ts index 8f54149..4b25a15 100644 --- a/src/client/rest/api/TxAPI.ts +++ b/src/client/rest/api/TxAPI.ts @@ -205,12 +205,15 @@ export class TxAPI extends BaseAPI { } /** - * Looks up a transaction on the blockchain, addressed by its hash - * @param txHash transaction's hash + * Query a transaction on the blockchain, addressed by its hash. + * @param tx_hash transaction's hash */ - public async txInfo(txHash: string, params: APIParams = {}): Promise { + public async txInfo( + tx_hash: string, + params: APIParams = {} + ): Promise { return this.c - .getRaw(`/cosmos/tx/v1beta1/txs/${txHash}`, params) + .getRaw(`/cosmos/tx/v1beta1/txs/${tx_hash}`, params) .then((v) => TxInfo.fromData(v.tx_response)) } @@ -220,7 +223,6 @@ export class TxAPI extends BaseAPI { * the resultant [[StdSignMsg]]. If no fee is provided, fee will be automatically * estimated using the parameters, simulated using a "dummy fee" with sourceAddress's * nonzero denominations in its balance. - * * @param sourceAddress account address of signer * @param options TX generation options */ @@ -265,8 +267,8 @@ export class TxAPI extends BaseAPI { } /** - * Looks up transactions on the blockchain for the block height. If height is undefined, - * gets the transactions for the latest block. + * Query transactions on the blockchain for the block height. + * If height is undefined, gets the transactions for the latest block. * @param height block height */ public async txInfosByHeight(height: number | undefined): Promise { @@ -287,9 +289,8 @@ export class TxAPI extends BaseAPI { } /** - * Estimates the transaction's fee by simulating it within the node - * @param sourceAddress address that will pay the bill - * @param msgs standard messages + * Estimate the transaction's fee by simulating it within the node. + * @param signers signer data * @param options options for fee estimation */ public async estimateFee( @@ -369,7 +370,7 @@ export class TxAPI extends BaseAPI { } /** - * Encode a transaction to base64-encoded protobuf + * Encode a transaction to base64-encoded protobuf. * @param tx transaction to encode */ public static encode(tx: Tx): string { @@ -377,15 +378,15 @@ export class TxAPI extends BaseAPI { } /** - * Decode a transaction from base64-encoded protobuf + * Decode a transaction from base64-encoded protobuf. * @param tx transaction string to decode */ - public static decode(encodedTx: string): Tx { - return Tx.fromBuffer(Buffer.from(encodedTx, 'base64')) + public static decode(encoded_tx: string): Tx { + return Tx.fromBuffer(Buffer.from(encoded_tx, 'base64')) } /** - * Get the transaction's hash + * Query the transaction's hash. * @param tx transaction to hash */ public static hash(tx: Tx): string { @@ -406,10 +407,8 @@ export class TxAPI extends BaseAPI { /** * Broadcast the transaction using "sync" mode, then wait for its inclusion in a block. - * * This method polls txInfo using the txHash to confirm the transaction's execution. - * - * @param tx transaction to broadcast + * @param tx transaction to broadcast * @param timeout time in milliseconds to wait for transaction to be included in a block. defaults to 30000 */ public async broadcast( @@ -441,7 +440,7 @@ export class TxAPI extends BaseAPI { try { txInfo = await this.txInfo(txResponse.txhash) } catch (error) { - // Errors when transaction is not found. + // Errors when transaction is not found } if (txInfo) { @@ -471,8 +470,8 @@ export class TxAPI extends BaseAPI { } /** - * NOTE: This is not a synchronous function and is unconventionally named. This function - * can be await as it returns a `Promise`. + * NOTE: This is not a synchronous function and is unconventionally named. + * This function can be awaited as it returns a `Promise`. * * Broadcast the transaction using the "sync" mode, returning after CheckTx() is performed. * @param tx transaction to broadcast @@ -518,7 +517,7 @@ export class TxAPI extends BaseAPI { /** * Search for transactions based on event attributes. - * @param options + * @param options tx search options */ public async search( options: Partial @@ -554,25 +553,32 @@ export class TxAPI extends BaseAPI { }) } + /** + * Search for events based on module address, module name and start/end heights + * @param module_addr module address + * @param module_name module name + * @param start_height minimum height to search events + * @param end_height maximum height to search events + */ public async searchEvents( - moduleAddr: string, - moduleName: string, - startHeight: number, - endHeight: number + module_addr: string, + module_name: string, + start_height: number, + end_height: number ): Promise { - if (endHeight < startHeight) { + if (end_height < start_height) { throw new Error(`Start height cannot be greater than end height`) } - if (endHeight - startHeight > 100) { + if (end_height - start_height > 100) { throw new Error(`Query height range cannot be greater than 100`) } const targetEvents: Event[] = [] - const targetTag = `${moduleAddr}::${moduleName}` + const targetTag = `${module_addr}::${module_name}` const query: TxSearchQuery[] = [ - { key: 'tx.height', value: startHeight.toString(), op: '>=' }, - { key: 'tx.height', value: endHeight.toString(), op: '<=' }, + { key: 'tx.height', value: start_height.toString(), op: '>=' }, + { key: 'tx.height', value: end_height.toString(), op: '<=' }, { key: 'move.type_tag', value: targetTag, op: 'CONTAINS' }, ] const filterEvents = (tx: TxInfo) => { diff --git a/src/client/rest/api/UpgradeAPI.ts b/src/client/rest/api/UpgradeAPI.ts index 5ad9209..e13b441 100644 --- a/src/client/rest/api/UpgradeAPI.ts +++ b/src/client/rest/api/UpgradeAPI.ts @@ -16,8 +16,9 @@ export namespace ModuleVersion { export class UpgradeAPI extends BaseAPI { /** - * queries a previously applied upgrade plan by its name. - * it returns the height of the plan. if there's no plan with given name, it returns 0. + * Query a previously applied upgrade plan by its name. + * It returns the height of the plan. If there's no plan with given name, it returns 0. + * @param name the name of the applied plan to query for */ public async appliedPlan( name: string, @@ -31,7 +32,7 @@ export class UpgradeAPI extends BaseAPI { } /** - * Look up the current plan + * Query the current plan. */ public async currentPlan(params: APIParams = {}): Promise { return this.c @@ -40,7 +41,7 @@ export class UpgradeAPI extends BaseAPI { } /** - * Look up the versions of the modules + * Query the versions of the modules. */ public async moduleVersions( params: APIParams = {} diff --git a/src/client/rest/api/WasmAPI.ts b/src/client/rest/api/WasmAPI.ts index bad1f24..8eb7860 100644 --- a/src/client/rest/api/WasmAPI.ts +++ b/src/client/rest/api/WasmAPI.ts @@ -77,6 +77,10 @@ export namespace CodeInfo { } export class WasmAPI extends BaseAPI { + /** + * Query the contract metadata. + * @param address the address of the contract to query + */ public async contractInfo( address: AccAddress, params: APIParams = {} @@ -97,6 +101,10 @@ export class WasmAPI extends BaseAPI { })) } + /** + * Query the contract code history. + * @param address the address of the contract to query + */ public async contractHistory( address: AccAddress, params: Partial = {} @@ -117,18 +125,26 @@ export class WasmAPI extends BaseAPI { ]) } + /** + * Query the list of all smart contracts for a code id. + * @param code_id unique code identifier + */ public async contractsByCode( - codeId: number, + code_id: number, params: Partial = {} ): Promise<[string[], Pagination]> { return this.c .get<{ contracts: string[] pagination: Pagination - }>(`/cosmwasm/wasm/v1/code/${codeId}/contracts`, params) + }>(`/cosmwasm/wasm/v1/code/${code_id}/contracts`, params) .then((d) => [d.contracts, d.pagination]) } + /** + * Query all the raw store data for a single contract. + * @param address the address of the contract + */ public async allContractState( address: AccAddress, params: Partial = {} @@ -141,30 +157,43 @@ export class WasmAPI extends BaseAPI { .then((d) => [d.models, d.pagination]) } + /** + * Query the single key from the raw store data of a contract. + * @param address the address of the contract + * @param query_data the query data passed to the contract + */ public async rawContractState( address: AccAddress, - queryData: string, + query_data: string, params: APIParams = {} ): Promise { return this.c .get<{ data: string - }>(`/cosmwasm/wasm/v1/contract/${address}/raw/${queryData}`, params) + }>(`/cosmwasm/wasm/v1/contract/${address}/raw/${query_data}`, params) .then((d) => d.data) } + /** + * Query the smart query result from the contract. + * @param address the address of the contract + * @param query_data the query data passed to the contract + */ public async smartContractState( address: AccAddress, - queryData: string, + query_data: string, params: APIParams = {} ): Promise { return this.c .get<{ data: T - }>(`/cosmwasm/wasm/v1/contract/${address}/smart/${queryData}`, params) + }>(`/cosmwasm/wasm/v1/contract/${address}/smart/${query_data}`, params) .then((res) => res.data) } + /** + * Query the metadatas for all stored wasm codes. + */ public async codeInfos( params: Partial = {} ): Promise<[CodeInfo[], Pagination]> { @@ -186,15 +215,19 @@ export class WasmAPI extends BaseAPI { ]) } + /** + * Query the binary code and metadata for a singe wasm code. + * @param code_id unique code identifier + */ public async codeInfo( - codeId: number, + code_id: number, params: APIParams = {} ): Promise<{ code_info: CodeInfo; data: string }> { return this.c .get<{ code_info: CodeInfo.Data data: string - }>(`/cosmwasm/wasm/v1/code/${codeId}`, params) + }>(`/cosmwasm/wasm/v1/code/${code_id}`, params) .then((d) => ({ code_info: { code_id: parseInt(d.code_info.code_id), @@ -208,6 +241,9 @@ export class WasmAPI extends BaseAPI { })) } + /** + * Query the pinned code ids. + */ public async pinnedCodes( params: Partial = {} ): Promise<[number[], Pagination]> { @@ -219,6 +255,9 @@ export class WasmAPI extends BaseAPI { .then((d) => [d.code_ids.map((id) => parseInt(id)), d.pagination]) } + /** + * Query the parameters of the wasm module. + */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ @@ -227,6 +266,10 @@ export class WasmAPI extends BaseAPI { .then((d) => WasmParams.fromData(d.params)) } + /** + * Query the contracts by creator. + * @param creator the address of contract creator + */ public async contractsByCreator( creator: AccAddress, params: Partial = {} From 3af7d5cbb66bbd342475fe400a12406823cb0b0d Mon Sep 17 00:00:00 2001 From: joon9823 Date: Thu, 7 Nov 2024 16:58:31 +0900 Subject: [PATCH 4/5] Fix comment styles --- src/client/WebSocketClient.ts | 2 +- src/core/consensus/BlockParams.ts | 4 +- src/core/consensus/EvidenceParams.ts | 6 +-- .../crisis/msgs/MsgVerifyInvariant.spec.ts | 52 ------------------- src/core/crisis/msgs/MsgVerifyInvariant.ts | 40 ++++++++------ src/core/gov/GovParams.ts | 26 +++++----- src/core/gov/TallyResult.ts | 2 +- .../applications/transfer/msgs/MsgTransfer.ts | 4 +- src/core/ibc/lightclient/tendermint/Header.ts | 52 +++++++++---------- src/core/move/msgs/MsgDelist.ts | 5 +- src/core/move/msgs/MsgWhitelist.ts | 2 +- src/core/mstaking/Delegation.ts | 6 +-- src/core/mstaking/Redelegation.ts | 2 +- src/core/mstaking/Validator.ts | 2 +- src/core/slashing/SlashingParams.ts | 10 ++-- src/core/tx/SignDoc.ts | 5 +- src/util/hash.ts | 2 +- 17 files changed, 88 insertions(+), 134 deletions(-) delete mode 100644 src/core/crisis/msgs/MsgVerifyInvariant.spec.ts diff --git a/src/client/WebSocketClient.ts b/src/client/WebSocketClient.ts index 3b101c2..53e4276 100644 --- a/src/client/WebSocketClient.ts +++ b/src/client/WebSocketClient.ts @@ -136,7 +136,7 @@ export class WebSocketClient extends EventEmitter { /** * WebSocketClient constructor - * @param URL The WebSocket endpoint URL on the Tendermint RPC server. + * @param URL the websocket endpoint URL on the Tendermint RPC server. * Ex: ws://localhost:26657/websocket * @param reconnectCount 0 for not to attempt reconnect, -1 for infinite, > 0 for number of times to attempt * @param reconnectInterval retry interval in milliseconds diff --git a/src/core/consensus/BlockParams.ts b/src/core/consensus/BlockParams.ts index aa401c1..6945690 100644 --- a/src/core/consensus/BlockParams.ts +++ b/src/core/consensus/BlockParams.ts @@ -7,8 +7,8 @@ export class BlockParams extends JSONSerializable< BlockParams.Proto > { /** - * @param max_bytes Max block size in bytes, must be greater than 0 - * @param max_gas Max gas per block, must be greater or equal to -1 + * @param max_bytes max block size in bytes, must be greater than 0 + * @param max_gas max gas per block, must be greater or equal to -1 */ constructor( public max_bytes: number, diff --git a/src/core/consensus/EvidenceParams.ts b/src/core/consensus/EvidenceParams.ts index 6bf590c..5ec2186 100644 --- a/src/core/consensus/EvidenceParams.ts +++ b/src/core/consensus/EvidenceParams.ts @@ -8,9 +8,9 @@ export class EvidenceParams extends JSONSerializable< EvidenceParams.Proto > { /** - * @param max_age_num_blocks Max age of evidence in blocks, MaxAgeDuration / average block time - * @param max_age_duration Max age of evidence in time - * @param max_bytes the maximum size of total evidence in bytes that can be committed in a single block + * @param max_age_num_blocks max age of evidence in blocks, MaxAgeDuration / average block time + * @param max_age_duration max age of evidence in time + * @param max_bytes max size of total evidence in bytes that can be committed in a single block */ constructor( public max_age_num_blocks: number, diff --git a/src/core/crisis/msgs/MsgVerifyInvariant.spec.ts b/src/core/crisis/msgs/MsgVerifyInvariant.spec.ts deleted file mode 100644 index 7fe71e5..0000000 --- a/src/core/crisis/msgs/MsgVerifyInvariant.spec.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { MsgVerifyInvariant } from './MsgVerifyInvariant' - -describe('MsgVerifyInvariant', () => { - it('deserialize correctly', () => { - const send = MsgVerifyInvariant.fromAmino({ - type: 'cosmos-sdk/MsgVerifyInvariant', - value: { - sender: 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', - invariantModuleName: 'bank', - invariantRoute: 'nonnegative-outstanding-supply', - }, - }) - - expect(send).toMatchObject({ - sender: 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', - invariantModuleName: 'bank', - invariantRoute: 'nonnegative-outstanding-supply', - }) - }) - - it('deserialize correctly proto', () => { - const send = MsgVerifyInvariant.fromData({ - '@type': '/cosmos.crisis.v1beta1.MsgVerifyInvariant', - sender: 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', - invariantModuleName: 'bank', - invariantRoute: 'nonnegative-outstanding-supply', - }) - - expect(send).toMatchObject({ - sender: 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', - invariantModuleName: 'bank', - invariantRoute: 'nonnegative-outstanding-supply', - }) - - expect(send.toData()).toMatchObject({ - '@type': '/cosmos.crisis.v1beta1.MsgVerifyInvariant', - sender: 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', - invariantModuleName: 'bank', - invariantRoute: 'nonnegative-outstanding-supply', - }) - }) - - it('not allowed conversion to amino/proto', () => { - const Msg = new MsgVerifyInvariant( - 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', - 'bank', - 'nonnegative-outstanding-supply' - ) - expect(Msg.toAmino).toThrow(/MsgVerifyInvarant is not allowed to send/) - expect(Msg.toProto).toThrow(/MsgVerifyInvarant is not allowed to send/) - }) -}) diff --git a/src/core/crisis/msgs/MsgVerifyInvariant.ts b/src/core/crisis/msgs/MsgVerifyInvariant.ts index fb71a21..20ac323 100644 --- a/src/core/crisis/msgs/MsgVerifyInvariant.ts +++ b/src/core/crisis/msgs/MsgVerifyInvariant.ts @@ -12,23 +12,27 @@ export class MsgVerifyInvariant extends JSONSerializable< MsgVerifyInvariant.Proto > { /** - * @param sender sender's address - * @param invariantModuleName module name to verify invariant - * @param invariantRoute route to verify + * @param sender the account address of private key to send coins to fee collector account + * @param invariant_module_name name of the invariant module + * @param invariantRoute the msg's invariant route */ constructor( public sender: AccAddress, - public invariantModuleName: string, - public invariantRoute: string + public invariant_module_name: string, + public invariant_route: string ) { super() } public static fromAmino(data: MsgVerifyInvariant.Amino): MsgVerifyInvariant { const { - value: { sender, invariantModuleName, invariantRoute }, + value: { sender, invariant_module_name, invariant_route }, } = data - return new MsgVerifyInvariant(sender, invariantModuleName, invariantRoute) + return new MsgVerifyInvariant( + sender, + invariant_module_name, + invariant_route + ) } public toAmino(): MsgVerifyInvariant.Amino { @@ -36,18 +40,22 @@ export class MsgVerifyInvariant extends JSONSerializable< } public static fromData(data: MsgVerifyInvariant.Data): MsgVerifyInvariant { - const { sender, invariantModuleName, invariantRoute } = data + const { sender, invariant_module_name, invariant_route } = data - return new MsgVerifyInvariant(sender, invariantModuleName, invariantRoute) + return new MsgVerifyInvariant( + sender, + invariant_module_name, + invariant_route + ) } public toData(): MsgVerifyInvariant.Data { - const { sender, invariantModuleName, invariantRoute } = this + const { sender, invariant_module_name, invariant_route } = this return { '@type': '/cosmos.crisis.v1beta1.MsgVerifyInvariant', sender, - invariantModuleName, - invariantRoute, + invariant_module_name, + invariant_route, } } @@ -82,16 +90,16 @@ export namespace MsgVerifyInvariant { type: 'cosmos-sdk/MsgVerifyInvariant' value: { sender: AccAddress - invariantModuleName: string - invariantRoute: string + invariant_module_name: string + invariant_route: string } } export interface Data { '@type': '/cosmos.crisis.v1beta1.MsgVerifyInvariant' sender: AccAddress - invariantModuleName: string - invariantRoute: string + invariant_module_name: string + invariant_route: string } export type Proto = MsgVerifyInvariant_pb diff --git a/src/core/gov/GovParams.ts b/src/core/gov/GovParams.ts index c3f3137..40cd777 100644 --- a/src/core/gov/GovParams.ts +++ b/src/core/gov/GovParams.ts @@ -15,23 +15,23 @@ export class GovParams extends JSONSerializable< public emergency_min_deposit: Coins /** - * @param min_deposit Minimum deposit for a proposal to enter voting period - * @param max_deposit_period Maximum period for holders to deposit on a proposal. Initial value: 2 months - * @param voting_period Duration of the voting period - * @param quorum Minimum percentage of total stake needed to vote for a result to be considered valid - * @param threshold Minimum proportion of Yes votes for proposal to pass. Default value: 0.5 - * @param veto_threshold Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Default value: 1/3 - * @param min_initial_deposit_ratio The ratio representing the proportion of the deposit value that must be paid at proposal submission - * @param proposal_cancel_ratio The cancel ratio which will not be returned back to the depositors when a proposal is cancelled - * @param proposal_cancel_dest The address which will receive (proposal_cancel_ratio * deposit) proposal deposits; If empty, the proposal deposits will be burned - * @param expedited_voting_period Duration of the voting period of an expedited proposal - * @param expedited_threshold Minimum proportion of Yes votes for proposal to pass. Default value: 0.67 - * @param expedited_min_deposit Minimum expedited deposit for a proposal to enter voting period + * @param min_deposit min deposit for a proposal to enter voting period + * @param max_deposit_period max period for holders to deposit on a proposal. Initial value: 2 months + * @param voting_period duration of the voting period + * @param quorum min percentage of total stake needed to vote for a result to be considered valid + * @param threshold min proportion of Yes votes for proposal to pass. Default value: 0.5 + * @param veto_threshold min value of Veto votes to Total votes ratio for proposal to be vetoed. Default value: 1/3 + * @param min_initial_deposit_ratio the ratio representing the proportion of the deposit value that must be paid at proposal submission + * @param proposal_cancel_ratio the cancel ratio which will not be returned back to the depositors when a proposal is cancelled + * @param proposal_cancel_dest the address which will receive (proposal_cancel_ratio * deposit) proposal deposits; If empty, the proposal deposits will be burned + * @param expedited_voting_period duration of the voting period of an expedited proposal + * @param expedited_threshold min proportion of Yes votes for proposal to pass. Default value: 0.67 + * @param expedited_min_deposit min expedited deposit for a proposal to enter voting period * @param burn_vote_quorum burn deposits if a proposal does not meet quorum * @param burn_proposal_deposit_prevote burn deposits if the proposal does not enter voting period * @param burn_vote_veto burn deposits if quorum with vote type no_veto is met * @param min_deposit_ratio the proportion of the deposit value minimum that must be met when making a deposit. Default value: 0.01 - * @param emergency_min_deposit minimum deposit for a emergency proposal to enter voting period + * @param emergency_min_deposit min deposit for a emergency proposal to enter voting period * @param emergency_tally_interval tally interval for emergency proposal * @param low_threshold_functions low threshold functions for emergency and expedited proposal * @param vesting the vesting contract info for tally diff --git a/src/core/gov/TallyResult.ts b/src/core/gov/TallyResult.ts index 22151d4..d179957 100644 --- a/src/core/gov/TallyResult.ts +++ b/src/core/gov/TallyResult.ts @@ -11,7 +11,7 @@ export class TallyResult extends JSONSerializable< * @param tally_height * @param total_staking_power * @param total_vesting_power - * @param v1_tally_result // the original TallyResult from cosmos-sdk which contains both staking and vesting power + * @param v1_tally_result the original tally result from cosmos-sdk which contains both staking and vesting power */ constructor( public tally_height: number, diff --git a/src/core/ibc/applications/transfer/msgs/MsgTransfer.ts b/src/core/ibc/applications/transfer/msgs/MsgTransfer.ts index d68dbdc..268bd66 100644 --- a/src/core/ibc/applications/transfer/msgs/MsgTransfer.ts +++ b/src/core/ibc/applications/transfer/msgs/MsgTransfer.ts @@ -27,8 +27,8 @@ export class MsgTransfer extends JSONSerializable< * @param token the tokens to be transferred * @param sender the sender address * @param receiver the recipient address on the destination chain - * @param timeout_height Timeout height relative to the current block height. (0 to disable) - * @param timeout_timestamp Timeout timestamp (in nanoseconds) relative to the current block timestamp. (0 to disable) + * @param timeout_height timeout height relative to the current block height. (0 to disable) + * @param timeout_timestamp timeout timestamp (in nanoseconds) relative to the current block timestamp. (0 to disable) * @param memo optional memo */ constructor( diff --git a/src/core/ibc/lightclient/tendermint/Header.ts b/src/core/ibc/lightclient/tendermint/Header.ts index 621af65..e2387bf 100644 --- a/src/core/ibc/lightclient/tendermint/Header.ts +++ b/src/core/ibc/lightclient/tendermint/Header.ts @@ -23,16 +23,16 @@ import { Any } from '@initia/initia.proto/google/protobuf/any' */ export class Header extends JSONSerializable { /** - * @param signedHeader - * @param validatorSet - * @param trustedHeight - * @param trustedValidators + * @param signed_header + * @param validator_set + * @param trusted_height + * @param trusted_validators */ constructor( - public signedHeader?: SignedHeader, - public validatorSet?: ValidatorSet, - public trustedHeight?: Height, - public trustedValidators?: ValidatorSet + public signed_header?: SignedHeader, + public validator_set?: ValidatorSet, + public trusted_height?: Height, + public trusted_validators?: ValidatorSet ) { super() } @@ -46,28 +46,24 @@ export class Header extends JSONSerializable { } public static fromData(data: Header.Data): Header { - const { - signed_header: signedHeader, - validator_set: validatorSet, - trusted_height: trustedHeight, - trusted_validators: trustedValidators, - } = data + const { signed_header, validator_set, trusted_height, trusted_validators } = + data return new Header( - signedHeader ? SignedHeader.fromData(signedHeader) : undefined, - validatorSet ? ValidatorSet.fromData(validatorSet) : undefined, - trustedHeight ? Height.fromData(trustedHeight) : undefined, - trustedValidators ? ValidatorSet.fromData(trustedValidators) : undefined + signed_header ? SignedHeader.fromData(signed_header) : undefined, + validator_set ? ValidatorSet.fromData(validator_set) : undefined, + trusted_height ? Height.fromData(trusted_height) : undefined, + trusted_validators ? ValidatorSet.fromData(trusted_validators) : undefined ) } public toData(): Header.Data { - const { signedHeader, validatorSet, trustedHeight, trustedValidators } = + const { signed_header, validator_set, trusted_height, trusted_validators } = this return { - signed_header: signedHeader?.toData(), - validator_set: validatorSet?.toData(), - trusted_height: trustedHeight?.toData(), - trusted_validators: trustedValidators?.toData(), + signed_header: signed_header?.toData(), + validator_set: validator_set?.toData(), + trusted_height: trusted_height?.toData(), + trusted_validators: trusted_validators?.toData(), } } @@ -83,13 +79,13 @@ export class Header extends JSONSerializable { } public toProto(): Header.Proto { - const { signedHeader, validatorSet, trustedHeight, trustedValidators } = + const { signed_header, validator_set, trusted_height, trusted_validators } = this return Header_pb.fromPartial({ - signedHeader: signedHeader?.toProto(), - validatorSet: validatorSet?.toProto(), - trustedHeight: trustedHeight?.toProto(), - trustedValidators: trustedValidators?.toProto(), + signedHeader: signed_header?.toProto(), + validatorSet: validator_set?.toProto(), + trustedHeight: trusted_height?.toProto(), + trustedValidators: trusted_validators?.toProto(), }) } diff --git a/src/core/move/msgs/MsgDelist.ts b/src/core/move/msgs/MsgDelist.ts index cc0924c..7116367 100644 --- a/src/core/move/msgs/MsgDelist.ts +++ b/src/core/move/msgs/MsgDelist.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgDelist as MsgDelist_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * MsgDelist unregisters a dex pair from the whitelist. + */ export class MsgDelist extends JSONSerializable< MsgDelist.Amino, MsgDelist.Data, @@ -10,7 +13,7 @@ export class MsgDelist extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param metadata_lp Dex coin LP metadata address + * @param metadata_lp dex coin LP metadata address */ constructor( public authority: AccAddress, diff --git a/src/core/move/msgs/MsgWhitelist.ts b/src/core/move/msgs/MsgWhitelist.ts index 8ffdf6f..5143e9c 100644 --- a/src/core/move/msgs/MsgWhitelist.ts +++ b/src/core/move/msgs/MsgWhitelist.ts @@ -10,7 +10,7 @@ export class MsgWhitelist extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param metadata_lp Dex coin LP metadata address + * @param metadata_lp dex coin LP metadata address * @param reward_weight registered to distribution's Params */ constructor( diff --git a/src/core/mstaking/Delegation.ts b/src/core/mstaking/Delegation.ts index 15afb83..c356206 100644 --- a/src/core/mstaking/Delegation.ts +++ b/src/core/mstaking/Delegation.ts @@ -18,9 +18,9 @@ export class Delegation extends JSONSerializable< public balance: Coins /** - * @param delegator_address delegator's account address - * @param validator_address validator's operator address - * @param shares delegator's shares + * @param delegator_address delegator's account address + * @param validator_address validator's operator address + * @param shares delegator's shares * @param balance balance of the delegation */ constructor( diff --git a/src/core/mstaking/Redelegation.ts b/src/core/mstaking/Redelegation.ts index b656804..b74fcbc 100644 --- a/src/core/mstaking/Redelegation.ts +++ b/src/core/mstaking/Redelegation.ts @@ -175,7 +175,7 @@ export namespace Redelegation { * * @param initial_balance balance of delegation prior to initiating redelegation * @param shares_dst - * @param creation_height height of blockchain when entry was created + * @param creation_height height of blockchain when entry was created * @param completion_time time when redelegation entry will be removed */ constructor( diff --git a/src/core/mstaking/Validator.ts b/src/core/mstaking/Validator.ts index 5b09c49..99cf6b4 100644 --- a/src/core/mstaking/Validator.ts +++ b/src/core/mstaking/Validator.ts @@ -32,7 +32,7 @@ export class Validator extends JSONSerializable< * @param consensus_pubkey validator's consensus public key * @param jailed whether the current validator is jailed * @param status unbonded `0`, unbonding `1`, bonded `2` - * @param tokens total Initia from all delegations (including self) + * @param tokens total INIT from all delegations (including self) * @param delegator_shares total shares of all delegators * @param description validator's delegate description * @param unbonding_height if unbonding, height at which this validator began unbonding diff --git a/src/core/slashing/SlashingParams.ts b/src/core/slashing/SlashingParams.ts index 97a0edf..4c73fdf 100644 --- a/src/core/slashing/SlashingParams.ts +++ b/src/core/slashing/SlashingParams.ts @@ -8,11 +8,11 @@ export class SlashingParams extends JSONSerializable< SlashingParams.Proto > { /** - * @param signed_blocks_window Number of blocks over which missed blocks are tallied for downtime - * @param min_signed_per_window If a validator misses more than this number, they will be penalized and jailed for downtime - * @param downtime_jail_duration Amount of time in seconds after which a jailed validator can be unjailed - * @param slash_fraction_double_sign Ratio of funds slashed for a double-sign infraction - * @param slash_fraction_downtime Ratio of funds slashed for a downtime infraction + * @param signed_blocks_window number of blocks over which missed blocks are tallied for downtime + * @param min_signed_per_window if a validator misses more than this number, they will be penalized and jailed for downtime + * @param downtime_jail_duration amount of time in seconds after which a jailed validator can be unjailed + * @param slash_fraction_double_sign ratio of funds slashed for a double-sign infraction + * @param slash_fraction_downtime ratio of funds slashed for a downtime infraction */ constructor( public signed_blocks_window: number, diff --git a/src/core/tx/SignDoc.ts b/src/core/tx/SignDoc.ts index cb66a07..27ff2f9 100644 --- a/src/core/tx/SignDoc.ts +++ b/src/core/tx/SignDoc.ts @@ -19,13 +19,12 @@ export class SignDoc extends JSONSerializable< * * @param chain_id ID of blockchain to submit transaction to * @param account_number account number on blockchain - * @param sequence Sequence number (nonce), number of signed previous transactions by - * account included on the blockchain at time of broadcast. + * @param sequence sequence number (nonce), number of signed previous transactions by account included on the blockchain at time of broadcast * @param fee transaction fee * @param msgs list of messages to include * @param memo optional note * @param timeout_height optional transaction timeout height, does not support amino - * @param public_key Signer's public key, only used at direct sign mode + * @param public_key signer's public key, only used at direct sign mode */ constructor( public chain_id: string, diff --git a/src/util/hash.ts b/src/util/hash.ts index 580a75c..70f44fa 100644 --- a/src/util/hash.ts +++ b/src/util/hash.ts @@ -16,7 +16,7 @@ function byteArrayToWordArray(ba: Uint8Array): CryptoJS.LibWordArray { /** * Calculates the transaction hash from Amino-encoded string. - * @param data Amino-encoded string (base64) + * @param data amino-encoded string (base64) */ export function hashToHex(data: string): string { return SHA256.hash(Base64.parse(data)).toString().toUpperCase() From d39b52291e5cd9e5907de35733b73678ee463f6b Mon Sep 17 00:00:00 2001 From: joon9823 Date: Thu, 7 Nov 2024 18:19:03 +0900 Subject: [PATCH 5/5] Add documenting comments for core structures of initia --- src/client/rest/Wallet.ts | 2 +- src/client/rest/api/MoveAPI.ts | 9 ++++++--- src/core/auction/msgs/MsgUpdateAuctionParams.ts | 2 +- src/core/auth/msgs/MsgUpdateAuthParams.ts | 2 +- src/core/bank/msgs/MsgSetDenomMetadata.ts | 2 +- src/core/bank/msgs/MsgUpdateBankParams.ts | 2 +- src/core/crisis/msgs/MsgUpdateCrisisParams.ts | 2 +- src/core/distribution/msgs/MsgUpdateDistrParams.ts | 2 +- src/core/evm/EvmParams.ts | 3 +++ src/core/evm/msgs/MsgCall.ts | 3 +++ src/core/evm/msgs/MsgCreate.ts | 3 +++ src/core/evm/msgs/MsgCreate2.ts | 3 +++ src/core/evm/msgs/MsgUpdateEvmParams.ts | 5 ++++- src/core/gov/msgs/MsgUpdateGovParams.ts | 2 +- .../nft-transfer/msgs/MsgUpdateIbcNftParams.ts | 2 +- .../transfer/msgs/MsgUpdateIbcTransferParams.ts | 2 +- .../ibc/core/channel/msgs/MsgUpdateIbcChannelParams.ts | 2 +- .../ibc/core/client/msgs/MsgUpdateIbcClientParams.ts | 2 +- .../connection/msgs/MsgUpdateIbcConnectionParams.ts | 2 +- src/core/ibchooks/msgs/MsgUpdateIbcHooksParams.ts | 2 +- src/core/marketmap/msgs/MsgRemoveMarketAuthorities.ts | 2 +- src/core/marketmap/msgs/MsgUpdateMarketmapParams.ts | 2 +- src/core/move/Module.ts | 3 +++ src/core/move/MoveParams.ts | 3 +++ src/core/move/msgs/MsgExecute.ts | 5 +++++ src/core/move/msgs/MsgExecuteJSON.ts | 3 +++ src/core/move/msgs/MsgGovExecute.ts | 5 +++++ src/core/move/msgs/MsgGovExecuteJSON.ts | 3 +++ src/core/move/msgs/MsgGovPublish.ts | 3 +++ src/core/move/msgs/MsgGovScript.ts | 5 +++++ src/core/move/msgs/MsgGovScriptJSON.ts | 3 +++ src/core/move/msgs/MsgPublish.ts | 3 +++ src/core/move/msgs/MsgScript.ts | 5 +++++ src/core/move/msgs/MsgScriptJSON.ts | 3 +++ src/core/move/msgs/MsgUpdateMoveParams.ts | 5 ++++- src/core/move/msgs/MsgWhitelist.ts | 6 ++++++ src/core/mstaking/msgs/MsgUpdateMstakingParams.ts | 2 +- src/core/opchild/BridgeInfo.ts | 3 +++ src/core/opchild/OpValidator.ts | 10 ++++++++++ src/core/opchild/OpchildParams.ts | 3 +++ src/core/opchild/msgs/MsgAddValidator.ts | 3 +++ src/core/opchild/msgs/MsgExecuteMessages.ts | 3 +++ src/core/opchild/msgs/MsgFinalizeTokenDeposit.ts | 3 +++ src/core/opchild/msgs/MsgInitiateTokenWithdrawal.ts | 3 +++ src/core/opchild/msgs/MsgRemoveValidator.ts | 3 +++ src/core/opchild/msgs/MsgSetBridgeInfo.ts | 3 +++ src/core/opchild/msgs/MsgSpendFeePool.ts | 3 +++ src/core/opchild/msgs/MsgUpdateOpchildParams.ts | 5 ++++- src/core/opchild/msgs/MsgUpdateOracle.ts | 3 +++ src/core/ophost/BatchInfo.ts | 3 +++ src/core/ophost/BatchInfoWithOutput.ts | 3 +++ src/core/ophost/BridgeConfig.ts | 3 +++ src/core/ophost/OphostParams.ts | 3 +++ src/core/ophost/Output.ts | 3 +++ src/core/ophost/msgs/MsgCreateBridge.ts | 3 +++ src/core/ophost/msgs/MsgDeleteOutput.ts | 3 +++ src/core/ophost/msgs/MsgFinalizeTokenWithdrawal.ts | 3 +++ src/core/ophost/msgs/MsgInitiateTokenDeposit.ts | 3 +++ src/core/ophost/msgs/MsgProposeOutput.ts | 3 +++ src/core/ophost/msgs/MsgRecordBatch.ts | 3 +++ src/core/ophost/msgs/MsgUpdateBatchInfo.ts | 3 +++ src/core/ophost/msgs/MsgUpdateChallenger.ts | 3 +++ src/core/ophost/msgs/MsgUpdateMetadata.ts | 3 +++ src/core/ophost/msgs/MsgUpdateOphostParams.ts | 5 ++++- src/core/ophost/msgs/MsgUpdateOracleConfig.ts | 3 +++ src/core/ophost/msgs/MsgUpdateProposer.ts | 3 +++ src/core/reward/msgs/MsgUpdateRewardParams.ts | 2 +- src/core/slashing/msgs/MsgUpdateSlashingParams.ts | 2 +- src/core/tokenfactory/TokenfactoryParams.ts | 3 +++ src/core/tokenfactory/msgs/MsgBurn.ts | 5 +++++ src/core/tokenfactory/msgs/MsgChangeAdmin.ts | 3 +++ src/core/tokenfactory/msgs/MsgCreateDenom.ts | 10 ++++++++++ src/core/tokenfactory/msgs/MsgForceTransfer.ts | 3 +++ src/core/tokenfactory/msgs/MsgMint.ts | 5 +++++ src/core/tokenfactory/msgs/MsgSetBeforeSendHook.ts | 3 +++ src/core/tokenfactory/msgs/MsgSetDenomMetadataWasm.ts | 3 +++ .../tokenfactory/msgs/MsgUpdateTokenfactoryParams.ts | 5 ++++- src/core/wasm/msgs/MsgUpdateWasmParams.ts | 2 +- 78 files changed, 231 insertions(+), 28 deletions(-) diff --git a/src/client/rest/Wallet.ts b/src/client/rest/Wallet.ts index 58ed833..997981e 100644 --- a/src/client/rest/Wallet.ts +++ b/src/client/rest/Wallet.ts @@ -7,7 +7,7 @@ import { SignMode } from '@initia/initia.proto/cosmos/tx/signing/v1beta1/signing export class Wallet { private accAddress: string /** - * @deprecated Use rest instead. + * @deprecated Use `rest` instead. */ public lcd: RESTClient diff --git a/src/client/rest/api/MoveAPI.ts b/src/client/rest/api/MoveAPI.ts index 47ea01d..4d59837 100644 --- a/src/client/rest/api/MoveAPI.ts +++ b/src/client/rest/api/MoveAPI.ts @@ -169,13 +169,14 @@ export class MoveAPI extends BaseAPI { } /** + * @deprecated Use `viewJSON` instead. + * * Execute view function and return the view result. * @param address the owner address of the module to query * @param module_name the module name of the entry function to query * @param function_name the name of a function to query * @param type_args the type arguments of a function to execute * @param args the arguments of a function to execute - * @deprecated Use `viewJSON` instead */ public async viewFunction( address: AccAddress, @@ -196,13 +197,14 @@ export class MoveAPI extends BaseAPI { } /** + * @deprecated Use `viewJSON` instead. + * * Execute view function and return the view result. * @param address the owner address of the module to query * @param module_name the module name of the entry function to query * @param function_name the name of a function to query * @param type_args the type arguments of a function to execute * @param args the arguments of a function to execute - * @deprecated Use `viewJSON` instead */ public async view( address: AccAddress, @@ -221,9 +223,10 @@ export class MoveAPI extends BaseAPI { } /** + * @deprecated Use `viewBatchJSON` instead. + * * Execute multiple view functions and return the view results. * @param requests list of requests to execute view functions - * @deprecated Use `viewBatchJSON` instead */ public async viewBatch(requests: ViewRequest[]): Promise { return this.c diff --git a/src/core/auction/msgs/MsgUpdateAuctionParams.ts b/src/core/auction/msgs/MsgUpdateAuctionParams.ts index e50127e..a10b2f1 100644 --- a/src/core/auction/msgs/MsgUpdateAuctionParams.ts +++ b/src/core/auction/msgs/MsgUpdateAuctionParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateAuctionParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/auth parameters to update + * @param params the auction parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/auth/msgs/MsgUpdateAuthParams.ts b/src/core/auth/msgs/MsgUpdateAuthParams.ts index 66c2f08..2662e39 100644 --- a/src/core/auth/msgs/MsgUpdateAuthParams.ts +++ b/src/core/auth/msgs/MsgUpdateAuthParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateAuthParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/auth parameters to update + * @param params the auth parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/bank/msgs/MsgSetDenomMetadata.ts b/src/core/bank/msgs/MsgSetDenomMetadata.ts index 5e61037..4f1c10d 100644 --- a/src/core/bank/msgs/MsgSetDenomMetadata.ts +++ b/src/core/bank/msgs/MsgSetDenomMetadata.ts @@ -11,7 +11,7 @@ export class MsgSetDenomMetadata extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param metadata the x/bank denom metadata to update + * @param metadata the bank denom metadata to update */ constructor( public authority: AccAddress, diff --git a/src/core/bank/msgs/MsgUpdateBankParams.ts b/src/core/bank/msgs/MsgUpdateBankParams.ts index 0df6738..e4e8f96 100644 --- a/src/core/bank/msgs/MsgUpdateBankParams.ts +++ b/src/core/bank/msgs/MsgUpdateBankParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateBankParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/bank parameters to update + * @param params the bank parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/crisis/msgs/MsgUpdateCrisisParams.ts b/src/core/crisis/msgs/MsgUpdateCrisisParams.ts index 80bb6db..9db013e 100644 --- a/src/core/crisis/msgs/MsgUpdateCrisisParams.ts +++ b/src/core/crisis/msgs/MsgUpdateCrisisParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateCrisisParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param constant_fee constant_fee defines the x/crisis parameters to update + * @param constant_fee the crisis parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/distribution/msgs/MsgUpdateDistrParams.ts b/src/core/distribution/msgs/MsgUpdateDistrParams.ts index 9302594..9d42924 100644 --- a/src/core/distribution/msgs/MsgUpdateDistrParams.ts +++ b/src/core/distribution/msgs/MsgUpdateDistrParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateDistrParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/distribution parameters to update + * @param params the distribution parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/evm/EvmParams.ts b/src/core/evm/EvmParams.ts index 8c6ec88..8398c8d 100644 --- a/src/core/evm/EvmParams.ts +++ b/src/core/evm/EvmParams.ts @@ -1,6 +1,9 @@ import { JSONSerializable } from '../../util/json' import { Params as Params_pb } from '@initia/initia.proto/minievm/evm/v1/types' +/** + * EvmParams defines the set of evm parameters. + */ export class EvmParams extends JSONSerializable< EvmParams.Amino, EvmParams.Data, diff --git a/src/core/evm/msgs/MsgCall.ts b/src/core/evm/msgs/MsgCall.ts index fd938f8..dd57bf5 100644 --- a/src/core/evm/msgs/MsgCall.ts +++ b/src/core/evm/msgs/MsgCall.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgCall as MsgCall_pb } from '@initia/initia.proto/minievm/evm/v1/tx' +/** + * MsgCall defines a method submitting Ethereum transactions. + */ export class MsgCall extends JSONSerializable< MsgCall.Amino, MsgCall.Data, diff --git a/src/core/evm/msgs/MsgCreate.ts b/src/core/evm/msgs/MsgCreate.ts index 528ecb8..1d50a93 100644 --- a/src/core/evm/msgs/MsgCreate.ts +++ b/src/core/evm/msgs/MsgCreate.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgCreate as MsgCreate_pb } from '@initia/initia.proto/minievm/evm/v1/tx' +/** + * MsgCreate defines a method calling create of EVM. + */ export class MsgCreate extends JSONSerializable< MsgCreate.Amino, MsgCreate.Data, diff --git a/src/core/evm/msgs/MsgCreate2.ts b/src/core/evm/msgs/MsgCreate2.ts index 462c58d..5fe994a 100644 --- a/src/core/evm/msgs/MsgCreate2.ts +++ b/src/core/evm/msgs/MsgCreate2.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgCreate2 as MsgCreate2_pb } from '@initia/initia.proto/minievm/evm/v1/tx' +/** + * MsgCreate2 defines a method calling create2 of EVM. + */ export class MsgCreate2 extends JSONSerializable< MsgCreate2.Amino, MsgCreate2.Data, diff --git a/src/core/evm/msgs/MsgUpdateEvmParams.ts b/src/core/evm/msgs/MsgUpdateEvmParams.ts index ce193db..b63f6aa 100644 --- a/src/core/evm/msgs/MsgUpdateEvmParams.ts +++ b/src/core/evm/msgs/MsgUpdateEvmParams.ts @@ -4,6 +4,9 @@ import { EvmParams } from '../EvmParams' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/minievm/evm/v1/tx' +/** + * MsgUpdateEvmParams defines an operation for updating the evm module parameters. + */ export class MsgUpdateEvmParams extends JSONSerializable< MsgUpdateEvmParams.Amino, MsgUpdateEvmParams.Data, @@ -11,7 +14,7 @@ export class MsgUpdateEvmParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/evm parameters to update + * @param params the evm parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/gov/msgs/MsgUpdateGovParams.ts b/src/core/gov/msgs/MsgUpdateGovParams.ts index 7eedd0c..0f2c2e2 100644 --- a/src/core/gov/msgs/MsgUpdateGovParams.ts +++ b/src/core/gov/msgs/MsgUpdateGovParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateGovParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/auth parameters to update + * @param params the gov parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/ibc/applications/nft-transfer/msgs/MsgUpdateIbcNftParams.ts b/src/core/ibc/applications/nft-transfer/msgs/MsgUpdateIbcNftParams.ts index 7ab4e85..864d55a 100644 --- a/src/core/ibc/applications/nft-transfer/msgs/MsgUpdateIbcNftParams.ts +++ b/src/core/ibc/applications/nft-transfer/msgs/MsgUpdateIbcNftParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateIbcNftParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the parameters to update + * @param params the parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/ibc/applications/transfer/msgs/MsgUpdateIbcTransferParams.ts b/src/core/ibc/applications/transfer/msgs/MsgUpdateIbcTransferParams.ts index d69d3f5..776ad15 100644 --- a/src/core/ibc/applications/transfer/msgs/MsgUpdateIbcTransferParams.ts +++ b/src/core/ibc/applications/transfer/msgs/MsgUpdateIbcTransferParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateIbcTransferParams extends JSONSerializable< > { /** * @param signer the address that controls the module - * @param params params defines the parameters to update + * @param params the parameters to update */ constructor( public signer: AccAddress, diff --git a/src/core/ibc/core/channel/msgs/MsgUpdateIbcChannelParams.ts b/src/core/ibc/core/channel/msgs/MsgUpdateIbcChannelParams.ts index ecb0144..9b52cd6 100644 --- a/src/core/ibc/core/channel/msgs/MsgUpdateIbcChannelParams.ts +++ b/src/core/ibc/core/channel/msgs/MsgUpdateIbcChannelParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateIbcChannelParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the channel parameters to update + * @param params the channel parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/ibc/core/client/msgs/MsgUpdateIbcClientParams.ts b/src/core/ibc/core/client/msgs/MsgUpdateIbcClientParams.ts index 792935c..adf3552 100644 --- a/src/core/ibc/core/client/msgs/MsgUpdateIbcClientParams.ts +++ b/src/core/ibc/core/client/msgs/MsgUpdateIbcClientParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateIbcClientParams extends JSONSerializable< > { /** * @param signer signer address - * @param params params defines the client parameters to update + * @param params the client parameters to update */ constructor( public signer: AccAddress, diff --git a/src/core/ibc/core/connection/msgs/MsgUpdateIbcConnectionParams.ts b/src/core/ibc/core/connection/msgs/MsgUpdateIbcConnectionParams.ts index b074926..3ce12c6 100644 --- a/src/core/ibc/core/connection/msgs/MsgUpdateIbcConnectionParams.ts +++ b/src/core/ibc/core/connection/msgs/MsgUpdateIbcConnectionParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateIbcConnectionParams extends JSONSerializable< > { /** * @param signer signer address - * @param params params defines the connection parameters to update + * @param params the connection parameters to update */ constructor( public signer: AccAddress, diff --git a/src/core/ibchooks/msgs/MsgUpdateIbcHooksParams.ts b/src/core/ibchooks/msgs/MsgUpdateIbcHooksParams.ts index 98c4944..36b7b4a 100644 --- a/src/core/ibchooks/msgs/MsgUpdateIbcHooksParams.ts +++ b/src/core/ibchooks/msgs/MsgUpdateIbcHooksParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateIbcHooksParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/hook parameters to update + * @param params the ibc hooks parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/marketmap/msgs/MsgRemoveMarketAuthorities.ts b/src/core/marketmap/msgs/MsgRemoveMarketAuthorities.ts index 3511791..42049a1 100644 --- a/src/core/marketmap/msgs/MsgRemoveMarketAuthorities.ts +++ b/src/core/marketmap/msgs/MsgRemoveMarketAuthorities.ts @@ -10,7 +10,7 @@ export class MsgRemoveMarketAuthorities extends JSONSerializable< > { /** * @param remove_addresses the list of addresses to remove - * @param admin the authority that is the x/marketmap Admin account + * @param admin the marketmap admin account */ constructor( public remove_addresses: AccAddress[], diff --git a/src/core/marketmap/msgs/MsgUpdateMarketmapParams.ts b/src/core/marketmap/msgs/MsgUpdateMarketmapParams.ts index 89cbc36..68be564 100644 --- a/src/core/marketmap/msgs/MsgUpdateMarketmapParams.ts +++ b/src/core/marketmap/msgs/MsgUpdateMarketmapParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateMarketmapParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/hook parameters to update + * @param params the hook parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/move/Module.ts b/src/core/move/Module.ts index 8d68caf..62f1ff5 100644 --- a/src/core/move/Module.ts +++ b/src/core/move/Module.ts @@ -7,6 +7,9 @@ import { upgradePolicyToJSON, } from '@initia/initia.proto/initia/move/v1/types' +/** + * Module is the data for the uploaded contract move code. + */ export class Module extends JSONSerializable< Module.Amino, Module.Data, diff --git a/src/core/move/MoveParams.ts b/src/core/move/MoveParams.ts index cdafceb..9fc992d 100644 --- a/src/core/move/MoveParams.ts +++ b/src/core/move/MoveParams.ts @@ -1,6 +1,9 @@ import { JSONSerializable } from '../../util/json' import { Params as Params_pb } from '@initia/initia.proto/initia/move/v1/types' +/** + * MoveParams defines the set of move parameters. + */ export class MoveParams extends JSONSerializable< MoveParams.Amino, MoveParams.Data, diff --git a/src/core/move/msgs/MsgExecute.ts b/src/core/move/msgs/MsgExecute.ts index 0c61ac9..c2e96f9 100644 --- a/src/core/move/msgs/MsgExecute.ts +++ b/src/core/move/msgs/MsgExecute.ts @@ -3,6 +3,11 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgExecute as MsgExecute_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * @deprecated Use `MsgExecuteJSON` instead. + * + * MsgExecute runs a entry function with the given message. + */ export class MsgExecute extends JSONSerializable< MsgExecute.Amino, MsgExecute.Data, diff --git a/src/core/move/msgs/MsgExecuteJSON.ts b/src/core/move/msgs/MsgExecuteJSON.ts index 0db61a0..3f85f24 100644 --- a/src/core/move/msgs/MsgExecuteJSON.ts +++ b/src/core/move/msgs/MsgExecuteJSON.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgExecuteJSON as MsgExecuteJSON_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * MsgExecuteJSON runs a entry function with the given message. + */ export class MsgExecuteJSON extends JSONSerializable< MsgExecuteJSON.Amino, MsgExecuteJSON.Data, diff --git a/src/core/move/msgs/MsgGovExecute.ts b/src/core/move/msgs/MsgGovExecute.ts index 6cc440b..c42519a 100644 --- a/src/core/move/msgs/MsgGovExecute.ts +++ b/src/core/move/msgs/MsgGovExecute.ts @@ -3,6 +3,11 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgGovExecute as MsgGovExecute_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * @deprecated Use `MsgGovExecuteJSON` instead. + * + * MsgGovExecute runs a entry function with the given message via gov proposal. + */ export class MsgGovExecute extends JSONSerializable< MsgGovExecute.Amino, MsgGovExecute.Data, diff --git a/src/core/move/msgs/MsgGovExecuteJSON.ts b/src/core/move/msgs/MsgGovExecuteJSON.ts index 0a8273a..a517672 100644 --- a/src/core/move/msgs/MsgGovExecuteJSON.ts +++ b/src/core/move/msgs/MsgGovExecuteJSON.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgGovExecuteJSON as MsgGovExecuteJSON_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * MsgGovExecuteJSON runs a entry function with the given message via gov proposal. + */ export class MsgGovExecuteJSON extends JSONSerializable< MsgGovExecuteJSON.Amino, MsgGovExecuteJSON.Data, diff --git a/src/core/move/msgs/MsgGovPublish.ts b/src/core/move/msgs/MsgGovPublish.ts index d4c20ef..8e64932 100644 --- a/src/core/move/msgs/MsgGovPublish.ts +++ b/src/core/move/msgs/MsgGovPublish.ts @@ -4,6 +4,9 @@ import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgGovPublish as MsgGovPublish_pb } from '@initia/initia.proto/initia/move/v1/tx' import { UpgradePolicy } from '@initia/initia.proto/initia/move/v1/types' +/** + * MsgGovPublish stores compiled Move module via gov proposal. + */ export class MsgGovPublish extends JSONSerializable< MsgGovPublish.Amino, MsgGovPublish.Data, diff --git a/src/core/move/msgs/MsgGovScript.ts b/src/core/move/msgs/MsgGovScript.ts index 7642ae0..555164c 100644 --- a/src/core/move/msgs/MsgGovScript.ts +++ b/src/core/move/msgs/MsgGovScript.ts @@ -3,6 +3,11 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgGovScript as MsgGovScript_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * @deprecated Use `MsgGovScriptJSON` instead. + * + * MsgGovScript runs a script with the given message via gov proposal. + */ export class MsgGovScript extends JSONSerializable< MsgGovScript.Amino, MsgGovScript.Data, diff --git a/src/core/move/msgs/MsgGovScriptJSON.ts b/src/core/move/msgs/MsgGovScriptJSON.ts index 92fd1c2..991fce6 100644 --- a/src/core/move/msgs/MsgGovScriptJSON.ts +++ b/src/core/move/msgs/MsgGovScriptJSON.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgGovScriptJSON as MsgGovScriptJSON_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * MsgGovScriptJSON runs a script with the given message via gov proposal. + */ export class MsgGovScriptJSON extends JSONSerializable< MsgGovScriptJSON.Amino, MsgGovScriptJSON.Data, diff --git a/src/core/move/msgs/MsgPublish.ts b/src/core/move/msgs/MsgPublish.ts index 2570b2f..bba18a8 100644 --- a/src/core/move/msgs/MsgPublish.ts +++ b/src/core/move/msgs/MsgPublish.ts @@ -4,6 +4,9 @@ import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgPublish as MsgPublish_pb } from '@initia/initia.proto/initia/move/v1/tx' import { UpgradePolicy } from '@initia/initia.proto/initia/move/v1/types' +/** + * MsgPublish stores the compiled Move module. + */ export class MsgPublish extends JSONSerializable< MsgPublish.Amino, MsgPublish.Data, diff --git a/src/core/move/msgs/MsgScript.ts b/src/core/move/msgs/MsgScript.ts index f8d03c5..e217981 100644 --- a/src/core/move/msgs/MsgScript.ts +++ b/src/core/move/msgs/MsgScript.ts @@ -3,6 +3,11 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgScript as MsgScript_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * @deprecated Use `MsgScriptJSON` instead. + * + * MsgScript runs a script with the given message. + */ export class MsgScript extends JSONSerializable< MsgScript.Amino, MsgScript.Data, diff --git a/src/core/move/msgs/MsgScriptJSON.ts b/src/core/move/msgs/MsgScriptJSON.ts index 614447a..899b40b 100644 --- a/src/core/move/msgs/MsgScriptJSON.ts +++ b/src/core/move/msgs/MsgScriptJSON.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgScriptJSON as MsgScriptJSON_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * MsgScriptJSON runs a script with the given message. + */ export class MsgScriptJSON extends JSONSerializable< MsgScriptJSON.Amino, MsgScriptJSON.Data, diff --git a/src/core/move/msgs/MsgUpdateMoveParams.ts b/src/core/move/msgs/MsgUpdateMoveParams.ts index c387a89..0cd0bf8 100644 --- a/src/core/move/msgs/MsgUpdateMoveParams.ts +++ b/src/core/move/msgs/MsgUpdateMoveParams.ts @@ -4,6 +4,9 @@ import { MoveParams } from '../MoveParams' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * MsgUpdateMoveParams defines an operation for updating the move module parameters. + */ export class MsgUpdateMoveParams extends JSONSerializable< MsgUpdateMoveParams.Amino, MsgUpdateMoveParams.Data, @@ -11,7 +14,7 @@ export class MsgUpdateMoveParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/move parameters to update + * @param params the move parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/move/msgs/MsgWhitelist.ts b/src/core/move/msgs/MsgWhitelist.ts index 5143e9c..763e234 100644 --- a/src/core/move/msgs/MsgWhitelist.ts +++ b/src/core/move/msgs/MsgWhitelist.ts @@ -3,6 +3,12 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgWhitelist as MsgWhitelist_pb } from '@initia/initia.proto/initia/move/v1/tx' +/** + * MsgWhitelist registers a dex pair to whitelist of various features. + * - whitelist from coin register operation + * - allow counter party denom can be used as gas fee + * - register lp denom as staking denom + */ export class MsgWhitelist extends JSONSerializable< MsgWhitelist.Amino, MsgWhitelist.Data, diff --git a/src/core/mstaking/msgs/MsgUpdateMstakingParams.ts b/src/core/mstaking/msgs/MsgUpdateMstakingParams.ts index fbe3821..8079549 100644 --- a/src/core/mstaking/msgs/MsgUpdateMstakingParams.ts +++ b/src/core/mstaking/msgs/MsgUpdateMstakingParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateMstakingParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/mstaking parameters to update + * @param params the mstaking parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/opchild/BridgeInfo.ts b/src/core/opchild/BridgeInfo.ts index a4539ea..f1ccb25 100644 --- a/src/core/opchild/BridgeInfo.ts +++ b/src/core/opchild/BridgeInfo.ts @@ -2,6 +2,9 @@ import { JSONSerializable } from '../../util/json' import { BridgeInfo as BridgeInfo_pb } from '@initia/opinit.proto/opinit/opchild/v1/types' import { BridgeConfig } from '../ophost' +/** + * BridgeInfo defines the information of the bridge. + */ export class BridgeInfo extends JSONSerializable< BridgeInfo.Amino, BridgeInfo.Data, diff --git a/src/core/opchild/OpValidator.ts b/src/core/opchild/OpValidator.ts index 5fa19fa..f326a05 100644 --- a/src/core/opchild/OpValidator.ts +++ b/src/core/opchild/OpValidator.ts @@ -4,6 +4,16 @@ import { ValConsPublicKey } from '../PublicKey' import { Validator as Validator_pb } from '@initia/opinit.proto/opinit/opchild/v1/types' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * OpValidator defines a validator, together with the total amount of the + * OpValidator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ export class OpValidator extends JSONSerializable< OpValidator.Amino, OpValidator.Data, diff --git a/src/core/opchild/OpchildParams.ts b/src/core/opchild/OpchildParams.ts index 09ccc7f..5adbd09 100644 --- a/src/core/opchild/OpchildParams.ts +++ b/src/core/opchild/OpchildParams.ts @@ -3,6 +3,9 @@ import { Coins } from '../Coins' import { AccAddress } from '../bech32' import { Params as Params_pb } from '@initia/opinit.proto/opinit/opchild/v1/types' +/** + * OpchildParams defines the set of opchild parameters. + */ export class OpchildParams extends JSONSerializable< OpchildParams.Amino, OpchildParams.Data, diff --git a/src/core/opchild/msgs/MsgAddValidator.ts b/src/core/opchild/msgs/MsgAddValidator.ts index 670f82c..6cddfb9 100644 --- a/src/core/opchild/msgs/MsgAddValidator.ts +++ b/src/core/opchild/msgs/MsgAddValidator.ts @@ -4,6 +4,9 @@ import { ValConsPublicKey } from '../../PublicKey' import { MsgAddValidator as MsgAddValidator_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgAddValidator defines a SDK message for adding a new validator. + */ export class MsgAddValidator extends JSONSerializable< MsgAddValidator.Amino, MsgAddValidator.Data, diff --git a/src/core/opchild/msgs/MsgExecuteMessages.ts b/src/core/opchild/msgs/MsgExecuteMessages.ts index 8a1af07..c146178 100644 --- a/src/core/opchild/msgs/MsgExecuteMessages.ts +++ b/src/core/opchild/msgs/MsgExecuteMessages.ts @@ -4,6 +4,9 @@ import { Msg } from '../../Msg' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgExecuteMessages as MsgExecuteMessages_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' +/** + * MsgExecuteMessages is a message to execute the given authority messages with validator permission. + */ export class MsgExecuteMessages extends JSONSerializable< MsgExecuteMessages.Amino, MsgExecuteMessages.Data, diff --git a/src/core/opchild/msgs/MsgFinalizeTokenDeposit.ts b/src/core/opchild/msgs/MsgFinalizeTokenDeposit.ts index 35a1612..4c2f9a3 100644 --- a/src/core/opchild/msgs/MsgFinalizeTokenDeposit.ts +++ b/src/core/opchild/msgs/MsgFinalizeTokenDeposit.ts @@ -5,6 +5,9 @@ import { Denom } from '../../Denom' import { MsgFinalizeTokenDeposit as MsgFinalizeTokenDeposit_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgFinalizeTokenDeposit is a message to submit deposit funds from upper layer. + */ export class MsgFinalizeTokenDeposit extends JSONSerializable< MsgFinalizeTokenDeposit.Amino, MsgFinalizeTokenDeposit.Data, diff --git a/src/core/opchild/msgs/MsgInitiateTokenWithdrawal.ts b/src/core/opchild/msgs/MsgInitiateTokenWithdrawal.ts index 32075b6..09bb3ae 100644 --- a/src/core/opchild/msgs/MsgInitiateTokenWithdrawal.ts +++ b/src/core/opchild/msgs/MsgInitiateTokenWithdrawal.ts @@ -4,6 +4,9 @@ import { Coin } from '../../Coin' import { MsgInitiateTokenWithdrawal as MsgInitiateTokenWithdrawal_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgInitiateTokenWithdrawal is a message to withdraw a new token from L2 to L1. + */ export class MsgInitiateTokenWithdrawal extends JSONSerializable< MsgInitiateTokenWithdrawal.Amino, MsgInitiateTokenWithdrawal.Data, diff --git a/src/core/opchild/msgs/MsgRemoveValidator.ts b/src/core/opchild/msgs/MsgRemoveValidator.ts index 34e6923..2e48544 100644 --- a/src/core/opchild/msgs/MsgRemoveValidator.ts +++ b/src/core/opchild/msgs/MsgRemoveValidator.ts @@ -3,6 +3,9 @@ import { AccAddress, ValAddress } from '../../bech32' import { MsgRemoveValidator as MsgRemoveValidator_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgRemoveValidator is a message to remove a validator from designated list. + */ export class MsgRemoveValidator extends JSONSerializable< MsgRemoveValidator.Amino, MsgRemoveValidator.Data, diff --git a/src/core/opchild/msgs/MsgSetBridgeInfo.ts b/src/core/opchild/msgs/MsgSetBridgeInfo.ts index 9aab80e..c47cd08 100644 --- a/src/core/opchild/msgs/MsgSetBridgeInfo.ts +++ b/src/core/opchild/msgs/MsgSetBridgeInfo.ts @@ -4,6 +4,9 @@ import { BridgeInfo } from '../BridgeInfo' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgSetBridgeInfo as MsgSetBridgeInfo_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' +/** + * MsgSetBridgeInfo is a message to set the registered bridge information. + */ export class MsgSetBridgeInfo extends JSONSerializable< MsgSetBridgeInfo.Amino, MsgSetBridgeInfo.Data, diff --git a/src/core/opchild/msgs/MsgSpendFeePool.ts b/src/core/opchild/msgs/MsgSpendFeePool.ts index 8ecda5f..3a123db 100644 --- a/src/core/opchild/msgs/MsgSpendFeePool.ts +++ b/src/core/opchild/msgs/MsgSpendFeePool.ts @@ -4,6 +4,9 @@ import { Coins } from '../../Coins' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgSpendFeePool as MsgSpendFeePool_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' +/** + * MsgSpendFeePool is a message to withdraw collected fees from the module account to the recipient address. + */ export class MsgSpendFeePool extends JSONSerializable< MsgSpendFeePool.Amino, MsgSpendFeePool.Data, diff --git a/src/core/opchild/msgs/MsgUpdateOpchildParams.ts b/src/core/opchild/msgs/MsgUpdateOpchildParams.ts index 3d7c1a2..d01926c 100644 --- a/src/core/opchild/msgs/MsgUpdateOpchildParams.ts +++ b/src/core/opchild/msgs/MsgUpdateOpchildParams.ts @@ -4,6 +4,9 @@ import { OpchildParams } from '../OpchildParams' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' +/** + * MsgUpdateOpchildParams defines an operation for updating the opchild module parameters. + */ export class MsgUpdateOpchildParams extends JSONSerializable< MsgUpdateOpchildParams.Amino, MsgUpdateOpchildParams.Data, @@ -11,7 +14,7 @@ export class MsgUpdateOpchildParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/move parameters to update + * @param params the opchild parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/opchild/msgs/MsgUpdateOracle.ts b/src/core/opchild/msgs/MsgUpdateOracle.ts index c2dc86c..4fb9b85 100644 --- a/src/core/opchild/msgs/MsgUpdateOracle.ts +++ b/src/core/opchild/msgs/MsgUpdateOracle.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { MsgUpdateOracle as MsgUpdateOracle_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgUpdateOracle is a message to update oracle prices which contains L1 extended commits for oracle. + */ export class MsgUpdateOracle extends JSONSerializable< MsgUpdateOracle.Amino, MsgUpdateOracle.Data, diff --git a/src/core/ophost/BatchInfo.ts b/src/core/ophost/BatchInfo.ts index 72b6352..a50ca49 100644 --- a/src/core/ophost/BatchInfo.ts +++ b/src/core/ophost/BatchInfo.ts @@ -7,6 +7,9 @@ import { batchInfo_ChainTypeToJSON as chainTypeToJSON, } from '@initia/opinit.proto/opinit/ophost/v1/types' +/** + * BatchInfo defines the set of batch information. + */ export class BatchInfo extends JSONSerializable< BatchInfo.Amino, BatchInfo.Data, diff --git a/src/core/ophost/BatchInfoWithOutput.ts b/src/core/ophost/BatchInfoWithOutput.ts index e8a2f17..895a537 100644 --- a/src/core/ophost/BatchInfoWithOutput.ts +++ b/src/core/ophost/BatchInfoWithOutput.ts @@ -3,6 +3,9 @@ import { BatchInfoWithOutput as BatchInfoWithOutput_pb } from '@initia/opinit.pr import { BatchInfo } from './BatchInfo' import { Output } from './Output' +/** + * BatchInfoWithOutput defines the batch information with output. + */ export class BatchInfoWithOutput extends JSONSerializable< BatchInfoWithOutput.Amino, BatchInfoWithOutput.Data, diff --git a/src/core/ophost/BridgeConfig.ts b/src/core/ophost/BridgeConfig.ts index 6a3a582..fcfb1a6 100644 --- a/src/core/ophost/BridgeConfig.ts +++ b/src/core/ophost/BridgeConfig.ts @@ -4,6 +4,9 @@ import { Duration } from '../Duration' import { BridgeConfig as BridgeConfig_pb } from '@initia/opinit.proto/opinit/ophost/v1/types' import { BatchInfo } from './BatchInfo' +/** + * BridgeConfig defines the set of bridge config. + */ export class BridgeConfig extends JSONSerializable< BridgeConfig.Amino, BridgeConfig.Data, diff --git a/src/core/ophost/OphostParams.ts b/src/core/ophost/OphostParams.ts index 76d7baa..d08ee68 100644 --- a/src/core/ophost/OphostParams.ts +++ b/src/core/ophost/OphostParams.ts @@ -2,6 +2,9 @@ import { JSONSerializable } from '../../util/json' import { Coins } from '../Coins' import { Params as Params_pb } from '@initia/opinit.proto/opinit/ophost/v1/types' +/** + * OphostParams defines the set of ophost parameters. + */ export class OphostParams extends JSONSerializable< OphostParams.Amino, OphostParams.Data, diff --git a/src/core/ophost/Output.ts b/src/core/ophost/Output.ts index 37f95aa..4685497 100644 --- a/src/core/ophost/Output.ts +++ b/src/core/ophost/Output.ts @@ -1,6 +1,9 @@ import { JSONSerializable } from '../../util/json' import { Output as Output_pb } from '@initia/opinit.proto/opinit/ophost/v1/types' +/** + * Output is a l2 block submitted by proposer. + */ export class Output extends JSONSerializable< Output.Amino, Output.Data, diff --git a/src/core/ophost/msgs/MsgCreateBridge.ts b/src/core/ophost/msgs/MsgCreateBridge.ts index e242e88..0ffbdc2 100644 --- a/src/core/ophost/msgs/MsgCreateBridge.ts +++ b/src/core/ophost/msgs/MsgCreateBridge.ts @@ -4,6 +4,9 @@ import { BridgeConfig } from '../BridgeConfig' import { MsgCreateBridge as MsgCreateBridge_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgCreateBridge is a message to register a new bridge with new bridge id. + */ export class MsgCreateBridge extends JSONSerializable< MsgCreateBridge.Amino, MsgCreateBridge.Data, diff --git a/src/core/ophost/msgs/MsgDeleteOutput.ts b/src/core/ophost/msgs/MsgDeleteOutput.ts index 2adaa73..1bc1da2 100644 --- a/src/core/ophost/msgs/MsgDeleteOutput.ts +++ b/src/core/ophost/msgs/MsgDeleteOutput.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { MsgDeleteOutput as MsgDeleteOutput_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgDeleteOutput is a message to delete unfinalized l2 output proposals. + */ export class MsgDeleteOutput extends JSONSerializable< MsgDeleteOutput.Amino, MsgDeleteOutput.Data, diff --git a/src/core/ophost/msgs/MsgFinalizeTokenWithdrawal.ts b/src/core/ophost/msgs/MsgFinalizeTokenWithdrawal.ts index dc91b5a..18d4267 100644 --- a/src/core/ophost/msgs/MsgFinalizeTokenWithdrawal.ts +++ b/src/core/ophost/msgs/MsgFinalizeTokenWithdrawal.ts @@ -4,6 +4,9 @@ import { Coin } from '../../Coin' import { MsgFinalizeTokenWithdrawal as MsgFinalizeTokenWithdrawal_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgFinalizeTokenWithdrawal is a message finalizing funds withdrawal from L2. + */ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< MsgFinalizeTokenWithdrawal.Amino, MsgFinalizeTokenWithdrawal.Data, diff --git a/src/core/ophost/msgs/MsgInitiateTokenDeposit.ts b/src/core/ophost/msgs/MsgInitiateTokenDeposit.ts index bd21b42..b771081 100644 --- a/src/core/ophost/msgs/MsgInitiateTokenDeposit.ts +++ b/src/core/ophost/msgs/MsgInitiateTokenDeposit.ts @@ -4,6 +4,9 @@ import { Coin } from '../../Coin' import { MsgInitiateTokenDeposit as MsgInitiateTokenDeposit_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgInitiateTokenDeposit is a message to deposit a new token from L1 to L2. + */ export class MsgInitiateTokenDeposit extends JSONSerializable< MsgInitiateTokenDeposit.Amino, MsgInitiateTokenDeposit.Data, diff --git a/src/core/ophost/msgs/MsgProposeOutput.ts b/src/core/ophost/msgs/MsgProposeOutput.ts index 78bee77..132427e 100644 --- a/src/core/ophost/msgs/MsgProposeOutput.ts +++ b/src/core/ophost/msgs/MsgProposeOutput.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { MsgProposeOutput as MsgProposeOutput_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgProposeOutput is a message to submit l2 block proposal. + */ export class MsgProposeOutput extends JSONSerializable< MsgProposeOutput.Amino, MsgProposeOutput.Data, diff --git a/src/core/ophost/msgs/MsgRecordBatch.ts b/src/core/ophost/msgs/MsgRecordBatch.ts index e308458..ca52a9b 100644 --- a/src/core/ophost/msgs/MsgRecordBatch.ts +++ b/src/core/ophost/msgs/MsgRecordBatch.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { MsgRecordBatch as MsgRecordBatch_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgRecordBatch is no_op message, which is only for tx indexing. + */ export class MsgRecordBatch extends JSONSerializable< MsgRecordBatch.Amino, MsgRecordBatch.Data, diff --git a/src/core/ophost/msgs/MsgUpdateBatchInfo.ts b/src/core/ophost/msgs/MsgUpdateBatchInfo.ts index c5033de..3ed8b79 100644 --- a/src/core/ophost/msgs/MsgUpdateBatchInfo.ts +++ b/src/core/ophost/msgs/MsgUpdateBatchInfo.ts @@ -4,6 +4,9 @@ import { MsgUpdateBatchInfo as MsgUpdateBatchInfo_pb } from '@initia/opinit.prot import { Any } from '@initia/initia.proto/google/protobuf/any' import { BatchInfo } from '../BatchInfo' +/** + * MsgUpdateBatchInfo is a message to change a batch info. + */ export class MsgUpdateBatchInfo extends JSONSerializable< MsgUpdateBatchInfo.Amino, MsgUpdateBatchInfo.Data, diff --git a/src/core/ophost/msgs/MsgUpdateChallenger.ts b/src/core/ophost/msgs/MsgUpdateChallenger.ts index 682e922..5d9c497 100644 --- a/src/core/ophost/msgs/MsgUpdateChallenger.ts +++ b/src/core/ophost/msgs/MsgUpdateChallenger.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { MsgUpdateChallenger as MsgUpdateChallenger_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgUpdateChallenger is a message to change a challenger. + */ export class MsgUpdateChallenger extends JSONSerializable< MsgUpdateChallenger.Amino, MsgUpdateChallenger.Data, diff --git a/src/core/ophost/msgs/MsgUpdateMetadata.ts b/src/core/ophost/msgs/MsgUpdateMetadata.ts index 15131d6..83de0e9 100644 --- a/src/core/ophost/msgs/MsgUpdateMetadata.ts +++ b/src/core/ophost/msgs/MsgUpdateMetadata.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { MsgUpdateMetadata as MsgUpdateMetadata_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgUpdateMetadata is a message to change metadata. + */ export class MsgUpdateMetadata extends JSONSerializable< MsgUpdateMetadata.Amino, MsgUpdateMetadata.Data, diff --git a/src/core/ophost/msgs/MsgUpdateOphostParams.ts b/src/core/ophost/msgs/MsgUpdateOphostParams.ts index b10664e..dea4b6b 100644 --- a/src/core/ophost/msgs/MsgUpdateOphostParams.ts +++ b/src/core/ophost/msgs/MsgUpdateOphostParams.ts @@ -4,6 +4,9 @@ import { OphostParams } from '../OphostParams' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +/** + * MsgUpdateOphostParams defines an operation for updating the ophost module parameters. + */ export class MsgUpdateOphostParams extends JSONSerializable< MsgUpdateOphostParams.Amino, MsgUpdateOphostParams.Data, @@ -11,7 +14,7 @@ export class MsgUpdateOphostParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/move parameters to update + * @param params the move parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/ophost/msgs/MsgUpdateOracleConfig.ts b/src/core/ophost/msgs/MsgUpdateOracleConfig.ts index 43b1946..64de4b3 100644 --- a/src/core/ophost/msgs/MsgUpdateOracleConfig.ts +++ b/src/core/ophost/msgs/MsgUpdateOracleConfig.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { MsgUpdateOracleConfig as MsgUpdateOracleConfig_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgUpdateOracleConfig is a message to change oracle config. + */ export class MsgUpdateOracleConfig extends JSONSerializable< MsgUpdateOracleConfig.Amino, MsgUpdateOracleConfig.Data, diff --git a/src/core/ophost/msgs/MsgUpdateProposer.ts b/src/core/ophost/msgs/MsgUpdateProposer.ts index 66301b3..4273bd4 100644 --- a/src/core/ophost/msgs/MsgUpdateProposer.ts +++ b/src/core/ophost/msgs/MsgUpdateProposer.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { MsgUpdateProposer as MsgUpdateProposer_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' import { Any } from '@initia/initia.proto/google/protobuf/any' +/** + * MsgUpdateProposer is a message to change a proposer. + */ export class MsgUpdateProposer extends JSONSerializable< MsgUpdateProposer.Amino, MsgUpdateProposer.Data, diff --git a/src/core/reward/msgs/MsgUpdateRewardParams.ts b/src/core/reward/msgs/MsgUpdateRewardParams.ts index 8b549b4..3d47dd6 100644 --- a/src/core/reward/msgs/MsgUpdateRewardParams.ts +++ b/src/core/reward/msgs/MsgUpdateRewardParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateRewardParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/reward parameters to update + * @param params the reward parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/slashing/msgs/MsgUpdateSlashingParams.ts b/src/core/slashing/msgs/MsgUpdateSlashingParams.ts index 0887c1a..820690d 100644 --- a/src/core/slashing/msgs/MsgUpdateSlashingParams.ts +++ b/src/core/slashing/msgs/MsgUpdateSlashingParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateSlashingParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/slashing parameters to update + * @param params the slashing parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/tokenfactory/TokenfactoryParams.ts b/src/core/tokenfactory/TokenfactoryParams.ts index 928600b..8e422db 100644 --- a/src/core/tokenfactory/TokenfactoryParams.ts +++ b/src/core/tokenfactory/TokenfactoryParams.ts @@ -2,6 +2,9 @@ import { JSONSerializable } from '../../util/json' import { Coins } from '../Coins' import { Params as Params_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/params' +/** + * TokenfactoryParams defines the set of tokenfactory parameters. + */ export class TokenfactoryParams extends JSONSerializable< TokenfactoryParams.Amino, TokenfactoryParams.Data, diff --git a/src/core/tokenfactory/msgs/MsgBurn.ts b/src/core/tokenfactory/msgs/MsgBurn.ts index dbcff42..01de119 100644 --- a/src/core/tokenfactory/msgs/MsgBurn.ts +++ b/src/core/tokenfactory/msgs/MsgBurn.ts @@ -4,6 +4,11 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgBurn as MsgBurn_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' +/** + * MsgBurn allows an admin account to burn a token. + * Only the admin of the token factory denom has permission to burn unless + * the denom does not have any admin. + */ export class MsgBurn extends JSONSerializable< MsgBurn.Amino, MsgBurn.Data, diff --git a/src/core/tokenfactory/msgs/MsgChangeAdmin.ts b/src/core/tokenfactory/msgs/MsgChangeAdmin.ts index 0b51136..0af3914 100644 --- a/src/core/tokenfactory/msgs/MsgChangeAdmin.ts +++ b/src/core/tokenfactory/msgs/MsgChangeAdmin.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgChangeAdmin as MsgChangeAdmin_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' +/** + * MsgChangeAdmin allows an admin account to reassign adminship of a denom to a new account. + */ export class MsgChangeAdmin extends JSONSerializable< MsgChangeAdmin.Amino, MsgChangeAdmin.Data, diff --git a/src/core/tokenfactory/msgs/MsgCreateDenom.ts b/src/core/tokenfactory/msgs/MsgCreateDenom.ts index 0ca3215..39162cd 100644 --- a/src/core/tokenfactory/msgs/MsgCreateDenom.ts +++ b/src/core/tokenfactory/msgs/MsgCreateDenom.ts @@ -3,6 +3,16 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgCreateDenom as MsgCreateDenom_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' +/** + * MsgCreateDenom allows an account to create a new denom. It requires a sender + * address and a sub denomination. The (sender_address, sub_denomination) tuple + * must be unique and cannot be re-used. + * + * The resulting denom created is defined as + * . The resulting denom's admin is + * originally set to be the creator, but this can be changed later. The token + * denom does not indicate the current admin. + */ export class MsgCreateDenom extends JSONSerializable< MsgCreateDenom.Amino, MsgCreateDenom.Data, diff --git a/src/core/tokenfactory/msgs/MsgForceTransfer.ts b/src/core/tokenfactory/msgs/MsgForceTransfer.ts index aaa522f..87de3a9 100644 --- a/src/core/tokenfactory/msgs/MsgForceTransfer.ts +++ b/src/core/tokenfactory/msgs/MsgForceTransfer.ts @@ -4,6 +4,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgForceTransfer as MsgForceTransfer_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' +/** + * MsgForceTransfer allows an admin account to transfer a token from one account to another. + */ export class MsgForceTransfer extends JSONSerializable< MsgForceTransfer.Amino, MsgForceTransfer.Data, diff --git a/src/core/tokenfactory/msgs/MsgMint.ts b/src/core/tokenfactory/msgs/MsgMint.ts index 0b085df..f0c9371 100644 --- a/src/core/tokenfactory/msgs/MsgMint.ts +++ b/src/core/tokenfactory/msgs/MsgMint.ts @@ -4,6 +4,11 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgMint as MsgMint_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' +/** + * MsgMint allows an admin account to mint more of a token. + * Only the admin of the token factory denom has permission to mint unless + * the denom does not have any admin. + */ export class MsgMint extends JSONSerializable< MsgMint.Amino, MsgMint.Data, diff --git a/src/core/tokenfactory/msgs/MsgSetBeforeSendHook.ts b/src/core/tokenfactory/msgs/MsgSetBeforeSendHook.ts index d1c41f5..88d470d 100644 --- a/src/core/tokenfactory/msgs/MsgSetBeforeSendHook.ts +++ b/src/core/tokenfactory/msgs/MsgSetBeforeSendHook.ts @@ -3,6 +3,9 @@ import { AccAddress } from '../../bech32' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgSetBeforeSendHook as MsgSetBeforeSendHook_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' +/** + * MsgSetBeforeSendHook allows an admin account to assign a CosmWasm contract to call with a BeforeSend hook. + */ export class MsgSetBeforeSendHook extends JSONSerializable< MsgSetBeforeSendHook.Amino, MsgSetBeforeSendHook.Data, diff --git a/src/core/tokenfactory/msgs/MsgSetDenomMetadataWasm.ts b/src/core/tokenfactory/msgs/MsgSetDenomMetadataWasm.ts index 039046b..98f1f07 100644 --- a/src/core/tokenfactory/msgs/MsgSetDenomMetadataWasm.ts +++ b/src/core/tokenfactory/msgs/MsgSetDenomMetadataWasm.ts @@ -4,6 +4,9 @@ import { DenomMetadata } from '../../bank/DenomMetadata' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgSetDenomMetadata as MsgSetDenomMetadata_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' +/** + * MsgSetDenomMetadataWasm allows an admin account to set the denom's bank metadata. + */ export class MsgSetDenomMetadataWasm extends JSONSerializable< MsgSetDenomMetadataWasm.Amino, MsgSetDenomMetadataWasm.Data, diff --git a/src/core/tokenfactory/msgs/MsgUpdateTokenfactoryParams.ts b/src/core/tokenfactory/msgs/MsgUpdateTokenfactoryParams.ts index 83942ee..d5a4373 100644 --- a/src/core/tokenfactory/msgs/MsgUpdateTokenfactoryParams.ts +++ b/src/core/tokenfactory/msgs/MsgUpdateTokenfactoryParams.ts @@ -4,6 +4,9 @@ import { TokenfactoryParams } from '../TokenfactoryParams' import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' +/** + * MsgUpdateTokenfactoryParams defines an operation for updating the tokenfactory module parameters. + */ export class MsgUpdateTokenfactoryParams extends JSONSerializable< MsgUpdateTokenfactoryParams.Amino, MsgUpdateTokenfactoryParams.Data, @@ -11,7 +14,7 @@ export class MsgUpdateTokenfactoryParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/tokenfactory parameters to update + * @param params the tokenfactory parameters to update */ constructor( public authority: AccAddress, diff --git a/src/core/wasm/msgs/MsgUpdateWasmParams.ts b/src/core/wasm/msgs/MsgUpdateWasmParams.ts index 9cd0d38..e37b8dc 100644 --- a/src/core/wasm/msgs/MsgUpdateWasmParams.ts +++ b/src/core/wasm/msgs/MsgUpdateWasmParams.ts @@ -11,7 +11,7 @@ export class MsgUpdateWasmParams extends JSONSerializable< > { /** * @param authority the address that controls the module - * @param params params defines the x/move parameters to update + * @param params the move parameters to update */ constructor( public authority: AccAddress,