@lerna-labs/hydra-sdk 1.0.0-beta.15 → 1.0.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,10 @@ import { MeshWallet } from '@meshsdk/core';
5
5
  * Reads the Cardano signing key from `HYDRA_ADMIN_KEY_FILE` (preferred)
6
6
  * or falls back to `HYDRA_ADMIN_CARDANO_PK`. Network is selected via `HYDRA_NETWORK`.
7
7
  *
8
+ * @param blockfrostProjectId - Optional Blockfrost project ID. When provided, the wallet
9
+ * is configured with a Blockfrost fetcher and submitter for L1 operations (e.g. preparing
10
+ * the Hydra head, querying UTxOs, submitting commit transactions).
8
11
  * @returns An initialized MeshWallet ready for signing transactions.
9
12
  * @throws If no signing key is available or the wallet fails to initialize.
10
13
  */
11
- export declare function getAdmin(): Promise<MeshWallet>;
14
+ export declare function getAdmin(blockfrostProjectId?: string): Promise<MeshWallet>;
@@ -1,5 +1,5 @@
1
1
  import { readFileSync } from 'node:fs';
2
- import { MeshWallet } from '@meshsdk/core';
2
+ import { BlockfrostProvider, MeshWallet } from '@meshsdk/core';
3
3
  import { optionalEnv } from '../config.js';
4
4
  /**
5
5
  * Create and initialize a MeshWallet for the Hydra head admin.
@@ -7,10 +7,13 @@ import { optionalEnv } from '../config.js';
7
7
  * Reads the Cardano signing key from `HYDRA_ADMIN_KEY_FILE` (preferred)
8
8
  * or falls back to `HYDRA_ADMIN_CARDANO_PK`. Network is selected via `HYDRA_NETWORK`.
9
9
  *
10
+ * @param blockfrostProjectId - Optional Blockfrost project ID. When provided, the wallet
11
+ * is configured with a Blockfrost fetcher and submitter for L1 operations (e.g. preparing
12
+ * the Hydra head, querying UTxOs, submitting commit transactions).
10
13
  * @returns An initialized MeshWallet ready for signing transactions.
11
14
  * @throws If no signing key is available or the wallet fails to initialize.
12
15
  */
13
- export async function getAdmin() {
16
+ export async function getAdmin(blockfrostProjectId) {
14
17
  let keyCborHex = null;
15
18
  // Preferred: read the instance's cardano.sk file directly (no secrets in .env)
16
19
  const keyFile = process.env.HYDRA_ADMIN_KEY_FILE;
@@ -32,13 +35,19 @@ export async function getAdmin() {
32
35
  else if (networkId > 1) {
33
36
  networkId = 1;
34
37
  }
35
- const wallet = new MeshWallet({
38
+ const walletOptions = {
36
39
  networkId: networkId,
37
40
  key: {
38
41
  type: 'cli',
39
42
  payment: keyCborHex,
40
43
  },
41
- });
44
+ };
45
+ if (blockfrostProjectId) {
46
+ const blockfrost = new BlockfrostProvider(blockfrostProjectId);
47
+ walletOptions.fetcher = blockfrost;
48
+ walletOptions.submitter = blockfrost;
49
+ }
50
+ const wallet = new MeshWallet(walletOptions);
42
51
  await wallet.init();
43
52
  if (!wallet.addresses.enterpriseAddressBech32) {
44
53
  throw new Error('Wallet failed to initialize!');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lerna-labs/hydra-sdk",
3
- "version": "1.0.0-beta.15",
3
+ "version": "1.0.0-beta.16",
4
4
  "description": "TypeScript SDK for managing Cardano Hydra Heads — lifecycle, UTxO queries, wallet management, transaction submission, and signature verification",
5
5
  "keywords": [
6
6
  "cardano",