Browse Source

Upgrade to the new delegation/undelegation flow (#80)

Gabriele Picco 1 year ago
parent
commit
31687314ac

+ 16 - 0
CHANGELOG.md

@@ -1,12 +1,28 @@
 
 ## [0.1.8] - 2024-06-27
+
+### ✨️ Features
  - Add allow undelegation ix (#68)
 
 ## [0.1.7] - 2024-06-21
 
 ### ✨️ Features
  - Add manual commit to the typescript sdk (#59)
+# :sparkles: Add manual commit to the typescript sdk
+| Status  | Type  | ⚠️ Core Change | Issue |
+| :---: | :---: | :---: | :--: |
+| Ready | Feature | No | - |
+
+## Description
+Add Ephemeral Rollups manual commit instruction to the typescript sdk
  - Upgrade to Anchor 0.30.1 (#62)
+# Upgrade to Anchor 0.30.1
+| Status  | Type  | ⚠️ Core Change | Issue |
+| :---: | :---: | :---: | :--: |
+| Ready | Feature | No | - |
+
+## Description
+Upgrade Anchor dependency to 0.30.1
 
 ### 👷 CI/CD
 

+ 261 - 33
Cargo.lock

@@ -824,6 +824,17 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
 [[package]]
 name = "bolt-attribute-bolt-arguments"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5cc7d380e5ebf6964359ae888a9134c9fded61150b6cbf958440c2711fa0829"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-attribute-bolt-arguments"
+version = "0.1.9"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -833,8 +844,20 @@ dependencies = [
 [[package]]
 name = "bolt-attribute-bolt-component"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bde3afd6f0c691bc3628aff8697df3c678f34328c037662262edbe54fa0aac39"
+dependencies = [
+ "bolt-utils 0.1.8",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-attribute-bolt-component"
+version = "0.1.9"
 dependencies = [
- "bolt-utils",
+ "bolt-utils 0.1.9",
  "proc-macro2",
  "quote",
  "syn 1.0.109",
@@ -843,8 +866,20 @@ dependencies = [
 [[package]]
 name = "bolt-attribute-bolt-component-deserialize"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3af3f94219f480f813dc5038327d54decd53bdb4a3ea79763c5a94cf75255fd4"
+dependencies = [
+ "bolt-utils 0.1.8",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-attribute-bolt-component-deserialize"
+version = "0.1.9"
 dependencies = [
- "bolt-utils",
+ "bolt-utils 0.1.9",
  "proc-macro2",
  "quote",
  "syn 1.0.109",
@@ -853,6 +888,17 @@ dependencies = [
 [[package]]
 name = "bolt-attribute-bolt-component-id"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d3be2a0037e4efd4672c29c36396fbdb34628aae253bd79072f0abd5bdf8703"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-attribute-bolt-component-id"
+version = "0.1.9"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -862,6 +908,17 @@ dependencies = [
 [[package]]
 name = "bolt-attribute-bolt-delegate"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "be2b1c9d1303622b1ee2554bb6d06e960739d7d8e88e815f1bb011d0f7b1b328"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-attribute-bolt-delegate"
+version = "0.1.9"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -871,6 +928,17 @@ dependencies = [
 [[package]]
 name = "bolt-attribute-bolt-extra-accounts"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef4bec9419f43ad52506bc3f5094fbf2dfe790327c80b256e556d2de98b61379"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-attribute-bolt-extra-accounts"
+version = "0.1.9"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -880,6 +948,17 @@ dependencies = [
 [[package]]
 name = "bolt-attribute-bolt-program"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "acc769ca239790335c5af46b64fdcd3fbca980f0a292e9ec537de7eb25bc9016"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-attribute-bolt-program"
+version = "0.1.9"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -889,6 +968,17 @@ dependencies = [
 [[package]]
 name = "bolt-attribute-bolt-system"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fbc709630ca4f96f59c0b6e6902c03f315256a1b57947e4353fde63ad8941986"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-attribute-bolt-system"
+version = "0.1.9"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -898,6 +988,17 @@ dependencies = [
 [[package]]
 name = "bolt-attribute-bolt-system-input"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e6fac0b2554c1cd1698a5ec8eb94906689a398d00cdb8edf4f3fed13500fc4c"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-attribute-bolt-system-input"
+version = "0.1.9"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -906,7 +1007,7 @@ dependencies = [
 
 [[package]]
 name = "bolt-cli"
-version = "0.1.8"
+version = "0.1.9"
 dependencies = [
  "anchor-cli",
  "anchor-client",
@@ -922,9 +1023,19 @@ dependencies = [
 [[package]]
 name = "bolt-component"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "60168104e26a180c2d73a0c742010c492d15a63ef2b80096c7a6b4b7c4b7d9ce"
 dependencies = [
  "anchor-lang",
- "bolt-system",
+ "bolt-system 0.1.8",
+]
+
+[[package]]
+name = "bolt-component"
+version = "0.1.9"
+dependencies = [
+ "anchor-lang",
+ "bolt-system 0.1.9",
 ]
 
 [[package]]
@@ -934,6 +1045,17 @@ version = "0.0.1"
 [[package]]
 name = "bolt-helpers-system-template"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e94bd87967a3bc8c3748b8f659401e34f3714f7fbc9cef090a59cb17062ee064"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-helpers-system-template"
+version = "0.1.9"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -943,6 +1065,17 @@ dependencies = [
 [[package]]
 name = "bolt-helpers-world-apply"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76cc82345e392ad048a0315b25573362664d2daf22f3ebdc9e52ae8b519b3294"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-helpers-world-apply"
+version = "0.1.9"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -952,44 +1085,89 @@ dependencies = [
 [[package]]
 name = "bolt-lang"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "81d1e6d8751afaccf16c02555fdba251be76c3e8bced6c49f96a7428d7b0f4c3"
 dependencies = [
  "ahash 0.8.11",
  "anchor-lang",
- "bolt-attribute-bolt-arguments",
- "bolt-attribute-bolt-component",
- "bolt-attribute-bolt-component-deserialize",
- "bolt-attribute-bolt-component-id",
- "bolt-attribute-bolt-delegate",
- "bolt-attribute-bolt-extra-accounts",
- "bolt-attribute-bolt-program",
- "bolt-attribute-bolt-system",
- "bolt-attribute-bolt-system-input",
- "bolt-system",
+ "bolt-attribute-bolt-arguments 0.1.8",
+ "bolt-attribute-bolt-component 0.1.8",
+ "bolt-attribute-bolt-component-deserialize 0.1.8",
+ "bolt-attribute-bolt-component-id 0.1.8",
+ "bolt-attribute-bolt-delegate 0.1.8",
+ "bolt-attribute-bolt-extra-accounts 0.1.8",
+ "bolt-attribute-bolt-program 0.1.8",
+ "bolt-attribute-bolt-system 0.1.8",
+ "bolt-attribute-bolt-system-input 0.1.8",
+ "bolt-system 0.1.8",
  "delegation-program-sdk",
  "serde",
  "serde_json",
- "world",
+ "world 0.1.8",
+]
+
+[[package]]
+name = "bolt-lang"
+version = "0.1.9"
+dependencies = [
+ "ahash 0.8.11",
+ "anchor-lang",
+ "bolt-attribute-bolt-arguments 0.1.9",
+ "bolt-attribute-bolt-component 0.1.9",
+ "bolt-attribute-bolt-component-deserialize 0.1.9",
+ "bolt-attribute-bolt-component-id 0.1.9",
+ "bolt-attribute-bolt-delegate 0.1.9",
+ "bolt-attribute-bolt-extra-accounts 0.1.9",
+ "bolt-attribute-bolt-program 0.1.9",
+ "bolt-attribute-bolt-system 0.1.9",
+ "bolt-attribute-bolt-system-input 0.1.9",
+ "bolt-system 0.1.9",
+ "ephemeral-rollups-sdk",
+ "serde",
+ "serde_json",
+ "world 0.1.9",
 ]
 
 [[package]]
 name = "bolt-system"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c12477c1a2eaab066643be790bc856cc16d23e8e7a78a02478fb61944a216f1e"
+dependencies = [
+ "anchor-lang",
+ "bolt-helpers-system-template 0.1.8",
+]
+
+[[package]]
+name = "bolt-system"
+version = "0.1.9"
 dependencies = [
  "anchor-lang",
- "bolt-helpers-system-template",
+ "bolt-helpers-system-template 0.1.9",
 ]
 
 [[package]]
 name = "bolt-types"
-version = "0.1.4"
+version = "0.1.6"
 dependencies = [
  "anchor-lang",
- "bolt-lang",
+ "bolt-lang 0.1.8",
 ]
 
 [[package]]
 name = "bolt-utils"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9fa9b5359de7664a9b46caf3b06740d28c28f9f53d1eb82eca0619888d63f845"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "bolt-utils"
+version = "0.1.9"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1598,9 +1776,9 @@ dependencies = [
 
 [[package]]
 name = "delegation-sdk-attribute-delegate"
-version = "0.1.2"
+version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c95b9e42aee58a38bcd7f3f0014a832e66ea31157f4f8102ae85a4a37aa4eeb5"
+checksum = "1151d538be1dfdec0892fffead4cf02c750c3a1e0b4dd68b4312b3dc1720151e"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -1867,6 +2045,42 @@ dependencies = [
  "termcolor",
 ]
 
+[[package]]
+name = "ephemeral-rollups-sdk"
+version = "0.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78d083d793a467350cb76312a1281e9bc6a0083823102dee8f99e1117b668fb6"
+dependencies = [
+ "anchor-lang",
+ "borsh 0.10.3",
+ "ephemeral-rollups-sdk-attribute-commit",
+ "ephemeral-rollups-sdk-attribute-delegate",
+ "paste",
+ "solana-program",
+]
+
+[[package]]
+name = "ephemeral-rollups-sdk-attribute-commit"
+version = "0.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82c0c885becc3dba2ffacd1d121b1f54bdb061a62549f4fe1f2982d4535b0a66"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "ephemeral-rollups-sdk-attribute-delegate"
+version = "0.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52e08894bd8218c86414fa637dad53c8cccddfab0f5ee81f3d70b79745e084cb"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
 [[package]]
 name = "equivalent"
 version = "1.0.1"
@@ -3159,10 +3373,10 @@ dependencies = [
 
 [[package]]
 name = "position"
-version = "0.1.8"
+version = "0.1.9"
 dependencies = [
  "anchor-lang",
- "bolt-lang",
+ "bolt-lang 0.1.9",
 ]
 
 [[package]]
@@ -5279,11 +5493,11 @@ dependencies = [
 
 [[package]]
 name = "system-apply-velocity"
-version = "0.1.8"
+version = "0.1.9"
 dependencies = [
  "anchor-lang",
  "anchor-spl",
- "bolt-lang",
+ "bolt-lang 0.1.9",
  "position",
  "velocity",
 ]
@@ -5311,19 +5525,19 @@ dependencies = [
 
 [[package]]
 name = "system-fly"
-version = "0.1.8"
+version = "0.1.9"
 dependencies = [
  "anchor-lang",
- "bolt-lang",
+ "bolt-lang 0.1.9",
  "position",
 ]
 
 [[package]]
 name = "system-simple-movement"
-version = "0.1.8"
+version = "0.1.9"
 dependencies = [
  "anchor-lang",
- "bolt-lang",
+ "bolt-lang 0.1.9",
  "bolt-types",
  "serde",
 ]
@@ -5841,10 +6055,10 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
 
 [[package]]
 name = "velocity"
-version = "0.1.8"
+version = "0.1.9"
 dependencies = [
  "anchor-lang",
- "bolt-lang",
+ "bolt-lang 0.1.9",
 ]
 
 [[package]]
@@ -6191,11 +6405,25 @@ dependencies = [
 [[package]]
 name = "world"
 version = "0.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b3cf98c27a8b193567d9dde24984503e2844b8d562c3c82d500209a44500e854"
+dependencies = [
+ "anchor-lang",
+ "bolt-component 0.1.8",
+ "bolt-helpers-world-apply 0.1.8",
+ "bolt-system 0.1.8",
+ "solana-security-txt",
+ "tuple-conv",
+]
+
+[[package]]
+name = "world"
+version = "0.1.9"
 dependencies = [
  "anchor-lang",
- "bolt-component",
- "bolt-helpers-world-apply",
- "bolt-system",
+ "bolt-component 0.1.9",
+ "bolt-helpers-world-apply 0.1.9",
+ "bolt-system 0.1.9",
  "solana-security-txt",
  "tuple-conv",
 ]

+ 17 - 17
Cargo.toml

@@ -7,7 +7,7 @@ members = [
 ]
 
 [workspace.package]
-version = "0.1.8"
+version = "0.1.9"
 authors = ["Magicblock Labs <dev@magicblock.gg>"]
 repository = "https://github.com/magicblock-labs/bolt"
 homepage = "https://www.magicblock.gg/"
@@ -15,21 +15,21 @@ license = "MIT"
 edition = "2021"
 
 [workspace.dependencies]
-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"}
+bolt-attribute-bolt-program = { path = "crates/bolt-lang/attribute/bolt-program", version = "=0.1.9" }
+bolt-attribute-bolt-delegate = { path = "crates/bolt-lang/attribute/delegate", version = "=0.1.9" }
+bolt-attribute-bolt-component = { path = "crates/bolt-lang/attribute/component", version = "=0.1.9" }
+bolt-attribute-bolt-system = { path = "crates/bolt-lang/attribute/system", version = "=0.1.9"}
+bolt-attribute-bolt-system-input = { path = "crates/bolt-lang/attribute/system-input", version = "=0.1.9" }
+bolt-attribute-bolt-extra-accounts = { path = "crates/bolt-lang/attribute/extra-accounts", version = "=0.1.9" }
+bolt-attribute-bolt-arguments = { path = "crates/bolt-lang/attribute/arguments", version = "=0.1.9" }
+bolt-attribute-bolt-component-deserialize = { path = "crates/bolt-lang/attribute/component-deserialize", version = "=0.1.9" }
+bolt-attribute-bolt-component-id = { path = "crates/bolt-lang/attribute/component-id", version = "=0.1.9" }
+bolt-helpers-system-template = { path = "crates/bolt-helpers/attribute/system-template", version = "=0.1.9" }
+bolt-helpers-world-apply = { path = "crates/bolt-helpers/attribute/world-apply", version = "=0.1.9" }
+bolt-utils = { path = "crates/bolt-lang/utils", version = "=0.1.9" }
+world = { path = "programs/world", features = ["cpi"], version = "=0.1.9"}
+bolt-system = { path = "programs/bolt-system", features = ["cpi"], version = "=0.1.9"}
+bolt-component = { path = "programs/bolt-component", features = ["cpi"], version = "=0.1.9"}
 
 ## External crates
 anchor-lang = { version = "=0.30.1", features = ["init-if-needed"] }
@@ -51,7 +51,7 @@ anyhow = "1.0.32"
 heck = "0.5.0"
 clap = { version = "4.2.4", features = ["derive"] }
 ahash = "=0.8.11"
-delegation-program-sdk = "=0.1.3"
+ephemeral-rollups-sdk = "=0.0.6"
 
 [profile.release]
 overflow-checks = true

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

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

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

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

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

@@ -1,6 +1,6 @@
 {
   "name": "@magicblock-labs/bolt-sdk",
-  "version": "0.1.8",
+  "version": "0.1.9",
   "description": "Bolt typescript SDK",
   "author": "dev@magicblock.gg",
   "license": "MIT",
@@ -8,7 +8,7 @@
   "dependencies": {
     "@metaplex-foundation/beet": "^0.7.1",
     "@metaplex-foundation/beet-solana": "^0.4.0",
-    "@magicblock-labs/delegation-program": "0.1.3"
+    "@magicblock-labs/ephemeral-rollups-sdk": "0.0.6"
   },
   "devDependencies": {
     "@metaplex-foundation/solita": "^0.20.1",

+ 1 - 1
clients/bolt-sdk/src/delegation/allow_undelegation.ts

@@ -3,7 +3,7 @@ import * as web3 from "@solana/web3.js";
 import {
   DelegateAccounts,
   DELEGATION_PROGRAM_ID,
-} from "@magicblock-labs/delegation-program";
+} from "@magicblock-labs/ephemeral-rollups-sdk";
 
 export const allowUndelegationStruct = new beet.BeetArgsStruct<{
   instructionDiscriminator: number[] /* size: 8 */;

+ 1 - 1
clients/bolt-sdk/src/delegation/delegate.ts

@@ -3,7 +3,7 @@ import * as web3 from "@solana/web3.js";
 import {
   DelegateAccounts,
   DELEGATION_PROGRAM_ID,
-} from "@magicblock-labs/delegation-program";
+} from "@magicblock-labs/ephemeral-rollups-sdk";
 import { FindComponentPda } from "../index";
 import {
   type PublicKey,

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

@@ -0,0 +1,63 @@
+import * as beet from "@metaplex-foundation/beet";
+import * as web3 from "@solana/web3.js";
+import {
+  MAGIC_CONTEXT_ID,
+  MAGIC_PROGRAM_ID,
+} from "@magicblock-labs/ephemeral-rollups-sdk";
+
+export const undelegateStruct = new beet.BeetArgsStruct<{
+  instructionDiscriminator: number[] /* size: 8 */;
+}>(
+  [["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)]],
+  "undelegateInstructionArgs"
+);
+
+export interface UndelegateInstructionAccounts {
+  payer: web3.PublicKey;
+  delegatedAccount: web3.PublicKey;
+  componentPda: web3.PublicKey;
+}
+
+export const undelegateInstructionDiscriminator = [
+  131, 148, 180, 198, 91, 104, 42, 238,
+];
+
+/**
+ * Creates an Undelegate instruction.
+ */
+export function createUndelegateInstruction(
+  accounts: UndelegateInstructionAccounts
+) {
+  const [data] = undelegateStruct.serialize({
+    instructionDiscriminator: undelegateInstructionDiscriminator,
+  });
+
+  const keys: web3.AccountMeta[] = [
+    {
+      pubkey: accounts.payer,
+      isWritable: true,
+      isSigner: true,
+    },
+    {
+      pubkey: accounts.delegatedAccount,
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: new web3.PublicKey(MAGIC_CONTEXT_ID),
+      isWritable: true,
+      isSigner: false,
+    },
+    {
+      pubkey: new web3.PublicKey(MAGIC_PROGRAM_ID),
+      isWritable: false,
+      isSigner: false,
+    },
+  ];
+
+  return new web3.TransactionInstruction({
+    programId: accounts.componentPda,
+    keys,
+    data,
+  });
+}

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

@@ -5,12 +5,9 @@ export * from "./generated/accounts";
 export * from "./generated/instructions";
 export * from "./world/transactions";
 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 { DELEGATION_PROGRAM_ID } from "@magicblock-labs/ephemeral-rollups-sdk";
 
 export const SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey(
   "Sysvar1nstructions1111111111111111111111111"

+ 1 - 1
clients/bolt-sdk/src/world/transactions.ts

@@ -22,7 +22,7 @@ import {
   type Connection,
   type PublicKey,
   Transaction,
-  TransactionInstruction,
+  type TransactionInstruction,
 } from "@solana/web3.js";
 import { PROGRAM_ID } from "../generated";
 

+ 4 - 4
clients/bolt-sdk/yarn.lock

@@ -84,10 +84,10 @@
     wrap-ansi "^8.1.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==
+"@magicblock-labs/ephemeral-rollups-sdk@0.0.6":
+  version "0.0.6"
+  resolved "https://registry.yarnpkg.com/@magicblock-labs/ephemeral-rollups-sdk/-/ephemeral-rollups-sdk-0.0.6.tgz#47a667d9fd7df76752660a6d82688e54174241ab"
+  integrity sha512-moep9ja4fmDXPa0OcjJBvvOTUNrds8rwTzxmbGd5Myu/6AsykcCpTuUZjleQCRotu/yODLVkpheMDr1S0/mtpA==
   dependencies:
     "@metaplex-foundation/beet" "^0.7.2"
     "@solana/web3.js" "^1.92.3"

+ 1 - 1
crates/bolt-lang/Cargo.toml

@@ -27,7 +27,7 @@ world = { workspace = true }
 bolt-system = { workspace = true }
 
 # Delegation
-delegation-program-sdk = { workspace = true }
+ephemeral-rollups-sdk = { workspace = true , features = ["anchor"]}
 
 # Other dependencies
 serde = { workspace = true }

+ 22 - 28
crates/bolt-lang/attribute/delegate/src/lib.rs

@@ -33,17 +33,17 @@ pub fn delegate(args: TokenStream, input: TokenStream) -> TokenStream {
 /// Modifies the component module and adds the necessary functions and structs.
 fn modify_component_module(mut module: ItemMod, component_type: &Type) -> ItemMod {
     let (delegate_fn, delegate_struct) = generate_delegate(component_type);
+    let (reinit_undelegate_fn, reinit_undelegate_struct) = generate_reinit_after_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)| {
         items.extend(
             vec![
                 delegate_fn,
                 delegate_struct,
+                reinit_undelegate_fn,
+                reinit_undelegate_struct,
                 undelegate_fn,
                 undelegate_struct,
-                allow_undelegate_fn,
-                allow_undelegate_struct,
             ]
             .into_iter()
             .map(|item| syn::parse2(item).unwrap())
@@ -55,18 +55,16 @@ fn modify_component_module(mut module: ItemMod, component_type: &Type) -> ItemMo
 }
 
 /// Generates the allow_undelegate function and struct.
-fn generate_allow_undelegate() -> (TokenStream2, TokenStream2) {
+fn generate_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(),
+            pub fn undelegate(ctx: Context<Undelegate>) -> Result<()> {
+                ::bolt_lang::commit_and_undelegate_accounts(
+                    &ctx.accounts.payer,
+                    vec![&ctx.accounts.delegated_account.to_account_info()],
+                    &ctx.accounts.magic_context,
+                    &ctx.accounts.magic_program,
                 )?;
                 Ok(())
             }
@@ -74,35 +72,31 @@ fn generate_allow_undelegate() -> (TokenStream2, TokenStream2) {
         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>,
+            pub struct Undelegate<'info> {
                 #[account(mut)]
-                /// CHECK: delegation metadata
-                pub delegation_metadata: AccountInfo<'info>,
-                #[account()]
-                /// CHECK: singer buffer to enforce CPI
-                pub buffer: AccountInfo<'info>,
+                pub payer: Signer<'info>,
+                #[account(mut)]
+                /// CHECK: The delegated component
+                pub delegated_account: AccountInfo<'info>,
+                #[account(mut, address = ::bolt_lang::MAGIC_CONTEXT_ID)]
+                /// CHECK:`
+                pub magic_context: AccountInfo<'info>,
                 #[account()]
                 /// CHECK:`
-                pub delegation_program: AccountInfo<'info>,
+                pub magic_program: Program<'info, MagicProgram>
             }
         },
     )
 }
 
 /// Generates the undelegate function and struct.
-fn generate_undelegate() -> (TokenStream2, TokenStream2) {
+fn generate_reinit_after_undelegate() -> (TokenStream2, TokenStream2) {
     (
         quote! {
             #[automatically_derived]
             pub fn process_undelegation(ctx: Context<InitializeAfterUndelegation>, account_seeds: Vec<Vec<u8>>) -> Result<()> {
                 let [delegated_account, buffer, payer, system_program] = [
-                    &ctx.accounts.base_account,
+                    &ctx.accounts.delegated_account,
                     &ctx.accounts.buffer,
                     &ctx.accounts.payer,
                     &ctx.accounts.system_program,
@@ -124,7 +118,7 @@ fn generate_undelegate() -> (TokenStream2, TokenStream2) {
             pub struct InitializeAfterUndelegation<'info> {
                 /// CHECK:`
                 #[account(mut)]
-                pub base_account: AccountInfo<'info>,
+                pub delegated_account: AccountInfo<'info>,
                 /// CHECK:`
                 #[account()]
                 pub buffer: AccountInfo<'info>,

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

@@ -20,7 +20,10 @@ pub use world;
 pub use world::program::World;
 pub use world::Entity;
 
-pub use delegation_program_sdk::{allow_undelegation, delegate_account, undelegate_account};
+pub use ephemeral_rollups_sdk::cpi::{delegate_account, undelegate_account};
+pub use ephemeral_rollups_sdk::ephem::{commit_and_undelegate_accounts};
+pub use ephemeral_rollups_sdk::anchor::{DelegationProgram, MagicProgram};
+pub use ephemeral_rollups_sdk::consts::{MAGIC_PROGRAM_ID, MAGIC_CONTEXT_ID};
 
 pub use serde;
 

+ 3 - 3
crates/types/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "bolt-types"
-version = "0.1.4"
+version = "0.1.6"
 description = "Autogenerate types for the bolt language"
 edition = "2021"
 
@@ -9,5 +9,5 @@ crate-type = ["cdylib", "lib"]
 name = "bolt_types"
 
 [dependencies]
-bolt-lang = { path = "../../crates/bolt-lang" }
-anchor-lang = { version = "0.30.1" }
+bolt-lang = "0.1.6"
+anchor-lang = "0.30.1"

+ 0 - 4
crates/types/src/component_Fn1JzzEdyb55fsyduWS94mYHizGhJZuhvjX6DVvrmGbQ.rs

@@ -9,7 +9,3 @@ pub struct ComponentFn1JzzEdyb55fsyduWS94mYHizGhJZuhvjX6DVvrmGbQ {
 
 pub use ComponentFn1JzzEdyb55fsyduWS94mYHizGhJZuhvjX6DVvrmGbQ as Position;
 
-#[component_deserialize]
-pub struct Entity {
-    pub id: u64,
-}

+ 1 - 1
examples/system-simple-movement/Cargo.toml

@@ -24,4 +24,4 @@ idl-build = ["anchor-lang/idl-build"]
 anchor-lang = { workspace = true }
 serde = { workspace = true }
 bolt-lang = { path = "../../crates/bolt-lang" }
-bolt-types = { version = "0.1.4", path = "../../crates/types" }
+bolt-types = { version = "0.1.6", path = "../../crates/types" }

+ 1 - 22
tests/bolt.ts

@@ -510,7 +510,7 @@ describe("bolt", () => {
     const txSign = await provider.sendAndConfirm(
       delegateComponent.transaction,
       [],
-      { skipPreflight: true, commitment: "finalized" }
+      { skipPreflight: true, commitment: "confirmed" }
     );
     console.log(`Delegation signature: ${txSign}`);
     const acc = await provider.connection.getAccountInfo(
@@ -518,25 +518,4 @@ describe("bolt", () => {
     );
     expect(acc.owner.toString()).to.equal(DELEGATION_PROGRAM_ID);
   });
-
-  it("Check component undelegation", async () => {
-    const allowUndelegateIx = createAllowUndelegationInstruction({
-      delegatedAccount: componentPositionEntity1Pda,
-      ownerProgram: exampleComponentPosition.programId,
-    });
-    const delegateIx = createUndelegateInstruction({
-      payer: provider.wallet.publicKey,
-      delegatedAccount: componentPositionEntity1Pda,
-      ownerProgram: exampleComponentPosition.programId,
-      reimbursement: provider.wallet.publicKey,
-    });
-    const tx = new anchor.web3.Transaction()
-      .add(allowUndelegateIx)
-      .add(delegateIx);
-    await provider.sendAndConfirm(tx);
-    const acc = await provider.connection.getAccountInfo(
-      componentPositionEntity1Pda
-    );
-    expect(acc.owner).to.deep.equal(exampleComponentPosition.programId);
-  });
 });

BIN
tests/fixtures/delegation.so