Skip to content

The Wallet Infra SDK provides tools and services for managing wallets, transactions and assets within the Wallet Infra API ecosystem.

License

Notifications You must be signed in to change notification settings

Brillionfi/wallet-infra-sdk

Repository files navigation

πŸ› οΈ Wallet Infra SDK

The Wallet Infra SDK provides tools and services for managing wallets, transactions, and assets within the Brillion ecosystem.

πŸ’‘ Features

  • πŸ‘› Wallet Management: Create, recover, and manage wallets
  • πŸ’Έ Transaction Handling: Create, sign, and cancel transactions
  • πŸ” Authentication: Support for multiple authentication providers
  • πŸͺ™ Token Management: Retrieve and manage tokens across different chains
  • ⛓️ Multi-Chain Support: Compatible with various blockchain networks
  • β›½ Gas Fee Estimation: Calculate and manage transaction gas fees
  • πŸ“Š Portfolio Tracking: Monitor wallet portfolios across chains
  • πŸ“œ Transaction History: Retrieve and analyze transaction history

πŸš€ Installation

Install the Wallet Infra SDK into your project with a single command:

npm install @brillionfi/wallet-infra-sdk

⚑ Quick Start

Get started with Wallet Infra SDK in a few steps:

1. Obtain your API key

Visit the Brillion Dashboard to set up your organization and create your first application. This process will give you a unique API key (appId).

2. Initialize the SDK

First, create a new instance of the Wallet Infra SDK:

import { WalletInfra } from "@brillionfi/wallet-infra-sdk";

// Initialize the SDK
const appId = "your-app-id";
const baseUrl = "your-base-url";
const walletInfra = new WalletInfra(appId, baseUrl);

Note

Make sure to replace "your-app-id" with the actual API key you obtained from the Brillion Dashboard.

3-1. Authenticate user with social login

Create or authenticate a user using your preferred provider:

import { AuthProvider } from "@brillionfi/wallet-infra-sdk";

// Generate authentication URL
const params = {redirectUrl: "your-redirect-url",provider: AuthProvider.Google } ;
const authUrl = await walletInfra.generateAuthUrl(params);

// Redirect user to authUrl for identity verification

// In your redirect endpoint, authenticate the user with the received JWT
walletInfra.authenticateUser(receivedJWT);

Valid AuthProvider value are:

  • GOOGLE
  • DISCORD
  • TWITTER
  • APPLE

3-2. Authenticate user with Walletconnect

Create or authenticate a user using your preferred provider:

import { AuthProvider } from "@brillionfi/wallet-infra-sdk";

// Generate authentication URL
const redirectUrl = "your-redirect-url";
const projectId = "your-wallet-connect-project-id"
const uri = walletInfra.generateWalletConnectUri({
  projectId, 
  redirectUrl,
  requiredNamespaces: {
    eip155: {
      methods: ['personal_sign'],
      chains: ['eip155:1'],
      events: ['connect', 'disconnect'],
    },
  },
});

// listen to onConnectWallet Event  and redirect user to authUrl when it triggered
walletInfra.onConnectWallet((authUrl: string)=>{})

//Show uri to user and ask to connect
// WalletConnectQRCodeModal.open(uri, ()=>{});

// In your redirect endpoint, authenticate the user with the received JWT
walletInfra.authenticateUser(receivedJWT);

4. Create a wallet

After authentication, create a new wallet for the user:

import { IWallet } from "@brillionfi/wallet-infra-sdk";
import {
  WalletTypes,
  WalletFormats,
  PasskeyAuthenticationSchema
} from "@brillionfi/wallet-infra-sdk/dist/models/wallet.models";

const newWallet: IWallet = {
  name: "MyFirstWallet",
  format: WalletFormats.ETHEREUM,
  signer: {
    authentication: PasskeyAuthenticationSchema,
  }
};

await walletInfra.Wallet.createWallet(newWallet);

πŸ“š Documentation

Check out the docs directory for detailed information and examples on using the Wallet Infra SDK.

🌐 Demo

Check out our Simple Wallet Demo to see the Wallet Infra SDK in action. This demo showcases how to manage your organization and applications and demonstrates how to access your application as a wallet user.

🀝 Contributing

We value community contributions and are eager to support your involvement. Here's how you can make a difference:

  • πŸš€ Use Wallet Infra SDK in your projects and share your experiences.
  • 🐞 Found a bug? Open an issue. Better yet, submit a pull request with a fix!
  • πŸ’‘ Have ideas for new features? We'd love to hear them.
  • πŸ“š Help improve our documentation for a smoother developer experience.

Committing

We use Commitizen to handle versioning and ensure consistent and meaningful commit messages. Here's how to use it:

npx cz

Or, after installing Commitizen globally:

git cz

πŸ’¬ Support

If you encounter any issues or have questions, please open an issue or contact the Brillion support team.

πŸ“„ License

The Wallet Infra SDK is licensed under the MIT License. For more details, see the LICENSE file.

About

The Wallet Infra SDK provides tools and services for managing wallets, transactions and assets within the Wallet Infra API ecosystem.

Resources

License

Stars

Watchers

Forks

Packages

No packages published