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 🙏

© 2024 – Pkg Stats / Ryan Hefner

starmap-api

v1.2.8

Published

Starmap Verified Public Directory Service API

Downloads

83

Readme

starmap

starmap.network

A verified on-chain Solana directory service.

SYSTEM OVERVIEW

Starmap is a Solana program that maps public identifiers ("PI") to wallet addresses. These mapping entries in Starmap are called name records. Currently-supported PIs include email address and phone number. Unverified aliases called Stars accounts will be available soon.

This API enables a user ("sender") to query Starmap to find the wallet address associated with a public identifier ("PI") such as an email address or phone number. The sender can then directly send SOL or tokens to the recipient. Alternatively, if there is no wallet currently associated, the sender can create an escrow account, send funds to the escrow, and notify the recipient. Flow details are below.

Additionally, a user ("recipient") can use this API to create a name record and to receive escrow funds.

If the recipient cannot claim the name record, the sender can cancel the escrow and reclaim their funds. All that with no calls to customer service! The only permissioned part of the system is claiming of name records.

API FLOW

With the exception of InitFee and Verify, the client can directly interact with the blockchain

SENDER ACTIONS

SEARCH

  1. Validate and normalize the name using parseName
  2. Abort if recordType is Invalid
  3. Fetch the name record using retrieveNameRegistry
  4. Confirm record.isAssignedAndValid
  5. Use record.owner

PAYMENT WITH NOTIFICATIONS

For transactions of value > $1 USD, Star Map can send the recipient an email notification.

  1. Client generates a transaction ID keypair (similar to Solana Pay)
  2. Client ensures the recipient has a respective associated token account
    1. If it does not exist, the client can abort or pay to create the destination token account transferAndNotify
  3. Client uses the transferAndNotify API to execute the transfer and create a notification request
  4. Client calls notification endpoint to send the notification and refund the request account rent.

DIRECT PAYMENT

  • Using wallet address above, wallet or app can send SOL or tokens.

ESCROWED PAYMENT

If the NameRecord does not exist or has no owner, the sender can create an escrow record and an associated token account that is owned by the escrow record.

  1. The sender can then transfer tokens (including wrapped SOL) to the token account.
  2. Until the name record is claimed, the escrow owner can withdraw funds from their escrow record's associated token accounts to cancel the escrow.

REGISTRATION & RECIPIENT ACTIONS

  1. InitFee (Stars-only)
    1. Client requests fee information for Stars records.
  2. Authorize and Pay
    1. Client pays for fees. Stars records are assigned at this step.
  3. Send Verification Request (N/A for Stars)
    1. Client submits PI to verification server.
    2. Server performs verification request and consumes verification fee on blockchain.
    3. Server 200 response indicates that verification request was sent.
  4. Complete Verification (N/A for Stars)
    1. Client submits verification code, PI, and pubkey to verification server.
    2. Server performs assignment and consumes assignment fee on blockchain.
    3. Server 200 response indicates that assignment is complete.
  5. Withdrawal
    1. Client withdrawals escrowed funds using blockchain client or RPC. This is useful if funds were sent before name registry creation/assignment.
    2. If SPL tokens are supported, those should also be transferred.

RECORD FORMAT

A name record contains:

  1. A major version which allows breaking changes
  2. A record type that indicates the type of public identifier and expected signatory
  3. A state bitfield for internal state management
    1. Payment status bits for verify attempt and assignment
    2. A lock bit that the name owner can set to prevent reassignment
    3. A notify bit that enables/disables notifications
  4. The pubkey of the signatory who assigned ownership
  5. The pubkey of the name owner who is allowed to
    1. Withdraw escrowed funds
    2. Update associated data
    3. Transfer account ownership
    4. Modify flags such as the lock flag and notify flag
    5. Delete the record
  6. [OPTIONAL] Additional data such as routing addresses

See also state.ts

DEVELOPER

Test:

npm test

INSTALL

npm i --save starmap-api

VALIDATED GET EXAMPLE

import { RecordType, retrieveNameRegistry, parseName } from 'starmap-api';

async function main() {
  let input = '+12345678910';
  const { recordType, name, parseError } = parseName(input);
  if (recordType == RecordType.Invalid) {
    console.log('Invalid identifier: %s', name);
    console.log('Error: %s', parseError.message);
    return;
  }
  console.log('Retrieve identifier:', name);
  const url = 'https://api.mainnet-beta.solana.com';
  const connection = new Connection(url, 'recent');
  let res = await retrieveNameRegistry(connection, name, recordType);
  if (res.isAssignedAndValid) {
    console.log('---Record---');
    console.log('Owner:', res.owner.toBase58());
  } else {
    console.log('Name not assigned');
  }
}

main()
  .catch((err) => {
    console.error(err);
    process.exit(-1);
  })
  .then(() => process.exit());

Contact

Gmail: starmap.network

Discord

Issues