@airgap/mina 0.13.45-beta.2 → 0.13.45-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +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
package/v1/node/GraphQLNode.js
CHANGED
|
@@ -1,115 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
16
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
17
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
18
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
19
|
-
function step(op) {
|
|
20
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
21
|
-
while (_) try {
|
|
22
|
-
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;
|
|
23
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
24
|
-
switch (op[0]) {
|
|
25
|
-
case 0: case 1: t = op; break;
|
|
26
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
27
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
28
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
29
|
-
default:
|
|
30
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
31
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
32
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
33
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
34
|
-
if (t[2]) _.ops.pop();
|
|
35
|
-
_.trys.pop(); continue;
|
|
36
|
-
}
|
|
37
|
-
op = body.call(thisArg, _);
|
|
38
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
39
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
3
|
exports.GraphQLNode = void 0;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
4
|
+
const graphql_request_1 = require("graphql-request");
|
|
5
|
+
class GraphQLNode {
|
|
6
|
+
constructor(url) {
|
|
47
7
|
this.url = url;
|
|
48
8
|
}
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
9
|
+
async getNonce(publicKey) {
|
|
10
|
+
const query = (0, graphql_request_1.gql) `
|
|
11
|
+
query AccountNonce($publicKey: PublicKey!) {
|
|
12
|
+
account(publicKey: $publicKey) {
|
|
13
|
+
nonce
|
|
14
|
+
inferredNonce
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
const response = await (0, graphql_request_1.request)(this.url, query, { publicKey });
|
|
19
|
+
return response.account?.inferredNonce ?? response.account?.nonce ?? '0';
|
|
20
|
+
}
|
|
21
|
+
async getBalance(publicKey) {
|
|
22
|
+
const query = (0, graphql_request_1.gql) `
|
|
23
|
+
query AccountBalance($publicKey: PublicKey!) {
|
|
24
|
+
account(publicKey: $publicKey) {
|
|
25
|
+
balance {
|
|
26
|
+
total
|
|
27
|
+
liquid
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const response = await (0, graphql_request_1.request)(this.url, query, { publicKey });
|
|
33
|
+
return {
|
|
34
|
+
total: response.account?.balance?.total ?? '0',
|
|
35
|
+
liquid: response.account?.balance?.liquid ?? '0'
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async sendTransaction(payment, signature) {
|
|
39
|
+
const mutation = (0, graphql_request_1.gql) `
|
|
40
|
+
mutation SendTransaction(
|
|
41
|
+
$to: PublicKey!
|
|
42
|
+
$from: PublicKey!
|
|
43
|
+
$amount: UInt64!
|
|
44
|
+
$fee: UInt64!
|
|
45
|
+
$nonce: UInt32!
|
|
46
|
+
$memo: String
|
|
47
|
+
$validUntil: UInt32
|
|
48
|
+
$rawSignature: String
|
|
49
|
+
$field: String
|
|
50
|
+
$scalar: String
|
|
51
|
+
) {
|
|
52
|
+
sendPayment(
|
|
53
|
+
input: { to: $to, from: $from, amount: $amount, fee: $fee, nonce: $nonce, memo: $memo, validUntil: $validUntil }
|
|
54
|
+
signature: { rawSignature: $rawSignature, field: $field, scalar: $scalar }
|
|
55
|
+
) {
|
|
56
|
+
payment {
|
|
57
|
+
hash
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
const response = await (0, graphql_request_1.request)(this.url, mutation, {
|
|
63
|
+
to: payment.to,
|
|
64
|
+
from: payment.from,
|
|
65
|
+
amount: payment.amount,
|
|
66
|
+
fee: payment.fee,
|
|
67
|
+
nonce: payment.nonce,
|
|
68
|
+
memo: payment.memo ?? null,
|
|
69
|
+
validUntil: payment.validUntil ?? null,
|
|
70
|
+
rawSignature: signature.type === 'raw' ? signature.value : null,
|
|
71
|
+
field: signature.type === 'legacy' ? signature.field : null,
|
|
72
|
+
scalar: signature.type === 'legacy' ? signature.scalar : null
|
|
109
73
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
74
|
+
return response.sendPayment?.payment?.hash ?? '';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
113
77
|
exports.GraphQLNode = GraphQLNode;
|
|
114
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
115
78
|
//# sourceMappingURL=GraphQLNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphQLNode.js","sourceRoot":"","sources":["../../../src/v1/node/GraphQLNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GraphQLNode.js","sourceRoot":"","sources":["../../../src/v1/node/GraphQLNode.ts"],"names":[],"mappings":";;;AAAA,qDAA8C;AA4B9C,MAAa,WAAW;IACtB,YAAoC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IAAG,CAAC;IAE5C,KAAK,CAAC,QAAQ,CAAC,SAAiB;QACrC,MAAM,KAAK,GAAG,IAAA,qBAAG,EAAA;;;;;;;KAOhB,CAAA;Q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