mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(settings): remove Solana RPC advanced option
This commit is contained in:
+2
-3
@@ -139,15 +139,15 @@ describe('AdvancedSettings', () => {
|
|||||||
|
|
||||||
const textareas = container.querySelectorAll<HTMLTextAreaElement>('textarea');
|
const textareas = container.querySelectorAll<HTMLTextAreaElement>('textarea');
|
||||||
const textInputs = container.querySelectorAll<HTMLInputElement>('input[type="text"]');
|
const textInputs = container.querySelectorAll<HTMLInputElement>('input[type="text"]');
|
||||||
expect(textareas.length).toBe(5);
|
expect(textareas.length).toBe(4);
|
||||||
expect(textInputs.length).toBe(3);
|
expect(textInputs.length).toBe(3);
|
||||||
|
expect(container.textContent).not.toContain('Solana RPC');
|
||||||
|
|
||||||
await dispatchInput(textareas[0], ' https://ipfs.one.example \n\nhttps://ipfs.two.example ');
|
await dispatchInput(textareas[0], ' https://ipfs.one.example \n\nhttps://ipfs.two.example ');
|
||||||
await dispatchInput(textInputs[0], ' https://media.new.example ');
|
await dispatchInput(textInputs[0], ' https://media.new.example ');
|
||||||
await dispatchInput(textareas[1], ' https://pubsub.one.example \n');
|
await dispatchInput(textareas[1], ' https://pubsub.one.example \n');
|
||||||
await dispatchInput(textareas[2], ' https://router.one.example \n');
|
await dispatchInput(textareas[2], ' https://router.one.example \n');
|
||||||
await dispatchInput(textareas[3], ' https://eth.one.example \n');
|
await dispatchInput(textareas[3], ' https://eth.one.example \n');
|
||||||
await dispatchInput(textareas[4], ' https://sol.one.example \n');
|
|
||||||
await dispatchInput(textInputs[1], ' ws://127.0.0.1:9138/secret ');
|
await dispatchInput(textInputs[1], ' ws://127.0.0.1:9138/secret ');
|
||||||
await dispatchInput(textInputs[2], ' /tmp/next-pkc ');
|
await dispatchInput(textInputs[2], ' /tmp/next-pkc ');
|
||||||
await clickButton('save_advanced_settings');
|
await clickButton('save_advanced_settings');
|
||||||
@@ -156,7 +156,6 @@ describe('AdvancedSettings', () => {
|
|||||||
mediaIpfsGatewayUrl: 'https://media.new.example',
|
mediaIpfsGatewayUrl: 'https://media.new.example',
|
||||||
chainProviders: {
|
chainProviders: {
|
||||||
eth: { chainId: 1, urls: ['https://eth.one.example'] },
|
eth: { chainId: 1, urls: ['https://eth.one.example'] },
|
||||||
sol: { chainId: 101, urls: ['https://sol.one.example'] },
|
|
||||||
},
|
},
|
||||||
pkcOptions: {
|
pkcOptions: {
|
||||||
dataPath: '/tmp/next-pkc',
|
dataPath: '/tmp/next-pkc',
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ interface SettingsProps {
|
|||||||
pubsubProvidersRef?: RefObject<HTMLTextAreaElement>;
|
pubsubProvidersRef?: RefObject<HTMLTextAreaElement>;
|
||||||
httpRoutersRef?: RefObject<HTMLTextAreaElement>;
|
httpRoutersRef?: RefObject<HTMLTextAreaElement>;
|
||||||
ethRpcRef?: RefObject<HTMLTextAreaElement>;
|
ethRpcRef?: RefObject<HTMLTextAreaElement>;
|
||||||
solRpcRef?: RefObject<HTMLTextAreaElement>;
|
|
||||||
p2pRpcRef?: RefObject<HTMLInputElement>;
|
p2pRpcRef?: RefObject<HTMLInputElement>;
|
||||||
p2pDataPathRef?: RefObject<HTMLInputElement>;
|
p2pDataPathRef?: RefObject<HTMLInputElement>;
|
||||||
}
|
}
|
||||||
@@ -131,11 +130,10 @@ const HttpRoutersSettings = ({ httpRoutersRef }: SettingsProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const BlockchainProvidersSettings = ({ ethRpcRef, solRpcRef }: SettingsProps) => {
|
const BlockchainProvidersSettings = ({ ethRpcRef }: SettingsProps) => {
|
||||||
const account = useAccount() as AccountShape | undefined;
|
const account = useAccount() as AccountShape | undefined;
|
||||||
const chainProviders = getChainProviders(account);
|
const chainProviders = getChainProviders(account);
|
||||||
const ethRpcDefaultValue = chainProviders?.['eth']?.urls?.join('\n');
|
const ethRpcDefaultValue = chainProviders?.['eth']?.urls?.join('\n');
|
||||||
const solRpcDefaultValue = chainProviders?.['sol']?.urls?.join('\n');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.blockchainProvidersSettings}>
|
<div className={styles.blockchainProvidersSettings}>
|
||||||
@@ -150,17 +148,6 @@ const BlockchainProvidersSettings = ({ ethRpcRef, solRpcRef }: SettingsProps) =>
|
|||||||
rows={chainProviders?.['eth']?.urls?.length || 1}
|
rows={chainProviders?.['eth']?.urls?.length || 1}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span className={styles.settingTip}>Solana RPC, for .sol domains</span>
|
|
||||||
<div>
|
|
||||||
<textarea
|
|
||||||
defaultValue={solRpcDefaultValue}
|
|
||||||
ref={solRpcRef}
|
|
||||||
autoCorrect='off'
|
|
||||||
autoComplete='off'
|
|
||||||
spellCheck='false'
|
|
||||||
rows={chainProviders?.['sol']?.urls?.length || 1}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -221,7 +208,6 @@ const AdvancedSettings = () => {
|
|||||||
const mediaIpfsGatewayUrlRef = useRef<HTMLInputElement>(null);
|
const mediaIpfsGatewayUrlRef = useRef<HTMLInputElement>(null);
|
||||||
const pubsubProvidersRef = useRef<HTMLTextAreaElement>(null);
|
const pubsubProvidersRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const ethRpcRef = useRef<HTMLTextAreaElement>(null);
|
const ethRpcRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const solRpcRef = useRef<HTMLTextAreaElement>(null);
|
|
||||||
const httpRoutersRef = useRef<HTMLTextAreaElement>(null);
|
const httpRoutersRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const p2pRpcRef = useRef<HTMLInputElement>(null);
|
const p2pRpcRef = useRef<HTMLInputElement>(null);
|
||||||
const p2pDataPathRef = useRef<HTMLInputElement>(null);
|
const p2pDataPathRef = useRef<HTMLInputElement>(null);
|
||||||
@@ -244,11 +230,6 @@ const AdvancedSettings = () => {
|
|||||||
.map((url) => url.trim())
|
.map((url) => url.trim())
|
||||||
.filter((url) => url !== '');
|
.filter((url) => url !== '');
|
||||||
|
|
||||||
const solRpcUrls = solRpcRef.current?.value
|
|
||||||
.split('\n')
|
|
||||||
.map((url) => url.trim())
|
|
||||||
.filter((url) => url !== '');
|
|
||||||
|
|
||||||
const httpRoutersOptions = httpRoutersRef.current?.value
|
const httpRoutersOptions = httpRoutersRef.current?.value
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.map((url) => url.trim())
|
.map((url) => url.trim())
|
||||||
@@ -261,9 +242,6 @@ const AdvancedSettings = () => {
|
|||||||
if (ethRpcUrls && ethRpcUrls.length > 0) {
|
if (ethRpcUrls && ethRpcUrls.length > 0) {
|
||||||
chainProviders.eth = { urls: ethRpcUrls, chainId: 1 };
|
chainProviders.eth = { urls: ethRpcUrls, chainId: 1 };
|
||||||
}
|
}
|
||||||
if (solRpcUrls && solRpcUrls.length > 0) {
|
|
||||||
chainProviders.sol = { urls: solRpcUrls, chainId: 101 };
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await setAccount({
|
await setAccount({
|
||||||
@@ -316,7 +294,7 @@ const AdvancedSettings = () => {
|
|||||||
blockchain providers:
|
blockchain providers:
|
||||||
</span>
|
</span>
|
||||||
<span className={styles.categorySettings}>
|
<span className={styles.categorySettings}>
|
||||||
<BlockchainProvidersSettings ethRpcRef={ethRpcRef} solRpcRef={solRpcRef} />
|
<BlockchainProvidersSettings ethRpcRef={ethRpcRef} />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.category}>
|
<div className={styles.category}>
|
||||||
|
|||||||
Reference in New Issue
Block a user