1.0.61 • Published 3 months ago

test-widget-knv-1 v1.0.61

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

@panoraexchange/widget-sdk

Description

The Panora Swap Widget SDK allows developers/projects to easily integrate Panora's powerful widget into their projects. With this SDK, you can enable users to swap directly through Panora's platform, providing them with access to the best routes and rates in the market.

Installation

Using Yarn

yarn add @panoraexchange/widget-sdk

Using npm

npm install @panoraexchange/widget-sdk

Using pnpm

pnpm add @panoraexchange/widget-sdk

Basic Example

To get started quickly, here's a basic example of how to integrate the Panora Swap Widget into your application:

import { PanoraWidget,  PanoraWidgetConfig } from "@panoraexchange/widget-sdk";

const widgetConfig: PanoraWidgetConfig = {
    API_KEY: "YOUR_API_KEY"
  }

export const Page = () => {
  return (
    <PanoraWidget config={widgetConfig} />
  );
}

Compatibility

Widget Configuration

Custom Widget Configurations

import { PanoraWidget, PanoraWidgetConfig } from "@panoraexchange/widget-sdk"

const widgetConfig: PanoraWidgetConfig = {
    API_KEY: "YOUR_API_KEY",
    // Custom styles to tailor the appearance of the widget
    styles?: {
      colors?: {
        primary?: string
        secondary?: string
        textPrimary?: string
        textSecondary?: string
    }
      widget?: {
        width?: string
        backgroundColor?: string
        secondaryBackgroundColor?: string
    }
      modal?: {
        width?: string
        backgroundColor?: string
        secondaryBackgroundColor?: string
    }
  },
    // Whether to show the connect wallet button or not (default: true)
    showConnectWalletButton: true,
    // Whether to show expanded view of the complete route (defult: true)
    showExpandRouteIcon: true,
    // Whether to show the detailed info about the swap transaction (default: true)
    showRouteInfo: true,
    // Overrides the list of enabled wallets to display within the widget
    enabledWallets: [  
        "Petra",
        "Martian",
        "Pontem",
        "Nightly",
        "OKX Wallet",
    ],
    // Configuration parameters for submitting a transaction. Sensible defaults for these values are taken if they are not specified explicitly.
    transactionOptions?: {
        // The maximum amount of gas that can be consumed by the transaction
        maxGasAmount?: 10000
        // The price per unit of gas that the sender is willing to pay
        gasUnitPrice?: 100,
        // Unix timestamp indicating when a transaction will expire if not included in the blockchain
        expireTimestamp: (new Date("2050-01-01T00:00:00Z"))?.getTime()

  },
   // Adding custom action buttons in the swap widget
  customActionBtns: [<button onClick={() => customAction()}>Custom Button</button>, ...],
  // Whether the token picker should open in a detailed modal format or a simple dropdown
  tokenPickerView: "DROPDOWN" | "MODAL",
  // Custom tokens to be used in the swap token picker
  customTokenList?: [
    "0x1::aptos_coin::AptosCoin", "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC", 
    ...],
  // Custom manifest.json url for mizu wallet
  mizuWalletManifestUrl?: string
  // Default list of favorite tokens to be shown in the token picker
  defaultFavoriteTokens?: [
    "0x1::aptos_coin::AptosCoin", "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC", 
    ...]
}

Widget Controls

import { usePanoraWidget } from "@panoraexchange/widget-sdk"

const widget = usePanoraWidget()

Set the from token in the swap widget

widget.setFromTokenAddress({ tokenType: "token address" })

Set the to token in the swap widget

widget.setToTokenAddress({ tokenType: "token address" })

Open the widget token picker

widget.openTokenPicker()

Close the widget token picker

widget.closeTokenPicker()
1.0.61

3 months ago

1.0.60

3 months ago

1.0.39

3 months ago

1.0.38

4 months ago

1.0.40

3 months ago

1.0.44

3 months ago

1.0.43

3 months ago

1.0.42

3 months ago

1.0.41

3 months ago

1.0.47

3 months ago

1.0.46

3 months ago

1.0.45

3 months ago

1.0.49

3 months ago

1.0.51

3 months ago

1.0.50

3 months ago

1.0.55

3 months ago

1.0.54

3 months ago

1.0.53

3 months ago

1.0.52

3 months ago

1.0.59

3 months ago

1.0.58

3 months ago

1.0.57

3 months ago

1.0.56

3 months ago

1.0.37

4 months ago

0.4.42

6 months ago

0.4.43

6 months ago

0.4.40

6 months ago

0.4.41

6 months ago

0.4.48

6 months ago

0.4.49

6 months ago

0.4.46

6 months ago

0.4.47

6 months ago

0.4.44

6 months ago

0.4.31

7 months ago

0.4.32

7 months ago

0.4.30

7 months ago

0.4.39

6 months ago

0.4.37

7 months ago

0.4.38

7 months ago

0.4.35

7 months ago

0.4.36

7 months ago

0.4.33

7 months ago

0.4.34

7 months ago

0.4.20

7 months ago

