⚒️ Wallet SDK
The BlockBolt SDK for the Sui Wallet App offers a seamless, secure, and user-friendly interface for executing transactions on the Sui blockchain. Users can confirm payments directly within their Sui wallet with support for QR code scanning and payment interpretation.
The SDK ensures safe and reliable delivery of funds to the merchant wallet by handling all the logic on-chain.
Open Source
Our payment infrastructure is fully open-source, reinforcing transparency and enabling community-driven security enhancements.
Installation
Install the BlockBolt SDK using either npm
or yarn
:
npm install @blockbolt/boltpay-wallet
yarn add @blockbolt/boltpay-wallet
Dependencies
BlockBolt SDK requires the @mysten/sui
package as a peer dependency. Install it alongside:
npm install @mysten/sui
yarn add @mysten/sui
Supported Coins
USD Coin
USDC
6
0x5d4b...::coin::COIN
Tether
USDT
6
0xc060...::coin::COIN
SCA Token
SCA
9
0x7016...::sca::SCA
Sacabum
SCB
5
0x9a55...::scb::SCB
Buck USD
BUCK
9
0xce7f...::buck::BUCK
Turbos
TURBOS
9
0x5d1f...::turbos::TURBOS
FlowX
FLX
8
0x6dae...::flx::FLX
NavX
NAVX
9
0xa99b...::navx::NAVX
FUD Token
FUD
5
0x76cb...::fud::FUD
Usage
Initializing the SDK
import { BlockBolt } from '@blockbolt/boltpay-wallet';
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
const sdk = new BlockBolt();
Preparing the Keypair
Generate or import your keypair using the Sui SDK. For example:
const keyPair = Ed25519Keypair.fromSecretKey(Uint8Array.from([...]));
🔐 Note: Never hardcode secrets or mnemonics in production. Use secure key vaults or encrypted storage.
Sending a Transaction
const qrCodeData = {
receiverAddr: "0xa2a0...e752",
nameProduct: "Coffee",
amount: 1000000000, // 1 SUI (9 decimals)
coinType: "0x...::sui::SUI",
randomId: "123456789",
senderAddr: "0x9d65...ae1", // Optional
};
try {
const result = await sdk.send({
keyPair,
...qrCodeData,
randomId: BigInt(qrCodeData.randomId),
});
console.log("Transaction result:", result.digest);
if (result.effects?.status.status === "success") {
console.log("✅ Transaction successful");
} else {
console.log("❌ Transaction failed:", result.effects?.status.error);
}
} catch (error) {
console.error("Transaction error:", error);
}
API Reference
BlockBolt.send(params)
BlockBolt.send(params)
Send a transaction via the Sui network.
Parameters
keyPair
—Ed25519Keypair
from Sui SDKreceiverAddr
— recipient wallet addressnameProduct
— name or description of the item/serviceamount
— amount to send (in smallest unit of token)coinType
— full coin type stringrandomId
— unique BigInt to avoid duplicatessenderAddr
(optional) — if set, only this wallet can initiate the payment
Returns
A Promise
resolving to the transaction result.
Error Handling
Wrap all SDK interactions in a try-catch
block:
try {
const result = await sdk.send({ /* params */ });
} catch (error) {
if (error instanceof TreasuryError) {
console.error("Treasury error:", error.message, "Coin:", error.coinType);
} else {
console.error("Unhandled error:", error);
}
}
Examples
import { BlockBolt } from '@blockbolt/boltpay-wallet';
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
const sdk = new BlockBolt();
const generateRandomBigInt = () => BigInt(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER));
const sendTransaction = async () => {
try {
const result = await sdk.send({
keyPair,
receiverAddr: "0xa2a0...e752",
nameProduct: "Coffee",
amount: 1000000000,
coinType: "0x...::sui::SUI",
randomId: generateRandomBigInt(),
senderAddr: "0x9d65...ae1",
});
console.log("Tx Digest:", result.digest);
if (result.effects?.status.status === "success") {
console.log("✅ Payment completed");
} else {
console.log("❌ Payment failed:", result.effects?.status.error);
}
} catch (error) {
console.error("Transaction Error:", error);
}
};
sendTransaction();
Best Practices
🔒 Security First: Never expose private keys or mnemonics.
⚙️ Key Management: Use secure wallets and avoid client-side key generation for production apps.
✅ Transaction Uniqueness: Always use
randomId
to prevent duplicate submissions.📤 QR Usage: Let users scan a QR that includes the transaction data (excluding private key).
ℹ️ Payments are verified strictly via on-chain logic. No external verification or off-chain validation is supported.
Support
Need help?
📧 Email: [email protected]
💬 Discord: Join Support Server
License
This project is licensed under the MIT License.
Last updated