Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ditch support to mb wallet #541

Merged
merged 5 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions packages/data/src/api/nearPrice/nearPrice.test.ts

This file was deleted.

12 changes: 6 additions & 6 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You can check a [quick example of Simple Login](https://github.com/Mintbase/exam

- [Installing](#Installing)

- [MintbaseWalletContextProvider (default)](#mintbasewalletcontextprovider) : The default Mintbase Wallet provider
- [BitteWalletContextProvider (default)](#bittewalletcontextprovider) : The default Bitte Wallet provider


# Installing
Expand Down Expand Up @@ -52,9 +52,9 @@ pnpm install @mintbase-js/react
pnpm install @near-wallet-selector/modal-ui
```

# MintbaseWalletContextProvider
# BitteWalletContextProvider

the default way of interacting with Mintbase Wallet is using the MintbaseWalletContextProvider
the default way of interacting with Mintbase Wallet is using the BitteWalletContextProvider

{% code title="app.tsx" overflow="wrap" lineNumbers="true" %}

Expand All @@ -72,15 +72,15 @@ the default way of interacting with Mintbase Wallet is using the MintbaseWalletC

```typescript
import "@near-wallet-selector/modal-ui/styles.css";
import { MintbaseWalletContextProvider } from '@mintbase-js/react'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this should just be called WalletContextProvider - independent of the name. If it were, then we wouldn't have had to change anything here.

import { BitteWalletContextProvider } from '@mintbase-js/react'

<MintbaseWalletContextProvider
<BitteWalletContextProvider
contractAddress="mycontract.mintbase1.near"
network="mainnet"
callbackUrl="https://www.mywebsite.com/callback"
>
<Component {...pageProps} />
</MintbaseWalletContextProvider>
</BitteWalletContextProvider>

```

Expand Down
3 changes: 1 addition & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"scripts": {
"build": "tsc",
"watch": "tsc && tsc --watch & jest --watch --coverage",
"lint": "eslint . --fix --ext ts --ext tsx",
"test": "jest --coverage"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why tho?

"lint": "eslint . --fix --ext ts --ext tsx"
},
"files": [
"lib"
Expand Down
15 changes: 8 additions & 7 deletions packages/react/src/BitteWalletContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ interface ContextProviderType {
additionalWallets?: Array<WalletModuleFactory>;
successUrl?: string;
failureUrl?: string;
onlyBitteWallet?: boolean
}


Expand All @@ -52,7 +53,7 @@ export const BitteWalletContextProvider: React.FC<ContextProviderType> = ({
network,
contractAddress,
additionalWallets,
onlyMbWallet,
onlyBitteWallet,
callbackUrl,
successUrl,
failureUrl,
Expand All @@ -73,21 +74,21 @@ export const BitteWalletContextProvider: React.FC<ContextProviderType> = ({

const { setupBitteWalletSelector, registerWalletAccountsSubscriber, connectWalletSelector, pollForWalletConnection, disconnectFromWalletSelector, signMessage } = BitteWalletAuth;

const setupMbWallet = async (): Promise<WalletSelectorComponents> => {
const isOnlyMbWallet = !!onlyMbWallet || !!(additionalWallets && additionalWallets.length > 0);
const setupBitteWallet = async (): Promise<WalletSelectorComponents> => {
const isOnlyBitteWallet = !!onlyBitteWallet || !!(additionalWallets && additionalWallets.length > 0);

return await setupBitteWalletSelector(
callbackUrl,
isOnlyMbWallet,
isOnlyBitteWallet,
selectedNetwork,
selectedContract,
isOnlyMbWallet ? { additionalWallets } : undefined,
isOnlyBitteWallet ? { additionalWallets } : undefined,
successUrl, failureUrl,
);
};
Comment on lines +77 to 88
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could live without having the wallet name everywhere. Like why not just setupWallet? People know its the bitte wallet from the import.


const setup = useCallback(async () => {
const components = await setupMbWallet();
const components = await setupBitteWallet();

setIsWalletSelectorSetup(true);
setComponents(components);
Expand All @@ -98,7 +99,7 @@ export const BitteWalletContextProvider: React.FC<ContextProviderType> = ({
};

const setupWallet = async (): Promise<WalletSelectorComponents> => {
const components = await setupMbWallet();
const components = await setupBitteWallet();

return components;
};
Expand Down
195 changes: 0 additions & 195 deletions packages/react/src/MintbaseWalletContext.test.tsx

This file was deleted.

Loading