From c3dad4231d044bd387a6bc1345106afd6ecc79e5 Mon Sep 17 00:00:00 2001 From: Mark Sinclair Date: Fri, 24 Oct 2025 23:23:41 +0100 Subject: [PATCH] ts-sdk: contract clients: update and re-run autogen --- .../codegen/contract-clients/build.mjs | 4 +- .../codegen/contract-clients/package.json | 2 +- .../contract-clients/src/CoconutDkg.client.ts | 485 ++++++- .../contract-clients/src/CoconutDkg.types.ts | 255 +++- .../src/Cw3FlexMultisig.client.ts | 89 +- .../src/Cw3FlexMultisig.types.ts | 100 +- .../contract-clients/src/Cw4Group.client.ts | 45 +- .../contract-clients/src/Cw4Group.types.ts | 2 +- .../contract-clients/src/Ecash.client.ts | 256 ++++ .../contract-clients/src/Ecash.types.ts | 106 ++ .../contract-clients/src/Mixnet.client.ts | 1263 +++++++++-------- .../contract-clients/src/Mixnet.types.ts | 577 +++++--- .../contract-clients/src/Vesting.client.ts | 287 ++-- .../contract-clients/src/Vesting.types.ts | 41 +- .../contract-clients/src/baseClient.ts | 200 +++ .../codegen/contract-clients/src/index.ts | 77 +- 16 files changed, 2519 insertions(+), 1270 deletions(-) create mode 100644 sdk/typescript/codegen/contract-clients/src/Ecash.client.ts create mode 100644 sdk/typescript/codegen/contract-clients/src/Ecash.types.ts create mode 100644 sdk/typescript/codegen/contract-clients/src/baseClient.ts diff --git a/sdk/typescript/codegen/contract-clients/build.mjs b/sdk/typescript/codegen/contract-clients/build.mjs index 5a6b6220f6..ffc5cd4005 100644 --- a/sdk/typescript/codegen/contract-clients/build.mjs +++ b/sdk/typescript/codegen/contract-clients/build.mjs @@ -3,13 +3,11 @@ import codegen from '@cosmwasm/ts-codegen'; codegen .default({ contracts: [ - { name: 'coconut-bandwidth', dir: '../../../../contracts/coconut-bandwidth' }, + { name: 'ecash', dir: '../../../../contracts/ecash' }, { name: 'coconut-dkg', dir: '../../../../contracts/coconut-dkg' }, { name: 'mixnet', dir: '../../../../contracts/mixnet' }, { name: 'cw3-flex-multisig', dir: '../../../../contracts/multisig/cw3-flex-multisig' }, { name: 'cw4-group', dir: '../../../../contracts/multisig/cw4-group' }, - { name: 'name-service', dir: '../../../../contracts/name-service' }, - { name: 'service-provider-directory', dir: '../../../../contracts/service-provider-directory' }, { name: 'vesting', dir: '../../../../contracts/vesting' }, ], outPath: './src', diff --git a/sdk/typescript/codegen/contract-clients/package.json b/sdk/typescript/codegen/contract-clients/package.json index c4239a36e3..e12df7ee69 100644 --- a/sdk/typescript/codegen/contract-clients/package.json +++ b/sdk/typescript/codegen/contract-clients/package.json @@ -18,7 +18,7 @@ "docs:watch": "nodemon --ext ts --watch './src/**/*' --watch './typedoc.json' --exec \"yarn docs:generate\"" }, "devDependencies": { - "@cosmwasm/ts-codegen": "^0.35.3", + "@cosmwasm/ts-codegen": "^1.13.3", "nodemon": "3.0.1", "npm-run-all": "^4.1.5", "reload": "^3.2.1", diff --git a/sdk/typescript/codegen/contract-clients/src/CoconutDkg.client.ts b/sdk/typescript/codegen/contract-clients/src/CoconutDkg.client.ts index c86b48d22c..cb960c87c0 100644 --- a/sdk/typescript/codegen/contract-clients/src/CoconutDkg.client.ts +++ b/sdk/typescript/codegen/contract-clients/src/CoconutDkg.client.ts @@ -1,23 +1,58 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { Coin, StdFee } from "@cosmjs/amino"; -import { InstantiateMsg, TimeConfiguration, ExecuteMsg, ContractSafeBytes, Addr, QueryMsg, MigrateMsg, PagedDealerResponse, DealerDetails, Timestamp, Uint64, EpochState, Epoch, DealerType, DealerDetailsResponse, PagedDealingsResponse, ContractDealing, NullableInitialReplacementData, InitialReplacementData, PagedVKSharesResponse, ContractVKShare } from "./CoconutDkg.types"; - +import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient"; +import { Coin, StdFee } from "@interchainjs/types"; +import { InstantiateMsg, TimeConfiguration, ExecuteMsg, ContractSafeBytes, DealingChunkInfo, PartialContractDealing, QueryMsg, MigrateMsg, EpochState, Timestamp, Uint64, StateAdvanceResponse, StateProgress, ContractVersion, Addr, PagedDealerResponse, DealerDetails, Epoch, DealerDealingsStatusResponse, DealerType, DealerDetailsResponse, PagedDealerIndexResponse, DealingChunkResponse, DealingChunkStatusResponse, ChunkSubmissionStatus, DealingStatusResponse, DealingStatus, DealingMetadataResponse, DealingMetadata, PagedDealerAddressesResponse, NullableEpoch, RegisteredDealerDetails, DealerRegistrationDetails, Cw4Contract, State, VkShareResponse, ContractVKShare, PagedVKSharesResponse } from "./CoconutDkg.types"; export interface CoconutDkgReadOnlyInterface { contractAddress: string; + getState: () => Promise; getCurrentEpochState: () => Promise; + getEpochStateAtHeight: ({ + height + }: { + height: number; + }) => Promise; getCurrentEpochThreshold: () => Promise; - getInitialDealers: () => Promise; + getEpochThreshold: ({ + epochId + }: { + epochId: number; + }) => Promise; + canAdvanceState: () => Promise; + getRegisteredDealer: ({ + dealerAddress, + epochId + }: { + dealerAddress: string; + epochId?: number; + }) => Promise; getDealerDetails: ({ dealerAddress }: { dealerAddress: string; }) => Promise; + getEpochDealersAddresses: ({ + epochId, + limit, + startAfter + }: { + epochId: number; + limit?: number; + startAfter?: string; + }) => Promise; + getEpochDealers: ({ + epochId, + limit, + startAfter + }: { + epochId: number; + limit?: number; + startAfter?: string; + }) => Promise; getCurrentDealers: ({ limit, startAfter @@ -25,22 +60,67 @@ export interface CoconutDkgReadOnlyInterface { limit?: number; startAfter?: string; }) => Promise; - getPastDealers: ({ + getDealerIndices: ({ limit, startAfter }: { limit?: number; startAfter?: string; - }) => Promise; - getDealing: ({ - idx, - limit, - startAfter + }) => Promise; + getDealingsMetadata: ({ + dealer, + dealingIndex, + epochId }: { - idx: number; - limit?: number; - startAfter?: string; - }) => Promise; + dealer: string; + dealingIndex: number; + epochId: number; + }) => Promise; + getDealerDealingsStatus: ({ + dealer, + epochId + }: { + dealer: string; + epochId: number; + }) => Promise; + getDealingStatus: ({ + dealer, + dealingIndex, + epochId + }: { + dealer: string; + dealingIndex: number; + epochId: number; + }) => Promise; + getDealingChunkStatus: ({ + chunkIndex, + dealer, + dealingIndex, + epochId + }: { + chunkIndex: number; + dealer: string; + dealingIndex: number; + epochId: number; + }) => Promise; + getDealingChunk: ({ + chunkIndex, + dealer, + dealingIndex, + epochId + }: { + chunkIndex: number; + dealer: string; + dealingIndex: number; + epochId: number; + }) => Promise; + getVerificationKey: ({ + epochId, + owner + }: { + epochId: number; + owner: string; + }) => Promise; getVerificationKeys: ({ epochId, limit, @@ -50,37 +130,89 @@ export interface CoconutDkgReadOnlyInterface { limit?: number; startAfter?: string; }) => Promise; + getCw2ContractVersion: () => Promise; } export class CoconutDkgQueryClient implements CoconutDkgReadOnlyInterface { - client: CosmWasmClient; + client: ICosmWasmClient; contractAddress: string; - - constructor(client: CosmWasmClient, contractAddress: string) { + constructor(client: ICosmWasmClient, contractAddress: string) { this.client = client; this.contractAddress = contractAddress; + this.getState = this.getState.bind(this); this.getCurrentEpochState = this.getCurrentEpochState.bind(this); + this.getEpochStateAtHeight = this.getEpochStateAtHeight.bind(this); this.getCurrentEpochThreshold = this.getCurrentEpochThreshold.bind(this); - this.getInitialDealers = this.getInitialDealers.bind(this); + this.getEpochThreshold = this.getEpochThreshold.bind(this); + this.canAdvanceState = this.canAdvanceState.bind(this); + this.getRegisteredDealer = this.getRegisteredDealer.bind(this); this.getDealerDetails = this.getDealerDetails.bind(this); + this.getEpochDealersAddresses = this.getEpochDealersAddresses.bind(this); + this.getEpochDealers = this.getEpochDealers.bind(this); this.getCurrentDealers = this.getCurrentDealers.bind(this); - this.getPastDealers = this.getPastDealers.bind(this); - this.getDealing = this.getDealing.bind(this); + this.getDealerIndices = this.getDealerIndices.bind(this); + this.getDealingsMetadata = this.getDealingsMetadata.bind(this); + this.getDealerDealingsStatus = this.getDealerDealingsStatus.bind(this); + this.getDealingStatus = this.getDealingStatus.bind(this); + this.getDealingChunkStatus = this.getDealingChunkStatus.bind(this); + this.getDealingChunk = this.getDealingChunk.bind(this); + this.getVerificationKey = this.getVerificationKey.bind(this); this.getVerificationKeys = this.getVerificationKeys.bind(this); + this.getCw2ContractVersion = this.getCw2ContractVersion.bind(this); } - + getState = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_state: {} + }); + }; getCurrentEpochState = async (): Promise => { return this.client.queryContractSmart(this.contractAddress, { get_current_epoch_state: {} }); }; + getEpochStateAtHeight = async ({ + height + }: { + height: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_epoch_state_at_height: { + height + } + }); + }; getCurrentEpochThreshold = async (): Promise => { return this.client.queryContractSmart(this.contractAddress, { get_current_epoch_threshold: {} }); }; - getInitialDealers = async (): Promise => { + getEpochThreshold = async ({ + epochId + }: { + epochId: number; + }): Promise => { return this.client.queryContractSmart(this.contractAddress, { - get_initial_dealers: {} + get_epoch_threshold: { + epoch_id: epochId + } + }); + }; + canAdvanceState = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + can_advance_state: {} + }); + }; + getRegisteredDealer = async ({ + dealerAddress, + epochId + }: { + dealerAddress: string; + epochId?: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_registered_dealer: { + dealer_address: dealerAddress, + epoch_id: epochId + } }); }; getDealerDetails = async ({ @@ -94,6 +226,40 @@ export class CoconutDkgQueryClient implements CoconutDkgReadOnlyInterface { } }); }; + getEpochDealersAddresses = async ({ + epochId, + limit, + startAfter + }: { + epochId: number; + limit?: number; + startAfter?: string; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_epoch_dealers_addresses: { + epoch_id: epochId, + limit, + start_after: startAfter + } + }); + }; + getEpochDealers = async ({ + epochId, + limit, + startAfter + }: { + epochId: number; + limit?: number; + startAfter?: string; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_epoch_dealers: { + epoch_id: epochId, + limit, + start_after: startAfter + } + }); + }; getCurrentDealers = async ({ limit, startAfter @@ -108,34 +274,119 @@ export class CoconutDkgQueryClient implements CoconutDkgReadOnlyInterface { } }); }; - getPastDealers = async ({ + getDealerIndices = async ({ limit, startAfter }: { limit?: number; startAfter?: string; - }): Promise => { + }): Promise => { return this.client.queryContractSmart(this.contractAddress, { - get_past_dealers: { + get_dealer_indices: { limit, start_after: startAfter } }); }; - getDealing = async ({ - idx, - limit, - startAfter + getDealingsMetadata = async ({ + dealer, + dealingIndex, + epochId }: { - idx: number; - limit?: number; - startAfter?: string; - }): Promise => { + dealer: string; + dealingIndex: number; + epochId: number; + }): Promise => { return this.client.queryContractSmart(this.contractAddress, { - get_dealing: { - idx, - limit, - start_after: startAfter + get_dealings_metadata: { + dealer, + dealing_index: dealingIndex, + epoch_id: epochId + } + }); + }; + getDealerDealingsStatus = async ({ + dealer, + epochId + }: { + dealer: string; + epochId: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_dealer_dealings_status: { + dealer, + epoch_id: epochId + } + }); + }; + getDealingStatus = async ({ + dealer, + dealingIndex, + epochId + }: { + dealer: string; + dealingIndex: number; + epochId: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_dealing_status: { + dealer, + dealing_index: dealingIndex, + epoch_id: epochId + } + }); + }; + getDealingChunkStatus = async ({ + chunkIndex, + dealer, + dealingIndex, + epochId + }: { + chunkIndex: number; + dealer: string; + dealingIndex: number; + epochId: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_dealing_chunk_status: { + chunk_index: chunkIndex, + dealer, + dealing_index: dealingIndex, + epoch_id: epochId + } + }); + }; + getDealingChunk = async ({ + chunkIndex, + dealer, + dealingIndex, + epochId + }: { + chunkIndex: number; + dealer: string; + dealingIndex: number; + epochId: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_dealing_chunk: { + chunk_index: chunkIndex, + dealer, + dealing_index: dealingIndex, + epoch_id: epochId + } + }); + }; + getVerificationKey = async ({ + epochId, + owner + }: { + epochId: number; + owner: string; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_verification_key: { + epoch_id: epochId, + owner } }); }; @@ -156,91 +407,142 @@ export class CoconutDkgQueryClient implements CoconutDkgReadOnlyInterface { } }); }; + getCw2ContractVersion = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_cw2_contract_version: {} + }); + }; } export interface CoconutDkgInterface extends CoconutDkgReadOnlyInterface { contractAddress: string; sender: string; + initiateDkg: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; registerDealer: ({ announceAddress, bteKeyWithProof, + identityKey, resharing }: { announceAddress: string; bteKeyWithProof: string; + identityKey: string; resharing: boolean; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - commitDealing: ({ - dealingBytes, + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + commitDealingsMetadata: ({ + chunks, + dealingIndex, resharing }: { - dealingBytes: ContractSafeBytes; + chunks: DealingChunkInfo[]; + dealingIndex: number; resharing: boolean; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + commitDealingsChunk: ({ + chunk + }: { + chunk: PartialContractDealing; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; commitVerificationKeyShare: ({ resharing, share }: { resharing: boolean; share: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; verifyVerificationKeyShare: ({ owner, resharing }: { - owner: Addr; + owner: string; resharing: boolean; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - surpassedThreshold: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - advanceEpochState: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + advanceEpochState: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + triggerReset: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + triggerResharing: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + transferOwnership: ({ + transferTo + }: { + transferTo: string; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + updateAnnounceAddress: ({ + newAddress + }: { + newAddress: string; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; } export class CoconutDkgClient extends CoconutDkgQueryClient implements CoconutDkgInterface { - client: SigningCosmWasmClient; + client: ISigningCosmWasmClient; sender: string; contractAddress: string; - - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) { super(client, contractAddress); this.client = client; this.sender = sender; this.contractAddress = contractAddress; + this.initiateDkg = this.initiateDkg.bind(this); this.registerDealer = this.registerDealer.bind(this); - this.commitDealing = this.commitDealing.bind(this); + this.commitDealingsMetadata = this.commitDealingsMetadata.bind(this); + this.commitDealingsChunk = this.commitDealingsChunk.bind(this); this.commitVerificationKeyShare = this.commitVerificationKeyShare.bind(this); this.verifyVerificationKeyShare = this.verifyVerificationKeyShare.bind(this); - this.surpassedThreshold = this.surpassedThreshold.bind(this); this.advanceEpochState = this.advanceEpochState.bind(this); + this.triggerReset = this.triggerReset.bind(this); + this.triggerResharing = this.triggerResharing.bind(this); + this.transferOwnership = this.transferOwnership.bind(this); + this.updateAnnounceAddress = this.updateAnnounceAddress.bind(this); } - + initiateDkg = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + initiate_dkg: {} + }, fee_, memo_, funds_); + }; registerDealer = async ({ announceAddress, bteKeyWithProof, + identityKey, resharing }: { announceAddress: string; bteKeyWithProof: string; + identityKey: string; resharing: boolean; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { register_dealer: { announce_address: announceAddress, bte_key_with_proof: bteKeyWithProof, + identity_key: identityKey, resharing } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - commitDealing = async ({ - dealingBytes, + commitDealingsMetadata = async ({ + chunks, + dealingIndex, resharing }: { - dealingBytes: ContractSafeBytes; + chunks: DealingChunkInfo[]; + dealingIndex: number; resharing: boolean; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { - commit_dealing: { - dealing_bytes: dealingBytes, + commit_dealings_metadata: { + chunks, + dealing_index: dealingIndex, resharing } - }, fee, memo, _funds); + }, fee_, memo_, funds_); + }; + commitDealingsChunk = async ({ + chunk + }: { + chunk: PartialContractDealing; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + commit_dealings_chunk: { + chunk + } + }, fee_, memo_, funds_); }; commitVerificationKeyShare = async ({ resharing, @@ -248,36 +550,63 @@ export class CoconutDkgClient extends CoconutDkgQueryClient implements CoconutDk }: { resharing: boolean; share: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { commit_verification_key_share: { resharing, share } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; verifyVerificationKeyShare = async ({ owner, resharing }: { - owner: Addr; + owner: string; resharing: boolean; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { verify_verification_key_share: { owner, resharing } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - surpassedThreshold = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - surpassed_threshold: {} - }, fee, memo, _funds); - }; - advanceEpochState = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + advanceEpochState = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { advance_epoch_state: {} - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; -} + triggerReset = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + trigger_reset: {} + }, fee_, memo_, funds_); + }; + triggerResharing = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + trigger_resharing: {} + }, fee_, memo_, funds_); + }; + transferOwnership = async ({ + transferTo + }: { + transferTo: string; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + transfer_ownership: { + transfer_to: transferTo + } + }, fee_, memo_, funds_); + }; + updateAnnounceAddress = async ({ + newAddress + }: { + newAddress: string; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + update_announce_address: { + new_address: newAddress + } + }, fee_, memo_, funds_); + }; +} \ No newline at end of file diff --git a/sdk/typescript/codegen/contract-clients/src/CoconutDkg.types.ts b/sdk/typescript/codegen/contract-clients/src/CoconutDkg.types.ts index 1f90bc5ed3..36483df717 100644 --- a/sdk/typescript/codegen/contract-clients/src/CoconutDkg.types.ts +++ b/sdk/typescript/codegen/contract-clients/src/CoconutDkg.types.ts @@ -1,11 +1,12 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ export interface InstantiateMsg { group_addr: string; + key_size: number; mix_denom: string; multisig_addr: string; time_configuration?: TimeConfiguration | null; @@ -19,16 +20,24 @@ export interface TimeConfiguration { verification_key_validation_time_secs: number; } export type ExecuteMsg = { + initiate_dkg: {}; +} | { register_dealer: { announce_address: string; bte_key_with_proof: string; + identity_key: string; resharing: boolean; }; } | { - commit_dealing: { - dealing_bytes: ContractSafeBytes; + commit_dealings_metadata: { + chunks: DealingChunkInfo[]; + dealing_index: number; resharing: boolean; }; +} | { + commit_dealings_chunk: { + chunk: PartialContractDealing; + }; } | { commit_verification_key_share: { resharing: boolean; @@ -36,41 +45,115 @@ export type ExecuteMsg = { }; } | { verify_verification_key_share: { - owner: Addr; + owner: string; resharing: boolean; }; -} | { - surpassed_threshold: {}; } | { advance_epoch_state: {}; +} | { + trigger_reset: {}; +} | { + trigger_resharing: {}; +} | { + transfer_ownership: { + transfer_to: string; + }; +} | { + update_announce_address: { + new_address: string; + }; }; export type ContractSafeBytes = number[]; -export type Addr = string; +export interface DealingChunkInfo { + size: number; +} +export interface PartialContractDealing { + chunk_index: number; + data: ContractSafeBytes; + dealing_index: number; +} export type QueryMsg = { + get_state: {}; +} | { get_current_epoch_state: {}; +} | { + get_epoch_state_at_height: { + height: number; + }; } | { get_current_epoch_threshold: {}; } | { - get_initial_dealers: {}; + get_epoch_threshold: { + epoch_id: number; + }; +} | { + can_advance_state: {}; +} | { + get_registered_dealer: { + dealer_address: string; + epoch_id?: number | null; + }; } | { get_dealer_details: { dealer_address: string; }; +} | { + get_epoch_dealers_addresses: { + epoch_id: number; + limit?: number | null; + start_after?: string | null; + }; +} | { + get_epoch_dealers: { + epoch_id: number; + limit?: number | null; + start_after?: string | null; + }; } | { get_current_dealers: { limit?: number | null; start_after?: string | null; }; } | { - get_past_dealers: { + get_dealer_indices: { limit?: number | null; start_after?: string | null; }; } | { - get_dealing: { - idx: number; - limit?: number | null; - start_after?: string | null; + get_dealings_metadata: { + dealer: string; + dealing_index: number; + epoch_id: number; + }; +} | { + get_dealer_dealings_status: { + dealer: string; + epoch_id: number; + }; +} | { + get_dealing_status: { + dealer: string; + dealing_index: number; + epoch_id: number; + }; +} | { + get_dealing_chunk_status: { + chunk_index: number; + dealer: string; + dealing_index: number; + epoch_id: number; + }; +} | { + get_dealing_chunk: { + chunk_index: number; + dealer: string; + dealing_index: number; + epoch_id: number; + }; +} | { + get_verification_key: { + epoch_id: number; + owner: string; }; } | { get_verification_keys: { @@ -78,22 +161,11 @@ export type QueryMsg = { limit?: number | null; start_after?: string | null; }; +} | { + get_cw2_contract_version: {}; }; export interface MigrateMsg {} -export interface PagedDealerResponse { - dealers: DealerDetails[]; - per_page: number; - start_next_after?: Addr | null; -} -export interface DealerDetails { - address: Addr; - announce_address: string; - assigned_index: number; - bte_public_key_with_proof: string; -} -export type Timestamp = Uint64; -export type Uint64 = number; -export type EpochState = "in_progress" | { +export type EpochState = ("waiting_initialisation" | "in_progress") | { public_key_submission: { resharing: boolean; }; @@ -114,36 +186,132 @@ export type EpochState = "in_progress" | { resharing: boolean; }; }; +export type Timestamp = Uint64; +export type Uint64 = number; +export interface StateAdvanceResponse { + current_state: EpochState; + deadline?: Timestamp | null; + is_complete: boolean; + progress: StateProgress; + reached_deadline: boolean; +} +export interface StateProgress { + registered_dealers: number; + registered_resharing_dealers: number; + submitted_dealings: number; + submitted_key_shares: number; + verified_keys: number; +} +export interface ContractVersion { + contract: string; + version: string; +} +export type Addr = string; +export interface PagedDealerResponse { + dealers: DealerDetails[]; + per_page: number; + start_next_after?: Addr | null; +} +export interface DealerDetails { + address: Addr; + announce_address: string; + assigned_index: number; + bte_public_key_with_proof: string; + ed25519_identity: string; +} export interface Epoch { + deadline?: Timestamp | null; epoch_id: number; - finish_timestamp: Timestamp; state: EpochState; + state_progress: StateProgress; time_configuration: TimeConfiguration; } -export type DealerType = "current" | "past" | "unknown"; +export interface DealerDealingsStatusResponse { + all_dealings_fully_submitted: boolean; + dealer: Addr; + dealing_submission_status: {}; + epoch_id: number; +} +export type DealerType = "unknown" | { + current: { + assigned_index: number; + }; +} | { + past: { + assigned_index: number; + }; +}; export interface DealerDetailsResponse { dealer_type: DealerType; details?: DealerDetails | null; } -export interface PagedDealingsResponse { - dealings: ContractDealing[]; - per_page: number; +export interface PagedDealerIndexResponse { + indices: [Addr, number][]; start_next_after?: Addr | null; } -export interface ContractDealing { +export interface DealingChunkResponse { + chunk?: ContractSafeBytes | null; + chunk_index: number; dealer: Addr; - dealing: ContractSafeBytes; + dealing_index: number; + epoch_id: number; } -export type NullableInitialReplacementData = InitialReplacementData | null; -export interface InitialReplacementData { - initial_dealers: Addr[]; - initial_height: number; +export interface DealingChunkStatusResponse { + chunk_index: number; + dealer: Addr; + dealing_index: number; + epoch_id: number; + status: ChunkSubmissionStatus; } -export interface PagedVKSharesResponse { - per_page: number; - shares: ContractVKShare[]; +export interface ChunkSubmissionStatus { + submission_height?: number | null; +} +export interface DealingStatusResponse { + dealer: Addr; + dealing_index: number; + epoch_id: number; + status: DealingStatus; +} +export interface DealingStatus { + chunk_submission_status: {}; + fully_submitted: boolean; + has_metadata: boolean; +} +export interface DealingMetadataResponse { + dealer: Addr; + dealing_index: number; + epoch_id: number; + metadata?: DealingMetadata | null; +} +export interface DealingMetadata { + dealing_index: number; + submitted_chunks: {}; +} +export interface PagedDealerAddressesResponse { + dealers: Addr[]; start_next_after?: Addr | null; } +export type NullableEpoch = Epoch | null; +export interface RegisteredDealerDetails { + details?: DealerRegistrationDetails | null; +} +export interface DealerRegistrationDetails { + announce_address: string; + bte_public_key_with_proof: string; + ed25519_identity: string; +} +export type Cw4Contract = Addr; +export interface State { + group_addr: Cw4Contract; + key_size: number; + mix_denom: string; + multisig_addr: Addr; +} +export interface VkShareResponse { + epoch_id: number; + owner: Addr; + share?: ContractVKShare | null; +} export interface ContractVKShare { announce_address: string; epoch_id: number; @@ -151,4 +319,9 @@ export interface ContractVKShare { owner: Addr; share: string; verified: boolean; +} +export interface PagedVKSharesResponse { + per_page: number; + shares: ContractVKShare[]; + start_next_after?: Addr | null; } \ No newline at end of file diff --git a/sdk/typescript/codegen/contract-clients/src/Cw3FlexMultisig.client.ts b/sdk/typescript/codegen/contract-clients/src/Cw3FlexMultisig.client.ts index cfe3b9f76f..cae76780ea 100644 --- a/sdk/typescript/codegen/contract-clients/src/Cw3FlexMultisig.client.ts +++ b/sdk/typescript/codegen/contract-clients/src/Cw3FlexMultisig.client.ts @@ -1,13 +1,12 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { StdFee } from "@cosmjs/amino"; -import { Executor, Addr, Duration, Uint128, UncheckedDenom, Threshold, Decimal, InstantiateMsg, UncheckedDepositInfo, ExecuteMsg, Expiration, Timestamp, Uint64, CosmosMsgForEmpty, BankMsg, StakingMsg, DistributionMsg, Binary, IbcMsg, WasmMsg, GovMsg, VoteOption, Vote, Coin, Empty, IbcTimeout, IbcTimeoutBlock, MemberChangedHookMsg, MemberDiff, QueryMsg, MigrateMsg, Cw4Contract, Denom, Config, DepositInfo, Status, ThresholdResponse, ProposalListResponseForEmpty, ProposalResponseForEmpty, VoterListResponse, VoterDetail, VoteListResponse, VoteInfo, VoteResponse, VoterResponse } from "./Cw3FlexMultisig.types"; - +import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient"; +import { StdFee } from "@interchainjs/types"; +import { Executor, Addr, Duration, Uint128, UncheckedDenom, Threshold, Decimal, InstantiateMsg, UncheckedDepositInfo, ExecuteMsg, Expiration, Timestamp, Uint64, CosmosMsgForEmpty, BankMsg, WasmMsg, Binary, Vote, Coin, Empty, MemberChangedHookMsg, MemberDiff, QueryMsg, MigrateMsg, Cw4Contract, Denom, Config, DepositInfo, Status, ThresholdResponse, ProposalListResponseForEmpty, ProposalResponseForEmpty, VoterListResponse, VoterDetail, VoteListResponse, VoteInfo, VoteResponse, VoterResponse } from "./Cw3FlexMultisig.types"; export interface Cw3FlexMultisigReadOnlyInterface { contractAddress: string; threshold: () => Promise; @@ -61,10 +60,9 @@ export interface Cw3FlexMultisigReadOnlyInterface { config: () => Promise; } export class Cw3FlexMultisigQueryClient implements Cw3FlexMultisigReadOnlyInterface { - client: CosmWasmClient; + client: ICosmWasmClient; contractAddress: string; - - constructor(client: CosmWasmClient, contractAddress: string) { + constructor(client: ICosmWasmClient, contractAddress: string) { this.client = client; this.contractAddress = contractAddress; this.threshold = this.threshold.bind(this); @@ -77,7 +75,6 @@ export class Cw3FlexMultisigQueryClient implements Cw3FlexMultisigReadOnlyInterf this.listVoters = this.listVoters.bind(this); this.config = this.config.bind(this); } - threshold = async (): Promise => { return this.client.queryContractSmart(this.contractAddress, { threshold: {} @@ -197,36 +194,35 @@ export interface Cw3FlexMultisigInterface extends Cw3FlexMultisigReadOnlyInterfa latest?: Expiration; msgs: CosmosMsgForEmpty[]; title: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - // vote: ({ - // proposalId, - // vote - // }: { - // proposalId: number; - // vote: Vote; - // }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + vote: ({ + proposalId, + vote + }: { + proposalId: number; + vote: Vote; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; execute: ({ proposalId }: { proposalId: number; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; close: ({ proposalId }: { proposalId: number; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; memberChangedHook: ({ diffs }: { diffs: MemberDiff[]; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; } export class Cw3FlexMultisigClient extends Cw3FlexMultisigQueryClient implements Cw3FlexMultisigInterface { - client: SigningCosmWasmClient; + client: ISigningCosmWasmClient; sender: string; contractAddress: string; - - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) { super(client, contractAddress); this.client = client; this.sender = sender; @@ -237,7 +233,6 @@ export class Cw3FlexMultisigClient extends Cw3FlexMultisigQueryClient implements this.close = this.close.bind(this); this.memberChangedHook = this.memberChangedHook.bind(this); } - propose = async ({ description, latest, @@ -248,7 +243,7 @@ export class Cw3FlexMultisigClient extends Cw3FlexMultisigQueryClient implements latest?: Expiration; msgs: CosmosMsgForEmpty[]; title: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { propose: { description, @@ -256,53 +251,53 @@ export class Cw3FlexMultisigClient extends Cw3FlexMultisigQueryClient implements msgs, title } - }, fee, memo, _funds); + }, fee_, memo_, funds_); + }; + vote = async ({ + proposalId, + vote + }: { + proposalId: number; + vote: Vote; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + vote: { + proposal_id: proposalId, + vote + } + }, fee_, memo_, funds_); }; - // vote = async ({ - // proposalId, - // vote - // }: { - // proposalId: number; - // vote: Vote; - // }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - // return await this.client.execute(this.sender, this.contractAddress, { - // vote: { - // proposal_id: proposalId, - // vote - // } - // }, fee, memo, _funds); - // }; execute = async ({ proposalId }: { proposalId: number; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { execute: { proposal_id: proposalId } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; close = async ({ proposalId }: { proposalId: number; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { close: { proposal_id: proposalId } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; memberChangedHook = async ({ diffs }: { diffs: MemberDiff[]; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { member_changed_hook: { diffs } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; -} +} \ No newline at end of file diff --git a/sdk/typescript/codegen/contract-clients/src/Cw3FlexMultisig.types.ts b/sdk/typescript/codegen/contract-clients/src/Cw3FlexMultisig.types.ts index 570e09b83d..d5fd3376cf 100644 --- a/sdk/typescript/codegen/contract-clients/src/Cw3FlexMultisig.types.ts +++ b/sdk/typescript/codegen/contract-clients/src/Cw3FlexMultisig.types.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ @@ -84,86 +84,17 @@ export type CosmosMsgForEmpty = { bank: BankMsg; } | { custom: Empty; -} | { - staking: StakingMsg; -} | { - distribution: DistributionMsg; -} | { - stargate: { - type_url: string; - value: Binary; - [k: string]: unknown; - }; -} | { - ibc: IbcMsg; } | { wasm: WasmMsg; -} | { - gov: GovMsg; }; export type BankMsg = { send: { amount: Coin[]; to_address: string; - [k: string]: unknown; }; } | { burn: { amount: Coin[]; - [k: string]: unknown; - }; -}; -export type StakingMsg = { - delegate: { - amount: Coin; - validator: string; - [k: string]: unknown; - }; -} | { - undelegate: { - amount: Coin; - validator: string; - [k: string]: unknown; - }; -} | { - redelegate: { - amount: Coin; - dst_validator: string; - src_validator: string; - [k: string]: unknown; - }; -}; -export type DistributionMsg = { - set_withdraw_address: { - address: string; - [k: string]: unknown; - }; -} | { - withdraw_delegator_reward: { - validator: string; - [k: string]: unknown; - }; -}; -export type Binary = string; -export type IbcMsg = { - transfer: { - amount: Coin; - channel_id: string; - timeout: IbcTimeout; - to_address: string; - [k: string]: unknown; - }; -} | { - send_packet: { - channel_id: string; - data: Binary; - timeout: IbcTimeout; - [k: string]: unknown; - }; -} | { - close_channel: { - channel_id: string; - [k: string]: unknown; }; }; export type WasmMsg = { @@ -171,7 +102,6 @@ export type WasmMsg = { contract_addr: string; funds: Coin[]; msg: Binary; - [k: string]: unknown; }; } | { instantiate: { @@ -180,54 +110,30 @@ export type WasmMsg = { funds: Coin[]; label: string; msg: Binary; - [k: string]: unknown; }; } | { migrate: { contract_addr: string; msg: Binary; new_code_id: number; - [k: string]: unknown; }; } | { update_admin: { admin: string; contract_addr: string; - [k: string]: unknown; }; } | { clear_admin: { contract_addr: string; - [k: string]: unknown; }; }; -export type GovMsg = { - vote: { - proposal_id: number; - vote: VoteOption; - [k: string]: unknown; - }; -}; -export type VoteOption = "yes" | "no" | "abstain" | "no_with_veto"; +export type Binary = string; export type Vote = "yes" | "no" | "abstain" | "veto"; export interface Coin { amount: Uint128; denom: string; - [k: string]: unknown; -} -export interface Empty { - [k: string]: unknown; -} -export interface IbcTimeout { - block?: IbcTimeoutBlock | null; - timestamp?: Timestamp | null; - [k: string]: unknown; -} -export interface IbcTimeoutBlock { - height: number; - revision: number; - [k: string]: unknown; } +export interface Empty {} export interface MemberChangedHookMsg { diffs: MemberDiff[]; } diff --git a/sdk/typescript/codegen/contract-clients/src/Cw4Group.client.ts b/sdk/typescript/codegen/contract-clients/src/Cw4Group.client.ts index 42482b9aba..2e1bfb2c01 100644 --- a/sdk/typescript/codegen/contract-clients/src/Cw4Group.client.ts +++ b/sdk/typescript/codegen/contract-clients/src/Cw4Group.client.ts @@ -1,13 +1,12 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { Coin, StdFee } from "@cosmjs/amino"; +import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient"; +import { Coin, StdFee } from "@interchainjs/types"; import { InstantiateMsg, Member, ExecuteMsg, QueryMsg, MigrateMsg, AdminResponse, HooksResponse, MemberListResponse, MemberResponse, TotalWeightResponse } from "./Cw4Group.types"; - export interface Cw4GroupReadOnlyInterface { contractAddress: string; admin: () => Promise; @@ -33,10 +32,9 @@ export interface Cw4GroupReadOnlyInterface { hooks: () => Promise; } export class Cw4GroupQueryClient implements Cw4GroupReadOnlyInterface { - client: CosmWasmClient; + client: ICosmWasmClient; contractAddress: string; - - constructor(client: CosmWasmClient, contractAddress: string) { + constructor(client: ICosmWasmClient, contractAddress: string) { this.client = client; this.contractAddress = contractAddress; this.admin = this.admin.bind(this); @@ -45,7 +43,6 @@ export class Cw4GroupQueryClient implements Cw4GroupReadOnlyInterface { this.member = this.member.bind(this); this.hooks = this.hooks.bind(this); } - admin = async (): Promise => { return this.client.queryContractSmart(this.contractAddress, { admin: {} @@ -103,31 +100,30 @@ export interface Cw4GroupInterface extends Cw4GroupReadOnlyInterface { admin }: { admin?: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateMembers: ({ add, remove }: { add: Member[]; remove: string[]; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; addHook: ({ addr }: { addr: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; removeHook: ({ addr }: { addr: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; } export class Cw4GroupClient extends Cw4GroupQueryClient implements Cw4GroupInterface { - client: SigningCosmWasmClient; + client: ISigningCosmWasmClient; sender: string; contractAddress: string; - - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) { super(client, contractAddress); this.client = client; this.sender = sender; @@ -137,17 +133,16 @@ export class Cw4GroupClient extends Cw4GroupQueryClient implements Cw4GroupInter this.addHook = this.addHook.bind(this); this.removeHook = this.removeHook.bind(this); } - updateAdmin = async ({ admin }: { admin?: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_admin: { admin } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateMembers = async ({ add, @@ -155,34 +150,34 @@ export class Cw4GroupClient extends Cw4GroupQueryClient implements Cw4GroupInter }: { add: Member[]; remove: string[]; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_members: { add, remove } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; addHook = async ({ addr }: { addr: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { add_hook: { addr } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; removeHook = async ({ addr }: { addr: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { remove_hook: { addr } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; -} +} \ No newline at end of file diff --git a/sdk/typescript/codegen/contract-clients/src/Cw4Group.types.ts b/sdk/typescript/codegen/contract-clients/src/Cw4Group.types.ts index 6fe03352a2..836a46846c 100644 --- a/sdk/typescript/codegen/contract-clients/src/Cw4Group.types.ts +++ b/sdk/typescript/codegen/contract-clients/src/Cw4Group.types.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ diff --git a/sdk/typescript/codegen/contract-clients/src/Ecash.client.ts b/sdk/typescript/codegen/contract-clients/src/Ecash.client.ts new file mode 100644 index 0000000000..e2dd496d3b --- /dev/null +++ b/sdk/typescript/codegen/contract-clients/src/Ecash.client.ts @@ -0,0 +1,256 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient"; +import { StdFee } from "@interchainjs/types"; +import { Uint128, InstantiateMsg, Coin, ExecuteMsg, QueryMsg, MigrateMsg, PagedBlacklistedAccountResponse, BlacklistedAccount, Blacklisting, BlacklistedAccountResponse, DepositResponse, Deposit, PagedDepositsResponse, DepositData, LatestDepositResponse } from "./Ecash.types"; +export interface EcashReadOnlyInterface { + contractAddress: string; + getBlacklistedAccount: ({ + publicKey + }: { + publicKey: string; + }) => Promise; + getBlacklistPaged: ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: string; + }) => Promise; + getRequiredDepositAmount: () => Promise; + getDeposit: ({ + depositId + }: { + depositId: number; + }) => Promise; + getLatestDeposit: () => Promise; + getDepositsPaged: ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: number; + }) => Promise; +} +export class EcashQueryClient implements EcashReadOnlyInterface { + client: ICosmWasmClient; + contractAddress: string; + constructor(client: ICosmWasmClient, contractAddress: string) { + this.client = client; + this.contractAddress = contractAddress; + this.getBlacklistedAccount = this.getBlacklistedAccount.bind(this); + this.getBlacklistPaged = this.getBlacklistPaged.bind(this); + this.getRequiredDepositAmount = this.getRequiredDepositAmount.bind(this); + this.getDeposit = this.getDeposit.bind(this); + this.getLatestDeposit = this.getLatestDeposit.bind(this); + this.getDepositsPaged = this.getDepositsPaged.bind(this); + } + getBlacklistedAccount = async ({ + publicKey + }: { + publicKey: string; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_blacklisted_account: { + public_key: publicKey + } + }); + }; + getBlacklistPaged = async ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: string; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_blacklist_paged: { + limit, + start_after: startAfter + } + }); + }; + getRequiredDepositAmount = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_required_deposit_amount: {} + }); + }; + getDeposit = async ({ + depositId + }: { + depositId: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_deposit: { + deposit_id: depositId + } + }); + }; + getLatestDeposit = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_latest_deposit: {} + }); + }; + getDepositsPaged = async ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_deposits_paged: { + limit, + start_after: startAfter + } + }); + }; +} +export interface EcashInterface extends EcashReadOnlyInterface { + contractAddress: string; + sender: string; + depositTicketBookFunds: ({ + identityKey + }: { + identityKey: string; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + requestRedemption: ({ + commitmentBs58, + numberOfTickets + }: { + commitmentBs58: string; + numberOfTickets: number; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + redeemTickets: ({ + gw, + n + }: { + gw: string; + n: number; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + updateAdmin: ({ + admin + }: { + admin: string; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + updateDepositValue: ({ + newDeposit + }: { + newDeposit: Coin; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + proposeToBlacklist: ({ + publicKey + }: { + publicKey: string; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + addToBlacklist: ({ + publicKey + }: { + publicKey: string; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; +} +export class EcashClient extends EcashQueryClient implements EcashInterface { + client: ISigningCosmWasmClient; + sender: string; + contractAddress: string; + constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) { + super(client, contractAddress); + this.client = client; + this.sender = sender; + this.contractAddress = contractAddress; + this.depositTicketBookFunds = this.depositTicketBookFunds.bind(this); + this.requestRedemption = this.requestRedemption.bind(this); + this.redeemTickets = this.redeemTickets.bind(this); + this.updateAdmin = this.updateAdmin.bind(this); + this.updateDepositValue = this.updateDepositValue.bind(this); + this.proposeToBlacklist = this.proposeToBlacklist.bind(this); + this.addToBlacklist = this.addToBlacklist.bind(this); + } + depositTicketBookFunds = async ({ + identityKey + }: { + identityKey: string; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + deposit_ticket_book_funds: { + identity_key: identityKey + } + }, fee_, memo_, funds_); + }; + requestRedemption = async ({ + commitmentBs58, + numberOfTickets + }: { + commitmentBs58: string; + numberOfTickets: number; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + request_redemption: { + commitment_bs58: commitmentBs58, + number_of_tickets: numberOfTickets + } + }, fee_, memo_, funds_); + }; + redeemTickets = async ({ + gw, + n + }: { + gw: string; + n: number; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + redeem_tickets: { + gw, + n + } + }, fee_, memo_, funds_); + }; + updateAdmin = async ({ + admin + }: { + admin: string; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + update_admin: { + admin + } + }, fee_, memo_, funds_); + }; + updateDepositValue = async ({ + newDeposit + }: { + newDeposit: Coin; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + update_deposit_value: { + new_deposit: newDeposit + } + }, fee_, memo_, funds_); + }; + proposeToBlacklist = async ({ + publicKey + }: { + publicKey: string; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + propose_to_blacklist: { + public_key: publicKey + } + }, fee_, memo_, funds_); + }; + addToBlacklist = async ({ + publicKey + }: { + publicKey: string; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + add_to_blacklist: { + public_key: publicKey + } + }, fee_, memo_, funds_); + }; +} \ No newline at end of file diff --git a/sdk/typescript/codegen/contract-clients/src/Ecash.types.ts b/sdk/typescript/codegen/contract-clients/src/Ecash.types.ts new file mode 100644 index 0000000000..e7deb4ee28 --- /dev/null +++ b/sdk/typescript/codegen/contract-clients/src/Ecash.types.ts @@ -0,0 +1,106 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + +export type Uint128 = string; +export interface InstantiateMsg { + deposit_amount: Coin; + group_addr: string; + holding_account: string; + multisig_addr: string; +} +export interface Coin { + amount: Uint128; + denom: string; +} +export type ExecuteMsg = { + deposit_ticket_book_funds: { + identity_key: string; + }; +} | { + request_redemption: { + commitment_bs58: string; + number_of_tickets: number; + }; +} | { + redeem_tickets: { + gw: string; + n: number; + }; +} | { + update_admin: { + admin: string; + }; +} | { + update_deposit_value: { + new_deposit: Coin; + }; +} | { + propose_to_blacklist: { + public_key: string; + }; +} | { + add_to_blacklist: { + public_key: string; + }; +}; +export type QueryMsg = { + get_blacklisted_account: { + public_key: string; + }; +} | { + get_blacklist_paged: { + limit?: number | null; + start_after?: string | null; + }; +} | { + get_required_deposit_amount: {}; +} | { + get_deposit: { + deposit_id: number; + }; +} | { + get_latest_deposit: {}; +} | { + get_deposits_paged: { + limit?: number | null; + start_after?: number | null; + }; +}; +export interface MigrateMsg {} +export interface PagedBlacklistedAccountResponse { + accounts: BlacklistedAccount[]; + per_page: number; + start_next_after?: string | null; +} +export interface BlacklistedAccount { + info: Blacklisting; + public_key: string; +} +export interface Blacklisting { + finalized_at_height?: number | null; + proposal_id: number; +} +export interface BlacklistedAccountResponse { + account?: Blacklisting | null; +} +export interface DepositResponse { + deposit?: Deposit | null; + id: number; +} +export interface Deposit { + bs58_encoded_ed25519_pubkey: string; +} +export interface PagedDepositsResponse { + deposits: DepositData[]; + start_next_after?: number | null; +} +export interface DepositData { + deposit: Deposit; + id: number; +} +export interface LatestDepositResponse { + deposit?: DepositData | null; +} \ No newline at end of file diff --git a/sdk/typescript/codegen/contract-clients/src/Mixnet.client.ts b/sdk/typescript/codegen/contract-clients/src/Mixnet.client.ts index c775e31a3d..7d068a8a71 100644 --- a/sdk/typescript/codegen/contract-clients/src/Mixnet.client.ts +++ b/sdk/typescript/codegen/contract-clients/src/Mixnet.client.ts @@ -1,64 +1,31 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { StdFee } from "@cosmjs/amino"; -import { Decimal, Percent, InstantiateMsg, Duration, InitialRewardingParams, ExecuteMsg, Layer, FamilyHead, MessageSignature, Uint128, ContractStateParams, Coin, IntervalRewardingParamsUpdate, LayerAssignment, MixNodeCostParams, MixNode, MixNodeConfigUpdate, Gateway, GatewayConfigUpdate, QueryMsg, MigrateMsg, Addr, PagedAllDelegationsResponse, Delegation, PagedFamiliesResponse, Family, PagedMembersResponse, MixnodeDetailsByIdentityResponse, MixNodeDetails, MixNodeBond, PendingMixNodeChanges, MixNodeRewarding, ContractVersion, ContractBuildInformation, CurrentIntervalResponse, Interval, MixNodeDelegationResponse, PagedDelegatorDelegationsResponse, EpochState, EpochStatus, EstimatedCurrentEpochRewardResponse, FamilyByHeadResponse, FamilyByLabelResponse, FamilyMembersByHeadResponse, FamilyMembersByLabelResponse, GatewayBondResponse, GatewayBond, PagedGatewayResponse, LayerDistribution, PagedMixnodeBondsResponse, PagedMixnodesDetailsResponse, PagedMixNodeDelegationsResponse, MixnodeDetailsResponse, MixnodeRewardingDetailsResponse, NumberOfPendingEventsResponse, GatewayOwnershipResponse, MixOwnershipResponse, PendingRewardResponse, PendingEpochEventKind, PendingEpochEventResponse, PendingEpochEventData, PendingEpochEventsResponse, PendingEpochEvent, PendingIntervalEventKind, PendingIntervalEventResponse, PendingIntervalEventData, PendingIntervalEventsResponse, PendingIntervalEvent, RewardedSetNodeStatus, PagedRewardedSetResponse, RewardingParams, IntervalRewardParams, String, Uint32, StakeSaturationResponse, ContractState, UnbondedMixnodeResponse, UnbondedMixnode, PagedUnbondedMixnodesResponse } from "./Mixnet.types"; -import { GetCw2ContractVersionResponse } from './types'; +import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient"; +import { StdFee } from "@interchainjs/types"; +import { Decimal, Percent, Uint128, InstantiateMsg, Duration, InitialRewardingParams, RewardedSetParams, RangedValueForUint128, RangedValueForPercent, VersionScoreFormulaParams, OutdatedVersionWeights, ExecuteMsg, Role, MessageSignature, ContractStateParamsUpdate, ConfigScoreParamsUpdate, DelegationsParams, Coin, OperatorsParamsUpdate, ActiveSetUpdate, IntervalRewardingParamsUpdate, RoleAssignment, NodeCostParams, MixNode, MixNodeConfigUpdate, Gateway, GatewayConfigUpdate, NymNode, NodeConfigUpdate, NodeRewardingParameters, QueryMsg, MigrateMsg, AdminResponse, Addr, PagedAllDelegationsResponse, Delegation, MixnodeDetailsByIdentityResponse, MixNodeDetails, MixNodeBond, PendingMixNodeChanges, NodeRewarding, ContractVersion, ContractBuildInformation, CurrentIntervalResponse, Interval, CurrentNymNodeVersionResponse, HistoricalNymNodeVersionEntry, HistoricalNymNodeVersion, TotalVersionDifference, NodeDelegationResponse, PagedDelegatorDelegationsResponse, EpochState, EpochStatus, EstimatedCurrentEpochRewardResponse, GatewayBondResponse, GatewayBond, PagedGatewayResponse, KeyRotationIdResponse, KeyRotationState, PagedMixnodeBondsResponse, PagedMixnodesDetailsResponse, MixnodeDetailsResponse, MixnodeRewardingDetailsResponse, PagedNodeDelegationsResponse, NodeRewardingDetailsResponse, StakeSaturationResponse, NumberOfPendingEventsResponse, PagedNymNodeBondsResponse, NymNodeBond, NodeDetailsResponse, NymNodeDetails, PendingNodeChanges, NodeDetailsByIdentityResponse, NymNodeVersionHistoryResponse, PagedNymNodeDetailsResponse, GatewayOwnershipResponse, MixOwnershipResponse, NodeOwnershipResponse, PendingRewardResponse, PendingEpochEventKind, PendingEpochEventResponse, PendingEpochEventData, PendingEpochEventsResponse, PendingEpochEvent, PendingIntervalEventKind, PendingIntervalEventResponse, PendingIntervalEventData, PendingIntervalEventsResponse, PendingIntervalEvent, PreassignedGatewayIdsResponse, PreassignedId, RolesMetadataResponse, RewardedSetMetadata, RoleMetadata, RewardingParams, IntervalRewardParams, String, EpochAssignmentResponse, Uint32, MixStakeSaturationResponse, ContractState, ContractStateParams, ConfigScoreParams, OperatorsParams, UnbondedMixnodeResponse, UnbondedMixnode, PagedUnbondedMixnodesResponse, UnbondedNodeResponse, UnbondedNymNode, PagedUnbondedNymNodesResponse } from "./Mixnet.types"; export interface MixnetReadOnlyInterface { contractAddress: string; - getAllFamiliesPaged: ({ - limit, - startAfter - }: { - limit?: number; - startAfter?: string; - }) => Promise; - getAllMembersPaged: ({ - limit, - startAfter - }: { - limit?: number; - startAfter?: string; - }) => Promise; - getFamilyByHead: ({ - head - }: { - head: string; - }) => Promise; - getFamilyByLabel: ({ - label - }: { - label: string; - }) => Promise; - getFamilyMembersByHead: ({ - head - }: { - head: string; - }) => Promise; - getFamilyMembersByLabel: ({ - label - }: { - label: string; - }) => Promise; + admin: () => Promise; getContractVersion: () => Promise; getCw2ContractVersion: () => Promise; getRewardingValidatorAddress: () => Promise; getStateParams: () => Promise; getState: () => Promise; - getRewardingParams: () => Promise; - getEpochStatus: () => Promise; - getCurrentIntervalDetails: () => Promise; - getRewardedSet: ({ + getCurrentNymNodeVersion: () => Promise; + getNymNodeVersionHistory: ({ limit, startAfter }: { limit?: number; startAfter?: number; - }) => Promise; + }) => Promise; + getRewardingParams: () => Promise; + getEpochStatus: () => Promise; + getCurrentIntervalDetails: () => Promise; getMixNodeBonds: ({ limit, startAfter @@ -117,7 +84,7 @@ export interface MixnetReadOnlyInterface { mixId }: { mixId: number; - }) => Promise; + }) => Promise; getUnbondedMixNodeInformation: ({ mixId }: { @@ -128,7 +95,6 @@ export interface MixnetReadOnlyInterface { }: { mixIdentity: string; }) => Promise; - getLayerDistribution: () => Promise; getGateways: ({ limit, startAfter @@ -146,15 +112,97 @@ export interface MixnetReadOnlyInterface { }: { address: string; }) => Promise; - getMixnodeDelegations: ({ + getPreassignedGatewayIds: ({ limit, - mixId, startAfter }: { limit?: number; - mixId: number; startAfter?: string; - }) => Promise; + }) => Promise; + getNymNodeBondsPaged: ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: number; + }) => Promise; + getNymNodesDetailedPaged: ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: number; + }) => Promise; + getUnbondedNymNode: ({ + nodeId + }: { + nodeId: number; + }) => Promise; + getUnbondedNymNodesPaged: ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: number; + }) => Promise; + getUnbondedNymNodesByOwnerPaged: ({ + limit, + owner, + startAfter + }: { + limit?: number; + owner: string; + startAfter?: number; + }) => Promise; + getUnbondedNymNodesByIdentityKeyPaged: ({ + identityKey, + limit, + startAfter + }: { + identityKey: string; + limit?: number; + startAfter?: number; + }) => Promise; + getOwnedNymNode: ({ + address + }: { + address: string; + }) => Promise; + getNymNodeDetails: ({ + nodeId + }: { + nodeId: number; + }) => Promise; + getNymNodeDetailsByIdentityKey: ({ + nodeIdentity + }: { + nodeIdentity: string; + }) => Promise; + getNodeRewardingDetails: ({ + nodeId + }: { + nodeId: number; + }) => Promise; + getNodeStakeSaturation: ({ + nodeId + }: { + nodeId: number; + }) => Promise; + getRoleAssignment: ({ + role + }: { + role: Role; + }) => Promise; + getRewardedSetMetadata: () => Promise; + getNodeDelegations: ({ + limit, + nodeId, + startAfter + }: { + limit?: number; + nodeId: number; + startAfter?: string; + }) => Promise; getDelegatorDelegations: ({ delegator, limit, @@ -166,13 +214,13 @@ export interface MixnetReadOnlyInterface { }) => Promise; getDelegationDetails: ({ delegator, - mixId, + nodeId, proxy }: { delegator: string; - mixId: number; + nodeId: number; proxy?: string; - }) => Promise; + }) => Promise; getAllDelegations: ({ limit, startAfter @@ -185,37 +233,39 @@ export interface MixnetReadOnlyInterface { }: { address: string; }) => Promise; - getPendingMixNodeOperatorReward: ({ - mixId + getPendingNodeOperatorReward: ({ + nodeId }: { - mixId: number; + nodeId: number; }) => Promise; getPendingDelegatorReward: ({ address, - mixId, + nodeId, proxy }: { address: string; - mixId: number; + nodeId: number; proxy?: string; }) => Promise; getEstimatedCurrentEpochOperatorReward: ({ estimatedPerformance, - mixId + estimatedWork, + nodeId }: { estimatedPerformance: Percent; - mixId: number; + estimatedWork?: Decimal; + nodeId: number; }) => Promise; getEstimatedCurrentEpochDelegatorReward: ({ address, estimatedPerformance, - mixId, - proxy + estimatedWork, + nodeId }: { address: string; estimatedPerformance: Percent; - mixId: number; - proxy?: string; + estimatedWork?: Decimal; + nodeId: number; }) => Promise; getPendingEpochEvents: ({ limit, @@ -247,29 +297,26 @@ export interface MixnetReadOnlyInterface { }: { address: string; }) => Promise; + getKeyRotationState: () => Promise; + getKeyRotationId: () => Promise; } export class MixnetQueryClient implements MixnetReadOnlyInterface { - client: CosmWasmClient; + client: ICosmWasmClient; contractAddress: string; - - constructor(client: CosmWasmClient, contractAddress: string) { + constructor(client: ICosmWasmClient, contractAddress: string) { this.client = client; this.contractAddress = contractAddress; - this.getAllFamiliesPaged = this.getAllFamiliesPaged.bind(this); - this.getAllMembersPaged = this.getAllMembersPaged.bind(this); - this.getFamilyByHead = this.getFamilyByHead.bind(this); - this.getFamilyByLabel = this.getFamilyByLabel.bind(this); - this.getFamilyMembersByHead = this.getFamilyMembersByHead.bind(this); - this.getFamilyMembersByLabel = this.getFamilyMembersByLabel.bind(this); + this.admin = this.admin.bind(this); this.getContractVersion = this.getContractVersion.bind(this); this.getCw2ContractVersion = this.getCw2ContractVersion.bind(this); this.getRewardingValidatorAddress = this.getRewardingValidatorAddress.bind(this); this.getStateParams = this.getStateParams.bind(this); this.getState = this.getState.bind(this); + this.getCurrentNymNodeVersion = this.getCurrentNymNodeVersion.bind(this); + this.getNymNodeVersionHistory = this.getNymNodeVersionHistory.bind(this); this.getRewardingParams = this.getRewardingParams.bind(this); this.getEpochStatus = this.getEpochStatus.bind(this); this.getCurrentIntervalDetails = this.getCurrentIntervalDetails.bind(this); - this.getRewardedSet = this.getRewardedSet.bind(this); this.getMixNodeBonds = this.getMixNodeBonds.bind(this); this.getMixNodesDetailed = this.getMixNodesDetailed.bind(this); this.getUnbondedMixNodes = this.getUnbondedMixNodes.bind(this); @@ -281,16 +328,29 @@ export class MixnetQueryClient implements MixnetReadOnlyInterface { this.getStakeSaturation = this.getStakeSaturation.bind(this); this.getUnbondedMixNodeInformation = this.getUnbondedMixNodeInformation.bind(this); this.getBondedMixnodeDetailsByIdentity = this.getBondedMixnodeDetailsByIdentity.bind(this); - this.getLayerDistribution = this.getLayerDistribution.bind(this); this.getGateways = this.getGateways.bind(this); this.getGatewayBond = this.getGatewayBond.bind(this); this.getOwnedGateway = this.getOwnedGateway.bind(this); - this.getMixnodeDelegations = this.getMixnodeDelegations.bind(this); + this.getPreassignedGatewayIds = this.getPreassignedGatewayIds.bind(this); + this.getNymNodeBondsPaged = this.getNymNodeBondsPaged.bind(this); + this.getNymNodesDetailedPaged = this.getNymNodesDetailedPaged.bind(this); + this.getUnbondedNymNode = this.getUnbondedNymNode.bind(this); + this.getUnbondedNymNodesPaged = this.getUnbondedNymNodesPaged.bind(this); + this.getUnbondedNymNodesByOwnerPaged = this.getUnbondedNymNodesByOwnerPaged.bind(this); + this.getUnbondedNymNodesByIdentityKeyPaged = this.getUnbondedNymNodesByIdentityKeyPaged.bind(this); + this.getOwnedNymNode = this.getOwnedNymNode.bind(this); + this.getNymNodeDetails = this.getNymNodeDetails.bind(this); + this.getNymNodeDetailsByIdentityKey = this.getNymNodeDetailsByIdentityKey.bind(this); + this.getNodeRewardingDetails = this.getNodeRewardingDetails.bind(this); + this.getNodeStakeSaturation = this.getNodeStakeSaturation.bind(this); + this.getRoleAssignment = this.getRoleAssignment.bind(this); + this.getRewardedSetMetadata = this.getRewardedSetMetadata.bind(this); + this.getNodeDelegations = this.getNodeDelegations.bind(this); this.getDelegatorDelegations = this.getDelegatorDelegations.bind(this); this.getDelegationDetails = this.getDelegationDetails.bind(this); this.getAllDelegations = this.getAllDelegations.bind(this); this.getPendingOperatorReward = this.getPendingOperatorReward.bind(this); - this.getPendingMixNodeOperatorReward = this.getPendingMixNodeOperatorReward.bind(this); + this.getPendingNodeOperatorReward = this.getPendingNodeOperatorReward.bind(this); this.getPendingDelegatorReward = this.getPendingDelegatorReward.bind(this); this.getEstimatedCurrentEpochOperatorReward = this.getEstimatedCurrentEpochOperatorReward.bind(this); this.getEstimatedCurrentEpochDelegatorReward = this.getEstimatedCurrentEpochDelegatorReward.bind(this); @@ -300,78 +360,12 @@ export class MixnetQueryClient implements MixnetReadOnlyInterface { this.getPendingIntervalEvent = this.getPendingIntervalEvent.bind(this); this.getNumberOfPendingEvents = this.getNumberOfPendingEvents.bind(this); this.getSigningNonce = this.getSigningNonce.bind(this); + this.getKeyRotationState = this.getKeyRotationState.bind(this); + this.getKeyRotationId = this.getKeyRotationId.bind(this); } - - getAllFamiliesPaged = async ({ - limit, - startAfter - }: { - limit?: number; - startAfter?: string; - }): Promise => { + admin = async (): Promise => { return this.client.queryContractSmart(this.contractAddress, { - get_all_families_paged: { - limit, - start_after: startAfter - } - }); - }; - getAllMembersPaged = async ({ - limit, - startAfter - }: { - limit?: number; - startAfter?: string; - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - get_all_members_paged: { - limit, - start_after: startAfter - } - }); - }; - getFamilyByHead = async ({ - head - }: { - head: string; - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - get_family_by_head: { - head - } - }); - }; - getFamilyByLabel = async ({ - label - }: { - label: string; - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - get_family_by_label: { - label - } - }); - }; - getFamilyMembersByHead = async ({ - head - }: { - head: string; - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - get_family_members_by_head: { - head - } - }); - }; - getFamilyMembersByLabel = async ({ - label - }: { - label: string; - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - get_family_members_by_label: { - label - } + admin: {} }); }; getContractVersion = async (): Promise => { @@ -399,6 +393,25 @@ export class MixnetQueryClient implements MixnetReadOnlyInterface { get_state: {} }); }; + getCurrentNymNodeVersion = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_current_nym_node_version: {} + }); + }; + getNymNodeVersionHistory = async ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_nym_node_version_history: { + limit, + start_after: startAfter + } + }); + }; getRewardingParams = async (): Promise => { return this.client.queryContractSmart(this.contractAddress, { get_rewarding_params: {} @@ -414,20 +427,6 @@ export class MixnetQueryClient implements MixnetReadOnlyInterface { get_current_interval_details: {} }); }; - getRewardedSet = async ({ - limit, - startAfter - }: { - limit?: number; - startAfter?: number; - }): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - get_rewarded_set: { - limit, - start_after: startAfter - } - }); - }; getMixNodeBonds = async ({ limit, startAfter @@ -541,7 +540,7 @@ export class MixnetQueryClient implements MixnetReadOnlyInterface { mixId }: { mixId: number; - }): Promise => { + }): Promise => { return this.client.queryContractSmart(this.contractAddress, { get_stake_saturation: { mix_id: mixId @@ -570,11 +569,6 @@ export class MixnetQueryClient implements MixnetReadOnlyInterface { } }); }; - getLayerDistribution = async (): Promise => { - return this.client.queryContractSmart(this.contractAddress, { - get_layer_distribution: {} - }); - }; getGateways = async ({ limit, startAfter @@ -611,19 +605,191 @@ export class MixnetQueryClient implements MixnetReadOnlyInterface { } }); }; - getMixnodeDelegations = async ({ + getPreassignedGatewayIds = async ({ limit, - mixId, startAfter }: { limit?: number; - mixId: number; startAfter?: string; - }): Promise => { + }): Promise => { return this.client.queryContractSmart(this.contractAddress, { - get_mixnode_delegations: { + get_preassigned_gateway_ids: { limit, - mix_id: mixId, + start_after: startAfter + } + }); + }; + getNymNodeBondsPaged = async ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_nym_node_bonds_paged: { + limit, + start_after: startAfter + } + }); + }; + getNymNodesDetailedPaged = async ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_nym_nodes_detailed_paged: { + limit, + start_after: startAfter + } + }); + }; + getUnbondedNymNode = async ({ + nodeId + }: { + nodeId: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_unbonded_nym_node: { + node_id: nodeId + } + }); + }; + getUnbondedNymNodesPaged = async ({ + limit, + startAfter + }: { + limit?: number; + startAfter?: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_unbonded_nym_nodes_paged: { + limit, + start_after: startAfter + } + }); + }; + getUnbondedNymNodesByOwnerPaged = async ({ + limit, + owner, + startAfter + }: { + limit?: number; + owner: string; + startAfter?: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_unbonded_nym_nodes_by_owner_paged: { + limit, + owner, + start_after: startAfter + } + }); + }; + getUnbondedNymNodesByIdentityKeyPaged = async ({ + identityKey, + limit, + startAfter + }: { + identityKey: string; + limit?: number; + startAfter?: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_unbonded_nym_nodes_by_identity_key_paged: { + identity_key: identityKey, + limit, + start_after: startAfter + } + }); + }; + getOwnedNymNode = async ({ + address + }: { + address: string; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_owned_nym_node: { + address + } + }); + }; + getNymNodeDetails = async ({ + nodeId + }: { + nodeId: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_nym_node_details: { + node_id: nodeId + } + }); + }; + getNymNodeDetailsByIdentityKey = async ({ + nodeIdentity + }: { + nodeIdentity: string; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_nym_node_details_by_identity_key: { + node_identity: nodeIdentity + } + }); + }; + getNodeRewardingDetails = async ({ + nodeId + }: { + nodeId: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_node_rewarding_details: { + node_id: nodeId + } + }); + }; + getNodeStakeSaturation = async ({ + nodeId + }: { + nodeId: number; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_node_stake_saturation: { + node_id: nodeId + } + }); + }; + getRoleAssignment = async ({ + role + }: { + role: Role; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_role_assignment: { + role + } + }); + }; + getRewardedSetMetadata = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_rewarded_set_metadata: {} + }); + }; + getNodeDelegations = async ({ + limit, + nodeId, + startAfter + }: { + limit?: number; + nodeId: number; + startAfter?: string; + }): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_node_delegations: { + limit, + node_id: nodeId, start_after: startAfter } }); @@ -647,17 +813,17 @@ export class MixnetQueryClient implements MixnetReadOnlyInterface { }; getDelegationDetails = async ({ delegator, - mixId, + nodeId, proxy }: { delegator: string; - mixId: number; + nodeId: number; proxy?: string; - }): Promise => { + }): Promise => { return this.client.queryContractSmart(this.contractAddress, { get_delegation_details: { delegator, - mix_id: mixId, + node_id: nodeId, proxy } }); @@ -687,65 +853,68 @@ export class MixnetQueryClient implements MixnetReadOnlyInterface { } }); }; - getPendingMixNodeOperatorReward = async ({ - mixId + getPendingNodeOperatorReward = async ({ + nodeId }: { - mixId: number; + nodeId: number; }): Promise => { return this.client.queryContractSmart(this.contractAddress, { - get_pending_mix_node_operator_reward: { - mix_id: mixId + get_pending_node_operator_reward: { + node_id: nodeId } }); }; getPendingDelegatorReward = async ({ address, - mixId, + nodeId, proxy }: { address: string; - mixId: number; + nodeId: number; proxy?: string; }): Promise => { return this.client.queryContractSmart(this.contractAddress, { get_pending_delegator_reward: { address, - mix_id: mixId, + node_id: nodeId, proxy } }); }; getEstimatedCurrentEpochOperatorReward = async ({ estimatedPerformance, - mixId + estimatedWork, + nodeId }: { estimatedPerformance: Percent; - mixId: number; + estimatedWork?: Decimal; + nodeId: number; }): Promise => { return this.client.queryContractSmart(this.contractAddress, { get_estimated_current_epoch_operator_reward: { estimated_performance: estimatedPerformance, - mix_id: mixId + estimated_work: estimatedWork, + node_id: nodeId } }); }; getEstimatedCurrentEpochDelegatorReward = async ({ address, estimatedPerformance, - mixId, - proxy + estimatedWork, + nodeId }: { address: string; estimatedPerformance: Percent; - mixId: number; - proxy?: string; + estimatedWork?: Decimal; + nodeId: number; }): Promise => { return this.client.queryContractSmart(this.contractAddress, { get_estimated_current_epoch_delegator_reward: { address, estimated_performance: estimatedPerformance, - mix_id: mixId, - proxy + estimated_work: estimatedWork, + node_id: nodeId } }); }; @@ -815,93 +984,54 @@ export class MixnetQueryClient implements MixnetReadOnlyInterface { } }); }; + getKeyRotationState = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_key_rotation_state: {} + }); + }; + getKeyRotationId = async (): Promise => { + return this.client.queryContractSmart(this.contractAddress, { + get_key_rotation_id: {} + }); + }; } export interface MixnetInterface extends MixnetReadOnlyInterface { contractAddress: string; sender: string; - assignNodeLayer: ({ - layer, - mixId + updateAdmin: ({ + admin }: { - layer: Layer; - mixId: number; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - createFamily: ({ - label - }: { - label: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - joinFamily: ({ - familyHead, - joinPermit - }: { - familyHead: FamilyHead; - joinPermit: MessageSignature; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - leaveFamily: ({ - familyHead - }: { - familyHead: FamilyHead; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - kickFamilyMember: ({ - member - }: { - member: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - createFamilyOnBehalf: ({ - label, - ownerAddress - }: { - label: string; - ownerAddress: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - joinFamilyOnBehalf: ({ - familyHead, - joinPermit, - memberAddress - }: { - familyHead: FamilyHead; - joinPermit: MessageSignature; - memberAddress: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - leaveFamilyOnBehalf: ({ - familyHead, - memberAddress - }: { - familyHead: FamilyHead; - memberAddress: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - kickFamilyMemberOnBehalf: ({ - headAddress, - member - }: { - headAddress: string; - member: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + admin: string; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateRewardingValidatorAddress: ({ address }: { address: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateContractStateParams: ({ - updatedParameters + update }: { - updatedParameters: ContractStateParams; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - updateActiveSetSize: ({ - activeSetSize, - forceImmediately + update: ContractStateParamsUpdate; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + updateCurrentNymNodeSemver: ({ + currentVersion + }: { + currentVersion: string; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + updateActiveSetDistribution: ({ + forceImmediately, + update }: { - activeSetSize: number; forceImmediately: boolean; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + update: ActiveSetUpdate; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateRewardingParams: ({ forceImmediately, updatedParams }: { forceImmediately: boolean; updatedParams: IntervalRewardingParamsUpdate; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateIntervalConfig: ({ epochDurationSecs, epochsInInterval, @@ -910,95 +1040,94 @@ export interface MixnetInterface extends MixnetReadOnlyInterface { epochDurationSecs: number; epochsInInterval: number; forceImmediately: boolean; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - beginEpochTransition: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - advanceCurrentEpoch: ({ - expectedActiveSetSize, - newRewardedSet - }: { - expectedActiveSetSize: number; - newRewardedSet: LayerAssignment[]; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + beginEpochTransition: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; reconcileEpochEvents: ({ limit }: { limit?: number; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + assignRoles: ({ + assignment + }: { + assignment: RoleAssignment; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; bondMixnode: ({ costParams, mixNode, ownerSignature }: { - costParams: MixNodeCostParams; + costParams: NodeCostParams; mixNode: MixNode; ownerSignature: MessageSignature; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; bondMixnodeOnBehalf: ({ costParams, mixNode, owner, ownerSignature }: { - costParams: MixNodeCostParams; + costParams: NodeCostParams; mixNode: MixNode; owner: string; ownerSignature: MessageSignature; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - pledgeMore: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + pledgeMore: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; pledgeMoreOnBehalf: ({ owner }: { owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; decreasePledge: ({ decreaseBy }: { decreaseBy: Coin; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; decreasePledgeOnBehalf: ({ decreaseBy, owner }: { decreaseBy: Coin; owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - unbondMixnode: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + unbondMixnode: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; unbondMixnodeOnBehalf: ({ owner }: { owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - updateMixnodeCostParams: ({ + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + updateCostParams: ({ newCosts }: { - newCosts: MixNodeCostParams; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + newCosts: NodeCostParams; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateMixnodeCostParamsOnBehalf: ({ newCosts, owner }: { - newCosts: MixNodeCostParams; + newCosts: NodeCostParams; owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateMixnodeConfig: ({ newConfig }: { newConfig: MixNodeConfigUpdate; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateMixnodeConfigOnBehalf: ({ newConfig, owner }: { newConfig: MixNodeConfigUpdate; owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + migrateMixnode: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; bondGateway: ({ gateway, ownerSignature }: { gateway: Gateway; ownerSignature: MessageSignature; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; bondGatewayOnBehalf: ({ gateway, owner, @@ -1007,102 +1136,120 @@ export interface MixnetInterface extends MixnetReadOnlyInterface { gateway: Gateway; owner: string; ownerSignature: MessageSignature; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - unbondGateway: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + unbondGateway: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; unbondGatewayOnBehalf: ({ owner }: { owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateGatewayConfig: ({ newConfig }: { newConfig: GatewayConfigUpdate; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateGatewayConfigOnBehalf: ({ newConfig, owner }: { newConfig: GatewayConfigUpdate; owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - delegateToMixnode: ({ - mixId + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + migrateGateway: ({ + costParams }: { - mixId: number; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + costParams?: NodeCostParams; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + bondNymNode: ({ + costParams, + node, + ownerSignature + }: { + costParams: NodeCostParams; + node: NymNode; + ownerSignature: MessageSignature; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + unbondNymNode: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + updateNodeConfig: ({ + update + }: { + update: NodeConfigUpdate; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + delegate: ({ + nodeId + }: { + nodeId: number; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; delegateToMixnodeOnBehalf: ({ delegate, mixId }: { delegate: string; mixId: number; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - undelegateFromMixnode: ({ - mixId + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + undelegate: ({ + nodeId }: { - mixId: number; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + nodeId: number; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; undelegateFromMixnodeOnBehalf: ({ delegate, mixId }: { delegate: string; mixId: number; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - rewardMixnode: ({ - mixId, - performance + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + rewardNode: ({ + nodeId, + params }: { - mixId: number; - performance: Percent; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - withdrawOperatorReward: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + nodeId: number; + params: NodeRewardingParameters; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + withdrawOperatorReward: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; withdrawOperatorRewardOnBehalf: ({ owner }: { owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; withdrawDelegatorReward: ({ - mixId + nodeId }: { - mixId: number; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + nodeId: number; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; withdrawDelegatorRewardOnBehalf: ({ mixId, owner }: { mixId: number; owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + migrateVestedMixNode: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + migrateVestedDelegation: ({ + mixId + }: { + mixId: number; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; } export class MixnetClient extends MixnetQueryClient implements MixnetInterface { - client: SigningCosmWasmClient; + client: ISigningCosmWasmClient; sender: string; contractAddress: string; - - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) { super(client, contractAddress); this.client = client; this.sender = sender; this.contractAddress = contractAddress; - this.assignNodeLayer = this.assignNodeLayer.bind(this); - this.createFamily = this.createFamily.bind(this); - this.joinFamily = this.joinFamily.bind(this); - this.leaveFamily = this.leaveFamily.bind(this); - this.kickFamilyMember = this.kickFamilyMember.bind(this); - this.createFamilyOnBehalf = this.createFamilyOnBehalf.bind(this); - this.joinFamilyOnBehalf = this.joinFamilyOnBehalf.bind(this); - this.leaveFamilyOnBehalf = this.leaveFamilyOnBehalf.bind(this); - this.kickFamilyMemberOnBehalf = this.kickFamilyMemberOnBehalf.bind(this); + this.updateAdmin = this.updateAdmin.bind(this); this.updateRewardingValidatorAddress = this.updateRewardingValidatorAddress.bind(this); this.updateContractStateParams = this.updateContractStateParams.bind(this); - this.updateActiveSetSize = this.updateActiveSetSize.bind(this); + this.updateCurrentNymNodeSemver = this.updateCurrentNymNodeSemver.bind(this); + this.updateActiveSetDistribution = this.updateActiveSetDistribution.bind(this); this.updateRewardingParams = this.updateRewardingParams.bind(this); this.updateIntervalConfig = this.updateIntervalConfig.bind(this); this.beginEpochTransition = this.beginEpochTransition.bind(this); - this.advanceCurrentEpoch = this.advanceCurrentEpoch.bind(this); this.reconcileEpochEvents = this.reconcileEpochEvents.bind(this); + this.assignRoles = this.assignRoles.bind(this); this.bondMixnode = this.bondMixnode.bind(this); this.bondMixnodeOnBehalf = this.bondMixnodeOnBehalf.bind(this); this.pledgeMore = this.pledgeMore.bind(this); @@ -1111,182 +1258,90 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { this.decreasePledgeOnBehalf = this.decreasePledgeOnBehalf.bind(this); this.unbondMixnode = this.unbondMixnode.bind(this); this.unbondMixnodeOnBehalf = this.unbondMixnodeOnBehalf.bind(this); - this.updateMixnodeCostParams = this.updateMixnodeCostParams.bind(this); + this.updateCostParams = this.updateCostParams.bind(this); this.updateMixnodeCostParamsOnBehalf = this.updateMixnodeCostParamsOnBehalf.bind(this); this.updateMixnodeConfig = this.updateMixnodeConfig.bind(this); this.updateMixnodeConfigOnBehalf = this.updateMixnodeConfigOnBehalf.bind(this); + this.migrateMixnode = this.migrateMixnode.bind(this); this.bondGateway = this.bondGateway.bind(this); this.bondGatewayOnBehalf = this.bondGatewayOnBehalf.bind(this); this.unbondGateway = this.unbondGateway.bind(this); this.unbondGatewayOnBehalf = this.unbondGatewayOnBehalf.bind(this); this.updateGatewayConfig = this.updateGatewayConfig.bind(this); this.updateGatewayConfigOnBehalf = this.updateGatewayConfigOnBehalf.bind(this); - this.delegateToMixnode = this.delegateToMixnode.bind(this); + this.migrateGateway = this.migrateGateway.bind(this); + this.bondNymNode = this.bondNymNode.bind(this); + this.unbondNymNode = this.unbondNymNode.bind(this); + this.updateNodeConfig = this.updateNodeConfig.bind(this); + this.delegate = this.delegate.bind(this); this.delegateToMixnodeOnBehalf = this.delegateToMixnodeOnBehalf.bind(this); - this.undelegateFromMixnode = this.undelegateFromMixnode.bind(this); + this.undelegate = this.undelegate.bind(this); this.undelegateFromMixnodeOnBehalf = this.undelegateFromMixnodeOnBehalf.bind(this); - this.rewardMixnode = this.rewardMixnode.bind(this); + this.rewardNode = this.rewardNode.bind(this); this.withdrawOperatorReward = this.withdrawOperatorReward.bind(this); this.withdrawOperatorRewardOnBehalf = this.withdrawOperatorRewardOnBehalf.bind(this); this.withdrawDelegatorReward = this.withdrawDelegatorReward.bind(this); this.withdrawDelegatorRewardOnBehalf = this.withdrawDelegatorRewardOnBehalf.bind(this); + this.migrateVestedMixNode = this.migrateVestedMixNode.bind(this); + this.migrateVestedDelegation = this.migrateVestedDelegation.bind(this); } - - assignNodeLayer = async ({ - layer, - mixId + updateAdmin = async ({ + admin }: { - layer: Layer; - mixId: number; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + admin: string; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { - assign_node_layer: { - layer, - mix_id: mixId + update_admin: { + admin } - }, fee, memo, _funds); - }; - createFamily = async ({ - label - }: { - label: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - create_family: { - label - } - }, fee, memo, _funds); - }; - joinFamily = async ({ - familyHead, - joinPermit - }: { - familyHead: FamilyHead; - joinPermit: MessageSignature; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - join_family: { - family_head: familyHead, - join_permit: joinPermit - } - }, fee, memo, _funds); - }; - leaveFamily = async ({ - familyHead - }: { - familyHead: FamilyHead; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - leave_family: { - family_head: familyHead - } - }, fee, memo, _funds); - }; - kickFamilyMember = async ({ - member - }: { - member: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - kick_family_member: { - member - } - }, fee, memo, _funds); - }; - createFamilyOnBehalf = async ({ - label, - ownerAddress - }: { - label: string; - ownerAddress: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - create_family_on_behalf: { - label, - owner_address: ownerAddress - } - }, fee, memo, _funds); - }; - joinFamilyOnBehalf = async ({ - familyHead, - joinPermit, - memberAddress - }: { - familyHead: FamilyHead; - joinPermit: MessageSignature; - memberAddress: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - join_family_on_behalf: { - family_head: familyHead, - join_permit: joinPermit, - member_address: memberAddress - } - }, fee, memo, _funds); - }; - leaveFamilyOnBehalf = async ({ - familyHead, - memberAddress - }: { - familyHead: FamilyHead; - memberAddress: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - leave_family_on_behalf: { - family_head: familyHead, - member_address: memberAddress - } - }, fee, memo, _funds); - }; - kickFamilyMemberOnBehalf = async ({ - headAddress, - member - }: { - headAddress: string; - member: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - kick_family_member_on_behalf: { - head_address: headAddress, - member - } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateRewardingValidatorAddress = async ({ address }: { address: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_rewarding_validator_address: { address } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateContractStateParams = async ({ - updatedParameters + update }: { - updatedParameters: ContractStateParams; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + update: ContractStateParamsUpdate; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_contract_state_params: { - updated_parameters: updatedParameters + update } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - updateActiveSetSize = async ({ - activeSetSize, - forceImmediately + updateCurrentNymNodeSemver = async ({ + currentVersion }: { - activeSetSize: number; - forceImmediately: boolean; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + currentVersion: string; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { - update_active_set_size: { - active_set_size: activeSetSize, - force_immediately: forceImmediately + update_current_nym_node_semver: { + current_version: currentVersion } - }, fee, memo, _funds); + }, fee_, memo_, funds_); + }; + updateActiveSetDistribution = async ({ + forceImmediately, + update + }: { + forceImmediately: boolean; + update: ActiveSetUpdate; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + update_active_set_distribution: { + force_immediately: forceImmediately, + update + } + }, fee_, memo_, funds_); }; updateRewardingParams = async ({ forceImmediately, @@ -1294,13 +1349,13 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { }: { forceImmediately: boolean; updatedParams: IntervalRewardingParamsUpdate; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_rewarding_params: { force_immediately: forceImmediately, updated_params: updatedParams } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateIntervalConfig = async ({ epochDurationSecs, @@ -1310,61 +1365,58 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { epochDurationSecs: number; epochsInInterval: number; forceImmediately: boolean; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_interval_config: { epoch_duration_secs: epochDurationSecs, epochs_in_interval: epochsInInterval, force_immediately: forceImmediately } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - beginEpochTransition = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + beginEpochTransition = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { begin_epoch_transition: {} - }, fee, memo, _funds); - }; - advanceCurrentEpoch = async ({ - expectedActiveSetSize, - newRewardedSet - }: { - expectedActiveSetSize: number; - newRewardedSet: LayerAssignment[]; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - advance_current_epoch: { - expected_active_set_size: expectedActiveSetSize, - new_rewarded_set: newRewardedSet - } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; reconcileEpochEvents = async ({ limit }: { limit?: number; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { reconcile_epoch_events: { limit } - }, fee, memo, _funds); + }, fee_, memo_, funds_); + }; + assignRoles = async ({ + assignment + }: { + assignment: RoleAssignment; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + assign_roles: { + assignment + } + }, fee_, memo_, funds_); }; bondMixnode = async ({ costParams, mixNode, ownerSignature }: { - costParams: MixNodeCostParams; + costParams: NodeCostParams; mixNode: MixNode; ownerSignature: MessageSignature; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { bond_mixnode: { cost_params: costParams, mix_node: mixNode, owner_signature: ownerSignature } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; bondMixnodeOnBehalf = async ({ costParams, @@ -1372,11 +1424,11 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { owner, ownerSignature }: { - costParams: MixNodeCostParams; + costParams: NodeCostParams; mixNode: MixNode; owner: string; ownerSignature: MessageSignature; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { bond_mixnode_on_behalf: { cost_params: costParams, @@ -1384,34 +1436,34 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { owner, owner_signature: ownerSignature } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - pledgeMore = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + pledgeMore = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { pledge_more: {} - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; pledgeMoreOnBehalf = async ({ owner }: { owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { pledge_more_on_behalf: { owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; decreasePledge = async ({ decreaseBy }: { decreaseBy: Coin; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { decrease_pledge: { decrease_by: decreaseBy } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; decreasePledgeOnBehalf = async ({ decreaseBy, @@ -1419,65 +1471,65 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { }: { decreaseBy: Coin; owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { decrease_pledge_on_behalf: { decrease_by: decreaseBy, owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - unbondMixnode = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + unbondMixnode = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { unbond_mixnode: {} - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; unbondMixnodeOnBehalf = async ({ owner }: { owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { unbond_mixnode_on_behalf: { owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - updateMixnodeCostParams = async ({ + updateCostParams = async ({ newCosts }: { - newCosts: MixNodeCostParams; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + newCosts: NodeCostParams; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { - update_mixnode_cost_params: { + update_cost_params: { new_costs: newCosts } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateMixnodeCostParamsOnBehalf = async ({ newCosts, owner }: { - newCosts: MixNodeCostParams; + newCosts: NodeCostParams; owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_mixnode_cost_params_on_behalf: { new_costs: newCosts, owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateMixnodeConfig = async ({ newConfig }: { newConfig: MixNodeConfigUpdate; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_mixnode_config: { new_config: newConfig } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateMixnodeConfigOnBehalf = async ({ newConfig, @@ -1485,13 +1537,18 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { }: { newConfig: MixNodeConfigUpdate; owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_mixnode_config_on_behalf: { new_config: newConfig, owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); + }; + migrateMixnode = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + migrate_mixnode: {} + }, fee_, memo_, funds_); }; bondGateway = async ({ gateway, @@ -1499,13 +1556,13 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { }: { gateway: Gateway; ownerSignature: MessageSignature; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { bond_gateway: { gateway, owner_signature: ownerSignature } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; bondGatewayOnBehalf = async ({ gateway, @@ -1515,41 +1572,41 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { gateway: Gateway; owner: string; ownerSignature: MessageSignature; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { bond_gateway_on_behalf: { gateway, owner, owner_signature: ownerSignature } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - unbondGateway = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + unbondGateway = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { unbond_gateway: {} - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; unbondGatewayOnBehalf = async ({ owner }: { owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { unbond_gateway_on_behalf: { owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateGatewayConfig = async ({ newConfig }: { newConfig: GatewayConfigUpdate; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_gateway_config: { new_config: newConfig } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateGatewayConfigOnBehalf = async ({ newConfig, @@ -1557,24 +1614,68 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { }: { newConfig: GatewayConfigUpdate; owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_gateway_config_on_behalf: { new_config: newConfig, owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - delegateToMixnode = async ({ - mixId + migrateGateway = async ({ + costParams }: { - mixId: number; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + costParams?: NodeCostParams; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { - delegate_to_mixnode: { - mix_id: mixId + migrate_gateway: { + cost_params: costParams } - }, fee, memo, _funds); + }, fee_, memo_, funds_); + }; + bondNymNode = async ({ + costParams, + node, + ownerSignature + }: { + costParams: NodeCostParams; + node: NymNode; + ownerSignature: MessageSignature; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + bond_nym_node: { + cost_params: costParams, + node, + owner_signature: ownerSignature + } + }, fee_, memo_, funds_); + }; + unbondNymNode = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + unbond_nym_node: {} + }, fee_, memo_, funds_); + }; + updateNodeConfig = async ({ + update + }: { + update: NodeConfigUpdate; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + update_node_config: { + update + } + }, fee_, memo_, funds_); + }; + delegate = async ({ + nodeId + }: { + nodeId: number; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + delegate: { + node_id: nodeId + } + }, fee_, memo_, funds_); }; delegateToMixnodeOnBehalf = async ({ delegate, @@ -1582,24 +1683,24 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { }: { delegate: string; mixId: number; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { delegate_to_mixnode_on_behalf: { delegate, mix_id: mixId } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - undelegateFromMixnode = async ({ - mixId + undelegate = async ({ + nodeId }: { - mixId: number; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + nodeId: number; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { - undelegate_from_mixnode: { - mix_id: mixId + undelegate: { + node_id: nodeId } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; undelegateFromMixnodeOnBehalf = async ({ delegate, @@ -1607,54 +1708,54 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { }: { delegate: string; mixId: number; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { undelegate_from_mixnode_on_behalf: { delegate, mix_id: mixId } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - rewardMixnode = async ({ - mixId, - performance + rewardNode = async ({ + nodeId, + params }: { - mixId: number; - performance: Percent; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + nodeId: number; + params: NodeRewardingParameters; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { - reward_mixnode: { - mix_id: mixId, - performance + reward_node: { + node_id: nodeId, + params } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - withdrawOperatorReward = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + withdrawOperatorReward = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { withdraw_operator_reward: {} - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; withdrawOperatorRewardOnBehalf = async ({ owner }: { owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { withdraw_operator_reward_on_behalf: { owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; withdrawDelegatorReward = async ({ - mixId + nodeId }: { - mixId: number; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + nodeId: number; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { withdraw_delegator_reward: { - mix_id: mixId + node_id: nodeId } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; withdrawDelegatorRewardOnBehalf = async ({ mixId, @@ -1662,12 +1763,28 @@ export class MixnetClient extends MixnetQueryClient implements MixnetInterface { }: { mixId: number; owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { withdraw_delegator_reward_on_behalf: { mix_id: mixId, owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; -} + migrateVestedMixNode = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + migrate_vested_mix_node: {} + }, fee_, memo_, funds_); + }; + migrateVestedDelegation = async ({ + mixId + }: { + mixId: number; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + migrate_vested_delegation: { + mix_id: mixId + } + }, fee_, memo_, funds_); + }; +} \ No newline at end of file diff --git a/sdk/typescript/codegen/contract-clients/src/Mixnet.types.ts b/sdk/typescript/codegen/contract-clients/src/Mixnet.types.ts index f0630f673f..9f38ec385c 100644 --- a/sdk/typescript/codegen/contract-clients/src/Mixnet.types.ts +++ b/sdk/typescript/codegen/contract-clients/src/Mixnet.types.ts @@ -1,80 +1,66 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ export type Decimal = string; export type Percent = Decimal; - -/** - * This instantiates the contract. - */ +export type Uint128 = string; export interface InstantiateMsg { + current_nym_node_version: string; epoch_duration: Duration; epochs_in_interval: number; initial_rewarding_params: InitialRewardingParams; + interval_operating_cost?: RangedValueForUint128; + key_validity_in_epochs?: number | null; + profit_margin?: RangedValueForPercent; rewarding_denom: string; rewarding_validator_address: string; + version_score_params?: VersionScoreFormulaParams; + version_score_weights?: OutdatedVersionWeights; vesting_contract_address: string; } export interface Duration { nanos: number; secs: number; - [k: string]: unknown; } export interface InitialRewardingParams { - active_set_size: number; active_set_work_factor: Decimal; initial_reward_pool: Decimal; initial_staking_supply: Decimal; interval_pool_emission: Percent; - rewarded_set_size: number; + rewarded_set_params: RewardedSetParams; staking_supply_scale_factor: Percent; sybil_resistance: Percent; } +export interface RewardedSetParams { + entry_gateways: number; + exit_gateways: number; + mixnodes: number; + standby: number; +} +export interface RangedValueForUint128 { + maximum: Uint128; + minimum: Uint128; +} +export interface RangedValueForPercent { + maximum: Percent; + minimum: Percent; +} +export interface VersionScoreFormulaParams { + penalty: Decimal; + penalty_scaling: Decimal; +} +export interface OutdatedVersionWeights { + major: number; + minor: number; + patch: number; + prerelease: number; +} export type ExecuteMsg = { - assign_node_layer: { - layer: Layer; - mix_id: number; - }; -} | { - create_family: { - label: string; - }; -} | { - join_family: { - family_head: FamilyHead; - join_permit: MessageSignature; - }; -} | { - leave_family: { - family_head: FamilyHead; - }; -} | { - kick_family_member: { - member: string; - }; -} | { - create_family_on_behalf: { - label: string; - owner_address: string; - }; -} | { - join_family_on_behalf: { - family_head: FamilyHead; - join_permit: MessageSignature; - member_address: string; - }; -} | { - leave_family_on_behalf: { - family_head: FamilyHead; - member_address: string; - }; -} | { - kick_family_member_on_behalf: { - head_address: string; - member: string; + update_admin: { + admin: string; }; } | { update_rewarding_validator_address: { @@ -82,12 +68,16 @@ export type ExecuteMsg = { }; } | { update_contract_state_params: { - updated_parameters: ContractStateParams; + update: ContractStateParamsUpdate; }; } | { - update_active_set_size: { - active_set_size: number; + update_current_nym_node_semver: { + current_version: string; + }; +} | { + update_active_set_distribution: { force_immediately: boolean; + update: ActiveSetUpdate; }; } | { update_rewarding_params: { @@ -102,24 +92,23 @@ export type ExecuteMsg = { }; } | { begin_epoch_transition: {}; -} | { - advance_current_epoch: { - expected_active_set_size: number; - new_rewarded_set: LayerAssignment[]; - }; } | { reconcile_epoch_events: { limit?: number | null; }; +} | { + assign_roles: { + assignment: RoleAssignment; + }; } | { bond_mixnode: { - cost_params: MixNodeCostParams; + cost_params: NodeCostParams; mix_node: MixNode; owner_signature: MessageSignature; }; } | { bond_mixnode_on_behalf: { - cost_params: MixNodeCostParams; + cost_params: NodeCostParams; mix_node: MixNode; owner: string; owner_signature: MessageSignature; @@ -146,12 +135,12 @@ export type ExecuteMsg = { owner: string; }; } | { - update_mixnode_cost_params: { - new_costs: MixNodeCostParams; + update_cost_params: { + new_costs: NodeCostParams; }; } | { update_mixnode_cost_params_on_behalf: { - new_costs: MixNodeCostParams; + new_costs: NodeCostParams; owner: string; }; } | { @@ -163,6 +152,8 @@ export type ExecuteMsg = { new_config: MixNodeConfigUpdate; owner: string; }; +} | { + migrate_mixnode: {}; } | { bond_gateway: { gateway: Gateway; @@ -190,8 +181,24 @@ export type ExecuteMsg = { owner: string; }; } | { - delegate_to_mixnode: { - mix_id: number; + migrate_gateway: { + cost_params?: NodeCostParams | null; + }; +} | { + bond_nym_node: { + cost_params: NodeCostParams; + node: NymNode; + owner_signature: MessageSignature; + }; +} | { + unbond_nym_node: {}; +} | { + update_node_config: { + update: NodeConfigUpdate; + }; +} | { + delegate: { + node_id: number; }; } | { delegate_to_mixnode_on_behalf: { @@ -199,8 +206,8 @@ export type ExecuteMsg = { mix_id: number; }; } | { - undelegate_from_mixnode: { - mix_id: number; + undelegate: { + node_id: number; }; } | { undelegate_from_mixnode_on_behalf: { @@ -208,9 +215,9 @@ export type ExecuteMsg = { mix_id: number; }; } | { - reward_mixnode: { - mix_id: number; - performance: Percent; + reward_node: { + node_id: number; + params: NodeRewardingParameters; }; } | { withdraw_operator_reward: {}; @@ -220,42 +227,62 @@ export type ExecuteMsg = { }; } | { withdraw_delegator_reward: { - mix_id: number; + node_id: number; }; } | { withdraw_delegator_reward_on_behalf: { mix_id: number; owner: string; }; +} | { + migrate_vested_mix_node: {}; +} | { + migrate_vested_delegation: { + mix_id: number; + }; }; -export type Layer = "One" | "Two" | "Three"; -export type FamilyHead = string; +export type Role = "eg" | "l1" | "l2" | "l3" | "xg" | "stb"; export type MessageSignature = number[]; -export type Uint128 = string; -export interface ContractStateParams { - minimum_gateway_pledge: Coin; - minimum_mixnode_delegation?: Coin | null; - minimum_mixnode_pledge: Coin; +export interface ContractStateParamsUpdate { + config_score_params?: ConfigScoreParamsUpdate | null; + delegations_params?: DelegationsParams | null; + operators_params?: OperatorsParamsUpdate | null; +} +export interface ConfigScoreParamsUpdate { + version_score_formula_params?: VersionScoreFormulaParams | null; + version_weights?: OutdatedVersionWeights | null; +} +export interface DelegationsParams { + minimum_delegation?: Coin | null; } export interface Coin { amount: Uint128; denom: string; - [k: string]: unknown; +} +export interface OperatorsParamsUpdate { + interval_operating_cost?: RangedValueForUint128 | null; + minimum_pledge?: Coin | null; + profit_margin?: RangedValueForPercent | null; +} +export interface ActiveSetUpdate { + entry_gateways: number; + exit_gateways: number; + mixnodes: number; } export interface IntervalRewardingParamsUpdate { active_set_work_factor?: Decimal | null; interval_pool_emission?: Percent | null; reward_pool?: Decimal | null; - rewarded_set_size?: number | null; + rewarded_set_params?: RewardedSetParams | null; staking_supply?: Decimal | null; staking_supply_scale_factor?: Percent | null; sybil_resistance_percent?: Percent | null; } -export interface LayerAssignment { - layer: Layer; - mix_id: number; +export interface RoleAssignment { + nodes: number[]; + role: Role; } -export interface MixNodeCostParams { +export interface NodeCostParams { interval_operating_cost: Coin; profit_margin_percent: Percent; } @@ -291,32 +318,22 @@ export interface GatewayConfigUpdate { mix_port: number; version: string; } +export interface NymNode { + custom_http_port?: number | null; + host: string; + identity_key: string; +} +export interface NodeConfigUpdate { + custom_http_port?: number | null; + host?: string | null; + restore_default_http_port?: boolean; +} +export interface NodeRewardingParameters { + performance: Percent; + work_factor: Decimal; +} export type QueryMsg = { - get_all_families_paged: { - limit?: number | null; - start_after?: string | null; - }; -} | { - get_all_members_paged: { - limit?: number | null; - start_after?: string | null; - }; -} | { - get_family_by_head: { - head: string; - }; -} | { - get_family_by_label: { - label: string; - }; -} | { - get_family_members_by_head: { - head: string; - }; -} | { - get_family_members_by_label: { - label: string; - }; + admin: {}; } | { get_contract_version: {}; } | { @@ -327,17 +344,19 @@ export type QueryMsg = { get_state_params: {}; } | { get_state: {}; +} | { + get_current_nym_node_version: {}; +} | { + get_nym_node_version_history: { + limit?: number | null; + start_after?: number | null; + }; } | { get_rewarding_params: {}; } | { get_epoch_status: {}; } | { get_current_interval_details: {}; -} | { - get_rewarded_set: { - limit?: number | null; - start_after?: number | null; - }; } | { get_mix_node_bonds: { limit?: number | null; @@ -389,8 +408,6 @@ export type QueryMsg = { get_bonded_mixnode_details_by_identity: { mix_identity: string; }; -} | { - get_layer_distribution: {}; } | { get_gateways: { limit?: number | null; @@ -405,9 +422,71 @@ export type QueryMsg = { address: string; }; } | { - get_mixnode_delegations: { + get_preassigned_gateway_ids: { limit?: number | null; - mix_id: number; + start_after?: string | null; + }; +} | { + get_nym_node_bonds_paged: { + limit?: number | null; + start_after?: number | null; + }; +} | { + get_nym_nodes_detailed_paged: { + limit?: number | null; + start_after?: number | null; + }; +} | { + get_unbonded_nym_node: { + node_id: number; + }; +} | { + get_unbonded_nym_nodes_paged: { + limit?: number | null; + start_after?: number | null; + }; +} | { + get_unbonded_nym_nodes_by_owner_paged: { + limit?: number | null; + owner: string; + start_after?: number | null; + }; +} | { + get_unbonded_nym_nodes_by_identity_key_paged: { + identity_key: string; + limit?: number | null; + start_after?: number | null; + }; +} | { + get_owned_nym_node: { + address: string; + }; +} | { + get_nym_node_details: { + node_id: number; + }; +} | { + get_nym_node_details_by_identity_key: { + node_identity: string; + }; +} | { + get_node_rewarding_details: { + node_id: number; + }; +} | { + get_node_stake_saturation: { + node_id: number; + }; +} | { + get_role_assignment: { + role: Role; + }; +} | { + get_rewarded_set_metadata: {}; +} | { + get_node_delegations: { + limit?: number | null; + node_id: number; start_after?: string | null; }; } | { @@ -419,7 +498,7 @@ export type QueryMsg = { } | { get_delegation_details: { delegator: string; - mix_id: number; + node_id: number; proxy?: string | null; }; } | { @@ -432,26 +511,27 @@ export type QueryMsg = { address: string; }; } | { - get_pending_mix_node_operator_reward: { - mix_id: number; + get_pending_node_operator_reward: { + node_id: number; }; } | { get_pending_delegator_reward: { address: string; - mix_id: number; + node_id: number; proxy?: string | null; }; } | { get_estimated_current_epoch_operator_reward: { estimated_performance: Percent; - mix_id: number; + estimated_work?: Decimal | null; + node_id: number; }; } | { get_estimated_current_epoch_delegator_reward: { address: string; estimated_performance: Percent; - mix_id: number; - proxy?: string | null; + estimated_work?: Decimal | null; + node_id: number; }; } | { get_pending_epoch_events: { @@ -477,10 +557,18 @@ export type QueryMsg = { get_signing_nonce: { address: string; }; +} | { + get_key_rotation_state: {}; +} | { + get_key_rotation_id: {}; }; export interface MigrateMsg { + unsafe_skip_state_updates?: boolean | null; vesting_contract_address?: string | null; } +export interface AdminResponse { + admin?: string | null; +} export type Addr = string; export interface PagedAllDelegationsResponse { delegations: Delegation[]; @@ -490,23 +578,10 @@ export interface Delegation { amount: Coin; cumulative_reward_ratio: Decimal; height: number; - mix_id: number; + node_id: number; owner: Addr; proxy?: Addr | null; } -export interface PagedFamiliesResponse { - families: Family[]; - start_next_after?: string | null; -} -export interface Family { - head: FamilyHead; - label: string; - proxy?: string | null; -} -export interface PagedMembersResponse { - members: [string, FamilyHead][]; - start_next_after?: string | null; -} export interface MixnodeDetailsByIdentityResponse { identity_key: string; mixnode_details?: MixNodeDetails | null; @@ -514,12 +589,11 @@ export interface MixnodeDetailsByIdentityResponse { export interface MixNodeDetails { bond_information: MixNodeBond; pending_changes?: PendingMixNodeChanges; - rewarding_details: MixNodeRewarding; + rewarding_details: NodeRewarding; } export interface MixNodeBond { bonding_height: number; is_unbonding: boolean; - layer: Layer; mix_id: number; mix_node: MixNode; original_pledge: Coin; @@ -527,10 +601,11 @@ export interface MixNodeBond { proxy?: Addr | null; } export interface PendingMixNodeChanges { + cost_params_change?: number | null; pledge_change?: number | null; } -export interface MixNodeRewarding { - cost_params: MixNodeCostParams; +export interface NodeRewarding { + cost_params: NodeCostParams; delegates: Decimal; last_rewarded_epoch: number; operator: Decimal; @@ -545,9 +620,12 @@ export interface ContractVersion { export interface ContractBuildInformation { build_timestamp: string; build_version: string; + cargo_debug?: string; + cargo_opt_level?: string; commit_branch: string; commit_sha: string; commit_timestamp: string; + contract_name?: string; rustc_version: string; } export interface CurrentIntervalResponse { @@ -563,11 +641,29 @@ export interface Interval { epochs_in_interval: number; id: number; total_elapsed_epochs: number; - [k: string]: unknown; } -export interface MixNodeDelegationResponse { +export interface CurrentNymNodeVersionResponse { + version?: HistoricalNymNodeVersionEntry | null; +} +export interface HistoricalNymNodeVersionEntry { + id: number; + version_information: HistoricalNymNodeVersion; +} +export interface HistoricalNymNodeVersion { + difference_since_genesis: TotalVersionDifference; + introduced_at_height: number; + semver: string; +} +export interface TotalVersionDifference { + major: number; + minor: number; + patch: number; + prerelease: number; +} +export interface NodeDelegationResponse { delegation?: Delegation | null; mixnode_still_bonded: boolean; + node_still_bonded: boolean; } export interface PagedDelegatorDelegationsResponse { delegations: Delegation[]; @@ -578,7 +674,11 @@ export type EpochState = "in_progress" | { final_node_id: number; last_rewarded: number; }; -} | "reconciling_events" | "advancing_epoch"; +} | "reconciling_events" | { + role_assignment: { + next: Role; + }; +}; export interface EpochStatus { being_advanced_by: Addr; state: EpochState; @@ -590,22 +690,6 @@ export interface EstimatedCurrentEpochRewardResponse { estimation?: Coin | null; original_stake?: Coin | null; } -export interface FamilyByHeadResponse { - family?: Family | null; - head: FamilyHead; -} -export interface FamilyByLabelResponse { - family?: Family | null; - label: string; -} -export interface FamilyMembersByHeadResponse { - head: FamilyHead; - members: string[]; -} -export interface FamilyMembersByLabelResponse { - label: string; - members: string[]; -} export interface GatewayBondResponse { gateway?: GatewayBond | null; identity: string; @@ -622,10 +706,12 @@ export interface PagedGatewayResponse { per_page: number; start_next_after?: string | null; } -export interface LayerDistribution { - layer1: number; - layer2: number; - layer3: number; +export interface KeyRotationIdResponse { + rotation_id: number; +} +export interface KeyRotationState { + initial_epoch_id: number; + validity_epochs: number; } export interface PagedMixnodeBondsResponse { nodes: MixNodeBond[]; @@ -637,22 +723,68 @@ export interface PagedMixnodesDetailsResponse { per_page: number; start_next_after?: number | null; } -export interface PagedMixNodeDelegationsResponse { - delegations: Delegation[]; - start_next_after?: string | null; -} export interface MixnodeDetailsResponse { mix_id: number; mixnode_details?: MixNodeDetails | null; } export interface MixnodeRewardingDetailsResponse { mix_id: number; - rewarding_details?: MixNodeRewarding | null; + rewarding_details?: NodeRewarding | null; +} +export interface PagedNodeDelegationsResponse { + delegations: Delegation[]; + start_next_after?: string | null; +} +export interface NodeRewardingDetailsResponse { + node_id: number; + rewarding_details?: NodeRewarding | null; +} +export interface StakeSaturationResponse { + current_saturation?: Decimal | null; + node_id: number; + uncapped_saturation?: Decimal | null; } export interface NumberOfPendingEventsResponse { epoch_events: number; interval_events: number; } +export interface PagedNymNodeBondsResponse { + nodes: NymNodeBond[]; + start_next_after?: number | null; +} +export interface NymNodeBond { + bonding_height: number; + is_unbonding: boolean; + node: NymNode; + node_id: number; + original_pledge: Coin; + owner: Addr; +} +export interface NodeDetailsResponse { + details?: NymNodeDetails | null; + node_id: number; +} +export interface NymNodeDetails { + bond_information: NymNodeBond; + pending_changes: PendingNodeChanges; + rewarding_details: NodeRewarding; +} +export interface PendingNodeChanges { + cost_params_change?: number | null; + pledge_change?: number | null; +} +export interface NodeDetailsByIdentityResponse { + details?: NymNodeDetails | null; + identity_key: string; +} +export interface NymNodeVersionHistoryResponse { + history: HistoricalNymNodeVersionEntry[]; + start_next_after?: number | null; +} +export interface PagedNymNodeDetailsResponse { + nodes: NymNodeDetails[]; + start_next_after?: number | null; +} export interface GatewayOwnershipResponse { address: Addr; gateway?: GatewayBond | null; @@ -661,32 +793,47 @@ export interface MixOwnershipResponse { address: Addr; mixnode_details?: MixNodeDetails | null; } +export interface NodeOwnershipResponse { + address: Addr; + details?: NymNodeDetails | null; +} export interface PendingRewardResponse { amount_earned?: Coin | null; amount_earned_detailed?: Decimal | null; amount_staked?: Coin | null; mixnode_still_fully_bonded: boolean; + node_still_fully_bonded: boolean; } export type PendingEpochEventKind = { delegate: { amount: Coin; - mix_id: number; + node_id: number; owner: Addr; proxy?: Addr | null; }; } | { undelegate: { - mix_id: number; + node_id: number; owner: Addr; proxy?: Addr | null; }; } | { - pledge_more: { + nym_node_pledge_more: { + amount: Coin; + node_id: number; + }; +} | { + mixnode_pledge_more: { amount: Coin; mix_id: number; }; } | { - decrease_pledge: { + nym_node_decrease_pledge: { + decrease_by: Coin; + node_id: number; + }; +} | { + mixnode_decrease_pledge: { decrease_by: Coin; mix_id: number; }; @@ -695,8 +842,12 @@ export type PendingEpochEventKind = { mix_id: number; }; } | { - update_active_set_size: { - new_size: number; + unbond_nym_node: { + node_id: number; + }; +} | { + update_active_set: { + update: ActiveSetUpdate; }; }; export interface PendingEpochEventResponse { @@ -719,7 +870,12 @@ export interface PendingEpochEvent { export type PendingIntervalEventKind = { change_mix_cost_params: { mix_id: number; - new_costs: MixNodeCostParams; + new_costs: NodeCostParams; + }; +} | { + change_nym_node_cost_params: { + new_costs: NodeCostParams; + node_id: number; }; } | { update_rewarding_params: { @@ -748,15 +904,34 @@ export interface PendingIntervalEvent { event: PendingIntervalEventData; id: number; } -export type RewardedSetNodeStatus = "active" | "standby"; -export interface PagedRewardedSetResponse { - nodes: [number, RewardedSetNodeStatus][]; - start_next_after?: number | null; +export interface PreassignedGatewayIdsResponse { + ids: PreassignedId[]; + start_next_after?: string | null; +} +export interface PreassignedId { + identity: string; + node_id: number; +} +export interface RolesMetadataResponse { + metadata: RewardedSetMetadata; +} +export interface RewardedSetMetadata { + entry_gateway_metadata: RoleMetadata; + epoch_id: number; + exit_gateway_metadata: RoleMetadata; + fully_assigned: boolean; + layer1_metadata: RoleMetadata; + layer2_metadata: RoleMetadata; + layer3_metadata: RoleMetadata; + standby_metadata: RoleMetadata; +} +export interface RoleMetadata { + highest_id: number; + num_nodes: number; } export interface RewardingParams { - active_set_size: number; interval: IntervalRewardParams; - rewarded_set_size: number; + rewarded_set: RewardedSetParams; } export interface IntervalRewardParams { active_set_work_factor: Decimal; @@ -769,19 +944,37 @@ export interface IntervalRewardParams { sybil_resistance: Percent; } export type String = string; +export interface EpochAssignmentResponse { + epoch_id: number; + nodes: number[]; +} export type Uint32 = number; -export interface StakeSaturationResponse { +export interface MixStakeSaturationResponse { current_saturation?: Decimal | null; mix_id: number; uncapped_saturation?: Decimal | null; } export interface ContractState { - owner: Addr; + owner?: Addr | null; params: ContractStateParams; rewarding_denom: string; rewarding_validator_address: Addr; vesting_contract_address: Addr; } +export interface ContractStateParams { + config_score_params: ConfigScoreParams; + delegations_params: DelegationsParams; + operators_params: OperatorsParams; +} +export interface ConfigScoreParams { + version_score_formula_params: VersionScoreFormulaParams; + version_weights: OutdatedVersionWeights; +} +export interface OperatorsParams { + interval_operating_cost: RangedValueForUint128; + minimum_pledge: Coin; + profit_margin: RangedValueForPercent; +} export interface UnbondedMixnodeResponse { mix_id: number; unbonded_info?: UnbondedMixnode | null; @@ -797,3 +990,17 @@ export interface PagedUnbondedMixnodesResponse { per_page: number; start_next_after?: number | null; } +export interface UnbondedNodeResponse { + details?: UnbondedNymNode | null; + node_id: number; +} +export interface UnbondedNymNode { + identity_key: string; + node_id: number; + owner: Addr; + unbonding_height: number; +} +export interface PagedUnbondedNymNodesResponse { + nodes: UnbondedNymNode[]; + start_next_after?: number | null; +} \ No newline at end of file diff --git a/sdk/typescript/codegen/contract-clients/src/Vesting.client.ts b/sdk/typescript/codegen/contract-clients/src/Vesting.client.ts index 57e08e327a..187fc80b08 100644 --- a/sdk/typescript/codegen/contract-clients/src/Vesting.client.ts +++ b/sdk/typescript/codegen/contract-clients/src/Vesting.client.ts @@ -1,13 +1,12 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ -import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; -import { StdFee } from "@cosmjs/amino"; -import { InstantiateMsg, ExecuteMsg, FamilyHead, MessageSignature, Uint128, Percent, Decimal, PledgeCap, Coin, MixNodeCostParams, MixNodeConfigUpdate, VestingSpecification, MixNode, Gateway, GatewayConfigUpdate, QueryMsg, Timestamp, Uint64, MigrateMsg, Addr, Account, VestingPeriod, AccountsResponse, BaseVestingAccountInfo, VestingCoinsResponse, AccountVestingCoins, AllDelegationsResponse, VestingDelegation, ContractVersion, ContractBuildInformation, Period, DelegationTimesResponse, NullablePledgeData, PledgeData, OriginalVestingResponse } from "./Vesting.types"; -import { GetCw2ContractVersionResponse } from './types'; +import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient"; +import { StdFee } from "@interchainjs/types"; +import { InstantiateMsg, ExecuteMsg, Uint128, Percent, Decimal, PledgeCap, MessageSignature, Coin, NodeCostParams, MixNodeConfigUpdate, VestingSpecification, MixNode, Gateway, GatewayConfigUpdate, QueryMsg, Timestamp, Uint64, MigrateMsg, Addr, Account, VestingPeriod, AccountsResponse, BaseVestingAccountInfo, VestingCoinsResponse, AccountVestingCoins, AllDelegationsResponse, VestingDelegation, ContractVersion, ContractBuildInformation, Period, DelegationTimesResponse, NullablePledgeData, PledgeData, OriginalVestingResponse } from "./Vesting.types"; export interface VestingReadOnlyInterface { contractAddress: string; getContractVersion: () => Promise; @@ -156,10 +155,9 @@ export interface VestingReadOnlyInterface { }) => Promise; } export class VestingQueryClient implements VestingReadOnlyInterface { - client: CosmWasmClient; + client: ICosmWasmClient; contractAddress: string; - - constructor(client: CosmWasmClient, contractAddress: string) { + constructor(client: ICosmWasmClient, contractAddress: string) { this.client = client; this.contractAddress = contractAddress; this.getContractVersion = this.getContractVersion.bind(this); @@ -189,7 +187,6 @@ export class VestingQueryClient implements VestingReadOnlyInterface { this.getDelegationTimes = this.getDelegationTimes.bind(this); this.getAllDelegations = this.getAllDelegations.bind(this); } - getContractVersion = async (): Promise => { return this.client.queryContractSmart(this.contractAddress, { get_contract_version: {} @@ -501,56 +498,34 @@ export class VestingQueryClient implements VestingReadOnlyInterface { export interface VestingInterface extends VestingReadOnlyInterface { contractAddress: string; sender: string; - createFamily: ({ - label - }: { - label: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - joinFamily: ({ - familyHead, - joinPermit - }: { - familyHead: FamilyHead; - joinPermit: MessageSignature; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - leaveFamily: ({ - familyHead - }: { - familyHead: FamilyHead; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - kickFamilyMember: ({ - member - }: { - member: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; trackReward: ({ address, amount }: { address: string; amount: Coin; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - claimOperatorReward: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + claimOperatorReward: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; claimDelegatorReward: ({ mixId }: { mixId: number; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateMixnodeCostParams: ({ newCosts }: { - newCosts: MixNodeCostParams; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + newCosts: NodeCostParams; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateMixnodeConfig: ({ newConfig }: { newConfig: MixNodeConfigUpdate; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateMixnetAddress: ({ address }: { address: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; delegateToMixnode: ({ amount, mixId, @@ -559,14 +534,14 @@ export interface VestingInterface extends VestingReadOnlyInterface { amount: Coin; mixId: number; onBehalfOf?: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; undelegateFromMixnode: ({ mixId, onBehalfOf }: { mixId: number; onBehalfOf?: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; createAccount: ({ cap, ownerAddress, @@ -577,12 +552,12 @@ export interface VestingInterface extends VestingReadOnlyInterface { ownerAddress: string; stakingAddress?: string; vestingSpec?: VestingSpecification; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; withdrawVestedCoins: ({ amount }: { amount: Coin; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; trackUndelegation: ({ amount, mixId, @@ -591,7 +566,7 @@ export interface VestingInterface extends VestingReadOnlyInterface { amount: Coin; mixId: number; owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; bondMixnode: ({ amount, costParams, @@ -599,35 +574,35 @@ export interface VestingInterface extends VestingReadOnlyInterface { ownerSignature }: { amount: Coin; - costParams: MixNodeCostParams; + costParams: NodeCostParams; mixNode: MixNode; ownerSignature: MessageSignature; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; pledgeMore: ({ amount }: { amount: Coin; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; decreasePledge: ({ amount }: { amount: Coin; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - unbondMixnode: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + unbondMixnode: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; trackUnbondMixnode: ({ amount, owner }: { amount: Coin; owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; trackDecreasePledge: ({ amount, owner }: { amount: Coin; owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; bondGateway: ({ amount, gateway, @@ -636,52 +611,59 @@ export interface VestingInterface extends VestingReadOnlyInterface { amount: Coin; gateway: Gateway; ownerSignature: MessageSignature; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; - unbondGateway: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + unbondGateway: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; trackUnbondGateway: ({ amount, owner }: { amount: Coin; owner: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateGatewayConfig: ({ newConfig }: { newConfig: GatewayConfigUpdate; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; transferOwnership: ({ toAddress }: { toAddress: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateStakingAddress: ({ toAddress }: { toAddress?: string; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; updateLockedPledgeCap: ({ address, cap }: { address: string; cap: PledgeCap; - }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + trackMigratedMixnode: ({ + owner + }: { + owner: string; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; + trackMigratedDelegation: ({ + mixId, + owner + }: { + mixId: number; + owner: string; + }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise; } export class VestingClient extends VestingQueryClient implements VestingInterface { - client: SigningCosmWasmClient; + client: ISigningCosmWasmClient; sender: string; contractAddress: string; - - constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { + constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) { super(client, contractAddress); this.client = client; this.sender = sender; this.contractAddress = contractAddress; - this.createFamily = this.createFamily.bind(this); - this.joinFamily = this.joinFamily.bind(this); - this.leaveFamily = this.leaveFamily.bind(this); - this.kickFamilyMember = this.kickFamilyMember.bind(this); this.trackReward = this.trackReward.bind(this); this.claimOperatorReward = this.claimOperatorReward.bind(this); this.claimDelegatorReward = this.claimDelegatorReward.bind(this); @@ -706,117 +688,71 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac this.transferOwnership = this.transferOwnership.bind(this); this.updateStakingAddress = this.updateStakingAddress.bind(this); this.updateLockedPledgeCap = this.updateLockedPledgeCap.bind(this); + this.trackMigratedMixnode = this.trackMigratedMixnode.bind(this); + this.trackMigratedDelegation = this.trackMigratedDelegation.bind(this); } - - createFamily = async ({ - label - }: { - label: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - create_family: { - label - } - }, fee, memo, _funds); - }; - joinFamily = async ({ - familyHead, - joinPermit - }: { - familyHead: FamilyHead; - joinPermit: MessageSignature; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - join_family: { - family_head: familyHead, - join_permit: joinPermit - } - }, fee, memo, _funds); - }; - leaveFamily = async ({ - familyHead - }: { - familyHead: FamilyHead; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - leave_family: { - family_head: familyHead - } - }, fee, memo, _funds); - }; - kickFamilyMember = async ({ - member - }: { - member: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { - return await this.client.execute(this.sender, this.contractAddress, { - kick_family_member: { - member - } - }, fee, memo, _funds); - }; trackReward = async ({ address, amount }: { address: string; amount: Coin; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { track_reward: { address, amount } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - claimOperatorReward = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + claimOperatorReward = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { claim_operator_reward: {} - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; claimDelegatorReward = async ({ mixId }: { mixId: number; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { claim_delegator_reward: { mix_id: mixId } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateMixnodeCostParams = async ({ newCosts }: { - newCosts: MixNodeCostParams; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + newCosts: NodeCostParams; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_mixnode_cost_params: { new_costs: newCosts } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateMixnodeConfig = async ({ newConfig }: { newConfig: MixNodeConfigUpdate; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_mixnode_config: { new_config: newConfig } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateMixnetAddress = async ({ address }: { address: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_mixnet_address: { address } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; delegateToMixnode = async ({ amount, @@ -826,14 +762,14 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac amount: Coin; mixId: number; onBehalfOf?: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { delegate_to_mixnode: { amount, mix_id: mixId, on_behalf_of: onBehalfOf } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; undelegateFromMixnode = async ({ mixId, @@ -841,13 +777,13 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac }: { mixId: number; onBehalfOf?: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { undelegate_from_mixnode: { mix_id: mixId, on_behalf_of: onBehalfOf } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; createAccount = async ({ cap, @@ -859,7 +795,7 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac ownerAddress: string; stakingAddress?: string; vestingSpec?: VestingSpecification; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { create_account: { cap, @@ -867,18 +803,18 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac staking_address: stakingAddress, vesting_spec: vestingSpec } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; withdrawVestedCoins = async ({ amount }: { amount: Coin; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { withdraw_vested_coins: { amount } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; trackUndelegation = async ({ amount, @@ -888,14 +824,14 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac amount: Coin; mixId: number; owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { track_undelegation: { amount, mix_id: mixId, owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; bondMixnode = async ({ amount, @@ -904,10 +840,10 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac ownerSignature }: { amount: Coin; - costParams: MixNodeCostParams; + costParams: NodeCostParams; mixNode: MixNode; ownerSignature: MessageSignature; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { bond_mixnode: { amount, @@ -915,34 +851,34 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac mix_node: mixNode, owner_signature: ownerSignature } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; pledgeMore = async ({ amount }: { amount: Coin; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { pledge_more: { amount } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; decreasePledge = async ({ amount }: { amount: Coin; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { decrease_pledge: { amount } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - unbondMixnode = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + unbondMixnode = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { unbond_mixnode: {} - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; trackUnbondMixnode = async ({ amount, @@ -950,13 +886,13 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac }: { amount: Coin; owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { track_unbond_mixnode: { amount, owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; trackDecreasePledge = async ({ amount, @@ -964,13 +900,13 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac }: { amount: Coin; owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { track_decrease_pledge: { amount, owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; bondGateway = async ({ amount, @@ -980,19 +916,19 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac amount: Coin; gateway: Gateway; ownerSignature: MessageSignature; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { bond_gateway: { amount, gateway, owner_signature: ownerSignature } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; - unbondGateway = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + unbondGateway = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { unbond_gateway: {} - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; trackUnbondGateway = async ({ amount, @@ -1000,46 +936,46 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac }: { amount: Coin; owner: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { track_unbond_gateway: { amount, owner } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateGatewayConfig = async ({ newConfig }: { newConfig: GatewayConfigUpdate; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_gateway_config: { new_config: newConfig } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; transferOwnership = async ({ toAddress }: { toAddress: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { transfer_ownership: { to_address: toAddress } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateStakingAddress = async ({ toAddress }: { toAddress?: string; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_staking_address: { to_address: toAddress } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; updateLockedPledgeCap = async ({ address, @@ -1047,12 +983,37 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac }: { address: string; cap: PledgeCap; - }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise => { + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { return await this.client.execute(this.sender, this.contractAddress, { update_locked_pledge_cap: { address, cap } - }, fee, memo, _funds); + }, fee_, memo_, funds_); }; -} + trackMigratedMixnode = async ({ + owner + }: { + owner: string; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + track_migrated_mixnode: { + owner + } + }, fee_, memo_, funds_); + }; + trackMigratedDelegation = async ({ + mixId, + owner + }: { + mixId: number; + owner: string; + }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise => { + return await this.client.execute(this.sender, this.contractAddress, { + track_migrated_delegation: { + mix_id: mixId, + owner + } + }, fee_, memo_, funds_); + }; +} \ No newline at end of file diff --git a/sdk/typescript/codegen/contract-clients/src/Vesting.types.ts b/sdk/typescript/codegen/contract-clients/src/Vesting.types.ts index a07a32a242..8adbc94a8a 100644 --- a/sdk/typescript/codegen/contract-clients/src/Vesting.types.ts +++ b/sdk/typescript/codegen/contract-clients/src/Vesting.types.ts @@ -1,5 +1,5 @@ /** -* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run the @cosmwasm/ts-codegen generate command to regenerate this file. */ @@ -9,23 +9,6 @@ export interface InstantiateMsg { mixnet_contract_address: string; } export type ExecuteMsg = { - create_family: { - label: string; - }; -} | { - join_family: { - family_head: FamilyHead; - join_permit: MessageSignature; - }; -} | { - leave_family: { - family_head: FamilyHead; - }; -} | { - kick_family_member: { - member: string; - }; -} | { track_reward: { address: string; amount: Coin; @@ -38,7 +21,7 @@ export type ExecuteMsg = { }; } | { update_mixnode_cost_params: { - new_costs: MixNodeCostParams; + new_costs: NodeCostParams; }; } | { update_mixnode_config: { @@ -79,7 +62,7 @@ export type ExecuteMsg = { } | { bond_mixnode: { amount: Coin; - cost_params: MixNodeCostParams; + cost_params: NodeCostParams; mix_node: MixNode; owner_signature: MessageSignature; }; @@ -133,9 +116,16 @@ export type ExecuteMsg = { address: string; cap: PledgeCap; }; +} | { + track_migrated_mixnode: { + owner: string; + }; +} | { + track_migrated_delegation: { + mix_id: number; + owner: string; + }; }; -export type FamilyHead = string; -export type MessageSignature = number[]; export type Uint128 = string; export type Percent = Decimal; export type Decimal = string; @@ -144,12 +134,12 @@ export type PledgeCap = { } | { absolute: Uint128; }; +export type MessageSignature = number[]; export interface Coin { amount: Uint128; denom: string; - [k: string]: unknown; } -export interface MixNodeCostParams { +export interface NodeCostParams { interval_operating_cost: Coin; profit_margin_percent: Percent; } @@ -353,9 +343,12 @@ export interface ContractVersion { export interface ContractBuildInformation { build_timestamp: string; build_version: string; + cargo_debug?: string; + cargo_opt_level?: string; commit_branch: string; commit_sha: string; commit_timestamp: string; + contract_name?: string; rustc_version: string; } export type Period = "before" | { diff --git a/sdk/typescript/codegen/contract-clients/src/baseClient.ts b/sdk/typescript/codegen/contract-clients/src/baseClient.ts new file mode 100644 index 0000000000..c6a93a557e --- /dev/null +++ b/sdk/typescript/codegen/contract-clients/src/baseClient.ts @@ -0,0 +1,200 @@ +/** +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ + + +import { StdFee, Coin } from '@interchainjs/types'; +import { DirectSigner } from '@interchainjs/cosmos'; +import { getSmartContractState } from 'interchainjs/cosmwasm/wasm/v1/query.rpc.func'; +import { executeContract } from 'interchainjs/cosmwasm/wasm/v1/tx.rpc.func'; +import { QuerySmartContractStateRequest, QuerySmartContractStateResponse } from 'interchainjs/cosmwasm/wasm/v1/query'; +import { MsgExecuteContract } from 'interchainjs/cosmwasm/wasm/v1/tx'; +import { Chain } from '@chain-registry/v2-types'; + +// Encoding utility functions +const fromUint8Array = (uint8Array: Uint8Array): T => { + const text = new TextDecoder().decode(uint8Array); + return JSON.parse(text); +}; + +const toUint8Array = (obj: any): Uint8Array => { + const text = JSON.stringify(obj); + return new TextEncoder().encode(text); +}; + +// Chain registry configuration +// The amount under gasPrice represents gas price per unit +export interface ChainConfig { + chain?: Chain; + gasPrice?: { + denom: string; + amount: string; + }; +} + +// Gas fee calculation utilities +export const calculateGasFromChain = (chain: Chain, gasAmount: string): StdFee => { + try { + const feeTokens = chain.fees?.feeTokens; + + if (feeTokens && feeTokens.length > 0) { + const primaryToken = feeTokens[0]; + // v2 chain-registry uses camelCase: averageGasPrice, lowGasPrice, fixedMinGasPrice + const gasPrice = primaryToken.averageGasPrice || primaryToken.lowGasPrice || primaryToken.fixedMinGasPrice || 0.025; + const gasAmountNum = parseInt(gasAmount); + const feeAmount = Math.ceil(gasAmountNum * gasPrice).toString(); + + return { + amount: [{ + denom: primaryToken.denom, + amount: feeAmount + }], + gas: gasAmount + }; + } + } catch (error) { + console.warn('Failed to calculate gas from chain registry:', error); + } + + // Fallback to default + return { amount: [], gas: gasAmount }; +}; + +// Default gas amount - users can easily change this +export let DEFAULT_GAS_AMOUNT = '200000'; + +// Allow users to set their preferred default gas amount +export const setDefaultGasAmount = (gasAmount: string): void => { + DEFAULT_GAS_AMOUNT = gasAmount; +}; + +// Get current default gas amount +export const getDefaultGasAmount = (): string => DEFAULT_GAS_AMOUNT; + +export const getAutoGasFee = (chainConfig?: ChainConfig): StdFee => { + const gasAmount = DEFAULT_GAS_AMOUNT; + + if (chainConfig?.chain) { + return calculateGasFromChain(chainConfig.chain, gasAmount); + } + + if (chainConfig?.gasPrice) { + const gasAmountNum = parseInt(gasAmount); + const gasPriceNum = parseFloat(chainConfig.gasPrice.amount); + const feeAmount = Math.ceil(gasAmountNum * gasPriceNum).toString(); + + return { + amount: [{ + denom: chainConfig.gasPrice.denom, + amount: feeAmount + }], + gas: gasAmount + }; + } + + // Fallback: no fee tokens, just gas amount + return { amount: [], gas: gasAmount }; +}; + +// InterchainJS interfaces for CosmWasm clients +export interface ICosmWasmClient { + queryContractSmart(contractAddr: string, query: any): Promise; +} + +export interface ISigningCosmWasmClient extends ICosmWasmClient { + execute( + sender: string, + contractAddress: string, + msg: any, + fee?: number | StdFee | "auto", + memo?: string, + funds?: Coin[], + chainConfig?: ChainConfig + ): Promise; +} + +export interface ISigningClient { + signAndBroadcast( + signerAddress: string, + messages: any[], + fee: number | StdFee | "auto", + memo?: string + ): Promise; +} + +// Helper functions to create InterchainJS clients +export function getCosmWasmClient(rpcEndpoint: string): ICosmWasmClient { + return { + queryContractSmart: async (contractAddr: string, query: any) => { + // Create the request object + const request: QuerySmartContractStateRequest = { + address: contractAddr, + queryData: toUint8Array(query) + }; + + // Execute the query using InterchainJS + const response: QuerySmartContractStateResponse = await getSmartContractState(rpcEndpoint, request); + + // Parse and return the result + return fromUint8Array(response.data); + }, + }; +} + +export function getSigningCosmWasmClient(signingClient: DirectSigner, rpcEndpoint?: string): ISigningCosmWasmClient { + return { + queryContractSmart: async (contractAddr: string, query: any) => { + if (!rpcEndpoint) { + throw new Error('rpcEndpoint is required for queryContractSmart in signing client'); + } + const request: QuerySmartContractStateRequest = { + address: contractAddr, + queryData: toUint8Array(query) + }; + const response: QuerySmartContractStateResponse = await getSmartContractState(rpcEndpoint, request); + return fromUint8Array(response.data); + }, + execute: async ( + sender: string, + contractAddress: string, + msg: any, + fee?: number | StdFee | "auto", + memo?: string, + funds?: Coin[], + chainConfig?: ChainConfig + ) => { + // Handle fee conversion + let finalFee: StdFee; + if (typeof fee === 'number') { + finalFee = { amount: [], gas: fee.toString() }; + } else if (fee === 'auto') { + finalFee = getAutoGasFee(chainConfig); + } else if (fee) { + finalFee = fee; + } else { + finalFee = getAutoGasFee(chainConfig); + } + + // Create the message object + const message: MsgExecuteContract = { + sender, + contract: contractAddress, + msg: toUint8Array(msg), + funds: funds || [] + }; + + // Execute the transaction using InterchainJS + const result = await executeContract( + signingClient as any, + sender, + message, + finalFee, + memo || '' + ); + + return result; + }, + }; +} diff --git a/sdk/typescript/codegen/contract-clients/src/index.ts b/sdk/typescript/codegen/contract-clients/src/index.ts index 530b718908..45d5479875 100644 --- a/sdk/typescript/codegen/contract-clients/src/index.ts +++ b/sdk/typescript/codegen/contract-clients/src/index.ts @@ -1,35 +1,48 @@ /** - * This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run the @cosmwasm/ts-codegen generate command to regenerate this file. - */ +* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3. +* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, +* and run the @cosmwasm/ts-codegen generate command to regenerate this file. +*/ -import * as _0 from './CoconutBandwidth.types'; -import * as _1 from './CoconutBandwidth.client'; -import * as _2 from './CoconutDkg.types'; -import * as _3 from './CoconutDkg.client'; -import * as _4 from './Mixnet.types'; -import * as _5 from './Mixnet.client'; -import * as _6 from './Cw3FlexMultisig.types'; -import * as _7 from './Cw3FlexMultisig.client'; -import * as _8 from './Cw4Group.types'; -import * as _9 from './Cw4Group.client'; -import * as _10 from './NameService.types'; -import * as _11 from './NameService.client'; -import * as _12 from './ServiceProviderDirectory.types'; -import * as _13 from './ServiceProviderDirectory.client'; -import * as _14 from './Vesting.types'; -import * as _15 from './Vesting.client'; -export * from './types'; - -/** @namespace */ +import * as _0 from "./Ecash.types"; +import * as _1 from "./Ecash.client"; +import * as _2 from "./CoconutDkg.types"; +import * as _3 from "./CoconutDkg.client"; +import * as _4 from "./Mixnet.types"; +import * as _5 from "./Mixnet.client"; +import * as _6 from "./Cw3FlexMultisig.types"; +import * as _7 from "./Cw3FlexMultisig.client"; +import * as _8 from "./Cw4Group.types"; +import * as _9 from "./Cw4Group.client"; +import * as _10 from "./Vesting.types"; +import * as _11 from "./Vesting.client"; +import * as _12 from "./baseClient"; export namespace contracts { - export const CoconutBandwidth = { ..._0, ..._1 }; - export const CoconutDkg = { ..._2, ..._3 }; - export const Mixnet = { ..._4, ..._5 }; - export const Cw3FlexMultisig = { ..._6, ..._7 }; - export const Cw4Group = { ..._8, ..._9 }; - export const NameService = { ..._10, ..._11 }; - export const ServiceProviderDirectory = { ..._12, ..._13 }; - export const Vesting = { ..._14, ..._15 }; -} + export const Ecash = { + ..._0, + ..._1 + }; + export const CoconutDkg = { + ..._2, + ..._3 + }; + export const Mixnet = { + ..._4, + ..._5 + }; + export const Cw3FlexMultisig = { + ..._6, + ..._7 + }; + export const Cw4Group = { + ..._8, + ..._9 + }; + export const Vesting = { + ..._10, + ..._11 + }; + export const baseClient = { + ..._12 + }; +} \ No newline at end of file