@ignitionfi/spl-stake-pool 1.1.15 → 1.1.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.
- package/dist/index.browser.cjs.js +5 -5
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.browser.esm.js +5 -5
- package/dist/index.browser.esm.js.map +1 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +5 -5
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/instructions.d.ts +1 -0
- package/package.json +1 -1
- package/src/index.ts +4 -13
- package/src/instructions.ts +2 -0
package/dist/instructions.d.ts
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -323,25 +323,15 @@ export async function depositWsolWithSession(
|
|
|
323
323
|
const stakePoolProgramId = getStakePoolProgramId(connection.rpcEndpoint)
|
|
324
324
|
const stakePool = stakePoolAccount.account.data
|
|
325
325
|
|
|
326
|
-
// stakePool.tokenProgramId
|
|
327
|
-
|
|
328
326
|
const instructions: TransactionInstruction[] = []
|
|
329
327
|
|
|
330
|
-
//
|
|
328
|
+
// The program handles ATA creation internally using funds from the user's deposit
|
|
329
|
+
// This prevents rent drain attacks where paymaster pays for ATA and user reclaims rent
|
|
331
330
|
if (!destinationTokenAccount) {
|
|
332
|
-
|
|
331
|
+
destinationTokenAccount = getAssociatedTokenAddressSync(
|
|
333
332
|
stakePool.poolMint,
|
|
334
333
|
userPubkey,
|
|
335
334
|
)
|
|
336
|
-
instructions.push(
|
|
337
|
-
createAssociatedTokenAccountIdempotentInstruction(
|
|
338
|
-
payer ?? signerOrSession,
|
|
339
|
-
associatedAddress,
|
|
340
|
-
userPubkey,
|
|
341
|
-
stakePool.poolMint,
|
|
342
|
-
),
|
|
343
|
-
)
|
|
344
|
-
destinationTokenAccount = associatedAddress
|
|
345
335
|
}
|
|
346
336
|
|
|
347
337
|
const withdrawAuthority = await findWithdrawAuthorityProgramAddress(
|
|
@@ -379,6 +369,7 @@ export async function depositWsolWithSession(
|
|
|
379
369
|
tokenProgramId: stakePool.tokenProgramId,
|
|
380
370
|
programSigner,
|
|
381
371
|
payer,
|
|
372
|
+
userWallet: userPubkey,
|
|
382
373
|
}),
|
|
383
374
|
)
|
|
384
375
|
return {
|
package/src/instructions.ts
CHANGED
|
@@ -965,6 +965,7 @@ export class StakePoolInstruction {
|
|
|
965
965
|
tokenProgramId: PublicKey
|
|
966
966
|
programId: PublicKey
|
|
967
967
|
payer?: PublicKey
|
|
968
|
+
userWallet: PublicKey
|
|
968
969
|
lamportsIn: number
|
|
969
970
|
minimumPoolTokensOut: number
|
|
970
971
|
}): TransactionInstruction {
|
|
@@ -992,6 +993,7 @@ export class StakePoolInstruction {
|
|
|
992
993
|
{ pubkey: params.wsolTransientAccount, isSigner: false, isWritable: true },
|
|
993
994
|
{ pubkey: params.programSigner, isSigner: false, isWritable: true },
|
|
994
995
|
{ pubkey: params.payer ?? params.fundingAccount, isSigner: true, isWritable: true },
|
|
996
|
+
{ pubkey: params.userWallet, isSigner: false, isWritable: false },
|
|
995
997
|
]
|
|
996
998
|
|
|
997
999
|
if (params.depositAuthority) {
|