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 🙏

© 2026 – Pkg Stats / Ryan Hefner

diamwallet-sdk-new

v1.0.2

Published

The DIAM Wallet Mobile SDK allows developers to seamlessly connect their dApps with both web apps (on Android mobile browsers) and mobile apps (on Android and iOS) through the DIAM Wallet App.

Readme

DIAM WALLET

DIAM Wallet SDK

The DIAM Wallet SDK allows developers to seamlessly connect their dApps with both web apps (on Android mobile browsers) and mobile apps (on Android and iOS) through the DIAM Wallet App.

Platform: iOS Platform: Android Platform: Web License npm version Build status code coverage install size npm bundle size npm downloads

Getting Started

Installation

You can install the DIAM Wallet SDK using npm or yarn:

Install the SDK in your Application:

yarn add diamwallet-sdk
npm install --save diamwallet-sdk 

iOS Setup

Install CocoaPods dependencies:

cd ios && pod install

Setting Up the SDK in Your Application

Note: The SDK does not include a wrapper, so it must be initialized in every file where it is used.

React Native Implementation

Install AsyncStorage for React-Native.

npm i --save @react-native-async-storage/async-storage
import React from 'react';
import DIAMWalletConnectionSDK from 'diamwallet-sdk';

const diamWalletSdk = new DIAMWalletConnectionSDK({
  platform: 'mobile',
  appCallback: 'app-scheme://callback',
  appName: 'Demo App',
  network: 'testnet', // or "mainnet"
});

React Web Implementation

Install web-vital for web(ReactJS).

npm i --save web-vitals
import React from 'react';
import DIAMWalletConnectionSDK from 'diamwallet-sdk';

const diamWalletSdk = new DIAMWalletConnectionSDK({
  platform: "web",
  appCallback: window.location.origin + "/callback",
  appName: "Demo App1",
  network: "testnet",
});

SDK Methods

1. Connect Wallet

Establishes connection with DIAM Wallet and returns user's wallet address.

Returns:

{
  status: boolean,    // Connection status
  address: string,    // Wallet address if successful
  data?: string      // Error message if failed
}

React Native

const connectWallet = async () => {
  try {
    console.log('Connecting wallet...');
    const result = await diamWalletSdk.connectWallet();
    console.log('Wallet connected!', result);
    
    if (result.status === true) {
      setAddress(result.address);
      setConnectionStatus(result.status);
    } else {
      Alert.alert('Errors', result.data, [{text: 'OK'}]);
    }
  } catch (error) {
    console.error('Failed to connect wallet:', error);
    setConnectionStatus(false);
    Alert.alert(`Failed to connect: \n${error.message}`);
  }
};

React Web

const connectWallet = async () => {
  try {
    console.log("Connecting...");
    const result = await sdk.connectWallet();
    
    if (result.status === true) {
      setConnectionStatus(result.status);
      setWalletAddress(result.address);
      let balanceResponse = await sdk.getBalance();
      setBalance(balanceResponse.data.balance);
    }
  } catch (error) {
    console.error("Failed to connect wallet:", error);
    setConnectionStatus(false);
    alert(`Failed to connect: \n${error.message}`);
  }
};

2. Fetch Wallet Balance

Retrieves the current balance of the connected wallet.

Returns:

{
  status: boolean,
  data: {
    balance: string
  }
}
const fetchBalance = async () => {
  let balanceResponse = await diamWalletSdk.getBalance();
  console.log(balanceResponse);
};

3. Send Transaction

Sends a new transaction to a specified address.

Parameters:

{
  amount: string,           // Amount to send
  toAddress: string,       // Recipient address
  signTransaction: false   // Must be false for sending
}

Returns:

