@firmachain/firma-js 0.2.47 → 0.2.49

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 (69) hide show
  1. package/dist/index.js +1 -5
  2. package/dist/sdk/FirmaAuthzService.js +5 -5
  3. package/dist/sdk/FirmaBankService.js +1 -1
  4. package/dist/sdk/FirmaChainService.d.ts +5 -0
  5. package/dist/sdk/FirmaChainService.js +44 -0
  6. package/dist/sdk/FirmaContractService.js +5 -5
  7. package/dist/sdk/FirmaCosmWasmCw20.d.ts +17 -0
  8. package/dist/sdk/FirmaCosmWasmCw20.js +269 -0
  9. package/dist/sdk/FirmaCosmWasmCw721.d.ts +43 -0
  10. package/dist/sdk/FirmaCosmWasmCw721.js +318 -0
  11. package/dist/sdk/FirmaCosmWasmService.js +9 -9
  12. package/dist/sdk/FirmaDistributionService.js +5 -5
  13. package/dist/sdk/FirmaFeeGrantService.js +3 -3
  14. package/dist/sdk/FirmaGovService.js +7 -7
  15. package/dist/sdk/FirmaIbcService.js +1 -1
  16. package/dist/sdk/FirmaNftService.js +5 -5
  17. package/dist/sdk/FirmaSDK.d.ts +5 -1
  18. package/dist/sdk/FirmaSDK.js +7 -1
  19. package/dist/sdk/FirmaStakingService.d.ts +7 -1
  20. package/dist/sdk/FirmaStakingService.js +16 -8
  21. package/dist/sdk/FirmaTokenService.js +4 -4
  22. package/dist/sdk/FirmaUtil.js +16 -20
  23. package/dist/sdk/FirmaWalletService.js +3 -3
  24. package/dist/sdk/firmachain/amino/addresses.js +11 -11
  25. package/dist/sdk/firmachain/amino/aminotypes.js +32 -36
  26. package/dist/sdk/firmachain/amino/encoding.js +26 -30
  27. package/dist/sdk/firmachain/amino/multisig.js +5 -5
  28. package/dist/sdk/firmachain/amino/signature.js +4 -4
  29. package/dist/sdk/firmachain/amino/signdoc.js +1 -1
  30. package/dist/sdk/firmachain/amino/wallet.js +10 -14
  31. package/dist/sdk/firmachain/authz/AuthzQueryClient.js +3 -3
  32. package/dist/sdk/firmachain/authz/index.js +1 -5
  33. package/dist/sdk/firmachain/bank/BankQueryClient.js +4 -4
  34. package/dist/sdk/firmachain/bank/index.js +1 -5
  35. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +2 -2
  36. package/dist/sdk/firmachain/common/LedgerWallet.js +10 -14
  37. package/dist/sdk/firmachain/common/accounts.js +2 -2
  38. package/dist/sdk/firmachain/common/index.js +1 -5
  39. package/dist/sdk/firmachain/common/signing.js +5 -9
  40. package/dist/sdk/firmachain/common/signingaminostargateclient.js +16 -16
  41. package/dist/sdk/firmachain/common/signingstargateclient.js +14 -18
  42. package/dist/sdk/firmachain/common/stargateclient.js +6 -6
  43. package/dist/sdk/firmachain/contract/ContractQueryClient.js +2 -2
  44. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +4 -4
  45. package/dist/sdk/firmachain/contract/index.js +1 -5
  46. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +8 -8
  47. package/dist/sdk/firmachain/cosmwasm/index.js +1 -5
  48. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +5 -5
  49. package/dist/sdk/firmachain/distribution/index.js +1 -5
  50. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +2 -2
  51. package/dist/sdk/firmachain/feegrant/index.js +1 -5
  52. package/dist/sdk/firmachain/google/protobuf/any.d.ts +1 -1
  53. package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +27 -27
  54. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +1 -1
  55. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +1 -1
  56. package/dist/sdk/firmachain/gov/GovQueryClient.js +2 -2
  57. package/dist/sdk/firmachain/gov/index.js +1 -5
  58. package/dist/sdk/firmachain/ibc/IbcQueryClient.js +1 -1
  59. package/dist/sdk/firmachain/ibc/index.js +1 -5
  60. package/dist/sdk/firmachain/mint/index.js +1 -5
  61. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +6 -6
  62. package/dist/sdk/firmachain/nft/index.js +1 -5
  63. package/dist/sdk/firmachain/slashing/index.js +1 -5
  64. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +3 -3
  65. package/dist/sdk/firmachain/staking/StakingQueryClient.js +13 -13
  66. package/dist/sdk/firmachain/staking/index.js +1 -5
  67. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +8 -8
  68. package/dist/sdk/firmachain/token/index.js +1 -5
  69. package/package.json +24 -24
@@ -15,14 +15,10 @@ 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, 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));
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;
26
22
  };
27
23
  var __values = (this && this.__values) || function(o) {
28
24
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
@@ -47,58 +43,58 @@ function encodeSecp256k1Pubkey(pubkey) {
47
43
  }
48
44
  return {
49
45
  type: pubkeys_1.pubkeyType.secp256k1,
50
- value: (0, encoding_1.toBase64)(pubkey),
46
+ value: encoding_1.toBase64(pubkey),
51
47
  };
52
48
  }
53
49
  exports.encodeSecp256k1Pubkey = encodeSecp256k1Pubkey;
54
50
  // As discussed in https://github.com/binance-chain/javascript-sdk/issues/163
55
51
  // Prefixes listed here: https://github.com/tendermint/tendermint/blob/d419fffe18531317c28c29a292ad7d253f6cafdf/docs/spec/blockchain/encoding.md#public-key-cryptography
56
52
  // Last bytes is varint-encoded length prefix
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 */);
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 */);
60
56
  /** See https://github.com/tendermint/tendermint/commit/38b401657e4ad7a7eeb3c30a3cbf512037df3740 */
61
- var pubkeyAminoPrefixMultisigThreshold = (0, encoding_1.fromHex)("22c1f7e2" /* variable length not included */);
57
+ var pubkeyAminoPrefixMultisigThreshold = encoding_1.fromHex("22c1f7e2" /* variable length not included */);
62
58
  /**
63
59
  * Decodes a pubkey in the Amino binary format to a type/value object.
64
60
  */
65
61
  function decodeAminoPubkey(data) {
66
- if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixSecp256k1)) {
62
+ if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixSecp256k1)) {
67
63
  var rest = data.slice(pubkeyAminoPrefixSecp256k1.length);
68
64
  if (rest.length !== 33) {
69
65
  throw new Error("Invalid rest data length. Expected 33 bytes (compressed secp256k1 pubkey).");
70
66
  }
71
67
  return {
72
68
  type: pubkeys_1.pubkeyType.secp256k1,
73
- value: (0, encoding_1.toBase64)(rest),
69
+ value: encoding_1.toBase64(rest),
74
70
  };
75
71
  }
76
- else if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixEd25519)) {
72
+ else if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixEd25519)) {
77
73
  var rest = data.slice(pubkeyAminoPrefixEd25519.length);
78
74
  if (rest.length !== 32) {
79
75
  throw new Error("Invalid rest data length. Expected 32 bytes (Ed25519 pubkey).");
80
76
  }
81
77
  return {
82
78
  type: pubkeys_1.pubkeyType.ed25519,
83
- value: (0, encoding_1.toBase64)(rest),
79
+ value: encoding_1.toBase64(rest),
84
80
  };
85
81
  }
86
- else if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixSr25519)) {
82
+ else if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixSr25519)) {
87
83
  var rest = data.slice(pubkeyAminoPrefixSr25519.length);
88
84
  if (rest.length !== 32) {
89
85
  throw new Error("Invalid rest data length. Expected 32 bytes (Sr25519 pubkey).");
90
86
  }
91
87
  return {
92
88
  type: pubkeys_1.pubkeyType.sr25519,
93
- value: (0, encoding_1.toBase64)(rest),
89
+ value: encoding_1.toBase64(rest),
94
90
  };
95
91
  }
96
- else if ((0, utils_1.arrayContentStartsWith)(data, pubkeyAminoPrefixMultisigThreshold)) {
92
+ else if (utils_1.arrayContentStartsWith(data, pubkeyAminoPrefixMultisigThreshold)) {
97
93
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
98
94
  return decodeMultisigPubkey(data);
99
95
  }
100
96
  else {
101
- throw new Error("Unsupported public key type. Amino data starts with: " + (0, encoding_1.toHex)(data.slice(0, 5)));
97
+ throw new Error("Unsupported public key type. Amino data starts with: " + encoding_1.toHex(data.slice(0, 5)));
102
98
  }
103
99
  }
