Open AnderUstarroz opened 2 years ago
I do the following in my custom implementation. Had to change it up completely since the new update.
const endStakingIx = await this.farmProgram.methods
.unstake(farmAuthBump, farmTreasuryBump, farmerBump, skipRewards)
.accounts({
farm,
farmer,
farmTreasury,
identity: identityPk,
bank: farmAcc.bank,
vault,
farmAuthority: farmAuth,
gemBank: this.bankProgram.programId,
systemProgram: SystemProgram.programId,
feeAcc: feeAccount,
})
.signers(signers)
.instruction();
const endCooldownIx = await this.farmProgram.methods
.unstake(farmAuthBump, farmTreasuryBump, farmerBump, skipRewards)
.accounts({
farm,
farmer,
farmTreasury,
identity: identityPk,
bank: farmAcc.bank,
vault,
farmAuthority: farmAuth,
gemBank: this.bankProgram.programId,
systemProgram: SystemProgram.programId,
feeAcc: feeAccount,
})
.signers(signers)
.instruction();
const withdrawGemIx = await this.bankProgram.methods
.withdrawGem(vaultAuthBump, gemBoxBump, GDRBump, gemRarityBump, gemAmount)
.accounts({
bank,
vault,
owner: isKp(farmerIdentity)
? (<Keypair>farmerIdentity).publicKey
: farmerIdentity,
authority: vaultAuth,
gemBox,
gemDepositReceipt: GDR,
gemDestination,
gemMint,
gemRarity,
receiver,
tokenProgram: TOKEN_PROGRAM_ID,
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
systemProgram: SystemProgram.programId,
rent: SYSVAR_RENT_PUBKEY,
})
.signers(signers)
.instruction();
let tx = new Transaction({
feePayer: this.wallet.publicKey,
recentBlockhash: (await this.conn.getLatestBlockhash()).blockhash,
});
tx.add(endStakingIx);
tx.add(endCooldownIx);
tx.add(withdrawGemIx);
Then, I send the transaction as a bundle.
@AnderUstarroz remember to update the IDL
json files for both gem_bank
and gem_farm
@dylie-eth, @llomosol thanks, thanks and thanks to both. Knowing those two things were key to make it work again.
@dylie-eth could you share the updated code as well, we're at a loss figuring how to combine the tx in the latest commit.
@AnderUstarroz could you share the latest implementation, if you have it figured?
Also regarding https://github.com/gemworks/gem-farm/issues/81 we are using our own frontend and the last changes broke compatibility. Just pulling the latest version won't work for us, because we have some merged transactions to simplify the flow (unstake, cooldown and withdraw gem within 1 step):
I have updated the transactions adding
feeAcc
same way as I saw on the updated gem-farm-client.ts file, but unstaking throws the following error:Could you give us any hint to know who to solve this error? as I said just pulling the latest master is not an option for us, as our code as diverged significantly.