@etherna/sdk-js
Version:
Etherna SDKs for operations on the network
82 lines • 2.71 kB
TypeScript
import type { EthernaGatewayClient } from ".";
import type { RequestOptions } from "..";
import type { GatewayBatch, GatewayBatchPreview, GatewayCredit, GatewayCurrentUser } from "./types";
export declare class UsersClient {
private instance;
constructor(instance: EthernaGatewayClient);
/**
* Get the current logged user's info
* @returns Gateway current user
*/
fetchCurrentUser(opts?: RequestOptions): Promise<GatewayCurrentUser>;
/**
* Get current user's credit
*
* @returns User's credit amount
*/
fetchCredit(opts?: RequestOptions): Promise<GatewayCredit>;
/**
* Get current user's pinned resources
*
* @returns List of resources references
*/
fetchPinnedResources(opts?: RequestOptions): Promise<string[]>;
/**
* Get current user's batches
*
* @returns User's list of batches
*/
fetchBatches(labelQuery?: string, opts?: RequestOptions): Promise<GatewayBatchPreview[]>;
/**
* Fetch the current user's welcome status
*
* @param opts Request options
* @returns User's welcome status
*/
fetchWelcome(opts?: RequestOptions): Promise<{
isFreePostageBatchConsumed: boolean;
}>;
/**
* Create a new batch
*
* @param depth Depth of the batch (size)
* @param amount Amount of the batch (TTL)
* @returns The newly created batch
*/
createBatch(depth: number, amount: bigint | string, label?: string, opts?: RequestOptions): Promise<GatewayBatch>;
/**
* Get current user's batches
*
* @param batchId Id of the swarm batch
* @returns User's list of batches
*/
fetchBatch(batchId: string, opts?: RequestOptions): Promise<GatewayBatch>;
/**
* Dilute batch (increase size)
*
* @param batchId Id of the swarm batch
* @param depth New batch depth
*/
diluteBatch(batchId: string, depth: number, opts?: RequestOptions): Promise<boolean>;
/**
* Get current user's offered resources
*
* @returns Reference list of offered resources
*/
fetchOfferedResources(opts?: RequestOptions): Promise<string[]>;
/**
* Request the creations of the offered postage batch (only for new users)
*
* @param opts Request options
* @returns 'true' if the request was successful
*/
requestWelcomePostage(opts?: RequestOptions): Promise<boolean>;
/**
* Fetch creation batch id
*
* @param referenceId Reference id of the batch
* @returns The created batch id if completed
*/
fetchPostageBatchRef(referenceId: string, opts?: RequestOptions): Promise<string>;
}
//# sourceMappingURL=users.d.ts.map