@cryptorubic/web3 0.8.5-alpha.1 → 0.8.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/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cryptorubic/web3",
|
|
3
|
-
"version": "0.8.5
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.0",
|
|
6
6
|
"bignumber.js": "9.1.2",
|
|
7
|
-
"@cryptorubic/core": "0.8.5
|
|
7
|
+
"@cryptorubic/core": "0.8.5",
|
|
8
8
|
"viem": "^2.19.1",
|
|
9
9
|
"web3-utils": "^4.3.1",
|
|
10
10
|
"@ton/ton": "^15.1.0",
|
|
11
11
|
"@solana/web3.js": "1.95.3",
|
|
12
12
|
"@solflare-wallet/utl-sdk": "^1.4.0",
|
|
13
13
|
"@ethersproject/bignumber": "^5.7.0",
|
|
14
|
-
"@cryptorubic/tron-types": "0.8.5
|
|
14
|
+
"@cryptorubic/tron-types": "0.8.5",
|
|
15
15
|
"bitcoin-address-validation": "^2.2.3",
|
|
16
16
|
"axios": "0.27.2",
|
|
17
17
|
"crc-32": "^1.2.2",
|
|
@@ -23,5 +23,4 @@ export declare class SolanaAdapter extends AbstractAdapter<Connection, Connectio
|
|
|
23
23
|
*/
|
|
24
24
|
getTokensBalances(address: string, tokensAddresses: string[]): Promise<BigNumber[]>;
|
|
25
25
|
callForTokensInfo(tokenAddresses: string[] | ReadonlyArray<string>): Promise<Token<SolanaBlockchainName>[]>;
|
|
26
|
-
callForTokensInfoNew(tokenAddresses: string[] | ReadonlyArray<string>): Promise<Token<SolanaBlockchainName>[]>;
|
|
27
26
|
}
|
|
@@ -4,7 +4,6 @@ exports.SolanaAdapter = exports.NATIVE_SOLANA_MINT_ADDRESS = void 0;
|
|
|
4
4
|
const spl_token_1 = require("@solana/spl-token");
|
|
5
5
|
const abstract_adapter_1 = require("./abstract-adapter");
|
|
6
6
|
const web3_js_1 = require("@solana/web3.js");
|
|
7
|
-
const utl_sdk_1 = require("@solflare-wallet/utl-sdk");
|
|
8
7
|
const core_1 = require("@cryptorubic/core");
|
|
9
8
|
const web3_pure_1 = require("../../utils/web3-pure");
|
|
10
9
|
const bignumber_js_1 = require("bignumber.js");
|
|
@@ -72,32 +71,6 @@ class SolanaAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
73
|
async callForTokensInfo(tokenAddresses) {
|
|
75
|
-
const nativeToken = core_1.nativeTokensList[core_1.BLOCKCHAIN_NAME.SOLANA];
|
|
76
|
-
const nativeTokenIndex = tokenAddresses.findIndex((address) => web3_pure_1.Web3Pure.isNativeAddress(core_1.CHAIN_TYPE.SOLANA, address));
|
|
77
|
-
const filteredTokenAddresses = tokenAddresses.filter((_, index) => index !== nativeTokenIndex);
|
|
78
|
-
// only native token in tokenAddresses
|
|
79
|
-
if (!filteredTokenAddresses.length) {
|
|
80
|
-
return [nativeToken];
|
|
81
|
-
}
|
|
82
|
-
const mints = filteredTokenAddresses.map((address) => new web3_js_1.PublicKey(address));
|
|
83
|
-
const tokenSdk = new utl_sdk_1.Client();
|
|
84
|
-
const tokensMint = await tokenSdk.fetchMints(mints);
|
|
85
|
-
const tokens = tokensMint.map((token) => {
|
|
86
|
-
return new core_1.Token({
|
|
87
|
-
address: token.address.toString(),
|
|
88
|
-
blockchain: core_1.BLOCKCHAIN_NAME.SOLANA,
|
|
89
|
-
decimals: token.decimals,
|
|
90
|
-
name: token.name,
|
|
91
|
-
symbol: token.symbol
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
if (nativeTokenIndex === -1) {
|
|
95
|
-
return tokens;
|
|
96
|
-
}
|
|
97
|
-
tokens.splice(nativeTokenIndex, 0, nativeToken);
|
|
98
|
-
return tokens;
|
|
99
|
-
}
|
|
100
|
-
async callForTokensInfoNew(tokenAddresses) {
|
|
101
74
|
const nativeToken = core_1.nativeTokensList[core_1.BLOCKCHAIN_NAME.SOLANA];
|
|
102
75
|
const nativeTokenIndex = tokenAddresses.findIndex((address) => web3_pure_1.Web3Pure.isNativeAddress(core_1.CHAIN_TYPE.SOLANA, address));
|
|
103
76
|
const filteredTokenAddresses = tokenAddresses.filter((_, index) => index !== nativeTokenIndex);
|
|
@@ -109,12 +109,6 @@ class SolanaTokensService {
|
|
|
109
109
|
const notFetchedTokensList = this.initialMints.filter((mint) => !fetchedTokensMap.get(mint.toString()));
|
|
110
110
|
return notFetchedTokensList;
|
|
111
111
|
}
|
|
112
|
-
// private getNotFetchedTokensList(tokensList: SolanaToken[]): PublicKey[] {
|
|
113
|
-
// const notFetchedTokensList = this.initialMints.filter((mint) =>
|
|
114
|
-
// tokensList.every((token) => !compareAddresses(token.address, mint.toString()))
|
|
115
|
-
// );
|
|
116
|
-
// return notFetchedTokensList;
|
|
117
|
-
// }
|
|
118
112
|
async getTokensList(tokenAddresses) {
|
|
119
113
|
try {
|
|
120
114
|
const queryParams = tokenAddresses.length > 1 ? { addresses: tokenAddresses.join(',') } : { query: tokenAddresses[0] };
|