@airgap/cosmos 0.13.8 → 0.13.9-beta.1
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/airgap-coinlib-cosmos.min.js +6 -0
- package/package.json +4 -4
- package/v1/data/transaction/CosmosTransaction.js +2 -0
- package/v1/data/transaction/CosmosTransaction.js.map +1 -1
- package/v1/module/CosmosModule.d.ts +14 -7
- package/v1/module/CosmosModule.js +34 -13
- package/v1/module/CosmosModule.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +18 -2
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.d.ts +1 -1
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-cosmos.json +61 -68
- package/v1/serializer/v3/serializer-companion.d.ts +12 -0
- package/v1/serializer/v3/serializer-companion.js +142 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validators.d.ts +1 -4
- package/v1/serializer/v3/validators/transaction-validators.js +1 -10
- package/v1/serializer/v3/validators/transaction-validators.js.map +1 -1
|
@@ -76445,6 +76445,12 @@ exports.NonExtendedProtocol = void 0;
|
|
|
76445
76445
|
var NonExtendedProtocol = /** @class */ (function () {
|
|
76446
76446
|
function NonExtendedProtocol() {
|
|
76447
76447
|
}
|
|
76448
|
+
NonExtendedProtocol.prototype.getExtendedPublicKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
76449
|
+
throw Promise.reject('extended public key support not implemented');
|
|
76450
|
+
};
|
|
76451
|
+
NonExtendedProtocol.prototype.getExtendedPublicKeyFromHexSecret = function (secret, derivationPath) {
|
|
76452
|
+
throw Promise.reject('extended public key support not implemented');
|
|
76453
|
+
};
|
|
76448
76454
|
NonExtendedProtocol.prototype.getExtendedPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
76449
76455
|
throw Promise.reject('extended private key support not implemented');
|
|
76450
76456
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/cosmos",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.9-beta.1",
|
|
4
4
|
"description": "The @airgap/cosmos is a Cosmos implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"author": "Papers GmbH <contact@papers.ch> (https://papers.ch)",
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@airgap/coinlib-core": "^0.13.
|
|
35
|
-
"@airgap/module-kit": "^0.13.
|
|
36
|
-
"@airgap/serializer": "^0.13.
|
|
34
|
+
"@airgap/coinlib-core": "^0.13.9-beta.0",
|
|
35
|
+
"@airgap/module-kit": "^0.13.9-beta.0",
|
|
36
|
+
"@airgap/serializer": "^0.13.9-beta.0"
|
|
37
37
|
},
|
|
38
38
|
"localDependencies": {},
|
|
39
39
|
"nyc": {
|
|
@@ -68,6 +68,7 @@ var CosmosTransaction = /** @class */ (function () {
|
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
70
|
CosmosTransaction.fromJSON = function (json) {
|
|
71
|
+
json = JSON.parse(JSON.stringify(json));
|
|
71
72
|
var messages = json.messages.map(function (value) {
|
|
72
73
|
var type = value.type;
|
|
73
74
|
switch (type) {
|
|
@@ -85,6 +86,7 @@ var CosmosTransaction = /** @class */ (function () {
|
|
|
85
86
|
return new CosmosTransaction(messages, CosmosFee_1.CosmosFee.fromJSON(json.fee), json.memo, json.chainID, json.accountNumber, json.sequence);
|
|
86
87
|
};
|
|
87
88
|
CosmosTransaction.fromRPCBody = function (json) {
|
|
89
|
+
json = JSON.parse(JSON.stringify(json));
|
|
88
90
|
var messages = json.msgs.map(function (value) {
|
|
89
91
|
var type = value.type;
|
|
90
92
|
switch (type) {
|
|
@@ -1 +1 @@
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WAAW,CAAC,KAAK,CAAC,CAAA;gBACjE;oBACE,MAAM,IAAI,0BAAiB,CAAC,sBAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;aAChE;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,IAAI,iBAAiB,CAAC,QAAQ,EAAE,qBAAS,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACvI,CAAC;IACH,wBAAC;AAAD,CAAC,AA5GD,IA4GC;AA5GY,8CAAiB"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { MainProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
|
+
import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
|
|
3
|
+
declare type SupportedProtocols = MainProtocolSymbols.COSMOS;
|
|
4
|
+
export declare class CosmosModule implements AirGapModule<{
|
|
5
|
+
Protocols: SupportedProtocols;
|
|
6
|
+
}> {
|
|
7
|
+
private readonly networkRegistries;
|
|
8
|
+
readonly supportedProtocols: Record<SupportedProtocols, ProtocolConfiguration>;
|
|
9
|
+
createOfflineProtocol(identifier: SupportedProtocols): Promise<AirGapOfflineProtocol | undefined>;
|
|
10
|
+
createOnlineProtocol(identifier: SupportedProtocols, networkId?: string): Promise<AirGapOnlineProtocol | undefined>;
|
|
11
|
+
createBlockExplorer(identifier: SupportedProtocols, networkId?: string): Promise<AirGapBlockExplorer | undefined>;
|
|
12
|
+
createV3SerializerCompanion(): Promise<AirGapV3SerializerCompanion>;
|
|
13
|
+
private createProtocol;
|
|
8
14
|
}
|
|
15
|
+
export {};
|
|
@@ -42,37 +42,43 @@ var errors_1 = require("@airgap/coinlib-core/errors");
|
|
|
42
42
|
var module_kit_1 = require("@airgap/module-kit");
|
|
43
43
|
var MintscanBlockExplorer_1 = require("../block-explorer/MintscanBlockExplorer");
|
|
44
44
|
var CosmosProtocol_1 = require("../protocol/CosmosProtocol");
|
|
45
|
+
var serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
45
46
|
var CosmosModule = /** @class */ (function () {
|
|
46
47
|
function CosmosModule() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
var _a;
|
|
49
|
+
this.networkRegistries = (_a = {},
|
|
50
|
+
_a[coinlib_core_1.MainProtocolSymbols.COSMOS] = new module_kit_1.ModuleNetworkRegistry({
|
|
51
|
+
supportedNetworks: [CosmosProtocol_1.COSMOS_MAINNET_PROTOCOL_NETWORK]
|
|
52
|
+
}),
|
|
53
|
+
_a);
|
|
54
|
+
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
51
55
|
}
|
|
52
|
-
CosmosModule.prototype.createOfflineProtocol = function () {
|
|
56
|
+
CosmosModule.prototype.createOfflineProtocol = function (identifier) {
|
|
53
57
|
return __awaiter(this, void 0, void 0, function () {
|
|
54
58
|
return __generator(this, function (_a) {
|
|
55
|
-
return [2 /*return*/,
|
|
59
|
+
return [2 /*return*/, this.createProtocol(identifier)];
|
|
56
60
|
});
|
|
57
61
|
});
|
|
58
62
|
};
|
|
59
|
-
CosmosModule.prototype.createOnlineProtocol = function (networkId) {
|
|
63
|
+
CosmosModule.prototype.createOnlineProtocol = function (identifier, networkId) {
|
|
64
|
+
var _a;
|
|
60
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
66
|
var network;
|
|
62
|
-
return __generator(this, function (
|
|
63
|
-
network = this.
|
|
67
|
+
return __generator(this, function (_b) {
|
|
68
|
+
network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
|
|
64
69
|
if (network === undefined) {
|
|
65
70
|
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, 'Protocol network type not supported.');
|
|
66
71
|
}
|
|
67
|
-
return [2 /*return*/, (
|
|
72
|
+
return [2 /*return*/, this.createProtocol(identifier, network)];
|
|
68
73
|
});
|
|
69
74
|
});
|
|
70
75
|
};
|
|
71
|
-
CosmosModule.prototype.createBlockExplorer = function (networkId) {
|
|
76
|
+
CosmosModule.prototype.createBlockExplorer = function (identifier, networkId) {
|
|
77
|
+
var _a;
|
|
72
78
|
return __awaiter(this, void 0, void 0, function () {
|
|
73
79
|
var network;
|
|
74
|
-
return __generator(this, function (
|
|
75
|
-
network = this.
|
|
80
|
+
return __generator(this, function (_b) {
|
|
81
|
+
network = (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkId);
|
|
76
82
|
if ((network === null || network === void 0 ? void 0 : network.type) !== 'mainnet') {
|
|
77
83
|
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, 'Block Explorer network type not supported.');
|
|
78
84
|
}
|
|
@@ -80,6 +86,21 @@ var CosmosModule = /** @class */ (function () {
|
|
|
80
86
|
});
|
|
81
87
|
});
|
|
82
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) {
|
|
97
|
+
switch (identifier) {
|
|
98
|
+
case coinlib_core_1.MainProtocolSymbols.COSMOS:
|
|
99
|
+
return (0, CosmosProtocol_1.createCosmosProtocol)({ network: network });
|
|
100
|
+
default:
|
|
101
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.AETERNITY, "Protocol ".concat(identifier, " not supported."));
|
|
102
|
+
}
|
|
103
|
+
};
|
|
83
104
|
return CosmosModule;
|
|
84
105
|
}());
|
|
85
106
|
exports.CosmosModule = CosmosModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosModule.js","sourceRoot":"","sources":["../../../src/v1/module/CosmosModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"CosmosModule.js","sourceRoot":"","sources":["../../../src/v1/module/CosmosModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAW2B;AAE3B,iFAA+E;AAC/E,6DAAkG;AAClG,8EAAmF;AAInF;IAAA;;QACmB,sBAAiB;YAChC,GAAC,kCAAmB,CAAC,MAAM,IAAG,IAAI,kCAAqB,CAAC;gBACtD,iBAAiB,EAAE,CAAC,gDAA+B,CAAC;aACrD,CAAC;gBACH;QACe,uBAAkB,GAAsD,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAoC1I,CAAC;IAlCc,4CAAqB,GAAlC,UAAmC,UAA8B;;;gBAC/D,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,2CAAoB,GAAjC,UAAkC,UAA8B,EAAE,SAAkB;;;;;gBAC5E,OAAO,GAAgC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,SAAS,CAAC,CAAA;gBACvG,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,MAAM,EAAE,sCAAsC,CAAC,CAAA;iBACzF;gBAED,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,EAAA;;;KAChD;IAEY,0CAAmB,GAAhC,UAAiC,UAA8B,EAAE,SAAkB;;;;;gBAC3E,OAAO,GAAgC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,SAAS,CAAC,CAAA;gBACvG,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,SAAS,EAAE;oBAC/B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,MAAM,EAAE,4CAA4C,CAAC,CAAA;iBAC/F;gBAED,sBAAO,IAAI,6CAAqB,EAAE,EAAA;;;KACnC;IAEY,kDAA2B,GAAxC;;;gBACE,sBAAO,IAAI,kDAA2B,EAAE,EAAA;;;KACzC;IAEO,qCAAc,GAAtB,UAAuB,UAA8B,EAAE,OAAyB;QAC9E,QAAQ,UAAU,EAAE;YAClB,KAAK,kCAAmB,CAAC,MAAM;gBAC7B,OAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YAC1C;gBACE,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,SAAS,EAAE,mBAAY,UAAU,oBAAiB,CAAC,CAAA;SAC/F;IACH,CAAC;IACH,mBAAC;AAAD,CAAC,AA1CD,IA0CC;AA1CY,oCAAY"}
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.cosmosTransactionSignResponseToSigned = exports.cosmosTransactionSignRequestToUnsigned = exports.cosmosSignedTransactionToResponse = exports.cosmosUnsignedTransactionToRequest = void 0;
|
|
4
15
|
var module_kit_1 = require("@airgap/module-kit");
|
|
5
16
|
function cosmosUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) {
|
|
6
|
-
|
|
17
|
+
var _ = unsigned.type, rest = __rest(unsigned, ["type"]);
|
|
18
|
+
return {
|
|
19
|
+
transaction: rest,
|
|
20
|
+
publicKey: publicKey,
|
|
21
|
+
callbackURL: callbackUrl
|
|
22
|
+
};
|
|
7
23
|
}
|
|
8
24
|
exports.cosmosUnsignedTransactionToRequest = cosmosUnsignedTransactionToRequest;
|
|
9
25
|
function cosmosSignedTransactionToResponse(signed, accountIdentifier) {
|
|
@@ -11,7 +27,7 @@ function cosmosSignedTransactionToResponse(signed, accountIdentifier) {
|
|
|
11
27
|
}
|
|
12
28
|
exports.cosmosSignedTransactionToResponse = cosmosSignedTransactionToResponse;
|
|
13
29
|
function cosmosTransactionSignRequestToUnsigned(request) {
|
|
14
|
-
return request.transaction;
|
|
30
|
+
return (0, module_kit_1.newUnsignedTransaction)(request.transaction);
|
|
15
31
|
}
|
|
16
32
|
exports.cosmosTransactionSignRequestToUnsigned = cosmosTransactionSignRequestToUnsigned;
|
|
17
33
|
function cosmosTransactionSignResponseToSigned(response) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iDAAiF;AAMjF,SAAgB,kCAAkC,CAChD,QAAmC,EACnC,SAAiB,EACjB,WAAoB;IAEZ,IAAM,CAAC,GAAc,QAAQ,KAAtB,EAAK,IAAI,UAAK,QAAQ,EAA/B,QAAoB,CAAF,CAAa;IAErC,OAAO;QACL,WAAW,EAAE,IAAI;QACjB,SAAS,WAAA;QACT,WAAW,EAAE,WAAW;KACzB,CAAA;AACH,CAAC;AAZD,gFAYC;AAED,SAAgB,iCAAiC,CAC/C,MAA+B,EAC/B,iBAAyB;IAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,iBAAiB,mBAAA,EAAE,CAAA;AAC3D,CAAC;AALD,8EAKC;AAED,SAAgB,sCAAsC,CAAC,OAAqC;IAC1F,OAAO,IAAA,mCAAsB,EAA4B,OAAO,CAAC,WAAW,CAAC,CAAA;AAC/E,CAAC;AAFD,wFAEC;AAED,SAAgB,qCAAqC,CAAC,QAAuC;IAC3F,OAAO,IAAA,iCAAoB,EAA0B,EAAE,OAAO,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAA;AACzF,CAAC;AAFD,sFAEC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TransactionSignRequest } from '@airgap/serializer';
|
|
2
2
|
import { CosmosUnsignedTransaction } from '../../../../types/transaction';
|
|
3
|
-
export interface CosmosTransactionSignRequest extends TransactionSignRequest<CosmosUnsignedTransaction
|
|
3
|
+
export interface CosmosTransactionSignRequest extends TransactionSignRequest<Omit<CosmosUnsignedTransaction, 'type'>> {
|
|
4
4
|
}
|
|
@@ -12,95 +12,88 @@
|
|
|
12
12
|
"type": "string"
|
|
13
13
|
},
|
|
14
14
|
"transaction": {
|
|
15
|
-
"$ref": "#/definitions/CosmosUnsignedTransaction"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"required": ["publicKey", "transaction"],
|
|
19
|
-
"type": "object"
|
|
20
|
-
},
|
|
21
|
-
"CosmosUnsignedTransaction": {
|
|
22
|
-
"additionalProperties": false,
|
|
23
|
-
"properties": {
|
|
24
|
-
"accountNumber": {
|
|
25
|
-
"type": "string"
|
|
26
|
-
},
|
|
27
|
-
"chainID": {
|
|
28
|
-
"type": "string"
|
|
29
|
-
},
|
|
30
|
-
"fee": {
|
|
31
15
|
"additionalProperties": false,
|
|
32
16
|
"properties": {
|
|
33
|
-
"
|
|
17
|
+
"accountNumber": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"chainID": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"fee": {
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"properties": {
|
|
26
|
+
"amount": {
|
|
27
|
+
"items": {
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"properties": {
|
|
30
|
+
"amount": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"denom": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"required": ["denom", "amount"],
|
|
38
|
+
"type": "object"
|
|
39
|
+
},
|
|
40
|
+
"type": "array"
|
|
41
|
+
},
|
|
42
|
+
"gas": {
|
|
43
|
+
"type": "string"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": ["amount", "gas"],
|
|
47
|
+
"type": "object"
|
|
48
|
+
},
|
|
49
|
+
"memo": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"messages": {
|
|
34
53
|
"items": {
|
|
35
54
|
"additionalProperties": false,
|
|
36
55
|
"properties": {
|
|
37
56
|
"amount": {
|
|
57
|
+
"items": {
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"properties": {
|
|
60
|
+
"amount": {
|
|
61
|
+
"type": "string"
|
|
62
|
+
},
|
|
63
|
+
"denom": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": ["denom", "amount"],
|
|
68
|
+
"type": "object"
|
|
69
|
+
},
|
|
70
|
+
"type": "array"
|
|
71
|
+
},
|
|
72
|
+
"fromAddress": {
|
|
38
73
|
"type": "string"
|
|
39
74
|
},
|
|
40
|
-
"
|
|
75
|
+
"toAddress": {
|
|
41
76
|
"type": "string"
|
|
77
|
+
},
|
|
78
|
+
"type": {
|
|
79
|
+
"enum": [0, 1, 2, 3],
|
|
80
|
+
"type": "number"
|
|
42
81
|
}
|
|
43
82
|
},
|
|
44
|
-
"required": ["
|
|
83
|
+
"required": ["type", "amount", "fromAddress", "toAddress"],
|
|
45
84
|
"type": "object"
|
|
46
85
|
},
|
|
47
86
|
"type": "array"
|
|
48
87
|
},
|
|
49
|
-
"
|
|
88
|
+
"sequence": {
|
|
50
89
|
"type": "string"
|
|
51
90
|
}
|
|
52
91
|
},
|
|
53
|
-
"required": ["
|
|
92
|
+
"required": ["messages", "fee", "memo", "chainID", "accountNumber", "sequence"],
|
|
54
93
|
"type": "object"
|
|
55
|
-
},
|
|
56
|
-
"memo": {
|
|
57
|
-
"type": "string"
|
|
58
|
-
},
|
|
59
|
-
"messages": {
|
|
60
|
-
"items": {
|
|
61
|
-
"additionalProperties": false,
|
|
62
|
-
"properties": {
|
|
63
|
-
"amount": {
|
|
64
|
-
"items": {
|
|
65
|
-
"additionalProperties": false,
|
|
66
|
-
"properties": {
|
|
67
|
-
"amount": {
|
|
68
|
-
"type": "string"
|
|
69
|
-
},
|
|
70
|
-
"denom": {
|
|
71
|
-
"type": "string"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"required": ["denom", "amount"],
|
|
75
|
-
"type": "object"
|
|
76
|
-
},
|
|
77
|
-
"type": "array"
|
|
78
|
-
},
|
|
79
|
-
"fromAddress": {
|
|
80
|
-
"type": "string"
|
|
81
|
-
},
|
|
82
|
-
"toAddress": {
|
|
83
|
-
"type": "string"
|
|
84
|
-
},
|
|
85
|
-
"type": {
|
|
86
|
-
"enum": [0, 1, 2, 3],
|
|
87
|
-
"type": "number"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
"required": ["type", "amount", "fromAddress", "toAddress"],
|
|
91
|
-
"type": "object"
|
|
92
|
-
},
|
|
93
|
-
"type": "array"
|
|
94
|
-
},
|
|
95
|
-
"sequence": {
|
|
96
|
-
"type": "string"
|
|
97
|
-
},
|
|
98
|
-
"type": {
|
|
99
|
-
"enum": ["unsigned"],
|
|
100
|
-
"type": "string"
|
|
101
94
|
}
|
|
102
95
|
},
|
|
103
|
-
"required": ["
|
|
96
|
+
"required": ["publicKey", "transaction"],
|
|
104
97
|
"type": "object"
|
|
105
98
|
}
|
|
106
99
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AirGapV3SerializerCompanion, SignedTransaction, UnsignedTransaction } from '@airgap/module-kit';
|
|
2
|
+
import { V3SchemaConfiguration } from '@airgap/module-kit/types/serializer';
|
|
3
|
+
import { TransactionSignRequest, TransactionSignResponse } from '@airgap/serializer';
|
|
4
|
+
export declare class CosmosV3SerializerCompanion implements AirGapV3SerializerCompanion {
|
|
5
|
+
readonly schemas: V3SchemaConfiguration[];
|
|
6
|
+
toTransactionSignRequest(identifier: string, unsignedTransaction: UnsignedTransaction, publicKey: string, callbackUrl?: string): Promise<TransactionSignRequest>;
|
|
7
|
+
fromTransactionSignRequest(identifier: string, transactionSignRequest: TransactionSignRequest): Promise<UnsignedTransaction>;
|
|
8
|
+
validateTransactionSignRequest(identifier: string, _transactionSignRequest: TransactionSignRequest): Promise<boolean>;
|
|
9
|
+
toTransactionSignResponse(identifier: string, signedTransaction: SignedTransaction, accountIdentifier: string): Promise<TransactionSignResponse>;
|
|
10
|
+
fromTransactionSignResponse(identifier: string, transactionSignResponse: TransactionSignResponse): Promise<SignedTransaction>;
|
|
11
|
+
validateTransactionSignResponse(identifier: string, _transactionSignResponse: TransactionSignResponse): Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.CosmosV3SerializerCompanion = void 0;
|
|
40
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
41
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
42
|
+
var serializer_1 = require("@airgap/serializer");
|
|
43
|
+
var transaction_converter_1 = require("./schemas/converter/transaction-converter");
|
|
44
|
+
var cosmosTransactionSignRequest = require('./schemas/generated/transaction-sign-request-cosmos.json');
|
|
45
|
+
var cosmosTransactionSignResponse = require('./schemas/generated/transaction-sign-response-cosmos.json');
|
|
46
|
+
var CosmosV3SerializerCompanion = /** @class */ (function () {
|
|
47
|
+
function CosmosV3SerializerCompanion() {
|
|
48
|
+
this.schemas = [
|
|
49
|
+
{
|
|
50
|
+
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
51
|
+
schema: { schema: cosmosTransactionSignRequest },
|
|
52
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.COSMOS
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: serializer_1.IACMessageType.TransactionSignResponse,
|
|
56
|
+
schema: { schema: cosmosTransactionSignResponse },
|
|
57
|
+
protocolIdentifier: coinlib_core_1.MainProtocolSymbols.COSMOS
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
}
|
|
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, transaction_converter_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, transaction_converter_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, transaction_converter_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, transaction_converter_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
|
+
}());
|
|
141
|
+
exports.CosmosV3SerializerCompanion = CosmosV3SerializerCompanion;
|
|
142
|
+
//# sourceMappingURL=serializer-companion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAA8D;AAG9D,iDAAgH;AAIhH,mFAKkD;AAElD,IAAM,4BAA4B,GAAe,OAAO,CAAC,0DAA0D,CAAC,CAAA;AACpH,IAAM,6BAA6B,GAAe,OAAO,CAAC,2DAA2D,CAAC,CAAA;AAEtH;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,0DAAkC,EAAC,mBAAgD,EAAE,SAAS,EAAE,WAAW,CAAC,EAAA;oBACrH;wBACE,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,MAAM,E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AAiD;;;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,10 +1,7 @@
|
|
|
1
|
-
import { TransactionValidator
|
|
1
|
+
import { TransactionValidator } from '@airgap/serializer';
|
|
2
2
|
import { CosmosTransactionSignRequest } from '../schemas/definitions/transaction-sign-request-cosmos';
|
|
3
3
|
import { CosmosTransactionSignResponse } from '../schemas/definitions/transaction-sign-response-cosmos';
|
|
4
4
|
export declare class CosmosTransactionValidator implements TransactionValidator {
|
|
5
5
|
validateUnsignedTransaction(request: CosmosTransactionSignRequest): Promise<any>;
|
|
6
6
|
validateSignedTransaction(response: CosmosTransactionSignResponse): Promise<any>;
|
|
7
7
|
}
|
|
8
|
-
export declare class CosmosTransactionValidatorFactory implements TransactionValidatorFactory<CosmosTransactionValidator> {
|
|
9
|
-
create(): CosmosTransactionValidator;
|
|
10
|
-
}
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.CosmosTransactionValidator = void 0;
|
|
40
40
|
// tslint:disable: max-classes-per-file
|
|
41
41
|
// import { async } from '@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate'
|
|
42
42
|
var serializer_1 = require("@airgap/serializer");
|
|
@@ -85,13 +85,4 @@ var CosmosTransactionValidator = /** @class */ (function () {
|
|
|
85
85
|
return CosmosTransactionValidator;
|
|
86
86
|
}());
|
|
87
87
|
exports.CosmosTransactionValidator = CosmosTransactionValidator;
|
|
88
|
-
var CosmosTransactionValidatorFactory = /** @class */ (function () {
|
|
89
|
-
function CosmosTransactionValidatorFactory() {
|
|
90
|
-
}
|
|
91
|
-
CosmosTransactionValidatorFactory.prototype.create = function () {
|
|
92
|
-
return new CosmosTransactionValidator();
|
|
93
|
-
};
|
|
94
|
-
return CosmosTransactionValidatorFactory;
|
|
95
|
-
}());
|
|
96
|
-
exports.CosmosTransactionValidatorFactory = CosmosTransactionValidatorFactory;
|
|
97
88
|
//# sourceMappingURL=transaction-validators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,4FAA4F;AAC5F,
|
|
1
|
+
{"version":3,"file":"transaction-validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,4FAA4F;AAC5F,iDAA6E;AAM7E,2CAA2C;AAC3C,yBAAyB;AACzB,8CAA8C;AAC9C,uCAAuC;AACvC,qBAAqB;AACrB,MAAM;AACN,IAAI;AACJ,kCAAkC;AAClC,iCAAiC;AAEjC,yCAAyC;AACzC,mBAAmB;AACnB,4CAA4C;AAC5C,uCAAuC;AACvC,qBAAqB;AACrB,OAAO;AACP,yBAAyB;AACzB,uCAAuC;AACvC,qBAAqB;AACrB,MAAM;AACN,IAAI;AAEJ,sBAAsB;AACtB;IAAA;IAYA,CAAC;IAXc,gEAA2B,GAAxC,UAAyC,OAAqC;;;gBAC5E,qEAAqE;gBACrE,IAAA,+BAAkB,EAAC,EAAE,CAAC,CAAA;gBAEtB,iFAAiF;gBACjF,sBAAO,SAAS,EAAA;;;KACjB;IACY,8DAAyB,GAAtC,UAAuC,QAAuC;;;gBAC5E,4EAA4E;gBAC5E,sBAAO,SAAS,EAAA;;;KACjB;IACH,iCAAC;AAAD,CAAC,AAZD,IAYC;AAZY,gEAA0B"}
|