@airgap/cosmos 0.13.45-beta.1 → 0.13.45-beta.3

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 (46) hide show
  1. package/package.json +6 -6
  2. package/v0/index.js +8 -8
  3. package/v0/index.js.map +1 -1
  4. package/v0/protocol/CosmosAddress.js +15 -16
  5. package/v0/protocol/CosmosAddress.js.map +1 -1
  6. package/v0/protocol/CosmosCoin.js +23 -24
  7. package/v0/protocol/CosmosCoin.js.map +1 -1
  8. package/v0/protocol/CosmosCryptoClient.js +19 -82
  9. package/v0/protocol/CosmosCryptoClient.js.map +1 -1
  10. package/v0/protocol/CosmosFee.js +16 -17
  11. package/v0/protocol/CosmosFee.js.map +1 -1
  12. package/v0/protocol/CosmosNodeClient.js +173 -365
  13. package/v0/protocol/CosmosNodeClient.js.map +1 -1
  14. package/v0/protocol/CosmosProtocol.d.ts +0 -1
  15. package/v0/protocol/CosmosProtocol.js +577 -1094
  16. package/v0/protocol/CosmosProtocol.js.map +1 -1
  17. package/v0/protocol/CosmosProtocolOptions.js +25 -98
  18. package/v0/protocol/CosmosProtocolOptions.js.map +1 -1
  19. package/v0/protocol/CosmosTransaction.js +37 -39
  20. package/v0/protocol/CosmosTransaction.js.map +1 -1
  21. package/v0/protocol/CosmosTypes.js +1 -1
  22. package/v0/protocol/CosmosTypes.js.map +1 -1
  23. package/v0/protocol/cosmos-message/CosmosDelegateMessage.js +24 -27
  24. package/v0/protocol/cosmos-message/CosmosDelegateMessage.js.map +1 -1
  25. package/v0/protocol/cosmos-message/CosmosMessage.js +11 -12
  26. package/v0/protocol/cosmos-message/CosmosMessage.js.map +1 -1
  27. package/v0/protocol/cosmos-message/CosmosSendMessage.js +31 -41
  28. package/v0/protocol/cosmos-message/CosmosSendMessage.js.map +1 -1
  29. package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js +20 -21
  30. package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js.map +1 -1
  31. package/v0/serializer/validators/transaction-validator.js +25 -77
  32. package/v0/serializer/validators/transaction-validator.js.map +1 -1
  33. package/v1/block-explorer/MintscanBlockExplorer.js +12 -61
  34. package/v1/block-explorer/MintscanBlockExplorer.js.map +1 -1
  35. package/v1/index.js +3 -3
  36. package/v1/index.js.map +1 -1
  37. package/v1/module/CosmosModule.d.ts +1 -1
  38. package/v1/module/CosmosModule.js +37 -95
  39. package/v1/module/CosmosModule.js.map +1 -1
  40. package/v1/module.js +2 -3
  41. package/v1/module.js.map +1 -1
  42. package/v1/protocol/CosmosProtocol.d.ts +1 -1
  43. package/v1/protocol/CosmosProtocol.js +35 -113
  44. package/v1/protocol/CosmosProtocol.js.map +1 -1
  45. package/v1/serializer/v3/serializer-companion.js +57 -124
  46. package/v1/serializer/v3/serializer-companion.js.map +1 -1
@@ -1,107 +1,49 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
3
  exports.CosmosModule = void 0;
