@exodus/solana-plugin 1.0.7 → 1.0.9

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 +3 -3
  2. package/src/index.js +15 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-plugin",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Exodus internal Solana asset plugin",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "@exodus/assets": "^9.0.1",
24
24
  "@exodus/bip44-constants": "^195.0.0",
25
- "@exodus/solana-api": "^2.5.28",
25
+ "@exodus/solana-api": "^2.5.30",
26
26
  "@exodus/solana-lib": "^1.7.5",
27
27
  "@exodus/solana-meta": "^1.0.7",
28
28
  "minimalistic-assert": "^1.0.1"
@@ -30,5 +30,5 @@
30
30
  "devDependencies": {
31
31
  "@exodus/assets-testing": "file:../../../__testing__"
32
32
  },
33
- "gitHead": "e46dbfdf19c725e5e7d4aa98a9e0eac913c44ed2"
33
+ "gitHead": "5270d4cf5f0a0ae9486533f237e6abe6f026ed16"
34
34
  }
package/src/index.js CHANGED
@@ -12,6 +12,7 @@ import { solana as feeData } from '@exodus/solana-lib/src/fee-data'
12
12
  import assetList from '@exodus/solana-meta'
13
13
  import ms from 'ms'
14
14
  import serverApi, {
15
+ isSolanaRewardsActivityTx,
15
16
  getBalancesFactory,
16
17
  getUnstakingFee,
17
18
  SolanaMonitor,
@@ -67,15 +68,28 @@ const createAsset = ({
67
68
  const createCustomToken = ({ assetId, assetName, ...rest }) =>
68
69
  createToken({ ...rest, name: assetName, mintAddress: assetId })
69
70
 
71
+ const isSmallValueTx = (tx) =>
72
+ !tx.tokens?.length &&
73
+ !isSolanaRewardsActivityTx(tx) &&
74
+ Math.abs(tx.coinAmount.toDefaultNumber()) <= 0.000_000_001
75
+
76
+ const getActivityTxs = ({ txs }) => txs.filter((tx) => !isSmallValueTx(tx))
77
+
70
78
  const features = {
71
79
  accountState: true,
72
80
  customTokens: true,
73
81
  feeMonitor: true,
74
82
  feesApi: true,
75
83
  nfts: true,
84
+ staking: {},
85
+ }
86
+
87
+ const assetStakingApi = {
88
+ isStaking: ({ accountState }) => accountState.staking.isDelegating,
76
89
  }
77
90
 
78
91
  const api = {
92
+ getActivityTxs,
79
93
  addressHasHistory: (...args) => serverApi.getAccountInfo(...args).then((acc) => !!acc),
80
94
  broadcastTx: (...args) => serverApi.broadcastTransaction(...args),
81
95
  createAccountState: () => SolanaAccountState,
@@ -106,6 +120,7 @@ const createAsset = ({
106
120
  sendTx,
107
121
  signTx: ({ unsignedTx, privateKey }) => signUnsignedTx(unsignedTx, privateKey),
108
122
  signUnsignedTx,
123
+ staking: assetStakingApi,
109
124
  validateAssetId: isValidAddress,
110
125
  }
111
126