Client class for the Krist API.
Options for the Krist API client.
Checks whether a name is available to be purchased.
https://krist.dev/docs/#api-NameGroup-CheckName
Whether the name is available.
The name to check the availability of, without the .kst
suffix.
Gets the amount of KST that is currently added to the base block reward. Essentially, this is the count of names registered in the last 500 blocks.
Block submission is currently disabled, so all new names will increase the bonus, but this does not currently mean anything.
The name bonus.
Get a list of names, sorted by name
ascending.
This method must be manually paginated, see paginateNames to do this automatically.
https://krist.dev/docs/#api-NameGroup-GetNames
The list of names.
Optional
options: KristApiPaginationOptionsGet a list of the newest names, sorted by registered
descending.
This method must be manually paginated, see paginateNewNames to do this automatically.
https://krist.dev/docs/#api-NameGroup-GetNewNames
The list of names.
Optional
options: KristApiPaginationOptionsPaginates the list of names, sorted by name
ascending.
The callback onPageFn
will be called for each page of results. The first
argument of the callback will be the array of KristName results for
that page. The second argument of the callback will be the total number of
results for the query. If the callback returns false
, pagination will stop.
https://krist.dev/docs/#api-NameGroup-GetNames
The total number of results for the query.
Optional
initialOptions: KristApiPaginationOptionsOptional
onPageFn: OnPageFn<KristName>Callback called for each page of results.
Paginates the list of names, sorted by registered
descending.
The callback onPageFn
will be called for each page of results. The first
argument of the callback will be the array of KristName results for
that page. The second argument of the callback will be the total number of
results for the query. If the callback returns false
, pagination will stop.
https://krist.dev/docs/#api-NameGroup-GetNewNames
The total number of results for the query.
Optional
initialOptions: KristApiPaginationOptionsOptional
onPageFn: OnPageFn<KristName>Callback called for each page of results.
Gets a list of names owned by the address, sorted by name
ascending.
This method must be manually paginated, see paginateAddressNames to do this automatically.
https://krist.dev/docs/#api-AddressGroup-GetAddressNames
The list of names.
The address to get names for.
Optional
options: KristApiPaginationOptionsGet a list of recent transactions involving an address, sorted by id
descending.
This method must be manually paginated, see paginateAddressTransactions to do this automatically.
https://krist.dev/docs/#api-AddressGroup-GetAddressTransactions
The list of addresses.
Optional
options: KristApiTransactionPaginationOptionsGet a list of addresses, sorted by firstseen
ascending.
This method must be manually paginated, see paginateAddresses to do this automatically.
https://krist.dev/docs/#api-AddressGroup-GetAddresses
The list of addresses.
Optional
options: KristApiPaginationOptionsGet a list of the richest addresses, sorted by balance
descending.
This method must be manually paginated, see paginateRichAddresses to do this automatically.
https://krist.dev/docs/#api-AddressGroup-GetRichAddresses
The list of addresses.
Optional
options: KristApiPaginationOptionsPaginates the list of names owned by an address, sorted by name
ascending.
The callback onPageFn
will be called for each page of results.
The first argument of the callback will be the array of KristName
results for that page. The second argument of the callback will be the total
number of results for the query. If the callback returns false
, pagination
will stop.
https://krist.dev/docs/#api-AddressGroup-GetAddressNames
The total number of results for the query.
The address to get names for.
Optional
initialOptions: KristApiPaginationOptionsOptional
onPageFn: OnPageFn<KristName>Callback called for each page of results.
Paginates the list of recent transactions involving an address, sorted by
id
descending.
The callback onPageFn
will be called for each page of results. The first
argument of the callback will be the array of KristTransaction
results for that page. The second argument of the callback will be the total
number of results for the query. If the callback returns false
, pagination
will stop.
https://krist.dev/docs/#api-AddressGroup-GetAddressTransactions
The total number of results for the query.
The address to get recent transactions for.
Optional
initialOptions: KristApiPaginationOptionsOptional
onPageFn: OnPageFn<KristTransaction>Callback called for each page of results.
Paginates the list of addresses, sorted by firstseen
ascending.
The callback onPageFn
will be called for each page of results. The first
argument of the callback will be the array of KristAddress results
for that page. The second argument of the callback will be the total number
of results for the query. If the callback returns false
, pagination will
stop.
https://krist.dev/docs/#api-AddressGroup-GetAddresses
The total number of results for the query.
Optional
initialOptions: KristApiPaginationOptionsOptional
onPageFn: OnPageFn<KristAddress>Callback called for each page of results.
Paginates the list of the richest addresses, sorted by balance
descending.
The callback onPageFn
will be called for each page of results.
The first argument of the callback will be the array of KristAddress
results for that page. The second argument of the callback will be the total
number of results for the query. If the callback returns false
, pagination
will stop.
https://krist.dev/docs/#api-AddressGroup-GetRichAddresses
The total number of results for the query.
Optional
initialOptions: KristApiPaginationOptionsOptional
onPageFn: OnPageFn<KristAddress>Callback called for each page of results.
Get a list of transactions, sorted by id
descending.
This method must be manually paginated, see paginateLatestTransactions to do this automatically.
https://krist.dev/docs/#api-TransactionGroup-GetLatestTransactions
The list of transactions.
Optional
options: KristApiTransactionPaginationOptionsGets a single transaction by its ID.
https://krist.dev/docs/#api-TransactionGroup-GetTransaction
The transaction.
The ID of the transaction to get.
Get a list of transactions, sorted by id
ascending.
This method must be manually paginated, see paginateTransactions to do this automatically.
https://krist.dev/docs/#api-TransactionGroup-GetTransactions
The list of transactions.
Optional
options: KristApiTransactionPaginationOptionsPaginates the list of transactions, sorted by id
descending.
The callback onPageFn
will be called for each page of results. The first
argument of the callback will be the array of KristTransaction
results for that page. The second argument of the callback will be the total
number of results for the query. If the callback returns false
, pagination
will stop.
https://krist.dev/docs/#api-TransactionGroup-GetLatestTransactions
The total number of results for the query.
Optional
initialOptions: KristApiTransactionPaginationOptionsOptional
onPageFn: OnPageFn<KristTransaction>Callback called for each page of results.
Paginates the list of transactions, sorted by id
ascending.
The callback onPageFn
will be called for each page of results. The first
argument of the callback will be the array of KristTransaction
results for that page. The second argument of the callback will be the total
number of results for the query. If the callback returns false
, pagination
will stop.
https://krist.dev/docs/#api-TransactionGroup-GetTransactions
The total number of results for the query.
Optional
initialOptions: KristApiTransactionPaginationOptionsOptional
onPageFn: OnPageFn<KristTransaction>Callback called for each page of results.
Optional
options: KristAuthOptionsGets the money supply - the amount of Krist currently in circulation. This is calculated as the sum of all address balances, but due to historical discrepancies in the Krist database, it is not necessarily the same value as the amount of Krist ever mined.
https://krist.dev/docs/#api-MiscellaneousGroup-GetMoneySupply
The amount of Krist currently in circulation.
Sends a transaction to the given address.
https://krist.dev/docs/#api-TransactionGroup-MakeTransaction
The KristTransaction that was made.
The address to send the transaction to. May be a Krist address or a name.
The amount to send.
Optional
options: KristApiMakeTransactionOptionsThe KristApiMakeTransactionOptions options for the request. If a password or private key are not supplied, the request will error.
Registers a new name. A name costs 500 KST to register.
https://krist.dev/docs/#api-NameGroup-RegisterName
The KristName that was made.
The name you want to register, without the .kst
suffix.
Optional
options: KristAuthOptionsThe KristAuthOptions options for the request. If a password or private key are not supplied, the request will error.
Transfers the name to another owner. You must be the owner of the name to transfer it.
https://krist.dev/docs/#api-NameGroup-TransferName
The KristName that was transferred.
The name you want to transfer, without the .kst
suffix.
The address you want to transfer the name to.
Optional
options: KristAuthOptionsThe KristAuthOptions options for the request. If a password or private key are not supplied, the request will error.
Updates the data of a name. You must be the owner of the name to update it.
https://krist.dev/docs/#api-NameGroup-UpdateNamePOST
The KristName that was updated.
The name you want to update, without the .kst
suffix.
Optional
data: null | stringThe data you want to set for the name, or null
to remove the
name's data.
Optional
options: KristAuthOptionsThe KristAuthOptions options for the request. If a password or private key are not supplied, the request will error.
Private
syncPrivate
userCreates a new Krist WebSocket client with the specified options. If a password or private key are not supplied, the connection will be a "guest" connection. The WebSocket client will automatically reconnect if the connection is lost. See KristWsClient for more information.
After calling createWsClient
, you can register event listeners with
ws.on(event, listener)
.
After registering the event listeners, you must call ws.connect();
to
begin the connection to the Krist server.
See KristWsClient for a full list of supported events and methods.
Connecting to the Krist API and listening for global transaction events:
import { KristApi } from "krist";
const api = new KristApi();
// Create a new websocket client. Subscribe to all transaction events
const ws = api.createWsClient({
initialSubscriptions: ["transactions"]
});
// Set up the event listeners before connecting
ws.on("transaction", transaction => {
console.log("New transaction received:", transaction);
});
ws.on("ready", async () => {
// Connected! Requests can now be made to the websocket server:
const me = await ws.getMe();
console.log("Websocket client now ready! I am:", me);
});
ws.connect(); // Connect to the websocket server
A new KristWsClient instance.
Optional
options: KristWsClientOptionsThe KristWsClientOptions options for the WebSocket client. If a password or private key are not supplied, the connection will be a "guest" connection.
Make a raw GET request to the Krist API. The methods for a specific API request should be used instead of this function.
The response of the request.
The type of the response body when parsed as JSON.
The endpoint to request, starting with /
.
Optional
qs: anyThe query string to use for the request. May be an object or a string.
Optional
options: RequestInitThe fetch options to use for the request.
Make a raw POST request to the Krist API. The methods for a specific API request should be used instead of this function.
The response of the request.
The type of the response body when parsed as JSON.
The endpoint to request, starting with /
.
Optional
body: anyOptional
qs: anyThe query string to use for the request. May be an object or a string.
Optional
options: RequestInitThe fetch options to use for the request.
Make a raw request to the Krist API. The methods for a specific API request should be used instead of this function.
The response of the request.
The type of the response body when parsed as JSON.
The HTTP method to use for the request.
The endpoint to request, starting with /
.
Optional
qs: anyThe query string to use for the request. May be an object or a string.
Optional
options: RequestInitThe fetch options to use for the request.
Generated using TypeDoc
Client class for the Krist API. Options may be specified as a constructor parameter.