@airgap/stellar 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 +4 -4
- package/v1/block-explorer/StellarBlockExplorer.js +12 -61
- package/v1/block-explorer/StellarBlockExplorer.js.map +1 -1
- package/v1/data/StellarAddress.js +13 -14
- package/v1/data/StellarAddress.js.map +1 -1
- package/v1/index.js +4 -4
- package/v1/index.js.map +1 -1
- package/v1/module/StellarModule.js +41 -110
- package/v1/module/StellarModule.js.map +1 -1
- package/v1/module.js +2 -3
- package/v1/module.js.map +1 -1
- package/v1/protocol/StellarProtocol.js +591 -859
- package/v1/protocol/StellarProtocol.js.map +1 -1
- package/v1/protocol/stellarAssets/StellarAsset.js +259 -466
- package/v1/protocol/stellarAssets/StellarAsset.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 +61 -134
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +14 -61
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
- package/v1/serializer/v3/validators/validators.js +18 -62
- 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/protocol.js +2 -2
- package/v1/types/protocol.js.map +1 -1
- package/v1/utils/convert.js +6 -7
- package/v1/utils/convert.js.map +1 -1
- package/v1/utils/key.js +9 -10
- package/v1/utils/key.js.map +1 -1
- package/v1/utils/signature.js +4 -5
- package/v1/utils/signature.js.map +1 -1
- package/v1/utils/transaction.d.ts +0 -1
- package/v1/utils/transaction.js +9 -10
- package/v1/utils/transaction.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airgap/stellar",
|
|
3
|
-
"version": "0.13.45-beta.
|
|
3
|
+
"version": "0.13.45-beta.3",
|
|
4
4
|
"description": "The @airgap/aeternity is an Aeternity implementation of the ICoinProtocol interface from @airgap/coinlib-core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"airgap",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"author": "Papers AG <contact@papers.ch> (https://papers.ch)",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@airgap/coinlib-core": "^0.13.45-beta.
|
|
34
|
-
"@airgap/module-kit": "^0.13.45-beta.
|
|
35
|
-
"@airgap/serializer": "^0.13.45-beta.
|
|
33
|
+
"@airgap/coinlib-core": "^0.13.45-beta.3",
|
|
34
|
+
"@airgap/module-kit": "^0.13.45-beta.3",
|
|
35
|
+
"@airgap/serializer": "^0.13.45-beta.3",
|
|
36
36
|
"@stellar/stellar-sdk": "^13.3.0"
|
|
37
37
|
},
|
|
38
38
|
"localDependencies": {},
|
|
@@ -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.StellarBlockExplorer = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
4
|
+
class StellarBlockExplorer {
|
|
5
|
+
constructor(url) {
|
|
42
6
|
this.url = url;
|
|
43
7
|
this.metadata = {
|
|
44
8
|
name: 'Stellar Explorer',
|
|
45
9
|
url: this.url
|
|
46
10
|
};
|
|
47
11
|
}
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return [2 /*return*/, "".concat(this.url, "/account/").concat(address)];
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
StellarBlockExplorer.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, "/tx/").concat(transactionId)];
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
return StellarBlockExplorer;
|
|
70
|
-
}());
|
|
12
|
+
async getMetadata() {
|
|
13
|
+
return this.metadata;
|
|
14
|
+
}
|
|
15
|
+
async createAddressUrl(address) {
|
|
16
|
+
return `${this.url}/account/${address}`;
|
|
17
|
+
}
|
|
18
|
+
async createTransactionUrl(transactionId) {
|
|
19
|
+
return `${this.url}/tx/${transactionId}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
71
22
|
exports.StellarBlockExplorer = StellarBlockExplorer;
|
|
72
23
|
//# sourceMappingURL=StellarBlockExplorer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StellarBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/StellarBlockExplorer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StellarBlockExplorer.js","sourceRoot":"","sources":["../../../src/v1/block-explorer/StellarBlockExplorer.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IAC/B,YAAmC,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAE7B,aAAQ,GAA0B;YACjD,IAAI,EAAE,kBAAkB;YACxB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAA;IALgD,CAAC;IAO3C,KAAK,CAAC,WAAW;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,OAAe;QAC3C,OAAO,GAAG,IAAI,CAAC,GAAG,YAAY,OAAO,EAAE,CAAA;IACzC,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,aAAqB;QACrD,OAAO,GAAG,IAAI,CAAC,GAAG,OAAO,aAAa,EAAE,CAAA;IAC1C,CAAC;CACF;AAnBD,oDAmBC"}
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StellarAddress = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const module_kit_1 = require("@airgap/module-kit");
|
|
5
|
+
const stellar_sdk_1 = require("@stellar/stellar-sdk");
|
|
6
|
+
class StellarAddress {
|
|
7
|
+
constructor(value) {
|
|
8
8
|
this.value = value;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
static from(publicKey) {
|
|
11
11
|
if (stellar_sdk_1.StrKey.isValidEd25519PublicKey(publicKey.value)) {
|
|
12
12
|
return new StellarAddress(publicKey.value);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const rawPublicKey = Buffer.from(publicKey.value, 'hex');
|
|
15
|
+
const stellarAddress = stellar_sdk_1.StrKey.encodeEd25519PublicKey(rawPublicKey);
|
|
16
16
|
return new StellarAddress(stellarAddress);
|
|
17
|
-
}
|
|
18
|
-
|
|
17
|
+
}
|
|
18
|
+
asString() {
|
|
19
19
|
return this.value;
|
|
20
|
-
}
|
|
21
|
-
|
|
20
|
+
}
|
|
21
|
+
toPublicKey() {
|
|
22
22
|
return (0, module_kit_1.newPublicKey)(this.value, 'encoded');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
}());
|
|
23
|
+
}
|
|
24
|
+
}
|
|
26
25
|
exports.StellarAddress = StellarAddress;
|
|
27
26
|
//# sourceMappingURL=StellarAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StellarAddress.js","sourceRoot":"","sources":["../../../src/v1/data/StellarAddress.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"StellarAddress.js","sourceRoot":"","sources":["../../../src/v1/data/StellarAddress.ts"],"names":[],"mappings":";;;AAAA,mDAA4D;AAE5D,sDAA6C;AAE7C,MAAa,cAAc;IACzB,YAAqC,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAE/C,MAAM,CAAC,IAAI,CAAC,SAAoB;QACrC,IAAI,oBAAM,CAAC,uBAAuB,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YACpD,OAAO,IAAI,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QAC5C,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAExD,MAAM,cAAc,GAAG,oBAAM,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAA;QAElE,OAAO,IAAI,cAAc,CAAC,cAAc,CAAC,CAAA;IAC3C,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAEM,WAAW;QAChB,OAAO,IAAA,yBAAY,EAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IAC5C,CAAC;CACF;AAtBD,wCAsBC"}
|
package/v1/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StellarBlockExplorer = exports.createStellarAssetProtocol = exports.createStellarProtocolOptions = exports.createStellarProtocol = exports.StellarModule = void 0;
|
|
4
|
-
|
|
4
|
+
const StellarBlockExplorer_1 = require("./block-explorer/StellarBlockExplorer");
|
|
5
5
|
Object.defineProperty(exports, "StellarBlockExplorer", { enumerable: true, get: function () { return StellarBlockExplorer_1.StellarBlockExplorer; } });
|
|
6
|
-
|
|
6
|
+
const StellarModule_1 = require("./module/StellarModule");
|
|
7
7
|
Object.defineProperty(exports, "StellarModule", { enumerable: true, get: function () { return StellarModule_1.StellarModule; } });
|
|
8
|
-
|
|
8
|
+
const StellarAsset_1 = require("./protocol/stellarAssets/StellarAsset");
|
|
9
9
|
Object.defineProperty(exports, "createStellarAssetProtocol", { enumerable: true, get: function () { return StellarAsset_1.createStellarAssetProtocol; } });
|
|
10
|
-
|
|
10
|
+
const StellarProtocol_1 = require("./protocol/StellarProtocol");
|
|
11
11
|
Object.defineProperty(exports, "createStellarProtocol", { enumerable: true, get: function () { return StellarProtocol_1.createStellarProtocol; } });
|
|
12
12
|
Object.defineProperty(exports, "createStellarProtocolOptions", { enumerable: true, get: function () { return StellarProtocol_1.createStellarProtocolOptions; } });
|
|
13
13
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v1/index.ts"],"names":[],"mappings":";;;AAAA,gFAA4E;AAoBnE,qGApBA,2CAAoB,OAoBA;AAnB7B,0DAAsD;AAW7C,8FAXA,6BAAa,OAWA;AAVtB,wEAAwG;AAczB,2GAdtE,yCAA0B,OAcsE;AAbzG,gEAAiH;AAavF,sGAbA,uCAAqB,OAaA;AAAE,6GAbA,8CAA4B,OAaA"}
|
|
@@ -1,124 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
3
|
exports.StellarModule = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var stellarNetworkRegistry = new module_kit_1.ModuleNetworkRegistry({
|
|
4
|
+
const module_kit_1 = require("@airgap/module-kit");
|
|
5
|
+
const coinlib_core_1 = require("@airgap/coinlib-core");
|
|
6
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
7
|
+
const StellarBlockExplorer_1 = require("../block-explorer/StellarBlockExplorer");
|
|
8
|
+
const StellarProtocol_1 = require("../protocol/StellarProtocol");
|
|
9
|
+
const serializer_companion_1 = require("../serializer/v3/serializer-companion");
|
|
10
|
+
const StellarAssets_1 = require("./StellarAssets");
|
|
11
|
+
const StellarAsset_1 = require("../protocol/stellarAssets/StellarAsset");
|
|
12
|
+
class StellarModule {
|
|
13
|
+
constructor() {
|
|
14
|
+
const stellarNetworkRegistry = new module_kit_1.ModuleNetworkRegistry({
|
|
63
15
|
supportedNetworks: [StellarProtocol_1.STELLAR_MAINNET_PROTOCOL_NETWORK]
|
|
64
16
|
});
|
|
65
|
-
this.networkRegistries =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
17
|
+
this.networkRegistries = {
|
|
18
|
+
[coinlib_core_1.MainProtocolSymbols.STELLAR]: stellarNetworkRegistry,
|
|
19
|
+
...StellarAssets_1.stellarAssetsIdentifiers.reduce((obj, next) => Object.assign(obj, { [next]: stellarNetworkRegistry }), {})
|
|
20
|
+
};
|
|
69
21
|
this.supportedProtocols = (0, module_kit_1.createSupportedProtocols)(this.networkRegistries);
|
|
70
22
|
}
|
|
71
|
-
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
var _a;
|
|
93
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
-
var network;
|
|
95
|
-
return __generator(this, function (_b) {
|
|
96
|
-
network = typeof networkOrId === 'object' ? networkOrId : (_a = this.networkRegistries[identifier]) === null || _a === void 0 ? void 0 : _a.findNetwork(networkOrId);
|
|
97
|
-
if (network === undefined) {
|
|
98
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.STELLAR, 'Block Explorer network not supported.');
|
|
99
|
-
}
|
|
100
|
-
return [2 /*return*/, new StellarBlockExplorer_1.StellarBlockExplorer(network.blockExplorerUrl)];
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
StellarModule.prototype.createV3SerializerCompanion = function () {
|
|
105
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
return __generator(this, function (_a) {
|
|
107
|
-
return [2 /*return*/, new serializer_companion_1.StellarV3SerializerCompanion()];
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
StellarModule.prototype.createProtocol = function (identifier, network) {
|
|
23
|
+
async createOfflineProtocol(identifier) {
|
|
24
|
+
return this.createProtocol(identifier);
|
|
25
|
+
}
|
|
26
|
+
async createOnlineProtocol(identifier, networkOrId) {
|
|
27
|
+
const network = typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId);
|
|
28
|
+
if (network === undefined) {
|
|
29
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.STELLAR, 'Protocol network not supported.');
|
|
30
|
+
}
|
|
31
|
+
return this.createProtocol(identifier, network);
|
|
32
|
+
}
|
|
33
|
+
async createBlockExplorer(identifier, networkOrId) {
|
|
34
|
+
const network = typeof networkOrId === 'object' ? networkOrId : this.networkRegistries[identifier]?.findNetwork(networkOrId);
|
|
35
|
+
if (network === undefined) {
|
|
36
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.STELLAR, 'Block Explorer network not supported.');
|
|
37
|
+
}
|
|
38
|
+
return new StellarBlockExplorer_1.StellarBlockExplorer(network.blockExplorerUrl);
|
|
39
|
+
}
|
|
40
|
+
async createV3SerializerCompanion() {
|
|
41
|
+
return new serializer_companion_1.StellarV3SerializerCompanion();
|
|
42
|
+
}
|
|
43
|
+
createProtocol(identifier, network) {
|
|
112
44
|
if (identifier === coinlib_core_1.MainProtocolSymbols.STELLAR) {
|
|
113
|
-
return (0, StellarProtocol_1.createStellarProtocol)({ network
|
|
45
|
+
return (0, StellarProtocol_1.createStellarProtocol)({ network });
|
|
114
46
|
}
|
|
115
47
|
if (StellarAssets_1.stellarAssets[identifier] !== undefined) {
|
|
116
|
-
|
|
48
|
+
const tokenMetadata = StellarAssets_1.stellarAssets[identifier];
|
|
117
49
|
return (0, StellarAsset_1.createStellarAssetProtocol)(tokenMetadata);
|
|
118
50
|
}
|
|
119
|
-
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SERIALIZER,
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
}());
|
|
51
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.SERIALIZER, `Protocol ${identifier} not supported.`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
123
54
|
exports.StellarModule = StellarModule;
|
|
124
55
|
//# sourceMappingURL=StellarModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StellarModule.js","sourceRoot":"","sources":["../../../src/v1/module/StellarModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StellarModule.js","sourceRoot":"","sources":["../../../src/v1/module/StellarModule.ts"],"names":[],"mappings":";;;AAAA,mDAW2B;AAC3B,uDAAkE;AAClE,wDAAqE;AAErE,iFAA6E;AAC7E,iEAAqG;AACrG,gFAAoF;AAEpF,mDAAyE;AACzE,yEAAmF;AAEnF,MAAa,aAAa;IAIxB;QACE,MAAM,sBAAsB,GAAkD,IAAI,kCAAqB,CAAC;YACtG,iBAAiB,EAAE,CAAC,kDAAgC,CAAC;SACtD,CAAC,CAAA;QAEF,IAAI,CAAC,iBAAiB,GAAG;YACvB,CAAC,kCAAmB,CAAC,OAAO,CAAC,EAAE,sBAAsB;YACrD,GAAG,wCAAwB,CAAC,MAAM,CAChC,CAAC,GAA0C,EAAE,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,sBAAsB,EAAE,CAAC,EACpH,EAAE,CACH;SACF,CAAA;QAED,IAAI,CAAC,kBAAkB,GAAG,IAAA,qCAAwB,EAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAC5E,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAAC,UAAkB;QACnD,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAA;IACxC,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAC/B,UAAkB,EAClB,WAA6C;QAE7C,MAAM,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;QAE9G,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,OAAO,EAAE,iCAAiC,CAAC,CAAA;QACtF,CAAC;QAED,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,UAAkB,EAClB,WAA6C;QAE7C,MAAM,OAAO,GACX,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;QAE9G,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,OAAO,EAAE,uCAAuC,CAAC,CAAA;QAC5F,CAAC;QAED,OAAO,IAAI,2CAAoB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC3D,CAAC;IAEM,KAAK,CAAC,2BAA2B;QACtC,OAAO,IAAI,mDAA4B,EAAE,CAAA;IAC3C,CAAC;IAEO,cAAc,CAAC,UAAkB,EAAE,OAAyB;QAClE,IAAI,UAAU,KAAK,kCAAmB,CAAC,OAAO,EAAE,CAAC;YAC/C,OAAO,IAAA,uCAAqB,EAAC,EAAE,OAAO,EAAE,CAAC,CAAA;QAC3C,CAAC;QAED,IAAI,6BAAa,CAAC,UAAU,CAAC,KAAK,SAAS,EAAE,CAAC;YAC5C,MAAM,aAAa,GAAyB,6BAAa,CAAC,UAAU,CAAC,CAAA;YAErE,OAAO,IAAA,yCAA0B,EAAC,aAAa,CAAC,CAAA;QAClD,CAAC;QAED,MAAM,IAAI,gCAAuB,CAAC,qBAAM,CAAC,UAAU,EAAE,YAAY,UAAU,iBAAiB,CAAC,CAAA;IAC/F,CAAC;CACF;AArED,sCAqEC"}
|
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 =
|
|
18
|
-
|
|
17
|
+
exports.create = create;
|
|
18
|
+
const StellarModule_1 = require("./module/StellarModule");
|
|
19
19
|
__exportStar(require("./index"), exports);
|
|
20
20
|
function create() {
|
|
21
21
|
return new StellarModule_1.StellarModule();
|
|
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":"
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/v1/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,wBAEC;AAND,0DAAsD;AAEtD,0CAAuB;AAEvB,SAAgB,MAAM;IACpB,OAAO,IAAI,6BAAa,EAAE,CAAA;AAC5B,CAAC"}
|