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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@alchemy_chain/js-sdk

v1.0.1

Published

Alchemy Chain JavaScript SDK - A simplified token API toolkit for blockchain token operations and interactions

Readme

@alchemy_chain/js-sdk

Alchemy Chain JavaScript SDK - A simplified token API toolkit for blockchain token operations and interactions.

Installation

npm install @alchemy_chain/js-sdk

Quick Start

const AlchemySDK = require('@alchemy_chain/js-sdk');

// Configure RPC endpoint and private key
AlchemySDK.Config('https://your-rpc-endpoint.com', 'your-private-key');

// Create token
const result = await AlchemySDK.CreateToken('My Token', 'MTK', 18, '0x...masterAuthority');
result.success(data => {
    console.log('Token address:', data.token);
    console.log('Transaction hash:', data.hash);
}).error(err => {
    console.error('Creation failed:', err);
});

API Documentation

Configuration

Config(rpcUrl, privateKey)

Configure RPC endpoint and private key.

  • rpcUrl: RPC endpoint URL
  • privateKey: Private key for signing (can include or exclude 0x prefix)

Token Operations

CreateToken(name, symbol, decimals, masterAuthority)

Create a new token.

  • name: Token name
  • symbol: Token symbol
  • decimals: Number of decimal places
  • masterAuthority: Master authority address

Returns: Promise with .success() and .error() methods.

GetTokenMetadata(tokenAddress)

Get token metadata.

  • tokenAddress: Token contract address

UpdateMetadata(tokenAddress, newName, newSymbol, nonce)

Update token metadata.

  • tokenAddress: Token contract address
  • newName: New token name
  • newSymbol: New token symbol
  • nonce: Transaction nonce value

Mint(tokenAddress, toAddress, amount, nonce)

Mint tokens.

  • tokenAddress: Token contract address
  • toAddress: Recipient address
  • amount: Amount to mint (wei value as string)
  • nonce: Transaction nonce value

AdminBurn(tokenAddress, fromAddress, amount, nonce)

Admin burn tokens.

  • tokenAddress: Token contract address
  • fromAddress: Address to burn tokens from
  • amount: Amount to burn (wei value as string)
  • nonce: Transaction nonce value

Authority Management

GrantAuthority(tokenAddress, role, account, nonce)

Grant authority.

  • tokenAddress: Token contract address
  • role: Authority role (e.g. 'MINT_ROLE')
  • account: Account address to be granted authority
  • nonce: Transaction nonce value

RevokeAuthority(tokenAddress, role, account, nonce)

Revoke authority.

  • tokenAddress: Token contract address
  • role: Authority role
  • account: Account address to revoke authority from
  • nonce: Transaction nonce value

Contract Control

Pause(tokenAddress, nonce)

Pause contract.

  • tokenAddress: Token contract address
  • nonce: Transaction nonce value

Unpause(tokenAddress, nonce)

Unpause contract.

  • tokenAddress: Token contract address
  • nonce: Transaction nonce value

AddToBlacklist(tokenAddress, accountAddress, nonce)

Add account to blacklist.

  • tokenAddress: Token contract address
  • accountAddress: Account address to add to blacklist
  • nonce: Transaction nonce value

Utility Methods

GetBalance(address)

Get ETH balance.

  • address: Address to query

Returns: Promise that returns an object with wei and eth fields on success.

Technical Details

Enhanced Signature Verification

The SDK implements a robust signature system with the following improvements:

  • Null Safety: Automatically handles and filters null/undefined values using strict null checks (value == null)
  • Array Support: Properly processes array parameters by:
    • Filtering out null/undefined array elements
    • Flattening arrays into individual values using spread operator
    • Including all non-null elements in signature
  • Method Security: For token operations, method arguments are included in signature verification
  • Parameter Ordering: All parameters are sorted alphabetically for consistent signature generation
  • String Conversion: All parameter values are converted to strings before joining
  • Comma Separation: Message parts are joined with commas for hash generation

Signature Fields

CreateToken Operations

Parameters included in signature:

  • decimals, masterAuthority, name, nonce, recentCheckpoint, symbol

Request parameters sent to server:

  • decimals, masterAuthority, name, symbol, nonce, recentCheckpoint, signature

Dynamic Method Calls

Parameters included in signature:

  • recentCheckpoint, nonce, methodArgs, token

Request parameters sent to server:

  • nonce, token, methodArgs, recentCheckpoint, signature

Note: The methodArgs field is now part of signature verification for enhanced security.

Examples

const AlchemySDK = require('@alchemy_chain/js-sdk');

async function main() {
    // Configuration
    AlchemySDK.Config('https://validator-node-rpc.aeon.xyz', 'your-private-key');

    // Create token
    const createResult = await AlchemySDK.CreateToken('My Token', 'MTK', 8, '0x...');
    createResult.success(async response => {
        const tokenAddress = response.token;
        console.log('Token created successfully:', tokenAddress);

        // Get token information
        const metadataResult = await AlchemySDK.GetTokenMetadata(tokenAddress);
        metadataResult.success(metadata => {
            console.log('Token name:', metadata.name);
            console.log('Token symbol:', metadata.symbol);
        });

        // Mint tokens
        const mintResult = await AlchemySDK.Mint(tokenAddress, '0x...', '1000000000000000000', 1);
        mintResult.success(response => {
            console.log('Mint successful:', response.hash);
        });
    }).error(err => {
        console.error('Creation failed:', err);
    });
}

main().catch(console.error);

Important Notes

  1. Private Key Security: Please keep your private key secure and do not hardcode it in your code
  2. Nonce Management: Ensure you use the correct nonce value when calling methods that require nonce
  3. Network Configuration: Make sure the RPC endpoint is accessible and compatible
  4. Error Handling: It's recommended to add appropriate error handling for all operations
  5. Signature Security: Method arguments are now included in signature verification - ensure parameters are correct
  6. Null Parameter Handling: The SDK automatically filters null/undefined values (== null check), so undefined parameters won't break signatures
  7. Array Parameters: When using array parameters, null elements are automatically filtered out and arrays are flattened
  8. Parameter Format: CreateToken uses camelCase parameters (masterAuthority, recentCheckpoint) in both signature and request
  9. String Conversion: All parameter values are automatically converted to strings during signature generation

License

MIT

Contributing

Issues and pull requests are welcome!