Skip to content

Commit

Permalink
fix: improved session handling and logging (#327)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
Co-authored-by: Tyler McDonald <tyler@hgraph.io>
  • Loading branch information
kantorcodes and tmctl authored Nov 13, 2024
1 parent 18560ab commit cb75b86
Show file tree
Hide file tree
Showing 13 changed files with 1,862 additions and 436 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ dist
*.sw[a-z]
**/.idea
.docusaurus**
.DS_Store
.DS_Store
coverage
2 changes: 1 addition & 1 deletion demos/react-dapp/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
transactionToBase64String,
SignAndExecuteQueryParams,
ExecuteTransactionParams,
} from '@hashgraph/hedera-wallet-connect'
} from '../../../dist/src/index'

import React, { useEffect, useMemo, useState } from 'react'
import Modal from './components/Modal'
Expand Down
19 changes: 18 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,28 @@ const config: Config = {
fakeTimers: {
enableGlobally: true,
},
testMatch: ['**/?(*.)+(spec|test).ts?(x)', '!**/DAppConnector.test.ts', '!**/wallet*/**'],
testMatch: ['**/?(*.)+(spec|test).ts?(x)'],
transform: {
'^.+\\.(t|j)sx?$': '@swc/jest',
},
transformIgnorePatterns: ['node_modules/(?!@walletconnect)'],
testEnvironment: 'node',
coverageDirectory: 'coverage',
collectCoverageFrom: [
'src/**/*.{js,ts}',
'!src/**/*.d.ts',
'!src/**/*.test.{js,ts}',
'!src/**/*.config.{js,ts}',
],
coverageReporters: ['text-summary', 'html'],
coverageThreshold: {
global: {
branches: 50,
functions: 50,
lines: 50,
statements: 50,
},
},
}

export default config
39 changes: 18 additions & 21 deletions package-lock.json

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

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@hashgraph/hedera-wallet-connect",
"version": "1.3.5",
"version": "1.3.6",
"description": "A library to facilitate integrating Hedera with WalletConnect",
"repository": {
"type": "git",
"url": "git+https://github.com/hashgraph/hedera-wallet-connect.git"
},
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"author": "Hgraph <support@hgraph.io>",
"keywords": [
"hedera",
Expand All @@ -32,6 +32,7 @@
"husky": "^9.0.6",
"jest": "^29.7.0",
"lint-staged": "^15.1.0",
"long": "^5.2.3",
"lokijs": "^1.5.12",
"nodemon": "^3.0.3",
"prettier": "^3.2.4",
Expand Down Expand Up @@ -61,7 +62,9 @@
"prettier:check": "prettier --check ./src/",
"prettier:fix": "prettier --write ./src/",
"prod:docs-docker": "sh docker-run.sh",
"test:sigMap": "jest --testMatch '**/SignatureMapHelpers.test.ts' --verbose"
"test:sigMap": "jest --testMatch '**/SignatureMapHelpers.test.ts' --verbose",
"test:coverage": "jest --coverage",
"test:coverage:html": "jest --coverage --coverageReporters='text-summary' --coverageReporters='html'"
},
"peerDependencies": {
"@hashgraph/sdk": "^2.40.0",
Expand Down
6 changes: 5 additions & 1 deletion src/lib/dapp/DAppSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
TransactionRecordQuery,
} from '@hashgraph/sdk'
import { proto } from '@hashgraph/proto'
import type { ISignClient } from '@walletconnect/types'
import type { CoreTypes, ISignClient } from '@walletconnect/types'

import {
HederaJsonRpcMethod,
Expand Down Expand Up @@ -139,6 +139,10 @@ export class DAppSigner implements Signer {
return this.call(new AccountRecordsQuery().setAccountId(this.accountId))
}

getMetadata(): CoreTypes.Metadata {
return this.signClient.metadata
}

async sign(
data: Uint8Array[],
signOptions?: Record<string, any>,
Expand Down
Loading

0 comments on commit cb75b86

Please sign in to comment.