Overview
You’ll find API endpoints and key usage notes below. If you ever need help you can reach out to us.Use Cases
Shinami’s Gas Station API lets you easily sponsor transactions for your users. SUI is pulled from a fund you create to power these transactions, managed in Shinami’s dashboard (see a how to create a fund on the Sui Gas Station FAQ page of our Help Center). Shinami facilitates sponsored transactions based on logic determined by you, the app developer. Examples include sponsoring each user’s initial transaction(s) for better onboarding and sponsoring transactions of a particular type that you want to encourage. Apps looking to onboard and retain Web2 users may choose to sponsor all transactions and use Gas Station alongside Shinami’s app-controlled Invisible Wallets or user-controlled zkLogin wallets to make Web3 fully unseen. For a game, this allows players to focus on gameplay, while behind the scenes the game creates and modifies game assets in a Sui wallet designated for the player. Players get the benefits of Web3 without friction.Authentication, Rate Limits, and Error Handling
Authentication You authenticate via an access key passed in a header (‘X-Api-Key: ACCESS_KEY’) or in the request url, e.g.https://api.us1.shinami.com/sui/gas/v1/ACCESS_KEY. We recommend using a request header and not putting access keys in your request URLs for reduced visibility (in logs, etc).
For more information, including how to set up API access keys, see our Authentication and API Keys guide.
Rate Limits
When you surpass the QPS limit for a key, we return a JSON-RPC error code -32010. We recommend implementing retries with a backoff to handle any rate limits errors that arise. You can also consider batching multiple Move calls into a single programmable transaction block for sponsorship. They’ll execute in sequence, having the same effect as if they were submitted separately. Finally, you can adjust the rate limits of your keys to better balance your QPS allotment across your keys.
Error Handling
See our Error Reference for guidance on the errors you may receive from our services, including a section on errors specific to the Gas Station API.
Send your first request
For a quick sample request that doesn’t require building a transaction, ask for the balance of the fund your access key is tied to with gas_getFund.Tutorials with E2E sample code
Check out our TypeScript tutorial for more code samples and details on the end-to-end flow of creating, sponsoring, and executing a transaction. Also, since our Gas Station does not support CORS (browser) requests for security reasons, our Frontend signing + backend sponsorship tutorial .Methods
gas_sponsorTransactionBlock
Sponsor a gas-less transaction. This request takes two parts of aTransactionData object: the sender address and the programmable transaction block to be executed (with gas information is omitted, this is considered a TransactionKindobject). It asks the Gas Station to attach a gas object to it and produce a complete TransactionData object signed by the sponsor (your Gas Station fund). The returned TransactionData then needs to be signed by the sender and sent to Shinami’s Node Service (or any full node) with both signatures to be executed with sui_executeTransactionBlock.
Important notes
- You cannot use the gas object in a sponsored transaction for other purposes. For example, you cannot write
const [coin] = txb.splitCoins(txb.gas,[txb.pure(100)]);because it’s accessingtxb.gas. If you try to sponsor a TransactionKind that uses the gas object you will get a JSON-RPC-32602error . - Gas Station doesn’t support CORS, so you must send requests from your backend. For more info and some sample code, see our FE signing + BE sponsorship guide.
- We charge a small fee (in SUI) per sponsorship request to cover our costs. For details, visit the “Sui Gas Station” tab on the Billing page of your Shinami dashboard.
- You need to create a Gas Station fund in your Shinami dashboard before you create an access key. When you create a gas station key, you assign it to a network (e.g. Testnet) and a fund on that network. For how to do that and find the deposit address, see our Sui Gas Station Help Center page.
- Auto vs manual budgeting: when you omit the
gasBudgetparameter, we set your gas budget automatically for you. We recommend this for most use cases. We put yourtransactionBytesthrough a sui_dryRunTransactionBlock request as a free service before we attempt to sponsor it. This call will generate error messages for certain invalid transactions, and we’ll return these errors back to you, which should be the same as if you had made asui_dryRunTransactionBlockrequest yourself. For more on auto vs manual budgeting, see the Appendix of our Gas Station tutorial.
Request Parameters: cURL
Example Request Template
The TypeScript example uses the Shinami Clients SDK, which you can install with:
{{name}} with the actual value for that name.
gas_getSponsoredTransactionBlockStatus
Check the status of a transaction you’ve sponsored to see if the gas object has been spent or not.Note that for many use cases, you will not need to check the status of your sponsorships. This is because when you get a successful response from the
gas_sponsorTransactionBlock request, you will immediately obtain a sender signature and submit it to our Node Service for execution (and therefore you’ll know the status).
Example Request Template
The TypeScript example uses the Shinami Clients SDK, which you can install with:
{{name}} with the actual value for that name.
gas_getFund
Get the balance for the Gas Station fund tied to the request’s API access key. When you create a Gas Station access key, you link it to exactly one Gas Station fund. So, when you make this request, we return the balance for the fund that’s tied to the access key you use for the request. To check which fund a Gas Station access key is tied too, see the Sui Gas Station FAQ page of our Help Center Request Parameters none Example Request Template The TypeScript example uses the Shinami Clients SDK, which you can install with:{{name}} with the actual value for that name.
Appendix
How to build, sponsor, sign, and execute a transaction
This section shows an example of how to build, sponsor, sign, and submit a transaction using the Shinami Clients SDK and the Mysten TypeScript SDK. For a high-level image of the sponsorship flow see here. For multiple end-to-end examples, see our Gas Station TypeScript tutorial. Key requirements- When you prepare a transaction for sponsorship, make you prepare a
TransactionKind, which is a transaction without the gas information (since this will be assigned by our Gas Station). When you make thebuild()call on yourTransaction, make sure thatonlyTransactionKind: true. In the code below, our SDK’sbuildGaslessTransactionfunction does this behind the scenes.
{{name}} with the actual value for that name.