The Flux API Library provides a convenient way to interact with the Flux API for managing wallets, transactions, and names. This library simplifies the process of making API calls and handling responses, allowing developers to focus on building their applications.
To install the Flux API Library, you can use npm or yarn:
npm install @ivanoliverfabra/flux
# or
yarn add @ivanoliverfabra/flux
# or
pnpm add @ivanoliverfabra/flux
# or
bun add @ivanoliverfabra/flux
To use the Flux API Library, first import it into your project:
import Flux from "@ivanoliverfabra/flux";
Then, create an instance of the Flux class with optional configuration options:
const flux = new Flux({
apiUrl: "https://api.fabra.live",
apiVersion: "v1",
});
Retrieve a list of wallets:
const wallets = await flux.wallets.get({ page: 1, limit: 10 });
Create a new wallet:
const newWallet = await flux.wallets.create();
Retrieve a list of rich wallets:
const richWallets = await flux.wallets.rich({ page: 1, limit: 10 });
Retrieve information about a specific wallet by its address:
const wallet = await flux.wallets.getByAddress("wallet_address");
Retrieve transactions associated with a specific wallet:
const transactions = await flux.wallets.getTransactions("wallet_address", {
page: 1,
limit: 10,
});
Retrieve names associated with a specific wallet:
const names = await flux.wallets.getNames("wallet_address");
Retrieve a list of transactions:
const transactions = await flux.transactions.get({ page: 1, limit: 10 });
Create a new transaction:
const newTransaction = await flux.transactions.create(
privateKey,
to,
amount,
metadata
);
Retrieve the latest transactions:
const latestTransactions = await flux.transactions.latest({
page: 1,
limit: 10,
});
Retrieve information about a specific transaction by its ID:
const transaction = await flux.transactions.getById("transaction_id");
#Get Names Retrieve a list of names:
const names = await flux.names.get({ page: 1, limit: 10 });
Retrieve the cost of a name:
const cost = await flux.names.cost();
Retrieve the latest names:
const latestNames = await flux.names.latest({ page: 1, limit: 10 });
Retrieve logs associated with a name:
const logs = await flux.names.logs({ page: 1, limit: 10 });
Retrieve information about a specific log by its ID:
const log = await flux.names.logById("log_id");
Retrieve logs associated with a specific name:
const logs = await flux.names.logsByName("name", { page: 1, limit: 10 });
Retrieve information about a specific name by its name:
const name = await flux.names.getByName("name");
Create a new name:
const newName = await flux.names.create(privateKey, "name");
Transfer ownership of a name:
const transfer = await flux.names.transfer(
privateKey,
"name",
"new_owner_address"
);
Check if a name is available:
const isAvailable = await flux.names.isAvailable("name");
Contributions are welcome! Feel free to open issues and pull requests on the GitHub repository.
This library is licensed under the MIT License.