async function debug(){
var basePubKey = new solanaWeb3.PublicKey("6gHtRckgbXmRtXkkCx5vhAh9jBUC3AuXTgmhi9gMHMVM");
var programID = new solanaWeb3.PublicKey("HnFghw7hfphghDi87X1uVdCvGYAF5JtqqNnrt74K6ke8");
var pda = await solanaWeb3.PublicKey.createWithSeed(basePubKey, "bank", programID);
console.log(pda.toBase58()); // this prints 6C5xTpDj47nGrAn58mwkJGytd52cWqfF35Jj8FqEnZFL
var seedBytes = new Uint8Array([98, 97, 110, 107]);
var try1 = await solanaWeb3.PublicKey.findProgramAddress([seedBytes], programID);
console.log(try1[0].toBase58()); //this prints CPPAAFkKFW91G4SzVFs2p4aqFZHR7Ba8xjAfTzbnxD5p
var try2 = await solanaWeb3.PublicKey.findProgramAddress([basePubKey.toBuffer(), seedBytes, programID.toBuffer()], programID);
console.log(try2[0].toBase58()); // this prints 2v9FKEF564tMixjncDpe8Ebsv8fuyK2QmsRpMyxMskBk
var try3 = await solanaWeb3.PublicKey.findProgramAddress([basePubKey.toBuffer(), seedBytes], programID);
console.log(try3[0].toBase58()); // this prints 3PYjPRXcrUzW37fbWSUw62SifqrFpgDKDVttSf7UTTy5
}
I made a PDA with createWithSeed(), and when I call findProgramAddress() with the same seed and programID, I get back a different address for the PDA. Why? I've tried different combinations of seeds. I've already checked that seedBytes is the "bank" in ASCII. I need to call findProgramAddress to get the bump of the pda, so that I can sign transaction with that pda in a program.