@airgap/cosmos 0.13.45-beta.2 → 0.13.45-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/v0/index.js +8 -8
- package/v0/index.js.map +1 -1
- package/v0/protocol/CosmosAddress.js +15 -16
- package/v0/protocol/CosmosAddress.js.map +1 -1
- package/v0/protocol/CosmosCoin.js +23 -24
- package/v0/protocol/CosmosCoin.js.map +1 -1
- package/v0/protocol/CosmosCryptoClient.js +19 -82
- package/v0/protocol/CosmosCryptoClient.js.map +1 -1
- package/v0/protocol/CosmosFee.js +16 -17
- package/v0/protocol/CosmosFee.js.map +1 -1
- package/v0/protocol/CosmosNodeClient.js +173 -365
- package/v0/protocol/CosmosNodeClient.js.map +1 -1
- package/v0/protocol/CosmosProtocol.d.ts +0 -1
- package/v0/protocol/CosmosProtocol.js +577 -1094
- package/v0/protocol/CosmosProtocol.js.map +1 -1
- package/v0/protocol/CosmosProtocolOptions.js +25 -98
- package/v0/protocol/CosmosProtocolOptions.js.map +1 -1
- package/v0/protocol/CosmosTransaction.js +37 -39
- package/v0/protocol/CosmosTransaction.js.map +1 -1
- package/v0/protocol/CosmosTypes.js +1 -1
- package/v0/protocol/CosmosTypes.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.js +24 -27
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosMessage.js +11 -12
- package/v0/protocol/cosmos-message/CosmosMessage.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosSendMessage.js +31 -41
- package/v0/protocol/cosmos-message/CosmosSendMessage.js.map +1 -1
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js +20 -21
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js.map +1 -1
- package/v0/serializer/validators/transaction-validator.js +25 -77
- package/v0/serializer/validators/transaction-validator.js.map +1 -1
- package/v1/block-explorer/MintscanBlockExplorer.js +12 -61
- package/v1/block-explorer/MintscanBlockExplorer.js.map +1 -1
- package/v1/index.js +3 -3
- package/v1/index.js.map +1 -1
- package/v1/module/CosmosModule.d.ts +1 -1
- package/v1/module/CosmosModule.js +37 -95
- package/v1/module/CosmosModule.js.map +1 -1
- package/v1/module.js +2 -3
- package/v1/module.js.map +1 -1
- package/v1/protocol/CosmosProtocol.d.ts +1 -1
- package/v1/protocol/CosmosProtocol.js +35 -113
- package/v1/protocol/CosmosProtocol.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +57 -124
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosMessage.js","sourceRoot":"","sources":["../../../../src/v0/protocol/cosmos-message/CosmosMessage.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"CosmosMessage.js","sourceRoot":"","sources":["../../../../src/v0/protocol/cosmos-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,sBAKX;AALD,WAAY,sBAAsB;IAChC,+DAAqC,CAAA;IACrC,0EAAgD,CAAA;IAChD,8EAAoD,CAAA;IACpD,gHAAsF,CAAA;AACxF,CAAC,EALW,sBAAsB,sCAAtB,sBAAsB,QAKjC;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,85 +1,75 @@
|
|
|
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
|
-
|
|
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 CosmosCoin_1 = require("../CosmosCoin");
|
|
10
|
+
const CosmosMessage_1 = require("./CosmosMessage");
|
|
11
|
+
class CosmosSendMessage {
|
|
12
|
+
constructor(fromAddress, toAddress, amount) {
|
|
22
13
|
this.type = CosmosMessage_1.CosmosMessageType.Send;
|
|
23
14
|
this.fromAddress = fromAddress;
|
|
24
15
|
this.toAddress = toAddress;
|
|
25
16
|
this.amount = amount;
|
|
26
17
|
}
|
|
27
|
-
|
|
18
|
+
toEncodeObject() {
|
|
28
19
|
return {
|
|
29
20
|
typeUrl: this.type.value,
|
|
30
21
|
value: {
|
|
31
22
|
fromAddress: this.fromAddress,
|
|
32
23
|
toAddress: this.toAddress,
|
|
33
|
-
amount:
|
|
24
|
+
amount: [...this.amount]
|
|
34
25
|
}
|
|
35
26
|
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return new CosmosSendMessage(encodeObject.value.fromAddress, encodeObject.value.toAddress, encodeObject.value.amount.map(
|
|
39
|
-
}
|
|
40
|
-
|
|
27
|
+
}
|
|
28
|
+
static fromEncodeObject(encodeObject) {
|
|
29
|
+
return new CosmosSendMessage(encodeObject.value.fromAddress, encodeObject.value.toAddress, encodeObject.value.amount.map((amount) => new CosmosCoin_1.CosmosCoin(amount.denom, amount.amount)));
|
|
30
|
+
}
|
|
31
|
+
toJSON() {
|
|
41
32
|
return {
|
|
42
33
|
type: this.type.index,
|
|
43
|
-
amount: this.amount.map(
|
|
34
|
+
amount: this.amount.map((value) => value.toJSON()),
|
|
44
35
|
fromAddress: this.fromAddress,
|
|
45
36
|
toAddress: this.toAddress
|
|
46
37
|
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return new CosmosSendMessage(json.fromAddress, json.toAddress, json.amount.map(
|
|
50
|
-
}
|
|
51
|
-
|
|
38
|
+
}
|
|
39
|
+
static fromJSON(json) {
|
|
40
|
+
return new CosmosSendMessage(json.fromAddress, json.toAddress, json.amount.map((value) => CosmosCoin_1.CosmosCoin.fromJSON(value)));
|
|
41
|
+
}
|
|
42
|
+
toRPCBody() {
|
|
52
43
|
return {
|
|
53
44
|
type: this.type.value,
|
|
54
45
|
value: {
|
|
55
|
-
amount: this.amount.map(
|
|
46
|
+
amount: this.amount.map((value) => value.toRPCBody()),
|
|
56
47
|
from_address: this.fromAddress,
|
|
57
48
|
to_address: this.toAddress
|
|
58
49
|
}
|
|
59
50
|
};
|
|
60
|
-
}
|
|
61
|
-
|
|
51
|
+
}
|
|
52
|
+
toAirGapTransaction(identifier, network, fee) {
|
|
62
53
|
return {
|
|
63
54
|
amount: this.amount
|
|
64
|
-
.map(
|
|
65
|
-
.reduce(
|
|
55
|
+
.map((value) => new bignumber_1.default(value.amount))
|
|
56
|
+
.reduce((prev, next) => prev.plus(next))
|
|
66
57
|
.toString(10),
|
|
67
58
|
to: [this.toAddress],
|
|
68
59
|
from: [this.fromAddress],
|
|
69
60
|
isInbound: false,
|
|
70
|
-
fee
|
|
61
|
+
fee,
|
|
71
62
|
protocolIdentifier: identifier,
|
|
72
|
-
network
|
|
63
|
+
network,
|
|
73
64
|
transactionDetails: this.toRPCBody(),
|
|
74
65
|
extra: {
|
|
75
66
|
type: IAirGapTransaction_1.AirGapTransactionType.SPEND
|
|
76
67
|
}
|
|
77
68
|
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return new CosmosSendMessage(json.value.from_address, json.value.to_address, json.value.amount.map(
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}());
|
|
69
|
+
}
|
|
70
|
+
static fromRPCBody(json) {
|
|
71
|
+
return new CosmosSendMessage(json.value.from_address, json.value.to_address, json.value.amount.map((value) => CosmosCoin_1.CosmosCoin.fromRPCBody(value)));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
84
74
|
exports.CosmosSendMessage = CosmosSendMessage;
|
|
85
75
|
//# sourceMappingURL=CosmosSendMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosSendMessage.js","sourceRoot":"","sources":["../../../../src/v0/protocol/cosmos-message/CosmosSendMessage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CosmosSendMessage.js","sourceRoot":"","sources":["../../../../src/v0/protocol/cosmos-message/CosmosSendMessage.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CosmosWithdrawDelegationRewardMessage = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const CosmosMessage_1 = require("./CosmosMessage");
|
|
5
|
+
class CosmosWithdrawDelegationRewardMessage {
|
|
6
|
+
constructor(delegatorAddress, validatorAddress) {
|
|
7
7
|
this.type = CosmosMessage_1.CosmosMessageType.WithdrawDelegationReward;
|
|
8
8
|
this.delegatorAddress = delegatorAddress;
|
|
9
9
|
this.validatorAddress = validatorAddress;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
toEncodeObject() {
|
|
12
12
|
return {
|
|
13
13
|
typeUrl: this.type.value,
|
|
14
14
|
value: {
|
|
@@ -16,34 +16,34 @@ var CosmosWithdrawDelegationRewardMessage = /** @class */ (function () {
|
|
|
16
16
|
validatorAddress: this.validatorAddress
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
}
|
|
20
|
-
|
|
19
|
+
}
|
|
20
|
+
static fromEncodeObject(encodeObject) {
|
|
21
21
|
return new CosmosWithdrawDelegationRewardMessage(encodeObject.value.delegatorAddress, encodeObject.value.validatorAddress);
|
|
22
|
-
}
|
|
23
|
-
|
|
22
|
+
}
|
|
23
|
+
toAirGapTransaction(identifier, network, fee) {
|
|
24
24
|
return {
|
|
25
25
|
from: [this.delegatorAddress],
|
|
26
26
|
to: [this.validatorAddress],
|
|
27
27
|
amount: '0',
|
|
28
28
|
isInbound: false,
|
|
29
|
-
fee
|
|
29
|
+
fee,
|
|
30
30
|
protocolIdentifier: identifier,
|
|
31
|
-
network
|
|
31
|
+
network,
|
|
32
32
|
transactionDetails: 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/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.ts"],"names":[],"mappings":";;;AAKA,
|
|
1
|
+
{"version":3,"file":"CosmosWithdrawDelegationRewardMessage.js","sourceRoot":"","sources":["../../../../src/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.ts"],"names":[],"mappings":";;;AAKA,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,mBAAmB,CAAC,UAA2B,EAAE,OAA8B,EAAE,GAAW;QACjG,OAAO;YACL,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC;YAC7B,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC;YAC3B,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,KAAK;YAChB,GAAG;YACH,kBAAkB,EAAE,UAAU;YAC9B,OAAO;YACP,kBAAkB,EAAE,IAAI,CAAC,SAAS,EAAE;SACrC,CAAA;IACH,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACrB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;YACnC,WAAW,EAAE,IAAI,CAAC,gBAAgB;YAClC,SAAS,EAAE,IAAI,CAAC,gBAAgB;SACjC,CAAA;IACH,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,IAAuB;QAC5C,OAAO,IAAI,qCAAqC,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IACpF,CAAC;IAEM,SAAS;QACd,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;YACrB,KAAK,EAAE;gBACL,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;gBACxC,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;aACzC;SACF,CAAA;IACH,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,IAAS;QACjC,OAAO,IAAI,qCAAqC,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAC9G,CAAC;CACF;AA/DD,sFA+DC"}
|
|
@@ -2,45 +2,9 @@
|
|
|
2
2
|
// tslint:disable: max-classes-per-file
|
|
3
3
|
// import { async } from '../../dependencies/src/validate.js-0.13.1/validate'
|
|
4
4
|
// import { RawTezosTransaction } from '../types'
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
15
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
16
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
17
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
18
|
-
function step(op) {
|
|
19
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
20
|
-
while (_) try {
|
|
21
|
-
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;
|
|
22
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
23
|
-
switch (op[0]) {
|
|
24
|
-
case 0: case 1: t = op; break;
|
|
25
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
26
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
27
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
28
|
-
default:
|
|
29
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
30
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
31
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
32
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
33
|
-
if (t[2]) _.ops.pop();
|
|
34
|
-
_.trys.pop(); continue;
|
|
35
|
-
}
|
|
36
|
-
op = body.call(thisArg, _);
|
|
37
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
38
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
6
|
exports.CosmosTransactionValidatorFactoryV2 = exports.CosmosTransactionValidatorFactory = exports.CosmosTransactionValidator = void 0;
|
|
43
|
-
|
|
7
|
+
const serializer_1 = require("@airgap/serializer");
|
|
44
8
|
// const unsignedTransactionConstraints = {
|
|
45
9
|
// binaryTransaction: {
|
|
46
10
|
// isValidTezosUnsignedTransaction: true,
|
|
@@ -62,51 +26,35 @@ var serializer_1 = require("@airgap/serializer");
|
|
|
62
26
|
// }
|
|
63
27
|
// }
|
|
64
28
|
// TODO implement this
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (version === void 0) { version = 'v3'; }
|
|
29
|
+
class CosmosTransactionValidator {
|
|
30
|
+
constructor(version = 'v3') {
|
|
68
31
|
this.version = version;
|
|
69
32
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
return [2 /*return*/, undefined]; // async(rawTx, unsignedTransactionConstraints).then(success, error)
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
CosmosTransactionValidator.prototype.validateSignedTransaction = function (signedTx) {
|
|
85
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
return __generator(this, function (_a) {
|
|
87
|
-
return [2 /*return*/, undefined]; // async(signedTx, signedTransactionConstraints).then(success, error)
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
return CosmosTransactionValidator;
|
|
92
|
-
}());
|
|
93
|
-
exports.CosmosTransactionValidator = CosmosTransactionValidator;
|
|
94
|
-
var CosmosTransactionValidatorFactory = /** @class */ (function () {
|
|
95
|
-
function CosmosTransactionValidatorFactory() {
|
|
33
|
+
async validateUnsignedTransaction(unsignedTx) {
|
|
34
|
+
// const rawTx: RawTezosTransaction = unsignedTx.transaction
|
|
35
|
+
if (this.version === 'v3') {
|
|
36
|
+
(0, serializer_1.validateSyncScheme)({});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
(0, serializer_1.validateSyncSchemeV2)({});
|
|
40
|
+
}
|
|
41
|
+
return undefined; // async(rawTx, unsignedTransactionConstraints).then(success, error)
|
|
96
42
|
}
|
|
97
|
-
|
|
43
|
+
async validateSignedTransaction(signedTx) {
|
|
44
|
+
return undefined; // async(signedTx, signedTransactionConstraints).then(success, error)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.CosmosTransactionValidator = CosmosTransactionValidator;
|
|
48
|
+
class CosmosTransactionValidatorFactory {
|
|
49
|
+
create() {
|
|
98
50
|
return new CosmosTransactionValidator('v3');
|
|
99
|
-
};
|
|
100
|
-
return CosmosTransactionValidatorFactory;
|
|
101
|
-
}());
|
|
102
|
-
exports.CosmosTransactionValidatorFactory = CosmosTransactionValidatorFactory;
|
|
103
|
-
var CosmosTransactionValidatorFactoryV2 = /** @class */ (function () {
|
|
104
|
-
function CosmosTransactionValidatorFactoryV2() {
|
|
105
51
|
}
|
|
106
|
-
|
|
52
|
+
}
|
|
53
|
+
exports.CosmosTransactionValidatorFactory = CosmosTransactionValidatorFactory;
|
|
54
|
+
class CosmosTransactionValidatorFactoryV2 {
|
|
55
|
+
create() {
|
|
107
56
|
return new CosmosTransactionValidator('v2');
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
111
59
|
exports.CosmosTransactionValidatorFactoryV2 = CosmosTransactionValidatorFactoryV2;
|
|
112
60
|
//# sourceMappingURL=transaction-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../src/v0/serializer/validators/transaction-validator.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,6EAA6E;AAC7E,iDAAiD
|
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../src/v0/serializer/validators/transaction-validator.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,6EAA6E;AAC7E,iDAAiD;;;AAEjD,mDAO2B;AAK3B,2CAA2C;AAC3C,yBAAyB;AACzB,6CAA6C;AAC7C,uCAAuC;AACvC,qBAAqB;AACrB,MAAM;AACN,IAAI;AACJ,kCAAkC;AAClC,iCAAiC;AAEjC,yCAAyC;AACzC,mBAAmB;AACnB,2CAA2C;AAC3C,uCAAuC;AACvC,qBAAqB;AACrB,OAAO;AACP,yBAAyB;AACzB,uCAAuC;AACvC,qBAAqB;AACrB,MAAM;AACN,IAAI;AAEJ,sBAAsB;AACtB,MAAa,0BAA0B;IACrC,YAA6B,UAAuB,IAAI;QAA3B,YAAO,GAAP,OAAO,CAAoB;IAAG,CAAC;IAErD,KAAK,CAAC,2BAA2B,CAAC,UAAqC;QAC5E,4DAA4D;QAC5D,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YAC1B,IAAA,+BAAkB,EAAC,EAAE,CAAC,CAAA;QACxB,CAAC;aAAM,CAAC;YACN,IAAA,iCAAoB,EAAC,EAAE,CAAC,CAAA;QAC1B,CAAC;QAED,OAAO,SAAS,CAAA,CAAC,oEAAoE;IACvF,CAAC;IACM,KAAK,CAAC,yBAAyB,CAAC,QAAiC;QACtE,OAAO,SAAS,CAAA,CAAC,qEAAqE;IACxF,CAAC;CACF;AAhBD,gEAgBC;AAED,MAAa,iCAAiC;IACrC,MAAM;QACX,OAAO,IAAI,0BAA0B,CAAC,IAAI,CAAC,CAAA;IAC7C,CAAC;CACF;AAJD,8EAIC;AAED,MAAa,mCAAmC;IACvC,MAAM;QACX,OAAO,IAAI,0BAA0B,CAAC,IAAI,CAAC,CAAA;IAC7C,CAAC;CACF;AAJD,kFAIC"}
|
|
@@ -1,72 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.MintscanBlockExplorer = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
4
|
+
class MintscanBlockExplorer {
|
|
5
|
+
constructor(url) {
|
|
42
6
|
this.url = url;
|
|
43
7
|
this.metadata = {
|
|
44
8
|
name: 'Mintscan',
|
|
45
9
|
url: this.url
|
|
46
10
|
};
|
|
47
11
|
}
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return [2 /*return*/, "".concat(this.url, "/cosmos/account/").concat(address)];
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
MintscanBlockExplorer.prototype.createTransactionUrl = function (transactionId) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
-
return __generator(this, function (_a) {
|
|
65
|
-
return [2 /*return*/, "".concat(this.url, "/cosmos/txs/").concat(transactionId)];
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
return MintscanBlockExplorer;
|
|
70
|
-
}());
|
|
12
|
+
async getMetadata() {
|
|
13
|
+
return this.metadata;
|
|
14
|
+
}
|
|
15
|
+
async createAddressUrl(address) {
|
|
16
|
+
return `${this.url}/cosmos/account/${address}`;
|
|
17
|
+
}
|
|
18
|
+
async createTransactionUrl(transactionId) {
|
|
19
|
+
return `${this.url}/cosmos/txs/${transactionId}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
71
22
|
exports.MintscanBlockExplorer = MintscanBlockExplorer;
|
|
72
23
|
//# sourceMappingURL=MintscanBlockExplorer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MintscanBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/MintscanBlockExplorer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MintscanBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/MintscanBlockExplorer.ts"],"names":[],"mappings":";;;AAEA,MAAa,qBAAqB;IAMhC,YAAoC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAL9B,aAAQ,GAA0B;YACjD,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IAEiD,CAAC;IAE5C,KAAK,CAAC,WAAW;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,OAAe;QAC3C,OAAO,GAAG,IAAI,CAAC,GAAG,mBAAmB,OAAO,EAAE,CAAA;IAChD,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,aAAqB;QACrD,OAAO,GAAG,IAAI,CAAC,GAAG,eAAe,aAAa,EAAE,CAAA;IAClD,CAAC;CACF;AAnBD,sDAmBC"}
|
package/v1/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MintscanBlockExplorer = exports.createCosmosProtocolOptions = exports.createCosmosProtocol = exports.CosmosModule = void 0;
|
|
4
|
-
|
|
4
|
+
const MintscanBlockExplorer_1 = require("./block-explorer/MintscanBlockExplorer");
|
|
5
5
|
Object.defineProperty(exports, "MintscanBlockExplorer", { enumerable: true, get: function () { return MintscanBlockExplorer_1.MintscanBlockExplorer; } });
|
|
6
|
-
|
|
6
|
+
const CosmosModule_1 = require("./module/CosmosModule");
|
|
7
7
|
Object.defineProperty(exports, "CosmosModule", { enumerable: true, get: function () { return CosmosModule_1.CosmosModule; } });
|
|
8
|
-
|
|
8
|
+
const CosmosProtocol_1 = require("./protocol/CosmosProtocol");
|
|
9
9
|
Object.defineProperty(exports, "createCosmosProtocol", { enumerable: true, get: function () { return CosmosProtocol_1.createCosmosProtocol; } });
|
|
10
10
|
Object.defineProperty(exports, "createCosmosProtocolOptions", { enumerable: true, get: function () { return CosmosProtocol_1.createCosmosProtocolOptions; } });
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,kFAA8E;AAcrE,sGAdA,6CAAqB,OAcA;AAb9B,wDAAoD;AAK3C,6FALA,2BAAY,OAKA;AAJrB,8DAA0H;AAQjG,qGARa,qCAAoB,OAQb;AAAE,4GARa,4CAA2B,OAQb"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MainProtocolSymbols } from '@airgap/coinlib-core';
|
|
2
2
|
import { CosmosProtocolNetwork } from '@airgap/cosmos-core';
|
|
3
3
|
import { AirGapBlockExplorer, AirGapModule, AirGapOfflineProtocol, AirGapOnlineProtocol, AirGapV3SerializerCompanion, ProtocolConfiguration } from '@airgap/module-kit';
|
|
4
|
-
|
|
4
|
+
type SupportedProtocols = MainProtocolSymbols.COSMOS;
|
|
5
5
|
export declare class CosmosModule implements AirGapModule<{
|
|
6
6
|
Protocols: SupportedProtocols;
|
|
7
7
|
ProtocolNetwork: CosmosProtocolNetwork;
|