diff --git a/packages/hathor-rpc-handler/eslint.config.js b/packages/hathor-rpc-handler/eslint.config.js index 8754db9..105d9bd 100644 --- a/packages/hathor-rpc-handler/eslint.config.js +++ b/packages/hathor-rpc-handler/eslint.config.js @@ -7,9 +7,6 @@ export default tseslint.config( eslint.configs.recommended, ...tseslint.configs.recommended, { - ignores: [ - 'dist/**/*.js', - ], rules: { '@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }], }, diff --git a/packages/hathor-rpc-handler/jest.config.js b/packages/hathor-rpc-handler/jest.config.js index 9bab4c5..18f62fe 100644 --- a/packages/hathor-rpc-handler/jest.config.js +++ b/packages/hathor-rpc-handler/jest.config.js @@ -1,6 +1,6 @@ /** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { +export default { preset: 'ts-jest', testEnvironment: 'node', testPathIgnorePatterns: ['/__tests__/mocks/'] diff --git a/packages/hathor-rpc-handler/package.json b/packages/hathor-rpc-handler/package.json index 0b9c3aa..96db555 100644 --- a/packages/hathor-rpc-handler/package.json +++ b/packages/hathor-rpc-handler/package.json @@ -2,6 +2,7 @@ "name": "@hathor/hathor-rpc-handler", "version": "0.0.24", "license": "MIT", + "type": "module", "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -12,7 +13,7 @@ "node": ">=20" }, "scripts": { - "lint": "eslint .", + "lint": "eslint . --ignore-pattern 'dist/*'", "test": "jest", "build": "tsc --declaration", "watch": "tsc -w" diff --git a/packages/hathor-rpc-handler/src/rpcHandler/index.ts b/packages/hathor-rpc-handler/src/rpcHandler/index.ts index 27b70d7..ec5faa4 100644 --- a/packages/hathor-rpc-handler/src/rpcHandler/index.ts +++ b/packages/hathor-rpc-handler/src/rpcHandler/index.ts @@ -19,6 +19,7 @@ import { SignWithAddressRpcRequest, RpcResponse, CreateTokenRpcRequest, + SignOracleDataRpcRequest, } from '../types'; import { getAddress, @@ -30,6 +31,7 @@ import { signWithAddress, } from '../rpcMethods'; import { InvalidRpcMethod } from '../errors'; +import { createToken } from '../rpcMethods/createToken'; export const handleRpcRequest = async ( request: RpcRequest, @@ -68,6 +70,18 @@ export const handleRpcRequest = async ( requestMetadata, promptHandler, ); + case RpcMethods.CreateToken: return createToken( + request as CreateTokenRpcRequest, + wallet, + requestMetadata, + promptHandler, + ); + case RpcMethods.SignOracleData: return signOracleData( + request as SignOracleDataRpcRequest, + wallet, + requestMetadata, + promptHandler, + ); case RpcMethods.SendNanoContractTx: return sendNanoContractTx( request as SendNanoContractRpcRequest, wallet, diff --git a/packages/hathor-rpc-handler/src/types/rpcResponse.ts b/packages/hathor-rpc-handler/src/types/rpcResponse.ts index 2cb3262..f05e48a 100644 --- a/packages/hathor-rpc-handler/src/types/rpcResponse.ts +++ b/packages/hathor-rpc-handler/src/types/rpcResponse.ts @@ -82,4 +82,5 @@ export type RpcResponse = GetAddressResponse | GetBalanceResponse | GetConnectedNetworkResponse | CreateTokenResponse + | SignOracleDataResponse | GetUtxosResponse;