Skip to content

Commit

Permalink
Undo changes to ts-client
Browse files Browse the repository at this point in the history
  • Loading branch information
toshiSat committed Mar 28, 2024
1 parent 6ea6fb3 commit bce2f08
Show file tree
Hide file tree
Showing 55 changed files with 1,502 additions and 1,829 deletions.
138 changes: 69 additions & 69 deletions ts-client/arkeo.arkeo/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { msgTypes } from './registry';
import { IgniteClient } from "../client"
import { MissingWalletError } from "../helpers"
import { Api } from "./rest";
import { MsgModProvider } from "./types/arkeo/arkeo/tx";
import { MsgBondProvider } from "./types/arkeo/arkeo/tx";
import { MsgSetVersion } from "./types/arkeo/arkeo/tx";
import { MsgClaimContractIncome } from "./types/arkeo/arkeo/tx";
import { MsgModProvider } from "./types/arkeo/arkeo/tx";
import { MsgOpenContract } from "./types/arkeo/arkeo/tx";
import { MsgCloseContract } from "./types/arkeo/arkeo/tx";
import { MsgClaimContractIncome } from "./types/arkeo/arkeo/tx";
import { MsgSetVersion } from "./types/arkeo/arkeo/tx";

import { EventBondProvider as typeEventBondProvider} from "./types"
import { EventModProvider as typeEventModProvider} from "./types"
Expand All @@ -32,16 +32,28 @@ import { ProtoStrings as typeProtoStrings} from "./types"
import { ProtoBools as typeProtoBools} from "./types"
import { Params as typeParams} from "./types"

export { MsgModProvider, MsgBondProvider, MsgOpenContract, MsgCloseContract, MsgClaimContractIncome, MsgSetVersion };
export { MsgBondProvider, MsgSetVersion, MsgClaimContractIncome, MsgModProvider, MsgOpenContract, MsgCloseContract };

