const options {
// optional
infuraProjectId: INFURA_PROJECT_ID,
// optional, you can contact us to apply for higher rate limit
// apiKey: API_KEY,
// optional, you can contact us to apply for higher rate limit
// apiSecret: API_SECRET,
// optional, default is mainnet 1
chainId: CHAIN_ID,
// optional, default is `https://wallet.qubic.app/`
walletUrl: 'https://wallet.qubic.app/',
// optional, default: false, when value is true, the show iframe instead of new window, credit card payment will failed with this option value true
enableIframe: true
// === QubicConnector Only options ===
// optional, default: false, when value is true, the popup will hide automatically
autoHideWelcome: true
// optional, default: false, when value is true, signUp actions from sdk will
// create a account that will force password setting
disableFastSignup: true
// optional, default: false, when value is true will not show in app browser warning
disableIabWarning: true
// optional, default: false, when value is true will not auto open external browser in line iab
disableOpenExternalBrowserWhenLineIab
}
import { initializeConnector, Web3ReactHooks } from '@web3-react/core';
import { Connector, Web3ReactStore } from '@web3-react/types';
import QubicWalletConnector from '@qubic-js/react';
// example if you need metamask
// import { MetaMask } from '@web3-react/metamask';
// const metamask = initializeConnector<MetaMask>(actions => new MetaMask({ actions }));
// please check Connector and Provider Options section
// You should only new only once in your application
const qubic = initializeConnector<QubicWalletConnector | Empty>(actions => {
if (typeof window === 'undefined') return new Empty(actions); // dummy for next.js
return new QubicWalletConnector({
actions,
options: {
chainId: 1,
infuraProjectId: INFURA_PROJECT_ID,
},
});
});
const wrappedConnectors: Record<'qubic', [Connector, Web3ReactHooks, Web3ReactStore]> = {
// metamask, // if you need metamask
qubic,
};
export default wrappedConnectors;
import Main from './Main.tsx';
import wrappedConnectors from './wrappedConnectors';
import { Web3ReactProvider } from '@web3-react/core';
export default function App() {
return (
<Web3ReactProvider connectors={Object.values(wrappedConnectors)}>
<Main />
</Web3ReactProvider>
);
}
import { ethers } from 'ethers';
import QubicProvider from '@qubic-js/browser';
import options from './options';
// please check Connector and Provider Options section
// You should only new only once in your application
const qubicProvider = new QubicProvider(options);
const provider = new ethers.providers.Web3Provider(qubicProvider);