1.0.4 • Published 11 months ago

exchange-crypto-sdk-example v1.0.4

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

Exchange-Crypto-Widget

Exchange-Crypto-Widget is a simple component for React applications.

Installation

You can install Exchange-Crypto-Widget via npm:

npm install exchange-crypto-sdk-example

Usage

To use widget in your React application, follow these steps:

import { CryptoProvider, CryptoWidget } from "exchange-crypto-sdk-example";

Initialize the widget:

  <CryptoProvider>
    <CryptoWidget />
  </CryptoProvider>;

Example

Here's a basic example of how to use widget:

import React from "react";
import { CryptoProvider, CryptoWidget } from "exchange-crypto-sdk-example";

function App() {
    const sdkConfig = {
        theme: {
            primaryColor: '#6366F1', 
            secondaryColor: '#10B981',
            accentColor: '#EC4899', 
            backgroundColor: '#FFFFFF',
            textColor: '#1F2937',
        },
        callbacks: {
            onTransactionStart: () => {
                console.log('Transaction started');
            },
            onTransactionComplete: () => {
                console.log('Transaction completed successfully');
            },
            onError: () => {
                console.log('Transaction failed');
            }
        },
        apiKeys: {
            etherscanApiKey: 'DEMO_KEY',
        },
        defaultFiatCurrency: 'USD',
    };

    return (
        <>
            <CryptoProvider config={sdkConfig}>
                <CryptoWidget />
            </CryptoProvider>
        </>
    );
}

export default App;

License

This project is licensed under the MIT License - see the LICENSE file for details.