Skip to content

Commit

Permalink
merge changes
Browse files Browse the repository at this point in the history
  • Loading branch information
marthendalnunes committed Dec 5, 2024
2 parents 66429ae + 5b10981 commit 7dc9afa
Show file tree
Hide file tree
Showing 23 changed files with 117 additions and 104 deletions.
2 changes: 1 addition & 1 deletion apps/api-credentials/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Config } from 'drizzle-kit';
import { env } from './src/env.js';
import { env } from './src/env';

export default {
schema: './src/lib/db/schema.ts',
Expand Down
2 changes: 1 addition & 1 deletion apps/api-credentials/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"devDependencies": {
"dotenv": "^16.4.5",
"drizzle-kit": "^0.26.2",
"drizzle-kit": "0.28.1",
"tsx": "^4.7.1",
"typescript": "^5.6.3"
}
Expand Down
1 change: 1 addition & 0 deletions apps/api-credentials/src/app/verify/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ verifyDiscordApp.get(
handle: user.username,
verifiedAt: new Date().toISOString(),
platformProfileUrl: `https://discordapp.com/users/${user.id}`,
platformProfileImageUrl: `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}`,
},
});
const issuer =
Expand Down
4 changes: 2 additions & 2 deletions apps/api-credentials/src/app/verify/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ verifyGithubApp.get(
}

let credential: VerifiableCredential;

try {
credential = await createCredential({
credentialSubject: {
id: did,
platform: 'github',
platformUserId: user.id,
platformUserId: user.id.toString(),
handle: `@${user.login}`,
verifiedAt: new Date().toISOString(),
platformProfileUrl: `https://github.com/${user.login}`,
platformProfileImageUrl: user.avatar_url,
},
});
const issuer =
Expand Down
1 change: 1 addition & 0 deletions apps/api-credentials/src/app/verify/x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ verifyXApp.get(
handle: `@${user.username}`,
verifiedAt: new Date().toISOString(),
platformProfileUrl: `https://x.com/${user.username}`,
platformProfileImageUrl: user.profile_image_url,
},
});

Expand Down
14 changes: 11 additions & 3 deletions apps/api-credentials/src/lib/veramo/actions/create-credential.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import { alias, veramoAgent } from '../agent.js';

type Platform = 'x' | 'github' | 'discord';

type CreateCredentialParams = {
// TODO: Process credential correctly
// biome-ignore lint/suspicious/noExplicitAny: any
credentialSubject: any;
credentialSubject: {
id: string;
platform: Platform;
platformUserId: string;
handle: string;
verifiedAt: string;
platformProfileUrl: string;
platformProfileImageUrl: string | undefined;
};
};
export async function createCredential({
credentialSubject,
Expand Down
11 changes: 11 additions & 0 deletions apps/api-credentials/src/scripts/create-identifier.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createIdentifier } from '../lib/veramo/actions/create-identifier.js';

async function main() {
const identifier = await createIdentifier();
console.log('New identifier created');
console.log(JSON.stringify(identifier, null, 2));
}

(async () => {
await main();
})();
2 changes: 1 addition & 1 deletion apps/api-identity/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { env } from '@/env.js';
import type { Config } from 'drizzle-kit';
import { env } from './src/env';

export default {
out: './src/lib/db/drizzle',
Expand Down
2 changes: 1 addition & 1 deletion apps/api-identity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"@types/pg": "^8.11.10",
"dotenv": "^16.4.5",
"drizzle-kit": "^0.26.2",
"drizzle-kit": "0.28.1",
"tsx": "^4.19.2",
"typescript": "^5.6.3"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/api-universal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"devDependencies": {
"@types/pg": "^8.11.10",
"dotenv": "^16.4.5",
"drizzle-kit": "^0.26.2",
"drizzle-kit": "0.28.1",
"tsx": "^4.19.2",
"typescript": "^5.6.3"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/api-universal/src/routes/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const accountsRouter = new Hono()
const isValid = verifyUniversalMessage({
chainId: data.chainId,
address: data.address,
content: "I want to discover what's possible in the Universal Network.",
content: 'Applying to the join the UNV beta.',
signature: data.signature,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const CardPaymentBasic = ({
<div className={cn(className)}>
<div className="flex justify-center pb-6">
<DebitCard
amount={formatUnits(BigInt(data.amount), 18).toString()}
amount={formatUnits(BigInt(data.amount), data.decimals).toString()}
tokenAddress={data.token}
chainId={chainId}
to={data.to}
Expand All @@ -65,7 +65,6 @@ export const CardPaymentBasic = ({
label="Amount"
value={formatUnits(BigInt(data.amount), data.decimals)}
/>
<RowBasic label="Expiration" value={'Never'} />
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const DIDDefaultParsedView = ({
return (
<div className={cn('flex justify-center', className)}>
<DIDCard
color="yellow"
chainId={chainId}
account={document.deconstructed.address}
resolver={document.deconstructed.resolver}
Expand Down
2 changes: 1 addition & 1 deletion apps/popup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"@svgr/webpack": "^8.1.0",
"@tanstack/react-query": "^5.59.0",
"class-variance-authority": "^0.7.0",
"drizzle-kit": "^0.26.2",
"drizzle-orm": "^0.36.4",
"lucide-react": "^0.446.0",
"luxon": "^3.5.0",
Expand Down Expand Up @@ -69,6 +68,7 @@
"@types/react-dom": "^18.2.7",
"autoprefixer": "^10.4.19",
"bufferutil": "^4.0.7",
"drizzle-kit": "0.28.1",
"encoding": "^0.1.13",
"pino-pretty": "^10.2.0",
"postcss": "^8.4.38",
Expand Down
102 changes: 53 additions & 49 deletions apps/wallet/app/(site)/leaderboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use client';
import { LeaderboardApplyDialog } from '@/components/core/leaderboard-apply-dialog';
import { LeaderboardMetricsTable } from '@/components/tables/leaderboard-metrics-table';
import { LeaderboardTable } from '@/components/tables/leaderboard-table';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Coins, Info, Medal, Orbit, Trophy } from 'lucide-react';
import { Coins, EarthLock, Info, Medal, Orbit, Trophy } from 'lucide-react';

export default function LeaderboardPage() {
return (
Expand Down Expand Up @@ -49,53 +48,58 @@ export default function LeaderboardPage() {
</TabsContent>
<TabsContent value="information" className="m-0 h-full p-0">
<section className="h-full">
<div className="container grid grid-cols-1 gap-x-8 lg:grid-cols-12">
<div className="space-y-6 lg:col-span-8">
<Card className=" p-6 ">
<LeaderboardMetricsTable />
</Card>
</div>
<div className="space-y-5 lg:col-span-4">
<Card>
<CardHeader>
<Coins className="size-8" />
<CardTitle className="font-bold text-2xl">
Get Rewarded for Trust
</CardTitle>
</CardHeader>
<CardContent className="content">
<p className="font-bold text-sm leading-6 ">
We're rewarding users for building a web of trust.
</p>
<p className="text-sm leading-6">
Users with the highest verifiable trust score will be
sent a USDC reward every month.
</p>
<p className="text-sm leading-6">
The reward will be distributed to the top 10 users with
the highest trust score.
</p>
</CardContent>
</Card>

<Card>
<CardHeader>
<Trophy className="size-8" />
<CardTitle className="font-bold text-2xl">
Trust Score Multiplier
</CardTitle>
</CardHeader>
<CardContent className="content">
<p className="text-sm leading-6">
Each asset has a unique trust score multiplier.
</p>
<p className="text-sm leading-6">
Users with the highest peer-to-peer credit scores wil
have a higher universal trust score.
</p>
</CardContent>
</Card>
</div>
<div className="container grid grid-cols-1 gap-x-8 lg:grid-cols-3">
<Card>
<CardHeader>
<Coins className="size-8" />
<CardTitle className="font-bold text-2xl">
Rewarding Relationships
</CardTitle>
</CardHeader>
<CardContent className="content">
<p className="font-bold text-sm leading-6 ">
We're rewarding users for building a web of trust.
</p>
<p className="text-sm leading-6">
Users with the highest verifiable trust score will be sent
a USDC reward every month.
</p>
</CardContent>
</Card>
<Card>
<CardHeader>
<Trophy className="size-8" />
<CardTitle className="font-bold text-2xl">
Universal Network
</CardTitle>
</CardHeader>
<CardContent className="content">
<p className="font-bold text-sm leading-6">
Users in the UNV Network play to build trust with each.
</p>
<p className="text-sm leading-6">
Creating peer-to-peer credit lines that are backed by
people and connections.
</p>
</CardContent>
</Card>
<Card>
<CardHeader>
<EarthLock className="size-8" />
<CardTitle className="font-bold text-2xl">
Web of Trust
</CardTitle>
</CardHeader>
<CardContent className="content">
<p className="font-bold text-sm leading-6">
The goal is to build a web of trust that is verifiable.
</p>
<p className="text-sm leading-6">
Backed by money, relationships and reputation. Trust is
and will always be the most valuable asset.
</p>
</CardContent>
</Card>
</div>
</section>
</TabsContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const LeaderboardApplyDialog = ({
}
try {
const _signature = await signTypedDataAsync({
content: "I want to discover what's possible in the Universal Network.",
content: 'Applying to the join the UNV beta.',
});

await mutateAsync({
Expand Down
6 changes: 6 additions & 0 deletions apps/wallet/src/components/tables/leaderboard-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ const columns = [
tokenList: defaultTokenList,
})?.address
}
decimals={
findToken({
address: DEFAULT_LEADERBOARD_ASSET,
tokenList: defaultTokenList,
})?.decimals
}
/>
</div>
),
Expand Down
2 changes: 1 addition & 1 deletion packages/universal-data/src/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const universalDeployments = {
// Test
Erc20Mintable: '0x4C8Be898BdE148aE6f9B0AF86e7D2b5a0558A7d0',
// Universal Identity
Resolver: '0xd32121B30762fC193141AabBE09E53Af28553be4',
Resolver: '0xc675eE8dA6B4183f977a7e9F1C4589B20982b8C3',
// Delegation Framework Core
EntryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032',
DelegationManager: '0x26e1920510E4d8693524e161380Bbf01318E33c9',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function useUniversalMessageSign() {
},
message: {
content: content,
// content: "I want to discover what's possible in the Universal Network.",
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/universal-wallet-sdk/src/core/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// TODO: Move to .env
export const WALLET_URL =
process.env.NODE_ENV === 'production'
? 'https://keys.districtlabs.com/connect'
? 'https://keys.univrsal.co/connect'
: 'http://localhost:3000/connect';
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function DebitCard({
case 'xLarge':
return 'text-3xl leading-tight';
case 'xxLarge':
return 'text-5xl leading-tight';
return 'text-4xl leading-tight';
default:
return '';
}
Expand Down Expand Up @@ -123,7 +123,7 @@ export function DebitCard({
'relative aspect-[36/22] w-full min-w-[320px] max-w-[560px] overflow-hidden rounded-2xl border-0 border-2 border-neutral-100 bg-gradient-to-br text-white shadow-md',
)}
>
<div className="-translate-y-1/3 absolute top-0 right-0 h-4/6 w-3/5 translate-x-1/3 rounded-full bg-white/20" />
{/* <div className="-translate-y-1/3 absolute top-0 right-0 h-4/6 w-3/5 translate-x-1/3 rounded-full bg-white/20" /> */}
<div className="relative flex h-full flex-col justify-between px-6 pt-2 pb-4">
<div className="flex items-start justify-between ">
<div className="space-y-1 pt-4">
Expand Down
22 changes: 10 additions & 12 deletions packages/universal-wallet-ui/components/identity/did-card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import { Fingerprint } from 'lucide-react';
import type { Address } from 'viem';
import { Card } from '../ui/card';
Expand Down Expand Up @@ -32,14 +30,14 @@ export function DIDCard({
'relative h-[250px] w-full min-w-[320px] max-w-[400px] overflow-hidden rounded-2xl border-0 bg-gradient-to-br text-white shadow-lg',
)}
>
<div className='absolute right-0 bottom-0 h-[200px] w-[200px] translate-x-1/3 translate-y-1/3 rounded-full bg-white/20' />
<div className='relative flex h-full flex-col justify-between p-6'>
<div className='w-full'>
<div className="space-y-2 w-full">
<div className='flex items-center justify-between gap-x-2'>
<span className='font-bold text-xl'>Universal Identity</span>
<Fingerprint size={24} />
</div>
{/* <div className='absolute right-0 bottom-0 h-[200px] w-[200px] translate-x-1/3 translate-y-1/3 rounded-full bg-white/20' /> */}
<div className="relative flex h-full flex-col justify-between p-6">
<div className="w-full">
<div className="w-full space-y-2">
<div className="flex items-center justify-between gap-x-2">
<span className="font-bold text-xl">Universal Identity</span>
<Fingerprint size={24} />
</div>
<div className="space-y-1">
<div className="font-mono text-xs">
{`did:uis:${chainId}:${truncateEthAddress(resolver, 7)}:${truncateEthAddress(account)}`}
Expand All @@ -50,11 +48,11 @@ export function DIDCard({

<div className="flex flex-col gap-y-2 ">
<div className="space-y-1">
<div className='font-black text-base'>Resolver</div>
<div className="font-black text-base">Resolver</div>
<div className="font-mono text-xs">{resolver}</div>
</div>
<div className="space-y-1">
<div className='font-black text-base'>Account</div>
<div className="font-black text-base">Account</div>
<div className="font-mono text-xs">{account}</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 7dc9afa

Please sign in to comment.