@airgap/cosmos 0.13.7-beta.21 → 0.13.7-beta.23

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 (154) hide show
  1. package/airgap-coinlib-cosmos.min.js +32425 -18722
  2. package/index.d.ts +1 -10
  3. package/index.js +15 -15
  4. package/index.js.map +1 -1
  5. package/package.json +4 -2
  6. package/v0/index.d.ts +10 -0
  7. package/v0/index.js +32 -0
  8. package/v0/index.js.map +1 -0
  9. package/{protocol → v0/protocol}/CosmosAddress.d.ts +0 -0
  10. package/{protocol → v0/protocol}/CosmosAddress.js +0 -0
  11. package/v0/protocol/CosmosAddress.js.map +1 -0
  12. package/{protocol → v0/protocol}/CosmosCoin.d.ts +0 -0
  13. package/{protocol → v0/protocol}/CosmosCoin.js +0 -0
  14. package/v0/protocol/CosmosCoin.js.map +1 -0
  15. package/{protocol → v0/protocol}/CosmosCryptoClient.d.ts +0 -0
  16. package/{protocol → v0/protocol}/CosmosCryptoClient.js +3 -1
  17. package/v0/protocol/CosmosCryptoClient.js.map +1 -0
  18. package/{protocol → v0/protocol}/CosmosFee.d.ts +0 -0
  19. package/{protocol → v0/protocol}/CosmosFee.js +0 -0
  20. package/v0/protocol/CosmosFee.js.map +1 -0
  21. package/{protocol → v0/protocol}/CosmosNodeClient.d.ts +0 -0
  22. package/{protocol → v0/protocol}/CosmosNodeClient.js +15 -15
  23. package/v0/protocol/CosmosNodeClient.js.map +1 -0
  24. package/{protocol → v0/protocol}/CosmosProtocol.d.ts +0 -0
  25. package/{protocol → v0/protocol}/CosmosProtocol.js +22 -20
  26. package/v0/protocol/CosmosProtocol.js.map +1 -0
  27. package/{protocol → v0/protocol}/CosmosProtocolOptions.d.ts +0 -0
  28. package/{protocol → v0/protocol}/CosmosProtocolOptions.js +4 -2
  29. package/v0/protocol/CosmosProtocolOptions.js.map +1 -0
  30. package/{protocol → v0/protocol}/CosmosTransaction.d.ts +0 -0
  31. package/{protocol → v0/protocol}/CosmosTransaction.js +0 -0
  32. package/v0/protocol/CosmosTransaction.js.map +1 -0
  33. package/{protocol → v0/protocol}/CosmosTypes.d.ts +0 -0
  34. package/{protocol → v0/protocol}/CosmosTypes.js +0 -0
  35. package/v0/protocol/CosmosTypes.js.map +1 -0
  36. package/{protocol → v0/protocol}/cosmos-message/CosmosDelegateMessage.d.ts +0 -0
  37. package/{protocol → v0/protocol}/cosmos-message/CosmosDelegateMessage.js +0 -0
  38. package/v0/protocol/cosmos-message/CosmosDelegateMessage.js.map +1 -0
  39. package/{protocol → v0/protocol}/cosmos-message/CosmosMessage.d.ts +0 -0
  40. package/{protocol → v0/protocol}/cosmos-message/CosmosMessage.js +0 -0
  41. package/v0/protocol/cosmos-message/CosmosMessage.js.map +1 -0
  42. package/{protocol → v0/protocol}/cosmos-message/CosmosSendMessage.d.ts +0 -0
  43. package/{protocol → v0/protocol}/cosmos-message/CosmosSendMessage.js +9 -7
  44. package/v0/protocol/cosmos-message/CosmosSendMessage.js.map +1 -0
  45. package/{protocol → v0/protocol}/cosmos-message/CosmosWithdrawDelegationRewardMessage.d.ts +0 -0
  46. package/{protocol → v0/protocol}/cosmos-message/CosmosWithdrawDelegationRewardMessage.js +0 -0
  47. package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js.map +1 -0
  48. package/v0/serializer/schemas/v2/transaction-sign-request-cosmos.json +100 -0
  49. package/v0/serializer/schemas/v2/transaction-sign-response-cosmos.json +22 -0
  50. package/v0/serializer/schemas/v3/transaction-sign-request-cosmos.json +100 -0
  51. package/v0/serializer/schemas/v3/transaction-sign-response-cosmos.json +19 -0
  52. package/v0/serializer/validators/transaction-validator.d.ts +15 -0
  53. package/v0/serializer/validators/transaction-validator.js +112 -0
  54. package/v0/serializer/validators/transaction-validator.js.map +1 -0
  55. package/v0/types/signed-transaction-cosmos.d.ts +5 -0
  56. package/{types → v0/types}/signed-transaction-cosmos.js +0 -0
  57. package/v0/types/signed-transaction-cosmos.js.map +1 -0
  58. package/{types → v0/types}/transaction-cosmos.d.ts +0 -0
  59. package/{types → v0/types}/transaction-cosmos.js +0 -0
  60. package/v0/types/transaction-cosmos.js.map +1 -0
  61. package/{types → v0/types}/unsigned-transaction-cosmos.d.ts +2 -2
  62. package/{types → v0/types}/unsigned-transaction-cosmos.js +0 -0
  63. package/v0/types/unsigned-transaction-cosmos.js.map +1 -0
  64. package/v1/block-explorer/MintscanBlockExplorer.d.ts +9 -0
  65. package/v1/block-explorer/MintscanBlockExplorer.js +74 -0
  66. package/v1/block-explorer/MintscanBlockExplorer.js.map +1 -0
  67. package/v1/data/CosmosAddress.d.ts +7 -0
  68. package/v1/data/CosmosAddress.js +26 -0
  69. package/v1/data/CosmosAddress.js.map +1 -0
  70. package/v1/data/CosmosCoin.d.ts +19 -0
  71. package/v1/data/CosmosCoin.js +55 -0
  72. package/v1/data/CosmosCoin.js.map +1 -0
  73. package/v1/data/CosmosFee.d.ts +15 -0
  74. package/v1/data/CosmosFee.js +31 -0
  75. package/v1/data/CosmosFee.js.map +1 -0
  76. package/v1/data/transaction/CosmosTransaction.d.ts +36 -0
  77. package/v1/data/transaction/CosmosTransaction.js +107 -0
  78. package/v1/data/transaction/CosmosTransaction.js.map +1 -0
  79. package/v1/data/transaction/message/CosmosDelegateMessage.d.ts +19 -0
  80. package/v1/data/transaction/message/CosmosDelegateMessage.js +70 -0
  81. package/v1/data/transaction/message/CosmosDelegateMessage.js.map +1 -0
  82. package/v1/data/transaction/message/CosmosMessage.d.ts +38 -0
  83. package/v1/data/transaction/message/CosmosMessage.js +47 -0
  84. package/v1/data/transaction/message/CosmosMessage.js.map +1 -0
  85. package/v1/data/transaction/message/CosmosSendMessage.d.ts +19 -0
  86. package/v1/data/transaction/message/CosmosSendMessage.js +83 -0
  87. package/v1/data/transaction/message/CosmosSendMessage.js.map +1 -0
  88. package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.d.ts +23 -0
  89. package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js +61 -0
  90. package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js.map +1 -0
  91. package/v1/index.d.ts +9 -0
  92. package/v1/index.js +11 -0
  93. package/v1/index.js.map +1 -0
  94. package/v1/module/CosmosModule.d.ts +8 -0
  95. package/v1/module/CosmosModule.js +86 -0
  96. package/v1/module/CosmosModule.js.map +1 -0
  97. package/v1/node/CosmosNodeClient.d.ts +28 -0
  98. package/v1/node/CosmosNodeClient.js +381 -0
  99. package/v1/node/CosmosNodeClient.js.map +1 -0
  100. package/v1/protocol/CosmosCryptoClient.d.ts +8 -0
  101. package/v1/protocol/CosmosCryptoClient.js +88 -0
  102. package/v1/protocol/CosmosCryptoClient.js.map +1 -0
  103. package/v1/protocol/CosmosProtocol.d.ts +50 -0
  104. package/v1/protocol/CosmosProtocol.js +658 -0
  105. package/v1/protocol/CosmosProtocol.js.map +1 -0
  106. package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +7 -0
  107. package/v1/serializer/v3/schemas/converter/transaction-converter.js +21 -0
  108. package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
  109. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.d.ts +4 -0
  110. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js +3 -0
  111. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js.map +1 -0
  112. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.d.ts +3 -0
  113. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js +3 -0
  114. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js.map +1 -0
  115. package/v1/serializer/v3/schemas/generated/transaction-sign-request-cosmos.json +107 -0
  116. package/v1/serializer/v3/schemas/generated/transaction-sign-response-cosmos.json +19 -0
  117. package/v1/serializer/v3/validators/transaction-validators.d.ts +10 -0
  118. package/v1/serializer/v3/validators/transaction-validators.js +97 -0
  119. package/v1/serializer/v3/validators/transaction-validators.js.map +1 -0
  120. package/v1/types/protocol.d.ts +8 -0
  121. package/v1/types/protocol.js +3 -0
  122. package/v1/types/protocol.js.map +1 -0
  123. package/v1/types/rpc.d.ts +286 -0
  124. package/v1/types/rpc.js +3 -0
  125. package/v1/types/rpc.js.map +1 -0
  126. package/v1/types/transaction.d.ts +44 -0
  127. package/v1/types/transaction.js +10 -0
  128. package/v1/types/transaction.js.map +1 -0
  129. package/v1/utils/key.d.ts +3 -0
  130. package/v1/utils/key.js +20 -0
  131. package/v1/utils/key.js.map +1 -0
  132. package/v1/utils/signature.d.ts +2 -0
  133. package/v1/utils/signature.js +13 -0
  134. package/v1/utils/signature.js.map +1 -0
  135. package/v1/utils/transaction.d.ts +1 -0
  136. package/v1/utils/transaction.js +8 -0
  137. package/v1/utils/transaction.js.map +1 -0
  138. package/protocol/CosmosAddress.js.map +0 -1
  139. package/protocol/CosmosCoin.js.map +0 -1
  140. package/protocol/CosmosCryptoClient.js.map +0 -1
  141. package/protocol/CosmosFee.js.map +0 -1
  142. package/protocol/CosmosNodeClient.js.map +0 -1
  143. package/protocol/CosmosProtocol.js.map +0 -1
  144. package/protocol/CosmosProtocolOptions.js.map +0 -1
  145. package/protocol/CosmosTransaction.js.map +0 -1
  146. package/protocol/CosmosTypes.js.map +0 -1
  147. package/protocol/cosmos-message/CosmosDelegateMessage.js.map +0 -1
  148. package/protocol/cosmos-message/CosmosMessage.js.map +0 -1
  149. package/protocol/cosmos-message/CosmosSendMessage.js.map +0 -1
  150. package/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js.map +0 -1
  151. package/types/signed-transaction-cosmos.d.ts +0 -6
  152. package/types/signed-transaction-cosmos.js.map +0 -1
  153. package/types/transaction-cosmos.js.map +0 -1
  154. package/types/unsigned-transaction-cosmos.js.map +0 -1
