Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in actions.placeBid #155

Open
dtome123 opened this issue Jan 22, 2022 · 26 comments
Open

Error in actions.placeBid #155

dtome123 opened this issue Jan 22, 2022 · 26 comments

Comments

@dtome123
Copy link

There a bug when I call actions.placeBid function, it is "Bidder Pot Token Must be a new account". Then I read source code and everything is normal. Why did that happen?
image
(error)
image
(code)

@exromany
Copy link
Contributor

since this metaplex-foundation/metaplex-program-library#101

  const bidderPotToken = await AuctionProgram.findProgramAddress([
    Buffer.from(AuctionProgram.PREFIX),
    new PublicKey(bidderPotKey).toBuffer(),
    Buffer.from("bidder_pot_token"),
  ]);

@aheckmann aheckmann added the bug label Jan 25, 2022
@aheckmann
Copy link
Contributor

Need to port this fix over metaplex-foundation/metaplex#1557

@dtome123
Copy link
Author

I try like sugget of exromany then it pass old bug but it have new bug
image

@exromany
Copy link
Contributor

because simulation fails. you can use connection.sendRawTransaction with skipPreflight to skip simulation

connection.sendRawTransaction(tx.serialize(), {
  skipPreflight: true,
});

@dtome123
Copy link
Author

because simulation fails. you can use connection.sendRawTransaction with skipPreflight to skip simulation

connection.sendRawTransaction(tx.serialize(), {
  skipPreflight: true,
});

But after executing, it is still an error transaction so it's not better than. Do you think error from logic code somewhere like smart contract? Because if I use old code in JDK, error is "Bidder Pot Token must be a new account". Then I use your code, it pass but new error is "instruction requires an initialized account". Is there a conflict here? Thank for your help

@basvanberckel
Copy link

The issue is that the revoke instruction is sent after the accountclose instruction, which leads to an uninitializedaccount error.

@AmmarKhalid123
Copy link

@basvanberckel @dtome123 I am facing this same issue, any idea on how to fix this ?

@basvanberckel
Copy link

I believe this is already enough to fix this error: metaplex-foundation/js#172

@AmmarKhalid123
Copy link

Yes this seems correct. I hope it gets accepted soon enough

@AmmarKhalid123
Copy link

@basvanberckel Is there any way I can use your forked repo to test this solution, and continue on my work until your PR is committed? I have run npm install git+https://github.com/Beemup/metaplex-js-sdk.git but unable to import from @metaplex/js, maybe because "lib" folder is missing in the node_modules/@metaplex/js/, which was there when I installed usingnpm install @metaplex/js.

@basvanberckel
Copy link

What does your import/require statement look like in your app code? You shouldn't need to import from /lib, just from '@metaplex/js'

@AmmarKhalid123
Copy link

import { Connection, actions } from '@metaplex/js';

@AmmarKhalid123
Copy link

import { Connection, actions } from '@metaplex/js';

On this import, I'm getting error: Module not found: Can't resolve '@metaplex/js' in 'D:\Office\SolMarketplace\solmarket\src' . Am I doing something wrong? @basvanberckel

@basvanberckel
Copy link

Yeah, my bad, you can't directly install from this repo as the artifacts aren't included.
Clone the repo, build it and install that as a dependency to your own project:

cd your/project/dir
git clone https://github.com/beemup/metaplex-js-sdk -b placebid-transfer-bug
cd metaplex-js-sdk
npm install
npm run build
cd ..
npm install ./metaplex-js-sdk

@AmmarKhalid123
Copy link

@basvanberckel I'm still getting the same error btw :( Have you tested out this solution on your end?

@AmmarKhalid123
Copy link

@basvanberckel I'm still getting the same error btw :( Have you tested out this solution on your end?

Just to clarify, imports are working fine, but I'm getting the initial error of "Bidder pot token must be a new account" on actions.placeBid
@basvanberckel

@basvanberckel
Copy link

I have my own implementation of placebid that fixes both these errors, the fix linked in this thread above together with my pull request should resolve both. I am not able to write a full test for this right now, there should be a unit test if this needs to be verified in the future.

@AmmarKhalid123
Copy link

the fix linked in this thread above together with my pull request should resolve both.

Are you talking about this fix?

because simulation fails. you can use connection.sendRawTransaction with skipPreflight to skip simulation

connection.sendRawTransaction(tx.serialize(), {
  skipPreflight: true,
});

@basvanberckel
Copy link

The bidder token address should be generated like in metaplex-foundation/metaplex#1557

That will resolve the initial error of this issue.

The transaction order should be changed like in my PR, that will resolve the UninitializedAccount error. It is also an option to remove the revoke instruction entirely, like in metaplex-foundation/metaplex#1557

@basvanberckel
Copy link

I've updated the pr to fix both errors. @AmmarKhalid123 Would you be able to verify this works in your setup?

@AmmarKhalid123
Copy link

I've updated the pr to fix both errors. @AmmarKhalid123 Would you be able to verify this works in your setup?

I will check right away and let you know

@AmmarKhalid123
Copy link

I've updated the pr to fix both errors. @AmmarKhalid123 Would you be able to verify this works in your setup?

Works like a charm.

@AmmarKhalid123
Copy link

@basvanberckel forgot, there was an import of AuctionProgram I remember missing, placeBid.ts file. I got it when tried to build the project, otherwise works great.

@basvanberckel
Copy link

Ah yes, thanks. Fixed that now

@tengu-br
Copy link

Can also confirm that @basvanberckel fix works.

@nurav97
Copy link

nurav97 commented Apr 26, 2022

@AmmarKhalid123 @basvanberckel @tengu-br i am also facing the same problem of bidder pot, i made the changes you have added in the pr but the issue of bidder pot token must be new is still there am i missing something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants