@airgap/cosmos 0.13.11-beta.15 → 0.13.11-beta.17
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/LICENSE.md +7 -7
- package/package.json +3 -2
- package/v1/index.d.ts +2 -6
- package/v1/index.js.map +1 -1
- package/v1/module/CosmosModule.js +1 -1
- package/v1/module/CosmosModule.js.map +1 -1
- package/v1/protocol/CosmosProtocol.d.ts +10 -47
- package/v1/protocol/CosmosProtocol.js +41 -531
- package/v1/protocol/CosmosProtocol.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +7 -7
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/data/CosmosAddress.d.ts +0 -7
- package/v1/data/CosmosAddress.js +0 -29
- package/v1/data/CosmosAddress.js.map +0 -1
- package/v1/data/CosmosCoin.d.ts +0 -19
- package/v1/data/CosmosCoin.js +0 -55
- package/v1/data/CosmosCoin.js.map +0 -1
- package/v1/data/CosmosFee.d.ts +0 -15
- package/v1/data/CosmosFee.js +0 -31
- package/v1/data/CosmosFee.js.map +0 -1
- package/v1/data/transaction/CosmosTransaction.d.ts +0 -36
- package/v1/data/transaction/CosmosTransaction.js +0 -109
- package/v1/data/transaction/CosmosTransaction.js.map +0 -1
- package/v1/data/transaction/message/CosmosDelegateMessage.d.ts +0 -19
- package/v1/data/transaction/message/CosmosDelegateMessage.js +0 -70
- package/v1/data/transaction/message/CosmosDelegateMessage.js.map +0 -1
- package/v1/data/transaction/message/CosmosMessage.d.ts +0 -38
- package/v1/data/transaction/message/CosmosMessage.js +0 -47
- package/v1/data/transaction/message/CosmosMessage.js.map +0 -1
- package/v1/data/transaction/message/CosmosSendMessage.d.ts +0 -19
- package/v1/data/transaction/message/CosmosSendMessage.js +0 -83
- package/v1/data/transaction/message/CosmosSendMessage.js.map +0 -1
- package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.d.ts +0 -23
- package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js +0 -61
- package/v1/data/transaction/message/CosmosWithdrawDelegationRewardMessage.js.map +0 -1
- package/v1/node/CosmosNodeClient.d.ts +0 -28
- package/v1/node/CosmosNodeClient.js +0 -381
- package/v1/node/CosmosNodeClient.js.map +0 -1
- package/v1/protocol/CosmosCryptoClient.d.ts +0 -8
- package/v1/protocol/CosmosCryptoClient.js +0 -90
- package/v1/protocol/CosmosCryptoClient.js.map +0 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +0 -7
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +0 -37
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +0 -1
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.d.ts +0 -4
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js +0 -3
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.js.map +0 -1
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.d.ts +0 -3
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js +0 -3
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.js.map +0 -1
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-cosmos.json +0 -100
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-cosmos.json +0 -19
- package/v1/serializer/v3/validators/transaction-validators.d.ts +0 -7
- package/v1/serializer/v3/validators/transaction-validators.js +0 -88
- package/v1/serializer/v3/validators/transaction-validators.js.map +0 -1
- package/v1/types/crypto.d.ts +0 -2
- package/v1/types/crypto.js +0 -3
- package/v1/types/crypto.js.map +0 -1
- package/v1/types/protocol.d.ts +0 -8
- package/v1/types/protocol.js +0 -3
- package/v1/types/protocol.js.map +0 -1
- package/v1/types/rpc.d.ts +0 -286
- package/v1/types/rpc.js +0 -3
- package/v1/types/rpc.js.map +0 -1
- package/v1/types/transaction.d.ts +0 -44
- package/v1/types/transaction.js +0 -10
- package/v1/types/transaction.js.map +0 -1
- package/v1/utils/key.d.ts +0 -3
- package/v1/utils/key.js +0 -20
- package/v1/utils/key.js.map +0 -1
- package/v1/utils/signature.d.ts +0 -2
- package/v1/utils/signature.js +0 -13
- package/v1/utils/signature.js.map +0 -1
- package/v1/utils/transaction.d.ts +0 -1
- package/v1/utils/transaction.js +0 -8
- package/v1/utils/transaction.js.map +0 -1
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.CosmosCryptoClient = void 0;
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
var SECP256K1 = require("@airgap/coinlib-core/dependencies/src/secp256k1-3.7.1/elliptic");
|
|
57
|
-
// @ts-ignore
|
|
58
|
-
var sha = require("@airgap/coinlib-core/dependencies/src/sha.js-2.4.11/index");
|
|
59
|
-
var Secp256k1CryptoClient_1 = require("@airgap/coinlib-core/protocols/Secp256k1CryptoClient");
|
|
60
|
-
var CosmosCryptoClient = /** @class */ (function (_super) {
|
|
61
|
-
__extends(CosmosCryptoClient, _super);
|
|
62
|
-
function CosmosCryptoClient() {
|
|
63
|
-
return _super.call(this) || this;
|
|
64
|
-
}
|
|
65
|
-
CosmosCryptoClient.prototype.signMessage = function (message, keypair) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
var sha256Hash, hash, signed;
|
|
68
|
-
return __generator(this, function (_a) {
|
|
69
|
-
sha256Hash = sha('sha256').update(Buffer.from(message)).digest();
|
|
70
|
-
hash = Buffer.from(sha256Hash);
|
|
71
|
-
signed = SECP256K1.sign(hash, Buffer.from(keypair.privateKey, 'hex'));
|
|
72
|
-
return [2 /*return*/, "0x".concat(Buffer.from(signed.signature).toString('hex'))];
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
CosmosCryptoClient.prototype.verifyMessage = function (message, signature, publicKey) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
-
var rawSignature, sha256Hash, messageHash;
|
|
79
|
-
return __generator(this, function (_a) {
|
|
80
|
-
rawSignature = Buffer.from(signature.replace(/^0x/, ''), 'hex');
|
|
81
|
-
sha256Hash = sha('sha256').update(Buffer.from(message)).digest();
|
|
82
|
-
messageHash = Buffer.from(sha256Hash);
|
|
83
|
-
return [2 /*return*/, SECP256K1.verify(messageHash, rawSignature, Buffer.from(publicKey, 'hex'))];
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
return CosmosCryptoClient;
|
|
88
|
-
}(Secp256k1CryptoClient_1.Secp256k1CryptoClient));
|
|
89
|
-
exports.CosmosCryptoClient = CosmosCryptoClient;
|
|
90
|
-
//# sourceMappingURL=CosmosCryptoClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CosmosCryptoClient.js","sourceRoot":"","sources":["../../../src/v1/protocol/CosmosCryptoClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,0FAA4F;AAC5F,aAAa;AACb,+EAAiF;AACjF,8FAA4F;AAE5F;IAAwC,sCAAqB;IAC3D;eACE,iBAAO;IACT,CAAC;IAEY,wCAAW,GAAxB,UAAyB,OAAe,EAAE,OAA+B;;;;gBACjE,UAAU,GAAW,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;gBACxE,IAAI,GAAW,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;gBACtC,MAAM,GAA0B,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAA;gBAElG,sBAAO,YAAK,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAE,EAAA;;;KAC5D;IAEY,0CAAa,GAA1B,UAA2B,OAAe,EAAE,SAAiB,EAAE,SAAiB;;;;gBACxE,YAAY,GAAW,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;gBAEvE,UAAU,GAAW,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;gBACxE,WAAW,GAAW,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;gBAEnD,sBAAO,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,EAAA;;;KAClF;IACH,yBAAC;AAAD,CAAC,AArBD,CAAwC,6CAAqB,GAqB5D;AArBY,gDAAkB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CosmosSignedTransaction, CosmosUnsignedTransaction } from '../../../../types/transaction';
|
|
2
|
-
import { CosmosTransactionSignRequest } from '../definitions/transaction-sign-request-cosmos';
|
|
3
|
-
import { CosmosTransactionSignResponse } from '../definitions/transaction-sign-response-cosmos';
|
|
4
|
-
export declare function cosmosUnsignedTransactionToRequest(unsigned: CosmosUnsignedTransaction, publicKey: string, callbackUrl?: string): CosmosTransactionSignRequest;
|
|
5
|
-
export declare function cosmosSignedTransactionToResponse(signed: CosmosSignedTransaction, accountIdentifier: string): CosmosTransactionSignResponse;
|
|
6
|
-
export declare function cosmosTransactionSignRequestToUnsigned(request: CosmosTransactionSignRequest): CosmosUnsignedTransaction;
|
|
7
|
-
export declare function cosmosTransactionSignResponseToSigned(response: CosmosTransactionSignResponse): CosmosSignedTransaction;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.cosmosTransactionSignResponseToSigned = exports.cosmosTransactionSignRequestToUnsigned = exports.cosmosSignedTransactionToResponse = exports.cosmosUnsignedTransactionToRequest = void 0;
|
|
15
|
-
var module_kit_1 = require("@airgap/module-kit");
|
|
16
|
-
function cosmosUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) {
|
|
17
|
-
var _ = unsigned.type, rest = __rest(unsigned, ["type"]);
|
|
18
|
-
return {
|
|
19
|
-
transaction: rest,
|
|
20
|
-
publicKey: publicKey,
|
|
21
|
-
callbackURL: callbackUrl
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
exports.cosmosUnsignedTransactionToRequest = cosmosUnsignedTransactionToRequest;
|
|
25
|
-
function cosmosSignedTransactionToResponse(signed, accountIdentifier) {
|
|
26
|
-
return { transaction: signed.encoded, accountIdentifier: accountIdentifier };
|
|
27
|
-
}
|
|
28
|
-
exports.cosmosSignedTransactionToResponse = cosmosSignedTransactionToResponse;
|
|
29
|
-
function cosmosTransactionSignRequestToUnsigned(request) {
|
|
30
|
-
return (0, module_kit_1.newUnsignedTransaction)(request.transaction);
|
|
31
|
-
}
|
|
32
|
-
exports.cosmosTransactionSignRequestToUnsigned = cosmosTransactionSignRequestToUnsigned;
|
|
33
|
-
function cosmosTransactionSignResponseToSigned(response) {
|
|
34
|
-
return (0, module_kit_1.newSignedTransaction)({ encoded: response.transaction });
|
|
35
|
-
}
|
|
36
|
-
exports.cosmosTransactionSignResponseToSigned = cosmosTransactionSignResponseToSigned;
|
|
37
|
-
//# sourceMappingURL=transaction-converter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iDAAiF;AAMjF,SAAgB,kCAAkC,CAChD,QAAmC,EACnC,SAAiB,EACjB,WAAoB;IAEZ,IAAM,CAAC,GAAc,QAAQ,KAAtB,EAAK,IAAI,UAAK,QAAQ,EAA/B,QAAoB,CAAF,CAAa;IAErC,OAAO;QACL,WAAW,EAAE,IAAI;QACjB,SAAS,WAAA;QACT,WAAW,EAAE,WAAW;KACzB,CAAA;AACH,CAAC;AAZD,gFAYC;AAED,SAAgB,iCAAiC,CAC/C,MAA+B,EAC/B,iBAAyB;IAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,iBAAiB,mBAAA,EAAE,CAAA;AAC3D,CAAC;AALD,8EAKC;AAED,SAAgB,sCAAsC,CAAC,OAAqC;IAC1F,OAAO,IAAA,mCAAsB,EAA4B,OAAO,CAAC,WAAW,CAAC,CAAA;AAC/E,CAAC;AAFD,wFAEC;AAED,SAAgB,qCAAqC,CAAC,QAAuC;IAC3F,OAAO,IAAA,iCAAoB,EAA0B,EAAE,OAAO,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAA;AACzF,CAAC;AAFD,sFAEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-sign-request-cosmos.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-request-cosmos.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-sign-response-cosmos.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/definitions/transaction-sign-response-cosmos.ts"],"names":[],"mappings":""}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$ref": "#/definitions/CosmosTransactionSignRequest",
|
|
3
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"definitions": {
|
|
5
|
-
"CosmosTransactionSignRequest": {
|
|
6
|
-
"additionalProperties": false,
|
|
7
|
-
"properties": {
|
|
8
|
-
"callbackURL": {
|
|
9
|
-
"type": "string"
|
|
10
|
-
},
|
|
11
|
-
"publicKey": {
|
|
12
|
-
"type": "string"
|
|
13
|
-
},
|
|
14
|
-
"transaction": {
|
|
15
|
-
"additionalProperties": false,
|
|
16
|
-
"properties": {
|
|
17
|
-
"accountNumber": {
|
|
18
|
-
"type": "string"
|
|
19
|
-
},
|
|
20
|
-
"chainID": {
|
|
21
|
-
"type": "string"
|
|
22
|
-
},
|
|
23
|
-
"fee": {
|
|
24
|
-
"additionalProperties": false,
|
|
25
|
-
"properties": {
|
|
26
|
-
"amount": {
|
|
27
|
-
"items": {
|
|
28
|
-
"additionalProperties": false,
|
|
29
|
-
"properties": {
|
|
30
|
-
"amount": {
|
|
31
|
-
"type": "string"
|
|
32
|
-
},
|
|
33
|
-
"denom": {
|
|
34
|
-
"type": "string"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"required": ["denom", "amount"],
|
|
38
|
-
"type": "object"
|
|
39
|
-
},
|
|
40
|
-
"type": "array"
|
|
41
|
-
},
|
|
42
|
-
"gas": {
|
|
43
|
-
"type": "string"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"required": ["amount", "gas"],
|
|
47
|
-
"type": "object"
|
|
48
|
-
},
|
|
49
|
-
"memo": {
|
|
50
|
-
"type": "string"
|
|
51
|
-
},
|
|
52
|
-
"messages": {
|
|
53
|
-
"items": {
|
|
54
|
-
"additionalProperties": false,
|
|
55
|
-
"properties": {
|
|
56
|
-
"amount": {
|
|
57
|
-
"items": {
|
|
58
|
-
"additionalProperties": false,
|
|
59
|
-
"properties": {
|
|
60
|
-
"amount": {
|
|
61
|
-
"type": "string"
|
|
62
|
-
},
|
|
63
|
-
"denom": {
|
|
64
|
-
"type": "string"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
"required": ["denom", "amount"],
|
|
68
|
-
"type": "object"
|
|
69
|
-
},
|
|
70
|
-
"type": "array"
|
|
71
|
-
},
|
|
72
|
-
"fromAddress": {
|
|
73
|
-
"type": "string"
|
|
74
|
-
},
|
|
75
|
-
"toAddress": {
|
|
76
|
-
"type": "string"
|
|
77
|
-
},
|
|
78
|
-
"type": {
|
|
79
|
-
"enum": [0, 1, 2, 3],
|
|
80
|
-
"type": "number"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"required": ["type", "amount", "fromAddress", "toAddress"],
|
|
84
|
-
"type": "object"
|
|
85
|
-
},
|
|
86
|
-
"type": "array"
|
|
87
|
-
},
|
|
88
|
-
"sequence": {
|
|
89
|
-
"type": "string"
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
"required": ["messages", "fee", "memo", "chainID", "accountNumber", "sequence"],
|
|
93
|
-
"type": "object"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
"required": ["publicKey", "transaction"],
|
|
97
|
-
"type": "object"
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$ref": "#/definitions/CosmosTransactionSignResponse",
|
|
3
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
-
"definitions": {
|
|
5
|
-
"CosmosTransactionSignResponse": {
|
|
6
|
-
"additionalProperties": false,
|
|
7
|
-
"properties": {
|
|
8
|
-
"accountIdentifier": {
|
|
9
|
-
"type": "string"
|
|
10
|
-
},
|
|
11
|
-
"transaction": {
|
|
12
|
-
"type": "string"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"required": ["accountIdentifier", "transaction"],
|
|
16
|
-
"type": "object"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TransactionValidator } from '@airgap/serializer';
|
|
2
|
-
import { CosmosTransactionSignRequest } from '../schemas/definitions/transaction-sign-request-cosmos';
|
|
3
|
-
import { CosmosTransactionSignResponse } from '../schemas/definitions/transaction-sign-response-cosmos';
|
|
4
|
-
export declare class CosmosTransactionValidator implements TransactionValidator {
|
|
5
|
-
validateUnsignedTransaction(request: CosmosTransactionSignRequest): Promise<any>;
|
|
6
|
-
validateSignedTransaction(response: CosmosTransactionSignResponse): Promise<any>;
|
|
7
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.CosmosTransactionValidator = void 0;
|
|
40
|
-
// tslint:disable: max-classes-per-file
|
|
41
|
-
// import { async } from '@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate'
|
|
42
|
-
var serializer_1 = require("@airgap/serializer");
|
|
43
|
-
// const unsignedTransactionConstraints = {
|
|
44
|
-
// binaryTransaction: {
|
|
45
|
-
// isValidCosmosUnsignedTransaction: true,
|
|
46
|
-
// presence: { allowEmpty: false },
|
|
47
|
-
// type: 'String'
|
|
48
|
-
// }
|
|
49
|
-
// }
|
|
50
|
-
// const success = () => undefined
|
|
51
|
-
// const error = errors => errors
|
|
52
|
-
// const signedTransactionConstraints = {
|
|
53
|
-
// transaction: {
|
|
54
|
-
// isValidCosmosSignedTransaction: true,
|
|
55
|
-
// presence: { allowEmpty: false },
|
|
56
|
-
// type: 'String'
|
|
57
|
-
// },
|
|
58
|
-
// accountIdentifier: {
|
|
59
|
-
// presence: { allowEmpty: false },
|
|
60
|
-
// type: 'String'
|
|
61
|
-
// }
|
|
62
|
-
// }
|
|
63
|
-
// TODO implement this
|
|
64
|
-
var CosmosTransactionValidator = /** @class */ (function () {
|
|
65
|
-
function CosmosTransactionValidator() {
|
|
66
|
-
}
|
|
67
|
-
CosmosTransactionValidator.prototype.validateUnsignedTransaction = function (request) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
return __generator(this, function (_a) {
|
|
70
|
-
// const transaction: CosmosUnsignedTransaction = request.transaction
|
|
71
|
-
(0, serializer_1.validateSyncScheme)({});
|
|
72
|
-
// return async(transaction, unsignedTransactionConstraints).then(success, error)
|
|
73
|
-
return [2 /*return*/, undefined];
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
CosmosTransactionValidator.prototype.validateSignedTransaction = function (response) {
|
|
78
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
79
|
-
return __generator(this, function (_a) {
|
|
80
|
-
// return async(response, signedTransactionConstraints).then(success, error)
|
|
81
|
-
return [2 /*return*/, undefined];
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
return CosmosTransactionValidator;
|
|
86
|
-
}());
|
|
87
|
-
exports.CosmosTransactionValidator = CosmosTransactionValidator;
|
|
88
|
-
//# sourceMappingURL=transaction-validators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validators.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,4FAA4F;AAC5F,iDAA6E;AAM7E,2CAA2C;AAC3C,yBAAyB;AACzB,8CAA8C;AAC9C,uCAAuC;AACvC,qBAAqB;AACrB,MAAM;AACN,IAAI;AACJ,kCAAkC;AAClC,iCAAiC;AAEjC,yCAAyC;AACzC,mBAAmB;AACnB,4CAA4C;AAC5C,uCAAuC;AACvC,qBAAqB;AACrB,OAAO;AACP,yBAAyB;AACzB,uCAAuC;AACvC,qBAAqB;AACrB,MAAM;AACN,IAAI;AAEJ,sBAAsB;AACtB;IAAA;IAYA,CAAC;IAXc,gEAA2B,GAAxC,UAAyC,OAAqC;;;gBAC5E,qEAAqE;gBACrE,IAAA,+BAAkB,EAAC,EAAE,CAAC,CAAA;gBAEtB,iFAAiF;gBACjF,sBAAO,SAAS,EAAA;;;KACjB;IACY,8DAAyB,GAAtC,UAAuC,QAAuC;;;gBAC5E,4EAA4E;gBAC5E,sBAAO,SAAS,EAAA;;;KACjB;IACH,iCAAC;AAAD,CAAC,AAZD,IAYC;AAZY,gEAA0B"}
|
package/v1/types/crypto.d.ts
DELETED
package/v1/types/crypto.js
DELETED
package/v1/types/crypto.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../../src/v1/types/crypto.ts"],"names":[],"mappings":""}
|
package/v1/types/protocol.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
-
export declare type CosmosUnits = 'atom' | 'uatom';
|
|
3
|
-
export interface CosmosProtocolNetwork extends ProtocolNetwork {
|
|
4
|
-
useCORSProxy?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export interface CosmosProtocolOptions {
|
|
7
|
-
network: CosmosProtocolNetwork;
|
|
8
|
-
}
|
package/v1/types/protocol.js
DELETED
package/v1/types/protocol.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/v1/types/protocol.ts"],"names":[],"mappings":""}
|