Skip to content

Commit

Permalink
Change images (#248)
Browse files Browse the repository at this point in the history
* statue optimised

* update images

* remove injective

* remove chain registry

* fix bug

* pre commit

* try fixing

* fix test

* remove another lib

* remove eth utils

* test fix

* fix image with bg color
  • Loading branch information
Dev Kalra committed Nov 8, 2023
1 parent 40ca43e commit 155a926
Show file tree
Hide file tree
Showing 16 changed files with 2,145 additions and 1,485 deletions.
15 changes: 5 additions & 10 deletions frontend/claim_sdk/ecosystems/signatures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ import {
TestSuiWallet,
} from '../testWallets'
import path from 'path'
import { Address as InjectiveAddress } from '@injectivelabs/sdk-ts'
import { airdrop } from '../solana'
import { ed25519 } from '@noble/curves/ed25519'
import { Ed25519PublicKey } from '@mysten/sui.js/keypairs/ed25519'
import { blake2b } from '@noble/hashes/blake2b'
import { getInjectiveAddress } from '../../utils/getInjectiveAddress'
import { getAddress } from 'ethers'

describe('signature tests', () => {
const solanaKeypair = anchor.web3.Keypair.generate()
Expand Down Expand Up @@ -92,16 +93,10 @@ describe('signature tests', () => {
.toRawBytes(false)
)

const injectiveAddrFromRecovered = InjectiveAddress.fromHex(
Buffer.from(recoveredEvmPubkey).toString('hex')
)
expect(injectiveAddrFromRecovered.toBech32('inj')).toEqual(
injectiveWallet.address()
)

expect(removeLeading0x(injectiveAddrFromRecovered.toHex())).toEqual(
Buffer.from(recoveredEvmPubkey).toString('hex')
const injectiveAddrFromRecovered = getInjectiveAddress(
getAddress(Buffer.from(recoveredEvmPubkey).toString('hex'))
)
expect(injectiveAddrFromRecovered).toEqual(injectiveWallet.address())

expect(Buffer.from(recoveredEvmPubkey).equals(Buffer.from(evmPubkey)))

Expand Down
9 changes: 4 additions & 5 deletions frontend/claim_sdk/testWallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ import { AminoSignResponse, Secp256k1HdWallet } from '@cosmjs/amino'
import { makeADR36AminoSignDoc } from '@keplr-wallet/cosmos'
import NodeWallet from '@coral-xyz/anchor/dist/cjs/nodewallet'
import { Keypair, PublicKey } from '@solana/web3.js'
import { OfflineAminoSigner } from '@injectivelabs/sdk-ts/dist/cjs/core/accounts/signers/types/amino-signer'
import { hardDriveSignMessage, signDiscordMessage } from './ecosystems/solana'
import { AptosAccount } from 'aptos'
import { aptosGetFullMessage } from './ecosystems/aptos'
import { Ed25519Keypair } from '@mysten/sui.js/keypairs/ed25519'
import { hashDiscordUserId } from '../utils/hashDiscord'
import { Address as InjectiveAddress } from '@injectivelabs/sdk-ts'
import { getInjectiveAddress } from '../utils/getInjectiveAddress'

dotenv.config() // Load environment variables from .env file

Expand Down Expand Up @@ -131,7 +130,7 @@ export class TestEvmWallet implements TestWallet {

public address(): string {
if (this.isInjectiveWallet) {
return InjectiveAddress.fromHex(this.wallet.address).toBech32('inj')
return getInjectiveAddress(this.wallet.address)
} else {
return this.wallet.address
}
Expand All @@ -140,7 +139,7 @@ export class TestEvmWallet implements TestWallet {

export class TestCosmWasmWallet implements TestWallet {
protected constructor(
readonly wallet: OfflineAminoSigner,
readonly wallet: Secp256k1HdWallet,
readonly addressStr: string
) {}
/**
Expand All @@ -156,7 +155,7 @@ export class TestCosmWasmWallet implements TestWallet {
const jsonContent = fs.readFileSync(keyFile, 'utf8')

const mnemonic = JSON.parse(jsonContent).mnemonic
const wallet: OfflineAminoSigner = await Secp256k1HdWallet.fromMnemonic(
const wallet: Secp256k1HdWallet = await Secp256k1HdWallet.fromMnemonic(
mnemonic,
chainId ? { prefix: chainId } : {}
)
Expand Down
24 changes: 22 additions & 2 deletions frontend/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Image from 'next/image'
import { usePathname } from 'next/navigation'
import { ReactNode } from 'react'

import bg from '../images/bg.png'
import bg from '../images/bg.svg'
import sphere from '../images/sphere.png'

import { useRouter } from 'next/router'
import { WELCOME_METADATA } from 'pages'
Expand Down Expand Up @@ -98,14 +99,33 @@ export const Layout = ({ children }: LayoutProps) => {
</div>
</div>
</div>
<span className="pointer-events-none fixed top-0 bottom-0 left-0 right-0 z-[-1]">
<span
className="pointer-events-none fixed top-0 bottom-0 left-0 right-0 z-[-1]"
style={{
background:
'radial-gradient(circle, rgba(70,43,120,1) 0%, rgba(8,6,17,1) 100%)',
}}
>
<Image
src={bg}
alt=""
layout="fill"
objectFit="cover"
objectPosition="left bottom"
/>
<Image
src={sphere}
alt=""
objectFit="cover"
objectPosition="left bottom"
style={{
width: '50%',
position: 'absolute',
bottom: '-4%',
left: '-5%',
opacity: 0.6,
}}
/>
<span className="absolute -left-[430px] -bottom-24 max-h-[100vh] max-w-[1200px]">
<Image src={statue} alt="" priority />
</span>
Expand Down
10 changes: 2 additions & 8 deletions frontend/components/wallets/Cosmos.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactElement, ReactNode, useEffect } from 'react'
import { ChainProvider, useChainWallet } from '@cosmos-kit/react-lite'
import { assets, chains } from 'chain-registry'
import { assets, chains } from '../../utils/chain-registry'
import { wallets as keplrWallets } from '@cosmos-kit/keplr-extension'
import { wallets as compassWallets } from '@cosmos-kit/compass-extension'
import { MainWalletBase } from '@cosmos-kit/core'
Expand All @@ -10,7 +10,7 @@ import keplr from '@images/keplr.svg'

export const WALLET_NAME = 'keplr-extension'

export type ChainName = 'injective' | 'osmosis' | 'neutron' | 'sei'
export type ChainName = 'osmosis' | 'neutron' | 'sei'

type CosmosWalletProviderProps = {
children: ReactNode
Expand All @@ -19,12 +19,6 @@ type CosmosWalletProviderProps = {
export function CosmosWalletProvider({
children,
}: CosmosWalletProviderProps): ReactElement {
assets.forEach((asset) => {
if (asset.chain_name === 'sei') {
asset.assets = [asset.assets[0]]
}
})

return (
<ChainProvider
chains={chains}
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/wallets/EVM.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { WalletConnectConnector } from 'wagmi/connectors/walletConnect'
import coinbase from '@images/coinbase.svg'
import walletConnect from '@images/wallet-connect.svg'
import metamask from '@images/metamask.svg'
import { getInjectiveAddress } from '@injectivelabs/sdk-ts'
import { getInjectiveAddress } from '../../utils/getInjectiveAddress'

// Configure chains & providers with the Alchemy provider.
// Two popular providers are Alchemy (alchemy.com) and Infura (infura.io)
Expand Down
4 changes: 1 addition & 3 deletions frontend/hooks/useGetEcosystemIdentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ import { useSession } from 'next-auth/react'
import { Ecosystem } from '@components/Ecosystem'
import { useCallback } from 'react'
import { useSeiWalletContext } from '@components/wallets/Sei'
import { getInjectiveAddress } from '@injectivelabs/sdk-ts'
import { getInjectiveAddress } from '../utils/getInjectiveAddress'

// It will return a function that can be used to get the identity of a given ecosystem
// The function will return the identity if the ecosystem is connected
// Else it will return undefined
export function useGetEcosystemIdentity() {
const aptosAddress = useAptosAddress()
const evmAddress = useEVMAddress()
const injectiveAddress = useCosmosAddress('injective')
const osmosisAddress = useCosmosAddress('osmosis')
const neutronAddress = useCosmosAddress('neutron')

Expand Down Expand Up @@ -62,7 +61,6 @@ export function useGetEcosystemIdentity() {
aptosAddress,
data?.user?.hashedUserId,
evmAddress,
injectiveAddress,
neutronAddress,
osmosisAddress,
seiAddress,
Expand Down
Binary file modified frontend/images/bg-statue-with-coins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/images/bg-statue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed frontend/images/bg.png
Binary file not shown.
Loading

0 comments on commit 155a926

Please sign in to comment.