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.
Files changed (56) hide show
  1. package/DecentralCardGame.cardchain.cardchain/module.js +428 -460
  2. package/DecentralCardGame.cardchain.cardchain/module.ts +1496 -1571
  3. package/DecentralCardGame.cardchain.cardchain/registry.js +74 -66
  4. package/DecentralCardGame.cardchain.cardchain/registry.ts +74 -66
  5. package/DecentralCardGame.cardchain.cardchain/rest.js +71 -0
  6. package/DecentralCardGame.cardchain.cardchain/rest.ts +132 -0
  7. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.js +6 -0
  8. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/card.ts +6 -0
  9. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/early_access_proposal.js +81 -0
  10. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/early_access_proposal.ts +106 -0
  11. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/encounters.js +295 -0
  12. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/encounters.ts +354 -0
  13. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/genesis.js +16 -0
  14. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/genesis.ts +19 -1
  15. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.js +447 -0
  16. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/query.ts +570 -0
  17. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/tx.js +504 -0
  18. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/tx.ts +613 -0
  19. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/user.js +50 -0
  20. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/user.ts +48 -0
  21. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/zealy.js +58 -0
  22. package/DecentralCardGame.cardchain.cardchain/types/cardchain/cardchain/zealy.ts +82 -0
  23. package/DecentralCardGame.cardchain.cardchain/types.js +5 -1
  24. package/DecentralCardGame.cardchain.cardchain/types.ts +8 -0
  25. package/DecentralCardGame.cardchain.featureflag/module.js +9 -7
  26. package/DecentralCardGame.cardchain.featureflag/module.ts +69 -65
  27. package/client.js +2 -5
  28. package/client.ts +164 -162
  29. package/cosmos.authz.v1beta1/module.js +33 -22
  30. package/cosmos.authz.v1beta1/module.ts +220 -148
  31. package/cosmos.distribution.v1beta1/module.js +65 -35
  32. package/cosmos.distribution.v1beta1/module.ts +354 -200
  33. package/cosmos.evidence.v1beta1/module.js +21 -13
  34. package/cosmos.evidence.v1beta1/module.ts +115 -86
  35. package/cosmos.gov.v1/module.js +48 -29
  36. package/cosmos.gov.v1/module.ts +275 -178
  37. package/cosmos.mint.v1beta1/module.js +9 -7
  38. package/cosmos.mint.v1beta1/module.ts +67 -63
  39. package/cosmos.nft.v1beta1/module.js +9 -7
  40. package/cosmos.nft.v1beta1/module.ts +75 -71
  41. package/cosmos.tx.v1beta1/module.js +9 -7
  42. package/cosmos.tx.v1beta1/module.ts +89 -85
  43. package/cosmos.vesting.v1beta1/module.js +52 -29
  44. package/cosmos.vesting.v1beta1/module.ts +249 -149
  45. package/ibc.applications.interchain_accounts.controller.v1/module.js +9 -7
  46. package/ibc.applications.interchain_accounts.controller.v1/module.ts +65 -61
  47. package/ibc.applications.transfer.v1/module.js +17 -12
  48. package/ibc.applications.transfer.v1/module.ts +114 -88
  49. package/ibc.core.channel.v1/module.js +1 -4
  50. package/ibc.core.channel.v1/module.ts +79 -81
  51. package/ibc.core.client.v1/module.js +1 -4
  52. package/ibc.core.client.v1/module.ts +81 -83
  53. package/ibc.core.connection.v1/module.js +6 -7
  54. package/ibc.core.connection.v1/module.ts +88 -84
  55. package/package.json +4 -1
  56. package/tsconfig.json +1 -1
@@ -110,6 +110,8 @@ function createBaseUser() {
110
110
  votableCards: [],
111
111
  votedCards: [],
112
112
  earlyAccess: undefined,
113
+ OpenEncounters: [],
114
+ WonEncounters: [],
113
115
  };
114
116
  }
