@cityofzion/bs-neo3 1.10.4 → 1.10.6
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/dist/BSNeo3.d.ts +1 -0
- package/dist/BSNeo3.js +3 -2
- package/dist/assets/tokens/mainnet.json +18 -0
- package/dist/constants/BSNeo3Constants.d.ts +1 -0
- package/dist/constants/BSNeo3Constants.js +2 -0
- package/dist/helpers/BSNeo3Helper.d.ts +6 -1
- package/dist/helpers/BSNeo3Helper.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/services/exchange-data/{FlamingoEDSNeo3.d.ts → FlamingoForthewinEDSNeo3.d.ts} +2 -2
- package/dist/services/exchange-data/{FlamingoEDSNeo3.js → FlamingoForthewinEDSNeo3.js} +36 -22
- package/package.json +2 -2
- /package/dist/assets/tokens/{common.json → native.json} +0 -0
package/dist/BSNeo3.d.ts
CHANGED
package/dist/BSNeo3.js
CHANGED
|
@@ -21,7 +21,7 @@ const neon_dappkit_1 = require("@cityofzion/neon-dappkit");
|
|
|
21
21
|
const neon_js_1 = require("@cityofzion/neon-js");
|
|
22
22
|
const BSNeo3Helper_1 = require("./helpers/BSNeo3Helper");
|
|
23
23
|
const DoraBDSNeo3_1 = require("./services/blockchain-data/DoraBDSNeo3");
|
|
24
|
-
const
|
|
24
|
+
const FlamingoForthewinEDSNeo3_1 = require("./services/exchange-data/FlamingoForthewinEDSNeo3");
|
|
25
25
|
const DoraESNeo3_1 = require("./services/explorer/DoraESNeo3");
|
|
26
26
|
const NeonDappKitLedgerServiceNeo3_1 = require("./services/ledger/NeonDappKitLedgerServiceNeo3");
|
|
27
27
|
const GhostMarketNDSNeo3_1 = require("./services/nft-data/GhostMarketNDSNeo3");
|
|
@@ -66,7 +66,7 @@ class BSNeo3 {
|
|
|
66
66
|
__classPrivateFieldGet(this, _BSNeo3_instances, "m", _BSNeo3_setTokens).call(this, network);
|
|
67
67
|
this.network = network;
|
|
68
68
|
this.blockchainDataService = new DoraBDSNeo3_1.DoraBDSNeo3(network, this.feeToken, this.claimToken, this.tokens);
|
|
69
|
-
this.exchangeDataService = new
|
|
69
|
+
this.exchangeDataService = new FlamingoForthewinEDSNeo3_1.FlamingoForthewinEDSNeo3(network);
|
|
70
70
|
this.nftDataService = new GhostMarketNDSNeo3_1.GhostMarketNDSNeo3(network);
|
|
71
71
|
this.explorerService = new DoraESNeo3_1.DoraESNeo3(network);
|
|
72
72
|
}
|
|
@@ -186,6 +186,7 @@ class BSNeo3 {
|
|
|
186
186
|
exports.BSNeo3 = BSNeo3;
|
|
187
187
|
_BSNeo3_instances = new WeakSet(), _BSNeo3_setTokens = function _BSNeo3_setTokens(network) {
|
|
188
188
|
const tokens = BSNeo3Helper_1.BSNeo3Helper.getTokens(network);
|
|
189
|
+
this.nativeTokens = BSNeo3Constants_1.BSNeo3Constants.NATIVE_ASSETS;
|
|
189
190
|
this.tokens = tokens;
|
|
190
191
|
this.feeToken = tokens.find(token => token.symbol === 'GAS');
|
|
191
192
|
this.burnToken = tokens.find(token => token.symbol === 'NEO');
|
|
@@ -172,5 +172,23 @@
|
|
|
172
172
|
"hash": "0x9770f4d78a19d1a6fa94b472bcedffcc06b56c49",
|
|
173
173
|
"decimals": 8,
|
|
174
174
|
"name": "FDE"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"symbol": "Hood",
|
|
178
|
+
"hash": "0xc8d56cac2dd82e2da605ccae6865a99da491b97e",
|
|
179
|
+
"decimals": 8,
|
|
180
|
+
"name": "RobinHood"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"symbol": "HD",
|
|
184
|
+
"hash": "0x4b027a8320d5705802e5efbb51f6231ebf412cf6",
|
|
185
|
+
"decimals": 8,
|
|
186
|
+
"name": "The Hongfei"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"symbol": "NRP",
|
|
190
|
+
"hash": "0x789518aa302b571e3e825f2c85a01ad731014a45",
|
|
191
|
+
"decimals": 8,
|
|
192
|
+
"name": "NeoRedPill"
|
|
175
193
|
}
|
|
176
194
|
]
|
|
@@ -6,6 +6,7 @@ var _a;
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.BSNeo3Constants = void 0;
|
|
8
8
|
const mainnet_json_1 = __importDefault(require("../assets/tokens/mainnet.json"));
|
|
9
|
+
const native_json_1 = __importDefault(require("../assets/tokens/native.json"));
|
|
9
10
|
class BSNeo3Constants {
|
|
10
11
|
}
|
|
11
12
|
exports.BSNeo3Constants = BSNeo3Constants;
|
|
@@ -57,3 +58,4 @@ BSNeo3Constants.ALL_NETWORKS = [..._a.MAINNET_NETWORKS, ..._a.TESTNET_NETWORKS];
|
|
|
57
58
|
BSNeo3Constants.DEFAULT_NETWORK = _a.MAINNET_NETWORKS[0];
|
|
58
59
|
BSNeo3Constants.NEO_NS_HASH = '0x50ac1c37690cc2cfc594472833cf57505d5f46de';
|
|
59
60
|
BSNeo3Constants.DEFAULT_BIP44_DERIVATION_PATH = "m/44'/888'/0'/0/?";
|
|
61
|
+
BSNeo3Constants.NATIVE_ASSETS = native_json_1.default;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { Network } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeo3NetworkId } from '../constants/BSNeo3Constants';
|
|
3
3
|
export declare class BSNeo3Helper {
|
|
4
|
-
static getTokens(network: Network<BSNeo3NetworkId>):
|
|
4
|
+
static getTokens(network: Network<BSNeo3NetworkId>): {
|
|
5
|
+
symbol: string;
|
|
6
|
+
name: string;
|
|
7
|
+
hash: string;
|
|
8
|
+
decimals: number;
|
|
9
|
+
}[];
|
|
5
10
|
static getRpcList(network: Network<BSNeo3NetworkId>): string[];
|
|
6
11
|
static isMainnet(network: Network<BSNeo3NetworkId>): boolean;
|
|
7
12
|
static isCustomNet(network: Network<BSNeo3NetworkId>): boolean;
|
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BSNeo3Helper = void 0;
|
|
7
|
-
const
|
|
7
|
+
const native_json_1 = __importDefault(require("../assets/tokens/native.json"));
|
|
8
8
|
const BSNeo3Constants_1 = require("../constants/BSNeo3Constants");
|
|
9
9
|
class BSNeo3Helper {
|
|
10
10
|
static getTokens(network) {
|
|
11
11
|
var _a;
|
|
12
12
|
const extraTokens = (_a = BSNeo3Constants_1.BSNeo3Constants.EXTRA_TOKENS_BY_NETWORK_ID[network.id]) !== null && _a !== void 0 ? _a : [];
|
|
13
|
-
return [...extraTokens, ...
|
|
13
|
+
return [...extraTokens, ...native_json_1.default];
|
|
14
14
|
}
|
|
15
15
|
static getRpcList(network) {
|
|
16
16
|
var _a;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from './constants/BSNeo3Constants';
|
|
|
3
3
|
export * from './helpers/BSNeo3Helper';
|
|
4
4
|
export * from './services/blockchain-data/DoraBDSNeo3';
|
|
5
5
|
export * from './services/blockchain-data/RpcBDSNeo3';
|
|
6
|
-
export * from './services/exchange-data/
|
|
6
|
+
export * from './services/exchange-data/FlamingoForthewinEDSNeo3';
|
|
7
7
|
export * from './services/explorer/DoraESNeo3';
|
|
8
8
|
export * from './services/ledger/NeonDappKitLedgerServiceNeo3';
|
|
9
9
|
export * from './services/nft-data/GhostMarketNDSNeo3';
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ __exportStar(require("./constants/BSNeo3Constants"), exports);
|
|
|
19
19
|
__exportStar(require("./helpers/BSNeo3Helper"), exports);
|
|
20
20
|
__exportStar(require("./services/blockchain-data/DoraBDSNeo3"), exports);
|
|
21
21
|
__exportStar(require("./services/blockchain-data/RpcBDSNeo3"), exports);
|
|
22
|
-
__exportStar(require("./services/exchange-data/
|
|
22
|
+
__exportStar(require("./services/exchange-data/FlamingoForthewinEDSNeo3"), exports);
|
|
23
23
|
__exportStar(require("./services/explorer/DoraESNeo3"), exports);
|
|
24
24
|
__exportStar(require("./services/ledger/NeonDappKitLedgerServiceNeo3"), exports);
|
|
25
25
|
__exportStar(require("./services/nft-data/GhostMarketNDSNeo3"), exports);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CryptoCompareEDS, ExchangeDataService, GetTokenPriceHistoryParams, GetTokenPricesParams, Network, TokenPricesHistoryResponse, TokenPricesResponse } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeo3NetworkId } from '../../constants/BSNeo3Constants';
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class FlamingoForthewinEDSNeo3 extends CryptoCompareEDS implements ExchangeDataService {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(network: Network<BSNeo3NetworkId>);
|
|
6
|
-
getTokenPrices(
|
|
6
|
+
getTokenPrices({ tokens }: GetTokenPricesParams): Promise<TokenPricesResponse[]>;
|
|
7
7
|
getTokenPriceHistory(params: GetTokenPriceHistoryParams): Promise<TokenPricesHistoryResponse[]>;
|
|
8
8
|
}
|
|
@@ -22,42 +22,56 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
22
22
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
|
-
var
|
|
25
|
+
var _FlamingoForthewinEDSNeo3_network, _FlamingoForthewinEDSNeo3_flamingoAxiosInstance, _FlamingoForthewinEDSNeo3_forthewinAxiosInstance;
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.
|
|
27
|
+
exports.FlamingoForthewinEDSNeo3 = void 0;
|
|
28
28
|
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
29
29
|
const axios_1 = __importDefault(require("axios"));
|
|
30
30
|
const BSNeo3Helper_1 = require("../../helpers/BSNeo3Helper");
|
|
31
|
-
class
|
|
31
|
+
class FlamingoForthewinEDSNeo3 extends blockchain_service_1.CryptoCompareEDS {
|
|
32
32
|
constructor(network) {
|
|
33
33
|
super();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
__classPrivateFieldSet(this,
|
|
38
|
-
__classPrivateFieldSet(this,
|
|
34
|
+
_FlamingoForthewinEDSNeo3_network.set(this, void 0);
|
|
35
|
+
_FlamingoForthewinEDSNeo3_flamingoAxiosInstance.set(this, void 0);
|
|
36
|
+
_FlamingoForthewinEDSNeo3_forthewinAxiosInstance.set(this, void 0);
|
|
37
|
+
__classPrivateFieldSet(this, _FlamingoForthewinEDSNeo3_network, network, "f");
|
|
38
|
+
__classPrivateFieldSet(this, _FlamingoForthewinEDSNeo3_flamingoAxiosInstance, axios_1.default.create({ baseURL: 'https://neo-api.b-cdn.net/flamingo' }), "f");
|
|
39
|
+
__classPrivateFieldSet(this, _FlamingoForthewinEDSNeo3_forthewinAxiosInstance, axios_1.default.create({ baseURL: 'https://api.forthewin.network' }), "f");
|
|
39
40
|
}
|
|
40
|
-
getTokenPrices(
|
|
41
|
+
getTokenPrices({ tokens }) {
|
|
42
|
+
var _a, _b;
|
|
41
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
if (!BSNeo3Helper_1.BSNeo3Helper.isMainnet(__classPrivateFieldGet(this,
|
|
43
|
-
throw new Error('Exchange is only available on
|
|
44
|
-
const { data } = yield __classPrivateFieldGet(this,
|
|
44
|
+
if (!BSNeo3Helper_1.BSNeo3Helper.isMainnet(__classPrivateFieldGet(this, _FlamingoForthewinEDSNeo3_network, "f")))
|
|
45
|
+
throw new Error('Exchange is only available on Mainnet');
|
|
46
|
+
const { data: flamingoData } = yield __classPrivateFieldGet(this, _FlamingoForthewinEDSNeo3_flamingoAxiosInstance, "f").get('/live-data/prices/latest');
|
|
45
47
|
const prices = [];
|
|
46
|
-
const
|
|
47
|
-
const allTokens = BSNeo3Helper_1.BSNeo3Helper.getTokens(__classPrivateFieldGet(this, _FlamingoEDSNeo3_network, "f"));
|
|
48
|
+
const allTokens = BSNeo3Helper_1.BSNeo3Helper.getTokens(__classPrivateFieldGet(this, _FlamingoForthewinEDSNeo3_network, "f"));
|
|
48
49
|
const neoToken = tokens.find(({ symbol }) => symbol === 'NEO');
|
|
49
|
-
const
|
|
50
|
+
const bNeoTokenHash = BSNeo3Helper_1.BSNeo3Helper.normalizeHash((_b = (_a = allTokens.find(({ symbol }) => symbol === 'bNEO')) === null || _a === void 0 ? void 0 : _a.hash) !== null && _b !== void 0 ? _b : '');
|
|
50
51
|
if (neoToken)
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
|
|
52
|
+
flamingoData.forEach(item => {
|
|
53
|
+
if (bNeoTokenHash === BSNeo3Helper_1.BSNeo3Helper.normalizeHash(item.hash))
|
|
54
|
+
flamingoData.push(Object.assign(Object.assign({}, item), { symbol: neoToken.symbol, hash: neoToken.hash }));
|
|
54
55
|
});
|
|
55
|
-
|
|
56
|
+
flamingoData.forEach(item => {
|
|
56
57
|
const token = tokens.find(({ hash }) => BSNeo3Helper_1.BSNeo3Helper.normalizeHash(hash) === BSNeo3Helper_1.BSNeo3Helper.normalizeHash(item.hash));
|
|
57
58
|
if (!token)
|
|
58
59
|
return;
|
|
59
60
|
prices.push({ usdPrice: item.usd_price, token });
|
|
60
61
|
});
|
|
62
|
+
if (tokens.length > prices.length) {
|
|
63
|
+
const { data: forthewinData } = yield __classPrivateFieldGet(this, _FlamingoForthewinEDSNeo3_forthewinAxiosInstance, "f").get('/mainnet/prices');
|
|
64
|
+
Object.entries(forthewinData).forEach(([hash, usdPrice]) => {
|
|
65
|
+
hash = BSNeo3Helper_1.BSNeo3Helper.normalizeHash(hash);
|
|
66
|
+
const hasPrice = !!prices.find(({ token }) => BSNeo3Helper_1.BSNeo3Helper.normalizeHash(token.hash) === hash);
|
|
67
|
+
if (hasPrice)
|
|
68
|
+
return;
|
|
69
|
+
const foundToken = tokens.find(token => BSNeo3Helper_1.BSNeo3Helper.normalizeHash(token.hash) === hash);
|
|
70
|
+
if (!foundToken)
|
|
71
|
+
return;
|
|
72
|
+
prices.push({ usdPrice, token: foundToken });
|
|
73
|
+
});
|
|
74
|
+
}
|
|
61
75
|
return prices;
|
|
62
76
|
});
|
|
63
77
|
}
|
|
@@ -66,11 +80,11 @@ class FlamingoEDSNeo3 extends blockchain_service_1.CryptoCompareEDS {
|
|
|
66
80
|
getTokenPriceHistory: { get: () => super.getTokenPriceHistory }
|
|
67
81
|
});
|
|
68
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
if (!BSNeo3Helper_1.BSNeo3Helper.isMainnet(__classPrivateFieldGet(this,
|
|
83
|
+
if (!BSNeo3Helper_1.BSNeo3Helper.isMainnet(__classPrivateFieldGet(this, _FlamingoForthewinEDSNeo3_network, "f")))
|
|
70
84
|
throw new Error('Exchange is only available on mainnet');
|
|
71
85
|
return yield _super.getTokenPriceHistory.call(this, params);
|
|
72
86
|
});
|
|
73
87
|
}
|
|
74
88
|
}
|
|
75
|
-
exports.
|
|
76
|
-
|
|
89
|
+
exports.FlamingoForthewinEDSNeo3 = FlamingoForthewinEDSNeo3;
|
|
90
|
+
_FlamingoForthewinEDSNeo3_network = new WeakMap(), _FlamingoForthewinEDSNeo3_flamingoAxiosInstance = new WeakMap(), _FlamingoForthewinEDSNeo3_forthewinAxiosInstance = new WeakMap();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo3",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"bignumber.js": "^9.1.2",
|
|
21
21
|
"isomorphic-ws": "^5.0.0",
|
|
22
22
|
"lodash.clonedeep": "^4.5.0",
|
|
23
|
-
"@cityofzion/blockchain-service": "1.16.
|
|
23
|
+
"@cityofzion/blockchain-service": "1.16.1",
|
|
24
24
|
"@cityofzion/bs-asteroid-sdk": "0.9.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
File without changes
|