@cityofzion/bs-ethereum 2.10.0 → 2.12.0

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.
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12
- if (kind === "m") throw new TypeError("Private method is not writable");
13
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
14
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
15
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
16
- };
17
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
19
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
- };
22
- var _FlamingoForthewinEDSNeox_instances, _FlamingoForthewinEDSNeox_network, _FlamingoForthewinEDSNeox_validateNeoXMainnetNetwork;
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.FlamingoForthewinEDSNeox = void 0;
25
- const blockchain_service_1 = require("@cityofzion/blockchain-service");
26
- const BSEthereumHelper_1 = require("../../helpers/BSEthereumHelper");
27
- const BlockscoutBDSEthereum_1 = require("../blockchain-data/BlockscoutBDSEthereum");
28
- class FlamingoForthewinEDSNeox extends blockchain_service_1.FlamingoForthewinEDS {
29
- constructor(network) {
30
- super();
31
- _FlamingoForthewinEDSNeox_instances.add(this);
32
- _FlamingoForthewinEDSNeox_network.set(this, void 0);
33
- __classPrivateFieldSet(this, _FlamingoForthewinEDSNeox_network, network, "f");
34
- }
35
- getTokenPrices({ tokens }) {
36
- const _super = Object.create(null, {
37
- getTokenPrices: { get: () => super.getTokenPrices }
38
- });
39
- return __awaiter(this, void 0, void 0, function* () {
40
- __classPrivateFieldGet(this, _FlamingoForthewinEDSNeox_instances, "m", _FlamingoForthewinEDSNeox_validateNeoXMainnetNetwork).call(this);
41
- const gasToken = tokens.find(({ symbol }) => symbol === 'GAS');
42
- const neoToken = tokens.find(({ symbol }) => symbol === 'NEO');
43
- if (!gasToken && !neoToken)
44
- return [];
45
- return yield _super.getTokenPrices.call(this, {
46
- tokens: tokens.filter(({ symbol }) => symbol === 'GAS' || symbol === 'NEO'),
47
- });
48
- });
49
- }
50
- getTokenPriceHistory(params) {
51
- const _super = Object.create(null, {
52
- getTokenPriceHistory: { get: () => super.getTokenPriceHistory }
53
- });
54
- return __awaiter(this, void 0, void 0, function* () {
55
- __classPrivateFieldGet(this, _FlamingoForthewinEDSNeox_instances, "m", _FlamingoForthewinEDSNeox_validateNeoXMainnetNetwork).call(this);
56
- const { symbol } = params.token;
57
- if (symbol !== 'GAS' && symbol !== 'NEO')
58
- throw new Error('Invalid token, it should be GAS or NEO');
59
- return yield _super.getTokenPriceHistory.call(this, params);
60
- });
61
- }
62
- }
63
- exports.FlamingoForthewinEDSNeox = FlamingoForthewinEDSNeox;
64
- _FlamingoForthewinEDSNeox_network = new WeakMap(), _FlamingoForthewinEDSNeox_instances = new WeakSet(), _FlamingoForthewinEDSNeox_validateNeoXMainnetNetwork = function _FlamingoForthewinEDSNeox_validateNeoXMainnetNetwork() {
65
- if (!BlockscoutBDSEthereum_1.BlockscoutBDSEthereum.isNeoX(__classPrivateFieldGet(this, _FlamingoForthewinEDSNeox_network, "f")) || !BSEthereumHelper_1.BSEthereumHelper.isMainnet(__classPrivateFieldGet(this, _FlamingoForthewinEDSNeox_network, "f")))
66
- throw new Error('Exchange is only available on Neo X Mainnet');
67
- };