This is a browser-based script to automatically resupply Star Atlas ships on a recurring basis (once per day for 7 days) with a single approval.
The single approval component is accomplished by leveraging the solana wallet-adapter function signAllTransactions. In an effort to increase efficiency, this script will also pack multiple instructions into each transaction, reducing transaction fees.
The recurring component is accomplished by leveraging Durable Transaction Nonce Accounts. These accounts store a nonce which can be used in place of a recent blockhash. They are intended for use in signing offline transactions. Here, those accounts are used to configure several “resupply” transaction ahead of time; allowing the user to sign all of the transactions at once.
Each account is required to be rent-exempt, so it requires a deposit of 0.00144768 SOL. Each account can only be used for one offline transaction at a time; so a separate account is required for each future transaction to be queued. Additionally, each ship type also requires a separate transaction due to Solana transaction size limits.
The initial deposit can be reclaimed by issuing a withdraw transaction for the exact amount deposited (Click Configure > Reclaim Rent).
Users are encouraged to build their own instance of a browser-compatible Star Atlas Factory - Score file. Doing so ensures that you are using trusted code. A pre-built file is provided for convenience.
This script uses a browserified version of Star Atlas Factory.
browserify sa-score.js --standalone BrowserScore -p esmify --exclude process -o staratlas-score-browserified.js
sa-score.js
const score = require("@staratlas/factory/dist/score");
module.exports = {score};
The script is built as a TamperMonkey script. TamperMonkey is a userscript manager available for free as a browser extension.
NOTE: The ship supplies displayed on the Fleet page will not reflect updated supplies while the script is running.