@ghostspeak/sdk 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -21605,6 +21605,22 @@ var BaseInstructions = class {
21605
21605
  console.log(`\u{1F510} Using ${signers.length} signers`);
21606
21606
  console.log(`\u{1F4CD} Program ID: ${this.programId}`);
21607
21607
  console.log(`\u{1F310} Commitment: ${this.commitment}`);
21608
+ for (let i = 0; i < instructions.length; i++) {
21609
+ const instruction = instructions[i];
21610
+ if (!instruction) {
21611
+ throw new Error(`Instruction at index ${i} is undefined`);
21612
+ }
21613
+ if (!instruction.programAddress) {
21614
+ throw new Error(`Instruction at index ${i} has no programAddress`);
21615
+ }
21616
+ if (!instruction.accounts) {
21617
+ throw new Error(`Instruction at index ${i} has no accounts array`);
21618
+ }
21619
+ if (!Array.isArray(instruction.accounts)) {
21620
+ throw new Error(`Instruction at index ${i} accounts is not an array`);
21621
+ }
21622
+ console.log(`\u2705 Instruction ${i}: ${instruction.accounts.length} accounts, program: ${instruction.programAddress}`);
21623
+ }
21608
21624
  console.log("\u{1F517} Fetching latest blockhash...");
21609
21625
  const { value: latestBlockhash } = await this.rpc.getLatestBlockhash().send();
21610
21626
  console.log(`\u2705 Got blockhash: ${latestBlockhash.blockhash}`);
@@ -21738,6 +21754,11 @@ var BaseInstructions = class {
21738
21754
  console.log(` Program: ${instruction.programAddress}`);
21739
21755
  console.log(` Accounts: ${instruction.accounts?.length || 0}`);
21740
21756
  console.log(` Data size: ${instruction.data?.length || 0} bytes`);
21757
+ if (instruction.accounts) {
21758
+ instruction.accounts.forEach((account, index) => {
21759
+ console.log(` Account ${index}: ${JSON.stringify(account)}`);
21760
+ });
21761
+ }
21741
21762
  }
21742
21763
  };
21743
21764
 
@@ -21756,17 +21777,30 @@ var AgentInstructions = class extends BaseInstructions {
21756
21777
  metadataUri: params.metadataUri,
21757
21778
  agentId: params.agentId,
21758
21779
  agentAddress: agentAddress.toString(),
21759
- userRegistry: userRegistryAddress.toString()
21760
- });
21761
- const instruction = getRegisterAgentInstruction({
21762
- agentAccount: agentAddress,
21763
- userRegistry: userRegistryAddress,
21764
- signer,
21765
- agentType,
21766
- metadataUri: params.metadataUri,
21767
- agentId: params.agentId
21780
+ userRegistry: userRegistryAddress.toString(),
21781
+ signer: signer.address ? signer.address.toString() : "NO_ADDRESS"
21768
21782
  });
21769
- return this.sendTransaction([instruction], [signer]);
21783
+ try {
21784
+ const instruction = getRegisterAgentInstruction({
21785
+ agentAccount: agentAddress,
21786
+ userRegistry: userRegistryAddress,
21787
+ signer,
21788
+ agentType,
21789
+ metadataUri: params.metadataUri,
21790
+ agentId: params.agentId
21791
+ });
21792
+ console.log("\u{1F4E6} Instruction created:", {
21793
+ programAddress: instruction.programAddress,
21794
+ accountsLength: instruction.accounts?.length,
21795
+ dataLength: instruction.data?.length,
21796
+ accounts: instruction.accounts
21797
+ });
21798
+ this.logInstructionDetails(instruction);
21799
+ return this.sendTransaction([instruction], [signer]);
21800
+ } catch (error) {
21801
+ console.error("\u274C Failed to create register instruction:", error);
21802
+ throw error;
21803
+ }
21770
21804
  }
21771
21805
  /**
21772
21806
  * Update an existing agent