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: Signature verification failed #12

Closed
cryptoguy55 opened this issue Jun 17, 2023 · 8 comments
Closed

Error: Signature verification failed #12

cryptoguy55 opened this issue Jun 17, 2023 · 8 comments

Comments

@cryptoguy55
Copy link

I am going to make the script to transfer the domain
but I have "Error: Signature verification failed" issue
Please help me to fix this issue
this is my current code

const { pubkey } = await getDomainKey(domain_sol);
let anotherKeypair = Keypair.generate();

// Step 2
// The registry object contains all the info about the domain name
// The NFT owner is of type PublicKey | undefined
const { registry, nftOwner } = await NameRegistryState.retrieve(
  connection,
  pubkey
);
const newOwner = new PublicKey(phantomWalletDestinatiob);

const ix = await transferNameOwnership(
  connection,
  domain_sol,
  newOwner,
  wallet.publicKey,
  registry.class,
  registry.parentName
);
const tx = new Transaction();
tx.add(ix)
tx.feePayer = wallet.publicKey;
tx.recentBlockhash =(await connection.getRecentBlockhash('max')).blockhash;
// await tx.setSigners(wallet.publicKey, anotherKeypair.publicKey);
// await tx.partialSign(anotherKeypair)
console.log(tx)
const result = await sendAndConfirmTransaction (
  connection,
  tx,
  [wallet]
)
@dr497
Copy link
Contributor

dr497 commented Jun 17, 2023

Thanks for opening this issue. I think there is an error with the parameters you give to transferNameOwnership. Here is the definition of the function:

/**
 * Change the owner of a given name account.
 *
 * @param connection The solana connection object to the RPC node
 * @param name The name of the name account
 * @param newOwner The new owner to be set
 * @param curentNameOwner the current name Owner
 * @param nameClass The class of this name, if it exsists
 * @param nameParent The parent name of this name, if it exists
 * @param parentOwner Parent name owner
 * @returns
 */
export declare function transferNameOwnership(connection: Connection, name: string, newOwner: PublicKey, nameClass?: PublicKey, nameParent?: PublicKey, parentOwner?: PublicKey): Promise<TransactionInstruction>;

wallet.publicKey is not the nameClass of the domain

@cryptoguy55
Copy link
Author

I set the wallet.publickey as curentNameOwner
I set the registry.class as nameClass

@dr497
Copy link
Contributor

dr497 commented Jun 17, 2023

There was an issue in the typedoc of the function, I think this is where the confusion was coming from 86243f4. Thanks for pointing this out!

In your code it should:

const ix = await transferNameOwnership(
  connection,
  domain_sol,
  newOwner,
  registry.class,
  registry.parentName
);

@cryptoguy55
Copy link
Author

Thank you. But I have same issue yet
image

@dr497
Copy link
Contributor

dr497 commented Jun 17, 2023

Is the domain you are trying to transfer a valid .sol domain name? Or is it a subdomain?

If it's a .sol try this:

const ix = await transferNameOwnership(
  connection,
  domain_sol,
  newOwner,
  undefined,
  ROOT_DOMAIN_ACCOUNT
);

If it's a subdomain a and wallet.publicKey owns the subdomain

const ix = await transferNameOwnership(
  connection,
  domain_sol,
  newOwner,
  undefined,
  parentKey
);

If it's a subdomain a and wallet.publicKey owns the parent but not the subdomain

const ix = await transferNameOwnership(
  connection,
  domain_sol,
  newOwner,
  undefined,
  parentKey,
  wallet.publicKey
);

The class is undefined for .sol domain so it should not be passed

@cryptoguy55
Copy link
Author

cryptoguy55 commented Jun 19, 2023

Hello.
I have the issue yet.
https://github.com/cryptoguy55/sns-registration/blob/master/index.js
It is my code.
below is issue I have now
Transaction {
signatures: [],
feePayer: PublicKey [PublicKey(FuG7ErYz8p6xKWbHepEy9t2bNK5J1u5Qe4EJDVhAJkF1)] {
_bn:
},
instructions: [
TransactionInstruction {
keys: [Array],
programId: [PublicKey [PublicKey(namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX)]],
data:
}
],
recentBlockhash: undefined,
lastValidBlockHeight: undefined,
nonceInfo: undefined,
minNonceContextSlot: undefined,
_message: undefined,
_json: undefined
}
Error: Signature verification failed
at Transaction.serialize (/home/centos/API-SOL/node_modules/@solana/web3.js/lib/index.cjs.js:1730:13)
at Connection.sendTransaction (/home/centos/API-SOL/node_modules/@solana/web3.js/lib/index.cjs.js:9101:41)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async sendAndConfirmTransaction (/home/centos/API-SOL/node_modules/@solana/web3.js/lib/index.cjs.js:2042:21)
at async transferSOLDomain (/home/centos/API-SOL/index.js:106:20)
Please help me
Thank you

@dr497
Copy link
Contributor

dr497 commented Jun 20, 2023

If you look at the definition of the transfer instruction https://github.com/Bonfida/sns-sdk/blob/main/js/src/instructions.ts#L141 the only account that must be signing in your case is the owner of the domain. According to the error its signature is missing. So there is a mismatch between the domain you are passing, its owner and the signer of the transaction

@cryptoguy55
Copy link
Author

I solved the issues.
Thank you for your help

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

No branches or pull requests

2 participants