The Wallet Infra SDK provides tools and services for managing wallets, transactions, and assets within the Brillion ecosystem.
- π 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
Install the Wallet Infra SDK into your project with a single command:
npm install @brillionfi/wallet-infra-sdk
Get started with Wallet Infra SDK in a few steps:
Visit the Brillion Dashboard to set up your organization and create your first application. This process will give you a unique API key (appId
).
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.
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:
- DISCORD
- APPLE
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);
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);
Check out the docs directory for detailed information and examples on using the Wallet Infra SDK.
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.
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.
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
If you encounter any issues or have questions, please open an issue or contact the Brillion support team.
The Wallet Infra SDK is licensed under the MIT License. For more details, see the LICENSE file.