diff --git a/public/locales/en/register.json b/public/locales/en/register.json index e7b41fae2..2fb50af93 100644 --- a/public/locales/en/register.json +++ b/public/locales/en/register.json @@ -108,13 +108,15 @@ "swarm": "Swarm", "onion": "Onion", "skynet": "Skynet", - "arweave": "Arweave" + "arweave": "Arweave", + "walrus": "Walrus" }, "placeholder": { "default": "Add url here", "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/en/transactionFlow.json b/public/locales/en/transactionFlow.json index 437646ad7..8bd4daea7 100644 --- a/public/locales/en/transactionFlow.json +++ b/public/locales/en/transactionFlow.json @@ -97,6 +97,7 @@ "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/es/register.json b/public/locales/es/register.json index 96870be2c..8add2ac01 100644 --- a/public/locales/es/register.json +++ b/public/locales/es/register.json @@ -107,13 +107,15 @@ "swarm": "Swarm", "onion": "Onion", "skynet": "Skynet", - "arweave": "Arweave" + "arweave": "Arweave", + "walrus": "Walrus" }, "placeholder": { "default": "Agrega la URL aquí", "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/es/transactionFlow.json b/public/locales/es/transactionFlow.json index 9bba53cdb..2867b642e 100644 --- a/public/locales/es/transactionFlow.json +++ b/public/locales/es/transactionFlow.json @@ -88,6 +88,7 @@ "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/nl/transactionFlow.json b/public/locales/nl/transactionFlow.json index 0c00c01f7..1f0ff5a70 100644 --- a/public/locales/nl/transactionFlow.json +++ b/public/locales/nl/transactionFlow.json @@ -80,6 +80,7 @@ "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://..." } }, diff --git a/public/locales/pt/register.json b/public/locales/pt/register.json index 9f6d20949..2cfa42cef 100644 --- a/public/locales/pt/register.json +++ b/public/locales/pt/register.json @@ -107,13 +107,15 @@ "swarm": "Swarm", "onion": "Onion", "skynet": "Skynet", - "arweave": "Arweave" + "arweave": "Arweave", + "walrus": "Walrus" }, "placeholder": { "default": "Adicione a URL aqui", "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/pt/transactionFlow.json b/public/locales/pt/transactionFlow.json index 92edd0b60..d0166ac54 100644 --- a/public/locales/pt/transactionFlow.json +++ b/public/locales/pt/transactionFlow.json @@ -56,6 +56,7 @@ "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/ru/register.json b/public/locales/ru/register.json index adf31a5cf..7ff304a3b 100644 --- a/public/locales/ru/register.json +++ b/public/locales/ru/register.json @@ -107,13 +107,15 @@ "swarm": "Swarm", "onion": "Onion", "skynet": "Skynet", - "arweave": "Arweave" + "arweave": "Arweave", + "walrus": "Walrus" }, "placeholder": { "default": "Добавьте URL здесь", "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/ru/transactionFlow.json b/public/locales/ru/transactionFlow.json index 55f676ee0..c3d6ed8a2 100644 --- a/public/locales/ru/transactionFlow.json +++ b/public/locales/ru/transactionFlow.json @@ -87,6 +87,7 @@ "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/uk/register.json b/public/locales/uk/register.json index 4acb0f8e3..e078b7b8f 100644 --- a/public/locales/uk/register.json +++ b/public/locales/uk/register.json @@ -107,13 +107,15 @@ "swarm": "Swarm", "onion": "Onion", "skynet": "Skynet", - "arweave": "Arweave" + "arweave": "Arweave", + "walrus": "Walrus" }, "placeholder": { "default": "Додати URL тут", "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/uk/transactionFlow.json b/public/locales/uk/transactionFlow.json index fc9c24ca3..1038e09c6 100644 --- a/public/locales/uk/transactionFlow.json +++ b/public/locales/uk/transactionFlow.json @@ -87,6 +87,7 @@ "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/zh/register.json b/public/locales/zh/register.json index 7b2a51346..227348e80 100644 --- a/public/locales/zh/register.json +++ b/public/locales/zh/register.json @@ -107,13 +107,15 @@ "swarm": "Swarm", "onion": "Onion", "skynet": "Skynet", - "arweave": "Arweave" + "arweave": "Arweave", + "walrus": "Walrus" }, "placeholder": { "default": "在此添加 url", "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/public/locales/zh/transactionFlow.json b/public/locales/zh/transactionFlow.json index 8382b12ee..9a2ab3a10 100644 --- a/public/locales/zh/transactionFlow.json +++ b/public/locales/zh/transactionFlow.json @@ -88,6 +88,7 @@ "ipfs": "ipfs://...", "skynet": "sia://...", "arweave": "ar://...", + "walrus": "walrus://...", "swarm": "bzz://...", "onion": "onion3://..." } diff --git a/src/assets/contentHash/DynamicContentHashIcon.tsx b/src/assets/contentHash/DynamicContentHashIcon.tsx index b2cd4a100..48cdb4571 100644 --- a/src/assets/contentHash/DynamicContentHashIcon.tsx +++ b/src/assets/contentHash/DynamicContentHashIcon.tsx @@ -10,6 +10,7 @@ export const contentHashIconTypes = { onion: dynamic(() => import('./onion.svg')), swarm: dynamic(() => import('./swarm.svg')), arweave: dynamic(() => import('./arweave.svg')), + walrus: dynamic(() => import('./walrus.svg')), } export const DynamicContentHashIcon = ({ diff --git a/src/assets/contentHash/walrus.svg b/src/assets/contentHash/walrus.svg new file mode 100644 index 000000000..df035a800 --- /dev/null +++ b/src/assets/contentHash/walrus.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/constants/supportedContentHashKeys.ts b/src/constants/supportedContentHashKeys.ts index 0a40b01dc..07544be32 100644 --- a/src/constants/supportedContentHashKeys.ts +++ b/src/constants/supportedContentHashKeys.ts @@ -1 +1 @@ -export const supportedContentHashKeys = ['ipfs', 'swarm', 'onion', 'skynet', 'arweave'] as const +export const supportedContentHashKeys = ['ipfs', 'swarm', 'onion', 'skynet', 'arweave', 'walrus'] as const diff --git a/src/hooks/useAvatarFromRecord.ts b/src/hooks/useAvatarFromRecord.ts index 72c3e6c57..f947a9f48 100644 --- a/src/hooks/useAvatarFromRecord.ts +++ b/src/hooks/useAvatarFromRecord.ts @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react' import { getProtocolType } from '@ensdomains/ensjs/utils' -const SUPPORTED_PROTOCOL_REGEX = /^(http|https|ar|ipfs|eip155):/ +const SUPPORTED_PROTOCOL_REGEX = /^(http|https|ar|ipfs|eip155|walrus):/ const chainIdToNetwork = (chainId?: string) => { if (chainId === '1') return 'mainnet' @@ -39,6 +39,11 @@ const getAvatarSrc = async (record: string) => { return `https://arweave.net/${decoded}` } + if (protocol === 'walrus') { + const { decoded } = getProtocolType(record)! + return `https://aggregator.walrus-testnet.walrus.space/v1/blobs/${decoded}` + } + if (protocol === 'eip155') { const apiUrl = makeApiURL(record) if (!apiUrl) return diff --git a/src/utils/contenthash.ts b/src/utils/contenthash.ts index 14c3be635..5d73edff4 100644 --- a/src/utils/contenthash.ts +++ b/src/utils/contenthash.ts @@ -9,8 +9,9 @@ export type ContentHashProtocol = | 'sia' | 'arweave' | 'ar' + | 'walrus' -export type ContentHashProvider = 'ipfs' | 'swarm' | 'onion' | 'skynet' | 'arweave' +export type ContentHashProvider = 'ipfs' | 'swarm' | 'onion' | 'skynet' | 'arweave' | 'walrus' type GetContentHashLinkParameters = { name: string @@ -50,6 +51,9 @@ export const getContentHashLink = ({ if (protocol === 'ar') { return `https://arweave.net/${hash}` } + if (protocol === 'walrus') { + return `https://aggregator.walrus-testnet.walrus.space/v1/blobs/${hash}` + } return null } @@ -76,6 +80,7 @@ const contentHashProtocolToProviderMap = { sia: 'skynet', arweave: 'arweave', ar: 'arweave', + walrus: 'walrus', } as const export const getContentHashProvider = (protocol: ContentHashProtocol): ContentHashProvider => diff --git a/src/validators/validateContentHash.ts b/src/validators/validateContentHash.ts index c4e3282e1..c8fc47ae0 100644 --- a/src/validators/validateContentHash.ts +++ b/src/validators/validateContentHash.ts @@ -11,6 +11,7 @@ const contentHashToProtocols = { onion: ['onion', 'onion3'], skynet: ['sia'], arweave: ['arweave', 'ar'], + walrus: ['walrus'], } export const validateContentHash = @@ -19,6 +20,7 @@ export const validateContentHash = if (!value) return true const output = getProtocolType(value) + console.log("protocol:",output) if (!output) return 'Invalid protocol type' const { protocolType, decoded } = output if (provider !== 'all' && !contentHashToProtocols[provider]?.includes(protocolType)) @@ -29,6 +31,7 @@ export const validateContentHash = (protocolType === 'onion' && decoded.length !== 16) || (protocolType === 'onion3' && decoded.length !== 56) || (protocolType === 'sia' && decoded.length !== 46) || + (protocolType === 'walrus' && decoded.length !== 66) || (['arweave', 'ar'].includes(protocolType) && decoded.length !== 43) ) return 'Invalid content id'