Skip to content

Commit

Permalink
Updated ts-client
Browse files Browse the repository at this point in the history
  • Loading branch information
Artemkaaas committed Nov 19, 2024
1 parent 7b59c21 commit 8eac7f5
Show file tree
Hide file tree
Showing 16 changed files with 470 additions and 432 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { msgTypes } from './registry';
import { IgniteClient } from "../client"
import { MissingWalletError } from "../helpers"
import { Api } from "./rest";
import { MsgUpdateComplianceInfo } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgCertifyModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgDeleteComplianceInfo } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgCertifyModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgProvisionModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgUpdateComplianceInfo } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgRevokeModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";

import { CertifiedModel as typeCertifiedModel} from "./types"
Expand All @@ -20,10 +20,10 @@ import { DeviceSoftwareCompliance as typeDeviceSoftwareCompliance} from "./types
import { ProvisionalModel as typeProvisionalModel} from "./types"
import { RevokedModel as typeRevokedModel} from "./types"

export { MsgUpdateComplianceInfo, MsgCertifyModel, MsgDeleteComplianceInfo, MsgProvisionModel, MsgRevokeModel };
export { MsgDeleteComplianceInfo, MsgCertifyModel, MsgProvisionModel, MsgUpdateComplianceInfo, MsgRevokeModel };

