Skip to content

Commit

Permalink
fix: en_7 recommendations... (#1749)
Browse files Browse the repository at this point in the history
* fix: fr9 recommendations

* fix: en_1 recommendations

* fix: en_1 recommendations

* fix: en_2 recommendations...

* fix: en_2 recommendations...

* fix: en_7 recommendations...

* fix: en_7 recommendations...

* fix: n_7 recommandations

* fix: n_7 recommandations

* Merge branch 'main' into 1656-fr9

* Merge branch '1661-en_2' into 1662-en_7

* fix: EN_7

* fix: EN_7

* fix: EN_7

---------

Co-authored-by: Fabio Rigamonti <[email protected]>
  • Loading branch information
lucanicoladebiasi and fabiorigam authored Jan 31, 2025
1 parent 3eecea9 commit f52a556
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 64 deletions.
8 changes: 4 additions & 4 deletions apps/sdk-cloudflare-integration/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"compilerOptions": {
"strict": true,
"module": "esnext",
"target": "esnext",
"module": "Node16",
"target": "ES2023",
"lib": [
"esnext"
],
"moduleResolution": "bundler",
"moduleResolution": "Node16",
"noEmit": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
Expand All @@ -18,4 +18,4 @@
"./**/*.ts"
]
}
}
}
6 changes: 3 additions & 3 deletions apps/sdk-nextjs-integration/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"module": "Node16",
"moduleResolution": "Node16",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
Expand All @@ -30,7 +30,7 @@
"**/*.ts",
"**/*.tsx",
"types.d.ts",
".next/types/**/*.ts",
".next/types/**/*.ts",
"jest.config.js" ],
"exclude": ["node_modules"]
}
6 changes: 3 additions & 3 deletions apps/sdk-vite-integration/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { BrowserRouter as Router, Route, Routes, Link } from 'react-router-dom';
import reactLogo from './assets/react.svg';
import viteLogo from '/vite.svg';
import './App.css';
import Hash from './components/Hash';
import TransferLogs from './components/TransferLogs';
import GetLastBlock from './components/GetLastBlock';
import Hash from './components/Hash.tsx';
import TransferLogs from './components/TransferLogs.tsx';
import GetLastBlock from './components/GetLastBlock.tsx';

function App() {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/sdk-vite-integration/src/components/GetLastBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type CompressedBlockDetail } from "@vechain/sdk-network";
import { useState } from "react";
import { thorClient } from "../const";
import { thorClient } from '../const/index.tsx';

const GetLastBlock = () => {
const [block, setBlock] = useState<CompressedBlockDetail | null>(null);
Expand Down
2 changes: 1 addition & 1 deletion apps/sdk-vite-integration/src/components/Hash.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Blake2b256, Keccak256, Sha256, Txt } from '@vechain/sdk-core';
import { useEffect, useState } from 'react';
import { HashedContent } from '../types';
import { HashedContent } from '../types/index.tsx';

const Hash = () => {
// State of content to hash
Expand Down
4 changes: 2 additions & 2 deletions apps/sdk-vite-integration/src/components/TransferLogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
FilterTransferLogsOptions
} from '@vechain/sdk-network';
import { Link } from 'react-router-dom';
import { Transfer } from "../types";
import { explorerUrl, thorClient } from "../const";
import { Transfer } from "../types/index.tsx";
import { explorerUrl, thorClient } from "../const/index.tsx";

