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

@satoshipay/stellar-sep-6

v0.1.0

Published

[Stellar Ecosystem Proposal 6 - "Anchor/Client interoperability"](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0006.md) client SDK, allowing Stellar wallets to withdraw or deposit third-party fiat or crypto assets like USD, EURT,

Downloads

7

Readme

@satoshipay/stellar-sep-6

Stellar Ecosystem Proposal 6 - "Anchor/Client interoperability" client SDK, allowing Stellar wallets to withdraw or deposit third-party fiat or crypto assets like USD, EURT, BTC, ETH, ...

That means that users can send EURT to the anchor, requesting a payout in fiat EUR to their SEPA account via bank transfer, for instance.

Note: This package is still considered experimental. Breaking changes should be expected.

Installation

npm install @satoshipay/stellar-sep-6
# or with yarn:
yarn add @satoshipay/stellar-sep-6

Concepts

  • Deposit - Send some value outside the Stellar network to the anchor who will send us tokens on the Stellar network
  • KYC (Know your customer) - Prove your identity to the anchor to meet anti-money-laundering regulations
  • Transfer server - That is the anchor's service responsible for deposit/withdrawal of tokens
  • Withdrawal - Send tokens on the Stellar network to its anchor who will pay us out outside the Stellar network

Usage

Look up an anchor's transfer server

import { fetchTransferServerURL } from "@satoshipay/stellar-sep-6"
import { Server } from "stellar-sdk"

const horizon = new Server("https://stellar-horizon.satoshipay.io/")
const eurtIssuer = "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S"

const transferServerURL: string | null = await fetchTransferServerURL(
  horizon,
  eurtIssuer
)

Fetch transfer server metadata

import { TransferServer } from "@satoshipay/stellar-sep-6"

const transferServer = TransferServer(transferServerURL)
const info = await transferServer.fetchInfo()

Request a withdrawal

import { TransferServer } from "@satoshipay/stellar-sep-6"
import { Keypair } from "stellar-sdk"

const myKeypair = Keypair.fromSecret("S...")
const transferServer = TransferServer(transferServerURL)

const result = await transferServer.withdraw("bank_account", "EURT", {
  account: myKeypair.publicKey(),

  // The `fetchInfo()` result describes what needs to be passed here
  dest: "DE00 1234 5678 9012 3456 00",
  dest_extra: "NOLADEXYZ"
})

if (result.type === "success") {
  // `result.data` contains the information where and how to send the tokens
  // to initiate the withdrawal...
} else if (
  result.type === "kyc" &&
  result.data.type === "interactive_customer_info_needed"
) {
  // Redirect to anchor's KYC page...
} else if (
  result.type === "kyc" &&
  result.data.type === "non_interactive_customer_info_needed"
) {
  // Request KYC data from the user in our app, then send to anchor...
} else if (
  result.type === "kyc" &&
  result.data.type === "customer_info_status"
) {
  // `result.data.status` will be "pending" or "denied"
  // If the KYC succeeded, the anchor will not send this response, but `result.type = "success"`
}

Bulk operations

import {
  fetchAssetTransferInfos,
  fetchTransferServers,
  TransferInfo
} from "@satoshipay/stellar-sep-6"
import { Asset, Server } from "stellar-sdk"

const assets = [
  new Asset("EURT", "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S"),
  new Asset("USD", "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX")
]
const horizon = new Server("https://stellar-horizon.satoshipay.io/")

const assetTransferServers: Map<
  Asset,
  TransferServer | null
> = await fetchTransferServers(horizon, assets)
const assetTransferInfos: Map<
  Asset,
  AssetTransferInfo
> = await fetchAssetTransferInfos(assetTransferServers)

interface AssetTransferInfo {
  deposit: TransferInfo["deposit"][""] // Deposit metadata for this asset
  transferInfo: TransferInfo // Complete server metadata of this anchor
  withdraw: TransferInfo["withdraw"][""] // Withdrawal metadata for this asset
}

Response types

We provide TypeScript type declarations for all responses of the /info, /deposit & /withdraw endpoints. See src/responses.ts.

License

GPL v3