115
117
  export const User = {
@@ -166,6 +168,16 @@ export const User = {
166
168
  if (message.earlyAccess !== undefined) {
167
169
  EarlyAccess.encode(message.earlyAccess, writer.uint32(122).fork()).ldelim();
168
170
  }
171
+ writer.uint32(130).fork();
172
+ for (const v of message.OpenEncounters) {
173
+ writer.uint64(v);
174
+ }
175
+ writer.ldelim();
176
+ writer.uint32(138).fork();
177
+ for (const v of message.WonEncounters) {
178
+ writer.uint64(v);
179
+ }
180
+ writer.ldelim();
169
181
  return writer;
170
182
  },
171
183
  decode(input, length) {
@@ -257,6 +269,28 @@ export const User = {
257
269
  case 15:
258
270
  message.earlyAccess = EarlyAccess.decode(reader, reader.uint32());
259
271
  break;
272
+ case 16:
273
+ if ((tag & 7) === 2) {
274
+ const end2 = reader.uint32() + reader.pos;
275
+ while (reader.pos < end2) {
276
+ message.OpenEncounters.push(longToNumber(reader.uint64()));
277
+ }
278
+ }
279
+ else {
280
+ message.OpenEncounters.push(longToNumber(reader.uint64()));
281
+ }
282
+ break;
283
+ case 17:
284
+ if ((tag & 7) === 2) {
285
+ const end2 = reader.uint32() + reader.pos;
286
+ while (reader.pos < end2) {
287
+ message.WonEncounters.push(longToNumber(reader.uint64()));
288
+ }
289
+ }
290
+ else {
291
+ message.WonEncounters.push(longToNumber(reader.uint64()));
292
+ }
293
+ break;
260
294
  default:
261
295
  reader.skipType(tag & 7);
262
296
  break;
@@ -284,6 +318,8 @@ export const User = {
284
318
  votableCards: Array.isArray(object?.votableCards) ? object.votableCards.map((e) => Number(e)) : [],
285
319
  votedCards: Array.isArray(object?.votedCards) ? object.votedCards.map((e) => Number(e)) : [],
286
320
  earlyAccess: isSet(object.earlyAccess) ? EarlyAccess.fromJSON(object.earlyAccess) : undefined,
321
+ OpenEncounters: Array.isArray(object?.OpenEncounters) ? object.OpenEncounters.map((e) => Number(e)) : [],
322
+ WonEncounters: Array.isArray(object?.WonEncounters) ? object.WonEncounters.map((e) => Number(e)) : [],
287
323
  };
288
324
  },
289
325
  toJSON(message) {
@@ -333,6 +369,18 @@ export const User = {
333
369
  }
334
370
  message.earlyAccess !== undefined
335
371
  && (obj.earlyAccess = message.earlyAccess ? EarlyAccess.toJSON(message.earlyAccess) : undefined);
372
+ if (message.OpenEncounters) {
373
+ obj.OpenEncounters = message.OpenEncounters.map((e) => Math.round(e));
374
+ }
375
+ else {
376
+ obj.OpenEncounters = [];
377
+ }
378
+ if (message.WonEncounters) {
379
+ obj.WonEncounters = message.WonEncounters.map((e) => Math.round(e));
380
+ }
381
+ else {
382
+ obj.WonEncounters = [];
383
+ }
336
384
  return obj;
337
385
  },
338
386
  fromPartial(object) {
@@ -355,6 +403,8 @@ export const User = {
355
403
  message.earlyAccess = (object.earlyAccess !== undefined && object.earlyAccess !== null)
356
404
  ? EarlyAccess.fromPartial(object.earlyAccess)
357
405
  : undefined;
406
+ message.OpenEncounters = object.OpenEncounters?.map((e) => e) || [];
407
+ message.WonEncounters = object.WonEncounters?.map((e) => e) || [];
358
408
  return message;
359
409
  },
360
410
  };
@@ -115,6 +115,8 @@ export interface User {
115
115
  votableCards: number[];
116
116
  votedCards: number[];
117
117
  earlyAccess: EarlyAccess | undefined;
118
+ OpenEncounters: number[];
119
+ WonEncounters: number[];
118
120
  }
119
121
 
120
122
  export interface EarlyAccess {
@@ -156,6 +158,8 @@ function createBaseUser(): User {
156
158
  votableCards: [],
157
159
  votedCards: [],
158
160
  earlyAccess: undefined,
161
+ OpenEncounters: [],
162
+ WonEncounters: [],
159
163
  };
160
164
  }
161
165
 
@@ -213,6 +217,16 @@ export const User = {
213
217
  if (message.earlyAccess !== undefined) {
214
218
  EarlyAccess.encode(message.earlyAccess, writer.uint32(122).fork()).ldelim();
215
219
  }
220
+ writer.uint32(130).fork();
221
+ for (const v of message.OpenEncounters) {
222
+ writer.uint64(v);
223
+ }
224
+ writer.ldelim();
225
+ writer.uint32(138).fork();
226
+ for (const v of message.WonEncounters) {
227
+ writer.uint64(v);
228
+ }
229
+ writer.ldelim();
216
230
  return writer;
217
231
  },
218
232
 
@@ -300,6 +314,26 @@ export const User = {
300
314
  case 15:
301
315
  message.earlyAccess = EarlyAccess.decode(reader, reader.uint32());
302
316
  break;
317
+ case 16:
318
+ if ((tag & 7) === 2) {
319
+ const end2 = reader.uint32() + reader.pos;
320
+ while (reader.pos < end2) {
321
+ message.OpenEncounters.push(longToNumber(reader.uint64() as Long));
322
+ }
323
+ } else {
324
+ message.OpenEncounters.push(longToNumber(reader.uint64() as Long));
325
+ }
326
+ break;
327
+ case 17:
328
+ if ((tag & 7) === 2) {
329
+ const end2 = reader.uint32() + reader.pos;
330
+ while (reader.pos < end2) {
331
+ message.WonEncounters.push(longToNumber(reader.uint64() as Long));
332
+ }
333
+ } else {
334
+ message.WonEncounters.push(longToNumber(reader.uint64() as Long));
335
+ }
336
+ break;
303
337
  default:
304
338
  reader.skipType(tag & 7);
305
339
  break;
@@ -328,6 +362,8 @@ export const User = {
328
362
  votableCards: Array.isArray(object?.votableCards) ? object.votableCards.map((e: any) => Number(e)) : [],
329
363
  votedCards: Array.isArray(object?.votedCards) ? object.votedCards.map((e: any) => Number(e)) : [],
330
364
  earlyAccess: isSet(object.earlyAccess) ? EarlyAccess.fromJSON(object.earlyAccess) : undefined,
365
+ OpenEncounters: Array.isArray(object?.OpenEncounters) ? object.OpenEncounters.map((e: any) => Number(e)) : [],
366
+ WonEncounters: Array.isArray(object?.WonEncounters) ? object.WonEncounters.map((e: any) => Number(e)) : [],
331
367
  };
332
368
  },
333
369
 
@@ -372,6 +408,16 @@ export const User = {
372
408
  }
373
409
  message.earlyAccess !== undefined
374
410
  && (obj.earlyAccess = message.earlyAccess ? EarlyAccess.toJSON(message.earlyAccess) : undefined);
411
+ if (message.OpenEncounters) {
412
+ obj.OpenEncounters = message.OpenEncounters.map((e) => Math.round(e));
413
+ } else {
414
+ obj.OpenEncounters = [];
415
+ }
416
+ if (message.WonEncounters) {
417
+ obj.WonEncounters = message.WonEncounters.map((e) => Math.round(e));
418
+ } else {
419
+ obj.WonEncounters = [];
420
+ }
375
421
  return obj;
376
422
  },
377
423
 
@@ -395,6 +441,8 @@ export const User = {
395
441
  message.earlyAccess = (object.earlyAccess !== undefined && object.earlyAccess !== null)
396
442
  ? EarlyAccess.fromPartial(object.earlyAccess)
397
443
  : undefined;
444
+ message.OpenEncounters = object.OpenEncounters?.map((e) => e) || [];
445
+ message.WonEncounters = object.WonEncounters?.map((e) => e) || [];
398
446
  return message;
399
447
  },
400
448
  };
