Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@masa-finance/masa-react
Advanced tools
<!-- TOC --> * [Getting Started with masa-react](#getting-started-with-masa-react) * [Installation](#installation) * [Styles](#styles) * [Setup Storybook](#setup-storybook) * [Usage ( inside MasaProvider )](#usage--inside-masaprovider-)
First install masa-react
in your project
yarn add @masa-finance/masa-react
Then import and add a provider
import {
MasaProvider
} from "@masa-finance/masa-react";
function App() {
return (
<MasaProvider>
...
</MasaProvider>
);
}
If you want to add our styles to your project just include this line at the very top of your file right below your imports
import "@masa-finance/masa-react/dist/style.css";
git clone https://github.com/masa-finance/masa-react.git
yarn
yarn storybook
Import useMasa
to have access to the masa
object, this will let you connect with the whole interface of smart contracts and tools from masa-sdk
import {
useMasa
} from "@masa-finance/masa-react";
const { connect } = useMasa();
const connectionCallback = () => {
history.push('/dashboard');
}
const connectionHandler = useCallback(() => {
connect(options)
}, [connect, options]);
<Button
onClick={connectionHandler}>
Connect
with
Masa
</Button>
import {
useMasa
} from "@masa-finance/masa-react";
const { masa } = useMasa();
const askForCreditScores = useCallback(async () => {
const creditScores = await masa?.creditScore.list();
console.log({ creditScores })
}, [masa]);
<Button
onClick={askForCreditScores}>
Show
credit
reports
</Button>
You can specify which scopes you want, here goes an example of requesting the connected user to have an identity
const options = {
scope: ['identity']
}
const connectionHandler = useCallback(() => {
connect(options)
}, [connect, options]);
<Button
onClick={connectionHandler}>
Connect
with
Masa
</Button>
export interface MasaShape {
children?: React.ReactNode;
// masa
masa?: Masa;
// verbose flag
verbose?: boolean;
// global loading
isLoading?: boolean;
// global connect
connect?: (options?: {
scope?: string[];
callback?: () => void
}) => void;
// general config
scope?: string[];
areScopesFullfiled?: boolean;
company?: string;
// provider
provider?: Wallet | Signer;
setProvider?: (provider?: Wallet | Signer) => void;
// modal
isModalOpen?: boolean;
setModalOpen?: (val: boolean) => void;
closeModal?: (forceCallback?: boolean) => void;
forcedPage?: string | null;
setForcedPage?: (page: string | null) => void;
openMintSoulnameModal?: (callback?: () => void) => void;
openMintMasaGreen?: (callback?: () => void) => void;
modalSize?: {
width: number;
height: number
} | null;
useModalSize?: (size: {
width: number;
height: number
}) => void;
// wallet
walletAddress?: string;
isWalletLoading?: boolean;
hasWalletAddress?: boolean;
// identity
identity?: {
identityId?: BigNumber;
address?: string;
};
isIdentityLoading?: boolean;
handlePurchaseIdentity?: () => Promise<boolean | undefined>;
handlePurchaseIdentityWithSoulname?: (
paymentMethod: PaymentMethod,
soulname: string,
registrationPrice: number
) => Promise<boolean>;
reloadIdentity?: () => void;
// session
isLoggedIn?: boolean;
isSessionLoading?: boolean;
handleLogin?: () => void;
handleLogout?: (logoutCallback?: () => void) => Promise<void>;
// credit scores
creditScores?: {
tokenId: BigNumber;
tokenUri: string;
metadata?: ICreditScore;
}[];
isCreditScoresLoading?: boolean;
handleCreateCreditScore?: () => Promise<boolean | undefined>;
reloadCreditScores?: () => void;
// soul names
soulnames?: SoulNameDetails[];
isSoulnamesLoading?: boolean;
reloadSoulnames?: () => void;
// greens
greens?: {
tokenId: BigNumber;
tokenUri: string;
metadata?: IGreen;
}[];
isGreensLoading?: boolean;
handleGenerateGreen?: (
phoneNumber: string
) => Promise<GenerateGreenResult | undefined>;
handleCreateGreen?: (
phoneNumber: string,
code: string
) => Promise<VerifyGreenResult | undefined>;
reloadGreens?: () => void;
// network
currentNetwork?: Network;
SupportedNetworks?: Partial<{ [index in NetworkName]: Network }>;
switchNetwork?: (networkName: NetworkName) => void;
forceNetwork?: NetworkName;
}
FAQs
<!-- TOC --> * [Getting Started with masa-react](#getting-started-with-masa-react) * [Installation](#installation) * [Styles](#styles) * [Setup Storybook](#setup-storybook) * [Usage ( inside MasaProvider )](#usage--inside-masaprovider-)
We found that @masa-finance/masa-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.