@silvana-one/coordination 1.0.34 → 1.0.36

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/agent.ts CHANGED
@@ -651,7 +651,7 @@ export class AgentRegistry {
651
651
  if (methodsData && Array.isArray(methodsData)) {
652
652
  for (const entry of methodsData) {
653
653
  const key = entry?.fields?.key;
654
- const value = entry?.fields?.value;
654
+ const value = entry?.fields?.value?.fields;
655
655
  if (key && value) {
656
656
  methods[key] = {
657
657
  description: value.description ?? undefined,
@@ -694,6 +694,27 @@ export class AgentRegistry {
694
694
  return app as SilvanaApp;
695
695
  }
696
696
 
697
+ createApp(params: {
698
+ name: string;
699
+ description?: string;
700
+ transaction?: Transaction;
701
+ }): Transaction {
702
+ const { name, description, transaction } = params;
703
+ const tx = transaction ?? new Transaction();
704
+
705
+ tx.moveCall({
706
+ target: `${silvanaRegistryPackage}::registry::add_app`,
707
+ arguments: [
708
+ tx.object(this.registry),
709
+ tx.pure.string(name),
710
+ tx.pure.option("string", description ?? null),
711
+ tx.object(SUI_CLOCK_OBJECT_ID),
712
+ ],
713
+ });
714
+
715
+ return tx;
716
+ }
717
+
697
718
  removeApp(params: { name: string; transaction?: Transaction }): Transaction {
698
719
  const { name, transaction } = params;
699
720
  const tx = transaction ?? new Transaction();
package/src/package.ts CHANGED
@@ -3,4 +3,10 @@
3
3
  export const silvanaRegistryPackage =
4
4
  process.env.SILVANA_REGISTRY_PACKAGE ??
5
5
  process.env.NEXT_PUBLIC_SILVANA_REGISTRY_PACKAGE ??
6
- "@silvana/agent";
6
+ "@silvana/agent";
7
+
8
+ // Get Silvana registry address from environment variables
9
+ // Compatible with both Node.js and Next.js environments
10
+ export const silvanaRegistryAddress =
11
+ process.env.SILVANA_REGISTRY_ADDRESS ??
12
+ process.env.NEXT_PUBLIC_SILVANA_REGISTRY_ADDRESS;