@@ -0,0 +1,58 @@
1
+ /* eslint-disable */
2
+ import _m0 from "protobufjs/minimal";
3
+ export const protobufPackage = "DecentralCardGame.cardchain.cardchain";
4
+ function createBaseZealy() {
5
+ return { address: "", zealyId: "" };
6
+ }
7
+ export const Zealy = {
8
+ encode(message, writer = _m0.Writer.create()) {
9
+ if (message.address !== "") {
10
+ writer.uint32(10).string(message.address);
11
+ }
12
+ if (message.zealyId !== "") {
13
+ writer.uint32(18).string(message.zealyId);
14
+ }
15
+ return writer;
16
+ },
17
+ decode(input, length) {
18
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
19
+ let end = length === undefined ? reader.len : reader.pos + length;
20
+ const message = createBaseZealy();
21
+ while (reader.pos < end) {
22
+ const tag = reader.uint32();
23
+ switch (tag >>> 3) {
24
+ case 1:
25
+ message.address = reader.string();
26
+ break;
27
+ case 2:
28
+ message.zealyId = reader.string();
29
+ break;
30
+ default:
31
+ reader.skipType(tag & 7);
32
+ break;
33
+ }
34
+ }
35
+ return message;
36
+ },
37
+ fromJSON(object) {
38
+ return {
39
+ address: isSet(object.address) ? String(object.address) : "",
40
+ zealyId: isSet(object.zealyId) ? String(object.zealyId) : "",
41
+ };
42
+ },
43
+ toJSON(message) {
44
+ const obj = {};
45
+ message.address !== undefined && (obj.address = message.address);
46
+ message.zealyId !== undefined && (obj.zealyId = message.zealyId);
47
+ return obj;
48
+ },
49
+ fromPartial(object) {
50
+ const message = createBaseZealy();
51
+ message.address = object.address ?? "";
52
+ message.zealyId = object.zealyId ?? "";
53
+ return message;
54
+ },
55
+ };
56
+ function isSet(value) {
57
+ return value !== null && value !== undefined;
58
+ }
@@ -0,0 +1,82 @@
1
+ /* eslint-disable */
2
+ import _m0 from "protobufjs/minimal";
3
+
4
+ export const protobufPackage = "DecentralCardGame.cardchain.cardchain";
5
+
6
+ export interface Zealy {
7
+ address: string;
8
+ zealyId: string;
9
+ }
10
+
11
+ function createBaseZealy(): Zealy {
12
+ return { address: "", zealyId: "" };
13
+ }
14
+
15
+ export const Zealy = {
16
+ encode(message: Zealy, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
17
+ if (message.address !== "") {
18
+ writer.uint32(10).string(message.address);
19
+ }
20
+ if (message.zealyId !== "") {
21
+ writer.uint32(18).string(message.zealyId);
22
+ }
23
+ return writer;
24
+ },
25
+
26
+ decode(input: _m0.Reader | Uint8Array, length?: number): Zealy {
27
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
28
+ let end = length === undefined ? reader.len : reader.pos + length;
29
+ const message = createBaseZealy();
30
+ while (reader.pos < end) {
31
+ const tag = reader.uint32();
32
+ switch (tag >>> 3) {
33
+ case 1:
34
+ message.address = reader.string();
35
+ break;
36
+ case 2:
37
+ message.zealyId = reader.string();
38
+ break;
39
+ default:
40
+ reader.skipType(tag & 7);
41
+ break;
42
+ }
43
+ }
44
+ return message;
45
+ },
46
+
47
+ fromJSON(object: any): Zealy {
48
+ return {
49
+ address: isSet(object.address) ? String(object.address) : "",
50
+ zealyId: isSet(object.zealyId) ? String(object.zealyId) : "",
51
+ };
52
+ },
53
+
54
+ toJSON(message: Zealy): unknown {
55
+ const obj: any = {};
56
+ message.address !== undefined && (obj.address = message.address);
57
+ message.zealyId !== undefined && (obj.zealyId = message.zealyId);
58
+ return obj;
59
+ },
60
+
61
+ fromPartial<I extends Exact<DeepPartial<Zealy>, I>>(object: I): Zealy {
62
+ const message = createBaseZealy();
63
+ message.address = object.address ?? "";
64
+ message.zealyId = object.zealyId ?? "";
65
+ return message;
66
+ },
67
+ };
68
+
69
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
70
+
71
+ export type DeepPartial<T> = T extends Builtin ? T
72
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
73
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
74
+ : Partial<T>;
75
+
76
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
77
+ export type Exact<P, I extends P> = P extends Builtin ? P
78
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
79
+
80
+ function isSet(value: any): boolean {
81
+ return value !== null && value !== undefined;
82
+ }
@@ -3,6 +3,9 @@ import { TimeStamp } from "./types/cardchain/cardchain/card";
3
3
  import { CopyrightProposal } from "./types/cardchain/cardchain/copyright_proposal";
