@thirdweb-dev/wallets
Version:
<p align="center"> <br /> <a href="https://thirdweb.com"><img src="https://github.com/thirdweb-dev/js/blob/main/legacy_packages/sdk/logo.svg?raw=true" width="200" alt=""/></a> <br /> </p> <h1 align="center">thirdweb Wallet SDK</h1> <p align="center"> <a h
130 lines • 4.8 kB
TypeScript
import type { WalletConnectConnector as WalletConnectConnectorType } from "../connectors/wallet-connect";
import type { QRModalOptions } from "../connectors/wallet-connect/qrModalOptions";
import { Connector } from "../interfaces/connector";
import { AbstractClientWallet, WalletOptions } from "./base";
import type { OKXConnector as OKXConnectorType } from "../connectors/okx";
type OKXAdditionalOptions = {
/**
* Whether to open the default Wallet Connect QR code Modal for connecting to OKX Wallet on mobile if OKX is not injected when calling connect().
*/
qrcode?: boolean;
/**
* When connecting OKX using the QR Code - Wallet Connect connector is used which requires a project id.
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
*
* https://docs.walletconnect.com/2.0/web3modal/options#projectid-required
*/
projectId?: string;
/**
* options to customize the Wallet Connect QR Code Modal ( only relevant when qrcode is true )
*
* https://docs.walletconnect.com/2.0/web3modal/options
*/
qrModalOptions?: QRModalOptions;
};
export type OKXWalletOptions = WalletOptions<OKXAdditionalOptions>;
type ConnectWithQrCodeArgs = {
chainId?: number;
onQrCodeUri: (uri: string) => void;
onConnected: (accountAddress: string) => void;
};
/**
* @wallet
*/
export declare class OKXWallet extends AbstractClientWallet<OKXAdditionalOptions> {
/**
* @internal
*/
connector?: Connector;
/**
* @internal
*/
walletConnectConnector?: WalletConnectConnectorType;
/**
* @internal
*/
OKXConnector?: OKXConnectorType;
/**
* @internal
*/
isInjected: boolean;
/**
* @internal
*/
static id: string;
/**
* @internal
*/
get walletName(): "OKX";
/**
* Create instance of `OKXWallet`
*
* @param options - The `options` object contains the following properties:
* ### clientId (recommended)
*
* Provide `clientId` to use the thirdweb RPCs for given `chains`
*
* You can create a client ID for your application from [thirdweb dashboard](https://thirdweb.com/create-api-key).
*
* ### projectId (recommended)
*
* This is only relevant if you want to use [WalletConnect](https://walletconnect.com/) for connecting to Zerion wallet mobile app when MetaMask is not injected.
*
* This `projectId` can be obtained at [cloud.walletconnect.com](https://cloud.walletconnect.com/). It is highly recommended to use your own project id and only use the default one for testing purposes.
*
* ### chains (optional)
* Provide an array of chains you want to support.
*
* Must be an array of `Chain` objects, from the [`@thirdweb-dev/chains`](https://www.npmjs.com/package/\@thirdweb-dev/chains) package.
*
* Defaults to our [default chains](/react/react.thirdwebprovider#default-chains).
*
* ### dappMetadata (optional)
* Information about your app that the wallet will display when your app tries to connect to it.
*
* Must be an object containing `name`, `url`, and optionally `description` and `logoUrl` properties.
*
* ### qrcode
* Whether to display the Wallet Connect QR code Modal or not.
*
* Must be a `boolean`. Defaults to `true`.
*
* ### qrModalOptions
* WalletConnect's [options](https://docs.walletconnect.com/advanced/walletconnectmodal/options) to customize the QR Code Modal.
*
*/
constructor(options: OKXWalletOptions);
protected getConnector(): Promise<Connector>;
/**
* Connect to the wallet using a QR code.
* You can use this method to display a QR code. The user can scan this QR code using the OKX Wallet mobile app to connect to your dapp.
*
* @example
* ```typescript
* wallet.connectWithQrCode({
* chainId: 1,
* onQrCodeUri(qrCodeUri) {
* // render the QR code with `qrCodeUri`
* },
* onConnected(accountAddress) {
* // update UI to show connected state
* },
* })
* ```
*
* @param options -
* The options object contains the following properties/method:
*
* ### chainId (optional)
* If provided, wallet will prompt the user to switch to the network with the given `chainId` after connecting.
*
* ### onQrCodeUri
* A callback to get the QR code URI to display to the user.
*
* ### onConnected
* A callback that is called when the user has connected their wallet using the QR code.
*/
connectWithQrCode(options: ConnectWithQrCodeArgs): Promise<void>;
}
export {};
//# sourceMappingURL=okx.d.ts.map