Browse Source

Merge branch 'main' into vbrunet/2024_06_17-dev-process-nits

crypto-vincent 1 year ago
parent
commit
51bf3cafa5

+ 7 - 1
.github/workflows/publish-bolt-crates.yml

@@ -8,7 +8,7 @@ on:
   workflow_dispatch:
   workflow_dispatch:
 
 
 env:
 env:
-  solana_version: v1.18.8
+  solana_version: v1.18.15
 
 
 jobs:
 jobs:
   install:
   install:
@@ -166,6 +166,12 @@ jobs:
           cargo install --path cli --force --locked
           cargo install --path cli --force --locked
           bolt build
           bolt build
 
 
+      - name: Generate lib
+        run: |
+          cd clients/bolt-sdk
+          yarn install && yarn build
+          cd ../..
+
       - name: run tests
       - name: run tests
         run: |
         run: |
           export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
           export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"

+ 7 - 1
.github/workflows/publish-bolt-sdk.yml

@@ -8,7 +8,7 @@ on:
   workflow_dispatch:
   workflow_dispatch:
 
 
 env:
 env:
-  solana_version: v1.18.8
+  solana_version: v1.18.15
 
 
 jobs:
 jobs:
   install:
   install:
@@ -166,6 +166,12 @@ jobs:
           cargo install --path cli --force --locked
           cargo install --path cli --force --locked
           bolt build
           bolt build
 
 
+      - name: Generate lib
+        run: |
+          cd clients/bolt-sdk
+          yarn install && yarn build
+          cd ../..
+
       - name: run tests
       - name: run tests
         run: |
         run: |
           export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
           export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"

+ 2 - 2
.github/workflows/run-tests.yml

@@ -6,7 +6,7 @@ on:
   pull_request:
   pull_request:
 
 
 env:
 env:
-  solana_version: v1.18.9
+  solana_version: v1.18.15
 
 
 jobs:
 jobs:
   install:
   install:
@@ -157,7 +157,7 @@ jobs:
       - name: Generate lib
       - name: Generate lib
         run: |
         run: |
           cd clients/bolt-sdk
           cd clients/bolt-sdk
-          yarn build
+          yarn install && yarn build
           cd ../..
           cd ../..
 
 
       - name: run tests
       - name: run tests

+ 11 - 0
CHANGELOG.md

