diff --git a/README.md b/README.md index 835760fc6..59a87773c 100644 --- a/README.md +++ b/README.md @@ -838,6 +838,95 @@ main().then(() => { }) ``` +## Instant RPC methods + +Using instantOps option to expose instant RPC methods. + +For example, for this config: +``` + instantOps: [ + { + className: "OsmosisClaim", + include: { + patterns: ["osmosis.**.*claim*"], + }, + }, + { + className: "CosmosAuthAccount", + include: { + patterns: [ + "cosmos.auth.**.*account*", + "cosmos.auth.**.*Account*", + "cosmos.gov.v1beta1.**", + ], + }, + nameMapping: { + // name mapping rule for both Msg and Query methods. + // moduleAccounts will be renamed to authModuleAccounts in generated class. + All: { + authModuleAccounts: "cosmos.auth.v1beta1.moduleAccounts", + }, + // name mapping rule for Msg methods. + Tx: { + // deposit method under Msg will be renamed to txDeposit in generated class. While deposit method under Query will remain the same. + txDeposit: "cosmos.gov.v1beta1.deposit", + // Same for vote method. + txVote: "cosmos.gov.v1beta1.vote", + }, + }, + }, + ], +``` + +There'll be an extra file generated in the root folder called service-ops.ts: +``` +export interface OsmosisClaim extends _OsmosisClaimV1beta1Queryrpc.OsmosisClaim {} +export class OsmosisClaim { + rpc: TxRpc; + init(rpc: TxRpc) { + this.rpc = rpc; + this.claimRecord = _OsmosisClaimV1beta1Queryrpc.createClientImpl(rpc).claimRecord; + this.claimableForAction = _OsmosisClaimV1beta1Queryrpc.createClientImpl(rpc).claimableForAction; + } +} +export interface CosmosAuthAccount extends _CosmosAuthV1beta1Queryrpc.CosmosAuthAccount, _CosmosGovV1beta1Queryrpc.CosmosAuthAccount, _CosmosGovV1beta1Txrpc.CosmosAuthAccount {} +export class CosmosAuthAccount { + rpc: TxRpc; + init(rpc: TxRpc) { + this.rpc = rpc; + this.accounts = _CosmosAuthV1beta1Queryrpc.createClientImpl(rpc).accounts; + this.account = _CosmosAuthV1beta1Queryrpc.createClientImpl(rpc).account; + + // moduleAccounts has been renamed to authModuleAccounts as the nameMapping in settings. + this.authModuleAccounts = _CosmosAuthV1beta1Queryrpc.createClientImpl(rpc).moduleAccounts; + + this.proposal = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).proposal; + this.proposals = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).proposals; + + // vote under Query remains the same. + this.vote = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).vote; + + this.votes = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).votes; + this.params = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).params; + + // deposit under Query remains the same. + this.deposit = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).deposit; + + this.deposits = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).deposits; + this.tallyResult = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).tallyResult; + this.submitProposal = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).submitProposal; + + //same as txDeposite for vote here. + this.txVote = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).vote; + + this.voteWeighted = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).voteWeighted; + + // deposit method under Msg will be renamed to txDeposit in generated class. While deposit method under Query will remain the same. + this.txDeposit = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).deposit; + } +} +``` + ## Manually registering types This example is with `osmosis` module in `osmojs`, but it is the same pattern for any module. diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.msg.ts index 8f64077b2..d1ff1a5d1 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.rpc.msg.ts @@ -1,13 +1,13 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; /** Msg defines the provider Msg service */ export interface Msg { /** SignProviderAttributes defines a method that signs provider attributes */ - signProviderAttributes(request: BroadcastTxReq): Promise>; + signProviderAttributes(request: BroadcastTxReq): Promise; /** DeleteProviderAttributes defines a method that deletes provider attributes */ - deleteProviderAttributes(request: BroadcastTxReq): Promise>; + deleteProviderAttributes(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -15,28 +15,20 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* SignProviderAttributes defines a method that signs provider attributes */ - signProviderAttributes = async (request: BroadcastTxReq): Promise> => { + signProviderAttributes = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSignProviderAttributes.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSignProviderAttributesResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* DeleteProviderAttributes defines a method that deletes provider attributes */ - deleteProviderAttributes = async (request: BroadcastTxReq): Promise> => { + deleteProviderAttributes = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgDeleteProviderAttributes.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgDeleteProviderAttributesResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.msg.ts index e32a34e18..563c1c3be 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.rpc.msg.ts @@ -1,13 +1,13 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgSignProviderAttributesResponse, MsgSignProviderAttributesResponseSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType, MsgDeleteProviderAttributesResponse, MsgDeleteProviderAttributesResponseSDKType } from "./audit"; /** Msg defines the provider Msg service */ export interface Msg { /** SignProviderAttributes defines a method that signs provider attributes */ - signProviderAttributes(request: BroadcastTxReq): Promise>; + signProviderAttributes(request: BroadcastTxReq): Promise; /** DeleteProviderAttributes defines a method that deletes provider attributes */ - deleteProviderAttributes(request: BroadcastTxReq): Promise>; + deleteProviderAttributes(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -15,28 +15,20 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* SignProviderAttributes defines a method that signs provider attributes */ - signProviderAttributes = async (request: BroadcastTxReq): Promise> => { + signProviderAttributes = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSignProviderAttributes.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSignProviderAttributesResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* DeleteProviderAttributes defines a method that deletes provider attributes */ - deleteProviderAttributes = async (request: BroadcastTxReq): Promise> => { + deleteProviderAttributes = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgDeleteProviderAttributes.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgDeleteProviderAttributesResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.msg.ts index a8b16dfa3..28d14fea8 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.rpc.msg.ts @@ -1,12 +1,12 @@ -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateCertificate, MsgCreateCertificateSDKType, MsgCreateCertificateResponse, MsgCreateCertificateResponseSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType, MsgRevokeCertificateResponse, MsgRevokeCertificateResponseSDKType } from "./cert"; /** Msg defines the provider Msg service */ export interface Msg { /** CreateCertificate defines a method to create new certificate given proper inputs. */ - createCertificate(request: BroadcastTxReq): Promise>; + createCertificate(request: BroadcastTxReq): Promise; /** RevokeCertificate defines a method to revoke the certificate */ - revokeCertificate(request: BroadcastTxReq): Promise>; + revokeCertificate(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -14,28 +14,20 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateCertificate defines a method to create new certificate given proper inputs. */ - createCertificate = async (request: BroadcastTxReq): Promise> => { + createCertificate = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateCertificate.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateCertificateResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* RevokeCertificate defines a method to revoke the certificate */ - revokeCertificate = async (request: BroadcastTxReq): Promise> => { + revokeCertificate = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgRevokeCertificate.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgRevokeCertificateResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts index f81f574cd..1c6431e6b 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts @@ -4,7 +4,7 @@ import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType } from "./group"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { isSet, bytesFromBase64, base64FromBytes, Exact } from "../../../helpers"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -1350,19 +1350,19 @@ export const DeploymentFilters = { /** Msg defines the deployment Msg service. */ export interface Msg { /** CreateDeployment defines a method to create new deployment given proper inputs. */ - createDeployment(request: BroadcastTxReq): Promise>; + createDeployment(request: BroadcastTxReq): Promise; /** DepositDeployment deposits more funds into the deployment account */ - depositDeployment(request: BroadcastTxReq): Promise>; + depositDeployment(request: BroadcastTxReq): Promise; /** UpdateDeployment defines a method to update a deployment given proper inputs. */ - updateDeployment(request: BroadcastTxReq): Promise>; + updateDeployment(request: BroadcastTxReq): Promise; /** CloseDeployment defines a method to close a deployment given proper inputs. */ - closeDeployment(request: BroadcastTxReq): Promise>; + closeDeployment(request: BroadcastTxReq): Promise; /** CloseGroup defines a method to close a group of a deployment given proper inputs. */ - closeGroup(request: BroadcastTxReq): Promise>; + closeGroup(request: BroadcastTxReq): Promise; /** PauseGroup defines a method to close a group of a deployment given proper inputs. */ - pauseGroup(request: BroadcastTxReq): Promise>; + pauseGroup(request: BroadcastTxReq): Promise; /** StartGroup defines a method to close a group of a deployment given proper inputs. */ - startGroup(request: BroadcastTxReq): Promise>; + startGroup(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -1370,88 +1370,60 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateDeployment defines a method to create new deployment given proper inputs. */ - createDeployment = async (request: BroadcastTxReq): Promise> => { + createDeployment = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateDeployment.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateDeploymentResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* DepositDeployment deposits more funds into the deployment account */ - depositDeployment = async (request: BroadcastTxReq): Promise> => { + depositDeployment = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgDepositDeployment.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgDepositDeploymentResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateDeployment defines a method to update a deployment given proper inputs. */ - updateDeployment = async (request: BroadcastTxReq): Promise> => { + updateDeployment = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateDeployment.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateDeploymentResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CloseDeployment defines a method to close a deployment given proper inputs. */ - closeDeployment = async (request: BroadcastTxReq): Promise> => { + closeDeployment = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCloseDeployment.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCloseDeploymentResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CloseGroup defines a method to close a group of a deployment given proper inputs. */ - closeGroup = async (request: BroadcastTxReq): Promise> => { + closeGroup = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCloseGroup.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCloseGroupResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* PauseGroup defines a method to close a group of a deployment given proper inputs. */ - pauseGroup = async (request: BroadcastTxReq): Promise> => { + pauseGroup = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgPauseGroup.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgPauseGroupResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* StartGroup defines a method to close a group of a deployment given proper inputs. */ - startGroup = async (request: BroadcastTxReq): Promise> => { + startGroup = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgStartGroup.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgStartGroupResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.msg.ts index 1d84806f9..d9fda4f6b 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.rpc.msg.ts @@ -2,26 +2,26 @@ import { DeploymentID, DeploymentIDSDKType } from "./deployment"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateDeployment, MsgCreateDeploymentSDKType, MsgCreateDeploymentResponse, MsgCreateDeploymentResponseSDKType, MsgDepositDeployment, MsgDepositDeploymentSDKType, MsgDepositDeploymentResponse, MsgDepositDeploymentResponseSDKType, MsgUpdateDeployment, MsgUpdateDeploymentSDKType, MsgUpdateDeploymentResponse, MsgUpdateDeploymentResponseSDKType, MsgCloseDeployment, MsgCloseDeploymentSDKType, MsgCloseDeploymentResponse, MsgCloseDeploymentResponseSDKType } from "./deploymentmsg"; import { MsgCloseGroup, MsgCloseGroupSDKType, MsgCloseGroupResponse, MsgCloseGroupResponseSDKType, MsgPauseGroup, MsgPauseGroupSDKType, MsgPauseGroupResponse, MsgPauseGroupResponseSDKType, MsgStartGroup, MsgStartGroupSDKType, MsgStartGroupResponse, MsgStartGroupResponseSDKType } from "./groupmsg"; /** Msg defines the deployment Msg service. */ export interface Msg { /** CreateDeployment defines a method to create new deployment given proper inputs. */ - createDeployment(request: BroadcastTxReq): Promise>; + createDeployment(request: BroadcastTxReq): Promise; /** DepositDeployment deposits more funds into the deployment account */ - depositDeployment(request: BroadcastTxReq): Promise>; + depositDeployment(request: BroadcastTxReq): Promise; /** UpdateDeployment defines a method to update a deployment given proper inputs. */ - updateDeployment(request: BroadcastTxReq): Promise>; + updateDeployment(request: BroadcastTxReq): Promise; /** CloseDeployment defines a method to close a deployment given proper inputs. */ - closeDeployment(request: BroadcastTxReq): Promise>; + closeDeployment(request: BroadcastTxReq): Promise; /** CloseGroup defines a method to close a group of a deployment given proper inputs. */ - closeGroup(request: BroadcastTxReq): Promise>; + closeGroup(request: BroadcastTxReq): Promise; /** PauseGroup defines a method to close a group of a deployment given proper inputs. */ - pauseGroup(request: BroadcastTxReq): Promise>; + pauseGroup(request: BroadcastTxReq): Promise; /** StartGroup defines a method to close a group of a deployment given proper inputs. */ - startGroup(request: BroadcastTxReq): Promise>; + startGroup(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -29,88 +29,60 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateDeployment defines a method to create new deployment given proper inputs. */ - createDeployment = async (request: BroadcastTxReq): Promise> => { + createDeployment = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateDeployment.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateDeploymentResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* DepositDeployment deposits more funds into the deployment account */ - depositDeployment = async (request: BroadcastTxReq): Promise> => { + depositDeployment = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgDepositDeployment.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgDepositDeploymentResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateDeployment defines a method to update a deployment given proper inputs. */ - updateDeployment = async (request: BroadcastTxReq): Promise> => { + updateDeployment = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateDeployment.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateDeploymentResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CloseDeployment defines a method to close a deployment given proper inputs. */ - closeDeployment = async (request: BroadcastTxReq): Promise> => { + closeDeployment = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCloseDeployment.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCloseDeploymentResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CloseGroup defines a method to close a group of a deployment given proper inputs. */ - closeGroup = async (request: BroadcastTxReq): Promise> => { + closeGroup = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCloseGroup.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCloseGroupResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* PauseGroup defines a method to close a group of a deployment given proper inputs. */ - pauseGroup = async (request: BroadcastTxReq): Promise> => { + pauseGroup = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgPauseGroup.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgPauseGroupResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* StartGroup defines a method to close a group of a deployment given proper inputs. */ - startGroup = async (request: BroadcastTxReq): Promise> => { + startGroup = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgStartGroup.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgStartGroupResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.msg.ts index d8fa4226c..453716594 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.rpc.msg.ts @@ -2,20 +2,20 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCreateBidResponse, MsgCreateBidResponseSDKType, MsgCloseBid, MsgCloseBidSDKType, MsgCloseBidResponse, MsgCloseBidResponseSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgWithdrawLeaseResponse, MsgWithdrawLeaseResponseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCreateLeaseResponse, MsgCreateLeaseResponseSDKType, MsgCloseLease, MsgCloseLeaseSDKType, MsgCloseLeaseResponse, MsgCloseLeaseResponseSDKType } from "./lease"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; /** Msg defines the market Msg service */ export interface Msg { /** CreateBid defines a method to create a bid given proper inputs. */ - createBid(request: BroadcastTxReq): Promise>; + createBid(request: BroadcastTxReq): Promise; /** CloseBid defines a method to close a bid given proper inputs. */ - closeBid(request: BroadcastTxReq): Promise>; + closeBid(request: BroadcastTxReq): Promise; /** WithdrawLease withdraws accrued funds from the lease payment */ - withdrawLease(request: BroadcastTxReq): Promise>; + withdrawLease(request: BroadcastTxReq): Promise; /** CreateLease creates a new lease */ - createLease(request: BroadcastTxReq): Promise>; + createLease(request: BroadcastTxReq): Promise; /** CloseLease defines a method to close an order given proper inputs. */ - closeLease(request: BroadcastTxReq): Promise>; + closeLease(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -23,64 +23,44 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateBid defines a method to create a bid given proper inputs. */ - createBid = async (request: BroadcastTxReq): Promise> => { + createBid = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateBid.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateBidResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CloseBid defines a method to close a bid given proper inputs. */ - closeBid = async (request: BroadcastTxReq): Promise> => { + closeBid = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCloseBid.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCloseBidResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* WithdrawLease withdraws accrued funds from the lease payment */ - withdrawLease = async (request: BroadcastTxReq): Promise> => { + withdrawLease = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgWithdrawLease.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgWithdrawLeaseResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CreateLease creates a new lease */ - createLease = async (request: BroadcastTxReq): Promise> => { + createLease = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateLease.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateLeaseResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CloseLease defines a method to close an order given proper inputs. */ - closeLease = async (request: BroadcastTxReq): Promise> => { + closeLease = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCloseLease.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCloseLeaseResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.msg.ts index c5ce0d804..fbb6c8756 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.rpc.msg.ts @@ -1,15 +1,15 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; /** Msg defines the provider Msg service */ export interface Msg { /** CreateProvider defines a method that creates a provider given the proper inputs */ - createProvider(request: BroadcastTxReq): Promise>; + createProvider(request: BroadcastTxReq): Promise; /** UpdateProvider defines a method that updates a provider given the proper inputs */ - updateProvider(request: BroadcastTxReq): Promise>; + updateProvider(request: BroadcastTxReq): Promise; /** DeleteProvider defines a method that deletes a provider given the proper inputs */ - deleteProvider(request: BroadcastTxReq): Promise>; + deleteProvider(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -17,40 +17,28 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateProvider defines a method that creates a provider given the proper inputs */ - createProvider = async (request: BroadcastTxReq): Promise> => { + createProvider = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateProvider.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateProviderResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateProvider defines a method that updates a provider given the proper inputs */ - updateProvider = async (request: BroadcastTxReq): Promise> => { + updateProvider = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateProvider.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateProviderResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* DeleteProvider defines a method that deletes a provider given the proper inputs */ - deleteProvider = async (request: BroadcastTxReq): Promise> => { + deleteProvider = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgDeleteProvider.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgDeleteProviderResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.msg.ts index 3bb0a1fe3..f6afe6e0b 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.rpc.msg.ts @@ -1,15 +1,15 @@ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateProvider, MsgCreateProviderSDKType, MsgCreateProviderResponse, MsgCreateProviderResponseSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgUpdateProviderResponse, MsgUpdateProviderResponseSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType, MsgDeleteProviderResponse, MsgDeleteProviderResponseSDKType } from "./provider"; /** Msg defines the provider Msg service */ export interface Msg { /** CreateProvider defines a method that creates a provider given the proper inputs */ - createProvider(request: BroadcastTxReq): Promise>; + createProvider(request: BroadcastTxReq): Promise; /** UpdateProvider defines a method that updates a provider given the proper inputs */ - updateProvider(request: BroadcastTxReq): Promise>; + updateProvider(request: BroadcastTxReq): Promise; /** DeleteProvider defines a method that deletes a provider given the proper inputs */ - deleteProvider(request: BroadcastTxReq): Promise>; + deleteProvider(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -17,40 +17,28 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateProvider defines a method that creates a provider given the proper inputs */ - createProvider = async (request: BroadcastTxReq): Promise> => { + createProvider = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateProvider.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateProviderResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateProvider defines a method that updates a provider given the proper inputs */ - updateProvider = async (request: BroadcastTxReq): Promise> => { + updateProvider = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateProvider.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateProviderResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* DeleteProvider defines a method that deletes a provider given the proper inputs */ - deleteProvider = async (request: BroadcastTxReq): Promise> => { + deleteProvider = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgDeleteProvider.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgDeleteProviderResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.msg.ts index 87b710a7d..1697e79f3 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; /** Msg defines the authz Msg service. */ @@ -11,18 +11,18 @@ export interface Msg { * for the given (granter, grantee, Authorization) triple, then the grant * will be overwritten. */ - grant(request: BroadcastTxReq): Promise>; + grant(request: BroadcastTxReq): Promise; /** * Exec attempts to execute the provided messages using * authorizations granted to the grantee. Each message should have only * one signer corresponding to the granter of the authorization. */ - exec(request: BroadcastTxReq): Promise>; + exec(request: BroadcastTxReq): Promise; /** * Revoke revokes any authorization corresponding to the provided method name on the * granter's account that has been granted to the grantee. */ - revoke(request: BroadcastTxReq): Promise>; + revoke(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -33,43 +33,31 @@ export class MsgClientImpl implements Msg { account with the provided expiration time. If there is already a grant for the given (granter, grantee, Authorization) triple, then the grant will be overwritten. */ - grant = async (request: BroadcastTxReq): Promise> => { + grant = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgGrant.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgGrantResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Exec attempts to execute the provided messages using authorizations granted to the grantee. Each message should have only one signer corresponding to the granter of the authorization. */ - exec = async (request: BroadcastTxReq): Promise> => { + exec = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgExec.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgExecResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Revoke revokes any authorization corresponding to the provided method name on the granter's account that has been granted to the grantee. */ - revoke = async (request: BroadcastTxReq): Promise> => { + revoke = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgRevoke.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgRevokeResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.msg.ts index 15383e74b..cae0d26cc 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.rpc.msg.ts @@ -1,14 +1,14 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType, MsgMultiSend, MsgMultiSendSDKType, MsgMultiSendResponse, MsgMultiSendResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ export interface Msg { /** Send defines a method for sending coins from one account to another account. */ - send(request: BroadcastTxReq): Promise>; + send(request: BroadcastTxReq): Promise; /** MultiSend defines a method for sending coins from some accounts to other accounts. */ - multiSend(request: BroadcastTxReq): Promise>; + multiSend(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -16,28 +16,20 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* Send defines a method for sending coins from one account to another account. */ - send = async (request: BroadcastTxReq): Promise> => { + send = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSend.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSendResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* MultiSend defines a method for sending coins from some accounts to other accounts. */ - multiSend = async (request: BroadcastTxReq): Promise> => { + multiSend = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgMultiSend.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgMultiSendResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.msg.ts index f6418a2e8..afe89c0c3 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.rpc.msg.ts @@ -1,10 +1,10 @@ -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType, MsgVerifyInvariantResponse, MsgVerifyInvariantResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ export interface Msg { /** VerifyInvariant defines a method to verify a particular invariance. */ - verifyInvariant(request: BroadcastTxReq): Promise>; + verifyInvariant(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -12,16 +12,12 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* VerifyInvariant defines a method to verify a particular invariance. */ - verifyInvariant = async (request: BroadcastTxReq): Promise> => { + verifyInvariant = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgVerifyInvariant.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgVerifyInvariantResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.msg.ts index 3120813c3..9e74da30a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgSetWithdrawAddressResponse, MsgSetWithdrawAddressResponseSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawDelegatorRewardResponse, MsgWithdrawDelegatorRewardResponseSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgWithdrawValidatorCommissionResponse, MsgWithdrawValidatorCommissionResponseSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType, MsgFundCommunityPoolResponse, MsgFundCommunityPoolResponseSDKType } from "./tx"; /** Msg defines the distribution Msg service. */ @@ -8,22 +8,22 @@ export interface Msg { * SetWithdrawAddress defines a method to change the withdraw address * for a delegator (or validator self-delegation). */ - setWithdrawAddress(request: BroadcastTxReq): Promise>; + setWithdrawAddress(request: BroadcastTxReq): Promise; /** * WithdrawDelegatorReward defines a method to withdraw rewards of delegator * from a single validator. */ - withdrawDelegatorReward(request: BroadcastTxReq): Promise>; + withdrawDelegatorReward(request: BroadcastTxReq): Promise; /** * WithdrawValidatorCommission defines a method to withdraw the * full commission to the validator address. */ - withdrawValidatorCommission(request: BroadcastTxReq): Promise>; + withdrawValidatorCommission(request: BroadcastTxReq): Promise; /** * FundCommunityPool defines a method to allow an account to directly * fund the community pool. */ - fundCommunityPool(request: BroadcastTxReq): Promise>; + fundCommunityPool(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -32,55 +32,39 @@ export class MsgClientImpl implements Msg { } /* SetWithdrawAddress defines a method to change the withdraw address for a delegator (or validator self-delegation). */ - setWithdrawAddress = async (request: BroadcastTxReq): Promise> => { + setWithdrawAddress = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSetWithdrawAddress.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSetWithdrawAddressResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* WithdrawDelegatorReward defines a method to withdraw rewards of delegator from a single validator. */ - withdrawDelegatorReward = async (request: BroadcastTxReq): Promise> => { + withdrawDelegatorReward = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgWithdrawDelegatorReward.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgWithdrawDelegatorRewardResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* WithdrawValidatorCommission defines a method to withdraw the full commission to the validator address. */ - withdrawValidatorCommission = async (request: BroadcastTxReq): Promise> => { + withdrawValidatorCommission = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgWithdrawValidatorCommission.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgWithdrawValidatorCommissionResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* FundCommunityPool defines a method to allow an account to directly fund the community pool. */ - fundCommunityPool = async (request: BroadcastTxReq): Promise> => { + fundCommunityPool = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgFundCommunityPool.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgFundCommunityPoolResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.msg.ts index aff363ddf..69bfa7615 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType, MsgSubmitEvidenceResponse, MsgSubmitEvidenceResponseSDKType } from "./tx"; /** Msg defines the evidence Msg service. */ @@ -8,7 +8,7 @@ export interface Msg { * SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or * counterfactual signing. */ - submitEvidence(request: BroadcastTxReq): Promise>; + submitEvidence(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -17,16 +17,12 @@ export class MsgClientImpl implements Msg { } /* SubmitEvidence submits an arbitrary Evidence of misbehavior such as equivocation or counterfactual signing. */ - submitEvidence = async (request: BroadcastTxReq): Promise> => { + submitEvidence = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSubmitEvidence.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSubmitEvidenceResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts index f9bba25a9..90cb49959 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgGrantAllowanceResponse, MsgGrantAllowanceResponseSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType, MsgRevokeAllowanceResponse, MsgRevokeAllowanceResponseSDKType } from "./tx"; /** Msg defines the feegrant msg service. */ @@ -8,12 +8,12 @@ export interface Msg { * GrantAllowance grants fee allowance to the grantee on the granter's * account with the provided expiration time. */ - grantAllowance(request: BroadcastTxReq): Promise>; + grantAllowance(request: BroadcastTxReq): Promise; /** * RevokeAllowance revokes any fee allowance of granter's account that * has been granted to the grantee. */ - revokeAllowance(request: BroadcastTxReq): Promise>; + revokeAllowance(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -22,29 +22,21 @@ export class MsgClientImpl implements Msg { } /* GrantAllowance grants fee allowance to the grantee on the granter's account with the provided expiration time. */ - grantAllowance = async (request: BroadcastTxReq): Promise> => { + grantAllowance = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgGrantAllowance.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgGrantAllowanceResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* RevokeAllowance revokes any fee allowance of granter's account that has been granted to the grantee. */ - revokeAllowance = async (request: BroadcastTxReq): Promise> => { + revokeAllowance = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgRevokeAllowance.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgRevokeAllowanceResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.msg.ts index 09bc88125..45c13e792 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.rpc.msg.ts @@ -1,24 +1,24 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgExecLegacyContentResponse, MsgExecLegacyContentResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; /** Msg defines the gov Msg service. */ export interface Msg { /** SubmitProposal defines a method to create new proposal given a content. */ - submitProposal(request: BroadcastTxReq): Promise>; + submitProposal(request: BroadcastTxReq): Promise; /** * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal * to execute a legacy content-based proposal. */ - execLegacyContent(request: BroadcastTxReq): Promise>; + execLegacyContent(request: BroadcastTxReq): Promise; /** Vote defines a method to add a vote on a specific proposal. */ - vote(request: BroadcastTxReq): Promise>; + vote(request: BroadcastTxReq): Promise; /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ - voteWeighted(request: BroadcastTxReq): Promise>; + voteWeighted(request: BroadcastTxReq): Promise; /** Deposit defines a method to add deposit on a specific proposal. */ - deposit(request: BroadcastTxReq): Promise>; + deposit(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -26,65 +26,45 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* SubmitProposal defines a method to create new proposal given a content. */ - submitProposal = async (request: BroadcastTxReq): Promise> => { + submitProposal = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSubmitProposal.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSubmitProposalResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal to execute a legacy content-based proposal. */ - execLegacyContent = async (request: BroadcastTxReq): Promise> => { + execLegacyContent = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgExecLegacyContent.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgExecLegacyContentResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Vote defines a method to add a vote on a specific proposal. */ - vote = async (request: BroadcastTxReq): Promise> => { + vote = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgVote.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgVoteResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* VoteWeighted defines a method to add a weighted vote on a specific proposal. */ - voteWeighted = async (request: BroadcastTxReq): Promise> => { + voteWeighted = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgVoteWeighted.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgVoteWeightedResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Deposit defines a method to add deposit on a specific proposal. */ - deposit = async (request: BroadcastTxReq): Promise> => { + deposit = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgDeposit.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgDepositResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.msg.ts index bf6f54209..aa398f87a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.rpc.msg.ts @@ -1,38 +1,38 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType } from "./gov"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgVoteWeightedResponse, MsgVoteWeightedResponseSDKType, MsgDeposit, MsgDepositSDKType, MsgDepositResponse, MsgDepositResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ export interface Msg { /** SubmitProposal defines a method to create new proposal given a content. */ - submitProposal(request: BroadcastTxReq): Promise>; + submitProposal(request: BroadcastTxReq): Promise; /** Vote defines a method to add a vote on a specific proposal. */ - vote(request: BroadcastTxReq): Promise>; + vote(request: BroadcastTxReq): Promise; /** * VoteWeighted defines a method to add a weighted vote on a specific proposal. * * Since: cosmos-sdk 0.43 */ - voteWeighted(request: BroadcastTxReq): Promise>; + voteWeighted(request: BroadcastTxReq): Promise; /** Deposit defines a method to add deposit on a specific proposal. */ - deposit(request: BroadcastTxReq): Promise>; + deposit(request: BroadcastTxReq): Promise; } /** Msg defines the bank Msg service. */ export interface CosmosAuthAccount { /** SubmitProposal defines a method to create new proposal given a content. */ - submitProposal(request: BroadcastTxReq): Promise>; + submitProposal(request: BroadcastTxReq): Promise; /** Vote defines a method to add a vote on a specific proposal. */ - txVote(request: BroadcastTxReq): Promise>; + txVote(request: BroadcastTxReq): Promise; /** * VoteWeighted defines a method to add a weighted vote on a specific proposal. * * Since: cosmos-sdk 0.43 */ - voteWeighted(request: BroadcastTxReq): Promise>; + voteWeighted(request: BroadcastTxReq): Promise; /** Deposit defines a method to add deposit on a specific proposal. */ - txDeposit(request: BroadcastTxReq): Promise>; + txDeposit(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -40,54 +40,38 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* SubmitProposal defines a method to create new proposal given a content. */ - submitProposal = async (request: BroadcastTxReq): Promise> => { + submitProposal = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSubmitProposal.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSubmitProposalResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Vote defines a method to add a vote on a specific proposal. */ - vote = async (request: BroadcastTxReq): Promise> => { + vote = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgVote.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgVoteResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* VoteWeighted defines a method to add a weighted vote on a specific proposal. Since: cosmos-sdk 0.43 */ - voteWeighted = async (request: BroadcastTxReq): Promise> => { + voteWeighted = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgVoteWeighted.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgVoteWeightedResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Deposit defines a method to add deposit on a specific proposal. */ - deposit = async (request: BroadcastTxReq): Promise> => { + deposit = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgDeposit.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgDepositResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.msg.ts index b2b6d9d30..e26f9147c 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.rpc.msg.ts @@ -1,38 +1,38 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateGroup, MsgCreateGroupSDKType, MsgCreateGroupResponse, MsgCreateGroupResponseSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupMembersResponse, MsgUpdateGroupMembersResponseSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupAdminResponse, MsgUpdateGroupAdminResponseSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgUpdateGroupMetadataResponse, MsgUpdateGroupMetadataResponseSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupPolicyResponse, MsgCreateGroupPolicyResponseSDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgCreateGroupWithPolicyResponse, MsgCreateGroupWithPolicyResponseSDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyAdminResponse, MsgUpdateGroupPolicyAdminResponseSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyDecisionPolicyResponse, MsgUpdateGroupPolicyDecisionPolicyResponseSDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgUpdateGroupPolicyMetadataResponse, MsgUpdateGroupPolicyMetadataResponseSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgSubmitProposalResponse, MsgSubmitProposalResponseSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgWithdrawProposalResponse, MsgWithdrawProposalResponseSDKType, MsgVote, MsgVoteSDKType, MsgVoteResponse, MsgVoteResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType, MsgLeaveGroupResponse, MsgLeaveGroupResponseSDKType } from "./tx"; /** Msg is the cosmos.group.v1 Msg service. */ export interface Msg { /** CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. */ - createGroup(request: BroadcastTxReq): Promise>; + createGroup(request: BroadcastTxReq): Promise; /** UpdateGroupMembers updates the group members with given group id and admin address. */ - updateGroupMembers(request: BroadcastTxReq): Promise>; + updateGroupMembers(request: BroadcastTxReq): Promise; /** UpdateGroupAdmin updates the group admin with given group id and previous admin address. */ - updateGroupAdmin(request: BroadcastTxReq): Promise>; + updateGroupAdmin(request: BroadcastTxReq): Promise; /** UpdateGroupMetadata updates the group metadata with given group id and admin address. */ - updateGroupMetadata(request: BroadcastTxReq): Promise>; + updateGroupMetadata(request: BroadcastTxReq): Promise; /** CreateGroupPolicy creates a new group policy using given DecisionPolicy. */ - createGroupPolicy(request: BroadcastTxReq): Promise>; + createGroupPolicy(request: BroadcastTxReq): Promise; /** CreateGroupWithPolicy creates a new group with policy. */ - createGroupWithPolicy(request: BroadcastTxReq): Promise>; + createGroupWithPolicy(request: BroadcastTxReq): Promise; /** UpdateGroupPolicyAdmin updates a group policy admin. */ - updateGroupPolicyAdmin(request: BroadcastTxReq): Promise>; + updateGroupPolicyAdmin(request: BroadcastTxReq): Promise; /** UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. */ - updateGroupPolicyDecisionPolicy(request: BroadcastTxReq): Promise>; + updateGroupPolicyDecisionPolicy(request: BroadcastTxReq): Promise; /** UpdateGroupPolicyMetadata updates a group policy metadata. */ - updateGroupPolicyMetadata(request: BroadcastTxReq): Promise>; + updateGroupPolicyMetadata(request: BroadcastTxReq): Promise; /** SubmitProposal submits a new proposal. */ - submitProposal(request: BroadcastTxReq): Promise>; + submitProposal(request: BroadcastTxReq): Promise; /** WithdrawProposal aborts a proposal. */ - withdrawProposal(request: BroadcastTxReq): Promise>; + withdrawProposal(request: BroadcastTxReq): Promise; /** Vote allows a voter to vote on a proposal. */ - vote(request: BroadcastTxReq): Promise>; + vote(request: BroadcastTxReq): Promise; /** Exec executes a proposal. */ - exec(request: BroadcastTxReq): Promise>; + exec(request: BroadcastTxReq): Promise; /** LeaveGroup allows a group member to leave the group. */ - leaveGroup(request: BroadcastTxReq): Promise>; + leaveGroup(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -40,172 +40,116 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateGroup creates a new group with an admin account address, a list of members and some optional metadata. */ - createGroup = async (request: BroadcastTxReq): Promise> => { + createGroup = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateGroup.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateGroupResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateGroupMembers updates the group members with given group id and admin address. */ - updateGroupMembers = async (request: BroadcastTxReq): Promise> => { + updateGroupMembers = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateGroupMembers.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateGroupMembersResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateGroupAdmin updates the group admin with given group id and previous admin address. */ - updateGroupAdmin = async (request: BroadcastTxReq): Promise> => { + updateGroupAdmin = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateGroupAdmin.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateGroupAdminResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateGroupMetadata updates the group metadata with given group id and admin address. */ - updateGroupMetadata = async (request: BroadcastTxReq): Promise> => { + updateGroupMetadata = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateGroupMetadata.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateGroupMetadataResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CreateGroupPolicy creates a new group policy using given DecisionPolicy. */ - createGroupPolicy = async (request: BroadcastTxReq): Promise> => { + createGroupPolicy = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateGroupPolicy.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateGroupPolicyResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CreateGroupWithPolicy creates a new group with policy. */ - createGroupWithPolicy = async (request: BroadcastTxReq): Promise> => { + createGroupWithPolicy = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateGroupWithPolicy.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateGroupWithPolicyResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateGroupPolicyAdmin updates a group policy admin. */ - updateGroupPolicyAdmin = async (request: BroadcastTxReq): Promise> => { + updateGroupPolicyAdmin = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateGroupPolicyAdmin.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateGroupPolicyAdminResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateGroupPolicyDecisionPolicy allows a group policy's decision policy to be updated. */ - updateGroupPolicyDecisionPolicy = async (request: BroadcastTxReq): Promise> => { + updateGroupPolicyDecisionPolicy = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateGroupPolicyDecisionPolicy.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateGroupPolicyDecisionPolicyResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateGroupPolicyMetadata updates a group policy metadata. */ - updateGroupPolicyMetadata = async (request: BroadcastTxReq): Promise> => { + updateGroupPolicyMetadata = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateGroupPolicyMetadata.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateGroupPolicyMetadataResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* SubmitProposal submits a new proposal. */ - submitProposal = async (request: BroadcastTxReq): Promise> => { + submitProposal = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSubmitProposal.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSubmitProposalResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* WithdrawProposal aborts a proposal. */ - withdrawProposal = async (request: BroadcastTxReq): Promise> => { + withdrawProposal = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgWithdrawProposal.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgWithdrawProposalResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Vote allows a voter to vote on a proposal. */ - vote = async (request: BroadcastTxReq): Promise> => { + vote = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgVote.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgVoteResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Exec executes a proposal. */ - exec = async (request: BroadcastTxReq): Promise> => { + exec = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgExec.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgExecResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* LeaveGroup allows a group member to leave the group. */ - leaveGroup = async (request: BroadcastTxReq): Promise> => { + leaveGroup = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgLeaveGroup.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgLeaveGroupResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.msg.ts index e331b9ee9..ecdba28ec 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.rpc.msg.ts @@ -1,10 +1,10 @@ -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendSDKType, MsgSendResponse, MsgSendResponseSDKType } from "./tx"; /** Msg defines the nft Msg service. */ export interface Msg { /** Send defines a method to send a nft from one account to another account. */ - send(request: BroadcastTxReq): Promise>; + send(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -12,16 +12,12 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* Send defines a method to send a nft from one account to another account. */ - send = async (request: BroadcastTxReq): Promise> => { + send = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSend.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSendResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.msg.ts index 2f022aafc..ba46bbf8f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.rpc.msg.ts @@ -1,4 +1,4 @@ -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgUnjail, MsgUnjailSDKType, MsgUnjailResponse, MsgUnjailResponseSDKType } from "./tx"; /** Msg defines the slashing Msg service. */ @@ -8,7 +8,7 @@ export interface Msg { * them into the bonded validator set, so they can begin receiving provisions * and rewards again. */ - unjail(request: BroadcastTxReq): Promise>; + unjail(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -18,16 +18,12 @@ export class MsgClientImpl implements Msg { /* Unjail defines a method for unjailing a jailed validator, thus returning them into the bonded validator set, so they can begin receiving provisions and rewards again. */ - unjail = async (request: BroadcastTxReq): Promise> => { + unjail = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUnjail.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUnjailResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.msg.ts index 5eb58a70e..54b989e6c 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.rpc.msg.ts @@ -2,30 +2,30 @@ import { Description, DescriptionSDKType, CommissionRates, CommissionRatesSDKTyp import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgCreateValidatorResponse, MsgCreateValidatorResponseSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgEditValidatorResponse, MsgEditValidatorResponseSDKType, MsgDelegate, MsgDelegateSDKType, MsgDelegateResponse, MsgDelegateResponseSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgBeginRedelegateResponse, MsgBeginRedelegateResponseSDKType, MsgUndelegate, MsgUndelegateSDKType, MsgUndelegateResponse, MsgUndelegateResponseSDKType } from "./tx"; /** Msg defines the staking Msg service. */ export interface Msg { /** CreateValidator defines a method for creating a new validator. */ - createValidator(request: BroadcastTxReq): Promise>; + createValidator(request: BroadcastTxReq): Promise; /** EditValidator defines a method for editing an existing validator. */ - editValidator(request: BroadcastTxReq): Promise>; + editValidator(request: BroadcastTxReq): Promise; /** * Delegate defines a method for performing a delegation of coins * from a delegator to a validator. */ - delegate(request: BroadcastTxReq): Promise>; + delegate(request: BroadcastTxReq): Promise; /** * BeginRedelegate defines a method for performing a redelegation * of coins from a delegator and source validator to a destination validator. */ - beginRedelegate(request: BroadcastTxReq): Promise>; + beginRedelegate(request: BroadcastTxReq): Promise; /** * Undelegate defines a method for performing an undelegation from a * delegate and a validator. */ - undelegate(request: BroadcastTxReq): Promise>; + undelegate(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -33,67 +33,47 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateValidator defines a method for creating a new validator. */ - createValidator = async (request: BroadcastTxReq): Promise> => { + createValidator = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateValidator.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateValidatorResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* EditValidator defines a method for editing an existing validator. */ - editValidator = async (request: BroadcastTxReq): Promise> => { + editValidator = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgEditValidator.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgEditValidatorResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Delegate defines a method for performing a delegation of coins from a delegator to a validator. */ - delegate = async (request: BroadcastTxReq): Promise> => { + delegate = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgDelegate.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgDelegateResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* BeginRedelegate defines a method for performing a redelegation of coins from a delegator and source validator to a destination validator. */ - beginRedelegate = async (request: BroadcastTxReq): Promise> => { + beginRedelegate = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgBeginRedelegate.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgBeginRedelegateResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Undelegate defines a method for performing an undelegation from a delegate and a validator. */ - undelegate = async (request: BroadcastTxReq): Promise> => { + undelegate = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUndelegate.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUndelegateResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts index dcacf12b9..e238eb09a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Plan, PlanSDKType } from "./upgrade"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgSoftwareUpgradeResponse, MsgSoftwareUpgradeResponseSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType, MsgCancelUpgradeResponse, MsgCancelUpgradeResponseSDKType } from "./tx"; /** Msg defines the upgrade Msg service. */ @@ -9,14 +9,14 @@ export interface Msg { * * Since: cosmos-sdk 0.46 */ - softwareUpgrade(request: BroadcastTxReq): Promise>; + softwareUpgrade(request: BroadcastTxReq): Promise; /** * CancelUpgrade is a governance operation for cancelling a previously * approvid software upgrade. * * Since: cosmos-sdk 0.46 */ - cancelUpgrade(request: BroadcastTxReq): Promise>; + cancelUpgrade(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -26,31 +26,23 @@ export class MsgClientImpl implements Msg { /* SoftwareUpgrade is a governance operation for initiating a software upgrade. Since: cosmos-sdk 0.46 */ - softwareUpgrade = async (request: BroadcastTxReq): Promise> => { + softwareUpgrade = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSoftwareUpgrade.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSoftwareUpgradeResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CancelUpgrade is a governance operation for cancelling a previously approvid software upgrade. Since: cosmos-sdk 0.46 */ - cancelUpgrade = async (request: BroadcastTxReq): Promise> => { + cancelUpgrade = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCancelUpgrade.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCancelUpgradeResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.msg.ts index 6465345dd..3ae98801f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreateVestingAccountResponse, MsgCreateVestingAccountResponseSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePermanentLockedAccountResponse, MsgCreatePermanentLockedAccountResponseSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType, MsgCreatePeriodicVestingAccountResponse, MsgCreatePeriodicVestingAccountResponseSDKType } from "./tx"; /** Msg defines the bank Msg service. */ @@ -9,17 +9,17 @@ export interface Msg { * CreateVestingAccount defines a method that enables creating a vesting * account. */ - createVestingAccount(request: BroadcastTxReq): Promise>; + createVestingAccount(request: BroadcastTxReq): Promise; /** * CreatePermanentLockedAccount defines a method that enables creating a permanent * locked account. */ - createPermanentLockedAccount(request: BroadcastTxReq): Promise>; + createPermanentLockedAccount(request: BroadcastTxReq): Promise; /** * CreatePeriodicVestingAccount defines a method that enables creating a * periodic vesting account. */ - createPeriodicVestingAccount(request: BroadcastTxReq): Promise>; + createPeriodicVestingAccount(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -28,42 +28,30 @@ export class MsgClientImpl implements Msg { } /* CreateVestingAccount defines a method that enables creating a vesting account. */ - createVestingAccount = async (request: BroadcastTxReq): Promise> => { + createVestingAccount = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateVestingAccount.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateVestingAccountResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CreatePermanentLockedAccount defines a method that enables creating a permanent locked account. */ - createPermanentLockedAccount = async (request: BroadcastTxReq): Promise> => { + createPermanentLockedAccount = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreatePermanentLockedAccount.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreatePermanentLockedAccountResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CreatePeriodicVestingAccount defines a method that enables creating a periodic vesting account. */ - createPeriodicVestingAccount = async (request: BroadcastTxReq): Promise> => { + createPeriodicVestingAccount = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreatePeriodicVestingAccount.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreatePeriodicVestingAccountResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.msg.ts index 9e3b3a9c6..3affa075b 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.rpc.msg.ts @@ -1,22 +1,22 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgStoreCodeResponse, MsgStoreCodeResponseSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgInstantiateContractResponse, MsgInstantiateContractResponseSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgExecuteContractResponse, MsgExecuteContractResponseSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgMigrateContractResponse, MsgMigrateContractResponseSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgUpdateAdminResponse, MsgUpdateAdminResponseSDKType, MsgClearAdmin, MsgClearAdminSDKType, MsgClearAdminResponse, MsgClearAdminResponseSDKType } from "./tx"; /** Msg defines the wasm Msg service. */ export interface Msg { /** StoreCode to submit Wasm code to the system */ - storeCode(request: BroadcastTxReq): Promise>; + storeCode(request: BroadcastTxReq): Promise; /** Instantiate creates a new smart contract instance for the given code id. */ - instantiateContract(request: BroadcastTxReq): Promise>; + instantiateContract(request: BroadcastTxReq): Promise; /** Execute submits the given message data to a smart contract */ - executeContract(request: BroadcastTxReq): Promise>; + executeContract(request: BroadcastTxReq): Promise; /** Migrate runs a code upgrade/ downgrade for a smart contract */ - migrateContract(request: BroadcastTxReq): Promise>; + migrateContract(request: BroadcastTxReq): Promise; /** UpdateAdmin sets a new admin for a smart contract */ - updateAdmin(request: BroadcastTxReq): Promise>; + updateAdmin(request: BroadcastTxReq): Promise; /** ClearAdmin removes any admin stored for a smart contract */ - clearAdmin(request: BroadcastTxReq): Promise>; + clearAdmin(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -24,76 +24,52 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* StoreCode to submit Wasm code to the system */ - storeCode = async (request: BroadcastTxReq): Promise> => { + storeCode = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgStoreCode.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgStoreCodeResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Instantiate creates a new smart contract instance for the given code id. */ - instantiateContract = async (request: BroadcastTxReq): Promise> => { + instantiateContract = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgInstantiateContract.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgInstantiateContractResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Execute submits the given message data to a smart contract */ - executeContract = async (request: BroadcastTxReq): Promise> => { + executeContract = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgExecuteContract.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgExecuteContractResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Migrate runs a code upgrade/ downgrade for a smart contract */ - migrateContract = async (request: BroadcastTxReq): Promise> => { + migrateContract = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgMigrateContract.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgMigrateContractResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateAdmin sets a new admin for a smart contract */ - updateAdmin = async (request: BroadcastTxReq): Promise> => { + updateAdmin = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateAdmin.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateAdminResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ClearAdmin removes any admin stored for a smart contract */ - clearAdmin = async (request: BroadcastTxReq): Promise> => { + clearAdmin = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgClearAdmin.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgClearAdminResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.msg.ts index ebed431aa..30e775b06 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.rpc.msg.ts @@ -1,5 +1,5 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertCoinResponse, MsgConvertCoinResponseSDKType, MsgConvertERC20, MsgConvertERC20SDKType, MsgConvertERC20Response, MsgConvertERC20ResponseSDKType } from "./tx"; /** Msg defines the erc20 Msg service. */ @@ -8,12 +8,12 @@ export interface Msg { * ConvertCoin mints a ERC20 representation of the native Cosmos coin denom * that is registered on the token mapping. */ - convertCoin(request: BroadcastTxReq): Promise>; + convertCoin(request: BroadcastTxReq): Promise; /** * ConvertERC20 mints a native Cosmos coin representation of the ERC20 token * contract that is registered on the token mapping. */ - convertERC20(request: BroadcastTxReq): Promise>; + convertERC20(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -22,29 +22,21 @@ export class MsgClientImpl implements Msg { } /* ConvertCoin mints a ERC20 representation of the native Cosmos coin denom that is registered on the token mapping. */ - convertCoin = async (request: BroadcastTxReq): Promise> => { + convertCoin = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgConvertCoin.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgConvertCoinResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ConvertERC20 mints a native Cosmos coin representation of the ERC20 token contract that is registered on the token mapping. */ - convertERC20 = async (request: BroadcastTxReq): Promise> => { + convertERC20 = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgConvertERC20.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgConvertERC20Response.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.msg.ts index c2e1a9988..a8493bdc2 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.rpc.msg.ts @@ -1,4 +1,4 @@ -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgRegisterDevFeeInfoResponse, MsgRegisterDevFeeInfoResponseSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgCancelDevFeeInfoResponse, MsgCancelDevFeeInfoResponseSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType, MsgUpdateDevFeeInfoResponse, MsgUpdateDevFeeInfoResponseSDKType } from "./tx"; /** Msg defines the fees Msg service. */ @@ -7,14 +7,14 @@ export interface Msg { * RegisterDevFeeInfo is used by a deployer to register a new contract for * receiving transaction fees */ - registerDevFeeInfo(request: BroadcastTxReq): Promise>; + registerDevFeeInfo(request: BroadcastTxReq): Promise; /** * CancelDevFeeInfo is used by a deployer to cancel a registered contract * and stop receiving transaction fees */ - cancelDevFeeInfo(request: BroadcastTxReq): Promise>; + cancelDevFeeInfo(request: BroadcastTxReq): Promise; /** UpdateDevFeeInfo is used by a deployer to update the withdraw address */ - updateDevFeeInfo(request: BroadcastTxReq): Promise>; + updateDevFeeInfo(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -23,41 +23,29 @@ export class MsgClientImpl implements Msg { } /* RegisterDevFeeInfo is used by a deployer to register a new contract for receiving transaction fees */ - registerDevFeeInfo = async (request: BroadcastTxReq): Promise> => { + registerDevFeeInfo = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgRegisterDevFeeInfo.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgRegisterDevFeeInfoResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* CancelDevFeeInfo is used by a deployer to cancel a registered contract and stop receiving transaction fees */ - cancelDevFeeInfo = async (request: BroadcastTxReq): Promise> => { + cancelDevFeeInfo = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCancelDevFeeInfo.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCancelDevFeeInfoResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateDevFeeInfo is used by a deployer to update the withdraw address */ - updateDevFeeInfo = async (request: BroadcastTxReq): Promise> => { + updateDevFeeInfo = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateDevFeeInfo.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateDevFeeInfoResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.msg.ts index bae607a4d..dfe2a2593 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.rpc.msg.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgCreateClawbackVestingAccountResponse, MsgCreateClawbackVestingAccountResponseSDKType, MsgClawback, MsgClawbackSDKType, MsgClawbackResponse, MsgClawbackResponseSDKType } from "./tx"; /** Msg defines the vesting Msg service. */ @@ -9,9 +9,9 @@ export interface Msg { * CreateClawbackVestingAccount creats a vesting account that is subject to * clawback and the configuration of vesting and lockup schedules. */ - createClawbackVestingAccount(request: BroadcastTxReq): Promise>; + createClawbackVestingAccount(request: BroadcastTxReq): Promise; /** Clawback removes the unvested tokens from a ClawbackVestingAccount. */ - clawback(request: BroadcastTxReq): Promise>; + clawback(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -20,28 +20,20 @@ export class MsgClientImpl implements Msg { } /* CreateClawbackVestingAccount creats a vesting account that is subject to clawback and the configuration of vesting and lockup schedules. */ - createClawbackVestingAccount = async (request: BroadcastTxReq): Promise> => { + createClawbackVestingAccount = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateClawbackVestingAccount.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateClawbackVestingAccountResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Clawback removes the unvested tokens from a ClawbackVestingAccount. */ - clawback = async (request: BroadcastTxReq): Promise> => { + clawback = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgClawback.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgClawbackResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.msg.ts index 3c964c21a..ce025fb91 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.rpc.msg.ts @@ -1,12 +1,12 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgTransfer, MsgTransferSDKType, MsgTransferResponse, MsgTransferResponseSDKType } from "./tx"; /** Msg defines the ibc/transfer Msg service. */ export interface Msg { /** Transfer defines a rpc handler method for MsgTransfer. */ - transfer(request: BroadcastTxReq): Promise>; + transfer(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -14,16 +14,12 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* Transfer defines a rpc handler method for MsgTransfer. */ - transfer = async (request: BroadcastTxReq): Promise> => { + transfer = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgTransfer.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgTransferResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.msg.ts index 4df7fb016..224611dbc 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.rpc.msg.ts @@ -1,33 +1,33 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgChannelOpenInit, MsgChannelOpenInitSDKType, MsgChannelOpenInitResponse, MsgChannelOpenInitResponseSDKType, MsgChannelOpenTry, MsgChannelOpenTrySDKType, MsgChannelOpenTryResponse, MsgChannelOpenTryResponseSDKType, MsgChannelOpenAck, MsgChannelOpenAckSDKType, MsgChannelOpenAckResponse, MsgChannelOpenAckResponseSDKType, MsgChannelOpenConfirm, MsgChannelOpenConfirmSDKType, MsgChannelOpenConfirmResponse, MsgChannelOpenConfirmResponseSDKType, MsgChannelCloseInit, MsgChannelCloseInitSDKType, MsgChannelCloseInitResponse, MsgChannelCloseInitResponseSDKType, MsgChannelCloseConfirm, MsgChannelCloseConfirmSDKType, MsgChannelCloseConfirmResponse, MsgChannelCloseConfirmResponseSDKType, MsgRecvPacket, MsgRecvPacketSDKType, MsgRecvPacketResponse, MsgRecvPacketResponseSDKType, MsgTimeout, MsgTimeoutSDKType, MsgTimeoutResponse, MsgTimeoutResponseSDKType, MsgTimeoutOnClose, MsgTimeoutOnCloseSDKType, MsgTimeoutOnCloseResponse, MsgTimeoutOnCloseResponseSDKType, MsgAcknowledgement, MsgAcknowledgementSDKType, MsgAcknowledgementResponse, MsgAcknowledgementResponseSDKType } from "./tx"; /** Msg defines the ibc/channel Msg service. */ export interface Msg { /** ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. */ - channelOpenInit(request: BroadcastTxReq): Promise>; + channelOpenInit(request: BroadcastTxReq): Promise; /** ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. */ - channelOpenTry(request: BroadcastTxReq): Promise>; + channelOpenTry(request: BroadcastTxReq): Promise; /** ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. */ - channelOpenAck(request: BroadcastTxReq): Promise>; + channelOpenAck(request: BroadcastTxReq): Promise; /** ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. */ - channelOpenConfirm(request: BroadcastTxReq): Promise>; + channelOpenConfirm(request: BroadcastTxReq): Promise; /** ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. */ - channelCloseInit(request: BroadcastTxReq): Promise>; + channelCloseInit(request: BroadcastTxReq): Promise; /** * ChannelCloseConfirm defines a rpc handler method for * MsgChannelCloseConfirm. */ - channelCloseConfirm(request: BroadcastTxReq): Promise>; + channelCloseConfirm(request: BroadcastTxReq): Promise; /** RecvPacket defines a rpc handler method for MsgRecvPacket. */ - recvPacket(request: BroadcastTxReq): Promise>; + recvPacket(request: BroadcastTxReq): Promise; /** Timeout defines a rpc handler method for MsgTimeout. */ - timeout(request: BroadcastTxReq): Promise>; + timeout(request: BroadcastTxReq): Promise; /** TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. */ - timeoutOnClose(request: BroadcastTxReq): Promise>; + timeoutOnClose(request: BroadcastTxReq): Promise; /** Acknowledgement defines a rpc handler method for MsgAcknowledgement. */ - acknowledgement(request: BroadcastTxReq): Promise>; + acknowledgement(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -35,125 +35,85 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* ChannelOpenInit defines a rpc handler method for MsgChannelOpenInit. */ - channelOpenInit = async (request: BroadcastTxReq): Promise> => { + channelOpenInit = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgChannelOpenInit.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgChannelOpenInitResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ChannelOpenTry defines a rpc handler method for MsgChannelOpenTry. */ - channelOpenTry = async (request: BroadcastTxReq): Promise> => { + channelOpenTry = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgChannelOpenTry.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgChannelOpenTryResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ChannelOpenAck defines a rpc handler method for MsgChannelOpenAck. */ - channelOpenAck = async (request: BroadcastTxReq): Promise> => { + channelOpenAck = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgChannelOpenAck.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgChannelOpenAckResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ChannelOpenConfirm defines a rpc handler method for MsgChannelOpenConfirm. */ - channelOpenConfirm = async (request: BroadcastTxReq): Promise> => { + channelOpenConfirm = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgChannelOpenConfirm.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgChannelOpenConfirmResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ChannelCloseInit defines a rpc handler method for MsgChannelCloseInit. */ - channelCloseInit = async (request: BroadcastTxReq): Promise> => { + channelCloseInit = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgChannelCloseInit.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgChannelCloseInitResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ChannelCloseConfirm defines a rpc handler method for MsgChannelCloseConfirm. */ - channelCloseConfirm = async (request: BroadcastTxReq): Promise> => { + channelCloseConfirm = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgChannelCloseConfirm.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgChannelCloseConfirmResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* RecvPacket defines a rpc handler method for MsgRecvPacket. */ - recvPacket = async (request: BroadcastTxReq): Promise> => { + recvPacket = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgRecvPacket.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgRecvPacketResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Timeout defines a rpc handler method for MsgTimeout. */ - timeout = async (request: BroadcastTxReq): Promise> => { + timeout = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgTimeout.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgTimeoutResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* TimeoutOnClose defines a rpc handler method for MsgTimeoutOnClose. */ - timeoutOnClose = async (request: BroadcastTxReq): Promise> => { + timeoutOnClose = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgTimeoutOnClose.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgTimeoutOnCloseResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Acknowledgement defines a rpc handler method for MsgAcknowledgement. */ - acknowledgement = async (request: BroadcastTxReq): Promise> => { + acknowledgement = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgAcknowledgement.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgAcknowledgementResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.msg.ts index 92a8acf48..f1569eb74 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.rpc.msg.ts @@ -1,17 +1,17 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgCreateClient, MsgCreateClientSDKType, MsgCreateClientResponse, MsgCreateClientResponseSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpdateClientResponse, MsgUpdateClientResponseSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgUpgradeClientResponse, MsgUpgradeClientResponseSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType, MsgSubmitMisbehaviourResponse, MsgSubmitMisbehaviourResponseSDKType } from "./tx"; /** Msg defines the ibc/client Msg service. */ export interface Msg { /** CreateClient defines a rpc handler method for MsgCreateClient. */ - createClient(request: BroadcastTxReq): Promise>; + createClient(request: BroadcastTxReq): Promise; /** UpdateClient defines a rpc handler method for MsgUpdateClient. */ - updateClient(request: BroadcastTxReq): Promise>; + updateClient(request: BroadcastTxReq): Promise; /** UpgradeClient defines a rpc handler method for MsgUpgradeClient. */ - upgradeClient(request: BroadcastTxReq): Promise>; + upgradeClient(request: BroadcastTxReq): Promise; /** SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. */ - submitMisbehaviour(request: BroadcastTxReq): Promise>; + submitMisbehaviour(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -19,52 +19,36 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateClient defines a rpc handler method for MsgCreateClient. */ - createClient = async (request: BroadcastTxReq): Promise> => { + createClient = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateClient.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateClientResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpdateClient defines a rpc handler method for MsgUpdateClient. */ - updateClient = async (request: BroadcastTxReq): Promise> => { + updateClient = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpdateClient.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpdateClientResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UpgradeClient defines a rpc handler method for MsgUpgradeClient. */ - upgradeClient = async (request: BroadcastTxReq): Promise> => { + upgradeClient = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUpgradeClient.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUpgradeClientResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* SubmitMisbehaviour defines a rpc handler method for MsgSubmitMisbehaviour. */ - submitMisbehaviour = async (request: BroadcastTxReq): Promise> => { + submitMisbehaviour = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSubmitMisbehaviour.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSubmitMisbehaviourResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.msg.ts index a872f9725..03a0f525e 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.rpc.msg.ts @@ -1,22 +1,22 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./connection"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenInitResponse, MsgConnectionOpenInitResponseSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenTryResponse, MsgConnectionOpenTryResponseSDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenAckResponse, MsgConnectionOpenAckResponseSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType, MsgConnectionOpenConfirmResponse, MsgConnectionOpenConfirmResponseSDKType } from "./tx"; /** Msg defines the ibc/connection Msg service. */ export interface Msg { /** ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. */ - connectionOpenInit(request: BroadcastTxReq): Promise>; + connectionOpenInit(request: BroadcastTxReq): Promise; /** ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. */ - connectionOpenTry(request: BroadcastTxReq): Promise>; + connectionOpenTry(request: BroadcastTxReq): Promise; /** ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. */ - connectionOpenAck(request: BroadcastTxReq): Promise>; + connectionOpenAck(request: BroadcastTxReq): Promise; /** * ConnectionOpenConfirm defines a rpc handler method for * MsgConnectionOpenConfirm. */ - connectionOpenConfirm(request: BroadcastTxReq): Promise>; + connectionOpenConfirm(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -24,53 +24,37 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* ConnectionOpenInit defines a rpc handler method for MsgConnectionOpenInit. */ - connectionOpenInit = async (request: BroadcastTxReq): Promise> => { + connectionOpenInit = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgConnectionOpenInit.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgConnectionOpenInitResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ConnectionOpenTry defines a rpc handler method for MsgConnectionOpenTry. */ - connectionOpenTry = async (request: BroadcastTxReq): Promise> => { + connectionOpenTry = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgConnectionOpenTry.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgConnectionOpenTryResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ConnectionOpenAck defines a rpc handler method for MsgConnectionOpenAck. */ - connectionOpenAck = async (request: BroadcastTxReq): Promise> => { + connectionOpenAck = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgConnectionOpenAck.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgConnectionOpenAckResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ConnectionOpenConfirm defines a rpc handler method for MsgConnectionOpenConfirm. */ - connectionOpenConfirm = async (request: BroadcastTxReq): Promise> => { + connectionOpenConfirm = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgConnectionOpenConfirm.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgConnectionOpenConfirmResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts index c6d0ec5f4..0c5765344 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.rpc.msg.ts @@ -1,9 +1,9 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../../../types"; import { BinaryReader } from "../../../../../binary"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType, MsgCreateBalancerPoolResponse, MsgCreateBalancerPoolResponseSDKType } from "./tx"; export interface Msg { - createBalancerPool(request: BroadcastTxReq): Promise>; + createBalancerPool(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -11,16 +11,12 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateBalancerPool */ - createBalancerPool = async (request: BroadcastTxReq): Promise> => { + createBalancerPool = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateBalancerPool.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateBalancerPoolResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts index 5ecd9b951..dfeec8256 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.rpc.msg.ts @@ -1,11 +1,11 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../../types"; import { BinaryReader } from "../../../../binary"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgCreateStableswapPoolResponse, MsgCreateStableswapPoolResponseSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType, MsgStableSwapAdjustScalingFactorsResponse, MsgStableSwapAdjustScalingFactorsResponseSDKType } from "./tx"; export interface Msg { - createStableswapPool(request: BroadcastTxReq): Promise>; - stableSwapAdjustScalingFactors(request: BroadcastTxReq): Promise>; + createStableswapPool(request: BroadcastTxReq): Promise; + stableSwapAdjustScalingFactors(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -13,28 +13,20 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateStableswapPool */ - createStableswapPool = async (request: BroadcastTxReq): Promise> => { + createStableswapPool = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateStableswapPool.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateStableswapPoolResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* StableSwapAdjustScalingFactors */ - stableSwapAdjustScalingFactors = async (request: BroadcastTxReq): Promise> => { + stableSwapAdjustScalingFactors = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgStableSwapAdjustScalingFactors.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgStableSwapAdjustScalingFactorsResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.msg.ts index 835246ad8..afd7ffad1 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.rpc.msg.ts @@ -1,16 +1,16 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgJoinPool, MsgJoinPoolSDKType, MsgJoinPoolResponse, MsgJoinPoolResponseSDKType, MsgExitPool, MsgExitPoolSDKType, MsgExitPoolResponse, MsgExitPoolResponseSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountInResponse, MsgSwapExactAmountInResponseSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgSwapExactAmountOutResponse, MsgSwapExactAmountOutResponseSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapExternAmountInResponse, MsgJoinSwapExternAmountInResponseSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgJoinSwapShareAmountOutResponse, MsgJoinSwapShareAmountOutResponseSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapExternAmountOutResponse, MsgExitSwapExternAmountOutResponseSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType, MsgExitSwapShareAmountInResponse, MsgExitSwapShareAmountInResponseSDKType } from "./tx"; export interface Msg { - joinPool(request: BroadcastTxReq): Promise>; - exitPool(request: BroadcastTxReq): Promise>; - swapExactAmountIn(request: BroadcastTxReq): Promise>; - swapExactAmountOut(request: BroadcastTxReq): Promise>; - joinSwapExternAmountIn(request: BroadcastTxReq): Promise>; - joinSwapShareAmountOut(request: BroadcastTxReq): Promise>; - exitSwapExternAmountOut(request: BroadcastTxReq): Promise>; - exitSwapShareAmountIn(request: BroadcastTxReq): Promise>; + joinPool(request: BroadcastTxReq): Promise; + exitPool(request: BroadcastTxReq): Promise; + swapExactAmountIn(request: BroadcastTxReq): Promise; + swapExactAmountOut(request: BroadcastTxReq): Promise; + joinSwapExternAmountIn(request: BroadcastTxReq): Promise; + joinSwapShareAmountOut(request: BroadcastTxReq): Promise; + exitSwapExternAmountOut(request: BroadcastTxReq): Promise; + exitSwapShareAmountIn(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -18,100 +18,68 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* JoinPool */ - joinPool = async (request: BroadcastTxReq): Promise> => { + joinPool = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgJoinPool.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgJoinPoolResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ExitPool */ - exitPool = async (request: BroadcastTxReq): Promise> => { + exitPool = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgExitPool.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgExitPoolResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* SwapExactAmountIn */ - swapExactAmountIn = async (request: BroadcastTxReq): Promise> => { + swapExactAmountIn = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSwapExactAmountIn.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSwapExactAmountInResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* SwapExactAmountOut */ - swapExactAmountOut = async (request: BroadcastTxReq): Promise> => { + swapExactAmountOut = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSwapExactAmountOut.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSwapExactAmountOutResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* JoinSwapExternAmountIn */ - joinSwapExternAmountIn = async (request: BroadcastTxReq): Promise> => { + joinSwapExternAmountIn = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgJoinSwapExternAmountIn.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgJoinSwapExternAmountInResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* JoinSwapShareAmountOut */ - joinSwapShareAmountOut = async (request: BroadcastTxReq): Promise> => { + joinSwapShareAmountOut = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgJoinSwapShareAmountOut.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgJoinSwapShareAmountOutResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ExitSwapExternAmountOut */ - exitSwapExternAmountOut = async (request: BroadcastTxReq): Promise> => { + exitSwapExternAmountOut = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgExitSwapExternAmountOut.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgExitSwapExternAmountOutResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ExitSwapShareAmountIn */ - exitSwapShareAmountIn = async (request: BroadcastTxReq): Promise> => { + exitSwapShareAmountIn = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgExitSwapShareAmountIn.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgExitSwapShareAmountInResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.msg.ts index f02927a46..4ec6df552 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.rpc.msg.ts @@ -1,12 +1,12 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgCreateGaugeResponse, MsgCreateGaugeResponseSDKType, MsgAddToGauge, MsgAddToGaugeSDKType, MsgAddToGaugeResponse, MsgAddToGaugeResponseSDKType } from "./tx"; export interface Msg { - createGauge(request: BroadcastTxReq): Promise>; - addToGauge(request: BroadcastTxReq): Promise>; + createGauge(request: BroadcastTxReq): Promise; + addToGauge(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -14,28 +14,20 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateGauge */ - createGauge = async (request: BroadcastTxReq): Promise> => { + createGauge = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateGauge.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateGaugeResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* AddToGauge */ - addToGauge = async (request: BroadcastTxReq): Promise> => { + addToGauge = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgAddToGauge.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgAddToGaugeResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.msg.ts index d411903a7..3d4719166 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.rpc.msg.ts @@ -1,20 +1,20 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgLockTokens, MsgLockTokensSDKType, MsgLockTokensResponse, MsgLockTokensResponseSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlockingAllResponse, MsgBeginUnlockingAllResponseSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgBeginUnlockingResponse, MsgBeginUnlockingResponseSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgExtendLockupResponse, MsgExtendLockupResponseSDKType, MsgForceUnlock, MsgForceUnlockSDKType, MsgForceUnlockResponse, MsgForceUnlockResponseSDKType } from "./tx"; /** Msg defines the Msg service. */ export interface Msg { /** LockTokens lock tokens */ - lockTokens(request: BroadcastTxReq): Promise>; + lockTokens(request: BroadcastTxReq): Promise; /** BeginUnlockingAll begin unlocking all tokens */ - beginUnlockingAll(request: BroadcastTxReq): Promise>; + beginUnlockingAll(request: BroadcastTxReq): Promise; /** MsgBeginUnlocking begins unlocking tokens by lock ID */ - beginUnlocking(request: BroadcastTxReq): Promise>; + beginUnlocking(request: BroadcastTxReq): Promise; /** MsgEditLockup edits the existing lockups by lock ID */ - extendLockup(request: BroadcastTxReq): Promise>; - forceUnlock(request: BroadcastTxReq): Promise>; + extendLockup(request: BroadcastTxReq): Promise; + forceUnlock(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -22,64 +22,44 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* LockTokens lock tokens */ - lockTokens = async (request: BroadcastTxReq): Promise> => { + lockTokens = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgLockTokens.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgLockTokensResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* BeginUnlockingAll begin unlocking all tokens */ - beginUnlockingAll = async (request: BroadcastTxReq): Promise> => { + beginUnlockingAll = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgBeginUnlockingAll.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgBeginUnlockingAllResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* MsgBeginUnlocking begins unlocking tokens by lock ID */ - beginUnlocking = async (request: BroadcastTxReq): Promise> => { + beginUnlocking = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgBeginUnlocking.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgBeginUnlockingResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* MsgEditLockup edits the existing lockups by lock ID */ - extendLockup = async (request: BroadcastTxReq): Promise> => { + extendLockup = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgExtendLockup.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgExtendLockupResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ForceUnlock */ - forceUnlock = async (request: BroadcastTxReq): Promise> => { + forceUnlock = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgForceUnlock.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgForceUnlockResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.msg.ts index 545d82ced..3a1aa5d90 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.rpc.msg.ts @@ -1,21 +1,21 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../types"; import { BinaryReader } from "../../binary"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidDelegateResponse, MsgSuperfluidDelegateResponseSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUndelegateResponse, MsgSuperfluidUndelegateResponseSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgSuperfluidUnbondLockResponse, MsgSuperfluidUnbondLockResponseSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgLockAndSuperfluidDelegateResponse, MsgLockAndSuperfluidDelegateResponseSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType, MsgUnPoolWhitelistedPoolResponse, MsgUnPoolWhitelistedPoolResponseSDKType } from "./tx"; /** Msg defines the Msg service. */ export interface Msg { /** Execute superfluid delegation for a lockup */ - superfluidDelegate(request: BroadcastTxReq): Promise>; + superfluidDelegate(request: BroadcastTxReq): Promise; /** Execute superfluid undelegation for a lockup */ - superfluidUndelegate(request: BroadcastTxReq): Promise>; + superfluidUndelegate(request: BroadcastTxReq): Promise; /** * For a given lock that is being superfluidly undelegated, * also unbond the underlying lock. */ - superfluidUnbondLock(request: BroadcastTxReq): Promise>; + superfluidUnbondLock(request: BroadcastTxReq): Promise; /** Execute lockup lock and superfluid delegation in a single msg */ - lockAndSuperfluidDelegate(request: BroadcastTxReq): Promise>; - unPoolWhitelistedPool(request: BroadcastTxReq): Promise>; + lockAndSuperfluidDelegate(request: BroadcastTxReq): Promise; + unPoolWhitelistedPool(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -23,65 +23,45 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* Execute superfluid delegation for a lockup */ - superfluidDelegate = async (request: BroadcastTxReq): Promise> => { + superfluidDelegate = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSuperfluidDelegate.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSuperfluidDelegateResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Execute superfluid undelegation for a lockup */ - superfluidUndelegate = async (request: BroadcastTxReq): Promise> => { + superfluidUndelegate = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSuperfluidUndelegate.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSuperfluidUndelegateResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* For a given lock that is being superfluidly undelegated, also unbond the underlying lock. */ - superfluidUnbondLock = async (request: BroadcastTxReq): Promise> => { + superfluidUnbondLock = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSuperfluidUnbondLock.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSuperfluidUnbondLockResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Execute lockup lock and superfluid delegation in a single msg */ - lockAndSuperfluidDelegate = async (request: BroadcastTxReq): Promise> => { + lockAndSuperfluidDelegate = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgLockAndSuperfluidDelegate.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgLockAndSuperfluidDelegateResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* UnPoolWhitelistedPool */ - unPoolWhitelistedPool = async (request: BroadcastTxReq): Promise> => { + unPoolWhitelistedPool = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgUnPoolWhitelistedPool.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgUnPoolWhitelistedPoolResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts index 4ea8dee4e..7cf6a9527 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.rpc.msg.ts @@ -1,15 +1,15 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; -import { BroadcastTxReq, BroadcastTxRes, TxRpc } from "../../../types"; +import { BroadcastTxReq, DeliverTxResponse, TxRpc } from "../../../types"; import { BinaryReader } from "../../../binary"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgCreateDenomResponse, MsgCreateDenomResponseSDKType, MsgMint, MsgMintSDKType, MsgMintResponse, MsgMintResponseSDKType, MsgBurn, MsgBurnSDKType, MsgBurnResponse, MsgBurnResponseSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgChangeAdminResponse, MsgChangeAdminResponseSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType, MsgSetDenomMetadataResponse, MsgSetDenomMetadataResponseSDKType } from "./tx"; /** Msg defines the tokefactory module's gRPC message service. */ export interface Msg { - createDenom(request: BroadcastTxReq): Promise>; - mint(request: BroadcastTxReq): Promise>; - burn(request: BroadcastTxReq): Promise>; - changeAdmin(request: BroadcastTxReq): Promise>; - setDenomMetadata(request: BroadcastTxReq): Promise>; + createDenom(request: BroadcastTxReq): Promise; + mint(request: BroadcastTxReq): Promise; + burn(request: BroadcastTxReq): Promise; + changeAdmin(request: BroadcastTxReq): Promise; + setDenomMetadata(request: BroadcastTxReq): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: TxRpc; @@ -17,64 +17,44 @@ export class MsgClientImpl implements Msg { this.rpc = rpc; } /* CreateDenom */ - createDenom = async (request: BroadcastTxReq): Promise> => { + createDenom = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgCreateDenom.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgCreateDenomResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Mint */ - mint = async (request: BroadcastTxReq): Promise> => { + mint = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgMint.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgMintResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* Burn */ - burn = async (request: BroadcastTxReq): Promise> => { + burn = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgBurn.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgBurnResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* ChangeAdmin */ - changeAdmin = async (request: BroadcastTxReq): Promise> => { + changeAdmin = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgChangeAdmin.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgChangeAdminResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; /* SetDenomMetadata */ - setDenomMetadata = async (request: BroadcastTxReq): Promise> => { + setDenomMetadata = async (request: BroadcastTxReq): Promise => { const data = [{ typeUrl: MsgSetDenomMetadata.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSetDenomMetadataResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); }; } export const createClientImpl = (rpc: TxRpc) => { diff --git a/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.msg.test.ts.snap b/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.msg.test.ts.snap index 52b7d828b..a5d841da1 100644 --- a/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.msg.test.ts.snap +++ b/packages/ast/src/clients/rpc/class/tendermint/__snapshots__/rpc.msg.test.ts.snap @@ -43,7 +43,7 @@ export interface Msg { /** Send defines a method for sending coins from one account to another account. */ send(request: MsgSend): Promise; /** MultiSend defines a method for sending coins from some accounts to other accounts. */ - multiSend(request: BroadcastTxReq): Promise>; + multiSend(request: BroadcastTxReq): Promise; }" `; @@ -60,16 +60,12 @@ exports[`RPC Msg Query mixed implement Client 2`] = ` const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "Send", data); return promise.then(data => MsgSendResponse.decode(new BinaryReader(data))); } - multiSend(request: BroadcastTxReq): Promise> { + multiSend(request: BroadcastTxReq): Promise { const data = [{ typeUrl: MsgMultiSend.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgMultiSendResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); } }" `; @@ -78,9 +74,9 @@ exports[`RPC Msg implement Client 1`] = ` "/** Msg defines the bank Msg service. */ export interface Msg { /** Send defines a method for sending coins from one account to another account. */ - send(request: BroadcastTxReq): Promise>; + send(request: BroadcastTxReq): Promise; /** MultiSend defines a method for sending coins from some accounts to other accounts. */ - multiSend(request: BroadcastTxReq): Promise>; + multiSend(request: BroadcastTxReq): Promise; }" `; @@ -92,27 +88,19 @@ exports[`RPC Msg implement Client 2`] = ` this.send = this.send.bind(this); this.multiSend = this.multiSend.bind(this); } - send(request: BroadcastTxReq): Promise> { + send(request: BroadcastTxReq): Promise { const data = [{ typeUrl: MsgSend.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgSendResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); } - multiSend(request: BroadcastTxReq): Promise> { + multiSend(request: BroadcastTxReq): Promise { const data = [{ typeUrl: MsgMultiSend.typeUrl, value: request.message }]; - const promise = this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); - return promise.then(data => ({ - txResponse: data, - response: data && data.msgResponses?.length ? MsgMultiSendResponse.decode(data.msgResponses[0].value) : undefined - })); + return this.rpc.signAndBroadcast!(request.signerAddress, data, request.fee, request.memo); } }" `; diff --git a/packages/ast/src/clients/rpc/class/tendermint/rpc.ts b/packages/ast/src/clients/rpc/class/tendermint/rpc.ts index 3ed739424..e41bb3a72 100644 --- a/packages/ast/src/clients/rpc/class/tendermint/rpc.ts +++ b/packages/ast/src/clients/rpc/class/tendermint/rpc.ts @@ -59,12 +59,7 @@ const rpcTxMethodDefinition = ( ) ); const responseType = t.tsTypeReference( - t.identifier("BroadcastTxRes"), - t.tsTypeParameterInstantiation( - [ - t.tsTypeReference(t.identifier(svc.responseType)) - ] - ) + t.identifier("DeliverTxResponse"), ); const methodArgs: t.Identifier = identifier( @@ -335,12 +330,7 @@ const rpcTxClassMethod = ( ) ); const responseType = t.tsTypeReference( - t.identifier("BroadcastTxRes"), - t.tsTypeParameterInstantiation( - [ - t.tsTypeReference(t.identifier(svc.responseType)) - ] - ) + t.identifier("DeliverTxResponse"), ); const comment = svc.comment ?? svc.name; @@ -372,71 +362,26 @@ const rpcTxClassMethod = ( ]), // generate: - // const promise = this.rpc.signAndBroadcast!( + // return this.rpc.signAndBroadcast!( // request.signerAddress, // data, // request.fee, // request.memo // ); - t.variableDeclaration('const', [ - t.variableDeclarator( - t.identifier('promise'), - t.callExpression( - t.memberExpression( - t.memberExpression( - t.thisExpression(), - t.identifier('rpc') - ), - t.identifier('signAndBroadcast!') - ), - [ - t.memberExpression(t.identifier('request'), t.identifier('signerAddress')), - t.identifier('data'), - t.memberExpression(t.identifier('request'), t.identifier('fee')), - t.memberExpression(t.identifier('request'), t.identifier('memo')) - ] - ) - ) - ]), - - // generate: - // return promise.then((data) => ({ - // txResponse: data, - // response: - // data && data.msgResponses?.length - // ? MsgCreateValidatorResponse.decode(data.msgResponses[0].value) - // : undefined, - // })); t.returnStatement( t.callExpression( - t.memberExpression(t.identifier('promise'), t.identifier('then')), + t.memberExpression( + t.memberExpression( + t.thisExpression(), + t.identifier('rpc') + ), + t.identifier('signAndBroadcast!') + ), [ - t.arrowFunctionExpression( - [t.identifier('data')], - t.objectExpression([ - t.objectProperty(t.identifier('txResponse'), t.identifier('data')), - t.objectProperty( - t.identifier('response'), - t.conditionalExpression( - t.logicalExpression( - '&&', - t.identifier('data'), - t.optionalMemberExpression( - t.memberExpression(t.identifier('data'), t.identifier('msgResponses')), - t.identifier('length'), - false, - true - ) - ), - t.callExpression( - t.memberExpression(t.identifier(svc.responseType), t.identifier('decode')), - [t.memberExpression(t.memberExpression(t.memberExpression(t.identifier('data'), t.identifier('msgResponses')), t.numericLiteral(0), true), t.identifier('value'))] - ), - t.identifier('undefined') - ) - ) - ]) - ) + t.memberExpression(t.identifier('request'), t.identifier('signerAddress')), + t.identifier('data'), + t.memberExpression(t.identifier('request'), t.identifier('fee')), + t.memberExpression(t.identifier('request'), t.identifier('memo')) ] ) ) @@ -549,7 +494,7 @@ export const createRpcClientInterface = ( switch (implementType) { case "Tx": context.addUtil("BroadcastTxReq"); - context.addUtil("BroadcastTxRes"); + context.addUtil("DeliverTxResponse"); return rpcTxMethodDefinition( methodAlias, @@ -627,7 +572,7 @@ export const createRpcClientClass = ( switch (implementType) { case "Tx": context.addUtil("BroadcastTxReq"); - context.addUtil("BroadcastTxRes"); + context.addUtil("DeliverTxResponse"); return rpcTxClassMethod( context, diff --git a/packages/telescope/README.md b/packages/telescope/README.md index 835760fc6..59a87773c 100644 --- a/packages/telescope/README.md +++ b/packages/telescope/README.md @@ -838,6 +838,95 @@ main().then(() => { }) ``` +## Instant RPC methods + +Using instantOps option to expose instant RPC methods. + +For example, for this config: +``` + instantOps: [ + { + className: "OsmosisClaim", + include: { + patterns: ["osmosis.**.*claim*"], + }, + }, + { + className: "CosmosAuthAccount", + include: { + patterns: [ + "cosmos.auth.**.*account*", + "cosmos.auth.**.*Account*", + "cosmos.gov.v1beta1.**", + ], + }, + nameMapping: { + // name mapping rule for both Msg and Query methods. + // moduleAccounts will be renamed to authModuleAccounts in generated class. + All: { + authModuleAccounts: "cosmos.auth.v1beta1.moduleAccounts", + }, + // name mapping rule for Msg methods. + Tx: { + // deposit method under Msg will be renamed to txDeposit in generated class. While deposit method under Query will remain the same. + txDeposit: "cosmos.gov.v1beta1.deposit", + // Same for vote method. + txVote: "cosmos.gov.v1beta1.vote", + }, + }, + }, + ], +``` + +There'll be an extra file generated in the root folder called service-ops.ts: +``` +export interface OsmosisClaim extends _OsmosisClaimV1beta1Queryrpc.OsmosisClaim {} +export class OsmosisClaim { + rpc: TxRpc; + init(rpc: TxRpc) { + this.rpc = rpc; + this.claimRecord = _OsmosisClaimV1beta1Queryrpc.createClientImpl(rpc).claimRecord; + this.claimableForAction = _OsmosisClaimV1beta1Queryrpc.createClientImpl(rpc).claimableForAction; + } +} +export interface CosmosAuthAccount extends _CosmosAuthV1beta1Queryrpc.CosmosAuthAccount, _CosmosGovV1beta1Queryrpc.CosmosAuthAccount, _CosmosGovV1beta1Txrpc.CosmosAuthAccount {} +export class CosmosAuthAccount { + rpc: TxRpc; + init(rpc: TxRpc) { + this.rpc = rpc; + this.accounts = _CosmosAuthV1beta1Queryrpc.createClientImpl(rpc).accounts; + this.account = _CosmosAuthV1beta1Queryrpc.createClientImpl(rpc).account; + + // moduleAccounts has been renamed to authModuleAccounts as the nameMapping in settings. + this.authModuleAccounts = _CosmosAuthV1beta1Queryrpc.createClientImpl(rpc).moduleAccounts; + + this.proposal = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).proposal; + this.proposals = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).proposals; + + // vote under Query remains the same. + this.vote = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).vote; + + this.votes = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).votes; + this.params = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).params; + + // deposit under Query remains the same. + this.deposit = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).deposit; + + this.deposits = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).deposits; + this.tallyResult = _CosmosGovV1beta1Queryrpc.createClientImpl(rpc).tallyResult; + this.submitProposal = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).submitProposal; + + //same as txDeposite for vote here. + this.txVote = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).vote; + + this.voteWeighted = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).voteWeighted; + + // deposit method under Msg will be renamed to txDeposit in generated class. While deposit method under Query will remain the same. + this.txDeposit = _CosmosGovV1beta1Txrpc.createClientImpl(rpc).deposit; + } +} +``` + ## Manually registering types This example is with `osmosis` module in `osmojs`, but it is the same pattern for any module. diff --git a/packages/telescope/src/utils/index.ts b/packages/telescope/src/utils/index.ts index 096e94ada..b7142c620 100644 --- a/packages/telescope/src/utils/index.ts +++ b/packages/telescope/src/utils/index.ts @@ -54,6 +54,7 @@ export const UTILS = { TxRpc: '__types__', BroadcastTxReq: '__types__', BroadcastTxRes: '__types__', + DeliverTxResponse: '__types__', grpc: '@improbable-eng/grpc-web', setPaginationParams: '__helpers__', SigningStargateClient: '@cosmjs/stargate', diff --git a/packages/telescope/types/utils/index.d.ts b/packages/telescope/types/utils/index.d.ts index 1a99e79a5..426285093 100644 --- a/packages/telescope/types/utils/index.d.ts +++ b/packages/telescope/types/utils/index.d.ts @@ -52,6 +52,7 @@ export declare const UTILS: { TxRpc: string; BroadcastTxReq: string; BroadcastTxRes: string; + DeliverTxResponse: string; grpc: string; setPaginationParams: string; SigningStargateClient: string;