@cryptorubic/web3 0.8.17-alpha.solana.4 → 0.8.17-alpha.solana.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.17-alpha.solana.
|
|
3
|
+
"version": "0.8.17-alpha.solana.5",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.0",
|
|
6
6
|
"bignumber.js": "9.1.2",
|
|
7
|
-
"@cryptorubic/core": "0.8.17-alpha.solana.
|
|
7
|
+
"@cryptorubic/core": "0.8.17-alpha.solana.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.17-alpha.solana.
|
|
14
|
+
"@cryptorubic/tron-types": "0.8.17-alpha.solana.5",
|
|
15
15
|
"bitcoin-address-validation": "^2.2.3",
|
|
16
16
|
"axios": "0.27.2",
|
|
17
17
|
"crc-32": "^1.2.2",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HttpClient } from '@cryptorubic/core';
|
|
2
2
|
import { Connection } from '@solana/web3.js';
|
|
3
3
|
import { SolanaAdapterConfig } from '../../models/solana-adapter-config';
|
|
4
|
+
import BigNumber from 'bignumber.js';
|
|
4
5
|
export declare class SolanaApiService {
|
|
5
6
|
private httpClient;
|
|
6
7
|
private readonly connection;
|
|
@@ -8,11 +9,11 @@ export declare class SolanaApiService {
|
|
|
8
9
|
private readonly HELIUS_API_KEY;
|
|
9
10
|
constructor(httpClient: HttpClient, connection: Connection, solanaConfig: SolanaAdapterConfig);
|
|
10
11
|
/**
|
|
11
|
-
* @returns ComputedUnitsLimit - like gasLimit in evm
|
|
12
|
+
* @returns wei ComputedUnitsLimit - like gasLimit in evm
|
|
12
13
|
*/
|
|
13
|
-
getConsumedUnitsLimit(txData: string): Promise<
|
|
14
|
+
getConsumedUnitsLimit(txData: string): Promise<BigNumber>;
|
|
14
15
|
/**
|
|
15
|
-
* @returns ComputedUnitsPrice - like gasPrice in evm
|
|
16
|
+
* @returns wei ComputedUnitsPrice - like gasPrice in evm
|
|
16
17
|
*/
|
|
17
|
-
getConsumedUnitsPrice(txData: string): Promise<
|
|
18
|
+
getConsumedUnitsPrice(txData: string): Promise<BigNumber>;
|
|
18
19
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SolanaApiService = void 0;
|
|
4
4
|
const utils_1 = require("ethers/lib/utils");
|
|
5
5
|
const utility_funcs_1 = require("./utility-funcs");
|
|
6
|
+
const bignumber_js_1 = require("bignumber.js");
|
|
6
7
|
class SolanaApiService {
|
|
7
8
|
constructor(httpClient, connection, solanaConfig) {
|
|
8
9
|
this.httpClient = httpClient;
|
|
@@ -11,7 +12,7 @@ class SolanaApiService {
|
|
|
11
12
|
this.HELIUS_API_KEY = solanaConfig.heliusApiKey;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
|
-
* @returns ComputedUnitsLimit - like gasLimit in evm
|
|
15
|
+
* @returns wei ComputedUnitsLimit - like gasLimit in evm
|
|
15
16
|
*/
|
|
16
17
|
async getConsumedUnitsLimit(txData) {
|
|
17
18
|
const DEFAULT_CU_LIMIT = 600000;
|
|
@@ -20,15 +21,15 @@ class SolanaApiService {
|
|
|
20
21
|
const resp = await this.connection.simulateTransaction(tx, {
|
|
21
22
|
replaceRecentBlockhash: true
|
|
22
23
|
});
|
|
23
|
-
return resp.value.unitsConsumed ? resp.value.unitsConsumed * 1.2 : DEFAULT_CU_LIMIT;
|
|
24
|
+
return resp.value.unitsConsumed ? new bignumber_js_1.default(resp.value.unitsConsumed * 1.2) : new bignumber_js_1.default(DEFAULT_CU_LIMIT);
|
|
24
25
|
}
|
|
25
26
|
catch (err) {
|
|
26
27
|
console.error('Solana_simulateTransaction_Error ==> ', err);
|
|
27
|
-
return DEFAULT_CU_LIMIT;
|
|
28
|
+
return new bignumber_js_1.default(DEFAULT_CU_LIMIT);
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
|
-
* @returns ComputedUnitsPrice - like gasPrice in evm
|
|
32
|
+
* @returns wei ComputedUnitsPrice - like gasPrice in evm
|
|
32
33
|
*/
|
|
33
34
|
async getConsumedUnitsPrice(txData) {
|
|
34
35
|
if (!this.HELIUS_API_KEY) {
|
|
@@ -46,7 +47,7 @@ class SolanaApiService {
|
|
|
46
47
|
}
|
|
47
48
|
]
|
|
48
49
|
});
|
|
49
|
-
return resp.result.priorityFeeEstimate;
|
|
50
|
+
return new bignumber_js_1.default(resp.result.priorityFeeEstimate);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
exports.SolanaApiService = SolanaApiService;
|