@@ -0,0 +1,658 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __importDefault = (this && this.__importDefault) || function (mod) {
50
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
+ };
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ exports.createCosmosProtocolOptions = exports.COSMOS_MAINNET_PROTOCOL_NETWORK = exports.createCosmosProtocol = exports.CosmosProtocolImpl = void 0;
54
+ var coinlib_core_1 = require("@airgap/coinlib-core");
55
+ var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
56
+ var index_1 = require("@airgap/coinlib-core/dependencies/src/bip32-2.0.4/src/index");
57
+ var index_2 = require("@airgap/coinlib-core/dependencies/src/bip39-2.5.0/index");
58
+ var cosmjs_1 = require("@airgap/coinlib-core/dependencies/src/cosmjs");
59
+ var SECP256K1 = require("@airgap/coinlib-core/dependencies/src/secp256k1-3.7.1/elliptic");
60
+ var sha = require("@airgap/coinlib-core/dependencies/src/sha.js-2.4.11/index");
61
+ var errors_1 = require("@airgap/coinlib-core/errors");
62
+ var module_kit_1 = require("@airgap/module-kit");
63
+ var CosmosAddress_1 = require("../data/CosmosAddress");
64
+ var CosmosCoin_1 = require("../data/CosmosCoin");
65
+ var CosmosFee_1 = require("../data/CosmosFee");
66
+ var CosmosTransaction_1 = require("../data/transaction/CosmosTransaction");
67
+ var CosmosDelegateMessage_1 = require("../data/transaction/message/CosmosDelegateMessage");
68
+ var CosmosMessage_1 = require("../data/transaction/message/CosmosMessage");
69
+ var CosmosSendMessage_1 = require("../data/transaction/message/CosmosSendMessage");
70
+ var CosmosWithdrawDelegationRewardMessage_1 = require("../data/transaction/message/CosmosWithdrawDelegationRewardMessage");
71
+ var CosmosNodeClient_1 = require("../node/CosmosNodeClient");
72
+ var key_1 = require("../utils/key");
73
+ var signature_1 = require("../utils/signature");
74
+ var transaction_1 = require("../utils/transaction");
75
+ var CosmosCryptoClient_1 = require("./CosmosCryptoClient");
76
+ // Implementation
77
+ var DEFAULT_GAS = (0, module_kit_1.newAmount)('200000', 'blockchain');
78
+ var CosmosProtocolImpl = /** @class */ (function () {
79
+ function CosmosProtocolImpl(options) {
80
+ if (options === void 0) { options = {}; }
81
+ // Common
82
+ this.units = {
83
+ atom: {
84
+ symbol: { value: 'ATOM', market: 'atom' },
85
+ decimals: 6
86
+ },
87
+ uatom: {
88
+ symbol: { value: 'uATOM' },
89
+ decimals: 0
90
+ }
91
+ };
92
+ this.feeDefaults = {
93
+ low: (0, module_kit_1.newAmount)(0.0005, 'atom').blockchain(this.units),
94
+ medium: (0, module_kit_1.newAmount)(0.005, 'atom').blockchain(this.units),
95
+ high: (0, module_kit_1.newAmount)(0.0072, 'atom').blockchain(this.units)
96
+ };
97
+ this.metadata = {
98
+ identifier: coinlib_core_1.MainProtocolSymbols.COSMOS,
99
+ name: 'Cosmos',
100
+ units: this.units,
101
+ mainUnit: 'atom',
102
+ fee: {
103
+ defaults: this.feeDefaults
104
+ },
105
+ account: {
106
+ standardDerivationPath: "m/44'/118'/0'/0/0",
107
+ address: {
108
+ isCaseSensitive: false,
109
+ placeholder: 'cosmos...',
110
+ regex: '^(cosmos|cosmosvaloper)[a-zA-Z0-9]{39}$'
111
+ }
112
+ },
113
+ transaction: {
114
+ arbitraryData: {
115
+ name: 'memo'
116
+ }
117
+ }
118
+ };
119
+ this.options = createCosmosProtocolOptions(options.network);
120
+ this.nodeClient = new CosmosNodeClient_1.CosmosNodeClient(this.options.network.rpcUrl, this.options.network.useCORSProxy);
121
+ this.cryptoClient = new CosmosCryptoClient_1.CosmosCryptoClient();
122
+ }
123
+ CosmosProtocolImpl.prototype.getMetadata = function () {
124
+ return __awaiter(this, void 0, void 0, function () {
125
+ return __generator(this, function (_a) {
126
+ return [2 /*return*/, this.metadata];
127
+ });
128
+ });
129
+ };
130
+ CosmosProtocolImpl.prototype.getAddressFromPublicKey = function (publicKey) {
131
+ return __awaiter(this, void 0, void 0, function () {
132
+ return __generator(this, function (_a) {
133
+ return [2 /*return*/, CosmosAddress_1.CosmosAddress.from(publicKey).asString()];
134
+ });
135
+ });
136
+ };
137
+ CosmosProtocolImpl.prototype.getDetailsFromTransaction = function (transaction, _publicKey) {
138
+ return __awaiter(this, void 0, void 0, function () {
139
+ return __generator(this, function (_a) {
140
+ switch (transaction.type) {
141
+ case 'signed':
142
+ return [2 /*return*/, this.getDetailsFromSignedTransaction(transaction)];
143
+ case 'unsigned':
144
+ return [2 /*return*/, this.getDetailsFromUnsignedTransaction(transaction)];
145
+ default:
146
+ (0, coinlib_core_1.assertNever)(transaction);
147
+ throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, 'Unsupported transaction type.');
148
+ }
149
+ return [2 /*return*/];
150
+ });
151
+ });
152
+ };
153
+ CosmosProtocolImpl.prototype.getDetailsFromSignedTransaction = function (transaction) {
154
+ var _a;
155
+ return __awaiter(this, void 0, void 0, function () {
156
+ var bytes, decoded, fee, result;
157
+ var _this = this;
158
+ return __generator(this, function (_b) {
159
+ switch (_b.label) {
160
+ case 0:
161
+ bytes = Uint8Array.from(Buffer.from(transaction.encoded, 'base64'));
162
+ return [4 /*yield*/, (0, cosmjs_1.decodeTxBytes)(bytes)];
163
+ case 1:
164
+ decoded = _b.sent();
165
+ fee = ((_a = decoded.fee) === null || _a === void 0 ? void 0 : _a.amount)
166
+ .map(function (_a) {
167
+ var amount = _a.amount;
168
+ return new bignumber_1.default(amount);
169
+ })
170
+ .reduce(function (current, next) { return current.plus(next); })
171
+ .toString(10);
172
+ result = decoded.messages
173
+ .map(function (message) {
174
+ var type = message.typeUrl;
175
+ switch (type) {
176
+ case CosmosMessage_1.CosmosMessageType.Send.value:
177
+ var sendMessage = CosmosSendMessage_1.CosmosSendMessage.fromEncodeObject(message);
178
+ return sendMessage.toAirGapTransaction(_this.options.network, fee);
179
+ case CosmosMessage_1.CosmosMessageType.Undelegate.value:
180
+ case CosmosMessage_1.CosmosMessageType.Delegate.value:
181
+ var delegateMessage = CosmosDelegateMessage_1.CosmosDelegateMessage.fromEncodeObject(message);
182
+ return delegateMessage.toAirGapTransaction(_this.options.network, fee);
183
+ case CosmosMessage_1.CosmosMessageType.WithdrawDelegationReward.value:
184
+ var withdrawMessage = CosmosWithdrawDelegationRewardMessage_1.CosmosWithdrawDelegationRewardMessage.fromEncodeObject(message);
185
+ return withdrawMessage.toAirGapTransaction(_this.options.network, fee);
186
+ default:
187
+ throw new errors_1.InvalidValueError(coinlib_core_1.Domain.COSMOS, 'Unknown transaction');
188
+ }
189
+ })
190
+ .map(function (tx) {
191
+ if (!tx.json) {
192
+ tx.json = {};
193
+ }
194
+ tx.json.memo = decoded.memo;
195
+ if (decoded.signerInfos.length > 0) {
196
+ tx.json.sequence = decoded.signerInfos[0].sequence.toString(10);
197
+ }
198
+ tx.arbitraryData = decoded.memo;
199
+ return tx;
200
+ });
201
+ return [2 /*return*/, result];
202
+ }
203
+ });
204
+ });
205
+ };
206
+ CosmosProtocolImpl.prototype.getDetailsFromUnsignedTransaction = function (transaction) {
207
+ return __awaiter(this, void 0, void 0, function () {
208
+ return __generator(this, function (_a) {
209
+ return [2 /*return*/, CosmosTransaction_1.CosmosTransaction.fromJSON(transaction).toAirGapTransactions(this.options.network)];
210
+ });
211
+ });
212
+ };
213
+ CosmosProtocolImpl.prototype.verifyMessageWithPublicKey = function (message, signature, publicKey) {
214
+ return __awaiter(this, void 0, void 0, function () {
215
+ var hexSignature, hexPublicKey;
216
+ return __generator(this, function (_a) {
217
+ hexSignature = (0, signature_1.convertSignature)(signature, 'hex');
218
+ hexPublicKey = (0, key_1.convertPublicKey)(publicKey, 'hex');
219
+ return [2 /*return*/, this.cryptoClient.verifyMessage(message, hexSignature.value, hexPublicKey.value)];
220
+ });
221
+ });
222
+ };
223
+ CosmosProtocolImpl.prototype.encryptAsymmetricWithPublicKey = function (payload, publicKey) {
224
+ return __awaiter(this, void 0, void 0, function () {
225
+ var hexPublicKey;
226
+ return __generator(this, function (_a) {
227
+ hexPublicKey = (0, key_1.convertPublicKey)(publicKey, 'hex');
228
+ return [2 /*return*/, this.cryptoClient.encryptAsymmetric(payload, hexPublicKey.value)];
229
+ });
230
+ });
231
+ };
232
+ // Offline
233
+ CosmosProtocolImpl.prototype.getKeyPairFromSecret = function (secret, derivationPath) {
234
+ return __awaiter(this, void 0, void 0, function () {
235
+ var nodeFromHex, seed, nodeFromMnemonic;
236
+ return __generator(this, function (_a) {
237
+ switch (secret.type) {
238
+ case 'hex':
239
+ nodeFromHex = (0, index_1.fromSeed)(Buffer.from(secret.value, 'hex'));
240
+ return [2 /*return*/, this.getKeyPairFromNode(nodeFromHex, derivationPath)];
241
+ case 'mnemonic':
242
+ (0, index_2.validateMnemonic)(secret.value);
243
+ seed = (0, index_2.mnemonicToSeed)(secret.value, secret.password);
244
+ nodeFromMnemonic = (0, index_1.fromSeed)(seed);
245
+ return [2 /*return*/, this.getKeyPairFromNode(nodeFromMnemonic, derivationPath)];
246
+ default:
247
+ (0, coinlib_core_1.assertNever)(secret);
248
+ throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, 'Unsupported secret type.');
249
+ }
250
+ return [2 /*return*/];
251
+ });
252
+ });
253
+ };
254
+ CosmosProtocolImpl.prototype.getKeyPairFromNode = function (node, derivationPath) {
255
+ return __awaiter(this, void 0, void 0, function () {
256
+ var keyPair, secretKey, publicKey;
257
+ return __generator(this, function (_a) {
258
+ keyPair = node.derivePath(derivationPath !== null && derivationPath !== void 0 ? derivationPath : 'm/');
259
+ secretKey = keyPair.privateKey;
260
+ if (secretKey === undefined) {
261
+ throw new errors_1.InvalidValueError(coinlib_core_1.Domain.COSMOS, 'Cannot generate private key');
262
+ }
263
+ publicKey = keyPair.publicKey;
264
+ return [2 /*return*/, {
265
+ secretKey: (0, module_kit_1.newSecretKey)(secretKey.toString('hex'), 'hex'),
266
+ publicKey: (0, module_kit_1.newPublicKey)(publicKey.toString('hex'), 'hex')
267
+ }];
268
+ });
269
+ });
270
+ };
271
+ CosmosProtocolImpl.prototype.signTransactionWithSecretKey = function (transaction, secretKey) {
272
+ return __awaiter(this, void 0, void 0, function () {
273
+ var hexSecretKey, privateKeyBuffer, publicKey, hexPublicKey, publicKeyBuffer, encodedObject, signBytes, sha256Hash, hash, signed, sigBase64, txBytes;
274
+ return __generator(this, function (_a) {
275
+ switch (_a.label) {
276
+ case 0:
277
+ hexSecretKey = (0, key_1.convertSecretKey)(secretKey, 'hex');
278
+ privateKeyBuffer = Buffer.from(hexSecretKey.value, 'hex');
279
+ return [4 /*yield*/, this.getKeyPairFromSecretKey(secretKey)];
280
+ case 1:
281
+ publicKey = (_a.sent()).publicKey;
282
+ hexPublicKey = (0, key_1.convertPublicKey)(publicKey, 'hex');
283
+ publicKeyBuffer = Buffer.from(hexPublicKey.value, 'hex');
284
+ encodedObject = CosmosTransaction_1.CosmosTransaction.fromJSON(transaction).toEncodeObject();
285
+ return [4 /*yield*/, (0, cosmjs_1.prepareSignBytes)(encodedObject, transaction.fee, Uint8Array.from(publicKeyBuffer), new bignumber_1.default(transaction.sequence).toNumber(), transaction.chainID, new bignumber_1.default(transaction.accountNumber).toNumber())];
286
+ case 2:
287
+ signBytes = _a.sent();
288
+ sha256Hash = sha('sha256').update(signBytes).digest();
289
+ hash = Buffer.from(sha256Hash);
290
+ signed = SECP256K1.sign(hash, privateKeyBuffer);
291
+ sigBase64 = Buffer.from(signed.signature, 'binary').toString('base64');
292
+ return [4 /*yield*/, (0, cosmjs_1.encodeTxBytes)(encodedObject, transaction.fee, Uint8Array.from(publicKeyBuffer), new bignumber_1.default(transaction.sequence).toNumber(), {
293
+ signature: sigBase64,
294
+ pub_key: {
295
+ type: 'tendermint/PubKeySecp256k1',
296
+ value: publicKeyBuffer.toString('base64')
297
+ }
298
+ }, transaction.chainID, new bignumber_1.default(transaction.accountNumber).toNumber())];
299
+ case 3:
300
+ txBytes = _a.sent();
301
+ return [2 /*return*/, (0, module_kit_1.newSignedTransaction)({
302
+ encoded: Buffer.from(txBytes).toString('base64')
303
+ })];
304
+ }
305
+ });
306
+ });
307
+ };
308
+ CosmosProtocolImpl.prototype.signMessageWithKeyPair = function (message, keyPair) {
309
+ return __awaiter(this, void 0, void 0, function () {
310
+ var hexSecretKey, signature;
311
+ return __generator(this, function (_a) {
312
+ switch (_a.label) {
313
+ case 0:
314
+ hexSecretKey = (0, key_1.convertSecretKey)(keyPair.secretKey, 'hex');
315
+ return [4 /*yield*/, this.cryptoClient.signMessage(message, { privateKey: hexSecretKey.value })];
316
+ case 1:
317
+ signature = _a.sent();
318
+ return [2 /*return*/, (0, module_kit_1.newSignature)(signature, 'hex')];
319
+ }
320
+ });
321
+ });
322
+ };
323
+ CosmosProtocolImpl.prototype.decryptAsymmetricWithKeyPair = function (payload, keyPair) {
324
+ return __awaiter(this, void 0, void 0, function () {
325
+ var hexSecretKey, hexPublicKey;
326
+ return __generator(this, function (_a) {
327
+ hexSecretKey = (0, key_1.convertSecretKey)(keyPair.secretKey, 'hex');
328
+ hexPublicKey = (0, key_1.convertPublicKey)(keyPair.publicKey, 'hex');
329
+ return [2 /*return*/, this.cryptoClient.decryptAsymmetric(payload, {
330
+ privateKey: hexSecretKey.value,
331
+ publicKey: hexPublicKey.value
332
+ })];
333
+ });
334
+ });
335
+ };
336
+ CosmosProtocolImpl.prototype.encryptAESWithSecretKey = function (payload, secretKey) {
337
+ return __awaiter(this, void 0, void 0, function () {
338
+ var hexSecretKey;
339
+ return __generator(this, function (_a) {
340
+ hexSecretKey = (0, key_1.convertSecretKey)(secretKey, 'hex');
341
+ return [2 /*return*/, this.cryptoClient.encryptAES(payload, hexSecretKey.value)];
342
+ });
343
+ });
344
+ };
345
+ CosmosProtocolImpl.prototype.decryptAESWithSecretKey = function (payload, secretKey) {
346
+ return __awaiter(this, void 0, void 0, function () {
347
+ var hexSecretKey;
348
+ return __generator(this, function (_a) {
349
+ hexSecretKey = (0, key_1.convertSecretKey)(secretKey, 'hex');
350
+ return [2 /*return*/, this.cryptoClient.decryptAES(payload, hexSecretKey.value)];
351
+ });
352
+ });
353
+ };
354
+ // Online
355
+ CosmosProtocolImpl.prototype.getNetwork = function () {
356
+ return __awaiter(this, void 0, void 0, function () {
357
+ return __generator(this, function (_a) {
358
+ return [2 /*return*/, this.options.network];
359
+ });
360
+ });
361
+ };
362
+ CosmosProtocolImpl.prototype.getTransactionsForPublicKey = function (publicKey, limit, cursor) {
363
+ return __awaiter(this, void 0, void 0, function () {
364
+ var address;
365
+ return __generator(this, function (_a) {
366
+ switch (_a.label) {
367
+ case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
368
+ case 1:
369
+ address = _a.sent();
370
+ return [2 /*return*/, this.getTransactionsForAddress(address, limit, cursor)];
371
+ }
372
+ });
373
+ });
374
+ };
375
+ CosmosProtocolImpl.prototype.getTransactionsForAddress = function (address, limit, cursor) {
376
+ return __awaiter(this, void 0, void 0, function () {
377
+ var promises, senderOffset, recipientOffset, senderTotal, recipientTotal, senderLimit, recipientLimit, transactions, sentTransactions, receivedTransactions, allTransactions, result, _loop_1, _i, allTransactions_1, transaction;
378
+ var _a;
379
+ var _this = this;
380
+ return __generator(this, function (_b) {
381
+ switch (_b.label) {
382
+ case 0:
383
+ promises = [];
384
+ senderOffset = 0;
385
+ recipientOffset = 0;
386
+ senderTotal = 0;
387
+ recipientTotal = 0;
388
+ senderLimit = 0;
389
+ recipientLimit = 0;
390
+ if (!cursor) return [3 /*break*/, 1];
391
+ senderOffset = cursor.sender.offset;
392
+ recipientOffset = cursor.recipient.offset;
393
+ senderTotal = cursor.sender.total;
394
+ recipientTotal = cursor.recipient.total;
395
+ senderLimit = (0, transaction_1.calculateTransactionLimit)(limit, senderTotal, recipientTotal, senderOffset, recipientOffset);
396
+ if (senderOffset <= Math.floor(senderTotal / senderLimit) * senderLimit) {
397
+ promises.push(this.nodeClient.fetchSendTransactionsFor(address, senderLimit, senderOffset, true));
398
+ }
399
+ else {
400
+ promises.push(new Promise(function (resolve) {
401
+ resolve({ txs: [], tx_responses: [], pagination: { total: String(senderTotal) } });
402
+ }));
403
+ }
404
+ recipientLimit = (0, transaction_1.calculateTransactionLimit)(limit, recipientTotal, senderTotal, recipientOffset, senderOffset);
405
+ if (recipientOffset <= Math.floor(recipientTotal / recipientLimit) * recipientLimit) {
406
+ promises.push(this.nodeClient.fetchSendTransactionsFor(address, recipientLimit, recipientOffset, false));
407
+ }
408
+ else {
409
+ promises.push(new Promise(function (resolve) {
410
+ resolve({ txs: [], tx_responses: [], pagination: { total: String(recipientTotal) } });
411
+ }));
412
+ }
413
+ return [3 /*break*/, 3];
414
+ case 1:
415
+ ;
416
+ return [4 /*yield*/, Promise.all([
417
+ this.nodeClient
418
+ .fetchSendTransactionsFor(address, 1, 0, true)
419
+ .then(function (response) { return new bignumber_1.default(response.pagination.total).toNumber(); }),
420
+ this.nodeClient
421
+ .fetchSendTransactionsFor(address, 1, 0, false)
422
+ .then(function (response) { return new bignumber_1.default(response.pagination.total).toNumber(); })
423
+ ])];
424
+ case 2:
425
+ _a = _b.sent(), senderTotal = _a[0], recipientTotal = _a[1];
426
+ senderLimit = (0, transaction_1.calculateTransactionLimit)(limit, senderTotal, recipientTotal, senderOffset, recipientOffset);
427
+ recipientLimit = (0, transaction_1.calculateTransactionLimit)(limit, recipientTotal, senderTotal, recipientOffset, senderOffset);
428
+ promises.push(this.nodeClient.fetchSendTransactionsFor(address, senderLimit, senderOffset, true), this.nodeClient.fetchSendTransactionsFor(address, recipientLimit, recipientOffset, false));
429
+ _b.label = 3;
430
+ case 3: return [4 /*yield*/, Promise.all(promises)];
431
+ case 4:
432
+ transactions = _b.sent();
433
+ sentTransactions = transactions[0];
434
+ receivedTransactions = transactions[1];
435
+ allTransactions = sentTransactions === null || sentTransactions === void 0 ? void 0 : sentTransactions.tx_responses.concat(receivedTransactions === null || receivedTransactions === void 0 ? void 0 : receivedTransactions.tx_responses);
436
+ result = [];
437
+ _loop_1 = function (transaction) {
438
+ var timestamp = new Date(transaction.timestamp).getTime() / 1000;
439
+ var fee = transaction.tx.auth_info.fee.amount
440
+ .filter(function (coin) { return coin.denom === 'uatom'; })
441
+ .map(function (coin) { return new bignumber_1.default(coin.amount); })
442
+ .reduce(function (current, next) { return current.plus(next); });
443
+ result = result.concat(transaction.tx.body.messages.map(function (msg) {
444
+ var tx = {
445
+ isInbound: false,
446
+ amount: (0, module_kit_1.newAmount)('0', 'blockchain'),
447
+ fee: (0, module_kit_1.newAmount)(fee, 'blockchain'),
448
+ network: _this.options.network,
449
+ status: {
450
+ type: 'unknown',
451
+ hash: transaction.txhash
452
+ },
453
+ timestamp: timestamp
454
+ };
455
+ switch (msg['@type']) {
456
+ case CosmosMessage_1.CosmosMessageTypeValue.UNDELEGATE:
457
+ return __assign(__assign({}, tx), { from: [msg.validator_address], to: [msg.delegator_address] });
458
+ case CosmosMessage_1.CosmosMessageTypeValue.WITHDRAW_DELEGATION_REWARD:
459
+ return __assign(__assign({}, tx), { from: [msg.delegator_address], to: [msg.validator_address] });
460
+ case CosmosMessage_1.CosmosMessageTypeValue.DELEGATE:
461
+ return __assign(__assign({}, tx), { from: [msg.delegator_address], to: [msg.validator_address] });
462
+ default:
463
+ return __assign(__assign({}, tx), { from: [msg.from_address], to: [msg.to_address], isInbound: msg.to_address === address, amount: (0, module_kit_1.newAmount)(msg.amount[0].amount, 'blockchain') });
464
+ }
465
+ }));
466
+ };
467
+ for (_i = 0, allTransactions_1 = allTransactions; _i < allTransactions_1.length; _i++) {
468
+ transaction = allTransactions_1[_i];
469
+ _loop_1(transaction);
470
+ }
471
+ return [2 /*return*/, {
472
+ transactions: result,
473
+ cursor: {
474
+ hasNext: senderOffset + senderLimit < senderTotal || recipientOffset + recipientLimit < recipientTotal,
475
+ limit: limit,
476
+ sender: {
477
+ total: senderTotal,
478
+ offset: senderOffset + senderLimit
479
+ },
480
+ recipient: {
481
+ total: recipientTotal,
482
+ offset: recipientOffset + recipientLimit
483
+ }
484
+ }
485
+ }];
486
+ }
487
+ });
488
+ });
489
+ };
490
+ CosmosProtocolImpl.prototype.getBalanceOfPublicKey = function (publicKey) {
491
+ return __awaiter(this, void 0, void 0, function () {
492
+ var address;
493
+ return __generator(this, function (_a) {
494
+ switch (_a.label) {
495
+ case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
496
+ case 1:
497
+ address = _a.sent();
498
+ return [2 /*return*/, this.getBalanceOfAddress(address)];
499
+ }
500
+ });
501
+ });
502
+ };
503
+ CosmosProtocolImpl.prototype.getBalanceOfAddress = function (address) {
504
+ return __awaiter(this, void 0, void 0, function () {
505
+ var balance;
506
+ return __generator(this, function (_a) {
507
+ switch (_a.label) {
508
+ case 0: return [4 /*yield*/, this.nodeClient.fetchBalance(address)];
509
+ case 1:
510
+ balance = _a.sent();
511
+ return [2 /*return*/, {
512
+ total: (0, module_kit_1.newAmount)(balance.total, 'blockchain'),
513
+ transferable: (0, module_kit_1.newAmount)(balance.available, 'blockchain')
514
+ }];
515
+ }
516
+ });
517
+ });
518
+ };
519
+ CosmosProtocolImpl.prototype.getTransactionMaxAmountWithPublicKey = function (publicKey, to, configuration) {
520
+ return __awaiter(this, void 0, void 0, function () {
521
+ var _a, total, transferable, balance, fee, estimatedFee, amountWithoutFees;
522
+ return __generator(this, function (_b) {
523
+ switch (_b.label) {
524
+ case 0: return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
525
+ case 1:
526
+ _a = _b.sent(), total = _a.total, transferable = _a.transferable;
527
+ balance = new bignumber_1.default((0, module_kit_1.newAmount)(transferable !== null && transferable !== void 0 ? transferable : total).blockchain(this.units).value);
528
+ if (!((configuration === null || configuration === void 0 ? void 0 : configuration.fee) !== undefined)) return [3 /*break*/, 2];
529
+ fee = configuration.fee;
530
+ return [3 /*break*/, 4];
531
+ case 2: return [4 /*yield*/, this.getTransactionFeeWithPublicKey(publicKey, to.map(function (recipient) { return ({
532
+ to: recipient,
533
+ amount: (0, module_kit_1.newAmount)(balance.div(to.length).decimalPlaces(0, bignumber_1.default.ROUND_CEIL), 'blockchain')
534
+ }); }))];
535
+ case 3:
536
+ estimatedFee = _b.sent();
537
+ fee = (0, module_kit_1.newAmount)(estimatedFee.medium).blockchain(this.units);
538
+ if (balance.lte(fee.value)) {
539
+ fee = (0, module_kit_1.newAmount)(0, 'blockchain');
540
+ }
541
+ _b.label = 4;
542
+ case 4:
543
+ fee = (0, module_kit_1.newAmount)(fee).blockchain(this.units);
544
+ amountWithoutFees = balance.minus(fee.value);
545
+ if (amountWithoutFees.isNegative()) {
546
+ amountWithoutFees = new bignumber_1.default(0);
547
+ }
548
+ return [2 /*return*/, (0, module_kit_1.newAmount)(amountWithoutFees, 'blockchain')];
549
+ }
550
+ });
551
+ });
552
+ };
553
+ CosmosProtocolImpl.prototype.getTransactionFeeWithPublicKey = function (_publicKey, _details) {
554
+ return __awaiter(this, void 0, void 0, function () {
555
+ return __generator(this, function (_a) {
556
+ return [2 /*return*/, this.feeDefaults];
557
+ });
558
+ });
559
+ };
560
+ CosmosProtocolImpl.prototype.prepareTransactionWithPublicKey = function (publicKey, details, configuration) {
561
+ var _a, _b;
562
+ return __awaiter(this, void 0, void 0, function () {
563
+ var fee, estimatedFee, wrappedFee, address, nodeInfo, account, _c, total, transferable, balance, messages, i, message, memo, transaction;
564
+ var _this = this;
565
+ return __generator(this, function (_d) {
566
+ switch (_d.label) {
567
+ case 0:
568
+ if (!((configuration === null || configuration === void 0 ? void 0 : configuration.fee) !== undefined)) return [3 /*break*/, 1];
569
+ fee = configuration.fee;
570
+ return [3 /*break*/, 3];
571
+ case 1: return [4 /*yield*/, this.getTransactionFeeWithPublicKey(publicKey, details)];
572
+ case 2:
573
+ estimatedFee = _d.sent();
574
+ fee = estimatedFee.medium;
575
+ _d.label = 3;
576
+ case 3:
577
+ wrappedFee = new bignumber_1.default((0, module_kit_1.newAmount)(fee).blockchain(this.units).value);
578
+ return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
579
+ case 4:
580
+ address = _d.sent();
581
+ return [4 /*yield*/, this.nodeClient.fetchNodeInfo()];
582
+ case 5:
583
+ nodeInfo = _d.sent();
584
+ return [4 /*yield*/, this.nodeClient.fetchAccount(address)];
585
+ case 6:
586
+ account = _d.sent();
587
+ return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
588
+ case 7:
589
+ _c = _d.sent(), total = _c.total, transferable = _c.transferable;
590
+ balance = new bignumber_1.default((0, module_kit_1.newAmount)(transferable !== null && transferable !== void 0 ? transferable : total).blockchain(this.units).value);
591
+ if (balance.lt(details.reduce(function (acc, next) { return acc.plus((0, module_kit_1.newAmount)(next.amount).blockchain(_this.units).value); }, wrappedFee))) {
592
+ throw new errors_1.BalanceError(coinlib_core_1.Domain.COSMOS, 'not enough balance');
593
+ }
594
+ messages = [];
595
+ for (i = 0; i < details.length; ++i) {
596
+ message = new CosmosSendMessage_1.CosmosSendMessage(address, details[i].to, [
597
+ new CosmosCoin_1.CosmosCoin('uatom', (0, module_kit_1.newAmount)(details[i].amount).blockchain(this.units).value)
598
+ ]);
599
+ messages.push(message);
600
+ }
601
+ memo = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.arbitraryData) !== null && _a !== void 0 ? _a : '';
602
+ transaction = new CosmosTransaction_1.CosmosTransaction(messages, new CosmosFee_1.CosmosFee([new CosmosCoin_1.CosmosCoin('uatom', wrappedFee.toString(10))], (0, module_kit_1.newAmount)(DEFAULT_GAS).blockchain(this.units).value), memo, nodeInfo.network, account.value.account_number, (_b = account.value.sequence) !== null && _b !== void 0 ? _b : '0');
603
+ return [2 /*return*/, (0, module_kit_1.newUnsignedTransaction)({
604
+ messages: transaction.messages.map(function (message) { return message.toJSON(); }),
605
+ fee: transaction.fee.toJSON(),
606
+ memo: transaction.memo,
607
+ chainID: transaction.chainID,
608
+ accountNumber: transaction.accountNumber,
609
+ sequence: transaction.sequence
610
+ })];
611
+ }
612
+ });
613
+ });
614
+ };
615
+ CosmosProtocolImpl.prototype.broadcastTransaction = function (transaction) {
616
+ return __awaiter(this, void 0, void 0, function () {
617
+ return __generator(this, function (_a) {
618
+ return [2 /*return*/, this.nodeClient.broadcastSignedTransaction(transaction.encoded)];
619
+ });
620
+ });
621
+ };
622
+ // Custom
623
+ CosmosProtocolImpl.prototype.getKeyPairFromSecretKey = function (secretKey) {
624
+ return __awaiter(this, void 0, void 0, function () {
625
+ var hexSecretKey, publicKey;
626
+ return __generator(this, function (_a) {
627
+ hexSecretKey = (0, key_1.convertSecretKey)(secretKey, 'hex');
628
+ publicKey = SECP256K1.publicKeyCreate(Buffer.from(secretKey.value, 'hex'));
629
+ return [2 /*return*/, {
630
+ secretKey: hexSecretKey,
631
+ publicKey: (0, module_kit_1.newPublicKey)(Buffer.from(publicKey, 'binary').toString('hex'), 'hex')
632
+ }];
633
+ });
634
+ });
635
+ };
636
+ return CosmosProtocolImpl;
637
+ }());
638
+ exports.CosmosProtocolImpl = CosmosProtocolImpl;
639
+ // Factory
640
+ function createCosmosProtocol(options) {
641
+ if (options === void 0) { options = {}; }
642
+ return new CosmosProtocolImpl(options);
643
+ }
644
+ exports.createCosmosProtocol = createCosmosProtocol;
645
+ exports.COSMOS_MAINNET_PROTOCOL_NETWORK = {
646
+ name: 'Mainnet',
647
+ type: 'mainnet',
648
+ rpcUrl: 'https://cosmos-node.prod.gke.papers.tech'
649
+ };
650
+ var DEFAULT_COSMOS_PROTOCOL_NETWORK = exports.COSMOS_MAINNET_PROTOCOL_NETWORK;
651
+ function createCosmosProtocolOptions(network) {
652
+ if (network === void 0) { network = {}; }
653
+ return {
654
+ network: __assign(__assign({}, DEFAULT_COSMOS_PROTOCOL_NETWORK), network)
655
+ };
656
+ }
657
+ exports.createCosmosProtocolOptions = createCosmosProtocolOptions;
658
+ //# sourceMappingURL=CosmosProtocol.js.map