1.0.61 • Published 2 months ago

test-widget-knv-1 v1.0.61

Weekly downloads
-
License
MIT
Repository
-
Last release
2 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

2 months ago

1.0.60

2 months ago

1.0.39

2 months ago

1.0.38

3 months ago

1.0.40

2 months ago

1.0.44

2 months ago

1.0.43

2 months ago

1.0.42

2 months ago

1.0.41

2 months ago

1.0.47

2 months ago

1.0.46

2 months ago

1.0.45

2 months ago

1.0.49

2 months ago

1.0.51

2 months ago

1.0.50

2 months ago

1.0.55

2 months ago

1.0.54

2 months ago

1.0.53

2 months ago

1.0.52

2 months ago

1.0.59

2 months ago

1.0.58

2 months ago

1.0.57

2 months ago

1.0.56

2 months ago

1.0.37

3 months ago

0.4.42

5 months ago

0.4.43

5 months ago

0.4.40

5 months ago

0.4.41

5 months ago

0.4.48

5 months ago

0.4.49

5 months ago

0.4.46

5 months ago

0.4.47

5 months ago

0.4.44

5 months ago

0.4.31

6 months ago

0.4.32

6 months ago

0.4.30

6 months ago

0.4.39

5 months ago

0.4.37

6 months ago

0.4.38

6 months ago

0.4.35

6 months ago

0.4.36

6 months ago

0.4.33

6 months ago

0.4.34

6 months ago

0.4.20

6 months ago

0.4.21

6 months ago

0.4.28

6 months ago

0.4.29

6 months ago

0.4.26

6 months ago

0.4.27

6 months ago

0.4.24

6 months ago

0.4.22

6 months ago

0.4.23

6 months ago

0.4.19

6 months ago

0.4.10

6 months ago

0.4.17

6 months ago

0.4.15

6 months ago

0.4.16

6 months ago

0.4.13

6 months ago

0.4.14

6 months ago

0.4.11

6 months ago

0.4.12

6 months ago

0.4.86

4 months ago

0.4.84

4 months ago

0.4.85

4 months ago

0.4.82

4 months ago

0.4.83

4 months ago

0.4.80

4 months ago

0.4.81

4 months ago

0.4.75

5 months ago

0.4.76

5 months ago

0.4.73

5 months ago

0.4.74

5 months ago

0.4.71

5 months ago

0.4.72

5 months ago

0.4.70

5 months ago

0.4.79

4 months ago

0.4.77

4 months ago

0.4.78

4 months ago

0.4.64

5 months ago

0.3.97

6 months ago

0.4.65

5 months ago

0.3.96

6 months ago

0.3.95

6 months ago

0.4.63

5 months ago

0.4.60

5 months ago

0.3.93

6 months ago

0.4.61

5 months ago

0.4.69

5 months ago

0.4.66

5 months ago

0.3.99

6 months ago

0.4.67

5 months ago

0.3.98

6 months ago

0.4.53

5 months ago

0.4.54

5 months ago

0.4.51

5 months ago

0.4.52

5 months ago

0.4.50

5 months ago

0.4.59

5 months ago

0.4.57

5 months ago

0.4.58

5 months ago

0.4.55

5 months ago

0.4.56

5 months ago

0.4.9

6 months ago

0.4.8

6 months ago

0.4.5

6 months ago

0.4.4

6 months ago

0.4.6

6 months ago

0.4.1

6 months ago

0.4.0

6 months ago

0.4.3

6 months ago

0.4.2

6 months ago

1.0.36

3 months ago

0.3.75

6 months ago

0.3.74

6 months ago

0.3.73

6 months ago

0.3.72

6 months ago

0.3.71

6 months ago

0.3.70

6 months ago

0.3.79

6 months ago

0.3.78

6 months ago

0.3.64

6 months ago

0.3.63

6 months ago

0.3.62

6 months ago

0.3.61

6 months ago

0.3.60

6 months ago

0.3.69

6 months ago

0.3.68

6 months ago

0.3.67

6 months ago

0.3.66

6 months ago

0.3.65

6 months ago

0.3.53

6 months ago

0.3.51

6 months ago

0.3.50

6 months ago

0.3.59

6 months ago

0.3.58

6 months ago

0.3.57

6 months ago

0.3.56

6 months ago

0.3.55

6 months ago

0.3.54

6 months ago

0.3.41

6 months ago

0.3.40

6 months ago

0.3.49

6 months ago

0.3.48

6 months ago

0.3.47

6 months ago

0.3.45

6 months ago

0.3.91

6 months ago

0.3.90

6 months ago

0.3.86

6 months ago

0.3.85

6 months ago

0.3.84

6 months ago

0.3.83

6 months ago

0.3.82

6 months ago

0.3.81

6 months ago

0.3.80

6 months ago

0.3.89

6 months ago

0.3.88

6 months ago

0.3.87

6 months ago

0.3.39

6 months ago

0.3.31

7 months ago

0.3.30

7 months ago

0.3.38

7 months ago

0.3.37

7 months ago

0.3.36

7 months ago

0.3.35

7 months ago

0.3.34

7 months ago

0.3.33

7 months ago

0.3.32

7 months ago

0.3.29

7 months ago

0.3.28

7 months ago

0.3.27

7 months ago

0.3.26

7 months ago

0.3.25

7 months ago

0.3.24

7 months ago

0.3.23

7 months ago

0.3.20

7 months ago

0.3.22

7 months ago

0.3.21

7 months ago

0.3.19

7 months ago

0.3.18

7 months ago

0.3.9

7 months ago

0.3.17

7 months ago

0.3.16

7 months ago

0.3.15

7 months ago

0.3.14

7 months ago

0.3.13

7 months ago

0.3.12

7 months ago

0.3.11

7 months ago

0.3.10

7 months ago

0.3.6

7 months ago

0.3.5

7 months ago

0.3.8

7 months ago

0.3.7

7 months ago

0.2.96

7 months ago

0.2.95

7 months ago

0.2.94

7 months ago

0.2.93

7 months ago

0.2.92

7 months ago

0.2.99

7 months ago

0.2.98

7 months ago

0.2.97

7 months ago

0.3.0

7 months ago

0.3.2

7 months ago

0.3.1

7 months ago

0.3.4

7 months ago

0.3.3

7 months ago

0.2.91

8 months ago

0.2.90

8 months ago

0.2.85

8 months ago

0.2.84

8 months ago

0.2.83

8 months ago

0.2.82

8 months ago

0.2.81

8 months ago

0.2.80

8 months ago

0.2.89

8 months ago

0.2.88

8 months ago

0.2.87

8 months ago

0.2.86

8 months ago

0.2.78

8 months ago

0.2.75

8 months ago

0.2.73

8 months ago

0.2.72

8 months ago

0.2.71

8 months ago

0.2.70

8 months ago

0.2.69

8 months ago

0.2.68

8 months ago

0.2.67

8 months ago

0.2.66

8 months ago

0.2.65

8 months ago

0.2.27

8 months ago

0.2.26

8 months ago

0.2.25

8 months ago

0.2.24

8 months ago

0.2.23

8 months ago

0.2.22

8 months ago

0.2.21

8 months ago

0.2.63

8 months ago

0.2.62

8 months ago

0.2.61

8 months ago

0.2.60

8 months ago

0.2.64

8 months ago

0.2.51

8 months ago

0.2.50

8 months ago

0.2.59

8 months ago

0.2.58

8 months ago

0.2.57

8 months ago

0.2.56

8 months ago

0.2.55

8 months ago

0.2.54

8 months ago

0.2.53

8 months ago

0.2.41

8 months ago

0.2.40

8 months ago

0.2.48

8 months ago

0.2.45

8 months ago

0.2.44

8 months ago

0.2.43

8 months ago

0.2.42

8 months ago

0.2.39

8 months ago

0.2.30

8 months ago

0.2.38

8 months ago

0.2.37

8 months ago

0.2.36

8 months ago

0.2.35

8 months ago

0.2.34

8 months ago

0.2.33

8 months ago

0.2.32

8 months ago

0.2.29

8 months ago

0.2.28

8 months ago

0.2.20

8 months ago

0.2.18

8 months ago

0.2.17

8 months ago

0.2.16

8 months ago

0.2.15

8 months ago

0.2.14

8 months ago

0.2.13

8 months ago

0.2.12

8 months ago

0.2.10

8 months ago

0.1.96

8 months ago

0.1.97

8 months ago

0.1.98

8 months ago

0.1.99

8 months ago

0.1.90

8 months ago

0.1.91

8 months ago

0.1.92

8 months ago

0.1.93

8 months ago

0.1.94

8 months ago

0.1.95

8 months ago

0.1.88

8 months ago

0.1.89

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.2.7

8 months ago

0.2.6

8 months ago

0.2.9

8 months ago

0.2.8

8 months ago

0.2.3

8 months ago

0.2.2

8 months ago

0.2.5

8 months ago

0.2.4

8 months ago

0.1.87

8 months ago

0.1.52

8 months ago

0.1.53

8 months ago

0.1.54

8 months ago

0.1.55

8 months ago

0.1.56

8 months ago

0.1.57

8 months ago

0.1.58

8 months ago

0.1.59

8 months ago

0.1.50

8 months ago

0.1.51

8 months ago

0.1.49

8 months ago

0.1.85

8 months ago

0.1.41

8 months ago

0.1.86

8 months ago

0.1.42

8 months ago

0.1.44

8 months ago

0.1.45

8 months ago

0.1.46

8 months ago

0.1.47

8 months ago

0.1.48

8 months ago

0.1.81

8 months ago

0.1.82

8 months ago

0.1.83

8 months ago

0.1.84

8 months ago

0.1.74

8 months ago

0.1.75

8 months ago

0.1.76

8 months ago

0.1.77

8 months ago

0.1.78

8 months ago

0.1.79

8 months ago

0.1.70

8 months ago

0.1.71

8 months ago

0.1.72

8 months ago

0.1.73

8 months ago

0.1.63

8 months ago

0.1.64

8 months ago

0.1.65

8 months ago

0.1.66

8 months ago

0.1.67

8 months ago

0.1.68

8 months ago

0.1.69

8 months ago

0.1.60

8 months ago

0.1.61

8 months ago

0.1.62

8 months ago

0.1.37

8 months ago

0.1.40

8 months ago

0.1.38

8 months ago

0.1.39

8 months ago

0.1.30

8 months ago

0.1.31

8 months ago

0.1.32

8 months ago

0.1.33

8 months ago

0.1.34

8 months ago

0.1.35

8 months ago

0.1.36

8 months ago

0.1.15

8 months ago

0.1.27

8 months ago

0.1.28

8 months ago

0.1.29

8 months ago

0.1.20

8 months ago

0.1.21

8 months ago

0.1.22

8 months ago

0.1.23

8 months ago

0.1.24

8 months ago

0.1.25

8 months ago

0.1.26

8 months ago

0.1.16

8 months ago

0.1.17

8 months ago

0.1.18

8 months ago

0.1.19

8 months ago

0.1.10

8 months ago

0.1.11

8 months ago

0.1.12

8 months ago

0.1.13

8 months ago

0.1.14

8 months ago

0.1.8

8 months ago

0.1.7

8 months ago

0.1.9

8 months ago

0.1.6

8 months ago

0.1.5

8 months ago

0.1.4

8 months ago

0.1.3

8 months ago

0.1.2

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago