@godex/ngx-widget
v0.0.1
Published
## Description
Downloads
1
Readme
@godex/ngx-widget
Description
@godex/ngx-widget
is an Angular library designed to integrate seamlessly with the Godex cryptocurrency exchange API. This library leverages Angular's powerful features, such as dependency injection and RxJS observables, to provide a robust and reactive way for Angular applications to interact with cryptocurrency exchange functions.
Features
getCoins(args?: IGetCoinsArgs)
: Retrieve a list of available coins.getPairInfo(args?: IPairInfoArgs)
: Get information about a currency pair.getTransactionById(id: string)
: Retrieve transaction information by ID.createTransaction(args?: ICreateTransactionArgs)
: Create a transaction.subscribeOnTransactionChanges(id: string)
: Returns an Observable to subscribe to transaction status changes.unsubscribeFromTransactionChanges(id: string)
: Unsubscribe from transaction status changes.
Installation
npm install @godex/ngx-widget
Usage
Importing
Import NgxWidgetService in your Angular module:
import { NgxWidgetService } from '@godex/ngx-widget';
@NgModule({
...
providers: [NgxWidgetService]
...
})
export class YourModule {}
Injecting the Service
Inject NgxWidgetService into your component or service:
import { NgxWidgetService } from '@godex/ngx-widget';
@Component({
...
})
export class YourComponent {
constructor(private ngxWidgetService: NgxWidgetService) {}
}
Examples
Getting a List of Coins
this.ngxWidgetService.getCoins({ page: 1, limit: 10, onlyActive: true })
.subscribe(response => console.log(response));
Getting Information About a Currency Pair
this.ngxWidgetService.getPairInfo({ from: 'BTC', to: 'ETH', amount: '1.0' })
.subscribe(response => console.log(response));
Creating a Transaction
const transactionArgs = {
// Your transaction arguments
};
this.ngxWidgetService.createTransaction(transactionArgs)
.subscribe(response => console.log(response));
Tracking Transaction Changes
this.ngxWidgetService.subscribeOnTransactionChanges('transactionId')
.subscribe(id => {
console.log(`Transaction status changed for ID: ${id}`);
});
// To unsubscribe
this.ngxWidgetService.unsubscribeFromTransactionChanges('transactionId');
API Documentation
For detailed API documentation and available features, visit Godex API Documentation.
Support
For any questions or issues related to the library, please reach out to our support team.