@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
126 lines (120 loc) • 6.04 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var defineProperty = require('../../../../dist/defineProperty-9051a5d3.cjs.dev.js');
var connector = require('../../../../dist/connector-a63dd9e7.cjs.dev.js');
var evm_wallets_base_dist_thirdwebDevWalletsEvmWalletsBase = require('../../../../dist/base-23fd36a9.cjs.dev.js');
var walletIds = require('../../../../dist/walletIds-a0be5020.cjs.dev.js');
var chains = require('@thirdweb-dev/chains');
require('eventemitter3');
require('../../abstract/dist/thirdweb-dev-wallets-evm-wallets-abstract.cjs.dev.js');
require('ethers');
require('@thirdweb-dev/sdk');
require('../../../../dist/headers-2be346e5.cjs.dev.js');
/**
* Wallet Interface to connect to [Blocto Wallet](https://blocto.io/)
*
* @example
* ```javascript
* import { BloctoWallet } from "@thirdweb-dev/wallets";
*
* const wallet = new BloctoWallet();
*
* wallet.connect();
* ```
*
* @wallet
*/
class BloctoWallet extends evm_wallets_base_dist_thirdwebDevWalletsEvmWalletsBase.AbstractClientWallet {
/**
* Create a `BloctoWallet` instance
* @param options - The `options` object includes 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).
*
* ### appId (recommended)
* To get advanced features and support from Blocto, you can create an appId from [blocto dashboard](https://docs.blocto.app/blocto-sdk/register-app-id)
*
* ### 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.
*
* ```javascript
* import { BloctoWallet } from "@thirdweb-dev/wallets";
*
* const walletWithOptions = new BloctoWallet({
* dappMetadata: {
* name: "thirdweb powered dApp",
* url: "https://thirdweb.com",
* description: "thirdweb powered dApp",
* logoUrl: "https://thirdweb.com/favicon.ico",
* },
* });
* ```
*
* ### chain (optional)
* The Network to connect the wallet to. Must be a `Chain` object, from the [`@thirdweb-dev/chains`](https://www.npmjs.com/package/\@thirdweb-dev/chains) package.
*/
constructor(options) {
if (options?.chain && options.clientId) {
options.chain = chains.updateChainRPCs(options.chain, options.clientId);
}
super(BloctoWallet.id, options);
/**
* @internal
*/
/**
* @internal
*/
defineProperty._defineProperty(this, "name", "Blocto");
}
/**
* @internal
*/
async initConnector() {
const {
BloctoConnector
} = await Promise.resolve().then(function () { return require('../../../connectors/blocto/dist/thirdweb-dev-wallets-evm-connectors-blocto.cjs.dev.js'); });
const bloctoConnector = new BloctoConnector({
chains: this.chains,
options: {
appId: this.options?.appId,
chainId: this.options?.chain?.chainId
}
});
this.connector = new connector.WagmiAdapter(bloctoConnector);
return this.connector;
}
async getConnector() {
if (!this.connector) {
return await this.initConnector();
}
return Promise.resolve(this.connector);
}
}
/**
* @internal
*/
defineProperty._defineProperty(BloctoWallet, "id", walletIds.walletIds.blocto);
/**
* @internal
*/
defineProperty._defineProperty(BloctoWallet, "meta", {
name: "Blocto",
iconURL: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzIyMzNfMjM4NykiPgo8cmVjdCB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHJ4PSIxMiIgZmlsbD0id2hpdGUiLz4KPHBhdGggZD0iTTMyLjkwM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9Ik0yNS41NjM2IDEyLjY4MjZDMjUuNTYzNiAxNS4wMzQ0IDI0LjMzMTUgMTcuMjE2NCAyMi4zMDggMTguNDE1M0MyMS4wMzc3IDE5LjE2ODYgMTkuODQ2OCAyMC4wNTgyIDE4Ljc2ODQgMjEuMDcxNUMxNi4zNzU1IDIzLjMxMzkgMTQuNTg5OCAyNi4wNjUzIDEzLjI2NzMgMjguNzkyOUMxMy4wMDcyIDI5LjMzMDQgMTIuMiAyOS4xNDAyIDEyLjIgMjguNTQyM1YxMi42ODI2QzEyLjIgOC45OTI0MiAxNS4xOTI0IDYgMTguODgyNiA2QzIyLjU3MjggNiAyNS41NjUyIDguOTkyNDIgMjUuNTY1MiAxMi42ODI2SDI1LjU2MzZaIiBmaWxsPSIjMDA3NUZGIi8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iY2xpcDBfMjIzM18yMzg3Ij4KPHJlY3Qgd2lkdGg9IjYwIiBoZWlnaHQ9IjYwIiBmaWxsPSJ3aGl0ZSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo=",
urls: {
android: "https://play.google.com/store/apps/details?id=com.portto.blocto",
ios: "https://apps.apple.com/app/blocto/id1481181682"
}
});
exports.BloctoWallet = BloctoWallet;