4
4
  import { WrapClearResponse } from "./types/cardchain/cardchain/council";
5
5
  import { WrapHashResponse } from "./types/cardchain/cardchain/council";
6
+ import { EarlyAccessProposal } from "./types/cardchain/cardchain/early_access_proposal";
7
+ import { Encounter } from "./types/cardchain/cardchain/encounters";
8
+ import { EncounterWithImage } from "./types/cardchain/cardchain/encounters";
6
9
  import { Image } from "./types/cardchain/cardchain/image";
7
10
  import { MatchPlayer } from "./types/cardchain/cardchain/match";
8
11
  import { MatchReporterProposal } from "./types/cardchain/cardchain/match_reporter_proposal";
@@ -22,4 +25,5 @@ import { AirDrops } from "./types/cardchain/cardchain/user";
22
25
  import { VotingResults } from "./types/cardchain/cardchain/voting";
23
26
  import { VotingResult } from "./types/cardchain/cardchain/voting";
24
27
  import { SingleVote } from "./types/cardchain/cardchain/voting";
25
- export { Card, TimeStamp, CopyrightProposal, WrapClearResponse, WrapHashResponse, Image, MatchPlayer, MatchReporterProposal, Num, Params, IgnoreMatches, IgnoreSellOffers, QueryQServerResponse, RunningAverage, Set, InnerRarities, AddrWithQuantity, SetProposal, EarlyAccess, BoosterPack, AirDrops, VotingResults, VotingResult, SingleVote, };
28
+ import { Zealy } from "./types/cardchain/cardchain/zealy";
29
+ export { Card, TimeStamp, CopyrightProposal, WrapClearResponse, WrapHashResponse, EarlyAccessProposal, Encounter, EncounterWithImage, Image, MatchPlayer, MatchReporterProposal, Num, Params, IgnoreMatches, IgnoreSellOffers, QueryQServerResponse, RunningAverage, Set, InnerRarities, AddrWithQuantity, SetProposal, EarlyAccess, BoosterPack, AirDrops, VotingResults, VotingResult, SingleVote, Zealy, };
@@ -3,6 +3,9 @@ import { TimeStamp } from "./types/cardchain/cardchain/card"
3
3
  import { CopyrightProposal } from "./types/cardchain/cardchain/copyright_proposal"
