Skip to content

Commit

Permalink
fix soul names being a string[]
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Sep 21, 2023
1 parent 784cf8c commit 5081256
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
Expand Up @@ -40,35 +40,47 @@ export const InterfaceSuccessCreateIdentity = (): JSX.Element => {
}
}, [company]);

const tweetContentLink = useMemo(() => {
const [tweetContentLink, setTweetContentLink] = useState<string>();

useAsync(async () => {
const companyUrlFormatted = company?.toLowerCase().replaceAll(' ', '-');

let tl: string;
switch (company) {
case 'Masa': {
return 'https://app.masa.finance';
tl = 'https://app.masa.finance';
break;
}
case 'Celo': {
if (soulnames && soulnames.length > 0) {
return `https://raregems.io/celo/celo-domain-names/${
soulnames?.at(-1)?.tokenDetails.tokenId.toString() ?? ''
if (soulnames?.[0]) {
const tokenDetails = await masa?.soulName.loadSoulNameByName(
soulnames[0]
);
tl = `https://raregems.io/celo/celo-domain-names/${
tokenDetails?.tokenDetails.tokenId.toString() ?? ''
}`;
}

return 'https://app.masa.finance';
tl = 'https://app.masa.finance';
break;
}
case 'Base': {
return 'https://app.basecamp.global';
tl = 'https://app.basecamp.global';
break;
}
case 'Base Universe':
case 'Brozo': {
return `https://masa.finance/sbts/${
tl = `https://masa.finance/sbts/${
companyUrlFormatted ?? ''
}-soulname-token`;
break;
}
default: {
return 'https://app.masa.finance';
tl = 'https://app.masa.finance';
break;
}
}
setTweetContentLink(tl);
}, [soulnames, company]);

const baseTwitterUrl = 'https://twitter.com/intent/tweet?text=';
Expand Down
17 changes: 3 additions & 14 deletions src/provider/masa-context-provider.tsx
@@ -1,36 +1,24 @@
import {
// CreditScoreDetails,
EnvironmentName,
GenerateGreenResult,
ICreditScore,
IGreen,
SoulNameDetails,
// Masa,
SupportedNetworks,
VerifyGreenResult,
} from '@masa-finance/masa-sdk';
import React, { useCallback, useMemo } from 'react';
import type { BigNumber } from 'ethers';

// import { createNewMasa } from '../helpers';
import {
// useCreditScores,
// useGreen,
// useIdentity,
useModal,
// useNetwork,
// useSession,
// useSoulnames,
// useWallet,
} from './modules';
import { useModal } from './modules';
import { MasaContext } from './masa-context';
import { MasaShape } from './masa-shape';
import { useScopes } from './modules/scopes/scopes';
import { useCustomGallerySBT, useCustomSBT } from './modules/custom-sbts';
import { useRainbowKit } from './use-rainbowkit';
// import { useWagmi } from './modules/wagmi';
// import { useNetworkSwitch } from './use-network-switch';

import { useLogout } from './hooks';
// import { useAccountState } from './use-account-state';
import { useSession as useSessionNew } from '../refactor/masa/use-session';
Expand All @@ -47,6 +35,7 @@ import { useIdentityPurchase } from '../refactor/masa/use-identity-purchase';
import { useCreditScoreCreate } from '../refactor/masa/use-credit-scores-create';
import { useSoulNamesPurchase } from '../refactor/masa/use-soulnames-purchase';
import { CustomGallerySBT } from '../refactor/masa/interfaces';

// import { useSoulNamesPurchase } from '../refactor/masa/use-soulnames-purchase';

export interface ArweaveConfig {
Expand Down Expand Up @@ -407,7 +396,7 @@ export const MasaContextProvider = ({
reloadCreditScores,

// soul names
soulnames: soulnames as SoulNameDetails[] | undefined,
soulnames,
isSoulnamesLoading,
reloadSoulnames,
soulNameStyle,
Expand Down
3 changes: 1 addition & 2 deletions src/provider/masa-shape.ts
Expand Up @@ -9,7 +9,6 @@ import {
Network,
NetworkName,
PaymentMethod,
SoulNameDetails,
VerifyGreenResult,
} from '@masa-finance/masa-sdk';
import { BigNumber, Signer } from 'ethers';
Expand Down Expand Up @@ -96,7 +95,7 @@ export interface MasaShape {
reloadCreditScores?: () => void;

// soul names
soulnames?: SoulNameDetails[];
soulnames?: string[];
isSoulnamesLoading?: boolean;
reloadSoulnames?: () => void;
soulNameStyle?: string;
Expand Down

0 comments on commit 5081256

Please sign in to comment.