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
When calling the 'view_account' method, the returned account storage bytes should be parsed to a readable format.
I used a custom solution for a near-todo-app I'm currently working on. Here's it:
`formatNearBytes(b) {
const units = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
let l = 0,
n = parseInt(b, 10) || 0;
while (n >= 1024 && ++l) {
n = n / 1024;
}
return n.toFixed(n < 10 && l > 0 ? 1 : 0) + " " + units[l];
}`
IMO, this should be native to the near-api-js format.ts lib
The text was updated successfully, but these errors were encountered:
When calling the 'view_account' method, the returned account storage bytes should be parsed to a readable format.
I used a custom solution for a near-todo-app I'm currently working on. Here's it:
`formatNearBytes(b) {
const units = ["bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
}`
IMO, this should be native to the near-api-js format.ts lib
The text was updated successfully, but these errors were encountered: