Skip to content

Commit

Permalink
Ditch support to mb wallet (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenmarcus authored Sep 19, 2024
1 parent b2f96c7 commit 4af87a9
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 793 deletions.
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'
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"
"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,
);
};

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

0 comments on commit 4af87a9

Please sign in to comment.