mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-18 19:30:27 +08:00
Remove all ceramic functionality
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
{
|
||||
"streamId": "k2t6wyse1ukyaidd42gy4h1guy10xcycfe424h13gjxkoupzhssv9j2svmb8rr",
|
||||
"state": {
|
||||
"type": 1,
|
||||
"content": "did:3:kjzl6cwe1jw1481xu9oyww9bhmueqr8f5uryk4xha9jzhj6vi063e0blpnil383",
|
||||
"metadata": {
|
||||
"family": "caip10-eip155:1",
|
||||
"controllers": ["0x5e813e48a81977c6fdd565ed5097eb600c73c4f0@eip155:1"]
|
||||
},
|
||||
"signature": 2,
|
||||
"anchorStatus": "ANCHORED",
|
||||
"log": [
|
||||
{
|
||||
"cid": "bafyreiayiqzx3vth6pu5yniakbu7nm4otiab2j4izu2knyvp2hyzbhxte4",
|
||||
"type": 0
|
||||
},
|
||||
{
|
||||
"cid": "bafyreic6lcoeq5gr3i532focvbiwe7xtajm66nsnoj5i66rmvqexgrjb6y",
|
||||
"type": 1
|
||||
},
|
||||
{
|
||||
"cid": "bafyreihochpuwo4fg36neapdljruhuzsjkakyvrcmvtxfbzcz3vn2sduye",
|
||||
"type": 2
|
||||
}
|
||||
],
|
||||
"anchorProof": {
|
||||
"root": "bafyreigcirwd56d5reel2gn2ndqyshyvbtvtffgqyldefwk4gucnc52lau",
|
||||
"txHash": "bagjqcgzacitwxfpo6uh5uyoa2cwt2lknpqovc75njw53hgkscxae6jlfytwa",
|
||||
"chainId": "eip155:1",
|
||||
"blockNumber": 13015348,
|
||||
"blockTimestamp": 1628838351
|
||||
},
|
||||
"doctype": "caip10-link"
|
||||
}
|
||||
}
|
||||
Generated
+938
-1388
File diff suppressed because it is too large
Load Diff
+2
-3
@@ -37,13 +37,11 @@
|
||||
"vitest": "^0.23.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@datamodels/identity-profile-basic": "^0.1.2",
|
||||
"@ethersproject/abstract-provider": "^5.4.0",
|
||||
"@gnosis.pm/safe-core-sdk": "^0.3.1",
|
||||
"@gnosis.pm/safe-core-sdk-types": "^0.1.1",
|
||||
"@gnosis.pm/safe-service-client": "^0.1.1",
|
||||
"@radicle/gray-matter": "4.1.0",
|
||||
"@self.id/core": "^0.1.0",
|
||||
"@stardazed/streams": "^3.1.0",
|
||||
"@types/marked": "^4.0.7",
|
||||
"@types/md5": "^2.3.2",
|
||||
@@ -63,6 +61,7 @@
|
||||
"siwe": "^2.0.5",
|
||||
"svelte": "^3.50.1",
|
||||
"svelte-preprocess": "^4.10.7",
|
||||
"svelte-routing": "^1.6.0"
|
||||
"svelte-routing": "^1.6.0",
|
||||
"util": "^0.12.4"
|
||||
}
|
||||
}
|
||||
|
||||
+8
-4
@@ -328,8 +328,10 @@
|
||||
{#if profile.org}
|
||||
{#if utils.isAddressEqual(profile.address, profile.org.address)}
|
||||
<div class="overflow-text">
|
||||
{#if profile.name}
|
||||
<a href={profile.registry(config)} class="link">{profile.name}</a>
|
||||
{#if profile.name && profile.ens}
|
||||
<a href={`/registrations/${profile.ens.name}`} class="link">
|
||||
{profile.name}
|
||||
</a>
|
||||
{:else}
|
||||
<span class="txt-missing">Not set</span>
|
||||
{/if}
|
||||
@@ -361,8 +363,10 @@
|
||||
{:else}
|
||||
<!-- User Profile -->
|
||||
<div>
|
||||
{#if profile.name}
|
||||
<a href={profile.registry(config)} class="link">{profile.name}</a>
|
||||
{#if profile.name && profile.ens}
|
||||
<a href={`/registrations/${profile.ens.name}`} class="link">
|
||||
{profile.name}
|
||||
</a>
|
||||
{:else}
|
||||
<span class="txt-missing">Not set</span>
|
||||
{/if}
|
||||
|
||||
@@ -155,8 +155,7 @@
|
||||
validate: "URN",
|
||||
placeholder: "URN, eg. eip155:1:0x4a9cf21…",
|
||||
description:
|
||||
"URN under which associated project anchors can be found. " +
|
||||
"To point to a Radicle org on Ethereum, use the CAIP-10 ID, eg. *eip155:1:0x4a9cf21…*",
|
||||
"URN under which associated project anchors can be found.",
|
||||
value: r.profile.anchorsAccount ?? "",
|
||||
editable: true,
|
||||
},
|
||||
|
||||
@@ -67,10 +67,6 @@
|
||||
"alchemy": { "key": "1T6h-0rxu7SRzKEtmukIoxaJOXazLDNs" }
|
||||
},
|
||||
"walletConnect": { "bridge": "https://radicle.bridge.walletconnect.org" },
|
||||
"ceramic": {
|
||||
"api": "https://gateway.ceramic.network",
|
||||
"registry": "https://self.id/"
|
||||
},
|
||||
"reactions": ["👍", "👎", "😄", "🎉", "🙁", "🚀", "👀"],
|
||||
"radicle": {
|
||||
"seed": {
|
||||
|
||||
@@ -3,7 +3,6 @@ import type { Writable } from "svelte/store";
|
||||
import { ethers } from "ethers";
|
||||
import type { TypedDataSigner } from "@ethersproject/abstract-signer";
|
||||
import SafeServiceClient from "@gnosis.pm/safe-service-client";
|
||||
import { Core } from "@self.id/core";
|
||||
import WalletConnect from "@walletconnect/client";
|
||||
import config from "@app/config.json";
|
||||
import { WalletConnectSigner } from "./WalletConnectSigner";
|
||||
@@ -66,10 +65,6 @@ export class Config {
|
||||
git: { port: number };
|
||||
link: { port: number };
|
||||
};
|
||||
ceramic: {
|
||||
client: Core;
|
||||
registry: string;
|
||||
};
|
||||
tokens: string[];
|
||||
token: ethers.Contract;
|
||||
|
||||
@@ -79,7 +74,6 @@ export class Config {
|
||||
metamaskSigner: (ethers.Signer & TypedDataSigner) | null,
|
||||
) {
|
||||
const cfg = (<Record<string, any>>config)[network.name];
|
||||
const ceramic = new Core({ ceramic: config.ceramic.api });
|
||||
|
||||
const walletConnectState = writable<WalletConnectState>({ state: "close" });
|
||||
const wc = Config.initializeWalletConnect(
|
||||
@@ -125,10 +119,6 @@ export class Config {
|
||||
this.projects = config.projects;
|
||||
this.seeds = config.seeds;
|
||||
this.abi = config.abi;
|
||||
this.ceramic = {
|
||||
client: ceramic,
|
||||
registry: config.ceramic.registry,
|
||||
};
|
||||
this.tokens = cfg.tokens;
|
||||
this.token = new ethers.Contract(
|
||||
this.radToken.address,
|
||||
|
||||
+1
-41
@@ -1,11 +1,7 @@
|
||||
import type { EnsProfile } from "@app/base/registrations/registrar";
|
||||
import type { BasicProfile } from "@datamodels/identity-profile-basic";
|
||||
import {
|
||||
isAddress,
|
||||
formatCAIP10Address,
|
||||
formatIpfsFile,
|
||||
resolveEnsProfile,
|
||||
resolveIdxProfile,
|
||||
parseUsername,
|
||||
AddressType,
|
||||
identifyAddress,
|
||||
@@ -21,7 +17,6 @@ export interface IProfile {
|
||||
address: string;
|
||||
type: AddressType;
|
||||
ens?: EnsProfile;
|
||||
idx?: BasicProfile;
|
||||
org?: Org;
|
||||
}
|
||||
|
||||
@@ -63,16 +58,9 @@ export class Profile {
|
||||
return this.profile.ens;
|
||||
}
|
||||
|
||||
// Get the IDX profle
|
||||
get idx(): BasicProfile | undefined {
|
||||
return this.profile.idx;
|
||||
}
|
||||
|
||||
get github(): string | undefined {
|
||||
if (this.profile?.ens?.github) {
|
||||
return parseUsername(this.profile.ens.github);
|
||||
} else if (this.profile?.idx?.affiliations) {
|
||||
return this.profile.idx?.affiliations.find(item => item === "github");
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
@@ -81,8 +69,6 @@ export class Profile {
|
||||
get twitter(): string | undefined {
|
||||
if (this.profile?.ens?.twitter) {
|
||||
return parseUsername(this.profile.ens.twitter);
|
||||
} else if (this.profile?.idx?.affiliations) {
|
||||
return this.profile.idx.affiliations.find(item => item === "twitter");
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
@@ -90,21 +76,17 @@ export class Profile {
|
||||
|
||||
get url(): string | undefined {
|
||||
if (this.profile?.ens?.url) return this.profile.ens.url;
|
||||
else if (this.profile?.idx?.url) return this.profile.idx.url;
|
||||
else return undefined;
|
||||
}
|
||||
|
||||
get name(): string | undefined {
|
||||
if (this.profile?.ens?.name) return this.profile.ens.name;
|
||||
else if (this.profile?.idx?.name) return this.profile.idx.name;
|
||||
else return undefined;
|
||||
}
|
||||
|
||||
get avatar(): string | undefined {
|
||||
if (this.profile?.ens?.avatar) {
|
||||
return this.profile.ens.avatar;
|
||||
} else if (this.profile?.idx?.image?.original?.src) {
|
||||
return formatIpfsFile(this.profile.idx.image.original.src);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
@@ -119,7 +101,6 @@ export class Profile {
|
||||
const addr = this.profile?.ens?.anchorsAccount;
|
||||
|
||||
if (addr) {
|
||||
// TODO: Workaround until caip package supports both CAIP10 formats.
|
||||
const [namespace, reference, address] = addr.split(":");
|
||||
const id = { chainId: { namespace, reference }, address };
|
||||
|
||||
@@ -138,20 +119,6 @@ export class Profile {
|
||||
return this.name ?? this.address;
|
||||
}
|
||||
|
||||
// Returns the corresponding registration form to edit a user profile.
|
||||
// We are not interested in a non-existant registry link, since we check before hand if the name exists.
|
||||
registry(config: Config): string {
|
||||
if (this.profile?.ens) {
|
||||
return `/registrations/${this.profile.ens.name}`;
|
||||
} else {
|
||||
return `${config.ceramic.registry}${formatCAIP10Address(
|
||||
this.profile.address,
|
||||
"eip155",
|
||||
config.network.chainId,
|
||||
)}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Keeping this function private since the desired entrypoint is .get()
|
||||
// All addresses returned from this function should be lowercase.
|
||||
private static async lookupProfile(
|
||||
@@ -188,20 +155,13 @@ export class Profile {
|
||||
}
|
||||
|
||||
try {
|
||||
const idx = await resolveIdxProfile(
|
||||
formatCAIP10Address(address, "eip155", config.network.chainId),
|
||||
config,
|
||||
);
|
||||
return {
|
||||
address,
|
||||
type,
|
||||
idx: idx ?? undefined,
|
||||
org: org ?? undefined,
|
||||
};
|
||||
} catch (e: any) {
|
||||
// Look for the No DID found for error by the resolveIdxProfile fn and send it to console.debug
|
||||
if (e.message.match("No DID found for")) console.debug(e.message);
|
||||
else console.error(e);
|
||||
console.error(e);
|
||||
|
||||
return { address, type, org: org ?? undefined };
|
||||
}
|
||||
|
||||
+1
-2
@@ -352,8 +352,7 @@ export const session = derived(state, s => {
|
||||
});
|
||||
|
||||
window.ethereum?.on("chainChanged", () => {
|
||||
// We disconnect the wallet to avoid out of sync state
|
||||
// between the account address and IDX DIDs
|
||||
// We disconnect the wallet to avoid out of sync state.
|
||||
disconnectMetamask();
|
||||
});
|
||||
|
||||
|
||||
@@ -80,16 +80,6 @@ describe("Format functions", () => {
|
||||
).toThrow();
|
||||
});
|
||||
|
||||
test("formatCAIP10Address", () => {
|
||||
expect(
|
||||
utils.formatCAIP10Address(
|
||||
"0x1234567890123456789012345678901234567890",
|
||||
"eip155",
|
||||
1,
|
||||
),
|
||||
).toEqual("0x1234567890123456789012345678901234567890@eip155:1");
|
||||
});
|
||||
|
||||
test("formatAddress", () => {
|
||||
expect(
|
||||
utils.formatAddress("0xb5d85cbf7cb3ee0d56b3bb207d5fc4b82f43f511"),
|
||||
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
getAnchorsAccount,
|
||||
getRegistration,
|
||||
} from "@app/base/registrations/registrar";
|
||||
import type { BasicProfile } from "@datamodels/identity-profile-basic";
|
||||
import { ProfileType } from "@app/profile";
|
||||
import { parseUnits } from "@ethersproject/units";
|
||||
import { GetSafe } from "@app/base/orgs/Org";
|
||||
@@ -150,14 +149,6 @@ export function formatBalance(n: BigNumber, decimals?: number): string {
|
||||
);
|
||||
}
|
||||
|
||||
export function formatCAIP10Address(
|
||||
address: string,
|
||||
protocol: string,
|
||||
impl: number,
|
||||
): string {
|
||||
return `${address.toLowerCase()}@${protocol}:${impl.toString()}`;
|
||||
}
|
||||
|
||||
// Returns a checksummed, shortened, without 0x prefix Ethereum address
|
||||
export function formatAddress(input: string): string {
|
||||
const addr = ethers.utils.getAddress(input).replace(/^0x/, "");
|
||||
@@ -510,19 +501,6 @@ export async function resolveMultiLabel(
|
||||
}, {});
|
||||
}
|
||||
|
||||
// Resolves an IDX profile or return null
|
||||
export const resolveIdxProfile = cache.cached(
|
||||
async (caip10: string, config: Config): Promise<BasicProfile | null> => {
|
||||
try {
|
||||
return await config.ceramic.client.get("basicProfile", caip10);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
(caip10: string) => caip10,
|
||||
{ max: 500, ttl: 30 * 60 * 1000 }, // Cache results for 30 minutes.
|
||||
);
|
||||
|
||||
// Resolves an ENS profile or return null
|
||||
export async function resolveEnsProfile(
|
||||
addressOrName: string,
|
||||
|
||||
Reference in New Issue
Block a user