From 34eeffe98911bdb3bed4c8d19b0e7b14351bf1e7 Mon Sep 17 00:00:00 2001 From: p0p3yee Date: Wed, 17 Jan 2024 11:58:24 -0500 Subject: [PATCH] Update ts client --- go.mod | 2 +- ts-client/fairyring.keyshare/module.ts | 164 +--- ts-client/fairyring.keyshare/registry.ts | 20 +- ts-client/fairyring.keyshare/rest.ts | 44 +- .../fairyring/keyshare/general_key_share.ts | 11 - .../types/fairyring/keyshare/genesis.ts | 9 - .../types/fairyring/keyshare/packet.ts | 44 +- .../types/fairyring/keyshare/query.ts | 124 +++ .../types/fairyring/keyshare/tx.ts | 893 ++++-------------- ts-client/fairyring.pep/module.ts | 48 +- ts-client/fairyring.pep/registry.ts | 4 +- .../types/fairyring/pep/packet.ts | 8 +- ts-client/package.json | 2 +- 13 files changed, 452 insertions(+), 921 deletions(-) diff --git a/go.mod b/go.mod index 7f01be34..2c0a2d59 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( cosmossdk.io/errors v1.0.0-beta.7 cosmossdk.io/math v1.0.1 github.com/FairBlock/DistributedIBE v0.0.0-20230528025616-f58fb2b93eaf + github.com/armon/go-metrics v0.4.1 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 github.com/cosmos/cosmos-sdk v0.47.3 @@ -47,7 +48,6 @@ require ( github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/OneOfOne/xxhash v1.2.8 // indirect - github.com/armon/go-metrics v0.4.1 // indirect github.com/aws/aws-sdk-go v1.44.203 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect diff --git a/ts-client/fairyring.keyshare/module.ts b/ts-client/fairyring.keyshare/module.ts index c1fb55fb..d416db1d 100755 --- a/ts-client/fairyring.keyshare/module.ts +++ b/ts-client/fairyring.keyshare/module.ts @@ -7,14 +7,12 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgCreateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { MsgRegisterValidator } from "./types/fairyring/keyshare/tx"; import { MsgDeleteAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { MsgCreateGeneralKeyShare } from "./types/fairyring/keyshare/tx"; -import { MsgUpdateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { MsgDeleteGeneralKeyShare } from "./types/fairyring/keyshare/tx"; import { MsgCreateLatestPubKey } from "./types/fairyring/keyshare/tx"; -import { MsgUpdateGeneralKeyShare } from "./types/fairyring/keyshare/tx"; +import { MsgUpdateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; +import { MsgCreateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; +import { MsgCreateGeneralKeyShare } from "./types/fairyring/keyshare/tx"; +import { MsgRegisterValidator } from "./types/fairyring/keyshare/tx"; import { MsgSendKeyshare } from "./types/fairyring/keyshare/tx"; import { AggregatedKeyShare as typeAggregatedKeyShare} from "./types" @@ -38,19 +36,7 @@ import { IBCInfo as typeIBCInfo} from "./types" import { CounterPartyIBCInfo as typeCounterPartyIBCInfo} from "./types" import { ValidatorSet as typeValidatorSet} from "./types" -export { MsgCreateAuthorizedAddress, MsgRegisterValidator, MsgDeleteAuthorizedAddress, MsgCreateGeneralKeyShare, MsgUpdateAuthorizedAddress, MsgDeleteGeneralKeyShare, MsgCreateLatestPubKey, MsgUpdateGeneralKeyShare, MsgSendKeyshare }; - -type sendMsgCreateAuthorizedAddressParams = { - value: MsgCreateAuthorizedAddress, - fee?: StdFee, - memo?: string -}; - -type sendMsgRegisterValidatorParams = { - value: MsgRegisterValidator, - fee?: StdFee, - memo?: string -}; +export { MsgDeleteAuthorizedAddress, MsgCreateLatestPubKey, MsgUpdateAuthorizedAddress, MsgCreateAuthorizedAddress, MsgCreateGeneralKeyShare, MsgRegisterValidator, MsgSendKeyshare }; type sendMsgDeleteAuthorizedAddressParams = { value: MsgDeleteAuthorizedAddress, @@ -58,8 +44,8 @@ type sendMsgDeleteAuthorizedAddressParams = { memo?: string }; -type sendMsgCreateGeneralKeyShareParams = { - value: MsgCreateGeneralKeyShare, +type sendMsgCreateLatestPubKeyParams = { + value: MsgCreateLatestPubKey, fee?: StdFee, memo?: string }; @@ -70,20 +56,20 @@ type sendMsgUpdateAuthorizedAddressParams = { memo?: string }; -type sendMsgDeleteGeneralKeyShareParams = { - value: MsgDeleteGeneralKeyShare, +type sendMsgCreateAuthorizedAddressParams = { + value: MsgCreateAuthorizedAddress, fee?: StdFee, memo?: string }; -type sendMsgCreateLatestPubKeyParams = { - value: MsgCreateLatestPubKey, +type sendMsgCreateGeneralKeyShareParams = { + value: MsgCreateGeneralKeyShare, fee?: StdFee, memo?: string }; -type sendMsgUpdateGeneralKeyShareParams = { - value: MsgUpdateGeneralKeyShare, +type sendMsgRegisterValidatorParams = { + value: MsgRegisterValidator, fee?: StdFee, memo?: string }; @@ -95,36 +81,28 @@ type sendMsgSendKeyshareParams = { }; -type msgCreateAuthorizedAddressParams = { - value: MsgCreateAuthorizedAddress, -}; - -type msgRegisterValidatorParams = { - value: MsgRegisterValidator, -}; - type msgDeleteAuthorizedAddressParams = { value: MsgDeleteAuthorizedAddress, }; -type msgCreateGeneralKeyShareParams = { - value: MsgCreateGeneralKeyShare, +type msgCreateLatestPubKeyParams = { + value: MsgCreateLatestPubKey, }; type msgUpdateAuthorizedAddressParams = { value: MsgUpdateAuthorizedAddress, }; -type msgDeleteGeneralKeyShareParams = { - value: MsgDeleteGeneralKeyShare, +type msgCreateAuthorizedAddressParams = { + value: MsgCreateAuthorizedAddress, }; -type msgCreateLatestPubKeyParams = { - value: MsgCreateLatestPubKey, +type msgCreateGeneralKeyShareParams = { + value: MsgCreateGeneralKeyShare, }; -type msgUpdateGeneralKeyShareParams = { - value: MsgUpdateGeneralKeyShare, +type msgRegisterValidatorParams = { + value: MsgRegisterValidator, }; type msgSendKeyshareParams = { @@ -161,34 +139,6 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgCreateAuthorizedAddress({ value, fee, memo }: sendMsgCreateAuthorizedAddressParams): Promise { - if (!signer) { - throw new Error('TxClient:sendMsgCreateAuthorizedAddress: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgCreateAuthorizedAddress({ value: MsgCreateAuthorizedAddress.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendMsgCreateAuthorizedAddress: Could not broadcast Tx: '+ e.message) - } - }, - - async sendMsgRegisterValidator({ value, fee, memo }: sendMsgRegisterValidatorParams): Promise { - if (!signer) { - throw new Error('TxClient:sendMsgRegisterValidator: Unable to sign Tx. Signer is not present.') - } - try { - const { address } = (await signer.getAccounts())[0]; - const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgRegisterValidator({ value: MsgRegisterValidator.fromPartial(value) }) - return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) - } catch (e: any) { - throw new Error('TxClient:sendMsgRegisterValidator: Could not broadcast Tx: '+ e.message) - } - }, - async sendMsgDeleteAuthorizedAddress({ value, fee, memo }: sendMsgDeleteAuthorizedAddressParams): Promise { if (!signer) { throw new Error('TxClient:sendMsgDeleteAuthorizedAddress: Unable to sign Tx. Signer is not present.') @@ -203,17 +153,17 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgCreateGeneralKeyShare({ value, fee, memo }: sendMsgCreateGeneralKeyShareParams): Promise { + async sendMsgCreateLatestPubKey({ value, fee, memo }: sendMsgCreateLatestPubKeyParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateGeneralKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateLatestPubKey: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgCreateGeneralKeyShare({ value: MsgCreateGeneralKeyShare.fromPartial(value) }) + let msg = this.msgCreateLatestPubKey({ value: MsgCreateLatestPubKey.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateGeneralKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateLatestPubKey: Could not broadcast Tx: '+ e.message) } }, @@ -231,45 +181,45 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - async sendMsgDeleteGeneralKeyShare({ value, fee, memo }: sendMsgDeleteGeneralKeyShareParams): Promise { + async sendMsgCreateAuthorizedAddress({ value, fee, memo }: sendMsgCreateAuthorizedAddressParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgDeleteGeneralKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateAuthorizedAddress: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgDeleteGeneralKeyShare({ value: MsgDeleteGeneralKeyShare.fromPartial(value) }) + let msg = this.msgCreateAuthorizedAddress({ value: MsgCreateAuthorizedAddress.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgDeleteGeneralKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateAuthorizedAddress: Could not broadcast Tx: '+ e.message) } }, - async sendMsgCreateLatestPubKey({ value, fee, memo }: sendMsgCreateLatestPubKeyParams): Promise { + async sendMsgCreateGeneralKeyShare({ value, fee, memo }: sendMsgCreateGeneralKeyShareParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateLatestPubKey: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateGeneralKeyShare: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgCreateLatestPubKey({ value: MsgCreateLatestPubKey.fromPartial(value) }) + let msg = this.msgCreateGeneralKeyShare({ value: MsgCreateGeneralKeyShare.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateLatestPubKey: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateGeneralKeyShare: Could not broadcast Tx: '+ e.message) } }, - async sendMsgUpdateGeneralKeyShare({ value, fee, memo }: sendMsgUpdateGeneralKeyShareParams): Promise { + async sendMsgRegisterValidator({ value, fee, memo }: sendMsgRegisterValidatorParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgUpdateGeneralKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgRegisterValidator: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgUpdateGeneralKeyShare({ value: MsgUpdateGeneralKeyShare.fromPartial(value) }) + let msg = this.msgRegisterValidator({ value: MsgRegisterValidator.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgUpdateGeneralKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgRegisterValidator: Could not broadcast Tx: '+ e.message) } }, @@ -288,22 +238,6 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht }, - msgCreateAuthorizedAddress({ value }: msgCreateAuthorizedAddressParams): EncodeObject { - try { - return { typeUrl: "/fairyring.keyshare.MsgCreateAuthorizedAddress", value: MsgCreateAuthorizedAddress.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgCreateAuthorizedAddress: Could not create message: ' + e.message) - } - }, - - msgRegisterValidator({ value }: msgRegisterValidatorParams): EncodeObject { - try { - return { typeUrl: "/fairyring.keyshare.MsgRegisterValidator", value: MsgRegisterValidator.fromPartial( value ) } - } catch (e: any) { - throw new Error('TxClient:MsgRegisterValidator: Could not create message: ' + e.message) - } - }, - msgDeleteAuthorizedAddress({ value }: msgDeleteAuthorizedAddressParams): EncodeObject { try { return { typeUrl: "/fairyring.keyshare.MsgDeleteAuthorizedAddress", value: MsgDeleteAuthorizedAddress.fromPartial( value ) } @@ -312,11 +246,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgCreateGeneralKeyShare({ value }: msgCreateGeneralKeyShareParams): EncodeObject { + msgCreateLatestPubKey({ value }: msgCreateLatestPubKeyParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgCreateGeneralKeyShare", value: MsgCreateGeneralKeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgCreateLatestPubKey", value: MsgCreateLatestPubKey.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateGeneralKeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateLatestPubKey: Could not create message: ' + e.message) } }, @@ -328,27 +262,27 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht } }, - msgDeleteGeneralKeyShare({ value }: msgDeleteGeneralKeyShareParams): EncodeObject { + msgCreateAuthorizedAddress({ value }: msgCreateAuthorizedAddressParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgDeleteGeneralKeyShare", value: MsgDeleteGeneralKeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgCreateAuthorizedAddress", value: MsgCreateAuthorizedAddress.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgDeleteGeneralKeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateAuthorizedAddress: Could not create message: ' + e.message) } }, - msgCreateLatestPubKey({ value }: msgCreateLatestPubKeyParams): EncodeObject { + msgCreateGeneralKeyShare({ value }: msgCreateGeneralKeyShareParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgCreateLatestPubKey", value: MsgCreateLatestPubKey.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgCreateGeneralKeyShare", value: MsgCreateGeneralKeyShare.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateLatestPubKey: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateGeneralKeyShare: Could not create message: ' + e.message) } }, - msgUpdateGeneralKeyShare({ value }: msgUpdateGeneralKeyShareParams): EncodeObject { + msgRegisterValidator({ value }: msgRegisterValidatorParams): EncodeObject { try { - return { typeUrl: "/fairyring.keyshare.MsgUpdateGeneralKeyShare", value: MsgUpdateGeneralKeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.keyshare.MsgRegisterValidator", value: MsgRegisterValidator.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgUpdateGeneralKeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:MsgRegisterValidator: Could not create message: ' + e.message) } }, diff --git a/ts-client/fairyring.keyshare/registry.ts b/ts-client/fairyring.keyshare/registry.ts index aad5d0c3..118ddace 100755 --- a/ts-client/fairyring.keyshare/registry.ts +++ b/ts-client/fairyring.keyshare/registry.ts @@ -1,23 +1,19 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgCreateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { MsgRegisterValidator } from "./types/fairyring/keyshare/tx"; import { MsgDeleteAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { MsgCreateGeneralKeyShare } from "./types/fairyring/keyshare/tx"; -import { MsgUpdateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; -import { MsgDeleteGeneralKeyShare } from "./types/fairyring/keyshare/tx"; import { MsgCreateLatestPubKey } from "./types/fairyring/keyshare/tx"; -import { MsgUpdateGeneralKeyShare } from "./types/fairyring/keyshare/tx"; +import { MsgUpdateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; +import { MsgCreateAuthorizedAddress } from "./types/fairyring/keyshare/tx"; +import { MsgCreateGeneralKeyShare } from "./types/fairyring/keyshare/tx"; +import { MsgRegisterValidator } from "./types/fairyring/keyshare/tx"; import { MsgSendKeyshare } from "./types/fairyring/keyshare/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/fairyring.keyshare.MsgCreateAuthorizedAddress", MsgCreateAuthorizedAddress], - ["/fairyring.keyshare.MsgRegisterValidator", MsgRegisterValidator], ["/fairyring.keyshare.MsgDeleteAuthorizedAddress", MsgDeleteAuthorizedAddress], - ["/fairyring.keyshare.MsgCreateGeneralKeyShare", MsgCreateGeneralKeyShare], - ["/fairyring.keyshare.MsgUpdateAuthorizedAddress", MsgUpdateAuthorizedAddress], - ["/fairyring.keyshare.MsgDeleteGeneralKeyShare", MsgDeleteGeneralKeyShare], ["/fairyring.keyshare.MsgCreateLatestPubKey", MsgCreateLatestPubKey], - ["/fairyring.keyshare.MsgUpdateGeneralKeyShare", MsgUpdateGeneralKeyShare], + ["/fairyring.keyshare.MsgUpdateAuthorizedAddress", MsgUpdateAuthorizedAddress], + ["/fairyring.keyshare.MsgCreateAuthorizedAddress", MsgCreateAuthorizedAddress], + ["/fairyring.keyshare.MsgCreateGeneralKeyShare", MsgCreateGeneralKeyShare], + ["/fairyring.keyshare.MsgRegisterValidator", MsgRegisterValidator], ["/fairyring.keyshare.MsgSendKeyshare", MsgSendKeyshare], ]; diff --git a/ts-client/fairyring.keyshare/rest.ts b/ts-client/fairyring.keyshare/rest.ts index 22e501a2..1e16bdcf 100644 --- a/ts-client/fairyring.keyshare/rest.ts +++ b/ts-client/fairyring.keyshare/rest.ts @@ -29,6 +29,10 @@ export interface KeyshareAuthorizedAddress { authorizedBy?: string; } +export interface KeyshareCommitments { + commitments?: string[]; +} + export interface KeyshareGeneralKeyShare { validator?: string; idType?: string; @@ -43,7 +47,6 @@ export interface KeyshareGeneralKeyShare { /** @format uint64 */ receivedBlockHeight?: string; - creator?: string; } export interface KeyshareKeyShare { @@ -65,14 +68,25 @@ export interface KeyshareKeyShare { export type KeyshareMsgCreateAuthorizedAddressResponse = object; -export type KeyshareMsgCreateGeneralKeyShareResponse = object; +export interface KeyshareMsgCreateGeneralKeyShareResponse { + creator?: string; + idType?: string; + idValue?: string; + keyShare?: string; + + /** @format uint64 */ + keyShareIndex?: string; + + /** @format uint64 */ + receivedBlockHeight?: string; + success?: boolean; + errorMessage?: string; +} export type KeyshareMsgCreateLatestPubKeyResponse = object; export type KeyshareMsgDeleteAuthorizedAddressResponse = object; -export type KeyshareMsgDeleteGeneralKeyShareResponse = object; - export interface KeyshareMsgRegisterValidatorResponse { creator?: string; } @@ -95,8 +109,6 @@ export interface KeyshareMsgSendKeyshareResponse { export type KeyshareMsgUpdateAuthorizedAddressResponse = object; -export type KeyshareMsgUpdateGeneralKeyShareResponse = object; - /** * Params defines the parameters for the module. */ @@ -193,6 +205,11 @@ export interface KeyshareQueryAllValidatorSetResponse { pagination?: V1Beta1PageResponse; } +export interface KeyshareQueryCommitmentsResponse { + activeCommitments?: KeyshareCommitments; + queuedCommitments?: KeyshareCommitments; +} + export interface KeyshareQueryGetAggregatedKeyShareResponse { aggregatedKeyShare?: KeyshareAggregatedKeyShare; } @@ -531,6 +548,21 @@ export class Api extends HttpClient + this.request({ + path: `/fairyring/keyshare/commitments`, + method: "GET", + format: "json", + ...params, + }); + /** * No description * diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/general_key_share.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/general_key_share.ts index 4b6b2513..70646572 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/general_key_share.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/general_key_share.ts @@ -12,7 +12,6 @@ export interface GeneralKeyShare { keyShareIndex: number; receivedTimestamp: number; receivedBlockHeight: number; - creator: string; } function createBaseGeneralKeyShare(): GeneralKeyShare { @@ -24,7 +23,6 @@ function createBaseGeneralKeyShare(): GeneralKeyShare { keyShareIndex: 0, receivedTimestamp: 0, receivedBlockHeight: 0, - creator: "", }; } @@ -51,9 +49,6 @@ export const GeneralKeyShare = { if (message.receivedBlockHeight !== 0) { writer.uint32(56).uint64(message.receivedBlockHeight); } - if (message.creator !== "") { - writer.uint32(66).string(message.creator); - } return writer; }, @@ -85,9 +80,6 @@ export const GeneralKeyShare = { case 7: message.receivedBlockHeight = longToNumber(reader.uint64() as Long); break; - case 8: - message.creator = reader.string(); - break; default: reader.skipType(tag & 7); break; @@ -105,7 +97,6 @@ export const GeneralKeyShare = { keyShareIndex: isSet(object.keyShareIndex) ? Number(object.keyShareIndex) : 0, receivedTimestamp: isSet(object.receivedTimestamp) ? Number(object.receivedTimestamp) : 0, receivedBlockHeight: isSet(object.receivedBlockHeight) ? Number(object.receivedBlockHeight) : 0, - creator: isSet(object.creator) ? String(object.creator) : "", }; }, @@ -118,7 +109,6 @@ export const GeneralKeyShare = { message.keyShareIndex !== undefined && (obj.keyShareIndex = Math.round(message.keyShareIndex)); message.receivedTimestamp !== undefined && (obj.receivedTimestamp = Math.round(message.receivedTimestamp)); message.receivedBlockHeight !== undefined && (obj.receivedBlockHeight = Math.round(message.receivedBlockHeight)); - message.creator !== undefined && (obj.creator = message.creator); return obj; }, @@ -131,7 +121,6 @@ export const GeneralKeyShare = { message.keyShareIndex = object.keyShareIndex ?? 0; message.receivedTimestamp = object.receivedTimestamp ?? 0; message.receivedBlockHeight = object.receivedBlockHeight ?? 0; - message.creator = object.creator ?? ""; return message; }, }; diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/genesis.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/genesis.ts index d3ef8012..cee7daca 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/genesis.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/genesis.ts @@ -73,15 +73,6 @@ export const GenesisState = { for (const v of message.generalKeyShareList) { GeneralKeyShare.encode(v!, writer.uint32(82).fork()).ldelim(); } - if (message.activePubKey !== undefined) { - ActivePubKey.encode(message.activePubKey, writer.uint32(42).fork()).ldelim(); - } - if (message.queuedPubKey !== undefined) { - QueuedPubKey.encode(message.queuedPubKey, writer.uint32(50).fork()).ldelim(); - } - for (const v of message.authorizedAddressList) { - AuthorizedAddress.encode(v!, writer.uint32(58).fork()).ldelim(); - } return writer; }, diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/packet.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/packet.ts index eec4e3c2..6d32c444 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/packet.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/packet.ts @@ -1,4 +1,5 @@ /* eslint-disable */ +import Long from "long"; import _m0 from "protobufjs/minimal"; export const protobufPackage = "fairyring.keyshare"; @@ -40,6 +41,7 @@ export interface AggrKeyshareDataPacketData { aggrKeyshare: string; aggrHeight: string; proposalId: string; + retries: number; } /** AggrKeyshareDataPacketAck defines a struct for the packet acknowledgment */ @@ -384,7 +386,7 @@ export const GetAggrKeysharePacketAck = { }; function createBaseAggrKeyshareDataPacketData(): AggrKeyshareDataPacketData { - return { identity: "", pubkey: "", aggrKeyshare: "", aggrHeight: "", proposalId: "" }; + return { identity: "", pubkey: "", aggrKeyshare: "", aggrHeight: "", proposalId: "", retries: 0 }; } export const AggrKeyshareDataPacketData = { @@ -404,6 +406,9 @@ export const AggrKeyshareDataPacketData = { if (message.proposalId !== "") { writer.uint32(42).string(message.proposalId); } + if (message.retries !== 0) { + writer.uint32(48).uint64(message.retries); + } return writer; }, @@ -429,6 +434,9 @@ export const AggrKeyshareDataPacketData = { case 5: message.proposalId = reader.string(); break; + case 6: + message.retries = longToNumber(reader.uint64() as Long); + break; default: reader.skipType(tag & 7); break; @@ -444,6 +452,7 @@ export const AggrKeyshareDataPacketData = { aggrKeyshare: isSet(object.aggrKeyshare) ? String(object.aggrKeyshare) : "", aggrHeight: isSet(object.aggrHeight) ? String(object.aggrHeight) : "", proposalId: isSet(object.proposalId) ? String(object.proposalId) : "", + retries: isSet(object.retries) ? Number(object.retries) : 0, }; }, @@ -454,6 +463,7 @@ export const AggrKeyshareDataPacketData = { message.aggrKeyshare !== undefined && (obj.aggrKeyshare = message.aggrKeyshare); message.aggrHeight !== undefined && (obj.aggrHeight = message.aggrHeight); message.proposalId !== undefined && (obj.proposalId = message.proposalId); + message.retries !== undefined && (obj.retries = Math.round(message.retries)); return obj; }, @@ -464,6 +474,7 @@ export const AggrKeyshareDataPacketData = { message.aggrKeyshare = object.aggrKeyshare ?? ""; message.aggrHeight = object.aggrHeight ?? ""; message.proposalId = object.proposalId ?? ""; + message.retries = object.retries ?? 0; return message; }, }; @@ -507,6 +518,25 @@ export const AggrKeyshareDataPacketAck = { }, }; +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; export type DeepPartial = T extends Builtin ? T @@ -518,6 +548,18 @@ type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; +function longToNumber(long: Long): number { + if (long.gt(Number.MAX_SAFE_INTEGER)) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + return long.toNumber(); +} + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + function isSet(value: any): boolean { return value !== null && value !== undefined; } diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/query.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/query.ts index e70403b1..6348b0dc 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/query.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/query.ts @@ -4,6 +4,7 @@ import _m0 from "protobufjs/minimal"; import { PageRequest, PageResponse } from "../../cosmos/base/query/v1beta1/pagination"; import { AggregatedKeyShare } from "./aggregated_key_share"; import { AuthorizedAddress } from "./authorized_address"; +import { Commitments } from "./commitments"; import { GeneralKeyShare } from "./general_key_share"; import { KeyShare } from "./key_share"; import { Params } from "./params"; @@ -12,6 +13,14 @@ import { ValidatorSet } from "./validator_set"; export const protobufPackage = "fairyring.keyshare"; +export interface QueryCommitmentsRequest { +} + +export interface QueryCommitmentsResponse { + activeCommitments: Commitments | undefined; + queuedCommitments: Commitments | undefined; +} + /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { } @@ -119,6 +128,113 @@ export interface QueryAllGeneralKeyShareResponse { pagination: PageResponse | undefined; } +function createBaseQueryCommitmentsRequest(): QueryCommitmentsRequest { + return {}; +} + +export const QueryCommitmentsRequest = { + encode(_: QueryCommitmentsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommitmentsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryCommitmentsRequest { + return {}; + }, + + toJSON(_: QueryCommitmentsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryCommitmentsRequest { + const message = createBaseQueryCommitmentsRequest(); + return message; + }, +}; + +function createBaseQueryCommitmentsResponse(): QueryCommitmentsResponse { + return { activeCommitments: undefined, queuedCommitments: undefined }; +} + +export const QueryCommitmentsResponse = { + encode(message: QueryCommitmentsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.activeCommitments !== undefined) { + Commitments.encode(message.activeCommitments, writer.uint32(10).fork()).ldelim(); + } + if (message.queuedCommitments !== undefined) { + Commitments.encode(message.queuedCommitments, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryCommitmentsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommitmentsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.activeCommitments = Commitments.decode(reader, reader.uint32()); + break; + case 2: + message.queuedCommitments = Commitments.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryCommitmentsResponse { + return { + activeCommitments: isSet(object.activeCommitments) ? Commitments.fromJSON(object.activeCommitments) : undefined, + queuedCommitments: isSet(object.queuedCommitments) ? Commitments.fromJSON(object.queuedCommitments) : undefined, + }; + }, + + toJSON(message: QueryCommitmentsResponse): unknown { + const obj: any = {}; + message.activeCommitments !== undefined + && (obj.activeCommitments = message.activeCommitments + ? Commitments.toJSON(message.activeCommitments) + : undefined); + message.queuedCommitments !== undefined + && (obj.queuedCommitments = message.queuedCommitments + ? Commitments.toJSON(message.queuedCommitments) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryCommitmentsResponse { + const message = createBaseQueryCommitmentsResponse(); + message.activeCommitments = (object.activeCommitments !== undefined && object.activeCommitments !== null) + ? Commitments.fromPartial(object.activeCommitments) + : undefined; + message.queuedCommitments = (object.queuedCommitments !== undefined && object.queuedCommitments !== null) + ? Commitments.fromPartial(object.queuedCommitments) + : undefined; + return message; + }, +}; + function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } @@ -1446,6 +1562,7 @@ export const QueryAllGeneralKeyShareResponse = { /** Query defines the gRPC querier service. */ export interface Query { + Commitments(request: QueryCommitmentsRequest): Promise; /** Parameters queries the parameters of the module. */ Params(request: QueryParamsRequest): Promise; /** Queries a ValidatorSet by index. */ @@ -1473,6 +1590,7 @@ export class QueryClientImpl implements Query { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; + this.Commitments = this.Commitments.bind(this); this.Params = this.Params.bind(this); this.ValidatorSet = this.ValidatorSet.bind(this); this.ValidatorSetAll = this.ValidatorSetAll.bind(this); @@ -1486,6 +1604,12 @@ export class QueryClientImpl implements Query { this.GeneralKeyShare = this.GeneralKeyShare.bind(this); this.GeneralKeyShareAll = this.GeneralKeyShareAll.bind(this); } + Commitments(request: QueryCommitmentsRequest): Promise { + const data = QueryCommitmentsRequest.encode(request).finish(); + const promise = this.rpc.request("fairyring.keyshare.Query", "Commitments", data); + return promise.then((data) => QueryCommitmentsResponse.decode(new _m0.Reader(data))); + } + Params(request: QueryParamsRequest): Promise { const data = QueryParamsRequest.encode(request).finish(); const promise = this.rpc.request("fairyring.keyshare.Query", "Params", data); diff --git a/ts-client/fairyring.keyshare/types/fairyring/keyshare/tx.ts b/ts-client/fairyring.keyshare/types/fairyring/keyshare/tx.ts index ad61b89f..d2d3a7a4 100644 --- a/ts-client/fairyring.keyshare/types/fairyring/keyshare/tx.ts +++ b/ts-client/fairyring.keyshare/types/fairyring/keyshare/tx.ts @@ -66,7 +66,6 @@ export interface MsgDeleteAuthorizedAddressResponse { export interface MsgCreateGeneralKeyShare { creator: string; - validator: string; idType: string; idValue: string; keyShare: string; @@ -76,30 +75,14 @@ export interface MsgCreateGeneralKeyShare { } export interface MsgCreateGeneralKeyShareResponse { -} - -export interface MsgUpdateGeneralKeyShare { creator: string; - validator: string; idType: string; idValue: string; keyShare: string; keyShareIndex: number; - receivedTimestamp: number; receivedBlockHeight: number; -} - -export interface MsgUpdateGeneralKeyShareResponse { -} - -export interface MsgDeleteGeneralKeyShare { - creator: string; - validator: string; - idType: string; - idValue: string; -} - -export interface MsgDeleteGeneralKeyShareResponse { + success: boolean; + errorMessage: string; } function createBaseMsgRegisterValidator(): MsgRegisterValidator { @@ -799,46 +782,71 @@ export const MsgDeleteAuthorizedAddressResponse = { }, }; -/** Msg defines the Msg service. */ -export interface Msg { - RegisterValidator(request: MsgRegisterValidator): Promise; - SendKeyshare(request: MsgSendKeyshare): Promise; - /** this line is used by starport scaffolding # proto/tx/rpc */ - CreateLatestPubKey(request: MsgCreateLatestPubKey): Promise; - CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise; - UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; - DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; +function createBaseMsgCreateGeneralKeyShare(): MsgCreateGeneralKeyShare { + return { + creator: "", + idType: "", + idValue: "", + keyShare: "", + keyShareIndex: 0, + receivedTimestamp: 0, + receivedBlockHeight: 0, + }; } -export class MsgClientImpl implements Msg { - private readonly rpc: Rpc; - constructor(rpc: Rpc) { - this.rpc = rpc; - this.RegisterValidator = this.RegisterValidator.bind(this); - this.SendKeyshare = this.SendKeyshare.bind(this); - this.CreateLatestPubKey = this.CreateLatestPubKey.bind(this); - this.CreateAuthorizedAddress = this.CreateAuthorizedAddress.bind(this); - this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); - this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); - } - RegisterValidator(request: MsgRegisterValidator): Promise { - const data = MsgRegisterValidator.encode(request).finish(); - const promise = this.rpc.request("fairyring.keyshare.Msg", "RegisterValidator", data); - return promise.then((data) => MsgRegisterValidatorResponse.decode(new _m0.Reader(data))); - } +export const MsgCreateGeneralKeyShare = { + encode(message: MsgCreateGeneralKeyShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + if (message.idType !== "") { + writer.uint32(18).string(message.idType); + } + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); + } + if (message.keyShare !== "") { + writer.uint32(34).string(message.keyShare); + } + if (message.keyShareIndex !== 0) { + writer.uint32(40).uint64(message.keyShareIndex); + } + if (message.receivedTimestamp !== 0) { + writer.uint32(48).uint64(message.receivedTimestamp); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(56).uint64(message.receivedBlockHeight); + } + return writer; + }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateAuthorizedAddress { + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGeneralKeyShare { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCreateAuthorizedAddress(); + const message = createBaseMsgCreateGeneralKeyShare(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.target = reader.string(); + message.creator = reader.string(); break; case 2: - message.creator = reader.string(); + message.idType = reader.string(); + break; + case 3: + message.idValue = reader.string(); + break; + case 4: + message.keyShare = reader.string(); + break; + case 5: + message.keyShareIndex = longToNumber(reader.uint64() as Long); + break; + case 6: + message.receivedTimestamp = longToNumber(reader.uint64() as Long); + break; + case 7: + message.receivedBlockHeight = longToNumber(reader.uint64() as Long); break; default: reader.skipType(tag & 7); @@ -848,102 +856,115 @@ export class MsgClientImpl implements Msg { return message; }, - fromJSON(object: any): MsgCreateAuthorizedAddress { + fromJSON(object: any): MsgCreateGeneralKeyShare { return { - target: isSet(object.target) ? String(object.target) : "", creator: isSet(object.creator) ? String(object.creator) : "", + idType: isSet(object.idType) ? String(object.idType) : "", + idValue: isSet(object.idValue) ? String(object.idValue) : "", + keyShare: isSet(object.keyShare) ? String(object.keyShare) : "", + keyShareIndex: isSet(object.keyShareIndex) ? Number(object.keyShareIndex) : 0, + receivedTimestamp: isSet(object.receivedTimestamp) ? Number(object.receivedTimestamp) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? Number(object.receivedBlockHeight) : 0, }; }, - toJSON(message: MsgCreateAuthorizedAddress): unknown { + toJSON(message: MsgCreateGeneralKeyShare): unknown { const obj: any = {}; - message.target !== undefined && (obj.target = message.target); message.creator !== undefined && (obj.creator = message.creator); + message.idType !== undefined && (obj.idType = message.idType); + message.idValue !== undefined && (obj.idValue = message.idValue); + message.keyShare !== undefined && (obj.keyShare = message.keyShare); + message.keyShareIndex !== undefined && (obj.keyShareIndex = Math.round(message.keyShareIndex)); + message.receivedTimestamp !== undefined && (obj.receivedTimestamp = Math.round(message.receivedTimestamp)); + message.receivedBlockHeight !== undefined && (obj.receivedBlockHeight = Math.round(message.receivedBlockHeight)); return obj; }, - fromPartial, I>>(object: I): MsgCreateAuthorizedAddress { - const message = createBaseMsgCreateAuthorizedAddress(); - message.target = object.target ?? ""; + fromPartial, I>>(object: I): MsgCreateGeneralKeyShare { + const message = createBaseMsgCreateGeneralKeyShare(); message.creator = object.creator ?? ""; + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyShare = object.keyShare ?? ""; + message.keyShareIndex = object.keyShareIndex ?? 0; + message.receivedTimestamp = object.receivedTimestamp ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; return message; }, }; -function createBaseMsgCreateAuthorizedAddressResponse(): MsgCreateAuthorizedAddressResponse { - return {}; +function createBaseMsgCreateGeneralKeyShareResponse(): MsgCreateGeneralKeyShareResponse { + return { + creator: "", + idType: "", + idValue: "", + keyShare: "", + keyShareIndex: 0, + receivedBlockHeight: 0, + success: false, + errorMessage: "", + }; } -export const MsgCreateAuthorizedAddressResponse = { - encode(_: MsgCreateAuthorizedAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateAuthorizedAddressResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCreateAuthorizedAddressResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } +export const MsgCreateGeneralKeyShareResponse = { + encode(message: MsgCreateGeneralKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); } - return message; - }, - - fromJSON(_: any): MsgCreateAuthorizedAddressResponse { - return {}; - }, - - toJSON(_: MsgCreateAuthorizedAddressResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): MsgCreateAuthorizedAddressResponse { - const message = createBaseMsgCreateAuthorizedAddressResponse(); - return message; - }, -}; - -function createBaseMsgUpdateAuthorizedAddress(): MsgUpdateAuthorizedAddress { - return { target: "", isAuthorized: false, creator: "" }; -} - -export const MsgUpdateAuthorizedAddress = { - encode(message: MsgUpdateAuthorizedAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.target !== "") { - writer.uint32(10).string(message.target); + if (message.idType !== "") { + writer.uint32(18).string(message.idType); } - if (message.isAuthorized === true) { - writer.uint32(16).bool(message.isAuthorized); + if (message.idValue !== "") { + writer.uint32(26).string(message.idValue); } - if (message.creator !== "") { - writer.uint32(26).string(message.creator); + if (message.keyShare !== "") { + writer.uint32(34).string(message.keyShare); + } + if (message.keyShareIndex !== 0) { + writer.uint32(40).uint64(message.keyShareIndex); + } + if (message.receivedBlockHeight !== 0) { + writer.uint32(48).uint64(message.receivedBlockHeight); + } + if (message.success === true) { + writer.uint32(56).bool(message.success); + } + if (message.errorMessage !== "") { + writer.uint32(66).string(message.errorMessage); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateAuthorizedAddress { + decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGeneralKeyShareResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgUpdateAuthorizedAddress(); + const message = createBaseMsgCreateGeneralKeyShareResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.target = reader.string(); + message.creator = reader.string(); break; case 2: - message.isAuthorized = reader.bool(); + message.idType = reader.string(); break; case 3: - message.creator = reader.string(); + message.idValue = reader.string(); + break; + case 4: + message.keyShare = reader.string(); + break; + case 5: + message.keyShareIndex = longToNumber(reader.uint64() as Long); + break; + case 6: + message.receivedBlockHeight = longToNumber(reader.uint64() as Long); + break; + case 7: + message.success = reader.bool(); + break; + case 8: + message.errorMessage = reader.string(); break; default: reader.skipType(tag & 7); @@ -953,608 +974,44 @@ export const MsgUpdateAuthorizedAddress = { return message; }, - fromJSON(object: any): MsgUpdateAuthorizedAddress { + fromJSON(object: any): MsgCreateGeneralKeyShareResponse { return { - target: isSet(object.target) ? String(object.target) : "", - isAuthorized: isSet(object.isAuthorized) ? Boolean(object.isAuthorized) : false, creator: isSet(object.creator) ? String(object.creator) : "", + idType: isSet(object.idType) ? String(object.idType) : "", + idValue: isSet(object.idValue) ? String(object.idValue) : "", + keyShare: isSet(object.keyShare) ? String(object.keyShare) : "", + keyShareIndex: isSet(object.keyShareIndex) ? Number(object.keyShareIndex) : 0, + receivedBlockHeight: isSet(object.receivedBlockHeight) ? Number(object.receivedBlockHeight) : 0, + success: isSet(object.success) ? Boolean(object.success) : false, + errorMessage: isSet(object.errorMessage) ? String(object.errorMessage) : "", }; }, - toJSON(message: MsgUpdateAuthorizedAddress): unknown { + toJSON(message: MsgCreateGeneralKeyShareResponse): unknown { const obj: any = {}; - message.target !== undefined && (obj.target = message.target); - message.isAuthorized !== undefined && (obj.isAuthorized = message.isAuthorized); message.creator !== undefined && (obj.creator = message.creator); + message.idType !== undefined && (obj.idType = message.idType); + message.idValue !== undefined && (obj.idValue = message.idValue); + message.keyShare !== undefined && (obj.keyShare = message.keyShare); + message.keyShareIndex !== undefined && (obj.keyShareIndex = Math.round(message.keyShareIndex)); + message.receivedBlockHeight !== undefined && (obj.receivedBlockHeight = Math.round(message.receivedBlockHeight)); + message.success !== undefined && (obj.success = message.success); + message.errorMessage !== undefined && (obj.errorMessage = message.errorMessage); return obj; }, - fromPartial, I>>(object: I): MsgUpdateAuthorizedAddress { - const message = createBaseMsgUpdateAuthorizedAddress(); - message.target = object.target ?? ""; - message.isAuthorized = object.isAuthorized ?? false; + fromPartial, I>>( + object: I, + ): MsgCreateGeneralKeyShareResponse { + const message = createBaseMsgCreateGeneralKeyShareResponse(); message.creator = object.creator ?? ""; - return message; - }, -}; - -function createBaseMsgUpdateAuthorizedAddressResponse(): MsgUpdateAuthorizedAddressResponse { - return {}; -} - -export const MsgUpdateAuthorizedAddressResponse = { - encode(_: MsgUpdateAuthorizedAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateAuthorizedAddressResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgUpdateAuthorizedAddressResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(_: any): MsgUpdateAuthorizedAddressResponse { - return {}; - }, - - toJSON(_: MsgUpdateAuthorizedAddressResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): MsgUpdateAuthorizedAddressResponse { - const message = createBaseMsgUpdateAuthorizedAddressResponse(); - return message; - }, -}; - -function createBaseMsgDeleteAuthorizedAddress(): MsgDeleteAuthorizedAddress { - return { target: "", creator: "" }; -} - -export const MsgDeleteAuthorizedAddress = { - encode(message: MsgDeleteAuthorizedAddress, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.target !== "") { - writer.uint32(10).string(message.target); - } - if (message.creator !== "") { - writer.uint32(18).string(message.creator); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeleteAuthorizedAddress { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgDeleteAuthorizedAddress(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.target = reader.string(); - break; - case 2: - message.creator = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): MsgDeleteAuthorizedAddress { - return { - target: isSet(object.target) ? String(object.target) : "", - creator: isSet(object.creator) ? String(object.creator) : "", - }; - }, - - toJSON(message: MsgDeleteAuthorizedAddress): unknown { - const obj: any = {}; - message.target !== undefined && (obj.target = message.target); - message.creator !== undefined && (obj.creator = message.creator); - return obj; - }, - - fromPartial, I>>(object: I): MsgDeleteAuthorizedAddress { - const message = createBaseMsgDeleteAuthorizedAddress(); - message.target = object.target ?? ""; - message.creator = object.creator ?? ""; - return message; - }, -}; - -function createBaseMsgDeleteAuthorizedAddressResponse(): MsgDeleteAuthorizedAddressResponse { - return {}; -} - -export const MsgDeleteAuthorizedAddressResponse = { - encode(_: MsgDeleteAuthorizedAddressResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeleteAuthorizedAddressResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgDeleteAuthorizedAddressResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(_: any): MsgDeleteAuthorizedAddressResponse { - return {}; - }, - - toJSON(_: MsgDeleteAuthorizedAddressResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): MsgDeleteAuthorizedAddressResponse { - const message = createBaseMsgDeleteAuthorizedAddressResponse(); - return message; - }, -}; - -function createBaseMsgCreateGeneralKeyShare(): MsgCreateGeneralKeyShare { - return { - creator: "", - validator: "", - idType: "", - idValue: "", - keyShare: "", - keyShareIndex: 0, - receivedTimestamp: 0, - receivedBlockHeight: 0, - }; -} - -export const MsgCreateGeneralKeyShare = { - encode(message: MsgCreateGeneralKeyShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.creator !== "") { - writer.uint32(10).string(message.creator); - } - if (message.validator !== "") { - writer.uint32(18).string(message.validator); - } - if (message.idType !== "") { - writer.uint32(26).string(message.idType); - } - if (message.idValue !== "") { - writer.uint32(34).string(message.idValue); - } - if (message.keyShare !== "") { - writer.uint32(42).string(message.keyShare); - } - if (message.keyShareIndex !== 0) { - writer.uint32(48).uint64(message.keyShareIndex); - } - if (message.receivedTimestamp !== 0) { - writer.uint32(56).uint64(message.receivedTimestamp); - } - if (message.receivedBlockHeight !== 0) { - writer.uint32(64).uint64(message.receivedBlockHeight); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGeneralKeyShare { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCreateGeneralKeyShare(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.creator = reader.string(); - break; - case 2: - message.validator = reader.string(); - break; - case 3: - message.idType = reader.string(); - break; - case 4: - message.idValue = reader.string(); - break; - case 5: - message.keyShare = reader.string(); - break; - case 6: - message.keyShareIndex = longToNumber(reader.uint64() as Long); - break; - case 7: - message.receivedTimestamp = longToNumber(reader.uint64() as Long); - break; - case 8: - message.receivedBlockHeight = longToNumber(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): MsgCreateGeneralKeyShare { - return { - creator: isSet(object.creator) ? String(object.creator) : "", - validator: isSet(object.validator) ? String(object.validator) : "", - idType: isSet(object.idType) ? String(object.idType) : "", - idValue: isSet(object.idValue) ? String(object.idValue) : "", - keyShare: isSet(object.keyShare) ? String(object.keyShare) : "", - keyShareIndex: isSet(object.keyShareIndex) ? Number(object.keyShareIndex) : 0, - receivedTimestamp: isSet(object.receivedTimestamp) ? Number(object.receivedTimestamp) : 0, - receivedBlockHeight: isSet(object.receivedBlockHeight) ? Number(object.receivedBlockHeight) : 0, - }; - }, - - toJSON(message: MsgCreateGeneralKeyShare): unknown { - const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.validator !== undefined && (obj.validator = message.validator); - message.idType !== undefined && (obj.idType = message.idType); - message.idValue !== undefined && (obj.idValue = message.idValue); - message.keyShare !== undefined && (obj.keyShare = message.keyShare); - message.keyShareIndex !== undefined && (obj.keyShareIndex = Math.round(message.keyShareIndex)); - message.receivedTimestamp !== undefined && (obj.receivedTimestamp = Math.round(message.receivedTimestamp)); - message.receivedBlockHeight !== undefined && (obj.receivedBlockHeight = Math.round(message.receivedBlockHeight)); - return obj; - }, - - fromPartial, I>>(object: I): MsgCreateGeneralKeyShare { - const message = createBaseMsgCreateGeneralKeyShare(); - message.creator = object.creator ?? ""; - message.validator = object.validator ?? ""; - message.idType = object.idType ?? ""; - message.idValue = object.idValue ?? ""; - message.keyShare = object.keyShare ?? ""; - message.keyShareIndex = object.keyShareIndex ?? 0; - message.receivedTimestamp = object.receivedTimestamp ?? 0; - message.receivedBlockHeight = object.receivedBlockHeight ?? 0; - return message; - }, -}; - -function createBaseMsgCreateGeneralKeyShareResponse(): MsgCreateGeneralKeyShareResponse { - return {}; -} - -export const MsgCreateGeneralKeyShareResponse = { - encode(_: MsgCreateGeneralKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateGeneralKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgCreateGeneralKeyShareResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(_: any): MsgCreateGeneralKeyShareResponse { - return {}; - }, - - toJSON(_: MsgCreateGeneralKeyShareResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): MsgCreateGeneralKeyShareResponse { - const message = createBaseMsgCreateGeneralKeyShareResponse(); - return message; - }, -}; - -function createBaseMsgUpdateGeneralKeyShare(): MsgUpdateGeneralKeyShare { - return { - creator: "", - validator: "", - idType: "", - idValue: "", - keyShare: "", - keyShareIndex: 0, - receivedTimestamp: 0, - receivedBlockHeight: 0, - }; -} - -export const MsgUpdateGeneralKeyShare = { - encode(message: MsgUpdateGeneralKeyShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.creator !== "") { - writer.uint32(10).string(message.creator); - } - if (message.validator !== "") { - writer.uint32(18).string(message.validator); - } - if (message.idType !== "") { - writer.uint32(26).string(message.idType); - } - if (message.idValue !== "") { - writer.uint32(34).string(message.idValue); - } - if (message.keyShare !== "") { - writer.uint32(42).string(message.keyShare); - } - if (message.keyShareIndex !== 0) { - writer.uint32(48).uint64(message.keyShareIndex); - } - if (message.receivedTimestamp !== 0) { - writer.uint32(56).uint64(message.receivedTimestamp); - } - if (message.receivedBlockHeight !== 0) { - writer.uint32(64).uint64(message.receivedBlockHeight); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGeneralKeyShare { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgUpdateGeneralKeyShare(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.creator = reader.string(); - break; - case 2: - message.validator = reader.string(); - break; - case 3: - message.idType = reader.string(); - break; - case 4: - message.idValue = reader.string(); - break; - case 5: - message.keyShare = reader.string(); - break; - case 6: - message.keyShareIndex = longToNumber(reader.uint64() as Long); - break; - case 7: - message.receivedTimestamp = longToNumber(reader.uint64() as Long); - break; - case 8: - message.receivedBlockHeight = longToNumber(reader.uint64() as Long); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): MsgUpdateGeneralKeyShare { - return { - creator: isSet(object.creator) ? String(object.creator) : "", - validator: isSet(object.validator) ? String(object.validator) : "", - idType: isSet(object.idType) ? String(object.idType) : "", - idValue: isSet(object.idValue) ? String(object.idValue) : "", - keyShare: isSet(object.keyShare) ? String(object.keyShare) : "", - keyShareIndex: isSet(object.keyShareIndex) ? Number(object.keyShareIndex) : 0, - receivedTimestamp: isSet(object.receivedTimestamp) ? Number(object.receivedTimestamp) : 0, - receivedBlockHeight: isSet(object.receivedBlockHeight) ? Number(object.receivedBlockHeight) : 0, - }; - }, - - toJSON(message: MsgUpdateGeneralKeyShare): unknown { - const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.validator !== undefined && (obj.validator = message.validator); - message.idType !== undefined && (obj.idType = message.idType); - message.idValue !== undefined && (obj.idValue = message.idValue); - message.keyShare !== undefined && (obj.keyShare = message.keyShare); - message.keyShareIndex !== undefined && (obj.keyShareIndex = Math.round(message.keyShareIndex)); - message.receivedTimestamp !== undefined && (obj.receivedTimestamp = Math.round(message.receivedTimestamp)); - message.receivedBlockHeight !== undefined && (obj.receivedBlockHeight = Math.round(message.receivedBlockHeight)); - return obj; - }, - - fromPartial, I>>(object: I): MsgUpdateGeneralKeyShare { - const message = createBaseMsgUpdateGeneralKeyShare(); - message.creator = object.creator ?? ""; - message.validator = object.validator ?? ""; - message.idType = object.idType ?? ""; - message.idValue = object.idValue ?? ""; - message.keyShare = object.keyShare ?? ""; - message.keyShareIndex = object.keyShareIndex ?? 0; - message.receivedTimestamp = object.receivedTimestamp ?? 0; - message.receivedBlockHeight = object.receivedBlockHeight ?? 0; - return message; - }, -}; - -function createBaseMsgUpdateGeneralKeyShareResponse(): MsgUpdateGeneralKeyShareResponse { - return {}; -} - -export const MsgUpdateGeneralKeyShareResponse = { - encode(_: MsgUpdateGeneralKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateGeneralKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgUpdateGeneralKeyShareResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(_: any): MsgUpdateGeneralKeyShareResponse { - return {}; - }, - - toJSON(_: MsgUpdateGeneralKeyShareResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): MsgUpdateGeneralKeyShareResponse { - const message = createBaseMsgUpdateGeneralKeyShareResponse(); - return message; - }, -}; - -function createBaseMsgDeleteGeneralKeyShare(): MsgDeleteGeneralKeyShare { - return { creator: "", validator: "", idType: "", idValue: "" }; -} - -export const MsgDeleteGeneralKeyShare = { - encode(message: MsgDeleteGeneralKeyShare, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.creator !== "") { - writer.uint32(10).string(message.creator); - } - if (message.validator !== "") { - writer.uint32(18).string(message.validator); - } - if (message.idType !== "") { - writer.uint32(26).string(message.idType); - } - if (message.idValue !== "") { - writer.uint32(34).string(message.idValue); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeleteGeneralKeyShare { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgDeleteGeneralKeyShare(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.creator = reader.string(); - break; - case 2: - message.validator = reader.string(); - break; - case 3: - message.idType = reader.string(); - break; - case 4: - message.idValue = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): MsgDeleteGeneralKeyShare { - return { - creator: isSet(object.creator) ? String(object.creator) : "", - validator: isSet(object.validator) ? String(object.validator) : "", - idType: isSet(object.idType) ? String(object.idType) : "", - idValue: isSet(object.idValue) ? String(object.idValue) : "", - }; - }, - - toJSON(message: MsgDeleteGeneralKeyShare): unknown { - const obj: any = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.validator !== undefined && (obj.validator = message.validator); - message.idType !== undefined && (obj.idType = message.idType); - message.idValue !== undefined && (obj.idValue = message.idValue); - return obj; - }, - - fromPartial, I>>(object: I): MsgDeleteGeneralKeyShare { - const message = createBaseMsgDeleteGeneralKeyShare(); - message.creator = object.creator ?? ""; - message.validator = object.validator ?? ""; - message.idType = object.idType ?? ""; - message.idValue = object.idValue ?? ""; - return message; - }, -}; - -function createBaseMsgDeleteGeneralKeyShareResponse(): MsgDeleteGeneralKeyShareResponse { - return {}; -} - -export const MsgDeleteGeneralKeyShareResponse = { - encode(_: MsgDeleteGeneralKeyShareResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeleteGeneralKeyShareResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMsgDeleteGeneralKeyShareResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(_: any): MsgDeleteGeneralKeyShareResponse { - return {}; - }, - - toJSON(_: MsgDeleteGeneralKeyShareResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): MsgDeleteGeneralKeyShareResponse { - const message = createBaseMsgDeleteGeneralKeyShareResponse(); + message.idType = object.idType ?? ""; + message.idValue = object.idValue ?? ""; + message.keyShare = object.keyShare ?? ""; + message.keyShareIndex = object.keyShareIndex ?? 0; + message.receivedBlockHeight = object.receivedBlockHeight ?? 0; + message.success = object.success ?? false; + message.errorMessage = object.errorMessage ?? ""; return message; }, }; @@ -1569,8 +1026,6 @@ export interface Msg { UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise; DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise; CreateGeneralKeyShare(request: MsgCreateGeneralKeyShare): Promise; - UpdateGeneralKeyShare(request: MsgUpdateGeneralKeyShare): Promise; - DeleteGeneralKeyShare(request: MsgDeleteGeneralKeyShare): Promise; } export class MsgClientImpl implements Msg { @@ -1584,8 +1039,6 @@ export class MsgClientImpl implements Msg { this.UpdateAuthorizedAddress = this.UpdateAuthorizedAddress.bind(this); this.DeleteAuthorizedAddress = this.DeleteAuthorizedAddress.bind(this); this.CreateGeneralKeyShare = this.CreateGeneralKeyShare.bind(this); - this.UpdateGeneralKeyShare = this.UpdateGeneralKeyShare.bind(this); - this.DeleteGeneralKeyShare = this.DeleteGeneralKeyShare.bind(this); } RegisterValidator(request: MsgRegisterValidator): Promise { const data = MsgRegisterValidator.encode(request).finish(); @@ -1628,36 +1081,6 @@ export class MsgClientImpl implements Msg { const promise = this.rpc.request("fairyring.keyshare.Msg", "CreateGeneralKeyShare", data); return promise.then((data) => MsgCreateGeneralKeyShareResponse.decode(new _m0.Reader(data))); } - - UpdateGeneralKeyShare(request: MsgUpdateGeneralKeyShare): Promise { - const data = MsgUpdateGeneralKeyShare.encode(request).finish(); - const promise = this.rpc.request("fairyring.keyshare.Msg", "UpdateGeneralKeyShare", data); - return promise.then((data) => MsgUpdateGeneralKeyShareResponse.decode(new _m0.Reader(data))); - } - - DeleteGeneralKeyShare(request: MsgDeleteGeneralKeyShare): Promise { - const data = MsgDeleteGeneralKeyShare.encode(request).finish(); - const promise = this.rpc.request("fairyring.keyshare.Msg", "DeleteGeneralKeyShare", data); - return promise.then((data) => MsgDeleteGeneralKeyShareResponse.decode(new _m0.Reader(data))); - } - - CreateAuthorizedAddress(request: MsgCreateAuthorizedAddress): Promise { - const data = MsgCreateAuthorizedAddress.encode(request).finish(); - const promise = this.rpc.request("fairyring.keyshare.Msg", "CreateAuthorizedAddress", data); - return promise.then((data) => MsgCreateAuthorizedAddressResponse.decode(new _m0.Reader(data))); - } - - UpdateAuthorizedAddress(request: MsgUpdateAuthorizedAddress): Promise { - const data = MsgUpdateAuthorizedAddress.encode(request).finish(); - const promise = this.rpc.request("fairyring.keyshare.Msg", "UpdateAuthorizedAddress", data); - return promise.then((data) => MsgUpdateAuthorizedAddressResponse.decode(new _m0.Reader(data))); - } - - DeleteAuthorizedAddress(request: MsgDeleteAuthorizedAddress): Promise { - const data = MsgDeleteAuthorizedAddress.encode(request).finish(); - const promise = this.rpc.request("fairyring.keyshare.Msg", "DeleteAuthorizedAddress", data); - return promise.then((data) => MsgDeleteAuthorizedAddressResponse.decode(new _m0.Reader(data))); - } } interface Rpc { diff --git a/ts-client/fairyring.pep/module.ts b/ts-client/fairyring.pep/module.ts index ff997270..7c317370 100755 --- a/ts-client/fairyring.pep/module.ts +++ b/ts-client/fairyring.pep/module.ts @@ -7,8 +7,8 @@ import { msgTypes } from './registry'; import { IgniteClient } from "../client" import { MissingWalletError } from "../helpers" import { Api } from "./rest"; -import { MsgCreateAggregatedKeyShare } from "./types/fairyring/pep/tx"; import { MsgSubmitEncryptedTx } from "./types/fairyring/pep/tx"; +import { MsgCreateAggregatedKeyShare } from "./types/fairyring/pep/tx"; import { AggregatedKeyShare as typeAggregatedKeyShare} from "./types" import { EncryptedTx as typeEncryptedTx} from "./types" @@ -23,13 +23,7 @@ import { PepNonce as typePepNonce} from "./types" import { ActivePubKey as typeActivePubKey} from "./types" import { QueuedPubKey as typeQueuedPubKey} from "./types" -export { MsgCreateAggregatedKeyShare, MsgSubmitEncryptedTx }; - -type sendMsgCreateAggregatedKeyShareParams = { - value: MsgCreateAggregatedKeyShare, - fee?: StdFee, - memo?: string -}; +export { MsgSubmitEncryptedTx, MsgCreateAggregatedKeyShare }; type sendMsgSubmitEncryptedTxParams = { value: MsgSubmitEncryptedTx, @@ -37,15 +31,21 @@ type sendMsgSubmitEncryptedTxParams = { memo?: string }; - -type msgCreateAggregatedKeyShareParams = { +type sendMsgCreateAggregatedKeyShareParams = { value: MsgCreateAggregatedKeyShare, + fee?: StdFee, + memo?: string }; + type msgSubmitEncryptedTxParams = { value: MsgSubmitEncryptedTx, }; +type msgCreateAggregatedKeyShareParams = { + value: MsgCreateAggregatedKeyShare, +}; + export const registry = new Registry(msgTypes); @@ -76,48 +76,48 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht return { - async sendMsgCreateAggregatedKeyShare({ value, fee, memo }: sendMsgCreateAggregatedKeyShareParams): Promise { + async sendMsgSubmitEncryptedTx({ value, fee, memo }: sendMsgSubmitEncryptedTxParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgCreateAggregatedKeyShare: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgSubmitEncryptedTx: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgCreateAggregatedKeyShare({ value: MsgCreateAggregatedKeyShare.fromPartial(value) }) + let msg = this.msgSubmitEncryptedTx({ value: MsgSubmitEncryptedTx.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgCreateAggregatedKeyShare: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgSubmitEncryptedTx: Could not broadcast Tx: '+ e.message) } }, - async sendMsgSubmitEncryptedTx({ value, fee, memo }: sendMsgSubmitEncryptedTxParams): Promise { + async sendMsgCreateAggregatedKeyShare({ value, fee, memo }: sendMsgCreateAggregatedKeyShareParams): Promise { if (!signer) { - throw new Error('TxClient:sendMsgSubmitEncryptedTx: Unable to sign Tx. Signer is not present.') + throw new Error('TxClient:sendMsgCreateAggregatedKeyShare: Unable to sign Tx. Signer is not present.') } try { const { address } = (await signer.getAccounts())[0]; const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix}); - let msg = this.msgSubmitEncryptedTx({ value: MsgSubmitEncryptedTx.fromPartial(value) }) + let msg = this.msgCreateAggregatedKeyShare({ value: MsgCreateAggregatedKeyShare.fromPartial(value) }) return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo) } catch (e: any) { - throw new Error('TxClient:sendMsgSubmitEncryptedTx: Could not broadcast Tx: '+ e.message) + throw new Error('TxClient:sendMsgCreateAggregatedKeyShare: Could not broadcast Tx: '+ e.message) } }, - msgCreateAggregatedKeyShare({ value }: msgCreateAggregatedKeyShareParams): EncodeObject { + msgSubmitEncryptedTx({ value }: msgSubmitEncryptedTxParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgCreateAggregatedKeyShare", value: MsgCreateAggregatedKeyShare.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgSubmitEncryptedTx", value: MsgSubmitEncryptedTx.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgCreateAggregatedKeyShare: Could not create message: ' + e.message) + throw new Error('TxClient:MsgSubmitEncryptedTx: Could not create message: ' + e.message) } }, - msgSubmitEncryptedTx({ value }: msgSubmitEncryptedTxParams): EncodeObject { + msgCreateAggregatedKeyShare({ value }: msgCreateAggregatedKeyShareParams): EncodeObject { try { - return { typeUrl: "/fairyring.pep.MsgSubmitEncryptedTx", value: MsgSubmitEncryptedTx.fromPartial( value ) } + return { typeUrl: "/fairyring.pep.MsgCreateAggregatedKeyShare", value: MsgCreateAggregatedKeyShare.fromPartial( value ) } } catch (e: any) { - throw new Error('TxClient:MsgSubmitEncryptedTx: Could not create message: ' + e.message) + throw new Error('TxClient:MsgCreateAggregatedKeyShare: Could not create message: ' + e.message) } }, diff --git a/ts-client/fairyring.pep/registry.ts b/ts-client/fairyring.pep/registry.ts index b11c9047..35605e55 100755 --- a/ts-client/fairyring.pep/registry.ts +++ b/ts-client/fairyring.pep/registry.ts @@ -1,10 +1,10 @@ import { GeneratedType } from "@cosmjs/proto-signing"; -import { MsgCreateAggregatedKeyShare } from "./types/fairyring/pep/tx"; import { MsgSubmitEncryptedTx } from "./types/fairyring/pep/tx"; +import { MsgCreateAggregatedKeyShare } from "./types/fairyring/pep/tx"; const msgTypes: Array<[string, GeneratedType]> = [ - ["/fairyring.pep.MsgCreateAggregatedKeyShare", MsgCreateAggregatedKeyShare], ["/fairyring.pep.MsgSubmitEncryptedTx", MsgSubmitEncryptedTx], + ["/fairyring.pep.MsgCreateAggregatedKeyShare", MsgCreateAggregatedKeyShare], ]; diff --git a/ts-client/fairyring.pep/types/fairyring/pep/packet.ts b/ts-client/fairyring.pep/types/fairyring/pep/packet.ts index 29c8f56c..670dd3c5 100644 --- a/ts-client/fairyring.pep/types/fairyring/pep/packet.ts +++ b/ts-client/fairyring.pep/types/fairyring/pep/packet.ts @@ -173,10 +173,10 @@ function createBaseCurrentKeysPacketAck(): CurrentKeysPacketAck { export const CurrentKeysPacketAck = { encode(message: CurrentKeysPacketAck, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.activeKey !== undefined) { - ActivePubKey.encode(message.activeKey, writer.uint32(18).fork()).ldelim(); + ActivePubKey.encode(message.activeKey, writer.uint32(10).fork()).ldelim(); } if (message.queuedKey !== undefined) { - QueuedPubKey.encode(message.queuedKey, writer.uint32(26).fork()).ldelim(); + QueuedPubKey.encode(message.queuedKey, writer.uint32(18).fork()).ldelim(); } return writer; }, @@ -188,10 +188,10 @@ export const CurrentKeysPacketAck = { while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 2: + case 1: message.activeKey = ActivePubKey.decode(reader, reader.uint32()); break; - case 3: + case 2: message.queuedKey = QueuedPubKey.decode(reader, reader.uint32()); break; default: diff --git a/ts-client/package.json b/ts-client/package.json index a4fbcb68..8e4df987 100644 --- a/ts-client/package.json +++ b/ts-client/package.json @@ -19,7 +19,7 @@ "@cosmjs/proto-signing": "0.27.0", "@cosmjs/stargate": "0.27.0", "@keplr-wallet/types": "^0.11.3", - "axios": "1.6.0", + "axios": "0.21.4", "buffer": "^6.0.3", "events": "^3.3.0" },