@cityofzion/bs-neo-legacy 1.10.4 → 1.10.5
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/constants/BSNeoLegacyConstants.d.ts +6 -3
- package/dist/constants/BSNeoLegacyConstants.js +6 -3
- package/dist/helpers/BSNeoLegacyHelper.d.ts +11 -1
- package/dist/helpers/BSNeoLegacyHelper.js +53 -0
- package/dist/services/BSNeoLegacy.d.ts +40 -8
- package/dist/services/BSNeoLegacy.js +62 -55
- package/package.json +2 -2
|
@@ -18,7 +18,10 @@ export declare class BSNeoLegacyConstants {
|
|
|
18
18
|
static ALL_NETWORKS: Network<BSNeoLegacyNetworkId>[];
|
|
19
19
|
static DEFAULT_BIP44_DERIVATION_PATH: string;
|
|
20
20
|
static DEFAULT_NETWORK: Network<BSNeoLegacyNetworkId>;
|
|
21
|
-
static readonly
|
|
22
|
-
static readonly
|
|
23
|
-
static readonly
|
|
21
|
+
static readonly MIGRATION_COZ_LEGACY_ADDRESS = "AaT27thuyPaqERPwERhk7QhfKrbj4xoyAV";
|
|
22
|
+
static readonly MIGRATION_COZ_FEE = 0.01;
|
|
23
|
+
static readonly MIGRATION_NEP_17_TRANSFER_FEE = 0.0112143;
|
|
24
|
+
static readonly MIGRATION_MIN_GAS = 0.1;
|
|
25
|
+
static readonly MIGRATION_MIN_NEO = 2;
|
|
26
|
+
static readonly MIGRATION_COZ_NEO3_ADDRESS = "NLMsicDapULKFDmAzTsbhwrZjYZ83j53Ty";
|
|
24
27
|
}
|
|
@@ -58,6 +58,9 @@ BSNeoLegacyConstants.TESTNET_NETWORKS = [
|
|
|
58
58
|
BSNeoLegacyConstants.ALL_NETWORKS = [..._a.MAINNET_NETWORKS, ..._a.TESTNET_NETWORKS];
|
|
59
59
|
BSNeoLegacyConstants.DEFAULT_BIP44_DERIVATION_PATH = "m/44'/888'/0'/0/?";
|
|
60
60
|
BSNeoLegacyConstants.DEFAULT_NETWORK = _a.MAINNET_NETWORKS[0];
|
|
61
|
-
BSNeoLegacyConstants.
|
|
62
|
-
BSNeoLegacyConstants.
|
|
63
|
-
BSNeoLegacyConstants.
|
|
61
|
+
BSNeoLegacyConstants.MIGRATION_COZ_LEGACY_ADDRESS = 'AaT27thuyPaqERPwERhk7QhfKrbj4xoyAV';
|
|
62
|
+
BSNeoLegacyConstants.MIGRATION_COZ_FEE = 0.01; // 1%
|
|
63
|
+
BSNeoLegacyConstants.MIGRATION_NEP_17_TRANSFER_FEE = 0.0112143;
|
|
64
|
+
BSNeoLegacyConstants.MIGRATION_MIN_GAS = 0.1;
|
|
65
|
+
BSNeoLegacyConstants.MIGRATION_MIN_NEO = 2;
|
|
66
|
+
BSNeoLegacyConstants.MIGRATION_COZ_NEO3_ADDRESS = 'NLMsicDapULKFDmAzTsbhwrZjYZ83j53Ty';
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { Network } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { BlockchainService, Network } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeoLegacyNetworkId } from '../constants/BSNeoLegacyConstants';
|
|
3
|
+
export type WaitForMigrationParams = {
|
|
4
|
+
transactionHash: string;
|
|
5
|
+
neo3Address: string;
|
|
6
|
+
neo3Service: BlockchainService;
|
|
7
|
+
neoLegacyService: BlockchainService;
|
|
8
|
+
};
|
|
3
9
|
export declare class BSNeoLegacyHelper {
|
|
4
10
|
static getLegacyNetwork(network: Network<BSNeoLegacyNetworkId>): string;
|
|
5
11
|
static getTokens(network: Network<BSNeoLegacyNetworkId>): {
|
|
@@ -11,4 +17,8 @@ export declare class BSNeoLegacyHelper {
|
|
|
11
17
|
static getRpcList(network: Network<BSNeoLegacyNetworkId>): string[];
|
|
12
18
|
static isMainnet(network: Network<BSNeoLegacyNetworkId>): boolean;
|
|
13
19
|
static normalizeHash(hash: string): string;
|
|
20
|
+
static waitForMigration(params: WaitForMigrationParams): Promise<{
|
|
21
|
+
isTransactionConfirmed: boolean;
|
|
22
|
+
isNeo3TransactionConfirmed: boolean;
|
|
23
|
+
}>;
|
|
14
24
|
}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
15
|
exports.BSNeoLegacyHelper = void 0;
|
|
16
|
+
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
7
17
|
const native_json_1 = __importDefault(require("../assets/tokens/native.json"));
|
|
8
18
|
const BSNeoLegacyConstants_1 = require("../constants/BSNeoLegacyConstants");
|
|
9
19
|
class BSNeoLegacyHelper {
|
|
@@ -28,5 +38,48 @@ class BSNeoLegacyHelper {
|
|
|
28
38
|
static normalizeHash(hash) {
|
|
29
39
|
return hash.startsWith('0x') ? hash.slice(2) : hash;
|
|
30
40
|
}
|
|
41
|
+
static waitForMigration(params) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const { neo3Address, neo3Service, transactionHash, neoLegacyService } = params;
|
|
44
|
+
const MAX_ATTEMPTS = 10;
|
|
45
|
+
const NEO3_MAX_ATTEMPTS = 20;
|
|
46
|
+
const response = {
|
|
47
|
+
isTransactionConfirmed: false,
|
|
48
|
+
isNeo3TransactionConfirmed: false,
|
|
49
|
+
};
|
|
50
|
+
let transactionResponse;
|
|
51
|
+
for (let i = 0; i < MAX_ATTEMPTS; i++) {
|
|
52
|
+
yield (0, blockchain_service_1.wait)(30000);
|
|
53
|
+
try {
|
|
54
|
+
transactionResponse = yield neoLegacyService.blockchainDataService.getTransaction(transactionHash);
|
|
55
|
+
response.isTransactionConfirmed = true;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
catch (_a) {
|
|
59
|
+
// Empty block
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (!response.isTransactionConfirmed)
|
|
63
|
+
return response;
|
|
64
|
+
for (let i = 0; i < NEO3_MAX_ATTEMPTS; i++) {
|
|
65
|
+
yield (0, blockchain_service_1.wait)(60000);
|
|
66
|
+
try {
|
|
67
|
+
const neo3Response = yield neo3Service.blockchainDataService.getTransactionsByAddress({
|
|
68
|
+
address: neo3Address,
|
|
69
|
+
});
|
|
70
|
+
const isTransactionConfirmed = neo3Response.transactions.some(transaction => transaction.time > transactionResponse.time &&
|
|
71
|
+
transaction.transfers.some(transfer => transfer.from === BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_COZ_NEO3_ADDRESS));
|
|
72
|
+
if (isTransactionConfirmed) {
|
|
73
|
+
response.isNeo3TransactionConfirmed = true;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (_b) {
|
|
78
|
+
// Empty block
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return response;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
31
84
|
}
|
|
32
85
|
exports.BSNeoLegacyHelper = BSNeoLegacyHelper;
|
|
@@ -1,11 +1,43 @@
|
|
|
1
|
-
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, TransferParam, BSWithExplorerService, ExplorerService, BSWithLedger, GetLedgerTransport,
|
|
1
|
+
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, TransferParam, BSWithExplorerService, ExplorerService, BSWithLedger, GetLedgerTransport, BalanceResponse } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeoLegacyNetworkId } from '../constants/BSNeoLegacyConstants';
|
|
3
3
|
import { NeonJsLedgerServiceNeoLegacy } from './ledger/NeonJsLedgerServiceNeoLegacy';
|
|
4
|
-
export
|
|
4
|
+
export type MigrateParams<BSName extends string = string> = {
|
|
5
|
+
account: Account<BSName>;
|
|
6
|
+
neo3Address: string;
|
|
7
|
+
neoLegacyMigrationAmounts: CalculateNeoLegacyMigrationAmountsResponse;
|
|
8
|
+
};
|
|
9
|
+
export type CalculateNeo3MigrationAmountsResponse = {
|
|
10
|
+
gasMigrationTotalFees?: string;
|
|
11
|
+
neoMigrationTotalFees?: string;
|
|
12
|
+
gasMigrationReceiveAmount?: string;
|
|
13
|
+
neoMigrationReceiveAmount?: string;
|
|
14
|
+
};
|
|
15
|
+
export type CalculateNeoLegacyMigrationAmountsResponse = {
|
|
16
|
+
hasEnoughGasBalance: boolean;
|
|
17
|
+
hasEnoughNeoBalance: boolean;
|
|
18
|
+
gasBalance?: BalanceResponse;
|
|
19
|
+
neoBalance?: BalanceResponse;
|
|
20
|
+
};
|
|
21
|
+
export declare class BSNeoLegacy<BSName extends string = string> implements BlockchainService<BSName, BSNeoLegacyNetworkId>, BSClaimable<BSName>, BSWithExplorerService, BSWithLedger<BSName> {
|
|
5
22
|
#private;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
23
|
+
NATIVE_ASSETS: {
|
|
24
|
+
hash: string;
|
|
25
|
+
symbol: string;
|
|
26
|
+
name: string;
|
|
27
|
+
decimals: number;
|
|
28
|
+
}[];
|
|
29
|
+
GAS_ASSET: {
|
|
30
|
+
hash: string;
|
|
31
|
+
symbol: string;
|
|
32
|
+
name: string;
|
|
33
|
+
decimals: number;
|
|
34
|
+
};
|
|
35
|
+
NEO_ASSET: {
|
|
36
|
+
hash: string;
|
|
37
|
+
symbol: string;
|
|
38
|
+
name: string;
|
|
39
|
+
decimals: number;
|
|
40
|
+
};
|
|
9
41
|
readonly name: BSName;
|
|
10
42
|
readonly bip44DerivationPath: string;
|
|
11
43
|
nativeTokens: Token[];
|
|
@@ -32,10 +64,10 @@ export declare class BSNeoLegacy<BSName extends string = string> implements Bloc
|
|
|
32
64
|
encrypt(key: string, password: string): Promise<string>;
|
|
33
65
|
transfer({ intents, senderAccount, tipIntent, ...params }: TransferParam<BSName>): Promise<string[]>;
|
|
34
66
|
claim(account: Account): Promise<string>;
|
|
67
|
+
migrate({ account, neo3Address, neoLegacyMigrationAmounts }: MigrateParams<BSName>): Promise<string>;
|
|
35
68
|
/**
|
|
36
69
|
* Reference: https://github.com/CityOfZion/legacy-n3-swap-service/blob/master/policy/policy.go
|
|
37
70
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
private getMigrationNeo3ValidatedData;
|
|
71
|
+
calculateNeo3MigrationAmounts(neoLegacyMigrationAmounts: CalculateNeoLegacyMigrationAmountsResponse): CalculateNeo3MigrationAmountsResponse;
|
|
72
|
+
calculateNeoLegacyMigrationAmounts(balance: BalanceResponse[]): CalculateNeoLegacyMigrationAmountsResponse;
|
|
41
73
|
}
|
|
@@ -184,46 +184,24 @@ class BSNeoLegacy {
|
|
|
184
184
|
return response.tx.hash;
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
* Reference: https://github.com/CityOfZion/legacy-n3-swap-service/blob/master/policy/policy.go
|
|
189
|
-
*/
|
|
190
|
-
calculateToMigrateToNeo3Values(params) {
|
|
187
|
+
migrate({ account, neo3Address, neoLegacyMigrationAmounts }) {
|
|
191
188
|
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
if (gasAmountNumber) {
|
|
195
|
-
// Two transfers fee and one transfer fee left over
|
|
196
|
-
const allNep17TransfersFee = BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_NEO3_NEP_17_TRANSFER_FEE * 3;
|
|
197
|
-
// Necessary to calculate the COZ fee
|
|
198
|
-
const gasAmountNumberLessAllNep17TransfersFee = gasAmountNumber - allNep17TransfersFee;
|
|
199
|
-
// Example: ~0.06635710 * 0.01 = ~0.00066357
|
|
200
|
-
const cozFee = gasAmountNumberLessAllNep17TransfersFee * BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_NEO3_COZ_FEE;
|
|
201
|
-
// Example: ~0.06635710 - ~0.00066357 = ~0.06569352
|
|
202
|
-
const gasAmountNumberLessCozFee = gasAmountNumberLessAllNep17TransfersFee - cozFee;
|
|
203
|
-
const allGasFeeNumberThatUserWillPay = cozFee + BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_NEO3_NEP_17_TRANSFER_FEE * 2;
|
|
204
|
-
const allGasAmountNumberThatUserWillReceive = gasAmountNumberLessCozFee + BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_NEO3_NEP_17_TRANSFER_FEE;
|
|
205
|
-
response.gasMigrationTotalFees = (0, blockchain_service_1.formatNumber)(allGasFeeNumberThatUserWillPay, this.GAS_ASSET.decimals);
|
|
206
|
-
response.gasMigrationAmount = (0, blockchain_service_1.formatNumber)(allGasAmountNumberThatUserWillReceive, this.GAS_ASSET.decimals);
|
|
189
|
+
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.isMainnet(this.network)) {
|
|
190
|
+
throw new Error('Must use Mainnet network');
|
|
207
191
|
}
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
|
|
192
|
+
if (!neoLegacyMigrationAmounts.hasEnoughGasBalance || !neoLegacyMigrationAmounts.gasBalance) {
|
|
193
|
+
throw new Error('Must have at least 0.1 GAS');
|
|
194
|
+
}
|
|
195
|
+
if (!neoLegacyMigrationAmounts.hasEnoughNeoBalance || !neoLegacyMigrationAmounts.neoBalance) {
|
|
196
|
+
throw new Error('Must have at least 2 NEO');
|
|
211
197
|
}
|
|
212
|
-
return response;
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
migrateToNeo3({ account, address }) {
|
|
216
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
-
if (!address)
|
|
218
|
-
throw new Error('Must have address');
|
|
219
|
-
const { gasAmountNumber, neoAmountNumber } = yield this.getMigrationNeo3ValidatedData({ account });
|
|
220
198
|
const { neonJsAccount, signingCallback } = yield __classPrivateFieldGet(this, _BSNeoLegacy_instances, "m", _BSNeoLegacy_generateSigningCallback).call(this, account);
|
|
221
199
|
const provider = new neon_js_1.api.neoCli.instance(this.network.url);
|
|
222
200
|
const intents = [];
|
|
223
|
-
if (
|
|
224
|
-
intents.push(...neon_js_1.api.makeIntent({ [this.GAS_ASSET.symbol]:
|
|
225
|
-
if (
|
|
226
|
-
intents.push(...neon_js_1.api.makeIntent({ [this.NEO_ASSET.symbol]:
|
|
201
|
+
if (neoLegacyMigrationAmounts.gasBalance)
|
|
202
|
+
intents.push(...neon_js_1.api.makeIntent({ [this.GAS_ASSET.symbol]: Number(neoLegacyMigrationAmounts.gasBalance.amount) }, BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_COZ_NEO3_ADDRESS));
|
|
203
|
+
if (neoLegacyMigrationAmounts.neoBalance)
|
|
204
|
+
intents.push(...neon_js_1.api.makeIntent({ [this.NEO_ASSET.symbol]: Number(neoLegacyMigrationAmounts.neoBalance.amount) }, BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_COZ_NEO3_ADDRESS));
|
|
227
205
|
const response = yield neon_js_1.api.sendAsset({
|
|
228
206
|
url: this.network.url,
|
|
229
207
|
api: provider,
|
|
@@ -235,7 +213,7 @@ class BSNeoLegacy {
|
|
|
235
213
|
attributes: [
|
|
236
214
|
new neon_js_1.tx.TransactionAttribute({
|
|
237
215
|
usage: neon_js_1.tx.TxAttrUsage.Remark14,
|
|
238
|
-
data: neon_js_1.u.str2hexstring(
|
|
216
|
+
data: neon_js_1.u.str2hexstring(neo3Address),
|
|
239
217
|
}),
|
|
240
218
|
new neon_js_1.tx.TransactionAttribute({
|
|
241
219
|
usage: neon_js_1.tx.TxAttrUsage.Remark15,
|
|
@@ -249,26 +227,55 @@ class BSNeoLegacy {
|
|
|
249
227
|
return response.tx.hash;
|
|
250
228
|
});
|
|
251
229
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
230
|
+
/**
|
|
231
|
+
* Reference: https://github.com/CityOfZion/legacy-n3-swap-service/blob/master/policy/policy.go
|
|
232
|
+
*/
|
|
233
|
+
calculateNeo3MigrationAmounts(neoLegacyMigrationAmounts) {
|
|
234
|
+
const response = {
|
|
235
|
+
gasMigrationReceiveAmount: undefined,
|
|
236
|
+
gasMigrationTotalFees: undefined,
|
|
237
|
+
neoMigrationReceiveAmount: undefined,
|
|
238
|
+
neoMigrationTotalFees: undefined,
|
|
239
|
+
};
|
|
240
|
+
if (neoLegacyMigrationAmounts.gasBalance && neoLegacyMigrationAmounts.hasEnoughGasBalance) {
|
|
241
|
+
// Two transfers fee and one transfer fee left over
|
|
242
|
+
const allNep17TransfersFee = BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_NEP_17_TRANSFER_FEE * 3;
|
|
243
|
+
const gasMigrationAmountNumber = Number(neoLegacyMigrationAmounts.gasBalance.amount);
|
|
244
|
+
// Necessary to calculate the COZ fee
|
|
245
|
+
const gasAmountNumberLessAllNep17TransfersFee = gasMigrationAmountNumber - allNep17TransfersFee;
|
|
246
|
+
// Example: ~0.06635710 * 0.01 = ~0.00066357
|
|
247
|
+
const cozFee = gasAmountNumberLessAllNep17TransfersFee * BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_COZ_FEE;
|
|
248
|
+
// Example: ~0.06635710 - ~0.00066357 = ~0.06569352
|
|
249
|
+
const gasAmountNumberLessCozFee = gasAmountNumberLessAllNep17TransfersFee - cozFee;
|
|
250
|
+
const allGasFeeNumberThatUserWillPay = cozFee + BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_NEP_17_TRANSFER_FEE * 2;
|
|
251
|
+
const allGasAmountNumberThatUserWillReceive = gasAmountNumberLessCozFee + BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_NEP_17_TRANSFER_FEE;
|
|
252
|
+
response.gasMigrationTotalFees = (0, blockchain_service_1.formatNumber)(allGasFeeNumberThatUserWillPay, this.GAS_ASSET.decimals);
|
|
253
|
+
response.gasMigrationReceiveAmount = (0, blockchain_service_1.formatNumber)(allGasAmountNumberThatUserWillReceive, this.GAS_ASSET.decimals);
|
|
254
|
+
}
|
|
255
|
+
if (neoLegacyMigrationAmounts.neoBalance && neoLegacyMigrationAmounts.hasEnoughNeoBalance) {
|
|
256
|
+
const neoMigrationAmountNumber = Number(neoLegacyMigrationAmounts.neoBalance.amount);
|
|
257
|
+
response.neoMigrationTotalFees = (0, blockchain_service_1.formatNumber)(Math.ceil(neoMigrationAmountNumber * BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_COZ_FEE), this.NEO_ASSET.decimals);
|
|
258
|
+
response.neoMigrationReceiveAmount = (0, blockchain_service_1.formatNumber)(neoMigrationAmountNumber - Number(response.neoMigrationTotalFees), this.NEO_ASSET.decimals);
|
|
259
|
+
}
|
|
260
|
+
return response;
|
|
261
|
+
}
|
|
262
|
+
calculateNeoLegacyMigrationAmounts(balance) {
|
|
263
|
+
const gasBalance = balance.find(({ token }) => (0, blockchain_service_1.normalizeHash)(token.hash) === this.GAS_ASSET.hash);
|
|
264
|
+
const neoBalance = balance.find(({ token }) => (0, blockchain_service_1.normalizeHash)(token.hash) === this.NEO_ASSET.hash);
|
|
265
|
+
let hasEnoughGasBalance = false;
|
|
266
|
+
let hasEnoughNeoBalance = false;
|
|
267
|
+
if (gasBalance) {
|
|
268
|
+
hasEnoughGasBalance = Number(gasBalance.amount) >= BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_MIN_GAS;
|
|
269
|
+
}
|
|
270
|
+
if (neoBalance) {
|
|
271
|
+
hasEnoughNeoBalance = Number(neoBalance.amount) >= BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_MIN_NEO;
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
gasBalance,
|
|
275
|
+
neoBalance,
|
|
276
|
+
hasEnoughGasBalance,
|
|
277
|
+
hasEnoughNeoBalance,
|
|
278
|
+
};
|
|
272
279
|
}
|
|
273
280
|
}
|
|
274
281
|
exports.BSNeoLegacy = BSNeoLegacy;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo-legacy",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.5",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "Coz",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@cityofzion/dora-ts": "0.0.11",
|
|
13
13
|
"@cityofzion/neon-js": "4.8.3",
|
|
14
14
|
"@ledgerhq/hw-transport": "~6.30.5",
|
|
15
|
-
"@cityofzion/blockchain-service": "1.16.
|
|
15
|
+
"@cityofzion/blockchain-service": "1.16.2",
|
|
16
16
|
"@cityofzion/bs-asteroid-sdk": "0.9.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|