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
|
@@ -2,32 +2,35 @@
|
|
|
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
|
|
|
11
|
-
import { Minter as typeMinter} from "./types"
|
|
12
|
-
import { Params as typeParams} from "./types"
|
|
13
|
-
|
|
14
|
-
export { };
|
|
15
|
-
|
|
16
|
+
import { Minter as typeMinter } from "./types";
|
|
17
|
+
import { Params as typeParams } from "./types";
|
|
16
18
|
|
|
19
|
+
export {};
|
|
17
20
|
|
|
18
21
|
export const registry = new Registry(msgTypes);
|
|
19
22
|
|
|
20
23
|
type Field = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
+
name: string;
|
|
25
|
+
type: unknown;
|
|
26
|
+
};
|
|
24
27
|
function getStructure(template) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const structure: { fields: Field[] } = { fields: [] };
|
|
29
|
+
for (let [key, value] of Object.entries(template)) {
|
|
30
|
+
let field = { name: key, type: typeof value };
|
|
31
|
+
structure.fields.push(field);
|
|
32
|
+
}
|
|
33
|
+
return structure;
|
|
31
34
|
}
|
|
32
35
|
const defaultFee = {
|
|
33
36
|
amount: [],
|
|
@@ -35,66 +38,67 @@ const defaultFee = {
|
|
|
35
38
|
};
|
|
36
39
|
|
|
37
40
|
interface TxClientOptions {
|
|
38
|
-
addr: string
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
addr: string;
|
|
42
|
+
prefix: string;
|
|
43
|
+
signer?: OfflineSigner;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
|
-
export const txClient = (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
export const txClient = (
|
|
47
|
+
{ signer, prefix, addr }: TxClientOptions = {
|
|
48
|
+
addr: "http://localhost:26657",
|
|
49
|
+
prefix: "cosmos",
|
|
50
|
+
},
|
|
51
|
+
) => {
|
|
52
|
+
return {};
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
interface QueryClientOptions {
|
|
52
|
-
addr: string
|
|
56
|
+
addr: string;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
export const queryClient = (
|
|
59
|
+
export const queryClient = (
|
|
60
|
+
{ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" },
|
|
61
|
+
) => {
|
|
56
62
|
return new Api({ baseURL: addr });
|
|
57
63
|
};
|
|
58
64
|
|
|
59
65
|
class SDKModule {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
public query: ReturnType<typeof queryClient>;
|
|
67
|
+
public tx: ReturnType<typeof txClient>;
|
|
68
|
+
public structure: Record<string, unknown>;
|
|
69
|
+
public registry: Array<[string, GeneratedType]> = [];
|
|
64
70
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
updateTX(client: IgniteClient) {
|
|
71
|
+
constructor(client: IgniteClient) {
|
|
72
|
+
this.query = queryClient({ addr: client.env.apiURL });
|
|
73
|
+
this.updateTX(client);
|
|
74
|
+
this.structure = {
|
|
75
|
+
Minter: getStructure(typeMinter.fromPartial({})),
|
|
76
|
+
Params: getStructure(typeParams.fromPartial({})),
|
|
77
|
+
};
|
|
78
|
+
client.on("signer-changed", (signer) => {
|
|
79
|
+
this.updateTX(client);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
updateTX(client: IgniteClient) {
|
|
79
83
|
const methods = txClient({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
})
|
|
84
|
-
|
|
84
|
+
signer: client.signer,
|
|
85
|
+
addr: client.env.rpcURL,
|
|
86
|
+
prefix: client.env.prefix ?? "cosmos",
|
|
87
|
+
});
|
|
88
|
+
|
|
85
89
|
this.tx = methods;
|
|
86
90
|
for (let m in methods) {
|
|
87
|
-
|
|
91
|
+
this.tx[m] = methods[m].bind(this.tx);
|
|
88
92
|
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const Module = (test: IgniteClient) => {
|
|
93
|
-
return {
|
|
94
|
-
module: {
|
|
95
|
-
CosmosMintV1Beta1: new SDKModule(test)
|
|
96
|
-
},
|
|
97
|
-
registry: msgTypes
|
|
98
93
|
}
|
|
99
94
|
}
|
|
100
|
-
|
|
95
|
+
|
|
96
|
+
const Module = (test: IgniteClient) => {
|
|
97
|
+
return {
|
|
98
|
+
module: {
|
|
99
|
+
CosmosMintV1Beta1: new SDKModule(test),
|
|
100
|
+
},
|
|
101
|
+
registry: msgTypes,
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
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 { EventSend as typeEventSend } from "./types";
|
|
6
6
|
import { EventMint as typeEventMint } from "./types";
|
|
@@ -21,7 +21,10 @@ const defaultFee = {
|
|
|
21
21
|
amount: [],
|
|
22
22
|
gas: "200000",
|
|
23
23
|
};
|
|
24
|
-
export const txClient = ({ signer, prefix, addr } = {
|
|
24
|
+
export const txClient = ({ signer, prefix, addr } = {
|
|
25
|
+
addr: "http://localhost:26657",
|
|
26
|
+
prefix: "cosmos",
|
|
27
|
+
}) => {
|
|
25
28
|
return {};
|
|
26
29
|
};
|
|
27
30
|
export const queryClient = ({ addr: addr } = { addr: "http://localhost:1317" }) => {
|
|
@@ -40,7 +43,7 @@ class SDKModule {
|
|
|
40
43
|
Class: getStructure(typeClass.fromPartial({})),
|
|
41
44
|
NFT: getStructure(typeNFT.fromPartial({})),
|
|
42
45
|
};
|
|
43
|
-
client.on(
|
|
46
|
+
client.on("signer-changed", (signer) => {
|
|
44
47
|
this.updateTX(client);
|
|
45
48
|
});
|
|
46
49
|
}
|
|
@@ -56,13 +59,12 @@ class SDKModule {
|
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
|
-
;
|
|
60
62
|
const Module = (test) => {
|
|
61
63
|
return {
|
|
62
64
|
module: {
|
|
63
|
-
CosmosNftV1Beta1: new SDKModule(test)
|
|
65
|
+
CosmosNftV1Beta1: new SDKModule(test),
|
|
64
66
|
},
|
|
65
|
-
registry: msgTypes
|
|
67
|
+
registry: msgTypes,
|
|
66
68
|
};
|
|
67
69
|
};
|
|
68
70
|
export default Module;
|
|
@@ -2,36 +2,39 @@
|
|
|
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
|
|
|
11
|
-
import { EventSend as typeEventSend} from "./types"
|
|
12
|
-
import { EventMint as typeEventMint} from "./types"
|
|
13
|
-
import { EventBurn as typeEventBurn} from "./types"
|
|
14
|
-
import { Entry as typeEntry} from "./types"
|
|
15
|
-
import { Class as typeClass} from "./types"
|
|
16
|
-
import { NFT as typeNFT} from "./types"
|
|
17
|
-
|
|
18
|
-
export { };
|
|
19
|
-
|
|
16
|
+
import { EventSend as typeEventSend } from "./types";
|
|
17
|
+
import { EventMint as typeEventMint } from "./types";
|
|
18
|
+
import { EventBurn as typeEventBurn } from "./types";
|
|
19
|
+
import { Entry as typeEntry } from "./types";
|
|
20
|
+
import { Class as typeClass } from "./types";
|
|
21
|
+
import { NFT as typeNFT } from "./types";
|
|
20
22
|
|
|
23
|
+
export {};
|
|
21
24
|
|
|
22
25
|
export const registry = new Registry(msgTypes);
|
|
23
26
|
|
|
24
27
|
type Field = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
+
name: string;
|
|
29
|
+
type: unknown;
|
|
30
|
+
};
|
|
28
31
|
function getStructure(template) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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;
|
|
35
38
|
}
|
|
36
39
|
const defaultFee = {
|
|
37
40
|
amount: [],
|
|
@@ -39,70 +42,71 @@ const defaultFee = {
|
|
|
39
42
|
};
|
|
40
43
|
|
|
41
44
|
interface TxClientOptions {
|
|
42
|
-
addr: string
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
addr: string;
|
|
46
|
+
prefix: string;
|
|
47
|
+
signer?: OfflineSigner;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
export const txClient = (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
export const txClient = (
|
|
51
|
+
{ signer, prefix, addr }: TxClientOptions = {
|
|
52
|
+
addr: "http://localhost:26657",
|
|
53
|
+
prefix: "cosmos",
|
|
54
|
+
},
|
|
55
|
+
) => {
|
|
56
|
+
return {};
|
|
53
57
|
};
|
|
54
58
|
|
|
55
59
|
interface QueryClientOptions {
|
|
56
|
-
addr: string
|
|
60
|
+
addr: string;
|
|
57
61
|
}
|
|
58
62
|
|
|
59
|
-
export const queryClient = (
|
|
63
|
+
export const queryClient = (
|
|
64
|
+
{ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" },
|
|
65
|
+
) => {
|
|
60
66
|
return new Api({ baseURL: addr });
|
|
61
67
|
};
|
|
62
68
|
|
|
63
69
|
class SDKModule {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
public query: ReturnType<typeof queryClient>;
|
|
71
|
+
public tx: ReturnType<typeof txClient>;
|
|
72
|
+
public structure: Record<string, unknown>;
|
|
73
|
+
public registry: Array<[string, GeneratedType]> = [];
|
|
68
74
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
updateTX(client: IgniteClient) {
|
|
75
|
+
constructor(client: IgniteClient) {
|
|
76
|
+
this.query = queryClient({ addr: client.env.apiURL });
|
|
77
|
+
this.updateTX(client);
|
|
78
|
+
this.structure = {
|
|
79
|
+
EventSend: getStructure(typeEventSend.fromPartial({})),
|
|
80
|
+
EventMint: getStructure(typeEventMint.fromPartial({})),
|
|
81
|
+
EventBurn: getStructure(typeEventBurn.fromPartial({})),
|
|
82
|
+
Entry: getStructure(typeEntry.fromPartial({})),
|
|
83
|
+
Class: getStructure(typeClass.fromPartial({})),
|
|
84
|
+
NFT: getStructure(typeNFT.fromPartial({})),
|
|
85
|
+
};
|
|
86
|
+
client.on("signer-changed", (signer) => {
|
|
87
|
+
this.updateTX(client);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
updateTX(client: IgniteClient) {
|
|
87
91
|
const methods = txClient({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})
|
|
92
|
-
|
|
92
|
+
signer: client.signer,
|
|
93
|
+
addr: client.env.rpcURL,
|
|
94
|
+
prefix: client.env.prefix ?? "cosmos",
|
|
95
|
+
});
|
|
96
|
+
|
|
93
97
|
this.tx = methods;
|
|
94
98
|
for (let m in methods) {
|
|
95
|
-
|
|
99
|
+
this.tx[m] = methods[m].bind(this.tx);
|
|
96
100
|
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const Module = (test: IgniteClient) => {
|
|
101
|
-
return {
|
|
102
|
-
module: {
|
|
103
|
-
CosmosNftV1Beta1: new SDKModule(test)
|
|
104
|
-
},
|
|
105
|
-
registry: msgTypes
|
|
106
101
|
}
|
|
107
102
|
}
|
|
108
|
-
|
|
103
|
+
|
|
104
|
+
const Module = (test: IgniteClient) => {
|
|
105
|
+
return {
|
|
106
|
+
module: {
|
|
107
|
+
CosmosNftV1Beta1: new SDKModule(test),
|
|
108
|
+
},
|
|
109
|
+
registry: msgTypes,
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
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 { Tx as typeTx } from "./types";
|
|
6
6
|
import { TxRaw as typeTxRaw } from "./types";
|
|
@@ -28,7 +28,10 @@ const defaultFee = {
|
|
|
28
28
|
amount: [],
|
|
29
29
|
gas: "200000",
|
|
30
30
|
};
|
|
31
|
-
export const txClient = ({ signer, prefix, addr } = {
|
|
31
|
+
export const txClient = ({ signer, prefix, addr } = {
|
|
32
|
+
addr: "http://localhost:26657",
|
|
33
|
+
prefix: "cosmos",
|
|
34
|
+
}) => {
|
|
32
35
|
return {};
|
|
33
36
|
};
|
|
34
37
|
export const queryClient = ({ addr: addr } = { addr: "http://localhost:1317" }) => {
|
|
@@ -54,7 +57,7 @@ class SDKModule {
|
|
|
54
57
|
Tip: getStructure(typeTip.fromPartial({})),
|
|
55
58
|
AuxSignerData: getStructure(typeAuxSignerData.fromPartial({})),
|
|
56
59
|
};
|
|
57
|
-
client.on(
|
|
60
|
+
client.on("signer-changed", (signer) => {
|
|
58
61
|
this.updateTX(client);
|
|
59
62
|
});
|
|
60
63
|
}
|
|
@@ -70,13 +73,12 @@ class SDKModule {
|
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
|
-
;
|
|
74
76
|
const Module = (test) => {
|
|
75
77
|
return {
|
|
76
78
|
module: {
|
|
77
|
-
CosmosTxV1Beta1: new SDKModule(test)
|
|
79
|
+
CosmosTxV1Beta1: new SDKModule(test),
|
|
78
80
|
},
|
|
79
|
-
registry: msgTypes
|
|
81
|
+
registry: msgTypes,
|
|
80
82
|
};
|
|
81
83
|
};
|
|
82
84
|
export default Module;
|
|
@@ -2,43 +2,46 @@
|
|
|
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
|
|
|
11
|
-
import { Tx as typeTx} from "./types"
|
|
12
|
-
import { TxRaw as typeTxRaw} from "./types"
|
|
13
|
-
import { SignDoc as typeSignDoc} from "./types"
|
|
14
|
-
import { SignDocDirectAux as typeSignDocDirectAux} from "./types"
|
|
15
|
-
import { TxBody as typeTxBody} from "./types"
|
|
16
|
-
import { AuthInfo as typeAuthInfo} from "./types"
|
|
17
|
-
import { SignerInfo as typeSignerInfo} from "./types"
|
|
18
|
-
import { ModeInfo as typeModeInfo} from "./types"
|
|
19
|
-
import { ModeInfo_Single as typeModeInfo_Single} from "./types"
|
|
20
|
-
import { ModeInfo_Multi as typeModeInfo_Multi} from "./types"
|
|
21
|
-
import { Fee as typeFee} from "./types"
|
|
22
|
-
import { Tip as typeTip} from "./types"
|
|
23
|
-
import { AuxSignerData as typeAuxSignerData} from "./types"
|
|
24
|
-
|
|
25
|
-
export { };
|
|
26
|
-
|
|
16
|
+
import { Tx as typeTx } from "./types";
|
|
17
|
+
import { TxRaw as typeTxRaw } from "./types";
|
|
18
|
+
import { SignDoc as typeSignDoc } from "./types";
|
|
19
|
+
import { SignDocDirectAux as typeSignDocDirectAux } from "./types";
|
|
20
|
+
import { TxBody as typeTxBody } from "./types";
|
|
21
|
+
import { AuthInfo as typeAuthInfo } from "./types";
|
|
22
|
+
import { SignerInfo as typeSignerInfo } from "./types";
|
|
23
|
+
import { ModeInfo as typeModeInfo } from "./types";
|
|
24
|
+
import { ModeInfo_Single as typeModeInfo_Single } from "./types";
|
|
25
|
+
import { ModeInfo_Multi as typeModeInfo_Multi } from "./types";
|
|
26
|
+
import { Fee as typeFee } from "./types";
|
|
27
|
+
import { Tip as typeTip } from "./types";
|
|
28
|
+
import { AuxSignerData as typeAuxSignerData } from "./types";
|
|
27
29
|
|
|
30
|
+
export {};
|
|
28
31
|
|
|
29
32
|
export const registry = new Registry(msgTypes);
|
|
30
33
|
|
|
31
34
|
type Field = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
+
name: string;
|
|
36
|
+
type: unknown;
|
|
37
|
+
};
|
|
35
38
|
function getStructure(template) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const structure: { fields: Field[] } = { fields: [] };
|
|
40
|
+
for (let [key, value] of Object.entries(template)) {
|
|
41
|
+
let field = { name: key, type: typeof value };
|
|
42
|
+
structure.fields.push(field);
|
|
43
|
+
}
|
|
44
|
+
return structure;
|
|
42
45
|
}
|
|
43
46
|
const defaultFee = {
|
|
44
47
|
amount: [],
|
|
@@ -46,77 +49,78 @@ const defaultFee = {
|
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
interface TxClientOptions {
|
|
49
|
-
addr: string
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
addr: string;
|
|
53
|
+
prefix: string;
|
|
54
|
+
signer?: OfflineSigner;
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
export const txClient = (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
export const txClient = (
|
|
58
|
+
{ signer, prefix, addr }: TxClientOptions = {
|
|
59
|
+
addr: "http://localhost:26657",
|
|
60
|
+
prefix: "cosmos",
|
|
61
|
+
},
|
|
62
|
+
) => {
|
|
63
|
+
return {};
|
|
60
64
|
};
|
|
61
65
|
|
|
62
66
|
interface QueryClientOptions {
|
|
63
|
-
addr: string
|
|
67
|
+
addr: string;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
export const queryClient = (
|
|
70
|
+
export const queryClient = (
|
|
71
|
+
{ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" },
|
|
72
|
+
) => {
|
|
67
73
|
return new Api({ baseURL: addr });
|
|
68
74
|
};
|
|
69
75
|
|
|
70
76
|
class SDKModule {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
public query: ReturnType<typeof queryClient>;
|
|
78
|
+
public tx: ReturnType<typeof txClient>;
|
|
79
|
+
public structure: Record<string, unknown>;
|
|
80
|
+
public registry: Array<[string, GeneratedType]> = [];
|
|
75
81
|
|
|
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
|
-
updateTX(client: IgniteClient) {
|
|
82
|
+
constructor(client: IgniteClient) {
|
|
83
|
+
this.query = queryClient({ addr: client.env.apiURL });
|
|
84
|
+
this.updateTX(client);
|
|
85
|
+
this.structure = {
|
|
86
|
+
Tx: getStructure(typeTx.fromPartial({})),
|
|
87
|
+
TxRaw: getStructure(typeTxRaw.fromPartial({})),
|
|
88
|
+
SignDoc: getStructure(typeSignDoc.fromPartial({})),
|
|
89
|
+
SignDocDirectAux: getStructure(typeSignDocDirectAux.fromPartial({})),
|
|
90
|
+
TxBody: getStructure(typeTxBody.fromPartial({})),
|
|
91
|
+
AuthInfo: getStructure(typeAuthInfo.fromPartial({})),
|
|
92
|
+
SignerInfo: getStructure(typeSignerInfo.fromPartial({})),
|
|
93
|
+
ModeInfo: getStructure(typeModeInfo.fromPartial({})),
|
|
94
|
+
ModeInfo_Single: getStructure(typeModeInfo_Single.fromPartial({})),
|
|
95
|
+
ModeInfo_Multi: getStructure(typeModeInfo_Multi.fromPartial({})),
|
|
96
|
+
Fee: getStructure(typeFee.fromPartial({})),
|
|
97
|
+
Tip: getStructure(typeTip.fromPartial({})),
|
|
98
|
+
AuxSignerData: getStructure(typeAuxSignerData.fromPartial({})),
|
|
99
|
+
};
|
|
100
|
+
client.on("signer-changed", (signer) => {
|
|
101
|
+
this.updateTX(client);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
updateTX(client: IgniteClient) {
|
|
101
105
|
const methods = txClient({
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
})
|
|
106
|
-
|
|
106
|
+
signer: client.signer,
|
|
107
|
+
addr: client.env.rpcURL,
|
|
108
|
+
prefix: client.env.prefix ?? "cosmos",
|
|
109
|
+
});
|
|
110
|
+
|
|
107
111
|
this.tx = methods;
|
|
108
112
|
for (let m in methods) {
|
|
109
|
-
|
|
113
|
+
this.tx[m] = methods[m].bind(this.tx);
|
|
110
114
|
}
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const Module = (test: IgniteClient) => {
|
|
115
|
-
return {
|
|
116
|
-
module: {
|
|
117
|
-
CosmosTxV1Beta1: new SDKModule(test)
|
|
118
|
-
},
|
|
119
|
-
registry: msgTypes
|
|
120
115
|
}
|
|
121
116
|
}
|
|
122
|
-
|
|
117
|
+
|
|
118
|
+
const Module = (test: IgniteClient) => {
|
|
119
|
+
return {
|
|
120
|
+
module: {
|
|
121
|
+
CosmosTxV1Beta1: new SDKModule(test),
|
|
122
|
+
},
|
|
123
|
+
registry: msgTypes,
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export default Module;
|