Currencies (SPL Tokens)
You can use GAMEXX to interact with SPL Tokens (called "Currencies" in GAMEXX) that are in your users' wallets. You can view balances and initiate a request to transfer Currencies to other GAMEXX users or other Solana wallet addresses.
You cannot use GAMEXX to create any Currencies, but you can "import" existing Currencies into GAMEXX. In addition, GAMEXX user wallets can accept any valid SPL Tokens, however, in order to view balances via the GAMEXX API, you must first explicitly import the Currency. By default, GAMEXX auto-imports two commonly used Currencies: SOL and USDC.
Note: Importing Currencies will require a minor amount of Solana blockchain knowledge.
In order to import a Currency into GAMEXX, you can make a POST http request to https://api.gamexx.dev/v2/currencies/import
.
You must provide the following fields in the request body:
mintAddress
: This is the address that defines the SPL Token you wish to import as a Currency.
The response will include some details about the Currency you just imported, including an id
that you can use to refer to the Currency in other api requests.
If the Currency you imported has well defined metadata (such as a name
and/or symbol
), these will be picked up automatically. If not, GAMEXX will assign a default value to those fields in the form of an abbreviated mint address.
Currently, it is not possible to "un-import" a Currency.
You can view all the Currencies currently registered to your game by making a GET http request to https://api.gamexx.dev/v2/currencies
.
The response will include a paginated list of Currencies you have previously imported. This list will not include the two default Currencies, SOL and USDC.
You can view the balances of Currencies for any given user by making a GET http request to https://api.gamexx.dev/users/{referenceId}/currencies
.
The response will include a paginated list of Currencies, and the quantity of each Currency possessed by the user. This response will also include the amount of SOL or USDC held by the user.
You can request a transfer of Currencies from one user to another, or to any on-chain Solana wallet address. The transfer of Currency will require the user's consent. To initiate a Currency transfer, you can make a POST http request to https://api.gamexx.dev/users/{referenceId}/currencies/{currencyId}/transfer
.
If you wish to transfer SOL or USDC, the currencyId
is "SOL" or "USDC" respectively.
You must provide the following fields in the POST body:
amount
: This is a string value that dictates how much of the Currency will be transferred.destinationUserReferenceId
ORdestinationWallet
: Identifies the recipient of the Currency.
All requests will return a "consent URL" that the user must visit to authorize the transfer of Currency.
Last updated