Skip to content

Commit

Permalink
Merge pull request #21 from Nomis-cc/feature/show-recipient-score-on-…
Browse files Browse the repository at this point in the history
…transaction

feat: update dependencies for JSX
  • Loading branch information
SukhachevN authored Aug 6, 2024
2 parents abca5db + 37529cc commit 2b260f7
Show file tree
Hide file tree
Showing 8 changed files with 3,857 additions and 3,479 deletions.
16 changes: 15 additions & 1 deletion packages/snap/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,25 @@ module.exports = {
},

{
files: ['*.test.ts'],
files: ['*.test.ts', '*.test.tsx'],
rules: {
'@typescript-eslint/unbound-method': 'off',
},
},

{
files: ['**/*.ts', '**/*.tsx'],
extends: ['@metamask/eslint-config-typescript'],
rules: {
// This allows importing the `Text` JSX component.
'@typescript-eslint/no-shadow': [
'error',
{
allow: ['Text'],
},
],
},
},
],

ignorePatterns: ['!.eslintrc.js', 'dist/'],
Expand Down
6 changes: 3 additions & 3 deletions packages/snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"test": "jest"
},
"dependencies": {
"@metamask/snaps-sdk": "^4.0.0",
"@metamask/snaps-sdk": "^6.1.1",
"buffer": "^6.0.3"
},
"devDependencies": {
Expand All @@ -37,8 +37,8 @@
"@metamask/eslint-config-jest": "^12.1.0",
"@metamask/eslint-config-nodejs": "^12.1.0",
"@metamask/eslint-config-typescript": "^12.1.0",
"@metamask/snaps-cli": "^6.1.0",
"@metamask/snaps-jest": "^7.0.0",
"@metamask/snaps-cli": "^6.2.1",
"@metamask/snaps-jest": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"eslint": "^8.45.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/snap.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { resolve } from 'path';

const config: SnapConfig = {
bundler: 'webpack',
input: resolve(__dirname, 'src/index.ts'),
input: resolve(__dirname, 'src/index.tsx'),
server: {
port: 8080,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/template-snap-monorepo.git"
},
"source": {
"shasum": "lKdj2bNf8RHmIe5hUyu+7f+Fwwi1gcj5ypwMkpy1IBo=",
"shasum": "EKgxZg2D/EjYdJAZFj9iHIxGTkDUSJtPKd7uXQAYdvk=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
7 changes: 6 additions & 1 deletion packages/snap/src/index.ts → packages/snap/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ export const onUserInput: OnUserInputHandler = async ({ id, event }) => {
method: 'snap_updateInterface',
params: {
id,
ui: renderMainUiWithScore(score, scoreName, url),
ui: renderMainUiWithScore(
score,
scoreName,
url,
`https://nomis.cc/api/snap/score?chainId=${chainId}&address=${account}`,
),
},
});
} catch {
Expand Down
2 changes: 2 additions & 0 deletions packages/snap/src/ui.ts → packages/snap/src/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ export const renderMainUiWithScore = (
score: number,
scoreName: string,
url: string,
link: string,
) => {
return panel([
heading(`${scoreName} Score: ${Number((score * 100).toFixed(2))}`),
text(`[Mint your score](https://nomis.cc${url})`),
text(link),
divider(),
form({
name: 'back',
Expand Down
6 changes: 4 additions & 2 deletions packages/snap/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "./"
"baseUrl": "./",
"jsx": "react-jsx",
"jsxImportSource": "@metamask/snaps-sdk"
},
"include": ["**/*.ts"]
"include": ["**/*.ts", "**/*.tsx"]
}
Loading

0 comments on commit 2b260f7

Please sign in to comment.