|
@@ -3,6 +3,7 @@ import {
|
|
anchor,
|
|
anchor,
|
|
web3,
|
|
web3,
|
|
FindComponentPda,
|
|
FindComponentPda,
|
|
|
|
+ FindComponentProgramDataPda,
|
|
FindEntityPda,
|
|
FindEntityPda,
|
|
SerializeArgs,
|
|
SerializeArgs,
|
|
} from "../../clients/bolt-sdk/lib";
|
|
} from "../../clients/bolt-sdk/lib";
|
|
@@ -102,7 +103,7 @@ export function ecs(framework) {
|
|
entity: framework.entity1Pda,
|
|
entity: framework.entity1Pda,
|
|
data: framework.componentVelocityEntity1Pda,
|
|
data: framework.componentVelocityEntity1Pda,
|
|
componentProgram: componentId,
|
|
componentProgram: componentId,
|
|
- authority: framework.worldProgram.programId,
|
|
|
|
|
|
+ authority: framework.provider.wallet.publicKey,
|
|
})
|
|
})
|
|
.instruction();
|
|
.instruction();
|
|
const transaction = new anchor.web3.Transaction().add(instruction);
|
|
const transaction = new anchor.web3.Transaction().add(instruction);
|
|
@@ -186,7 +187,6 @@ export function ecs(framework) {
|
|
authority: framework.provider.wallet.publicKey,
|
|
authority: framework.provider.wallet.publicKey,
|
|
boltSystem: framework.systemSimpleMovement.programId,
|
|
boltSystem: framework.systemSimpleMovement.programId,
|
|
world: framework.worldPda,
|
|
world: framework.worldPda,
|
|
- sessionToken: null,
|
|
|
|
})
|
|
})
|
|
.remainingAccounts([
|
|
.remainingAccounts([
|
|
{
|
|
{
|
|
@@ -221,7 +221,6 @@ export function ecs(framework) {
|
|
authority: framework.provider.wallet.publicKey,
|
|
authority: framework.provider.wallet.publicKey,
|
|
boltSystem: framework.systemSimpleMovement.programId,
|
|
boltSystem: framework.systemSimpleMovement.programId,
|
|
world: framework.worldPda,
|
|
world: framework.worldPda,
|
|
- sessionToken: null,
|
|
|
|
})
|
|
})
|
|
.remainingAccounts([
|
|
.remainingAccounts([
|
|
{
|
|
{
|
|
@@ -255,7 +254,6 @@ export function ecs(framework) {
|
|
authority: framework.provider.wallet.publicKey,
|
|
authority: framework.provider.wallet.publicKey,
|
|
boltSystem: framework.systemFly.programId,
|
|
boltSystem: framework.systemFly.programId,
|
|
world: framework.worldPda,
|
|
world: framework.worldPda,
|
|
- sessionToken: null,
|
|
|
|
})
|
|
})
|
|
.remainingAccounts([
|
|
.remainingAccounts([
|
|
{
|
|
{
|
|
@@ -289,7 +287,6 @@ export function ecs(framework) {
|
|
authority: framework.provider.wallet.publicKey,
|
|
authority: framework.provider.wallet.publicKey,
|
|
boltSystem: framework.systemApplyVelocity.programId,
|
|
boltSystem: framework.systemApplyVelocity.programId,
|
|
world: framework.worldPda,
|
|
world: framework.worldPda,
|
|
- sessionToken: null,
|
|
|
|
})
|
|
})
|
|
.remainingAccounts([
|
|
.remainingAccounts([
|
|
{
|
|
{
|
|
@@ -342,7 +339,6 @@ export function ecs(framework) {
|
|
authority: framework.provider.wallet.publicKey,
|
|
authority: framework.provider.wallet.publicKey,
|
|
boltSystem: framework.systemApplyVelocity.programId,
|
|
boltSystem: framework.systemApplyVelocity.programId,
|
|
world: framework.worldPda,
|
|
world: framework.worldPda,
|
|
- sessionToken: null,
|
|
|
|
})
|
|
})
|
|
.remainingAccounts([
|
|
.remainingAccounts([
|
|
{
|
|
{
|
|
@@ -398,7 +394,6 @@ export function ecs(framework) {
|
|
authority: framework.provider.wallet.publicKey,
|
|
authority: framework.provider.wallet.publicKey,
|
|
boltSystem: framework.systemFly.programId,
|
|
boltSystem: framework.systemFly.programId,
|
|
world: framework.worldPda,
|
|
world: framework.worldPda,
|
|
- sessionToken: null,
|
|
|
|
})
|
|
})
|
|
.remainingAccounts([
|
|
.remainingAccounts([
|
|
{
|
|
{
|
|
@@ -424,5 +419,36 @@ export function ecs(framework) {
|
|
expect(position.y.toNumber()).to.equal(0);
|
|
expect(position.y.toNumber()).to.equal(0);
|
|
expect(position.z.toNumber()).to.equal(1);
|
|
expect(position.z.toNumber()).to.equal(1);
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ it("Destroy Velocity Component on Entity 1", async () => {
|
|
|
|
+ const keypair = web3.Keypair.generate();
|
|
|
|
+
|
|
|
|
+ let componentBalance = await framework.provider.connection.getBalance(
|
|
|
|
+ framework.componentVelocityEntity1Pda,
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ const componentProgramData = FindComponentProgramDataPda({
|
|
|
|
+ programId: framework.exampleComponentVelocity.programId,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ const instruction = await framework.worldProgram.methods
|
|
|
|
+ .destroyComponent()
|
|
|
|
+ .accounts({
|
|
|
|
+ authority: framework.provider.wallet.publicKey,
|
|
|
|
+ componentProgram: framework.exampleComponentVelocity.programId,
|
|
|
|
+ entity: framework.entity1Pda,
|
|
|
|
+ component: framework.componentVelocityEntity1Pda,
|
|
|
|
+ componentProgramData: componentProgramData,
|
|
|
|
+ receiver: keypair.publicKey,
|
|
|
|
+ })
|
|
|
|
+ .instruction();
|
|
|
|
+ const transaction = new anchor.web3.Transaction().add(instruction);
|
|
|
|
+ await framework.provider.sendAndConfirm(transaction);
|
|
|
|
+
|
|
|
|
+ const balance = await framework.provider.connection.getBalance(
|
|
|
|
+ keypair.publicKey,
|
|
|
|
+ );
|
|
|
|
+ expect(balance).to.equal(componentBalance);
|
|
|
|
+ });
|
|
});
|
|
});
|
|
}
|
|
}
|