@cityofzion/bs-neo3 1.3.1 → 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/helpers/FlamingoSwapHelper.d.ts +1 -0
- package/dist/helpers/FlamingoSwapHelper.js +4 -0
- package/dist/services/swap/FlamingoSwapServiceNeo3.d.ts +1 -2
- package/dist/services/swap/FlamingoSwapServiceNeo3.js +6 -4
- 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;
|
|
@@ -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) {
|
|
@@ -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
|
-
listSwappableTokensSymbol(network: Network<BSNeo3NetworkId>): string[];
|
|
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
|
-
listSwappableTokensSymbol(network) {
|
|
85
|
-
return Object.keys(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
|
});
|
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": {
|