Skip to content

Commit 884f047

Browse files
committed
♻️ Removing bolt-component and bolt-system
1 parent 686f220 commit 884f047

File tree

24 files changed

+25
-358
lines changed

24 files changed

+25
-358
lines changed

.github/workflows/publish-bolt-crates.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ jobs:
180180
-p bolt-cli \
181181
-p bolt-lang \
182182
-p bolt-utils \
183-
-p bolt-system \
184-
-p bolt-component \
185183
-p bolt-attribute-bolt-arguments \
186184
-p bolt-attribute-bolt-bundle \
187185
-p bolt-attribute-bolt-component \

Anchor.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ skip-lint = false
88
world = "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n"
99

1010
[programs.localnet]
11-
bolt-component = "CmP2djJgABZ4cRokm4ndxuq6LerqpNHLBsaUv2XKEJua"
12-
bolt-system = "7X4EFsDJ5aYTcEjKzJ94rD8FRKgQeXC89fkpeTS4KaqP"
1311
component-small = "9yBADAhoTWCkNRB6hbfpwUgPpxyJiF9uEiWVPR6k7A4y"
1412
escrow-funding = "4Um2d8SvyfWyLLtfu2iJMFhM77DdjjyQusEy7K3VhPkd"
1513
example-bundle = "CgfPBUeDUL3GT6b5AUDFE56KKgU4ycWA9ERjEWsfMZCj"
@@ -37,7 +35,7 @@ cluster = "localnet"
3735
wallet = "./tests/fixtures/provider.json"
3836

3937
[workspace]
40-
members = ["crates/programs/bolt-component", "crates/programs/bolt-system", "crates/programs/world", "examples/component-position", "examples/component-velocity", "examples/system-apply-velocity", "examples/system-fly", "examples/system-simple-movement", "examples/component-small", "examples/system-with-1-component", "examples/system-with-2-components", "examples/system-with-3-components", "examples/system-with-4-components", "examples/system-with-5-components", "examples/system-with-6-components", "examples/system-with-7-components", "examples/system-with-8-components", "examples/system-with-9-components", "examples/system-with-10-components", "examples/escrow-funding", "examples/bundle"]
38+
members = ["crates/programs/world", "examples/component-position", "examples/component-velocity", "examples/system-apply-velocity", "examples/system-fly", "examples/system-simple-movement", "examples/component-small", "examples/system-with-1-component", "examples/system-with-2-components", "examples/system-with-3-components", "examples/system-with-4-components", "examples/system-with-5-components", "examples/system-with-6-components", "examples/system-with-7-components", "examples/system-with-8-components", "examples/system-with-9-components", "examples/system-with-10-components", "examples/escrow-funding", "examples/bundle"]
4139

4240
[scripts]
4341
test = "tests/script.sh"