type sendMsgUpdateComplianceInfoParams = {
value: MsgUpdateComplianceInfo,
type sendMsgDeleteComplianceInfoParams = {
value: MsgDeleteComplianceInfo,
fee?: StdFee,
memo?: string
};
Expand All @@ -34,14 +34,14 @@ type sendMsgCertifyModelParams = {
memo?: string
};

type sendMsgDeleteComplianceInfoParams = {
value: MsgDeleteComplianceInfo,
type sendMsgProvisionModelParams = {
value: MsgProvisionModel,
fee?: StdFee,
memo?: string
};

type sendMsgProvisionModelParams = {
value: MsgProvisionModel,
type sendMsgUpdateComplianceInfoParams = {
value: MsgUpdateComplianceInfo,
fee?: StdFee,
memo?: string
};
Expand All @@ -53,22 +53,22 @@ type sendMsgRevokeModelParams = {
};


type msgUpdateComplianceInfoParams = {
value: MsgUpdateComplianceInfo,
type msgDeleteComplianceInfoParams = {
value: MsgDeleteComplianceInfo,
};

type msgCertifyModelParams = {
value: MsgCertifyModel,
};

type msgDeleteComplianceInfoParams = {
value: MsgDeleteComplianceInfo,
};

type msgProvisionModelParams = {
value: MsgProvisionModel,
};

type msgUpdateComplianceInfoParams = {
value: MsgUpdateComplianceInfo,
};

type msgRevokeModelParams = {
value: MsgRevokeModel,
};
Expand Down Expand Up @@ -103,17 +103,17 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht

return {

async sendMsgUpdateComplianceInfo({ value, fee, memo }: sendMsgUpdateComplianceInfoParams): Promise<DeliverTxResponse> {
async sendMsgDeleteComplianceInfo({ value, fee, memo }: sendMsgDeleteComplianceInfoParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgUpdateComplianceInfo: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgDeleteComplianceInfo: Unable to sign Tx. Signer is not present.')
}
try {
const { address } = (await signer.getAccounts())[0];
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
let msg = this.msgUpdateComplianceInfo({ value: MsgUpdateComplianceInfo.fromPartial(value) })
let msg = this.msgDeleteComplianceInfo({ value: MsgDeleteComplianceInfo.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgUpdateComplianceInfo: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgDeleteComplianceInfo: Could not broadcast Tx: '+ e.message)
}
},

Expand All @@ -131,31 +131,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
}
},

async sendMsgDeleteComplianceInfo({ value, fee, memo }: sendMsgDeleteComplianceInfoParams): Promise<DeliverTxResponse> {
async sendMsgProvisionModel({ value, fee, memo }: sendMsgProvisionModelParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgDeleteComplianceInfo: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgProvisionModel: Unable to sign Tx. Signer is not present.')
}
try {
const { address } = (await signer.getAccounts())[0];
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
let msg = this.msgDeleteComplianceInfo({ value: MsgDeleteComplianceInfo.fromPartial(value) })
let msg = this.msgProvisionModel({ value: MsgProvisionModel.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgDeleteComplianceInfo: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgProvisionModel: Could not broadcast Tx: '+ e.message)
}
},

async sendMsgProvisionModel({ value, fee, memo }: sendMsgProvisionModelParams): Promise<DeliverTxResponse> {
async sendMsgUpdateComplianceInfo({ value, fee, memo }: sendMsgUpdateComplianceInfoParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgProvisionModel: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgUpdateComplianceInfo: Unable to sign Tx. Signer is not present.')
}
try {
const { address } = (await signer.getAccounts())[0];
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
let msg = this.msgProvisionModel({ value: MsgProvisionModel.fromPartial(value) })
let msg = this.msgUpdateComplianceInfo({ value: MsgUpdateComplianceInfo.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgProvisionModel: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgUpdateComplianceInfo: Could not broadcast Tx: '+ e.message)
}
},

Expand All @@ -174,11 +174,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
},


msgUpdateComplianceInfo({ value }: msgUpdateComplianceInfoParams): EncodeObject {
msgDeleteComplianceInfo({ value }: msgDeleteComplianceInfoParams): EncodeObject {
try {
return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgUpdateComplianceInfo", value: MsgUpdateComplianceInfo.fromPartial( value ) }
return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgDeleteComplianceInfo", value: MsgDeleteComplianceInfo.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgUpdateComplianceInfo: Could not create message: ' + e.message)
throw new Error('TxClient:MsgDeleteComplianceInfo: Could not create message: ' + e.message)
}
},

Expand All @@ -190,19 +190,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
}
},

msgDeleteComplianceInfo({ value }: msgDeleteComplianceInfoParams): EncodeObject {
msgProvisionModel({ value }: msgProvisionModelParams): EncodeObject {
try {
return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgDeleteComplianceInfo", value: MsgDeleteComplianceInfo.fromPartial( value ) }
return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgProvisionModel", value: MsgProvisionModel.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgDeleteComplianceInfo: Could not create message: ' + e.message)
throw new Error('TxClient:MsgProvisionModel: Could not create message: ' + e.message)
}
},

msgProvisionModel({ value }: msgProvisionModelParams): EncodeObject {
msgUpdateComplianceInfo({ value }: msgUpdateComplianceInfoParams): EncodeObject {
try {
return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgProvisionModel", value: MsgProvisionModel.fromPartial( value ) }
return { typeUrl: "/zigbeealliance.distributedcomplianceledger.compliance.MsgUpdateComplianceInfo", value: MsgUpdateComplianceInfo.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgProvisionModel: Could not create message: ' + e.message)
throw new Error('TxClient:MsgUpdateComplianceInfo: Could not create message: ' + e.message)
}
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { GeneratedType } from "@cosmjs/proto-signing";
import { MsgUpdateComplianceInfo } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgCertifyModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgDeleteComplianceInfo } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgCertifyModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgProvisionModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgUpdateComplianceInfo } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";
import { MsgRevokeModel } from "./types/zigbeealliance/distributedcomplianceledger/compliance/tx";

const msgTypes: Array<[string, GeneratedType]> = [
["/zigbeealliance.distributedcomplianceledger.compliance.MsgUpdateComplianceInfo", MsgUpdateComplianceInfo],
["/zigbeealliance.distributedcomplianceledger.compliance.MsgCertifyModel", MsgCertifyModel],
["/zigbeealliance.distributedcomplianceledger.compliance.MsgDeleteComplianceInfo", MsgDeleteComplianceInfo],
["/zigbeealliance.distributedcomplianceledger.compliance.MsgCertifyModel", MsgCertifyModel],
["/zigbeealliance.distributedcomplianceledger.compliance.MsgProvisionModel", MsgProvisionModel],
["/zigbeealliance.distributedcomplianceledger.compliance.MsgUpdateComplianceInfo", MsgUpdateComplianceInfo],
["/zigbeealliance.distributedcomplianceledger.compliance.MsgRevokeModel", MsgRevokeModel],

];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { msgTypes } from './registry';
import { IgniteClient } from "../client"
import { MissingWalletError } from "../helpers"
import { Api } from "./rest";
import { MsgProposeAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
import { MsgApproveRevokeAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
import { MsgProposeAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
import { MsgProposeRevokeAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
import { MsgRejectAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
import { MsgApproveAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
Expand All @@ -21,16 +21,16 @@ import { PendingAccountRevocation as typePendingAccountRevocation} from "./types
import { RejectedAccount as typeRejectedAccount} from "./types"
import { RevokedAccount as typeRevokedAccount} from "./types"

export { MsgProposeAddAccount, MsgApproveRevokeAccount, MsgProposeRevokeAccount, MsgRejectAddAccount, MsgApproveAddAccount };
export { MsgApproveRevokeAccount, MsgProposeAddAccount, MsgProposeRevokeAccount, MsgRejectAddAccount, MsgApproveAddAccount };

type sendMsgProposeAddAccountParams = {
value: MsgProposeAddAccount,
type sendMsgApproveRevokeAccountParams = {
value: MsgApproveRevokeAccount,
fee?: StdFee,
memo?: string
};

type sendMsgApproveRevokeAccountParams = {
value: MsgApproveRevokeAccount,
type sendMsgProposeAddAccountParams = {
value: MsgProposeAddAccount,
fee?: StdFee,
memo?: string
};
Expand All @@ -54,14 +54,14 @@ type sendMsgApproveAddAccountParams = {
};


type msgProposeAddAccountParams = {
value: MsgProposeAddAccount,
};

type msgApproveRevokeAccountParams = {
value: MsgApproveRevokeAccount,
};

type msgProposeAddAccountParams = {
value: MsgProposeAddAccount,
};

type msgProposeRevokeAccountParams = {
value: MsgProposeRevokeAccount,
};
Expand Down Expand Up @@ -104,31 +104,31 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht

return {

async sendMsgProposeAddAccount({ value, fee, memo }: sendMsgProposeAddAccountParams): Promise<DeliverTxResponse> {
async sendMsgApproveRevokeAccount({ value, fee, memo }: sendMsgApproveRevokeAccountParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgProposeAddAccount: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgApproveRevokeAccount: Unable to sign Tx. Signer is not present.')
}
try {
const { address } = (await signer.getAccounts())[0];
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
let msg = this.msgProposeAddAccount({ value: MsgProposeAddAccount.fromPartial(value) })
let msg = this.msgApproveRevokeAccount({ value: MsgApproveRevokeAccount.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgProposeAddAccount: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgApproveRevokeAccount: Could not broadcast Tx: '+ e.message)
}
},

async sendMsgApproveRevokeAccount({ value, fee, memo }: sendMsgApproveRevokeAccountParams): Promise<DeliverTxResponse> {
async sendMsgProposeAddAccount({ value, fee, memo }: sendMsgProposeAddAccountParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgApproveRevokeAccount: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgProposeAddAccount: Unable to sign Tx. Signer is not present.')
}
try {
const { address } = (await signer.getAccounts())[0];
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
let msg = this.msgApproveRevokeAccount({ value: MsgApproveRevokeAccount.fromPartial(value) })
let msg = this.msgProposeAddAccount({ value: MsgProposeAddAccount.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgApproveRevokeAccount: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgProposeAddAccount: Could not broadcast Tx: '+ e.message)
}
},

Expand Down Expand Up @@ -175,19 +175,19 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
},


msgProposeAddAccount({ value }: msgProposeAddAccountParams): EncodeObject {
msgApproveRevokeAccount({ value }: msgApproveRevokeAccountParams): EncodeObject {
try {
return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgProposeAddAccount", value: MsgProposeAddAccount.fromPartial( value ) }
return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveRevokeAccount", value: MsgApproveRevokeAccount.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgProposeAddAccount: Could not create message: ' + e.message)
throw new Error('TxClient:MsgApproveRevokeAccount: Could not create message: ' + e.message)
}
},

msgApproveRevokeAccount({ value }: msgApproveRevokeAccountParams): EncodeObject {
msgProposeAddAccount({ value }: msgProposeAddAccountParams): EncodeObject {
try {
return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveRevokeAccount", value: MsgApproveRevokeAccount.fromPartial( value ) }
return { typeUrl: "/zigbeealliance.distributedcomplianceledger.dclauth.MsgProposeAddAccount", value: MsgProposeAddAccount.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgApproveRevokeAccount: Could not create message: ' + e.message)
throw new Error('TxClient:MsgProposeAddAccount: Could not create message: ' + e.message)
}
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { GeneratedType } from "@cosmjs/proto-signing";
import { MsgProposeAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
import { MsgApproveRevokeAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
import { MsgProposeAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
import { MsgProposeRevokeAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
import { MsgRejectAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";
import { MsgApproveAddAccount } from "./types/zigbeealliance/distributedcomplianceledger/dclauth/tx";

const msgTypes: Array<[string, GeneratedType]> = [
["/zigbeealliance.distributedcomplianceledger.dclauth.MsgProposeAddAccount", MsgProposeAddAccount],
["/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveRevokeAccount", MsgApproveRevokeAccount],
["/zigbeealliance.distributedcomplianceledger.dclauth.MsgProposeAddAccount", MsgProposeAddAccount],
["/zigbeealliance.distributedcomplianceledger.dclauth.MsgProposeRevokeAccount", MsgProposeRevokeAccount],
["/zigbeealliance.distributedcomplianceledger.dclauth.MsgRejectAddAccount", MsgRejectAddAccount],
["/zigbeealliance.distributedcomplianceledger.dclauth.MsgApproveAddAccount", MsgApproveAddAccount],
Expand Down
Loading

0 comments on commit 8eac7f5

Please sign in to comment.