{
  status: boolean,
  data: Array<object>; // Array of generic objects
}
const sendTransaction = async () => {
  let transactionData = {
    amount: "10",  // sending amount
    toAddress: "GBVKH4ZK6QWETZTQFLQ3JMGXKMRVRK3ZPZ3Z4ACQXY42J6P7F5DRZYNY",  // receiver address
    signTransaction: false,
  };
  
  try {
    const result = await diamWalletSdk.sendTransaction(transactionData);
    console.log(result);
  } catch (error) {
    console.error('Failed to send transaction:', error);
  } 
};

4. Sign Transaction

Signs a transaction without broadcasting it to the network.

Parameters:

{
  amount: string,          // Amount to send
  toAddress: string,      // Recipient address
  signTransaction: true   // Must be true for signing
}

Returns:

{
  status: boolean,
  data: {
    xdr: string      // Signed transaction XDR
  }
}
const signTransaction = async () => {   
  let transactionData = {
    amount: "10",  // sending amount
    toAddress: "GBVKH4ZK6QWETZTQFLQ3JMGXKMRVRK3ZPZ3Z4ACQXY42J6P7F5DRZYNY",  // receiver address
    signTransaction: true,
  };
  
  try {
    const result = await diamWalletSdk.sendTransaction(transactionData);
    console.log(result);
  } catch (error) {
    console.error('Failed to sign transaction:', error);
  } 
};

5. Send Signed Transaction

Broadcasts a previously signed XDR transaction.

Parameters:

{
  signTransaction: false,
  xdr: string             // Signed XDR string
}

Returns:

{
  status: boolean,
  data: Array<object>; // Array of generic objects
}
const sendSignedXDRTransaction = async () => {
  let transactionData = {
    signTransaction: false,
    xdr: selectedXDR,
  };
  
  try {
    const result = await diamWalletSdk.sendTransaction(transactionData);
    console.log(result);
  } catch (error) {
    console.error("Failed to send transaction:", error);
  } 
};

6. Validate Public Address

Validates if a given address is formatted correctly.

Parameters:

publicAddress: string    // Address to validate

Returns:

{
  valid: boolean
}
const addressValidation = async () => {
  let valid = await diamWalletSdk.validatePublicAddress(
    "GBVKH4ZK6QWETZTQFLQ3JMGXKMRVRK3ZPZ3Z4ACQXY42J6P7F5DRZYNY" // receiver address
  );
  console.log(valid); // {valid: true/false} 
};

7. Disconnect Wallet

Terminates the connection with the DIAM Wallet.

Returns:

{
  status: boolean,
  message?: string    // Optional status message
}
const disconnectWallet = async () => {
  try {
    await diamWalletSdk.disconnect();
  } catch (error) {
    console.error("Failed to disconnect wallet:", error);
    alert(`Failed to disconnect: \n${error.message}`);
  }
};

Configuration Options

| Option | Type | Description | Mandatory | |--------|------|-------------|-----------| | diamWalletOptions.platform | string | Name of your platform | Yes | | diamWalletOptions.appCallback | string | URL of your dApp | Yes | | diamWalletOptions.appName | string | Name of your dApp | Yes | | diamWalletOptions.network | string | Network name ("testnet" or "mainnet") | Yes |

Available Methods

  • connectWallet(): Connect to DIAM Wallet Application
  • getBalance(): Fetch balance for the connected wallet
  • sendTransaction({amount, toAddress, signTransaction: false}): Send transaction to specified public address
  • signTransaction({amount, toAddress, signTransaction: true}): Sign transaction for specified public address
  • sendTransaction({signTransaction: false, xdr}): Send signed XDR transaction
  • validatePublicAddress(publicAddress): Validate public address
  • disconnect(): Terminate DIAM Wallet connection

Resources

Support

For additional support, please open an issue on our GitHub repository.

License

The DIAM Wallet Mobile SDK is licensed under the MIT License.

You are free to use, modify, and distribute the SDK in your projects, subject to the conditions of the MIT License.

Conditions

  • The software is provided "as is", without any warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement.
  • In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software