40
- var coinlib_core_1 = require("@airgap/coinlib-core");
41
- var errors_1 = require("@airgap/coinlib-core/errors");
42
- var module_kit_1 = require("@airgap/module-kit");
43
- var MintscanBlockExplorer_1 = require("../block-explorer/MintscanBlockExplorer");
44
- var CosmosProtocol_1 = require("../protocol/CosmosProtocol");
45
- var serializer_companion_1 = require("../serializer/v3/serializer-companion");
46
- var CosmosModule = /** @class */ (function () {
47
- function CosmosModule() {
48
- var _a;
49
- this.networkRegistries = (_a = {},
50
- _a[coinlib_core_1.MainProtocolSymbols.COSMOS] = new module_kit_1.ModuleNetworkRegistry({
4
+ const coinlib_core_1 = require("@airgap/coinlib-core");
5
+ const errors_1 = require("@airgap/coinlib-core/errors");
6
+ const module_kit_1 = require("@airgap/module-kit");
7
+ const MintscanBlockExplorer_1 = require("../block-explorer/MintscanBlockExplorer");
8
+ const CosmosProtocol_1 = require("../protocol/CosmosProtocol");
9
+ const serializer_companion_1 = require("../serializer/v3/serializer-companion");
10
+ class CosmosModule {
11
+ constructor() {
12
+ this.networkRegistries = {
13
+ [coinlib_core_1.MainProtocolSymbols.COSMOS]: new module_kit_1.ModuleNetworkRegistry({
51
14
  supportedNetworks: [CosmosProtocol_1.COSMOS_MAINNET_PROTOCOL_NETWORK]
52
- }),
53
- _a);
15
+ })
16
+ };
54
17
  this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
55
18
  }
56
- CosmosModule.prototype.createOfflineProtocol = function (identifier) {
57
- return __awaiter(this, void 0, void 0, function () {
58
- return __generator(this, function (_a) {
59
- return [2 /*return*/, this.createProtocol(identifier)];
60
- });
61
- });
62
- };
63
- CosmosModule.prototype.createOnlineProtocol = function (identifier, networkOrId) {
64
- var _a;
65
- return __awaiter(this, void 0, void 0, function () {
66
- var network;
67
- return __generator(this, function (_b) {
68
- network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
69
- if (network === undefined) {
70
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, 'Protocol network type not supported.');
71
- }
72
- return [2 /*return*/, this.createProtocol(identifier, network)];
73
- });
74
- });
75
- };
76
- CosmosModule.prototype.createBlockExplorer = function (identifier, networkOrId) {
77
- var _a;
78
- return __awaiter(this, void 0, void 0, function () {
79
- var network;
80
- return __generator(this, function (_b) {
81
- network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
82
- if (network === undefined) {
83
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, 'Block Explorer network type not supported.');
84
- }
85
- return [2 /*return*/, new MintscanBlockExplorer_1.MintscanBlockExplorer(network.blockExplorerUrl)];
86
- });
87
- });
88
- };
89
- CosmosModule.prototype.createV3SerializerCompanion = function () {
90
- return __awaiter(this, void 0, void 0, function () {
91
- return __generator(this, function (_a) {
92
- return [2 /*return*/, new serializer_companion_1.CosmosV3SerializerCompanion()];
93
- });
94
- });
95
- };
96
- CosmosModule.prototype.createProtocol = function (identifier, network) {
19
+ async createOfflineProtocol(identifier) {
20
+ return this.createProtocol(identifier);
21
+ }
22
+ async createOnlineProtocol(identifier, networkOrId) {
23
+ const network = typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId);
24
+ if (network === undefined) {
25
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, 'Protocol network type not supported.');
26
+ }
27
+ return this.createProtocol(identifier, network);
28
+ }
29
+ async createBlockExplorer(identifier, networkOrId) {
30
+ const network = typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId);
31
+ if (network === undefined) {
32
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, 'Block Explorer network type not supported.');
33
+ }
34
+ return new MintscanBlockExplorer_1.MintscanBlockExplorer(network.blockExplorerUrl);
35
+ }
36
+ async createV3SerializerCompanion() {
37
+ return new serializer_companion_1.CosmosV3SerializerCompanion();
38
+ }
39
+ createProtocol(identifier, network) {
97
40
  switch (identifier) {
98
41
  case coinlib_core_1.MainProtocolSymbols.COSMOS:
99
- return (0, CosmosProtocol_1.createCosmosProtocol)({ network: network });
42
+ return (0, CosmosProtocol_1.createCosmosProtocol)({ network });
100
43
  default:
101
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, "Protocol ".concat(identifier, " not supported."));
44
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, `Protocol ${identifier} not supported.`);
102
45
  }
