Skip to content

Transaction failed to sanitize accounts offsets correctly #23

@oriana13

Description

@oriana13

Good morning ! First of all thank you very much for this project! But I have a small question, I wanted to test a transaction but it sends me an error, I don't know where it can come from, can you help me? Thank you :)

package org.p2p.solanaj;

import java.nio.charset.StandardCharsets;

import org.p2p.solanaj.core.Account;
import org.p2p.solanaj.core.PublicKey;
import org.p2p.solanaj.core.Transaction;
import org.p2p.solanaj.programs.SystemProgram;
import org.p2p.solanaj.rpc.Cluster;
import org.p2p.solanaj.rpc.RpcClient;

public class app {
    public static void main(String[] args) throws Exception {
        RpcClient client = new RpcClient(Cluster.TESTNET);

        PublicKey fromPublicKey = new PublicKey("7qZdRkPfAXr8dya3Ui5zaMNVR1u5yScTYC2nrU4zoqhq");
        PublicKey toPublickKey = new PublicKey("CagvN2fgcgWBCSYZ7UgdeY7Rx7vMRj3tacBiCEuU8wPc");
        int lamports = 1000;

        String sKey = "*****************************************************************";
        byte[] secret = sKey.getBytes(StandardCharsets.UTF_8);

        Account signer = new Account(secret);

        Transaction transaction = new Transaction()
                .addInstruction(SystemProgram.transfer(fromPublicKey, toPublickKey, lamports));

        String signature = client.getApi().sendTransaction(transaction, signer);

        System.out.println(signature);
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions