Upgrade using ABI

Step 1: Create a Solana Account

First, create a Solana account that will be used to control the Ethereum account.

Step 2: Create the Corresponding Ethereum Account

You need to use a Solana account to send messages to the Ethereum contract through the Solana program.

import { ethers } from "hardhat";
import { PublicKey } from "@solana/web3.js";
import { coder } from "your-coder-library"; // Example placeholder

const solanaAddress = new PublicKey("your-solana-account").toBytes();
const sourceAddress = coder.encode(["bytes32"], [Buffer.from(solanaAddress)]);
const payload = coder.encode(["bytes32", "bytes"], [sourceAddress, Buffer.from([0])]);

// Send message using the Solana program
const programID = new PublicKey("solana-program-address");
const program = new anchor.Program(idl, programID);
const message = hexStringToUint8Array(payload);

const ix3 = program.methods.sendMessage(Buffer.from(message)).accounts({
  config: realConfig,
  wormholeProgram: CORE_BRIDGE_PID,
  ...wormholeAccounts2,
}).instruction();

const tx3 = new Transaction().add(await ix3);

try {
  const commitment: Commitment = 'confirmed';
  await sendAndConfirmTransaction(provider.connection, tx3, [yourSolanaAccount], { commitment });
} catch (error) {
  console.error(error);
}

You can generate the payload as follows:

Step 3: Query the Generated Proxy Account

The Proxy address will be shown if you upgrade succseefullyo upgrade your account into a universal account, you should send

Last updated