Hive Astro Loader 0.2 Released

@hive.coding · 2024-11-24 20:52 · HiveDevs

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 • OnHive.io

#hive-139531 #hive #dev #programming #it #ecency #ecency
Payout: 0.000 HBD
Votes: 115
More interactions (upvote, reblog, reply) coming soon.