Gas Station API

Abstract away gas fees from your user experience

Shinami's Gas Station API allows apps to sponsor the gas fees for their user's transactions.

Shinami handles the management, refueling and optimization of gas credits (SUI) to facilitate sponsored transactions. This frees apps to focus on how to apply sponsored transactions to improve onboarding and user engagement. Check out our gas station guide and TypeScript tutorial for more details on how it works.

This section details the JSON-RPC methods for interacting with Shinami's gas station.

🚧

Server Side Only:

For security of your fund, the recommended setup is to have your web app talk to your own backend server and integrate with our gas station from your server.

gas_sponsorTransactionBlock

Description
Sponsors a gasless transaction by attaching a gas object to it and signs the sponsored transaction with the gas owner's key.

Params

  • transactionBytes : <Base64> - BCS serialized Transaction Kind
  • sender - <SuiAddress>- the sender's Sui address
  • gasBudget : the gas budget, the transaction will fail if the gas cost exceed the budget
curl https://api.shinami.com/gas/v1 \
-X POST \
-H 'X-API-Key: <<gasAccessKey>>' \
-H 'Content-Type: application/json' \
-d '{ "jsonrpc":"2.0", 
      "method":"gas_sponsorTransactionBlock",
      "params":["{{transactionBytes}}",
      			"{{sender}}",
      			"{{gasBudget}}"],
      "id":1}'

Result

  • TransactionBytes : <TransactionBytes>
  • digest : <TransactionDigest>
  • signature : <Base64> - encoded transaction signature, signed by the gas owner
  • expireAtTime : expiration time of the assigned gas object, in Unix epoch seconds
  • expireAfterEpoch - last Sui epoch this assigned gas object is valid for

gas_getSponsoredTransactionBlockStatus

Description
Retrieve the status of a sponsored transaction (in flight, invalid, or complete).

Params

  • transactionDigest : <TransactionDigest> - Base58 encoded transaction digest
curl https://api.shinami.com/gas/v1 \
-X POST \
-H 'X-API-Key: <<gasAccessKey>>' \
-H 'Content-Type: application/json' \
-d '{ "jsonrpc":"2.0", "method":"gas_getSponsoredTransactionBlockStatus", "params":["{{transactionDigest}}"], "id":1}'

Result
Status : <string>