How to Get Refund Initial Liquidity
If a market cannot be resolved or becomes unresolvable, the market creator can claim a refund of their initial liquidity. This section provides complete working scripts for claiming refunds from both V2 AMM markets and P2P markets.Important: Only the market creator can claim refunds, and the market must meet specific conditions (such as being unresolvable or past a buffer period).
Claiming Refund for V2 AMM Market
For V2 AMM markets, the creator who provided the initial liquidity can claim a refund if the market is deemed unresolvable. This script demonstrates the refund process for V2 markets.- Only the market creator can claim a refund
- The market must be unresolvable
- Uses
client.claimMarketRefund()method
Claiming Refund for P2P Market
For P2P markets, creators can claim refunds with additional checks including buffer period validation. This script demonstrates the complete refund process for P2P markets with detailed error handling.- Only the market creator can claim a refund
- Must wait for the buffer period to pass before claiming
- Uses
client.claimP2PMarketRefund()for simplified refund claiming - SDK handles creator validation and token program detection automatically
| Error | Description | Solution |
|---|---|---|
BufferPeriodNotPassed | The required waiting period hasn’t elapsed | Wait until the buffer period passes before retrying |
Signer is not the creator | The wallet attempting the refund is not the market creator | Use the creator’s wallet to claim the refund |
Market account not found | Invalid market address provided | Verify the market address is correct |
Redemption module not available | No wallet/signer configured in the client | Initialize PNPClient with a valid private key |
| Feature | V2 AMM Market Refund | P2P Market Refund |
|---|---|---|
| SDK Method | client.claimMarketRefund() | client.claimP2PMarketRefund() |
| Buffer Period | May apply | Required waiting period |
| Creator Validation | Automatic | Explicit check in script |
| Token Program Support | Standard SPL Token | Both SPL Token and Token-2022 |
| Error Details | Basic error messages | Advanced error parsing with codes |
| Complexity | Simple, single method call | More complex, requires PDA derivation |
