Hive Coding avatar

Hive Astro Loader 0.2 Released

hive.coding

Published: 24 Nov 2024 › Updated: 24 Nov 2024Hive Astro Loader 0.2 Released

Hive Astro Loader 0.2 Released

Today the package @onhive.io/astro-loader has been released in version 0.2.1 with a brand new accounts loader!



• • •

The new loader allows you to fetch information about a single or multiple accounts in one API call. The usage is very straightforward:

import { defineCollection } from "astro:content";
import { hiveAccountsLoader } from "@onhive.io/astro-loader";

export const collections = {
  accounts: defineCollection({
    type: "content_layer",
    loader: hiveAccountsLoader("hive.coding") // or ["hive.coding", "mciszczon"] for multiple accounts
  })
};

The returned account(s) will have the following format (TypeScript definitions taken from the code of the library):

export type Account = {
  id: string;
  name: string;
  created: Date;
  wallet: Wallet;
  postCount: number;
  profile: Profile;
};

export type Wallet = {
  hive: {
    liquid: Money implements;
    frozen: Money;
  };
  hbd: {
    liquid: Money;
    frozen: Money;
  };
};

export interface MoneyInterface {
  currency: string;
  amount: string;
  precision: number;

  asFloat(): number;
}

class Money implements MoneyInterface { ... }

More loaders are coming soon. Feel free to contribute to the code directly, report bugs or request features!

The library is available at npm.

In order to contribute, head over to: instytutfi/hive-astro-loader



• • •

Hive Coding:
Fueling Hive development through community effort

Thank you for your support!

hive.coding@hive.codingOnHive.io

Leave Hive Astro Loader 0.2 Released to:

Written by

Building software & teaching others about the Hive blockchain. Made by @mciszczon

Read more #hive-139531 posts


Best Posts From Hive Coding

We have not curated any of hive.coding's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Hive Coding