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

@dippixyz/base

v1.2.8

Published

Dippi SDK

Downloads

25

Readme

Dippi SDK for JS

This is the Dippi SDK for JavaScript, providing a wrapper around the Dippi API.

Installation

npm i @dippixyz/base

Usage

Go to client.dippi.xyz to sign up and obtain an appToken and appId.

Class Definitions

Dippi

  • appToken: string;
  • appId: string;
  • url: string;
  • authToken: string;
  • urlReturn: string;
  • auth: AuthInterface;
  • user: UserInterface;
  • wallet: WalletInterface;
  • application: ApplicationInterface;
  • applicationToken: ApplicationTokenInterface;

TBA

  • appToken: string;
  • appId: string;
  • url: string;
  • authToken: string;
  • auth: Auth;
  • _tokenBoundAccount: TokenBoundAccountInterface;

Dippi Client

To use the Dippi Client, follow the steps below:

  1. Initialization:

    const { Dippi, TBA } = require('@dippixyz/base');
    
    const dippiClient = new Dippi({
        appToken: [appToken],
        appId: [appId],
        url: 'https://api.dippi.xyz',
    });
  2. Authentication:

    const { accessToken } = await dippiClient.auth.login();
    dippiClient.setAuthToken(accessToken);
  3. Fetching User Profile:

    const userProfile = await dippiClient.user.getProfile(userId);
  4. Working with Wallets, Applications, and Application Tokens:

    const userWallets = await dippiClient.wallet.list();
    const userApplications = await dippiClient.application.list();
    const userApplicationToken = await dippiClient.applicationToken.retrieve(
        applicationId,
    );

Token Bound Account (TBA)

To utilize the Token Bound Account (TBA) Class:

  1. Initialization:

    const tbaConfig = {
        appToken: [appToken],
        appId: [appId],
        url: 'https://api.dippi.xyz',
        auth: dippiClient.auth, // Passing the auth instance from Dippi client
    };
    
    const tba = new TBA(tbaConfig);
  2. Initialization and Creation for TBA:

    const initArgs = {
        destinationWallet: 'destinationWalletAddress',
        nftContract: 'nftContractAddress',
        nftId: 'nftId',
    };
    
    await tba.init(initArgs);
    await tba.create();

Example Application

Below is an example of how you can utilize the Dippi SDK and the TBA feature in a simple Node.js application.

const { Dippi, TBA } = require('@dippixyz/base');

// Initialize Dippi Client
const dippiClient = new Dippi({
    appToken: 'yourAppToken',
    appId: 'yourAppId',
    url: 'https://api.dippi.xyz',
});

(async () => {
    // Authenticate Dippi Client
    const { accessToken } = await dippiClient.auth.login();
    dippiClient.setAuthToken(accessToken);

    // Fetch User Profile
    const userId = 'yourUserId';
    const userProfile = await dippiClient.user.getProfile(userId);

    // Create User Profile
    const userProfileData: UserCreatePayload = {
        email: '[email protected]',
        applicationId: 'yourApplicationId',
        password: 'yourPassword',
        authType: 'yourAuthType',
        phone: 'yourPhoneNumber',
    };
    await dippiClient.user.createProfile(userProfileData);

    // Authenticate User
    const signInData: SignInPayload = {
        email: '[email protected]',
        password: 'yourPassword',
        token: 'yourToken',
        applicationId: 'yourApplicationId',
        countryCode: 'yourCountryCode',
    };
    await dippiClient.user.authenticate(signInData);

    // Reset password for user
    const resetPasswordData: ResetPasswordPayload = {
        email: '[email protected]',
    };
    await dippiClient.user.resetPassword(resetPasswordData);

    // Change password for user
    const changePasswordData: ChangePasswordPayload = {
        userEmail: '[email protected]',
        oldPassword: 'your_old_password',
        password: 'your_new_password',
        repeatedPassword: 'your_new_password',
    };
    await dippiClient.user.changePassword(changePasswordData);

    // List User Wallets
    const userWallets = await dippiClient.wallet.list();

    // Create Wallet
    const walletCreateData: WalletCreatePayload = {
        ownerId: 'yourOwnerId',
        walletType: 'yourWalletType',
        isTestNet: true,
        storeOption: 'email',
        userCode: 'yourUserCode',
        name: 'yourWalletName',
        fromMnemonic: true,
        mnemonicPhrase: 'yourMnemonicPhrase',
        fromPrivateKey: true,
        privateKey: 'yourPrivateKey',
        useRecoveryPhrase: true,
        recoveryPhrase: 'yourRecoveryPhrase',
        repeatedRecoveryPhrase: 'yourRepeatedRecoveryPhrase',
        useKeyppiProtocol: true,
        useKeyppiTransactionInfluenciableWallets: true,
        transactionInfluenciableWallets: 'yourTransactionInfluenciableWallets',
        acceptTermsAndConditions: true,
        environment: 'yourEnvironment',
    };
    await dippiClient.wallet.create(walletCreateData);

    // Get NFTs
    const getNFTsData: WalletGetNFTsPayload = {
        address: 'yourWalletAddress',
        chainId: 1, // Replace with actual chainId
    };
    await dippiCliente.wallet.getNFTs(getNFTsData);

    // Get Balance
    await dippiClient.wallet.getBalance('yourWalletAddress');

    // Get Wallet Info
    await dippiClient.wallet.getWalletInfo('yourWalletAddress');

    // List User Applications
    const userApplications = await dippiClient.application.list();

    // Retrieve User Application Token
    const tokenId = 'yourTokenId';
    const userApplicationToken = await dippiClient.applicationToken.retrieve(
        tokenId,
    );

    // Initialize TBA
    const tbaConfig = {
        appToken: 'yourAppToken',
        appId: 'yourAppId',
        url: 'https://api.dippi.xyz',
        auth: dippiClient.auth,
        _tokenBoundAccount: {},
    };

    const tba = new TBA(tbaConfig);

    // Initialize and Create TBA
    const initArgs = {
        destinationWallet: 'destinationWalletAddress',
        chainId: 'chain id',
        nftContract: 'nftContractAddress',
        nftId: 'nftId',
    };

    await tba.init(initArgs);
    await tba.createAccount();

    console.log('TBA created successfully!');
})();

Make sure to replace the placeholders in the code with your actual data. Save this code in a file, say app.js, and run it using node app.js.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgements

  • Hat tip to anyone whose code was used
  • Inspiration
  • etc