0.0.4 • Published 9 months ago

@lumora/sns-sdk v0.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

StorynamesSDK

A TypeScript SDK for interacting with the Story Names service on Story Protocol. This library provides functionalities for name resolution, reverse resolution, retrieving text records, content hashes, and more.

Features

  • Resolve Storynames to EVM addresses.
  • Perform reverse resolution to find primary names associated with addresses.
  • Retrieve text records for Storynames: telegram, twitter, discord, website.
  • Retrieve Avatar for Storynames.
  • Fetch content hashes for Storynames.
  • UI Component to display Storynames information.

Installation

Install the SDK using npm or yarn:

npm install storynames-sdk

or

yarn add storynames-sdk

Usage

Import the SDK

import { StorynamesSDK } from "storynames-sdk";

Initialization

Create an instance of the SDK by specifying the network (odyssey or mainnet later):

const storynames = new StorynamesSDK("odyssey");

Methods

getAddress(name: string): Promise

Resolve a Storyname .ip to an EVM address.

const address = await storynames.getAddress("example.ip");
console.log("Resolved Address:", address);

getName(address: string): Promise

Retrieve the primary name associated with an EVM address. If no name is set, the address itself is returned.

const name = await storynames.getName("0x1234567890abcdef...");
console.log("Primary Name:", name);

getText(name: string, key: string): Promise

Fetch a specific text record for a Story name. This can be particularly useful for retrieving social information associated with a user.

const textRecord = await storynames.getText("example.ip", "twitter");
console.log("Twitter Record:", textRecord);

getContent(name: string): Promise

Retrieve the content hash for a Storyname.

const contentHash = await storynames.getContent("example.ip");
console.log("Content Hash:", contentHash);
0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago