@cityofzion/bs-neo3 1.2.0 → 1.3.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.
- package/dist/BSNeo3.d.ts +3 -3
- package/dist/BSNeo3.js +9 -9
- package/dist/builder/invocation/FlamingoSwapInvocationBuilderNeo3.d.ts +7 -0
- package/dist/builder/invocation/FlamingoSwapInvocationBuilderNeo3.js +95 -0
- package/dist/builder/invocation/NeonDappKitInvocationBuilderNeo3.d.ts +34 -0
- package/dist/builder/invocation/NeonDappKitInvocationBuilderNeo3.js +102 -0
- package/dist/constants/FlamingoSwapConstants.d.ts +36 -0
- package/dist/constants/FlamingoSwapConstants.js +853 -0
- package/dist/{BSNeo3Helper.js → helpers/BSNeo3Helper.js} +2 -2
- package/dist/helpers/FlamingoSwapHelper.d.ts +19 -0
- package/dist/helpers/FlamingoSwapHelper.js +84 -0
- package/dist/index.d.ts +13 -11
- package/dist/index.js +13 -11
- package/dist/{DoraBDSNeo3.d.ts → services/blockchain-data/DoraBDSNeo3.d.ts} +4 -4
- package/dist/{DoraBDSNeo3.js → services/blockchain-data/DoraBDSNeo3.js} +3 -3
- package/dist/{RpcBDSNeo3.d.ts → services/blockchain-data/RpcBDSNeo3.d.ts} +2 -2
- package/dist/{RpcBDSNeo3.js → services/blockchain-data/RpcBDSNeo3.js} +4 -4
- package/dist/{FlamingoEDSNeo3.d.ts → services/exchange-data/FlamingoEDSNeo3.d.ts} +1 -1
- package/dist/{FlamingoEDSNeo3.js → services/exchange-data/FlamingoEDSNeo3.js} +1 -1
- package/dist/{DoraESNeo3.d.ts → services/explorer/DoraESNeo3.d.ts} +2 -2
- package/dist/{DoraESNeo3.js → services/explorer/DoraESNeo3.js} +1 -1
- package/dist/{NeonDappKitLedgerServiceNeo3.d.ts → services/ledger/NeonDappKitLedgerServiceNeo3.d.ts} +2 -4
- package/dist/services/ledger/NeonDappKitLedgerServiceNeo3.js +135 -0
- package/dist/{GhostMarketNDSNeo3.d.ts → services/nft-data/GhostMarketNDSNeo3.d.ts} +2 -2
- package/dist/{RpcNDSNeo3.d.ts → services/nft-data/RpcNDSNeo3.d.ts} +1 -1
- package/dist/services/swap/FlamingoSwapServiceNeo3.d.ts +23 -0
- package/dist/services/swap/FlamingoSwapServiceNeo3.js +271 -0
- package/dist/services/swap/handlers/FlamingoSwapDetailsHandler.d.ts +24 -0
- package/dist/services/swap/handlers/FlamingoSwapDetailsHandler.js +178 -0
- package/dist/services/swap/handlers/FlamingoSwapRouteHandler.d.ts +13 -0
- package/dist/services/swap/handlers/FlamingoSwapRouteHandler.js +181 -0
- package/dist/services/swap/handlers/FlamingoSwapSocketHandler.d.ts +9 -0
- package/dist/services/swap/handlers/FlamingoSwapSocketHandler.js +57 -0
- package/dist/services/swap/handlers/index.d.ts +3 -0
- package/dist/services/swap/handlers/index.js +19 -0
- package/package.json +7 -5
- package/dist/NeonDappKitLedgerServiceNeo3.js +0 -110
- package/dist/flamingo-swap/FlamingoSwapControllerService.d.ts +0 -20
- package/dist/flamingo-swap/FlamingoSwapControllerService.js +0 -290
- package/dist/flamingo-swap/FlamingoSwapHelper.d.ts +0 -48
- package/dist/flamingo-swap/FlamingoSwapHelper.js +0 -171
- package/dist/flamingo-swap/FlamingoSwapNeonDappKitInvocationBuilder.d.ts +0 -19
- package/dist/flamingo-swap/FlamingoSwapNeonDappKitInvocationBuilder.js +0 -208
- package/dist/{BSNeo3Helper.d.ts → helpers/BSNeo3Helper.d.ts} +0 -0
- package/dist/{GhostMarketNDSNeo3.js → services/nft-data/GhostMarketNDSNeo3.js} +1 -1
- /package/dist/{RpcNDSNeo3.js → services/nft-data/RpcNDSNeo3.js} +0 -0
package/dist/BSNeo3.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Account, AccountWithDerivationPath, BDSClaimable, BlockchainDataService, BlockchainService, BSCalculableFee, BSClaimable, BSWithExplorerService, BSWithLedger, BSWithNameService, BSWithNft, ExchangeDataService, ExplorerService, Network, NftDataService, Token, TransferParam } from '@cityofzion/blockchain-service';
|
|
2
2
|
import Transport from '@ledgerhq/hw-transport';
|
|
3
|
-
import { BSNeo3NetworkId } from './BSNeo3Helper';
|
|
4
|
-
import { NeonDappKitLedgerServiceNeo3 } from './NeonDappKitLedgerServiceNeo3';
|
|
3
|
+
import { BSNeo3NetworkId } from './helpers/BSNeo3Helper';
|
|
4
|
+
import { NeonDappKitLedgerServiceNeo3 } from './services/ledger/NeonDappKitLedgerServiceNeo3';
|
|
5
5
|
export declare class BSNeo3<BSCustomName extends string = string> implements BlockchainService<BSCustomName, BSNeo3NetworkId>, BSClaimable, BSWithNameService, BSCalculableFee, BSWithNft, BSWithExplorerService, BSWithLedger {
|
|
6
6
|
#private;
|
|
7
7
|
blockchainName: BSCustomName;
|
package/dist/BSNeo3.js
CHANGED
|
@@ -16,15 +16,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
16
16
|
var _BSNeo3_instances, _BSNeo3_setTokens, _BSNeo3_buildTransferInvocation;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.BSNeo3 = void 0;
|
|
19
|
-
const neon_js_1 = require("@cityofzion/neon-js");
|
|
20
|
-
const neon_dappkit_1 = require("@cityofzion/neon-dappkit");
|
|
21
19
|
const bs_asteroid_sdk_1 = require("@cityofzion/bs-asteroid-sdk");
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const DoraESNeo3_1 = require("./DoraESNeo3");
|
|
20
|
+
const neon_dappkit_1 = require("@cityofzion/neon-dappkit");
|
|
21
|
+
const neon_js_1 = require("@cityofzion/neon-js");
|
|
22
|
+
const BSNeo3Helper_1 = require("./helpers/BSNeo3Helper");
|
|
23
|
+
const DoraBDSNeo3_1 = require("./services/blockchain-data/DoraBDSNeo3");
|
|
24
|
+
const FlamingoEDSNeo3_1 = require("./services/exchange-data/FlamingoEDSNeo3");
|
|
25
|
+
const DoraESNeo3_1 = require("./services/explorer/DoraESNeo3");
|
|
26
|
+
const NeonDappKitLedgerServiceNeo3_1 = require("./services/ledger/NeonDappKitLedgerServiceNeo3");
|
|
27
|
+
const GhostMarketNDSNeo3_1 = require("./services/nft-data/GhostMarketNDSNeo3");
|
|
28
28
|
class BSNeo3 {
|
|
29
29
|
constructor(blockchainName, network, getLedgerTransport) {
|
|
30
30
|
_BSNeo3_instances.add(this);
|
|
@@ -195,7 +195,7 @@ _BSNeo3_instances = new WeakSet(), _BSNeo3_setTokens = function _BSNeo3_setToken
|
|
|
195
195
|
? neon_js_1.u.BigInteger.fromDecimal(intent.amount, intent.tokenDecimals).toString()
|
|
196
196
|
: intent.amount,
|
|
197
197
|
},
|
|
198
|
-
{ type: 'Any', value:
|
|
198
|
+
{ type: 'Any', value: null },
|
|
199
199
|
],
|
|
200
200
|
};
|
|
201
201
|
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SwapServiceSwapToReceiveArgs, SwapServiceSwapToUseArgs } from '@cityofzion/blockchain-service';
|
|
2
|
+
import { ContractInvocationMulti } from '@cityofzion/neon-dappkit-types';
|
|
3
|
+
import { BSNeo3NetworkId } from '../../helpers/BSNeo3Helper';
|
|
4
|
+
export declare class FlamingoSwapInvocationBuilderNeo3 {
|
|
5
|
+
#private;
|
|
6
|
+
static swapInvocation(data: SwapServiceSwapToReceiveArgs<BSNeo3NetworkId> | SwapServiceSwapToUseArgs<BSNeo3NetworkId>): ContractInvocationMulti;
|
|
7
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
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");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var _a, _FlamingoSwapInvocationBuilderNeo3_buildSwapTokenToReceiveInvocation, _FlamingoSwapInvocationBuilderNeo3_buildSwapTokenToUseInvocation, _FlamingoSwapInvocationBuilderNeo3_mapRoutePathToArgs, _FlamingoSwapInvocationBuilderNeo3_getAllowedContracts, _FlamingoSwapInvocationBuilderNeo3_buildNEOTransferInvocation;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.FlamingoSwapInvocationBuilderNeo3 = void 0;
|
|
10
|
+
const neon_core_1 = require("@cityofzion/neon-core");
|
|
11
|
+
const FlamingoSwapConstants_1 = require("../../constants/FlamingoSwapConstants");
|
|
12
|
+
const FlamingoSwapHelper_1 = require("../../helpers/FlamingoSwapHelper");
|
|
13
|
+
const NeonDappKitInvocationBuilderNeo3_1 = require("./NeonDappKitInvocationBuilderNeo3");
|
|
14
|
+
class FlamingoSwapInvocationBuilderNeo3 {
|
|
15
|
+
static swapInvocation(data) {
|
|
16
|
+
return data.type === 'swapTokenToReceive'
|
|
17
|
+
? __classPrivateFieldGet(this, _a, "m", _FlamingoSwapInvocationBuilderNeo3_buildSwapTokenToReceiveInvocation).call(this, data)
|
|
18
|
+
: __classPrivateFieldGet(this, _a, "m", _FlamingoSwapInvocationBuilderNeo3_buildSwapTokenToUseInvocation).call(this, data);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.FlamingoSwapInvocationBuilderNeo3 = FlamingoSwapInvocationBuilderNeo3;
|
|
22
|
+
_a = FlamingoSwapInvocationBuilderNeo3, _FlamingoSwapInvocationBuilderNeo3_buildSwapTokenToReceiveInvocation = function _FlamingoSwapInvocationBuilderNeo3_buildSwapTokenToReceiveInvocation({ address, amountToReceive, deadline, maximumSelling, network, routePath, }) {
|
|
23
|
+
const [tokenToUse] = routePath;
|
|
24
|
+
const tokenToReceive = routePath[routePath.length - 1];
|
|
25
|
+
const scriptHashes = FlamingoSwapHelper_1.FlamingoSwapHelper.getFlamingoSwapScriptHashes(network);
|
|
26
|
+
const tokenToReceiveOverrode = FlamingoSwapHelper_1.FlamingoSwapHelper.overrideToken(network, tokenToReceive);
|
|
27
|
+
const invocations = [];
|
|
28
|
+
const allowedContracts = __classPrivateFieldGet(this, _a, "m", _FlamingoSwapInvocationBuilderNeo3_getAllowedContracts).call(this, scriptHashes, routePath);
|
|
29
|
+
const amountToReceiveFormatted = FlamingoSwapHelper_1.FlamingoSwapHelper.formatAmount(amountToReceive, tokenToReceiveOverrode.decimals);
|
|
30
|
+
const maximumSellingFormatted = FlamingoSwapHelper_1.FlamingoSwapHelper.formatAmount(maximumSelling, tokenToUse.decimals);
|
|
31
|
+
const swapInvocation = NeonDappKitInvocationBuilderNeo3_1.NeonDappKitInvocationBuilderNeo3.swapTokenOutForTokenInContractInvocation({
|
|
32
|
+
routerScriptHash: scriptHashes.flamingoSwapRouter,
|
|
33
|
+
senderAddress: address,
|
|
34
|
+
amountToReceive: amountToReceiveFormatted,
|
|
35
|
+
maximumSelling: maximumSellingFormatted,
|
|
36
|
+
deadline,
|
|
37
|
+
args: __classPrivateFieldGet(this, _a, "m", _FlamingoSwapInvocationBuilderNeo3_mapRoutePathToArgs).call(this, routePath),
|
|
38
|
+
});
|
|
39
|
+
invocations.push(swapInvocation);
|
|
40
|
+
if (FlamingoSwapHelper_1.FlamingoSwapHelper.isNeoToken(network, tokenToReceive)) {
|
|
41
|
+
const amountToReceiveTransfer = neon_core_1.u.BigInteger.fromNumber(Number(amountToReceiveFormatted) * FlamingoSwapConstants_1.FlamingoSwapConstants.GAS_PER_NEO).toString();
|
|
42
|
+
const neoTransferInvocation = __classPrivateFieldGet(this, _a, "m", _FlamingoSwapInvocationBuilderNeo3_buildNEOTransferInvocation).call(this, address, amountToReceiveTransfer, network);
|
|
43
|
+
invocations.push(neoTransferInvocation);
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
invocations,
|
|
47
|
+
signers: [{ scopes: neon_core_1.tx.WitnessScope.CustomContracts, allowedContracts }],
|
|
48
|
+
};
|
|
49
|
+
}, _FlamingoSwapInvocationBuilderNeo3_buildSwapTokenToUseInvocation = function _FlamingoSwapInvocationBuilderNeo3_buildSwapTokenToUseInvocation({ address, amountToUse, deadline, minimumReceived, network, routePath, }) {
|
|
50
|
+
const [tokenToUse] = routePath;
|
|
51
|
+
const tokenToReceive = routePath[routePath.length - 1];
|
|
52
|
+
const scriptHashes = FlamingoSwapHelper_1.FlamingoSwapHelper.getFlamingoSwapScriptHashes(network);
|
|
53
|
+
const invocations = [];
|
|
54
|
+
const allowedContracts = __classPrivateFieldGet(this, _a, "m", _FlamingoSwapInvocationBuilderNeo3_getAllowedContracts).call(this, scriptHashes, routePath);
|
|
55
|
+
if (FlamingoSwapHelper_1.FlamingoSwapHelper.isNeoToken(network, tokenToUse)) {
|
|
56
|
+
const neoTransferInvocation = __classPrivateFieldGet(this, _a, "m", _FlamingoSwapInvocationBuilderNeo3_buildNEOTransferInvocation).call(this, address, amountToUse, network);
|
|
57
|
+
invocations.push(neoTransferInvocation);
|
|
58
|
+
}
|
|
59
|
+
const amountToUseFormatted = FlamingoSwapHelper_1.FlamingoSwapHelper.formatAmount(amountToUse, tokenToUse.decimals);
|
|
60
|
+
const minimumReceivedFormatted = FlamingoSwapHelper_1.FlamingoSwapHelper.formatAmount(minimumReceived, tokenToReceive.decimals);
|
|
61
|
+
const swapInvocation = NeonDappKitInvocationBuilderNeo3_1.NeonDappKitInvocationBuilderNeo3.swapTokenInForTokenOutContractInvocation({
|
|
62
|
+
routerScriptHash: scriptHashes.flamingoSwapRouter,
|
|
63
|
+
amountToUse: amountToUseFormatted,
|
|
64
|
+
minimumReceived: minimumReceivedFormatted,
|
|
65
|
+
senderAddress: address,
|
|
66
|
+
deadline,
|
|
67
|
+
args: __classPrivateFieldGet(this, _a, "m", _FlamingoSwapInvocationBuilderNeo3_mapRoutePathToArgs).call(this, routePath),
|
|
68
|
+
});
|
|
69
|
+
invocations.push(swapInvocation);
|
|
70
|
+
return {
|
|
71
|
+
invocations,
|
|
72
|
+
signers: [{ scopes: neon_core_1.tx.WitnessScope.CustomContracts, allowedContracts }],
|
|
73
|
+
};
|
|
74
|
+
}, _FlamingoSwapInvocationBuilderNeo3_mapRoutePathToArgs = function _FlamingoSwapInvocationBuilderNeo3_mapRoutePathToArgs(routePath) {
|
|
75
|
+
return routePath.map(token => ({
|
|
76
|
+
type: 'Hash160',
|
|
77
|
+
value: token.hash,
|
|
78
|
+
}));
|
|
79
|
+
}, _FlamingoSwapInvocationBuilderNeo3_getAllowedContracts = function _FlamingoSwapInvocationBuilderNeo3_getAllowedContracts(scriptHashes, routePath) {
|
|
80
|
+
return [
|
|
81
|
+
scriptHashes.flamingoSwapRouter,
|
|
82
|
+
scriptHashes.flamingoFactory,
|
|
83
|
+
scriptHashes.flamingoPairWhiteList,
|
|
84
|
+
...routePath.map(token => token.hash),
|
|
85
|
+
];
|
|
86
|
+
}, _FlamingoSwapInvocationBuilderNeo3_buildNEOTransferInvocation = function _FlamingoSwapInvocationBuilderNeo3_buildNEOTransferInvocation(address, amount, network) {
|
|
87
|
+
const bNEO = FlamingoSwapHelper_1.FlamingoSwapHelper.getFlamingoSwapToken(network, 'bNEO');
|
|
88
|
+
const GAS = FlamingoSwapHelper_1.FlamingoSwapHelper.getFlamingoSwapToken(network, 'GAS');
|
|
89
|
+
return NeonDappKitInvocationBuilderNeo3_1.NeonDappKitInvocationBuilderNeo3.transferContractInvocation({
|
|
90
|
+
senderAddress: address,
|
|
91
|
+
amount,
|
|
92
|
+
tokenHash: bNEO.hash,
|
|
93
|
+
contractHash: GAS.hash,
|
|
94
|
+
});
|
|
95
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Arg, ContractInvocation } from '@cityofzion/neon-dappkit-types';
|
|
2
|
+
export type GetReservesParams = {
|
|
3
|
+
routerScriptHash: string;
|
|
4
|
+
tokenToReceiveHash: string;
|
|
5
|
+
tokenToUseHash: string;
|
|
6
|
+
};
|
|
7
|
+
export type TokenOutForTokenInParams = {
|
|
8
|
+
routerScriptHash: string;
|
|
9
|
+
senderAddress: string;
|
|
10
|
+
amountToReceive: string;
|
|
11
|
+
maximumSelling: string;
|
|
12
|
+
deadline: string;
|
|
13
|
+
args: Arg[];
|
|
14
|
+
};
|
|
15
|
+
export type TokenInForTokenOutParams = {
|
|
16
|
+
routerScriptHash: string;
|
|
17
|
+
senderAddress: string;
|
|
18
|
+
amountToUse: string;
|
|
19
|
+
minimumReceived: string;
|
|
20
|
+
deadline: string;
|
|
21
|
+
args: Arg[];
|
|
22
|
+
};
|
|
23
|
+
export type TransferArgs = {
|
|
24
|
+
contractHash: string;
|
|
25
|
+
senderAddress: string;
|
|
26
|
+
tokenHash: string;
|
|
27
|
+
amount: string;
|
|
28
|
+
};
|
|
29
|
+
export declare class NeonDappKitInvocationBuilderNeo3 {
|
|
30
|
+
static getReservesContractInvocation({ routerScriptHash, tokenToReceiveHash, tokenToUseHash, }: GetReservesParams): ContractInvocation;
|
|
31
|
+
static swapTokenOutForTokenInContractInvocation({ routerScriptHash, senderAddress, amountToReceive, maximumSelling, deadline, args, }: TokenOutForTokenInParams): ContractInvocation;
|
|
32
|
+
static swapTokenInForTokenOutContractInvocation({ routerScriptHash, senderAddress, amountToUse, minimumReceived, deadline, args, }: TokenInForTokenOutParams): ContractInvocation;
|
|
33
|
+
static transferContractInvocation({ contractHash, senderAddress, tokenHash, amount, }: TransferArgs): ContractInvocation;
|
|
34
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NeonDappKitInvocationBuilderNeo3 = void 0;
|
|
4
|
+
class NeonDappKitInvocationBuilderNeo3 {
|
|
5
|
+
static getReservesContractInvocation({ routerScriptHash, tokenToReceiveHash, tokenToUseHash, }) {
|
|
6
|
+
return {
|
|
7
|
+
scriptHash: routerScriptHash,
|
|
8
|
+
operation: 'getReserves',
|
|
9
|
+
args: [
|
|
10
|
+
{
|
|
11
|
+
type: 'Hash160',
|
|
12
|
+
value: tokenToReceiveHash,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: 'Hash160',
|
|
16
|
+
value: tokenToUseHash,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
static swapTokenOutForTokenInContractInvocation({ routerScriptHash, senderAddress, amountToReceive, maximumSelling, deadline, args, }) {
|
|
22
|
+
return {
|
|
23
|
+
scriptHash: routerScriptHash,
|
|
24
|
+
operation: 'swapTokenOutForTokenIn',
|
|
25
|
+
args: [
|
|
26
|
+
{
|
|
27
|
+
type: 'Hash160',
|
|
28
|
+
value: senderAddress,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'Integer',
|
|
32
|
+
value: amountToReceive,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'Integer',
|
|
36
|
+
value: maximumSelling,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'Array',
|
|
40
|
+
value: args,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 'Integer',
|
|
44
|
+
value: deadline,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
static swapTokenInForTokenOutContractInvocation({ routerScriptHash, senderAddress, amountToUse, minimumReceived, deadline, args, }) {
|
|
50
|
+
return {
|
|
51
|
+
scriptHash: routerScriptHash,
|
|
52
|
+
operation: 'swapTokenInForTokenOut',
|
|
53
|
+
args: [
|
|
54
|
+
{
|
|
55
|
+
type: 'Hash160',
|
|
56
|
+
value: senderAddress,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'Integer',
|
|
60
|
+
value: amountToUse,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'Integer',
|
|
64
|
+
value: minimumReceived,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
type: 'Array',
|
|
68
|
+
value: args,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: 'Integer',
|
|
72
|
+
value: deadline,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static transferContractInvocation({ contractHash, senderAddress, tokenHash, amount, }) {
|
|
78
|
+
return {
|
|
79
|
+
scriptHash: contractHash,
|
|
80
|
+
operation: 'transfer',
|
|
81
|
+
args: [
|
|
82
|
+
{
|
|
83
|
+
type: 'Hash160',
|
|
84
|
+
value: senderAddress,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: 'Hash160',
|
|
88
|
+
value: tokenHash,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'Integer',
|
|
92
|
+
value: amount,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: 'Any',
|
|
96
|
+
value: null,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.NeonDappKitInvocationBuilderNeo3 = NeonDappKitInvocationBuilderNeo3;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Token } from '@cityofzion/blockchain-service';
|
|
2
|
+
import BigNumber from 'bignumber.js';
|
|
3
|
+
import { BSNeo3NetworkId } from '../helpers/BSNeo3Helper';
|
|
4
|
+
export type FlamingoSwapScriptHashes = {
|
|
5
|
+
flamingoSwapRouter: string;
|
|
6
|
+
flamingoPairWhiteList: string;
|
|
7
|
+
flamingoFactory: string;
|
|
8
|
+
};
|
|
9
|
+
export type FlamingoSwapPoolInfo = {
|
|
10
|
+
symbol: string;
|
|
11
|
+
decimals: number;
|
|
12
|
+
hash: string;
|
|
13
|
+
tokens: Token[];
|
|
14
|
+
};
|
|
15
|
+
export type FlamingoSwapPools = {
|
|
16
|
+
[key: string]: FlamingoSwapPoolInfo;
|
|
17
|
+
};
|
|
18
|
+
export type FlamingoSwapTokens = {
|
|
19
|
+
[key: string]: Token;
|
|
20
|
+
};
|
|
21
|
+
export declare const BLOCKCHAIN_WSS_URL = "wss://rpc10.n3.nspcc.ru:10331/ws";
|
|
22
|
+
export declare class FlamingoSwapConstants {
|
|
23
|
+
static readonly BN_0: BigNumber;
|
|
24
|
+
static readonly BN_1: BigNumber;
|
|
25
|
+
static readonly BN_997: BigNumber;
|
|
26
|
+
static readonly BN_1000: BigNumber;
|
|
27
|
+
static readonly FEE_RATE: BigNumber;
|
|
28
|
+
static readonly GAS_PER_NEO = 0.001;
|
|
29
|
+
static readonly TESTNET_FLAMINGO_SWAP_TOKENS: FlamingoSwapTokens;
|
|
30
|
+
static readonly MAINNET_FLAMINGO_SWAP_TOKENS: FlamingoSwapTokens;
|
|
31
|
+
static readonly FLAMINGO_SWAP_TOKENS: Record<BSNeo3NetworkId, FlamingoSwapTokens>;
|
|
32
|
+
static readonly FLAMINGO_SWAP_SCRIPT_HASHES: Partial<Record<BSNeo3NetworkId, FlamingoSwapScriptHashes>>;
|
|
33
|
+
static readonly TESTNET_FLAMINGO_SWAP_POOLS: FlamingoSwapPools;
|
|
34
|
+
static readonly MAINNET_FLAMINGO_SWAP_POOLS: FlamingoSwapPools;
|
|
35
|
+
static readonly FLAMINGO_SWAP_POOLS: Record<BSNeo3NetworkId, FlamingoSwapPools>;
|
|
36
|
+
}
|