Skip to content

Commit

Permalink
Merge pull request #23 from nabla-studio/DavideSegullo/fix-types
Browse files Browse the repository at this point in the history
Davide segullo/fix types
  • Loading branch information
DavideSegullo authored Nov 24, 2023
2 parents 9e27aa0 + fd2c973 commit a6ab28b
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/nextjs/components/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const Button = () => {
}}
>
<img
src={wallet.options.logoUrls?.light?.svg}
src={wallet.logoLight}
alt={wallet.options.prettyName}
height="48px"
width="48px"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"typescript": "~5.2.2",
"verdaccio": "^5.27.0",
"vite": "~4.5.0",
"vite-plugin-dts": "~3.6.1",
"vite-plugin-dts": "~2.3.0",
"vitest": "~0.34.6",
"vue-tsc": "^1.8.8"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/chain-registry/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default defineConfig({
nxViteTsPaths(),
dts({
entryRoot: 'src',
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
skipDiagnostics: true,
}),
],

Expand Down
40 changes: 40 additions & 0 deletions packages/core/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,46 @@ export abstract class Wallet<T = unknown> {
this.events.removeAllListeners();
}

get logoDark() {
const urls = this.options.logoUrls;

if (urls && urls.dark) {
const keys = Object.keys(urls.dark);

if (urls.dark.svg) {
return urls.dark.svg;
}

if (keys.length > 0) {
const [key] = keys;

return (urls.dark as { [key: string]: string })[key];
}
}

return undefined;
}

get logoLight() {
const urls = this.options.logoUrls;

if (urls && urls.light) {
const keys = Object.keys(urls.light);

if (urls.light.svg) {
return urls.light.svg;
}

if (keys.length > 0) {
const [key] = keys;

return (urls.light as { [key: string]: string })[key];
}
}

return undefined;
}

abstract addListeners(): void;

abstract init(): Promise<T | undefined>;
Expand Down
3 changes: 2 additions & 1 deletion packages/core/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default defineConfig({
nxViteTsPaths(),
dts({
entryRoot: 'src',
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
skipDiagnostics: true,
}),
],

Expand Down
3 changes: 2 additions & 1 deletion packages/nuxt/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export default defineConfig({
nxViteTsPaths(),
dts({
entryRoot: 'src',
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
skipDiagnostics: true,
}),
],

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/providers/next.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { QuirksConfigContext } from './config';
import { PropsWithChildren, useContext, useEffect, useState } from 'react';
import { type PropsWithChildren, useContext, useEffect, useState } from 'react';

export const QuirksNextProvider = (props: PropsWithChildren<unknown>) => {
const { children } = props;
Expand Down
3 changes: 2 additions & 1 deletion packages/react/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export default defineConfig({
nxViteTsPaths(),
dts({
entryRoot: 'src',
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
skipDiagnostics: true,
}),
],

Expand Down
2 changes: 1 addition & 1 deletion packages/store/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"declaration": true,
"types": ["node", "vite/client"]
},
"include": ["src/**/*.ts"],
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
}
3 changes: 2 additions & 1 deletion packages/store/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default defineConfig({
nxViteTsPaths(),
dts({
entryRoot: 'src',
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
skipDiagnostics: true,
}),
],

Expand Down
3 changes: 2 additions & 1 deletion packages/vue/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export default defineConfig({
nxViteTsPaths(),
dts({
entryRoot: 'src',
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
skipDiagnostics: true,
}),
],

Expand Down
4 changes: 2 additions & 2 deletions packages/wallets/src/xdefi/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export const xdefiExtensionOptions: WalletOptions = {
],
logoUrls: {
light: {
jpg: 'https://lh3.googleusercontent.com/6TkuRn_tZ2v5Bw4MZ2nTwJLEWU-76bAQFJhXunA7cbroI0izn7Mwi46Wvu3q5WfNUbQiPucQTCSTrb0FD_BCXuo3=w128-h128-e365-rj-sc0x00ffffff',
jpg: 'https://explorer-api.walletconnect.com/v3/logo/lg/efec6318-7f96-4b30-9287-6c287660cd00?projectId=2f05ae7f1116030fde2d36508f472bfb',
},
dark: {
jpg: 'https://lh3.googleusercontent.com/6TkuRn_tZ2v5Bw4MZ2nTwJLEWU-76bAQFJhXunA7cbroI0izn7Mwi46Wvu3q5WfNUbQiPucQTCSTrb0FD_BCXuo3=w128-h128-e365-rj-sc0x00ffffff',
jpg: 'https://explorer-api.walletconnect.com/v3/logo/lg/efec6318-7f96-4b30-9287-6c287660cd00?projectId=2f05ae7f1116030fde2d36508f472bfb',
},
},
events: {
Expand Down
3 changes: 2 additions & 1 deletion packages/wallets/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default defineConfig({
nxViteTsPaths(),
dts({
entryRoot: 'src',
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'),
skipDiagnostics: true,
}),
],

Expand Down
69 changes: 57 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a6ab28b

Please sign in to comment.