@@ -1,4 +1,15 @@
 
 
+## [0.1.8] - 2024-06-27
+ - Add allow undelegation ix (#68)
+
+## [0.1.7] - 2024-06-21
+
+### ✨️ Features
+ - Add manual commit to the typescript sdk (#59)
+ - Upgrade to Anchor 0.30.1 (#62)
+
+### 👷 CI/CD
+
 ## [0.1.5] - 2024-04-23
 ## [0.1.5] - 2024-04-23
 
 
 ### 📚 Documentation
 ### 📚 Documentation

File diff suppressed because it is too large
+ 171 - 147
Cargo.lock


+ 23 - 23
Cargo.toml

@@ -7,7 +7,7 @@ members = [
 ]
 ]
 
 
 [workspace.package]
 [workspace.package]
-version = "0.1.6"
+version = "0.1.8"
 authors = ["Magicblock Labs <dev@magicblock.gg>"]
 authors = ["Magicblock Labs <dev@magicblock.gg>"]
 repository = "https://github.com/magicblock-labs/bolt"
 repository = "https://github.com/magicblock-labs/bolt"
 homepage = "https://www.magicblock.gg/"
 homepage = "https://www.magicblock.gg/"
@@ -15,31 +15,31 @@ license = "MIT"
 edition = "2021"
 edition = "2021"
 
 
 [workspace.dependencies]
 [workspace.dependencies]
-bolt-attribute-bolt-program = { path = "crates/bolt-lang/attribute/bolt-program", version = "=0.1.6" }
-bolt-attribute-bolt-delegate = { path = "crates/bolt-lang/attribute/delegate", version = "=0.1.6" }
-bolt-attribute-bolt-component = { path = "crates/bolt-lang/attribute/component", version = "=0.1.6" }
-bolt-attribute-bolt-system = { path = "crates/bolt-lang/attribute/system", version = "=0.1.6"}
-bolt-attribute-bolt-system-input = { path = "crates/bolt-lang/attribute/system-input", version = "=0.1.6" }
-bolt-attribute-bolt-extra-accounts = { path = "crates/bolt-lang/attribute/extra-accounts", version = "=0.1.6" }
-bolt-attribute-bolt-arguments = { path = "crates/bolt-lang/attribute/arguments", version = "=0.1.6" }
-bolt-attribute-bolt-component-deserialize = { path = "crates/bolt-lang/attribute/component-deserialize", version = "=0.1.6" }
-bolt-attribute-bolt-component-id = { path = "crates/bolt-lang/attribute/component-id", version = "=0.1.6" }
-bolt-helpers-system-template = { path = "crates/bolt-helpers/attribute/system-template", version = "=0.1.6" }
-bolt-helpers-world-apply = { path = "crates/bolt-helpers/attribute/world-apply", version = "=0.1.6" }
-bolt-utils = { path = "crates/bolt-lang/utils", version = "=0.1.6" }
-world = { path = "programs/world", features = ["cpi"], version = "=0.1.6"}
-bolt-system = { path = "programs/bolt-system", features = ["cpi"], version = "=0.1.6"}
-bolt-component = { path = "programs/bolt-component", features = ["cpi"], version = "=0.1.6"}
+bolt-attribute-bolt-program = { path = "crates/bolt-lang/attribute/bolt-program", version = "=0.1.8" }
+bolt-attribute-bolt-delegate = { path = "crates/bolt-lang/attribute/delegate", version = "=0.1.8" }
+bolt-attribute-bolt-component = { path = "crates/bolt-lang/attribute/component", version = "=0.1.8" }
+bolt-attribute-bolt-system = { path = "crates/bolt-lang/attribute/system", version = "=0.1.8"}
+bolt-attribute-bolt-system-input = { path = "crates/bolt-lang/attribute/system-input", version = "=0.1.8" }
+bolt-attribute-bolt-extra-accounts = { path = "crates/bolt-lang/attribute/extra-accounts", version = "=0.1.8" }
+bolt-attribute-bolt-arguments = { path = "crates/bolt-lang/attribute/arguments", version = "=0.1.8" }
+bolt-attribute-bolt-component-deserialize = { path = "crates/bolt-lang/attribute/component-deserialize", version = "=0.1.8" }
+bolt-attribute-bolt-component-id = { path = "crates/bolt-lang/attribute/component-id", version = "=0.1.8" }
+bolt-helpers-system-template = { path = "crates/bolt-helpers/attribute/system-template", version = "=0.1.8" }
+bolt-helpers-world-apply = { path = "crates/bolt-helpers/attribute/world-apply", version = "=0.1.8" }
+bolt-utils = { path = "crates/bolt-lang/utils", version = "=0.1.8" }
+world = { path = "programs/world", features = ["cpi"], version = "=0.1.8"}
+bolt-system = { path = "programs/bolt-system", features = ["cpi"], version = "=0.1.8"}
+bolt-component = { path = "programs/bolt-component", features = ["cpi"], version = "=0.1.8"}
 
 
 ## External crates
 ## External crates
-anchor-lang = { version = "=0.30.0", features = ["init-if-needed"] }
-anchor-cli = { version = "=0.30.0" }
-anchor-client = { version = "=0.30.0" }
-anchor-syn = { version = "=0.30.0" }
-anchor-lang-idl = { version = "=0.1.0" }
+anchor-lang = { version = "=0.30.1", features = ["init-if-needed"] }
+anchor-cli = { version = "=0.30.1" }
+anchor-client = { version = "=0.30.1" }
+anchor-syn = { version = "=0.30.1" }
+anchor-spl = { version = "=0.30.1" }
+anchor-lang-idl = { version = "=0.1.1" }
 solana-program = { version = "=1.18" }
 solana-program = { version = "=1.18" }
 solana-client = { version = "=1.16" }
 solana-client = { version = "=1.16" }
-anchor-spl = { version = "=0.30.0" }
 solana-security-txt = "1.1.1"
 solana-security-txt = "1.1.1"
 tuple-conv = "1.0.1"
 tuple-conv = "1.0.1"
 syn = { version = "1.0.60", features = ["full"] }
 syn = { version = "1.0.60", features = ["full"] }
@@ -51,7 +51,7 @@ anyhow = "1.0.32"
 heck = "0.5.0"
 heck = "0.5.0"
 clap = { version = "4.2.4", features = ["derive"] }
 clap = { version = "4.2.4", features = ["derive"] }
 ahash = "=0.8.11"
 ahash = "=0.8.11"
-delegation-program-sdk = "=0.0.2"
+delegation-program-sdk = "=0.1.3"
 
 
 [profile.release]
 [profile.release]
 overflow-checks = true
 overflow-checks = true

+ 3 - 8
README.md

@@ -20,9 +20,7 @@
 
 
 Bolt is a high-performance, scalable SVM-based framework designed for Fully On Chain (FOC) Games and Autonomous Worlds.
 Bolt is a high-performance, scalable SVM-based framework designed for Fully On Chain (FOC) Games and Autonomous Worlds.
 
 
-With Bolt, you can create games that live forever on the blockchain. These games are platform-centric by default, empowering users to extend and modify both game content and logic. Bolt facilitates multiplayer gaming experiences with performances on pair with traditional multiplayer servers.
-
-Furthermore, the framework incorporates an Entity Component System (ECS) architecture, streamlining the game structuring and assembly process and providing ready-to-use components. Developers can reuse and contribute modules and logic deployed on the blockchain.
+With Bolt, you can create games that live forever on the blockchain. These games are platform-centric by default, empowering users to extend and modify both game content and logic. The framework incorporates an Entity Component System (ECS) architecture, streamlining the game structuring and assembly process and providing ready-to-use components. Developers can reuse and contribute modules and logic deployed on the blockchain.
 
 
 ## Packages
 ## Packages
 
 
@@ -53,13 +51,10 @@ cd new-project
 bolt test
 bolt test
 ```
 ```
 
 
-## 📘 Bolt book
-
-Read the Bolt book: [book.boltengine.gg](https://book.boltengine.gg/)
+## 📘 Bolt docs
 
 
-## 📜 Bolt Whitepaper
+Read the Bolt [docs](https://docs.magicblock.gg/BOLT/Introduction/introduction)
 
 
-Read the Bolt whitepaper for a detailed overview on the architecture and the scalability solution: [Ephemeral Rollups are All you Need](https://arxiv.org/abs/2311.02650)
 
 
 ## 🚧 Under construction
 ## 🚧 Under construction
 
 

+ 8 - 8
cli/npm-package/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "@magicblock-labs/bolt-cli",
   "name": "@magicblock-labs/bolt-cli",
-  "version": "0.1.6",
+  "version": "0.1.8",
   "description": "Bolt CLI tool",
   "description": "Bolt CLI tool",
   "homepage": "https://github.com/magicblock-labs/bolt#readme",
   "homepage": "https://github.com/magicblock-labs/bolt#readme",
   "bugs": {
   "bugs": {
@@ -29,13 +29,13 @@
     "typescript": "^4.9.4"
     "typescript": "^4.9.4"
   },
   },
   "optionalDependencies": {
   "optionalDependencies": {
-    "@magicblock-labs/bolt-cli-darwin-x64": "0.1.6",
-    "@magicblock-labs/bolt-cli-darwin-arm64": "0.1.6",
-    "@magicblock-labs/bolt-cli-linux-x86": "0.1.6",
-    "@magicblock-labs/bolt-cli-linux-x64": "0.1.6",
-    "@magicblock-labs/bolt-cli-linux-arm64": "0.1.6",
-    "@magicblock-labs/bolt-cli-windows-x86": "0.1.6",
-    "@magicblock-labs/bolt-cli-windows-x64": "0.1.6"
+    "@magicblock-labs/bolt-cli-darwin-x64": "0.1.8",
+    "@magicblock-labs/bolt-cli-darwin-arm64": "0.1.8",
+    "@magicblock-labs/bolt-cli-linux-x86": "0.1.8",
+    "@magicblock-labs/bolt-cli-linux-x64": "0.1.8",
+    "@magicblock-labs/bolt-cli-linux-arm64": "0.1.8",
+    "@magicblock-labs/bolt-cli-windows-x86": "0.1.8",
+    "@magicblock-labs/bolt-cli-windows-x64": "0.1.8"
   },
   },
   "publishConfig": {
   "publishConfig": {
     "access": "public"
     "access": "public"

+ 1 - 1
cli/npm-package/package.json.tmpl

@@ -1,7 +1,7 @@
 {
 {
   "name": "@magicblock-labs/${node_pkg}",
   "name": "@magicblock-labs/${node_pkg}",
   "description": "Bolt CLI tool (${node_pkg})",
   "description": "Bolt CLI tool (${node_pkg})",
-  "version": "0.1.6",
+  "version": "0.1.8",
   "repository": {
   "repository": {
     "type": "git",
     "type": "git",
     "url": "git+https://github.com/magicblock-labs/bolt.git"
     "url": "git+https://github.com/magicblock-labs/bolt.git"

+ 9 - 4
cli/src/lib.rs

@@ -69,6 +69,7 @@ pub fn entry(opts: Opts) -> Result<()> {
                 name,
                 name,
                 javascript,
                 javascript,
                 solidity,
                 solidity,
+                no_install,
                 no_git,
                 no_git,
                 template,
                 template,
                 test_template,
                 test_template,
@@ -78,6 +79,7 @@ pub fn entry(opts: Opts) -> Result<()> {
                 name,
                 name,
                 javascript,
                 javascript,
                 solidity,
                 solidity,
+                no_install,
                 no_git,
                 no_git,
                 template,
                 template,
                 test_template,
                 test_template,
@@ -137,6 +139,7 @@ fn init(
     name: String,
     name: String,
     javascript: bool,
     javascript: bool,
     solidity: bool,
     solidity: bool,
+    no_install: bool,
     no_git: bool,
     no_git: bool,
     template: anchor_cli::rust_template::ProgramTemplate,
     template: anchor_cli::rust_template::ProgramTemplate,
     test_template: anchor_cli::rust_template::TestTemplate,
     test_template: anchor_cli::rust_template::TestTemplate,
@@ -385,10 +388,12 @@ fn init(
         }
         }
     }
     }
 
 
-    let yarn_result = install_node_modules("yarn")?;
-    if !yarn_result.status.success() {
-        println!("Failed yarn install will attempt to npm install");
-        install_node_modules("npm")?;
+    if !no_install {
+        let yarn_result = install_node_modules("yarn")?;
+        if !yarn_result.status.success() {
+            println!("Failed yarn install will attempt to npm install");
+            install_node_modules("npm")?;
+        }
     }
     }
 
 
     if !no_git {
     if !no_git {

+ 3 - 2
clients/bolt-sdk/package.json

@@ -1,13 +1,14 @@
 {
 {
   "name": "@magicblock-labs/bolt-sdk",
   "name": "@magicblock-labs/bolt-sdk",
-  "version": "0.1.6",
+  "version": "0.1.8",
   "description": "Bolt typescript SDK",
   "description": "Bolt typescript SDK",
   "author": "dev@magicblock.gg",
   "author": "dev@magicblock.gg",
   "license": "MIT",
   "license": "MIT",
   "private": false,
   "private": false,
   "dependencies": {
   "dependencies": {
     "@metaplex-foundation/beet": "^0.7.1",
     "@metaplex-foundation/beet": "^0.7.1",
-    "@metaplex-foundation/beet-solana": "^0.4.0"
+    "@metaplex-foundation/beet-solana": "^0.4.0",
+    "@magicblock-labs/delegation-program": "0.1.3"
   },
   },
   "devDependencies": {
   "devDependencies": {
     "@metaplex-foundation/solita": "^0.20.1",
     "@metaplex-foundation/solita": "^0.20.1",

+ 0 - 51
clients/bolt-sdk/src/delegation/accounts.ts

@@ -1,51 +0,0 @@
-import { PublicKey } from "@solana/web3.js";
-
-const SEED_BUFFER_PDA = "buffer";
-const SEED_DELEGATION_PDA = "delegation";
-const DELEGATED_ACCOUNT_SEEDS = "account-seeds";
-const SEED_COMMIT_STATE_RECORD_PDA = "commit-state-record";
-const SEED_STATE_DIFF_PDA = "state-diff";
-export const DELEGATION_PROGRAM_ID =
-  "DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh";
-
-export function getDelegationAccounts(
-  accountToDelegate: PublicKey,
-  ownerProgram: PublicKey,
-  ownedBuffer: boolean = true
-) {
-  const pdaBytes = accountToDelegate.toBytes();
-
-  const [delegationPda] = PublicKey.findProgramAddressSync(
-    [Buffer.from(SEED_DELEGATION_PDA), pdaBytes],
-    new PublicKey(DELEGATION_PROGRAM_ID)
-  );
-
-  const [delegatedAccountSeedsPda] = PublicKey.findProgramAddressSync(
-    [Buffer.from(DELEGATED_ACCOUNT_SEEDS), pdaBytes],
-    new PublicKey(DELEGATION_PROGRAM_ID)
-  );
-
-  const [bufferPda] = PublicKey.findProgramAddressSync(
-    [Buffer.from(SEED_BUFFER_PDA), pdaBytes],
-    ownedBuffer
-      ? new PublicKey(ownerProgram)
-      : new PublicKey(DELEGATION_PROGRAM_ID)
-  );
-
-  const [commitStateRecordPda] = PublicKey.findProgramAddressSync(
-    [Buffer.from(SEED_COMMIT_STATE_RECORD_PDA), pdaBytes],
-    new PublicKey(DELEGATION_PROGRAM_ID)
-  );
-
-  const [commitStatePda] = PublicKey.findProgramAddressSync(
-    [Buffer.from(SEED_STATE_DIFF_PDA), pdaBytes],
-    new PublicKey(DELEGATION_PROGRAM_ID)
-  );
-  return {
-    delegationPda,
-    delegatedAccountSeedsPda,
-    bufferPda,
-    commitStateRecordPda,
-    commitStatePda,
-  };
-}

+ 75 - 0
clients/bolt-sdk/src/delegation/allow_undelegation.ts

@@ -0,0 +1,75 @@
+import * as beet from "@metaplex-foundation/beet";
+import * as web3 from "@solana/web3.js";
+import {
+  DelegateAccounts,
+  DELEGATION_PROGRAM_ID,
+} from "@magicblock-labs/delegation-program";
+
+export const allowUndelegationStruct = new beet.BeetArgsStruct<{
+  instructionDiscriminator: number[] /* size: 8 */;
+}>(
+  [["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)]],
+  "allowUndelegationInstructionArgs"
+);
+
+export interface AllowUndelegationInstructionAccounts {
+  delegatedAccount: web3.PublicKey;
+  ownerProgram: web3.PublicKey;
+  buffer?: web3.PublicKey;
+}
+
+export const allowUndelegateInstructionDiscriminator = [
+  255, 66, 82, 208, 247, 5, 210, 126,
+];
+
+/**
+ * Creates a Delegate instruction.
+ */
+
+export function createAllowUndelegationInstruction(
+  accounts: AllowUndelegationInstructionAccounts
+) {
+  const [data] = allowUndelegationStruct.serialize({
+    instructionDiscriminator: allowUndelegateInstructionDiscriminator,
+  });
+
+  const { delegationPda, delegationMetadata, bufferPda } = DelegateAccounts(
+    accounts.delegatedAccount,
+    accounts.ownerProgram
+  );
+
+  const keys: web3.AccountMeta[] = [
+    {
+      pubkey: accounts.delegatedAccount,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: delegationPda,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: delegationMetadata,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: bufferPda,
+      isWritable: false,
+      isSigner: false,
+    },
+    {
+      pubkey: new web3.PublicKey(DELEGATION_PROGRAM_ID),
+      isWritable: true,
+      isSigner: false,
+    },
+  ];
+
+  const programId = accounts.ownerProgram;
+  return new web3.TransactionInstruction({
+    programId,
+    keys,
+    data,
+  });
+}

+ 10 - 5
clients/bolt-sdk/src/delegation/delegate.ts

@@ -1,6 +1,9 @@
 import * as beet from "@metaplex-foundation/beet";
 import * as beet from "@metaplex-foundation/beet";
 import * as web3 from "@solana/web3.js";
 import * as web3 from "@solana/web3.js";
-import { DELEGATION_PROGRAM_ID, getDelegationAccounts } from "./accounts";
+import {
+  DelegateAccounts,
+  DELEGATION_PROGRAM_ID,
+} from "@magicblock-labs/delegation-program";
 
 
 export interface DelegateInstructionArgs {
 export interface DelegateInstructionArgs {
   validUntil: beet.bignum;
   validUntil: beet.bignum;
@@ -32,7 +35,7 @@ export interface DelegateInstructionAccounts {
   ownerProgram: web3.PublicKey;
   ownerProgram: web3.PublicKey;
   buffer?: web3.PublicKey;
   buffer?: web3.PublicKey;
   delegationRecord?: web3.PublicKey;
   delegationRecord?: web3.PublicKey;
-  delegateAccountSeeds?: web3.PublicKey;
+  delegationMetadata?: web3.PublicKey;
   delegationProgram?: web3.PublicKey;
   delegationProgram?: web3.PublicKey;
   systemProgram?: web3.PublicKey;
   systemProgram?: web3.PublicKey;
 }
 }
@@ -57,8 +60,10 @@ export function createDelegateInstruction(
     commitFrequencyMs,
     commitFrequencyMs,
   });
   });
 
 
-  const { delegationPda, delegatedAccountSeedsPda, bufferPda } =
-    getDelegationAccounts(accounts.account, accounts.ownerProgram);
+  const { delegationPda, delegationMetadata, bufferPda } = DelegateAccounts(
+    accounts.account,
+    accounts.ownerProgram
+  );
 
 
   const keys: web3.AccountMeta[] = [
   const keys: web3.AccountMeta[] = [
     {
     {
@@ -92,7 +97,7 @@ export function createDelegateInstruction(
       isSigner: false,
       isSigner: false,
     },
     },
     {
     {
-      pubkey: accounts.delegateAccountSeeds ?? delegatedAccountSeedsPda,
+      pubkey: accounts.delegationMetadata ?? delegationMetadata,
       isWritable: true,
       isWritable: true,
       isSigner: false,
       isSigner: false,
     },
     },

+ 0 - 115
clients/bolt-sdk/src/delegation/undelegate.ts

@@ -1,115 +0,0 @@
-import * as beet from "@metaplex-foundation/beet";
-import * as web3 from "@solana/web3.js";
-import { DELEGATION_PROGRAM_ID, getDelegationAccounts } from "./accounts";
-import { PublicKey } from "@solana/web3.js";
-
-export const undelegateStruct = new beet.FixableBeetArgsStruct<{
-  instructionDiscriminator: number[];
-}>(
-  [["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)]],
-  "UndelegateInstructionArgs"
-);
-
-/**
- * Accounts required by the _undelegate_ instruction
- */
-
-export interface UndelegateInstructionAccounts {
-  payer: web3.PublicKey;
-  delegatedAccount: web3.PublicKey;
-  ownerProgram: web3.PublicKey;
-  buffer?: web3.PublicKey;
-  commitStatePda?: web3.PublicKey;
-  commitStateRecordPda?: web3.PublicKey;
-  delegationRecord?: web3.PublicKey;
-  delegateAccountSeeds?: web3.PublicKey;
-  reimbursement: web3.PublicKey;
-  systemProgram?: web3.PublicKey;
-}
-
-export const undelegateInstructionDiscriminator = [3, 0, 0, 0, 0, 0, 0, 0];
-
-/**
- * Creates an _undelegate_ instruction.
- *
- */
-
-export function createUndelegateInstruction(
-  accounts: UndelegateInstructionAccounts,
-  programId = new PublicKey(DELEGATION_PROGRAM_ID)
-) {
-  const [data] = undelegateStruct.serialize({
-    instructionDiscriminator: undelegateInstructionDiscriminator,
-  });
-
-  const {
-    delegationPda,
-    delegatedAccountSeedsPda,
-    bufferPda,
-    commitStateRecordPda,
-    commitStatePda,
-  } = getDelegationAccounts(
-    accounts.delegatedAccount,
-    accounts.ownerProgram,
-    false
-  );
-
-  const keys: web3.AccountMeta[] = [
-    {
-      pubkey: accounts.payer,
-      isWritable: false,
-      isSigner: true,
-    },
-    {
-      pubkey: accounts.delegatedAccount,
-      isWritable: true,
-      isSigner: false,
-    },
-    {
-      pubkey: accounts.ownerProgram,
-      isWritable: false,
-      isSigner: false,
-    },
-    {
-      pubkey: accounts.buffer ?? bufferPda,
-      isWritable: true,
-      isSigner: false,
-    },
-    {
-      pubkey: accounts.commitStatePda ?? commitStatePda,
-      isWritable: true,
-      isSigner: false,
-    },
-    {
-      pubkey: accounts.commitStateRecordPda ?? commitStateRecordPda,
-      isWritable: true,
-      isSigner: false,
-    },
-    {
-      pubkey: accounts.delegationRecord ?? delegationPda,
-      isWritable: true,
-      isSigner: false,
-    },
-    {
-      pubkey: accounts.delegateAccountSeeds ?? delegatedAccountSeedsPda,
-      isWritable: true,
-      isSigner: false,
-    },
-    {
-      pubkey: accounts.reimbursement,
-      isWritable: false,
-      isSigner: false,
-    },
-    {
-      pubkey: accounts.systemProgram ?? web3.SystemProgram.programId,
-      isWritable: false,
-      isSigner: false,
-    },
-  ];
-
-  return new web3.TransactionInstruction({
-    programId,
-    keys,
-    data,
-  });
-}

+ 6 - 2
clients/bolt-sdk/src/index.ts

@@ -4,9 +4,13 @@ import { PROGRAM_ID } from "./generated";
 export * from "./generated/accounts";
 export * from "./generated/accounts";
 export * from "./generated/instructions";
 export * from "./generated/instructions";
 export * from "./world/transactions";
 export * from "./world/transactions";
-export * from "./delegation/accounts";
 export * from "./delegation/delegate";
 export * from "./delegation/delegate";
-export * from "./delegation/undelegate";
+export * from "./delegation/allow_undelegation";
+export {
+  createCommitInstruction,
+  createUndelegateInstruction,
+  DELEGATION_PROGRAM_ID,
+} from "@magicblock-labs/delegation-program";
 
 
 export const SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey(
 export const SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey(
   "Sysvar1nstructions1111111111111111111111111"
   "Sysvar1nstructions1111111111111111111111111"

+ 279 - 11
clients/bolt-sdk/yarn.lock

@@ -14,6 +14,13 @@
   dependencies:
   dependencies:
     regenerator-runtime "^0.14.0"
     regenerator-runtime "^0.14.0"
 
 
+"@babel/runtime@^7.24.7":
+  version "7.24.7"
+  resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.24.7.tgz#f4f0d5530e8dbdf59b3451b9b3e594b6ba082e12"
+  integrity sha512-UwgBRMjJP+xv857DCngvqXI3Iq6J4v0wXmwc6sapg+zyhbwmQX67LUEFrkK5tbyJ30jGuG3ZvWpBiB9LCy1kWw==
+  dependencies:
+    regenerator-runtime "^0.14.0"
+
 "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
 "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
   version "4.4.0"
   version "4.4.0"
   resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz"
   resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz"
@@ -77,6 +84,14 @@
     wrap-ansi "^8.1.0"
     wrap-ansi "^8.1.0"
     wrap-ansi-cjs "npm:wrap-ansi@^7.0.0"
     wrap-ansi-cjs "npm:wrap-ansi@^7.0.0"
 
 
+"@magicblock-labs/delegation-program@0.1.2":
+  version "0.1.2"
+  resolved "https://registry.yarnpkg.com/@magicblock-labs/delegation-program/-/delegation-program-0.1.2.tgz#7b298398259d80a368eb9e91cb911e5a6e542391"
+  integrity sha512-9EGtcBWGAXGCOjTJVyzxydMpM8GGk8QjzQlgpV0q96BAbmpEO9C6b/N3lvMRTR1FfDuBn43a3Pa5YEiHyUu8Eg==
+  dependencies:
+    "@metaplex-foundation/beet" "^0.7.2"
+    "@solana/web3.js" "^1.92.3"
+
 "@metaplex-foundation/beet-solana@^0.3.1":
 "@metaplex-foundation/beet-solana@^0.3.1":
   version "0.3.1"
   version "0.3.1"
   resolved "https://registry.npmjs.org/@metaplex-foundation/beet-solana/-/beet-solana-0.3.1.tgz"
   resolved "https://registry.npmjs.org/@metaplex-foundation/beet-solana/-/beet-solana-0.3.1.tgz"
@@ -106,6 +121,16 @@
     bn.js "^5.2.0"
     bn.js "^5.2.0"
     debug "^4.3.3"
     debug "^4.3.3"
 
 
+"@metaplex-foundation/beet@^0.7.2":
+  version "0.7.2"
+  resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet/-/beet-0.7.2.tgz#fa4726e4cfd4fb6fed6cddc9b5213c1c2a2d0b77"
+  integrity sha512-K+g3WhyFxKPc0xIvcIjNyV1eaTVJTiuaHZpig7Xx0MuYRMoJLLvhLTnUXhFdR5Tu2l2QSyKwfyXDgZlzhULqFg==
+  dependencies:
+    ansicolors "^0.3.2"
+    assert "^2.1.0"
+    bn.js "^5.2.0"
+    debug "^4.3.3"
+
 "@metaplex-foundation/rustbin@^0.3.0":
 "@metaplex-foundation/rustbin@^0.3.0":
   version "0.3.5"
   version "0.3.5"
   resolved "https://registry.npmjs.org/@metaplex-foundation/rustbin/-/rustbin-0.3.5.tgz"
   resolved "https://registry.npmjs.org/@metaplex-foundation/rustbin/-/rustbin-0.3.5.tgz"
@@ -140,11 +165,23 @@
   dependencies:
   dependencies:
     "@noble/hashes" "1.3.3"
     "@noble/hashes" "1.3.3"
 
 
+"@noble/curves@^1.4.0":
+  version "1.4.0"
+  resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.0.tgz#f05771ef64da724997f69ee1261b2417a49522d6"
+  integrity sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==
+  dependencies:
+    "@noble/hashes" "1.4.0"
+
 "@noble/hashes@1.3.3", "@noble/hashes@^1.3.1":
 "@noble/hashes@1.3.3", "@noble/hashes@^1.3.1":
   version "1.3.3"
   version "1.3.3"
   resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz"
   resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz"
   integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==
   integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==
 
 
+"@noble/hashes@1.4.0", "@noble/hashes@^1.4.0":
+  version "1.4.0"
+  resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426"
+  integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==
+
 "@nodelib/fs.scandir@2.1.5":
 "@nodelib/fs.scandir@2.1.5":
   version "2.1.5"
   version "2.1.5"
   resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz"
   resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz"
@@ -171,7 +208,7 @@
   resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz"
   resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz"
   integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
   integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==
 
 
-"@solana/buffer-layout@^4.0.0":
+"@solana/buffer-layout@^4.0.0", "@solana/buffer-layout@^4.0.1":
   version "4.0.1"
   version "4.0.1"
   resolved "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz"
   resolved "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz"
   integrity sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==
   integrity sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==
@@ -199,6 +236,34 @@
     rpc-websockets "^7.5.1"
     rpc-websockets "^7.5.1"
     superstruct "^0.14.2"
     superstruct "^0.14.2"
 
 
+"@solana/web3.js@^1.92.3":
+  version "1.93.0"
+  resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.93.0.tgz#4b6975020993cec2f6626e4f2bf559ca042df8db"
+  integrity sha512-suf4VYwWxERz4tKoPpXCRHFRNst7jmcFUaD65kII+zg9urpy5PeeqgLV6G5eWGzcVzA9tZeXOju1A1Y+0ojEVw==
+  dependencies:
+    "@babel/runtime" "^7.24.7"
+    "@noble/curves" "^1.4.0"
+    "@noble/hashes" "^1.4.0"
+    "@solana/buffer-layout" "^4.0.1"
+    agentkeepalive "^4.5.0"
+    bigint-buffer "^1.1.5"
+    bn.js "^5.2.1"
+    borsh "^0.7.0"
+    bs58 "^4.0.1"
+    buffer "6.0.3"
+    fast-stable-stringify "^1.0.0"
+    jayson "^4.1.0"
+    node-fetch "^2.7.0"
+    rpc-websockets "^9.0.0"
+    superstruct "^1.0.4"
+
+"@swc/helpers@^0.5.11":
+  version "0.5.11"
+  resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.11.tgz#5bab8c660a6e23c13b2d23fcd1ee44a2db1b0cb7"
+  integrity sha512-YNlnKRWF2sVojTpIyzwou9XoTNbzbzONwRhOoniEioF1AtaitTvVZblaQRrAzChWQ1bLYyYSWzM18y4WwgzJ+A==
+  dependencies:
+    tslib "^2.4.0"
+
 "@types/connect@^3.4.33":
 "@types/connect@^3.4.33":
   version "3.4.38"
   version "3.4.38"
   resolved "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz"
   resolved "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz"
@@ -233,6 +298,11 @@
   resolved "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz"
   resolved "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz"
   integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==
   integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==
 
 
+"@types/uuid@^8.3.4":
+  version "8.3.4"
+  resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.4.tgz#bd86a43617df0594787d38b735f55c805becf1bc"
+  integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==
+
 "@types/ws@^7.4.4":
 "@types/ws@^7.4.4":
   version "7.4.7"
   version "7.4.7"
   resolved "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz"
   resolved "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz"
@@ -240,6 +310,13 @@
   dependencies:
   dependencies:
     "@types/node" "*"
     "@types/node" "*"
 
 
+"@types/ws@^8.2.2":
+  version "8.5.10"
+  resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.10.tgz#4acfb517970853fa6574a3a6886791d04a396787"
+  integrity sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==
+  dependencies:
+    "@types/node" "*"
+
 "@typescript-eslint/eslint-plugin@^6.14.0":
 "@typescript-eslint/eslint-plugin@^6.14.0":
   version "6.14.0"
   version "6.14.0"
   resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.14.0.tgz"
   resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.14.0.tgz"
@@ -348,7 +425,7 @@ acorn@^8.9.0:
   resolved "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz"
   resolved "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz"
   integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==
   integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==
 
 
-agentkeepalive@^4.3.0:
+agentkeepalive@^4.3.0, agentkeepalive@^4.5.0:
   version "4.5.0"
   version "4.5.0"
   resolved "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz"
   resolved "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz"
   integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==
   integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==
@@ -486,6 +563,17 @@ arraybuffer.prototype.slice@^1.0.2:
     is-array-buffer "^3.0.2"
     is-array-buffer "^3.0.2"
     is-shared-array-buffer "^1.0.2"
     is-shared-array-buffer "^1.0.2"
 
 
+assert@^2.1.0:
+  version "2.1.0"
+  resolved "https://registry.yarnpkg.com/assert/-/assert-2.1.0.tgz#6d92a238d05dc02e7427c881fb8be81c8448b2dd"
+  integrity sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==
+  dependencies:
+    call-bind "^1.0.2"
+    is-nan "^1.3.2"
+    object-is "^1.1.5"
+    object.assign "^4.1.4"
+    util "^0.12.5"
+
 asynciterator.prototype@^1.0.0:
 asynciterator.prototype@^1.0.0:
   version "1.0.0"
   version "1.0.0"
   resolved "https://registry.npmjs.org/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz"
   resolved "https://registry.npmjs.org/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz"
@@ -498,6 +586,13 @@ available-typed-arrays@^1.0.5:
   resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz"
   resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz"
   integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==
   integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==
 
 
+available-typed-arrays@^1.0.7:
+  version "1.0.7"
+  resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846"
+  integrity sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==
+  dependencies:
+    possible-typed-array-names "^1.0.0"
+
 balanced-match@^1.0.0:
 balanced-match@^1.0.0:
   version "1.0.2"
   version "1.0.2"
   resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
   resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
@@ -584,7 +679,7 @@ bs58@^5.0.0:
   dependencies:
   dependencies:
     base-x "^4.0.0"
     base-x "^4.0.0"
 
 
-buffer@6.0.3, buffer@~6.0.3:
+buffer@6.0.3, buffer@^6.0.3, buffer@~6.0.3:
   version "6.0.3"
   version "6.0.3"
   resolved "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz"
   resolved "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz"
   integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
   integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
@@ -608,6 +703,17 @@ call-bind@^1.0.0, call-bind@^1.0.2, call-bind@^1.0.4, call-bind@^1.0.5:
     get-intrinsic "^1.2.1"
     get-intrinsic "^1.2.1"
     set-function-length "^1.1.1"
     set-function-length "^1.1.1"
 
 
+call-bind@^1.0.7:
+  version "1.0.7"
+  resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9"
+  integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==
+  dependencies:
+    es-define-property "^1.0.0"
+    es-errors "^1.3.0"
+    function-bind "^1.1.2"
+    get-intrinsic "^1.2.4"
+    set-function-length "^1.2.1"
+
 callsites@^3.0.0:
 callsites@^3.0.0:
   version "3.1.0"
   version "3.1.0"
   resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz"
   resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz"
@@ -690,6 +796,15 @@ define-data-property@^1.0.1, define-data-property@^1.1.1:
     gopd "^1.0.1"
     gopd "^1.0.1"
     has-property-descriptors "^1.0.0"
     has-property-descriptors "^1.0.0"
 
 
+define-data-property@^1.1.4:
+  version "1.1.4"
+  resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e"
+  integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==
+  dependencies:
+    es-define-property "^1.0.0"
+    es-errors "^1.3.0"
+    gopd "^1.0.1"
+
 define-properties@^1.1.3, define-properties@^1.2.0, define-properties@^1.2.1:
 define-properties@^1.1.3, define-properties@^1.2.0, define-properties@^1.2.1:
   version "1.2.1"
   version "1.2.1"
   resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz"
   resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz"
@@ -793,6 +908,18 @@ es-abstract@^1.22.1:
     unbox-primitive "^1.0.2"
     unbox-primitive "^1.0.2"
     which-typed-array "^1.1.13"
     which-typed-array "^1.1.13"
 
 
+es-define-property@^1.0.0:
+  version "1.0.0"
+  resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845"
+  integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==
+  dependencies:
+    get-intrinsic "^1.2.4"
+
+es-errors@^1.3.0:
+  version "1.3.0"
+  resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f"
+  integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==
+
 es-iterator-helpers@^1.0.12:
 es-iterator-helpers@^1.0.12:
   version "1.0.15"
   version "1.0.15"
   resolved "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.0.15.tgz"
   resolved "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.0.15.tgz"
@@ -1029,6 +1156,11 @@ eventemitter3@^4.0.7:
   resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz"
   resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz"
   integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==
   integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==
 
 
+eventemitter3@^5.0.1:
+  version "5.0.1"
+  resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4"
+  integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==
+
 eyes@^0.1.8:
 eyes@^0.1.8:
   version "0.1.8"
   version "0.1.8"
   resolved "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
   resolved "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
@@ -1172,6 +1304,17 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@
     has-symbols "^1.0.3"
     has-symbols "^1.0.3"
     hasown "^2.0.0"
     hasown "^2.0.0"
 
 
+get-intrinsic@^1.2.4:
+  version "1.2.4"
+  resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd"
+  integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==
+  dependencies:
+    es-errors "^1.3.0"
+    function-bind "^1.1.2"
+    has-proto "^1.0.1"
+    has-symbols "^1.0.3"
+    hasown "^2.0.0"
+
 get-symbol-description@^1.0.0:
 get-symbol-description@^1.0.0:
   version "1.0.0"
   version "1.0.0"
   resolved "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz"
   resolved "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz"
@@ -1284,6 +1427,13 @@ has-property-descriptors@^1.0.0:
   dependencies:
   dependencies:
     get-intrinsic "^1.2.2"
     get-intrinsic "^1.2.2"
 
 
+has-property-descriptors@^1.0.2:
+  version "1.0.2"
+  resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854"
+  integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==
+  dependencies:
+    es-define-property "^1.0.0"
+
 has-proto@^1.0.1:
 has-proto@^1.0.1:
   version "1.0.1"
   version "1.0.1"
   resolved "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz"
   resolved "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz"
@@ -1301,6 +1451,13 @@ has-tostringtag@^1.0.0:
   dependencies:
   dependencies:
     has-symbols "^1.0.2"
     has-symbols "^1.0.2"
 
 
+has-tostringtag@^1.0.2:
+  version "1.0.2"
+  resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc"
+  integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==
+  dependencies:
+    has-symbols "^1.0.3"
+
 hasown@^2.0.0:
 hasown@^2.0.0:
   version "2.0.0"
   version "2.0.0"
   resolved "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz"
   resolved "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz"
@@ -1346,9 +1503,9 @@ inflight@^1.0.4:
     once "^1.3.0"
     once "^1.3.0"
     wrappy "1"
     wrappy "1"
 
 
-inherits@2:
+inherits@2, inherits@^2.0.3:
   version "2.0.4"
   version "2.0.4"
-  resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz"
+  resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
   integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
   integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
 
 
 internal-slot@^1.0.5:
 internal-slot@^1.0.5:
@@ -1360,6 +1517,14 @@ internal-slot@^1.0.5:
     hasown "^2.0.0"
     hasown "^2.0.0"
     side-channel "^1.0.4"
     side-channel "^1.0.4"
 
 
+is-arguments@^1.0.4:
+  version "1.1.1"
+  resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b"
+  integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==
+  dependencies:
+    call-bind "^1.0.2"
+    has-tostringtag "^1.0.0"
+
 is-array-buffer@^3.0.1, is-array-buffer@^3.0.2:
 is-array-buffer@^3.0.1, is-array-buffer@^3.0.2:
   version "3.0.2"
   version "3.0.2"
   resolved "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz"
   resolved "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz"
@@ -1427,9 +1592,9 @@ is-fullwidth-code-point@^3.0.0:
   resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz"
   resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz"
   integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
   integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
 
 
-is-generator-function@^1.0.10:
+is-generator-function@^1.0.10, is-generator-function@^1.0.7:
   version "1.0.10"
   version "1.0.10"
-  resolved "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz"
+  resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72"
   integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==
   integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==
   dependencies:
   dependencies:
     has-tostringtag "^1.0.0"
     has-tostringtag "^1.0.0"
@@ -1446,6 +1611,14 @@ is-map@^2.0.1:
   resolved "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz"
   resolved "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz"
   integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==
   integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==
 
 
+is-nan@^1.3.2:
+  version "1.3.2"
+  resolved "https://registry.yarnpkg.com/is-nan/-/is-nan-1.3.2.tgz#043a54adea31748b55b6cd4e09aadafa69bd9e1d"
+  integrity sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==
+  dependencies:
+    call-bind "^1.0.0"
+    define-properties "^1.1.3"
+
 is-negative-zero@^2.0.2:
 is-negative-zero@^2.0.2:
   version "2.0.2"
   version "2.0.2"
   resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz"
   resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz"
@@ -1509,6 +1682,13 @@ is-typed-array@^1.1.10, is-typed-array@^1.1.12, is-typed-array@^1.1.9:
   dependencies:
   dependencies:
     which-typed-array "^1.1.11"
     which-typed-array "^1.1.11"
 
 
+is-typed-array@^1.1.3:
+  version "1.1.13"
+  resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.13.tgz#d6c5ca56df62334959322d7d7dd1cca50debe229"
+  integrity sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==
+  dependencies:
+    which-typed-array "^1.1.14"
+
 is-weakmap@^2.0.1:
 is-weakmap@^2.0.1:
   version "2.0.1"
   version "2.0.1"
   resolved "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz"
   resolved "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz"
@@ -1774,7 +1954,7 @@ no-case@^3.0.4:
     lower-case "^2.0.2"
     lower-case "^2.0.2"
     tslib "^2.0.3"
     tslib "^2.0.3"
 
 
-node-fetch@^2.6.12:
+node-fetch@^2.6.12, node-fetch@^2.7.0:
   version "2.7.0"
   version "2.7.0"
   resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz"
   resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz"
   integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
   integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
@@ -1796,6 +1976,14 @@ object-inspect@^1.13.1, object-inspect@^1.9.0:
   resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz"
   resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz"
   integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==
   integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==
 
 
+object-is@^1.1.5:
+  version "1.1.6"
+  resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.6.tgz#1a6a53aed2dd8f7e6775ff870bea58545956ab07"
+  integrity sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==
+  dependencies:
+    call-bind "^1.0.7"
+    define-properties "^1.2.1"
+
 object-keys@^1.1.1:
 object-keys@^1.1.1:
   version "1.1.1"
   version "1.1.1"
   resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz"
   resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz"
@@ -1934,6 +2122,11 @@ picomatch@^2.3.1:
   resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz"
   resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz"
   integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
   integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
 
 
+possible-typed-array-names@^1.0.0:
+  version "1.0.0"
+  resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz#89bb63c6fada2c3e90adc4a647beeeb39cc7bf8f"
+  integrity sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==
+
 prelude-ls@^1.2.1:
 prelude-ls@^1.2.1:
   version "1.2.1"
   version "1.2.1"
   resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz"
   resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz"
@@ -2054,6 +2247,22 @@ rpc-websockets@^7.5.1:
     bufferutil "^4.0.1"
     bufferutil "^4.0.1"
     utf-8-validate "^5.0.2"
     utf-8-validate "^5.0.2"
 
 
+rpc-websockets@^9.0.0:
+  version "9.0.2"
+  resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-9.0.2.tgz#4c1568d00b8100f997379a363478f41f8f4b242c"
+  integrity sha512-YzggvfItxMY3Lwuax5rC18inhbjJv9Py7JXRHxTIi94JOLrqBsSsUUc5bbl5W6c11tXhdfpDPK0KzBhoGe8jjw==
+  dependencies:
+    "@swc/helpers" "^0.5.11"
+    "@types/uuid" "^8.3.4"
+    "@types/ws" "^8.2.2"
+    buffer "^6.0.3"
+    eventemitter3 "^5.0.1"
+    uuid "^8.3.2"
+    ws "^8.5.0"
+  optionalDependencies:
+    bufferutil "^4.0.1"
+    utf-8-validate "^5.0.2"
+
 run-parallel@^1.1.9:
 run-parallel@^1.1.9:
   version "1.2.0"
   version "1.2.0"
   resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz"
   resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz"
@@ -2107,6 +2316,18 @@ set-function-length@^1.1.1:
     gopd "^1.0.1"
     gopd "^1.0.1"
     has-property-descriptors "^1.0.0"
     has-property-descriptors "^1.0.0"
 
 
+set-function-length@^1.2.1:
+  version "1.2.2"
+  resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449"
+  integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==
+  dependencies:
+    define-data-property "^1.1.4"
+    es-errors "^1.3.0"
+    function-bind "^1.1.2"
+    get-intrinsic "^1.2.4"
+    gopd "^1.0.1"
+    has-property-descriptors "^1.0.2"
+
 set-function-name@^2.0.0, set-function-name@^2.0.1:
 set-function-name@^2.0.0, set-function-name@^2.0.1:
   version "2.0.1"
   version "2.0.1"
   resolved "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz"
   resolved "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz"
@@ -2178,8 +2399,16 @@ spok@^1.4.3:
     ansicolors "~0.3.2"
     ansicolors "~0.3.2"
     find-process "^1.4.7"
     find-process "^1.4.7"
 
 
-"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0:
-  name string-width-cjs
+"string-width-cjs@npm:string-width@^4.2.0":
+  version "4.2.3"
+  resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
+  integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
+  dependencies:
+    emoji-regex "^8.0.0"
+    is-fullwidth-code-point "^3.0.0"
+    strip-ansi "^6.0.1"
+
+string-width@^4.1.0:
   version "4.2.3"
   version "4.2.3"
   resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
   resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
   integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
   integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -2239,7 +2468,14 @@ string.prototype.trimstart@^1.0.7:
     define-properties "^1.2.0"
     define-properties "^1.2.0"
     es-abstract "^1.22.1"
     es-abstract "^1.22.1"
 
 
-"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
+"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
+  version "6.0.1"
+  resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
+  integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
+  dependencies:
+    ansi-regex "^5.0.1"
+
+strip-ansi@^6.0.0, strip-ansi@^6.0.1:
   version "6.0.1"
   version "6.0.1"
   resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
   resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
   integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
   integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -2268,6 +2504,11 @@ superstruct@^0.14.2:
   resolved "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz"
   resolved "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz"
   integrity sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==
   integrity sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==
 
 
+superstruct@^1.0.4:
+  version "1.0.4"
+  resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.4.tgz#0adb99a7578bd2f1c526220da6571b2d485d91ca"
+  integrity sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ==
+
 supports-color@^7.1.0:
 supports-color@^7.1.0:
   version "7.2.0"
   version "7.2.0"
   resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz"
   resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz"
@@ -2332,6 +2573,11 @@ tslib@^2.0.3:
   resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz"
   resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz"
   integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
   integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
 
 
+tslib@^2.4.0:
+  version "2.6.3"
+  resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0"
+  integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==
+
 type-check@^0.4.0, type-check@~0.4.0:
 type-check@^0.4.0, type-check@~0.4.0:
   version "0.4.0"
   version "0.4.0"
   resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz"
   resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz"
@@ -2439,6 +2685,17 @@ utf-8-validate@^5.0.2:
   dependencies:
   dependencies:
     node-gyp-build "^4.3.0"
     node-gyp-build "^4.3.0"
 
 
+util@^0.12.5:
+  version "0.12.5"
+  resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc"
+  integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==
+  dependencies:
+    inherits "^2.0.3"
+    is-arguments "^1.0.4"
+    is-generator-function "^1.0.7"
+    is-typed-array "^1.1.3"
+    which-typed-array "^1.1.2"
+
 uuid@^8.3.2:
 uuid@^8.3.2:
   version "8.3.2"
   version "8.3.2"
   resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz"
   resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz"
@@ -2517,6 +2774,17 @@ which-typed-array@^1.1.11, which-typed-array@^1.1.13, which-typed-array@^1.1.9:
     gopd "^1.0.1"
     gopd "^1.0.1"
     has-tostringtag "^1.0.0"
     has-tostringtag "^1.0.0"
 
 
+which-typed-array@^1.1.14, which-typed-array@^1.1.2:
+  version "1.1.15"
+  resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.15.tgz#264859e9b11a649b388bfaaf4f767df1f779b38d"
+  integrity sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==
+  dependencies:
+    available-typed-arrays "^1.0.7"
+    call-bind "^1.0.7"
+    for-each "^0.3.3"
+    gopd "^1.0.1"
+    has-tostringtag "^1.0.2"
+
 which@^2.0.1:
 which@^2.0.1:
   version "2.0.2"
   version "2.0.2"
   resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz"
   resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz"

+ 47 - 3
crates/bolt-lang/attribute/delegate/src/lib.rs

@@ -34,6 +34,7 @@ pub fn delegate(args: TokenStream, input: TokenStream) -> TokenStream {
 fn modify_component_module(mut module: ItemMod, component_type: &Type) -> ItemMod {
 fn modify_component_module(mut module: ItemMod, component_type: &Type) -> ItemMod {
     let (delegate_fn, delegate_struct) = generate_delegate(component_type);
     let (delegate_fn, delegate_struct) = generate_delegate(component_type);
     let (undelegate_fn, undelegate_struct) = generate_undelegate();
     let (undelegate_fn, undelegate_struct) = generate_undelegate();
+    let (allow_undelegate_fn, allow_undelegate_struct) = generate_allow_undelegate();
     module.content = module.content.map(|(brace, mut items)| {
     module.content = module.content.map(|(brace, mut items)| {
         items.extend(
         items.extend(
             vec![
             vec![
@@ -41,6 +42,8 @@ fn modify_component_module(mut module: ItemMod, component_type: &Type) -> ItemMo
                 delegate_struct,
                 delegate_struct,
                 undelegate_fn,
                 undelegate_fn,
                 undelegate_struct,
                 undelegate_struct,
+                allow_undelegate_fn,
+                allow_undelegate_struct,
             ]
             ]
             .into_iter()
             .into_iter()
             .map(|item| syn::parse2(item).unwrap())
             .map(|item| syn::parse2(item).unwrap())
@@ -51,6 +54,47 @@ fn modify_component_module(mut module: ItemMod, component_type: &Type) -> ItemMo
     module
     module
 }
 }
 
 
+/// Generates the allow_undelegate function and struct.
+fn generate_allow_undelegate() -> (TokenStream2, TokenStream2) {
+    (
+        quote! {
+            #[automatically_derived]
+            pub fn allow_undelegation(ctx: Context<AllowUndelegation>) -> Result<()> {
+                ::bolt_lang::allow_undelegation(
+                    &ctx.accounts.base_account,
+                    &ctx.accounts.delegation_record,
+                    &ctx.accounts.delegation_metadata,
+                    &ctx.accounts.buffer,
+                    &ctx.accounts.delegation_program,
+                    &id(),
+                )?;
+                Ok(())
+            }
+        },
+        quote! {
+            #[automatically_derived]
+            #[derive(Accounts)]
+            pub struct AllowUndelegation<'info> {
+                #[account()]
+                /// CHECK: The delegated component
+                pub base_account: AccountInfo<'info>,
+                #[account()]
+                /// CHECK: delegation record
+                pub delegation_record: AccountInfo<'info>,
+                #[account(mut)]
+                /// CHECK: delegation metadata
+                pub delegation_metadata: AccountInfo<'info>,
+                #[account()]
+                /// CHECK: singer buffer to enforce CPI
+                pub buffer: AccountInfo<'info>,
+                #[account()]
+                /// CHECK:`
+                pub delegation_program: AccountInfo<'info>,
+            }
+        },
+    )
+}
+
 /// Generates the undelegate function and struct.
 /// Generates the undelegate function and struct.
 fn generate_undelegate() -> (TokenStream2, TokenStream2) {
 fn generate_undelegate() -> (TokenStream2, TokenStream2) {
     (
     (
@@ -63,7 +107,7 @@ fn generate_undelegate() -> (TokenStream2, TokenStream2) {
                     &ctx.accounts.payer,
                     &ctx.accounts.payer,
                     &ctx.accounts.system_program,
                     &ctx.accounts.system_program,
                 ];
                 ];
-                undelegate_account(
+                ::bolt_lang::undelegate_account(
                     delegated_account,
                     delegated_account,
                     &id(),
                     &id(),
                     buffer,
                     buffer,
@@ -77,7 +121,7 @@ fn generate_undelegate() -> (TokenStream2, TokenStream2) {
         quote! {
         quote! {
             #[automatically_derived]
             #[automatically_derived]
             #[derive(Accounts)]
             #[derive(Accounts)]
-                pub struct InitializeAfterUndelegation<'info> {
+            pub struct InitializeAfterUndelegation<'info> {
                 /// CHECK:`
                 /// CHECK:`
                 #[account(mut)]
                 #[account(mut)]
                 pub base_account: AccountInfo<'info>,
                 pub base_account: AccountInfo<'info>,
@@ -115,7 +159,7 @@ fn generate_delegate(component_type: &Type) -> (TokenStream2, TokenStream2) {
 
 
                 let pda_seeds: &[&[u8]] = &[<#component_type>::seed(), &entity.key.to_bytes()];
                 let pda_seeds: &[&[u8]] = &[<#component_type>::seed(), &entity.key.to_bytes()];
 
 
-                delegate_account(
+                ::bolt_lang::delegate_account(
                     payer,
                     payer,
                     account,
                     account,
                     owner_program,
                     owner_program,

+ 1 - 1
crates/bolt-lang/src/lib.rs

@@ -20,7 +20,7 @@ pub use world;
 pub use world::program::World;
 pub use world::program::World;
 pub use world::Entity;
 pub use world::Entity;
 
 
-pub use delegation_program_sdk::{delegate_account, undelegate_account};
+pub use delegation_program_sdk::{allow_undelegation, delegate_account, undelegate_account};
 
 
 pub use serde;
 pub use serde;
 
 

+ 1 - 1
crates/types/Cargo.toml

@@ -10,4 +10,4 @@ name = "bolt_types"
 
 
 [dependencies]
 [dependencies]
 bolt-lang = { path = "../../crates/bolt-lang" }
 bolt-lang = { path = "../../crates/bolt-lang" }
-anchor-lang = { version = "0.30.0" }
+anchor-lang = { version = "0.30.1" }

+ 1 - 1
package.json

@@ -4,7 +4,7 @@
         "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
         "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
     },
     },
     "dependencies": {
     "dependencies": {
-        "@coral-xyz/anchor": "0.30.0"
+        "@coral-xyz/anchor": "0.30.1"
     },
     },
     "devDependencies": {
     "devDependencies": {
         "chai": "^4.3.4",
         "chai": "^4.3.4",

+ 12 - 7
tests/bolt.ts

@@ -7,9 +7,8 @@ import { type BoltComponent } from "../target/types/bolt_component";
 import { type SystemSimpleMovement } from "../target/types/system_simple_movement";
 import { type SystemSimpleMovement } from "../target/types/system_simple_movement";
 import { type SystemFly } from "../target/types/system_fly";
 import { type SystemFly } from "../target/types/system_fly";
 import { type SystemApplyVelocity } from "../target/types/system_apply_velocity";
 import { type SystemApplyVelocity } from "../target/types/system_apply_velocity";
-import { type World } from "../target/types/world";
 import { expect } from "chai";
 import { expect } from "chai";
-import BN from "bn.js";
+import type BN from "bn.js";
 import {
 import {
   AddEntity,
   AddEntity,
   createDelegateInstruction,
   createDelegateInstruction,
@@ -20,6 +19,7 @@ import {
   InitializeComponent,
   InitializeComponent,
   InitializeNewWorld,
   InitializeNewWorld,
   ApplySystem,
   ApplySystem,
+  createAllowUndelegationInstruction,
 } from "../clients/bolt-sdk";
 } from "../clients/bolt-sdk";
 
 
 enum Direction {
 enum Direction {
@@ -67,7 +67,6 @@ describe("bolt", () => {
   const provider = anchor.AnchorProvider.env();
   const provider = anchor.AnchorProvider.env();
   anchor.setProvider(provider);
   anchor.setProvider(provider);
 
 
-  const boltWorld = anchor.workspace.World as Program<World>;
   const boltComponentProgram = anchor.workspace
   const boltComponentProgram = anchor.workspace
     .BoltComponent as Program<BoltComponent>;
     .BoltComponent as Program<BoltComponent>;
 
 
@@ -446,7 +445,7 @@ describe("bolt", () => {
       await provider.sendAndConfirm(applySystem.transaction);
       await provider.sendAndConfirm(applySystem.transaction);
     } catch (error) {
     } catch (error) {
       failed = true;
       failed = true;
-      //console.log("error", error);
+      // console.log("error", error);
       expect(error.logs.join("\n")).to.contain("Error Code: InvalidAuthority");
       expect(error.logs.join("\n")).to.contain("Error Code: InvalidAuthority");
     }
     }
     expect(failed).to.equal(true);
     expect(failed).to.equal(true);
@@ -473,7 +472,7 @@ describe("bolt", () => {
         })
         })
         .rpc();
         .rpc();
     } catch (error) {
     } catch (error) {
-      //console.log("error", error);
+      // console.log("error", error);
       expect(error.message).to.contain("Error Code: InvalidCaller");
       expect(error.message).to.contain("Error Code: InvalidCaller");
       invalid = true;
       invalid = true;
     }
     }
@@ -491,7 +490,7 @@ describe("bolt", () => {
         })
         })
         .rpc();
         .rpc();
     } catch (error) {
     } catch (error) {
-      //console.log("error", error);
+      // console.log("error", error);
       expect(error.message).to.contain(
       expect(error.message).to.contain(
         "bolt_component. Error Code: AccountOwnedByWrongProgram"
         "bolt_component. Error Code: AccountOwnedByWrongProgram"
       );
       );
@@ -516,13 +515,19 @@ describe("bolt", () => {
   });
   });
 
 
   it("Check component undelegation", async () => {
   it("Check component undelegation", async () => {
+    const allowUndelegateIx = createAllowUndelegationInstruction({
+      delegatedAccount: componentPositionEntity1Pda,
+      ownerProgram: exampleComponentPosition.programId,
+    });
     const delegateIx = createUndelegateInstruction({
     const delegateIx = createUndelegateInstruction({
       payer: provider.wallet.publicKey,
       payer: provider.wallet.publicKey,
       delegatedAccount: componentPositionEntity1Pda,
       delegatedAccount: componentPositionEntity1Pda,
       ownerProgram: exampleComponentPosition.programId,
       ownerProgram: exampleComponentPosition.programId,
       reimbursement: provider.wallet.publicKey,
       reimbursement: provider.wallet.publicKey,
     });
     });
-    const tx = new anchor.web3.Transaction().add(delegateIx);
+    const tx = new anchor.web3.Transaction()
+      .add(allowUndelegateIx)
+      .add(delegateIx);
     await provider.sendAndConfirm(tx);
     await provider.sendAndConfirm(tx);
     const acc = await provider.connection.getAccountInfo(
     const acc = await provider.connection.getAccountInfo(
       componentPositionEntity1Pda
       componentPositionEntity1Pda

BIN
tests/fixtures/delegation.so


+ 16 - 10
yarn.lock

@@ -21,12 +21,18 @@
   dependencies:
   dependencies:
     regenerator-runtime "^0.14.0"
     regenerator-runtime "^0.14.0"
 
 
-"@coral-xyz/anchor@0.30.0":
-  version "0.30.0"
-  resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.0.tgz#52acdba504b0008f1026d3a4bbbcb2d4feb5c69e"
-  integrity sha512-qreDh5ztiRHVnCbJ+RS70NJ6aSTPBYDAgFeQ7Z5QvaT5DcDIhNyt4onOciVz2ieIE1XWePOJDDu9SbNvPGBkvQ==
-  dependencies:
-    "@coral-xyz/borsh" "^0.30.0"
+"@coral-xyz/anchor-errors@^0.30.1":
+  version "0.30.1"
+  resolved "https://registry.yarnpkg.com/@coral-xyz/anchor-errors/-/anchor-errors-0.30.1.tgz#bdfd3a353131345244546876eb4afc0e125bec30"
+  integrity sha512-9Mkradf5yS5xiLWrl9WrpjqOrAV+/W2RQHDlbnAZBivoGpOs1ECjoDCkVk4aRG8ZdiFiB8zQEVlxf+8fKkmSfQ==
+
+"@coral-xyz/anchor@0.30.1":
+  version "0.30.1"
+  resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.1.tgz#17f3e9134c28cd0ea83574c6bab4e410bcecec5d"
+  integrity sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ==
+  dependencies:
+    "@coral-xyz/anchor-errors" "^0.30.1"
+    "@coral-xyz/borsh" "^0.30.1"
     "@noble/hashes" "^1.3.1"
     "@noble/hashes" "^1.3.1"
     "@solana/web3.js" "^1.68.0"
     "@solana/web3.js" "^1.68.0"
     bn.js "^5.1.2"
     bn.js "^5.1.2"
@@ -41,10 +47,10 @@
     superstruct "^0.15.4"
     superstruct "^0.15.4"
     toml "^3.0.0"
     toml "^3.0.0"
 
 
-"@coral-xyz/borsh@^0.30.0":
-  version "0.30.0"
-  resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.30.0.tgz#3e6f23e944ef6c89f2c9cbead383358752ac5e73"
-  integrity sha512-OrcV+7N10cChhgDRUxM4iEIuwxUHHs52XD85R8cFCUqE0vbLYrcoPPPs+VF6kZ9DhdJGVW2I6DHJOp5TykyZog==
+"@coral-xyz/borsh@^0.30.1":
+  version "0.30.1"
+  resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.30.1.tgz#869d8833abe65685c72e9199b8688477a4f6b0e3"
+  integrity sha512-aaxswpPrCFKl8vZTbxLssA2RvwX2zmKLlRCIktJOwW+VpVwYtXRtlWiIP+c2pPRKneiTiWCN2GEMSH9j1zTlWQ==
   dependencies:
   dependencies:
     bn.js "^5.1.2"
     bn.js "^5.1.2"
     buffer-layout "^1.2.0"
     buffer-layout "^1.2.0"

Some files were not shown because too many files changed in this diff