104
100
  exports.decodeAminoPubkey = decodeAminoPubkey;
@@ -137,7 +133,7 @@ function decodeMultisigPubkey(data) {
137
133
  var reader = Array.from(data);
138
134
  // remove multisig amino prefix;
139
135
  var prefixFromReader = reader.splice(0, pubkeyAminoPrefixMultisigThreshold.length);
140
- if (!(0, utils_1.arrayContentStartsWith)(prefixFromReader, pubkeyAminoPrefixMultisigThreshold)) {
136
+ if (!utils_1.arrayContentStartsWith(prefixFromReader, pubkeyAminoPrefixMultisigThreshold)) {
141
137
  throw new Error("Invalid multisig prefix.");
142
138
  }
143
139
  // remove 0x08 threshold prefix;
@@ -192,18 +188,18 @@ function encodeUvarint(value) {
192
188
  */
193
189
  function encodeAminoPubkey(pubkey) {
194
190
  var e_1, _a;
195
- if ((0, pubkeys_1.isMultisigThresholdPubkey)(pubkey)) {
191
+ if (pubkeys_1.isMultisigThresholdPubkey(pubkey)) {
196
192
  var out = Array.from(pubkeyAminoPrefixMultisigThreshold);
197
193
  out.push(0x08); // TODO: What is this?
198
194
  out.push.apply(// TODO: What is this?
199
- out, __spreadArray([], __read(encodeUvarint(pubkey.value.threshold)), false));
195
+ out, __spreadArray([], __read(encodeUvarint(pubkey.value.threshold))));
200
196
  try {
201
197
  for (var _b = __values(pubkey.value.pubkeys.map(function (p) { return encodeAminoPubkey(p); })), _c = _b.next(); !_c.done; _c = _b.next()) {
202
198
  var pubkeyData = _c.value;
203
199
  out.push(0x12); // TODO: What is this?
204
200
  out.push.apply(// TODO: What is this?
205
- out, __spreadArray([], __read(encodeUvarint(pubkeyData.length)), false));
206
- out.push.apply(out, __spreadArray([], __read(pubkeyData), false));
201
+ out, __spreadArray([], __read(encodeUvarint(pubkeyData.length))));
202
+ out.push.apply(out, __spreadArray([], __read(pubkeyData)));
207
203
  }
208
204
  }
209
205
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -215,11 +211,11 @@ function encodeAminoPubkey(pubkey) {
215
211
  }
216
212
  return new Uint8Array(out);
217
213
  }
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));
214
+ else if (pubkeys_1.isEd25519Pubkey(pubkey)) {
215
+ return new Uint8Array(__spreadArray(__spreadArray([], __read(pubkeyAminoPrefixEd25519)), __read(encoding_1.fromBase64(pubkey.value))));
220
216
  }
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));
217
+ else if (pubkeys_1.isSecp256k1Pubkey(pubkey)) {
218
+ return new Uint8Array(__spreadArray(__spreadArray([], __read(pubkeyAminoPrefixSecp256k1)), __read(encoding_1.fromBase64(pubkey.value))));
223
219
  }
224
220
  else {
225
221
  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 = (0, encoding_1.toHex)(a);
16
- var bHex = (0, encoding_1.toHex)(b);
15
+ var aHex = encoding_1.toHex(a);
16
+ var bHex = 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 = ".concat(uintThreshold.toNumber(), " exceeds number of keys n = ").concat(pubkeys.length));
24
+ throw new Error("Threshold k = " + uintThreshold.toNumber() + " exceeds number of keys n = " + 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 = (0, addresses_1.pubkeyToRawAddress)(lhs);
31
- var addressRhs = (0, addresses_1.pubkeyToRawAddress)(rhs);
30
+ var addressLhs = addresses_1.pubkeyToRawAddress(lhs);
31
+ var addressRhs = 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: (0, encoding_2.encodeSecp256k1Pubkey)(pubkey),
20
- signature: (0, encoding_1.toBase64)(signature),
19
+ pub_key: encoding_2.encodeSecp256k1Pubkey(pubkey),
20
+ signature: 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: (0, encoding_1.fromBase64)(signature.pub_key.value),
30
- signature: (0, encoding_1.fromBase64)(signature.signature),
29
+ pubkey: encoding_1.fromBase64(signature.pub_key.value),
30
+ signature: 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 (0, encoding_1.toUtf8)(sortedJsonStringify(signDoc));
40
+ return encoding_1.toUtf8(sortedJsonStringify(signDoc));
41
41
  }
42
42
  exports.serializeSignDoc = serializeSignDoc;
@@ -51,14 +51,10 @@ 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, 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));
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;
62
58
  };
