decentralcardgame-cardchain-client-ts 0.0.26-rc1 → 0.0.27
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 +504 -352
- package/DecentralCardGame.cardchain.cardchain/module.ts +1505 -1267
- package/DecentralCardGame.cardchain.cardchain/registry.js +64 -62
- package/DecentralCardGame.cardchain.cardchain/registry.ts +64 -62
- package/DecentralCardGame.cardchain.cardchain/rest.js +31 -17
- package/DecentralCardGame.cardchain.cardchain/rest.ts +139 -94
- package/DecentralCardGame.cardchain.cardchain/types/amino/amino.ts +1 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.js +86 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.ts +90 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.js +229 -114
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.ts +276 -120
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/set.js +186 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/set.ts +210 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/tx.js +91 -0
- package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/tx.ts +113 -0
- package/DecentralCardGame.cardchain.cardchain/types.js +3 -1
- package/DecentralCardGame.cardchain.cardchain/types.ts +4 -0
- package/DecentralCardGame.cardchain.featureflag/module.js +4 -1
- package/DecentralCardGame.cardchain.featureflag/module.ts +71 -69
- package/DecentralCardGame.cardchain.featureflag/rest.ts +6 -6
- package/client.js +3 -9
- package/client.ts +154 -167
- package/cosmos.auth.v1beta1/module.js +4 -1
- package/cosmos.auth.v1beta1/module.ts +71 -69
- package/cosmos.auth.v1beta1/rest.ts +21 -21
- package/cosmos.authz.v1beta1/module.js +17 -17
- package/cosmos.authz.v1beta1/module.ts +25 -25
- package/cosmos.authz.v1beta1/registry.js +4 -4
- package/cosmos.authz.v1beta1/registry.ts +4 -4
- package/cosmos.authz.v1beta1/rest.ts +75 -75
- package/cosmos.bank.v1beta1/rest.ts +9 -9
- package/cosmos.distribution.v1beta1/module.js +27 -27
- package/cosmos.distribution.v1beta1/module.ts +42 -42
- package/cosmos.distribution.v1beta1/registry.js +4 -4
- package/cosmos.distribution.v1beta1/registry.ts +4 -4
- package/cosmos.distribution.v1beta1/rest.ts +20 -20
- package/cosmos.gov.v1/module.js +24 -24
- package/cosmos.gov.v1/module.ts +36 -36
- package/cosmos.gov.v1/registry.js +4 -4
- package/cosmos.gov.v1/registry.ts +4 -4
- package/cosmos.gov.v1/rest.ts +90 -90
- package/cosmos.gov.v1beta1/module.js +27 -27
- package/cosmos.gov.v1beta1/module.ts +42 -42
- package/cosmos.gov.v1beta1/registry.js +4 -4
- package/cosmos.gov.v1beta1/registry.ts +4 -4
- package/cosmos.gov.v1beta1/rest.ts +152 -152
- package/cosmos.group.v1/module.js +108 -108
- package/cosmos.group.v1/module.ts +164 -164
- package/cosmos.group.v1/registry.js +18 -18
- package/cosmos.group.v1/registry.ts +18 -18
- package/cosmos.group.v1/rest.js +5 -5
- package/cosmos.group.v1/rest.ts +214 -214
- package/cosmos.mint.v1beta1/rest.ts +13 -13
- package/cosmos.nft.v1beta1/rest.ts +132 -132
- package/cosmos.slashing.v1beta1/rest.ts +19 -19
- package/cosmos.staking.v1beta1/module.js +39 -39
- package/cosmos.staking.v1beta1/module.ts +59 -59
- package/cosmos.staking.v1beta1/registry.js +6 -6
- package/cosmos.staking.v1beta1/registry.ts +6 -6
- package/cosmos.staking.v1beta1/rest.ts +95 -95
- package/cosmos.upgrade.v1beta1/module.js +16 -16
- package/cosmos.upgrade.v1beta1/module.ts +24 -24
- package/cosmos.upgrade.v1beta1/registry.js +2 -2
- package/cosmos.upgrade.v1beta1/registry.ts +2 -2
- package/ibc.applications.interchain_accounts.controller.v1/rest.ts +10 -10
- package/ibc.applications.interchain_accounts.host.v1/rest.ts +13 -13
- package/ibc.applications.transfer.v1/rest.ts +3 -3
- package/ibc.core.channel.v1/rest.ts +44 -44
- package/package.json +1 -1
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/card.js +0 -651
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/card.ts +0 -735
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/copyright_proposal.js +0 -102
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/copyright_proposal.ts +0 -134
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/council.js +0 -350
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/council.ts +0 -409
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/genesis.js +0 -254
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/genesis.ts +0 -281
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/image.js +0 -88
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/image.ts +0 -115
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/match.js +0 -308
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/match.ts +0 -355
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/match_reporter_proposal.js +0 -67
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/match_reporter_proposal.ts +0 -92
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/num.js +0 -73
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/num.ts +0 -102
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/params.js +0 -314
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/params.ts +0 -367
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/query.js +0 -1984
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/query.ts +0 -2382
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/running_average.js +0 -85
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/running_average.ts +0 -111
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/sell_offer.js +0 -148
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/sell_offer.ts +0 -183
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/server.js +0 -93
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/server.ts +0 -124
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/set.js +0 -365
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/set.ts +0 -416
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/set_proposal.js +0 -93
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/set_proposal.ts +0 -124
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/tx.js +0 -4494
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/tx.ts +0 -5526
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/user.js +0 -522
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/user.ts +0 -583
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/voting.js +0 -346
- package/DecentralCardGame.cardchain.cardchain/types/DecentralCardGame/cardchain/cardchain/voting.ts +0 -417
|
@@ -3,16 +3,16 @@ import { SigningStargateClient } from "@cosmjs/stargate";
|
|
|
3
3
|
import { Registry } from "@cosmjs/proto-signing";
|
|
4
4
|
import { msgTypes } from './registry';
|
|
5
5
|
import { Api } from "./rest";
|
|
6
|
-
import { MsgGrant } from "./types/cosmos/authz/v1beta1/tx";
|
|
7
|
-
import { MsgExec } from "./types/cosmos/authz/v1beta1/tx";
|
|
8
6
|
import { MsgRevoke } from "./types/cosmos/authz/v1beta1/tx";
|
|
7
|
+
import { MsgExec } from "./types/cosmos/authz/v1beta1/tx";
|
|
8
|
+
import { MsgGrant } from "./types/cosmos/authz/v1beta1/tx";
|
|
9
9
|
import { GenericAuthorization as typeGenericAuthorization } from "./types";
|
|
10
10
|
import { Grant as typeGrant } from "./types";
|
|
11
11
|
import { GrantAuthorization as typeGrantAuthorization } from "./types";
|
|
12
12
|
import { GrantQueueItem as typeGrantQueueItem } from "./types";
|
|
13
13
|
import { EventGrant as typeEventGrant } from "./types";
|
|
14
14
|
import { EventRevoke as typeEventRevoke } from "./types";
|
|
15
|
-
export {
|
|
15
|
+
export { MsgRevoke, MsgExec, MsgGrant };
|
|
16
16
|
export const registry = new Registry(msgTypes);
|
|
17
17
|
function getStructure(template) {
|
|
18
18
|
const structure = { fields: [] };
|
|
@@ -28,18 +28,18 @@ const defaultFee = {
|
|
|
28
28
|
};
|
|
29
29
|
export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26657", prefix: "cosmos" }) => {
|
|
30
30
|
return {
|
|
31
|
-
async
|
|
31
|
+
async sendMsgRevoke({ value, fee, memo }) {
|
|
32
32
|
if (!signer) {
|
|
33
|
-
throw new Error('TxClient:
|
|
33
|
+
throw new Error('TxClient:sendMsgRevoke: Unable to sign Tx. Signer is not present.');
|
|
34
34
|
}
|
|
35
35
|
try {
|
|
36
36
|
const { address } = (await signer.getAccounts())[0];
|
|
37
37
|
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
38
|
-
let msg = this.
|
|
38
|
+
let msg = this.msgRevoke({ value: MsgRevoke.fromPartial(value) });
|
|
39
39
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
40
40
|
}
|
|
41
41
|
catch (e) {
|
|
42
|
-
throw new Error('TxClient:
|
|
42
|
+
throw new Error('TxClient:sendMsgRevoke: Could not broadcast Tx: ' + e.message);
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
async sendMsgExec({ value, fee, memo }) {
|
|
@@ -56,26 +56,26 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
56
56
|
throw new Error('TxClient:sendMsgExec: Could not broadcast Tx: ' + e.message);
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
|
-
async
|
|
59
|
+
async sendMsgGrant({ value, fee, memo }) {
|
|
60
60
|
if (!signer) {
|
|
61
|
-
throw new Error('TxClient:
|
|
61
|
+
throw new Error('TxClient:sendMsgGrant: Unable to sign Tx. Signer is not present.');
|
|
62
62
|
}
|
|
63
63
|
try {
|
|
64
64
|
const { address } = (await signer.getAccounts())[0];
|
|
65
65
|
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
66
|
-
let msg = this.
|
|
66
|
+
let msg = this.msgGrant({ value: MsgGrant.fromPartial(value) });
|
|
67
67
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
68
68
|
}
|
|
69
69
|
catch (e) {
|
|
70
|
-
throw new Error('TxClient:
|
|
70
|
+
throw new Error('TxClient:sendMsgGrant: Could not broadcast Tx: ' + e.message);
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
|
|
73
|
+
msgRevoke({ value }) {
|
|
74
74
|
try {
|
|
75
|
-
return { typeUrl: "/cosmos.authz.v1beta1.
|
|
75
|
+
return { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value: MsgRevoke.fromPartial(value) };
|
|
76
76
|
}
|
|
77
77
|
catch (e) {
|
|
78
|
-
throw new Error('TxClient:
|
|
78
|
+
throw new Error('TxClient:MsgRevoke: Could not create message: ' + e.message);
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
msgExec({ value }) {
|
|
@@ -86,12 +86,12 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
86
86
|
throw new Error('TxClient:MsgExec: Could not create message: ' + e.message);
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
|
-
|
|
89
|
+
msgGrant({ value }) {
|
|
90
90
|
try {
|
|
91
|
-
return { typeUrl: "/cosmos.authz.v1beta1.
|
|
91
|
+
return { typeUrl: "/cosmos.authz.v1beta1.MsgGrant", value: MsgGrant.fromPartial(value) };
|
|
92
92
|
}
|
|
93
93
|
catch (e) {
|
|
94
|
-
throw new Error('TxClient:
|
|
94
|
+
throw new Error('TxClient:MsgGrant: Could not create message: ' + e.message);
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
};
|
|
@@ -7,9 +7,9 @@ import { msgTypes } from './registry';
|
|
|
7
7
|
import { IgniteClient } from "../client"
|
|
8
8
|
import { MissingWalletError } from "../helpers"
|
|
9
9
|
import { Api } from "./rest";
|
|
10
|
-
import { MsgGrant } from "./types/cosmos/authz/v1beta1/tx";
|
|
11
|
-
import { MsgExec } from "./types/cosmos/authz/v1beta1/tx";
|
|
12
10
|
import { MsgRevoke } from "./types/cosmos/authz/v1beta1/tx";
|
|
11
|
+
import { MsgExec } from "./types/cosmos/authz/v1beta1/tx";
|
|
12
|
+
import { MsgGrant } from "./types/cosmos/authz/v1beta1/tx";
|
|
13
13
|
|
|
14
14
|
import { GenericAuthorization as typeGenericAuthorization} from "./types"
|
|
15
15
|
import { Grant as typeGrant} from "./types"
|
|
@@ -18,10 +18,10 @@ import { GrantQueueItem as typeGrantQueueItem} from "./types"
|
|
|
18
18
|
import { EventGrant as typeEventGrant} from "./types"
|
|
19
19
|
import { EventRevoke as typeEventRevoke} from "./types"
|
|
20
20
|
|
|
21
|
-
export {
|
|
21
|
+
export { MsgRevoke, MsgExec, MsgGrant };
|
|
22
22
|
|
|
23
|
-
type
|
|
24
|
-
value:
|
|
23
|
+
type sendMsgRevokeParams = {
|
|
24
|
+
value: MsgRevoke,
|
|
25
25
|
fee?: StdFee,
|
|
26
26
|
memo?: string
|
|
27
27
|
};
|
|
@@ -32,23 +32,23 @@ type sendMsgExecParams = {
|
|
|
32
32
|
memo?: string
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
type
|
|
36
|
-
value:
|
|
35
|
+
type sendMsgGrantParams = {
|
|
36
|
+
value: MsgGrant,
|
|
37
37
|
fee?: StdFee,
|
|
38
38
|
memo?: string
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
type
|
|
43
|
-
value:
|
|
42
|
+
type msgRevokeParams = {
|
|
43
|
+
value: MsgRevoke,
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
type msgExecParams = {
|
|
47
47
|
value: MsgExec,
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
type
|
|
51
|
-
value:
|
|
50
|
+
type msgGrantParams = {
|
|
51
|
+
value: MsgGrant,
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
|
|
@@ -81,17 +81,17 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
81
81
|
|
|
82
82
|
return {
|
|
83
83
|
|
|
84
|
-
async
|
|
84
|
+
async sendMsgRevoke({ value, fee, memo }: sendMsgRevokeParams): Promise<DeliverTxResponse> {
|
|
85
85
|
if (!signer) {
|
|
86
|
-
throw new Error('TxClient:
|
|
86
|
+
throw new Error('TxClient:sendMsgRevoke: Unable to sign Tx. Signer is not present.')
|
|
87
87
|
}
|
|
88
88
|
try {
|
|
89
89
|
const { address } = (await signer.getAccounts())[0];
|
|
90
90
|
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
|
|
91
|
-
let msg = this.
|
|
91
|
+
let msg = this.msgRevoke({ value: MsgRevoke.fromPartial(value) })
|
|
92
92
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
|
|
93
93
|
} catch (e: any) {
|
|
94
|
-
throw new Error('TxClient:
|
|
94
|
+
throw new Error('TxClient:sendMsgRevoke: Could not broadcast Tx: '+ e.message)
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
|
|
@@ -109,26 +109,26 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
|
|
112
|
-
async
|
|
112
|
+
async sendMsgGrant({ value, fee, memo }: sendMsgGrantParams): Promise<DeliverTxResponse> {
|
|
113
113
|
if (!signer) {
|
|
114
|
-
throw new Error('TxClient:
|
|
114
|
+
throw new Error('TxClient:sendMsgGrant: Unable to sign Tx. Signer is not present.')
|
|
115
115
|
}
|
|
116
116
|
try {
|
|
117
117
|
const { address } = (await signer.getAccounts())[0];
|
|
118
118
|
const signingClient = await SigningStargateClient.connectWithSigner(addr,signer,{registry, prefix});
|
|
119
|
-
let msg = this.
|
|
119
|
+
let msg = this.msgGrant({ value: MsgGrant.fromPartial(value) })
|
|
120
120
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo)
|
|
121
121
|
} catch (e: any) {
|
|
122
|
-
throw new Error('TxClient:
|
|
122
|
+
throw new Error('TxClient:sendMsgGrant: Could not broadcast Tx: '+ e.message)
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
125
|
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
msgRevoke({ value }: msgRevokeParams): EncodeObject {
|
|
128
128
|
try {
|
|
129
|
-
return { typeUrl: "/cosmos.authz.v1beta1.
|
|
129
|
+
return { typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", value: MsgRevoke.fromPartial( value ) }
|
|
130
130
|
} catch (e: any) {
|
|
131
|
-
throw new Error('TxClient:
|
|
131
|
+
throw new Error('TxClient:MsgRevoke: Could not create message: ' + e.message)
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
|
|
@@ -140,11 +140,11 @@ export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "ht
|
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
msgGrant({ value }: msgGrantParams): EncodeObject {
|
|
144
144
|
try {
|
|
145
|
-
return { typeUrl: "/cosmos.authz.v1beta1.
|
|
145
|
+
return { typeUrl: "/cosmos.authz.v1beta1.MsgGrant", value: MsgGrant.fromPartial( value ) }
|
|
146
146
|
} catch (e: any) {
|
|
147
|
-
throw new Error('TxClient:
|
|
147
|
+
throw new Error('TxClient:MsgGrant: Could not create message: ' + e.message)
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { MsgGrant } from "./types/cosmos/authz/v1beta1/tx";
|
|
2
|
-
import { MsgExec } from "./types/cosmos/authz/v1beta1/tx";
|
|
3
1
|
import { MsgRevoke } from "./types/cosmos/authz/v1beta1/tx";
|
|
2
|
+
import { MsgExec } from "./types/cosmos/authz/v1beta1/tx";
|
|
3
|
+
import { MsgGrant } from "./types/cosmos/authz/v1beta1/tx";
|
|
4
4
|
const msgTypes = [
|
|
5
|
-
["/cosmos.authz.v1beta1.MsgGrant", MsgGrant],
|
|
6
|
-
["/cosmos.authz.v1beta1.MsgExec", MsgExec],
|
|
7
5
|
["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke],
|
|
6
|
+
["/cosmos.authz.v1beta1.MsgExec", MsgExec],
|
|
7
|
+
["/cosmos.authz.v1beta1.MsgGrant", MsgGrant],
|
|
8
8
|
];
|
|
9
9
|
export { msgTypes };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { GeneratedType } from "@cosmjs/proto-signing";
|
|
2
|
-
import { MsgGrant } from "./types/cosmos/authz/v1beta1/tx";
|
|
3
|
-
import { MsgExec } from "./types/cosmos/authz/v1beta1/tx";
|
|
4
2
|
import { MsgRevoke } from "./types/cosmos/authz/v1beta1/tx";
|
|
3
|
+
import { MsgExec } from "./types/cosmos/authz/v1beta1/tx";
|
|
4
|
+
import { MsgGrant } from "./types/cosmos/authz/v1beta1/tx";
|
|
5
5
|
|
|
6
6
|
const msgTypes: Array<[string, GeneratedType]> = [
|
|
7
|
-
["/cosmos.authz.v1beta1.MsgGrant", MsgGrant],
|
|
8
|
-
["/cosmos.authz.v1beta1.MsgExec", MsgExec],
|
|
9
7
|
["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke],
|
|
8
|
+
["/cosmos.authz.v1beta1.MsgExec", MsgExec],
|
|
9
|
+
["/cosmos.authz.v1beta1.MsgGrant", MsgGrant],
|
|
10
10
|
|
|
11
11
|
];
|
|
12
12
|
|
|
@@ -9,6 +9,80 @@
|
|
|
9
9
|
* ---------------------------------------------------------------
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Grant gives permissions to execute
|
|
14
|
+
the provide method with expiration time.
|
|
15
|
+
*/
|
|
16
|
+
export interface Authzv1Beta1Grant {
|
|
17
|
+
/**
|
|
18
|
+
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
19
|
+
* URL that describes the type of the serialized message.
|
|
20
|
+
*
|
|
21
|
+
* Protobuf library provides support to pack/unpack Any values in the form
|
|
22
|
+
* of utility functions or additional generated methods of the Any type.
|
|
23
|
+
* Example 1: Pack and unpack a message in C++.
|
|
24
|
+
* Foo foo = ...;
|
|
25
|
+
* Any any;
|
|
26
|
+
* any.PackFrom(foo);
|
|
27
|
+
* ...
|
|
28
|
+
* if (any.UnpackTo(&foo)) {
|
|
29
|
+
* ...
|
|
30
|
+
* }
|
|
31
|
+
* Example 2: Pack and unpack a message in Java.
|
|
32
|
+
* Any any = Any.pack(foo);
|
|
33
|
+
* if (any.is(Foo.class)) {
|
|
34
|
+
* foo = any.unpack(Foo.class);
|
|
35
|
+
* Example 3: Pack and unpack a message in Python.
|
|
36
|
+
* foo = Foo(...)
|
|
37
|
+
* any = Any()
|
|
38
|
+
* any.Pack(foo)
|
|
39
|
+
* if any.Is(Foo.DESCRIPTOR):
|
|
40
|
+
* any.Unpack(foo)
|
|
41
|
+
* Example 4: Pack and unpack a message in Go
|
|
42
|
+
* foo := &pb.Foo{...}
|
|
43
|
+
* any, err := anypb.New(foo)
|
|
44
|
+
* if err != nil {
|
|
45
|
+
* ...
|
|
46
|
+
* }
|
|
47
|
+
* ...
|
|
48
|
+
* foo := &pb.Foo{}
|
|
49
|
+
* if err := any.UnmarshalTo(foo); err != nil {
|
|
50
|
+
* The pack methods provided by protobuf library will by default use
|
|
51
|
+
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
52
|
+
* methods only use the fully qualified type name after the last '/'
|
|
53
|
+
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
54
|
+
* name "y.z".
|
|
55
|
+
* JSON
|
|
56
|
+
* ====
|
|
57
|
+
* The JSON representation of an `Any` value uses the regular
|
|
58
|
+
* representation of the deserialized, embedded message, with an
|
|
59
|
+
* additional field `@type` which contains the type URL. Example:
|
|
60
|
+
* package google.profile;
|
|
61
|
+
* message Person {
|
|
62
|
+
* string first_name = 1;
|
|
63
|
+
* string last_name = 2;
|
|
64
|
+
* {
|
|
65
|
+
* "@type": "type.googleapis.com/google.profile.Person",
|
|
66
|
+
* "firstName": <string>,
|
|
67
|
+
* "lastName": <string>
|
|
68
|
+
* If the embedded message type is well-known and has a custom JSON
|
|
69
|
+
* representation, that representation will be embedded adding a field
|
|
70
|
+
* `value` which holds the custom JSON in addition to the `@type`
|
|
71
|
+
* field. Example (for message [google.protobuf.Duration][]):
|
|
72
|
+
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
|
73
|
+
* "value": "1.212s"
|
|
74
|
+
*/
|
|
75
|
+
authorization?: ProtobufAny;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* time when the grant will expire and will be pruned. If null, then the grant
|
|
79
|
+
* doesn't have a time expiration (other conditions in `authorization`
|
|
80
|
+
* may apply to invalidate the grant)
|
|
81
|
+
* @format date-time
|
|
82
|
+
*/
|
|
83
|
+
expiration?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
12
86
|
/**
|
|
13
87
|
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
14
88
|
URL that describes the type of the serialized message.
|
|
@@ -130,80 +204,6 @@ export interface RpcStatus {
|
|
|
130
204
|
details?: ProtobufAny[];
|
|
131
205
|
}
|
|
132
206
|
|
|
133
|
-
/**
|
|
134
|
-
* Grant gives permissions to execute
|
|
135
|
-
the provide method with expiration time.
|
|
136
|
-
*/
|
|
137
|
-
export interface V1Beta1Grant {
|
|
138
|
-
/**
|
|
139
|
-
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
140
|
-
* URL that describes the type of the serialized message.
|
|
141
|
-
*
|
|
142
|
-
* Protobuf library provides support to pack/unpack Any values in the form
|
|
143
|
-
* of utility functions or additional generated methods of the Any type.
|
|
144
|
-
* Example 1: Pack and unpack a message in C++.
|
|
145
|
-
* Foo foo = ...;
|
|
146
|
-
* Any any;
|
|
147
|
-
* any.PackFrom(foo);
|
|
148
|
-
* ...
|
|
149
|
-
* if (any.UnpackTo(&foo)) {
|
|
150
|
-
* ...
|
|
151
|
-
* }
|
|
152
|
-
* Example 2: Pack and unpack a message in Java.
|
|
153
|
-
* Any any = Any.pack(foo);
|
|
154
|
-
* if (any.is(Foo.class)) {
|
|
155
|
-
* foo = any.unpack(Foo.class);
|
|
156
|
-
* Example 3: Pack and unpack a message in Python.
|
|
157
|
-
* foo = Foo(...)
|
|
158
|
-
* any = Any()
|
|
159
|
-
* any.Pack(foo)
|
|
160
|
-
* if any.Is(Foo.DESCRIPTOR):
|
|
161
|
-
* any.Unpack(foo)
|
|
162
|
-
* Example 4: Pack and unpack a message in Go
|
|
163
|
-
* foo := &pb.Foo{...}
|
|
164
|
-
* any, err := anypb.New(foo)
|
|
165
|
-
* if err != nil {
|
|
166
|
-
* ...
|
|
167
|
-
* }
|
|
168
|
-
* ...
|
|
169
|
-
* foo := &pb.Foo{}
|
|
170
|
-
* if err := any.UnmarshalTo(foo); err != nil {
|
|
171
|
-
* The pack methods provided by protobuf library will by default use
|
|
172
|
-
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
|
173
|
-
* methods only use the fully qualified type name after the last '/'
|
|
174
|
-
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
|
175
|
-
* name "y.z".
|
|
176
|
-
* JSON
|
|
177
|
-
* ====
|
|
178
|
-
* The JSON representation of an `Any` value uses the regular
|
|
179
|
-
* representation of the deserialized, embedded message, with an
|
|
180
|
-
* additional field `@type` which contains the type URL. Example:
|
|
181
|
-
* package google.profile;
|
|
182
|
-
* message Person {
|
|
183
|
-
* string first_name = 1;
|
|
184
|
-
* string last_name = 2;
|
|
185
|
-
* {
|
|
186
|
-
* "@type": "type.googleapis.com/google.profile.Person",
|
|
187
|
-
* "firstName": <string>,
|
|
188
|
-
* "lastName": <string>
|
|
189
|
-
* If the embedded message type is well-known and has a custom JSON
|
|
190
|
-
* representation, that representation will be embedded adding a field
|
|
191
|
-
* `value` which holds the custom JSON in addition to the `@type`
|
|
192
|
-
* field. Example (for message [google.protobuf.Duration][]):
|
|
193
|
-
* "@type": "type.googleapis.com/google.protobuf.Duration",
|
|
194
|
-
* "value": "1.212s"
|
|
195
|
-
*/
|
|
196
|
-
authorization?: ProtobufAny;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* time when the grant will expire and will be pruned. If null, then the grant
|
|
200
|
-
* doesn't have a time expiration (other conditions in `authorization`
|
|
201
|
-
* may apply to invalidate the grant)
|
|
202
|
-
* @format date-time
|
|
203
|
-
*/
|
|
204
|
-
expiration?: string;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
207
|
export interface V1Beta1GrantAuthorization {
|
|
208
208
|
granter?: string;
|
|
209
209
|
grantee?: string;
|
|
@@ -388,7 +388,7 @@ export interface V1Beta1QueryGranterGrantsResponse {
|
|
|
388
388
|
*/
|
|
389
389
|
export interface V1Beta1QueryGrantsResponse {
|
|
390
390
|
/** authorizations is a list of grants granted for grantee by granter. */
|
|
391
|
-
grants?:
|
|
391
|
+
grants?: Authzv1Beta1Grant[];
|
|
392
392
|
|
|
393
393
|
/** pagination defines an pagination for the response. */
|
|
394
394
|
pagination?: V1Beta1PageResponse;
|
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
* ---------------------------------------------------------------
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Params defines the parameters for the bank module.
|
|
14
|
+
*/
|
|
15
|
+
export interface Bankv1Beta1Params {
|
|
16
|
+
send_enabled?: V1Beta1SendEnabled[];
|
|
17
|
+
default_send_enabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
export interface ProtobufAny {
|
|
13
21
|
"@type"?: string;
|
|
14
22
|
}
|
|
@@ -215,14 +223,6 @@ export interface V1Beta1PageResponse {
|
|
|
215
223
|
total?: string;
|
|
216
224
|
}
|
|
217
225
|
|
|
218
|
-
/**
|
|
219
|
-
* Params defines the parameters for the bank module.
|
|
220
|
-
*/
|
|
221
|
-
export interface V1Beta1Params {
|
|
222
|
-
send_enabled?: V1Beta1SendEnabled[];
|
|
223
|
-
default_send_enabled?: boolean;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
226
|
/**
|
|
227
227
|
* QueryAllBalancesResponse is the response type for the Query/AllBalances RPC
|
|
228
228
|
method.
|
|
@@ -281,7 +281,7 @@ export interface V1Beta1QueryDenomsMetadataResponse {
|
|
|
281
281
|
*/
|
|
282
282
|
export interface V1Beta1QueryParamsResponse {
|
|
283
283
|
/** Params defines the parameters for the bank module. */
|
|
284
|
-
params?:
|
|
284
|
+
params?: Bankv1Beta1Params;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
/**
|
|
@@ -3,10 +3,10 @@ import { SigningStargateClient } from "@cosmjs/stargate";
|
|
|
3
3
|
import { Registry } from "@cosmjs/proto-signing";
|
|
4
4
|
import { msgTypes } from './registry';
|
|
5
5
|
import { Api } from "./rest";
|
|
6
|
-
import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx";
|
|
7
6
|
import { MsgWithdrawDelegatorReward } from "./types/cosmos/distribution/v1beta1/tx";
|
|
8
|
-
import {
|
|
7
|
+
import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx";
|
|
9
8
|
import { MsgFundCommunityPool } from "./types/cosmos/distribution/v1beta1/tx";
|
|
9
|
+
import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx";
|
|
10
10
|
import { Params as typeParams } from "./types";
|
|
11
11
|
import { ValidatorHistoricalRewards as typeValidatorHistoricalRewards } from "./types";
|
|
12
12
|
import { ValidatorCurrentRewards as typeValidatorCurrentRewards } from "./types";
|
|
@@ -26,7 +26,7 @@ import { ValidatorHistoricalRewardsRecord as typeValidatorHistoricalRewardsRecor
|
|
|
26
26
|
import { ValidatorCurrentRewardsRecord as typeValidatorCurrentRewardsRecord } from "./types";
|
|
27
27
|
import { DelegatorStartingInfoRecord as typeDelegatorStartingInfoRecord } from "./types";
|
|
28
28
|
import { ValidatorSlashEventRecord as typeValidatorSlashEventRecord } from "./types";
|
|
29
|
-
export { MsgWithdrawValidatorCommission,
|
|
29
|
+
export { MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool, MsgSetWithdrawAddress };
|
|
30
30
|
export const registry = new Registry(msgTypes);
|
|
31
31
|
function getStructure(template) {
|
|
32
32
|
const structure = { fields: [] };
|
|
@@ -42,20 +42,6 @@ const defaultFee = {
|
|
|
42
42
|
};
|
|
43
43
|
export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26657", prefix: "cosmos" }) => {
|
|
44
44
|
return {
|
|
45
|
-
async sendMsgWithdrawValidatorCommission({ value, fee, memo }) {
|
|
46
|
-
if (!signer) {
|
|
47
|
-
throw new Error('TxClient:sendMsgWithdrawValidatorCommission: Unable to sign Tx. Signer is not present.');
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
const { address } = (await signer.getAccounts())[0];
|
|
51
|
-
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
52
|
-
let msg = this.msgWithdrawValidatorCommission({ value: MsgWithdrawValidatorCommission.fromPartial(value) });
|
|
53
|
-
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
throw new Error('TxClient:sendMsgWithdrawValidatorCommission: Could not broadcast Tx: ' + e.message);
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
45
|
async sendMsgWithdrawDelegatorReward({ value, fee, memo }) {
|
|
60
46
|
if (!signer) {
|
|
61
47
|
throw new Error('TxClient:sendMsgWithdrawDelegatorReward: Unable to sign Tx. Signer is not present.');
|
|
@@ -70,18 +56,18 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
70
56
|
throw new Error('TxClient:sendMsgWithdrawDelegatorReward: Could not broadcast Tx: ' + e.message);
|
|
71
57
|
}
|
|
72
58
|
},
|
|
73
|
-
async
|
|
59
|
+
async sendMsgWithdrawValidatorCommission({ value, fee, memo }) {
|
|
74
60
|
if (!signer) {
|
|
75
|
-
throw new Error('TxClient:
|
|
61
|
+
throw new Error('TxClient:sendMsgWithdrawValidatorCommission: Unable to sign Tx. Signer is not present.');
|
|
76
62
|
}
|
|
77
63
|
try {
|
|
78
64
|
const { address } = (await signer.getAccounts())[0];
|
|
79
65
|
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
80
|
-
let msg = this.
|
|
66
|
+
let msg = this.msgWithdrawValidatorCommission({ value: MsgWithdrawValidatorCommission.fromPartial(value) });
|
|
81
67
|
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
82
68
|
}
|
|
83
69
|
catch (e) {
|
|
84
|
-
throw new Error('TxClient:
|
|
70
|
+
throw new Error('TxClient:sendMsgWithdrawValidatorCommission: Could not broadcast Tx: ' + e.message);
|
|
85
71
|
}
|
|
86
72
|
},
|
|
87
73
|
async sendMsgFundCommunityPool({ value, fee, memo }) {
|
|
@@ -98,12 +84,18 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
98
84
|
throw new Error('TxClient:sendMsgFundCommunityPool: Could not broadcast Tx: ' + e.message);
|
|
99
85
|
}
|
|
100
86
|
},
|
|
101
|
-
|
|
87
|
+
async sendMsgSetWithdrawAddress({ value, fee, memo }) {
|
|
88
|
+
if (!signer) {
|
|
89
|
+
throw new Error('TxClient:sendMsgSetWithdrawAddress: Unable to sign Tx. Signer is not present.');
|
|
90
|
+
}
|
|
102
91
|
try {
|
|
103
|
-
|
|
92
|
+
const { address } = (await signer.getAccounts())[0];
|
|
93
|
+
const signingClient = await SigningStargateClient.connectWithSigner(addr, signer, { registry, prefix });
|
|
94
|
+
let msg = this.msgSetWithdrawAddress({ value: MsgSetWithdrawAddress.fromPartial(value) });
|
|
95
|
+
return await signingClient.signAndBroadcast(address, [msg], fee ? fee : defaultFee, memo);
|
|
104
96
|
}
|
|
105
97
|
catch (e) {
|
|
106
|
-
throw new Error('TxClient:
|
|
98
|
+
throw new Error('TxClient:sendMsgSetWithdrawAddress: Could not broadcast Tx: ' + e.message);
|
|
107
99
|
}
|
|
108
100
|
},
|
|
109
101
|
msgWithdrawDelegatorReward({ value }) {
|
|
@@ -114,12 +106,12 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
114
106
|
throw new Error('TxClient:MsgWithdrawDelegatorReward: Could not create message: ' + e.message);
|
|
115
107
|
}
|
|
116
108
|
},
|
|
117
|
-
|
|
109
|
+
msgWithdrawValidatorCommission({ value }) {
|
|
118
110
|
try {
|
|
119
|
-
return { typeUrl: "/cosmos.distribution.v1beta1.
|
|
111
|
+
return { typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: MsgWithdrawValidatorCommission.fromPartial(value) };
|
|
120
112
|
}
|
|
121
113
|
catch (e) {
|
|
122
|
-
throw new Error('TxClient:
|
|
114
|
+
throw new Error('TxClient:MsgWithdrawValidatorCommission: Could not create message: ' + e.message);
|
|
123
115
|
}
|
|
124
116
|
},
|
|
125
117
|
msgFundCommunityPool({ value }) {
|
|
@@ -130,6 +122,14 @@ export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26
|
|
|
130
122
|
throw new Error('TxClient:MsgFundCommunityPool: Could not create message: ' + e.message);
|
|
131
123
|
}
|
|
132
124
|
},
|
|
125
|
+
msgSetWithdrawAddress({ value }) {
|
|
126
|
+
try {
|
|
127
|
+
return { typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: MsgSetWithdrawAddress.fromPartial(value) };
|
|
128
|
+
}
|
|
129
|
+
catch (e) {
|
|
130
|
+
throw new Error('TxClient:MsgSetWithdrawAddress: Could not create message: ' + e.message);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
133
|
};
|
|
134
134
|
};
|
|
135
135
|
export const queryClient = ({ addr: addr } = { addr: "http://localhost:1317" }) => {
|