SDK Reference
Last updated
Last updated
The main class for interacting with the Glitch Gremlin platform.
createChaosRequest
Creates a new chaos test request.
Parameters:
targetProgram
: PublicKey or string of program to test
testType
: FUZZ | LOAD | EXPLOIT | CONCURRENCY
duration
: 60-3600 seconds
intensity
: 1-10 scale
params?
: Optional test-specific parameters
Returns:
getRequestStatus
Get status of an existing request.
Returns:
createProposal
Create a new governance proposal.
Parameters:
title
: Proposal title
description
: Detailed description
targetProgram
: Program to test
testParams
: ChaosRequestParams
stakingAmount
: Amount of GLITCH to stake
Returns:
vote
Vote on a governance proposal.
stakeTokens
Stake GLITCH tokens.
Parameters:
amount
: Number of tokens to stake
lockupPeriod
: Lock duration (86400-31536000 seconds)
unstakeTokens
Unstake previously staked tokens.
calculateChaosRequestFee
Calculate the fee for a chaos request.
The SDK throws GlitchError
with specific error codes:
Common error codes:
1001: Insufficient funds
1002: Invalid program address
1003: Request timeout
1004: Invalid test type
1005: Invalid intensity
1006: Invalid duration
1007: Rate limit exceeded
1008: Insufficient stake amount
1009: Insufficient voting balance
1010: Already voted
1011: Invalid proposal ID
1012: Execution failed
1013: Proposal not passed
1014: Invalid lockup period
1015: Stake not found
1016: Tokens still locked
1008: Insufficient stake amount
1009: Insufficient voting balance
1010: Already voted
1011: Invalid proposal ID
1012: Execution failed
1013: Proposal not passed
1014: Invalid lockup period
1015: Stake not found
1016: Tokens still locked
2 second cooldown between chaos requests
Maximum 3 requests per minute per address
1 proposal per address per day
Voting cooldown period between votes
Maximum 10 active proposals at once
Staking lockup period: 1 day to 1 year
Always handle errors appropriately:
Use appropriate test durations:
Monitor test results:
See the examples directory for complete usage examples:
quick-test.ts
: Simple test using an ephemeral wallet
basic-test.ts
: More detailed test with custom parameters
governance-proposal.ts
: Example of creating a governance proposal