Hub JS Package

Hub JS Package

  • Users
  • Buckets
  • Threads
  • Textile Docs

@textile/hub > Filecoin

Filecoin class

Filecoin is a client wrapper for interacting with the Textile Hub Filecoin API.

Signature:

export declare class Filecoin extends GrpcAuthentication 

Extends: GrpcAuthentication

Example

Initialize the Bucket API and open an existing bucket (or create if new).

import { Filecoin, PrivateKey, UserAuth } from '@textile/hub'

const getAddresses = async (auth: UserAuth, user: PrivateKey) => {
  const filecoin = Filecoin.withUserAuth(auth)
  // Scope the API to the current user
  await filecoin.getToken(user)
  // List wallet addresses
  const health = await filecoin.addresses()
}

Methods

MethodModifiersDescription
addresses()(BETA) List all Filecoin wallet addresses associated with the current account or user.
balance(address)(BETA) Get the balance for any wallet address.
cidInfo(cid)(BETA) Get information about the storage and storage job state of a cid stored by the user.
cidSummary(cids)(BETA) Get summary information about the storage and storage job state of cids stored by the user.
copyAuth(auth, options)staticCopies the full scope and authentication from one API instance to this one. This will copy any existing authentication and authorization info, including:- Information created withKeyInfo and withUserAuth.- Any token generated from getToken or getTokenChallenge.- If you scoped the instance to a specific thread using withThread
getToken(identity)Obtain a token for interacting with the remote API. When your app is creating new private-key based users to interact with the API using User Group keys, you must first create a new token for each new user. Tokens do not change after you create them.
getTokenChallenge(publicKey, callback)Obtain a token for interacting with the remote API. When your app is creating new private-key based users to interact with the API using User Group keys, you must first create a new token for each new user. Tokens do not change after you create them. This callback method will require you to handle challenge signing.
retrievalDealRecords(config)(BETA) Query for Filecoin retrieval deal records for the current account/user.
setToken(token)Obtain a token for interacting with the remote API. When your app is creating new private-key based users to interact with the API using User Group keys, you must first create a new token for each new user. Tokens do not change after you create them.
storageDealRecords(config)(BETA) Query for Filecoin storage deal records for the current account/user.
withKeyInfo(key, options)staticCreates a new API client instance for accessing the gRPC API using key & secret based authentication. This method is recommended for admin or insecure implementations where the non-signing keys or key with secret can be embedded directly in an app.
withUserAuth(auth, options)staticCreates a new API client instance for accessing the gRPC API using User Group key authentication. This method is recommended for public apps where API secrets need to remain hidden from end users.
  • Filecoin class
  • Example
  • Methods
Hub JS Package
Docs
Getting StartedThreadDBBuckets
Resources
All DocumentationProject SlackBlog
More
GitHubStar
Follow @textileio