Skip to content

Commit 5bb518a

Browse files
committed
feat(wallet-gateway-remote): added connectivity status to login
Signed-off-by: phillip olesen <[email protected]>
1 parent bc623c7 commit 5bb518a

File tree

12 files changed

+72
-14160
lines changed

12 files changed

+72
-14160
lines changed

api-specs/ledger-api/3.4.0/openapi.yaml

Lines changed: 0 additions & 6833 deletions
This file was deleted.

api-specs/ledger-api/3.4.7/openapi.yaml

Lines changed: 0 additions & 7318 deletions
This file was deleted.

core/rpc-generator/templates/client/typescript/_package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"version": "0.0.0",
44
"type": "module",
55
"description": "TypeScript client generated by OpenRPC",
6-
"repository": "github:hyperledger-labs/splice-wallet-kernel",
76
"license": "Apache-2.0",
87
"main": "dist/index.cjs",
98
"module": "dist/index.js",
@@ -42,5 +41,9 @@
4241
"tsup": "^8.5.1",
4342
"typedoc": "^0.28.14",
4443
"typescript": "^5.9.3"
44+
},
45+
"repository": {
46+
"type": "git",
47+
"url": "git+https://github.com/hyperledger-labs/splice-wallet-kernel.git"
4548
}
4649
}

core/wallet-dapp-remote-rpc-client/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
},
4747
"repository": {
4848
"type": "git",
49-
"url": "git+https://github.com/hyperledger-labs/splice-wallet-kernel.git",
50-
"directory": "core/wallet-dapp-remote-rpc-client"
49+
"url": "git+https://github.com/hyperledger-labs/splice-wallet-kernel.git"
5150
}
5251
}

core/wallet-dapp-rpc-client/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
},
4747
"repository": {
4848
"type": "git",
49-
"url": "git+https://github.com/hyperledger-labs/splice-wallet-kernel.git",
50-
"directory": "core/wallet-dapp-rpc-client"
49+
"url": "git+https://github.com/hyperledger-labs/splice-wallet-kernel.git"
5150
}
5251
}

core/wallet-store-inmemory/src/StoreInternal.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,31 @@ export class StoreInternal implements Store, AuthAware<StoreInternal> {
363363
if (networkAlreadyExists) {
364364
throw new Error(`Network ${network.id} already exists`)
365365
} else {
366-
this.systemStorage.networks.push(network)
366+
//connectivity test
367+
const ledgerClient = new LedgerClient({
368+
baseUrl: new URL(network.ledgerApi.baseUrl),
369+
logger: this.logger,
370+
})
371+
let connectivityCheck = false
372+
this.logger.info(
373+
`Checking connectivity to ledger at ${network.ledgerApi.baseUrl}`
374+
)
375+
376+
try {
377+
const version = await ledgerClient.get('/v2/version')
378+
if (version.version) {
379+
connectivityCheck = true
380+
}
381+
} catch (error) {
382+
this.logger.warn(
383+
`Failed to connect to ledger at ${network.ledgerApi.baseUrl}: ${error}`
384+
)
385+
}
386+
387+
this.systemStorage.networks.push({
388+
...network,
389+
verified: connectivityCheck,
390+
})
367391
}
368392
}
369393

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
import { Kysely } from 'kysely'
5+
import { DB } from '../schema.js'
6+
7+
export async function up(db: Kysely<DB>): Promise<void> {
8+
console.log('Adding verfied to network table')
9+
10+
await db.schema
11+
.alterTable('networks')
12+
.addColumn('verified', 'boolean')
13+
.execute()
14+
}
15+
16+
export async function down(db: Kysely<DB>): Promise<void> {
17+
await db.schema.alterTable('networks').dropColumn('verified').execute()
18+
}

core/wallet-store-sql/src/schema.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ interface NetworkTable {
3333

3434
auth: string // json stringified
3535
adminAuth: string | undefined // json stringified
36+
verified: number | undefined
3637
}
3738

3839
interface WalletTable {
@@ -129,6 +130,8 @@ export const toNetwork = (table: NetworkTable): Network => {
129130
adminAuth: table.adminAuth
130131
? authSchema.parse(JSON.parse(table.adminAuth))
131132
: undefined,
133+
verified:
134+
table.verified !== undefined ? table.verified === 1 : undefined,
132135
}
133136
}
134137

@@ -148,6 +151,12 @@ export const fromNetwork = (
148151
adminAuth: network.adminAuth
149152
? JSON.stringify(network.adminAuth)
150153
: undefined,
154+
verified:
155+
network.verified !== undefined
156+
? network.verified
157+
? 1
158+
: 0
159+
: undefined,
151160
}
152161
}
153162

core/wallet-user-rpc-client/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
},
4747
"repository": {
4848
"type": "git",
49-
"url": "git+https://github.com/hyperledger-labs/splice-wallet-kernel.git",
50-
"directory": "core/wallet-user-rpc-client"
49+
"url": "git+https://github.com/hyperledger-labs/splice-wallet-kernel.git"
5150
}
5251
}

core/wallet-user-rpc-client/src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ export interface Auth {
6363
*
6464
*/
6565
export type LedgerApi = string
66+
/**
67+
*
68+
* Indicates whether we were able to verify connectivity with the node.
69+
*
70+
*/
71+
export type Verified = boolean
6672
/**
6773
*
6874
* Structure representing the Networks
@@ -77,6 +83,7 @@ export interface Network {
7783
auth: Auth
7884
adminAuth?: Auth
7985
ledgerApi: LedgerApi
86+
verified?: Verified
8087
}
8188
/**
8289
*

0 commit comments

Comments
 (0)