0.4.21

7 months ago

0.4.28

7 months ago

0.4.29

7 months ago

0.4.26

7 months ago

0.4.27

7 months ago

0.4.24

7 months ago

0.4.22

7 months ago

0.4.23

7 months ago

0.4.19

7 months ago

0.4.10

7 months ago

0.4.17

7 months ago

0.4.15

7 months ago

0.4.16

7 months ago

0.4.13

7 months ago

0.4.14

7 months ago

0.4.11

7 months ago

0.4.12

7 months ago

0.4.86

5 months ago

0.4.84

5 months ago

0.4.85

5 months ago

0.4.82

5 months ago

0.4.83

5 months ago

0.4.80

5 months ago

0.4.81

5 months ago

0.4.75

6 months ago

0.4.76

6 months ago

0.4.73

6 months ago

0.4.74

6 months ago

0.4.71

6 months ago

0.4.72

6 months ago

0.4.70

6 months ago

0.4.79

5 months ago

0.4.77

5 months ago

0.4.78

5 months ago

0.4.64

6 months ago

0.3.97

7 months ago

0.4.65

6 months ago

0.3.96

7 months ago

0.3.95

7 months ago

0.4.63

6 months ago

0.4.60

6 months ago

0.3.93

7 months ago

0.4.61

6 months ago

0.4.69

6 months ago

0.4.66

6 months ago

0.3.99

7 months ago

0.4.67

6 months ago

0.3.98

7 months ago

0.4.53

6 months ago

0.4.54

6 months ago

0.4.51

6 months ago

0.4.52

6 months ago

0.4.50

6 months ago

0.4.59

6 months ago

0.4.57

6 months ago

0.4.58

6 months ago

0.4.55

6 months ago

0.4.56

6 months ago

0.4.9

7 months ago

0.4.8

7 months ago

0.4.5

7 months ago

0.4.4

7 months ago

0.4.6

7 months ago

0.4.1

7 months ago

0.4.0

7 months ago

0.4.3

7 months ago

0.4.2

7 months ago

1.0.36

4 months ago

0.3.75

7 months ago

0.3.74

7 months ago

0.3.73

7 months ago

0.3.72

7 months ago

0.3.71

7 months ago

0.3.70

7 months ago

0.3.79

7 months ago

0.3.78

7 months ago

0.3.64

7 months ago

0.3.63

7 months ago

0.3.62

7 months ago

0.3.61

7 months ago

0.3.60

7 months ago

0.3.69

7 months ago

0.3.68

7 months ago

0.3.67

7 months ago

0.3.66

7 months ago

0.3.65

7 months ago

0.3.53

7 months ago

0.3.51

7 months ago

0.3.50

7 months ago

0.3.59

7 months ago

0.3.58

7 months ago

0.3.57

7 months ago

0.3.56

7 months ago

0.3.55

7 months ago

0.3.54

7 months ago

0.3.41

7 months ago

0.3.40

7 months ago

0.3.49

7 months ago

0.3.48

7 months ago

0.3.47

7 months ago

0.3.45

7 months ago

0.3.91

7 months ago

0.3.90

7 months ago

0.3.86

7 months ago

0.3.85

7 months ago

0.3.84

7 months ago

0.3.83

7 months ago

0.3.82

7 months ago

0.3.81

7 months ago

0.3.80

7 months ago

0.3.89

7 months ago

0.3.88

7 months ago

0.3.87

7 months ago

0.3.39

7 months ago

0.3.31

8 months ago

0.3.30

8 months ago

0.3.38

8 months ago

0.3.37

8 months ago

0.3.36

8 months ago

0.3.35

8 months ago

0.3.34

8 months ago

0.3.33

8 months ago

0.3.32

8 months ago

0.3.29

8 months ago

0.3.28

8 months ago

0.3.27

8 months ago

0.3.26

8 months ago

0.3.25

8 months ago

0.3.24

8 months ago

0.3.23

8 months ago

0.3.20

8 months ago

0.3.22

8 months ago

0.3.21

8 months ago

0.3.19

8 months ago

0.3.18

8 months ago

0.3.9

8 months ago

0.3.17

8 months ago

0.3.16

8 months ago

0.3.15

8 months ago

0.3.14

8 months ago

0.3.13

8 months ago

0.3.12

8 months ago

0.3.11

8 months ago

0.3.10

8 months ago

0.3.6

8 months ago

0.3.5

8 months ago

0.3.8

8 months ago

0.3.7

8 months ago

0.2.96

8 months ago

0.2.95

9 months ago

0.2.94

9 months ago

0.2.93

9 months ago

0.2.92

9 months ago

0.2.99

8 months ago

0.2.98

8 months ago

0.2.97

8 months ago

0.3.0

8 months ago

0.3.2

8 months ago

0.3.1

8 months ago

0.3.4

8 months ago

0.3.3

8 months ago

0.2.91

9 months ago

0.2.90

9 months ago

0.2.85

9 months ago

0.2.84

9 months ago

0.2.83

9 months ago

0.2.82

9 months ago

0.2.81

