Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction failed to sanitize accounts offsets correctly #23

Open
oriana13 opened this issue Apr 6, 2022 · 0 comments
Open

Transaction failed to sanitize accounts offsets correctly #23

oriana13 opened this issue Apr 6, 2022 · 0 comments

Comments

@oriana13
Copy link

oriana13 commented Apr 6, 2022

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);
    }

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant