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,114 +1,112 @@
|
|
|
1
1
|
// Generated by Ignite ignite.com/cli
|
|
2
2
|
|
|
3
|
-
import {StdFee} from "@cosmjs/amino";
|
|
4
|
-
import {SigningStargateClient, DeliverTxResponse} from "@cosmjs/stargate";
|
|
5
|
-
import {EncodeObject, GeneratedType, OfflineSigner, Registry} from "@cosmjs/proto-signing";
|
|
6
|
-
import {msgTypes} from './registry';
|
|
7
|
-
import {IgniteClient} from "../client"
|
|
8
|
-
import {MissingWalletError} from "../helpers"
|
|
9
|
-
import {Api} from "./rest";
|
|
3
|
+
import { StdFee } from "@cosmjs/amino";
|
|
4
|
+
import { SigningStargateClient, DeliverTxResponse } from "@cosmjs/stargate";
|
|
5
|
+
import { EncodeObject, GeneratedType, OfflineSigner, Registry } from "@cosmjs/proto-signing";
|
|
6
|
+
import { msgTypes } from './registry';
|
|
7
|
+
import { IgniteClient } from "../client"
|
|
8
|
+
import { MissingWalletError } from "../helpers"
|
|
9
|
+
import { Api } from "./rest";
|
|
10
10
|
|
|
11
|
-
import {Channel as typeChannel} from "./types"
|
|
12
|
-
import {IdentifiedChannel as typeIdentifiedChannel} from "./types"
|
|
13
|
-
import {Counterparty as typeCounterparty} from "./types"
|
|
14
|
-
import {Packet as typePacket} from "./types"
|
|
15
|
-
import {PacketState as typePacketState} from "./types"
|
|
16
|
-
import {PacketId as typePacketId} from "./types"
|
|
17
|
-
import {Acknowledgement as typeAcknowledgement} from "./types"
|
|
18
|
-
import {PacketSequence as typePacketSequence} from "./types"
|
|
11
|
+
import { Channel as typeChannel} from "./types"
|
|
12
|
+
import { IdentifiedChannel as typeIdentifiedChannel} from "./types"
|
|
13
|
+
import { Counterparty as typeCounterparty} from "./types"
|
|
14
|
+
import { Packet as typePacket} from "./types"
|
|
15
|
+
import { PacketState as typePacketState} from "./types"
|
|
16
|
+
import { PacketId as typePacketId} from "./types"
|
|
17
|
+
import { Acknowledgement as typeAcknowledgement} from "./types"
|
|
18
|
+
import { PacketSequence as typePacketSequence} from "./types"
|
|
19
|
+
|
|
20
|
+
export { };
|
|
19
21
|
|
|
20
|
-
export {};
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
export const registry = new Registry(msgTypes);
|
|
24
25
|
|
|
25
26
|
type Field = {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
name: string;
|
|
28
|
+
type: unknown;
|
|
28
29
|
}
|
|
29
|
-
|
|
30
30
|
function getStructure(template) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
const structure: {fields: Field[]} = { fields: [] }
|
|
32
|
+
for (let [key, value] of Object.entries(template)) {
|
|
33
|
+
let field = { name: key, type: typeof value }
|
|
34
|
+
structure.fields.push(field)
|
|
35
|
+
}
|
|
36
|
+
return structure
|
|
37
37
|
}
|
|
38
|
-
|
|
39
38
|
const defaultFee = {
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
amount: [],
|
|
40
|
+
gas: "200000",
|
|
42
41
|
};
|
|
43
42
|
|
|
44
43
|
interface TxClientOptions {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
addr: string
|
|
45
|
+
prefix: string
|
|
46
|
+
signer?: OfflineSigner
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
export const txClient = ({signer, prefix, addr}: TxClientOptions = {
|
|
51
|
-
addr: "http://localhost:26657",
|
|
52
|
-
prefix: "cosmos"
|
|
53
|
-
}) => {
|
|
49
|
+
export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "http://localhost:26657", prefix: "cosmos" }) => {
|
|
54
50
|
|
|
55
|
-
|
|
51
|
+
return {
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
}
|
|
56
55
|
};
|
|
57
56
|
|
|
58
57
|
interface QueryClientOptions {
|
|
59
|
-
|
|
58
|
+
addr: string
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
export const queryClient = ({addr: addr}: QueryClientOptions = {addr: "http://localhost:1317"}) => {
|
|
63
|
-
|
|
61
|
+
export const queryClient = ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => {
|
|
62
|
+
return new Api({ baseURL: addr });
|
|
64
63
|
};
|
|
65
64
|
|
|
66
65
|
class SDKModule {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.tx[m] = methods[m].bind(this.tx);
|
|
102
|
-
}
|
|
66
|
+
public query: ReturnType<typeof queryClient>;
|
|
67
|
+
public tx: ReturnType<typeof txClient>;
|
|
68
|
+
public structure: Record<string,unknown>;
|
|
69
|
+
public registry: Array<[string, GeneratedType]> = [];
|
|
70
|
+
|
|
71
|
+
constructor(client: IgniteClient) {
|
|
72
|
+
|
|
73
|
+
this.query = queryClient({ addr: client.env.apiURL });
|
|
74
|
+
this.updateTX(client);
|
|
75
|
+
this.structure = {
|
|
76
|
+
Channel: getStructure(typeChannel.fromPartial({})),
|
|
77
|
+
IdentifiedChannel: getStructure(typeIdentifiedChannel.fromPartial({})),
|
|
78
|
+
Counterparty: getStructure(typeCounterparty.fromPartial({})),
|
|
79
|
+
Packet: getStructure(typePacket.fromPartial({})),
|
|
80
|
+
PacketState: getStructure(typePacketState.fromPartial({})),
|
|
81
|
+
PacketId: getStructure(typePacketId.fromPartial({})),
|
|
82
|
+
Acknowledgement: getStructure(typeAcknowledgement.fromPartial({})),
|
|
83
|
+
PacketSequence: getStructure(typePacketSequence.fromPartial({})),
|
|
84
|
+
|
|
85
|
+
};
|
|
86
|
+
client.on('signer-changed',(signer) => {
|
|
87
|
+
this.updateTX(client);
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
updateTX(client: IgniteClient) {
|
|
91
|
+
const methods = txClient({
|
|
92
|
+
signer: client.signer,
|
|
93
|
+
addr: client.env.rpcURL,
|
|
94
|
+
prefix: client.env.prefix ?? "cosmos",
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
this.tx = methods;
|
|
98
|
+
for (let m in methods) {
|
|
99
|
+
this.tx[m] = methods[m].bind(this.tx);
|
|
103
100
|
}
|
|
101
|
+
}
|
|
104
102
|
};
|
|
105
103
|
|
|
106
104
|
const Module = (test: IgniteClient) => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
105
|
+
return {
|
|
106
|
+
module: {
|
|
107
|
+
IbcCoreChannelV1: new SDKModule(test)
|
|
108
|
+
},
|
|
109
|
+
registry: msgTypes
|
|
110
|
+
}
|
|
113
111
|
}
|
|
114
112
|
export default Module;
|
|
@@ -24,10 +24,7 @@ const defaultFee = {
|
|
|
24
24
|
amount: [],
|
|
25
25
|
gas: "200000",
|
|
26
26
|
};
|
|
27
|
-
export const txClient = ({ signer, prefix, addr } = {
|
|
28
|
-
addr: "http://localhost:26657",
|
|
29
|
-
prefix: "cosmos"
|
|
30
|
-
}) => {
|
|
27
|
+
export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26657", prefix: "cosmos" }) => {
|
|
31
28
|
return {};
|
|
32
29
|
};
|
|
33
30
|
export const queryClient = ({ addr: addr } = { addr: "http://localhost:1317" }) => {
|
|
@@ -1,116 +1,114 @@
|
|
|
1
1
|
// Generated by Ignite ignite.com/cli
|
|
2
2
|
|
|
3
|
-
import {StdFee} from "@cosmjs/amino";
|
|
4
|
-
import {SigningStargateClient, DeliverTxResponse} from "@cosmjs/stargate";
|
|
5
|
-
import {EncodeObject, GeneratedType, OfflineSigner, Registry} from "@cosmjs/proto-signing";
|
|
6
|
-
import {msgTypes} from './registry';
|
|
7
|
-
import {IgniteClient} from "../client"
|
|
8
|
-
import {MissingWalletError} from "../helpers"
|
|
9
|
-
import {Api} from "./rest";
|
|
3
|
+
import { StdFee } from "@cosmjs/amino";
|
|
4
|
+
import { SigningStargateClient, DeliverTxResponse } from "@cosmjs/stargate";
|
|
5
|
+
import { EncodeObject, GeneratedType, OfflineSigner, Registry } from "@cosmjs/proto-signing";
|
|
6
|
+
import { msgTypes } from './registry';
|
|
7
|
+
import { IgniteClient } from "../client"
|
|
8
|
+
import { MissingWalletError } from "../helpers"
|
|
9
|
+
import { Api } from "./rest";
|
|
10
10
|
|
|
11
|
-
import {IdentifiedClientState as typeIdentifiedClientState} from "./types"
|
|
12
|
-
import {ConsensusStateWithHeight as typeConsensusStateWithHeight} from "./types"
|
|
13
|
-
import {ClientConsensusStates as typeClientConsensusStates} from "./types"
|
|
14
|
-
import {ClientUpdateProposal as typeClientUpdateProposal} from "./types"
|
|
15
|
-
import {UpgradeProposal as typeUpgradeProposal} from "./types"
|
|
16
|
-
import {Height as typeHeight} from "./types"
|
|
17
|
-
import {Params as typeParams} from "./types"
|
|
18
|
-
import {GenesisMetadata as typeGenesisMetadata} from "./types"
|
|
19
|
-
import {IdentifiedGenesisMetadata as typeIdentifiedGenesisMetadata} from "./types"
|
|
11
|
+
import { IdentifiedClientState as typeIdentifiedClientState} from "./types"
|
|
12
|
+
import { ConsensusStateWithHeight as typeConsensusStateWithHeight} from "./types"
|
|
13
|
+
import { ClientConsensusStates as typeClientConsensusStates} from "./types"
|
|
14
|
+
import { ClientUpdateProposal as typeClientUpdateProposal} from "./types"
|
|
15
|
+
import { UpgradeProposal as typeUpgradeProposal} from "./types"
|
|
16
|
+
import { Height as typeHeight} from "./types"
|
|
17
|
+
import { Params as typeParams} from "./types"
|
|
18
|
+
import { GenesisMetadata as typeGenesisMetadata} from "./types"
|
|
19
|
+
import { IdentifiedGenesisMetadata as typeIdentifiedGenesisMetadata} from "./types"
|
|
20
|
+
|
|
21
|
+
export { };
|
|
20
22
|
|
|
21
|
-
export {};
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
export const registry = new Registry(msgTypes);
|
|
25
26
|
|
|
26
27
|
type Field = {
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
name: string;
|
|
29
|
+
type: unknown;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
31
|
function getStructure(template) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
const structure: {fields: Field[]} = { fields: [] }
|
|
33
|
+
for (let [key, value] of Object.entries(template)) {
|
|
34
|
+
let field = { name: key, type: typeof value }
|
|
35
|
+
structure.fields.push(field)
|
|
36
|
+
}
|
|
37
|
+
return structure
|
|
38
38
|
}
|
|
39
|
-
|
|
40
39
|
const defaultFee = {
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
amount: [],
|
|
41
|
+
gas: "200000",
|
|
43
42
|
};
|
|
44
43
|
|
|
45
44
|
interface TxClientOptions {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
addr: string
|
|
46
|
+
prefix: string
|
|
47
|
+
signer?: OfflineSigner
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
export const txClient = ({signer, prefix, addr}: TxClientOptions = {
|
|
52
|
-
addr: "http://localhost:26657",
|
|
53
|
-
prefix: "cosmos"
|
|
54
|
-
}) => {
|
|
50
|
+
export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "http://localhost:26657", prefix: "cosmos" }) => {
|
|
55
51
|
|
|
56
|
-
|
|
52
|
+
return {
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
}
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
interface QueryClientOptions {
|
|
60
|
-
|
|
59
|
+
addr: string
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
export const queryClient = ({addr: addr}: QueryClientOptions = {addr: "http://localhost:1317"}) => {
|
|
64
|
-
|
|
62
|
+
export const queryClient = ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => {
|
|
63
|
+
return new Api({ baseURL: addr });
|
|
65
64
|
};
|
|
66
65
|
|
|
67
66
|
class SDKModule {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this.tx[m] = methods[m].bind(this.tx);
|
|
104
|
-
}
|
|
67
|
+
public query: ReturnType<typeof queryClient>;
|
|
68
|
+
public tx: ReturnType<typeof txClient>;
|
|
69
|
+
public structure: Record<string,unknown>;
|
|
70
|
+
public registry: Array<[string, GeneratedType]> = [];
|
|
71
|
+
|
|
72
|
+
constructor(client: IgniteClient) {
|
|
73
|
+
|
|
74
|
+
this.query = queryClient({ addr: client.env.apiURL });
|
|
75
|
+
this.updateTX(client);
|
|
76
|
+
this.structure = {
|
|
77
|
+
IdentifiedClientState: getStructure(typeIdentifiedClientState.fromPartial({})),
|
|
78
|
+
ConsensusStateWithHeight: getStructure(typeConsensusStateWithHeight.fromPartial({})),
|
|
79
|
+
ClientConsensusStates: getStructure(typeClientConsensusStates.fromPartial({})),
|
|
80
|
+
ClientUpdateProposal: getStructure(typeClientUpdateProposal.fromPartial({})),
|
|
81
|
+
UpgradeProposal: getStructure(typeUpgradeProposal.fromPartial({})),
|
|
82
|
+
Height: getStructure(typeHeight.fromPartial({})),
|
|
83
|
+
Params: getStructure(typeParams.fromPartial({})),
|
|
84
|
+
GenesisMetadata: getStructure(typeGenesisMetadata.fromPartial({})),
|
|
85
|
+
IdentifiedGenesisMetadata: getStructure(typeIdentifiedGenesisMetadata.fromPartial({})),
|
|
86
|
+
|
|
87
|
+
};
|
|
88
|
+
client.on('signer-changed',(signer) => {
|
|
89
|
+
this.updateTX(client);
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
updateTX(client: IgniteClient) {
|
|
93
|
+
const methods = txClient({
|
|
94
|
+
signer: client.signer,
|
|
95
|
+
addr: client.env.rpcURL,
|
|
96
|
+
prefix: client.env.prefix ?? "cosmos",
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
this.tx = methods;
|
|
100
|
+
for (let m in methods) {
|
|
101
|
+
this.tx[m] = methods[m].bind(this.tx);
|
|
105
102
|
}
|
|
103
|
+
}
|
|
106
104
|
};
|
|
107
105
|
|
|
108
106
|
const Module = (test: IgniteClient) => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
return {
|
|
108
|
+
module: {
|
|
109
|
+
IbcCoreClientV1: new SDKModule(test)
|
|
110
|
+
},
|
|
111
|
+
registry: msgTypes
|
|
112
|
+
}
|
|
115
113
|
}
|
|
116
114
|
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 { ConnectionEnd as typeConnectionEnd } from "./types";
|
|
6
6
|
import { IdentifiedConnection as typeIdentifiedConnection } from "./types";
|
|
@@ -24,7 +24,7 @@ const defaultFee = {
|
|
|
24
24
|
};
|
|
25
25
|
export const txClient = ({ signer, prefix, addr } = {
|
|
26
26
|
addr: "http://localhost:26657",
|
|
27
|
-
prefix: "cosmos"
|
|
27
|
+
prefix: "cosmos",
|
|
28
28
|
}) => {
|
|
29
29
|
return {};
|
|
30
30
|
};
|
|
@@ -45,7 +45,7 @@ class SDKModule {
|
|
|
45
45
|
Version: getStructure(typeVersion.fromPartial({})),
|
|
46
46
|
Params: getStructure(typeParams.fromPartial({})),
|
|
47
47
|
};
|
|
48
|
-
client.on(
|
|
48
|
+
client.on("signer-changed", (signer) => {
|
|
49
49
|
this.updateTX(client);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -61,13 +61,12 @@ class SDKModule {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
;
|
|
65
64
|
const Module = (test) => {
|
|
66
65
|
return {
|
|
67
66
|
module: {
|
|
68
|
-
IbcCoreConnectionV1: new SDKModule(test)
|
|
67
|
+
IbcCoreConnectionV1: new SDKModule(test),
|
|
69
68
|
},
|
|
70
|
-
registry: msgTypes
|
|
69
|
+
registry: msgTypes,
|
|
71
70
|
};
|
|
72
71
|
};
|
|
73
72
|
export default Module;
|
|
@@ -1,112 +1,116 @@
|
|
|
1
1
|
// Generated by Ignite ignite.com/cli
|
|
2
2
|
|
|
3
|
-
import {StdFee} from "@cosmjs/amino";
|
|
4
|
-
import {SigningStargateClient, DeliverTxResponse} from "@cosmjs/stargate";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
3
|
+
import { StdFee } from "@cosmjs/amino";
|
|
4
|
+
import { SigningStargateClient, DeliverTxResponse } from "@cosmjs/stargate";
|
|
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";
|
|
14
|
+
import { Api } from "./rest";
|
|
15
|
+
|
|
16
|
+
import { ConnectionEnd as typeConnectionEnd } from "./types";
|
|
17
|
+
import { IdentifiedConnection as typeIdentifiedConnection } from "./types";
|
|
18
|
+
import { Counterparty as typeCounterparty } from "./types";
|
|
19
|
+
import { ClientPaths as typeClientPaths } from "./types";
|
|
20
|
+
import { ConnectionPaths as typeConnectionPaths } from "./types";
|
|
21
|
+
import { Version as typeVersion } from "./types";
|
|
22
|
+
import { Params as typeParams } from "./types";
|
|
18
23
|
|
|
19
24
|
export {};
|
|
20
25
|
|
|
21
|
-
|
|
22
26
|
export const registry = new Registry(msgTypes);
|
|
23
27
|
|
|
24
28
|
type Field = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
+
name: string;
|
|
30
|
+
type: unknown;
|
|
31
|
+
};
|
|
29
32
|
function getStructure(template) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const structure: { fields: Field[] } = { fields: [] };
|
|
34
|
+
for (let [key, value] of Object.entries(template)) {
|
|
35
|
+
let field = { name: key, type: typeof value };
|
|
36
|
+
structure.fields.push(field);
|
|
37
|
+
}
|
|
38
|
+
return structure;
|
|
36
39
|
}
|
|
37
|
-
|
|
38
40
|
const defaultFee = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
amount: [],
|
|
42
|
+
gas: "200000",
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
interface TxClientOptions {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
addr: string;
|
|
47
|
+
prefix: string;
|
|
48
|
+
signer?: OfflineSigner;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
export const txClient = (
|
|
51
|
+
export const txClient = (
|
|
52
|
+
{ signer, prefix, addr }: TxClientOptions = {
|
|
50
53
|
addr: "http://localhost:26657",
|
|
51
|
-
prefix: "cosmos"
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
prefix: "cosmos",
|
|
55
|
+
},
|
|
56
|
+
) => {
|
|
57
|
+
return {};
|
|
55
58
|
};
|
|
56
59
|
|
|
57
60
|
interface QueryClientOptions {
|
|
58
|
-
|
|
61
|
+
addr: string;
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
export const queryClient = (
|
|
62
|
-
|
|
64
|
+
export const queryClient = (
|
|
65
|
+
{ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" },
|
|
66
|
+
) => {
|
|
67
|
+
return new Api({ baseURL: addr });
|
|
63
68
|
};
|
|
64
69
|
|
|
65
70
|
class SDKModule {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
public query: ReturnType<typeof queryClient>;
|
|
72
|
+
public tx: ReturnType<typeof txClient>;
|
|
73
|
+
public structure: Record<string, unknown>;
|
|
74
|
+
public registry: Array<[string, GeneratedType]> = [];
|
|
75
|
+
|
|
76
|
+
constructor(client: IgniteClient) {
|
|
77
|
+
this.query = queryClient({ addr: client.env.apiURL });
|
|
78
|
+
this.updateTX(client);
|
|
79
|
+
this.structure = {
|
|
80
|
+
ConnectionEnd: getStructure(typeConnectionEnd.fromPartial({})),
|
|
81
|
+
IdentifiedConnection: getStructure(
|
|
82
|
+
typeIdentifiedConnection.fromPartial({}),
|
|
83
|
+
),
|
|
84
|
+
Counterparty: getStructure(typeCounterparty.fromPartial({})),
|
|
85
|
+
ClientPaths: getStructure(typeClientPaths.fromPartial({})),
|
|
86
|
+
ConnectionPaths: getStructure(typeConnectionPaths.fromPartial({})),
|
|
87
|
+
Version: getStructure(typeVersion.fromPartial({})),
|
|
88
|
+
Params: getStructure(typeParams.fromPartial({})),
|
|
89
|
+
};
|
|
90
|
+
client.on("signer-changed", (signer) => {
|
|
91
|
+
this.updateTX(client);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
updateTX(client: IgniteClient) {
|
|
95
|
+
const methods = txClient({
|
|
96
|
+
signer: client.signer,
|
|
97
|
+
addr: client.env.rpcURL,
|
|
98
|
+
prefix: client.env.prefix ?? "cosmos",
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
this.tx = methods;
|
|
102
|
+
for (let m in methods) {
|
|
103
|
+
this.tx[m] = methods[m].bind(this.tx);
|
|
88
104
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const methods = txClient({
|
|
92
|
-
signer: client.signer,
|
|
93
|
-
addr: client.env.rpcURL,
|
|
94
|
-
prefix: client.env.prefix ?? "cosmos",
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
this.tx = methods;
|
|
98
|
-
for (let m in methods) {
|
|
99
|
-
this.tx[m] = methods[m].bind(this.tx);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
103
107
|
|
|
104
108
|
const Module = (test: IgniteClient) => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
export default Module;
|
|
109
|
+
return {
|
|
110
|
+
module: {
|
|
111
|
+
IbcCoreConnectionV1: new SDKModule(test),
|
|
112
|
+
},
|
|
113
|
+
registry: msgTypes,
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export default Module;
|