9 months ago

0.2.80

9 months ago

0.2.89

9 months ago

0.2.88

9 months ago

0.2.87

9 months ago

0.2.86

9 months ago

0.2.78

9 months ago

0.2.75

9 months ago

0.2.73

9 months ago

0.2.72

9 months ago

0.2.71

9 months ago

0.2.70

9 months ago

0.2.69

9 months ago

0.2.68

9 months ago

0.2.67

9 months ago

0.2.66

9 months ago

0.2.65

9 months ago

0.2.27

9 months ago

0.2.26

9 months ago

0.2.25

9 months ago

0.2.24

9 months ago

0.2.23

9 months ago

0.2.22

9 months ago

0.2.21

9 months ago

0.2.63

9 months ago

0.2.62

9 months ago

0.2.61

9 months ago

0.2.60

9 months ago

0.2.64

9 months ago

0.2.51

9 months ago

0.2.50

9 months ago

0.2.59

9 months ago

0.2.58

9 months ago

0.2.57

9 months ago

0.2.56

9 months ago

0.2.55

9 months ago

0.2.54

9 months ago

0.2.53

9 months ago

0.2.41

9 months ago

0.2.40

9 months ago

0.2.48

9 months ago

0.2.45

9 months ago

0.2.44

9 months ago

0.2.43

9 months ago

0.2.42

9 months ago

0.2.39

9 months ago

0.2.30

9 months ago

0.2.38

9 months ago

0.2.37

9 months ago

0.2.36

9 months ago

0.2.35

9 months ago

0.2.34

9 months ago

0.2.33

9 months ago

0.2.32

9 months ago

0.2.29

9 months ago

0.2.28

9 months ago

0.2.20

9 months ago

0.2.18

9 months ago

0.2.17

9 months ago

0.2.16

9 months ago

0.2.15

9 months ago

0.2.14

9 months ago

0.2.13

9 months ago

0.2.12

9 months ago

0.2.10

9 months ago

0.1.96

9 months ago

0.1.97

9 months ago

0.1.98

9 months ago

0.1.99

9 months ago

0.1.90

9 months ago

0.1.91

9 months ago

0.1.92

9 months ago

0.1.93

9 months ago

0.1.94

9 months ago

0.1.95

9 months ago

0.1.88

9 months ago

0.1.89

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.2.7

9 months ago

0.2.6

9 months ago

0.2.9

9 months ago

0.2.8

9 months ago

0.2.3

9 months ago

0.2.2

9 months ago

0.2.5

9 months ago

0.2.4

9 months ago

0.1.87

9 months ago

0.1.52

9 months ago

0.1.53

9 months ago

0.1.54

9 months ago

0.1.55

9 months ago

0.1.56

9 months ago

0.1.57

9 months ago

0.1.58

9 months ago

0.1.59

9 months ago

0.1.50

9 months ago

0.1.51

9 months ago

0.1.49

9 months ago

0.1.85

9 months ago

0.1.41

9 months ago

0.1.86

9 months ago

0.1.42

9 months ago

0.1.44

9 months ago

0.1.45

9 months ago

0.1.46

9 months ago

0.1.47

9 months ago

0.1.48

9 months ago

0.1.81

9 months ago

0.1.82

9 months ago

0.1.83

9 months ago

0.1.84

9 months ago

0.1.74

9 months ago

0.1.75

9 months ago

0.1.76

9 months ago

0.1.77

9 months ago

0.1.78

9 months ago

0.1.79

9 months ago

0.1.70

9 months ago

0.1.71

9 months ago

0.1.72

9 months ago

0.1.73

9 months ago

0.1.63

9 months ago

0.1.64

9 months ago

0.1.65

9 months ago

0.1.66

9 months ago

0.1.67

9 months ago

0.1.68

9 months ago

0.1.69

9 months ago

0.1.60

9 months ago

0.1.61

9 months ago

0.1.62

9 months ago

0.1.37

9 months ago

0.1.40

9 months ago

0.1.38

9 months ago

0.1.39

9 months ago

0.1.30

9 months ago

0.1.31

9 months ago

0.1.32

9 months ago

0.1.33

9 months ago

0.1.34

9 months ago

0.1.35

9 months ago

0.1.36

9 months ago

0.1.15

9 months ago

0.1.27

9 months ago

0.1.28

9 months ago

0.1.29

9 months ago

0.1.20

9 months ago

0.1.21

9 months ago

0.1.22

9 months ago

0.1.23

9 months ago

0.1.24

9 months ago

0.1.25

9 months ago

0.1.26

9 months ago

0.1.16

9 months ago

0.1.17

9 months ago

0.1.18

9 months ago

0.1.19

9 months ago

0.1.10

9 months ago

0.1.11

9 months ago

0.1.12

9 months ago

0.1.13

9 months ago

0.1.14

9 months ago

0.1.8

9 months ago

0.1.7

9 months ago

0.1.9

9 months ago

0.1.6

9 months ago

0.1.5

9 months ago

0.1.4

9 months ago

0.1.3

9 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago