@firmachain/firma-js 0.2.33 → 0.2.34

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 (62) hide show
  1. package/dist/index.js +5 -1
  2. package/dist/sdk/FirmaAuthzService.js +5 -5
  3. package/dist/sdk/FirmaBankService.js +1 -1
  4. package/dist/sdk/FirmaContractService.js +4 -4
  5. package/dist/sdk/FirmaCosmWasmService.js +11 -13
  6. package/dist/sdk/FirmaDistributionService.js +5 -5
  7. package/dist/sdk/FirmaFeeGrantService.js +3 -3
  8. package/dist/sdk/FirmaGovService.js +7 -7
  9. package/dist/sdk/FirmaIbcService.js +1 -1
  10. package/dist/sdk/FirmaIpfsService.js +1 -1
  11. package/dist/sdk/FirmaNftService.js +3 -3
  12. package/dist/sdk/FirmaStakingService.js +5 -5
  13. package/dist/sdk/FirmaTokenService.js +4 -4
  14. package/dist/sdk/FirmaUtil.d.ts +4 -2
  15. package/dist/sdk/FirmaUtil.js +18 -13
  16. package/dist/sdk/FirmaWalletService.js +3 -3
  17. package/dist/sdk/firmachain/amino/addresses.js +11 -11
  18. package/dist/sdk/firmachain/amino/aminotypes.js +36 -32
  19. package/dist/sdk/firmachain/amino/encoding.js +30 -26
  20. package/dist/sdk/firmachain/amino/multisig.js +5 -5
  21. package/dist/sdk/firmachain/amino/signature.js +4 -4
  22. package/dist/sdk/firmachain/amino/signdoc.js +1 -1
  23. package/dist/sdk/firmachain/amino/wallet.js +14 -10
  24. package/dist/sdk/firmachain/authz/AuthzQueryClient.js +3 -3
  25. package/dist/sdk/firmachain/authz/index.js +5 -1
  26. package/dist/sdk/firmachain/bank/BankQueryClient.js +4 -4
  27. package/dist/sdk/firmachain/bank/index.js +5 -1
  28. package/dist/sdk/firmachain/common/CommonTxClient.d.ts +7 -0
  29. package/dist/sdk/firmachain/common/CommonTxClient.js +79 -0
  30. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +2 -2
  31. package/dist/sdk/firmachain/common/LedgerWallet.js +14 -10
  32. package/dist/sdk/firmachain/common/accounts.js +2 -2
  33. package/dist/sdk/firmachain/common/index.js +5 -1
  34. package/dist/sdk/firmachain/common/signing.js +9 -5
  35. package/dist/sdk/firmachain/common/signingaminostargateclient.js +16 -16
  36. package/dist/sdk/firmachain/common/signingstargateclient.js +18 -14
  37. package/dist/sdk/firmachain/common/stargateclient.js +6 -6
  38. package/dist/sdk/firmachain/contract/ContractQueryClient.js +2 -2
  39. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +4 -4
  40. package/dist/sdk/firmachain/contract/index.js +5 -1
  41. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +7 -7
  42. package/dist/sdk/firmachain/cosmwasm/index.js +5 -1
  43. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +5 -5
  44. package/dist/sdk/firmachain/distribution/index.js +5 -1
  45. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +2 -2
  46. package/dist/sdk/firmachain/feegrant/index.js +5 -1
  47. package/dist/sdk/firmachain/google/protobuf/any.d.ts +1 -1
  48. package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +27 -27
  49. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +1 -1
  50. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +1 -1
  51. package/dist/sdk/firmachain/gov/GovQueryClient.js +2 -2
  52. package/dist/sdk/firmachain/gov/index.js +5 -1
  53. package/dist/sdk/firmachain/ibc/IbcQueryClient.js +1 -1
  54. package/dist/sdk/firmachain/ibc/index.js +5 -1
  55. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +6 -6
  56. package/dist/sdk/firmachain/nft/index.js +5 -1
  57. package/dist/sdk/firmachain/slashing/index.js +5 -1
  58. package/dist/sdk/firmachain/staking/StakingQueryClient.js +8 -8
  59. package/dist/sdk/firmachain/staking/index.js +5 -1
  60. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +8 -8
  61. package/dist/sdk/firmachain/token/index.js +5 -1
  62. package/package.json +1 -2
@@ -8,32 +8,32 @@ var encoding_2 = require("./encoding");
8
8
  var pubkeys_1 = require("./pubkeys");
9
9
  function rawEd25519PubkeyToRawAddress(pubkeyData) {
10
10
  if (pubkeyData.length !== 32) {
11
- throw new Error("Invalid Ed25519 pubkey length: " + pubkeyData.length);
11
+ throw new Error("Invalid Ed25519 pubkey length: ".concat(pubkeyData.length));
12
12
  }
13
- return crypto_1.sha256(pubkeyData).slice(0, 20);
13
+ return (0, crypto_1.sha256)(pubkeyData).slice(0, 20);
14
14
  }
