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

arcpay-sdk

v0.0.12

Published

arcpay is a web3 payment processor, facilitating the use of royalty points to purchase digital and real-world assets. The sdk provides a plug and play interface with arcpay contracts and enable users to create and purchase listings.

Downloads

238

Readme

arcpay-sdk

arcpay is a web3 payment processor, facilitating the use of royalty points to purchase digital and real-world assets. The sdk provides a plug and play interface with arcpay contracts and enable users to create and purchase listings.

Features

  • Supported chain: algorand:testnet, algorand:mainnet, voi:testnet, voi:mainnet (soon)

Installation

npm install arcpay-sdk

Usage

import { createClient, useArcpay } from 'arcpay-sdk';

// Instantiate the arcpay client singleton for a given network. Calling this method twice with the same network will return the same instance.
const arcpayClient = createClient('algo:testnet', {
  apiKey: '<your-api-key>', // API key can be obtained from the arcpay dashboard
});

// You can use the useArcpay helper to get the client instance after instantiating it.
const arcpayClient = useArcpay('algo:testnet');

// Create a VOI -> ARC-72 sale
const listingId: string = await arcpayClient.create({listingType: 'sale'});

// Get all listings for your account
const listings: Listing[] = await arcpayClient.getListings();

// Buy a listing
const confirmation: TransactionConfirmation = arcpayClient.buy(listingId);

Methods


createClient

Instantiate an arcpay client instance for a given network. Calling this method twice with the same network will return the same instance.

Parameters
  • network: PublicNetwork: The network to use. Use 'algo:testnet' for Algorand testnet. REQUIRED
  • options: ArcpayClientOptions: Options to instantiate the client REQUIRED
    • apiKey?: string: Account API key. Can be obtained from the arcpay dashboard. The API key origin must match the request's origin. API key is required in most cases unless client is provided.
    • darkMode?: boolean: Use dark mode for the arcpay modal. Default is false.
    • client?: SupabaseClient: SupabaseClient to use. if not provided API key is required. This is for advanced use cases and shouldn't be used in most cases.
Returns
  • ArcpayClient: Client object to interact with arcpay.

useArcpay

Return the arcpay client instance for a given network. This method is meant to be called from inside components, after instantiating the client using createClient.

Parameters
  • network: PublicNetwork: The network to use. Use 'algo:testnet' for Algorand testnet. REQUIRED
Returns
  • ArcpayClient: Client object to interact with arcpay.

client.create

Creates a new listing. Calling this method will display the arcpay listing creation modal to the user.

Parameters
  • options?: CreateOptions: Optional options to create listing
    • assetId?: string: Asset ID to create listing for. If provided, the asset will be automatically selected and displayed when the asset is present in the user's wallet. If not provided or not present in the user wallet, the user will be prompted to select an asset.
    • listingType?: ListingType: Listing type to create. When provided the listing type selection radio will be hidden from the UI. Default is sale.
    • listingName?: string: Name for the listing. If not provided, the asset name will be used.
    • tags?: string[]: Tags for the listing. Can be used to filter listings. Default is [].
    • accountId?: number: Account ID to create the listing for. This is for advanced use cases and shouldn't be used in most cases.
Returns
  • Promise<string>: A promise that resolves to the listing ID.

client.buy

Buy / bid on a listing. Calling this method will display the arcpay purchase modal to the user.

Parameters
  • id: string: Listing ID to purchase.
Returns
  • Promise<TransactionConfirmation>: A promise that resolves to the algosdk transaction confirmation object.

client.close

Close a listing. Calling this method will display the sign modal to close the listing. Listings such as auctions must be closed by their creator / winner for the winner to receive the asset.

Parameters
  • id: string: Listing ID to close.
Returns
  • Promise<TransactionConfirmation>: A promise that resolves to the algosdk transaction confirmation object.

client.cancel

Cancel a listing. Calling this method will display the sign modal to cancel the listing.

Parameters
  • id: string: Listing ID to cancel.
Returns
  • Promise<TransactionConfirmation>: A promise that resolves to the algosdk transaction confirmation object.

client.getListings

Returns all listings for the account.

Returns
  • Promise<Listing[]>: A promise that resolves to the list of listings.

client.getListingById

Returns details for a listing given it's ID.

Parameters
  • id: string: Listing ID to query.
Returns
  • Promise<Listing>: A promise that resolves to the details of the listing.

client.toggleDarkMode

Toggle dark mode for the arcpay modal.

Parameters
  • bool?: string: Optional boolean to set dark mode. If not provided, it will toggle the current dark mode.