metaplex-foundation / js-deprecated

Deprecated Metaplex JavaScript SDK
https://metaplex-foundation.github.io/js/
MIT License
128 stars 77 forks source link

Fix placeBid errors #172

Open basvanberckel opened 2 years ago

basvanberckel commented 2 years ago

Fixes both errors in https://github.com/metaplex-foundation/js/issues/155

The bidder pot account should be created, it should be a PDA passed to the program.

The revoke instruction for the transfer approval is sent after the transfer account is already closed. This reverses that order.

basvanberckel commented 2 years ago

It's possible that the revoke operation is not necessary at all if the source account is closed right away, but I am not 100% sure about this

yamijuan commented 2 years ago

@austbot

turcol commented 2 years ago

@basvanberckel thanks for the PR, as it really fixed (partially) the issue we were facing. Do you know who can move forward this PR to be accepted?

I noticed it was already approved by 3 reviewers, and I wonder if @yamijuan can review and accept it or who can do the last approval?

Thanks in advance !!

checho1989 commented 2 years ago

Trying to placeBid or InstantSale Im facing same issue with the UnitializedAccount:

Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 4: instruction requires an initialized account

Maybe the PR could fix it? Thanks

nurav97 commented 2 years ago

@checho1989 where you able to solve this issue, i am getting the same error

turcol commented 2 years ago

@nurav97 be sure that in anyplace your are using the SDK you do have the closeTokenAccountTx at the end of your mulitple transations, as in many places on the SDK the closeTokenAccountTx is before than the payingAccount and the createRevokeTx

An example (it is part of this PR):

txBatch.addTransaction(createTokenAccountTx); txBatch.addAfterTransaction(closeTokenAccountTx); txBatch.addSigner(payingAccount);

txBatch.addAfterTransaction(createRevokeTx); txBatch.addSigner(transferAuthority);

txBatch.addAfterTransaction(closeTokenAccountTx);

nurav97 commented 2 years ago

@turcol i made that change but i am now getting custom Error

failed to send transaction: Transaction simulation failed: Error processing Instruction 5: custom program error: 0x1f

i have also set flag in transaction.ts to skipPreflight:true but still the preflight check is happning i want to check the same error on explorer to check if i get any more info in the logs about this error

do you have any idea about why i am getting the error or the preflight is not setting to true