Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions clients/csharp/Solana.Unity.Bolt/WorldProgram/Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public class ApplyAccounts

public PublicKey Authority { get; set; }

public PublicKey InstructionSysvarAccount { get; set; } = new PublicKey("Sysvar1nstructions1111111111111111111111111");
public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
public PublicKey World { get; set; }
}

Expand All @@ -287,7 +287,7 @@ public class ApplyWithSessionAccounts

public PublicKey Authority { get; set; }

public PublicKey InstructionSysvarAccount { get; set; } = new PublicKey("Sysvar1nstructions1111111111111111111111111");
public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
public PublicKey World { get; set; }

public PublicKey SessionToken { get; set; }
Expand Down Expand Up @@ -318,7 +318,7 @@ public class DestroyComponentAccounts

public PublicKey Component { get; set; }

public PublicKey InstructionSysvarAccount { get; set; } = new PublicKey("Sysvar1nstructions1111111111111111111111111");
public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
}

Expand All @@ -334,7 +334,7 @@ public class InitializeComponentAccounts

public PublicKey Authority { get; set; }

public PublicKey InstructionSysvarAccount { get; set; } = new PublicKey("Sysvar1nstructions1111111111111111111111111");
public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
}

Expand Down Expand Up @@ -432,7 +432,7 @@ public static Solana.Unity.Rpc.Models.TransactionInstruction Apply(ApplyAccounts
{
programId ??= new(ID);
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.BoltSystem, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.InstructionSysvarAccount, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.World, false)};
{Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.BoltSystem, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.World, false)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(16258613031726085112UL, offset);
Expand All @@ -450,7 +450,7 @@ public static Solana.Unity.Rpc.Models.TransactionInstruction ApplyWithSession(Ap
{
programId ??= new(ID);
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.BoltSystem, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.InstructionSysvarAccount, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SessionToken, false)};
{Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.BoltSystem, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SessionToken, false)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(7459768094276011477UL, offset);
Expand Down Expand Up @@ -482,7 +482,7 @@ public static Solana.Unity.Rpc.Models.TransactionInstruction DestroyComponent(De
{
programId ??= new(ID);
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Receiver, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgram, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgramData, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Entity, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Component, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.InstructionSysvarAccount, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
{Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Receiver, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgram, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgramData, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Entity, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Component, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(5321952129328727336UL, offset);
Expand All @@ -496,7 +496,7 @@ public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeComponent
{
programId ??= new(ID);
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
{Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Data, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Entity, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgram, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.InstructionSysvarAccount, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
{Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Data, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Entity, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgram, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(2179155133888827172UL, offset);
Expand Down
16 changes: 6 additions & 10 deletions clients/typescript/src/generated/idl/world.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"address": "A61GccEkeYiQeRM5HbQW5SZwiicoPjFJaRcLt22qSnhP",
"address": "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n",
"metadata": {
"name": "world",
"version": "0.2.3",
"version": "0.2.4",
"spec": "0.1.0",
"description": "Bolt World program",
"repository": "https://github.com/magicblock-labs/bolt"
Expand Down Expand Up @@ -124,8 +124,7 @@
"signer": true
},
{
"name": "instruction_sysvar_account",
"address": "Sysvar1nstructions1111111111111111111111111"
"name": "cpi_auth"
},
{
"name": "world"
Expand Down Expand Up @@ -159,8 +158,7 @@
"signer": true
},
{
"name": "instruction_sysvar_account",
"address": "Sysvar1nstructions1111111111111111111111111"
"name": "cpi_auth"
},
{
"name": "world"
Expand Down Expand Up @@ -244,8 +242,7 @@
"writable": true
},
{
"name": "instruction_sysvar_account",
"address": "Sysvar1nstructions1111111111111111111111111"
"name": "cpi_auth"
},
{
"name": "system_program",
Expand Down Expand Up @@ -286,8 +283,7 @@
"name": "authority"
},
{
"name": "instruction_sysvar_account",
"address": "Sysvar1nstructions1111111111111111111111111"
"name": "cpi_auth"
},
{
"name": "system_program",
Expand Down
5 changes: 2 additions & 3 deletions clients/typescript/src/generated/instructions/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import { CPI_AUTH_ADDRESS } from "../../world/transactions";

/**
* @category Instructions
Expand Down Expand Up @@ -39,7 +40,6 @@ export const applyStruct = new beet.FixableBeetArgsStruct<
* @property [] boltSystem
* @property [_writable_] boltComponent
* @property [] authority
* @property [] instructionSysvarAccount
* @category Instructions
* @category Apply
* @category generated
Expand All @@ -49,7 +49,6 @@ export interface ApplyInstructionAccounts {
boltSystem: web3.PublicKey;
boltComponent: web3.PublicKey;
authority: web3.PublicKey;
instructionSysvarAccount: web3.PublicKey;
world: web3.PublicKey;
anchorRemainingAccounts?: web3.AccountMeta[];
}
Expand Down Expand Up @@ -99,7 +98,7 @@ export function createApplyInstruction(
isSigner: false,
},
{
pubkey: accounts.instructionSysvarAccount,
pubkey: CPI_AUTH_ADDRESS,
isWritable: false,
isSigner: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import * as beet from "@metaplex-foundation/beet";
import * as web3 from "@solana/web3.js";
import { CPI_AUTH_ADDRESS } from "../../world/transactions";

/**
* @category Instructions
Expand All @@ -27,7 +28,7 @@ export const initializeComponentStruct = new beet.BeetArgsStruct<{
* @property [] entity
* @property [] componentProgram
* @property [] authority
* @property [] instructionSysvarAccount
* @property [] cpiAuth
* @category Instructions
* @category InitializeComponent
* @category generated
Expand All @@ -38,7 +39,6 @@ export interface InitializeComponentInstructionAccounts {
entity: web3.PublicKey;
componentProgram: web3.PublicKey;
authority: web3.PublicKey;
instructionSysvarAccount: web3.PublicKey;
systemProgram?: web3.PublicKey;
anchorRemainingAccounts?: web3.AccountMeta[];
}
Expand Down Expand Up @@ -89,7 +89,7 @@ export function createInitializeComponentInstruction(
isSigner: false,
},
{
pubkey: accounts.instructionSysvarAccount,
pubkey: CPI_AUTH_ADDRESS,
isWritable: false,
isSigner: false,
},
Expand Down
14 changes: 5 additions & 9 deletions clients/typescript/src/generated/types/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type World = {
address: "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n";
metadata: {
name: "world";
version: "0.2.3";
version: "0.2.4";
spec: "0.1.0";
description: "Bolt World program";
repository: "https://github.com/magicblock-labs/bolt";
Expand Down Expand Up @@ -97,8 +97,7 @@ export type World = {
signer: true;
},
{
name: "instructionSysvarAccount";
address: "Sysvar1nstructions1111111111111111111111111";
name: "cpiAuth";
},
{
name: "world";
Expand All @@ -123,8 +122,7 @@ export type World = {
signer: true;
},
{
name: "instructionSysvarAccount";
address: "Sysvar1nstructions1111111111111111111111111";
name: "cpiAuth";
},
{
name: "world";
Expand Down Expand Up @@ -190,8 +188,7 @@ export type World = {
writable: true;
},
{
name: "instructionSysvarAccount";
address: "Sysvar1nstructions1111111111111111111111111";
name: "cpiAuth";
},
{
name: "systemProgram";
Expand Down Expand Up @@ -223,8 +220,7 @@ export type World = {
name: "authority";
},
{
name: "instructionSysvarAccount";
address: "Sysvar1nstructions1111111111111111111111111";
name: "cpiAuth";
},
{
name: "systemProgram";
Expand Down
10 changes: 8 additions & 2 deletions clients/typescript/src/world/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
BN,
FindComponentProgramDataPda,
} from "../index";
import type web3 from "@solana/web3.js";
import web3 from "@solana/web3.js";
import {
type Connection,
Keypair,
Expand All @@ -34,6 +34,10 @@ import {
} from "../generated";
import { type Idl, Program } from "@coral-xyz/anchor";

export const CPI_AUTH_ADDRESS = new web3.PublicKey(
"B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi",
);

export async function InitializeRegistry({
payer,
connection,
Expand Down Expand Up @@ -371,6 +375,7 @@ export async function DestroyComponent({
componentProgram,
componentProgramData,
receiver,
cpiAuth: CPI_AUTH_ADDRESS,
})
.instruction();
const transaction = new Transaction().add(instruction);
Expand Down Expand Up @@ -416,7 +421,6 @@ export async function InitializeComponent({
data: componentPda,
componentProgram: componentId,
authority: authority ?? PROGRAM_ID,
instructionSysvarAccount: SYSVAR_INSTRUCTIONS_PUBKEY,
anchorRemainingAccounts,
});
const transaction = new Transaction().add(instruction);
Expand Down Expand Up @@ -503,6 +507,7 @@ async function createApplySystemInstruction({
boltSystem: systemId,
sessionToken: session.token,
world,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts(remainingAccounts)
.instruction();
Expand All @@ -513,6 +518,7 @@ async function createApplySystemInstruction({
authority: authority ?? PROGRAM_ID,
boltSystem: systemId,
world,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts(remainingAccounts)
.instruction();
Expand Down
12 changes: 12 additions & 0 deletions clients/typescript/test/low-level/ecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
FindComponentProgramDataPda,
FindEntityPda,
SerializeArgs,
CPI_AUTH_ADDRESS,
} from "../../lib";
import { Direction } from "../framework";

Expand Down Expand Up @@ -104,6 +105,7 @@ export function ecs(framework) {
data: framework.componentVelocityEntity1Pda,
componentProgram: componentId,
authority: framework.provider.wallet.publicKey,
cpiAuth: CPI_AUTH_ADDRESS,
})
.instruction();
const transaction = new anchor.web3.Transaction().add(instruction);
Expand All @@ -124,6 +126,7 @@ export function ecs(framework) {
data: framework.componentPositionEntity1Pda,
componentProgram: componentId,
authority: framework.worldProgram.programId,
cpiAuth: CPI_AUTH_ADDRESS,
})
.instruction();
const transaction = new anchor.web3.Transaction().add(instruction);
Expand All @@ -144,6 +147,7 @@ export function ecs(framework) {
data: componentPda,
componentProgram: componentId,
authority: framework.worldProgram.programId,
cpiAuth: CPI_AUTH_ADDRESS,
})
.instruction();
const transaction = new anchor.web3.Transaction().add(instruction);
Expand All @@ -164,6 +168,7 @@ export function ecs(framework) {
data: framework.componentPositionEntity4Pda,
componentProgram: componentId,
authority: framework.worldProgram.programId,
cpiAuth: CPI_AUTH_ADDRESS,
})
.instruction();
const transaction = new anchor.web3.Transaction().add(instruction);
Expand All @@ -187,6 +192,7 @@ export function ecs(framework) {
authority: framework.provider.wallet.publicKey,
boltSystem: framework.systemSimpleMovement.programId,
world: framework.worldPda,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts([
{
Expand Down Expand Up @@ -221,6 +227,7 @@ export function ecs(framework) {
authority: framework.provider.wallet.publicKey,
boltSystem: framework.systemSimpleMovement.programId,
world: framework.worldPda,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts([
{
Expand Down Expand Up @@ -254,6 +261,7 @@ export function ecs(framework) {
authority: framework.provider.wallet.publicKey,
boltSystem: framework.systemFly.programId,
world: framework.worldPda,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts([
{
Expand Down Expand Up @@ -287,6 +295,7 @@ export function ecs(framework) {
authority: framework.provider.wallet.publicKey,
boltSystem: framework.systemApplyVelocity.programId,
world: framework.worldPda,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts([
{
Expand Down Expand Up @@ -339,6 +348,7 @@ export function ecs(framework) {
authority: framework.provider.wallet.publicKey,
boltSystem: framework.systemApplyVelocity.programId,
world: framework.worldPda,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts([
{
Expand Down Expand Up @@ -394,6 +404,7 @@ export function ecs(framework) {
authority: framework.provider.wallet.publicKey,
boltSystem: framework.systemFly.programId,
world: framework.worldPda,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts([
{
Expand Down Expand Up @@ -440,6 +451,7 @@ export function ecs(framework) {
component: framework.componentVelocityEntity1Pda,
componentProgramData: componentProgramData,
receiver: keypair.publicKey,
cpiAuth: CPI_AUTH_ADDRESS,
})
.instruction();
const transaction = new anchor.web3.Transaction().add(instruction);
Expand Down
Loading