@airgap/mina 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/block-explorer/MinaExplorerBlockExplorer.js +12 -61
- package/v1/block-explorer/MinaExplorerBlockExplorer.js.map +1 -1
- package/v1/index.js +2 -2
- package/v1/index.js.map +1 -1
- package/v1/indexer/MinaExplorerIndexer.js +64 -107
- package/v1/indexer/MinaExplorerIndexer.js.map +1 -1
- package/v1/module/MinaModule.js +38 -96
- package/v1/module/MinaModule.js.map +1 -1
- package/v1/module.js +2 -3
- package/v1/module.js.map +1 -1
- package/v1/node/GraphQLNode.js +70 -107
- package/v1/node/GraphQLNode.js.map +1 -1
- package/v1/protocol/MinaProtocol.js +179 -317
- package/v1/protocol/MinaProtocol.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/serializer-companion.js +69 -148
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +16 -65
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
- package/v1/serializer/v3/validators/validators.js +36 -81
- package/v1/serializer/v3/validators/validators.js.map +1 -1
- package/v1/types/crypto.d.ts +1 -1
- package/v1/types/protocol.d.ts +2 -2
- package/v1/types/transaction.d.ts +1 -1
- package/v1/utils/key.d.ts +0 -1
- package/v1/utils/key.js +23 -14
- package/v1/utils/key.js.map +1 -1
- package/v1/utils/math.js +7 -11
- package/v1/utils/math.js.map +1 -1
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
15
|
-
|
|
3
|
+
exports.minaUnsignedTransactionToRequest = minaUnsignedTransactionToRequest;
|
|
4
|
+
exports.minaSignedTransactionToResponse = minaSignedTransactionToResponse;
|
|
5
|
+
exports.minaTransactionSignRequestToUnsigned = minaTransactionSignRequestToUnsigned;
|
|
6
|
+
exports.minaTransactionSignResponseToSigned = minaTransactionSignResponseToSigned;
|
|
7
|
+
const module_kit_1 = require("@airgap/module-kit");
|
|
16
8
|
function minaUnsignedTransactionToRequest(unsigned, publicKey, callbackUrl) {
|
|
17
|
-
|
|
9
|
+
const { type: _, ...rest } = unsigned;
|
|
18
10
|
return {
|
|
19
11
|
transaction: rest,
|
|
20
|
-
publicKey
|
|
12
|
+
publicKey,
|
|
21
13
|
callbackURL: callbackUrl
|
|
22
14
|
};
|
|
23
15
|
}
|
|
24
|
-
exports.minaUnsignedTransactionToRequest = minaUnsignedTransactionToRequest;
|
|
25
16
|
function minaSignedTransactionToResponse(signed, accountIdentifier) {
|
|
26
|
-
return { transaction: JSON.stringify(signed), accountIdentifier
|
|
17
|
+
return { transaction: JSON.stringify(signed), accountIdentifier };
|
|
27
18
|
}
|
|
28
|
-
exports.minaSignedTransactionToResponse = minaSignedTransactionToResponse;
|
|
29
19
|
function minaTransactionSignRequestToUnsigned(request) {
|
|
30
20
|
return (0, module_kit_1.newUnsignedTransaction)(request.transaction);
|
|
31
21
|
}
|
|
32
|
-
exports.minaTransactionSignRequestToUnsigned = minaTransactionSignRequestToUnsigned;
|
|
33
22
|
function minaTransactionSignResponseToSigned(response) {
|
|
34
23
|
return (0, module_kit_1.newSignedTransaction)(JSON.parse(response.transaction));
|
|
35
24
|
}
|
|
36
|
-
exports.minaTransactionSignResponseToSigned = minaTransactionSignResponseToSigned;
|
|
37
25
|
//# sourceMappingURL=transaction-converter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction-converter.js","sourceRoot":"","sources":["../../../../../../src/v1/serializer/v3/schemas/converter/transaction-converter.ts"],"names":[],"mappings":";;AAMA,4EAYC;AAED,0EAEC;AAED,oFAEC;AAED,kFAEC;AA9BD,mDAAiF;AAMjF,SAAgB,gCAAgC,CAC9C,QAAiC,EACjC,SAAiB,EACjB,WAAoB;IAEpB,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAA;IAErC,OAAO;QACL,WAAW,EAAE,IAAI;QACjB,SAAS;QACT,WAAW,EAAE,WAAW;KACzB,CAAA;AACH,CAAC;AAED,SAAgB,+BAA+B,CAAC,MAA6B,EAAE,iBAAyB;IACtG,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAA;AACnE,CAAC;AAED,SAAgB,oCAAoC,CAAC,OAAmC;IACtF,OAAO,IAAA,mCAAsB,EAA0B,OAAO,CAAC,WAAW,CAAC,CAAA;AAC7E,CAAC;AAED,SAAgB,mCAAmC,CAAC,QAAqC;IACvF,OAAO,IAAA,iCAAoB,EAAwB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAA;AACtF,CAAC"}
|
|
@@ -1,53 +1,17 @@
|
|
|
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.MinaV3SerializerCompanion = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
4
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
5
|
+
const validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
6
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
7
|
+
const serializer_1 = require("@airgap/serializer");
|
|
8
|
+
const transaction_converter_1 = require("./schemas/converter/transaction-converter");
|
|
9
|
+
const transaction_validator_1 = require("./validators/transaction-validator");
|
|
10
|
+
const validators_1 = require("./validators/validators");
|
|
11
|
+
const minaTransactionSignRequest = require('./schemas/generated/transaction-sign-request-mina.json');
|
|
12
|
+
const minaTransactionSignResponse = require('./schemas/generated/transaction-sign-response-mina.json');
|
|
13
|
+
class MinaV3SerializerCompanion {
|
|
14
|
+
constructor() {
|
|
51
15
|
this.schemas = [
|
|
52
16
|
{
|
|
53
17
|
type: serializer_1.IACMessageType.TransactionSignRequest,
|
|
@@ -61,113 +25,70 @@ var MinaV3SerializerCompanion = /** @class */ (function () {
|
|
|
61
25
|
}
|
|
62
26
|
];
|
|
63
27
|
this.minaTransactionValidator = new transaction_validator_1.MinaTransactionValidator();
|
|
64
|
-
Object.keys(validators_1.minaValidators).forEach(
|
|
28
|
+
Object.keys(validators_1.minaValidators).forEach((key) => {
|
|
65
29
|
validate_1.validators[key] = validators_1.minaValidators[key];
|
|
66
30
|
});
|
|
67
31
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return [2 /*return*/];
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
MinaV3SerializerCompanion.prototype.validateTransactionSignRequest = function (identifier, transactionSignRequest) {
|
|
95
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
-
var _a, _b;
|
|
97
|
-
return __generator(this, function (_c) {
|
|
98
|
-
switch (_c.label) {
|
|
99
|
-
case 0:
|
|
100
|
-
_a = identifier;
|
|
101
|
-
switch (_a) {
|
|
102
|
-
case coinlib_core_1.MainProtocolSymbols.MINA: return [3 /*break*/, 1];
|
|
103
|
-
}
|
|
104
|
-
return [3 /*break*/, 4];
|
|
105
|
-
case 1:
|
|
106
|
-
_c.trys.push([1, 3, , 4]);
|
|
107
|
-
return [4 /*yield*/, this.minaTransactionValidator.validateUnsignedTransaction(transactionSignRequest)];
|
|
108
|
-
case 2:
|
|
109
|
-
_c.sent();
|
|
110
|
-
return [2 /*return*/, true];
|
|
111
|
-
case 3:
|
|
112
|
-
_b = _c.sent();
|
|
113
|
-
return [2 /*return*/, false];
|
|
114
|
-
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.MINA, "Protocol ".concat(identifier, " not supported"));
|
|
32
|
+
async toTransactionSignRequest(identifier, unsignedTransaction, publicKey, callbackUrl) {
|
|
33
|
+
switch (identifier) {
|
|
34
|
+
case coinlib_core_1.MainProtocolSymbols.MINA:
|
|
35
|
+
return (0, transaction_converter_1.minaUnsignedTransactionToRequest)(unsignedTransaction, publicKey, callbackUrl);
|
|
36
|
+
default:
|
|
37
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.MINA, `Protocol ${identifier} not supported`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async fromTransactionSignRequest(identifier, transactionSignRequest) {
|
|
41
|
+
switch (identifier) {
|
|
42
|
+
case coinlib_core_1.MainProtocolSymbols.MINA:
|
|
43
|
+
return (0, transaction_converter_1.minaTransactionSignRequestToUnsigned)(transactionSignRequest);
|
|
44
|
+
default:
|
|
45
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.MINA, `Protocol ${identifier} not supported`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async validateTransactionSignRequest(identifier, transactionSignRequest) {
|
|
49
|
+
switch (identifier) {
|
|
50
|
+
case coinlib_core_1.MainProtocolSymbols.MINA:
|
|
51
|
+
try {
|
|
52
|
+
await this.minaTransactionValidator.validateUnsignedTransaction(transactionSignRequest);
|
|
53
|
+
return true;
|
|
115
54
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
};
|
|
119
|
-
MinaV3SerializerCompanion.prototype.toTransactionSignResponse = function (identifier, signedTransaction, accountIdentifier) {
|
|
120
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
-
return __generator(this, function (_a) {
|
|
122
|
-
switch (identifier) {
|
|
123
|
-
case coinlib_core_1.MainProtocolSymbols.MINA:
|
|
124
|
-
return [2 /*return*/, (0, transaction_converter_1.minaSignedTransactionToResponse)(signedTransaction, accountIdentifier)];
|
|
125
|
-
default:
|
|
126
|
-
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.MINA, "Protocol ".concat(identifier, " not supported"));
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
127
57
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
58
|
+
default:
|
|
59
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.MINA, `Protocol ${identifier} not supported`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async toTransactionSignResponse(identifier, signedTransaction, accountIdentifier) {
|
|
63
|
+
switch (identifier) {
|
|
64
|
+
case coinlib_core_1.MainProtocolSymbols.MINA:
|
|
65
|
+
return (0, transaction_converter_1.minaSignedTransactionToResponse)(signedTransaction, accountIdentifier);
|
|
66
|
+
default:
|
|
67
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.MINA, `Protocol ${identifier} not supported`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async fromTransactionSignResponse(identifier, transactionSignResponse) {
|
|
71
|
+
switch (identifier) {
|
|
72
|
+
case coinlib_core_1.MainProtocolSymbols.MINA:
|
|
73
|
+
return (0, transaction_converter_1.minaTransactionSignResponseToSigned)(transactionSignResponse);
|
|
74
|
+
default:
|
|
75
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.MINA, `Protocol ${identifier} not supported`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async validateTransactionSignResponse(identifier, transactionSignResponse) {
|
|
79
|
+
switch (identifier) {
|
|
80
|
+
case coinlib_core_1.MainProtocolSymbols.MINA:
|
|
81
|
+
try {
|
|
82
|
+
await this.minaTransactionValidator.validateSignedTransaction(transactionSignResponse);
|
|
83
|
+
return true;
|
|
140
84
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
MinaV3SerializerCompanion.prototype.validateTransactionSignResponse = function (identifier, transactionSignResponse) {
|
|
146
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
147
|
-
var _a, _b;
|
|
148
|
-
return __generator(this, function (_c) {
|
|
149
|
-
switch (_c.label) {
|
|
150
|
-
case 0:
|
|
151
|
-
_a = identifier;
|
|
152
|
-
switch (_a) {
|
|
153
|
-
case coinlib_core_1.MainProtocolSymbols.MINA: return [3 /*break*/, 1];
|
|
154
|
-
}
|
|
155
|
-
return [3 /*break*/, 4];
|
|
156
|
-
case 1:
|
|
157
|
-
_c.trys.push([1, 3, , 4]);
|
|
158
|
-
return [4 /*yield*/, this.minaTransactionValidator.validateSignedTransaction(transactionSignResponse)];
|
|
159
|
-
case 2:
|
|
160
|
-
_c.sent();
|
|
161
|
-
return [2 /*return*/, true];
|
|
162
|
-
case 3:
|
|
163
|
-
_b = _c.sent();
|
|
164
|
-
return [2 /*return*/, false];
|
|
165
|
-
case 4: throw new errors_1.UnsupportedError(coinlib_core_1.Domain.MINA, "Protocol ".concat(identifier, " not supported"));
|
|
85
|
+
catch {
|
|
86
|
+
return false;
|
|
166
87
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
88
|
+
default:
|
|
89
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.MINA, `Protocol ${identifier} not supported`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
172
93
|
exports.MinaV3SerializerCompanion = MinaV3SerializerCompanion;
|
|
173
94
|
//# sourceMappingURL=serializer-companion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializer-companion.js","sourceRoot":"","sources":["../../../../src/v1/serializer/v3/serializer-companion.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAClE,gGAA8F;AAC9F,wDAA8D;AAE9D,mDAAgH;AAIhH,qFAKkD;AAClD,8EAA6E;AAC7E,wDAAwD;AAExD,MAAM,0B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C;YACnB,KAAK,kCAAmB,CAAC,IAAI;gBAC3B,IAAI,CAAC;oBACH,MAAM,IAAI,CAAC,wBAAwB,CAAC,yBAAyB,CAAC,uBAAuB,CAAC,CAAA;oBAEtF,OAAO,IAAI,CAAA;gBACb,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,KAAK,CAAA;gBACd,CAAC;YACH;gBACE,MAAM,IAAI,yBAAgB,CAAC,qBAAM,CAAC,IAAI,EAAE,YAAY,UAAU,gBAAgB,CAAC,CAAA;QACnF,CAAC;IACH,CAAC;CACF;AAtGD,8DAsGC"}
|
|
@@ -1,45 +1,9 @@
|
|
|
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.MinaTransactionValidator = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
4
|
+
const validate_1 = require("@airgap/coinlib-core/dependencies/src/validate.js-0.13.1/validate");
|
|
5
|
+
const serializer_1 = require("@airgap/serializer");
|
|
6
|
+
const unsignedTransactionConstraints = {
|
|
43
7
|
networkType: {
|
|
44
8
|
presence: { allowEmpty: false },
|
|
45
9
|
type: 'String',
|
|
@@ -50,7 +14,7 @@ var unsignedTransactionConstraints = {
|
|
|
50
14
|
isValidMinaPayment: true
|
|
51
15
|
}
|
|
52
16
|
};
|
|
53
|
-
|
|
17
|
+
const signedTransactionConstraints = {
|
|
54
18
|
data: {
|
|
55
19
|
presence: { allowEmpty: false },
|
|
56
20
|
isValidMinaPayment: true
|
|
@@ -60,31 +24,18 @@ var signedTransactionConstraints = {
|
|
|
60
24
|
isValidMinaSignature: true
|
|
61
25
|
}
|
|
62
26
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
27
|
+
const success = () => undefined;
|
|
28
|
+
const error = (errors) => errors;
|
|
29
|
+
class MinaTransactionValidator {
|
|
30
|
+
async validateUnsignedTransaction(request) {
|
|
31
|
+
const transaction = request.transaction;
|
|
32
|
+
(0, serializer_1.validateSyncScheme)({});
|
|
33
|
+
return (0, validate_1.async)(transaction, unsignedTransactionConstraints).then(success, error);
|
|
34
|
+
}
|
|
35
|
+
async validateSignedTransaction(response) {
|
|
36
|
+
const transaction = JSON.parse(response.transaction);
|
|
37
|
+
return (0, validate_1.async)(transaction, signedTransactionConstraints).then(success, error);
|
|
67
38
|
}
|
|
68
|
-
|
|
69
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
-
var transaction;
|
|
71
|
-
return __generator(this, function (_a) {
|
|
72
|
-
transaction = request.transaction;
|
|
73
|
-
(0, serializer_1.validateSyncScheme)({});
|
|
74
|
-
return [2 /*return*/, (0, validate_1.async)(transaction, unsignedTransactionConstraints).then(success, error)];
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
MinaTransactionValidator.prototype.validateSignedTransaction = function (response) {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
-
var transaction;
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
transaction = JSON.parse(response.transaction);
|
|
83
|
-
return [2 /*return*/, (0, validate_1.async)(transaction, signedTransactionConstraints).then(success, error)];
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
return MinaTransactionValidator;
|
|
88
|
-
}());
|
|
39
|
+
}
|
|
89
40
|
exports.MinaTransactionValidator = MinaTransactionValidator;
|
|
90
41
|
//# sourceMappingURL=transaction-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction-validator.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/transaction-validator.ts"],"names":[],"mappings":";;;AAAA,gGAAyF;AACzF,mDAA6E;AAK7E,MAAM,8BAA8B,GAAG;IACrC,WAAW,EAAE;QACX,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,IAAI,EAAE,QAAQ;QACd,sBAAsB,EAAE,IAAI;KAC7B;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,kBAAkB,EAAE,IAAI;KACzB;CACF,CAAA;AACD,MAAM,4BAA4B,GAAG;IACnC,IAAI,EAAE;QACJ,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,kBAAkB,EAAE,IAAI;KACzB;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/B,oBAAoB,EAAE,IAAI;KAC3B;CACF,CAAA;AAED,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,SAAS,CAAA;AAC/B,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAA;AAEhC,MAAa,wBAAwB;IAC5B,KAAK,CAAC,2BAA2B,CAAC,OAAmC;QAC1E,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;QACvC,IAAA,+BAAkB,EAAC,EAAE,CAAC,CAAA;QAEtB,OAAO,IAAA,gBAAK,EAAC,WAAW,EAAE,8BAA8B,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAChF,CAAC;IAEM,KAAK,CAAC,yBAAyB,CAAC,QAAqC;QAC1E,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;QACpD,OAAO,IAAA,gBAAK,EAAC,WAAW,EAAE,4BAA4B,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAC9E,CAAC;CACF;AAZD,4DAYC"}
|
|
@@ -1,90 +1,45 @@
|
|
|
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.minaValidators = void 0;
|
|
40
|
-
|
|
4
|
+
const MinaProtocol_1 = require("../../../protocol/MinaProtocol");
|
|
41
5
|
exports.minaValidators = {
|
|
42
|
-
isValidMinaPayment:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
if (typeof payment.validUntil !== 'undefined' && (typeof payment.validUntil !== 'string' || !amountPattern.test(payment.validUntil))) {
|
|
77
|
-
return [2 /*return*/, 'not a valid timestamp'];
|
|
78
|
-
}
|
|
79
|
-
return [2 /*return*/, null];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}); },
|
|
83
|
-
isValidMinaSignature: function (value) {
|
|
6
|
+
isValidMinaPayment: async (value) => {
|
|
7
|
+
if (typeof value !== 'object') {
|
|
8
|
+
return 'not an object';
|
|
9
|
+
}
|
|
10
|
+
const protocol = (0, MinaProtocol_1.createMinaProtocol)();
|
|
11
|
+
const metadata = await protocol.getMetadata();
|
|
12
|
+
const addressPattern = RegExp(metadata.account?.address?.regex ?? '.*');
|
|
13
|
+
const amountPattern = RegExp('d+');
|
|
14
|
+
const payment = value;
|
|
15
|
+
if (typeof payment.to !== 'string' || !addressPattern.test(payment.to)) {
|
|
16
|
+
return 'not a valid Mina `to` address';
|
|
17
|
+
}
|
|
18
|
+
if (typeof payment.from !== 'string' || !addressPattern.test(payment.from)) {
|
|
19
|
+
return 'not a valid Mina `from` address';
|
|
20
|
+
}
|
|
21
|
+
if (typeof payment.amount !== 'string' || !amountPattern.test(payment.amount)) {
|
|
22
|
+
return 'not a valid amount';
|
|
23
|
+
}
|
|
24
|
+
if (typeof payment.fee !== 'string' || !amountPattern.test(payment.fee)) {
|
|
25
|
+
return 'not a valid fee';
|
|
26
|
+
}
|
|
27
|
+
if (typeof payment.nonce !== 'string' || !amountPattern.test(payment.nonce) || parseInt(payment.nonce, 10) < 0) {
|
|
28
|
+
return 'not a valid nonce';
|
|
29
|
+
}
|
|
30
|
+
if (typeof payment.memo !== 'undefined' && typeof payment.memo !== 'string') {
|
|
31
|
+
return 'not a valid memo';
|
|
32
|
+
}
|
|
33
|
+
if (typeof payment.validUntil !== 'undefined' && (typeof payment.validUntil !== 'string' || !amountPattern.test(payment.validUntil))) {
|
|
34
|
+
return 'not a valid timestamp';
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
},
|
|
38
|
+
isValidMinaSignature: (value) => {
|
|
84
39
|
if (typeof value !== 'object') {
|
|
85
40
|
return 'not an object';
|
|
86
41
|
}
|
|
87
|
-
|
|
42
|
+
const signature = value;
|
|
88
43
|
if (signature.type === 'raw') {
|
|
89
44
|
if (typeof signature.value !== 'string') {
|
|
90
45
|
return 'not a valid Mina raw signature';
|
|
@@ -102,7 +57,7 @@ exports.minaValidators = {
|
|
|
102
57
|
}
|
|
103
58
|
return 'not a valid Mina signature type';
|
|
104
59
|
},
|
|
105
|
-
isValidMinaNetworkType:
|
|
60
|
+
isValidMinaNetworkType: (value) => {
|
|
106
61
|
if (!value) {
|
|
107
62
|
return null;
|
|
108
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/validators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../../../src/v1/serializer/v3/validators/validators.ts"],"names":[],"mappings":";;;AAAA,iEAAmE;AAGtD,QAAA,cAAc,GAAG;IAC5B,kBAAkB,EAAE,KAAK,EAAE,KAAc,EAAE,EAAE;QAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,eAAe,CAAA;QACxB,CAAC;QAED,MAAM,QAAQ,GAAG,IAAA,iCAAkB,GAAE,CAAA;QACrC,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAA;QAC7C,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,CAAA;QACvE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;QAElC,MAAM,OAAO,GAAG,KAA6B,CAAA;QAC7C,IAAI,OAAO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;IACb,CAAC;IACD,oBAAoB,EAAE,CAAC,KAAc,EAAE,EAAE;QACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,eAAe,CAAA;QACxB,CAAC;QAED,MAAM,SAAS,GAAG,KAA+B,CAAA;QAEjD,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YAC7B,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACxC,OAAO,gCAAgC,CAAA;YACzC,CAAC;YAED,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAChC,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACxC,OAAO,mCAAmC,CAAA;YAC5C,CAAC;YACD,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACzC,OAAO,mCAAmC,CAAA;YAC5C,CAAC;YAED,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,iCAAiC,CAAA;IAC1C,CAAC;IACD,sBAAsB,EAAE,CAAC,KAAc,EAAE,EAAE;QACzC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,cAAc,CAAA;QACvB,CAAC;QAED,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YAC/C,OAAO,+BAA+B,CAAA;QACxC,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA"}
|
package/v1/types/crypto.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Secp256K1CryptoConfiguration } from '@airgap/module-kit';
|
|
2
|
-
export
|
|
2
|
+
export type MinaCryptoConfiguration = Secp256K1CryptoConfiguration;
|
package/v1/types/protocol.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProtocolNetwork } from '@airgap/module-kit';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type MinaUnits = 'MINA';
|
|
3
|
+
export type MinaNetworkType = 'mainnet' | 'testnet';
|
|
4
4
|
export interface MinaProtocolNetwork extends ProtocolNetwork {
|
|
5
5
|
blockExplorerApi: string;
|
|
6
6
|
minaType: MinaNetworkType;
|
|
@@ -18,7 +18,7 @@ export interface MinaLegacySignature {
|
|
|
18
18
|
field: string;
|
|
19
19
|
scalar: string;
|
|
20
20
|
}
|
|
21
|
-
export
|
|
21
|
+
export type MinaSignature = MinaRawSignature | MinaLegacySignature;
|
|
22
22
|
export interface MinaUnsignedTransaction extends UnsignedTransaction {
|
|
23
23
|
networkType: MinaNetworkType;
|
|
24
24
|
data: MinaPayment;
|
package/v1/utils/key.d.ts
CHANGED