Skip to main content
Use this script to run the steps in Create a vault. That page explains the initialization arguments and required accounts. Every initial manager must be an authorized vault creator. The payer needs SOL for account rent, transaction fees, and the Squads creation fee. The example uses TypeScript and the Exponent SDK. The script uses SOL accounting, 9 LP decimals, and a 1,000 SOL AUM cap. It assigns one manager, who also pays for creation and owns the fee-treasury LP token account.

Set up the example

Install the dependencies:
Set the RPC endpoint and the path to a manager keypair stored as a JSON byte array:

Create the vault

Save the following as create-vault.mts. Review settings, feeTreasuryOwner, and roles before running it. The script generates a new vault seed with randomBytes(8) when VAULT_SEED_HEX is unset.
create-vault.mts
Submit the creation transaction:
This submits a transaction on Solana mainnet. The output includes the transaction signature, vault address, seed, LP mint, and stored voting configuration. The assertions check the example’s expected settings and empty state.

Retry an interrupted or failed transaction

If submission or confirmation times out, check the original transaction’s status before retrying. To preserve the vault address, reuse the seed printed before submission:
The example stops if that vault already exists. If the Squads account index changes before execution, rebuilding with the same seed obtains fresh Squads accounts while preserving the vault address. A run without VAULT_SEED_HEX generates a new vault address.