#Configuration
Configure the Walbucket SDK to match your needs. All configuration is done when creating a new Walbucket instance.
#Required Fields
#apiKey (required)
Your API key for authentication. Get your API key from the Walbucket Developer Console:
- Go to the Developer Console (use the Console link in the navigation bar)
- Sign in with your wallet
- Navigate to the Developer section, then go to API Keys
- Click Create API Key to generate a new key
- Copy your API key and use it in your configuration
apiKey: "your-api-key";Security Note: Always store your API key in environment variables and never commit it to version control. For client-side applications, use environment variables prefixed with
NEXT_PUBLIC_(Next.js) or similar build-time environment variable injection.
#Gas Strategy Fields (one required)
Depending on your gasStrategy, you need to provide either:
sponsorPrivateKey- Required if usinggasStrategy: 'developer-sponsored'(default)signAndExecuteTransaction+userAddress- Required if usinggasStrategy: 'user-pays'
#Optional Fields
#network
Sui network to use. Package ID is automatically selected based on network.
network?: 'testnet' | 'mainnet' | 'devnet' | 'localnet'Default: 'testnet'
#encryption
Enable Seal encryption for uploaded files.
encryption?: booleanDefault: true
#gasStrategy
Choose who pays gas fees for transactions.
gasStrategy?: 'developer-sponsored' | 'user-pays'Default: 'developer-sponsored'
'developer-sponsored'- Developer pays all gas fees (better UX, requiressponsorPrivateKey)'user-pays'- Users pay their own gas fees (more decentralized, requiresuserSigner)
#cacheTTL
Cache TTL in seconds for asset metadata.
cacheTTL?: numberDefault: 3600 (1 hour)
#Advanced Configuration
These fields are usually auto-detected and don't need to be set:
packageId- Override auto-detected package IDwalrusPublisherUrl- Override auto-detected Walrus publisher URLwalrusAggregatorUrl- Override auto-detected Walrus aggregator URLsealServerIds- Override auto-detected Seal server IDs
#Configuration Interface
interface WalbucketConfig {
// Required
apiKey: string;
// Required based on gasStrategy choice
sponsorPrivateKey?: string; // Required if gasStrategy is 'developer-sponsored'
signAndExecuteTransaction?: SignAndExecuteTransaction; // Required if gasStrategy is 'user-pays'
userAddress?: string; // Required if gasStrategy is 'user-pays'
// Optional with smart defaults
network?: "testnet" | "mainnet" | "devnet" | "localnet"; // Default: 'testnet'
encryption?: boolean; // Default: true
gasStrategy?: "developer-sponsored" | "user-pays"; // Default: 'developer-sponsored'
// Auto-detected (usually don't need to set)
packageId?: string; // Auto-detected from network
walrusPublisherUrl?: string; // Auto-detected from network
walrusAggregatorUrl?: string; // Auto-detected from network
sealServerIds?: string[]; // Auto-detected from network
cacheTTL?: number; // Default: 3600 seconds
useGrpc?: boolean; // Default: true
}#Examples
#Basic Configuration (Developer-Sponsored)
const walbucket = new Walbucket({
apiKey: "your-api-key",
network: "testnet",
sponsorPrivateKey: "your-private-key",
});#Mainnet Configuration
const walbucket = new Walbucket({
apiKey: "your-api-key",
network: "mainnet",
sponsorPrivateKey: "your-private-key",
});#Without Encryption
const walbucket = new Walbucket({
apiKey: "your-api-key",
network: "testnet",
sponsorPrivateKey: "your-private-key",
encryption: false,
});#User-Pays Gas Strategy
import {
useSignAndExecuteTransaction,
useCurrentAccount,
} from "@mysten/dapp-kit";
function MyComponent() {
const { mutateAsync: signAndExecuteTransaction } =
useSignAndExecuteTransaction();
const currentAccount = useCurrentAccount();
const walbucket = new Walbucket({
apiKey: "your-api-key",
network: "testnet",
gasStrategy: "user-pays",
signAndExecuteTransaction,
userAddress: currentAccount?.address,
});
}#Custom Cache TTL
const walbucket = new Walbucket({
apiKey: "your-api-key",
network: "testnet",
sponsorPrivateKey: "your-private-key",
cacheTTL: 7200, // 2 hours
});#Learn More
- Gas Strategies - Detailed guide on gas payment options
- Wallet Integration - Setting up user-pays strategy
- Quick Start - Get started guide