Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@dialectlabs/blinks-react-native
Advanced tools
React Native SDK for rendering blinks for Solana Actions on mobile dApps. Check out our documentation for more information on what actions and blinks are and how to build them.
# npm
npm i @dialectlabs/blinks-react-native
#yarn
yarn add @dialectlabs/blinks-react-native
The following imports need to be made to simplify the blink integration:
useAction
hook and ActionAdapter
type from @dialectlabs/blinks-react-native
Blink
component from @dialectlabs/blinks-react-native
A getWalletAdapter
function has to be defined to generate an adapter of type ActionAdapter
for interactions with user wallets like wallet connect and signing transactions through the React Native dApp.
After that, the Blink
component can be used in the React Native dApp to render the blink. It takes the following props:
theme
- has the styling for the blink to be renderedaction
- object returned by the useAction
function (which requires the adapter from getWalletAdapter
and Action URL)website
- the complete URL of the ActionwebsiteText
- The domain name of the Action URLAn example of this is:
import {
Blink,
BlockchainIds,
useAction,
createSignMessageText,
type ActionAdapter,
} from '@dialectlabs/blinks-react-native';
import { PublicKey } from '@solana/web3.js';
import type React from 'react';
function getWalletAdapter(): ActionAdapter {
return {
connect: async (_context) => {
console.log('connect');
return PublicKey.default.toString();
},
signTransaction: async (_tx, _context) => {
console.log('signTransaction');
return {
signature: 'signature',
};
},
confirmTransaction: async (_signature, _context) => {
console.log('confirmTransaction');
},
signMessage: async (message: string | SignMessageData, _context) => {
const messageToSign =
typeof message === 'string' ? message : createSignMessageText(message);
console.log('signMessage', messageToSign);
return { signature: 'signature' };
},
metadata: { supportedBlockchainIds: [BlockchainIds.SOLANA_MAINNET] },
};
}
export const BlinkInTheWalletIntegrationExample: React.FC<{
url: string; // could be action api or website url
}> = ({ url }) => {
const adapter = getWalletAdapter();
const { action } = useAction({ url });
if (!action) {
// return placeholder component
}
const actionUrl = new URL(url);
return (
<Blink
theme={{
'--blink-button': '#1D9BF0',
'--blink-border-radius-rounded-button': 9999,
// and any other custom styles
}}
adapter={adapter}
action={action}
websiteUrl={actionUrl.href}
websiteText={actionUrl.hostname}
/>
);
};
The blink styles can be customized by passing a theme
prop to the Blink
component. The theme object can include any properties you'd like to override from the default theme:
{
'--blink-bg-primary': '#ffffff',
'--blink-bg-secondary': '#f2f3f5',
'--blink-button': '#2a2a2b',
'--blink-button-disabled': '#737373',
'--blink-button-hover': '#323335',
'--blink-button-success': '#09cbbf1a',
'--blink-icon-error': '#f71a05',
'--blink-icon-error-hover': '#ff402e',
'--blink-icon-primary': '#737373',
'--blink-icon-primary-hover': '#888989',
'--blink-icon-warning': '#d55f00',
'--blink-icon-warning-hover': '#ef6f08',
'--blink-input-bg': '#ffffff',
'--blink-input-bg-disabled': '#dee1e7',
'--blink-input-bg-selected': '#08c0b4',
'--blink-input-stroke': '#c4c6c8',
'--blink-input-stroke-disabled': '#dee1e7',
'--blink-input-stroke-error': '#ff402e',
'--blink-input-stroke-hover': '#b3b3b3',
'--blink-input-stroke-selected': '#08c0b4',
'--blink-stroke-error': '#ff9696',
'--blink-stroke-primary': '#d7d7d7',
'--blink-stroke-secondary': '#ebebeb',
'--blink-stroke-warning': '#ffbc6e',
'--blink-text-brand': '#08c0b4',
'--blink-text-button': '#ffffff',
'--blink-text-button-disabled': '#f2f3f5',
'--blink-text-button-success': '#00a095',
'--blink-text-error': '#f71a05',
'--blink-text-error-hover': '#ff402e',
'--blink-text-input': '#232324',
'--blink-text-input-disabled': '#b3b3b3',
'--blink-text-input-placeholder': '#737373',
'--blink-text-link': '#737373',
'--blink-text-link-hover': '#888989',
'--blink-text-primary': '#232324',
'--blink-text-secondary': '#434445',
'--blink-text-success': '#00a095',
'--blink-text-warning': '#d55f00',
'--blink-text-warning-hover': '#ef6f08',
'--blink-transparent-error': '#ff96961a',
'--blink-transparent-grey': '#b3b3b31a',
'--blink-transparent-warning': '#ffbc6e1a',
'--blink-border-radius-rounded-lg': 4,
'--blink-border-radius-rounded-xl': 8,
'--blink-border-radius-rounded-2xl': 16,
'--blink-border-radius-rounded-button': 8,
'--blink-border-radius-rounded-input': 8,
'--blink-border-radius-rounded-input-standalone': 8,
}
FAQs
react native support for solana actions
We found that @dialectlabs/blinks-react-native 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.
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.