@airgap/cosmos 0.13.8-beta.10 → 0.13.8-beta.11
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 +0 -6
- package/package.json +4 -4
- package/v1/data/transaction/CosmosTransaction.js +0 -2
- package/v1/data/transaction/CosmosTransaction.js.map +1 -1
- package/v1/module/CosmosModule.d.ts +7 -14
- package/v1/module/CosmosModule.js +13 -34
- package/v1/module/CosmosModule.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +2 -18
- 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 +68 -61
- package/v1/serializer/v3/validators/transaction-validators.d.ts +4 -1
- package/v1/serializer/v3/validators/transaction-validators.js +10 -1
- package/v1/serializer/v3/validators/transaction-validators.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.d.ts +0 -12
- package/v1/serializer/v3/serializer-companion.js +0 -142
- package/v1/serializer/v3/serializer-companion.js.map +0 -1
|
@@ -76445,12 +76445,6 @@ 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
|
-
};
|
|
76454
76448
|
NonExtendedProtocol.prototype.getExtendedPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
|
|
76455
76449
|
throw Promise.reject('extended private key support not implemented');
|
|
76456
76450
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/cosmos",
|
|
3
|
-
"version": "0.13.8-beta.
|
|
3
|
+
"version": "0.13.8-beta.11",
|
|
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.8-beta.
|
|
35
|
-
"@airgap/module-kit": "^0.13.8-beta.
|
|
36
|
-
"@airgap/serializer": "^0.13.8-beta.
|
|
34
|
+
"@airgap/coinlib-core": "^0.13.8-beta.11",
|
|
35
|
+
"@airgap/module-kit": "^0.13.8-beta.11",
|
|
36
|
+
"@airgap/serializer": "^0.13.8-beta.11"
|
|
37
37
|
},
|
|
38
38
|
"localDependencies": {},
|
|
39
39
|
"nyc": {
|
|
@@ -68,7 +68,6 @@ var CosmosTransaction = /** @class */ (function () {
|
|
|
68
68
|
});
|
|
69
69
|
};
|
|
70
70
|
CosmosTransaction.fromJSON = function (json) {
|
|
71
|
-
json = JSON.parse(JSON.stringify(json));
|
|
72
71
|
var messages = json.messages.map(function (value) {
|
|
73
72
|
var type = value.type;
|
|
74
73
|
switch (type) {
|
|
@@ -86,7 +85,6 @@ var CosmosTransaction = /** @class */ (function () {
|
|
|
86
85
|
return new CosmosTransaction(messages, CosmosFee_1.CosmosFee.fromJSON(json.fee), json.memo, json.chainID, json.accountNumber, json.sequence);
|
|
87
86
|
};
|
|
88
87
|
CosmosTransaction.fromRPCBody = function (json) {
|
|
89
|
-
json = JSON.parse(JSON.stringify(json));
|
|
90
88
|
var messages = json.msgs.map(function (value) {
|
|
91
89
|
var type = value.type;
|
|
92
90
|
switch (type) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosTransaction.js","sourceRoot":"","sources":["../../../../src/v1/data/transaction/CosmosTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,iHAA0F;AAE1F,sDAA+D;AAC/D,2EAAkE;AAOlE,0CAAwC;AAExC,yEAAuE;AACvE,yDAAkG;AAClG,iEAA+D;AAC/D,yGAAuG;AAMvG;IAQE,2BAAY,QAAyB,EAAE,GAAc,EAAE,IAAY,EAAE,OAAe,EAAE,aAAqB,EAAE,QAAgB;QAC3H,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAEM,kCAAM,GAAb;QACE,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YACtB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,MAAM,EAAE,EAAd,CAAc,CAAC;YACtD,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAA;IACH,CAAC;IAEM,qCAAS,GAAhB;QACE,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,aAAa;YAClC,QAAQ,EAAE,IAAI,CAAC,OAAO;YACtB,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE;YACzB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,GA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C,QAAQ,CAAC,CAAA;IAClI,CAAC;IAEa,6BAAW,GAAzB,UAA0B,IAAS;QACjC,IAAM,QAAQ,GAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,KAAU;YACzD,IAAM,IAAI,GAAW,KAAK,CAAC,IAAI,CAAA;YAC/B,QAAQ,IAAI,EAAE;gBACZ,KAAK,iCAAiB,CAAC,IAAI,CAAC,KAAK;oBAC/B,OAAO,qCAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;gBAC7C,KAAK,iCAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC;gBACtC,KAAK,iCAAiB,CAAC,UAAU,CAAC,KAAK;oBACrC,OAAO,6CAAqB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;gBACjD,KAAK,iCAAiB,CAAC,wBAAwB,CAAC,KAAK;oBACnD,OAAO,6EAAqC,CAAC,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,AA1GD,IA0GC;AA1GY,8CAAiB"}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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;
|
|
1
|
+
import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
+
export declare class CosmosModule implements AirGapModule {
|
|
3
|
+
private readonly networkRegistry;
|
|
4
|
+
readonly supportedNetworks: Record<string, ProtocolNetwork>;
|
|
5
|
+
createOfflineProtocol(): Promise<AirGapOfflineProtocol | undefined>;
|
|
6
|
+
createOnlineProtocol(networkId?: string): Promise<AirGapOnlineProtocol | undefined>;
|
|
7
|
+
createBlockExplorer(networkId?: string): Promise<AirGapBlockExplorer | undefined>;
|
|
14
8
|
}
|
|
15
|
-
export {};
|
|
@@ -42,43 +42,37 @@ 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");
|
|
46
45
|
var CosmosModule = /** @class */ (function () {
|
|
47
46
|
function CosmosModule() {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}),
|
|
53
|
-
_a);
|
|
54
|
-
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
47
|
+
this.networkRegistry = new module_kit_1.ModuleNetworkRegistry({
|
|
48
|
+
supportedNetworks: [CosmosProtocol_1.COSMOS_MAINNET_PROTOCOL_NETWORK]
|
|
49
|
+
});
|
|
50
|
+
this.supportedNetworks = this.networkRegistry.supportedNetworks;
|
|
55
51
|
}
|
|
56
|
-
CosmosModule.prototype.createOfflineProtocol = function (
|
|
52
|
+
CosmosModule.prototype.createOfflineProtocol = function () {
|
|
57
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
58
54
|
return __generator(this, function (_a) {
|
|
59
|
-
return [2 /*return*/,
|
|
55
|
+
return [2 /*return*/, (0, CosmosProtocol_1.createCosmosProtocol)()];
|
|
60
56
|
});
|
|
61
57
|
});
|
|
62
58
|
};
|
|
63
|
-
CosmosModule.prototype.createOnlineProtocol = function (
|
|
64
|
-
var _a;
|
|
59
|
+
CosmosModule.prototype.createOnlineProtocol = function (networkId) {
|
|
65
60
|
return __awaiter(this, void 0, void 0, function () {
|
|
66
61
|
var network;
|
|
67
|
-
return __generator(this, function (
|
|
68
|
-
network =
|
|
62
|
+
return __generator(this, function (_a) {
|
|
63
|
+
network = this.networkRegistry.findNetwork(networkId);
|
|
69
64
|
if (network === undefined) {
|
|
70
65
|
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, 'Protocol network type not supported.');
|
|
71
66
|
}
|
|
72
|
-
return [2 /*return*/,
|
|
67
|
+
return [2 /*return*/, (0, CosmosProtocol_1.createCosmosProtocol)({ network: network })];
|
|
73
68
|
});
|
|
74
69
|
});
|
|
75
70
|
};
|
|
76
|
-
CosmosModule.prototype.createBlockExplorer = function (
|
|
77
|
-
var _a;
|
|
71
|
+
CosmosModule.prototype.createBlockExplorer = function (networkId) {
|
|
78
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
79
73
|
var network;
|
|
80
|
-
return __generator(this, function (
|
|
81
|
-
network =
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
network = this.networkRegistry.findNetwork(networkId);
|
|
82
76
|
if ((network === null || network === void 0 ? void 0 : network.type) !== 'mainnet') {
|
|
83
77
|
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.COSMOS, 'Block Explorer network type not supported.');
|
|
84
78
|
}
|
|
@@ -86,21 +80,6 @@ var CosmosModule = /** @class */ (function () {
|
|
|
86
80
|
});
|
|
87
81
|
});
|
|
88
82
|
};
|
|
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
|
-
};
|
|
104
83
|
return CosmosModule;
|
|
105
84
|
}());
|
|
106
85
|
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,qDAA6C;AAC7C,sDAAqE;AACrE,iDAO2B;AAE3B,iFAA+E;AAC/E,6DAAkG;AAElG;IAAA;QACmB,oBAAe,GAA0B,IAAI,kCAAqB,CAAC;YAClF,iBAAiB,EAAE,CAAC,gDAA+B,CAAC;SACrD,CAAC,CAAA;QAEc,sBAAiB,GAAoC,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAA;IAuB7G,CAAC;IArBc,4CAAqB,GAAlC;;;gBACE,sBAAO,IAAA,qCAAoB,GAAE,EAAA;;;KAC9B;IAEY,2CAAoB,GAAjC,UAAkC,SAAkB;;;;gBAC5C,OAAO,GAAgC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACxF,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,MAAM,EAAE,sCAAsC,CAAC,CAAA;iBACzF;gBAED,sBAAO,IAAA,qCAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,CAAC,EAAA;;;KACzC;IAEY,0CAAmB,GAAhC,UAAiC,SAAkB;;;;gBAC3C,OAAO,GAAgC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,SAAS,CAAC,CAAA;gBACxF,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;IACH,mBAAC;AAAD,CAAC,AA5BD,IA4BC;AA5BY,oCAAY"}
|
|
@@ -1,25 +1,9 @@
|
|
|
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
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.cosmosTransactionSignResponseToSigned = exports.cosmosTransactionSignRequestToUnsigned = exports.cosmosSignedTransactionToResponse = exports.cosmosUnsignedTransactionToRequest = void 0;
|
|
15
4
|
var module_kit_1 = require("@airgap/module-kit");
|
|
16
5
|
function cosmosUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) {
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
transaction: rest,
|
|
20
|
-
publicKey: publicKey,
|
|
21
|
-
callbackURL: callbackUrl
|
|
22
|
-
};
|
|
6
|
+
return { transaction: unsigned, publicKey: publicKey, callbackURL: callbackUrl };
|
|
23
7
|
}
|
|
24
8
|
exports.cosmosUnsignedTransactionToRequest = cosmosUnsignedTransactionToRequest;
|
|
25
9
|
function cosmosSignedTransactionToResponse(signed, accountIdentifier) {
|
|
@@ -27,7 +11,7 @@ function cosmosSignedTransactionToResponse(signed, accountIdentifier) {
|
|
|
27
11
|
}
|
|
28
12
|
exports.cosmosSignedTransactionToResponse = cosmosSignedTransactionToResponse;
|
|
29
13
|
function cosmosTransactionSignRequestToUnsigned(request) {
|
|
30
|
-
return
|
|
14
|
+
return request.transaction;
|
|
31
15
|
}
|
|
32
16
|
exports.cosmosTransactionSignRequestToUnsigned = cosmosTransactionSignRequestToUnsigned;
|
|
33
17
|
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,iDAAyD;AAMzD,SAAgB,kCAAkC,CAChD,QAAmC,EACnC,SAAiB,EACjB,WAAoB;IAEpB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,WAAA,EAAE,WAAW,EAAE,WAAW,EAAE,CAAA;AACvE,CAAC;AAND,gFAMC;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,OAAO,CAAC,WAAW,CAAA;AAC5B,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<
|
|
3
|
+
export interface CosmosTransactionSignRequest extends TransactionSignRequest<CosmosUnsignedTransaction> {
|
|
4
4
|
}
|
|
@@ -12,88 +12,95 @@
|
|
|
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": {
|
|
15
31
|
"additionalProperties": false,
|
|
16
32
|
"properties": {
|
|
17
|
-
"
|
|
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": {
|
|
33
|
+
"amount": {
|
|
53
34
|
"items": {
|
|
54
35
|
"additionalProperties": false,
|
|
55
36
|
"properties": {
|
|
56
37
|
"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": {
|
|
73
38
|
"type": "string"
|
|
74
39
|
},
|
|
75
|
-
"
|
|
40
|
+
"denom": {
|
|
76
41
|
"type": "string"
|
|
77
|
-
},
|
|
78
|
-
"type": {
|
|
79
|
-
"enum": [0, 1, 2, 3],
|
|
80
|
-
"type": "number"
|
|
81
42
|
}
|
|
82
43
|
},
|
|
83
|
-
"required": ["
|
|
44
|
+
"required": ["denom", "amount"],
|
|
84
45
|
"type": "object"
|
|
85
46
|
},
|
|
86
47
|
"type": "array"
|
|
87
48
|
},
|
|
88
|
-
"
|
|
49
|
+
"gas": {
|
|
89
50
|
"type": "string"
|
|
90
51
|
}
|
|
91
52
|
},
|
|
92
|
-
"required": ["
|
|
53
|
+
"required": ["amount", "gas"],
|
|
93
54
|
"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"
|
|
94
101
|
}
|
|
95
102
|
},
|
|
96
|
-
"required": ["
|
|
103
|
+
"required": ["accountNumber", "chainID", "fee", "memo", "messages", "sequence", "type"],
|
|
97
104
|
"type": "object"
|
|
98
105
|
}
|
|
99
106
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { TransactionValidator } from '@airgap/serializer';
|
|
1
|
+
import { TransactionValidator, TransactionValidatorFactory } 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.CosmosTransactionValidator = void 0;
|
|
39
|
+
exports.CosmosTransactionValidatorFactory = 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,4 +85,13 @@ 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;
|
|
88
97
|
//# 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,iDAA0G;AAM1G,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;AAcvC;IAAA;IAIA,CAAC;IAHQ,kDAAM,GAAb;QACE,OAAO,IAAI,0BAA0B,EAAE,CAAA;IACzC,CAAC;IACH,wCAAC;AAAD,CAAC,AAJD,IAIC;AAJY,8EAAiC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,mBAAY,UAAU,mBAAgB,CAAC,CAAA;iBACpF;;;;KACF;IAEY,gEAA0B,GAAvC,UACE,UAAkB,EAClB,sBAA8C;;;gBAE9C,QAAQ,UAAU,EAAE;oBAClB,KAAK,kCAAmB,CAAC,MAAM;wBAC7B,sBAA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