Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion public/locales/en/register.json
Original file line number Diff line number Diff line change
Expand Up @@ -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://..."
}
Expand Down
1 change: 1 addition & 0 deletions public/locales/en/transactionFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"ipfs": "ipfs://...",
"skynet": "sia://...",
"arweave": "ar://...",
"walrus": "walrus://...",
"swarm": "bzz://...",
"onion": "onion3://..."
}
Expand Down
4 changes: 3 additions & 1 deletion public/locales/es/register.json
Original file line number Diff line number Diff line change
Expand Up @@ -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://..."
}
Expand Down
1 change: 1 addition & 0 deletions public/locales/es/transactionFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"ipfs": "ipfs://...",
"skynet": "sia://...",
"arweave": "ar://...",
"walrus": "walrus://...",
"swarm": "bzz://...",
"onion": "onion3://..."
}
Expand Down
1 change: 1 addition & 0 deletions public/locales/nl/transactionFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"ipfs": "ipfs://...",
"skynet": "sia://...",
"arweave": "ar://...",
"walrus": "walrus://...",
"swarm": "bzz://..."
}
},
Expand Down
4 changes: 3 additions & 1 deletion public/locales/pt/register.json
Original file line number Diff line number Diff line change
Expand Up @@ -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://..."
}
Expand Down
1 change: 1 addition & 0 deletions public/locales/pt/transactionFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"ipfs": "ipfs://...",
"skynet": "sia://...",
"arweave": "ar://...",
"walrus": "walrus://...",
"swarm": "bzz://...",
"onion": "onion3://..."
}
Expand Down
4 changes: 3 additions & 1 deletion public/locales/ru/register.json
Original file line number Diff line number Diff line change
Expand Up @@ -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://..."
}
Expand Down
1 change: 1 addition & 0 deletions public/locales/ru/transactionFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"ipfs": "ipfs://...",
"skynet": "sia://...",
"arweave": "ar://...",
"walrus": "walrus://...",
"swarm": "bzz://...",
"onion": "onion3://..."
}
Expand Down
4 changes: 3 additions & 1 deletion public/locales/uk/register.json
Original file line number Diff line number Diff line change
Expand Up @@ -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://..."
}
Expand Down
1 change: 1 addition & 0 deletions public/locales/uk/transactionFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"ipfs": "ipfs://...",
"skynet": "sia://...",
"arweave": "ar://...",
"walrus": "walrus://...",
"swarm": "bzz://...",
"onion": "onion3://..."
}
Expand Down
4 changes: 3 additions & 1 deletion public/locales/zh/register.json
Original file line number Diff line number Diff line change
Expand Up @@ -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://..."
}
Expand Down
1 change: 1 addition & 0 deletions public/locales/zh/transactionFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"ipfs": "ipfs://...",
"skynet": "sia://...",
"arweave": "ar://...",
"walrus": "walrus://...",
"swarm": "bzz://...",
"onion": "onion3://..."
}
Expand Down
1 change: 1 addition & 0 deletions src/assets/contentHash/DynamicContentHashIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ({
Expand Down
20 changes: 20 additions & 0 deletions src/assets/contentHash/walrus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/constants/supportedContentHashKeys.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const supportedContentHashKeys = ['ipfs', 'swarm', 'onion', 'skynet', 'arweave'] as const
export const supportedContentHashKeys = ['ipfs', 'swarm', 'onion', 'skynet', 'arweave', 'walrus'] as const
7 changes: 6 additions & 1 deletion src/hooks/useAvatarFromRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/utils/contenthash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand All @@ -76,6 +80,7 @@ const contentHashProtocolToProviderMap = {
sia: 'skynet',
arweave: 'arweave',
ar: 'arweave',
walrus: 'walrus',
} as const

export const getContentHashProvider = (protocol: ContentHashProtocol): ContentHashProvider =>
Expand Down
3 changes: 3 additions & 0 deletions src/validators/validateContentHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const contentHashToProtocols = {
onion: ['onion', 'onion3'],
skynet: ['sia'],
arweave: ['arweave', 'ar'],
walrus: ['walrus'],
}

export const validateContentHash =
Expand All @@ -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))
Expand All @@ -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'
Expand Down