You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How should 'validation' specs be implemented, ala CAIP-3, CAIP-22, CAIP-29?
Proposal
I'm imagining that we introduce more specific *Param types, plus a functional validation function that looks something like:
exportinterfaceCAIP3ChainIdParamsextendsChainIDParams{namespace: "eip155",}exportconstisCAIP3ChainId=(params: ChainIdParams): params is CAIP3ChainIdParams=>{if(params.namespace!=="eip155")returnfalse;try{// must parse as decimal numberparseInt(params.reference,10);}catch{returnfalse;}returntrue;};
we could bring in a more extensible validation library like ajv, or write our own based on some spec we define (a ValidatorSpec?), but imo may not be worth it unless validation logic gets out of hand.
The text was updated successfully, but these errors were encountered:
How should 'validation' specs be implemented, ala CAIP-3, CAIP-22, CAIP-29?
Proposal
I'm imagining that we introduce more specific
*Param
types, plus a functional validation function that looks something like:we could bring in a more extensible validation library like
ajv
, or write our own based on some spec we define (aValidatorSpec
?), but imo may not be worth it unless validation logic gets out of hand.The text was updated successfully, but these errors were encountered: