nara-sdk 1.0.37 → 1.0.39

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/src/quest.ts CHANGED
@@ -322,21 +322,29 @@ export async function submitAnswer(
322
322
  const program = createProgram(connection, wallet, options?.programId);
323
323
 
324
324
  if (activityLog) {
325
- const { makeLogActivityIx } = await import("./agent_registry");
325
+ const { makeLogActivityIx, makeLogActivityWithReferralIx } = await import("./agent_registry");
326
326
  const submitIx = await program.methods
327
327
  .submitAnswer(proof.proofA as any, proof.proofB as any, proof.proofC as any, agent, model)
328
328
  .accounts({ user: wallet.publicKey, payer: wallet.publicKey })
329
329
  .instruction();
330
- const logIx = await makeLogActivityIx(
331
- connection,
332
- wallet.publicKey,
333
- activityLog.agentId,
334
- activityLog.model,
335
- activityLog.activity,
336
- activityLog.log,
337
- undefined,
338
- activityLog.referralAgentId
339
- );
330
+ const logIx = activityLog.referralAgentId
331
+ ? await makeLogActivityWithReferralIx(
332
+ connection,
333
+ wallet.publicKey,
334
+ activityLog.agentId,
335
+ activityLog.model,
336
+ activityLog.activity,
337
+ activityLog.log,
338
+ activityLog.referralAgentId
339
+ )
340
+ : await makeLogActivityIx(
341
+ connection,
342
+ wallet.publicKey,
343
+ activityLog.agentId,
344
+ activityLog.model,
345
+ activityLog.activity,
346
+ activityLog.log
347
+ );
340
348
  const tx = new Transaction().add(submitIx).add(logIx);
341
349
  tx.feePayer = wallet.publicKey;
342
350
  tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;