@cityofzion/bs-neox 1.3.1 → 1.3.3
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.
|
@@ -26,8 +26,8 @@ BSNeoXConstants.NEO_TOKEN = __classPrivateFieldGet(_a, _a, "f", _BSNeoXConstants
|
|
|
26
26
|
hash: '0xc28736dc83f4fd43d6fb832Fd93c3eE7bB26828f',
|
|
27
27
|
});
|
|
28
28
|
BSNeoXConstants.RPC_LIST_BY_NETWORK_ID = {
|
|
29
|
-
'47763': ['https://mainnet-1.rpc.banelabs.org'],
|
|
30
|
-
'12227332': ['https://neoxt4seed1.ngd.network'],
|
|
29
|
+
'47763': ['https://mainnet-1.rpc.banelabs.org', 'https://mainnet-2.rpc.banelabs.org'],
|
|
30
|
+
'12227332': ['https://testnet.rpc.banelabs.org', 'https://neoxt4seed1.ngd.network'],
|
|
31
31
|
};
|
|
32
32
|
BSNeoXConstants.MAINNET_NETWORK_IDS = ['47763'];
|
|
33
33
|
BSNeoXConstants.TESTNET_NETWORK_IDS = ['12227332'];
|
|
@@ -455,16 +455,14 @@ _BlockscoutBDSNeoX_nftDataService = new WeakMap(), _BlockscoutBDSNeoX_explorerSe
|
|
|
455
455
|
const to = input.args._to;
|
|
456
456
|
const receiverAddress = neon_js_1.wallet.getAddressFromScriptHash(to.startsWith('0x') ? to.slice(2) : to);
|
|
457
457
|
if (input.name === 'withdrawNative') {
|
|
458
|
-
const token = __classPrivateFieldGet(this, _BlockscoutBDSNeoX_neo3NeoXBridgeService, "f").tokens.find(this._tokenService.predicateByHash(BSNeoXConstants_1.BSNeoXConstants.NATIVE_ASSET));
|
|
458
|
+
const token = __classPrivateFieldGet(this, _BlockscoutBDSNeoX_neo3NeoXBridgeService, "f").tokens.find(currentToken => this._tokenService.predicateByHash(BSNeoXConstants_1.BSNeoXConstants.NATIVE_ASSET, currentToken));
|
|
459
459
|
if (!token)
|
|
460
460
|
return undefined;
|
|
461
|
-
const amount = blockchain_service_1.BSBigNumberHelper.format(ethers_1.ethers.utils.formatUnits(blockscoutTransaction.value, token.decimals), {
|
|
462
|
-
decimals: token.decimals,
|
|
463
|
-
});
|
|
461
|
+
const amount = blockchain_service_1.BSBigNumberHelper.format(blockchain_service_1.BSBigNumberHelper.fromNumber(ethers_1.ethers.utils.formatUnits(blockscoutTransaction.value, token.decimals)).minus(Neo3NeoXBridgeService_1.Neo3NeoXBridgeService.BRIDGE_FEE), { decimals: token.decimals });
|
|
464
462
|
return { amount, token, receiverAddress };
|
|
465
463
|
}
|
|
466
464
|
if (input.name === 'withdrawToken') {
|
|
467
|
-
const token = __classPrivateFieldGet(this, _BlockscoutBDSNeoX_neo3NeoXBridgeService, "f").tokens.find(this._tokenService.predicateByHash(BSNeoXConstants_1.BSNeoXConstants.NEO_TOKEN));
|
|
465
|
+
const token = __classPrivateFieldGet(this, _BlockscoutBDSNeoX_neo3NeoXBridgeService, "f").tokens.find(currentToken => this._tokenService.predicateByHash(BSNeoXConstants_1.BSNeoXConstants.NEO_TOKEN, currentToken));
|
|
468
466
|
if (!token)
|
|
469
467
|
return undefined;
|
|
470
468
|
const amount = blockchain_service_1.BSBigNumberHelper.format(ethers_1.ethers.utils.formatUnits(input.args._amount, token.decimals), {
|
|
@@ -3,6 +3,7 @@ import { BSNeoX } from '../../BSNeoX';
|
|
|
3
3
|
export declare class Neo3NeoXBridgeService<BSName extends string> implements INeo3NeoXBridgeService<BSName> {
|
|
4
4
|
#private;
|
|
5
5
|
static readonly BRIDGE_SCRIPT_HASH = "0x1212000000000000000000000000000000000004";
|
|
6
|
+
static readonly BRIDGE_FEE = 0.1;
|
|
6
7
|
readonly BRIDGE_BASE_CONFIRMATION_URL = "https://xexplorer.neo.org:8877/api/v1/transactions/deposits";
|
|
7
8
|
tokens: TBridgeToken<BSName>[];
|
|
8
9
|
constructor(service: BSNeoX<BSName>);
|
|
@@ -50,7 +50,7 @@ class Neo3NeoXBridgeService {
|
|
|
50
50
|
try {
|
|
51
51
|
const provider = new ethers_1.ethers.providers.JsonRpcProvider(__classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").network.url);
|
|
52
52
|
const bridgeContract = new ethers_1.ethers.Contract(Neo3NeoXBridgeService.BRIDGE_SCRIPT_HASH, bridge_1.BRIDGE_ABI, provider);
|
|
53
|
-
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(token
|
|
53
|
+
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(token, BSNeoXConstants_1.BSNeoXConstants.NATIVE_ASSET);
|
|
54
54
|
const response = isNativeToken
|
|
55
55
|
? yield bridgeContract.nativeBridge()
|
|
56
56
|
: yield bridgeContract.tokenBridges(token.hash);
|
|
@@ -74,7 +74,7 @@ class Neo3NeoXBridgeService {
|
|
|
74
74
|
getApprovalFee(params) {
|
|
75
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
76
|
try {
|
|
77
|
-
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token
|
|
77
|
+
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token, BSNeoXConstants_1.BSNeoXConstants.NATIVE_ASSET);
|
|
78
78
|
if (isNativeToken) {
|
|
79
79
|
throw new blockchain_service_1.BSError('No allowance fee for native token', 'NO_ALLOWANCE_FEE');
|
|
80
80
|
}
|
|
@@ -105,7 +105,7 @@ class Neo3NeoXBridgeService {
|
|
|
105
105
|
const bridgeContract = new ethers_1.ethers.Contract(Neo3NeoXBridgeService.BRIDGE_SCRIPT_HASH, bridge_1.BRIDGE_ABI);
|
|
106
106
|
const to = '0x' + neon_js_1.wallet.getScriptHashFromAddress(params.receiverAddress);
|
|
107
107
|
const bridgeFee = ethers_1.ethers.utils.parseUnits(params.bridgeFee, BSNeoXConstants_1.BSNeoXConstants.NATIVE_ASSET.decimals);
|
|
108
|
-
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token
|
|
108
|
+
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token, BSNeoXConstants_1.BSNeoXConstants.NATIVE_ASSET);
|
|
109
109
|
let bridgeTransactionParam = {
|
|
110
110
|
type: 2,
|
|
111
111
|
};
|
|
@@ -152,7 +152,7 @@ class Neo3NeoXBridgeService {
|
|
|
152
152
|
}
|
|
153
153
|
try {
|
|
154
154
|
const BridgeInterface = new ethers_1.ethers.utils.Interface(bridge_1.BRIDGE_ABI);
|
|
155
|
-
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token
|
|
155
|
+
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token, BSNeoXConstants_1.BSNeoXConstants.NATIVE_ASSET);
|
|
156
156
|
let nonce;
|
|
157
157
|
if (isNativeToken) {
|
|
158
158
|
const item = data.items[0];
|
|
@@ -179,7 +179,7 @@ class Neo3NeoXBridgeService {
|
|
|
179
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
180
180
|
try {
|
|
181
181
|
let url;
|
|
182
|
-
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token
|
|
182
|
+
const isNativeToken = __classPrivateFieldGet(this, _Neo3NeoXBridgeService_service, "f").tokenService.predicateByHash(params.token, BSNeoXConstants_1.BSNeoXConstants.NATIVE_ASSET);
|
|
183
183
|
if (isNativeToken) {
|
|
184
184
|
url = `${this.BRIDGE_BASE_CONFIRMATION_URL}/${params.nonce}`;
|
|
185
185
|
}
|
|
@@ -215,3 +215,4 @@ _Neo3NeoXBridgeService_service = new WeakMap(), _Neo3NeoXBridgeService_instances
|
|
|
215
215
|
});
|
|
216
216
|
};
|
|
217
217
|
Neo3NeoXBridgeService.BRIDGE_SCRIPT_HASH = '0x1212000000000000000000000000000000000004';
|
|
218
|
+
Neo3NeoXBridgeService.BRIDGE_FEE = 0.1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neox",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"axios": "1.8.2",
|
|
17
17
|
"ethers": "5.7.2",
|
|
18
18
|
"date-fns": "~4.1.0",
|
|
19
|
-
"@cityofzion/blockchain-service": "1.21.
|
|
20
|
-
"@cityofzion/bs-ethereum": "2.13.
|
|
19
|
+
"@cityofzion/blockchain-service": "1.21.1",
|
|
20
|
+
"@cityofzion/bs-ethereum": "2.13.2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@ledgerhq/hw-transport-node-hid": "~6.29.9",
|