@exodus/solana-lib 1.2.16 → 1.2.20

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/encode.js +6 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-lib",
3
- "version": "1.2.16",
3
+ "version": "1.2.20",
4
4
  "description": "Exodus internal Solana low-level library",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -23,5 +23,5 @@
23
23
  "lodash": "^4.17.11",
24
24
  "tweetnacl": "^1.0.3"
25
25
  },
26
- "gitHead": "882b8a97ef05cbd0fbd7da0b2ce457e0a0ae7e35"
26
+ "gitHead": "ed71abb9ea9f703a731790ff290b217d10de9a49"
27
27
  }
package/src/encode.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @flow
2
2
  import { PublicKey, StakeProgram } from './vendor'
3
3
  import { SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID, TOKEN_PROGRAM_ID, SEED } from './constants'
4
- import { getPublicKey } from './keypair'
4
+ import { getPublicKey, getKeyPairFromPrivateKey } from './keypair'
5
5
  import bs58 from 'bs58'
6
6
  import BN from 'bn.js'
7
7
 
@@ -30,6 +30,11 @@ export function isValidAddress(address: string): boolean {
30
30
  }
31
31
  }
32
32
 
33
+ export function getEncodedSecretKey(privateKey): string {
34
+ const { secretKey } = getKeyPairFromPrivateKey(Buffer.from(privateKey, 'hex'))
35
+ return bs58.encode(secretKey)
36
+ }
37
+
33
38
  // doc: https://spl.solana.com/associated-token-account (HACK: refactored to sync)
34
39
  export function findAssociatedTokenAddress(
35
40
  walletAddress: string,