@cityofzion/bs-ethereum 2.8.4 → 2.9.0
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.
|
@@ -28,6 +28,16 @@ BSEthereumConstants.NATIVE_SYMBOL_BY_NETWORK_ID = {
|
|
|
28
28
|
};
|
|
29
29
|
BSEthereumConstants.NATIVE_WRAPPED_HASH_BY_NETWORK_ID = {
|
|
30
30
|
'1': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
31
|
+
'10': '0x4200000000000000000000000000000000000006',
|
|
32
|
+
'25': '0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23',
|
|
33
|
+
'56': '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c',
|
|
34
|
+
'137': '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
|
|
35
|
+
'250': '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83',
|
|
36
|
+
'8453': '0x4200000000000000000000000000000000000006',
|
|
37
|
+
'42161': '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
|
|
38
|
+
'42220': '0x471EcE3750Da237f93B8E339c536989b8978a438',
|
|
39
|
+
'43114': '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7',
|
|
40
|
+
'59144': '0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f',
|
|
31
41
|
};
|
|
32
42
|
BSEthereumConstants.RPC_LIST_BY_NETWORK_ID = {
|
|
33
43
|
'1': [
|
|
@@ -68,6 +68,8 @@ class MoralisEDSEthereum extends blockchain_service_1.CryptoCompareEDS {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
+
if (tokensBody.length === 0)
|
|
72
|
+
return [];
|
|
71
73
|
const splitTokensBody = [];
|
|
72
74
|
for (let i = 0; i < tokensBody.length; i += __classPrivateFieldGet(this, _MoralisEDSEthereum_maxTokenPricesPerCall, "f")) {
|
|
73
75
|
splitTokensBody.push(tokensBody.slice(i, i + __classPrivateFieldGet(this, _MoralisEDSEthereum_maxTokenPricesPerCall, "f")));
|
|
@@ -146,23 +148,8 @@ _MoralisEDSEthereum_network = new WeakMap(), _MoralisEDSEthereum_blockchainDataS
|
|
|
146
148
|
const nativeToken = BSEthereumHelper_1.BSEthereumHelper.getNativeAsset(__classPrivateFieldGet(this, _MoralisEDSEthereum_network, "f"));
|
|
147
149
|
const wrappedSymbol = `W${nativeToken.symbol}`;
|
|
148
150
|
const localWrappedHash = BSEthereumConstants_1.BSEthereumConstants.NATIVE_WRAPPED_HASH_BY_NETWORK_ID[__classPrivateFieldGet(this, _MoralisEDSEthereum_network, "f").id];
|
|
149
|
-
if (localWrappedHash)
|
|
150
|
-
return Object.assign(Object.assign({}, nativeToken), { symbol: wrappedSymbol, hash: localWrappedHash });
|
|
151
|
-
}
|
|
152
|
-
const client = MoralisBDSEthereum_1.MoralisBDSEthereum.getClient(__classPrivateFieldGet(this, _MoralisEDSEthereum_network, "f"));
|
|
153
|
-
const { data } = yield client.get('/erc20/metadata/symbols', {
|
|
154
|
-
params: {
|
|
155
|
-
symbols: [wrappedSymbol],
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
const wrapperToken = data.find(token => token.verified_contract && !token.possible_spam);
|
|
159
|
-
if (!wrapperToken)
|
|
151
|
+
if (!localWrappedHash)
|
|
160
152
|
throw new Error('Wrapper token not found');
|
|
161
|
-
return {
|
|
162
|
-
decimals: Number(wrapperToken.decimals),
|
|
163
|
-
hash: wrapperToken.address,
|
|
164
|
-
name: wrapperToken.name,
|
|
165
|
-
symbol: wrapperToken.symbol,
|
|
166
|
-
};
|
|
153
|
+
return Object.assign(Object.assign({}, nativeToken), { symbol: wrappedSymbol, hash: localWrappedHash });
|
|
167
154
|
});
|
|
168
155
|
};
|
|
@@ -17,7 +17,7 @@ export declare class EthersLedgerServiceEthereum<BSName extends string = string>
|
|
|
17
17
|
emitter: LedgerServiceEmitter;
|
|
18
18
|
getLedgerTransport?: GetLedgerTransport<BSName>;
|
|
19
19
|
constructor(blockchainService: BSEthereum<BSName>, getLedgerTransport?: GetLedgerTransport<BSName>);
|
|
20
|
-
getAccounts(transport: Transport): Promise<Account<BSName>[]>;
|
|
20
|
+
getAccounts(transport: Transport, untilIndex?: number): Promise<Account<BSName>[]>;
|
|
21
21
|
getAccount(transport: Transport, index: number): Promise<Account<BSName>>;
|
|
22
22
|
getSigner(transport: Transport, path: string, provider?: ethers.providers.Provider): EthersLedgerSigner;
|
|
23
23
|
}
|
|
@@ -166,11 +166,19 @@ class EthersLedgerServiceEthereum {
|
|
|
166
166
|
__classPrivateFieldSet(this, _EthersLedgerServiceEthereum_blockchainService, blockchainService, "f");
|
|
167
167
|
this.getLedgerTransport = getLedgerTransport;
|
|
168
168
|
}
|
|
169
|
-
getAccounts(transport) {
|
|
169
|
+
getAccounts(transport, untilIndex) {
|
|
170
170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
let accountsByBlockchainService;
|
|
172
|
+
if (untilIndex === undefined) {
|
|
173
|
+
accountsByBlockchainService = yield (0, blockchain_service_1.fetchAccountsForBlockchainServices)([__classPrivateFieldGet(this, _EthersLedgerServiceEthereum_blockchainService, "f")], (_service, index) => __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
return this.getAccount(transport, index);
|
|
175
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
accountsByBlockchainService = yield (0, blockchain_service_1.generateAccountUntilIndexForBlockchainService)([__classPrivateFieldGet(this, _EthersLedgerServiceEthereum_blockchainService, "f")], untilIndex, (_service, index) => __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
return this.getAccount(transport, index);
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
174
182
|
const accounts = accountsByBlockchainService.get(__classPrivateFieldGet(this, _EthersLedgerServiceEthereum_blockchainService, "f").name);
|
|
175
183
|
return accounts !== null && accounts !== void 0 ? accounts : [];
|
|
176
184
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-ethereum",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@ledgerhq/hw-app-eth": "~6.35.7",
|
|
21
21
|
"@ethersproject/abstract-signer": "~5.7.0",
|
|
22
22
|
"@ethersproject/properties": "~5.7.0",
|
|
23
|
-
"@cityofzion/blockchain-service": "1.
|
|
23
|
+
"@cityofzion/blockchain-service": "1.15.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@ledgerhq/hw-transport-node-hid": "~6.28.5",
|