@airgap/coreum 0.13.45-beta.2 → 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.
- package/package.json +6 -6
- package/v1/block-explorer/CoreumExplorer.js +12 -61
- package/v1/block-explorer/CoreumExplorer.js.map +1 -1
- package/v1/index.js +3 -3
- package/v1/index.js.map +1 -1
- package/v1/module/CoreumModule.d.ts +1 -1
- package/v1/module/CoreumModule.js +37 -95
- package/v1/module/CoreumModule.js.map +1 -1
- package/v1/module.js +2 -3
- package/v1/module.js.map +1 -1
- package/v1/protocol/CoreumProtocol.d.ts +1 -1
- package/v1/protocol/CoreumProtocol.js +35 -113
- package/v1/protocol/CoreumProtocol.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +57 -124
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/coreum",
|
|
3
|
-
"version": "0.13.45-beta.
|
|
3
|
+
"version": "0.13.45-beta.3",
|
|
4
4
|
"description": "The @airgap/coreum is a Coreum implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
},
|
|
31
31
|
"author": "Papers AG <contact@papers.ch> (https://papers.ch)",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@airgap/coinlib-core": "^0.13.45-beta.
|
|
34
|
-
"@airgap/cosmos-core": "^0.13.45-beta.
|
|
35
|
-
"@airgap/crypto": "^0.13.45-beta.
|
|
36
|
-
"@airgap/module-kit": "^0.13.45-beta.
|
|
37
|
-
"@airgap/serializer": "^0.13.45-beta.
|
|
33
|
+
"@airgap/coinlib-core": "^0.13.45-beta.3",
|
|
34
|
+
"@airgap/cosmos-core": "^0.13.45-beta.3",
|
|
35
|
+
"@airgap/crypto": "^0.13.45-beta.3",
|
|
36
|
+
"@airgap/module-kit": "^0.13.45-beta.3",
|
|
37
|
+
"@airgap/serializer": "^0.13.45-beta.3"
|
|
38
38
|
},
|
|
39
39
|
"nyc": {
|
|
40
40
|
"include": [
|
|
@@ -1,72 +1,23 @@
|
|
|
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.CoreumBlockExplorer = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
4
|
+
class CoreumBlockExplorer {
|
|
5
|
+
constructor(url) {
|
|
42
6
|
this.url = url;
|
|
43
7
|
this.metadata = {
|
|
44
8
|
name: 'Coreum Explorer',
|
|
45
9
|
url: this.url
|
|
46
10
|
};
|
|
47
11
|
}
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return [2 /*return*/, "".concat(this.url, "/accounts/").concat(address)];
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
CoreumBlockExplorer.prototype.createTransactionUrl = function (transactionId) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
-
return __generator(this, function (_a) {
|
|
65
|
-
return [2 /*return*/, "".concat(this.url, "/transactions/").concat(transactionId)];
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
return CoreumBlockExplorer;
|
|
70
|
-
}());
|
|
12
|
+
async getMetadata() {
|
|
13
|
+
return this.metadata;
|
|
14
|
+
}
|
|
15
|
+
async createAddressUrl(address) {
|
|
16
|
+
return `${this.url}/accounts/${address}`;
|
|
17
|
+
}
|
|
18
|
+
async createTransactionUrl(transactionId) {
|
|
19
|
+
return `${this.url}/transactions/${transactionId}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
71
22
|
exports.CoreumBlockExplorer = CoreumBlockExplorer;
|
|
72
23
|
//# sourceMappingURL=CoreumExplorer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreumExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/CoreumExplorer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoreumExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/CoreumExplorer.ts"],"names":[],"mappings":";;;AAEA,MAAa,mBAAmB;IAM9B,YAAoC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAL9B,aAAQ,GAA0B;YACjD,IAAI,EAAE,iBAAiB;YACvB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IAEiD,CAAC;IAE5C,KAAK,CAAC,WAAW;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,OAAe;QAC3C,OAAO,GAAG,IAAI,CAAC,GAAG,aAAa,OAAO,EAAE,CAAA;IAC1C,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,aAAqB;QACrD,OAAO,GAAG,IAAI,CAAC,GAAG,iBAAiB,aAAa,EAAE,CAAA;IACpD,CAAC;CACF;AAnBD,kDAmBC"}
|
package/v1/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoreumBlockExplorer = exports.createCoreumProtocolOptions = exports.createCoreumProtocol = exports.CoreumModule = void 0;
|
|
4
|
-
|
|
4
|
+
const CoreumExplorer_1 = require("./block-explorer/CoreumExplorer");
|
|
5
5
|
Object.defineProperty(exports, "CoreumBlockExplorer", { enumerable: true, get: function () { return CoreumExplorer_1.CoreumBlockExplorer; } });
|
|
6
|
-
|
|
6
|
+
const CoreumModule_1 = require("./module/CoreumModule");
|
|
7
7
|
Object.defineProperty(exports, "CoreumModule", { enumerable: true, get: function () { return CoreumModule_1.CoreumModule; } });
|
|
8
|
-
|
|
8
|
+
const CoreumProtocol_1 = require("./protocol/CoreumProtocol");
|
|
9
9
|
Object.defineProperty(exports, "createCoreumProtocol", { enumerable: true, get: function () { return CoreumProtocol_1.createCoreumProtocol; } });
|
|
10
10
|
Object.defineProperty(exports, "createCoreumProtocolOptions", { enumerable: true, get: function () { return CoreumProtocol_1.createCoreumProtocolOptions; } });
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,oEAAqE;AAc5D,oGAdA,oCAAmB,OAcA;AAb5B,wDAAoD;AAK3C,6FALA,2BAAY,OAKA;AAJrB,8DAA6G;AAQpF,qGARA,qCAAoB,OAQA;AAAE,4GARA,4CAA2B,OAQA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MainProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
2
|
import { CosmosProtocolNetwork } from '@airgap/cosmos-core';
|
|
3
3
|
import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
|
|
4
|
-
|
|
4
|
+
type SupportedProtocols = MainProtocolSymbols.COREUM;
|
|
5
5
|
export declare class CoreumModule implements AirGapModule<{
|
|
6
6
|
Protocols: SupportedProtocols;
|
|
7
7
|
ProtocolNetwork: CosmosProtocolNetwork;
|
|
@@ -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.CoreumModule = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
_a[coinlib_core_1.MainProtocolSymbols.COREUM] = 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 CoreumExplorer_1 = require("../block-explorer/CoreumExplorer");
|
|
8
|
+
const CoreumProtocol_1 = require("../protocol/CoreumProtocol");
|
|
9
|
+
const serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
10
|
+
class CoreumModule {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.networkRegistries = {
|
|
13
|
+
[coinlib_core_1.MainProtocolSymbols.COREUM]: new module_kit_1.ModuleNetworkRegistry({
|
|
51
14
|
supportedNetworks: [CoreumProtocol_1.COREUM_PROTOCOL_NETWORK]
|
|
52
|
-
})
|
|
53
|
-
|
|
15
|
+
})
|
|
16
|
+
};
|
|
54
17
|
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
55
18
|
}
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
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 CoreumExplorer_1.CoreumBlockExplorer(network.blockExplorerUrl)];
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
CoreumModule.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.CoreumV3SerializerCompanion()];
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
CoreumModule.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.COREUM, '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 CoreumExplorer_1.CoreumBlockExplorer(network.blockExplorerUrl);
|
|
35
|
+
}
|
|
36
|
+
async createV3SerializerCompanion() {
|
|
37
|
+
return new serializer_companion_1.CoreumV3SerializerCompanion();
|
|
38
|
+
}
|
|
39
|
+
createProtocol(identifier, network) {
|
|
97
40
|
switch (identifier) {
|
|
98
41
|
case coinlib_core_1.MainProtocolSymbols.COREUM:
|
|
99
|
-
return (0, CoreumProtocol_1.createCoreumProtocol)({ network
|
|
42
|
+
return (0, CoreumProtocol_1.createCoreumProtocol)({ network });
|
|
100
43
|
default:
|
|
101
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COREUM,
|
|
44
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COREUM, `Protocol ${identifier} not supported.`);
|
|
102
45
|
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
}());
|
|
46
|
+
}
|
|
47
|
+
}
|
|
106
48
|
exports.CoreumModule = CoreumModule;
|
|
107
49
|
//# sourceMappingURL=CoreumModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreumModule.js","sourceRoot":"","sources":["../../../src/v1/module/CoreumModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoreumModule.js","sourceRoot":"","sources":["../../../src/v1/module/CoreumModule.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAClE,wDAAqE;AAErE,mDAW2B;AAE3B,qEAAsE;AACtE,+DAA0F;AAC1F,gFAAmF;AAInF,MAAa,YAAY;IAAzB;QACmB,sBAAiB,GAAsD;YACtF,CAAC,kCAAmB,CAAC,MAAM,CAAC,EAAE,IAAI,kCAAqB,CAAC;gBACtD,iBAAiB,EAAE,CAAC,wCAAuB,CAAC;aAC7C,CAAC;SACH,CAAA;QACe,uBAAkB,GAA8D,IAAA,qCAAwB,EACtH,IAAI,CAAC,iBAAiB,CACvB,CAAA;IA8CH,CAAC;IA5CQ,KAAK,CAAC,qBAAqB,CAAC,UAAsC;QACvE,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;IACxC,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAC/B,UAAsC,EACtC,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,sCAAsC,CAAC,CAAA;QAC1F,CAAC;QAED,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,UAAsC,EACtC,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,oCAAmB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC1D,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;AAtDD,oCAsDC"}
|
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 =
|
|
18
|
-
|
|
17
|
+
exports.create = create;
|
|
18
|
+
const CoreumModule_1 = require("./module/CoreumModule");
|
|
19
19
|
__exportStar(require("./index"), exports);
|
|
20
20
|
function create() {
|
|
21
21
|
return new CoreumModule_1.CoreumModule();
|
|
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":"
|
|
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 { CosmosBaseProtocolImpl, CosmosBaseStakingProtocol, CosmosProtocolNetwork, CosmosProtocolOptions } from '@airgap/cosmos-core';
|
|
2
2
|
import { FeeDefaults, ProtocolMetadata, PublicKey, RecursivePartial, TransactionDetails, TransactionSimpleConfiguration } from '@airgap/module-kit';
|
|
3
|
-
export
|
|
3
|
+
export type CoreumDenom = 'core' | 'ucore';
|
|
4
4
|
export interface CoreumProtocol extends CosmosBaseStakingProtocol<CoreumDenom> {
|
|
5
5
|
}
|
|
6
6
|
export declare class CoreumProtocolImpl extends CosmosBaseProtocolImpl<CoreumDenom> implements CoreumProtocol {
|
|
@@ -1,80 +1,17 @@
|
|
|
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.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
_this.units = {
|
|
3
|
+
exports.COREUM_PROTOCOL_NETWORK = exports.CoreumProtocolImpl = void 0;
|
|
4
|
+
exports.createCoreumProtocol = createCoreumProtocol;
|
|
5
|
+
exports.createCoreumProtocolOptions = createCoreumProtocolOptions;
|
|
6
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
7
|
+
const cosmos_core_1 = require("@airgap/cosmos-core");
|
|
8
|
+
const module_kit_1 = require("@airgap/module-kit");
|
|
9
|
+
const DEFAULT_GAS = (0, module_kit_1.newAmount)('200000', 'blockchain');
|
|
10
|
+
class CoreumProtocolImpl extends cosmos_core_1.CosmosBaseProtocolImpl {
|
|
11
|
+
constructor(options = {}) {
|
|
12
|
+
const fullOptions = createCoreumProtocolOptions(options);
|
|
13
|
+
super(fullOptions);
|
|
14
|
+
this.units = {
|
|
78
15
|
core: {
|
|
79
16
|
symbol: { value: 'CORE', market: 'CORE' },
|
|
80
17
|
decimals: 6
|
|
@@ -84,21 +21,21 @@ var CoreumProtocolImpl = /** @class */ (function (_super) {
|
|
|
84
21
|
decimals: 0
|
|
85
22
|
}
|
|
86
23
|
};
|
|
87
|
-
|
|
88
|
-
low: (0, module_kit_1.newAmount)(0.007, 'core').blockchain(
|
|
89
|
-
medium: (0, module_kit_1.newAmount)(0.0085, 'core').blockchain(
|
|
90
|
-
high: (0, module_kit_1.newAmount)(0.01, 'core').blockchain(
|
|
24
|
+
this.feeDefaults = {
|
|
25
|
+
low: (0, module_kit_1.newAmount)(0.007, 'core').blockchain(this.units),
|
|
26
|
+
medium: (0, module_kit_1.newAmount)(0.0085, 'core').blockchain(this.units),
|
|
27
|
+
high: (0, module_kit_1.newAmount)(0.01, 'core').blockchain(this.units)
|
|
91
28
|
};
|
|
92
|
-
|
|
29
|
+
this.metadata = {
|
|
93
30
|
identifier: coinlib_core_1.MainProtocolSymbols.COREUM,
|
|
94
31
|
name: 'Coreum',
|
|
95
|
-
units:
|
|
32
|
+
units: this.units,
|
|
96
33
|
mainUnit: 'core',
|
|
97
34
|
fee: {
|
|
98
|
-
defaults:
|
|
35
|
+
defaults: this.feeDefaults
|
|
99
36
|
},
|
|
100
37
|
account: {
|
|
101
|
-
standardDerivationPath:
|
|
38
|
+
standardDerivationPath: `m/44'/990'/0'/0/0`,
|
|
102
39
|
address: {
|
|
103
40
|
isCaseSensitive: false,
|
|
104
41
|
placeholder: 'core...',
|
|
@@ -111,31 +48,19 @@ var CoreumProtocolImpl = /** @class */ (function (_super) {
|
|
|
111
48
|
}
|
|
112
49
|
}
|
|
113
50
|
};
|
|
114
|
-
return _this;
|
|
115
51
|
}
|
|
116
|
-
|
|
117
|
-
return
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
CoreumProtocolImpl.prototype.getTransactionFeeWithPublicKey = function (_publicKey, _details, _configuration) {
|
|
124
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
125
|
-
return __generator(this, function (_a) {
|
|
126
|
-
return [2 /*return*/, this.feeDefaults];
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
return CoreumProtocolImpl;
|
|
131
|
-
}(cosmos_core_1.CosmosBaseProtocolImpl));
|
|
52
|
+
async getMetadata() {
|
|
53
|
+
return this.metadata;
|
|
54
|
+
}
|
|
55
|
+
async getTransactionFeeWithPublicKey(_publicKey, _details, _configuration) {
|
|
56
|
+
return this.feeDefaults;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
132
59
|
exports.CoreumProtocolImpl = CoreumProtocolImpl;
|
|
133
60
|
// Factory
|
|
134
|
-
function createCoreumProtocol(options) {
|
|
135
|
-
if (options === void 0) { options = {}; }
|
|
61
|
+
function createCoreumProtocol(options = {}) {
|
|
136
62
|
return new CoreumProtocolImpl(options);
|
|
137
63
|
}
|
|
138
|
-
exports.createCoreumProtocol = createCoreumProtocol;
|
|
139
64
|
exports.COREUM_PROTOCOL_NETWORK = {
|
|
140
65
|
name: 'Mainnet',
|
|
141
66
|
type: 'mainnet',
|
|
@@ -143,19 +68,16 @@ exports.COREUM_PROTOCOL_NETWORK = {
|
|
|
143
68
|
blockExplorerUrl: 'https://explorer.coreum.com/coreum',
|
|
144
69
|
useCORSProxy: true
|
|
145
70
|
};
|
|
146
|
-
|
|
147
|
-
function createCoreumProtocolOptions(partialOptions) {
|
|
148
|
-
var _a, _b, _c, _d, _e, _f;
|
|
149
|
-
if (partialOptions === void 0) { partialOptions = {}; }
|
|
71
|
+
const DEFAULT_COREUM_PROTOCOL_NETWORK = exports.COREUM_PROTOCOL_NETWORK;
|
|
72
|
+
function createCoreumProtocolOptions(partialOptions = {}) {
|
|
150
73
|
return {
|
|
151
|
-
network:
|
|
152
|
-
addressPrefix:
|
|
153
|
-
baseUnit:
|
|
74
|
+
network: { ...DEFAULT_COREUM_PROTOCOL_NETWORK, ...partialOptions.network },
|
|
75
|
+
addressPrefix: partialOptions.addressPrefix ?? 'core',
|
|
76
|
+
baseUnit: partialOptions.baseUnit ?? 'ucore',
|
|
154
77
|
defaultGas: {
|
|
155
|
-
value:
|
|
156
|
-
unit:
|
|
78
|
+
value: partialOptions.defaultGas?.value ?? DEFAULT_GAS.value,
|
|
79
|
+
unit: partialOptions.defaultGas?.unit ?? DEFAULT_GAS.unit
|
|
157
80
|
}
|
|
158
81
|
};
|
|
159
82
|
}
|
|
160
|
-
exports.createCoreumProtocolOptions = createCoreumProtocolOptions;
|
|
161
83
|
//# sourceMappingURL=CoreumProtocol.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreumProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/CoreumProtocol.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoreumProtocol.js","sourceRoot":"","sources":["../../../src/v1/protocol/CoreumProtocol.ts"],"names":[],"mappings":";;;AAsFA,oDAEC;AAYD,kEAYC;AAhHD,uDAA0D;AAC1D,qDAAqI;AACrI,mDAU2B;AAI3B,MAAM,WAAW,GAAwB,IAAA,sBAAS,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;AAI1E,MAAa,kBAAmB,SAAQ,oCAAmC;IACzE,YAAmB,UAAgE,EAAE;QACnF,MAAM,WAAW,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAA;QAExD,KAAK,CAAC,WAAW,CAAC,CAAA;QAGH,UAAK,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,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;gBAC1B,QAAQ,EAAE,CAAC;aACZ;SACF,CAAA;QAEgB,gBAAW,GAA6B;YACvD,GAAG,EAAE,IAAA,sBAAS,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;YACpD,MAAM,EAAE,IAAA,sBAAS,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;YACxD,IAAI,EAAE,IAAA,sBAAS,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;SACrD,CAAA;QAEgB,aAAQ,GAAkC;YACzD,UAAU,EAAE,kCAAmB,CAAC,MAAM;YACtC,IAAI,EAAE,QAAQ;YAEd,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,MAAM;YAEhB,GAAG,EAAE;gBACH,QAAQ,EAAE,IAAI,CAAC,WAAW;aAC3B;YAED,OAAO,EAAE;gBACP,sBAAsB,EAAE,mBAAmB;gBAC3C,OAAO,EAAE;oBACP,eAAe,EAAE,KAAK;oBACtB,WAAW,EAAE,SAAS;oBACtB,KAAK,EAAE,qCAAqC;iBAC7C;aACF;YAED,WAAW,EAAE;gBACX,aAAa,EAAE;oBACb,IAAI,EAAE,MAAM;iBACb;aACF;SACF,CAAA;IA5CD,CAAC;IA8CM,KAAK,CAAC,WAAW;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,8BAA8B,CACzC,UAAqB,EACrB,QAA2C,EAC3C,cAA+C;QAE/C,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;CACF;AA9DD,gDA8DC;AAED,UAAU;AAEV,SAAgB,oBAAoB,CAAC,UAAgE,EAAE;IACrG,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAA;AACxC,CAAC;AAEY,QAAA,uBAAuB,GAA0B;IAC5D,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,0CAA0C;IAClD,gBAAgB,EAAE,oCAAoC;IACtD,YAAY,EAAE,IAAI;CACnB,CAAA;AAED,MAAM,+BAA+B,GAA0B,+BAAuB,CAAA;AAEtF,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,MAAM;QACrD,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.CoreumV3SerializerCompanion = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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 CoreumV3SerializerCompanion {
|
|
11
|
+
constructor() {
|
|
48
12
|
this.schemas = [
|
|
49
13
|
{
|
|
50
14
|
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
@@ -58,85 +22,54 @@ var CoreumV3SerializerCompanion = /** @class */ (function () {
|
|
|
58
22
|
}
|
|
59
23
|
];
|
|
60
24
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
CoreumV3SerializerCompanion.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.COREUM:
|
|
118
|
-
return [2 /*return*/, (0, cosmos_core_1.cosmosTransactionSignResponseToSigned)(transactionSignResponse)];
|
|
119
|
-
default:
|
|
120
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COREUM, "Protocol ".concat(identifier, " not supported"));
|
|
121
|
-
}
|
|
122
|
-
return [2 /*return*/];
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
CoreumV3SerializerCompanion.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.COREUM:
|
|
131
|
-
return [2 /*return*/, true];
|
|
132
|
-
default:
|
|
133
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COREUM, "Protocol ".concat(identifier, " not supported"));
|
|
134
|
-
}
|
|
135
|
-
return [2 /*return*/];
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
return CoreumV3SerializerCompanion;
|
|
140
|
-
}());
|
|
25
|
+
async toTransactionSignRequest(identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
26
|
+
switch (identifier) {
|
|
27
|
+
case coinlib_core_1.MainProtocolSymbols.COREUM:
|
|
28
|
+
return (0, cosmos_core_1.cosmosUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl);
|
|
29
|
+
default:
|
|
30
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COREUM, `Protocol ${identifier} not supported`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async fromTransactionSignRequest(identifier, transactionSignRequest) {
|
|
34
|
+
switch (identifier) {
|
|
35
|
+
case coinlib_core_1.MainProtocolSymbols.COREUM:
|
|
36
|
+
return (0, cosmos_core_1.cosmosTransactionSignRequestToUnsigned)(transactionSignRequest);
|
|
37
|
+
default:
|
|
38
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COREUM, `Protocol ${identifier} not supported`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async validateTransactionSignRequest(identifier, _transactionSignRequest) {
|
|
42
|
+
switch (identifier) {
|
|
43
|
+
case coinlib_core_1.MainProtocolSymbols.COREUM:
|
|
44
|
+
return true;
|
|
45
|
+
default:
|
|
46
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COREUM, `Protocol ${identifier} not supported`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async toTransactionSignResponse(identifier, signedTransaction, accountIdentifier) {
|
|
50
|
+
switch (identifier) {
|
|
51
|
+
case coinlib_core_1.MainProtocolSymbols.COREUM:
|
|
52
|
+
return (0, cosmos_core_1.cosmosSignedTransactionToResponse)(signedTransaction, accountIdentifier);
|
|
53
|
+
default:
|
|
54
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COREUM, `Protocol ${identifier} not supported`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async fromTransactionSignResponse(identifier, transactionSignResponse) {
|
|
58
|
+
switch (identifier) {
|
|
59
|
+
case coinlib_core_1.MainProtocolSymbols.COREUM:
|
|
60
|
+
return (0, cosmos_core_1.cosmosTransactionSignResponseToSigned)(transactionSignResponse);
|
|
61
|
+
default:
|
|
62
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COREUM, `Protocol ${identifier} not supported`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async validateTransactionSignResponse(identifier, _transactionSignResponse) {
|
|
66
|
+
switch (identifier) {
|
|
67
|
+
case coinlib_core_1.MainProtocolSymbols.COREUM:
|
|
68
|
+
return true;
|
|
69
|
+
default:
|
|
70
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COREUM, `Protocol ${identifier} not supported`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
141
74
|
exports.CoreumV3SerializerCompanion = CoreumV3SerializerCompanion;
|
|
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":"
|
|
1
|
+
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":"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"}
|