63
59
  Object.defineProperty(exports, "__esModule", { value: true });
64
60
  exports.decrypt = exports.encrypt = exports.supportedAlgorithms = exports.executeKdf = exports.cosmjsSalt = void 0;
@@ -69,7 +65,7 @@ var encoding_1 = require("@cosmjs/encoding");
69
65
  * This reduces the scope of a potential rainbow attack to all CosmJS users.
70
66
  * Must be 16 bytes due to implementation limitations.
71
67
  */
72
- exports.cosmjsSalt = (0, encoding_1.toAscii)("The CosmJS salt.");
68
+ exports.cosmjsSalt = encoding_1.toAscii("The CosmJS salt.");
73
69
  function executeKdf(password, configuration) {
74
70
  return __awaiter(this, void 0, void 0, function () {
75
71
  var options;
@@ -77,7 +73,7 @@ function executeKdf(password, configuration) {
77
73
  switch (configuration.algorithm) {
78
74
  case "argon2id": {
79
75
  options = configuration.params;
80
- if (!(0, crypto_1.isArgon2idOptions)(options))
76
+ if (!crypto_1.isArgon2idOptions(options))
81
77
  throw new Error("Invalid format of argon2id params");
82
78
  return [2 /*return*/, crypto_1.Argon2id.execute(password, exports.cosmjsSalt, options)];
83
79
  }
@@ -106,12 +102,12 @@ function encrypt(plaintext, encryptionKey, config) {
106
102
  case 1:
107
103
  nonce = crypto_1.Random.getBytes(crypto_1.xchacha20NonceLength);
108
104
  _b = Uint8Array.bind;
109
- _c = [__spreadArray([], __read(nonce), false)];
105
+ _c = [__spreadArray([], __read(nonce))];
110
106
  return [4 /*yield*/, crypto_1.Xchacha20poly1305Ietf.encrypt(plaintext, encryptionKey, nonce)];
111
107
  case 2:
112
108
  // Prepend fixed-length nonce to ciphertext as suggested in the example from https://github.com/jedisct1/libsodium.js#api
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, "'"));
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 + "'");
115
111
  }
116
112
  });
117
113
  });
@@ -127,7 +123,7 @@ function decrypt(ciphertext, encryptionKey, config) {
127
123
  return [2 /*return*/, crypto_1.Xchacha20poly1305Ietf.decrypt(ciphertext.slice(crypto_1.xchacha20NonceLength), encryptionKey, nonce)];
128
124
  }
129
125
  default:
130
- throw new Error("Unsupported encryption algorithm: '".concat(config.algorithm, "'"));
126
+ throw new Error("Unsupported encryption algorithm: '" + config.algorithm + "'");
131
127
  }
132
128
  return [2 /*return*/];
133
129
  });
@@ -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=".concat(granterAddress, "&grantee=").concat(granteeAddress, "&msg_type_url=").concat(msgType);
63
+ path = "/cosmos/authz/v1beta1/grants?granter=" + granterAddress + "&grantee=" + granteeAddress + "&msg_type_url=" + 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=".concat(granterAddress, "&grantee=").concat(granteeAddress, "&msg_type_url=").concat(msgType);
87
+ path = "/cosmos/authz/v1beta1/grants?granter=" + granterAddress + "&grantee=" + granteeAddress + "&msg_type_url=" + 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=".concat(granterAddress, "&grantee=").concat(granteeAddress, "&msg_type_url=").concat(msgType);
123
+ path = "/cosmos/authz/v1beta1/grants?granter=" + granterAddress + "&grantee=" + granteeAddress + "&msg_type_url=" + msgType;
124
124
  return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
125
125
  case 1:
126
126
  result = _a.sent();
