Getting Started
The Galliun Payment SDK provides a TypeScript interface to interact with the Galliun Payment Protocol smart contracts.
Installation
npm install @galliun/galliun-payment-sdk
# or
yarn add @galliun/galliun-payment-sdkInitialization
The main entry point is the PaymentClient class which provides access to all protocol features:
import { PaymentClient } from '@galliun/payment-sdk';
const client = new PaymentClient({
network: 'mainnet', // or 'testnet', 'devnet'
packageId: '0x...', // Protocol package ID
configId: '0x...', // Protocol config ID
adminCapId: '0x...', // Optional: Admin capability ID
sender: '0x...', // Optional: Default sender address
signTransaction: async (tx) => {
// Your transaction signing logic
return signedTx;
},
});you can find the contract addresses in the PAYMENT_IDS
Required Parameters
network: The Sui network to connect to ('mainnet' or 'testnet')packageId: The protocol package IDconfigId: The protocol configuration object IDsignTransaction: Function to sign transactions
Optional Parameters
adminCapId: Admin capability ID (only needed for admin operations)sender: Default sender addresssuiClient: Custom Sui client instance
Available Managers
The client provides specialized managers for different protocol features:
// Bill Management (One-time and Recurring)
const { billManager } = client;
// Payment Request Management
const { paymentRequestManager } = client;
// Product Management
const { productManager } = client;
// Configuration Management
const { configManager } = client;Each manager provides specific methods for its domain. See the respective documentation sections for details:
Error Handling
The SDK throws typed errors for various failure cases. Always wrap SDK calls in try-catch blocks:
try {
await client.billManager.createBill(/* ... */);
} catch (error) {
if (error.code === 'UNSUPPORTED_COIN') {
// Handle unsupported coin error
}
// Handle other errors
}Next Steps
Learn about Bill Management
Explore Payment Requests
Set up Product Management
Read the API Reference
Last updated