@cityofzion/bs-neo-legacy 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/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 +59 -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,21 @@ 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
|
-
response.neoMigrationAmount = (0, blockchain_service_1.formatNumber)(neoAmountNumber - Number(response.neoMigrationTotalFees), this.NEO_ASSET.decimals);
|
|
192
|
+
if (!neoLegacyMigrationAmounts.hasEnoughGasBalance && !neoLegacyMigrationAmounts.hasEnoughNeoBalance) {
|
|
193
|
+
throw new Error('Must have at least 0.1 GAS or 2 NEO');
|
|
211
194
|
}
|
|
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
195
|
const { neonJsAccount, signingCallback } = yield __classPrivateFieldGet(this, _BSNeoLegacy_instances, "m", _BSNeoLegacy_generateSigningCallback).call(this, account);
|
|
221
196
|
const provider = new neon_js_1.api.neoCli.instance(this.network.url);
|
|
222
197
|
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]:
|
|
198
|
+
if (neoLegacyMigrationAmounts.gasBalance)
|
|
199
|
+
intents.push(...neon_js_1.api.makeIntent({ [this.GAS_ASSET.symbol]: Number(neoLegacyMigrationAmounts.gasBalance.amount) }, BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_COZ_NEO3_ADDRESS));
|
|
200
|
+
if (neoLegacyMigrationAmounts.neoBalance)
|
|
201
|
+
intents.push(...neon_js_1.api.makeIntent({ [this.NEO_ASSET.symbol]: Number(neoLegacyMigrationAmounts.neoBalance.amount) }, BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_COZ_NEO3_ADDRESS));
|
|
227
202
|
const response = yield neon_js_1.api.sendAsset({
|
|
228
203
|
url: this.network.url,
|
|
229
204
|
api: provider,
|
|
@@ -235,7 +210,7 @@ class BSNeoLegacy {
|
|
|
235
210
|
attributes: [
|
|
236
211
|
new neon_js_1.tx.TransactionAttribute({
|
|
237
212
|
usage: neon_js_1.tx.TxAttrUsage.Remark14,
|
|
238
|
-
data: neon_js_1.u.str2hexstring(
|
|
213
|
+
data: neon_js_1.u.str2hexstring(neo3Address),
|
|
239
214
|
}),
|
|
240
215
|
new neon_js_1.tx.TransactionAttribute({
|
|
241
216
|
usage: neon_js_1.tx.TxAttrUsage.Remark15,
|
|
@@ -249,26 +224,55 @@ class BSNeoLegacy {
|
|
|
249
224
|
return response.tx.hash;
|
|
250
225
|
});
|
|
251
226
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Reference: https://github.com/CityOfZion/legacy-n3-swap-service/blob/master/policy/policy.go
|
|
229
|
+
*/
|
|
230
|
+
calculateNeo3MigrationAmounts(neoLegacyMigrationAmounts) {
|
|
231
|
+
const response = {
|
|
232
|
+
gasMigrationReceiveAmount: undefined,
|
|
233
|
+
gasMigrationTotalFees: undefined,
|
|
234
|
+
neoMigrationReceiveAmount: undefined,
|
|
235
|
+
neoMigrationTotalFees: undefined,
|
|
236
|
+
};
|
|
237
|
+
if (neoLegacyMigrationAmounts.gasBalance && neoLegacyMigrationAmounts.hasEnoughGasBalance) {
|
|
238
|
+
// Two transfers fee and one transfer fee left over
|
|
239
|
+
const allNep17TransfersFee = BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_NEP_17_TRANSFER_FEE * 3;
|
|
240
|
+
const gasMigrationAmountNumber = Number(neoLegacyMigrationAmounts.gasBalance.amount);
|
|
241
|
+
// Necessary to calculate the COZ fee
|
|
242
|
+
const gasAmountNumberLessAllNep17TransfersFee = gasMigrationAmountNumber - allNep17TransfersFee;
|
|
243
|
+
// Example: ~0.06635710 * 0.01 = ~0.00066357
|
|
244
|
+
const cozFee = gasAmountNumberLessAllNep17TransfersFee * BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_COZ_FEE;
|
|
245
|
+
// Example: ~0.06635710 - ~0.00066357 = ~0.06569352
|
|
246
|
+
const gasAmountNumberLessCozFee = gasAmountNumberLessAllNep17TransfersFee - cozFee;
|
|
247
|
+
const allGasFeeNumberThatUserWillPay = cozFee + BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_NEP_17_TRANSFER_FEE * 2;
|
|
248
|
+
const allGasAmountNumberThatUserWillReceive = gasAmountNumberLessCozFee + BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_NEP_17_TRANSFER_FEE;
|
|
249
|
+
response.gasMigrationTotalFees = (0, blockchain_service_1.formatNumber)(allGasFeeNumberThatUserWillPay, this.GAS_ASSET.decimals);
|
|
250
|
+
response.gasMigrationReceiveAmount = (0, blockchain_service_1.formatNumber)(allGasAmountNumberThatUserWillReceive, this.GAS_ASSET.decimals);
|
|
251
|
+
}
|
|
252
|
+
if (neoLegacyMigrationAmounts.neoBalance && neoLegacyMigrationAmounts.hasEnoughNeoBalance) {
|
|
253
|
+
const neoMigrationAmountNumber = Number(neoLegacyMigrationAmounts.neoBalance.amount);
|
|
254
|
+
response.neoMigrationTotalFees = (0, blockchain_service_1.formatNumber)(Math.ceil(neoMigrationAmountNumber * BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_COZ_FEE), this.NEO_ASSET.decimals);
|
|
255
|
+
response.neoMigrationReceiveAmount = (0, blockchain_service_1.formatNumber)(neoMigrationAmountNumber - Number(response.neoMigrationTotalFees), this.NEO_ASSET.decimals);
|
|
256
|
+
}
|
|
257
|
+
return response;
|
|
258
|
+
}
|
|
259
|
+
calculateNeoLegacyMigrationAmounts(balance) {
|
|
260
|
+
const gasBalance = balance.find(({ token }) => (0, blockchain_service_1.normalizeHash)(token.hash) === this.GAS_ASSET.hash);
|
|
261
|
+
const neoBalance = balance.find(({ token }) => (0, blockchain_service_1.normalizeHash)(token.hash) === this.NEO_ASSET.hash);
|
|
262
|
+
let hasEnoughGasBalance = false;
|
|
263
|
+
let hasEnoughNeoBalance = false;
|
|
264
|
+
if (gasBalance) {
|
|
265
|
+
hasEnoughGasBalance = Number(gasBalance.amount) >= BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_MIN_GAS;
|
|
266
|
+
}
|
|
267
|
+
if (neoBalance) {
|
|
268
|
+
hasEnoughNeoBalance = Number(neoBalance.amount) >= BSNeoLegacyConstants_1.BSNeoLegacyConstants.MIGRATION_MIN_NEO;
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
gasBalance,
|
|
272
|
+
neoBalance,
|
|
273
|
+
hasEnoughGasBalance,
|
|
274
|
+
hasEnoughNeoBalance,
|
|
275
|
+
};
|
|
272
276
|
}
|
|
273
277
|
}
|
|
274
278
|
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.6",
|
|
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": {
|