@@ -1,11 +1,7 @@
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
- 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);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  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/".concat(denom);
60
+ path = "/cosmos/bank/v1beta1/supply/" + 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/".concat(address, "/by_denom?denom=").concat(denom);
75
+ path = "/cosmos/bank/v1beta1/balances/" + address + "/by_denom?denom=" + 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/".concat(address);
90
+ path = "/cosmos/bank/v1beta1/balances/" + 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/".concat(address, "/by_denom?denom=").concat(denom);
105
+ path = "/cosmos/bank/v1beta1/balances/" + address + "/by_denom?denom=" + denom;
106
106
  return [4 /*yield*/, this.axios.get(path)];
107
107
  case 1:
108
108
  result = _a.sent();
@@ -1,11 +1,7 @@
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
- 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);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -135,7 +135,7 @@ var LedgerSigningStargateClient = /** @class */ (function (_super) {
135
135
  case 0:
136
136
  _a.trys.push([0, 2, , 3]);
137
137
  accAddress = this.toAccAddress(address);
138
- hexAccAddress = "0x01".concat(Buffer.from(accAddress).toString("hex"));
138
+ hexAccAddress = "0x01" + Buffer.from(accAddress).toString("hex");
139
139
  axios = axios_1.default.create({
140
140
  baseURL: LedgerSigningStargateClient._endpoint,
141
141
  headers: {
@@ -149,7 +149,7 @@ var LedgerSigningStargateClient = /** @class */ (function (_super) {
149
149
  result = _a.sent();
150
150
  finalData = result.data.result.response.value;
151
151
  account = any_1.Any.decode(Buffer.from(finalData, "base64"));
152
- finalAccount = (0, accounts_1.accountFromAny)(account);
152
+ finalAccount = accounts_1.accountFromAny(account);
153
153
  return [2 /*return*/, finalAccount];
154
154
  case 2:
155
155
  error_1 = _a.sent();
@@ -51,14 +51,10 @@ 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, 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));
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;
62
58
  };
63
59
  var __importDefault = (this && this.__importDefault) || function (mod) {
64
60
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -95,7 +91,7 @@ function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
95
91
  var authInfo = {
96
92
  signerInfos: makeSignerInfos(signers, signMode),
97
93
  fee: {
98
- amount: __spreadArray([], __read(feeAmount), false),
94
+ amount: __spreadArray([], __read(feeAmount)),
99
95
  gasLimit: long_1.default.fromNumber(gasLimit),
100
96
  granter: granter,
101
97
  },
@@ -113,7 +109,7 @@ function signFromLedger(ledger, messages, option, registry) {
113
109
  return [4 /*yield*/, FirmaUtil_1.FirmaUtil.getSignerDataForLedger(address)];
114
110
  case 2:
115
111
  signerData = _b.sent();
116
- pubkey = (0, proto_signing_1.encodePubkey)((0, encoding_2.encodeSecp256k1Pubkey)(publicKey));
112
+ pubkey = proto_signing_1.encodePubkey(encoding_2.encodeSecp256k1Pubkey(publicKey));
117
113
  aminoTypes = new aminotypes_1.AminoTypes({});
118
114
  msgs = messages.map(function (msg) { return aminoTypes.toAmino(msg); });
119
115
  chainId = signerData.chain_id;
@@ -121,9 +117,9 @@ function signFromLedger(ledger, messages, option, registry) {
121
117
  sequence = Number.parseInt(signerData.sequence);
122
118
  memo = option.memo;
123
119
  fee = { amount: option.fee.amount, gas: option.fee.gas };
124
- signDoc = (0, signdoc_2.makeSignDoc)(msgs, fee, chainId, memo, accountNumber, sequence);
125
- signMessage = (0, signdoc_1.serializeSignDoc)(signDoc);
126
- return [4 /*yield*/, ledger.sign((0, encoding_3.fromUtf8)(signMessage))];
120
+ signDoc = signdoc_2.makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence);
121
+ signMessage = signdoc_1.serializeSignDoc(signDoc);
122
+ return [4 /*yield*/, ledger.sign(encoding_3.fromUtf8(signMessage))];
127
123
  case 3:
128
124
  ledgerSignature = _b.sent();
129
125
  ;
@@ -141,7 +137,7 @@ function signFromLedger(ledger, messages, option, registry) {
141
137
  txRaw = tx_2.TxRaw.fromPartial({
142
138
  bodyBytes: signedTxBodyBytes,
143
139
  authInfoBytes: signedAuthInfoBytes,
144
- signatures: [(0, encoding_1.fromBase64)(Buffer.from(ledgerSignature).toString('base64'))],
140
+ signatures: [encoding_1.fromBase64(Buffer.from(ledgerSignature).toString('base64'))],
145
141
  });
146
142
  return [2 /*return*/, txRaw];
147
143
  }
@@ -10,7 +10,7 @@ function uint64FromProto(input) {
10
10
  }
11
11
  function accountFromBaseAccount(input) {
12
12
  var address = input.address, pubKey = input.pubKey, accountNumber = input.accountNumber, sequence = input.sequence;
13
- var pubkey = (0, proto_signing_1.decodePubkey)(pubKey);
13
+ var pubkey = proto_signing_1.decodePubkey(pubKey);
14
14
  return {
15
15
  address: address,
16
16
  pubkey: pubkey,
@@ -58,7 +58,7 @@ function accountFromAny(input) {
58
58
  return accountFromBaseAccount(baseAccount);
59
59
  }
60
60
  default:
61
- throw new Error("Unsupported type: '".concat(typeUrl, "'"));
61
+ throw new Error("Unsupported type: '" + typeUrl + "'");
62
62
  }
63
63
  }
64
64
  exports.accountFromAny = accountFromAny;
@@ -1,11 +1,7 @@
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
- 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);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -15,14 +15,10 @@ 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, 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));
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;
26
22
  };
27
23
  var __importDefault = (this && this.__importDefault) || function (mod) {
28
24
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -49,7 +45,7 @@ function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
49
45
  var authInfo = {
50
46
  signerInfos: makeSignerInfos(signers, signMode),
51
47
  fee: {
52
- amount: __spreadArray([], __read(feeAmount), false),
48
+ amount: __spreadArray([], __read(feeAmount)),
53
49
  gasLimit: long_1.default.fromNumber(gasLimit),
54
50
  granter: granter,
55
51
  },
@@ -77,7 +77,7 @@ function isMsgSignData(msg) {
77
77
  var castedMsg = msg;
78
78
  if (castedMsg.type !== "sign/MsgSignData")
79
79
  return false;
80
- if (!(0, utils_1.isNonNullObject)(castedMsg.value))
80
+ if (!utils_1.isNonNullObject(castedMsg.value))
81
81
  return false;
82
82
  if (typeof castedMsg.value.signer !== "string")
83
83
  return false;
@@ -128,7 +128,7 @@ var SigningAminoStargateClient = /** @class */ (function (_super) {
128
128
  type: "sign/MsgSignData",
129
129
  value: {
130
130
  signer: signerAddress,
131
- data: (0, encoding_1.toBase64)(d),
131
+ data: encoding_1.toBase64(d),
132
132
  },
133
133
  }); });
134
134
  return [4 /*yield*/, this.signer.getAccounts()];
@@ -137,15 +137,15 @@ var SigningAminoStargateClient = /** @class */ (function (_super) {
137
137
  if (!accountFromSigner) {
138
138
  throw new Error("Failed to retrieve account from signer");
139
139
  }
140
- signDoc = (0, amino_1.makeSignDoc)(msgs, fee, chainId, memo, accountNumber, sequence);
140
+ signDoc = amino_1.makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence);
141
141
  return [4 /*yield*/, this.signer.signAmino(signerAddress, signDoc)];
142
142
  case 2:
143
143
  _a = _b.sent(), signature = _a.signature, signed = _a.signed;
144
- if (!(0, fast_deep_equal_1.default)(signDoc, signed)) {
144
+ if (!fast_deep_equal_1.default(signDoc, signed)) {
145
145
  throw new Error("The signed document differs from the signing instruction. This is not supported for ADR-036.");
146
146
  }
147
- signatureResult = (0, tx_1.makeStdTx)(signDoc, signature);
148
- decodeData = (0, amino_1.decodeSignature)(signatureResult.signatures[0]);
147
+ signatureResult = tx_1.makeStdTx(signDoc, signature);
148
+ decodeData = amino_1.decodeSignature(signatureResult.signatures[0]);
149
149
  jsonData = {
150
150
  type: "sign/MsgSignData",
151
151
  signer: signatureResult.msg[0].value.signer,
@@ -164,7 +164,7 @@ var SigningAminoStargateClient = /** @class */ (function (_super) {
164
164
  return __generator(this, function (_a) {
165
165
  switch (_a.label) {
166
166
  case 0:
167
- newSignature = (0, amino_1.encodeSecp256k1Signature)(FirmaUtil_1.FirmaUtil.base64ToArrayBuffer(data.pubkey), FirmaUtil_1.FirmaUtil.base64ToArrayBuffer(data.signature));
167
+ newSignature = amino_1.encodeSecp256k1Signature(FirmaUtil_1.FirmaUtil.base64ToArrayBuffer(data.pubkey), FirmaUtil_1.FirmaUtil.base64ToArrayBuffer(data.signature));
168
168
  signed = {
169
169
  fee: {
170
170
  gas: "0",
@@ -202,15 +202,15 @@ var SigningAminoStargateClient = /** @class */ (function (_super) {
202
202
  if (signatures.length !== 1)
203
203
  throw new Error("Must have exactly one signature to be supported.");
204
204
  signature = signatures[0];
205
- if (!(0, amino_2.isSecp256k1Pubkey)(signature.pub_key)) {
205
+ if (!amino_2.isSecp256k1Pubkey(signature.pub_key)) {
206
206
  throw new Error("Only secp256k1 signatures are supported.");
207
207
  }
208
- signBytes = (0, amino_2.serializeSignDoc)((0, amino_1.makeSignDoc)(signed.msg, signed.fee, chainId, signed.memo, accountNumber, sequence));
209
- prehashed = (0, crypto_1.sha256)(signBytes);
210
- secpSignature = crypto_2.Secp256k1Signature.fromFixedLength((0, encoding_2.fromBase64)(signature.signature));
211
- rawSecp256k1Pubkey = (0, encoding_2.fromBase64)(signature.pub_key.value);
212
- rawSignerAddress = (0, amino_3.rawSecp256k1PubkeyToRawAddress)(rawSecp256k1Pubkey);
213
- if (signedMessages.some(function (msg) { return !(0, utils_2.arrayContentEquals)(encoding_1.Bech32.decode(msg.value.signer).data, rawSignerAddress); })) {
208
+ signBytes = amino_2.serializeSignDoc(amino_1.makeSignDoc(signed.msg, signed.fee, chainId, signed.memo, accountNumber, sequence));
209
+ prehashed = crypto_1.sha256(signBytes);
210
+ secpSignature = crypto_2.Secp256k1Signature.fromFixedLength(encoding_2.fromBase64(signature.signature));
211
+ rawSecp256k1Pubkey = encoding_2.fromBase64(signature.pub_key.value);
212
+ rawSignerAddress = amino_3.rawSecp256k1PubkeyToRawAddress(rawSecp256k1Pubkey);
213
+ if (signedMessages.some(function (msg) { return !utils_2.arrayContentEquals(encoding_1.Bech32.decode(msg.value.signer).data, rawSignerAddress); })) {
214
214
  throw new Error("Found mismatch between signer in message and public key");
215
215
  }
216
216
  return [4 /*yield*/, crypto_2.Secp256k1.verifySignature(secpSignature, prehashed, rawSecp256k1Pubkey)];
@@ -237,7 +237,7 @@ var SigningAminoStargateClient = /** @class */ (function (_super) {
237
237
  case 0:
238
238
  _a.trys.push([0, 2, , 3]);
239
239
  accAddress = this.toAccAddress(address);
240
- hexAccAddress = "0x01".concat(Buffer.from(accAddress).toString("hex"));
240
+ hexAccAddress = "0x01" + Buffer.from(accAddress).toString("hex");
241
241
  axios = axios_1.default.create({
242
242
  baseURL: SigningAminoStargateClient._endpoint,
243
243
  headers: {
@@ -251,7 +251,7 @@ var SigningAminoStargateClient = /** @class */ (function (_super) {
251
251
  result = _a.sent();
252
252
  finalData = result.data.result.response.value;
253
253
  account = any_1.Any.decode(Buffer.from(finalData, "base64"));
254
- finalAccount = (0, accounts_1.accountFromAny)(account);
254
+ finalAccount = accounts_1.accountFromAny(account);
255
255
  return [2 /*return*/, finalAccount];
256
256
  case 2:
257
257
  error_1 = _a.sent();