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 CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
public PublicKey InstructionSysvarAccount { get; set; } = new PublicKey("Sysvar1nstructions1111111111111111111111111");
public PublicKey World { get; set; }
}

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

public PublicKey Authority { get; set; }

public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
public PublicKey InstructionSysvarAccount { get; set; } = new PublicKey("Sysvar1nstructions1111111111111111111111111");
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 CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
public PublicKey InstructionSysvarAccount { get; set; } = new PublicKey("Sysvar1nstructions1111111111111111111111111");
public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
}

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

public PublicKey Authority { get; set; }

public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
public PublicKey InstructionSysvarAccount { get; set; } = new PublicKey("Sysvar1nstructions1111111111111111111111111");
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.CpiAuth, 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.InstructionSysvarAccount, 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.CpiAuth, 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.InstructionSysvarAccount, 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.CpiAuth, 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.InstructionSysvarAccount, 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.CpiAuth, 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.InstructionSysvarAccount, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
byte[] _data = new byte[1200];
int offset = 0;
_data.WriteU64(2179155133888827172UL, offset);
Expand Down
12 changes: 8 additions & 4 deletions clients/typescript/src/generated/idl/world.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@
"signer": true
},
{
"name": "cpi_auth"
"name": "instruction_sysvar_account",
"address": "Sysvar1nstructions1111111111111111111111111"
},
{
"name": "world"
Expand Down Expand Up @@ -158,7 +159,8 @@
"signer": true
},
{
"name": "cpi_auth"
"name": "instruction_sysvar_account",
"address": "Sysvar1nstructions1111111111111111111111111"
},
{
"name": "world"
Expand Down Expand Up @@ -242,7 +244,8 @@
"writable": true
},
{
"name": "cpi_auth"
"name": "instruction_sysvar_account",
"address": "Sysvar1nstructions1111111111111111111111111"
},
{
"name": "system_program",
Expand Down Expand Up @@ -283,7 +286,8 @@
"name": "authority"
},
{
"name": "cpi_auth"
"name": "instruction_sysvar_account",
"address": "Sysvar1nstructions1111111111111111111111111"
},
{
"name": "system_program",
Expand Down
5 changes: 3 additions & 2 deletions clients/typescript/src/generated/instructions/apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

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 @@ -40,6 +39,7 @@ export const applyStruct = new beet.FixableBeetArgsStruct<
* @property [] boltSystem
* @property [_writable_] boltComponent
* @property [] authority
* @property [] instructionSysvarAccount
* @category Instructions
* @category Apply
* @category generated
Expand All @@ -49,6 +49,7 @@ 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 @@ -98,7 +99,7 @@ export function createApplyInstruction(
isSigner: false,
},
{
pubkey: CPI_AUTH_ADDRESS,
pubkey: accounts.instructionSysvarAccount,
isWritable: false,
isSigner: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

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 @@ -28,7 +27,7 @@ export const initializeComponentStruct = new beet.BeetArgsStruct<{
* @property [] entity
* @property [] componentProgram
* @property [] authority
* @property [] cpiAuth
* @property [] instructionSysvarAccount
* @category Instructions
* @category InitializeComponent
* @category generated
Expand All @@ -39,6 +38,7 @@ 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: CPI_AUTH_ADDRESS,
pubkey: accounts.instructionSysvarAccount,
isWritable: false,
isSigner: false,
},
Expand Down
12 changes: 8 additions & 4 deletions clients/typescript/src/generated/types/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export type World = {
signer: true;
},
{
name: "cpiAuth";
name: "instructionSysvarAccount";
address: "Sysvar1nstructions1111111111111111111111111";
},
{
name: "world";
Expand All @@ -122,7 +123,8 @@ export type World = {
signer: true;
},
{
name: "cpiAuth";
name: "instructionSysvarAccount";
address: "Sysvar1nstructions1111111111111111111111111";
},
{
name: "world";
Expand Down Expand Up @@ -188,7 +190,8 @@ export type World = {
writable: true;
},
{
name: "cpiAuth";
name: "instructionSysvarAccount";
address: "Sysvar1nstructions1111111111111111111111111";
},
{
name: "systemProgram";
Expand Down Expand Up @@ -220,7 +223,8 @@ export type World = {
name: "authority";
},
{
name: "cpiAuth";
name: "instructionSysvarAccount";
address: "Sysvar1nstructions1111111111111111111111111";
},
{
name: "systemProgram";
Expand Down
10 changes: 2 additions & 8 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 web3 from "@solana/web3.js";
import type web3 from "@solana/web3.js";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Invalid TS type import for @solana/web3.js (breaks types like web3.PublicKey)

There is no default export. Use a type namespace import.

Apply this diff:

-import type web3 from "@solana/web3.js";
+import type * as web3 from "@solana/web3.js";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import type web3 from "@solana/web3.js";
import type * as web3 from "@solana/web3.js";
🤖 Prompt for AI Agents
In clients/typescript/src/world/transactions.ts around line 21, the current line
uses an invalid default type import "import type web3 from '@solana/web3.js'";
replace it with a type namespace import so named exports like web3.PublicKey
work correctly: change to "import type * as web3 from '@solana/web3.js'". Ensure
any subsequent type references remain qualified (web3.PublicKey,
web3.Transaction, etc.).

import {
type Connection,
Keypair,
Expand All @@ -34,10 +34,6 @@ 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 @@ -375,7 +371,6 @@ export async function DestroyComponent({
componentProgram,
componentProgramData,
receiver,
cpiAuth: CPI_AUTH_ADDRESS,
})
.instruction();
const transaction = new Transaction().add(instruction);
Expand Down Expand Up @@ -421,6 +416,7 @@ 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 @@ -507,7 +503,6 @@ async function createApplySystemInstruction({
boltSystem: systemId,
sessionToken: session.token,
world,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts(remainingAccounts)
.instruction();
Expand All @@ -518,7 +513,6 @@ async function createApplySystemInstruction({
authority: authority ?? PROGRAM_ID,
boltSystem: systemId,
world,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts(remainingAccounts)
.instruction();
Expand Down
12 changes: 0 additions & 12 deletions clients/typescript/test/low-level/ecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
FindComponentProgramDataPda,
FindEntityPda,
SerializeArgs,
CPI_AUTH_ADDRESS,
} from "../../lib";
import { Direction } from "../framework";

Expand Down Expand Up @@ -105,7 +104,6 @@ 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 @@ -126,7 +124,6 @@ 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 @@ -147,7 +144,6 @@ 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 @@ -168,7 +164,6 @@ 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 @@ -192,7 +187,6 @@ 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 @@ -227,7 +221,6 @@ 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 @@ -261,7 +254,6 @@ 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 @@ -295,7 +287,6 @@ 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 @@ -348,7 +339,6 @@ 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 @@ -404,7 +394,6 @@ 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 @@ -451,7 +440,6 @@ 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
4 changes: 0 additions & 4 deletions clients/typescript/test/low-level/permissioning/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
FindEntityPda,
FindComponentPda,
SerializeArgs,
CPI_AUTH_ADDRESS,
} from "../../../lib";
import { assert, expect } from "chai";

Expand Down Expand Up @@ -47,7 +46,6 @@ export function component(framework) {
data: component,
componentProgram: componentId,
authority: framework.provider.wallet.publicKey,
cpiAuth: CPI_AUTH_ADDRESS,
})
.instruction();
const transaction = new anchor.web3.Transaction().add(instruction);
Expand All @@ -68,7 +66,6 @@ export function component(framework) {
authority: keypair.publicKey,
boltSystem: framework.systemFly.programId,
world: framework.worldPda,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts([
{
Expand Down Expand Up @@ -118,7 +115,6 @@ export function component(framework) {
authority: framework.provider.wallet.publicKey,
boltSystem: framework.systemFly.programId,
world: framework.worldPda,
cpiAuth: CPI_AUTH_ADDRESS,
})
.remainingAccounts([
{
Expand Down
Loading
Loading