103
- };
104
- return CosmosModule;
105
- }());
46
+ }
47
+ }
106
48
  exports.CosmosModule = CosmosModule;
107
49
  //# sourceMappingURL=CosmosModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CosmosModule.js","sourceRoot":"","sources":["../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AC,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;QAE9G,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,MAAM,EAAE,sCAAsC,CAAC,CAAA;QAC1F,CAAC;QAED,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,UAA8B,EAC9B,WAA4C;QAE5C,MAAM,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;QAE9G,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,MAAM,EAAE,4CAA4C,CAAC,CAAA;QAChG,CAAC;QAED,OAAO,IAAI,6CAAqB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC5D,CAAC;IAEM,KAAK,CAAC,2BAA2B;QACtC,OAAO,IAAI,kDAA2B,EAAE,CAAA;IAC1C,CAAC;IAEO,cAAc,CAAC,UAA8B,EAAE,OAAyB;QAC9E,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,kCAAmB,CAAC,MAAM;gBAC7B,OAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,EAAE,CAAC,CAAA;YAC1C;gBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,MAAM,EAAE,YAAY,UAAU,iBAAiB,CAAC,CAAA;QAC7F,CAAC;IACH,CAAC;CACF;AApDD,oCAoDC"}
package/v1/module.js CHANGED
@@ -14,11 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.create = void 0;
18
- var CosmosModule_1 = require("./module/CosmosModule");
17
+ exports.create = create;
18
+ const CosmosModule_1 = require("./module/CosmosModule");
19
19
  __exportStar(require("./index"), exports);
20
20
  function create() {
21
21
  return new CosmosModule_1.CosmosModule();
22
22
  }
23
- exports.create = create;
24
23
  //# sourceMappingURL=module.js.map
package/v1/module.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,sDAAoD;AAEpD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,2BAAY,EAAE,CAAA;AAC3B,CAAC;AAFD,wBAEC"}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,wBAEC;AAND,wDAAoD;AAEpD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,2BAAY,EAAE,CAAA;AAC3B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { FeeDefaults, ProtocolMetadata, PublicKey, RecursivePartial, TransactionDetails, TransactionSimpleConfiguration } from '@airgap/module-kit';
2
2
  import { CosmosBaseProtocolImpl, CosmosProtocolNetwork, CosmosProtocolOptions, CosmosBaseStakingProtocol } from '@airgap/cosmos-core';
3
- export declare type CosmosDenom = 'atom' | 'uatom';
3
+ export type CosmosDenom = 'atom' | 'uatom';
4
4
  export interface CosmosProtocol extends CosmosBaseStakingProtocol<CosmosDenom> {
5
5
  }
6
6
  export declare class CosmosProtocolImpl extends CosmosBaseProtocolImpl<CosmosDenom> implements CosmosProtocol {
@@ -1,82 +1,19 @@
1
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
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
- return new (P || (P = Promise))(function (resolve, reject) {
31
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
- step((generator = generator.apply(thisArg, _arguments || [])).next());
35
- });
36
- };
37
- var __generator = (this && this.__generator) || function (thisArg, body) {
38
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
- function verb(n) { return function (v) { return step([n, v]); }; }
41
- function step(op) {
42
- if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
44
- 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;
45
- if (y = 0, t) op = [op[0] & 2, t.value];
46
- switch (op[0]) {
47
- case 0: case 1: t = op; break;
48
- case 4: _.label++; return { value: op[1], done: false };
49
- case 5: _.label++; y = op[1]; op = [0]; continue;
50
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
- default:
52
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
- if (t[2]) _.ops.pop();
57
- _.trys.pop(); continue;
58
- }
59
- op = body.call(thisArg, _);
60
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
- }
63
- };
64
2
  Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.createCosmosProtocolOptions = exports.COSMOS_MAINNET_PROTOCOL_NETWORK = exports.createCosmosProtocol = exports.CosmosProtocolImpl = void 0;
