Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 14 additions & 2 deletions packages/client/src/solanaEncode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
mint,
accounts = [],
}: EncodeOptions) => {
const connectedPdaAccount = new anchor.web3.PublicKey(connected);
const connectedProgramId = new anchor.web3.PublicKey(connected);
const [connectedPdaAccount] = anchor.web3.PublicKey.findProgramAddressSync(
[Buffer.from("connected", "utf-8")],
connectedProgramId
);
const [pdaAccount] = anchor.web3.PublicKey.findProgramAddressSync(
[Buffer.from("meta", "utf-8")],
new anchor.web3.PublicKey(gateway)
Expand All @@ -41,6 +45,13 @@
publicKey: ethers.hexlify(anchor.web3.SystemProgram.programId.toBytes()),
};

const instructionSysvar = {
isWritable: false,
publicKey: ethers.hexlify(

Check failure on line 50 in packages/client/src/solanaEncode.ts

View workflow job for this annotation

GitHub Actions / build

Replace `⏎······anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY.toBytes()⏎····` with `anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY.toBytes()`
anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY.toBytes()
),
};

let baseAccounts;
if (mint) {
const mintPubkey = new anchor.web3.PublicKey(mint);
Expand Down Expand Up @@ -72,9 +83,10 @@
gatewayPda,
tokenProgram,
systemProgram,
instructionSysvar,
];
} else {
baseAccounts = [pda, gatewayPda, systemProgram];
baseAccounts = [pda, gatewayPda, systemProgram, instructionSysvar];
}

// Parse additional accounts using our utility function
Expand Down
5 changes: 4 additions & 1 deletion packages/commands/src/solana/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const main = async (options: EncodeOptions) => {

export const encodeCommand = new Command("encode")
.summary("Encode payload data for Solana")
.requiredOption("--connected <address>", "Connected PDA account address")
.requiredOption(
"--connected <address>",
"Connected program address used to derive the PDA"
Copy link
Member

Choose a reason for hiding this comment

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

should be just Connected program address i think

Copy link
Member Author

Choose a reason for hiding this comment

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

)
.requiredOption("--data <data>", "Data to encode")
.requiredOption("--gateway <address>", "Gateway program address")
.option("--mint <address>", "Mint address for SPL token operations")
Expand Down
Loading