@sqds/grid v2.x, this guide will help you migrate to v3.0.0. The new version introduces improved error handling, camelCase field naming, new trading features, and better state management.
Overview of Breaking Changes
v3.0.0 introduces several breaking changes that improve the developer experience:- Error handling: Methods now throw
GridErrorinstead of returning{success, error}wrappers - camelCase naming: All response/request fields now use camelCase instead of snake_case
- Response structure: All responses have a
.dataobject containing the payload - New features: Account state management, trading smart transactions, and passkey accounts
Migration Steps
Update Error Handling Pattern
Replace all success checks with try/catch blocks. Methods now throw After (v3.0.0):
GridError on failure.Before (v2.x):Update Field Names to camelCase
All response and request fields now use camelCase instead of snake_case.Before (v2.x):After (v3.0.0):Complete field name mapping:
GridError field change:
| Old (snake_case) | New (camelCase) |
|---|---|
otp_sent | otpSent |
otp_id | otpId |
created_at | createdAt |
expires_at | expiresAt |
grid_user_id | gridUserId |
time_lock | timeLock |
admin_address | adminAddress |
transaction_signers | transactionSigners |
spending_limit_signers | spendingLimitSigners |
transaction_signature | transactionSignature |
confirmed_at | confirmedAt |
Update Response Access Pattern
Responses now use After (v3.0.0):
BaseResponse<T> which wraps data in a .data property along with request metadata in .lastResponse.Before (v2.x):The
.data property contains your actual response payload. The .lastResponse property contains request metadata (requestId, statusCode, headers) useful for debugging and support.Update Transaction Signing Flow
Update authentication data access to use camelCase.Before (v2.x):After (v3.0.0):
Update Type References
Several response types have been updated. The main change is removing the old Update your function signatures:
GridResponse<T> wrapper.Type updates:Migration Checklist
- Update package to v3.0.0
- Replace all
if (response.success)checks withtry/catchblocks - Import and use
GridErrorfor error handling - Update all snake_case field accesses to camelCase (see table above)
- Update
error.status_codetoerror.statusCode - Update type declarations to remove
GridResponse<T>wrapper - Test authentication flows (initAuth, completeAuth)
- Test transaction creation and signing
- Verify error handling catches
GridErrorcorrectly - Run TypeScript compilation to catch any missed changes