@airgap/cosmos-core 0.13.45-beta.1 → 0.13.45-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/v1/index.js +11 -11
- package/v1/index.js.map +1 -1
- package/v1/node/CosmosNodeClient.js +189 -396
- package/v1/node/CosmosNodeClient.js.map +1 -1
- package/v1/protocol/CosmosBaseProtocol.js +557 -993
- package/v1/protocol/CosmosBaseProtocol.js.map +1 -1
- package/v1/protocol/CosmosCryptoClient.js +19 -82
- package/v1/protocol/CosmosCryptoClient.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +8 -20
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validators.js +12 -59
- package/v1/serializer/v3/validators/transaction-validators.js.map +1 -1
- package/v1/types/crypto.d.ts +1 -1
- package/v1/types/data/CosmosAddress.js +16 -18
- package/v1/types/data/CosmosAddress.js.map +1 -1
- package/v1/types/data/CosmosCoin.js +21 -23
- package/v1/types/data/CosmosCoin.js.map +1 -1
- package/v1/types/data/CosmosFee.js +16 -17
- package/v1/types/data/CosmosFee.js.map +1 -1
- package/v1/types/data/transaction/CosmosTransaction.js +38 -40
- package/v1/types/data/transaction/CosmosTransaction.js.map +1 -1
- package/v1/types/data/transaction/message/CosmosDelegateMessage.js +24 -27
- package/v1/types/data/transaction/message/CosmosDelegateMessage.js.map +1 -1
- package/v1/types/data/transaction/message/CosmosMessage.js +11 -12
- package/v1/types/data/transaction/message/CosmosMessage.js.map +1 -1
- package/v1/types/data/transaction/message/CosmosSendMessage.js +31 -41
- package/v1/types/data/transaction/message/CosmosSendMessage.js.map +1 -1
- package/v1/types/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js +20 -21
- package/v1/types/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js.map +1 -1
- package/v1/types/transaction.js +1 -1
- package/v1/types/transaction.js.map +1 -1
- package/v1/utils/key.js +4 -5
- package/v1/utils/key.js.map +1 -1
- package/v1/utils/signature.js +3 -4
- package/v1/utils/signature.js.map +1 -1
- package/v1/utils/transaction.js +1 -2
- package/v1/utils/transaction.js.map +1 -1
|
@@ -4,16 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CosmosTransaction = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
8
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
9
|
+
const coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
10
|
+
const CosmosFee_1 = require("../CosmosFee");
|
|
11
|
+
const CosmosDelegateMessage_1 = require("./message/CosmosDelegateMessage");
|
|
12
|
+
const CosmosMessage_1 = require("./message/CosmosMessage");
|
|
13
|
+
const CosmosSendMessage_1 = require("./message/CosmosSendMessage");
|
|
14
|
+
const CosmosWithdrawDelegationRewardMessage_1 = require("./message/CosmosWithdrawDelegationRewardMessage");
|
|
15
|
+
class CosmosTransaction {
|
|
16
|
+
constructor(messages, fee, memo, chainID, accountNumber, sequence) {
|
|
17
17
|
this.messages = messages;
|
|
18
18
|
this.fee = fee;
|
|
19
19
|
this.memo = memo;
|
|
@@ -21,56 +21,55 @@ var CosmosTransaction = /** @class */ (function () {
|
|
|
21
21
|
this.accountNumber = accountNumber;
|
|
22
22
|
this.sequence = sequence;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
toJSON() {
|
|
25
25
|
return {
|
|
26
26
|
accountNumber: this.accountNumber,
|
|
27
27
|
chainID: this.chainID,
|
|
28
28
|
fee: this.fee.toJSON(),
|
|
29
29
|
memo: this.memo,
|
|
30
|
-
messages: this.messages.map(
|
|
30
|
+
messages: this.messages.map((value) => value.toJSON()),
|
|
31
31
|
sequence: this.sequence
|
|
32
32
|
};
|
|
33
|
-
}
|
|
34
|
-
|
|
33
|
+
}
|
|
34
|
+
toRPCBody() {
|
|
35
35
|
return {
|
|
36
36
|
account_number: this.accountNumber,
|
|
37
37
|
chain_id: this.chainID,
|
|
38
38
|
fee: this.fee.toRPCBody(),
|
|
39
39
|
memo: this.memo,
|
|
40
|
-
msgs: this.messages.map(
|
|
40
|
+
msgs: this.messages.map((value) => value.toRPCBody()),
|
|
41
41
|
sequence: this.sequence
|
|
42
42
|
};
|
|
43
|
-
}
|
|
44
|
-
|
|
43
|
+
}
|
|
44
|
+
toEncodeObject() {
|
|
45
45
|
return {
|
|
46
46
|
typeUrl: '/cosmos.tx.v1beta1.TxBody',
|
|
47
47
|
value: {
|
|
48
|
-
messages: this.messages.map(
|
|
48
|
+
messages: this.messages.map((msg) => msg.toEncodeObject()),
|
|
49
49
|
memo: this.memo
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var fee = this.fee.amount.map(function (value) { return new bignumber_1.default(value.amount); }).reduce(function (prev, next) { return prev.plus(next); });
|
|
52
|
+
}
|
|
53
|
+
toAirGapTransactions(network) {
|
|
54
|
+
const fee = this.fee.amount.map((value) => new bignumber_1.default(value.amount)).reduce((prev, next) => prev.plus(next));
|
|
56
55
|
return this.messages
|
|
57
|
-
.map(
|
|
58
|
-
.map(
|
|
56
|
+
.map((message) => message.toAirGapTransaction(network, fee.toString(10)))
|
|
57
|
+
.map((tx) => {
|
|
59
58
|
if (!tx.json) {
|
|
60
59
|
tx.json = {};
|
|
61
60
|
}
|
|
62
|
-
tx.json.accountNumber =
|
|
63
|
-
tx.json.chainID =
|
|
64
|
-
tx.json.memo =
|
|
65
|
-
tx.json.sequence =
|
|
66
|
-
tx.arbitraryData =
|
|
61
|
+
tx.json.accountNumber = this.accountNumber;
|
|
62
|
+
tx.json.chainID = this.chainID;
|
|
63
|
+
tx.json.memo = this.memo;
|
|
64
|
+
tx.json.sequence = this.sequence;
|
|
65
|
+
tx.arbitraryData = this.memo;
|
|
67
66
|
return tx;
|
|
68
67
|
});
|
|
69
|
-
}
|
|
70
|
-
|
|
68
|
+
}
|
|
69
|
+
static fromJSON(json) {
|
|
71
70
|
json = JSON.parse(JSON.stringify(json));
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const messages = json.messages.map((value) => {
|
|
72
|
+
const type = value.type;
|
|
74
73
|
switch (type) {
|
|
75
74
|
case CosmosMessage_1.CosmosMessageType.Send.index:
|
|
76
75
|
return CosmosSendMessage_1.CosmosSendMessage.fromJSON(value);
|
|
@@ -84,11 +83,11 @@ var CosmosTransaction = /** @class */ (function () {
|
|
|
84
83
|
}
|
|
85
84
|
});
|
|
86
85
|
return new CosmosTransaction(messages, CosmosFee_1.CosmosFee.fromJSON(json.fee), json.memo, json.chainID, json.accountNumber, json.sequence);
|
|
87
|
-
}
|
|
88
|
-
|
|
86
|
+
}
|
|
87
|
+
static fromRPCBody(json) {
|
|
89
88
|
json = JSON.parse(JSON.stringify(json));
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
const messages = json.msgs.map((value) => {
|
|
90
|
+
const type = value.type;
|
|
92
91
|
switch (type) {
|
|
93
92
|
case CosmosMessage_1.CosmosMessageType.Send.value:
|
|
94
93
|
return CosmosSendMessage_1.CosmosSendMessage.fromRPCBody(value);
|
|
@@ -102,8 +101,7 @@ var CosmosTransaction = /** @class */ (function () {
|
|
|
102
101
|
}
|
|
103
102
|
});
|
|
104
103
|
return new CosmosTransaction(messages, CosmosFee_1.CosmosFee.fromRPCBody(json.fee), json.memo, json.chain_id, json.account_number, json.sequence);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
}());
|
|
104
|
+
}
|
|
105
|
+
}
|
|
108
106
|
exports.CosmosTransaction = CosmosTransaction;
|
|
109
107
|
//# sourceMappingURL=CosmosTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosTransaction.js","sourceRoot":"","sources":["../../../../../src/v1/types/data/transaction/CosmosTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"CosmosTransaction.js","sourceRoot":"","sources":["../../../../../src/v1/types/data/transaction/CosmosTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,mHAA0F;AAE1F,wDAA+D;AAC/D,6EAAkE;AAOlE,4CAAwC;AAExC,2EAAuE;AACvE,2DAAkG;AAClG,mEAA+D;AAC/D,2GAAuG;AAMvG,MAAa,iBAAiB;IAQ5B,YAAY,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,MAAM;QACX,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,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACtD,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAA;IACH,CAAC;IAEM,SAAS;QACd,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,aAAa;YAClC,QAAQ,EAAE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5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (undelegate === void 0) { undelegate = false; }
|
|
4
|
+
const IAirGapTransaction_1 = require("@airgap/coinlib-core/interfaces/IAirGapTransaction");
|
|
5
|
+
const module_kit_1 = require("@airgap/module-kit");
|
|
6
|
+
const CosmosCoin_1 = require("../../CosmosCoin");
|
|
7
|
+
const CosmosMessage_1 = require("./CosmosMessage");
|
|
8
|
+
class CosmosDelegateMessage {
|
|
9
|
+
constructor(delegatorAddress, validatorAddress, amount, undelegate = false) {
|
|
11
10
|
this.delegatorAddress = delegatorAddress;
|
|
12
11
|
this.validatorAddress = validatorAddress;
|
|
13
12
|
this.amount = amount;
|
|
14
13
|
this.type = undelegate ? CosmosMessage_1.CosmosMessageType.Undelegate : CosmosMessage_1.CosmosMessageType.Delegate;
|
|
15
14
|
}
|
|
16
|
-
|
|
15
|
+
toEncodeObject() {
|
|
17
16
|
return {
|
|
18
17
|
typeUrl: this.type.value,
|
|
19
18
|
value: {
|
|
@@ -22,24 +21,23 @@ var CosmosDelegateMessage = /** @class */ (function () {
|
|
|
22
21
|
amount: this.amount
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
CosmosDelegateMessage.prototype.toJSON = function () {
|
|
24
|
+
}
|
|
25
|
+
static fromEncodeObject(encodeObject) {
|
|
26
|
+
const undelegate = encodeObject.typeUrl === CosmosMessage_1.CosmosMessageType.Undelegate.value;
|
|
27
|
+
return new CosmosDelegateMessage(encodeObject.value.delegatorAddress, encodeObject.value.validatorAddress, new CosmosCoin_1.CosmosCoin(encodeObject.value.amount?.denom ?? 'uatom', encodeObject.value.amount?.amount ?? '0'), undelegate);
|
|
28
|
+
}
|
|
29
|
+
toJSON() {
|
|
32
30
|
return {
|
|
33
31
|
type: this.type.index,
|
|
34
32
|
amount: [this.amount.toJSON()],
|
|
35
33
|
fromAddress: this.delegatorAddress,
|
|
36
34
|
toAddress: this.validatorAddress
|
|
37
35
|
};
|
|
38
|
-
}
|
|
39
|
-
|
|
36
|
+
}
|
|
37
|
+
static fromJSON(json) {
|
|
40
38
|
return new CosmosDelegateMessage(json.fromAddress, json.toAddress, CosmosCoin_1.CosmosCoin.fromJSON(json.amount[0]), json.type === CosmosMessage_1.CosmosMessageType.Undelegate.index);
|
|
41
|
-
}
|
|
42
|
-
|
|
39
|
+
}
|
|
40
|
+
toRPCBody() {
|
|
43
41
|
return {
|
|
44
42
|
type: this.type.value,
|
|
45
43
|
value: {
|
|
@@ -48,23 +46,22 @@ var CosmosDelegateMessage = /** @class */ (function () {
|
|
|
48
46
|
validator_address: this.validatorAddress
|
|
49
47
|
}
|
|
50
48
|
};
|
|
51
|
-
}
|
|
52
|
-
|
|
49
|
+
}
|
|
50
|
+
toAirGapTransaction(network, fee) {
|
|
53
51
|
return {
|
|
54
52
|
from: [this.delegatorAddress],
|
|
55
53
|
to: [this.validatorAddress],
|
|
56
54
|
isInbound: false,
|
|
57
55
|
amount: (0, module_kit_1.newAmount)(this.amount.amount, 'blockchain'),
|
|
58
56
|
fee: (0, module_kit_1.newAmount)(fee, 'blockchain'),
|
|
59
|
-
network
|
|
57
|
+
network,
|
|
60
58
|
type: this.type.index === CosmosMessage_1.CosmosMessageTypeIndex.DELEGATE ? IAirGapTransaction_1.AirGapTransactionType.DELEGATE : IAirGapTransaction_1.AirGapTransactionType.UNDELEGATE,
|
|
61
59
|
json: this.toRPCBody()
|
|
62
60
|
};
|
|
63
|
-
}
|
|
64
|
-
|
|
61
|
+
}
|
|
62
|
+
static fromRPCBody(json) {
|
|
65
63
|
return new CosmosDelegateMessage(json.value.delegator_address, json.value.validator_address, CosmosCoin_1.CosmosCoin.fromRPCBody(json.value.amount), json.type === CosmosMessage_1.CosmosMessageType.Undelegate.value);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
}());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
69
66
|
exports.CosmosDelegateMessage = CosmosDelegateMessage;
|
|
70
67
|
//# sourceMappingURL=CosmosDelegateMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosDelegateMessage.js","sourceRoot":"","sources":["../../../../../../src/v1/types/data/transaction/message/CosmosDelegateMessage.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"CosmosDelegateMessage.js","sourceRoot":"","sources":["../../../../../../src/v1/types/data/transaction/message/CosmosDelegateMessage.ts"],"names":[],"mappings":";;;AACA,2FAA0F;AAC1F,mDAAiE;AAGjE,iDAA6C;AAE7C,mDAA6G;AAE7G,MAAa,qBAAqB;IAOhC,YAAY,gBAAwB,EAAE,gBAAwB,EAAE,MAAkB,EAAE,aAAsB,KAAK;QAC7G,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,iCAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,iCAAiB,CAAC,QAAQ,CAAA;IACpF,CAAC;IAEM,cAAc;QACnB,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACxB,KAAK,EAAE;gBACL,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB;SACF,CAAA;IACH,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,YAA0B;QACvD,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,KAAK,iCAAiB,CAAC,UAAU,CAAC,KAAK,CAAA;QAC9E,OAAO,IAAI,qBAAqB,CAC9B,YAAY,CAAC,KAAK,CAAC,gBAAgB,EACnC,YAAY,CAA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AC;YACnD,GAAG,EAAE,IAAA,sBAAS,EAAC,GAAG,EAAE,YAAY,CAAC;YAEjC,OAAO;YACP,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,sCAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC,0CAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC,0CAAqB,CAAC,UAAU;YAC7H,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE;SACvB,CAAA;IACH,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,IAAS;QACjC,OAAO,IAAI,qBAAqB,CAC9B,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAC5B,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAC5B,uBAAU,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EACzC,IAAI,CAAC,IAAI,KAAK,iCAAiB,CAAC,UAAU,CAAC,KAAK,CACjD,CAAA;IACH,CAAC;CACF;AAvFD,sDAuFC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CosmosMessageType = exports.CosmosMessageTypeValue = exports.CosmosMessageTypeIndex = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
5
|
+
const coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
6
6
|
var CosmosMessageTypeIndex;
|
|
7
7
|
(function (CosmosMessageTypeIndex) {
|
|
8
8
|
CosmosMessageTypeIndex[CosmosMessageTypeIndex["SEND"] = 0] = "SEND";
|
|
9
9
|
CosmosMessageTypeIndex[CosmosMessageTypeIndex["DELEGATE"] = 1] = "DELEGATE";
|
|
10
10
|
CosmosMessageTypeIndex[CosmosMessageTypeIndex["UNDELEGATE"] = 2] = "UNDELEGATE";
|
|
11
11
|
CosmosMessageTypeIndex[CosmosMessageTypeIndex["WITHDRAW_DELEGATION_REWARD"] = 3] = "WITHDRAW_DELEGATION_REWARD";
|
|
12
|
-
})(CosmosMessageTypeIndex
|
|
12
|
+
})(CosmosMessageTypeIndex || (exports.CosmosMessageTypeIndex = CosmosMessageTypeIndex = {}));
|
|
13
13
|
var CosmosMessageTypeValue;
|
|
14
14
|
(function (CosmosMessageTypeValue) {
|
|
15
15
|
CosmosMessageTypeValue["SEND"] = "/cosmos.bank.v1beta1.MsgSend";
|
|
@@ -17,9 +17,13 @@ var CosmosMessageTypeValue;
|
|
|
17
17
|
CosmosMessageTypeValue["UNDELEGATE"] = "/cosmos.staking.v1beta1.MsgUndelegate";
|
|
18
18
|
CosmosMessageTypeValue["WITHDRAW_DELEGATION_REWARD"] = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward";
|
|
19
19
|
CosmosMessageTypeValue["MSGMULTISEND"] = "/cosmos.bank.v1beta1.MsgMultiSend";
|
|
20
|
-
})(CosmosMessageTypeValue
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
})(CosmosMessageTypeValue || (exports.CosmosMessageTypeValue = CosmosMessageTypeValue = {}));
|
|
21
|
+
class CosmosMessageType {
|
|
22
|
+
static { this.Send = new CosmosMessageType(CosmosMessageTypeIndex.SEND); }
|
|
23
|
+
static { this.Delegate = new CosmosMessageType(CosmosMessageTypeIndex.DELEGATE); }
|
|
24
|
+
static { this.Undelegate = new CosmosMessageType(CosmosMessageTypeIndex.UNDELEGATE); }
|
|
25
|
+
static { this.WithdrawDelegationReward = new CosmosMessageType(CosmosMessageTypeIndex.WITHDRAW_DELEGATION_REWARD); }
|
|
26
|
+
constructor(index) {
|
|
23
27
|
this.index = index;
|
|
24
28
|
switch (index) {
|
|
25
29
|
case CosmosMessageTypeIndex.SEND:
|
|
@@ -38,11 +42,6 @@ var CosmosMessageType = /** @class */ (function () {
|
|
|
38
42
|
throw new errors_1.InvalidValueError(coinlib_error_1.Domain.COSMOS, 'Unknown message');
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
|
-
|
|
42
|
-
CosmosMessageType.Delegate = new CosmosMessageType(CosmosMessageTypeIndex.DELEGATE);
|
|
43
|
-
CosmosMessageType.Undelegate = new CosmosMessageType(CosmosMessageTypeIndex.UNDELEGATE);
|
|
44
|
-
CosmosMessageType.WithdrawDelegationReward = new CosmosMessageType(CosmosMessageTypeIndex.WITHDRAW_DELEGATION_REWARD);
|
|
45
|
-
return CosmosMessageType;
|
|
46
|
-
}());
|
|
45
|
+
}
|
|
47
46
|
exports.CosmosMessageType = CosmosMessageType;
|
|
48
47
|
//# sourceMappingURL=CosmosMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosMessage.js","sourceRoot":"","sources":["../../../../../../src/v1/types/data/transaction/message/CosmosMessage.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"CosmosMessage.js","sourceRoot":"","sources":["../../../../../../src/v1/types/data/transaction/message/CosmosMessage.ts"],"names":[],"mappings":";;;AAAA,wDAA+D;AAC/D,6EAAkE;AAgBlE,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,mEAAQ,CAAA;IACR,2EAAY,CAAA;IACZ,+EAAc,CAAA;IACd,+GAA8B,CAAA;AAChC,CAAC,EALW,sBAAsB,sCAAtB,sBAAsB,QAKjC;AAED,IAAY,sBAMX;AAND,WAAY,sBAAsB;IAChC,+DAAqC,CAAA;IACrC,0EAAgD,CAAA;IAChD,8EAAoD,CAAA;IACpD,gHAAsF,CAAA;IACtF,4EAAkD,CAAA;AACpD,CAAC,EANW,sBAAsB,sCAAtB,sBAAsB,QAMjC;AAED,MAAa,iBAAiB;aACd,SAAI,GAAsB,IAAI,iBAAiB,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAA;aAC5E,aAAQ,GAAsB,IAAI,iBAAiB,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAA;aACpF,eAAU,GAAsB,IAAI,iBAAiB,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAA;aACxF,6BAAwB,GAAsB,IAAI,iBAAiB,CAAC,sBAAsB,CAAC,0BAA0B,CAAC,CAAA;IAKpI,YAAY,KAA6B;QACvC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,QAAQ,KAAK,EAAE,CAAC;YACd,KAAK,sBAAsB,CAAC,IAAI;gBAC9B,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAA;gBACxC,MAAK;YACP,KAAK,sBAAsB,CAAC,QAAQ;gBAClC,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAC,QAAQ,CAAA;gBAC5C,MAAK;YACP,KAAK,sBAAsB,CAAC,UAAU;gBACpC,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAC,UAAU,CAAA;gBAC9C,MAAK;YACP,KAAK,sBAAsB,CAAC,0BAA0B;gBACpD,IAAI,CAAC,KAAK,GAAG,sBAAsB,CAAC,0BAA0B,CAAA;gBAC9D,MAAK;YACP;gBACE,MAAM,IAAI,0BAAiB,CAAC,sBAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;QACjE,CAAC;IACH,CAAC;;AA3BH,8CA4BC"}
|
|
@@ -1,83 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
6
|
exports.CosmosSendMessage = void 0;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
const bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
8
|
+
const IAirGapTransaction_1 = require("@airgap/coinlib-core/interfaces/IAirGapTransaction");
|
|
9
|
+
const module_kit_1 = require("@airgap/module-kit");
|
|
10
|
+
const CosmosCoin_1 = require("../../CosmosCoin");
|
|
11
|
+
const CosmosMessage_1 = require("./CosmosMessage");
|
|
12
|
+
class CosmosSendMessage {
|
|
13
|
+
constructor(fromAddress, toAddress, amount) {
|
|
23
14
|
this.type = CosmosMessage_1.CosmosMessageType.Send;
|
|
24
15
|
this.fromAddress = fromAddress;
|
|
25
16
|
this.toAddress = toAddress;
|
|
26
17
|
this.amount = amount;
|
|
27
18
|
}
|
|
28
|
-
|
|
19
|
+
toEncodeObject() {
|
|
29
20
|
return {
|
|
30
21
|
typeUrl: this.type.value,
|
|
31
22
|
value: {
|
|
32
23
|
fromAddress: this.fromAddress,
|
|
33
24
|
toAddress: this.toAddress,
|
|
34
|
-
amount:
|
|
25
|
+
amount: [...this.amount]
|
|
35
26
|
}
|
|
36
27
|
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return new CosmosSendMessage(encodeObject.value.fromAddress, encodeObject.value.toAddress, encodeObject.value.amount.map(
|
|
40
|
-
}
|
|
41
|
-
|
|
28
|
+
}
|
|
29
|
+
static fromEncodeObject(encodeObject) {
|
|
30
|
+
return new CosmosSendMessage(encodeObject.value.fromAddress, encodeObject.value.toAddress, encodeObject.value.amount.map((amount) => new CosmosCoin_1.CosmosCoin(amount.denom, amount.amount)));
|
|
31
|
+
}
|
|
32
|
+
toJSON() {
|
|
42
33
|
return {
|
|
43
34
|
type: this.type.index,
|
|
44
|
-
amount: this.amount.map(
|
|
35
|
+
amount: this.amount.map((value) => value.toJSON()),
|
|
45
36
|
fromAddress: this.fromAddress,
|
|
46
37
|
toAddress: this.toAddress
|
|
47
38
|
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return new CosmosSendMessage(json.fromAddress, json.toAddress, json.amount.map(
|
|
51
|
-
}
|
|
52
|
-
|
|
39
|
+
}
|
|
40
|
+
static fromJSON(json) {
|
|
41
|
+
return new CosmosSendMessage(json.fromAddress, json.toAddress, json.amount.map((value) => CosmosCoin_1.CosmosCoin.fromJSON(value)));
|
|
42
|
+
}
|
|
43
|
+
toRPCBody() {
|
|
53
44
|
return {
|
|
54
45
|
type: this.type.value,
|
|
55
46
|
value: {
|
|
56
|
-
amount: this.amount.map(
|
|
47
|
+
amount: this.amount.map((value) => value.toRPCBody()),
|
|
57
48
|
from_address: this.fromAddress,
|
|
58
49
|
to_address: this.toAddress
|
|
59
50
|
}
|
|
60
51
|
};
|
|
61
|
-
}
|
|
62
|
-
|
|
52
|
+
}
|
|
53
|
+
toAirGapTransaction(network, fee) {
|
|
63
54
|
return {
|
|
64
55
|
from: [this.fromAddress],
|
|
65
56
|
to: [this.toAddress],
|
|
66
57
|
isInbound: false,
|
|
67
58
|
amount: (0, module_kit_1.newAmount)(this.amount
|
|
68
|
-
.map(
|
|
69
|
-
.reduce(
|
|
59
|
+
.map((value) => new bignumber_1.default(value.amount))
|
|
60
|
+
.reduce((prev, next) => prev.plus(next))
|
|
70
61
|
.toString(10), 'blockchain'),
|
|
71
62
|
fee: (0, module_kit_1.newAmount)(fee, 'blockchain'),
|
|
72
|
-
network
|
|
63
|
+
network,
|
|
73
64
|
type: IAirGapTransaction_1.AirGapTransactionType.SPEND,
|
|
74
65
|
json: this.toRPCBody()
|
|
75
66
|
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return new CosmosSendMessage(json.value.from_address, json.value.to_address, json.value.amount.map(
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
}());
|
|
67
|
+
}
|
|
68
|
+
static fromRPCBody(json) {
|
|
69
|
+
return new CosmosSendMessage(json.value.from_address, json.value.to_address, json.value.amount.map((value) => CosmosCoin_1.CosmosCoin.fromRPCBody(value)));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
82
72
|
exports.CosmosSendMessage = CosmosSendMessage;
|
|
83
73
|
//# sourceMappingURL=CosmosSendMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosSendMessage.js","sourceRoot":"","sources":["../../../../../../src/v1/types/data/transaction/message/CosmosSendMessage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CosmosSendMessage.js","sourceRoot":"","sources":["../../../../../../src/v1/types/data/transaction/message/CosmosSendMessage.ts"],"names":[],"mappings":";;;;;;AAAA,mHAA0F;AAE1F,2FAA0F;AAC1F,mDAAiE;AAGjE,iDAA6D;AAE7D,mDAAqF;AAErF,MAAa,iBAAiB;IAO5B,YAAY,WAAmB,EAAE,SAAiB,EAAE,MAAoB;QAFxD,SAAI,GAAsB,iCAAiB,CAAC,IAAI,CAAA;QAG9D,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,cAAc;QACnB,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACxB,KAAK,EAAE;gBACL,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;aACzB;SACF,CAAA;IACH,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,YAA0B;QACvD,OAAO,IAAI,iBAAiB,CAC1B,YAAY,CAAC,KAAK,CAAC,WAAW,EAC9B,YAAY,CAAC,KAAK,CAAC,SAAS,EAC5B,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAW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AE,CAAC,IAAI,mBAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;iBACvD,MAAM,CAAC,CAAC,IAAe,EAAE,IAAe,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBAC7D,QAAQ,CAAC,EAAE,CAAC,EACf,YAAY,CACb;YACD,GAAG,EAAE,IAAA,sBAAS,EAAC,GAAG,EAAE,YAAY,CAAC;YAEjC,OAAO;YACP,IAAI,EAAE,0CAAqB,CAAC,KAAK;YACjC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE;SACvB,CAAA;IACH,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,IAAS;QACjC,OAAO,IAAI,iBAAiB,CAC1B,IAAI,CAAC,KAAK,CAAC,YAAY,EACvB,IAAI,CAAC,KAAK,CAAC,UAAU,EACrB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,uBAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CACrE,CAAA;IACH,CAAC;CACF;AAxFD,8CAwFC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CosmosWithdrawDelegationRewardMessage = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const module_kit_1 = require("@airgap/module-kit");
|
|
5
|
+
const CosmosMessage_1 = require("./CosmosMessage");
|
|
6
|
+
class CosmosWithdrawDelegationRewardMessage {
|
|
7
|
+
constructor(delegatorAddress, validatorAddress) {
|
|
8
8
|
this.type = CosmosMessage_1.CosmosMessageType.WithdrawDelegationReward;
|
|
9
9
|
this.delegatorAddress = delegatorAddress;
|
|
10
10
|
this.validatorAddress = validatorAddress;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
toEncodeObject() {
|
|
13
13
|
return {
|
|
14
14
|
typeUrl: this.type.value,
|
|
15
15
|
value: {
|
|
@@ -17,33 +17,33 @@ var CosmosWithdrawDelegationRewardMessage = /** @class */ (function () {
|
|
|
17
17
|
validatorAddress: this.validatorAddress
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
}
|
|
21
|
-
|
|
20
|
+
}
|
|
21
|
+
static fromEncodeObject(encodeObject) {
|
|
22
22
|
return new CosmosWithdrawDelegationRewardMessage(encodeObject.value.delegatorAddress, encodeObject.value.validatorAddress);
|
|
23
|
-
}
|
|
24
|
-
|
|
23
|
+
}
|
|
24
|
+
toAirGapTransaction(network, fee) {
|
|
25
25
|
return {
|
|
26
26
|
from: [this.delegatorAddress],
|
|
27
27
|
to: [this.validatorAddress],
|
|
28
28
|
isInbound: false,
|
|
29
29
|
amount: (0, module_kit_1.newAmount)('0', 'blockchain'),
|
|
30
30
|
fee: (0, module_kit_1.newAmount)(fee, 'blockchain'),
|
|
31
|
-
network
|
|
31
|
+
network,
|
|
32
32
|
json: this.toRPCBody()
|
|
33
33
|
};
|
|
34
|
-
}
|
|
35
|
-
|
|
34
|
+
}
|
|
35
|
+
toJSON() {
|
|
36
36
|
return {
|
|
37
37
|
type: this.type.index,
|
|
38
38
|
amount: [{ denom: '', amount: '' }],
|
|
39
39
|
fromAddress: this.delegatorAddress,
|
|
40
40
|
toAddress: this.validatorAddress
|
|
41
41
|
};
|
|
42
|
-
}
|
|
43
|
-
|
|
42
|
+
}
|
|
43
|
+
static fromJSON(json) {
|
|
44
44
|
return new CosmosWithdrawDelegationRewardMessage(json.fromAddress, json.toAddress);
|
|
45
|
-
}
|
|
46
|
-
|
|
45
|
+
}
|
|
46
|
+
toRPCBody() {
|
|
47
47
|
return {
|
|
48
48
|
type: this.type.value,
|
|
49
49
|
value: {
|
|
@@ -51,11 +51,10 @@ var CosmosWithdrawDelegationRewardMessage = /** @class */ (function () {
|
|
|
51
51
|
validator_address: this.validatorAddress
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
}
|
|
55
|
-
|
|
54
|
+
}
|
|
55
|
+
static fromRPCBody(json) {
|
|
56
56
|
return new CosmosWithdrawDelegationRewardMessage(json.value.delegator_address, json.value.validator_address);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
}());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
60
59
|
exports.CosmosWithdrawDelegationRewardMessage = CosmosWithdrawDelegationRewardMessage;
|
|
61
60
|
//# sourceMappingURL=CosmosWithdrawDelegationRewardMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosWithdrawDelegationRewardMessage.js","sourceRoot":"","sources":["../../../../../../src/v1/types/data/transaction/message/CosmosWithdrawDelegationRewardMessage.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"CosmosWithdrawDelegationRewardMessage.js","sourceRoot":"","sources":["../../../../../../src/v1/types/data/transaction/message/CosmosWithdrawDelegationRewardMessage.ts"],"names":[],"mappings":";;;AACA,mDAAiE;AAIjE,mDAAqF;AAErF,MAAa,qCAAqC;IAKhD,YAAY,gBAAwB,EAAE,gBAAwB;QAF9C,SAAI,GAAsB,iCAAiB,CAAC,wBAAwB,CAAA;QAGlF,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;IAC1C,CAAC;IAEM,cAAc;QACnB,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACxB,KAAK,EAAE;gBACL,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;aACxC;SACF,CAAA;IACH,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,YAA0B;QACvD,OAAO,IAAI,qCAAqC,CAAC,YAAY,CAAC,KAAK,CAAC,gBAAgB,EAAE,YAAY,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;IAC5H,CAAC;IAEM,mBA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DelegationActionType["UNDELEGATE"] = "undelegate";
|
|
15
15
|
CosmosDelegationActionType["WITHDRAW_ALL_REWARDS"] = "withdraw_all_rewards";
|
|
16
16
|
CosmosDelegationActionType["WITHDRAW_VALIDATOR_REWARDS"] = "withdraw_validator_rewards";
|
|
17
|
-
})(CosmosDelegationActionType
|
|
17
|
+
})(CosmosDelegationActionType || (exports.CosmosDelegationActionType = CosmosDelegationActionType = {}));
|
|
18
18
|
//# sourceMappingURL=transaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/v1/types/transaction.ts"],"names":[],"mappings":";;;AAEA,IAAK,sBAKJ;AALD,WAAK,sBAAsB;IACzB,mEAAQ,CAAA;IACR,2EAAY,CAAA;IACZ,+EAAc,CAAA;IACd,+GAA8B,CAAA;AAChC,CAAC,EALI,sBAAsB,KAAtB,sBAAsB,QAK1B;AAED,IAAY,0BAKX;AALD,WAAY,0BAA0B;IACpC,mDAAqB,CAAA;IACrB,uDAAyB,CAAA;IACzB,2EAA6C,CAAA;IAC7C,uFAAyD,CAAA;AAC3D,CAAC,EALW,0BAA0B,
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/v1/types/transaction.ts"],"names":[],"mappings":";;;AAEA,IAAK,sBAKJ;AALD,WAAK,sBAAsB;IACzB,mEAAQ,CAAA;IACR,2EAAY,CAAA;IACZ,+EAAc,CAAA;IACd,+GAA8B,CAAA;AAChC,CAAC,EALI,sBAAsB,KAAtB,sBAAsB,QAK1B;AAED,IAAY,0BAKX;AALD,WAAY,0BAA0B;IACpC,mDAAqB,CAAA;IACrB,uDAAyB,CAAA;IACzB,2EAA6C,CAAA;IAC7C,uFAAyD,CAAA;AAC3D,CAAC,EALW,0BAA0B,0CAA1B,0BAA0B,QAKrC"}
|
package/v1/utils/key.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
exports.convertSecretKey = convertSecretKey;
|
|
4
|
+
exports.convertPublicKey = convertPublicKey;
|
|
5
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
6
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
6
7
|
function convertSecretKey(secretKey, targetFormat) {
|
|
7
8
|
if (secretKey.format === targetFormat) {
|
|
8
9
|
return secretKey;
|
|
9
10
|
}
|
|
10
11
|
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, 'Unsupported secret key conversion.');
|
|
11
12
|
}
|
|
12
|
-
exports.convertSecretKey = convertSecretKey;
|
|
13
13
|
function convertPublicKey(publicKey, targetFormat) {
|
|
14
14
|
if (publicKey.format === targetFormat) {
|
|
15
15
|
return publicKey;
|
|
16
16
|
}
|
|
17
17
|
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, 'Unsupported public key conversion.');
|
|
18
18
|
}
|
|
19
|
-
exports.convertPublicKey = convertPublicKey;
|
|
20
19
|
//# sourceMappingURL=key.js.map
|
package/v1/utils/key.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../../src/v1/utils/key.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"key.js","sourceRoot":"","sources":["../../../src/v1/utils/key.ts"],"names":[],"mappings":";;AAIA,4CAMC;AAED,4CAMC;AAlBD,uDAA6C;AAC7C,wDAA8D;AAG9D,SAAgB,gBAAgB,CAAC,SAAoB,EAAE,YAAiC;IACtF,IAAI,SAAS,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;QACtC,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,MAAM,EAAE,oCAAoC,CAAC,CAAA;AACjF,CAAC;AAED,SAAgB,gBAAgB,CAAC,SAAoB,EAAE,YAAiC;IACtF,IAAI,SAAS,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;QACtC,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,MAAM,EAAE,oCAAoC,CAAC,CAAA;AACjF,CAAC"}
|
package/v1/utils/signature.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertSignature =
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
exports.convertSignature = convertSignature;
|
|
4
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
5
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
6
6
|
function convertSignature(signature, targetFormat) {
|
|
7
7
|
if (signature.format === targetFormat) {
|
|
8
8
|
return signature;
|
|
9
9
|
}
|
|
10
10
|
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.COSMOS, 'Unsupported signature key conversion.');
|
|
11
11
|
}
|
|
12
|
-
exports.convertSignature = convertSignature;
|
|
13
12
|
//# sourceMappingURL=signature.js.map
|