npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@filedgr/filedgr-template-sdk

v1.11.0

Published

SDK to allow simple access to Filedgr attested data, using templates

Readme

Filedgr Template SDK

A TypeScript/JavaScript SDK for interacting with the Filedgr Template API. This SDK provides easy access to Filedgr's attested data management functionalities using templates.

For comprehensive documentation, please visit: https://filedgr-docs.netlify.app/

Features

  • Template-based data management
  • Attested data retrieval
  • TypeScript support with full type definitions
  • Environment-specific configurations (dev, test, prod)
  • Promise-based async API
  • Public access token available for testing.

Installation

npm install @filedgr/filedgr-template-sdk
# or
yarn add @filedgr/filedgr-template-sdk

Quick Start

You can use the public token 'public' to test the SDK:

import FiledgrTemplateApi, { Constants, Types } from '@filedgr/filedgr-template-sdk';

// Initialize the SDK with public token
const client = new FiledgrTemplateApi({
  bearerToken: 'public',
  environment: Constants.Environment.DEV // Optional: defaults to DEV
});

// Get stream attachments
const streamAttachments = await client.getTokensAttachment({
  tokenCode: 'FLDGR_aIXzDt',
  pageSize: '10', // Optional
  page: '1'      // Optional
});

// Get specific data attachment
const dataAttachment = await client.getDataAttachment('26eb8860-1c37-4978-8658-84270e65d11e');

Configuration

The SDK can be initialized with different configurations:

// Default configuration (DEV environment) with public token
const defaultClient = new FiledgrTemplateApi({
  bearerToken: 'public'
});

// Test environment
const testClient = new FiledgrTemplateApi({
  bearerToken: 'public',
  environment: Constants.Environment.TEST
});

// Production environment
const prodClient = new FiledgrTemplateApi({
  bearerToken: 'public', // Note: Public token might have limited access in production
  environment: Constants.Environment.PROD
});

// Custom API URL
const customClient = new FiledgrTemplateApi({
  bearerToken: 'public',
  baseUrl: 'https://your-custom-url.com'
});

API Reference

getVaultByLedger

Retrieves vault information for a given vault network ID and ledger.

const client = new FiledgrTemplateApi({ bearerToken: 'public' });

const response = await client.getVaultByLedger(
  'vault-network-id',
  Types.NetworkServerNames.XRPL
);

Response type: Types.VaultModel

interface VaultModel {
  id: string;
  created_at: string;
  name: string;
  description: string;
  template_id: string;
  status: VaultStatus;
  ledger: string;
  // ... other fields
}

IPFS File Downloads

The SDK provides methods to download files from IPFS, supporting both public and private resources.

// Download and save a public file
await client.downloadAndSaveIPFSFile({
  cid: 'your-cid',
  filename: 'document.pdf',
  mimeType: 'application/pdf',
  isPublic: true
});

// Download and save a private file with ledger info
await client.downloadAndSaveIPFSFile({
  cid: 'your-cid',
  filename: 'private-document.pdf',
  mimeType: 'application/pdf',
  isPublic: false,
  ledgerInfo: {
    tx_hash: 'transaction-hash',
    ledger: Types.NetworkServerNames.XRPL
  }
});

getTokensAttachment

Retrieves stream attachments for a given token code.

const client = new FiledgrTemplateApi({ bearerToken: 'public' });

const response = await client.getTokensAttachment({
  tokenCode: 'FLDGR_aIXzDt',
  pageSize: '10',  // Optional, defaults to '10'
  page: '1'        // Optional, defaults to '1'
});

Response type: Types.StreamAttachmentResponse

interface StreamAttachmentResponse {
  total_records: number;
  current_page: number;
  total_pages: number;
  content: GetDataAttachmentResponse[];
}

getDataAttachment

Retrieves detailed information about a specific data attachment.

const client = new FiledgrTemplateApi({ bearerToken: 'public' });

const response = await client.getDataAttachment('26eb8860-1c37-4978-8658-84270e65d11e');

Response type: Types.GetDataAttachmentResponse

interface GetDataAttachmentResponse {
  id: string;
  created_at: string;
  name: string;
  status: DataAttachmentStatus;
  // ... other fields
}

Environment Variables

The SDK supports three environments with their respective API and IPFS endpoints:

  • Development (DEV):
    • API: https://template-api.dev.filedgr.network
    • Public IPFS: ipfs.pub.dev.filedgr.network
    • Private IPFS: ipfs.priv.dev.filedgr.network
  • Testing (TEST):
    • API: https://template-api.test.filedgr.network
    • Public IPFS: ipfs.pub.test.filedgr.network
    • Private IPFS: ipfs.priv.test.filedgr.network
  • Production (PROD):
    • API: https://template-api.filedgr.network
    • Public IPFS: ipfs.pub.filedgr.network
    • Private IPFS: ipfs.priv.filedgr.network

Error Handling

The SDK throws errors with descriptive messages for various scenarios:

try {
  const client = new FiledgrTemplateApi({ bearerToken: 'public' });
  const response = await client.getDataAttachment('invalid_id');
} catch (error) {
  if (error.message === 'Unauthorized') {
    // Handle authentication error
  } else {
    // Handle other errors
  }
}

Development

To contribute to the SDK:

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Run tests:
    npm test          # Run all tests
    npm run test:unit # Run unit tests only
    npm run test:integration # Run integration tests only

Types

The SDK includes TypeScript definitions for all responses and inputs. Key types include:

  • Types.DataAttachmentStatus
  • Types.FileAttachmentStatus
  • Types.NetworkServerNames
  • Types.StreamStatus
  • Types.StreamProgressStep
  • Types.GetDataAttachmentResponse
  • Types.StreamAttachmentResponse
  • Types.FileDto
  • Types.StreamDto

Example Data

Here are some example stream and attachment IDs you can use with the public token:

  • Stream Code: FLDGR_aIXzDt
  • Attachment ID: 26eb8860-1c37-4978-8658-84270e65d11e

License

MIT - see the LICENSE.md file for details

Support

For support, please:

  1. Check our documentation at https://filedgr-docs.netlify.app/
  2. Open an issue in the GitHub repository
  3. Contact [email protected]