type sendMsgModProviderParams = {
value: MsgModProvider,
type sendMsgBondProviderParams = {
value: MsgBondProvider,
fee?: StdFee,
memo?: string
};

type sendMsgBondProviderParams = {
value: MsgBondProvider,
type sendMsgSetVersionParams = {
value: MsgSetVersion,
fee?: StdFee,
memo?: string
};

type sendMsgClaimContractIncomeParams = {
value: MsgClaimContractIncome,
fee?: StdFee,
memo?: string
};

type sendMsgModProviderParams = {
value: MsgModProvider,
fee?: StdFee,
memo?: string
};
Expand All @@ -58,27 +70,23 @@ type sendMsgCloseContractParams = {
memo?: string
};

type sendMsgClaimContractIncomeParams = {
value: MsgClaimContractIncome,
fee?: StdFee,
memo?: string

type msgBondProviderParams = {
value: MsgBondProvider,
};

type sendMsgSetVersionParams = {
type msgSetVersionParams = {
value: MsgSetVersion,
fee?: StdFee,
memo?: string
};

type msgClaimContractIncomeParams = {
value: MsgClaimContractIncome,
};

type msgModProviderParams = {
value: MsgModProvider,
};

type msgBondProviderParams = {
value: MsgBondProvider,
};

type msgOpenContractParams = {
value: MsgOpenContract,
};
Expand All @@ -87,14 +95,6 @@ type msgCloseContractParams = {
value: MsgCloseContract,
};

type msgClaimContractIncomeParams = {
value: MsgClaimContractIncome,
};

type msgSetVersionParams = {
value: MsgSetVersion,
};


export const registry = new Registry(msgTypes);

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

return {

async sendMsgModProvider({ value, fee, memo }: sendMsgModProviderParams): Promise<DeliverTxResponse> {
async sendMsgBondProvider({ value, fee, memo }: sendMsgBondProviderParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgModProvider: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgBondProvider: 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.msgModProvider({ value: MsgModProvider.fromPartial(value) })
let msg = this.msgBondProvider({ value: MsgBondProvider.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgModProvider: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgBondProvider: Could not broadcast Tx: '+ e.message)
}
},

async sendMsgBondProvider({ value, fee, memo }: sendMsgBondProviderParams): Promise<DeliverTxResponse> {
async sendMsgSetVersion({ value, fee, memo }: sendMsgSetVersionParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgBondProvider: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgSetVersion: 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.msgBondProvider({ value: MsgBondProvider.fromPartial(value) })
let msg = this.msgSetVersion({ value: MsgSetVersion.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgBondProvider: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgSetVersion: Could not broadcast Tx: '+ e.message)
}
},

async sendMsgOpenContract({ value, fee, memo }: sendMsgOpenContractParams): Promise<DeliverTxResponse> {
async sendMsgClaimContractIncome({ value, fee, memo }: sendMsgClaimContractIncomeParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgOpenContract: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgClaimContractIncome: 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.msgOpenContract({ value: MsgOpenContract.fromPartial(value) })
let msg = this.msgClaimContractIncome({ value: MsgClaimContractIncome.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgOpenContract: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgClaimContractIncome: Could not broadcast Tx: '+ e.message)
}
},

async sendMsgCloseContract({ value, fee, memo }: sendMsgCloseContractParams): Promise<DeliverTxResponse> {
async sendMsgModProvider({ value, fee, memo }: sendMsgModProviderParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgCloseContract: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgModProvider: 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.msgCloseContract({ value: MsgCloseContract.fromPartial(value) })
let msg = this.msgModProvider({ value: MsgModProvider.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgCloseContract: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgModProvider: Could not broadcast Tx: '+ e.message)
}
},

async sendMsgClaimContractIncome({ value, fee, memo }: sendMsgClaimContractIncomeParams): Promise<DeliverTxResponse> {
async sendMsgOpenContract({ value, fee, memo }: sendMsgOpenContractParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgClaimContractIncome: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgOpenContract: 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.msgClaimContractIncome({ value: MsgClaimContractIncome.fromPartial(value) })
let msg = this.msgOpenContract({ value: MsgOpenContract.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgClaimContractIncome: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgOpenContract: Could not broadcast Tx: '+ e.message)
}
},

async sendMsgSetVersion({ value, fee, memo }: sendMsgSetVersionParams): Promise<DeliverTxResponse> {
async sendMsgCloseContract({ value, fee, memo }: sendMsgCloseContractParams): Promise<DeliverTxResponse> {
if (!signer) {
throw new Error('TxClient:sendMsgSetVersion: Unable to sign Tx. Signer is not present.')
throw new Error('TxClient:sendMsgCloseContract: 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.msgSetVersion({ value: MsgSetVersion.fromPartial(value) })
let msg = this.msgCloseContract({ value: MsgCloseContract.fromPartial(value) })
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
} catch (e: any) {
throw new Error('TxClient:sendMsgSetVersion: Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:sendMsgCloseContract: Could not broadcast Tx: '+ e.message)
}
},


msgModProvider({ value }: msgModProviderParams): EncodeObject {
msgBondProvider({ value }: msgBondProviderParams): EncodeObject {
try {
return { typeUrl: "/arkeo.arkeo.MsgModProvider", value: MsgModProvider.fromPartial( value ) }
return { typeUrl: "/arkeo.arkeo.MsgBondProvider", value: MsgBondProvider.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgModProvider: Could not create message: ' + e.message)
throw new Error('TxClient:MsgBondProvider: Could not create message: ' + e.message)
}
},

msgBondProvider({ value }: msgBondProviderParams): EncodeObject {
msgSetVersion({ value }: msgSetVersionParams): EncodeObject {
try {
return { typeUrl: "/arkeo.arkeo.MsgBondProvider", value: MsgBondProvider.fromPartial( value ) }
return { typeUrl: "/arkeo.arkeo.MsgSetVersion", value: MsgSetVersion.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgBondProvider: Could not create message: ' + e.message)
throw new Error('TxClient:MsgSetVersion: Could not create message: ' + e.message)
}
},

msgOpenContract({ value }: msgOpenContractParams): EncodeObject {
msgClaimContractIncome({ value }: msgClaimContractIncomeParams): EncodeObject {
try {
return { typeUrl: "/arkeo.arkeo.MsgOpenContract", value: MsgOpenContract.fromPartial( value ) }
return { typeUrl: "/arkeo.arkeo.MsgClaimContractIncome", value: MsgClaimContractIncome.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgOpenContract: Could not create message: ' + e.message)
throw new Error('TxClient:MsgClaimContractIncome: Could not create message: ' + e.message)
}
},

msgCloseContract({ value }: msgCloseContractParams): EncodeObject {
msgModProvider({ value }: msgModProviderParams): EncodeObject {
try {
return { typeUrl: "/arkeo.arkeo.MsgCloseContract", value: MsgCloseContract.fromPartial( value ) }
return { typeUrl: "/arkeo.arkeo.MsgModProvider", value: MsgModProvider.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgCloseContract: Could not create message: ' + e.message)
throw new Error('TxClient:MsgModProvider: Could not create message: ' + e.message)
}
},

msgClaimContractIncome({ value }: msgClaimContractIncomeParams): EncodeObject {
msgOpenContract({ value }: msgOpenContractParams): EncodeObject {
try {
return { typeUrl: "/arkeo.arkeo.MsgClaimContractIncome", value: MsgClaimContractIncome.fromPartial( value ) }
return { typeUrl: "/arkeo.arkeo.MsgOpenContract", value: MsgOpenContract.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgClaimContractIncome: Could not create message: ' + e.message)
throw new Error('TxClient:MsgOpenContract: Could not create message: ' + e.message)
}
},

msgSetVersion({ value }: msgSetVersionParams): EncodeObject {
msgCloseContract({ value }: msgCloseContractParams): EncodeObject {
try {
return { typeUrl: "/arkeo.arkeo.MsgSetVersion", value: MsgSetVersion.fromPartial( value ) }
return { typeUrl: "/arkeo.arkeo.MsgCloseContract", value: MsgCloseContract.fromPartial( value ) }
} catch (e: any) {
throw new Error('TxClient:MsgSetVersion: Could not create message: ' + e.message)
throw new Error('TxClient:MsgCloseContract: Could not create message: ' + e.message)
}
},

Expand Down
12 changes: 6 additions & 6 deletions ts-client/arkeo.arkeo/registry.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { GeneratedType } from "@cosmjs/proto-signing";
import { MsgModProvider } from "./types/arkeo/arkeo/tx";
import { MsgBondProvider } from "./types/arkeo/arkeo/tx";
import { MsgSetVersion } from "./types/arkeo/arkeo/tx";
import { MsgClaimContractIncome } from "./types/arkeo/arkeo/tx";
import { MsgModProvider } from "./types/arkeo/arkeo/tx";
import { MsgOpenContract } from "./types/arkeo/arkeo/tx";
import { MsgCloseContract } from "./types/arkeo/arkeo/tx";
import { MsgClaimContractIncome } from "./types/arkeo/arkeo/tx";
import { MsgSetVersion } from "./types/arkeo/arkeo/tx";

const msgTypes: Array<[string, GeneratedType]> = [
["/arkeo.arkeo.MsgModProvider", MsgModProvider],
["/arkeo.arkeo.MsgBondProvider", MsgBondProvider],
["/arkeo.arkeo.MsgSetVersion", MsgSetVersion],
["/arkeo.arkeo.MsgClaimContractIncome", MsgClaimContractIncome],
["/arkeo.arkeo.MsgModProvider", MsgModProvider],
["/arkeo.arkeo.MsgOpenContract", MsgOpenContract],
["/arkeo.arkeo.MsgCloseContract", MsgCloseContract],
["/arkeo.arkeo.MsgClaimContractIncome", MsgClaimContractIncome],
["/arkeo.arkeo.MsgSetVersion", MsgSetVersion],

];

Expand Down
12 changes: 6 additions & 6 deletions ts-client/arkeo.arkeo/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export type ArkeoMsgOpenContractResponse = object;

export type ArkeoMsgSetVersionResponse = object;

/**
* Params defines the parameters for the module.
*/
export type ArkeoParams = object;

export interface ArkeoProvider {
/** @format byte */
pub_key?: string;
Expand Down Expand Up @@ -158,14 +163,9 @@ export interface ArkeoQueryFetchProviderResponse {
*/
export interface ArkeoQueryParamsResponse {
/** params holds all the parameters of this module. */
params?: ArkeoarkeoParams;
params?: ArkeoParams;
}

/**
* Params defines the parameters for the module.
*/
export type ArkeoarkeoParams = object;

export interface ProtobufAny {
"@type"?: string;
}
Expand Down
13 changes: 1 addition & 12 deletions ts-client/arkeo.arkeo/types/arkeo/arkeo/genesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ export interface GenesisState {
contracts: Contract[];
nextContractId: number;
contractExpirationSets: ContractExpirationSet[];
userContractSets: UserContractSet[];
/** this line is used by starport scaffolding # genesis/proto/state */
version: number;
userContractSets: UserContractSet[];
}

function createBaseGenesisState(): GenesisState {
Expand All @@ -26,7 +25,6 @@ function createBaseGenesisState(): GenesisState {
nextContractId: 0,
contractExpirationSets: [],
userContractSets: [],
version: 0,
};
}

Expand All @@ -50,9 +48,6 @@ export const GenesisState = {
for (const v of message.userContractSets) {
UserContractSet.encode(v!, writer.uint32(50).fork()).ldelim();
}
if (message.version !== 0) {
writer.uint32(56).int64(message.version);
}
return writer;
},

Expand Down Expand Up @@ -81,9 +76,6 @@ export const GenesisState = {
case 6:
message.userContractSets.push(UserContractSet.decode(reader, reader.uint32()));
break;
case 7:
message.version = longToNumber(reader.int64() as Long);
break;
default:
reader.skipType(tag & 7);
break;
Expand All @@ -104,7 +96,6 @@ export const GenesisState = {
userContractSets: Array.isArray(object?.userContractSets)
? object.userContractSets.map((e: any) => UserContractSet.fromJSON(e))
: [],
version: isSet(object.version) ? Number(object.version) : 0,
};
},

Expand Down Expand Up @@ -134,7 +125,6 @@ export const GenesisState = {
} else {
obj.userContractSets = [];
}
message.version !== undefined && (obj.version = Math.round(message.version));
return obj;
},

Expand All @@ -149,7 +139,6 @@ export const GenesisState = {
message.contractExpirationSets = object.contractExpirationSets?.map((e) => ContractExpirationSet.fromPartial(e))
|| [];
message.userContractSets = object.userContractSets?.map((e) => UserContractSet.fromPartial(e)) || [];
message.version = object.version ?? 0;
return message;
},
};
Expand Down
Loading

0 comments on commit bce2f08

Please sign in to comment.