skynetcap / solanaj Goto Github PK
View Code? Open in Web Editor NEWSolana RPC client written in Java
License: MIT License
Solana RPC client written in Java
License: MIT License
// deserialize the transaction
const swapTransactionBuf = Buffer.from(swapTransaction, 'base64');
var transaction = VersionedTransaction.deserialize(swapTransactionBuf);
console.log(transaction);
// sign the transaction
transaction.sign([wallet.payer]);
// Execute the transaction
const rawTransaction = transaction.serialize()
const txid = await connection.sendRawTransaction(rawTransaction, {
skipPreflight: true,
maxRetries: 2
});
await connection.confirmTransaction(txid);
console.log(https://solscan.io/tx/${txid}
);
https://station.jup.ag/docs/apis/swap-api
How to achieve it?
Using the Java version of Solanaj, the public key addresses generated by importing private keys exported from Phantom Wallet and Okx Web3 Wallet are the same, while the public key addresses generated by importing mnemonics exported from Phantom Wallet and Okx Web3 Wallet are different? May I ask what the problem is? How should we solve it?
var transaction = VersionedTransaction.deserialize(swapTransactionBuf);
How to implement it in Java?
I'm trying to use this library for experimenting, but I cannot get it to work with maven given that there are not packages published. 😅
Is there a plan to publish the builds? 🤔
public ConfirmedTransaction getTransaction(String signature, Commitment commitment) throws RpcException {
List params = new ArrayList<>();
params.add(signature);
Map<String, Object> parameterMap = new HashMap<>();
if (commitment != null) {
parameterMap.put("commitment", commitment); //update parameterMap.put("commitment", commitment.getValue());
}
parameterMap.put("maxSupportedTransactionVersion", 0);
params.add(parameterMap);
return client.call("getTransaction", params, ConfirmedTransaction.class);
}
how do use proxy in RpcClient?
org.p2p.solanaj.programs.AssociatedTokenProgram
keys.add(new AccountMeta(walletAddress, false, false));
Is there any implementation of the createAssociatedTokenAccountInstruction method? I can’t seem to find it under TokenProgram
Help! To create a token address and call the 'SystemProgram.createAccount' method, what is the meaning of the parameters?
help! 创建token地址调用 'SystemProgram.createAccount' 方法, 参数的意义是什么?
public static TransactionInstruction createAccount(PublicKey fromPublicKey, PublicKey newAccountPublikkey,
long lamports, long space, PublicKey programId)
Requirements:
Architecture:
APIs:
GetProgramAccounts:
dataSize = 0
org.p2p.solanaj.rpc.RpcException: Transaction version (0) is not supported by the requesting client. Please try the request again with the following configuration parameter: "maxSupportedTransactionVersion": 0
at org.p2p.solanaj.rpc.RpcClient.call(RpcClient.java:88)
at org.p2p.solanaj.rpc.RpcApi.getBlock(RpcApi.java:522)
We currently use a poorly-coded library called Java-Websocket, instead of the highly battle tested OkHttp. OkHttp supports websockets. Use OkHttp, and remove the original dependency.
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.p2p.solanaj.rpc.types.RecentBlockhash$Value.getBlockhash()' on a null object reference
at org.p2p.solanaj.rpc.RpcApi.getRecentBlockhash(RpcApi.java:47)
at org.p2p.solanaj.rpc.RpcApi.getRecentBlockhash(RpcApi.java:37)
at org.p2p.solanaj.rpc.RpcApi.sendTransaction(RpcApi.java:62)
at org.p2p.solanaj.rpc.RpcApi.sendTransaction(RpcApi.java:56)
I want to build the instruction for swapping on DEX Orca.
I don't understand how to build data
for SystemProgram.createTransactionInstruction
.
If someone can help me with this, or has any useful link.
Thank you.
I am trying on Solana Testnet, and when I use getBlock() method I got Json parsing exception.
public enum RewardType {
/*FEE, RENT, VOTING, STAKING*/
Fee, Rent, Voting, Staking
}
exception occurs because of upper case and when I change like this it works.
Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.