4
4
  import { WrapClearResponse } from "./types/cardchain/cardchain/council"
5
5
  import { WrapHashResponse } from "./types/cardchain/cardchain/council"
6
+ import { EarlyAccessProposal } from "./types/cardchain/cardchain/early_access_proposal"
7
+ import { Encounter } from "./types/cardchain/cardchain/encounters"
8
+ import { EncounterWithImage } from "./types/cardchain/cardchain/encounters"
6
9
  import { Image } from "./types/cardchain/cardchain/image"
7
10
  import { MatchPlayer } from "./types/cardchain/cardchain/match"
8
11
  import { MatchReporterProposal } from "./types/cardchain/cardchain/match_reporter_proposal"
@@ -22,6 +25,7 @@ import { AirDrops } from "./types/cardchain/cardchain/user"
22
25
  import { VotingResults } from "./types/cardchain/cardchain/voting"
23
26
  import { VotingResult } from "./types/cardchain/cardchain/voting"
24
27
  import { SingleVote } from "./types/cardchain/cardchain/voting"
28
+ import { Zealy } from "./types/cardchain/cardchain/zealy"
25
29
 
26
30
 
27
31
  export {
@@ -30,6 +34,9 @@ export {
30
34
  CopyrightProposal,
31
35
  WrapClearResponse,
32
36
  WrapHashResponse,
37
+ EarlyAccessProposal,
38
+ Encounter,
39
+ EncounterWithImage,
33
40
  Image,
34
41
  MatchPlayer,
35
42
  MatchReporterProposal,
@@ -49,5 +56,6 @@ export {
49
56
  VotingResults,
50
57
  VotingResult,
51
58
  SingleVote,
59
+ Zealy,
52
60
 
53
61
  }
@@ -1,6 +1,6 @@
1
1
  // Generated by Ignite ignite.com/cli
2
- import { Registry } from "@cosmjs/proto-signing";
3
- import { msgTypes } from './registry';
2
+ import { Registry, } from "@cosmjs/proto-signing";
3
+ import { msgTypes } from "./registry";
4
4
  import { Api } from "./rest";
5
5
  import { Flag as typeFlag } from "./types";
6
6
  import { Params as typeParams } from "./types";
@@ -18,7 +18,10 @@ const defaultFee = {
18
18
  amount: [],
19
19
  gas: "200000",
20
20
  };
21
- export const txClient = ({ signer, prefix, addr } = { addr: "http://localhost:26657", prefix: "cosmos" }) => {
21
+ export const txClient = ({ signer, prefix, addr } = {
22
+ addr: "http://localhost:26657",
23
+ prefix: "cosmos",
24
+ }) => {
22
25
  return {};
23
26
  };
24
27
  export const queryClient = ({ addr: addr } = { addr: "http://localhost:1317" }) => {
@@ -34,7 +37,7 @@ class SDKModule {
34
37
  Params: getStructure(typeParams.fromPartial({})),
35
38
  FlagEnableProposal: getStructure(typeFlagEnableProposal.fromPartial({})),
36
39
  };
37
- client.on('signer-changed', (signer) => {
40
+ client.on("signer-changed", (signer) => {
38
41
  this.updateTX(client);
39
42
  });
40
43
  }
@@ -50,13 +53,12 @@ class SDKModule {
50
53
  }
51
54
  }
52
55
  }
53
- ;
54
56
  const Module = (test) => {
55
57
  return {
56
58
  module: {
57
- DecentralCardGameCardchainFeatureflag: new SDKModule(test)
59
+ DecentralCardGameCardchainFeatureflag: new SDKModule(test),
58
60
  },
59
- registry: msgTypes
61
+ registry: msgTypes,
60
62
  };
61
63
  };
62
64
  export default Module;
@@ -2,33 +2,36 @@
2
2
 
3
3
  import { StdFee } from "@cosmjs/amino";
4
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"
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 { Flag as typeFlag} from "./types"
12
- import { Params as typeParams} from "./types"
13
- import { FlagEnableProposal as typeFlagEnableProposal} from "./types"
14
-
15
- export { };
16
-
16
+ import { Flag as typeFlag } from "./types";
17
+ import { Params as typeParams } from "./types";
18
+ import { FlagEnableProposal as typeFlagEnableProposal } from "./types";
17
19
 
20
+ export {};
18
21
 
19
22
  export const registry = new Registry(msgTypes);
20
23
 
21
24
  type Field = {
22
- name: string;
23
- type: unknown;
24
- }
25
+ name: string;
26
+ type: unknown;
27
+ };
25
28
  function getStructure(template) {
26
- const structure: {fields: Field[]} = { fields: [] }
27
- for (let [key, value] of Object.entries(template)) {
28
- let field = { name: key, type: typeof value }
29
- structure.fields.push(field)
30
- }
31
- return structure
29
+ const structure: { fields: Field[] } = { fields: [] };
30
+ for (let [key, value] of Object.entries(template)) {
31
+ let field = { name: key, type: typeof value };
32
+ structure.fields.push(field);
33
+ }
34
+ return structure;
32
35
  }
33
36
  const defaultFee = {
34
37
  amount: [],
@@ -36,67 +39,68 @@ const defaultFee = {
36
39
  };
37
40
 
38
41
  interface TxClientOptions {
39
- addr: string
40
- prefix: string
41
- signer?: OfflineSigner
42
+ addr: string;
43
+ prefix: string;
44
+ signer?: OfflineSigner;
42
45
  }
43
46
 
44
- export const txClient = ({ signer, prefix, addr }: TxClientOptions = { addr: "http://localhost:26657", prefix: "cosmos" }) => {
45
-
46
- return {
47
-
48
-
49
- }
47
+ export const txClient = (
48
+ { signer, prefix, addr }: TxClientOptions = {
49
+ addr: "http://localhost:26657",
50
+ prefix: "cosmos",
51
+ },
52
+ ) => {
53
+ return {};
50
54
  };
51
55
 
52
56
  interface QueryClientOptions {
53
- addr: string
57
+ addr: string;
54
58
  }
55
59
 
56
- export const queryClient = ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => {
60
+ export const queryClient = (
61
+ { addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" },
62
+ ) => {
57
63
  return new Api({ baseURL: addr });
58
64
  };
59
65
 
60
66
  class SDKModule {
61
- public query: ReturnType<typeof queryClient>;
62
- public tx: ReturnType<typeof txClient>;
63
- public structure: Record<string,unknown>;
64
- public registry: Array<[string, GeneratedType]> = [];
67
+ public query: ReturnType<typeof queryClient>;
68
+ public tx: ReturnType<typeof txClient>;
69
+ public structure: Record<string, unknown>;
70
+ public registry: Array<[string, GeneratedType]> = [];
65
71
 
66
- constructor(client: IgniteClient) {
67
-
68
- this.query = queryClient({ addr: client.env.apiURL });
69
- this.updateTX(client);
70
- this.structure = {
71
- Flag: getStructure(typeFlag.fromPartial({})),
72
- Params: getStructure(typeParams.fromPartial({})),
73
- FlagEnableProposal: getStructure(typeFlagEnableProposal.fromPartial({})),
74
-
75
- };
76
- client.on('signer-changed',(signer) => {
77
- this.updateTX(client);
78
- })
79
- }
80
- updateTX(client: IgniteClient) {
72
+ constructor(client: IgniteClient) {
73
+ this.query = queryClient({ addr: client.env.apiURL });
74
+ this.updateTX(client);
75
+ this.structure = {
76
+ Flag: getStructure(typeFlag.fromPartial({})),
77
+ Params: getStructure(typeParams.fromPartial({})),
78
+ FlagEnableProposal: getStructure(typeFlagEnableProposal.fromPartial({})),
79
+ };
80
+ client.on("signer-changed", (signer) => {
81
+ this.updateTX(client);
82
+ });
83
+ }
84
+ updateTX(client: IgniteClient) {
81
85
  const methods = txClient({
82
- signer: client.signer,
83
- addr: client.env.rpcURL,
84
- prefix: client.env.prefix ?? "cosmos",
85
- })
86
-
86
+ signer: client.signer,
87
+ addr: client.env.rpcURL,
88
+ prefix: client.env.prefix ?? "cosmos",
89
+ });
90
+
87
91
  this.tx = methods;
88
92
  for (let m in methods) {
89
- this.tx[m] = methods[m].bind(this.tx);
93
+ this.tx[m] = methods[m].bind(this.tx);
90
94
  }
91
- }
92
- };
93
-
94
- const Module = (test: IgniteClient) => {
95
- return {
96
- module: {
97
- DecentralCardGameCardchainFeatureflag: new SDKModule(test)
98
- },
99
- registry: msgTypes
100
95
  }
101
96
  }
102
- export default Module;
97
+
98
+ const Module = (test: IgniteClient) => {
99
+ return {
100
+ module: {
101
+ DecentralCardGameCardchainFeatureflag: new SDKModule(test),
102
+ },
103
+ registry: msgTypes,
104
+ };
105
+ };
106
+ export default Module;
package/client.js CHANGED
@@ -20,10 +20,7 @@ export class IgniteClient extends EventEmitter {
20
20
  async signAndBroadcast(msgs, fee, memo) {
21
21
  if (this.signer) {
22
22
  const { address } = (await this.signer.getAccounts())[0];
23
- const signingClient = await SigningStargateClient.connectWithSigner(this.env.rpcURL, this.signer, {
24
- registry: new Registry(this.registry),
25
- prefix: this.env.prefix
26
- });
23
+ const signingClient = await SigningStargateClient.connectWithSigner(this.env.rpcURL, this.signer, { registry: new Registry(this.registry), prefix: this.env.prefix });
27
24
  return await signingClient.signAndBroadcast(address, msgs, fee ? fee : defaultFee, memo);
28
25
  }
29
26
  else {
@@ -37,7 +34,7 @@ export class IgniteClient extends EventEmitter {
37
34
  this.setMaxListeners(0);
38
35
  this.signer = signer;
39
36
  const classConstructor = this.constructor;
40
- classConstructor.plugins.forEach(plugin => {
37
+ classConstructor.plugins.forEach((plugin) => {
41
38
  const pluginInstance = plugin(this);
42
39
  Object.assign(this, pluginInstance.module);
43
40
  if (this.registry) {