Giter Site home page Giter Site logo

kana-widget-example's Introduction

@kanalabs/kana-widget

Installation

Kana Widget is available as a npm package.

npm:

npm install @kanalabs/kana-widget

yarn:

yarn add @kanalabs/kana-widget

pnpm:

pnpm install @kanalabs/kana-widget

Getting Started with Kana Widget

Here is an example of a basic app using Kana Widget:

import { KanaWidget, WidgetConfig } from "@kanalabs/kana-widget";
export const WidgetPage = () => {
  const widgetConfig: WidgetConfig = {
  // Required: The unique SDK key provided by the developer. This key is essential for the widget to function properly.
  // If you haven't received a key yet, please contact the development team to obtain one.
  sdkKey: "Your dApp/company SDK key",

  };
  return (
    <KanaWidget config={widgetConfig} />
  );
};

Configure Widget

This is the example with all the available configurations:

import { KanaWidget, AptosDexsFilter, BridgeOption, Chain, WidgetConfig } from "@kanalabs/kana-widget";

const widgetConfig: WidgetConfig = {
  // Required: The unique SDK key provided by the development team. This key is essential for the widget to function properly.
  // If you haven't received a key yet, please contact the development team to obtain one.
  sdkKey: "Your dApp/company SDK key",

  //Optional: The name of your dApp or company using this widget.
  integrator:"Your dApp/company name",

  //Optional: Configures the blockchain chains that will be used as source and target for transactions.
  chains: {
    sourceChain: [Chain.Aptos, Chain.Solana, Chain.Ethereum],
    targetChain: [Chain.Aptos, Chain.Solana, Chain.Ethereum],
  },

  //Optional: Configuration for decentralized exchanges (DEXs) to be used within the widget,
  // categorized by blockchain.
  dexs: {
    aptos: [AptosDexsFilter.Pontem], // List of DEXs to be used on the Aptos blockchain.
  },

  //Optional: Configuration for bridges that are supported by the widget for cross-chain transactions.
  bridges: [BridgeOption.CCTP, BridgeOption.Wormhole], // List of bridge options.

  //Optional: Determines whether a guided tour or walkthrough is available for users of the widget.
  // Set to 'false' to disable the tour.
  tour: false,

  // Optional: Configure custom blockchain network providers if you wish to use your own instead of default settings.
  Provider: {
    aptosProvider: `https://aptos-mainnet.nodereal.io/v1/${NODEREAL_KEY}/v1`,
    solanaProvider: `https://greatest-frequent-owl.solana-mainnet.quiknode.pro/${SOLANA_QUICKNODE_KEY}`,
    polygonProvider: `https://polygon-mainnet.nodereal.io/v1/${NODEREAL_KEY}`,
    binanceProvider: `https://bsc-mainnet.nodereal.io/v1/${NODEREAL_KEY}`,
    ethereumProvider: `https://eth-mainnet.nodereal.io/v1/${NODEREAL_KEY}`,
    arbitrumProvider: `https://open-platform.nodereal.io/${NODEREAL_KEY}/arbitrum-nitro/`,
    avalancheProvider: `https://open-platform.nodereal.io/${NODEREAL_KEY}/avalanche-c/ext/bc/C/rpc`,
    zkSyncProvider: `https://open-platform.nodereal.io/${NODEREAL_KEY}/zksync`,
    suiProvider: "https://sui-mainnet-rpc.nodereal.io",
  },

  //Optional: Styling options for the widget container and elements within it.
  containerStyle: {
    backgroundColor: "#1E1123", // Background color of the widget container.
    primaryColor: "#130E18", // Primary color theme for the widget.
    secondaryColor: "#2c2533", // Secondary color theme for the widget.
    buttonColor: "#00fbd0", // Color for buttons within the widget.
  },
};

export const WidgetPage = () => {
  return <KanaWidget config={widgetConfig} />;
};

Customize Widget

This example showcases all the available styling configurations:

import { KanaWidget, WidgetConfig } from "@kanalabs/kana-widget";

const widgetConfig: WidgetConfig = {
  // Required: The unique SDK key provided by the developer. This key is essential for the widget to function properly.
  // If you haven't received a key yet, please contact the development team to obtain one.
  sdkKey: "Your dApp/company SDK key",

  // Styling options for the widget container and elements within it.
  containerStyle: {
    backgroundColor: "#1E1123", // Background color of the widget container.
    primaryColor: "#130E18", // Primary color theme for the widget.
    secondaryColor: "#2c2533", // Secondary color theme for the widget.
    buttonColor: "#00fbd0", // Color for buttons within the widget.
  },
  };

export const WidgetPage = () => {
  return (
    <KanaWidget config={widgetConfig} />
  );
};

Troubleshooting

If you are facing any issue like

BREAKING CHANGE: webpack<5 used to include polyfills for node.js core modules by default.

Please add custom webpack settings to config-overrides.js. For further details regarding custom webpack settings refer here.

Documentation

Kana Widget Documentation

kana-widget-example's People

Contributors

gunaseelan25 avatar

Watchers

Parthasarathy Ramanujam avatar Partha avatar Chetan Bothra avatar

Forkers

junu1229

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.