@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airgap/mina",
3
- "version": "0.13.45-beta.1",
3
+ "version": "0.13.45-beta.3",
4
4
  "description": "The @airgap/mina is a Mina implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
5
5
  "keywords": [
6
6
  "airgap",
@@ -30,10 +30,10 @@
30
30
  },
31
31
  "author": "Papers AG <contact@papers.ch> (https://papers.ch)",
32
32
  "dependencies": {
33
- "@airgap/coinlib-core": "^0.13.45-beta.1",
34
- "@airgap/crypto": "^0.13.45-beta.1",
35
- "@airgap/module-kit": "^0.13.45-beta.1",
36
- "@airgap/serializer": "^0.13.45-beta.1",
33
+ "@airgap/coinlib-core": "^0.13.45-beta.3",
34
+ "@airgap/crypto": "^0.13.45-beta.3",
35
+ "@airgap/module-kit": "^0.13.45-beta.3",
36
+ "@airgap/serializer": "^0.13.45-beta.3",
37
37
  "graphql": "^16.7.1",
38
38
  "graphql-request": "^6.1.0",
39
39
  "mina-signer": "^2.0.3"
@@ -1,72 +1,23 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
3
  exports.MinaExplorerBlockExplorer = void 0;
40
- var MinaExplorerBlockExplorer = /** @class */ (function () {
41
- function MinaExplorerBlockExplorer(url) {
4
+ class MinaExplorerBlockExplorer {
5
+ constructor(url) {
42
6
  this.url = url;
43
7
  this.metadata = {
44
8
  name: 'Mina Explorer',
45
9
  url: this.url
46
10
  };
47
11
  }
48
- MinaExplorerBlockExplorer.prototype.getMetadata = function () {
49
- return __awaiter(this, void 0, void 0, function () {
50
- return __generator(this, function (_a) {
51
- return [2 /*return*/, this.metadata];
52
- });
53
- });
54
- };
55
- MinaExplorerBlockExplorer.prototype.createAddressUrl = function (address) {
56
- return __awaiter(this, void 0, void 0, function () {
57
- return __generator(this, function (_a) {
58
- return [2 /*return*/, "".concat(this.url, "/wallet/").concat(address)];
59
- });
60
- });
61
- };
62
- MinaExplorerBlockExplorer.prototype.createTransactionUrl = function (transactionId) {
63
- return __awaiter(this, void 0, void 0, function () {
64
- return __generator(this, function (_a) {
65
- return [2 /*return*/, "".concat(this.url, "/transaction/").concat(transactionId)];
66
- });
67
- });
68
- };
69
- return MinaExplorerBlockExplorer;
70
- }());
12
+ async getMetadata() {
13
+ return this.metadata;
14
+ }
15
+ async createAddressUrl(address) {
16
+ return `${this.url}/wallet/${address}`;
17
+ }
18
+ async createTransactionUrl(transactionId) {
19
+ return `${this.url}/transaction/${transactionId}`;
20
+ }
21
+ }
71
22
  exports.MinaExplorerBlockExplorer = MinaExplorerBlockExplorer;
72
23
  //# sourceMappingURL=MinaExplorerBlockExplorer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MinaExplorerBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/MinaExplorerBlockExplorer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;IACE,mCAAoC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAE9B,aAAQ,GAA0B;YACjD,IAAI,EAAE,eAAe;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IALiD,CAAC;IAMtC,+CAAW,GAAxB;;;gBACE,sBAAO,IAAI,CAAC,QAAQ,EAAA;;;KACrB;IAEY,oDAAgB,GAA7B,UAA8B,OAAe;;;gBAC3C,sBAAO,UAAG,IAAI,CAAC,GAAG,qBAAW,OAAO,CAAE,EAAA;;;KACvC;IAEY,wDAAoB,GAAjC,UAAkC,aAAqB;;;gBACrD,sBAAO,UAAG,IAAI,CAAC,GAAG,0BAAgB,aAAa,CAAE,EAAA;;;KAClD;IACH,gCAAC;AAAD,CAAC,AAlBD,IAkBC;AAlBY,8DAAyB"}
1
+ {"version":3,"file":"MinaExplorerBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/MinaExplorerBlockExplorer.ts"],"names":[],"mappings":";;;AAEA,MAAa,yBAAyB;IACpC,YAAoC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAE9B,aAAQ,GAA0B;YACjD,IAAI,EAAE,eAAe;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IALiD,CAAC;IAM5C,KAAK,CAAC,WAAW;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,OAAe;QAC3C,OAAO,GAAG,IAAI,CAAC,GAAG,WAAW,OAAO,EAAE,CAAA;IACxC,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,aAAqB;QACrD,OAAO,GAAG,IAAI,CAAC,GAAG,gBAAgB,aAAa,EAAE,CAAA;IACnD,CAAC;CACF;AAlBD,8DAkBC"}
package/v1/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createMinaProtocol = exports.MinaModule = void 0;
4
- var MinaModule_1 = require("./module/MinaModule");
4
+ const MinaModule_1 = require("./module/MinaModule");
5
5
  Object.defineProperty(exports, "MinaModule", { enumerable: true, get: function () { return MinaModule_1.MinaModule; } });
6
- var MinaProtocol_1 = require("./protocol/MinaProtocol");
6
+ const MinaProtocol_1 = require("./protocol/MinaProtocol");
7
7
  Object.defineProperty(exports, "createMinaProtocol", { enumerable: true, get: function () { return MinaProtocol_1.createMinaProtocol; } });
8
8
  //# sourceMappingURL=index.js.map
package/v1/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,kDAAgD;AAQvC,2FARA,uBAAU,OAQA;AAPnB,wDAA0E;AAWnD,mGAXd,iCAAkB,OAWc"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAQvC,2FARA,uBAAU,OAQA;AAPnB,0DAA0E;AAWnD,mGAXd,iCAAkB,OAWc"}
@@ -1,116 +1,73 @@
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.MinaExplorerIndexer = void 0;
44
- var graphql_request_1 = require("graphql-request");
45
- var EMPTY_MEMO = 'E4YM2vTHhWEg66xpj52JErHUBU4pZ1yageL4TVDDpTTSsv8mK6YaH';
46
- var MinaExplorerIndexer = /** @class */ (function () {
47
- function MinaExplorerIndexer(url) {
4
+ const graphql_request_1 = require("graphql-request");
5
+ const EMPTY_MEMO = 'E4YM2vTHhWEg66xpj52JErHUBU4pZ1yageL4TVDDpTTSsv8mK6YaH';
6
+ class MinaExplorerIndexer {
7
+ constructor(url) {
48
8
  this.url = url;
49
9
  }
50
- MinaExplorerIndexer.prototype.getTransactions = function (publicKey, limit, dateTimeOffset) {
51
- var _a, _b;
52
- return __awaiter(this, void 0, void 0, function () {
53
- var query, response;
54
- return __generator(this, function (_c) {
55
- switch (_c.label) {
56
- case 0:
57
- query = (0, graphql_request_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query GetTransactions($publicKey: String!, $limit: Int!, $dateTimeOffset: DateTime) {\n transactions(\n limit: $limit\n sortBy: DATETIME_DESC\n query: { canonical: true, OR: [{ to: $publicKey }, { from: $publicKey }], dateTime_lt: $dateTimeOffset }\n ) {\n to\n from\n amount\n fee\n memo\n hash\n dateTime\n failureReason\n }\n }\n "], ["\n query GetTransactions($publicKey: String!, $limit: Int!, $dateTimeOffset: DateTime) {\n transactions(\n limit: $limit\n sortBy: DATETIME_DESC\n query: { canonical: true, OR: [{ to: $publicKey }, { from: $publicKey }], dateTime_lt: $dateTimeOffset }\n ) {\n to\n from\n amount\n fee\n memo\n hash\n dateTime\n failureReason\n }\n }\n "])));
58
- return [4 /*yield*/, (0, graphql_request_1.request)(this.url, query, {
59
- publicKey: publicKey,
60
- limit: limit,
61
- dateTimeOffset: dateTimeOffset !== null && dateTimeOffset !== void 0 ? dateTimeOffset : null
62
- })];
63
- case 1:
64
- response = _c.sent();
65
- return [2 /*return*/, ((_b = (_a = response.transactions) === null || _a === void 0 ? void 0 : _a.map(function (transaction) {
66
- var _a, _b, _c, _d, _e, _f, _g, _h;
67
- return ({
68
- to: (_a = transaction.to) !== null && _a !== void 0 ? _a : '',
69
- from: (_b = transaction.from) !== null && _b !== void 0 ? _b : '',
70
- amount: (_c = transaction.amount) !== null && _c !== void 0 ? _c : 0,
71
- fee: (_d = transaction.fee) !== null && _d !== void 0 ? _d : 0,
72
- memo: transaction.memo && transaction.memo !== EMPTY_MEMO ? transaction.memo : undefined,
73
- kind: (_e = transaction.kind) !== null && _e !== void 0 ? _e : undefined,
74
- hash: (_f = transaction.hash) !== null && _f !== void 0 ? _f : undefined,
75
- dateTime: (_g = transaction.dateTime) !== null && _g !== void 0 ? _g : '',
76
- failureReason: (_h = transaction.failureReason) !== null && _h !== void 0 ? _h : undefined
77
- });
78
- })) !== null && _b !== void 0 ? _b : [])];
79
- }
80
- });
10
+ async getTransactions(publicKey, limit, dateTimeOffset) {
11
+ const query = (0, graphql_request_1.gql) `
12
+ query GetTransactions($publicKey: String!, $limit: Int!, $dateTimeOffset: DateTime) {
13
+ transactions(
14
+ limit: $limit
15
+ sortBy: DATETIME_DESC
16
+ query: { canonical: true, OR: [{ to: $publicKey }, { from: $publicKey }], dateTime_lt: $dateTimeOffset }
17
+ ) {
18
+ to
19
+ from
20
+ amount
21
+ fee
22
+ memo
23
+ hash
24
+ dateTime
25
+ failureReason
26
+ }
27
+ }
28
+ `;
29
+ const response = await (0, graphql_request_1.request)(this.url, query, {
30
+ publicKey,
31
+ limit,
32
+ dateTimeOffset: dateTimeOffset ?? null
81
33
  });
82
- };
83
- MinaExplorerIndexer.prototype.getLatestFees = function (blockSpan) {
84
- var _a, _b, _c, _d;
85
- return __awaiter(this, void 0, void 0, function () {
86
- var blockQuery, blocksResponse, blockHeight, feesQuery, feesResponse;
87
- return __generator(this, function (_e) {
88
- switch (_e.label) {
89
- case 0:
90
- blockQuery = (0, graphql_request_1.gql)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n query GetLatestBlock {\n blocks(limit: 1, sortBy: DATETIME_DESC, query: { canonical: true }) {\n blockHeight\n }\n }\n "], ["\n query GetLatestBlock {\n blocks(limit: 1, sortBy: DATETIME_DESC, query: { canonical: true }) {\n blockHeight\n }\n }\n "])));
91
- return [4 /*yield*/, (0, graphql_request_1.request)(this.url, blockQuery)];
92
- case 1:
93
- blocksResponse = _e.sent();
94
- blockHeight = (_b = ((_a = blocksResponse === null || blocksResponse === void 0 ? void 0 : blocksResponse.blocks) !== null && _a !== void 0 ? _a : [])[0]) === null || _b === void 0 ? void 0 : _b.blockHeight;
95
- if (!blockHeight) {
96
- return [2 /*return*/, []];
97
- }
98
- feesQuery = (0, graphql_request_1.gql)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n query GetFees($minBlockHeight: Int) {\n transactions(sortBy: FEE_ASC, query: { canonical: true, blockHeight_gt: $minBlockHeight }) {\n fee\n }\n }\n "], ["\n query GetFees($minBlockHeight: Int) {\n transactions(sortBy: FEE_ASC, query: { canonical: true, blockHeight_gt: $minBlockHeight }) {\n fee\n }\n }\n "])));
99
- return [4 /*yield*/, (0, graphql_request_1.request)(this.url, feesQuery, {
100
- minBlockHeight: blockHeight - blockSpan
101
- })];
102
- case 2:
103
- feesResponse = _e.sent();
104
- return [2 /*return*/, (_d = (_c = feesResponse.transactions) === null || _c === void 0 ? void 0 : _c.map(function (_a) {
105
- var fee = _a.fee;
106
- return (fee !== null && fee !== void 0 ? fee : 0).toString();
107
- })) !== null && _d !== void 0 ? _d : []];
108
- }
109
- });
34
+ return (response.transactions?.map((transaction) => ({
35
+ to: transaction.to ?? '',
36
+ from: transaction.from ?? '',
37
+ amount: transaction.amount ?? 0,
38
+ fee: transaction.fee ?? 0,
39
+ memo: transaction.memo && transaction.memo !== EMPTY_MEMO ? transaction.memo : undefined,
40
+ kind: transaction.kind ?? undefined,
41
+ hash: transaction.hash ?? undefined,
42
+ dateTime: transaction.dateTime ?? '',
43
+ failureReason: transaction.failureReason ?? undefined
44
+ })) ?? []);
45
+ }
46
+ async getLatestFees(blockSpan) {
47
+ const blockQuery = (0, graphql_request_1.gql) `
48
+ query GetLatestBlock {
49
+ blocks(limit: 1, sortBy: DATETIME_DESC, query: { canonical: true }) {
50
+ blockHeight
51
+ }
52
+ }
53
+ `;
54
+ const blocksResponse = await (0, graphql_request_1.request)(this.url, blockQuery);
55
+ const blockHeight = (blocksResponse?.blocks ?? [])[0]?.blockHeight;
56
+ if (!blockHeight) {
57
+ return [];
58
+ }
59
+ const feesQuery = (0, graphql_request_1.gql) `
60
+ query GetFees($minBlockHeight: Int) {
61
+ transactions(sortBy: FEE_ASC, query: { canonical: true, blockHeight_gt: $minBlockHeight }) {
62
+ fee
63
+ }
64
+ }
65
+ `;
66
+ const feesResponse = await (0, graphql_request_1.request)(this.url, feesQuery, {
67
+ minBlockHeight: blockHeight - blockSpan
110
68
  });
111
- };
112
- return MinaExplorerIndexer;
113
- }());
69
+ return feesResponse.transactions?.map(({ fee }) => (fee ?? 0).toString()) ?? [];
70
+ }
71
+ }
114
72
  exports.MinaExplorerIndexer = MinaExplorerIndexer;
115
- var templateObject_1, templateObject_2, templateObject_3;
116
73
  //# sourceMappingURL=MinaExplorerI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QAC7E,MAAM,WAAW,GAAG,CAAC,cAAc,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,CAAA;QAClE,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO,EAAE,CAAA;QACX,CAAC;QAED,MAAM,SAAS,GAAG,IAAA,qBAAG,EAAA;;;;;;KAMpB,CAAA;QAED,MAAM,YAAY,GAAoB,MAAM,IAAA,yBAAO,EAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE;YACvE,cAAc,EAAE,WAAW,GAAG,SAAS;SACxC,CAAC,CAAA;QAEF,OAAO,YAAY,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;IACjF,CAAC;CACF;AAzED,kDAyEC"}
@@ -1,109 +1,51 @@
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.MinaModule = void 0;
40
- var coinlib_core_1 = require("@airgap/coinlib-core");
41
- var errors_1 = require("@airgap/coinlib-core/errors");
42
- var module_kit_1 = require("@airgap/module-kit");
43
- var MinaExplorerBlockExplorer_1 = require("../block-explorer/MinaExplorerBlockExplorer");
44
- var module_1 = require("../module");
45
- var MinaProtocol_1 = require("../protocol/MinaProtocol");
46
- var serializer_companion_1 = require("../serializer/v3/serializer-companion");
47
- var MinaModule = /** @class */ (function () {
48
- function MinaModule() {
49
- var _a;
50
- var networkRegistry = new module_kit_1.ModuleNetworkRegistry({
4
+ const coinlib_core_1 = require("@airgap/coinlib-core");
5
+ const errors_1 = require("@airgap/coinlib-core/errors");
6
+ const module_kit_1 = require("@airgap/module-kit");
7
+ const MinaExplorerBlockExplorer_1 = require("../block-explorer/MinaExplorerBlockExplorer");
8
+ const module_1 = require("../module");
9
+ const MinaProtocol_1 = require("../protocol/MinaProtocol");
10
+ const serializer_companion_1 = require("../serializer/v3/serializer-companion");
11
+ class MinaModule {
12
+ constructor() {
13
+ const networkRegistry = new module_kit_1.ModuleNetworkRegistry({
51
14
  supportedNetworks: [MinaProtocol_1.MINA_MAINNET_PROTOCOL_NETWORK]
52
15
  });
53
- this.networkRegistries = (_a = {},
54
- _a[coinlib_core_1.MainProtocolSymbols.MINA] = networkRegistry,
55
- _a);
16
+ this.networkRegistries = {
17
+ [coinlib_core_1.MainProtocolSymbols.MINA]: networkRegistry
18
+ };
56
19
  this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
57
20
  }
58
- MinaModule.prototype.createOfflineProtocol = function (identifier) {
59
- return __awaiter(this, void 0, void 0, function () {
60
- return __generator(this, function (_a) {
61
- return [2 /*return*/, this.createProtocol(identifier)];
62
- });
63
- });
64
- };
65
- MinaModule.prototype.createOnlineProtocol = function (identifier, networkOrId) {
66
- var _a;
67
- return __awaiter(this, void 0, void 0, function () {
68
- var network;
69
- return __generator(this, function (_b) {
70
- network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
71
- if (network === undefined) {
72
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.MINA, 'Protocol network type not supported.');
73
- }
74
- return [2 /*return*/, this.createProtocol(identifier, network)];
75
- });
76
- });
77
- };
78
- MinaModule.prototype.createBlockExplorer = function (identifier, networkOrId) {
79
- var _a;
80
- return __awaiter(this, void 0, void 0, function () {
81
- var network;
82
- return __generator(this, function (_b) {
83
- network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
84
- if (network === undefined) {
85
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.MINA, 'Block Explorer network type not supported.');
86
- }
87
- return [2 /*return*/, new MinaExplorerBlockExplorer_1.MinaExplorerBlockExplorer(network.blockExplorerUrl)];
88
- });
89
- });
90
- };
91
- MinaModule.prototype.createV3SerializerCompanion = function () {
92
- return __awaiter(this, void 0, void 0, function () {
93
- return __generator(this, function (_a) {
94
- return [2 /*return*/, new serializer_companion_1.MinaV3SerializerCompanion()];
95
- });
96
- });
97
- };
98
- MinaModule.prototype.createProtocol = function (identifier, network) {
21
+ async createOfflineProtocol(identifier) {
22
+ return this.createProtocol(identifier);
23
+ }
24
+ async createOnlineProtocol(identifier, networkOrId) {
25
+ const network = typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId);
26
+ if (network === undefined) {
27
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.MINA, 'Protocol network type not supported.');
28
+ }
29
+ return this.createProtocol(identifier, network);
30
+ }
31
+ async createBlockExplorer(identifier, networkOrId) {
32
+ const network = typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId);
33
+ if (network === undefined) {
34
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.MINA, 'Block Explorer network type not supported.');
35
+ }
36
+ return new MinaExplorerBlockExplorer_1.MinaExplorerBlockExplorer(network.blockExplorerUrl);
37
+ }
38
+ async createV3SerializerCompanion() {
39
+ return new serializer_companion_1.MinaV3SerializerCompanion();
40
+ }
41
+ createProtocol(identifier, network) {
99
42
  switch (identifier) {
100
43
  case coinlib_core_1.MainProtocolSymbols.MINA:
101
- return (0, module_1.createMinaProtocol)({ network: network });
44
+ return (0, module_1.createMinaProtocol)({ network });
102
45
  default:
103
- throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.MINA, "Protocol ".concat(identifier, " not supported."));
46
+ throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.MINA, `Protocol ${identifier} not supported.`);
104
47
  }
105
- };
106
- return MinaModule;
107
- }());
48
+ }
49
+ }
108
50
  exports.MinaModule = MinaModule;
109
51
  //# sourceMappingURL=MinaModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MinaModule.js","sourceRoot":"","sources":["../../../src/v1/module/MinaModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAkE;AAClE,sDAAqE;AACrE,iDAW2B;AAE3B,yFAAuF;AACvF,oCAA8C;AAC9C,yDAAwE;AACxE,8EAAiF;AAGjF;IAIE;;QACE,IAAM,eAAe,GAA0B,IAAI,kCAAqB,CAAC;YACvE,iBAAiB,EAAE,CAAC,4CAA6B,CAAC;SACnD,CAAC,CAAA;QAEF,IAAI,CAAC,iBAAiB;YACpB,GAAC,kCAAmB,CAAC,IAAI,IAAG,eAAe;eAC5C,CAAA;QACD,IAAI,CAAC,kBAAkB,GAAG,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAC5E,CAAC;IAEY,0CAAqB,GAAlC,UAAmC,UAAkB;;;gBACnD,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,EAAA;;;KACvC;IAEY,yCAAoB,GAAjC,UACE,UAAkB,EAClB,WAA0C;;;;;gBAEpC,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAA;gBAE9G,IAAI,OAAO,KAAK,SAAS,EAAE;oBACzB,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,IAAI,EAAE,sCAAsC,CAAC,CAAA;iBACvF;gBAED,sBAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,EAAA;;;KAChD;IAEY,wCAAmB,GAAhC,UACE,UAAkB,EAClB,WAA0C;;;;;gBAEpC,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,M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qBAAM,CAAC,IAAI,EAAE,YAAY,UAAU,iBAAiB,CAAC,CAAA;QAC3F,CAAC;IACH,CAAC;CACF;AA3DD,gCA2DC"}
package/v1/module.js CHANGED
@@ -14,11 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.create = void 0;
18
- var MinaModule_1 = require("./module/MinaModule");
17
+ exports.create = create;
18
+ const MinaModule_1 = require("./module/MinaModule");
19
19
  __exportStar(require("./index"), exports);
20
20
  function create() {
21
21
  return new MinaModule_1.MinaModule();
22
22
  }
23
- exports.create = create;
24
23
  //# sourceMappingURL=module.js.map
package/v1/module.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,kDAAgD;AAEhD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,uBAAU,EAAE,CAAA;AACzB,CAAC;AAFD,wBAEC"}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,wBAEC;AAND,oDAAgD;AAEhD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,uBAAU,EAAE,CAAA;AACzB,CAAC"}