decentralcardgame-cardchain-client-ts 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DecentralCardGame.cardchain.cardchain/module.js +428 -460
- package/DecentralCardGame.cardchain.cardchain/module.ts +1496 -1571
- package/DecentralCardGame.cardchain.cardchain/registry.js +74 -66
- package/DecentralCardGame.cardchain.cardchain/registry.ts +74 -66
- package/DecentralCardGame.cardchain.cardchain/rest.js +71 -0
- package/DecentralCardGame.cardchain.cardchain/rest.ts +132 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.js +6 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.ts +6 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/early_access_proposal.js +81 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/early_access_proposal.ts +106 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/encounters.js +295 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/encounters.ts +354 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/genesis.js +16 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/genesis.ts +19 -1
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.js +447 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.ts +570 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/tx.js +504 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/tx.ts +613 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/user.js +50 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/user.ts +48 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/zealy.js +58 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/zealy.ts +82 -0
- package/DecentralCardGame.cardchain.cardchain/types.js +5 -1
- package/DecentralCardGame.cardchain.cardchain/types.ts +8 -0
- package/DecentralCardGame.cardchain.featureflag/module.js +9 -7
- package/DecentralCardGame.cardchain.featureflag/module.ts +69 -65
- package/client.js +2 -5
- package/client.ts +164 -162
- package/cosmos.authz.v1beta1/module.js +33 -22
- package/cosmos.authz.v1beta1/module.ts +220 -148
- package/cosmos.distribution.v1beta1/module.js +65 -35
- package/cosmos.distribution.v1beta1/module.ts +354 -200
- package/cosmos.evidence.v1beta1/module.js +21 -13
- package/cosmos.evidence.v1beta1/module.ts +115 -86
- package/cosmos.gov.v1/module.js +48 -29
- package/cosmos.gov.v1/module.ts +275 -178
- package/cosmos.mint.v1beta1/module.js +9 -7
- package/cosmos.mint.v1beta1/module.ts +67 -63
- package/cosmos.nft.v1beta1/module.js +9 -7
- package/cosmos.nft.v1beta1/module.ts +75 -71
- package/cosmos.tx.v1beta1/module.js +9 -7
- package/cosmos.tx.v1beta1/module.ts +89 -85
- package/cosmos.vesting.v1beta1/module.js +52 -29
- package/cosmos.vesting.v1beta1/module.ts +249 -149
- package/ibc.applications.interchain_accounts.controller.v1/module.js +9 -7
- package/ibc.applications.interchain_accounts.controller.v1/module.ts +65 -61
- package/ibc.applications.transfer.v1/module.js +17 -12
- package/ibc.applications.transfer.v1/module.ts +114 -88
- package/ibc.core.channel.v1/module.js +1 -4
- package/ibc.core.channel.v1/module.ts +79 -81
- package/ibc.core.client.v1/module.js +1 -4
- package/ibc.core.client.v1/module.ts +81 -83
- package/ibc.core.connection.v1/module.js +6 -7
- package/ibc.core.connection.v1/module.ts +88 -84
- package/package.json +4 -1
- package/tsconfig.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by Ignite ignite.com/cli
|
|
2
2
|
import { SigningStargateClient } from "@cosmjs/stargate";
|
|
3
|
-
import { Registry } from "@cosmjs/proto-signing";
|
|
4
|
-
import { msgTypes } from
|
|
3
|
+
import { Registry, } from "@cosmjs/proto-signing";
|
|
4
|
+
import { msgTypes } from "./registry";
|
|
5
5
|
import { Api } from "./rest";
|
|
6
6
|
import { MsgCreatePeriodicVestingAccount } from "./types/cosmos/vesting/v1beta1/tx";
|
|
7
7
|
import { MsgCreateVestingAccount } from "./types/cosmos/vesting/v1beta1/tx";
|
|
@@ -12,7 +12,7 @@ import { DelayedVestingAccount as typeDelayedVestingAccount } from "./types";
|
|
|
12
12
|
import { Period as typePeriod } from "./types";
|
|
13
13
|
import { PeriodicVestingAccount as typePeriodicVestingAccount } from "./types";
|
|
14
14
|
import { PermanentLockedAccount as typePermanentLockedAccount } from "./types";
|
|
15
|
-
export { MsgCreatePeriodicVestingAccount, MsgCreateVestingAccount, MsgCreatePermanentLockedAccount };
|
|
15
|
+
export { MsgCreatePeriodicVestingAccount, MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, };
|
|
16
16
|
export const registry = new Registry(msgTypes);
|
|
17
17
|
function getStructure(template) {
|
|
18
18
|
const structure = { fields: [] };
|
|
@@ -26,72 +26,96 @@ const defaultFee = {
|
|
|
26
26
|
amount: [],
|
|
27
27
|
gas: "200000",
|
|
28
28
|
};
|
|
29
|
-
export const txClient = ({ signer, prefix, addr } = {
|
|
29
|
+
export const txClient = ({ signer, prefix, addr } = {
|
|
30
|
+
addr: "http://localhost:26657",
|
|
31
|
+
prefix: "cosmos",
|
|
32
|
+
}) => {
|
|
30
33
|
return {
|
|
31
|
-
async sendMsgCreatePeriodicVestingAccount({ value, fee, memo }) {
|
|
34
|
+
async sendMsgCreatePeriodicVestingAccount({ value, fee, memo, }) {
|
|
32
35
|
if (!signer) {
|
|
33
|
-
throw new Error(
|
|
36
|
+
throw new Error("TxClient:sendMsgCreatePeriodicVestingAccount: Unable to sign Tx. Signer is not present.");
|
|
34
37
|
}
|
|
35
38
|
try {
|
|
36
39
|
const { address } = (await signer.getAccounts())[0];
|
|
37
40
|
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
38
|
-
let msg = this.msgCreatePeriodicVestingAccount({
|
|
41
|
+
let msg = this.msgCreatePeriodicVestingAccount({
|
|
42
|
+
value: MsgCreatePeriodicVestingAccount.fromPartial(value),
|
|
43
|
+
});
|
|
39
44
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
40
45
|
}
|
|
41
46
|
catch (e) {
|
|
42
|
-
throw new Error(
|
|
47
|
+
throw new Error("TxClient:sendMsgCreatePeriodicVestingAccount: Could not broadcast Tx: " +
|
|
48
|
+
e.message);
|
|
43
49
|
}
|
|
44
50
|
},
|
|
45
|
-
async sendMsgCreateVestingAccount({ value, fee, memo }) {
|
|
51
|
+
async sendMsgCreateVestingAccount({ value, fee, memo, }) {
|
|
46
52
|
if (!signer) {
|
|
47
|
-
throw new Error(
|
|
53
|
+
throw new Error("TxClient:sendMsgCreateVestingAccount: Unable to sign Tx. Signer is not present.");
|
|
48
54
|
}
|
|
49
55
|
try {
|
|
50
56
|
const { address } = (await signer.getAccounts())[0];
|
|
51
57
|
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
52
|
-
let msg = this.msgCreateVestingAccount({
|
|
58
|
+
let msg = this.msgCreateVestingAccount({
|
|
59
|
+
value: MsgCreateVestingAccount.fromPartial(value),
|
|
60
|
+
});
|
|
53
61
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
54
62
|
}
|
|
55
63
|
catch (e) {
|
|
56
|
-
throw new Error(
|
|
64
|
+
throw new Error("TxClient:sendMsgCreateVestingAccount: Could not broadcast Tx: " +
|
|
65
|
+
e.message);
|
|
57
66
|
}
|
|
58
67
|
},
|
|
59
|
-
async sendMsgCreatePermanentLockedAccount({ value, fee, memo }) {
|
|
68
|
+
async sendMsgCreatePermanentLockedAccount({ value, fee, memo, }) {
|
|
60
69
|
if (!signer) {
|
|
61
|
-
throw new Error(
|
|
70
|
+
throw new Error("TxClient:sendMsgCreatePermanentLockedAccount: Unable to sign Tx. Signer is not present.");
|
|
62
71
|
}
|
|
63
72
|
try {
|
|
64
73
|
const { address } = (await signer.getAccounts())[0];
|
|
65
74
|
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
66
|
-
let msg = this.msgCreatePermanentLockedAccount({
|
|
75
|
+
let msg = this.msgCreatePermanentLockedAccount({
|
|
76
|
+
value: MsgCreatePermanentLockedAccount.fromPartial(value),
|
|
77
|
+
});
|
|
67
78
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
68
79
|
}
|
|
69
80
|
catch (e) {
|
|
70
|
-
throw new Error(
|
|
81
|
+
throw new Error("TxClient:sendMsgCreatePermanentLockedAccount: Could not broadcast Tx: " +
|
|
82
|
+
e.message);
|
|
71
83
|
}
|
|
72
84
|
},
|
|
73
|
-
msgCreatePeriodicVestingAccount({ value }) {
|
|
85
|
+
msgCreatePeriodicVestingAccount({ value, }) {
|
|
74
86
|
try {
|
|
75
|
-
return {
|
|
87
|
+
return {
|
|
88
|
+
typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount",
|
|
89
|
+
value: MsgCreatePeriodicVestingAccount.fromPartial(value),
|
|
90
|
+
};
|
|
76
91
|
}
|
|
77
92
|
catch (e) {
|
|
78
|
-
throw new Error(
|
|
93
|
+
throw new Error("TxClient:MsgCreatePeriodicVestingAccount: Could not create message: " +
|
|
94
|
+
e.message);
|
|
79
95
|
}
|
|
80
96
|
},
|
|
81
|
-
msgCreateVestingAccount({ value }) {
|
|
97
|
+
msgCreateVestingAccount({ value, }) {
|
|
82
98
|
try {
|
|
83
|
-
return {
|
|
99
|
+
return {
|
|
100
|
+
typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount",
|
|
101
|
+
value: MsgCreateVestingAccount.fromPartial(value),
|
|
102
|
+
};
|
|
84
103
|
}
|
|
85
104
|
catch (e) {
|
|
86
|
-
throw new Error(
|
|
105
|
+
throw new Error("TxClient:MsgCreateVestingAccount: Could not create message: " +
|
|
106
|
+
e.message);
|
|
87
107
|
}
|
|
88
108
|
},
|
|
89
|
-
msgCreatePermanentLockedAccount({ value }) {
|
|
109
|
+
msgCreatePermanentLockedAccount({ value, }) {
|
|
90
110
|
try {
|
|
91
|
-
return {
|
|
111
|
+
return {
|
|
112
|
+
typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount",
|
|
113
|
+
value: MsgCreatePermanentLockedAccount.fromPartial(value),
|
|
114
|
+
};
|
|
92
115
|
}
|
|
93
116
|
catch (e) {
|
|
94
|
-
throw new Error(
|
|
117
|
+
throw new Error("TxClient:MsgCreatePermanentLockedAccount: Could not create message: " +
|
|
118
|
+
e.message);
|
|
95
119
|
}
|
|
96
120
|
},
|
|
97
121
|
};
|
|
@@ -112,7 +136,7 @@ class SDKModule {
|
|
|
112
136
|
PeriodicVestingAccount: getStructure(typePeriodicVestingAccount.fromPartial({})),
|
|
113
137
|
PermanentLockedAccount: getStructure(typePermanentLockedAccount.fromPartial({})),
|
|
114
138
|
};
|
|
115
|
-
client.on(
|
|
139
|
+
client.on("signer-changed", (signer) => {
|
|
116
140
|
this.updateTX(client);
|
|
117
141
|
});
|
|
118
142
|
}
|
|
@@ -128,13 +152,12 @@ class SDKModule {
|
|
|
128
152
|
}
|
|
129
153
|
}
|
|
130
154
|
}
|
|
131
|
-
;
|
|
132
155
|
const Module = (test) => {
|
|
133
156
|
return {
|
|
134
157
|
module: {
|
|
135
|
-
CosmosVestingV1Beta1: new SDKModule(test)
|
|
158
|
+
CosmosVestingV1Beta1: new SDKModule(test),
|
|
136
159
|
},
|
|
137
|
-
registry: msgTypes
|
|
160
|
+
registry: msgTypes,
|
|
138
161
|
};
|
|
139
162
|
};
|
|
140
163
|
export default Module;
|
|
@@ -2,69 +2,76 @@
|
|
|
2
2
|
|
|
3
3
|
import { StdFee } from "@cosmjs/amino";
|
|
4
4
|
import { SigningStargateClient, DeliverTxResponse } from "@cosmjs/stargate";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import {
|
|
6
|
+
EncodeObject,
|
|
7
|
+
GeneratedType,
|
|
8
|
+
OfflineSigner,
|
|
9
|
+
Registry,
|
|
10
|
+
} from "@cosmjs/proto-signing";
|
|
11
|
+
import { msgTypes } from "./registry";
|
|
12
|
+
import { IgniteClient } from "../client";
|
|
13
|
+
import { MissingWalletError } from "../helpers";
|
|
9
14
|
import { Api } from "./rest";
|
|
10
15
|
import { MsgCreatePeriodicVestingAccount } from "./types/cosmos/vesting/v1beta1/tx";
|
|
11
16
|
import { MsgCreateVestingAccount } from "./types/cosmos/vesting/v1beta1/tx";
|
|
12
17
|
import { MsgCreatePermanentLockedAccount } from "./types/cosmos/vesting/v1beta1/tx";
|
|
13
18
|
|
|
14
|
-
import { BaseVestingAccount as typeBaseVestingAccount} from "./types"
|
|
15
|
-
import { ContinuousVestingAccount as typeContinuousVestingAccount} from "./types"
|
|
16
|
-
import { DelayedVestingAccount as typeDelayedVestingAccount} from "./types"
|
|
17
|
-
import { Period as typePeriod} from "./types"
|
|
18
|
-
import { PeriodicVestingAccount as typePeriodicVestingAccount} from "./types"
|
|
19
|
-
import { PermanentLockedAccount as typePermanentLockedAccount} from "./types"
|
|
19
|
+
import { BaseVestingAccount as typeBaseVestingAccount } from "./types";
|
|
20
|
+
import { ContinuousVestingAccount as typeContinuousVestingAccount } from "./types";
|
|
21
|
+
import { DelayedVestingAccount as typeDelayedVestingAccount } from "./types";
|
|
22
|
+
import { Period as typePeriod } from "./types";
|
|
23
|
+
import { PeriodicVestingAccount as typePeriodicVestingAccount } from "./types";
|
|
24
|
+
import { PermanentLockedAccount as typePermanentLockedAccount } from "./types";
|
|
20
25
|
|
|
21
|
-
export {
|
|
26
|
+
export {
|
|
27
|
+
MsgCreatePeriodicVestingAccount,
|
|
28
|
+
MsgCreateVestingAccount,
|
|
29
|
+
MsgCreatePermanentLockedAccount,
|
|
30
|
+
};
|
|
22
31
|
|
|
23
32
|
type sendMsgCreatePeriodicVestingAccountParams = {
|
|
24
|
-
value: MsgCreatePeriodicVestingAccount
|
|
25
|
-
fee?: StdFee
|
|
26
|
-
memo?: string
|
|
33
|
+
value: MsgCreatePeriodicVestingAccount;
|
|
34
|
+
fee?: StdFee;
|
|
35
|
+
memo?: string;
|
|
27
36
|
};
|
|
28
37
|
|
|
29
38
|
type sendMsgCreateVestingAccountParams = {
|
|
30
|
-
value: MsgCreateVestingAccount
|
|
31
|
-
fee?: StdFee
|
|
32
|
-
memo?: string
|
|
39
|
+
value: MsgCreateVestingAccount;
|
|
40
|
+
fee?: StdFee;
|
|
41
|
+
memo?: string;
|
|
33
42
|
};
|
|
34
43
|
|
|
35
44
|
type sendMsgCreatePermanentLockedAccountParams = {
|
|
36
|
-
value: MsgCreatePermanentLockedAccount
|
|
37
|
-
fee?: StdFee
|
|
38
|
-
memo?: string
|
|
45
|
+
value: MsgCreatePermanentLockedAccount;
|
|
46
|
+
fee?: StdFee;
|
|
47
|
+
memo?: string;
|
|
39
48
|
};
|
|
40
49
|
|
|
41
|
-
|
|
42
50
|
type msgCreatePeriodicVestingAccountParams = {
|
|
43
|
-
value: MsgCreatePeriodicVestingAccount
|
|
51
|
+
value: MsgCreatePeriodicVestingAccount;
|
|
44
52
|
};
|
|
45
53
|
|
|
46
54
|
type msgCreateVestingAccountParams = {
|
|
47
|
-
value: MsgCreateVestingAccount
|
|
55
|
+
value: MsgCreateVestingAccount;
|
|
48
56
|
};
|
|
49
57
|
|
|
50
58
|
type msgCreatePermanentLockedAccountParams = {
|
|
51
|
-
value: MsgCreatePermanentLockedAccount
|
|
59
|
+
value: MsgCreatePermanentLockedAccount;
|
|
52
60
|
};
|
|
53
61
|
|
|
54
|
-
|
|
55
62
|
export const registry = new Registry(msgTypes);
|
|
56
63
|
|
|
57
64
|
type Field = {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
65
|
+
name: string;
|
|
66
|
+
type: unknown;
|
|
67
|
+
};
|
|
61
68
|
function getStructure(template) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
const structure: { fields: Field[] } = { fields: [] };
|
|
70
|
+
for (let [key, value] of Object.entries(template)) {
|
|
71
|
+
let field = { name: key, type: typeof value };
|
|
72
|
+
structure.fields.push(field);
|
|
73
|
+
}
|
|
74
|
+
return structure;
|
|
68
75
|
}
|
|
69
76
|
const defaultFee = {
|
|
70
77
|
amount: [],
|
|
@@ -72,136 +79,229 @@ const defaultFee = {
|
|
|
72
79
|
};
|
|
73
80
|
|
|
74
81
|
interface TxClientOptions {
|
|
75
|
-
addr: string
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
addr: string;
|
|
83
|
+
prefix: string;
|
|
84
|
+
signer?: OfflineSigner;
|
|
78
85
|
}
|
|
79
86
|
|
|
80
|
-
export const txClient = (
|
|
81
|
-
|
|
87
|
+
export const txClient = (
|
|
88
|
+
{ signer, prefix, addr }: TxClientOptions = {
|
|
89
|
+
addr: "http://localhost:26657",
|
|
90
|
+
prefix: "cosmos",
|
|
91
|
+
},
|
|
92
|
+
) => {
|
|
82
93
|
return {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
94
|
+
async sendMsgCreatePeriodicVestingAccount({
|
|
95
|
+
value,
|
|
96
|
+
fee,
|
|
97
|
+
memo,
|
|
98
|
+
}: sendMsgCreatePeriodicVestingAccountParams): Promise<DeliverTxResponse> {
|
|
99
|
+
if (!signer) {
|
|
100
|
+
throw new Error(
|
|
101
|
+
"TxClient:sendMsgCreatePeriodicVestingAccount: Unable to sign Tx. Signer is not present.",
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
const { address } = (await signer.getAccounts())[0];
|
|
106
|
+
const signingClient = await SigningStargateClient.connectWithSigner(
|
|
107
|
+
addr,
|
|
108
|
+
signer,
|
|
109
|
+
{ registry, prefix },
|
|
110
|
+
);
|
|
111
|
+
let msg = this.msgCreatePeriodicVestingAccount({
|
|
112
|
+
value: MsgCreatePeriodicVestingAccount.fromPartial(value),
|
|
113
|
+
});
|
|
114
|
+
return await signingClient.signAndBroadcast(
|
|
115
|
+
address,
|
|
116
|
+
[msg],
|
|
117
|
+
fee ? fee : defaultFee,
|
|
118
|
+
memo,
|
|
119
|
+
);
|
|
120
|
+
} catch (e: any) {
|
|
121
|
+
throw new Error(
|
|
122
|
+
"TxClient:sendMsgCreatePeriodicVestingAccount: Could not broadcast Tx: " +
|
|
123
|
+
e.message,
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
async sendMsgCreateVestingAccount({
|
|
129
|
+
value,
|
|
130
|
+
fee,
|
|
131
|
+
memo,
|
|
132
|
+
}: sendMsgCreateVestingAccountParams): Promise<DeliverTxResponse> {
|
|
133
|
+
if (!signer) {
|
|
134
|
+
throw new Error(
|
|
135
|
+
"TxClient:sendMsgCreateVestingAccount: Unable to sign Tx. Signer is not present.",
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const { address } = (await signer.getAccounts())[0];
|
|
140
|
+
const signingClient = await SigningStargateClient.connectWithSigner(
|
|
141
|
+
addr,
|
|
142
|
+
signer,
|
|
143
|
+
{ registry, prefix },
|
|
144
|
+
);
|
|
145
|
+
let msg = this.msgCreateVestingAccount({
|
|
146
|
+
value: MsgCreateVestingAccount.fromPartial(value),
|
|
147
|
+
});
|
|
148
|
+
return await signingClient.signAndBroadcast(
|
|
149
|
+
address,
|
|
150
|
+
[msg],
|
|
151
|
+
fee ? fee : defaultFee,
|
|
152
|
+
memo,
|
|
153
|
+
);
|
|
154
|
+
} catch (e: any) {
|
|
155
|
+
throw new Error(
|
|
156
|
+
"TxClient:sendMsgCreateVestingAccount: Could not broadcast Tx: " +
|
|
157
|
+
e.message,
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
async sendMsgCreatePermanentLockedAccount({
|
|
163
|
+
value,
|
|
164
|
+
fee,
|
|
165
|
+
memo,
|
|
166
|
+
}: sendMsgCreatePermanentLockedAccountParams): Promise<DeliverTxResponse> {
|
|
167
|
+
if (!signer) {
|
|
168
|
+
throw new Error(
|
|
169
|
+
"TxClient:sendMsgCreatePermanentLockedAccount: Unable to sign Tx. Signer is not present.",
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
try {
|
|
173
|
+
const { address } = (await signer.getAccounts())[0];
|
|
174
|
+
const signingClient = await SigningStargateClient.connectWithSigner(
|
|
175
|
+
addr,
|
|
176
|
+
signer,
|
|
177
|
+
{ registry, prefix },
|
|
178
|
+
);
|
|
179
|
+
let msg = this.msgCreatePermanentLockedAccount({
|
|
180
|
+
value: MsgCreatePermanentLockedAccount.fromPartial(value),
|
|
181
|
+
});
|
|
182
|
+
return await signingClient.signAndBroadcast(
|
|
183
|
+
address,
|
|
184
|
+
[msg],
|
|
185
|
+
fee ? fee : defaultFee,
|
|
186
|
+
memo,
|
|
187
|
+
);
|
|
188
|
+
} catch (e: any) {
|
|
189
|
+
throw new Error(
|
|
190
|
+
"TxClient:sendMsgCreatePermanentLockedAccount: Could not broadcast Tx: " +
|
|
191
|
+
e.message,
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
msgCreatePeriodicVestingAccount({
|
|
197
|
+
value,
|
|
198
|
+
}: msgCreatePeriodicVestingAccountParams): EncodeObject {
|
|
199
|
+
try {
|
|
200
|
+
return {
|
|
201
|
+
typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount",
|
|
202
|
+
value: MsgCreatePeriodicVestingAccount.fromPartial(value),
|
|
203
|
+
};
|
|
204
|
+
} catch (e: any) {
|
|
205
|
+
throw new Error(
|
|
206
|
+
"TxClient:MsgCreatePeriodicVestingAccount: Could not create message: " +
|
|
207
|
+
e.message,
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
msgCreateVestingAccount({
|
|
213
|
+
value,
|
|
214
|
+
}: msgCreateVestingAccountParams): EncodeObject {
|
|
215
|
+
try {
|
|
216
|
+
return {
|
|
217
|
+
typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount",
|
|
218
|
+
value: MsgCreateVestingAccount.fromPartial(value),
|
|
219
|
+
};
|
|
220
|
+
} catch (e: any) {
|
|
221
|
+
throw new Error(
|
|
222
|
+
"TxClient:MsgCreateVestingAccount: Could not create message: " +
|
|
223
|
+
e.message,
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
msgCreatePermanentLockedAccount({
|
|
229
|
+
value,
|
|
230
|
+
}: msgCreatePermanentLockedAccountParams): EncodeObject {
|
|
231
|
+
try {
|
|
232
|
+
return {
|
|
233
|
+
typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount",
|
|
234
|
+
value: MsgCreatePermanentLockedAccount.fromPartial(value),
|
|
235
|
+
};
|
|
236
|
+
} catch (e: any) {
|
|
237
|
+
throw new Error(
|
|
238
|
+
"TxClient:MsgCreatePermanentLockedAccount: Could not create message: " +
|
|
239
|
+
e.message,
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
};
|
|
152
244
|
};
|
|
153
245
|
|
|
154
246
|
interface QueryClientOptions {
|
|
155
|
-
addr: string
|
|
247
|
+
addr: string;
|
|
156
248
|
}
|
|
157
249
|
|
|
158
|
-
export const queryClient = (
|
|
250
|
+
export const queryClient = (
|
|
251
|
+
{ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" },
|
|
252
|
+
) => {
|
|
159
253
|
return new Api({ baseURL: addr });
|
|
160
254
|
};
|
|
161
255
|
|
|
162
256
|
class SDKModule {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
257
|
+
public query: ReturnType<typeof queryClient>;
|
|
258
|
+
public tx: ReturnType<typeof txClient>;
|
|
259
|
+
public structure: Record<string, unknown>;
|
|
260
|
+
public registry: Array<[string, GeneratedType]> = [];
|
|
261
|
+
|
|
262
|
+
constructor(client: IgniteClient) {
|
|
263
|
+
this.query = queryClient({ addr: client.env.apiURL });
|
|
264
|
+
this.updateTX(client);
|
|
265
|
+
this.structure = {
|
|
266
|
+
BaseVestingAccount: getStructure(typeBaseVestingAccount.fromPartial({})),
|
|
267
|
+
ContinuousVestingAccount: getStructure(
|
|
268
|
+
typeContinuousVestingAccount.fromPartial({}),
|
|
269
|
+
),
|
|
270
|
+
DelayedVestingAccount: getStructure(
|
|
271
|
+
typeDelayedVestingAccount.fromPartial({}),
|
|
272
|
+
),
|
|
273
|
+
Period: getStructure(typePeriod.fromPartial({})),
|
|
274
|
+
PeriodicVestingAccount: getStructure(
|
|
275
|
+
typePeriodicVestingAccount.fromPartial({}),
|
|
276
|
+
),
|
|
277
|
+
PermanentLockedAccount: getStructure(
|
|
278
|
+
typePermanentLockedAccount.fromPartial({}),
|
|
279
|
+
),
|
|
280
|
+
};
|
|
281
|
+
client.on("signer-changed", (signer) => {
|
|
282
|
+
this.updateTX(client);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
updateTX(client: IgniteClient) {
|
|
186
286
|
const methods = txClient({
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
})
|
|
191
|
-
|
|
287
|
+
signer: client.signer,
|
|
288
|
+
addr: client.env.rpcURL,
|
|
289
|
+
prefix: client.env.prefix ?? "cosmos",
|
|
290
|
+
});
|
|
291
|
+
|
|
192
292
|
this.tx = methods;
|
|
193
293
|
for (let m in methods) {
|
|
194
|
-
|
|
294
|
+
this.tx[m] = methods[m].bind(this.tx);
|
|
195
295
|
}
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const Module = (test: IgniteClient) => {
|
|
200
|
-
return {
|
|
201
|
-
module: {
|
|
202
|
-
CosmosVestingV1Beta1: new SDKModule(test)
|
|
203
|
-
},
|
|
204
|
-
registry: msgTypes
|
|
205
296
|
}
|
|
206
297
|
}
|
|
207
|
-
|
|
298
|
+
|
|
299
|
+
const Module = (test: IgniteClient) => {
|
|
300
|
+
return {
|
|
301
|
+
module: {
|
|
302
|
+
CosmosVestingV1Beta1: new SDKModule(test),
|
|
303
|
+
},
|
|
304
|
+
registry: msgTypes,
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
export default Module;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by Ignite ignite.com/cli
|
|
2
|
-
import { Registry } from "@cosmjs/proto-signing";
|
|
3
|
-
import { msgTypes } from
|
|
2
|
+
import { Registry, } from "@cosmjs/proto-signing";
|
|
3
|
+
import { msgTypes } from "./registry";
|
|
4
4
|
import { Api } from "./rest";
|
|
5
5
|
import { Params as typeParams } from "./types";
|
|
6
6
|
export const registry = new Registry(msgTypes);
|
|
@@ -16,7 +16,10 @@ const defaultFee = {
|
|
|
16
16
|
amount: [],
|
|
17
17
|
gas: "200000",
|
|
18
18
|
};
|
|
19
|
-
export const txClient = ({ signer, prefix, addr } = {
|
|
19
|
+
export const txClient = ({ signer, prefix, addr } = {
|
|
20
|
+
addr: "http://localhost:26657",
|
|
21
|
+
prefix: "cosmos",
|
|
22
|
+
}) => {
|
|
20
23
|
return {};
|
|
21
24
|
};
|
|
22
25
|
export const queryClient = ({ addr: addr } = { addr: "http://localhost:1317" }) => {
|
|
@@ -30,7 +33,7 @@ class SDKModule {
|
|
|
30
33
|
this.structure = {
|
|
31
34
|
Params: getStructure(typeParams.fromPartial({})),
|
|
32
35
|
};
|
|
33
|
-
client.on(
|
|
36
|
+
client.on("signer-changed", (signer) => {
|
|
34
37
|
this.updateTX(client);
|
|
35
38
|
});
|
|
36
39
|
}
|
|
@@ -46,13 +49,12 @@ class SDKModule {
|
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
|
-
;
|
|
50
52
|
const Module = (test) => {
|
|
51
53
|
return {
|
|
52
54
|
module: {
|
|
53
|
-
IbcApplicationsInterchainAccountsControllerV1: new SDKModule(test)
|
|
55
|
+
IbcApplicationsInterchainAccountsControllerV1: new SDKModule(test),
|
|
54
56
|
},
|
|
55
|
-
registry: msgTypes
|
|
57
|
+
registry: msgTypes,
|
|
56
58
|
};
|
|
57
59
|
};
|
|
58
60
|
export default Module;
|