Creates a new Wallet object with the given name and adds it to the wallets dictionary.
- name: The name of the new wallet.
Deletes the Wallet object with the given ID from the wallets dictionary.
- id: The ID of the wallet to delete.
Sets the currentWallet field to the Wallet object with the given ID.
- id: The ID of the wallet to select.
Returns the Wallet object with the given ID.
- id: The ID of the wallet to get.
The Wallet object with the given ID.
Returns a list of all Wallet objects.
A list of all Wallet objects.
Returns the CoinMetadata object for the coin with the given symbol.
- symbol: The symbol of the coin to get metadata for.
The CoinMetadata object for the coin with the given symbol.
Returns the SUIMarketData object for the coin with the given symbol.
- symbol: The symbol of the coin to get market data for.
The SUIMarketData object for the coin with the given symbol.
Returns the CoinPage object for the coin with the given symbol.
- symbol: The symbol of the coin to get the page for.
The CoinPage object for the coin with the given symbol.
Returns the Sprite object for the coin with the given symbol.
- symbol: The symbol of the coin to get the image for.
The Sprite object for the coin with the given symbol.
Updates the cached coin data by making an RPC call to the SUI daemon and parsing the response.
Updates the coinMetadatas dictionary by making an RPC call to the SUI daemon and parsing the response.
Updates the coinGeckoData dictionary by making an API call to CoinGecko and parsing the response.
Updates the coinPages dictionary by making an API call to CoinGecko and parsing the response.
Updates the coinImages dictionary by loading coin images from the Resources folder.
Updates the lastUpdated field to the current date and time.
Saves the cached coin data to disk.
Loads the cached coin data from disk.
Makes an RPC call to the SUI daemon to get the latest coin data.
A Task<RpcResponse> object representing the RPC response.
Makes an RPC call to the SUI daemon to get the latest coin metadata.
A Task<RpcResponse> object representing the RPC response.
Returns the Transaction object with the given transaction ID.
- txid: The transaction ID of the transaction to get.
The Transaction object with the given transaction ID.
Returns a list of all Transaction objects.
A list of all Transaction objects.
Returns a list of Transaction objects for the given address.
- address: The address to get transaction history for.
A list of Transaction objects for the given address.
Returns the balance of the given address.
- address: The address to get the balance for.
The balance of the given address.
Sends a transaction from the given address to the given address with the given amount.
-
fromAddress: The address to send the transaction from.
-
toAddress: The address to send the transaction to.
-
amount: The amount to send in the transaction.
A Task<RpcResponse> object representing the RPC response.
Gets or sets the array of BaseScreen objects managed by the SimpleScreenManager.
Gets or sets the current BaseScreen object being displayed by the SimpleScreenManager.
Gets or sets the previous BaseScreen object that was displayed by the SimpleScreenManager.
Gets the number of BaseScreen objects in the history stack of the SimpleScreenManager.
Gets or sets the Transform object that holds the BaseScreen objects managed by the SimpleScreenManager.
Hides the mainHolder object of the SimpleScreenManager.
Shows the mainHolder object of the SimpleScreenManager.
Toggles the visibility of the mainHolder object of the SimpleScreenManager.
Goes back to the previous BaseScreen object in the history stack of the SimpleScreenManager.
Clears the history stack of the SimpleScreenManager and optionally pushes a BaseScreen object onto the stack.
- baseScreen: The BaseScreen object to push onto the history stack.
Shows the given BaseScreen object and sets it as the current screen of the SimpleScreenManager.
-
curScreen: The current BaseScreen object being displayed by the
SimpleScreenManager.
-
screen: The BaseScreen object to show.
Shows the BaseScreen object with the given name and sets it as the current screen of the SimpleScreenManager.
- name: The name of the BaseScreen object to show.
Shows the BaseScreen object with the given name and sets it as the current screen of the SimpleScreenManager, passing the given data to the ShowScreen method of the BaseScreen object.
-
name: The name of the BaseScreen object to show.
-
data: The data to pass to the ShowScreen method of the BaseScreen
object.
Shows the BaseScreen object at the given index and sets it as the current screen of the SimpleScreenManager.
-
curScreen: The current BaseScreen object being displayed by the
SimpleScreenManager.
-
index: The index of the BaseScreen object to show.
Shows the BaseScreen object with the given name and sets it as the current screen of the SimpleScreenManager, passing the given data to the ShowScreen method of the BaseScreen object.
-
curScreen: The current BaseScreen object being displayed by the
SimpleScreenManager.
-
name: The name of the BaseScreen object to show.
-
data: The data to pass to the ShowScreen method of the BaseScreen
object.
Hides the BaseScreen object with the given name.
- name: The name of the BaseScreen object to hide.
Hides all BaseScreen objects managed by the SimpleScreenManager except for the BaseScreen object at the given index.
- screenIndex: The index of the BaseScreen object to show. Default
value is 0.
Gets or sets the SimpleScreenManager object that manages the BaseScreen object.
Gets or sets the IScreenAnimation object that animates the BaseScreen object.
Navigates to the BaseScreen object with the given name and passes the given data to the ShowScreen method of the BaseScreen object.
-
page: The name of the BaseScreen object to navigate to.
-
data: The data to pass to the ShowScreen method of the BaseScreen
object.
Hides the BaseScreen object.
Initializes the BaseScreen object.
Shows the BaseScreen object and passes the given data to the ShowScreen method of the BaseScreen object.
- data: The data to pass to the ShowScreen method of the BaseScreen
object.
Shows the BaseScreen object and passes the given data to the ShowScreen method of the BaseScreen object.
- data: The data to pass to the ShowScreen method of the BaseScreen
object.
Gets the Object with the given name from the BaseScreen object.
- name: The name of the Object to get.
The Object with the given name.
The InfoPopupManager class is responsible for managing notification popups in a Unity game. It contains an enumeration for different types of notification popups, as well as properties for the content holder, notification prefab, colors, and sprites used for the notification popups. The class also has a list of NotificationPopup objects that are managed by the InfoPopupManager, and a transform object used as an underlay for the notification popups.
The AddNotif method adds a notification popup of the given type and message to the InfoPopupManager. If the message is the same as the previous notification popup, it will not be added. The ClearNotif method clears all notification popups managed by the InfoPopupManager. The RemoveNotif method removes the given NotificationPopup object from the list of notification popups managed by the InfoPopupManager.
infoPopupManager.AddNotif(InfoType.Info, "This is an info message."); |
---|
The above example adds an info notification popup with the message "This is an info message." to the InfoPopupManager.
The AddNotif method first checks if the message is the same as the previous notification popup. If it is, the method returns without adding a new notification popup. If the message is different, the method instantiates a new notification popup using the notifPrefab object and sets its color and sprite based on the given type. The new notification popup is then added to the notifQueue list. If there are more than three notification popups in the queue, the oldest one is removed using the Destroy method and the Remove method of the notifQueue list. Finally, the SetActive method of the underlay object is called to make the underlay visible.
Gets or sets the Transform object that holds the notification popups managed by the InfoPopupManager.
Gets or sets the GameObject prefab used for creating notification popups.
Gets or sets the InfoPopupManager instance.
Gets or sets the color used for warning notification popups.
Gets or sets the color used for error notification popups.
Gets or sets the color used for info notification popups.
Gets or sets the sprite used for warning notification popups.
Gets or sets the sprite used for error notification popups.
Gets or sets the sprite used for info notification popups.
Gets or sets the list of NotificationPopup objects managed by the InfoPopupManager.
Gets or sets the Transform object used as an underlay for the notification popups managed by the InfoPopupManager.
Adds a notification popup of the given type and message to the InfoPopupManager.
-
type: The type of the notification popup to add.
-
message: The message to display in the notification popup.
Clears all notification popups managed by the InfoPopupManager.
Removes the given NotificationPopup object from the list of notification popups managed by the InfoPopupManager.
- notif: The NotificationPopup object to remove.
SDK
The WebsocketController is a class that provides functionality for setting up and managing a WebSocket connection to a server. Here's an overview of the methods contained in the class:
This method sets up a WebSocket connection to the specified URL. It takes in a string url as a parameter.
This method subscribes to a WebSocket event with the specified filter parameters. It takes in an object filterParams as a parameter.
This method unsubscribes from the current WebSocket event.
This method unsubscribes from a WebSocket event with the specified ID. It takes in a string id as a parameter.
This method closes the WebSocket connection.
The class also contains several event handlers that are triggered when certain WebSocket events occur:
-
OnOpen: This event handler is triggered when the WebSocket
connection is opened.
-
OnError: This event handler is triggered when an error occurs with
the WebSocket connection.
-
OnClose: This event handler is triggered when the WebSocket
connection is closed.
-
OnMessage: This event handler is triggered when a message is
received from the WebSocket server.
The class also contains a Update method that is called every frame. This method dispatches any messages in the WebSocket message queue.
The WebsocketController class uses the NativeWebSocket library to handle WebSocket connections. It also uses the JsonConvert class from the Newtonsoft.Json library to serialize and deserialize JSON objects.
Overall, the WebsocketController class provides a simple and convenient way to set up and manage WebSocket connections in a Unity project.
The RPCClient class is a that provides methods for making remote procedure calls (RPCs) to a server using Unity's UnityWebRequest class. The class contains several public and internal methods for sending requests to the server, downloading images, and sending requests using coroutines.
The RPCClient constructor takes a URI string as an argument and sets it as the _uri field. The SendRequest method sends a JSON-RPC request to the server and returns a JsonRpcResponse<T> object, which contains the result of the request. The SendAPIRequest method is similar to SendRequest, but it returns an object of type T instead of a JsonRpcResponse<T> object.
The Get method sends a GET request to the specified URL and returns an object of type T. The DownloadImage method downloads an image from the specified URL and returns it as a Sprite object.
The SendRequestCoroutine method sends a request to the server using a coroutine and calls the specified callback function when the request is complete.
Overall, the RPCClient class provides a simple and efficient way to make RPCs to a server using Unity's UnityWebRequest class, allowing for easy communication with a remote server.
The constructor for the RPCClient class takes a URI string as an argument and sets it as the _uri field.
The SendRequest method takes an object of type T and sends it to the server as a JSON-RPC request. The method returns a JsonRpcResponse<T> object, which contains the result of the request.
- data: The data to be sent to the server as a JSON-RPC request.
- Task<JsonRpcResponse<T>>: A Task object that represents the
asynchronous operation. The JsonRpcResponse<T> object contains the result of the request.
The SendAPIRequest method is similar to SendRequest, but it returns an object of type T instead of a JsonRpcResponse<T> object.
- data: The data to be sent to the server as a JSON-RPC request.
- Task<T>: A Task object that represents the asynchronous operation.
The object of type T contains the result of the request.
The Get method sends a GET request to the specified URL and returns an object of type T.
- url: The URL to send the GET request to.
- Task<T>: A Task object that represents the asynchronous operation.
The object of type T contains the result of the request.
The DownloadImage method downloads an image from the specified URL and returns it as a Sprite object.
- url: The URL to download the image from.
- Task<Sprite>: A Task object that represents the asynchronous
operation. The Sprite object contains the downloaded image.
The SendRequestCoroutine method sends a request to the server using a coroutine and calls the specified callback function when the request is complete.
-
uri: The URI to send the request to.
-
callback: The callback function to call when the request is
complete.
- IEnumerator: An IEnumerator object that represents the coroutine.
The SUIRPCClient class is a class that provides functionality for sending requests to a SUI RPC server. Class extends RPCClient class.
Creates a new instance of the SUIRPCClient class with the specified URI.
- uri - The URI of the SUI RPC server.
Sends a JSON-RPC request to the SUI RPC server and returns the response.
- data - The data to send with the request.
- A JsonRpcResponse<T> object representing the response from the
server.
Sends a JSON-RPC request to the SUI RPC server and returns the response.
- data - The RPCRequestBase object representing the request to send.
- A JsonRpcResponse<T> object representing the response from the
server.
Sends a JSON-RPC request to the SUI RPC server and returns the response.
-
method - The name of the method to call.
-
parameters - The parameters to pass to the method.
- A JsonRpcResponse<T> object representing the response from the
server.
Gets the balances of all coins for the specified wallet.
- wallet - The wallet to get the balances for.
- A JsonRpcResponse<List<Balance>> object representing the response
from the server.
Gets the balances of all coins for the specified public key.
- publicKey - The public key to get the balances for.
- A JsonRpcResponse<List<Balance>> object representing the response
from the server.
Gets the balance of the specified coin for the specified wallet.
-
wallet - The wallet to get the balance for.
-
cointType - The type of coin to get the balance for.
- A JsonRpcResponse<Balance> object representing the response from
the server.
Gets the balance of the specified coin for the specified public key.
-
publicKey - The public key to get the balance for.
-
cointType - The type of coin to get the balance for.
- A JsonRpcResponse<Balance> object representing the response from
the server.
Gets all coins for the specified wallet.
-
wallet - The wallet to get the coins for.
-
cursor - The cursor to use for pagination.
-
limit - The maximum number of coins to return.
- A JsonRpcResponse<PageForCoinAndObjectID> object representing the
response from the server.
Gets all coins for the specified public key.
-
publicKey - The public key to get the coins for.
-
cursor - The cursor to use for pagination.
-
limit - The maximum number of coins to return.
- A JsonRpcResponse<PageForCoinAndObjectID> object representing the
response from the server.
Gets the coins of the specified type for the specified wallet.
-
wallet - The wallet to get the coins for.
-
cointType - The type of coin to get.
-
cursor - The cursor to use for pagination.
-
limit - The maximum number of coins to return.
- A JsonRpcResponse<CoinPage> object representing the response from
the server.
Gets the metadata for the specified coin.
- coinType - The type of coin to get the metadata for.
- A JsonRpcResponse<CoinMetadata> object representing the response
from the server.
Gets the reference gas price.
- A JsonRpcResponse<string> object representing the response from the
server.
Gets the object with the specified ID.
- objectId - The ID of the object to get.
- A SUIObjectResponse object representing the response from the
server.
Gets the object with the specified ID.
- objectId - The ID of the object to get.
- A SUIObjectResponse object representing the response from the
server.
Gets the objects owned by the specified address.
-
address - The address to get the objects for.
-
query - The query to use for filtering the objects.
-
objectId - The ID of the object to start the query from.
-
limit - The maximum number of objects to return.
- A Page_for_SuiObjectResponse_and_ObjectID object representing the
response from the server.
Gets the total supply of the specified coin.
- coinType - The type of coin to get the total supply for.
- A Supply object representing the response from the server.
Executes a transaction block.
- args - The arguments to use for the transaction block.
- A SuiTransactionBlockResponse object representing the response from
the server.
Executes a transaction block.
-
txBytes - The transaction bytes to use for the transaction block.
-
serializedSignatures - The serialized signatures to use for the
transaction block.
-
options - The options to use for the transaction block.
-
requestType - The type of request to use for the transaction block.
- A JsonRpcResponse<SuiTransactionBlockResponse> object representing
the response from the server.
Dry runs a transaction block.
- txBytes - The transaction bytes to use for the transaction block.
- A JsonRpcResponse<SuiTransactionBlockResponse> object representing
the response from the server.
Pays SUI.
-
signer - The wallet to use for signing the transaction.
-
inputCoins - The input coins to use for the transaction.
-
recipients - The recipients of the transaction.
-
amounts - The amounts to send to each recipient.
-
gasBudget - The gas budget for the transaction.
- A JsonRpcResponse<TransactionBlockBytes> object representing the
response from the server.
Pays all SUI.
-
signer - The wallet to use for signing the transaction.
-
inputCoins - The input coins to use for the transaction.
-
recipients - The recipient of the transaction.
-
gasBudget - The gas budget for the transaction.
- A JsonRpcResponse<TransactionBlockBytes> object representing the
response from the server.
Returns built transaction with passed parameters.
-
signer - The wallet to use for signing the transaction.
-
inputCoins - The input coins to use for the transaction.
-
recipients - The recipients of the transaction.
-
amounts - The amounts to send to each recipient.
-
gas - The gas to use for the transaction.
-
gasBudget - The gas budget for the transaction.
- A JsonRpcResponse<TransactionBlockBytes> object representing the
response from the server.
Queries events.
- filter - The filter to use for the query.
- A JsonRpcResponse<PageForEventAndEventID> object representing the
response from the server.
Queries transaction blocks.
- filters - The filters to use for the query.
- A
JsonRpcResponse<PageForTransactionBlockResponseAndTransactionDigest> object representing the response from the server.
Gets multiple transaction blocks.
-
digests - The digests of the transaction blocks to get.
-
options - The options to use for the transaction blocks.
- A List<SuiTransactionBlockResponse> object representing the
response from the server.
Constructor for the Wallet class.
Constructor for the Wallet class that takes a KeyPair object, password, and wallet name as parameters.
-
keyPair: The KeyPair object to use for the wallet.
-
password: The password to use for the wallet.
-
walletName: The name of the wallet.
Constructor for the Wallet class that takes a mnemonic, password, and wallet name as parameters.
-
mnemonic: The mnemonic to use for the wallet.
-
password: The password to use for the wallet.
-
walletName: The name of the wallet.
Generates a new mnemonic and key pair for the wallet.
The KeyPair object for the new account.
Restores a key pair from the given mnemonic.
- mnemonic: The mnemonic to use for restoring the key pair.
The KeyPair object for the restored account.
Returns a list of all saved wallet names.
A list of all saved wallet names.
Saves the wallet to disk.
Saves the wallet to disk with the given password.
- newPassword: The password to use for saving the wallet.
Restores a wallet from disk.
-
walletName: The name of the wallet to restore.
-
password: The password to use for restoring the wallet.
The restored Wallet object.
Restores a wallet from the given private key.
- privateKey: The private key to use for restoring the wallet.
Removes the wallet from disk.
Signs the given message with the wallet's private key.
- message: The message to sign.
The signature for the message.
Signs the given data with the wallet's private key.
- data: The data to sign.
The signature for the data.
Adds an intent to the given message.
- message: The message to add an intent to.
The message with the added intent.
I hope this helps! Let me know if you have any further questions.
Generates a new BIP39 mnemonic.
The generated mnemonic.
Checks if the given mnemonic is valid.
- mnemonic: The mnemonic to check.
true if the mnemonic is valid, false otherwise.
Converts a hexadecimal string to a byte array.
- hex: The hexadecimal string to convert.
The byte array representation of the hexadecimal string.
Converts a BIP39 mnemonic to a byte array seed.
- seed: The BIP39 mnemonic to convert.
The byte array seed.
Converts a BIP39 mnemonic to a hexadecimal seed.
- seed: The BIP39 mnemonic to convert.
The hexadecimal seed.
Generates a seed from a BIP39 mnemonic.
- mnemonic: The BIP39 mnemonic to generate the seed from.
The generated seed.
Checks if the given derivation path is valid.
- path: The derivation path to check.
true if the derivation path is valid, false otherwise.
Checks if the given mnemonic is valid.
- mnemonic: The mnemonic to check.
true if the mnemonic is valid, false otherwise.
Sanitizes the given mnemonic.
- mnemonic: The mnemonic to sanitize.
The sanitized mnemonic.
Derives a key pair from the given derivation path, master key, and chain code.
-
path: The derivation path to use.
-
_masterKey: The master key to use.
-
_chainCode: The chain code to use.
A tuple containing the derived key and chain code.
Generates a key pair from the given BIP39 mnemonic.
- mnemonics: The BIP39 mnemonic to use.
A KeyPair object containing the generated public and private keys.
Encrypts the given BIP39 mnemonic with the given password.
-
mnemonic: The BIP39 mnemonic to encrypt.
-
password: The password to use for encryption.
The encrypted mnemonic.
Decrypts the given encrypted BIP39 mnemonic with the given password.
-
encryptedMnemonic: The encrypted BIP39 mnemonic to decrypt.
-
password: The password to use for decryption.
The decrypted BIP39 mnemonic.
Decrypts the given encrypted BIP39 mnemonic with the given BIP39 mnemonic.
-
encryptedMnemonic: The encrypted BIP39 mnemonic to decrypt.
-
mnemonic: The BIP39 mnemonic to use for decryption.
The password used for encryption.
Gets or sets the public key for the KeyPair object.
Gets or sets the private key for the KeyPair object.
Gets or sets the public key as a base64-encoded string.
Gets or sets the SUI address for the KeyPair object.
Gets the SUI secret for the KeyPair object.
Checks if the given SUI address is in the correct format.
- address: The SUI address to check.
true if the SUI address is in the correct format, false otherwise.
Constructor for the KeyPair class that takes a public key and private key as parameters.
-
publicKey: The public key to use for the KeyPair object.
-
privateKey: The private key to use for the KeyPair object.
Converts the given public key to an SUI address.
- publicKeyBytes: The public key to convert.
The SUI address for the public key.
Gets the private key from the given SUI secret.
- suiSecret: The SUI secret to use for getting the private key.
The private key for the SUI secret.
Generates a KeyPair object from the given private key.
- privateKey: The private key to use for generating the KeyPair
object.
The generated KeyPair object.
Encrypts the given plain text using the given pass phrase.
-
plainText: The plain text to encrypt.
-
passPhrase: The pass phrase to use for encryption.
The encrypted cipher text.
Decrypts the given cipher text using the given pass phrase.
-
cipherText: The cipher text to decrypt.
-
passPhrase: The pass phrase to use for decryption.
The decrypted plain text.