Răsfoiți Sursa

:sparkles: Simplify the Bolt typescript Sdk (#36)

* :sparkles: Simplify the Bolt typescript Sdk

* :recycle: Generate ecs template using the simpler SDK syntax

* :zap: Increase max components to 5
Gabriele Picco 1 an în urmă
părinte
comite
12eb5b058e
30 a modificat fișierele cu 1608 adăugiri și 101 ștergeri
  1. 49 93
      cli/src/rust_template.rs
  2. 1 0
      clients/bolt-sdk/.solitarc.js
  3. 143 1
      clients/bolt-sdk/idl/world.json
  4. 3 0
      clients/bolt-sdk/lib/index.d.ts
  5. 1 1
      clients/bolt-sdk/lib/index.d.ts.map
  6. 17 1
      clients/bolt-sdk/lib/index.js
  7. 1 1
      clients/bolt-sdk/lib/index.js.map
  8. 31 0
      clients/bolt-sdk/lib/instructions/apply4.d.ts
  9. 1 0
      clients/bolt-sdk/lib/instructions/apply4.d.ts.map
  10. 169 0
      clients/bolt-sdk/lib/instructions/apply4.js
  11. 0 0
      clients/bolt-sdk/lib/instructions/apply4.js.map
  12. 33 0
      clients/bolt-sdk/lib/instructions/apply5.d.ts
  13. 1 0
      clients/bolt-sdk/lib/instructions/apply5.d.ts.map
  14. 179 0
      clients/bolt-sdk/lib/instructions/apply5.js
  15. 0 0
      clients/bolt-sdk/lib/instructions/apply5.js.map
  16. 2 0
      clients/bolt-sdk/lib/instructions/index.d.ts
  17. 1 1
      clients/bolt-sdk/lib/instructions/index.d.ts.map
  18. 2 0
      clients/bolt-sdk/lib/instructions/index.js
  19. 1 1
      clients/bolt-sdk/lib/instructions/index.js.map
  20. 65 0
      clients/bolt-sdk/lib/transactions/transactions.d.ts
  21. 1 0
      clients/bolt-sdk/lib/transactions/transactions.d.ts.map
  22. 335 0
      clients/bolt-sdk/lib/transactions/transactions.js
  23. 0 0
      clients/bolt-sdk/lib/transactions/transactions.js.map
  24. 17 0
      clients/bolt-sdk/src/generated/index.ts
  25. 162 0
      clients/bolt-sdk/src/generated/instructions/apply4.ts
  26. 176 0
      clients/bolt-sdk/src/generated/instructions/apply5.ts
  27. 2 0
      clients/bolt-sdk/src/generated/instructions/index.ts
  28. 213 0
      clients/bolt-sdk/src/generated/transactions/transactions.ts
  29. 1 1
      programs/bolt-system/src/lib.rs
  30. 1 1
      programs/world/src/lib.rs

+ 49 - 93
cli/src/rust_template.rs

@@ -348,11 +348,7 @@ pub fn mocha(name: &str) -> String {
         r#"const anchor = require("@magicblock-labs/anchor");
 const boltSdk = require("@magicblock-labs/bolt-sdk");
 const {{
-    createInitializeNewWorldInstruction,
-    FindWorldPda,
-    FindWorldRegistryPda,
-    Registry,
-    World
+    InitializeNewWorld,
 }} = boltSdk;
 
 describe("{}", () => {{
@@ -361,19 +357,12 @@ describe("{}", () => {{
   anchor.setProvider(provider);
 
   it("InitializeNewWorld", async () => {{
-      const registry = await Registry.fromAccountAddress(provider.connection, registryPda);
-      worldId = new anchor.BN(registry.worlds);
-      worldPda = FindWorldPda(new anchor.BN(worldId))
-      const initializeWorldIx = createInitializeNewWorldInstruction(
-          {{
-              world: worldPda,
-              registry: registryPda,
-              payer: provider.wallet.publicKey,
-          }});
-
-      const tx = new anchor.web3.Transaction().add(initializeWorldIx);
-      const txSign = await provider.sendAndConfirm(tx);
-      console.log(`Initialized a new world (ID=${{worldId}}). Initialization signature: ${{txSign}}`);
+    const initNewWorld = await InitializeNewWorld({{
+      payer: provider.wallet.publicKey,
+      connection: provider.connection,
+    }});
+    const txSign = await provider.sendAndConfirm(initNewWorld.transaction);
+    console.log(`Initialized a new world (ID=${{initNewWorld.worldPda}}). Initialization signature: ${{txSign}}`);
     }});
   }});
 }});
@@ -387,11 +376,7 @@ pub fn jest(name: &str) -> String {
         r#"const anchor = require("@magicblock-labs/anchor");
 const boltSdk = require("@magicblock-labs/bolt-sdk");
 const {{
-    createInitializeNewWorldInstruction,
-    FindWorldPda,
-    FindWorldRegistryPda,
-    Registry,
-    World
+    InitializeNewWorld,
 }} = boltSdk;
 
 describe("{}", () => {{
@@ -400,24 +385,16 @@ describe("{}", () => {{
   anchor.setProvider(provider);
 
   // Constants used to test the program.
-  const registryPda = FindWorldRegistryPda();
-  let worldId: anchor.BN;
   let worldPda: PublicKey;
 
   it("InitializeNewWorld", async () => {{
-      const registry = await Registry.fromAccountAddress(provider.connection, registryPda);
-      worldId = new anchor.BN(registry.worlds);
-      worldPda = FindWorldPda(new anchor.BN(worldId))
-      const initializeWorldIx = createInitializeNewWorldInstruction(
-          {{
-              world: worldPda,
-              registry: registryPda,
-              payer: provider.wallet.publicKey,
-          }});
-
-      const tx = new anchor.web3.Transaction().add(initializeWorldIx);
-      const txSign = await provider.sendAndConfirm(tx);
-      console.log(`Initialized a new world (ID=${{worldId}}). Initialization signature: ${{txSign}}`);
+    const initNewWorld = await InitializeNewWorld({{
+      payer: provider.wallet.publicKey,
+      connection: provider.connection,
+    }});
+    const txSign = await provider.sendAndConfirm(initNewWorld.transaction);
+    worldPda = initNewWorld.worldPda;
+    console.log(`Initialized a new world (ID=${{worldPda}}). Initialization signature: ${{txSign}}`);
     }});
   }});
 "#,
@@ -433,15 +410,11 @@ import {{ PublicKey }} from "@solana/web3.js";
 import {{ Position }} from "../target/types/position";
 import {{ Movement }} from "../target/types/movement";
 import {{
-    createInitializeNewWorldInstruction,
-    FindWorldPda,
-    FindWorldRegistryPda,
-    FindEntityPda,
-    Registry,
-    World,
-    createAddEntityInstruction,
-    createInitializeComponentInstruction,
-    FindComponentPda, createApplyInstruction
+    InitializeNewWorld,
+    AddEntity,
+    InitializeComponent,
+    ApplySystem,
+    FindComponentPda,
 }} from "@magicblock-labs/bolt-sdk"
 import {{expect}} from "chai";
 
@@ -451,8 +424,6 @@ describe("{}", () => {{
   anchor.setProvider(provider);
 
   // Constants used to test the program.
-  const registryPda = FindWorldRegistryPda();
-  let worldId: anchor.BN;
   let worldPda: PublicKey;
   let entityPda: PublicKey;
 
@@ -460,66 +431,51 @@ describe("{}", () => {{
   const systemMovement = anchor.workspace.Movement as Program<Movement>;
 
   it("InitializeNewWorld", async () => {{
-        const registry = await Registry.fromAccountAddress(provider.connection, registryPda);
-        worldId = new anchor.BN(registry.worlds);
-        worldPda = FindWorldPda(new anchor.BN(worldId))
-        const initializeWorldIx = createInitializeNewWorldInstruction(
-            {{
-                world: worldPda,
-                registry: registryPda,
-                payer: provider.wallet.publicKey,
-            }});
-
-        const tx = new anchor.web3.Transaction().add(initializeWorldIx);
-        const txSign = await provider.sendAndConfirm(tx);
-        console.log(`Initialized a new world (ID=${{worldId}}). Initialization signature: ${{txSign}}`);
+    const initNewWorld = await InitializeNewWorld({{
+      payer: provider.wallet.publicKey,
+      connection: provider.connection,
     }});
+    const txSign = await provider.sendAndConfirm(initNewWorld.transaction);
+    worldPda = initNewWorld.worldPda;
+    console.log(`Initialized a new world (ID=${{worldPda}}). Initialization signature: ${{txSign}}`);
+  }});
 
   it("Add an entity", async () => {{
-      const world = await World.fromAccountAddress(provider.connection, worldPda);
-      const entityId = new anchor.BN(world.entities);
-      entityPda = FindEntityPda(worldId, entityId);
-
-      let createEntityIx = createAddEntityInstruction({{
-          world: worldPda,
-          payer: provider.wallet.publicKey,
-          entity: entityPda,
+      const addEntity = await AddEntity({{
+        payer: provider.wallet.publicKey,
+        worldPda: worldPda,
+        connection: provider.connection,
       }});
-      const tx = new anchor.web3.Transaction().add(createEntityIx);
-      const txSign = await provider.sendAndConfirm(tx);
-      console.log(`Initialized a new Entity (ID=${{worldId}}). Initialization signature: ${{txSign}}`);
+      const txSign = await provider.sendAndConfirm(addEntity.transaction);
+      entityPda = addEntity.entityPda;
+      console.log(`Initialized a new Entity (ID=${{addEntity.entityId}}). Initialization signature: ${{txSign}}`);
   }});
 
   it("Add a component", async () => {{
-      const positionComponentPda = FindComponentPda(positionComponent.programId, entityPda, "");
-      let initComponentIx = createInitializeComponentInstruction({{
+      const initComponent = await InitializeComponent({{
           payer: provider.wallet.publicKey,
-          entity: entityPda,
-          data: positionComponentPda,
-          componentProgram: positionComponent.programId,
+          entityPda,
+          componentId: positionComponent.programId,
       }});
-
-      const tx = new anchor.web3.Transaction().add(initComponentIx);
-      const txSign = await provider.sendAndConfirm(tx);
-      console.log(`Initialized a new component. Initialization signature: ${{txSign}}`);
+      const txSign = await provider.sendAndConfirm(initComponent.transaction);
+      console.log(`Initialized the grid component. Initialization signature: ${{txSign}}`);
   }});
 
   it("Apply a system", async () => {{
-      const positionComponentPda = FindComponentPda(positionComponent.programId, entityPda, "");
+      const positionComponentPda = FindComponentPda(positionComponent.programId, entityPda);
       // Check that the component has been initialized and x is 0
       let positionData = await positionComponent.account.position.fetch(
           positionComponentPda
       );
-      expect(positionData.x.toNumber()).to.eq(0);
-      let applySystemIx = createApplyInstruction({{
-          componentProgram: positionComponent.programId,
-          boltSystem: systemMovement.programId,
-          boltComponent: positionComponentPda,
-          authority: provider.wallet.publicKey,
-      }}, {{args: new Uint8Array()}});
-
-      const tx = new anchor.web3.Transaction().add(applySystemIx);
-      await provider.sendAndConfirm(tx);
+
+      const applySystem = await ApplySystem({{
+        authority: provider.wallet.publicKey,
+        boltSystem: systemMovement.programId,
+        entityPda,
+        components: [positionComponent.programId],
+      }});
+      const txSign = await provider.sendAndConfirm(applySystem.transaction);
+      console.log(`Applied a system. Signature: ${{txSign}}`);
 
       // Check that the system has been applied and x is > 0
       positionData = await positionComponent.account.position.fetch(

+ 1 - 0
clients/bolt-sdk/.solitarc.js

@@ -8,6 +8,7 @@ module.exports = {
   idlGenerator: "anchor",
   programName: "world",
   programId: "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n",
+  removeExistingIdl: false,
   idlDir,
   sdkDir,
   binaryInstallDir,

+ 143 - 1
clients/bolt-sdk/idl/world.json

@@ -1,5 +1,5 @@
 {
-  "version": "0.0.1",
+  "version": "0.1.1",
   "name": "world",
   "instructions": [
     {
@@ -260,6 +260,148 @@
           "type": "bytes"
         }
       ]
+    },
+    {
+      "name": "apply4",
+      "accounts": [
+        {
+          "name": "boltSystem",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "componentProgram1",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "boltComponent1",
+          "isMut": true,
+          "isSigner": false
+        },
+        {
+          "name": "componentProgram2",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "boltComponent2",
+          "isMut": true,
+          "isSigner": false
+        },
+        {
+          "name": "componentProgram3",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "boltComponent3",
+          "isMut": true,
+          "isSigner": false
+        },
+        {
+          "name": "componentProgram4",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "boltComponent4",
+          "isMut": true,
+          "isSigner": false
+        },
+        {
+          "name": "authority",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "instructionSysvarAccount",
+          "isMut": false,
+          "isSigner": false
+        }
+      ],
+      "args": [
+        {
+          "name": "args",
+          "type": "bytes"
+        }
+      ]
+    },
+    {
+      "name": "apply5",
+      "accounts": [
+        {
+          "name": "boltSystem",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "componentProgram1",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "boltComponent1",
+          "isMut": true,
+          "isSigner": false
+        },
+        {
+          "name": "componentProgram2",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "boltComponent2",
+          "isMut": true,
+          "isSigner": false
+        },
+        {
+          "name": "componentProgram3",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "boltComponent3",
+          "isMut": true,
+          "isSigner": false
+        },
+        {
+          "name": "componentProgram4",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "boltComponent4",
+          "isMut": true,
+          "isSigner": false
+        },
+        {
+          "name": "componentProgram5",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "boltComponent5",
+          "isMut": true,
+          "isSigner": false
+        },
+        {
+          "name": "authority",
+          "isMut": false,
+          "isSigner": false
+        },
+        {
+          "name": "instructionSysvarAccount",
+          "isMut": false,
+          "isSigner": false
+        }
+      ],
+      "args": [
+        {
+          "name": "args",
+          "type": "bytes"
+        }
+      ]
     }
   ],
   "accounts": [

+ 3 - 0
clients/bolt-sdk/lib/index.d.ts

@@ -1,7 +1,9 @@
+/// <reference types="node" />
 import { PublicKey } from "@solana/web3.js";
 import type BN from "bn.js";
 export * from "./accounts";
 export * from "./instructions";
+export * from "./transactions/transactions";
 export declare const PROGRAM_ADDRESS =
   "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n";
 export declare const SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
@@ -19,4 +21,5 @@ export declare function FindComponentPda(
   entity: PublicKey,
   componentId?: string
 ): PublicKey;
+export declare function SerializeArgs(args?: any): Buffer;
 //# sourceMappingURL=index.d.ts.map

+ 1 - 1
clients/bolt-sdk/lib/index.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/generated/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,OAAO,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAQ/B,eAAO,MAAM,eAAe,gDAAgD,CAAC;AAE7E,eAAO,MAAM,0BAA0B,WAEtC,CAAC;AAQF,eAAO,MAAM,UAAU,WAAiC,CAAC;AAEzD,wBAAgB,oBAAoB,CAClC,SAAS,GAAE,SAAqC,aAMjD;AAED,wBAAgB,YAAY,CAC1B,EAAE,EAAE,EAAE,EACN,SAAS,GAAE,SAAqC,aAMjD;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,EAAE,EACX,QAAQ,EAAE,EAAE,EACZ,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,GAAE,SAAqC,aAUjD;AAED,wBAAgB,gBAAgB,CAC9B,kBAAkB,EAAE,SAAS,EAC7B,MAAM,EAAE,SAAS,EACjB,WAAW,GAAE,MAAW,aAMzB"}
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/generated/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,OAAO,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAQ5C,eAAO,MAAM,eAAe,gDAAgD,CAAC;AAE7E,eAAO,MAAM,0BAA0B,WAEtC,CAAC;AAQF,eAAO,MAAM,UAAU,WAAiC,CAAC;AAEzD,wBAAgB,oBAAoB,CAClC,SAAS,GAAE,SAAqC,aAMjD;AAED,wBAAgB,YAAY,CAC1B,EAAE,EAAE,EAAE,EACN,SAAS,GAAE,SAAqC,aAMjD;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,EAAE,EACX,QAAQ,EAAE,EAAE,EACZ,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,GAAE,SAAqC,aAUjD;AAED,wBAAgB,gBAAgB,CAC9B,kBAAkB,EAAE,SAAS,EAC7B,MAAM,EAAE,SAAS,EACjB,WAAW,GAAE,MAAW,aAMzB;AAOD,wBAAgB,aAAa,CAAC,IAAI,GAAE,GAAQ,UAS3C"}

+ 17 - 1
clients/bolt-sdk/lib/index.js

@@ -30,7 +30,8 @@ var __exportStar =
         __createBinding(exports, m, p);
   };
 Object.defineProperty(exports, "__esModule", { value: true });
-exports.FindComponentPda =
+exports.SerializeArgs =
+  exports.FindComponentPda =
   exports.FindEntityPda =
   exports.FindWorldPda =
   exports.FindWorldRegistryPda =
@@ -41,6 +42,7 @@ exports.FindComponentPda =
 var web3_js_1 = require("@solana/web3.js");
 __exportStar(require("./accounts"), exports);
 __exportStar(require("./instructions"), exports);
+__exportStar(require("./transactions/transactions"), exports);
 exports.PROGRAM_ADDRESS = "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n";
 exports.SYSVAR_INSTRUCTIONS_PUBKEY = new web3_js_1.PublicKey(
   "Sysvar1nstructions1111111111111111111111111"
@@ -90,4 +92,18 @@ function FindComponentPda(componentProgramId, entity, componentId) {
   )[0];
 }
 exports.FindComponentPda = FindComponentPda;
+function SerializeArgs(args) {
+  if (args === void 0) {
+    args = {};
+  }
+  var jsonString = JSON.stringify(args);
+  var encoder = new TextEncoder();
+  var binaryData = encoder.encode(jsonString);
+  return Buffer.from(
+    binaryData.buffer,
+    binaryData.byteOffset,
+    binaryData.byteLength
+  );
+}
+exports.SerializeArgs = SerializeArgs;
 //# sourceMappingURL=index.js.map

+ 1 - 1
clients/bolt-sdk/lib/index.js.map

@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/generated/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,6CAA2B;AAC3B,iDAA+B;AAQlB,QAAA,eAAe,GAAG,6CAA6C,CAAC;AAEhE,QAAA,0BAA0B,GAAG,IAAI,mBAAS,CACrD,6CAA6C,CAC9C,CAAC;AAQW,QAAA,UAAU,GAAG,IAAI,mBAAS,CAAC,uBAAe,CAAC,CAAC;AAEzD,SAAgB,oBAAoB,CAClC,SAAgD;IAAhD,0BAAA,EAAA,gBAA2B,mBAAS,CAAC,kBAAU,CAAC;IAEhD,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,EACzB,SAAS,CACV,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AAPD,oDAOC;AAED,SAAgB,YAAY,CAC1B,EAAM,EACN,SAAgD;IAAhD,0BAAA,EAAA,gBAA2B,mBAAS,CAAC,kBAAU,CAAC;IAEhD,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAC5C,SAAS,CACV,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AARD,oCAQC;AAED,SAAgB,aAAa,CAC3B,OAAW,EACX,QAAY,EACZ,SAAkB,EAClB,SAAgD;IAAhD,0BAAA,EAAA,gBAA2B,mBAAS,CAAC,kBAAU,CAAC;IAEhD,IAAM,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACjE,IAAI,SAAS,IAAI,IAAI,EAAE;QACrB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;KACpC;SAAM;QACL,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;KACxC;IACD,OAAO,mBAAS,CAAC,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC;AAdD,sCAcC;AAED,SAAgB,gBAAgB,CAC9B,kBAA6B,EAC7B,MAAiB,EACjB,WAAwB;IAAxB,4BAAA,EAAA,gBAAwB;IAExB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,EAC5C,kBAAkB,CACnB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,4CASC"}
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/generated/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAE5C,6CAA2B;AAC3B,iDAA+B;AAC/B,8DAA4C;AAQ/B,QAAA,eAAe,GAAG,6CAA6C,CAAC;AAEhE,QAAA,0BAA0B,GAAG,IAAI,mBAAS,CACrD,6CAA6C,CAC9C,CAAC;AAQW,QAAA,UAAU,GAAG,IAAI,mBAAS,CAAC,uBAAe,CAAC,CAAC;AAEzD,SAAgB,oBAAoB,CAClC,SAAgD;IAAhD,0BAAA,EAAA,gBAA2B,mBAAS,CAAC,kBAAU,CAAC;IAEhD,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,EACzB,SAAS,CACV,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AAPD,oDAOC;AAED,SAAgB,YAAY,CAC1B,EAAM,EACN,SAAgD;IAAhD,0BAAA,EAAA,gBAA2B,mBAAS,CAAC,kBAAU,CAAC;IAEhD,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAC5C,SAAS,CACV,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AARD,oCAQC;AAED,SAAgB,aAAa,CAC3B,OAAW,EACX,QAAY,EACZ,SAAkB,EAClB,SAAgD;IAAhD,0BAAA,EAAA,gBAA2B,mBAAS,CAAC,kBAAU,CAAC;IAEhD,IAAM,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACjE,IAAI,SAAS,IAAI,IAAI,EAAE;QACrB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;KACpC;SAAM;QACL,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;KACxC;IACD,OAAO,mBAAS,CAAC,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC;AAdD,sCAcC;AAED,SAAgB,gBAAgB,CAC9B,kBAA6B,EAC7B,MAAiB,EACjB,WAAwB;IAAxB,4BAAA,EAAA,gBAAwB;IAExB,OAAO,mBAAS,CAAC,sBAAsB,CACrC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,EAC5C,kBAAkB,CACnB,CAAC,CAAC,CAAC,CAAC;AACP,CAAC;AATD,4CASC;AAOD,SAAgB,aAAa,CAAC,IAAc;IAAd,qBAAA,EAAA,SAAc;IAC1C,IAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,IAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,IAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,IAAI,CAChB,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,UAAU,EACrB,UAAU,CAAC,UAAU,CACtB,CAAC;AACJ,CAAC;AATD,sCASC"}

+ 31 - 0
clients/bolt-sdk/lib/instructions/apply4.d.ts

@@ -0,0 +1,31 @@
+import * as beet from "@metaplex-foundation/beet";
+import * as web3 from "@solana/web3.js";
+export interface Apply4InstructionArgs {
+  args: Uint8Array;
+}
+export declare const apply4Struct: beet.FixableBeetArgsStruct<
+  Apply4InstructionArgs & {
+    instructionDiscriminator: number[];
+  }
+>;
+export interface Apply4InstructionAccounts {
+  boltSystem: web3.PublicKey;
+  componentProgram1: web3.PublicKey;
+  boltComponent1: web3.PublicKey;
+  componentProgram2: web3.PublicKey;
+  boltComponent2: web3.PublicKey;
+  componentProgram3: web3.PublicKey;
+  boltComponent3: web3.PublicKey;
+  componentProgram4: web3.PublicKey;
+  boltComponent4: web3.PublicKey;
+  authority?: web3.PublicKey;
+  instructionSysvarAccount?: web3.PublicKey;
+  anchorRemainingAccounts?: web3.AccountMeta[];
+}
+export declare const apply4InstructionDiscriminator: number[];
+export declare function createApply4Instruction(
+  accounts: Apply4InstructionAccounts,
+  args: Apply4InstructionArgs,
+  programId?: web3.PublicKey
+): web3.TransactionInstruction;
+//# sourceMappingURL=apply4.d.ts.map

+ 1 - 0
clients/bolt-sdk/lib/instructions/apply4.d.ts.map

@@ -0,0 +1 @@
+{"version":3,"file":"apply4.d.ts","sourceRoot":"","sources":["../../src/generated/instructions/apply4.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAC;AAClD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAQxC,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,CAAC;CAClB;AAMD,eAAO,MAAM,YAAY;8BAEK,MAAM,EAAE;EAQrC,CAAC;AAmBF,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;IAClC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;IAClC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;IAClC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;IAClC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,wBAAwB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;IAC1C,uBAAuB,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;CAC9C;AAED,eAAO,MAAM,8BAA8B,UAE1C,CAAC;AAYF,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,qBAAqB,EAC3B,SAAS,iBAAoE,+BA4E9E"}

+ 169 - 0
clients/bolt-sdk/lib/instructions/apply4.js

@@ -0,0 +1,169 @@
+"use strict";
+var __assign =
+  (this && this.__assign) ||
+  function () {
+    __assign =
+      Object.assign ||
+      function (t) {
+        for (var s, i = 1, n = arguments.length; i < n; i++) {
+          s = arguments[i];
+          for (var p in s)
+            if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+        }
+        return t;
+      };
+    return __assign.apply(this, arguments);
+  };
+var __createBinding =
+  (this && this.__createBinding) ||
+  (Object.create
+    ? function (o, m, k, k2) {
+        if (k2 === undefined) k2 = k;
+        var desc = Object.getOwnPropertyDescriptor(m, k);
+        if (
+          !desc ||
+          ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
+        ) {
+          desc = {
+            enumerable: true,
+            get: function () {
+              return m[k];
+            },
+          };
+        }
+        Object.defineProperty(o, k2, desc);
+      }
+    : function (o, m, k, k2) {
+        if (k2 === undefined) k2 = k;
+        o[k2] = m[k];
+      });
+var __setModuleDefault =
+  (this && this.__setModuleDefault) ||
+  (Object.create
+    ? function (o, v) {
+        Object.defineProperty(o, "default", { enumerable: true, value: v });
+      }
+    : function (o, v) {
+        o["default"] = v;
+      });
+var __importStar =
+  (this && this.__importStar) ||
+  function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null)
+      for (var k in mod)
+        if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
+          __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+  };
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.createApply4Instruction =
+  exports.apply4InstructionDiscriminator =
+  exports.apply4Struct =
+    void 0;
+var beet = __importStar(require("@metaplex-foundation/beet"));
+var web3 = __importStar(require("@solana/web3.js"));
+var index_1 = require("../index");
+exports.apply4Struct = new beet.FixableBeetArgsStruct(
+  [
+    ["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)],
+    ["args", beet.bytes],
+  ],
+  "Apply4InstructionArgs"
+);
+exports.apply4InstructionDiscriminator = [223, 104, 24, 79, 252, 196, 14, 109];
+function createApply4Instruction(accounts, args, programId) {
+  var _a, _b;
+  if (programId === void 0) {
+    programId = new web3.PublicKey(
+      "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n"
+    );
+  }
+  var data = exports.apply4Struct.serialize(
+    __assign(
+      { instructionDiscriminator: exports.apply4InstructionDiscriminator },
+      args
+    )
+  )[0];
+  var keys = [
+    {
+      pubkey: accounts.boltSystem,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram1,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent1,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram2,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent2,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram3,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent3,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram4,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent4,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey:
+        (_a = accounts.authority) !== null && _a !== void 0 ? _a : programId,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey:
+        (_b = accounts.instructionSysvarAccount) !== null && _b !== void 0
+          ? _b
+          : index_1.SYSVAR_INSTRUCTIONS_PUBKEY,
+      isWritable: false,
+      isSigner: false,
+    },
+  ];
+  if (accounts.anchorRemainingAccounts != null) {
+    for (
+      var _i = 0, _c = accounts.anchorRemainingAccounts;
+      _i < _c.length;
+      _i++
+    ) {
+      var acc = _c[_i];
+      keys.push(acc);
+    }
+  }
+  var ix = new web3.TransactionInstruction({
+    programId: programId,
+    keys: keys,
+    data: data,
+  });
+  return ix;
+}
+exports.createApply4Instruction = createApply4Instruction;
+//# sourceMappingURL=apply4.js.map

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
clients/bolt-sdk/lib/instructions/apply4.js.map


+ 33 - 0
clients/bolt-sdk/lib/instructions/apply5.d.ts

@@ -0,0 +1,33 @@
+import * as beet from "@metaplex-foundation/beet";
+import * as web3 from "@solana/web3.js";
+export interface Apply5InstructionArgs {
+  args: Uint8Array;
+}
+export declare const apply5Struct: beet.FixableBeetArgsStruct<
+  Apply5InstructionArgs & {
+    instructionDiscriminator: number[];
+  }
+>;
+export interface Apply5InstructionAccounts {
+  boltSystem: web3.PublicKey;
+  componentProgram1: web3.PublicKey;
+  boltComponent1: web3.PublicKey;
+  componentProgram2: web3.PublicKey;
+  boltComponent2: web3.PublicKey;
+  componentProgram3: web3.PublicKey;
+  boltComponent3: web3.PublicKey;
+  componentProgram4: web3.PublicKey;
+  boltComponent4: web3.PublicKey;
+  componentProgram5: web3.PublicKey;
+  boltComponent5: web3.PublicKey;
+  authority?: web3.PublicKey;
+  instructionSysvarAccount?: web3.PublicKey;
+  anchorRemainingAccounts?: web3.AccountMeta[];
+}
+export declare const apply5InstructionDiscriminator: number[];
+export declare function createApply5Instruction(
+  accounts: Apply5InstructionAccounts,
+  args: Apply5InstructionArgs,
+  programId?: web3.PublicKey
+): web3.TransactionInstruction;
+//# sourceMappingURL=apply5.d.ts.map

+ 1 - 0
clients/bolt-sdk/lib/instructions/apply5.d.ts.map

@@ -0,0 +1 @@
+{"version":3,"file":"apply5.d.ts","sourceRoot":"","sources":["../../src/generated/instructions/apply5.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,IAAI,MAAM,2BAA2B,CAAC;AAClD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAQxC,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,CAAC;CAClB;AAMD,eAAO,MAAM,YAAY;8BAEK,MAAM,EAAE;EAQrC,CAAC;AAqBF,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;IAClC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;IAClC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;IAClC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;IAClC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;IAClC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,wBAAwB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;IAC1C,uBAAuB,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;CAC9C;AAED,eAAO,MAAM,8BAA8B,UAE1C,CAAC;AAYF,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,qBAAqB,EAC3B,SAAS,iBAAoE,+BAsF9E"}

+ 179 - 0
clients/bolt-sdk/lib/instructions/apply5.js

@@ -0,0 +1,179 @@
+"use strict";
+var __assign =
+  (this && this.__assign) ||
+  function () {
+    __assign =
+      Object.assign ||
+      function (t) {
+        for (var s, i = 1, n = arguments.length; i < n; i++) {
+          s = arguments[i];
+          for (var p in s)
+            if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+        }
+        return t;
+      };
+    return __assign.apply(this, arguments);
+  };
+var __createBinding =
+  (this && this.__createBinding) ||
+  (Object.create
+    ? function (o, m, k, k2) {
+        if (k2 === undefined) k2 = k;
+        var desc = Object.getOwnPropertyDescriptor(m, k);
+        if (
+          !desc ||
+          ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
+        ) {
+          desc = {
+            enumerable: true,
+            get: function () {
+              return m[k];
+            },
+          };
+        }
+        Object.defineProperty(o, k2, desc);
+      }
+    : function (o, m, k, k2) {
+        if (k2 === undefined) k2 = k;
+        o[k2] = m[k];
+      });
+var __setModuleDefault =
+  (this && this.__setModuleDefault) ||
+  (Object.create
+    ? function (o, v) {
+        Object.defineProperty(o, "default", { enumerable: true, value: v });
+      }
+    : function (o, v) {
+        o["default"] = v;
+      });
+var __importStar =
+  (this && this.__importStar) ||
+  function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null)
+      for (var k in mod)
+        if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
+          __createBinding(result, mod, k);
+    __setModuleDefault(result, mod);
+    return result;
+  };
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.createApply5Instruction =
+  exports.apply5InstructionDiscriminator =
+  exports.apply5Struct =
+    void 0;
+var beet = __importStar(require("@metaplex-foundation/beet"));
+var web3 = __importStar(require("@solana/web3.js"));
+var index_1 = require("../index");
+exports.apply5Struct = new beet.FixableBeetArgsStruct(
+  [
+    ["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)],
+    ["args", beet.bytes],
+  ],
+  "Apply5InstructionArgs"
+);
+exports.apply5InstructionDiscriminator = [223, 104, 24, 79, 252, 196, 14, 109];
+function createApply5Instruction(accounts, args, programId) {
+  var _a, _b;
+  if (programId === void 0) {
+    programId = new web3.PublicKey(
+      "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n"
+    );
+  }
+  var data = exports.apply5Struct.serialize(
+    __assign(
+      { instructionDiscriminator: exports.apply5InstructionDiscriminator },
+      args
+    )
+  )[0];
+  var keys = [
+    {
+      pubkey: accounts.boltSystem,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram1,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent1,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram2,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent2,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram3,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent3,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram4,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent4,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram5,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent5,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey:
+        (_a = accounts.authority) !== null && _a !== void 0 ? _a : programId,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey:
+        (_b = accounts.instructionSysvarAccount) !== null && _b !== void 0
+          ? _b
+          : index_1.SYSVAR_INSTRUCTIONS_PUBKEY,
+      isWritable: false,
+      isSigner: false,
+    },
+  ];
+  if (accounts.anchorRemainingAccounts != null) {
+    for (
+      var _i = 0, _c = accounts.anchorRemainingAccounts;
+      _i < _c.length;
+      _i++
+    ) {
+      var acc = _c[_i];
+      keys.push(acc);
+    }
+  }
+  var ix = new web3.TransactionInstruction({
+    programId: programId,
+    keys: keys,
+    data: data,
+  });
+  return ix;
+}
+exports.createApply5Instruction = createApply5Instruction;
+//# sourceMappingURL=apply5.js.map

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
clients/bolt-sdk/lib/instructions/apply5.js.map


+ 2 - 0
clients/bolt-sdk/lib/instructions/index.d.ts

@@ -2,6 +2,8 @@ export * from "./addEntity";
 export * from "./apply";
 export * from "./apply2";
 export * from "./apply3";
+export * from "./apply4";
+export * from "./apply5";
 export * from "./initializeComponent";
 export * from "./initializeNewWorld";
 export * from "./initializeRegistry";

+ 1 - 1
clients/bolt-sdk/lib/instructions/index.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generated/instructions/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generated/instructions/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}

+ 2 - 0
clients/bolt-sdk/lib/instructions/index.js

@@ -34,6 +34,8 @@ __exportStar(require("./addEntity"), exports);
 __exportStar(require("./apply"), exports);
 __exportStar(require("./apply2"), exports);
 __exportStar(require("./apply3"), exports);
+__exportStar(require("./apply4"), exports);
+__exportStar(require("./apply5"), exports);
 __exportStar(require("./initializeComponent"), exports);
 __exportStar(require("./initializeNewWorld"), exports);
 __exportStar(require("./initializeRegistry"), exports);

+ 1 - 1
clients/bolt-sdk/lib/instructions/index.js.map

@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generated/instructions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,wDAAsC;AACtC,uDAAqC;AACrC,uDAAqC"}
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generated/instructions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,wDAAsC;AACtC,uDAAqC;AACrC,uDAAqC"}

+ 65 - 0
clients/bolt-sdk/lib/transactions/transactions.d.ts

@@ -0,0 +1,65 @@
+import BN from "bn.js";
+import { type PublicKey, Transaction, type Connection } from "@solana/web3.js";
+import type web3 from "@solana/web3.js";
+export declare function InitializeNewWorld({
+  payer,
+  connection,
+}: {
+  payer: PublicKey;
+  connection: Connection;
+}): Promise<{
+  transaction: Transaction;
+  worldPda: PublicKey;
+  worldId: BN;
+}>;
+export declare function AddEntity({
+  payer,
+  worldPda,
+  connection,
+}: {
+  payer: PublicKey;
+  worldPda: PublicKey;
+  connection: Connection;
+}): Promise<{
+  transaction: Transaction;
+  entityPda: PublicKey;
+  entityId: BN;
+}>;
+export declare function InitializeComponent({
+  payer,
+  entityPda,
+  componentId,
+  seed,
+  authority,
+  anchorRemainingAccounts,
+}: {
+  payer: PublicKey;
+  entityPda: PublicKey;
+  componentId: PublicKey;
+  seed?: string;
+  authority?: web3.PublicKey;
+  anchorRemainingAccounts?: web3.AccountMeta[];
+}): Promise<{
+  transaction: Transaction;
+  componentPda: PublicKey;
+}>;
+export declare function ApplySystem({
+  authority,
+  boltSystem,
+  entityPda,
+  components,
+  args,
+  extraAccounts,
+  seed,
+}: {
+  authority: PublicKey;
+  boltSystem: PublicKey;
+  entityPda: PublicKey;
+  components: PublicKey[];
+  args?: object;
+  extraAccounts?: web3.AccountMeta[];
+  seed?: string[];
+}): Promise<{
+  transaction: Transaction;
+}>;
+//# sourceMappingURL=transactions.d.ts.map

+ 1 - 0
clients/bolt-sdk/lib/transactions/transactions.d.ts.map

@@ -0,0 +1 @@
+{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../src/generated/transactions/transactions.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,MAAM,OAAO,CAAC;AACvB,OAAO,EAAE,KAAK,SAAS,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAUxC,wBAAsB,kBAAkB,CAAC,EACvC,KAAK,EACL,UAAU,GACX,EAAE;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACxB,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,EAAE,CAAA;CAAE,CAAC,CAe1E;AASD,wBAAsB,SAAS,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,UAAU,GACX,EAAE;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;CACxB,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,EAAE,CAAA;CAAE,CAAC,CAe5E;AAYD,wBAAsB,mBAAmB,CAAC,EACxC,KAAK,EACL,SAAS,EACT,WAAW,EACX,IAAS,EACT,SAAS,EACT,uBAAuB,GACxB,EAAE;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,uBAAuB,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;CAC9C,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,YAAY,EAAE,SAAS,CAAA;CAAE,CAAC,CAejE;AAaD,wBAAsB,WAAW,CAAC,EAChC,SAAS,EACT,UAAU,EACV,SAAS,EACT,UAAU,EACV,IAAS,EACT,aAAa,EACb,IAAI,GACL,EAAE;IACD,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,SAAS,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,GAAG,OAAO,CAAC;IAAE,WAAW,EAAE,WAAW,CAAA;CAAE,CAAC,CA6CxC"}

+ 335 - 0
clients/bolt-sdk/lib/transactions/transactions.js

@@ -0,0 +1,335 @@
+"use strict";
+var __awaiter =
+  (this && this.__awaiter) ||
+  function (thisArg, _arguments, P, generator) {
+    function adopt(value) {
+      return value instanceof P
+        ? value
+        : new P(function (resolve) {
+            resolve(value);
+          });
+    }
+    return new (P || (P = Promise))(function (resolve, reject) {
+      function fulfilled(value) {
+        try {
+          step(generator.next(value));
+        } catch (e) {
+          reject(e);
+        }
+      }
+      function rejected(value) {
+        try {
+          step(generator["throw"](value));
+        } catch (e) {
+          reject(e);
+        }
+      }
+      function step(result) {
+        result.done
+          ? resolve(result.value)
+          : adopt(result.value).then(fulfilled, rejected);
+      }
+      step((generator = generator.apply(thisArg, _arguments || [])).next());
+    });
+  };
+var __generator =
+  (this && this.__generator) ||
+  function (thisArg, body) {
+    var _ = {
+        label: 0,
+        sent: function () {
+          if (t[0] & 1) throw t[1];
+          return t[1];
+        },
+        trys: [],
+        ops: [],
+      },
+      f,
+      y,
+      t,
+      g;
+    return (
+      (g = { next: verb(0), throw: verb(1), return: verb(2) }),
+      typeof Symbol === "function" &&
+        (g[Symbol.iterator] = function () {
+          return this;
+        }),
+      g
+    );
+    function verb(n) {
+      return function (v) {
+        return step([n, v]);
+      };
+    }
+    function step(op) {
+      if (f) throw new TypeError("Generator is already executing.");
+      while ((g && ((g = 0), op[0] && (_ = 0)), _))
+        try {
+          if (
+            ((f = 1),
+            y &&
+              (t =
+                op[0] & 2
+                  ? y["return"]
+                  : op[0]
+                  ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
+                  : y.next) &&
+              !(t = t.call(y, op[1])).done)
+          )
+            return t;
+          if (((y = 0), t)) op = [op[0] & 2, t.value];
+          switch (op[0]) {
+            case 0:
+            case 1:
+              t = op;
+              break;
+            case 4:
+              _.label++;
+              return { value: op[1], done: false };
+            case 5:
+              _.label++;
+              y = op[1];
+              op = [0];
+              continue;
+            case 7:
+              op = _.ops.pop();
+              _.trys.pop();
+              continue;
+            default:
+              if (
+                !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
+                (op[0] === 6 || op[0] === 2)
+              ) {
+                _ = 0;
+                continue;
+              }
+              if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
+                _.label = op[1];
+                break;
+              }
+              if (op[0] === 6 && _.label < t[1]) {
+                _.label = t[1];
+                t = op;
+                break;
+              }
+              if (t && _.label < t[2]) {
+                _.label = t[2];
+                _.ops.push(op);
+                break;
+              }
+              if (t[2]) _.ops.pop();
+              _.trys.pop();
+              continue;
+          }
+          op = body.call(thisArg, _);
+        } catch (e) {
+          op = [6, e];
+          y = 0;
+        } finally {
+          f = t = 0;
+        }
+      if (op[0] & 5) throw op[1];
+      return { value: op[0] ? op[1] : void 0, done: true };
+    }
+  };
+var __importDefault =
+  (this && this.__importDefault) ||
+  function (mod) {
+    return mod && mod.__esModule ? mod : { default: mod };
+  };
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ApplySystem =
+  exports.InitializeComponent =
+  exports.AddEntity =
+  exports.InitializeNewWorld =
+    void 0;
+var index_1 = require("../index");
+var bn_js_1 = __importDefault(require("bn.js"));
+var web3_js_1 = require("@solana/web3.js");
+var MAX_COMPONENTS = 5;
+function InitializeNewWorld(_a) {
+  var payer = _a.payer,
+    connection = _a.connection;
+  return __awaiter(this, void 0, void 0, function () {
+    var registryPda, registry, worldId, worldPda, initializeWorldIx;
+    return __generator(this, function (_b) {
+      switch (_b.label) {
+        case 0:
+          registryPda = (0, index_1.FindWorldRegistryPda)();
+          return [
+            4,
+            index_1.Registry.fromAccountAddress(connection, registryPda),
+          ];
+        case 1:
+          registry = _b.sent();
+          worldId = new bn_js_1.default(registry.worlds);
+          worldPda = (0, index_1.FindWorldPda)(new bn_js_1.default(worldId));
+          initializeWorldIx = (0, index_1.createInitializeNewWorldInstruction)({
+            world: worldPda,
+            registry: registryPda,
+            payer: payer,
+          });
+          return [
+            2,
+            {
+              transaction: new web3_js_1.Transaction().add(initializeWorldIx),
+              worldPda: worldPda,
+              worldId: worldId,
+            },
+          ];
+      }
+    });
+  });
+}
+exports.InitializeNewWorld = InitializeNewWorld;
+function AddEntity(_a) {
+  var payer = _a.payer,
+    worldPda = _a.worldPda,
+    connection = _a.connection;
+  return __awaiter(this, void 0, void 0, function () {
+    var world, entityId, entityPda, createEntityIx;
+    return __generator(this, function (_b) {
+      switch (_b.label) {
+        case 0:
+          return [4, index_1.World.fromAccountAddress(connection, worldPda)];
+        case 1:
+          world = _b.sent();
+          entityId = new bn_js_1.default(world.entities);
+          entityPda = (0, index_1.FindEntityPda)(
+            new bn_js_1.default(world.id),
+            entityId
+          );
+          createEntityIx = (0, index_1.createAddEntityInstruction)({
+            world: worldPda,
+            payer: payer,
+            entity: entityPda,
+          });
+          return [
+            2,
+            {
+              transaction: new web3_js_1.Transaction().add(createEntityIx),
+              entityPda: entityPda,
+              entityId: entityId,
+            },
+          ];
+      }
+    });
+  });
+}
+exports.AddEntity = AddEntity;
+function InitializeComponent(_a) {
+  var payer = _a.payer,
+    entityPda = _a.entityPda,
+    componentId = _a.componentId,
+    _b = _a.seed,
+    seed = _b === void 0 ? "" : _b,
+    authority = _a.authority,
+    anchorRemainingAccounts = _a.anchorRemainingAccounts;
+  return __awaiter(this, void 0, void 0, function () {
+    var componentPda, initComponentIx;
+    return __generator(this, function (_c) {
+      componentPda = (0, index_1.FindComponentPda)(
+        componentId,
+        entityPda,
+        seed
+      );
+      initComponentIx = (0, index_1.createInitializeComponentInstruction)({
+        payer: payer,
+        entity: entityPda,
+        data: componentPda,
+        componentProgram: componentId,
+        authority: authority,
+        anchorRemainingAccounts: anchorRemainingAccounts,
+      });
+      return [
+        2,
+        {
+          transaction: new web3_js_1.Transaction().add(initComponentIx),
+          componentPda: componentPda,
+        },
+      ];
+    });
+  });
+}
+exports.InitializeComponent = InitializeComponent;
+function ApplySystem(_a) {
+  var authority = _a.authority,
+    boltSystem = _a.boltSystem,
+    entityPda = _a.entityPda,
+    components = _a.components,
+    _b = _a.args,
+    args = _b === void 0 ? {} : _b,
+    extraAccounts = _a.extraAccounts,
+    seed = _a.seed;
+  return __awaiter(this, void 0, void 0, function () {
+    var instructionFunctions,
+      componentPdas,
+      instructionArgs,
+      functionName,
+      applySystemIx;
+    return __generator(this, function (_c) {
+      instructionFunctions = {
+        createApplyInstruction: index_1.createApplyInstruction,
+        createApply2Instruction: index_1.createApply2Instruction,
+        createApply3Instruction: index_1.createApply3Instruction,
+        createApply4Instruction: index_1.createApply4Instruction,
+        createApply5Instruction: index_1.createApply5Instruction,
+      };
+      if (components.length === 0) throw new Error("No components provided");
+      if (seed == null) seed = new Array(components.length).fill("");
+      if (seed.length !== components.length)
+        throw new Error("Seed length does not match components length");
+      componentPdas = [];
+      components.forEach(function (component) {
+        var componentPda = (0, index_1.FindComponentPda)(
+          component,
+          entityPda,
+          ""
+        );
+        componentPdas.push(componentPda);
+      });
+      if (components.length < 1 || components.length > MAX_COMPONENTS) {
+        throw new Error(
+          "Not implemented for component counts outside 1-".concat(
+            MAX_COMPONENTS
+          )
+        );
+      }
+      instructionArgs = {
+        authority: authority,
+        boltSystem: boltSystem,
+        anchorRemainingAccounts: extraAccounts,
+      };
+      components.forEach(function (component, index) {
+        instructionArgs[getBoltComponentProgramName(index, components.length)] =
+          component;
+        instructionArgs[getBoltComponentName(index, components.length)] =
+          componentPdas[index];
+      });
+      functionName = getApplyInstructionFunctionName(components.length);
+      applySystemIx = instructionFunctions[functionName](instructionArgs, {
+        args: (0, index_1.SerializeArgs)(args),
+      });
+      return [
+        2,
+        {
+          transaction: new web3_js_1.Transaction().add(applySystemIx),
+        },
+      ];
+    });
+  });
+}
+exports.ApplySystem = ApplySystem;
+function getApplyInstructionFunctionName(componentsLength) {
+  if (componentsLength === 1) return "createApplyInstruction";
+  return "createApply".concat(componentsLength, "Instruction");
+}
+function getBoltComponentName(index, componentsLength) {
+  if (componentsLength === 1) return "boltComponent";
+  return "boltComponent".concat(index + 1);
+}
+function getBoltComponentProgramName(index, componentsLength) {
+  if (componentsLength === 1) return "componentProgram";
+  return "componentProgram".concat(index + 1);
+}
+//# sourceMappingURL=transactions.js.map

Fișier diff suprimat deoarece este prea mare
+ 0 - 0
clients/bolt-sdk/lib/transactions/transactions.js.map


+ 17 - 0
clients/bolt-sdk/src/generated/index.ts

@@ -2,6 +2,7 @@ import { PublicKey } from "@solana/web3.js";
 import type BN from "bn.js";
 export * from "./accounts";
 export * from "./instructions";
+export * from "./transactions/transactions";
 
 /**
  * Program address
@@ -68,3 +69,19 @@ export function FindComponentPda(
     componentProgramId
   )[0];
 }
+
+/**
+ * Serialize arguments to a buffer
+ * @param args
+ * @constructor
+ */
+export function SerializeArgs(args: any = {}) {
+  const jsonString = JSON.stringify(args);
+  const encoder = new TextEncoder();
+  const binaryData = encoder.encode(jsonString);
+  return Buffer.from(
+    binaryData.buffer,
+    binaryData.byteOffset,
+    binaryData.byteLength
+  );
+}

+ 162 - 0
clients/bolt-sdk/src/generated/instructions/apply4.ts

@@ -0,0 +1,162 @@
+/**
+ * This code was GENERATED using the solita package.
+ * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
+ *
+ * See: https://github.com/metaplex-foundation/solita
+ */
+
+import * as beet from "@metaplex-foundation/beet";
+import * as web3 from "@solana/web3.js";
+import { SYSVAR_INSTRUCTIONS_PUBKEY } from "../index";
+
+/**
+ * @category Instructions
+ * @category Apply4
+ * @category generated
+ */
+export interface Apply4InstructionArgs {
+  args: Uint8Array;
+}
+/**
+ * @category Instructions
+ * @category Apply4
+ * @category generated
+ */
+export const apply4Struct = new beet.FixableBeetArgsStruct<
+  Apply4InstructionArgs & {
+    instructionDiscriminator: number[] /* size: 8 */;
+  }
+>(
+  [
+    ["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)],
+    ["args", beet.bytes],
+  ],
+  "Apply4InstructionArgs"
+);
+/**
+ * Accounts required by the _apply4_ instruction
+ *
+ * @property [] boltSystem
+ * @property [] componentProgram1
+ * @property [_writable_] boltComponent1
+ * @property [] componentProgram2
+ * @property [_writable_] boltComponent2
+ * @property [] componentProgram3
+ * @property [_writable_] boltComponent3
+ * @property [] componentProgram4
+ * @property [_writable_] boltComponent4
+ * @property [] authority
+ * @property [] instructionSysvarAccount
+ * @category Instructions
+ * @category Apply4
+ * @category generated
+ */
+export interface Apply4InstructionAccounts {
+  boltSystem: web3.PublicKey;
+  componentProgram1: web3.PublicKey;
+  boltComponent1: web3.PublicKey;
+  componentProgram2: web3.PublicKey;
+  boltComponent2: web3.PublicKey;
+  componentProgram3: web3.PublicKey;
+  boltComponent3: web3.PublicKey;
+  componentProgram4: web3.PublicKey;
+  boltComponent4: web3.PublicKey;
+  authority?: web3.PublicKey;
+  instructionSysvarAccount?: web3.PublicKey;
+  anchorRemainingAccounts?: web3.AccountMeta[];
+}
+
+export const apply4InstructionDiscriminator = [
+  223, 104, 24, 79, 252, 196, 14, 109,
+];
+
+/**
+ * Creates a _Apply4_ instruction.
+ *
+ * @param accounts that will be accessed while the instruction is processed
+ * @param args to provide as instruction data to the program
+ *
+ * @category Instructions
+ * @category Apply4
+ * @category generated
+ */
+export function createApply4Instruction(
+  accounts: Apply4InstructionAccounts,
+  args: Apply4InstructionArgs,
+  programId = new web3.PublicKey("WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n")
+) {
+  const [data] = apply4Struct.serialize({
+    instructionDiscriminator: apply4InstructionDiscriminator,
+    ...args,
+  });
+  const keys: web3.AccountMeta[] = [
+    {
+      pubkey: accounts.boltSystem,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram1,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent1,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram2,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent2,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram3,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent3,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram4,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent4,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.authority ?? programId,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.instructionSysvarAccount ?? SYSVAR_INSTRUCTIONS_PUBKEY,
+      isWritable: false,
+      isSigner: false,
+    },
+  ];
+
+  if (accounts.anchorRemainingAccounts != null) {
+    for (const acc of accounts.anchorRemainingAccounts) {
+      keys.push(acc);
+    }
+  }
+
+  const ix = new web3.TransactionInstruction({
+    programId,
+    keys,
+    data,
+  });
+  return ix;
+}

+ 176 - 0
clients/bolt-sdk/src/generated/instructions/apply5.ts

@@ -0,0 +1,176 @@
+/**
+ * This code was GENERATED using the solita package.
+ * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
+ *
+ * See: https://github.com/metaplex-foundation/solita
+ */
+
+import * as beet from "@metaplex-foundation/beet";
+import * as web3 from "@solana/web3.js";
+import { SYSVAR_INSTRUCTIONS_PUBKEY } from "../index";
+
+/**
+ * @category Instructions
+ * @category Apply5
+ * @category generated
+ */
+export interface Apply5InstructionArgs {
+  args: Uint8Array;
+}
+/**
+ * @category Instructions
+ * @category Apply5
+ * @category generated
+ */
+export const apply5Struct = new beet.FixableBeetArgsStruct<
+  Apply5InstructionArgs & {
+    instructionDiscriminator: number[] /* size: 8 */;
+  }
+>(
+  [
+    ["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)],
+    ["args", beet.bytes],
+  ],
+  "Apply5InstructionArgs"
+);
+/**
+ * Accounts required by the _apply5_ instruction
+ *
+ * @property [] boltSystem
+ * @property [] componentProgram1
+ * @property [_writable_] boltComponent1
+ * @property [] componentProgram2
+ * @property [_writable_] boltComponent2
+ * @property [] componentProgram3
+ * @property [_writable_] boltComponent3
+ * @property [] componentProgram4
+ * @property [_writable_] boltComponent4
+ * @property [] componentProgram5
+ * @property [_writable_] boltComponent5
+ * @property [] authority
+ * @property [] instructionSysvarAccount
+ * @category Instructions
+ * @category Apply5
+ * @category generated
+ */
+export interface Apply5InstructionAccounts {
+  boltSystem: web3.PublicKey;
+  componentProgram1: web3.PublicKey;
+  boltComponent1: web3.PublicKey;
+  componentProgram2: web3.PublicKey;
+  boltComponent2: web3.PublicKey;
+  componentProgram3: web3.PublicKey;
+  boltComponent3: web3.PublicKey;
+  componentProgram4: web3.PublicKey;
+  boltComponent4: web3.PublicKey;
+  componentProgram5: web3.PublicKey;
+  boltComponent5: web3.PublicKey;
+  authority?: web3.PublicKey;
+  instructionSysvarAccount?: web3.PublicKey;
+  anchorRemainingAccounts?: web3.AccountMeta[];
+}
+
+export const apply5InstructionDiscriminator = [
+  223, 104, 24, 79, 252, 196, 14, 109,
+];
+
+/**
+ * Creates a _Apply5_ instruction.
+ *
+ * @param accounts that will be accessed while the instruction is processed
+ * @param args to provide as instruction data to the program
+ *
+ * @category Instructions
+ * @category Apply5
+ * @category generated
+ */
+export function createApply5Instruction(
+  accounts: Apply5InstructionAccounts,
+  args: Apply5InstructionArgs,
+  programId = new web3.PublicKey("WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n")
+) {
+  const [data] = apply5Struct.serialize({
+    instructionDiscriminator: apply5InstructionDiscriminator,
+    ...args,
+  });
+  const keys: web3.AccountMeta[] = [
+    {
+      pubkey: accounts.boltSystem,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram1,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent1,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram2,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent2,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram3,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent3,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram4,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent4,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.componentProgram5,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.boltComponent5,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.authority ?? programId,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: accounts.instructionSysvarAccount ?? SYSVAR_INSTRUCTIONS_PUBKEY,
+      isWritable: false,
+      isSigner: false,
+    },
+  ];
+
+  if (accounts.anchorRemainingAccounts != null) {
+    for (const acc of accounts.anchorRemainingAccounts) {
+      keys.push(acc);
+    }
+  }
+
+  const ix = new web3.TransactionInstruction({
+    programId,
+    keys,
+    data,
+  });
+  return ix;
+}

+ 2 - 0
clients/bolt-sdk/src/generated/instructions/index.ts

@@ -2,6 +2,8 @@ export * from "./addEntity";
 export * from "./apply";
 export * from "./apply2";
 export * from "./apply3";
+export * from "./apply4";
+export * from "./apply5";
 export * from "./initializeComponent";
 export * from "./initializeNewWorld";
 export * from "./initializeRegistry";

+ 213 - 0
clients/bolt-sdk/src/generated/transactions/transactions.ts

@@ -0,0 +1,213 @@
+import {
+  createAddEntityInstruction,
+  createInitializeComponentInstruction,
+  createInitializeNewWorldInstruction,
+  FindComponentPda,
+  FindEntityPda,
+  FindWorldPda,
+  FindWorldRegistryPda,
+  Registry,
+  SerializeArgs,
+  World,
+  createApplyInstruction,
+  createApply2Instruction,
+  createApply3Instruction,
+  createApply4Instruction,
+  createApply5Instruction,
+} from "../index";
+import BN from "bn.js";
+import { type PublicKey, Transaction, type Connection } from "@solana/web3.js";
+import type web3 from "@solana/web3.js";
+
+const MAX_COMPONENTS = 5;
+
+/**
+ * Create the transaction to Initialize a new world
+ * @param payer
+ * @param connection
+ * @constructor
+ */
+export async function InitializeNewWorld({
+  payer,
+  connection,
+}: {
+  payer: PublicKey;
+  connection: Connection;
+}): Promise<{ transaction: Transaction; worldPda: PublicKey; worldId: BN }> {
+  const registryPda = FindWorldRegistryPda();
+  const registry = await Registry.fromAccountAddress(connection, registryPda);
+  const worldId = new BN(registry.worlds);
+  const worldPda = FindWorldPda(new BN(worldId));
+  const initializeWorldIx = createInitializeNewWorldInstruction({
+    world: worldPda,
+    registry: registryPda,
+    payer,
+  });
+  return {
+    transaction: new Transaction().add(initializeWorldIx),
+    worldPda,
+    worldId,
+  };
+}
+
+/**
+ * Create the transaction to Add a new entity
+ * @param payer
+ * @param worldPda
+ * @param connection
+ * @constructor
+ */
+export async function AddEntity({
+  payer,
+  worldPda,
+  connection,
+}: {
+  payer: PublicKey;
+  worldPda: PublicKey;
+  connection: Connection;
+}): Promise<{ transaction: Transaction; entityPda: PublicKey; entityId: BN }> {
+  const world = await World.fromAccountAddress(connection, worldPda);
+  const entityId = new BN(world.entities);
+  const entityPda = FindEntityPda(new BN(world.id), entityId);
+
+  const createEntityIx = createAddEntityInstruction({
+    world: worldPda,
+    payer,
+    entity: entityPda,
+  });
+  return {
+    transaction: new Transaction().add(createEntityIx),
+    entityPda,
+    entityId,
+  };
+}
+
+/**
+ * Create the transaction to Initialize a new component
+ * @param payer
+ * @param entityPda
+ * @param componentId
+ * @param seed
+ * @param authority
+ * @param anchorRemainingAccounts
+ * @constructor
+ */
+export async function InitializeComponent({
+  payer,
+  entityPda,
+  componentId,
+  seed = "",
+  authority,
+  anchorRemainingAccounts,
+}: {
+  payer: PublicKey;
+  entityPda: PublicKey;
+  componentId: PublicKey;
+  seed?: string;
+  authority?: web3.PublicKey;
+  anchorRemainingAccounts?: web3.AccountMeta[];
+}): Promise<{ transaction: Transaction; componentPda: PublicKey }> {
+  const componentPda = FindComponentPda(componentId, entityPda, seed);
+  const initComponentIx = createInitializeComponentInstruction({
+    payer,
+    entity: entityPda,
+    data: componentPda,
+    componentProgram: componentId,
+    authority,
+    anchorRemainingAccounts,
+  });
+
+  return {
+    transaction: new Transaction().add(initComponentIx),
+    componentPda,
+  };
+}
+
+/**
+ * Apply a system to an entity and its components
+ * @param authority
+ * @param boltSystem
+ * @param entityPda
+ * @param components
+ * @param args
+ * @param extraAccounts
+ * @param seed
+ * @constructor
+ */
+export async function ApplySystem({
+  authority,
+  boltSystem,
+  entityPda,
+  components,
+  args = {},
+  extraAccounts,
+  seed,
+}: {
+  authority: PublicKey;
+  boltSystem: PublicKey;
+  entityPda: PublicKey;
+  components: PublicKey[];
+  args?: object;
+  extraAccounts?: web3.AccountMeta[];
+  seed?: string[];
+}): Promise<{ transaction: Transaction }> {
+  const instructionFunctions = {
+    createApplyInstruction,
+    createApply2Instruction,
+    createApply3Instruction,
+    createApply4Instruction,
+    createApply5Instruction,
+  };
+  if (components.length === 0) throw new Error("No components provided");
+  if (seed == null) seed = new Array(components.length).fill("");
+  if (seed.length !== components.length)
+    throw new Error("Seed length does not match components length");
+  const componentPdas: PublicKey[] = [];
+  components.forEach((component) => {
+    const componentPda = FindComponentPda(component, entityPda, "");
+    componentPdas.push(componentPda);
+  });
+
+  if (components.length < 1 || components.length > MAX_COMPONENTS) {
+    throw new Error(
+      `Not implemented for component counts outside 1-${MAX_COMPONENTS}`
+    );
+  }
+
+  const instructionArgs = {
+    authority,
+    boltSystem,
+    anchorRemainingAccounts: extraAccounts,
+  };
+
+  components.forEach((component, index) => {
+    instructionArgs[getBoltComponentProgramName(index, components.length)] =
+      component;
+    instructionArgs[getBoltComponentName(index, components.length)] =
+      componentPdas[index];
+  });
+
+  const functionName = getApplyInstructionFunctionName(components.length);
+  const applySystemIx = instructionFunctions[functionName](instructionArgs, {
+    args: SerializeArgs(args),
+  });
+
+  return {
+    transaction: new Transaction().add(applySystemIx),
+  };
+}
+
+function getApplyInstructionFunctionName(componentsLength: number) {
+  if (componentsLength === 1) return "createApplyInstruction";
+  return `createApply${componentsLength}Instruction`;
+}
+
+function getBoltComponentName(index: number, componentsLength: number) {
+  if (componentsLength === 1) return "boltComponent";
+  return `boltComponent${index + 1}`;
+}
+
+function getBoltComponentProgramName(index: number, componentsLength: number) {
+  if (componentsLength === 1) return "componentProgram";
+  return `componentProgram${index + 1}`;
+}

+ 1 - 1
programs/bolt-system/src/lib.rs

@@ -4,7 +4,7 @@ use bolt_helpers_system_template::system_template;
 
 declare_id!("7X4EFsDJ5aYTcEjKzJ94rD8FRKgQeXC89fkpeTS4KaqP");
 
-#[system_template(max_components = 3)]
+#[system_template(max_components = 5)]
 #[program]
 pub mod bolt_system {
     use super::*;

+ 1 - 1
programs/world/src/lib.rs

@@ -19,7 +19,7 @@ security_txt! {
 
 mod error;
 
-#[apply_system(max_components = 3)]
+#[apply_system(max_components = 5)]
 #[program]
 pub mod world {
     use super::*;

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff