Update IDX dependencies

Signed-off-by: Sebastian Martinez <sebastinez@me.com>
This commit is contained in:
Sebastian Martinez
2021-10-30 22:43:05 +02:00
parent 53365e18f3
commit 1f5193b032
5 changed files with 1062 additions and 183 deletions
+1046 -163
View File
File diff suppressed because it is too large Load Diff
+6 -7
View File
@@ -22,25 +22,24 @@
"vite-plugin-rewrite-all": "^0.1.2"
},
"dependencies": {
"@ceramicnetwork/http-client": "^1.0.6",
"@ceramicstudio/idx": "^0.12.1",
"@ceramicstudio/idx-constants": "^1.0.0",
"@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",
"@self.id/core": "^0.1.0",
"@stardazed/streams": "^3.1.0",
"@types/marked": "^2.0.3",
"@ethersproject/abstract-provider": "^5.4.0",
"@walletconnect/client": "^1.6.0",
"@walletconnect/signer-connection": "^1.6.0",
"@walletconnect/types": "^1.6.0",
"@walletconnect/utils": "^1.6.0",
"buffer": "^6.0.3",
"caip": "^1.0.0",
"ethereum-blockies": "^0.1.1",
"eventemitter3": "4.0.7",
"caip": "^0.9.2",
"eip1193-provider": "1.0.1",
"ethereum-blockies": "^0.1.1",
"ethers": "^5.0.31",
"eventemitter3": "4.0.7",
"marked": "^2.0.7",
"multibase": "^4.0.4",
"multihashes": "^4.0.2",
+3 -7
View File
@@ -3,8 +3,7 @@ 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 CeramicClient from "@ceramicnetwork/http-client";
import { IDX } from "@ceramicstudio/idx";
import { Core } from '@self.id/core';
import WalletConnect from "@walletconnect/client";
import config from "@app/config.json";
import { WalletConnectSigner } from "./WalletConnectSigner";
@@ -62,9 +61,8 @@ export class Config {
api: { port: number };
link: { port: number };
};
idx: { client: IDX };
ceramic: {
client: CeramicClient;
client: Core;
registry: string;
};
tokens: string[];
@@ -76,8 +74,7 @@ export class Config {
metamaskSigner: ethers.Signer & TypedDataSigner | null,
) {
const cfg = (<Record<string, any>> config)[network.name];
const ceramic = new CeramicClient(config.ceramic.api);
const idx = new IDX({ ceramic });
const ceramic = new Core({ ceramic: config.ceramic.api });
const walletConnectState = writable<WalletConnectState>(
{ state: "close" }
@@ -120,7 +117,6 @@ export class Config {
this.signer = null;
this.gasLimits = gasLimits;
this.abi = config.abi;
this.idx = { client: idx };
this.ceramic = {
client: ceramic,
registry: config.ceramic.registry
+5 -4
View File
@@ -1,6 +1,6 @@
import { AccountId } from 'caip';
import { AccountID } from 'caip';
import type { EnsProfile } from "@app/base/registrations/registrar";
import type { BasicProfile } from "@ceramicstudio/idx-constants";
import type { BasicProfile } from '@datamodels/identity-profile-basic';
import {
isAddress, formatCAIP10Address, formatIpfsFile, resolveEnsProfile, resolveIdxProfile, parseUsername, parseEnsLabel
} from "@app/utils";
@@ -90,7 +90,7 @@ export class Profile {
const addr = this.profile?.ens?.anchorsAccount;
if (addr) {
const id = new AccountId(addr);
const id = new AccountID(addr);
// Ethereum address.
if (typeof id.chainId === "object" && id.chainId.namespace === "eip155") {
@@ -145,7 +145,8 @@ export class Profile {
formatCAIP10Address(address, "eip155", config.network.chainId), config
);
return { address, ens: null, idx };
} catch {
} catch (e) {
console.error(e);
return { address, ens: null, idx: null };
}
}
+2 -2
View File
@@ -8,7 +8,7 @@ import config from "@app/config.json";
import { assert } from '@app/error';
import type { EnsProfile } from "@app/base/registrations/registrar";
import { getAvatar, getSeedHost, getSeedId, getAnchorsAccount, getRegistration } from '@app/base/registrations/registrar';
import type { BasicProfile } from "@ceramicstudio/idx-constants";
import type { BasicProfile } from '@datamodels/identity-profile-basic';
import { ProfileType } from '@app/profile';
export enum AddressType {
@@ -267,7 +267,7 @@ export async function resolveLabel(label: string | undefined, config: Config): P
// Resolves an IDX profile or return null
export async function resolveIdxProfile(caip10: string, config: Config): Promise<BasicProfile | null> {
return config.idx.client.get<BasicProfile>("basicProfile", caip10);
return config.ceramic.client.get("basicProfile", caip10);
}
// Resolves an ENS profile or return null