@exodus/solana-lib 1.3.5 → 1.3.6
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 +2 -2
- package/src/tx/simulate-and-sign-tx.js +10 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-lib",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"description": "Exodus internal Solana low-level library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"lodash": "^4.17.11",
|
|
26
26
|
"tweetnacl": "^1.0.3"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "90859f94717cf2b928cb93b030ecfba523b8179e"
|
|
29
29
|
}
|
|
@@ -8,8 +8,8 @@ import { PublicKey } from '../vendor/'
|
|
|
8
8
|
* 40 bytes is the size of the IPv6 header
|
|
9
9
|
* 8 bytes is the size of the fragment header
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const PACKET_DATA_SIZE = 1280 - 40 - 8
|
|
12
|
+
const SIGNATURE_LENGTH = 64
|
|
13
13
|
|
|
14
14
|
export function computeBalance(futureAccountBalance: string, currentAccountBalance: string) {
|
|
15
15
|
return new U64(futureAccountBalance).sub(new U64(currentAccountBalance))
|
|
@@ -21,8 +21,10 @@ export function getTransactionSimulationParams(transactionMessage) {
|
|
|
21
21
|
commitment: 'confirmed',
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const accountAddresses = transactionMessage
|
|
25
|
-
.
|
|
24
|
+
const accountAddresses = transactionMessage.accountKeys
|
|
25
|
+
.filter((_, index) => !transactionMessage.indexToProgramIds.has(index))
|
|
26
|
+
.map((account) => account.toString())
|
|
27
|
+
|
|
26
28
|
config['accounts'] = {
|
|
27
29
|
encoding: 'base64',
|
|
28
30
|
addresses: accountAddresses,
|
|
@@ -85,16 +87,13 @@ export function filterAccountsByOwner(futureAccountsState, accountAddresses, pub
|
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
export function buildRawTransaction(signData) {
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
const signaturesLength = signatureCount.length + SIGNATURE_LENGTH
|
|
90
|
+
export function buildRawTransaction(signData, requiredSignatureCount) {
|
|
91
|
+
const signatureCount = [requiredSignatureCount]
|
|
92
|
+
const signaturesLength = signatureCount.length + requiredSignatureCount * SIGNATURE_LENGTH
|
|
92
93
|
const rawTransactionLength = signData.length + signaturesLength
|
|
93
94
|
|
|
94
95
|
if (rawTransactionLength > PACKET_DATA_SIZE) {
|
|
95
|
-
throw Error(
|
|
96
|
-
`Transaction too large: ${rawTransactionLength} > ${PACKET_DATA_SIZE}`,
|
|
97
|
-
)
|
|
96
|
+
throw Error(`Transaction too large: ${rawTransactionLength} > ${PACKET_DATA_SIZE}`)
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
const rawTransaction = Buffer.alloc(rawTransactionLength)
|