Skip to content

Commit

Permalink
feat: more cleanup, masa client work
Browse files Browse the repository at this point in the history
  • Loading branch information
simodrws committed Jun 9, 2023
1 parent b73e70f commit 233efbe
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
5 changes: 2 additions & 3 deletions src/refactor/masa-client/masa-client-provider.tsx
@@ -1,15 +1,14 @@
import React, { ReactNode, createContext, useContext, useMemo } from 'react';
import type { Masa } from '@masa-finance/masa-sdk';
import { useMasaClient } from './masa-client';

export interface MasaClientProviderValue {
masa?: Masa;
masa?: ReturnType<typeof useMasaClient>['sdk'];
}

export const MasaClientContext = createContext({} as MasaClientProviderValue);

export const MasaClientProvider = ({ children }: { children: ReactNode }) => {
const masa = useMasaClient();
const { sdk: masa } = useMasaClient();

const masaClientProviderValue = useMemo(
() => ({
Expand Down
10 changes: 9 additions & 1 deletion src/refactor/masa-client/masa-client.ts
@@ -1,5 +1,6 @@
import type { Signer } from 'ethers';
import type { NetworkName } from '@masa-finance/masa-sdk';
import { useMemo } from 'react';
import { useConfig } from '../base-provider';
import { useWallet } from '../wallet-client/wallet/use-wallet';
import { useMasaSDK } from './use-masa-sdk';
Expand Down Expand Up @@ -30,5 +31,12 @@ export const useMasaClient = () => {
]
);

return masa;
const masaClient = useMemo(
() => ({
sdk: masa,
}),
[masa]
);

return masaClient;
};
17 changes: 0 additions & 17 deletions src/refactor/masa-client/masa-state-provider.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/refactor/masa-client/use-masa-sdk.ts
Expand Up @@ -59,7 +59,7 @@ export const useMasaSDK = (
let contractOverrides: Partial<IIdentityContracts> | undefined;

if (contractAddressOverrides) {
if (verbose) console.log({ contractAddressOverrides });
if (verbose) console.log('DEBUG:', { contractAddressOverrides });

contractOverrides = {} as Partial<IIdentityContracts>;
contractOverrides.SoulStoreContract = SoulStore__factory.connect(
Expand Down

0 comments on commit 233efbe

Please sign in to comment.