solana-labs / solana-web3.js

Solana JavaScript SDK
https://solana-labs.github.io/solana-web3.js
MIT License
2.2k stars 875 forks source link

Feat Request: Generic `realloc` interface / instruction builder #3169

Closed jacksondoherty closed 2 months ago

jacksondoherty commented 2 months ago

Motivation

The only current instruction builder for realloc is specifically tailored to SPL tokens, createReallocateInstruction, which contains parameters like extensionTypes that don't make sense for other use cases. It would be great to have a generic realloc interface / instruction builder similar to SystemProgram.createAccount.

Example use case

  const createAccountIx = createReallocInterfaceInstruction({
    fromPubkey,
    accountPubkey,
    additionalLamports,
    additionalSpace,
    programId,
  });
  // ...send ix

Details

Optionally, instead of "additional" we could have new totals.

jacksondoherty commented 2 months ago

No longer convinced this is needed – realloc should probably just be paired with the instruction that intends to use the new space.

github-actions[bot] commented 2 months ago

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.