Skip to content

Developer Experience Improvements - Feedback from Real-World Usage #47

@paulgnz

Description

@paulgnz

Developer Experience Improvements

Feedback and suggestions based on real-world development experience building Proton.Link and related dApps.


1. Better Error Messages for Failed Transactions (High Priority)

Issue: When transactions fail, error messages are sometimes technical/cryptic and not helpful for end users.

Current behavior:

"assertion failure with message: insufficient balance"

Suggestion: Wrap common errors with user-friendly messages:

{
  code: "INSUFFICIENT_BALANCE",
  message: "You don't have enough XPR to complete this transaction",
  technical: "assertion failure with message: insufficient balance",
  suggestion: "Current balance: 10.0000 XPR, Required: 50.0000 XPR"
}

This would help dApp developers show better error messages without having to parse error strings manually.


2. Built-in Retry Logic for RPC Failures (Medium Priority)

Issue: RPC endpoints occasionally fail or timeout, requiring manual retry logic in every dApp.

Suggestion: Add configurable retry with fallback endpoints:

const proton = new ProtonWebSDK({
  endpoints: ['https://proton.eosusa.io', 'https://proton.greymass.com'],
  retryConfig: {
    maxRetries: 3,
    retryDelay: 1000,
    fallbackOnFailure: true
  }
});

3. TypeScript Types for Table Rows (Medium Priority)

Issue: get_table_rows returns any type, requiring manual typing in TypeScript projects.

Suggestion: Add generic type support:

interface Rating {
  account: string;
  level: number;
  reason: string;
}

const { rows } = await rpc.get_table_rows<Rating>({
  code: 'protonrating',
  table: 'ratings',
  // ...
});
// rows is now Rating[] instead of any[]

4. Session Persistence Helpers (Low Priority)

Issue: Session restoration requires boilerplate code in every dApp.

Current pattern we use:

// On app load
const { user, error } = await ProtonSDK.restoreSession();
if (!error && user?.actor) {
  setAuth(user.actor);
  setAccountData(user);
}

Suggestion: Add built-in persistence option:

const proton = new ProtonWebSDK({
  persistSession: true,  // Auto-save to localStorage
  sessionKey: 'proton_session',  // Custom key
  onSessionRestore: (user) => console.log('Welcome back', user.actor)
});

5. Transaction Status Tracking (Low Priority)

Suggestion: Add transaction status checking for apps that need to verify irreversibility:

const result = await proton.transact(actions);

// Check if transaction is irreversible
const status = await proton.getTransactionStatus(result.transactionId);
// { status: 'irreversible', block: 12345, confirmations: 330 }

6. Pagination Helper for Large Tables (Medium Priority)

Issue: Fetching all rows from large tables requires manual pagination.

Current pattern:

let lower_bound = '';
while (true) {
  const { rows, more } = await rpc.get_table_rows({ lower_bound, ... });
  // process rows
  if (!more) break;
  lower_bound = rows[rows.length - 1].id;
}

Suggestion: Add async iterator:

for await (const row of rpc.iterateTable('contract', 'table')) {
  // process each row, pagination handled automatically
}

Summary

Suggestion Priority Impact
Better error messages High Improves end-user UX
TypeScript generics for tables Medium Better developer experience
Built-in retry logic Medium More resilient dApps
Table pagination helper Medium Cleaner code
Session persistence Low Reduces boilerplate
Transaction status tracking Low Nice for specific use cases

Happy to discuss any of these further or contribute PRs if there's interest!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions