@settlemint/sdk-ipfs
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

SettleMint logo

SettleMint SDK

https://settlemint.com
Integrate SettleMint into your application with ease.

CI status License npm stars

Documentation   •   NPM   •   Issues

Table of Contents

About

The SettleMint IPFS SDK provides a simple way to interact with IPFS (InterPlanetary File System) through the SettleMint platform. It enables you to easily store and retrieve files using IPFS in a decentralized manner.

For detailed information about using IPFS with the SettleMint platform, check out our official documentation.

API Reference

Functions

createIpfsClient()

createIpfsClient(options): object

Defined in: sdk/ipfs/src/ipfs.ts:31

Creates an IPFS client for client-side use

Parameters
Parameter Type Description
options { instance: string; } Configuration options for the client
options.instance string The URL of the IPFS instance to connect to
Returns

object

An object containing the configured IPFS client instance

Name Type Defined in
client KuboRPCClient sdk/ipfs/src/ipfs.ts:31
Throws

Will throw an error if the options fail validation

Example
import { createIpfsClient } from '@settlemint/sdk-ipfs';

const { client } = createIpfsClient({
  instance: 'https://ipfs.settlemint.com'
});

// Upload a file using Blob
const blob = new Blob(['Hello, world!'], { type: 'text/plain' });
const result = await client.add(blob);
console.log(result.cid.toString());

createServerIpfsClient()

createServerIpfsClient(options): object

Defined in: sdk/ipfs/src/ipfs.ts:60

Creates an IPFS client for server-side use with authentication

Parameters
Parameter Type Description
options { accessToken: string; instance: string; } Configuration options for the client including authentication
options.accessToken string The access token used to authenticate with the SettleMint platform
options.instance string The URL of the IPFS instance to connect to
Returns

object

An object containing the authenticated IPFS client instance

Name Type Defined in
client KuboRPCClient sdk/ipfs/src/ipfs.ts:60
Throws

Will throw an error if called on the client side or if options validation fails

Example
import { createServerIpfsClient } from '@settlemint/sdk-ipfs';

const { client } = createServerIpfsClient({
  instance: process.env.SETTLEMINT_IPFS_ENDPOINT,
  accessToken: process.env.SETTLEMINT_ACCESS_TOKEN
});

// Upload a file using Blob
const blob = new Blob(['Hello, world!'], { type: 'text/plain' });
const result = await client.add(blob);
console.log(result.cid.toString());

Contributing

We welcome contributions from the community! Please check out our Contributing guide to learn how you can help improve the SettleMint SDK through bug reports, feature requests, documentation updates, or code contributions.

License

The SettleMint SDK is released under the FSL Software License. See the LICENSE file for more details.

Package Sidebar

Install

npm i @settlemint/sdk-ipfs

Weekly Downloads

5,639

Version

1.1.5

License

FSL-1.1-MIT

Unpacked Size

29.1 kB

Total Files

9

Last publish

Collaborators

  • roderik
  • patrickmualaba