@cryptorubic/web3 0.8.5-alpha.1 → 0.8.5-alpha.2
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-alpha.
|
|
3
|
+
"version": "0.8.5-alpha.2",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.0",
|
|
6
6
|
"bignumber.js": "9.1.2",
|
|
7
|
-
"@cryptorubic/core": "0.8.5-alpha.
|
|
7
|
+
"@cryptorubic/core": "0.8.5-alpha.2",
|
|
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-alpha.
|
|
14
|
+
"@cryptorubic/tron-types": "0.8.5-alpha.2",
|
|
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");
|
|
@@ -71,33 +70,33 @@ class SolanaAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
71
70
|
return new bignumber_js_1.default(tokenWithBalance || NaN);
|
|
72
71
|
});
|
|
73
72
|
}
|
|
73
|
+
// public async callForTokensInfo(tokenAddresses: string[] | ReadonlyArray<string>): Promise<Token<SolanaBlockchainName>[]> {
|
|
74
|
+
// const nativeToken = nativeTokensList[BLOCKCHAIN_NAME.SOLANA] as Token<SolanaBlockchainName>;
|
|
75
|
+
// const nativeTokenIndex = tokenAddresses.findIndex((address) => Web3Pure.isNativeAddress(CHAIN_TYPE.SOLANA, address));
|
|
76
|
+
// const filteredTokenAddresses = tokenAddresses.filter((_, index) => index !== nativeTokenIndex);
|
|
77
|
+
// // only native token in tokenAddresses
|
|
78
|
+
// if (!filteredTokenAddresses.length) {
|
|
79
|
+
// return [nativeToken];
|
|
80
|
+
// }
|
|
81
|
+
// const mints = filteredTokenAddresses.map((address) => new PublicKey(address));
|
|
82
|
+
// const tokenSdk = new TokenSdk();
|
|
83
|
+
// const tokensMint = await tokenSdk.fetchMints(mints);
|
|
84
|
+
// const tokens = tokensMint.map((token) => {
|
|
85
|
+
// return new Token({
|
|
86
|
+
// address: token.address.toString(),
|
|
87
|
+
// blockchain: BLOCKCHAIN_NAME.SOLANA,
|
|
88
|
+
// decimals: token.decimals!,
|
|
89
|
+
// name: token.name,
|
|
90
|
+
// symbol: token.symbol
|
|
91
|
+
// });
|
|
92
|
+
// });
|
|
93
|
+
// if (nativeTokenIndex === -1) {
|
|
94
|
+
// return tokens;
|
|
95
|
+
// }
|
|
96
|
+
// tokens.splice(nativeTokenIndex, 0, nativeToken);
|
|
97
|
+
// return tokens;
|
|
98
|
+
// }
|
|
74
99
|
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
100
|
const nativeToken = core_1.nativeTokensList[core_1.BLOCKCHAIN_NAME.SOLANA];
|
|
102
101
|
const nativeTokenIndex = tokenAddresses.findIndex((address) => web3_pure_1.Web3Pure.isNativeAddress(core_1.CHAIN_TYPE.SOLANA, address));
|
|
103
102
|
const filteredTokenAddresses = tokenAddresses.filter((_, index) => index !== nativeTokenIndex);
|