15
15
  exports.rawEd25519PubkeyToRawAddress = rawEd25519PubkeyToRawAddress;
16
16
  function rawSecp256k1PubkeyToRawAddress(pubkeyData) {
17
17
  if (pubkeyData.length !== 33) {
18
- throw new Error("Invalid Secp256k1 pubkey length (compressed): " + pubkeyData.length);
18
+ throw new Error("Invalid Secp256k1 pubkey length (compressed): ".concat(pubkeyData.length));
19
19
  }
20
- return crypto_1.ripemd160(crypto_1.sha256(pubkeyData));
20
+ return (0, crypto_1.ripemd160)((0, crypto_1.sha256)(pubkeyData));
21
21
  }
22
22
  exports.rawSecp256k1PubkeyToRawAddress = rawSecp256k1PubkeyToRawAddress;
23
23
  // For secp256k1 this assumes we already have a compressed pubkey.
24
24
  function pubkeyToRawAddress(pubkey) {
25
- if (pubkeys_1.isSecp256k1Pubkey(pubkey)) {
26
- var pubkeyData = encoding_1.fromBase64(pubkey.value);
25
+ if ((0, pubkeys_1.isSecp256k1Pubkey)(pubkey)) {
26
+ var pubkeyData = (0, encoding_1.fromBase64)(pubkey.value);
27
27
  return rawSecp256k1PubkeyToRawAddress(pubkeyData);
28
28
  }
29
- else if (pubkeys_1.isEd25519Pubkey(pubkey)) {
30
- var pubkeyData = encoding_1.fromBase64(pubkey.value);
29
+ else if ((0, pubkeys_1.isEd25519Pubkey)(pubkey)) {
30
+ var pubkeyData = (0, encoding_1.fromBase64)(pubkey.value);
31
31
  return rawEd25519PubkeyToRawAddress(pubkeyData);
32
32
  }
33
- else if (pubkeys_1.isMultisigThresholdPubkey(pubkey)) {
33
+ else if ((0, pubkeys_1.isMultisigThresholdPubkey)(pubkey)) {
34
34
  // https://github.com/tendermint/tendermint/blob/38b401657e4ad7a7eeb3c30a3cbf512037df3740/crypto/multisig/threshold_pubkey.go#L71-L74
35
- var pubkeyData = encoding_2.encodeAminoPubkey(pubkey);
36
- return crypto_1.sha256(pubkeyData).slice(0, 20);
35
+ var pubkeyData = (0, encoding_2.encodeAminoPubkey)(pubkey);
36
+ return (0, crypto_1.sha256)(pubkeyData).slice(0, 20);
37
37
  }
38
38
  else {
39
39
  throw new Error("Unsupported public key type");
@@ -26,10 +26,14 @@ var __read = (this && this.__read) || function (o, n) {
26
26
  }
27
27
  return ar;
28
28
  };
29
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
30
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
31
- to[j] = from[i];
32
- return to;
29
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
+ if (ar || !(i in from)) {
32
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
+ ar[i] = from[i];
34
+ }
35
+ }
36
+ return to.concat(ar || Array.prototype.slice.call(from));
33
37
  };
34
38
  var __importDefault = (this && this.__importDefault) || function (mod) {
35
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -52,7 +56,7 @@ function omitDefault(input) {
52
56
  if (long_1.default.isLong(input)) {
53
57
  return input.isZero() ? undefined : input;
54
58
  }
55
- throw new Error("Got unsupported type '" + typeof input + "'");
59
+ throw new Error("Got unsupported type '".concat(typeof input, "'"));
56
60
  }
57
61
  function createDefaultTypes(prefix) {
58
62
  return {
@@ -64,7 +68,7 @@ function createDefaultTypes(prefix) {
64
68
  return ({
65
69
  from_address: fromAddress,
66
70
  to_address: toAddress,
67
- amount: __spreadArray([], __read(amount)),
71
+ amount: __spreadArray([], __read(amount), false),
68
72
  });
69
73
  },
70
74
  fromAmino: function (_a) {
@@ -72,7 +76,7 @@ function createDefaultTypes(prefix) {
72
76
  return ({
73
77
  fromAddress: from_address,
74
78
  toAddress: to_address,
75
- amount: __spreadArray([], __read(amount)),
79
+ amount: __spreadArray([], __read(amount), false),
76
80
  });
77
81
  },
78
82
  },
@@ -83,11 +87,11 @@ function createDefaultTypes(prefix) {
83
87
  return ({
84
88
  inputs: inputs.map(function (input) { return ({
85
89
  address: input.address,
86
- coins: __spreadArray([], __read(input.coins)),
90
+ coins: __spreadArray([], __read(input.coins), false),
87
91
  }); }),
88
92
  outputs: outputs.map(function (output) { return ({
89
93
  address: output.address,
90
- coins: __spreadArray([], __read(output.coins)),
94
+ coins: __spreadArray([], __read(output.coins), false),
91
95
  }); }),
92
96
  });
93
97
  },
@@ -96,11 +100,11 @@ function createDefaultTypes(prefix) {
96
100
  return ({
97
101
  inputs: inputs.map(function (input) { return ({
98
102
  address: input.address,
99
- coins: __spreadArray([], __read(input.coins)),
103
+ coins: __spreadArray([], __read(input.coins), false),
100
104
  }); }),
101
105
  outputs: outputs.map(function (output) { return ({
102
106
  address: output.address,
103
- coins: __spreadArray([], __read(output.coins)),
107
+ coins: __spreadArray([], __read(output.coins), false),
104
108
  }); }),
105
109
  });
106
110
  },
@@ -111,14 +115,14 @@ function createDefaultTypes(prefix) {
111
115
  toAmino: function (_a) {
112
116
  var amount = _a.amount, depositor = _a.depositor;
113
117
  return ({
114
- amount: __spreadArray([], __read(amount)),
118
+ amount: __spreadArray([], __read(amount), false),
115
119
  depositor: depositor,
116
120
  });
117
121
  },
118
122
  fromAmino: function (_a) {
119
123
  var amount = _a.amount, depositor = _a.depositor;
120
124
  return ({
121
- amount: __spreadArray([], __read(amount)),
125
+ amount: __spreadArray([], __read(amount), false),
122
126
  depositor: depositor,
123
127
  });
124
128
  },
@@ -205,7 +209,7 @@ function createDefaultTypes(prefix) {
205
209
  fromAmino: function (_a) {
206
210
  var option = _a.option, proposal_id = _a.proposal_id, voter = _a.voter;
207
211
  return {
208
- option: gov_1.voteOptionFromJSON(option),
212
+ option: (0, gov_1.voteOptionFromJSON)(option),
209
213
  proposalId: long_1.default.fromString(proposal_id),
210
214
  voter: voter,
211
215
  };
@@ -215,7 +219,7 @@ function createDefaultTypes(prefix) {
215
219
  aminoType: "cosmos-sdk/MsgSubmitProposal",
216
220
  toAmino: function (_a) {
217
221
  var initialDeposit = _a.initialDeposit, proposer = _a.proposer, content = _a.content;
218
- utils_1.assertDefinedAndNotNull(content);
222
+ (0, utils_1.assertDefinedAndNotNull)(content);
219
223
  var proposal;
220
224
  switch (content.typeUrl) {
221
225
  case "/cosmos.gov.v1beta1.TextProposal": {
@@ -230,7 +234,7 @@ function createDefaultTypes(prefix) {
230
234
  break;
231
235
  }
232
236
  default:
233
- throw new Error("Unsupported proposal type: '" + content.typeUrl + "'");
237
+ throw new Error("Unsupported proposal type: '".concat(content.typeUrl, "'"));
234
238
  }
235
239
  return {
236
240
  initial_deposit: initialDeposit,
@@ -244,10 +248,10 @@ function createDefaultTypes(prefix) {
244
248
  switch (content.type) {
245
249
  case "cosmos-sdk/TextProposal": {
246
250
  var value = content.value;
247
- utils_1.assert(utils_1.isNonNullObject(value));
251
+ (0, utils_1.assert)((0, utils_1.isNonNullObject)(value));
248
252
  var _b = value, title = _b.title, description = _b.description;
249
- utils_1.assert(typeof title === "string");
250
- utils_1.assert(typeof description === "string");
253
+ (0, utils_1.assert)(typeof title === "string");
254
+ (0, utils_1.assert)(typeof description === "string");
251
255
  any_content = any_1.Any.fromPartial({
252
256
  typeUrl: "/cosmos.gov.v1beta1.TextProposal",
253
257
  value: gov_1.TextProposal.encode(gov_1.TextProposal.fromPartial({
@@ -258,7 +262,7 @@ function createDefaultTypes(prefix) {
258
262
  break;
259
263
  }
260
264
  default:
261
- throw new Error("Unsupported proposal type: '" + content.type + "'");
265
+ throw new Error("Unsupported proposal type: '".concat(content.type, "'"));
262
266
  }
263
267
  return {
264
268
  initialDeposit: Array.from(initial_deposit),
@@ -272,7 +276,7 @@ function createDefaultTypes(prefix) {
272
276
  aminoType: "cosmos-sdk/MsgBeginRedelegate",
273
277
  toAmino: function (_a) {
274
278
  var delegatorAddress = _a.delegatorAddress, validatorSrcAddress = _a.validatorSrcAddress, validatorDstAddress = _a.validatorDstAddress, amount = _a.amount;
275
- utils_1.assertDefinedAndNotNull(amount, "missing amount");
279
+ (0, utils_1.assertDefinedAndNotNull)(amount, "missing amount");
276
280
  return {
277
281
  delegator_address: delegatorAddress,
278
282
  validator_src_address: validatorSrcAddress,
@@ -294,10 +298,10 @@ function createDefaultTypes(prefix) {
294
298
  aminoType: "cosmos-sdk/MsgCreateValidator",
295
299
  toAmino: function (_a) {
296
300
  var description = _a.description, commission = _a.commission, minSelfDelegation = _a.minSelfDelegation, delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress, pubkey = _a.pubkey, value = _a.value;
297
- utils_1.assertDefinedAndNotNull(description, "missing description");
298
- utils_1.assertDefinedAndNotNull(commission, "missing commission");
299
- utils_1.assertDefinedAndNotNull(pubkey, "missing pubkey");
300
- utils_1.assertDefinedAndNotNull(value, "missing value");
301
+ (0, utils_1.assertDefinedAndNotNull)(description, "missing description");
302
+ (0, utils_1.assertDefinedAndNotNull)(commission, "missing commission");
303
+ (0, utils_1.assertDefinedAndNotNull)(pubkey, "missing pubkey");
304
+ (0, utils_1.assertDefinedAndNotNull)(value, "missing value");
301
305
  return {
302
306
  description: {
303
307
  moniker: description.moniker,
@@ -314,16 +318,16 @@ function createDefaultTypes(prefix) {
314
318
  min_self_delegation: minSelfDelegation,
315
319
  delegator_address: delegatorAddress,
316
320
  validator_address: validatorAddress,
317
- pubkey: encoding_2.encodeBech32Pubkey({
321
+ pubkey: (0, encoding_2.encodeBech32Pubkey)({
318
322
  type: "tendermint/PubKeySecp256k1",
319
- value: encoding_1.toBase64(pubkey.value),
323
+ value: (0, encoding_1.toBase64)(pubkey.value),
320
324
  }, prefix),
321
325
  value: value,
322
326
  };
323
327
  },
324
328
  fromAmino: function (_a) {
325
329
  var description = _a.description, commission = _a.commission, min_self_delegation = _a.min_self_delegation, delegator_address = _a.delegator_address, validator_address = _a.validator_address, pubkey = _a.pubkey, value = _a.value;
326
- var decodedPubkey = encoding_2.decodeBech32Pubkey(pubkey);
330
+ var decodedPubkey = (0, encoding_2.decodeBech32Pubkey)(pubkey);
327
331
  if (decodedPubkey.type !== "tendermint/PubKeySecp256k1") {
328
332
  throw new Error("Only Secp256k1 public keys are supported");
329
333
  }
@@ -345,7 +349,7 @@ function createDefaultTypes(prefix) {
345
349
  validatorAddress: validator_address,
346
350
  pubkey: {
347
351
  typeUrl: "/cosmos.crypto.secp256k1.PubKey",
348
- value: encoding_1.fromBase64(decodedPubkey.value),
352
+ value: (0, encoding_1.fromBase64)(decodedPubkey.value),
349
353
  },
350
354
  value: value,
351
355
  };
@@ -355,7 +359,7 @@ function createDefaultTypes(prefix) {
355
359
  aminoType: "cosmos-sdk/MsgDelegate",
356
360
  toAmino: function (_a) {
357
361
  var delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress, amount = _a.amount;
358
- utils_1.assertDefinedAndNotNull(amount, "missing amount");
362
+ (0, utils_1.assertDefinedAndNotNull)(amount, "missing amount");
359
363
  return {
360
364
  delegator_address: delegatorAddress,
361
365
  validator_address: validatorAddress,
@@ -375,7 +379,7 @@ function createDefaultTypes(prefix) {
375
379
  aminoType: "cosmos-sdk/MsgEditValidator",
376
380
  toAmino: function (_a) {
377
381
  var description = _a.description, commissionRate = _a.commissionRate, minSelfDelegation = _a.minSelfDelegation, validatorAddress = _a.validatorAddress;
378
- utils_1.assertDefinedAndNotNull(description, "missing description");
382
+ (0, utils_1.assertDefinedAndNotNull)(description, "missing description");
379
383
  return {
380
384
  description: {
381
385
  moniker: description.moniker,
@@ -409,7 +413,7 @@ function createDefaultTypes(prefix) {
409
413
  aminoType: "cosmos-sdk/MsgUndelegate",
410
414
  toAmino: function (_a) {
411
415
  var delegatorAddress = _a.delegatorAddress, validatorAddress = _a.validatorAddress, amount = _a.amount;
412
- utils_1.assertDefinedAndNotNull(amount, "missing amount");
416
+ (0, utils_1.assertDefinedAndNotNull)(amount, "missing amount");
413
417
  return {
414
418
  delegator_address: delegatorAddress,
415
419
  validator_address: validatorAddress,
@@ -15,10 +15,14 @@ var __read = (this && this.__read) || function (o, n) {
15
15
  }
16
16
  return ar;
17
17
  };
18
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
19
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
20
- to[j] = from[i];
21
- return to;
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
22
26
  };
23
27
  var __values = (this && this.__values) || function(o) {
24
28
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
@@ -43,58 +47,58 @@ function encodeSecp256k1Pubkey(pubkey) {
43
47
  }
44
48
  return {
45
49
  type: pubkeys_1.pubkeyType.secp256k1,
46
- value: encoding_1.toBase64(pubkey),
50
+ value: (0, encoding_1.toBase64)(pubkey),
47
51
  };
48
52
  }
49
53
  exports.encodeSecp256k1Pubkey = encodeSecp256k1Pubkey;
50
54
  // As discussed in https://github.com/binance-chain/javascript-sdk/issues/163
51
55
  // Prefixes listed here: https://github.com/tendermint/tendermint/blob/d419fffe18531317c28c29a292ad7d253f6cafdf/docs/spec/blockchain/encoding.md#public-key-cryptography
52
56
  // Last bytes is varint-encoded length prefix
53
- var pubkeyAminoPrefixSecp256k1 = encoding_1.fromHex("eb5ae987" + "21" /* fixed length */);
54
- var pubkeyAminoPrefixEd25519 = encoding_1.fromHex("1624de64" + "20" /* fixed length */);
55
- var pubkeyAminoPrefixSr25519 = encoding_1.fromHex("0dfb1005" + "20" /* fixed length */);
57
+ var pubkeyAminoPrefixSecp256k1 = (0, encoding_1.fromHex)("eb5ae987" + "21" /* fixed length */);
58
+ var pubkeyAminoPrefixEd25519 = (0, encoding_1.fromHex)("1624de64" + "20" /* fixed length */);
59
+ var pubkeyAminoPrefixSr25519 = (0, encoding_1.fromHex)("0dfb1005" + "20" /* fixed length */);
56
60
  /** See https://github.com/tendermint/tendermint/commit/38b401657e4ad7a7eeb3c30a3cbf512037df3740 */
57
- var pubkeyAminoPrefixMultisigThreshold = encoding_1.fromHex("22c1f7e2" /* variable length not included */);
61
+ var pubkeyAminoPrefixMultisigThreshold = (0, encoding_1.fromHex)("22c1f7e2" /* variable length not included */);
58
62
  /**
59
63
  * Decodes a pubkey in the Amino binary format to a type/value object.
60
64
  */
61
65
  function decodeAminoPubkey(data) {
62
- if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixSecp256k1)) {
66
+ if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixSecp256k1)) {
63
67
  var rest = data.slice(pubkeyAminoPrefixSecp256k1.length);
64
68
  if (rest.length !== 33) {
65
69
  throw new Error("Invalid rest data length. Expected 33 bytes (compressed secp256k1 pubkey).");
66
70
  }
67
71
  return {
68
72
  type: pubkeys_1.pubkeyType.secp256k1,
69
- value: encoding_1.toBase64(rest),
73
+ value: (0, encoding_1.toBase64)(rest),
70
74
  };
71
75
  }
72
- else if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixEd25519)) {
76
+ else if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixEd25519)) {
73
77
  var rest = data.slice(pubkeyAminoPrefixEd25519.length);
74
78
  if (rest.length !== 32) {
75
79
  throw new Error("Invalid rest data length. Expected 32 bytes (Ed25519 pubkey).");
76
80
  }
77
81
  return {
78
82
  type: pubkeys_1.pubkeyType.ed25519,
79
- value: encoding_1.toBase64(rest),
83
+ value: (0, encoding_1.toBase64)(rest),
80
84
  };
81
85
  }
82
- else if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixSr25519)) {
86
+ else if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixSr25519)) {
83
87
  var rest = data.slice(pubkeyAminoPrefixSr25519.length);
84
88
  if (rest.length !== 32) {
85
89
  throw new Error("Invalid rest data length. Expected 32 bytes (Sr25519 pubkey).");
86
90
  }
87
91
  return {
88
92
  type: pubkeys_1.pubkeyType.sr25519,
89
- value: encoding_1.toBase64(rest),
93
+ value: (0, encoding_1.toBase64)(rest),
90
94
  };
91
95
  }
92
- else if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixMultisigThreshold)) {
96
+ else if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixMultisigThreshold)) {
93
97
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
94
98
  return decodeMultisigPubkey(data);
95
99
  }
96
100
  else {
97
- throw new Error("Unsupported public key type. Amino data starts with: " + encoding_1.toHex(data.slice(0, 5)));
101
+ throw new Error("Unsupported public key type. Amino data starts with: " + (0, encoding_1.toHex)(data.slice(0, 5)));
98
102
  }
99
103
  }
100
104
  exports.decodeAminoPubkey = decodeAminoPubkey;
@@ -133,7 +137,7 @@ function decodeMultisigPubkey(data) {
133
137
  var reader = Array.from(data);
134
138
  // remove multisig amino prefix;
135
139
  var prefixFromReader = reader.splice(0, pubkeyAminoPrefixMultisigThreshold.length);
136
- if (!utils_1.arrayContentStartsWith(prefixFromReader, pubkeyAminoPrefixMultisigThreshold)) {
140
+ if (!(0, utils_1.arrayContentStartsWith)(prefixFromReader, pubkeyAminoPrefixMultisigThreshold)) {
137
141
  throw new Error("Invalid multisig prefix.");
138
142
  }
139
143
  // remove 0x08 threshold prefix;
@@ -188,18 +192,18 @@ function encodeUvarint(value) {
188
192
  */
189
193
  function encodeAminoPubkey(pubkey) {
190
194
  var e_1, _a;
191
- if (pubkeys_1.isMultisigThresholdPubkey(pubkey)) {
195
+ if ((0, pubkeys_1.isMultisigThresholdPubkey)(pubkey)) {
192
196
  var out = Array.from(pubkeyAminoPrefixMultisigThreshold);
193
197
  out.push(0x08); // TODO: What is this?
194
198
  out.push.apply(// TODO: What is this?
195
- out, __spreadArray([], __read(encodeUvarint(pubkey.value.threshold))));
199
+ out, __spreadArray([], __read(encodeUvarint(pubkey.value.threshold)), false));
196
200
  try {
197
201
  for (var _b = __values(pubkey.value.pubkeys.map(function (p) { return encodeAminoPubkey(p); })), _c = _b.next(); !_c.done; _c = _b.next()) {
198
202
  var pubkeyData = _c.value;
199
203
  out.push(0x12); // TODO: What is this?
200
204
  out.push.apply(// TODO: What is this?
201
- out, __spreadArray([], __read(encodeUvarint(pubkeyData.length))));
202
- out.push.apply(out, __spreadArray([], __read(pubkeyData)));
205
+ out, __spreadArray([], __read(encodeUvarint(pubkeyData.length)), false));
206
+ out.push.apply(out, __spreadArray([], __read(pubkeyData), false));
203
207
  }
204
208
  }
205
209
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -211,11 +215,11 @@ function encodeAminoPubkey(pubkey) {
211
215
  }
212
216
  return new Uint8Array(out);
213
217
  }
214
- else if (pubkeys_1.isEd25519Pubkey(pubkey)) {
215
- return new Uint8Array(__spreadArray(__spreadArray([], __read(pubkeyAminoPrefixEd25519)), __read(encoding_1.fromBase64(pubkey.value))));
218
+ else if ((0, pubkeys_1.isEd25519Pubkey)(pubkey)) {
219
+ return new Uint8Array(__spreadArray(__spreadArray([], __read(pubkeyAminoPrefixEd25519), false), __read((0, encoding_1.fromBase64)(pubkey.value)), false));
216
220
  }
217
- else if (pubkeys_1.isSecp256k1Pubkey(pubkey)) {
218
- return new Uint8Array(__spreadArray(__spreadArray([], __read(pubkeyAminoPrefixSecp256k1)), __read(encoding_1.fromBase64(pubkey.value))));
221
+ else if ((0, pubkeys_1.isSecp256k1Pubkey)(pubkey)) {
222
+ return new Uint8Array(__spreadArray(__spreadArray([], __read(pubkeyAminoPrefixSecp256k1), false), __read((0, encoding_1.fromBase64)(pubkey.value)), false));
219
223
  }
220
224
  else {
221
225
  throw new Error("Unsupported pubkey type");
@@ -12,8 +12,8 @@ var addresses_1 = require("./addresses");
12
12
  * Returns 0 if `a === b`.
13
13
  */
14
14
  function compareArrays(a, b) {
15
- var aHex = encoding_1.toHex(a);
16
- var bHex = encoding_1.toHex(b);
15
+ var aHex = (0, encoding_1.toHex)(a);
16
+ var bHex = (0, encoding_1.toHex)(b);
17
17
  return aHex === bHex ? 0 : aHex < bHex ? -1 : 1;
18
18
  }
19
19
  exports.compareArrays = compareArrays;
@@ -21,14 +21,14 @@ function createMultisigThresholdPubkey(pubkeys, threshold, nosort) {
21
21
  if (nosort === void 0) { nosort = false; }
22
22
  var uintThreshold = new math_1.Uint53(threshold);
23
23
  if (uintThreshold.toNumber() > pubkeys.length) {
24
- throw new Error("Threshold k = " + uintThreshold.toNumber() + " exceeds number of keys n = " + pubkeys.length);
24
+ throw new Error("Threshold k = ".concat(uintThreshold.toNumber(), " exceeds number of keys n = ").concat(pubkeys.length));
25
25
  }
26
26
  var outPubkeys = nosort
27
27
  ? pubkeys
28
28
  : Array.from(pubkeys).sort(function (lhs, rhs) {
29
29
  // https://github.com/cosmos/cosmos-sdk/blob/v0.42.2/client/keys/add.go#L172-L174
30
- var addressLhs = addresses_1.pubkeyToRawAddress(lhs);
31
- var addressRhs = addresses_1.pubkeyToRawAddress(rhs);
30
+ var addressLhs = (0, addresses_1.pubkeyToRawAddress)(lhs);
31
+ var addressRhs = (0, addresses_1.pubkeyToRawAddress)(rhs);
32
32
  return compareArrays(addressLhs, addressRhs);
33
33
  });
34
34
  return {
@@ -16,8 +16,8 @@ function encodeSecp256k1Signature(pubkey, signature) {
16
16
  throw new Error("Signature must be 64 bytes long. Cosmos SDK uses a 2x32 byte fixed length encoding for the secp256k1 signature integers r and s.");
17
17
  }
18
18
  return {
19
- pub_key: encoding_2.encodeSecp256k1Pubkey(pubkey),
20
- signature: encoding_1.toBase64(signature),
19
+ pub_key: (0, encoding_2.encodeSecp256k1Pubkey)(pubkey),
20
+ signature: (0, encoding_1.toBase64)(signature),
21
21
  };
22
22
  }
23
23
  exports.encodeSecp256k1Signature = encodeSecp256k1Signature;
@@ -26,8 +26,8 @@ function decodeSignature(signature) {
26
26
  // Note: please don't add cases here without writing additional unit tests
27
27
  case pubkeys_1.pubkeyType.secp256k1:
28
28
  return {
29
- pubkey: encoding_1.fromBase64(signature.pub_key.value),
30
- signature: encoding_1.fromBase64(signature.signature),
29
+ pubkey: (0, encoding_1.fromBase64)(signature.pub_key.value),
30
+ signature: (0, encoding_1.fromBase64)(signature.signature),
31
31
  };
32
32
  default:
33
33
  throw new Error("Unsupported pubkey type");
@@ -37,6 +37,6 @@ function makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence) {
37
37
  }
38
38
  exports.makeSignDoc = makeSignDoc;
39
39
  function serializeSignDoc(signDoc) {
40
- return encoding_1.toUtf8(sortedJsonStringify(signDoc));
40
+ return (0, encoding_1.toUtf8)(sortedJsonStringify(signDoc));
41
41
  }
42
42
  exports.serializeSignDoc = serializeSignDoc;
@@ -51,10 +51,14 @@ var __read = (this && this.__read) || function (o, n) {
51
51
  }
52
52
  return ar;
53
53
  };
54
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
55
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
56
- to[j] = from[i];
57
- return to;
54
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
55
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
56
+ if (ar || !(i in from)) {
57
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
58
+ ar[i] = from[i];
59
+ }
60
+ }
61
+ return to.concat(ar || Array.prototype.slice.call(from));
58
62
  };
59
63
  Object.defineProperty(exports, "__esModule", { value: true });
60
64
  exports.decrypt = exports.encrypt = exports.supportedAlgorithms = exports.executeKdf = exports.cosmjsSalt = void 0;
@@ -65,7 +69,7 @@ var encoding_1 = require("@cosmjs/encoding");
65
69
  * This reduces the scope of a potential rainbow attack to all CosmJS users.
66
70
  * Must be 16 bytes due to implementation limitations.
67
71
  */
68
- exports.cosmjsSalt = encoding_1.toAscii("The CosmJS salt.");
72
+ exports.cosmjsSalt = (0, encoding_1.toAscii)("The CosmJS salt.");
69
73
  function executeKdf(password, configuration) {
70
74
  return __awaiter(this, void 0, void 0, function () {
71
75
  var options;
@@ -73,7 +77,7 @@ function executeKdf(password, configuration) {
73
77
  switch (configuration.algorithm) {
74
78
  case "argon2id": {
75
79
  options = configuration.params;
76
- if (!crypto_1.isArgon2idOptions(options))
80
+ if (!(0, crypto_1.isArgon2idOptions)(options))
77
81
  throw new Error("Invalid format of argon2id params");
78
82
  return [2 /*return*/, crypto_1.Argon2id.execute(password, exports.cosmjsSalt, options)];
79
83
  }
@@ -102,12 +106,12 @@ function encrypt(plaintext, encryptionKey, config) {
102
106
  case 1:
103
107
  nonce = crypto_1.Random.getBytes(crypto_1.xchacha20NonceLength);
104
108
  _b = Uint8Array.bind;
105
- _c = [__spreadArray([], __read(nonce))];
109
+ _c = [__spreadArray([], __read(nonce), false)];
106
110
  return [4 /*yield*/, crypto_1.Xchacha20poly1305Ietf.encrypt(plaintext, encryptionKey, nonce)];
107
111
  case 2:
108
112
  // Prepend fixed-length nonce to ciphertext as suggested in the example from https://github.com/jedisct1/libsodium.js#api
109
- return [2 /*return*/, new (_b.apply(Uint8Array, [void 0, __spreadArray.apply(void 0, _c.concat([__read.apply(void 0, [(_d.sent())])]))]))()];
110
- case 3: throw new Error("Unsupported encryption algorithm: '" + config.algorithm + "'");
113
+ return [2 /*return*/, new (_b.apply(Uint8Array, [void 0, __spreadArray.apply(void 0, _c.concat([__read.apply(void 0, [(_d.sent())]), false]))]))()];
114
+ case 3: throw new Error("Unsupported encryption algorithm: '".concat(config.algorithm, "'"));
111
115
  }
112
116
  });
113
117
  });
@@ -123,7 +127,7 @@ function decrypt(ciphertext, encryptionKey, config) {
123
127
  return [2 /*return*/, crypto_1.Xchacha20poly1305Ietf.decrypt(ciphertext.slice(crypto_1.xchacha20NonceLength), encryptionKey, nonce)];
124
128
  }
125
129
  default:
126
- throw new Error("Unsupported encryption algorithm: '" + config.algorithm + "'");
130
+ throw new Error("Unsupported encryption algorithm: '".concat(config.algorithm, "'"));
127
131
  }
128
132
  return [2 /*return*/];
129
133
  });
@@ -60,7 +60,7 @@ var AuthzQueryClient = /** @class */ (function () {
60
60
  switch (_a.label) {
61
61
  case 0:
62
62
  msgType = "/cosmos.bank.v1beta1.MsgSend";
63
- path = "/cosmos/authz/v1beta1/grants?granter=" + granterAddress + "&grantee=" + granteeAddress + "&msg_type_url=" + msgType;
63
+ path = "/cosmos/authz/v1beta1/grants?granter=".concat(granterAddress, "&grantee=").concat(granteeAddress, "&msg_type_url=").concat(msgType);
64
64
  return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
65
65
  case 1:
66
66
  result = _a.sent();
@@ -84,7 +84,7 @@ var AuthzQueryClient = /** @class */ (function () {
84
84
  return __generator(this, function (_a) {
85
85
  switch (_a.label) {
86
86
  case 0:
87
- path = "/cosmos/authz/v1beta1/grants?granter=" + granterAddress + "&grantee=" + granteeAddress + "&msg_type_url=" + msgType;
87
+ path = "/cosmos/authz/v1beta1/grants?granter=".concat(granterAddress, "&grantee=").concat(granteeAddress, "&msg_type_url=").concat(msgType);
88
88
  return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
89
89
  case 1:
90
90
  result = _a.sent();
@@ -120,7 +120,7 @@ var AuthzQueryClient = /** @class */ (function () {
120
120
  msgType = "/cosmos.staking.v1beta1.MsgBeginRedelegate";
121
121
  break;
122
122
  }
123
- path = "/cosmos/authz/v1beta1/grants?granter=" + granterAddress + "&grantee=" + granteeAddress + "&msg_type_url=" + msgType;
123
+ path = "/cosmos/authz/v1beta1/grants?granter=".concat(granterAddress, "&grantee=").concat(granteeAddress, "&msg_type_url=").concat(msgType);
124
124
  return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
125
125
  case 1:
126
126
  result = _a.sent();
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -57,7 +57,7 @@ var BankQueryClient = /** @class */ (function () {
57
57
  return __generator(this, function (_a) {
58
58
  switch (_a.label) {
59
59
  case 0:
60
- path = "/cosmos/bank/v1beta1/supply/" + denom;
60
+ path = "/cosmos/bank/v1beta1/supply/".concat(denom);
61
61
  return [4 /*yield*/, this.axios.get(path)];
62
62
  case 1:
63
63
  result = _a.sent();
@@ -72,7 +72,7 @@ var BankQueryClient = /** @class */ (function () {
72
72
  return __generator(this, function (_a) {
73
73
  switch (_a.label) {
74
74
  case 0:
75
- path = "/cosmos/bank/v1beta1/balances/" + address + "/by_denom?denom=" + denom;
75
+ path = "/cosmos/bank/v1beta1/balances/".concat(address, "/by_denom?denom=").concat(denom);
76
76
  return [4 /*yield*/, this.axios.get(path)];
77
77
  case 1:
78
78
  result = _a.sent();
@@ -87,7 +87,7 @@ var BankQueryClient = /** @class */ (function () {
87
87
  return __generator(this, function (_a) {
88
88
  switch (_a.label) {
89
89
  case 0:
90
- path = "/cosmos/bank/v1beta1/balances/" + address;
90
+ path = "/cosmos/bank/v1beta1/balances/".concat(address);
91
91
  return [4 /*yield*/, this.axios.get(path)];
92
92
  case 1:
93
93
  result = _a.sent();
@@ -102,7 +102,7 @@ var BankQueryClient = /** @class */ (function () {
102
102
  return __generator(this, function (_a) {
103
103
  switch (_a.label) {
104
104
  case 0:
105
- path = "/cosmos/bank/v1beta1/balances/" + address + "/by_denom?denom=" + denom;
105
+ path = "/cosmos/bank/v1beta1/balances/".concat(address, "/by_denom?denom=").concat(denom);
106
106
  return [4 /*yield*/, this.axios.get(path)];
107
107
  case 1:
108
108
  result = _a.sent();
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -0,0 +1,7 @@
1
+ import { Registry } from "@cosmjs/proto-signing";
2
+ import { FirmaWalletService } from "../../FirmaWalletService";
3
+ import { ITxClient } from "./ITxClient";
4
+ export declare class CommonTxClient extends ITxClient {
5
+ constructor(wallet: FirmaWalletService, address: string);
6
+ static getRegistry(): Registry;
7
+ }