66
- var coinlib_core_1 = require("@airgap/coinlib-core");
67
- var module_kit_1 = require("@airgap/module-kit");
68
- var cosmos_core_1 = require("@airgap/cosmos-core");
3
+ exports.COSMOS_MAINNET_PROTOCOL_NETWORK = exports.CosmosProtocolImpl = void 0;
4
+ exports.createCosmosProtocol = createCosmosProtocol;
5
+ exports.createCosmosProtocolOptions = createCosmosProtocolOptions;
6
+ const coinlib_core_1 = require("@airgap/coinlib-core");
7
+ const module_kit_1 = require("@airgap/module-kit");
8
+ const cosmos_core_1 = require("@airgap/cosmos-core");
69
9
  // Implementation
70
- var DEFAULT_GAS = (0, module_kit_1.newAmount)('600000', 'blockchain');
71
- var CosmosProtocolImpl = /** @class */ (function (_super) {
72
- __extends(CosmosProtocolImpl, _super);
73
- function CosmosProtocolImpl(options) {
74
- if (options === void 0) { options = {}; }
75
- var _this = this;
76
- var fullOptions = createCosmosProtocolOptions(options);
77
- _this = _super.call(this, fullOptions) || this;
10
+ const DEFAULT_GAS = (0, module_kit_1.newAmount)('600000', 'blockchain');
11
+ class CosmosProtocolImpl extends cosmos_core_1.CosmosBaseProtocolImpl {
12
+ constructor(options = {}) {
13
+ const fullOptions = createCosmosProtocolOptions(options);
14
+ super(fullOptions);
78
15
  // Common
79
- _this.units = {
16
+ this.units = {
80
17
  atom: {
81
18
  symbol: { value: 'ATOM', market: 'atom' },
82
19
  decimals: 6
@@ -86,21 +23,21 @@ var CosmosProtocolImpl = /** @class */ (function (_super) {
86
23
  decimals: 0
87
24
  }
88
25
  };
89
- _this.feeDefaults = {
90
- low: (0, module_kit_1.newAmount)(0.0025, 'atom').blockchain(_this.units),
91
- medium: (0, module_kit_1.newAmount)(0.005, 'atom').blockchain(_this.units),
92
- high: (0, module_kit_1.newAmount)(0.01, 'atom').blockchain(_this.units)
26
+ this.feeDefaults = {
27
+ low: (0, module_kit_1.newAmount)(0.0025, 'atom').blockchain(this.units),
28
+ medium: (0, module_kit_1.newAmount)(0.005, 'atom').blockchain(this.units),
29
+ high: (0, module_kit_1.newAmount)(0.01, 'atom').blockchain(this.units)
93
30
  };
94
- _this.metadata = {
31
+ this.metadata = {
95
32
  identifier: coinlib_core_1.MainProtocolSymbols.COSMOS,
96
33
  name: 'Cosmos',
97
- units: _this.units,
34
+ units: this.units,
98
35
  mainUnit: 'atom',
99
36
  fee: {
100
- defaults: _this.feeDefaults
37
+ defaults: this.feeDefaults
101
38
  },
102
39
  account: {
103
- standardDerivationPath: "m/44'/118'/0'/0/0",
40
+ standardDerivationPath: `m/44'/118'/0'/0/0`,
104
41
  address: {
105
42
  isCaseSensitive: false,
106
43
  placeholder: 'cosmos...',
@@ -113,50 +50,35 @@ var CosmosProtocolImpl = /** @class */ (function (_super) {
113
50
  }
114
51
  }
115
52
  };
116
- return _this;
117
53
  }
118
- CosmosProtocolImpl.prototype.getMetadata = function () {
119
- return __awaiter(this, void 0, void 0, function () {
120
- return __generator(this, function (_a) {
121
- return [2 /*return*/, this.metadata];
122
- });
123
- });
124
- };
125
- CosmosProtocolImpl.prototype.getTransactionFeeWithPublicKey = function (_publicKey, _details, _configuration) {
126
- return __awaiter(this, void 0, void 0, function () {
127
- return __generator(this, function (_a) {
128
- return [2 /*return*/, this.feeDefaults];
129
- });
130
- });
131
- };
132
- return CosmosProtocolImpl;
133
- }(cosmos_core_1.CosmosBaseProtocolImpl));
54
+ async getMetadata() {
55
+ return this.metadata;
56
+ }
57
+ async getTransactionFeeWithPublicKey(_publicKey, _details, _configuration) {
58
+ return this.feeDefaults;
59
+ }
60
+ }
134
61
  exports.CosmosProtocolImpl = CosmosProtocolImpl;
135
62
  // Factory
136
- function createCosmosProtocol(options) {
137
- if (options === void 0) { options = {}; }
63
+ function createCosmosProtocol(options = {}) {
138
64
  return new CosmosProtocolImpl(options);
139
65
  }
140
- exports.createCosmosProtocol = createCosmosProtocol;
141
66
  exports.COSMOS_MAINNET_PROTOCOL_NETWORK = {
142
67
  name: 'Mainnet',
143
68
  type: 'mainnet',
144
69
  rpcUrl: 'https://cosmos-node.prod.gke.papers.tech',
145
70
  blockExplorerUrl: 'https://www.mintscan.io'
146
71
  };
147
- var DEFAULT_COSMOS_PROTOCOL_NETWORK = exports.COSMOS_MAINNET_PROTOCOL_NETWORK;
148
- function createCosmosProtocolOptions(partialOptions) {
149
- var _a, _b, _c, _d, _e, _f;
150
- if (partialOptions === void 0) { partialOptions = {}; }
72
+ const DEFAULT_COSMOS_PROTOCOL_NETWORK = exports.COSMOS_MAINNET_PROTOCOL_NETWORK;
73
+ function createCosmosProtocolOptions(partialOptions = {}) {
151
74
  return {
152
- network: __assign(__assign({}, DEFAULT_COSMOS_PROTOCOL_NETWORK), partialOptions.network),
153
- addressPrefix: (_a = partialOptions.addressPrefix) !== null && _a !== void 0 ? _a : 'cosmos',
154
- baseUnit: (_b = partialOptions.baseUnit) !== null && _b !== void 0 ? _b : 'uatom',
75
+ network: { ...DEFAULT_COSMOS_PROTOCOL_NETWORK, ...partialOptions.network },
76
+ addressPrefix: partialOptions.addressPrefix ?? 'cosmos',
77
+ baseUnit: partialOptions.baseUnit ?? 'uatom',
155
78
  defaultGas: {
156
- value: (_d = (_c = partialOptions.defaultGas) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : DEFAULT_GAS.value,
157
- unit: (_f = (_e = partialOptions.defaultGas) === null || _e === void 0 ? void 0 : _e.unit) !== null && _f !== void 0 ? _f : DEFAULT_GAS.unit
79
+ value: partialOptions.defaultGas?.value ?? DEFAULT_GAS.value,
80
+ unit: partialOptions.defaultGas?.unit ?? DEFAULT_GAS.unit
158
81
  }
159
82
  };
160
83
  }
161
- exports.createCosmosProtocolOptions = createCosmosProtocolOptions;
162
84
  //# sourceMappingURL=CosmosProtocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CosmosProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/CosmosProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0D;AAC1D,iDAU2B;AAE3B,mDAAqI;AAIrI,iBAAiB;AACjB,IAAM,WAAW,GAAwB,IAAA,sBAAS,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;AAI1E;IAAwC,sCAAmC;IACzE,4BAAmB,OAAkE;QAAlE,wBAAA,EAAA,YAAkE;QAArF,iBAIC;QAHC,IAAM,WAAW,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAA;gBAExD,kBAAM,WAAW,CAAC;QAGpB,SAAS;QAEQ,WAAK,GAAuC;YAC3D,IAAI,EAAE;gBACJ,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;gBACzC,QAAQ,EAAE,CAAC;aACZ;YACD,KAAK,EAAE;gBACL,M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CAAC,UAAgE,EAAE;IACrG,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAA;AACxC,CAAC;AAEY,QAAA,+BAA+B,GAA0B;IACpE,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,0CAA0C;IAClD,gBAAgB,EAAE,yBAAyB;CAC5C,CAAA;AAED,MAAM,+BAA+B,GAA0B,uCAA+B,CAAA;AAE9F,SAAgB,2BAA2B,CACzC,iBAAuE,EAAE;IAEzE,OAAO;QACL,OAAO,EAAE,EAAE,GAAG,+BAA+B,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE;QAC1E,aAAa,EAAE,cAAc,CAAC,aAAa,IAAI,QAAQ;QACvD,QAAQ,EAAE,cAAc,CAAC,QAAQ,IAAI,OAAO;QAC5C,UAAU,EAAE;YACV,KAAK,EAAE,cAAc,CAAC,UAAU,EAAE,KAAK,IAAI,WAAW,CAAC,KAAK;YAC5D,IAAI,EAAE,cAAc,CAAC,UAAU,EAAE,IAAI,IAAI,WAAW,CAAC,IAAI;SAC1D;KACF,CAAA;AACH,CAAC"}
@@ -1,50 +1,14 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
3
  exports.CosmosV3SerializerCompanion = void 0;
40
- var coinlib_core_1 = require("@airgap/coinlib-core");
41
- var errors_1 = require("@airgap/coinlib-core/errors");
42
- var cosmos_core_1 = require("@airgap/cosmos-core");
43
- var serializer_1 = require("@airgap/serializer");
44
- var cosmosTransactionSignRequest = require('@airgap/cosmos-core/v1/serializer/v3/schemas/generated/transaction-sign-request-cosmos.json');
45
- var cosmosTransactionSignResponse = require('@airgap/cosmos-core/v1/serializer/v3/schemas/generated/transaction-sign-response-cosmos.json');
46
- var CosmosV3SerializerCompanion = /** @class */ (function () {
47
- function CosmosV3SerializerCompanion() {
4
+ const coinlib_core_1 = require("@airgap/coinlib-core");
5
+ const errors_1 = require("@airgap/coinlib-core/errors");
6
+ const cosmos_core_1 = require("@airgap/cosmos-core");
7
+ const serializer_1 = require("@airgap/serializer");
8
+ const cosmosTransactionSignRequest = require('@airgap/cosmos-core/v1/serializer/v3/schemas/generated/transaction-sign-request-cosmos.json');
9
+ const cosmosTransactionSignResponse = require('@airgap/cosmos-core/v1/serializer/v3/schemas/generated/transaction-sign-response-cosmos.json');
10
+ class CosmosV3SerializerCompanion {
11
+ constructor() {
48
12
  this.schemas = [
49
13
  {
50
14
  type: serializer_1.IACMessageType.TransactionSignRequest,
@@ -58,85 +22,54 @@ var CosmosV3SerializerCompanion = /** @class */ (function () {
58
22
  }
59
23
  ];
60
24
  }
61
- CosmosV3SerializerCompanion.prototype.toTransactionSignRequest = function (identifier, unsignedTransaction, publicKey, callbackUrl) {
62
- return __awaiter(this, void 0, void 0, function () {
63
- return __generator(this, function (_a) {
64
- switch (identifier) {
65
- case coinlib_core_1.MainProtocolSymbols.COSMOS:
66
- return [2 /*return*/, (0, cosmos_core_1.cosmosUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl)];
67
- default:
68
- throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, "Protocol ".concat(identifier, " not supported"));
69
- }
70
- return [2 /*return*/];
71
- });
72
- });
73
- };
74
- CosmosV3SerializerCompanion.prototype.fromTransactionSignRequest = function (identifier, transactionSignRequest) {
75
- return __awaiter(this, void 0, void 0, function () {
76
- return __generator(this, function (_a) {
77
- switch (identifier) {
78
- case coinlib_core_1.MainProtocolSymbols.COSMOS:
79
- return [2 /*return*/, (0, cosmos_core_1.cosmosTransactionSignRequestToUnsigned)(transactionSignRequest)];
80
- default:
81
- throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, "Protocol ".concat(identifier, " not supported"));
82
- }
83
- return [2 /*return*/];
84
- });
85
- });
86
- };
87
- CosmosV3SerializerCompanion.prototype.validateTransactionSignRequest = function (identifier, _transactionSignRequest) {
88
- return __awaiter(this, void 0, void 0, function () {
89
- return __generator(this, function (_a) {
90
- switch (identifier) {
91
- case coinlib_core_1.MainProtocolSymbols.COSMOS:
92
- return [2 /*return*/, true];
93
- default:
94
- throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, "Protocol ".concat(identifier, " not supported"));
95
- }
96
- return [2 /*return*/];
97
- });
98
- });
99
- };
100
- CosmosV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
101
- return __awaiter(this, void 0, void 0, function () {
102
- return __generator(this, function (_a) {
103
- switch (identifier) {
104
- case coinlib_core_1.MainProtocolSymbols.COSMOS:
105
- return [2 /*return*/, (0, cosmos_core_1.cosmosSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
106
- default:
107
- throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, "Protocol ".concat(identifier, " not supported"));
108
- }
109
- return [2 /*return*/];
110
- });
111
- });
112
- };
113
- CosmosV3SerializerCompanion.prototype.fromTransactionSignResponse = function (identifier, transactionSignResponse) {
114
- return __awaiter(this, void 0, void 0, function () {
115
- return __generator(this, function (_a) {
116
- switch (identifier) {
117
- case coinlib_core_1.MainProtocolSymbols.COSMOS:
118
- return [2 /*return*/, (0, cosmos_core_1.cosmosTransactionSignResponseToSigned)(transactionSignResponse)];
119
- default:
120
- throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, "Protocol ".concat(identifier, " not supported"));
121
- }
122
- return [2 /*return*/];
123
- });
124
- });
125
- };
126
- CosmosV3SerializerCompanion.prototype.validateTransactionSignResponse = function (identifier, _transactionSignResponse) {
127
- return __awaiter(this, void 0, void 0, function () {
128
- return __generator(this, function (_a) {
129
- switch (identifier) {
130
- case coinlib_core_1.MainProtocolSymbols.COSMOS:
131
- return [2 /*return*/, true];
132
- default:
133
- throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, "Protocol ".concat(identifier, " not supported"));
134
- }
135
- return [2 /*return*/];
136
- });
137
- });
138
- };
139
- return CosmosV3SerializerCompanion;
140
- }());
25
+ async toTransactionSignRequest(identifier, unsignedTransaction, publicKey, callbackUrl) {
26
+ switch (identifier) {
27
+ case coinlib_core_1.MainProtocolSymbols.COSMOS:
28
+ return (0, cosmos_core_1.cosmosUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl);
29
+ default:
30
+ throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, `Protocol ${identifier} not supported`);
31
+ }
32
+ }
33
+ async fromTransactionSignRequest(identifier, transactionSignRequest) {
34
+ switch (identifier) {
35
+ case coinlib_core_1.MainProtocolSymbols.COSMOS:
36
+ return (0, cosmos_core_1.cosmosTransactionSignRequestToUnsigned)(transactionSignRequest);
37
+ default:
38
+ throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, `Protocol ${identifier} not supported`);
39
+ }
40
+ }
41
+ async validateTransactionSignRequest(identifier, _transactionSignRequest) {
42
+ switch (identifier) {
43
+ case coinlib_core_1.MainProtocolSymbols.COSMOS:
44
+ return true;
45
+ default:
46
+ throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, `Protocol ${identifier} not supported`);
47
+ }
48
+ }
49
+ async toTransactionSignResponse(identifier, signedTransaction, accountIdentifier) {
50
+ switch (identifier) {
51
+ case coinlib_core_1.MainProtocolSymbols.COSMOS:
52
+ return (0, cosmos_core_1.cosmosSignedTransactionToResponse)(signedTransaction, accountIdentifier);
53
+ default:
54
+ throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, `Protocol ${identifier} not supported`);
55
+ }
56
+ }
57
+ async fromTransactionSignResponse(identifier, transactionSignResponse) {
58
+ switch (identifier) {
59
+ case coinlib_core_1.MainProtocolSymbols.COSMOS:
60
+ return (0, cosmos_core_1.cosmosTransactionSignResponseToSigned)(transactionSignResponse);
61
+ default:
62
+ throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, `Protocol ${identifier} not supported`);
63
+ }
64
+ }
65
+ async validateTransactionSignResponse(identifier, _transactionSignResponse) {
66
+ switch (identifier) {
67
+ case coinlib_core_1.MainProtocolSymbols.COSMOS:
68
+ return true;
69
+ default:
70
+ throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, `Protocol ${identifier} not supported`);
71
+ }
72
+ }
73
+ }
141
74
  exports.CosmosV3SerializerCompanion = CosmosV3SerializerCompanion;
142
75
  //# sourceMappingURL=serializer-companion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAA8D;AAC9D,mDAO4B;AAG5B,iDAAgH;AAEhH,IAAM,4BAA4B,GAAe,OAAO,CAAC,6FAA6F,CAAC,CAAA;AACvJ,IAAM,6BAA6B,GAAe,OAAO,CAAC,8FAA8F,CAAC,CAAA;AAEzJ;IAAA;QACkB,YAAO,GAA4B;YACjD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,4BAA4B,EAAE;gBAChD,kBAAkB,EAAE,kCAAmB,CAAC,MAAM;aAC/C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,6BAA6B,EAAE;gBACjD,kBAAkB,EAAE,kCAAmB,CAAC,MAAM;aAC/C;SACF,CAAA;IAsEH,CAAC;IApEc,8DAAwB,GAArC,UACE,UAAkB,EAClB,mBAAwC,EACxC,SAAiB,EACjB,WAAoB;;;gBAEpB,QAAQ,UAAU,EAAE;oBAClB,KAAK,kCAAmB,CAAC,MAAM;wBAC7B,sBAAO,IAAA,gDAAkC,EAAC,mBAAgD,EAAE,SAAS,EAAE,WAAW,CAAC,EAAA;oBACrH;wBACE,MAAM,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Y,qEAA+B,GAA5C,UAA6C,UAAkB,EAAE,wBAAiD;;;gBAChH,QAAQ,UAAU,EAAE;oBAClB,KAAK,kCAAmB,CAAC,MAAM;wBAC7B,sBAAO,IAAI,EAAA;oBACb;wBACE,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,MAAM,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;iBACpF;;;;KACF;IACH,kCAAC;AAAD,CAAC,AAlFD,IAkFC;AAlFY,kEAA2B"}
1
+ {"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAClE,wDAA8D;AAC9D,qDAO4B;AAG5B,mDAAgH;AAEhH,MAAM,4BAA4B,GAAe,OAAO,CAAC,6FAA6F,CAAC,CAAA;AACvJ,MAAM,6BAA6B,GAAe,OAAO,CAAC,8FAA8F,CAAC,CAAA;AAEzJ,MAAa,2BAA2B;IAAxC;QACkB,YAAO,GAA4B;YACjD;gBACE,IAAI,EAAE,2BAAc,CAAC,sBAAsB;gBAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,4BAA4B,EAAE;gBAChD,kBAAkB,EAAE,kCAAmB,CAAC,MAAM;aAC/C;YACD;gBACE,IAAI,EAAE,2BAAc,CAAC,uBAAuB;gBAC5C,MAAM,EAAE,EAAE,MAAM,EAAE,6BAA6B,EAAE;gBACjD,kBAAkB,EAAE,kCAAmB,CAAC,MAAM;aAC/C;SACF,CAAA;IAsEH,CAAC;IApEQ,KAAK,CAAC,wBAAwB,CACnC,UAAkB,EAClB,mBAAwC,EACxC,SAAiB,EACjB,WAAoB;QAEpB,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,kCAAmB,CAAC,MAAM;gBAC7B,OAAO,IAAA,gDAAkC,EAAC,mBAAgD,EAAE,SAAS,EAAE,WAAW,CAAC,CAAA;YACrH;gBACE,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,MAAM,E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