magicblock-labs / solana.unity-core Goto Github PK
View Code? Open in Web Editor NEWSolana's Unity SDK and integration library.
Home Page: https://solana.unity-sdk.gg
License: MIT License
Solana's Unity SDK and integration library.
Home Page: https://solana.unity-sdk.gg
License: MIT License
Is your feature request related to a problem? Please describe.
Missing getfeeformessage implementation
Note that SendTransactionAsync in SolanaRpcClient (Solana.Unity.Rpc/SolanaRpcClient.cs, line 985) doesn't add a "commitment" parameter to the outgoing request; it only adds the "preflightCommitment", which is a different parameter.
From the Solana docs: "For preflight checks and transaction processing," .... "The commitment parameter should be included as the last element in the params array"
https://docs.solana.com/developing/clients/jsonrpc-api
There is a HandleCommitment method (non-public) which conditionally adds a 'commitment' parameter with value to the Parameters collection. It isn't called in SendTransactionAsync, but it's called in similar methods.
Note that the only Commitment argument accepted by SendTransactionAsync is called "preflightCommitment", and it's used to set the preflightCommitment value. It might do to change that parameter to "commitment", and use it for both preflight commitment and commitment. Or else, add a second parameter for commitment.
I'm creating a pull request with the former (one parameter used for both preflight commitment and commitment)
Problem description
Describe the solution you'd like
Additional context
Solnet: https://github.com/bmresearch/Solnet
Is your feature request related to a problem? Please describe.
Versioned Transactions are not supported
Describe the solution you'd like
Implement a VersionedTransaction class, which follows web3.js versioned mechanism for serializing/deserializing versioned transanctions
Describe the bug
I wrote some simple code as the doc saids.
here is the code:
Mnemonic newMnemonic = new Mnemonic(WordList.English, WordCount.Twelve);
// generate a wallet
Wallet wallet = new Wallet(newMnemonic);
CurrentWallet = wallet;
Debug.Log("words:" + wallet.Mnemonic);
Debug.Log("pubkey:" + wallet.Account.PublicKey);
Debug.Log("privatekey:" + wallet.Account.PrivateKey);
// It's ok to get here ↑↑↑
//try to get balance
IRpcClient rpcClient = ClientFactory.GetClient(Cluster.DevNet);
var balance = rpcClient.GetBalance(wallet.Account.PublicKey);
//unity get stuck here ↑↑↑
Debug.Log($"Balance: {balance.Result.Value}");
Describe the bug
Wrong price calculations
To Reproduce
Console.WriteLine(PriceMath.TickIndexToPrice(1, 9, 9));
Console.WriteLine(PriceMath.TickIndexToPrice(100, 9, 9));
10.00150003749937502188359611493754442728685383249508961171928583303106051744175749673006360257982567683817469619873
10.15112303331957826695058866288058596662162812280744838892230990557699568227283140711413108281156799322006970554316890624
Expected behavior
1.0001
1.0100496620928754
Is your feature request related to a problem? Please describe.
This nuget package contains the Unity3D SDK, and importing it will cause duplication of unity dlls. Even if it is deleted, it will be imported again when the project is opened next time.
Describe the bug
When you call toString on a public or private key which _key or _keyBytes are null there is an endless loop from the properties calling each other.
To Reproduce
PublicKey pubKey = new PublicKey("");
pubKey.Key = null;
Debug.Log(pubKey);
Expected behavior
There is no endless loop but instead returned null.
Additional context
Ill make a pr for a fix
Describe the bug
Regarding class Solana.Unity.Rpc.SolanaRpcClient, which is an implementation of IRpcClient: Its SendTransactionAsync method takes in a parameter of type Commitment. It may be expected that, if the transaction is successfully sent, the method will block the task's thread until the transaction's status has reached the specified commitment level.
Example:
SendTransactionAsync(buffer, true, Commitment.Finalized)
In the call above, it may be reasonably expected that by the time the method returns, the transaction (if it was successfully sent and not reverted) is Finalized.
However, no blocking occurs.
To Reproduce
Expected behavior
My understanding is that the expected behavior is for the SendTransactionAsync method to block its task thread until the transaction's status has reached the specified commitment level.
Desktop (please complete the following information):
Is your feature request related to a problem? Please describe.
Finalized is not always desirable as default commitment
Describe the solution you'd like
Add configurable default commitment for RPC calls
Describe the bug
I encountered an overflow error when converting the result from JSON using the rpc.GetTokenAccountsByOwnerAsync
method, specifically when the rentEpoch
value exceeds ulong.MaxValue
. This issue arises when processing rentEpoch
values larger than what ulong
can represent.
To Reproduce
Steps to reproduce the behavior:
rpc.GetTokenAccountsByOwnerAsync
method to retrieve information about token accounts associated with an owner.rentEpoch
value in the returned JSON data exceeds ulong.MaxValue
.rentEpoch
values.Expected behavior
I expected the library to either handle rentEpoch
values of any size properly or provide a clear error message indicating that the value exceeds the supported range. Ideally, measures such as using a different data type or implementing a validation mechanism should be taken to accommodate scenarios where rentEpoch
could surpass ulong
limits.
Note: This issue report was created with the assistance of ChatGPT.
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.