Skip to content

Commit a50d9ab

Browse files
authored
feat(drive): default helia node (cybercongress#1047)
1 parent d9d4709 commit a50d9ab

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"cyberlink",
77
"cyberlinks",
88
"denoms",
9+
"helia",
910
"investmint",
1011
"Ipfs",
1112
"Keplr",

src/features/ipfs/ipfsSettings/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ import ErrorIpfsSettings from './ErrorIpfsSettings';
2222
import ComponentLoader from './ipfsComponents/ipfsLoader';
2323
import Drive from '../Drive';
2424
import { useBackend } from 'src/contexts/backend';
25+
import { IPFSNodes } from 'src/services/ipfs/ipfs.d.ts';
2526

26-
const dataOpts = ['external', 'embedded', 'helia'];
27+
const dataOpts = [IPFSNodes.EXTERNAL, IPFSNodes.EMBEDDED, IPFSNodes.HELIA];
2728

2829
function IpfsSettings() {
29-
const [valueSelect, setValueSelect] = useState('external');
30+
const [valueSelect, setValueSelect] = useState(IPFSNodes.HELIA);
3031
const [valueInput, setValueInput] = useState('');
3132
const [valueInputGateway, setValueInputGateway] = useState('');
3233
const { isIpfsInitialized, ipfsError: failed, loadIpfs } = useBackend();

src/services/ipfs/config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IpfsOptsType } from './ipfs';
1+
import { IPFSNodes, IpfsOptsType } from './ipfs.d';
22

33
export const CYBER_NODE_SWARM_PEER_ID =
44
'QmUgmRxoLtGERot7Y6G7UyF6fwvnusQZfGR15PuE6pY3aB';
@@ -13,8 +13,8 @@ export const CYBER_GATEWAY_URL = 'https://gateway.ipfs.cybernode.ai';
1313
export const FILE_SIZE_DOWNLOAD = 20 * 10 ** 6;
1414

1515
export const getIpfsOpts = () => {
16-
let ipfsOpts = {
17-
ipfsNodeType: 'embedded',
16+
let ipfsOpts: IpfsOptsType = {
17+
ipfsNodeType: IPFSNodes.HELIA,
1818
urlOpts: '/ip4/127.0.0.1/tcp/5001', // default url
1919
userGateway: 'http://127.0.0.1:8080',
2020
};

src/services/ipfs/ipfs.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import { LsResult } from 'ipfs-core-types/dist/src/pin';
33

44
export type CallBackFuncStatus = (a: string) => void;
55

6+
export enum IPFSNodes {
7+
EXTERNAL = 'external',
8+
EMBEDDED = 'embedded',
9+
HELIA = 'helia',
10+
}
11+
612
type IpfsNodeType = 'embedded' | 'external' | 'helia';
713

814
export type IpfsFileStats = {

0 commit comments

Comments
 (0)