@exodus/solana-api 1.2.16 → 1.2.17

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/index.js +12 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-api",
3
- "version": "1.2.16",
3
+ "version": "1.2.17",
4
4
  "description": "Exodus internal Solana asset API wrapper",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -22,5 +22,5 @@
22
22
  "devDependencies": {
23
23
  "node-fetch": "~1.6.3"
24
24
  },
25
- "gitHead": "882b8a97ef05cbd0fbd7da0b2ce457e0a0ae7e35"
25
+ "gitHead": "6e6162c94eefd164c7dd63d039be60f790b37ced"
26
26
  }
package/src/index.js CHANGED
@@ -198,12 +198,15 @@ class Api {
198
198
  staking: {
199
199
  method: 'createAccountWithSeed',
200
200
  seed: stakeTx.seed,
201
- stakeAddress: stakeTx.newAccount,
201
+ stakeAddresses: [stakeTx.newAccount],
202
202
  stake: stakeTx.lamports,
203
203
  },
204
204
  }
205
205
  } else if (stakeWithdraw) {
206
- // TODO: lodash.find above returns 1 occurence, there could be multiple withdraw instructions in the same tx.
206
+ const stakeAccounts = lodash.map(
207
+ lodash.filter(instructions, { program: 'stake', type: 'withdraw' }),
208
+ 'stakeAccount'
209
+ )
207
210
  tx = {
208
211
  owner: stakeWithdraw.withdrawAuthority,
209
212
  from: stakeWithdraw.stakeAccount,
@@ -212,20 +215,24 @@ class Api {
212
215
  fee,
213
216
  staking: {
214
217
  method: 'withdraw',
215
- stakeAddress: stakeWithdraw.stakeAccount,
218
+ stakeAddresses: stakeAccounts,
216
219
  stake: stakeWithdraw.lamports,
217
220
  },
218
221
  }
219
222
  } else if (stakeUndelegate) {
223
+ const stakeAccounts = lodash.map(
224
+ lodash.filter(instructions, { program: 'stake', type: 'deactivate' }),
225
+ 'stakeAccount'
226
+ )
220
227
  tx = {
221
228
  owner: stakeUndelegate.stakeAuthority,
222
229
  from: stakeUndelegate.stakeAuthority,
223
- to: stakeUndelegate.stakeAccount,
230
+ to: stakeUndelegate.stakeAccount, // obsolete
224
231
  amount: 0,
225
232
  fee,
226
233
  staking: {
227
234
  method: 'undelegate',
228
- stakeAddress: stakeUndelegate.stakeAccount,
235
+ stakeAddresses: stakeAccounts,
229
236
  },
230
237
  }
231
238
  } else {