-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Feature Request
Description
The viewFunction convenience function currently only accepts argsBase64 for passing arguments. It would be more developer-friendly to also accept argsJson as an alternative, which would automatically be converted to base64.
Current API
viewFunction(params: {
accountId: string;
methodName: string;
argsBase64?: string;
// ...
})Proposed API
viewFunction(params: {
accountId: string;
methodName: string;
argsBase64?: string;
argsJson?: any; // New parameter
// ...
})Implementation Notes
- Should accept either
argsBase64orargsJson, but not both - When
argsJsonis provided, it should be JSON.stringify'd and then base64 encoded - Could potentially add a helper function like
viewFunctionAsJsonthat already exists but for input args
Benefits
- More intuitive API for JavaScript/TypeScript developers
- Reduces boilerplate of manually encoding JSON to base64
- Consistent with how other NEAR SDKs handle function arguments
Metadata
Metadata
Assignees
Labels
No labels