@cityofzion/bs-multichain 3.0.4 → 3.0.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/BSAggregator.js +4 -15
- package/dist/features/bridge/Neo3NeoXBridgeOrchestrator.js +245 -241
- package/dist/features/swap/SimpleSwapApi.js +114 -144
- package/dist/features/swap/SimpleSwapOrchestrator.js +273 -295
- package/dist/features/swap/SimpleSwapService.js +20 -31
- package/dist/features/wallet-connect/WalletKitHelper.js +19 -32
- package/package.json +15 -18
|
@@ -1,13 +1,4 @@
|
|
|
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
|
-
};
|
|
11
2
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
3
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
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");
|
|
@@ -50,249 +41,229 @@ class Neo3NeoXBridgeOrchestrator {
|
|
|
50
41
|
this.fromService = isInitialNeoX ? params.neoXService : params.neo3Service;
|
|
51
42
|
this.toService = isInitialNeoX ? params.neo3Service : params.neoXService;
|
|
52
43
|
}
|
|
53
|
-
init() {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_feeTokenBalance, null, "f");
|
|
70
|
-
});
|
|
44
|
+
async init() {
|
|
45
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
46
|
+
value: [this.fromService.neo3NeoXBridgeService.gasToken, this.fromService.neo3NeoXBridgeService.neoToken],
|
|
47
|
+
}, "a", _Neo3NeoXBridgeOrchestrator_availableTokensToUse_set);
|
|
48
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, loading: false }, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_set);
|
|
49
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, valid: null, loading: false }, "a", _Neo3NeoXBridgeOrchestrator_addressToReceive_set);
|
|
50
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, valid: null, loading: false }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
51
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, loading: false }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_set);
|
|
52
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, loading: false }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMax_set);
|
|
53
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, loading: false }, "a", _Neo3NeoXBridgeOrchestrator_amountToReceive_set);
|
|
54
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, loading: false }, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_set);
|
|
55
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, loading: false }, "a", _Neo3NeoXBridgeOrchestrator_tokenToReceive_set);
|
|
56
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, loading: false }, "a", _Neo3NeoXBridgeOrchestrator_tokenToUseBalance_set);
|
|
57
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, loading: false }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
58
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_balances, null, "f");
|
|
59
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_feeTokenBalance, null, "f");
|
|
71
60
|
}
|
|
72
|
-
switchTokens() {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
yield this.setTokenToUse(tokenToReceive);
|
|
81
|
-
});
|
|
61
|
+
async switchTokens() {
|
|
62
|
+
const fromService = this.fromService;
|
|
63
|
+
const toService = this.toService;
|
|
64
|
+
this.fromService = toService;
|
|
65
|
+
this.toService = fromService;
|
|
66
|
+
const tokenToReceive = __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToReceive_get).value;
|
|
67
|
+
await this.init();
|
|
68
|
+
await this.setTokenToUse(tokenToReceive);
|
|
82
69
|
}
|
|
83
|
-
setTokenToUse(token) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (token)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
: this.toService.neo3NeoXBridgeService.neoToken;
|
|
98
|
-
}
|
|
99
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: tokenToReceive !== null && tokenToReceive !== void 0 ? tokenToReceive : null, error: null }, "a", _Neo3NeoXBridgeOrchestrator_tokenToReceive_set);
|
|
100
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: token, error: null }, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_set);
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
const treatedError = __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "m", _Neo3NeoXBridgeOrchestrator_treatError).call(this, error);
|
|
104
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { error: treatedError }, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_set);
|
|
105
|
-
throw treatedError;
|
|
70
|
+
async setTokenToUse(token) {
|
|
71
|
+
let tokenToReceive;
|
|
72
|
+
try {
|
|
73
|
+
if (!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_availableTokensToUse_get).value)
|
|
74
|
+
throw new blockchain_service_1.BSError('No available tokens to use', 'NO_AVAILABLE_TOKENS');
|
|
75
|
+
if (token) {
|
|
76
|
+
if (__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value && this.fromService.tokenService.predicate(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value, token))
|
|
77
|
+
return;
|
|
78
|
+
if (!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_availableTokensToUse_get).value.some(currentToken => this.fromService.tokenService.predicate(token, currentToken)))
|
|
79
|
+
throw new blockchain_service_1.BSError('You are trying to use a token that is not available', 'TOKEN_NOT_AVAILABLE');
|
|
80
|
+
const isGasToken = this.fromService.tokenService.predicateByHash(token, this.fromService.neo3NeoXBridgeService.gasToken);
|
|
81
|
+
tokenToReceive = isGasToken
|
|
82
|
+
? this.toService.neo3NeoXBridgeService.gasToken
|
|
83
|
+
: this.toService.neo3NeoXBridgeService.neoToken;
|
|
106
84
|
}
|
|
107
|
-
|
|
108
|
-
|
|
85
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: tokenToReceive ?? null, error: null }, "a", _Neo3NeoXBridgeOrchestrator_tokenToReceive_set);
|
|
86
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: token, error: null }, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_set);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
const treatedError = __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "m", _Neo3NeoXBridgeOrchestrator_treatError).call(this, error);
|
|
90
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { error: treatedError }, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_set);
|
|
91
|
+
throw treatedError;
|
|
92
|
+
}
|
|
93
|
+
await Promise.allSettled([this.setBalances(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_balances, "f")), this.setAmountToUse(null)]);
|
|
109
94
|
}
|
|
110
|
-
setAccountToUse(account) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (account)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
throw new blockchain_service_1.BSError('You are trying to use an account that is not compatible with the selected token', 'ACCOUNT_NOT_COMPATIBLE_WITH_TOKEN');
|
|
118
|
-
}
|
|
119
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: account, error: null }, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_set);
|
|
120
|
-
yield Promise.allSettled([this.setBalances(null), this.setAmountToUse(null)]);
|
|
95
|
+
async setAccountToUse(account) {
|
|
96
|
+
try {
|
|
97
|
+
if (account) {
|
|
98
|
+
if (__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_get).value && blockchain_service_1.BSAccountHelper.predicate(account)(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_get).value))
|
|
99
|
+
return;
|
|
100
|
+
if (this.fromService.name !== account.blockchain)
|
|
101
|
+
throw new blockchain_service_1.BSError('You are trying to use an account that is not compatible with the selected token', 'ACCOUNT_NOT_COMPATIBLE_WITH_TOKEN');
|
|
121
102
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
103
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: account, error: null }, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_set);
|
|
104
|
+
await Promise.allSettled([this.setBalances(null), this.setAmountToUse(null)]);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
const treatedError = __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "m", _Neo3NeoXBridgeOrchestrator_treatError).call(this, error);
|
|
108
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { error: treatedError }, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_set);
|
|
109
|
+
throw treatedError;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async setAddressToReceive(address) {
|
|
113
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
114
|
+
value: address,
|
|
115
|
+
loading: !!address,
|
|
116
|
+
valid: null,
|
|
117
|
+
error: null,
|
|
118
|
+
}, "a", _Neo3NeoXBridgeOrchestrator_addressToReceive_set);
|
|
119
|
+
if (__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_addressToReceiveTimeout, "f") !== null)
|
|
120
|
+
clearTimeout(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_addressToReceiveTimeout, "f"));
|
|
121
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_addressToReceiveTimeout, setTimeout(async () => {
|
|
122
|
+
if (__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_addressToReceive_get).value) {
|
|
123
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
124
|
+
valid: this.toService.validateAddress(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_addressToReceive_get).value),
|
|
125
|
+
loading: false,
|
|
126
|
+
}, "a", _Neo3NeoXBridgeOrchestrator_addressToReceive_set);
|
|
126
127
|
}
|
|
127
|
-
});
|
|
128
|
+
}, 1500), "f");
|
|
128
129
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
130
|
+
async setBalances(balances) {
|
|
131
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_balances, balances, "f");
|
|
132
|
+
const tokenToUseBalance = __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value && balances
|
|
133
|
+
? balances?.find(item => this.fromService.tokenService.predicateByHash(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value, item.token))
|
|
134
|
+
: null;
|
|
135
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
136
|
+
value: tokenToUseBalance,
|
|
137
|
+
}, "a", _Neo3NeoXBridgeOrchestrator_tokenToUseBalance_set);
|
|
138
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_feeTokenBalance, balances
|
|
139
|
+
? balances?.find(item => this.fromService.tokenService.predicateByHash(this.fromService.feeToken, item.token))
|
|
140
|
+
: null, "f");
|
|
141
|
+
if (tokenToUseBalance === null || !__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: true, error: null }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMax_set);
|
|
145
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: true, error: null }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_set);
|
|
146
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: true, error: null }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
147
|
+
try {
|
|
148
|
+
const constants = await this.fromService.neo3NeoXBridgeService.getBridgeConstants(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value);
|
|
149
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: constants.bridgeMinAmount }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_set);
|
|
150
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: constants.bridgeFee }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
151
|
+
const bridgeMaxAmountBn = blockchain_service_1.BSBigNumberHelper.fromNumber(constants.bridgeMaxAmount);
|
|
152
|
+
const tokenBalanceAmountBn = blockchain_service_1.BSBigNumberHelper.fromNumber(tokenToUseBalance?.amount ?? 0);
|
|
153
|
+
const isFeeToken = this.fromService.tokenService.predicateByHash(this.fromService.feeToken, __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value);
|
|
154
|
+
const maxTokenBalanceAmountBn = isFeeToken
|
|
155
|
+
? tokenBalanceAmountBn.minus(constants.bridgeFee)
|
|
156
|
+
: tokenBalanceAmountBn;
|
|
157
|
+
const max = blockchain_service_1.BSBigNumber.max(0, blockchain_service_1.BSBigNumber.min(bridgeMaxAmountBn, maxTokenBalanceAmountBn));
|
|
158
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: blockchain_service_1.BSBigNumberHelper.format(max, { decimals: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value.decimals }) }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMax_set);
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
const treatedError = __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "m", _Neo3NeoXBridgeOrchestrator_treatError).call(this, error);
|
|
162
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, error: treatedError }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMax_set);
|
|
163
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, error: treatedError }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_set);
|
|
164
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, error: treatedError }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
165
|
+
throw treatedError;
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: false }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMax_set);
|
|
169
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: false }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_set);
|
|
170
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: false }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
171
|
+
}
|
|
148
172
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
__classPrivateFieldSet(this,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
? balances === null || balances === void 0 ? void 0 : balances.find(item => this.fromService.tokenService.predicateByHash(this.fromService.feeToken, item.token))
|
|
161
|
-
: null, "f");
|
|
162
|
-
if (tokenToUseBalance === null || !__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value) {
|
|
173
|
+
async setAmountToUse(amount) {
|
|
174
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: amount }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
175
|
+
if (!amount) {
|
|
176
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { valid: null, loading: false, error: null }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
177
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, loading: false, error: null }, "a", _Neo3NeoXBridgeOrchestrator_amountToReceive_set);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_amountToUseTimeout, "f") !== null)
|
|
181
|
+
clearTimeout(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_amountToUseTimeout, "f"));
|
|
182
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_amountToUseTimeout, setTimeout(async () => {
|
|
183
|
+
if (!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value)
|
|
163
184
|
return;
|
|
164
|
-
}
|
|
165
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
166
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
167
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: true, error: null }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
185
|
+
const formattedAmount = blockchain_service_1.BSBigNumberHelper.format(amount, { decimals: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value.decimals });
|
|
186
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: formattedAmount }, "a", _Neo3NeoXBridgeOrchestrator_amountToReceive_set);
|
|
187
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: formattedAmount }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
168
188
|
try {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
189
|
+
if (__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value === null ||
|
|
190
|
+
__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_get).value === null ||
|
|
191
|
+
__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMax_get).value === null ||
|
|
192
|
+
__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_get).value === null ||
|
|
193
|
+
__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_get).value === null ||
|
|
194
|
+
__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_feeTokenBalance, "f") === null) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: true }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
198
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: true }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
199
|
+
const amountToUseBn = blockchain_service_1.BSBigNumberHelper.fromNumber(formattedAmount);
|
|
200
|
+
if (amountToUseBn.isLessThan(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_get).value)) {
|
|
201
|
+
throw new blockchain_service_1.BSError('Amount is below the minimum', 'AMOUNT_BELOW_MINIMUM');
|
|
202
|
+
}
|
|
203
|
+
if (amountToUseBn.isGreaterThan(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMax_get).value)) {
|
|
204
|
+
throw new blockchain_service_1.BSError('Amount is above the maximum', 'AMOUNT_ABOVE_MAXIMUM');
|
|
205
|
+
}
|
|
206
|
+
const approvalFee = await this.fromService.neo3NeoXBridgeService
|
|
207
|
+
.getApprovalFee({
|
|
208
|
+
account: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_get).value,
|
|
209
|
+
token: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value,
|
|
210
|
+
amount: formattedAmount,
|
|
211
|
+
})
|
|
212
|
+
.then(fee => fee)
|
|
213
|
+
.catch(() => '0');
|
|
214
|
+
const newBridgeFee = blockchain_service_1.BSBigNumberHelper.fromNumber(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_get).value).plus(approvalFee);
|
|
215
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
216
|
+
value: blockchain_service_1.BSBigNumberHelper.format(newBridgeFee, { decimals: this.fromService.feeToken.decimals }),
|
|
217
|
+
}, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
174
218
|
const isFeeToken = this.fromService.tokenService.predicateByHash(this.fromService.feeToken, __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: blockchain_service_1.BSBigNumberHelper.format(max, { decimals: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value.decimals }) }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMax_set);
|
|
219
|
+
if (newBridgeFee.plus(isFeeToken ? amountToUseBn : 0).isGreaterThan(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_feeTokenBalance, "f")?.amount ?? 0)) {
|
|
220
|
+
throw new blockchain_service_1.BSError('You do not have enough fee token balance to cover the bridge fee', 'INSUFFICIENT_FEE_TOKEN_BALANCE');
|
|
221
|
+
}
|
|
222
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { valid: true, error: null }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
180
223
|
}
|
|
181
224
|
catch (error) {
|
|
182
225
|
const treatedError = __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "m", _Neo3NeoXBridgeOrchestrator_treatError).call(this, error);
|
|
183
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
184
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, error: treatedError }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_set);
|
|
185
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { value: null, error: treatedError }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
186
|
-
throw treatedError;
|
|
226
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { valid: false, error: treatedError }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
187
227
|
}
|
|
188
228
|
finally {
|
|
189
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: false }, "a",
|
|
190
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: false }, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_set);
|
|
229
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: false }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
191
230
|
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: false }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
192
231
|
}
|
|
193
|
-
});
|
|
232
|
+
}, 1500), "f");
|
|
194
233
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
try {
|
|
213
|
-
if (__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value === null ||
|
|
214
|
-
__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_get).value === null ||
|
|
215
|
-
__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMax_get).value === null ||
|
|
216
|
-
__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_get).value === null ||
|
|
217
|
-
__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_get).value === null ||
|
|
218
|
-
__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_feeTokenBalance, "f") === null) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: true }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
222
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: true }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
223
|
-
const amountToUseBn = blockchain_service_1.BSBigNumberHelper.fromNumber(formattedAmount);
|
|
224
|
-
if (amountToUseBn.isLessThan(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMin_get).value)) {
|
|
225
|
-
throw new blockchain_service_1.BSError('Amount is below the minimum', 'AMOUNT_BELOW_MINIMUM');
|
|
226
|
-
}
|
|
227
|
-
if (amountToUseBn.isGreaterThan(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUseMax_get).value)) {
|
|
228
|
-
throw new blockchain_service_1.BSError('Amount is above the maximum', 'AMOUNT_ABOVE_MAXIMUM');
|
|
229
|
-
}
|
|
230
|
-
const approvalFee = yield this.fromService.neo3NeoXBridgeService
|
|
231
|
-
.getApprovalFee({
|
|
232
|
-
account: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_get).value,
|
|
233
|
-
token: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value,
|
|
234
|
-
amount: formattedAmount,
|
|
235
|
-
})
|
|
236
|
-
.then(fee => fee)
|
|
237
|
-
.catch(() => '0');
|
|
238
|
-
const newBridgeFee = blockchain_service_1.BSBigNumberHelper.fromNumber(__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_get).value).plus(approvalFee);
|
|
239
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, {
|
|
240
|
-
value: blockchain_service_1.BSBigNumberHelper.format(newBridgeFee, { decimals: this.fromService.feeToken.decimals }),
|
|
241
|
-
}, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
242
|
-
const isFeeToken = this.fromService.tokenService.predicateByHash(this.fromService.feeToken, __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value);
|
|
243
|
-
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
|
-
throw new blockchain_service_1.BSError('You do not have enough fee token balance to cover the bridge fee', 'INSUFFICIENT_FEE_TOKEN_BALANCE');
|
|
245
|
-
}
|
|
246
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { valid: true, error: null }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
247
|
-
}
|
|
248
|
-
catch (error) {
|
|
249
|
-
const treatedError = __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "m", _Neo3NeoXBridgeOrchestrator_treatError).call(this, error);
|
|
250
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { valid: false, error: treatedError }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
251
|
-
}
|
|
252
|
-
finally {
|
|
253
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: false }, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_set);
|
|
254
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_instances, { loading: false }, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_set);
|
|
255
|
-
}
|
|
256
|
-
}), 1500), "f");
|
|
234
|
+
async bridge() {
|
|
235
|
+
if (!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_get).value ||
|
|
236
|
+
!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value ||
|
|
237
|
+
!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToReceive_get).value ||
|
|
238
|
+
!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_get).valid ||
|
|
239
|
+
!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_get).value ||
|
|
240
|
+
!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToReceive_get).value ||
|
|
241
|
+
!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_addressToReceive_get).value ||
|
|
242
|
+
!__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_get).value) {
|
|
243
|
+
throw new blockchain_service_1.BSError('Required parameters are not set for bridging', 'BRIDGE_NOT_READY');
|
|
244
|
+
}
|
|
245
|
+
return await this.fromService.neo3NeoXBridgeService.bridge({
|
|
246
|
+
account: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_get).value,
|
|
247
|
+
token: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value,
|
|
248
|
+
amount: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_get).value,
|
|
249
|
+
receiverAddress: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_addressToReceive_get).value,
|
|
250
|
+
bridgeFee: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_get).value,
|
|
257
251
|
});
|
|
258
252
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
throw new blockchain_service_1.BSError('Required parameters are not set for bridging', 'BRIDGE_NOT_READY');
|
|
270
|
-
}
|
|
271
|
-
return yield this.fromService.neo3NeoXBridgeService.bridge({
|
|
272
|
-
account: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_accountToUse_get).value,
|
|
273
|
-
token: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_tokenToUse_get).value,
|
|
274
|
-
amount: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_amountToUse_get).value,
|
|
275
|
-
receiverAddress: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_addressToReceive_get).value,
|
|
276
|
-
bridgeFee: __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_instances, "a", _Neo3NeoXBridgeOrchestrator_bridgeFee_get).value,
|
|
277
|
-
});
|
|
253
|
+
static async wait({ tokenToUse, tokenToReceive, transactionHash, neo3Service, neoXService, }) {
|
|
254
|
+
const isNeo3Service = tokenToUse.blockchain === neo3Service.name;
|
|
255
|
+
const fromService = isNeo3Service ? neo3Service : neoXService;
|
|
256
|
+
const toService = isNeo3Service ? neoXService : neo3Service;
|
|
257
|
+
const nonce = await blockchain_service_1.BSUtilsHelper.retry(() => fromService.neo3NeoXBridgeService.getNonce({
|
|
258
|
+
token: tokenToUse,
|
|
259
|
+
transactionHash,
|
|
260
|
+
}), {
|
|
261
|
+
retries: 10,
|
|
262
|
+
delay: 30000,
|
|
278
263
|
});
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const isNeo3Service = tokenToUse.blockchain === neo3Service.name;
|
|
283
|
-
const fromService = isNeo3Service ? neo3Service : neoXService;
|
|
284
|
-
const toService = isNeo3Service ? neoXService : neo3Service;
|
|
285
|
-
const nonce = yield blockchain_service_1.BSUtilsHelper.retry(() => fromService.neo3NeoXBridgeService.getNonce({
|
|
286
|
-
token: tokenToUse,
|
|
287
|
-
transactionHash,
|
|
288
|
-
}), {
|
|
289
|
-
retries: 10,
|
|
290
|
-
delay: 30000,
|
|
291
|
-
});
|
|
292
|
-
yield blockchain_service_1.BSUtilsHelper.retry(() => toService.neo3NeoXBridgeService.getTransactionHashByNonce({ nonce, token: tokenToReceive }), {
|
|
293
|
-
retries: 10,
|
|
294
|
-
delay: 30000,
|
|
295
|
-
});
|
|
264
|
+
await blockchain_service_1.BSUtilsHelper.retry(() => toService.neo3NeoXBridgeService.getTransactionHashByNonce({ nonce, token: tokenToReceive }), {
|
|
265
|
+
retries: 10,
|
|
266
|
+
delay: 30000,
|
|
296
267
|
});
|
|
297
268
|
}
|
|
298
269
|
}
|
|
@@ -300,57 +271,90 @@ exports.Neo3NeoXBridgeOrchestrator = Neo3NeoXBridgeOrchestrator;
|
|
|
300
271
|
_Neo3NeoXBridgeOrchestrator_balances = new WeakMap(), _Neo3NeoXBridgeOrchestrator_feeTokenBalance = new WeakMap(), _Neo3NeoXBridgeOrchestrator_addressToReceiveTimeout = new WeakMap(), _Neo3NeoXBridgeOrchestrator_amountToUseTimeout = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalAvailableTokensToUse = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalTokenToUse = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalAccountToUse = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalAmountToUse = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalAmountToUseMin = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalAmountToUseMax = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalTokenToReceive = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalAddressToReceive = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalAmountToReceive = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalTokenToUseBalance = new WeakMap(), _Neo3NeoXBridgeOrchestrator_internalBridgeFee = new WeakMap(), _Neo3NeoXBridgeOrchestrator_instances = new WeakSet(), _Neo3NeoXBridgeOrchestrator_availableTokensToUse_get = function _Neo3NeoXBridgeOrchestrator_availableTokensToUse_get() {
|
|
301
272
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAvailableTokensToUse, "f");
|
|
302
273
|
}, _Neo3NeoXBridgeOrchestrator_availableTokensToUse_set = function _Neo3NeoXBridgeOrchestrator_availableTokensToUse_set(value) {
|
|
303
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAvailableTokensToUse,
|
|
274
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAvailableTokensToUse, {
|
|
275
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAvailableTokensToUse, "f"),
|
|
276
|
+
...value,
|
|
277
|
+
}, "f");
|
|
304
278
|
this.eventEmitter.emit('availableTokensToUse', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAvailableTokensToUse, "f"));
|
|
305
279
|
}, _Neo3NeoXBridgeOrchestrator_tokenToUse_get = function _Neo3NeoXBridgeOrchestrator_tokenToUse_get() {
|
|
306
280
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToUse, "f");
|
|
307
281
|
}, _Neo3NeoXBridgeOrchestrator_tokenToUse_set = function _Neo3NeoXBridgeOrchestrator_tokenToUse_set(value) {
|
|
308
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToUse,
|
|
282
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToUse, {
|
|
283
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToUse, "f"),
|
|
284
|
+
...value,
|
|
285
|
+
}, "f");
|
|
309
286
|
this.eventEmitter.emit('tokenToUse', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToUse, "f"));
|
|
310
287
|
}, _Neo3NeoXBridgeOrchestrator_accountToUse_get = function _Neo3NeoXBridgeOrchestrator_accountToUse_get() {
|
|
311
288
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAccountToUse, "f");
|
|
312
289
|
}, _Neo3NeoXBridgeOrchestrator_accountToUse_set = function _Neo3NeoXBridgeOrchestrator_accountToUse_set(value) {
|
|
313
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAccountToUse,
|
|
290
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAccountToUse, {
|
|
291
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAccountToUse, "f"),
|
|
292
|
+
...value,
|
|
293
|
+
}, "f");
|
|
314
294
|
this.eventEmitter.emit('accountToUse', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAccountToUse, "f"));
|
|
315
295
|
}, _Neo3NeoXBridgeOrchestrator_amountToUse_get = function _Neo3NeoXBridgeOrchestrator_amountToUse_get() {
|
|
316
296
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUse, "f");
|
|
317
297
|
}, _Neo3NeoXBridgeOrchestrator_amountToUse_set = function _Neo3NeoXBridgeOrchestrator_amountToUse_set(value) {
|
|
318
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUse,
|
|
298
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUse, {
|
|
299
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUse, "f"),
|
|
300
|
+
...value,
|
|
301
|
+
}, "f");
|
|
319
302
|
this.eventEmitter.emit('amountToUse', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUse, "f"));
|
|
320
303
|
}, _Neo3NeoXBridgeOrchestrator_amountToUseMin_get = function _Neo3NeoXBridgeOrchestrator_amountToUseMin_get() {
|
|
321
304
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUseMin, "f");
|
|
322
305
|
}, _Neo3NeoXBridgeOrchestrator_amountToUseMin_set = function _Neo3NeoXBridgeOrchestrator_amountToUseMin_set(value) {
|
|
323
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUseMin,
|
|
306
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUseMin, {
|
|
307
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUseMin, "f"),
|
|
308
|
+
...value,
|
|
309
|
+
}, "f");
|
|
324
310
|
this.eventEmitter.emit('amountToUseMin', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUseMin, "f"));
|
|
325
311
|
}, _Neo3NeoXBridgeOrchestrator_amountToUseMax_get = function _Neo3NeoXBridgeOrchestrator_amountToUseMax_get() {
|
|
326
312
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUseMax, "f");
|
|
327
313
|
}, _Neo3NeoXBridgeOrchestrator_amountToUseMax_set = function _Neo3NeoXBridgeOrchestrator_amountToUseMax_set(value) {
|
|
328
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUseMax,
|
|
314
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUseMax, {
|
|
315
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUseMax, "f"),
|
|
316
|
+
...value,
|
|
317
|
+
}, "f");
|
|
329
318
|
this.eventEmitter.emit('amountToUseMax', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToUseMax, "f"));
|
|
330
319
|
}, _Neo3NeoXBridgeOrchestrator_tokenToReceive_get = function _Neo3NeoXBridgeOrchestrator_tokenToReceive_get() {
|
|
331
320
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToReceive, "f");
|
|
332
321
|
}, _Neo3NeoXBridgeOrchestrator_tokenToReceive_set = function _Neo3NeoXBridgeOrchestrator_tokenToReceive_set(value) {
|
|
333
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToReceive,
|
|
322
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToReceive, {
|
|
323
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToReceive, "f"),
|
|
324
|
+
...value,
|
|
325
|
+
}, "f");
|
|
334
326
|
this.eventEmitter.emit('tokenToReceive', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToReceive, "f"));
|
|
335
327
|
}, _Neo3NeoXBridgeOrchestrator_addressToReceive_get = function _Neo3NeoXBridgeOrchestrator_addressToReceive_get() {
|
|
336
328
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAddressToReceive, "f");
|
|
337
329
|
}, _Neo3NeoXBridgeOrchestrator_addressToReceive_set = function _Neo3NeoXBridgeOrchestrator_addressToReceive_set(value) {
|
|
338
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAddressToReceive,
|
|
330
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAddressToReceive, {
|
|
331
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAddressToReceive, "f"),
|
|
332
|
+
...value,
|
|
333
|
+
}, "f");
|
|
339
334
|
this.eventEmitter.emit('addressToReceive', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAddressToReceive, "f"));
|
|
340
335
|
}, _Neo3NeoXBridgeOrchestrator_amountToReceive_get = function _Neo3NeoXBridgeOrchestrator_amountToReceive_get() {
|
|
341
336
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToReceive, "f");
|
|
342
337
|
}, _Neo3NeoXBridgeOrchestrator_amountToReceive_set = function _Neo3NeoXBridgeOrchestrator_amountToReceive_set(value) {
|
|
343
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToReceive,
|
|
338
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToReceive, {
|
|
339
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToReceive, "f"),
|
|
340
|
+
...value,
|
|
341
|
+
}, "f");
|
|
344
342
|
this.eventEmitter.emit('amountToReceive', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalAmountToReceive, "f"));
|
|
345
343
|
}, _Neo3NeoXBridgeOrchestrator_tokenToUseBalance_get = function _Neo3NeoXBridgeOrchestrator_tokenToUseBalance_get() {
|
|
346
344
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToUseBalance, "f");
|
|
347
345
|
}, _Neo3NeoXBridgeOrchestrator_tokenToUseBalance_set = function _Neo3NeoXBridgeOrchestrator_tokenToUseBalance_set(value) {
|
|
348
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToUseBalance,
|
|
346
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToUseBalance, {
|
|
347
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToUseBalance, "f"),
|
|
348
|
+
...value,
|
|
349
|
+
}, "f");
|
|
349
350
|
this.eventEmitter.emit('tokenToUseBalance', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalTokenToUseBalance, "f"));
|
|
350
351
|
}, _Neo3NeoXBridgeOrchestrator_bridgeFee_get = function _Neo3NeoXBridgeOrchestrator_bridgeFee_get() {
|
|
351
352
|
return __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalBridgeFee, "f");
|
|
352
353
|
}, _Neo3NeoXBridgeOrchestrator_bridgeFee_set = function _Neo3NeoXBridgeOrchestrator_bridgeFee_set(value) {
|
|
353
|
-
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalBridgeFee,
|
|
354
|
+
__classPrivateFieldSet(this, _Neo3NeoXBridgeOrchestrator_internalBridgeFee, {
|
|
355
|
+
...__classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalBridgeFee, "f"),
|
|
356
|
+
...value,
|
|
357
|
+
}, "f");
|
|
354
358
|
this.eventEmitter.emit('bridgeFee', __classPrivateFieldGet(this, _Neo3NeoXBridgeOrchestrator_internalBridgeFee, "f"));
|
|
355
359
|
}, _Neo3NeoXBridgeOrchestrator_treatError = function _Neo3NeoXBridgeOrchestrator_treatError(error) {
|
|
356
360
|
if (error instanceof blockchain_service_1.BSError)
|