@cityofzion/bs-neo-legacy 1.10.0 → 1.10.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.
|
@@ -35,6 +35,6 @@ export declare class BSNeoLegacy<BSName extends string = string> implements Bloc
|
|
|
35
35
|
* Reference: https://github.com/CityOfZion/legacy-n3-swap-service/blob/master/policy/policy.go
|
|
36
36
|
*/
|
|
37
37
|
calculateToMigrateToNeo3Values(params: CalculateToMigrateToNeo3ValuesParams<BSName>): Promise<CalculateToMigrateToNeo3ValuesResponse>;
|
|
38
|
-
migrateToNeo3({ account, address }: MigrateToNeo3Params<BSName>): Promise<string
|
|
38
|
+
migrateToNeo3({ account, address }: MigrateToNeo3Params<BSName>): Promise<string>;
|
|
39
39
|
private getMigrationNeo3ValidatedData;
|
|
40
40
|
}
|
|
@@ -246,7 +246,7 @@ class BSNeoLegacy {
|
|
|
246
246
|
});
|
|
247
247
|
if (!response.tx)
|
|
248
248
|
throw new Error('Migration failed on send');
|
|
249
|
-
return
|
|
249
|
+
return response.tx.hash;
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
252
|
getMigrationNeo3ValidatedData({ account }) {
|
|
@@ -257,10 +257,16 @@ class BSNeoLegacy {
|
|
|
257
257
|
const balances = yield this.blockchainDataService.getBalance(account.address);
|
|
258
258
|
const gasAmount = (_a = balances.find(({ token }) => (0, blockchain_service_1.normalizeHash)(token.hash) === this.GAS_ASSET.hash)) === null || _a === void 0 ? void 0 : _a.amount;
|
|
259
259
|
const neoAmount = (_b = balances.find(({ token }) => (0, blockchain_service_1.normalizeHash)(token.hash) === this.NEO_ASSET.hash)) === null || _b === void 0 ? void 0 : _b.amount;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
let gasAmountNumber = Number(gasAmount) || 0;
|
|
261
|
+
let neoAmountNumber = Number(neoAmount) || 0;
|
|
262
|
+
const hasNotGasAmountEnough = gasAmountNumber < 0.1;
|
|
263
|
+
const hasNotNeoAmountEnough = neoAmountNumber < 2;
|
|
264
|
+
if (hasNotGasAmountEnough && hasNotNeoAmountEnough)
|
|
263
265
|
throw new Error('Must have at least 0.1 GAS or 2 NEO');
|
|
266
|
+
if (hasNotGasAmountEnough)
|
|
267
|
+
gasAmountNumber = 0;
|
|
268
|
+
if (hasNotNeoAmountEnough)
|
|
269
|
+
neoAmountNumber = 0;
|
|
264
270
|
return { gasAmountNumber, neoAmountNumber };
|
|
265
271
|
});
|
|
266
272
|
}
|
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.2",
|
|
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.15.
|
|
15
|
+
"@cityofzion/blockchain-service": "1.15.3",
|
|
16
16
|
"@cityofzion/bs-asteroid-sdk": "0.9.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|