Cargo.lock

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ resolver = "2"
33
members = [
44
"crates/bolt-cli",
55
"crates/bolt-lang",
6-
"crates/programs/bolt-component",
7-
"crates/programs/bolt-system",
86
"crates/programs/world",
97
"crates/types",
108
"examples/*",
@@ -34,8 +32,6 @@ bolt-attribute-bolt-component-deserialize = { path = "crates/bolt-lang/attribute
3432
bolt-attribute-bolt-component-id = { path = "crates/bolt-lang/attribute/component-id", version = "=0.2.6" }
3533
bolt-utils = { path = "crates/bolt-lang/utils", version = "=0.2.6" }
3634
world = { path = "crates/programs/world", features = ["cpi"], version = "=0.2.6"}
37-
bolt-system = { path = "crates/programs/bolt-system", features = ["cpi"], version = "=0.2.6"}
38-
bolt-component = { path = "crates/programs/bolt-component", features = ["cpi"], version = "=0.2.6"}
3935
component-large = { path = "examples/component-large", features = ["cpi"], version = "=0.2.6"}
4036
component-small = { path = "examples/component-small", features = ["cpi"], version = "=0.2.6"}
4137

clients/csharp/Solana.Unity.Bolt/WorldProgram/Bolt/ApplySystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static Solana.Unity.Rpc.Models.TransactionInstruction ApplySystem(
5151

5252
/// <summary>
5353
/// Apply a bundled system and/or bundled components by name, mirroring TS client behavior.
54-
/// - If systemId is a bundled System (program + name), we use "global:bolt_execute_{name}" discriminator.
54+
/// - If systemId is a bundled System (program + name), we use "global:{name}_bolt_execute" discriminator.
5555
/// - For each component, if provided as bundled Component (program + name), we:
5656
/// * use the component name as the PDA seed and
5757
/// * build the component-specific update discriminator (name + _update or _update_with_session).

clients/typescript/src/ecs/component.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ export class Component extends Identifier {
1313
: new Component(componentId);
1414
}
1515

16-
getMethodDiscriminator(method: string): string {
17-
return "global:" + (this.name ? this.name + "_" : "") + method;
18-
}
19-
2016
pda(entity: PublicKey, seed?: string): PublicKey {
2117
return FindComponentPda({
2218
componentId: this.program,

clients/typescript/src/ecs/identifier.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ export class Identifier {
88
this.program = program;
99
this.name = name;
1010
}
11+
12+
getMethodDiscriminator(method: string): string {
13+
return "global:" + (this.name ? this.name + "_" : "") + method;
14+
}
1115
}

clients/typescript/src/ecs/system.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { PublicKey } from "@solana/web3.js";
22
import { Identifier } from "./identifier";
33

44
export class System extends Identifier {
5-
constructor(program: PublicKey, name: string) {
5+
constructor(program: PublicKey, name?: string) {
66
super(program, name);
77
}
8+
9+
static from(systemId: PublicKey | System): System {
10+
return systemId instanceof System ? systemId : new System(systemId);
11+
}
812
}

clients/typescript/src/world/transactions.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ async function createApplySystemInstruction({
463463
extraAccounts,
464464
args,
465465
}: ApplySystemInstruction): Promise<web3.TransactionInstruction> {
466+
let system = System.from(systemId);
466467
const program = new Program(
467468
worldIdl as Idl,
468469
) as unknown as Program<WorldProgram>;
@@ -516,21 +517,14 @@ async function createApplySystemInstruction({
516517
// Build discriminators per component in order of remaining accounts pairs
517518
const discriminators: Buffer[] = components.map((component) =>
518519
Buffer.from(
519-
GetDiscriminator(
520-
"global:" +
521-
(component.name ? component.name + "_" : "") +
522-
(session ? "update_with_session" : "update"),
520+
Component.from(component.id).getMethodDiscriminator(
521+
session ? "update_with_session" : "update",
523522
),
524523
),
525524
);
526525

527526
const systemDiscriminator = Buffer.from(
528-
GetDiscriminator(
529-
"global:" +
530-
(systemId instanceof System
531-
? `bolt_execute_${systemId.name}`
532-
: "bolt_execute"),
533-
),
527+
system.getMethodDiscriminator("bolt_execute"),
534528
);
535529

536530
if (session)
@@ -542,7 +536,7 @@ async function createApplySystemInstruction({
542536
)
543537
.accounts({
544538
authority: authority ?? PROGRAM_ID,
545-
boltSystem: systemId instanceof System ? systemId.program : systemId,
539+
boltSystem: system.program,
546540
sessionToken: session.token,
547541
world,
548542
cpiAuth: CPI_AUTH_ADDRESS,
@@ -554,7 +548,7 @@ async function createApplySystemInstruction({
554548
.apply(systemDiscriminator, discriminators, SerializeArgs(args))
555549
.accounts({
556550
authority: authority ?? PROGRAM_ID,
557-
boltSystem: systemId instanceof System ? systemId.program : systemId,
551+
boltSystem: system.program,
558552
world,
559553
cpiAuth: CPI_AUTH_ADDRESS,
560554
})

clients/typescript/test/intermediate-level/ecs.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,7 @@ export function ecs(framework: Framework) {
161161
direction: Direction.Up,
162162
},
163163
});
164-
await framework.provider.sendAndConfirm(applySystem.transaction, [], {
165-
skipPreflight: true,
166-
});
164+
await framework.provider.sendAndConfirm(applySystem.transaction);
167165

168166
const position =
169167
await framework.exampleComponentPosition.account.position.fetch(

0 commit comments

Comments
 (0)