@firmachain/firma-js 0.2.33 → 0.2.36

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 (63) 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.d.ts +1 -0
  5. package/dist/sdk/FirmaContractService.js +31 -8
  6. package/dist/sdk/FirmaCosmWasmService.js +9 -9
  7. package/dist/sdk/FirmaDistributionService.js +5 -5
  8. package/dist/sdk/FirmaFeeGrantService.js +3 -3
  9. package/dist/sdk/FirmaGovService.js +7 -7
  10. package/dist/sdk/FirmaIbcService.js +1 -1
  11. package/dist/sdk/FirmaIpfsService.js +1 -1
  12. package/dist/sdk/FirmaNftService.js +3 -3
  13. package/dist/sdk/FirmaStakingService.js +5 -5
  14. package/dist/sdk/FirmaTokenService.js +4 -4
  15. package/dist/sdk/FirmaUtil.d.ts +4 -2
  16. package/dist/sdk/FirmaUtil.js +19 -14
  17. package/dist/sdk/FirmaWalletService.js +3 -3
  18. package/dist/sdk/firmachain/amino/addresses.js +11 -11
  19. package/dist/sdk/firmachain/amino/aminotypes.js +36 -32
  20. package/dist/sdk/firmachain/amino/encoding.js +30 -26
  21. package/dist/sdk/firmachain/amino/multisig.js +5 -5
  22. package/dist/sdk/firmachain/amino/signature.js +4 -4
  23. package/dist/sdk/firmachain/amino/signdoc.js +1 -1
  24. package/dist/sdk/firmachain/amino/wallet.js +14 -10
  25. package/dist/sdk/firmachain/authz/AuthzQueryClient.js +3 -3
  26. package/dist/sdk/firmachain/authz/index.js +5 -1
  27. package/dist/sdk/firmachain/bank/BankQueryClient.js +4 -4
  28. package/dist/sdk/firmachain/bank/index.js +5 -1
  29. package/dist/sdk/firmachain/common/CommonTxClient.d.ts +7 -0
  30. package/dist/sdk/firmachain/common/CommonTxClient.js +79 -0
  31. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +2 -2
  32. package/dist/sdk/firmachain/common/LedgerWallet.js +14 -10
  33. package/dist/sdk/firmachain/common/accounts.js +2 -2
  34. package/dist/sdk/firmachain/common/index.js +5 -1
  35. package/dist/sdk/firmachain/common/signing.js +9 -5
  36. package/dist/sdk/firmachain/common/signingaminostargateclient.js +16 -16
  37. package/dist/sdk/firmachain/common/signingstargateclient.js +18 -14
  38. package/dist/sdk/firmachain/common/stargateclient.js +6 -6
  39. package/dist/sdk/firmachain/contract/ContractQueryClient.js +2 -2
  40. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +4 -4
  41. package/dist/sdk/firmachain/contract/index.js +5 -1
  42. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +7 -7
  43. package/dist/sdk/firmachain/cosmwasm/index.js +5 -1
  44. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +5 -5
  45. package/dist/sdk/firmachain/distribution/index.js +5 -1
  46. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +2 -2
  47. package/dist/sdk/firmachain/feegrant/index.js +5 -1
  48. package/dist/sdk/firmachain/google/protobuf/any.d.ts +1 -1
  49. package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +27 -27
  50. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +1 -1
  51. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +1 -1
  52. package/dist/sdk/firmachain/gov/GovQueryClient.js +2 -2
  53. package/dist/sdk/firmachain/gov/index.js +5 -1
  54. package/dist/sdk/firmachain/ibc/IbcQueryClient.js +1 -1
  55. package/dist/sdk/firmachain/ibc/index.js +5 -1
  56. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +6 -6
  57. package/dist/sdk/firmachain/nft/index.js +5 -1
  58. package/dist/sdk/firmachain/slashing/index.js +5 -1
  59. package/dist/sdk/firmachain/staking/StakingQueryClient.js +8 -8
  60. package/dist/sdk/firmachain/staking/index.js +5 -1
  61. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +8 -8
  62. package/dist/sdk/firmachain/token/index.js +5 -1
  63. package/package.json +1 -1
@@ -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
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.CommonTxClient = void 0;
19
+ var proto_signing_1 = require("@cosmjs/proto-signing");
20
+ var tx_1 = require("cosmjs-types/cosmos/bank/v1beta1/tx");
21
+ var tx_2 = require("cosmjs-types/cosmos/distribution/v1beta1/tx");
22
+ var tx_3 = require("cosmjs-types/cosmos/gov/v1beta1/tx");
23
+ var tx_4 = require("cosmjs-types/cosmos/staking/v1beta1/tx");
24
+ var tx_5 = require("cosmjs-types/cosmwasm/wasm/v1/tx");
25
+ var AuthzTxTypes_1 = require("../authz/AuthzTxTypes");
26
+ var ContractTxTypes_1 = require("../contract/ContractTxTypes");
27
+ var FeeGrantTxTypes_1 = require("../feegrant/FeeGrantTxTypes");
28
+ var NftTxTypes_1 = require("../nft/NftTxTypes");
29
+ var TokenTxTypes_1 = require("../token/TokenTxTypes");
30
+ var ITxClient_1 = require("./ITxClient");
31
+ var types = [
32
+ ["/cosmos.authz.v1beta1.MsgExec", AuthzTxTypes_1.MsgExec],
33
+ ["/cosmos.authz.v1beta1.MsgGrant", AuthzTxTypes_1.MsgGrant],
34
+ ["/cosmos.authz.v1beta1.MsgRevoke", AuthzTxTypes_1.MsgRevoke],
35
+ ["/cosmos.bank.v1beta1.MsgSend", tx_1.MsgSend],
36
+ ["/cosmos.bank.v1beta1.MsgMultiSend", tx_1.MsgMultiSend],
37
+ ["/firmachain.firmachain.contract.MsgCreateContractFile", ContractTxTypes_1.MsgCreateContractFile],
38
+ ["/firmachain.firmachain.contract.MsgAddContractLog", ContractTxTypes_1.MsgAddContractLog],
39
+ ["/cosmwasm.wasm.v1.MsgStoreCode", tx_5.MsgStoreCode],
40
+ ["/cosmwasm.wasm.v1.MsgInstantiateContract", tx_5.MsgInstantiateContract],
41
+ ["/cosmwasm.wasm.v1.MsgExecuteContract", tx_5.MsgExecuteContract],
42
+ ["/cosmwasm.wasm.v1.MsgUpdateAdmin", tx_5.MsgUpdateAdmin],
43
+ ["/cosmwasm.wasm.v1.MsgClearAdmin", tx_5.MsgClearAdmin],
44
+ ["/cosmwasm.wasm.v1.MsgMigrateContract", tx_5.MsgMigrateContract],
45
+ ["/cosmos.distribution.v1beta1.MsgFundCommunityPool", tx_2.MsgFundCommunityPool],
46
+ ["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", tx_2.MsgSetWithdrawAddress],
47
+ ["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", tx_2.MsgWithdrawDelegatorReward],
48
+ ["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", tx_2.MsgWithdrawValidatorCommission],
49
+ ["/cosmos.feegrant.v1beta1.MsgGrantAllowance", FeeGrantTxTypes_1.MsgGrantAllowance],
50
+ ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", FeeGrantTxTypes_1.MsgRevokeAllowance],
51
+ ["/cosmos.gov.v1beta1.MsgDeposit", tx_3.MsgDeposit],
52
+ ["/cosmos.gov.v1beta1.MsgSubmitProposal", tx_3.MsgSubmitProposal],
53
+ ["/cosmos.gov.v1beta1.MsgVote", tx_3.MsgVote],
54
+ ["/ibc.applications.transfer.v1.MsgTransfer", NftTxTypes_1.MsgTransfer],
55
+ ["/firmachain.firmachain.nft.MsgTransfer", NftTxTypes_1.MsgTransfer],
56
+ ["/firmachain.firmachain.nft.MsgMint", NftTxTypes_1.MsgMint],
57
+ ["/firmachain.firmachain.nft.MsgBurn", NftTxTypes_1.MsgBurn],
58
+ ["/cosmos.staking.v1beta1.MsgDelegate", tx_4.MsgDelegate],
59
+ ["/cosmos.staking.v1beta1.MsgUndelegate", tx_4.MsgUndelegate],
60
+ ["/cosmos.staking.v1beta1.MsgBeginRedelegate", tx_4.MsgBeginRedelegate],
61
+ ["/cosmos.staking.v1beta1.MsgEditValidator", tx_4.MsgEditValidator],
62
+ ["/cosmos.staking.v1beta1.MsgCreateValidator", tx_4.MsgCreateValidator],
63
+ ["/firmachain.firmachain.token.MsgCreateToken", TokenTxTypes_1.MsgCreateToken],
64
+ ["/firmachain.firmachain.token.MsgUpdateTokenURI", TokenTxTypes_1.MsgUpdateTokenURI],
65
+ ["/firmachain.firmachain.token.MsgMint", NftTxTypes_1.MsgMint],
66
+ ["/firmachain.firmachain.token.MsgBurn", NftTxTypes_1.MsgBurn]
67
+ ];
68
+ var registry = new proto_signing_1.Registry(types);
69
+ var CommonTxClient = /** @class */ (function (_super) {
70
+ __extends(CommonTxClient, _super);
71
+ function CommonTxClient(wallet, address) {
72
+ return _super.call(this, wallet, address, registry) || this;
73
+ }
74
+ CommonTxClient.getRegistry = function () {
75
+ return registry;
76
+ };
77
+ return CommonTxClient;
78
+ }(ITxClient_1.ITxClient));
79
+ exports.CommonTxClient = CommonTxClient;
@@ -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" + Buffer.from(accAddress).toString("hex");
138
+ hexAccAddress = "0x01".concat(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 = accounts_1.accountFromAny(account);
152
+ finalAccount = (0, accounts_1.accountFromAny)(account);
153
153
  return [2 /*return*/, finalAccount];
154
154
  case 2:
155
155
  error_1 = _a.sent();
@@ -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
  var __importDefault = (this && this.__importDefault) || function (mod) {
60
64
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -91,7 +95,7 @@ function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
91
95
  var authInfo = {
92
96
  signerInfos: makeSignerInfos(signers, signMode),
93
97
  fee: {
94
- amount: __spreadArray([], __read(feeAmount)),
98
+ amount: __spreadArray([], __read(feeAmount), false),
95
99
  gasLimit: long_1.default.fromNumber(gasLimit),
96
100
  granter: granter,
97
101
  },
@@ -109,7 +113,7 @@ function signFromLedger(ledger, messages, option, registry) {
109
113
  return [4 /*yield*/, FirmaUtil_1.FirmaUtil.getSignerDataForLedger(address)];
110
114
  case 2:
111
115
  signerData = _b.sent();
112
- pubkey = proto_signing_1.encodePubkey(encoding_2.encodeSecp256k1Pubkey(publicKey));
116
+ pubkey = (0, proto_signing_1.encodePubkey)((0, encoding_2.encodeSecp256k1Pubkey)(publicKey));
113
117
  aminoTypes = new aminotypes_1.AminoTypes({});
114
118
  msgs = messages.map(function (msg) { return aminoTypes.toAmino(msg); });
115
119
  chainId = signerData.chain_id;
@@ -117,9 +121,9 @@ function signFromLedger(ledger, messages, option, registry) {
117
121
  sequence = Number.parseInt(signerData.sequence);
118
122
  memo = option.memo;
119
123
  fee = { amount: option.fee.amount, gas: option.fee.gas };
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))];
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))];
123
127
  case 3:
