@cityofzion/bs-multichain 1.0.8 → 1.0.10
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.
|
@@ -87,9 +87,9 @@ class Neo3NeoXBridgeOrchestrator {
|
|
|
87
87
|
if (!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_availableTokensToUse_get).value)
|
|
88
88
|
throw new blockchain_service_1.BSError('No available tokens to use', 'NO_AVAILABLE_TOKENS');
|
|
89
89
|
if (token) {
|
|
90
|
-
if (__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value && this.fromService.tokenService.predicate(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value
|
|
90
|
+
if (__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value && this.fromService.tokenService.predicate(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value, token))
|
|
91
91
|
return;
|
|
92
|
-
if (!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_availableTokensToUse_get).value.some(this.fromService.tokenService.predicate(token)))
|
|
92
|
+
if (!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_availableTokensToUse_get).value.some(currentToken => this.fromService.tokenService.predicate(token, currentToken)))
|
|
93
93
|
throw new blockchain_service_1.BSError('You are trying to use a token that is not available', 'TOKEN_NOT_AVAILABLE');
|
|
94
94
|
tokenToReceive = this.toService.neo3NeoXBridgeService.tokens.find(item => token.multichainId === item.multichainId);
|
|
95
95
|
if (!tokenToReceive)
|
|
@@ -150,15 +150,14 @@ class Neo3NeoXBridgeOrchestrator {
|
|
|
150
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
151
|
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_balances, balances, "f");
|
|
152
152
|
const tokenToUseBalance = __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value && balances
|
|
153
|
-
? balances === null || balances === void 0 ? void 0 : balances.find(item => this.fromService.tokenService.predicateByHash(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value
|
|
153
|
+
? balances === null || balances === void 0 ? void 0 : balances.find(item => this.fromService.tokenService.predicateByHash(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value, item.token))
|
|
154
154
|
: null;
|
|
155
155
|
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
156
156
|
value: tokenToUseBalance,
|
|
157
157
|
}, "a", _Neo3NeoXBridgeOrchestrator_tokenToUseBalance_set);
|
|
158
|
-
|
|
159
|
-
? balances === null || balances === void 0 ? void 0 : balances.find(item => this.fromService.tokenService.predicateByHash(this.fromService.feeToken
|
|
160
|
-
: null;
|
|
161
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_feeTokenBalance, feeTokenBalance, "f");
|
|
158
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_feeTokenBalance, balances
|
|
159
|
+
? balances === null || balances === void 0 ? void 0 : balances.find(item => this.fromService.tokenService.predicateByHash(this.fromService.feeToken, item.token))
|
|
160
|
+
: null, "f");
|
|
162
161
|
if (tokenToUseBalance === null || !__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value) {
|
|
163
162
|
return;
|
|
164
163
|
}
|
|
@@ -171,7 +170,7 @@ class Neo3NeoXBridgeOrchestrator {
|
|
|
171
170
|
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: constants.bridgeFee }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
172
171
|
const bridgeMaxAmountBn = blockchain_service_1.BSBigNumberHelper.fromNumber(constants.bridgeMaxAmount);
|
|
173
172
|
const tokenBalanceAmountBn = blockchain_service_1.BSBigNumberHelper.fromNumber((_a = tokenToUseBalance === null || tokenToUseBalance === void 0 ? void 0 : tokenToUseBalance.amount) !== null && _a !== void 0 ? _a : 0);
|
|
174
|
-
const isFeeToken = this.fromService.tokenService.predicateByHash(this.fromService.feeToken
|
|
173
|
+
const isFeeToken = this.fromService.tokenService.predicateByHash(this.fromService.feeToken, __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value);
|
|
175
174
|
const maxTokenBalanceAmountBn = isFeeToken
|
|
176
175
|
? tokenBalanceAmountBn.minus(constants.bridgeFee)
|
|
177
176
|
: tokenBalanceAmountBn;
|
|
@@ -239,7 +238,7 @@ class Neo3NeoXBridgeOrchestrator {
|
|
|
239
238
|
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
240
239
|
value: blockchain_service_1.BSBigNumberHelper.format(newBridgeFee, { decimals: this.fromService.feeToken.decimals }),
|
|
241
240
|
}, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
242
|
-
const isFeeToken = this.fromService.tokenService.predicateByHash(this.fromService.feeToken
|
|
241
|
+
const isFeeToken = this.fromService.tokenService.predicateByHash(this.fromService.feeToken, __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value);
|
|
243
242
|
if (newBridgeFee.plus(isFeeToken ? amountToUseBn : 0).isGreaterThan((_b = (_a = __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_feeTokenBalance, "f")) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0)) {
|
|
244
243
|
throw new blockchain_service_1.BSError('You do not have enough fee token balance to cover the bridge fee', 'INSUFFICIENT_FEE_TOKEN_BALANCE');
|
|
245
244
|
}
|
|
@@ -268,14 +267,13 @@ class Neo3NeoXBridgeOrchestrator {
|
|
|
268
267
|
!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_get).value) {
|
|
269
268
|
throw new blockchain_service_1.BSError('Required parameters are not set for bridging', 'BRIDGE_NOT_READY');
|
|
270
269
|
}
|
|
271
|
-
|
|
270
|
+
return yield this.fromService.neo3NeoXBridgeService.bridge({
|
|
272
271
|
account: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_get).value,
|
|
273
272
|
token: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value,
|
|
274
273
|
amount: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_get).value,
|
|
275
274
|
receiverAddress: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_addressToReceive_get).value,
|
|
276
275
|
bridgeFee: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_get).value,
|
|
277
276
|
});
|
|
278
|
-
return transaction;
|
|
279
277
|
});
|
|
280
278
|
}
|
|
281
279
|
static wait({ tokenToUse, tokenToReceive, transactionHash, neo3Service, neoXService, }) {
|
|
@@ -224,7 +224,7 @@ _SimpleSwapApi_tickersBySimpleSwapBlockchain = new WeakMap(), _SimpleSwapApi_axi
|
|
|
224
224
|
blockchainService = options.blockchainServicesByName[blockchain];
|
|
225
225
|
const normalizedHash = hash && blockchainService ? blockchainService.tokenService.normalizeHash(hash) : '';
|
|
226
226
|
const token = blockchainService.tokens.find(item => {
|
|
227
|
-
if (normalizedHash && blockchainService && blockchainService.tokenService.predicateByHash(item
|
|
227
|
+
if (normalizedHash && blockchainService && blockchainService.tokenService.predicateByHash(item, normalizedHash))
|
|
228
228
|
return true;
|
|
229
229
|
const currentLowerCaseSymbol = item.symbol.toLowerCase();
|
|
230
230
|
if (!normalizedHash)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-multichain",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"axios": "~1.8.2",
|
|
14
14
|
"lodash": "~4.17.21",
|
|
15
|
-
"@cityofzion/blockchain-service": "1.21.
|
|
15
|
+
"@cityofzion/blockchain-service": "1.21.1"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/jest": "29.5.3",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"@types/node": "~22.8.6",
|
|
28
28
|
"@typescript-eslint/eslint-plugin": "~8.12.2",
|
|
29
29
|
"@typescript-eslint/parser": "~8.12.2",
|
|
30
|
-
"@cityofzion/bs-
|
|
31
|
-
"@cityofzion/bs-ethereum": "2.13.
|
|
32
|
-
"@cityofzion/bs-
|
|
33
|
-
"@cityofzion/bs-
|
|
30
|
+
"@cityofzion/bs-neo3": "1.16.2",
|
|
31
|
+
"@cityofzion/bs-ethereum": "2.13.2",
|
|
32
|
+
"@cityofzion/bs-neo-legacy": "1.13.2",
|
|
33
|
+
"@cityofzion/bs-neox": "1.3.3"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsc --project tsconfig.build.json",
|