@galliun/galliun-payment-sdk
v0.1.1
Published
Galliun Payment SDK
Downloads
9
Readme
@galliun/galliun-payment-sdk
TypeScript SDK for interacting with the Galliun Payment Protocol on Sui Network. Enables easy integration of Galliun Payment contracts
Installation
npm install @galliun/galliun-payment-sdk
# or
yarn add @galliun/galliun-payment-sdkQuick Start
import { PaymentClient } from '@galliun/galliun-payment-sdk';
const client = new PaymentClient({
network: 'mainnet', // or 'testnet', 'devnet'
packageId: '0x...', // Protocol package ID
configId: '0x...', // Protocol config ID
signTransaction: async (tx) => {
// Your transaction signing logic
return signedTx;
},
});
// Access different managers
const { billManager, paymentRequestManager, productManager } = client;
// Example: Create a bill
try {
const bill = await billManager.createBill({
amount: '1000000',
coinType: '0x2::sui::SUI',
description: 'Test Bill',
participants: ['0x...'],
});
console.log('Bill created:', bill);
} catch (error) {
console.error('Failed to create bill:', error);
}Documentation
For detailed documentation, visit our GitBook Documentation.
Error Handling
The SDK provides typed errors for better error handling:
try {
await client.billManager.createBill(/* ... */);
} catch (error) {
if (error.code === 'UNSUPPORTED_COIN') {
// Handle unsupported coin error
}
// Handle other errors
}License
MIT License
