@ghostspeak/sdk 1.3.0 → 1.3.1
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 +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16302,7 +16302,12 @@ function getRegisterAgentInstructionDataEncoder() {
|
|
|
16302
16302
|
["metadataUri", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
16303
16303
|
["agentId", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())]
|
|
16304
16304
|
]),
|
|
16305
|
-
(value) =>
|
|
16305
|
+
(value) => {
|
|
16306
|
+
if (typeof value.agentType !== "number" || isNaN(value.agentType)) {
|
|
16307
|
+
throw new Error(`Invalid agentType: ${value.agentType}. Must be a valid number.`);
|
|
16308
|
+
}
|
|
16309
|
+
return { ...value, discriminator: REGISTER_AGENT_DISCRIMINATOR };
|
|
16310
|
+
}
|
|
16306
16311
|
);
|
|
16307
16312
|
}
|
|
16308
16313
|
function getRegisterAgentInstructionDataDecoder() {
|
|
@@ -21745,11 +21750,19 @@ var AgentInstructions = class extends BaseInstructions {
|
|
|
21745
21750
|
* Register a new AI agent
|
|
21746
21751
|
*/
|
|
21747
21752
|
async register(signer, agentAddress, userRegistryAddress, params) {
|
|
21753
|
+
const agentType = typeof params.agentType === "number" && !isNaN(params.agentType) ? params.agentType : 1;
|
|
21754
|
+
console.log("\u{1F50D} Registering agent with params:", {
|
|
21755
|
+
agentType,
|
|
21756
|
+
metadataUri: params.metadataUri,
|
|
21757
|
+
agentId: params.agentId,
|
|
21758
|
+
agentAddress: agentAddress.toString(),
|
|
21759
|
+
userRegistry: userRegistryAddress.toString()
|
|
21760
|
+
});
|
|
21748
21761
|
const instruction = getRegisterAgentInstruction({
|
|
21749
21762
|
agentAccount: agentAddress,
|
|
21750
21763
|
userRegistry: userRegistryAddress,
|
|
21751
21764
|
signer,
|
|
21752
|
-
agentType
|
|
21765
|
+
agentType,
|
|
21753
21766
|
metadataUri: params.metadataUri,
|
|
21754
21767
|
agentId: params.agentId
|
|
21755
21768
|
});
|
|
@@ -21759,10 +21772,11 @@ var AgentInstructions = class extends BaseInstructions {
|
|
|
21759
21772
|
* Update an existing agent
|
|
21760
21773
|
*/
|
|
21761
21774
|
async update(signer, agentAddress, agentType, metadataUri, agentId) {
|
|
21775
|
+
const validAgentType = typeof agentType === "number" && !isNaN(agentType) ? agentType : 1;
|
|
21762
21776
|
const instruction = getUpdateAgentInstruction({
|
|
21763
21777
|
agentAccount: agentAddress,
|
|
21764
21778
|
signer,
|
|
21765
|
-
agentType,
|
|
21779
|
+
agentType: validAgentType,
|
|
21766
21780
|
metadataUri,
|
|
21767
21781
|
agentId
|
|
21768
21782
|
});
|