@airgap/cosmos 0.13.11-beta.1 → 0.13.11-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/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +1 -5
- package/v0/index.d.ts +10 -0
- package/v0/index.js +32 -0
- package/v0/index.js.map +1 -0
- package/v0/protocol/CosmosAddress.d.ts +8 -0
- package/v0/protocol/CosmosAddress.js +28 -0
- package/v0/protocol/CosmosAddress.js.map +1 -0
- package/v0/protocol/CosmosCoin.d.ts +19 -0
- package/v0/protocol/CosmosCoin.js +55 -0
- package/v0/protocol/CosmosCoin.js.map +1 -0
- package/v0/protocol/CosmosCryptoClient.d.ts +8 -0
- package/v0/protocol/CosmosCryptoClient.js +90 -0
- package/v0/protocol/CosmosCryptoClient.js.map +1 -0
- package/v0/protocol/CosmosFee.d.ts +15 -0
- package/v0/protocol/CosmosFee.js +31 -0
- package/v0/protocol/CosmosFee.js.map +1 -0
- package/v0/protocol/CosmosNodeClient.d.ts +25 -0
- package/v0/protocol/CosmosNodeClient.js +382 -0
- package/v0/protocol/CosmosNodeClient.js.map +1 -0
- package/v0/protocol/CosmosProtocol.d.ts +124 -0
- package/v0/protocol/CosmosProtocol.js +1155 -0
- package/v0/protocol/CosmosProtocol.js.map +1 -0
- package/v0/protocol/CosmosProtocolOptions.d.ts +22 -0
- package/v0/protocol/CosmosProtocolOptions.js +116 -0
- package/v0/protocol/CosmosProtocolOptions.js.map +1 -0
- package/v0/protocol/CosmosTransaction.d.ts +37 -0
- package/v0/protocol/CosmosTransaction.js +106 -0
- package/v0/protocol/CosmosTransaction.js.map +1 -0
- package/v0/protocol/CosmosTypes.d.ts +310 -0
- package/v0/protocol/CosmosTypes.js +8 -0
- package/v0/protocol/CosmosTypes.js.map +1 -0
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.d.ts +20 -0
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.js +72 -0
- package/v0/protocol/cosmos-message/CosmosDelegateMessage.js.map +1 -0
- package/v0/protocol/cosmos-message/CosmosMessage.d.ts +39 -0
- package/v0/protocol/cosmos-message/CosmosMessage.js +47 -0
- package/v0/protocol/cosmos-message/CosmosMessage.js.map +1 -0
- package/v0/protocol/cosmos-message/CosmosSendMessage.d.ts +20 -0
- package/v0/protocol/cosmos-message/CosmosSendMessage.js +85 -0
- package/v0/protocol/cosmos-message/CosmosSendMessage.js.map +1 -0
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.d.ts +24 -0
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js +61 -0
- package/v0/protocol/cosmos-message/CosmosWithdrawDelegationRewardMessage.js.map +1 -0
- package/v0/serializer/schemas/v2/transaction-sign-request-cosmos.json +100 -0
- package/v0/serializer/schemas/v2/transaction-sign-response-cosmos.json +22 -0
- package/v0/serializer/schemas/v3/transaction-sign-request-cosmos.json +100 -0
- package/v0/serializer/schemas/v3/transaction-sign-response-cosmos.json +23 -0
- package/v0/serializer/validators/transaction-validator.d.ts +15 -0
- package/v0/serializer/validators/transaction-validator.js +112 -0
- package/v0/serializer/validators/transaction-validator.js.map +1 -0
- package/v0/types/signed-transaction-cosmos.d.ts +5 -0
- package/v0/types/signed-transaction-cosmos.js +3 -0
- package/v0/types/signed-transaction-cosmos.js.map +1 -0
- package/v0/types/transaction-cosmos.d.ts +5 -0
- package/v0/types/transaction-cosmos.js +3 -0
- package/v0/types/transaction-cosmos.js.map +1 -0
- package/v0/types/unsigned-transaction-cosmos.d.ts +33 -0
- package/v0/types/unsigned-transaction-cosmos.js +10 -0
- package/v0/types/unsigned-transaction-cosmos.js.map +1 -0
- package/v1/block-explorer/MintscanBlockExplorer.d.ts +9 -0
- package/v1/block-explorer/MintscanBlockExplorer.js +74 -0
- package/v1/block-explorer/MintscanBlockExplorer.js.map +1 -0
- package/v1/data/CosmosAddress.d.ts +7 -0
- package/v1/data/CosmosAddress.js +29 -0
- package/v1/data/CosmosAddress.js.map +1 -0
- package/v1/data/CosmosCoin.d.ts +19 -0
- package/v1/data/CosmosCoin.js +55 -0
- package/v1/data/CosmosCoin.js.map +1 -0
- package/v1/data/CosmosFee.d.ts +15 -0
- package/v1/data/CosmosFee.js +31 -0
- package/v1/data/CosmosFee.js.map +1 -0
- package/v1/data/transaction/CosmosTransaction.d.ts +36 -0
- package/v1/data/transaction/CosmosTransaction.js +109 -0
- package/v1/data/transaction/CosmosTransaction.js.map +1 -0
- package/v1/data/transaction/message/CosmosDelegateMessage.d.ts +19 -0
- package/v1/data/transaction/message/CosmosDelegateMessage.js +70 -0
- package/v1/data/transaction/message/CosmosDelegateMessage.js.map +1 -0
- package/v1/data/transaction/message/CosmosMessage.d.ts +38 -0
- package/v1/data/transaction/message/CosmosMessage.js +47 -0
- package/v1/data/transaction/message/CosmosMessage.js.map +1 -0
- package/v1/data/transaction/message/CosmosSendMessage.d.ts +19 -0
- package/v1/data/transaction/message/CosmosSendMessage.js +83 -0
- package/v1/data/transaction/message/CosmosSendMessage.js.map +1 -0
- package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.d.ts +23 -0
- package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js +61 -0
- package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js.map +1 -0
- package/v1/index.d.ts +10 -0
- package/v1/index.js +11 -0
- package/v1/index.js.map +1 -0
- package/v1/module/CosmosModule.d.ts +15 -0
- package/v1/module/CosmosModule.js +107 -0
- package/v1/module/CosmosModule.js.map +1 -0
- package/v1/module.d.ts +3 -0
- package/v1/module.js +24 -0
- package/v1/module.js.map +1 -0
- package/v1/node/CosmosNodeClient.d.ts +28 -0
- package/v1/node/CosmosNodeClient.js +381 -0
- package/v1/node/CosmosNodeClient.js.map +1 -0
- package/v1/protocol/CosmosCryptoClient.d.ts +8 -0
- package/v1/protocol/CosmosCryptoClient.js +90 -0
- package/v1/protocol/CosmosCryptoClient.js.map +1 -0
- package/v1/protocol/CosmosProtocol.d.ts +53 -0
- package/v1/protocol/CosmosProtocol.js +651 -0
- package/v1/protocol/CosmosProtocol.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +7 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +37 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.d.ts +4 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-cosmos.json +100 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-cosmos.json +19 -0
- package/v1/serializer/v3/serializer-companion.d.ts +12 -0
- package/v1/serializer/v3/serializer-companion.js +142 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validators.d.ts +7 -0
- package/v1/serializer/v3/validators/transaction-validators.js +88 -0
- package/v1/serializer/v3/validators/transaction-validators.js.map +1 -0
- package/v1/types/crypto.d.ts +2 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/protocol.d.ts +8 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/rpc.d.ts +286 -0
- package/v1/types/rpc.js +3 -0
- package/v1/types/rpc.js.map +1 -0
- package/v1/types/transaction.d.ts +44 -0
- package/v1/types/transaction.js +10 -0
- package/v1/types/transaction.js.map +1 -0
- package/v1/utils/key.d.ts +3 -0
- package/v1/utils/key.js +20 -0
- package/v1/utils/key.js.map +1 -0
- package/v1/utils/signature.d.ts +2 -0
- package/v1/utils/signature.js +13 -0
- package/v1/utils/signature.js.map +1 -0
- package/v1/utils/transaction.d.ts +1 -0
- package/v1/utils/transaction.js +8 -0
- package/v1/utils/transaction.js.map +1 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/SignedCosmosTransaction",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"IAirGapSignedTransaction": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"SignedCosmosTransaction": {
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"accountIdentifier": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"transaction": {
|
|
15
|
+
"$ref": "#/definitions/IAirGapSignedTransaction",
|
|
16
|
+
"type": "string"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"required": ["accountIdentifier", "transaction"],
|
|
20
|
+
"type": "object"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TransactionValidator, TransactionValidatorFactory, TransactionValidatorFactoryV2, TransactionValidatorV2 } from '@airgap/serializer';
|
|
2
|
+
import { SignedCosmosTransaction } from '../../types/signed-transaction-cosmos';
|
|
3
|
+
import { UnsignedCosmosTransaction } from '../../types/transaction-cosmos';
|
|
4
|
+
export declare class CosmosTransactionValidator implements TransactionValidator, TransactionValidatorV2 {
|
|
5
|
+
private readonly version;
|
|
6
|
+
constructor(version?: 'v2' | 'v3');
|
|
7
|
+
validateUnsignedTransaction(unsignedTx: UnsignedCosmosTransaction): Promise<any>;
|
|
8
|
+
validateSignedTransaction(signedTx: SignedCosmosTransaction): Promise<any>;
|
|
9
|
+
}
|
|
10
|
+
export declare class CosmosTransactionValidatorFactory implements TransactionValidatorFactory<CosmosTransactionValidator> {
|
|
11
|
+
create(): CosmosTransactionValidator;
|
|
12
|
+
}
|
|
13
|
+
export declare class CosmosTransactionValidatorFactoryV2 implements TransactionValidatorFactoryV2<CosmosTransactionValidator> {
|
|
14
|
+
create(): CosmosTransactionValidator;
|
|
15
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// tslint:disable: max-classes-per-file
|
|
3
|
+
// import { async } from '../../dependencies/src/validate.js-0.13.1/validate'
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.CosmosTransactionValidatorFactoryV2 = exports.CosmosTransactionValidatorFactory = exports.CosmosTransactionValidator = void 0;
|
|
43
|
+
var serializer_1 = require("@airgap/serializer");
|
|
44
|
+
// const unsignedTransactionConstraints = {
|
|
45
|
+
// binaryTransaction: {
|
|
46
|
+
// isValidTezosUnsignedTransaction: true,
|
|
47
|
+
// presence: { allowEmpty: false },
|
|
48
|
+
// type: 'String'
|
|
49
|
+
// }
|
|
50
|
+
// }
|
|
51
|
+
// const success = () => undefined
|
|
52
|
+
// const error = errors => errors
|
|
53
|
+
// const signedTransactionConstraints = {
|
|
54
|
+
// transaction: {
|
|
55
|
+
// isValidTezosSignedTransaction: true,
|
|
56
|
+
// presence: { allowEmpty: false },
|
|
57
|
+
// type: 'String'
|
|
58
|
+
// },
|
|
59
|
+
// accountIdentifier: {
|
|
60
|
+
// presence: { allowEmpty: false },
|
|
61
|
+
// type: 'String'
|
|
62
|
+
// }
|
|
63
|
+
// }
|
|
64
|
+
// TODO implement this
|
|
65
|
+
var CosmosTransactionValidator = /** @class */ (function () {
|
|
66
|
+
function CosmosTransactionValidator(version) {
|
|
67
|
+
if (version === void 0) { version = 'v3'; }
|
|
68
|
+
this.version = version;
|
|
69
|
+
}
|
|
70
|
+
CosmosTransactionValidator.prototype.validateUnsignedTransaction = function (unsignedTx) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
// const rawTx: RawTezosTransaction = unsignedTx.transaction
|
|
74
|
+
if (this.version === 'v3') {
|
|
75
|
+
(0, serializer_1.validateSyncScheme)({});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
(0, serializer_1.validateSyncSchemeV2)({});
|
|
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() {
|
|
96
|
+
}
|
|
97
|
+
CosmosTransactionValidatorFactory.prototype.create = function () {
|
|
98
|
+
return new CosmosTransactionValidator('v3');
|
|
99
|
+
};
|
|
100
|
+
return CosmosTransactionValidatorFactory;
|
|
101
|
+
}());
|
|
102
|
+
exports.CosmosTransactionValidatorFactory = CosmosTransactionValidatorFactory;
|
|
103
|
+
var CosmosTransactionValidatorFactoryV2 = /** @class */ (function () {
|
|
104
|
+
function CosmosTransactionValidatorFactoryV2() {
|
|
105
|
+
}
|
|
106
|
+
CosmosTransactionValidatorFactoryV2.prototype.create = function () {
|
|
107
|
+
return new CosmosTransactionValidator('v2');
|
|
108
|
+
};
|
|
109
|
+
return CosmosTransactionValidatorFactoryV2;
|
|
110
|
+
}());
|
|
111
|
+
exports.CosmosTransactionValidatorFactoryV2 = CosmosTransactionValidatorFactoryV2;
|
|
112
|
+
//# sourceMappingURL=transaction-validator.js.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjD,iDAO2B;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;IACE,oCAA6B,OAA2B;QAA3B,wBAAA,EAAA,cAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;IAAG,CAAC;IAE/C,gEAA2B,GAAxC,UAAyC,UAAqC;;;gBAC5E,4DAA4D;gBAC5D,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE;oBACzB,IAAA,+BAAkB,EAAC,EAAE,CAAC,CAAA;iBACvB;qBAAM;oBACL,IAAA,iCAAoB,EAAC,EAAE,CAAC,CAAA;iBACzB;gBAED,sBAAO,SAAS,EAAA,CAAC,oEAAoE;;;KACtF;IACY,8DAAyB,GAAtC,UAAuC,QAAiC;;;gBACtE,sBAAO,SAAS,EAAA,CAAC,qEAAqE;;;KACvF;IACH,iCAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,gEAA0B;AAkBvC;IAAA;IAIA,CAAC;IAHQ,kDAAM,GAAb;QACE,OAAO,IAAI,0BAA0B,CAAC,IAAI,CAAC,CAAA;IAC7C,CAAC;IACH,wCAAC;AAAD,CAAC,AAJD,IAIC;AAJY,8EAAiC;AAM9C;IAAA;IAIA,CAAC;IAHQ,oDAAM,GAAb;QACE,OAAO,IAAI,0BAA0B,CAAC,IAAI,CAAC,CAAA;IAC7C,CAAC;IACH,0CAAC;AAAD,CAAC,AAJD,IAIC;AAJY,kFAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signed-transaction-cosmos.js","sourceRoot":"","sources":["../../../src/v0/types/signed-transaction-cosmos.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction-cosmos.js","sourceRoot":"","sources":["../../../src/v0/types/transaction-cosmos.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TransactionSignRequest, TransactionSignRequestV2 } from '@airgap/serializer';
|
|
2
|
+
interface CosmosCoin {
|
|
3
|
+
denom: string;
|
|
4
|
+
amount: string;
|
|
5
|
+
}
|
|
6
|
+
interface CosmosFee {
|
|
7
|
+
amount: CosmosCoin[];
|
|
8
|
+
gas: string;
|
|
9
|
+
}
|
|
10
|
+
declare enum CosmosMessageTypeIndex {
|
|
11
|
+
SEND = 0,
|
|
12
|
+
DELEGATE = 1,
|
|
13
|
+
UNDELEGATE = 2,
|
|
14
|
+
WITHDRAW_DELEGATION_REWARD = 3
|
|
15
|
+
}
|
|
16
|
+
interface CosmosMessage {
|
|
17
|
+
type: CosmosMessageTypeIndex;
|
|
18
|
+
amount: CosmosCoin[];
|
|
19
|
+
fromAddress: string;
|
|
20
|
+
toAddress: string;
|
|
21
|
+
}
|
|
22
|
+
interface CosmosTransaction {
|
|
23
|
+
messages: CosmosMessage[];
|
|
24
|
+
fee: CosmosFee;
|
|
25
|
+
memo: string;
|
|
26
|
+
chainID: string;
|
|
27
|
+
accountNumber: string;
|
|
28
|
+
sequence: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SerializableUnsignedCosmosTransaction extends TransactionSignRequest, TransactionSignRequestV2 {
|
|
31
|
+
transaction: CosmosTransaction;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var CosmosMessageTypeIndex;
|
|
4
|
+
(function (CosmosMessageTypeIndex) {
|
|
5
|
+
CosmosMessageTypeIndex[CosmosMessageTypeIndex["SEND"] = 0] = "SEND";
|
|
6
|
+
CosmosMessageTypeIndex[CosmosMessageTypeIndex["DELEGATE"] = 1] = "DELEGATE";
|
|
7
|
+
CosmosMessageTypeIndex[CosmosMessageTypeIndex["UNDELEGATE"] = 2] = "UNDELEGATE";
|
|
8
|
+
CosmosMessageTypeIndex[CosmosMessageTypeIndex["WITHDRAW_DELEGATION_REWARD"] = 3] = "WITHDRAW_DELEGATION_REWARD";
|
|
9
|
+
})(CosmosMessageTypeIndex || (CosmosMessageTypeIndex = {}));
|
|
10
|
+
//# sourceMappingURL=unsigned-transaction-cosmos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsigned-transaction-cosmos.js","sourceRoot":"","sources":["../../../src/v0/types/unsigned-transaction-cosmos.ts"],"names":[],"mappings":";;AAYA,IAAK,sBAKJ;AALD,WAAK,sBAAsB;IACzB,mEAAQ,CAAA;IACR,2EAAY,CAAA;IACZ,+EAAc,CAAA;IACd,+GAA8B,CAAA;AAChC,CAAC,EALI,sBAAsB,KAAtB,sBAAsB,QAK1B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AirGapBlockExplorer, BlockExplorerMetadata } from '@airgap/module-kit';
|
|
2
|
+
export declare class MintscanBlockExplorer implements AirGapBlockExplorer {
|
|
3
|
+
private readonly url;
|
|
4
|
+
private readonly metadata;
|
|
5
|
+
constructor(url?: string);
|
|
6
|
+
getMetadata(): Promise<BlockExplorerMetadata>;
|
|
7
|
+
createAddressUrl(address: string): Promise<string>;
|
|
8
|
+
createTransactionUrl(transactionId: string): Promise<string>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
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.MintscanBlockExplorer = void 0;
|
|
40
|
+
var BLOCK_EXPLORER_URL = 'https://www.mintscan.io';
|
|
41
|
+
var MintscanBlockExplorer = /** @class */ (function () {
|
|
42
|
+
function MintscanBlockExplorer(url) {
|
|
43
|
+
if (url === void 0) { url = BLOCK_EXPLORER_URL; }
|
|
44
|
+
this.url = url;
|
|
45
|
+
this.metadata = {
|
|
46
|
+
name: 'Mintscan',
|
|
47
|
+
url: this.url
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
MintscanBlockExplorer.prototype.getMetadata = function () {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
return [2 /*return*/, this.metadata];
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
MintscanBlockExplorer.prototype.createAddressUrl = function (address) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
return [2 /*return*/, "".concat(this.url, "/cosmos/account/").concat(address)];
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
MintscanBlockExplorer.prototype.createTransactionUrl = function (transactionId) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
return [2 /*return*/, "".concat(this.url, "/cosmos/txs/").concat(transactionId)];
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
return MintscanBlockExplorer;
|
|
72
|
+
}());
|
|
73
|
+
exports.MintscanBlockExplorer = MintscanBlockExplorer;
|
|
74
|
+
//# sourceMappingURL=MintscanBlockExplorer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MintscanBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/MintscanBlockExplorer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,kBAAkB,GAAW,yBAAyB,CAAA;AAE5D;IAME,+BAAoC,GAAgC;QAAhC,oBAAA,EAAA,wBAAgC;QAAhC,QAAG,GAAH,GAAG,CAA6B;QALnD,aAAQ,GAA0B;YACjD,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IAEsE,CAAC;IAE3D,2CAAW,GAAxB;;;gBACE,sBAAO,IAAI,CAAC,QAAQ,EAAA;;;KACrB;IAEY,gDAAgB,GAA7B,UAA8B,OAAe;;;gBAC3C,sBAAO,UAAG,IAAI,CAAC,GAAG,6BAAmB,OAAO,CAAE,EAAA;;;KAC/C;IAEY,oDAAoB,GAAjC,UAAkC,aAAqB;;;gBACrD,sBAAO,UAAG,IAAI,CAAC,GAAG,yBAAe,aAAa,CAAE,EAAA;;;KACjD;IACH,4BAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,sDAAqB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CosmosAddress = void 0;
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
var BECH32 = require("@airgap/coinlib-core/dependencies/src/bech32-1.1.3/index");
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
var RIPEMD160 = require("@airgap/coinlib-core/dependencies/src/ripemd160-2.0.2/index");
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
var sha = require("@airgap/coinlib-core/dependencies/src/sha.js-2.4.11/index");
|
|
10
|
+
var key_1 = require("../utils/key");
|
|
11
|
+
var ADDRESS_PREFIX = 'cosmos';
|
|
12
|
+
var CosmosAddress = /** @class */ (function () {
|
|
13
|
+
function CosmosAddress(value) {
|
|
14
|
+
this.value = value;
|
|
15
|
+
}
|
|
16
|
+
CosmosAddress.from = function (publicKey) {
|
|
17
|
+
var hexPublicKey = (0, key_1.convertPublicKey)(publicKey, 'hex');
|
|
18
|
+
var sha256Hash = sha('sha256').update(Buffer.from(hexPublicKey.value, 'hex')).digest();
|
|
19
|
+
var hash = new RIPEMD160().update(Buffer.from(sha256Hash)).digest();
|
|
20
|
+
var address = BECH32.encode(ADDRESS_PREFIX, BECH32.toWords(hash));
|
|
21
|
+
return new CosmosAddress(address);
|
|
22
|
+
};
|
|
23
|
+
CosmosAddress.prototype.asString = function () {
|
|
24
|
+
return this.value;
|
|
25
|
+
};
|
|
26
|
+
return CosmosAddress;
|
|
27
|
+
}());
|
|
28
|
+
exports.CosmosAddress = CosmosAddress;
|
|
29
|
+
//# sourceMappingURL=CosmosAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CosmosAddress.js","sourceRoot":"","sources":["../../../src/v1/data/CosmosAddress.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,iFAAmF;AACnF,aAAa;AACb,uFAAyF;AACzF,aAAa;AACb,+EAAiF;AAGjF,oCAA+C;AAE/C,IAAM,cAAc,GAAW,QAAQ,CAAA;AAEvC;IACE,uBAAqC,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAExC,kBAAI,GAAlB,UAAmB,SAAoB;QACrC,IAAM,YAAY,GAAc,IAAA,sBAAgB,EAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QAElE,IAAM,UAAU,GAAW,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;QAChG,IAAM,IAAI,GAAG,IAAI,SAAS,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;QACrE,IAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;QAEnE,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAA;IACnC,CAAC;IAEM,gCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IACH,oBAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,sCAAa"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import BigNumber from '@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
|
|
2
|
+
import { JSONConvertible } from '@airgap/coinlib-core/interfaces/JSONConvertible';
|
|
3
|
+
import { RPCConvertible } from '@airgap/coinlib-core/interfaces/RPCConvertible';
|
|
4
|
+
export interface CosmosCoinJSON {
|
|
5
|
+
denom: string;
|
|
6
|
+
amount: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class CosmosCoin implements JSONConvertible, RPCConvertible {
|
|
9
|
+
private static readonly supportedDenominations;
|
|
10
|
+
readonly denom: string;
|
|
11
|
+
readonly amount: string;
|
|
12
|
+
constructor(denom: string, amount: string);
|
|
13
|
+
toJSON(): CosmosCoinJSON;
|
|
14
|
+
static fromJSON(json: CosmosCoinJSON): CosmosCoin;
|
|
15
|
+
static fromCoins(json: CosmosCoinJSON[]): CosmosCoin[];
|
|
16
|
+
static sum(coins: CosmosCoin[]): BigNumber;
|
|
17
|
+
toRPCBody(): any;
|
|
18
|
+
static fromRPCBody(json: any): CosmosCoin;
|
|
19
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CosmosCoin = void 0;
|
|
7
|
+
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
8
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
9
|
+
var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
10
|
+
var CosmosCoin = /** @class */ (function () {
|
|
11
|
+
function CosmosCoin(denom, amount) {
|
|
12
|
+
this.denom = denom;
|
|
13
|
+
this.amount = amount;
|
|
14
|
+
}
|
|
15
|
+
CosmosCoin.prototype.toJSON = function () {
|
|
16
|
+
return {
|
|
17
|
+
amount: this.amount,
|
|
18
|
+
denom: this.denom
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
CosmosCoin.fromJSON = function (json) {
|
|
22
|
+
if (!CosmosCoin.supportedDenominations.includes(json.denom)) {
|
|
23
|
+
throw new errors_1.UnsupportedError(coinlib_error_1.Domain.COSMOS, 'Unsupported cosmos denomination');
|
|
24
|
+
}
|
|
25
|
+
return new CosmosCoin(json.denom, json.amount);
|
|
26
|
+
};
|
|
27
|
+
CosmosCoin.fromCoins = function (json) {
|
|
28
|
+
return json
|
|
29
|
+
.map(function (coinJSON) {
|
|
30
|
+
try {
|
|
31
|
+
return CosmosCoin.fromJSON(coinJSON);
|
|
32
|
+
}
|
|
33
|
+
catch (_a) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.filter(function (value) { return value !== undefined; });
|
|
38
|
+
};
|
|
39
|
+
CosmosCoin.sum = function (coins) {
|
|
40
|
+
return coins.reduce(function (current, next) { return current.plus(new bignumber_1.default(next.amount)); }, new bignumber_1.default(0));
|
|
41
|
+
};
|
|
42
|
+
CosmosCoin.prototype.toRPCBody = function () {
|
|
43
|
+
return {
|
|
44
|
+
amount: this.amount,
|
|
45
|
+
denom: this.denom
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
CosmosCoin.fromRPCBody = function (json) {
|
|
49
|
+
return new CosmosCoin(json.denom, json.amount);
|
|
50
|
+
};
|
|
51
|
+
CosmosCoin.supportedDenominations = ['uatom'];
|
|
52
|
+
return CosmosCoin;
|
|
53
|
+
}());
|
|
54
|
+
exports.CosmosCoin = CosmosCoin;
|
|
55
|
+
//# sourceMappingURL=CosmosCoin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CosmosCoin.js","sourceRoot":"","sources":["../../../src/v1/data/CosmosCoin.ts"],"names":[],"mappings":";;;;;;AAAA,iHAA0F;AAC1F,sDAA8D;AAC9D,2EAAkE;AASlE;IAKE,oBAAY,KAAa,EAAE,MAAc;QACvC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEM,2BAAM,GAAb;QACE,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAA;IACH,CAAC;IAEa,mBAAQ,GAAtB,UAAuB,IAAoB;QACzC,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC3D,MAAM,IAAI,yBAAgB,CAAC,sBAAM,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAAA;SAC7E;QAED,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAChD,CAAC;IAEa,oBAAS,GAAvB,UAAwB,IAAsB;QAC5C,OAAO,IAAI;aACR,GAAG,CAAC,UAAC,QAAQ;YACZ,IAAI;gBACF,OAAO,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;aACrC;YAAC,WAAM;gBACN,OAAO,SAAS,CAAA;aACjB;QACH,CAAC,CAAC;aACD,MAAM,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,KAAK,SAAS,EAAnB,CAAmB,CAAiB,CAAA;IAC3D,CAAC;IAEa,cAAG,GAAjB,UAAkB,KAAmB;QACnC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAC,OAAO,EAAE,IAAI,IAAK,OAAA,OAAO,CAAC,IAAI,CAAC,IAAI,mBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAxC,CAAwC,EAAE,IAAI,mBAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IACpG,CAAC;IAEM,8BAAS,GAAhB;QACE,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAA;IACH,CAAC;IAEa,sBAAW,GAAzB,UAA0B,IAAS;QACjC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAChD,CAAC;IAjDuB,iCAAsB,GAAG,CAAC,OAAO,CAAC,CAAA;IAkD5D,iBAAC;CAAA,AAnDD,IAmDC;AAnDY,gCAAU"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JSONConvertible } from '@airgap/coinlib-core/interfaces/JSONConvertible';
|
|
2
|
+
import { RPCConvertible } from '@airgap/coinlib-core/interfaces/RPCConvertible';
|
|
3
|
+
import { CosmosCoin } from './CosmosCoin';
|
|
4
|
+
export declare class CosmosFee implements JSONConvertible, RPCConvertible {
|
|
5
|
+
readonly amount: CosmosCoin[];
|
|
6
|
+
readonly gas: string;
|
|
7
|
+
constructor(amount: CosmosCoin[], gas: string);
|
|
8
|
+
toJSON(): {
|
|
9
|
+
amount: import("./CosmosCoin").CosmosCoinJSON[];
|
|
10
|
+
gas: string;
|
|
11
|
+
};
|
|
12
|
+
static fromJSON(json: any): CosmosFee;
|
|
13
|
+
toRPCBody(): any;
|
|
14
|
+
static fromRPCBody(json: any): CosmosFee;
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CosmosFee = void 0;
|
|
4
|
+
var CosmosCoin_1 = require("./CosmosCoin");
|
|
5
|
+
var CosmosFee = /** @class */ (function () {
|
|
6
|
+
function CosmosFee(amount, gas) {
|
|
7
|
+
this.amount = amount;
|
|
8
|
+
this.gas = gas;
|
|
9
|
+
}
|
|
10
|
+
CosmosFee.prototype.toJSON = function () {
|
|
11
|
+
return {
|
|
12
|
+
amount: this.amount.map(function (value) { return value.toJSON(); }),
|
|
13
|
+
gas: this.gas
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
CosmosFee.fromJSON = function (json) {
|
|
17
|
+
return new CosmosFee(json.amount.map(function (value) { return CosmosCoin_1.CosmosCoin.fromJSON(value); }), json.gas);
|
|
18
|
+
};
|
|
19
|
+
CosmosFee.prototype.toRPCBody = function () {
|
|
20
|
+
return {
|
|
21
|
+
amount: this.amount.map(function (value) { return value.toRPCBody(); }),
|
|
22
|
+
gas: this.gas
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
CosmosFee.fromRPCBody = function (json) {
|
|
26
|
+
return new CosmosFee(json.amount.map(function (value) { return CosmosCoin_1.CosmosCoin.fromRPCBody(value); }), json.gas);
|
|
27
|
+
};
|
|
28
|
+
return CosmosFee;
|
|
29
|
+
}());
|
|
30
|
+
exports.CosmosFee = CosmosFee;
|
|
31
|
+
//# sourceMappingURL=CosmosFee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CosmosFee.js","sourceRoot":"","sources":["../../../src/v1/data/CosmosFee.ts"],"names":[],"mappings":";;;AAGA,2CAAyC;AAEzC;IAIE,mBAAY,MAAoB,EAAE,GAAW;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAEM,0BAAM,GAAb;QACE,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,MAAM,EAAE,EAAd,CAAc,CAAC;YAClD,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IACH,CAAC;IAEa,kBAAQ,GAAtB,UAAuB,IAAS;QAC9B,OAAO,IAAI,SAAS,CAClB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,KAAU,IAAK,OAAA,uBAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAA1B,CAA0B,CAAC,EAC3D,IAAI,CAAC,GAAG,CACT,CAAA;IACH,CAAC;IAEM,6BAAS,GAAhB;QACE,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,SAAS,EAAE,EAAjB,CAAiB,CAAC;YACrD,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IACH,CAAC;IAEa,qBAAW,GAAzB,UAA0B,IAAS;QACjC,OAAO,IAAI,SAAS,CAClB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,KAAU,IAAK,OAAA,uBAAU,CAAC,WAAW,CAAC,KAAK,CAAC,EAA7B,CAA6B,CAAC,EAC9D,IAAI,CAAC,GAAG,CACT,CAAA;IACH,CAAC;IACH,gBAAC;AAAD,CAAC,AApCD,IAoCC;AApCY,8BAAS"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EncodeObject } from '@airgap/coinlib-core/dependencies/src/cosmjs';
|
|
2
|
+
import { JSONConvertible } from '@airgap/coinlib-core/interfaces/JSONConvertible';
|
|
3
|
+
import { RPCConvertible } from '@airgap/coinlib-core/interfaces/RPCConvertible';
|
|
4
|
+
import { AirGapTransaction } from '@airgap/module-kit';
|
|
5
|
+
import { CosmosProtocolNetwork, CosmosUnits } from '../../types/protocol';
|
|
6
|
+
import { CosmosUnsignedTransaction } from '../../types/transaction';
|
|
7
|
+
import { CosmosFee } from '../CosmosFee';
|
|
8
|
+
import { CosmosMessage } from './message/CosmosMessage';
|
|
9
|
+
export interface Encodable {
|
|
10
|
+
toEncodeObject(): EncodeObject;
|
|
11
|
+
}
|
|
12
|
+
export declare class CosmosTransaction implements JSONConvertible, RPCConvertible, Encodable {
|
|
13
|
+
readonly messages: CosmosMessage[];
|
|
14
|
+
readonly fee: CosmosFee;
|
|
15
|
+
readonly memo: string;
|
|
16
|
+
readonly chainID: string;
|
|
17
|
+
readonly accountNumber: string;
|
|
18
|
+
readonly sequence: string;
|
|
19
|
+
constructor(messages: CosmosMessage[], fee: CosmosFee, memo: string, chainID: string, accountNumber: string, sequence: string);
|
|
20
|
+
toJSON(): {
|
|
21
|
+
accountNumber: string;
|
|
22
|
+
chainID: string;
|
|
23
|
+
fee: {
|
|
24
|
+
amount: import("../CosmosCoin").CosmosCoinJSON[];
|
|
25
|
+
gas: string;
|
|
26
|
+
};
|
|
27
|
+
memo: string;
|
|
28
|
+
messages: import("./message/CosmosMessage").CosmosMessageJSON[];
|
|
29
|
+
sequence: string;
|
|
30
|
+
};
|
|
31
|
+
toRPCBody(): any;
|
|
32
|
+
toEncodeObject(): EncodeObject;
|
|
33
|
+
toAirGapTransactions(network: CosmosProtocolNetwork): AirGapTransaction<CosmosUnits>[];
|
|
34
|
+
static fromJSON(json: CosmosUnsignedTransaction): CosmosTransaction;
|
|
35
|
+
static fromRPCBody(json: any): CosmosTransaction;
|
|
36
|
+
}
|