@cityofzion/bs-neo3 1.3.0 → 1.3.2
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 +3 -2
- package/dist/BSNeo3.js +4 -0
- package/dist/constants/FlamingoSwapConstants.js +0 -150
- package/dist/helpers/FlamingoSwapHelper.d.ts +1 -0
- package/dist/helpers/FlamingoSwapHelper.js +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/services/swap/FlamingoSwapServiceNeo3.d.ts +2 -3
- package/dist/services/swap/FlamingoSwapServiceNeo3.js +6 -4
- package/dist/services/swap/handlers/FlamingoSwapRouteHandler.js +9 -9
- package/package.json +2 -2
package/dist/BSNeo3.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Account, AccountWithDerivationPath, BDSClaimable, BlockchainDataService, BlockchainService, BSCalculableFee, BSClaimable, BSWithExplorerService, BSWithLedger, BSWithNameService, BSWithNft, ExchangeDataService, ExplorerService, Network, NftDataService, Token, TransferParam } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { Account, AccountWithDerivationPath, BDSClaimable, BlockchainDataService, BlockchainService, BSCalculableFee, BSClaimable, BSWithExplorerService, BSWithLedger, BSWithNameService, BSWithNft, BSWithSwap, ExchangeDataService, ExplorerService, Network, NftDataService, SwapService, Token, TransferParam } from '@cityofzion/blockchain-service';
|
|
2
2
|
import Transport from '@ledgerhq/hw-transport';
|
|
3
3
|
import { BSNeo3NetworkId } from './helpers/BSNeo3Helper';
|
|
4
4
|
import { NeonDappKitLedgerServiceNeo3 } from './services/ledger/NeonDappKitLedgerServiceNeo3';
|
|
5
|
-
export declare class BSNeo3<BSCustomName extends string = string> implements BlockchainService<BSCustomName, BSNeo3NetworkId>, BSClaimable, BSWithNameService, BSCalculableFee, BSWithNft, BSWithExplorerService, BSWithLedger {
|
|
5
|
+
export declare class BSNeo3<BSCustomName extends string = string> implements BlockchainService<BSCustomName, BSNeo3NetworkId>, BSClaimable, BSWithNameService, BSCalculableFee, BSWithNft, BSWithExplorerService, BSWithLedger, BSWithSwap<BSNeo3NetworkId> {
|
|
6
6
|
#private;
|
|
7
7
|
blockchainName: BSCustomName;
|
|
8
8
|
derivationPath: string;
|
|
@@ -17,6 +17,7 @@ export declare class BSNeo3<BSCustomName extends string = string> implements Blo
|
|
|
17
17
|
explorerService: ExplorerService;
|
|
18
18
|
network: Network<BSNeo3NetworkId>;
|
|
19
19
|
constructor(blockchainName: BSCustomName, network?: Network<BSNeo3NetworkId>, getLedgerTransport?: (account: Account) => Promise<Transport>);
|
|
20
|
+
createSwapService(): SwapService<BSNeo3NetworkId>;
|
|
20
21
|
setNetwork(network: Network<BSNeo3NetworkId>): void;
|
|
21
22
|
validateAddress(address: string): boolean;
|
|
22
23
|
validateEncrypted(encryptedKey: string): boolean;
|
package/dist/BSNeo3.js
CHANGED
|
@@ -25,6 +25,7 @@ const FlamingoEDSNeo3_1 = require("./services/exchange-data/FlamingoEDSNeo3");
|
|
|
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");
|
|
28
|
+
const FlamingoSwapServiceNeo3_1 = require("./services/swap/FlamingoSwapServiceNeo3");
|
|
28
29
|
class BSNeo3 {
|
|
29
30
|
constructor(blockchainName, network, getLedgerTransport) {
|
|
30
31
|
_BSNeo3_instances.add(this);
|
|
@@ -34,6 +35,9 @@ class BSNeo3 {
|
|
|
34
35
|
this.derivationPath = BSNeo3Helper_1.BSNeo3Helper.DERIVATION_PATH;
|
|
35
36
|
this.setNetwork(network);
|
|
36
37
|
}
|
|
38
|
+
createSwapService() {
|
|
39
|
+
return new FlamingoSwapServiceNeo3_1.FlamingoSwapServiceNeo3(this.network, this.ledgerService);
|
|
40
|
+
}
|
|
37
41
|
setNetwork(network) {
|
|
38
42
|
__classPrivateFieldGet(this, _BSNeo3_instances, "m", _BSNeo3_setTokens).call(this, network);
|
|
39
43
|
this.network = network;
|
|
@@ -25,12 +25,6 @@ FlamingoSwapConstants.TESTNET_FLAMINGO_SWAP_TOKENS = {
|
|
|
25
25
|
hash: '0x5b53998b399d10cd25727269e865acc785ef5c1a',
|
|
26
26
|
name: 'FLM',
|
|
27
27
|
},
|
|
28
|
-
FLUND: {
|
|
29
|
-
symbol: 'FLUND',
|
|
30
|
-
decimals: 8,
|
|
31
|
-
hash: '0x3d0085f442ead25ff3a7507c8eaa27cc8623a6be',
|
|
32
|
-
name: 'FLUND',
|
|
33
|
-
},
|
|
34
28
|
TIPS: {
|
|
35
29
|
symbol: 'TIPS',
|
|
36
30
|
decimals: 8,
|
|
@@ -139,81 +133,6 @@ FlamingoSwapConstants.TESTNET_FLAMINGO_SWAP_TOKENS = {
|
|
|
139
133
|
hash: '0x1883231a31dc912805cc08a281d4c268c4cac345',
|
|
140
134
|
name: 'fBNB',
|
|
141
135
|
},
|
|
142
|
-
// ============ Ethereum Assets ============ //
|
|
143
|
-
WETH: {
|
|
144
|
-
symbol: 'WETH',
|
|
145
|
-
decimals: 18,
|
|
146
|
-
hash: '0xb603cea165119701b58d56d10d2060fbfb3efad8',
|
|
147
|
-
name: 'WETH',
|
|
148
|
-
},
|
|
149
|
-
WBTC: {
|
|
150
|
-
symbol: 'WBTC',
|
|
151
|
-
decimals: 8,
|
|
152
|
-
hash: '0x557563dc4ed3fd256eba55b9622f53331ab97c2f',
|
|
153
|
-
name: 'WBTC',
|
|
154
|
-
},
|
|
155
|
-
USDT: {
|
|
156
|
-
symbol: 'USDT',
|
|
157
|
-
decimals: 6,
|
|
158
|
-
hash: '0xad3f96ae966ad60347f31845b7e4b333104c52fb',
|
|
159
|
-
name: 'USDT',
|
|
160
|
-
},
|
|
161
|
-
xWETH: {
|
|
162
|
-
symbol: 'xWETH',
|
|
163
|
-
decimals: 18,
|
|
164
|
-
hash: '0xd38fc89febb12e5d32faa72e07d486a268b9c63a',
|
|
165
|
-
name: 'xWETH',
|
|
166
|
-
},
|
|
167
|
-
xWBTC: {
|
|
168
|
-
symbol: 'xWBTC',
|
|
169
|
-
decimals: 8,
|
|
170
|
-
hash: '0x447b931cc604a30dc16c49002f35a7aab7888b78',
|
|
171
|
-
name: 'xWBTC',
|
|
172
|
-
},
|
|
173
|
-
xUSDT: {
|
|
174
|
-
symbol: 'xUSDT',
|
|
175
|
-
decimals: 6,
|
|
176
|
-
hash: '0xf15b5430321f4e51f5f534cedada7fbb78fa6680',
|
|
177
|
-
name: 'xUSDT',
|
|
178
|
-
},
|
|
179
|
-
// ============ Ontology Assets ============ //
|
|
180
|
-
ONTd: {
|
|
181
|
-
symbol: 'ONTd',
|
|
182
|
-
decimals: 9,
|
|
183
|
-
hash: '0x869951e3397550e800d5faf579857cdb637a0051',
|
|
184
|
-
name: 'ONTd',
|
|
185
|
-
},
|
|
186
|
-
// ============ BSC Assets ============ //
|
|
187
|
-
CAKE: {
|
|
188
|
-
symbol: 'CAKE',
|
|
189
|
-
decimals: 18,
|
|
190
|
-
hash: '0x778140d3A1e0024Be11e723a8af2C4d521feBA4f',
|
|
191
|
-
name: 'CAKE',
|
|
192
|
-
},
|
|
193
|
-
BNB: {
|
|
194
|
-
symbol: 'BNB',
|
|
195
|
-
decimals: 18,
|
|
196
|
-
hash: '0x0000000000000000000000000000000000000000',
|
|
197
|
-
name: 'BNB',
|
|
198
|
-
},
|
|
199
|
-
xfCAKE: {
|
|
200
|
-
symbol: 'xfCAKE',
|
|
201
|
-
decimals: 18,
|
|
202
|
-
hash: '0x64A647dC1634d164896D7146f7Ad314665DFeB18',
|
|
203
|
-
name: 'xfCAKE',
|
|
204
|
-
},
|
|
205
|
-
bNUDES: {
|
|
206
|
-
symbol: 'bNUDES',
|
|
207
|
-
decimals: 8,
|
|
208
|
-
hash: '0xeA5143686D0edb60dcE657CeDA8367a92a2Bff58',
|
|
209
|
-
name: 'bNUDES',
|
|
210
|
-
},
|
|
211
|
-
FUSD: {
|
|
212
|
-
symbol: 'FUSD',
|
|
213
|
-
decimals: 8,
|
|
214
|
-
hash: '0xcdaddd3e196bb1c1978364dd78b8cec5d4753f58',
|
|
215
|
-
name: 'FUSD',
|
|
216
|
-
},
|
|
217
136
|
};
|
|
218
137
|
FlamingoSwapConstants.MAINNET_FLAMINGO_SWAP_TOKENS = {
|
|
219
138
|
// ============ Neo Assets ============ //
|
|
@@ -223,12 +142,6 @@ FlamingoSwapConstants.MAINNET_FLAMINGO_SWAP_TOKENS = {
|
|
|
223
142
|
hash: '0xf0151f528127558851b39c2cd8aa47da7418ab28',
|
|
224
143
|
name: 'FLM',
|
|
225
144
|
},
|
|
226
|
-
FLUND: {
|
|
227
|
-
symbol: 'FLUND',
|
|
228
|
-
decimals: 8,
|
|
229
|
-
hash: '0xa9603a59e21d29e37ac39cf1b5f5abf5006b22a3',
|
|
230
|
-
name: 'FLUND',
|
|
231
|
-
},
|
|
232
145
|
TIPS: {
|
|
233
146
|
symbol: 'TIPS',
|
|
234
147
|
decimals: 8,
|
|
@@ -355,69 +268,6 @@ FlamingoSwapConstants.MAINNET_FLAMINGO_SWAP_TOKENS = {
|
|
|
355
268
|
hash: '0xb56f0fba45cc57a948b342186274dfd863996bb3',
|
|
356
269
|
name: 'fBNB',
|
|
357
270
|
},
|
|
358
|
-
// ============ Ethereum Assets ============ //
|
|
359
|
-
WETH: {
|
|
360
|
-
symbol: 'WETH',
|
|
361
|
-
decimals: 18,
|
|
362
|
-
hash: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
363
|
-
name: 'WETH',
|
|
364
|
-
},
|
|
365
|
-
WBTC: {
|
|
366
|
-
symbol: 'WBTC',
|
|
367
|
-
decimals: 8,
|
|
368
|
-
hash: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
|
|
369
|
-
name: 'WBTC',
|
|
370
|
-
},
|
|
371
|
-
USDT: {
|
|
372
|
-
symbol: 'USDT',
|
|
373
|
-
decimals: 6,
|
|
374
|
-
hash: '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
|
375
|
-
name: 'USDT',
|
|
376
|
-
},
|
|
377
|
-
xWETH: {
|
|
378
|
-
symbol: 'xWETH',
|
|
379
|
-
decimals: 18,
|
|
380
|
-
hash: '0x46b2E0224efb03D43eba88AB5A1995480e6A76b6',
|
|
381
|
-
name: 'xWETH',
|
|
382
|
-
},
|
|
383
|
-
xWBTC: {
|
|
384
|
-
symbol: 'xWBTC',
|
|
385
|
-
decimals: 8,
|
|
386
|
-
hash: '0xebd0e8988ac25a793dc27368f96a5a72e34efcd7',
|
|
387
|
-
name: 'xWBTC',
|
|
388
|
-
},
|
|
389
|
-
xUSDT: {
|
|
390
|
-
symbol: 'xUSDT',
|
|
391
|
-
decimals: 6,
|
|
392
|
-
hash: '0xa93727e8661d4f82cfd50f7d8fd3f38ec8493b84',
|
|
393
|
-
name: 'xUSDT',
|
|
394
|
-
},
|
|
395
|
-
// ============ Ontology Assets ============ //
|
|
396
|
-
ONTd: {
|
|
397
|
-
symbol: 'ONTd',
|
|
398
|
-
decimals: 9,
|
|
399
|
-
hash: '33ae7eae016193ba0fe238b223623bc78faac158',
|
|
400
|
-
name: 'ONTd',
|
|
401
|
-
},
|
|
402
|
-
WING: {
|
|
403
|
-
symbol: 'WING',
|
|
404
|
-
decimals: 9,
|
|
405
|
-
hash: '00c59fcd27a562d6397883eab1f2fff56e58ef80',
|
|
406
|
-
name: 'WING',
|
|
407
|
-
},
|
|
408
|
-
// ============ BSC Assets ============ //
|
|
409
|
-
CAKE: {
|
|
410
|
-
symbol: 'CAKE',
|
|
411
|
-
decimals: 18,
|
|
412
|
-
hash: '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82',
|
|
413
|
-
name: 'CAKE',
|
|
414
|
-
},
|
|
415
|
-
xfCAKE: {
|
|
416
|
-
symbol: 'xfCAKE',
|
|
417
|
-
decimals: 18,
|
|
418
|
-
hash: '0xD05923B7E0c86f31A4a6dFA4d5bbF191AbEe6Ab2',
|
|
419
|
-
name: 'xfCAKE',
|
|
420
|
-
},
|
|
421
271
|
};
|
|
422
272
|
FlamingoSwapConstants.FLAMINGO_SWAP_TOKENS = {
|
|
423
273
|
testnet: _a.TESTNET_FLAMINGO_SWAP_TOKENS,
|
|
@@ -3,6 +3,7 @@ import BigNumber from 'bignumber.js';
|
|
|
3
3
|
import { FlamingoSwapPoolInfo, FlamingoSwapPools, FlamingoSwapScriptHashes, FlamingoSwapTokens } from '../constants/FlamingoSwapConstants';
|
|
4
4
|
import { BSNeo3NetworkId } from './BSNeo3Helper';
|
|
5
5
|
export declare class FlamingoSwapHelper {
|
|
6
|
+
static listSwappableTokensSymbol(network: Network<BSNeo3NetworkId>): string[];
|
|
6
7
|
static getFlamingoSwapPools(network: Network<BSNeo3NetworkId>): FlamingoSwapPools;
|
|
7
8
|
static getFlamingoSwapPool(network: Network<BSNeo3NetworkId>, name: string): FlamingoSwapPoolInfo;
|
|
8
9
|
static getFlamingoSwapTokens(network: Network<BSNeo3NetworkId>): FlamingoSwapTokens;
|
|
@@ -7,7 +7,11 @@ exports.FlamingoSwapHelper = void 0;
|
|
|
7
7
|
const neon_core_1 = require("@cityofzion/neon-core");
|
|
8
8
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
9
|
const FlamingoSwapConstants_1 = require("../constants/FlamingoSwapConstants");
|
|
10
|
+
const handlers_1 = require("../services/swap/handlers");
|
|
10
11
|
class FlamingoSwapHelper {
|
|
12
|
+
static listSwappableTokensSymbol(network) {
|
|
13
|
+
return Object.keys(handlers_1.FlamingoSwapRouteHandler.createPoolGraph(network));
|
|
14
|
+
}
|
|
11
15
|
static getFlamingoSwapPools(network) {
|
|
12
16
|
const pools = FlamingoSwapConstants_1.FlamingoSwapConstants.FLAMINGO_SWAP_POOLS[network.id];
|
|
13
17
|
if (!pools) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './BSNeo3';
|
|
2
2
|
export * from './builder/invocation/FlamingoSwapInvocationBuilderNeo3';
|
|
3
3
|
export * from './builder/invocation/NeonDappKitInvocationBuilderNeo3';
|
|
4
|
-
export * from './constants/FlamingoSwapConstants';
|
|
5
4
|
export * from './helpers/BSNeo3Helper';
|
|
6
5
|
export * from './helpers/FlamingoSwapHelper';
|
|
6
|
+
export * from './constants/FlamingoSwapConstants';
|
|
7
7
|
export * from './services/blockchain-data/DoraBDSNeo3';
|
|
8
8
|
export * from './services/blockchain-data/RpcBDSNeo3';
|
|
9
9
|
export * from './services/exchange-data/FlamingoEDSNeo3';
|
package/dist/index.js
CHANGED
|
@@ -17,9 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./BSNeo3"), exports);
|
|
18
18
|
__exportStar(require("./builder/invocation/FlamingoSwapInvocationBuilderNeo3"), exports);
|
|
19
19
|
__exportStar(require("./builder/invocation/NeonDappKitInvocationBuilderNeo3"), exports);
|
|
20
|
-
__exportStar(require("./constants/FlamingoSwapConstants"), exports);
|
|
21
20
|
__exportStar(require("./helpers/BSNeo3Helper"), exports);
|
|
22
21
|
__exportStar(require("./helpers/FlamingoSwapHelper"), exports);
|
|
22
|
+
__exportStar(require("./constants/FlamingoSwapConstants"), exports);
|
|
23
23
|
__exportStar(require("./services/blockchain-data/DoraBDSNeo3"), exports);
|
|
24
24
|
__exportStar(require("./services/blockchain-data/RpcBDSNeo3"), exports);
|
|
25
25
|
__exportStar(require("./services/exchange-data/FlamingoEDSNeo3"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, Network,
|
|
1
|
+
import { Account, Network, SwapService, SwapServiceEvents, SwapServiceSwapToReceiveArgs, SwapServiceSwapToUseArgs, Token } from '@cityofzion/blockchain-service';
|
|
2
2
|
import TypedEmitter from 'typed-emitter';
|
|
3
3
|
import { BSNeo3NetworkId } from '../../helpers/BSNeo3Helper';
|
|
4
4
|
import { NeonDappKitLedgerServiceNeo3 } from '../ledger/NeonDappKitLedgerServiceNeo3';
|
|
@@ -6,9 +6,8 @@ type BuildSwapInvocationArgs = SwapServiceSwapToUseArgs<BSNeo3NetworkId> | SwapS
|
|
|
6
6
|
export declare class FlamingoSwapServiceNeo3 implements SwapService<BSNeo3NetworkId> {
|
|
7
7
|
#private;
|
|
8
8
|
eventEmitter: TypedEmitter<SwapServiceEvents>;
|
|
9
|
-
constructor(network: Network<BSNeo3NetworkId>, ledgerService
|
|
9
|
+
constructor(network: Network<BSNeo3NetworkId>, ledgerService?: NeonDappKitLedgerServiceNeo3);
|
|
10
10
|
buildSwapInvocationArgs(): BuildSwapInvocationArgs;
|
|
11
|
-
listSwappableTokens(network: Network<BSNeo3NetworkId>): PoolGraph;
|
|
12
11
|
swap(isLedger?: boolean): Promise<void>;
|
|
13
12
|
startListeningBlockGeneration(): void;
|
|
14
13
|
stopListeningBlockGeneration(): void;
|
|
@@ -81,24 +81,26 @@ class FlamingoSwapServiceNeo3 {
|
|
|
81
81
|
throw new Error("minimumReceived is required for 'amountToUse' swap type");
|
|
82
82
|
return Object.assign(Object.assign({}, baseSwapArgs), { amountToUse: __classPrivateFieldGet(this, _FlamingoSwapServiceNeo3_instances, "a", _FlamingoSwapServiceNeo3_amountToUse_get), minimumReceived: __classPrivateFieldGet(this, _FlamingoSwapServiceNeo3_instances, "a", _FlamingoSwapServiceNeo3_minimumReceived_get), type: 'swapTokenToUse' });
|
|
83
83
|
}
|
|
84
|
-
listSwappableTokens(network) {
|
|
85
|
-
return handlers_1.FlamingoSwapRouteHandler.createPoolGraph(network);
|
|
86
|
-
}
|
|
87
84
|
swap(isLedger) {
|
|
88
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
86
|
const swapInvocationArgs = this.buildSwapInvocationArgs();
|
|
90
87
|
let ledgerTransport;
|
|
88
|
+
let signingCallback;
|
|
91
89
|
if (isLedger) {
|
|
90
|
+
if (!__classPrivateFieldGet(this, _FlamingoSwapServiceNeo3_ledgerService, "f")) {
|
|
91
|
+
throw new Error('You must provide a ledger service to use Ledger');
|
|
92
|
+
}
|
|
92
93
|
if (!__classPrivateFieldGet(this, _FlamingoSwapServiceNeo3_ledgerService, "f").getLedgerTransport) {
|
|
93
94
|
throw new Error('You must provide a getLedgerTransport function to use Ledger');
|
|
94
95
|
}
|
|
95
96
|
ledgerTransport = yield __classPrivateFieldGet(this, _FlamingoSwapServiceNeo3_ledgerService, "f").getLedgerTransport(__classPrivateFieldGet(this, _FlamingoSwapServiceNeo3_instances, "a", _FlamingoSwapServiceNeo3_accountToUse_get));
|
|
97
|
+
signingCallback = __classPrivateFieldGet(this, _FlamingoSwapServiceNeo3_ledgerService, "f").getSigningCallback(ledgerTransport);
|
|
96
98
|
}
|
|
97
99
|
const account = new neon_core_1.wallet.Account(__classPrivateFieldGet(this, _FlamingoSwapServiceNeo3_instances, "a", _FlamingoSwapServiceNeo3_accountToUse_get).key);
|
|
98
100
|
const invoker = yield neon_dappkit_1.NeonInvoker.init({
|
|
99
101
|
rpcAddress: __classPrivateFieldGet(this, _FlamingoSwapServiceNeo3_network, "f").url,
|
|
100
102
|
account,
|
|
101
|
-
signingCallback
|
|
103
|
+
signingCallback,
|
|
102
104
|
});
|
|
103
105
|
yield invoker.invokeFunction(FlamingoSwapInvocationBuilderNeo3_1.FlamingoSwapInvocationBuilderNeo3.swapInvocation(swapInvocationArgs));
|
|
104
106
|
});
|
|
@@ -35,24 +35,24 @@ class FlamingoSwapRouteHandler {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
static createPoolGraph(network) {
|
|
38
|
+
const poolGraph = {};
|
|
38
39
|
const pools = FlamingoSwapHelper_1.FlamingoSwapHelper.getFlamingoSwapPools(network);
|
|
39
40
|
const tokens = FlamingoSwapHelper_1.FlamingoSwapHelper.getFlamingoSwapTokens(network);
|
|
40
41
|
const { NEO, bNEO } = tokens;
|
|
41
|
-
const poolGraph = {};
|
|
42
42
|
// Initialize poolGraph with empty arrays
|
|
43
|
-
Object.
|
|
44
|
-
poolGraph[
|
|
43
|
+
Object.keys(tokens).forEach(tokenSymbol => {
|
|
44
|
+
poolGraph[tokenSymbol] = [];
|
|
45
45
|
});
|
|
46
46
|
// Add edges to poolGraph
|
|
47
47
|
Object.values(pools).forEach(pool => {
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
poolGraph[
|
|
51
|
-
poolGraph[
|
|
48
|
+
const tokenASymbol = pool.tokens[0].symbol;
|
|
49
|
+
const tokenBSymbol = pool.tokens[1].symbol;
|
|
50
|
+
poolGraph[tokenASymbol].push(tokenBSymbol);
|
|
51
|
+
poolGraph[tokenBSymbol].push(tokenASymbol);
|
|
52
52
|
});
|
|
53
53
|
// Remove duplicates from poolGraph
|
|
54
|
-
Object.keys(
|
|
55
|
-
poolGraph[tokenSymbol] =
|
|
54
|
+
Object.keys(tokens).forEach(tokenSymbol => {
|
|
55
|
+
poolGraph[tokenSymbol] = Array.from(new Set(poolGraph[tokenSymbol]));
|
|
56
56
|
});
|
|
57
57
|
// Include NEO to the poolGraph
|
|
58
58
|
poolGraph[NEO.symbol] = Object.keys(tokens).filter(tokenSymbol => tokenSymbol === bNEO.symbol);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo3",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
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.3.
|
|
23
|
+
"@cityofzion/blockchain-service": "1.3.2",
|
|
24
24
|
"@cityofzion/bs-asteroid-sdk": "0.9.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|