@exodus/solana-lib 1.7.0 → 1.7.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 +2 -2
- package/src/tx/sign-hardware.js +15 -2
- package/src/tx/sign-unsigned-tx.js +18 -1
- package/src/vendor/publickey.js +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-lib",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Exodus internal Solana low-level library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"lodash": "^4.17.11",
|
|
28
28
|
"tweetnacl": "^1.0.3"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "107ccdaaaee35747ff1723be05723b734410bca6"
|
|
31
31
|
}
|
package/src/tx/sign-hardware.js
CHANGED
|
@@ -34,8 +34,21 @@ const signWithHardwareWallet = async ({ tx, hardwareDevice, accountIndex }) => {
|
|
|
34
34
|
|
|
35
35
|
const applySignatures = ({ tx, signatures }) => {
|
|
36
36
|
if (isLegacyTransaction(tx)) {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
signatures.forEach(({ publicKey: publicKeyBuffer }) => {
|
|
38
|
+
const publicKey = new PublicKey(publicKeyBuffer)
|
|
39
|
+
// Some transactions that we construct internally are technically not complete.
|
|
40
|
+
// They don't contain the empty signature slot for the public key.
|
|
41
|
+
const foundEmptySignatureSlot = tx.signatures.find(({ publicKey: pubKey }) =>
|
|
42
|
+
pubKey.equals(publicKey)
|
|
43
|
+
)
|
|
44
|
+
if (!foundEmptySignatureSlot) {
|
|
45
|
+
// We could use `setSigners` but maybe this is more robust?
|
|
46
|
+
tx.signatures.push({
|
|
47
|
+
publicKey,
|
|
48
|
+
signature: null,
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
})
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
signatures.forEach(({ publicKey, signature }) => {
|
|
@@ -24,6 +24,23 @@ const _signTx = ({ tx, privateKey }) => {
|
|
|
24
24
|
tx.sign([account])
|
|
25
25
|
} else {
|
|
26
26
|
// Legacy Transactions
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
// Some transactions that we construct internally are technically not complete.
|
|
29
|
+
// They don't contain the empty signature slot for the public key.
|
|
30
|
+
const foundEmptySignatureSlot = tx.signatures.find(({ publicKey }) =>
|
|
31
|
+
publicKey.equals(account.publicKey)
|
|
32
|
+
)
|
|
33
|
+
if (!foundEmptySignatureSlot) {
|
|
34
|
+
// We could use `setSigners` but maybe this is more robust?
|
|
35
|
+
tx.signatures.push({
|
|
36
|
+
publicKey: account.publicKey,
|
|
37
|
+
signature: null,
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// We need to use `partialSign()` here because legacy `sign()` will
|
|
42
|
+
// delete all existing signatures which isn't great if we're
|
|
43
|
+
// signing a transaction that already has signatures.
|
|
44
|
+
tx.partialSign(account)
|
|
28
45
|
}
|
|
29
46
|
}
|
package/src/vendor/publickey.js
CHANGED