/**
* Reduce the size of a hex string
Expand Down
2 changes: 1 addition & 1 deletion apps/sdk-vite-integration/src/const/index.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// eslint-disable-next-line react-refresh/only-export-components
export * from './const';
export * from '../const/const.tsx';
2 changes: 1 addition & 1 deletion apps/sdk-vite-integration/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App'
import App from './App.tsx'

createRoot(document.getElementById('root')!).render(
<StrictMode>
Expand Down
2 changes: 1 addition & 1 deletion apps/sdk-vite-integration/src/types/index.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type * from './types.d';
export type * from './types.d.tsx';
4 changes: 2 additions & 2 deletions apps/sdk-vite-integration/tests/Hash.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-react'
import Hash from '../src/components/Hash'
import Hash from '../src/components/Hash.js'

test('renders name', async () => {
const { getByText } = render(<Hash />)

await expect.element(getByText('0xbf56c0728fd4e9cf64bfaf6dabab81554103298cdee5cc4d580433aa25e98b00')).toBeInTheDocument()
})
})
4 changes: 2 additions & 2 deletions apps/sdk-vite-integration/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"module": "Node16",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "Bundler",
"moduleResolution": "Node16",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
Expand Down
21 changes: 11 additions & 10 deletions apps/sdk-vite-integration/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": ["esnext", "dom"],
"module": "ESNext",
"moduleResolution": "Bundler",
"jsx": "react-jsx",
"types": ["@vitest/browser/providers/playwright"],
"strict": true,
"allowImportingTsExtensions": true,
"declaration": true,
"noEmit": true,
"esModuleInterop": true,
"skipLibCheck": true
"jsx": "react-jsx",
"lib": ["esnext", "dom"],
"module": "Node16",
"moduleResolution": "Node16",
"noEmit": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2023",
"types": ["@vitest/browser/providers/playwright"]
}
}
}
4 changes: 2 additions & 2 deletions apps/sdk-vite-integration/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"module": "Node16",
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "Bundler",
"moduleResolution": "Node16",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
Expand Down
14 changes: 7 additions & 7 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"target": "ES2023",
"module": "Node16",
"moduleResolution": "Node16",
"allowSyntheticDefaultImports": true,
},
"ts-node": {
"compilerOptions": {
"esModuleInterop": true,
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "Node",
"module": "Node16",
"target": "ES2023",
"moduleResolution": "Node16",
},
"esm": true
}
}
}
11 changes: 8 additions & 3 deletions packages/aws-kms-adapter/tests/KMSVeChainSigner.solo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import {
Transaction,
type TransactionClause
} from '@vechain/sdk-core';
import { signerUtils, THOR_SOLO_URL, ThorClient } from '@vechain/sdk-network';
import {
signerUtils,
THOR_SOLO_URL,
ThorClient,
type TypedDataDomain
} from '@vechain/sdk-network';
import fs from 'fs';
import path from 'path';
import {
Expand Down Expand Up @@ -297,7 +302,7 @@ describe('KMSVeChainSigner - Thor Solo', () => {
}
};
const signature = await signer.signTypedData(
typedData.domain,
typedData.domain as TypedDataDomain,
typedData.types,
typedData.data,
typedData.primaryType
Expand All @@ -307,7 +312,7 @@ describe('KMSVeChainSigner - Thor Solo', () => {
expect(signature).toMatch(/^0x[A-Fa-f0-9]{130}$/);

const signatureWithoutPrimaryType = await signer.signTypedData(
typedData.domain,
typedData.domain as TypedDataDomain,
typedData.types,
typedData.data
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Wallet } from 'ethers';
import {
TESTNET_URL,
ThorClient,
type TypedDataDomain,
VeChainPrivateKeySigner,
VeChainProvider,
vnsUtils
Expand Down Expand Up @@ -293,7 +294,7 @@ describe('VeChain base signer tests', () => {
);
await expect(
signer.signTypedData(
eip712TestCases.invalid.domain,
eip712TestCases.invalid.domain as TypedDataDomain,
eip712TestCases.invalid.types,
eip712TestCases.invalid.data,
eip712TestCases.invalid.primaryType
Expand All @@ -317,7 +318,7 @@ describe('VeChain base signer tests', () => {
});
await expect(
signer.signTypedData(
eip712TestCases.valid.domain,
eip712TestCases.valid.domain as TypedDataDomain,
eip712TestCases.valid.types,
eip712TestCases.valid.data,
eip712TestCases.valid.primaryType
Expand All @@ -326,7 +327,7 @@ describe('VeChain base signer tests', () => {

await expect(
signer.signTypedData(
eip712TestCases.valid.domain,
eip712TestCases.valid.domain as TypedDataDomain,
eip712TestCases.valid.types,
eip712TestCases.valid.data,
eip712TestCases.valid.primaryType
Expand All @@ -348,15 +349,15 @@ describe('VeChain base signer tests', () => {
provider
);
const actual = await privateKeySigner.signTypedData(
eip712TestCases.valid.domain,
eip712TestCases.valid.domain as TypedDataDomain,
eip712TestCases.valid.types,
eip712TestCases.valid.data,
eip712TestCases.valid.primaryType
);
expect(actual).toBe(expected);
const actualWithoutPrimaryType =
await privateKeySigner.signTypedData(
eip712TestCases.valid.domain,
eip712TestCases.valid.domain as TypedDataDomain,
eip712TestCases.valid.types,
eip712TestCases.valid.data
);
Expand All @@ -378,7 +379,7 @@ describe('VeChain base signer tests', () => {
const actualWithStringChainId =
await privateKeySigner.signTypedData(
{
...eip712TestCases.valid.domain,
...(eip712TestCases.valid.domain as TypedDataDomain),
chainId: vechainChainId
},
eip712TestCases.valid.types,
Expand All @@ -389,7 +390,7 @@ describe('VeChain base signer tests', () => {
const actualWithBigintChainId =
await privateKeySigner.signTypedData(
{
...eip712TestCases.valid.domain,
...(eip712TestCases.valid.domain as TypedDataDomain),
chainId: BigInt(vechainChainId)
},
eip712TestCases.valid.types,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, test } from '@jest/globals';
import { ERC20_ABI, HexUInt } from '@vechain/sdk-core';
import { Address, ERC20_ABI, HexUInt } from '@vechain/sdk-core';
import { InvalidAbiItem } from '@vechain/sdk-errors';
import {
THOR_SOLO_URL,
Expand Down Expand Up @@ -101,7 +101,7 @@ describe('ThorClient - ERC20 Contracts', () => {
const eventsWithAnArgsObject = await contract.filters
.Transfer({
from: undefined,
to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address
to: `0x${Address.of(TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address).digits}`
})
.get();

Expand Down Expand Up @@ -476,7 +476,7 @@ describe('ThorClient - ERC20 Contracts', () => {
await (await contractEventExample.transact.setValue(3000n)).wait();

const transferCriteria = contractERC20.criteria.Transfer({
to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address
to: `0x${Address.of(TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address).digits}`
});

const valueCriteria = contractEventExample.criteria.ValueSet();
Expand Down Expand Up @@ -537,7 +537,7 @@ describe('ThorClient - ERC20 Contracts', () => {
await (await contractEventExample.transact.setValue(3000n)).wait();

const transferCriteria = contractERC20.criteria.Transfer({
to: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address
to: `0x${Address.of(TEST_ACCOUNTS.TRANSACTION.TRANSACTION_RECEIVER.address).digits}`
});

const valueCriteria = contractEventExample.criteria.ValueSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ describe('ThorClient - Contracts', () => {
.StateChanged({
newValue: undefined,
oldValue: undefined,
sender: TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address
sender: `0x${Address.of(TEST_ACCOUNTS.TRANSACTION.TRANSACTION_SENDER.address).digits}`
})
.get();

Expand Down
8 changes: 4 additions & 4 deletions packages/rpc-proxy/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"rootDir": "./src",
"outDir": "./dist",
"strict": true,
"target": "es2020",
"module": "commonjs",
"target": "es2023",
"module": "Node16",
"sourceMap": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node"
"moduleResolution": "Node16"
},
"include": [
"./src/**/*.ts",
"./tests/**/*.ts"
]
}
}
10 changes: 5 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"module": "ESNext",
"target": "ESNext",
"module": "Node16",
"target": "ES2023",
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"moduleResolution": "Node16",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
Expand All @@ -22,7 +22,7 @@
"ts-node": {
// these options are overrides used only by ts-node
"compilerOptions": {
"module": "commonjs"
"module": "Node16"
}
},
}
}

1 comment on commit f52a556

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Coverage

Summary

Lines Statements Branches Functions
Coverage: 99%
98.98% (4378/4423) 97.01% (1398/1441) 98.9% (906/916)
Title Tests Skipped Failures Errors Time
core 838 0 πŸ’€ 0 ❌ 0 πŸ”₯ 2m 32s ⏱️
network 731 0 πŸ’€ 0 ❌ 0 πŸ”₯ 5m 8s ⏱️
errors 40 0 πŸ’€ 0 ❌ 0 πŸ”₯ 17.466s ⏱️
logging 3 0 πŸ’€ 0 ❌ 0 πŸ”₯ 19.091s ⏱️
hardhat-plugin 19 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 6s ⏱️
aws-kms-adapter 23 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 34s ⏱️
ethers-adapter 5 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 22s ⏱️
rpc-proxy 37 0 πŸ’€ 0 ❌ 0 πŸ”₯ 1m 27s ⏱️

Please sign in to comment.