1.5.9 • Published 6 months ago

demo-warss v1.5.9

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

BlockBolt Payment

The BoltPay SDK for the Sui Wallet App offers a highly beneficial and smoothly integrated feature set for Sui chain transactions. It provides a user-friendly and secure way for users to execute payments. The key features of this SDK include QR code scanning and payment request interpretation, allowing users to confirm payments effortlessly within their Sui wallet app. By handling transactions on the Sui chain, the BoltPay SDK ensures safe and reliable delivery of payments to the merchant's wallet.

Installation

  • Compatible with Node.js and React-based applications.
  • Requires the @blockbolt/sui-wallet and @mysten/sui.js libraries for full functionality.

Install the SDK via npm:

npm install @blockbolt/sui-wallet
    ##
yarn add @blockbolt/sui-wallet  
    ##
pnpm install @blockbolt/sui-wallet

Prerequisites

You will need mysten js library to run the sdk

Install the SDK via npm, yarn or pnpm:

npm install @mysten/sui.js
    ##
yarn add @mysten/sui.js  
    ##
pnpm install @mysten/sui.js    

Usage The SDK provides two main functions: createEcomTx for generic E-commerce transactions and createWoComTx for WooCommerce-specific transactions.

Importing the SDK

import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519';
import { createEcomTx, createWoComTx, Ed25519Keypair } from '@blockbolt/sui-wallet';

Important Note on the Demo Example for createEcomTx & createWoComTx:

In the provided example for the createEcomTx & createWoComTx function, the code snippet demonstrates how a transaction can be created and executed. It's important to understand that the part of the code dealing with the Ed25519Keypair is included solely for demonstration purposes.

Wallet providers must use their secure method have to pass the signer. The signer is passed to the createEcomTx or createWoComTx function to initiate the transaction securely. This approach ensures that the transaction process adheres to security best practices, maintaining the integrity and safety of the transaction on the Sui chain.

E-commerce Transactions (createEcomTx)

  • unique_id: A unique, random numerical identifier for each transaction.
  • merchantName: The merchant's name for identifying the payment recipient.
  • amount: The value to be transferred in the transaction.
  • receiverAddress: The merchant's Sui wallet address for receiving the payment.

For demo purpose only

const phrase = "your seed phrase"; // Securely retrieve the seed phrase
const keyPair = Ed25519Keypair.deriveKeypair(phrase, "m/44'/784'/0'/0'/0'");

Example Usage

const response = await createEcomTx({
    signer: keyPair, // here you can either pass the walle signer or for test you can use like above example
    unique_id: randomId, // Replace with a unique identifier
    name: Merchant Name,  // Replace with the merchant name
    amount: Price,      // Replace with the transaction amount
    receiverAddress: Merchant Address, // Replace with the merchant's address
    networkType: "testnet" // "testnet", "devnet", or "mainnet"
});

WooCommerce Transactions (createWoComTx)

  • unique_id: A unique, random numerical identifier for each transaction.
  • merchantName: The merchant's name for identifying the payment recipient.
  • amount: The value to be transferred in the transaction.
  • receiverAddress: The merchant's Sui wallet address for receiving the payment.

For demo purpose only

const phrase = "your seed phrase"; // Securely retrieve the seed phrase
const keyPair = Ed25519Keypair.deriveKeypair(phrase, "m/44'/784'/0'/0'/0'");

Example Usage

const responseWoCom = await createWoComTx({
    signer: keyPair, // here you can either pass the walle signer or for test you can use like above example
    unique_id: randomId, // Replace with a unique identifier
    name: Merchant Name,  // Replace with the merchant name
    amount: Price,      // Replace with the transaction amount
    receiverAddress: Merchant Address, // Replace with the merchant's address
    networkType: "testnet" // "testnet", "devnet", or "mainnet"
});

Best Practices

Security: Avoid hardcoding sensitive information like seed phrases. Always retrieve them from a secure and encrypted source. Key Management: Especially in client-side applications, use pre-derived signer objects for enhanced security. Additional Information Make sure to replace placeholders in the code examples with actual data from your application.

1.5.9

6 months ago

1.3.9

6 months ago

1.2.9

6 months ago

1.1.9

6 months ago

1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago