@exodus/solana-lib 3.9.4 → 3.9.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/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.9.5](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.9.4...@exodus/solana-lib@3.9.5) (2025-03-25)
7
+
8
+
9
+ ### License
10
+
11
+
12
+ * license: re-license under MIT license (#4814)
13
+
14
+
15
+
6
16
  ## [3.9.4](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.9.3...@exodus/solana-lib@3.9.4) (2025-01-02)
7
17
 
8
18
 
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2024 Exodus Movement, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,21 @@
1
- # @exodus/solana-lib
1
+ # @exodus/solana-lib · [![npm version](https://img.shields.io/badge/npm-public-blue.svg?style=flat)](https://www.npmjs.com/package/@exodus/solana-lib)
2
2
 
3
- Solana utils, such as for cryptography, address encoding/decoding, transaction building, etc. See [Asset Packages](../../docs/asset-packages.md) for more detail on this package's role.
3
+ **solana-lib** is a comprehensive library designed for seamless interaction with the Solana blockchain. It provides a robust set of functions and classes to facilitate core blockchain operations.
4
+
5
+ This library encompasses all the essential tools required for cryptographic operations, including key derivation and signing. It also supports transaction serialization and deserialization, data encoding and decoding, and the crafting of various types of transactions such as regular transactions, token transactions, and staking transactions.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ Install the package via `yarn`:
12
+
13
+ ```bash
14
+ yarn add @exodus/solana-lib
15
+ ```
16
+
17
+ ## License
18
+
19
+ This project is licensed under the MIT License.
20
+ You are free to use, modify, and distribute this software under the terms of the MIT License.
21
+ For more details, see the [LICENSE](LICENSE) file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-lib",
3
- "version": "3.9.4",
3
+ "version": "3.9.5",
4
4
  "description": "Solana utils, such as for cryptography, address encoding/decoding, transaction building, etc.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -10,7 +10,7 @@
10
10
  "!src/**/__tests__"
11
11
  ],
12
12
  "author": "Exodus Movement, Inc.",
13
- "license": "ISC",
13
+ "license": "MIT",
14
14
  "publishConfig": {
15
15
  "access": "public"
16
16
  },
@@ -45,5 +45,5 @@
45
45
  "type": "git",
46
46
  "url": "git+https://github.com/ExodusMovement/assets.git"
47
47
  },
48
- "gitHead": "8a6a0d1a70d14e86a9cf4d47b8884939f10be724"
48
+ "gitHead": "0908ae0c3bd6a7d5bdd91946f88d389037f7d710"
49
49
  }
@@ -0,0 +1,44 @@
1
+ # **Computing Fees and Priority Fees in Solana**
2
+
3
+ In Solana, **fees** and **priority fees** are influenced by network conditions, making them **not fully deterministic** but still **predictable to some extent**.
4
+
5
+ ---
6
+
7
+ ## **1. Computing Base Transaction Fees**
8
+
9
+ Solana uses a **fixed fee structure** based on transaction size. The base fee is computed as:
10
+
11
+ base_fee = num_signatures \* signature_fee
12
+
13
+ - **Signature Fee**: A fixed amount per signature (historically 5000 lamports per signature, but subject to change).
14
+ - **Num Signatures**: Typically 1 for standard transactions, more if using multi-signature accounts.
15
+
16
+ Thus, if network parameters remain unchanged, you can **deterministically** compute the **base fee**.
17
+
18
+ ---
19
+
20
+ ## **2. Computing Priority Fee (Not Deterministic)**
21
+
22
+ The **priority fee** is **market-driven**, meaning it depends on **current network congestion**. Users specify the **compute unit price** in lamports per **compute unit**. The total priority fee is then:
23
+
24
+ priority_fee = compute_units_used \* compute_unit_price
25
+
26
+ - **Compute Units Used**: Can be estimated based on the transaction complexity but varies based on program execution.
27
+ - **Compute Unit Price**: Set by the user, competes with others in a bidding system.
28
+
29
+ ### **Why is Priority Fee Not Deterministic?**
30
+
31
+ - The **compute units used** may vary due to transaction execution conditions.
32
+ - The **compute unit price** is market-driven and changes based on network demand.
33
+
34
+ Thus, **you can estimate priority fees, but they are not deterministic**.
35
+
36
+ ---
37
+
38
+ ## **3. Can You Precompute Fees?**
39
+
40
+ | Fee Type | Deterministic? | Notes |
41
+ | ---------------- | -------------- | ------------------------------------------------ |
42
+ | **Base Fee** | ✅ Yes | Fixed per signature and transaction size. |
43
+ | **Priority Fee** | ❌ No | Market-driven and depends on network congestion. |
44
+ | **Total Fees** | ⚠️ Estimated | Can be predicted but not guaranteed. |
@@ -4,9 +4,10 @@ export const createFeeData = ({ asset }) =>
4
4
  new FeeData({
5
5
  config: {
6
6
  fee: `0.000005 ${asset.ticker}`,
7
+ baseFee: `0.000005 ${asset.ticker}`,
7
8
  priorityFee: 1_000_000,
8
9
  fuelThreshold: `0.000015 ${asset.ticker}`,
9
- computeUnitsMultiplier: 4, // compute units buffer
10
+ computeUnitsMultiplier: 1, // compute units buffer, increasing to > 1 can cause Dust issues.
10
11
  },
11
12
  mainKey: 'fee',
12
13
  currency: asset.currency,
@@ -63,7 +63,6 @@ function createIx(
63
63
  export const createTokenTransferInstruction = (owner, fromTokenAddress, to, amount) => {
64
64
  const sourcePubkey = new PublicKey(fromTokenAddress) // the token ADDRESS needed!
65
65
  const destinationPubkey = new PublicKey(to)
66
- console.log(`destination token address: ${destinationPubkey.toBase58()}`)
67
66
  const ownerAccountOrWalletPublicKey = new PublicKey(owner) // the only native SOL address
68
67
 
69
68
  return Token.createTransferInstruction(