124
128
  ledgerSignature = _b.sent();
125
129
  ;
@@ -137,7 +141,7 @@ function signFromLedger(ledger, messages, option, registry) {
137
141
  txRaw = tx_2.TxRaw.fromPartial({
138
142
  bodyBytes: signedTxBodyBytes,
139
143
  authInfoBytes: signedAuthInfoBytes,
140
- signatures: [encoding_1.fromBase64(Buffer.from(ledgerSignature).toString('base64'))],
144
+ signatures: [(0, encoding_1.fromBase64)(Buffer.from(ledgerSignature).toString('base64'))],
141
145
  });
142
146
  return [2 /*return*/, txRaw];
143
147
  }
@@ -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 = proto_signing_1.decodePubkey(pubKey);
13
+ var pubkey = (0, 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: '" + typeUrl + "'");
61
+ throw new Error("Unsupported type: '".concat(typeUrl, "'"));
62
62
  }
63
63
  }
64
64
  exports.accountFromAny = accountFromAny;
@@ -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];
@@ -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 __importDefault = (this && this.__importDefault) || function (mod) {
24
28
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -45,7 +49,7 @@ function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, signMode) {
45
49
  var authInfo = {
46
50
  signerInfos: makeSignerInfos(signers, signMode),
47
51
  fee: {
48
- amount: __spreadArray([], __read(feeAmount)),
52
+ amount: __spreadArray([], __read(feeAmount), false),
49
53
  gasLimit: long_1.default.fromNumber(gasLimit),
50
54
  granter: granter,
51
55
  },
@@ -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 (!utils_1.isNonNullObject(castedMsg.value))
80
+ if (!(0, 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: encoding_1.toBase64(d),
131
+ data: (0, 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 = amino_1.makeSignDoc(msgs, fee, chainId, memo, accountNumber, sequence);
140
+ signDoc = (0, 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 (!fast_deep_equal_1.default(signDoc, signed)) {
144
+ if (!(0, 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 = tx_1.makeStdTx(signDoc, signature);
148
- decodeData = amino_1.decodeSignature(signatureResult.signatures[0]);
147
+ signatureResult = (0, tx_1.makeStdTx)(signDoc, signature);
148
+ decodeData = (0, 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 = amino_1.encodeSecp256k1Signature(FirmaUtil_1.FirmaUtil.base64ToArrayBuffer(data.pubkey), FirmaUtil_1.FirmaUtil.base64ToArrayBuffer(data.signature));
167
+ newSignature = (0, 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 (!amino_2.isSecp256k1Pubkey(signature.pub_key)) {
205
+ if (!(0, amino_2.isSecp256k1Pubkey)(signature.pub_key)) {
206
206
  throw new Error("Only secp256k1 signatures are supported.");
207
207
  }
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); })) {
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); })) {
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" + Buffer.from(accAddress).toString("hex");
240
+ hexAccAddress = "0x01".concat(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 = accounts_1.accountFromAny(account);
254
+ finalAccount = (0, accounts_1.accountFromAny)(account);
255
255
  return [2 /*return*/, finalAccount];
256
256
  case 2:
257
257
  error_1 = _a.sent();
@@ -66,10 +66,14 @@ var __read = (this && this.__read) || function (o, n) {
66
66
  }
67
67
  return ar;
68
68
  };
69
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
70
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
71
- to[j] = from[i];
72
- return to;
69
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
70
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
71
+ if (ar || !(i in from)) {
72
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
73
+ ar[i] = from[i];
74
+ }
75
+ }
76
+ return to.concat(ar || Array.prototype.slice.call(from));
73
77
  };
74
78
  var __importDefault = (this && this.__importDefault) || function (mod) {
75
79
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -145,8 +149,8 @@ var SigningStargateClient = /** @class */ (function (_super) {
145
149
  account = _b.sent();
146
150
  if (account == null)
147
151
  throw new Error("Failed to retrieve account from signer");
148
- rawSecp256k1Pubkey = encoding_1.fromBase64(account.pubkey.value);
149
- pubkey = proto_signing_1.encodePubkey(encoding_3.encodeSecp256k1Pubkey(rawSecp256k1Pubkey));
152
+ rawSecp256k1Pubkey = (0, encoding_1.fromBase64)(account.pubkey.value);
153
+ pubkey = (0, proto_signing_1.encodePubkey)((0, encoding_3.encodeSecp256k1Pubkey)(rawSecp256k1Pubkey));
150
154
  txBodyEncodeObject = {
151
155
  typeUrl: "/cosmos.tx.v1beta1.TxBody",
152
156
  value: {
@@ -157,7 +161,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
157
161
  txBodyBytes = registry.encode(txBodyEncodeObject);
158
162
  gasLimit = math_1.Int53.fromString(fee.gas).toNumber();
159
163
  authInfoBytes = this.makeAuthInfoBytes([{ pubkey: pubkey, sequence: sequence }], fee.amount, gasLimit, fee.granter);
160
- return [2 /*return*/, proto_signing_1.makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber)];
164
+ return [2 /*return*/, (0, proto_signing_1.makeSignDoc)(txBodyBytes, authInfoBytes, chainId, accountNumber)];
161
165
  }
162
166
  });
163
167
  });
@@ -224,7 +228,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
224
228
  case 0:
225
229
  _a.trys.push([0, 2, , 3]);
226
230
  accAddress = this.toAccAddress(address);
227
- hexAccAddress = "0x01" + Buffer.from(accAddress).toString("hex");
231
+ hexAccAddress = "0x01".concat(Buffer.from(accAddress).toString("hex"));
228
232
  axios = axios_1.default.create({
229
233
  baseURL: SigningStargateClient._endpoint,
230
234
  headers: {
@@ -238,7 +242,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
238
242
  result = _a.sent();
239
243
  finalData = result.data.result.response.value;
240
244
  account = any_1.Any.decode(Buffer.from(finalData, "base64"));
241
- finalAccount = accounts_1.accountFromAny(account);
245
+ finalAccount = (0, accounts_1.accountFromAny)(account);
242
246
  return [2 /*return*/, finalAccount];
243
247
  case 2:
244
248
  error_1 = _a.sent();
@@ -284,7 +288,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
284
288
  var authInfo = {
285
289
  signerInfos: this.makeSignerInfos(signers, signMode),
286
290
  fee: {
287
- amount: __spreadArray([], __read(feeAmount)),
291
+ amount: __spreadArray([], __read(feeAmount), false),
288
292
  gasLimit: long_1.default.fromNumber(gasLimit),
289
293
  granter: granter,
290
294
  },
@@ -303,7 +307,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
303
307
  if (!accountFromSigner) {
304
308
  throw new Error("Failed to retrieve account from signer");
305
309
  }
306
- pubkey = proto_signing_1.encodePubkey(encoding_3.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
310
+ pubkey = (0, proto_signing_1.encodePubkey)((0, encoding_3.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
307
311
  txBodyEncodeObject = {
308
312
  typeUrl: "/cosmos.tx.v1beta1.TxBody",
309
313
  value: {
@@ -314,14 +318,14 @@ var SigningStargateClient = /** @class */ (function (_super) {
314
318
  txBodyBytes = this.registry.encode(txBodyEncodeObject);
315
319
  gasLimit = math_1.Int53.fromString(fee.gas).toNumber();
316
320
  authInfoBytes = SigningStargateClient.makeAuthInfoBytes([{ pubkey: pubkey, sequence: sequence }], fee.amount, gasLimit, fee.granter);
317
- signDoc = proto_signing_1.makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
321
+ signDoc = (0, proto_signing_1.makeSignDoc)(txBodyBytes, authInfoBytes, chainId, accountNumber);
318
322
  return [4 /*yield*/, this.getSigner().signDirect(signerAddress, signDoc)];
319
323
  case 2:
320
324
  _b = _c.sent(), signature = _b.signature, signed = _b.signed;
321
325
  return [2 /*return*/, tx_1.TxRaw.fromPartial({
322
326
  bodyBytes: signed.bodyBytes,
323
327
  authInfoBytes: signed.authInfoBytes,
324
- signatures: [encoding_1.fromBase64(signature.signature)],
328
+ signatures: [(0, encoding_1.fromBase64)(signature.signature)],
325
329
  })];
326
330
  }
327
331
  });
@@ -344,7 +348,7 @@ var SigningStargateClient = /** @class */ (function (_super) {
344
348
  txRaw = tx_1.TxRaw.fromPartial({
345
349
  bodyBytes: signed.bodyBytes,
346
350
  authInfoBytes: signed.authInfoBytes,
347
- signatures: [encoding_1.fromBase64(signature.signature)],
351
+ signatures: [(0, encoding_1.fromBase64)(signature.signature)],
348
352
  });
349
353
  return [2 /*return*/, { txRaw: txRaw, signature: signature.signature }];
350
354
  }
@@ -108,7 +108,7 @@ var StargateClient = /** @class */ (function () {
108
108
  var results;
109
109
  return __generator(this, function (_b) {
110
110
  switch (_b.label) {
111
- case 0: return [4 /*yield*/, this.txsQuery("tx.hash='" + id + "'")];
111
+ case 0: return [4 /*yield*/, this.txsQuery("tx.hash='".concat(id, "'"))];
112
112
  case 1:
113
113
  results = _b.sent();
114
114
  return [2 /*return*/, (_a = results[0]) !== null && _a !== void 0 ? _a : null];
@@ -139,9 +139,9 @@ var StargateClient = /** @class */ (function () {
139
139
  switch (_a.label) {
140
140
  case 0:
141
141
  if (timedOut) {
142
- throw new TimeoutError("Transaction with ID " + txId + " was submitted but was not yet found on the chain. You might want to check later.", txId);
142
+ throw new TimeoutError("Transaction with ID ".concat(txId, " was submitted but was not yet found on the chain. You might want to check later."), txId);
143
143
  }
144
- return [4 /*yield*/, utils_1.sleep(pollIntervalMs)];
144
+ return [4 /*yield*/, (0, utils_1.sleep)(pollIntervalMs)];
145
145
  case 1:
146
146
  _a.sent();
147
147
  return [4 /*yield*/, this.getTx(txId)];
@@ -167,9 +167,9 @@ var StargateClient = /** @class */ (function () {
167
167
  case 2:
168
168
  broadcasted = _a.sent();
169
169
  if (broadcasted.code) {
170
- throw new Error("Broadcasting transaction failed with code " + broadcasted.code + " (codespace: " + broadcasted.codeSpace + "). Log: " + broadcasted.log);
170
+ throw new Error("Broadcasting transaction failed with code ".concat(broadcasted.code, " (codespace: ").concat(broadcasted.codeSpace, "). Log: ").concat(broadcasted.log));
171
171
  }
172
- transactionId = encoding_1.toHex(broadcasted.hash).toUpperCase();
172
+ transactionId = (0, encoding_1.toHex)(broadcasted.hash).toUpperCase();
173
173
  return [2 /*return*/, new Promise(function (resolve, reject) {
174
174
  return pollForTx(transactionId).then(function (value) {
175
175
  clearTimeout(txPollTimeout);
@@ -194,7 +194,7 @@ var StargateClient = /** @class */ (function () {
194
194
  return [2 /*return*/, results.txs.map(function (tx) {
195
195
  return {
196
196
  height: tx.height,
197
- hash: encoding_1.toHex(tx.hash).toUpperCase(),
197
+ hash: (0, encoding_1.toHex)(tx.hash).toUpperCase(),
198
198
  code: tx.result.code,
199
199
  rawLog: tx.result.log || "",
200
200
  tx: tx.tx,
@@ -87,7 +87,7 @@ var ContractQueryClient = /** @class */ (function () {
87
87
  return __generator(this, function (_a) {
88
88
  switch (_a.label) {
89
89
  case 0:
90
- path = "/firmachain/firmachain/contract/contractFile/" + fileHash;
90
+ path = "/firmachain/firmachain/contract/contractFile/".concat(fileHash);
91
91
  return [4 /*yield*/, this.axios.get(path)];
92
92
  case 1:
93
93
  result = _a.sent();
@@ -122,7 +122,7 @@ var ContractQueryClient = /** @class */ (function () {
122
122
  return __generator(this, function (_a) {
123
123
  switch (_a.label) {
124
124
  case 0:
125
- path = "/firmachain/firmachain/contract/contractLog/" + logId;
125
+ path = "/firmachain/firmachain/contract/contractLog/".concat(logId);
126
126
  return [4 /*yield*/, this.axios.get(path)];
127
127
  case 1:
128
128
  result = _a.sent();