@dynamic-labs/midnight 4.95.2 → 4.96.0

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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,17 @@
1
1
 
2
+ ## [4.96.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.95.2...v4.96.0) (2026-08-03)
3
+
4
+
5
+ ### Features
6
+
7
+ * **midnight:** add contract wallet provider support ([#12133](https://github.com/dynamic-labs/dynamic-auth/issues/12133)) ([f649ce4](https://github.com/dynamic-labs/dynamic-auth/commit/f649ce47101b439542e8db1c802a4a372fb45eb2))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **starknet:** restore Braavos L2 session after lock and unlock ([#12125](https://github.com/dynamic-labs/dynamic-auth/issues/12125)) ([9ea226f](https://github.com/dynamic-labs/dynamic-auth/commit/9ea226f1dd2a58e3087c267d74cfe79452ddaeff))
13
+ * **wallet-book:** add universal deep link for Exodus Solana WalletConnect ([168dba5](https://github.com/dynamic-labs/dynamic-auth/commit/168dba5aa6076a769b78394eef093c91948b3c91)), closes [#12123](https://github.com/dynamic-labs/dynamic-auth/issues/12123)
14
+
2
15
  ### [4.95.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.95.1...v4.95.2) (2026-07-30)
3
16
 
4
17
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.95.2";
6
+ var version = "4.96.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.95.2";
2
+ var version = "4.96.0";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/midnight",
3
- "version": "4.95.2",
3
+ "version": "4.96.0",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/assert-package-version": "4.95.2",
21
+ "@dynamic-labs/assert-package-version": "4.96.0",
22
22
  "@dynamic-labs/sdk-api-core": "0.0.1093",
23
23
  "@midnight-ntwrk/dapp-connector-api": "4.0.1",
24
- "@dynamic-labs/logger": "4.95.2",
25
- "@dynamic-labs/types": "4.95.2",
26
- "@dynamic-labs/utils": "4.95.2",
27
- "@dynamic-labs/waas": "4.95.2",
28
- "@dynamic-labs/wallet-book": "4.95.2",
29
- "@dynamic-labs/wallet-connector-core": "4.95.2"
24
+ "@dynamic-labs/logger": "4.96.0",
25
+ "@dynamic-labs/types": "4.96.0",
26
+ "@dynamic-labs/utils": "4.96.0",
27
+ "@dynamic-labs/waas": "4.96.0",
28
+ "@dynamic-labs/wallet-book": "4.96.0",
29
+ "@dynamic-labs/wallet-connector-core": "4.96.0"
30
30
  },
31
31
  "peerDependencies": {}
32
32
  }
package/src/types.d.ts CHANGED
@@ -22,6 +22,38 @@ export type MidnightTransaction = {
22
22
  circuitCalls: MidnightCircuitCall[];
23
23
  fee?: number;
24
24
  };
25
+ /**
26
+ * Minimal structural view of a ledger transaction — only what is needed to move
27
+ * one across the embedded-wallet boundary.
28
+ */
29
+ export type MidnightSerializableTransaction = {
30
+ serialize(): Uint8Array;
31
+ };
32
+ /**
33
+ * midnight-js compatible wallet and submission provider backed by an embedded
34
+ * wallet. Structurally equivalent to `WalletProvider & MidnightProvider` from
35
+ * `@midnight-ntwrk/midnight-js/types`, declared here rather than imported so
36
+ * this package carries no dependency on the consumer's midnight-js or
37
+ * ledger-v8 version.
38
+ *
39
+ * Transaction objects are deliberately structural so consumers can use their
40
+ * installed midnight-js/ledger version without sharing secret key state.
41
+ * Parameterise with the consumer's own `UnboundTransaction` and
42
+ * `FinalizedTransaction` to get a provider assignable to `MidnightProviders`:
43
+ *
44
+ * ```ts
45
+ * const walletProvider = await wallet.getWalletProvider<
46
+ * UnboundTransaction,
47
+ * FinalizedTransaction
48
+ * >();
49
+ * ```
50
+ */
51
+ export type MidnightContractWalletProvider<TUnboundTransaction extends MidnightSerializableTransaction = MidnightSerializableTransaction, TFinalizedTransaction extends MidnightSerializableTransaction = MidnightSerializableTransaction> = {
52
+ balanceTx(tx: TUnboundTransaction, ttl?: Date): Promise<TFinalizedTransaction>;
53
+ getCoinPublicKey(): string;
54
+ getEncryptionPublicKey(): string;
55
+ submitTx(tx: TFinalizedTransaction): Promise<string>;
56
+ };
25
57
  /**
26
58
  * Minimal interface for the Midnight wallet provider injected into window.
27
59
  *
@@ -163,6 +163,31 @@ class DynamicWaasMidnightConnector extends waas.withDynamicWaas(WaasMidnightWall
163
163
  midnightNetworkParam() {
164
164
  return { networkId: this.getSelectedMidnightNetwork() };
165
165
  }
166
+ getWalletProviderRequestParams(accountAddress, networkId) {
167
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
168
+ var _a, _b, _c;
169
+ if (this.activeAccountAddress !== accountAddress) {
170
+ throw new utils.DynamicError('The active Midnight wallet changed after the contract wallet provider was created', 'midnight_wallet_provider_account_changed');
171
+ }
172
+ const signedSessionId = yield this.requireSignedSessionId();
173
+ const mfaToken = yield ((_a = this.getMfaToken) === null || _a === void 0 ? void 0 : _a.call(this, {
174
+ mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
175
+ }));
176
+ const password = yield this.getPasswordIfNeeded({ accountAddress });
177
+ const elevatedAccessToken = yield ((_b = this.getElevatedAccessToken) === null || _b === void 0 ? void 0 : _b.call(this, {
178
+ scope: sdkApiCore.TokenScope.Walletsign,
179
+ }));
180
+ return {
181
+ accountAddress,
182
+ authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
183
+ elevatedAccessToken,
184
+ mfaToken,
185
+ networkId,
186
+ password,
187
+ signedSessionId,
188
+ };
189
+ });
190
+ }
166
191
  /**
167
192
  * Gets the active wallet address for the selected network.
168
193
  *
@@ -370,6 +395,67 @@ class DynamicWaasMidnightConnector extends waas.withDynamicWaas(WaasMidnightWall
370
395
  getProvider() {
371
396
  return undefined;
372
397
  }
398
+ /**
399
+ * Returns a midnight-js compatible provider whose wallet-bound operations
400
+ * execute inside the embedded-wallet iframe. Only public keys and serialized
401
+ * transactions cross the iframe boundary.
402
+ */
403
+ getWalletProvider() {
404
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
405
+ this.ensureActiveAccountFromVerifiedCredentials();
406
+ if (!this.activeAccountAddress) {
407
+ throw new utils.DynamicError('Active account address is required', 'active_account_address_is_required');
408
+ }
409
+ const accountAddress = this.activeAccountAddress;
410
+ const networkId = this.getSelectedMidnightNetwork();
411
+ const walletClient = (yield this.getWaasWalletClient());
412
+ // The cast above asserts RPCs that older embedded-wallet clients do not
413
+ // expose. Without this check the caller gets an unattributable
414
+ // "is not a function" TypeError instead of the actual cause.
415
+ const missingRpcs = ['getWalletProvider', 'balanceWalletProviderTransaction'].filter((rpc) => typeof walletClient[rpc] !== 'function');
416
+ if (missingRpcs.length > 0) {
417
+ throw new utils.DynamicError(`The embedded wallet client does not support Midnight contract wallet providers (missing: ${missingRpcs.join(', ')}). Upgrade @dynamic-labs-wallet/browser-wallet-client to a version that exposes these operations.`, 'midnight_wallet_provider_unsupported_client');
418
+ }
419
+ const initParams = yield this.getWalletProviderRequestParams(accountAddress, networkId);
420
+ const { coinPublicKey, encryptionPublicKey } = yield walletClient.getWalletProvider(initParams);
421
+ return {
422
+ balanceTx: (transaction, ttl) => _tslib.__awaiter(this, void 0, void 0, function* () {
423
+ const requestParams = yield this.getWalletProviderRequestParams(accountAddress, networkId);
424
+ const transactionConstructor = transaction.constructor;
425
+ // Reached through `transaction.constructor` so this package never
426
+ // imports ledger-v8 and stays free of the consumer's ledger version.
427
+ // The type constraint only guarantees `serialize()`, so the static is
428
+ // checked rather than assumed — a wrapped or proxied transaction would
429
+ // otherwise fail with a bare "deserialize is not a function". Checked
430
+ // before the balance call below so a wrapper transaction fails
431
+ // side-effect free, rather than after UTXOs are already reserved.
432
+ if (typeof (transactionConstructor === null || transactionConstructor === void 0 ? void 0 : transactionConstructor.deserialize) !== 'function') {
433
+ throw new utils.DynamicError('The transaction passed to balanceTx has no static deserialize; pass a ledger Transaction rather than a wrapper', 'midnight_transaction_not_deserializable');
434
+ }
435
+ const response = yield walletClient.balanceWalletProviderTransaction(Object.assign(Object.assign({}, requestParams), { transaction: utils.uint8ArrayToBase64(transaction.serialize()), ttl: ttl === null || ttl === void 0 ? void 0 : ttl.toISOString() }));
436
+ return transactionConstructor.deserialize('signature', 'proof', 'binding', utils.uint8ArrayFromBase64(response.transaction));
437
+ }),
438
+ getCoinPublicKey: () => coinPublicKey,
439
+ getEncryptionPublicKey: () => encryptionPublicKey,
440
+ submitTx: (transaction) => _tslib.__awaiter(this, void 0, void 0, function* () {
441
+ const requestParams = yield this.getWalletProviderRequestParams(accountAddress, networkId);
442
+ // `txIdentifier` is newer than the published client's type, so it is
443
+ // read through a cast: this compiles against both, and an older client
444
+ // simply degrades to the hash.
445
+ const { txHash, txIdentifier } = (yield walletClient.submitTransaction(Object.assign(Object.assign({}, requestParams), { transaction: utils.uint8ArrayToBase64(transaction.serialize()) })));
446
+ // Balances changed — drop the snapshot so the next send fetches fresh.
447
+ this.clearSendBalanceCache();
448
+ // midnight-js treats this return value as a TransactionId and polls
449
+ // `transactions(offset: { identifier })` to observe inclusion. The
450
+ // canonical hash is a different value and never matches, so returning
451
+ // it leaves callers such as deployContract waiting on a transaction
452
+ // that already succeeded. Prefer the submission identifier; fall back
453
+ // to the hash for older wallet clients that do not return it.
454
+ return txIdentifier !== null && txIdentifier !== void 0 ? txIdentifier : txHash;
455
+ }),
456
+ };
457
+ });
458
+ }
373
459
  /**
374
460
  * Creates a new Midnight wallet account.
375
461
  * Midnight wallets automatically create multiple address types:
@@ -3,7 +3,7 @@ import { JwtVerifiedCredential, MFAAction, SignMessageContext, TokenScope } from
3
3
  import { IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
4
4
  import { IDynamicWaasConnector, InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
5
5
  import { Logger } from '@dynamic-labs/logger';
6
- import type { DynamicWaasMidnightConnectorProps } from '../../types';
6
+ import type { DynamicWaasMidnightConnectorProps, MidnightContractWalletProvider, MidnightSerializableTransaction } from '../../types';
7
7
  import { MidnightWallet } from '../../wallet/MidnightWallet';
8
8
  import { WaasMidnightWalletConnector } from '../WaasMidnightWalletConnector';
9
9
  declare const DynamicWaasMidnightConnector_base: (abstract new (...args: any[]) => {
@@ -137,12 +137,6 @@ declare const DynamicWaasMidnightConnector_base: (abstract new (...args: any[])
137
137
  displayContainer: HTMLElement;
138
138
  }): Promise<void>;
139
139
  hideICloudSignIn(): Promise<void>;
140
- /**
141
- * Spread into wallet-client calls. Published browser-wallet-client builds
142
- * that predate per-network support don't declare `networkId` — spreading a
143
- * non-literal keeps this compiling against those types; older clients drop
144
- * the field and default to preview.
145
- */
146
140
  isICloudAuthenticated(): Promise<boolean>;
147
141
  refreshWalletAccountShares({ accountAddress, password, }: {
148
142
  accountAddress: string;
@@ -150,7 +144,12 @@ declare const DynamicWaasMidnightConnector_base: (abstract new (...args: any[])
150
144
  }): Promise<void>;
151
145
  reshareWalletAccountShares({ accountAddress, thresholdSignatureScheme, password, }: {
152
146
  accountAddress: string;
153
- thresholdSignatureScheme: string;
147
+ thresholdSignatureScheme: string; /**
148
+ * Spread into wallet-client calls. Published browser-wallet-client builds
149
+ * that predate per-network support don't declare `networkId` — spreading a
150
+ * non-literal keeps this compiling against those types; older clients drop
151
+ * the field and default to preview.
152
+ */
154
153
  password?: string | undefined;
155
154
  }): Promise<void>;
156
155
  revokeDelegation({ accountAddress, password, }: {
@@ -302,6 +301,7 @@ export declare class DynamicWaasMidnightConnector extends DynamicWaasMidnightCon
302
301
  * the field and default to preview.
303
302
  */
304
303
  private midnightNetworkParam;
304
+ private getWalletProviderRequestParams;
305
305
  /**
306
306
  * Gets the active wallet address for the selected network.
307
307
  *
@@ -363,6 +363,12 @@ export declare class DynamicWaasMidnightConnector extends DynamicWaasMidnightCon
363
363
  * For WaaS, there is no traditional browser provider.
364
364
  */
365
365
  getProvider(): undefined;
366
+ /**
367
+ * Returns a midnight-js compatible provider whose wallet-bound operations
368
+ * execute inside the embedded-wallet iframe. Only public keys and serialized
369
+ * transactions cross the iframe boundary.
370
+ */
371
+ getWalletProvider<TUnboundTransaction extends MidnightSerializableTransaction = MidnightSerializableTransaction, TFinalizedTransaction extends MidnightSerializableTransaction = MidnightSerializableTransaction>(): Promise<MidnightContractWalletProvider<TUnboundTransaction, TFinalizedTransaction>>;
366
372
  /**
367
373
  * Creates a new Midnight wallet account.
368
374
  * Midnight wallets automatically create multiple address types:
@@ -1,7 +1,7 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../_virtual/_tslib.js';
3
3
  import { MFAAction, TokenScope } from '@dynamic-labs/sdk-api-core';
4
- import { DynamicError } from '@dynamic-labs/utils';
4
+ import { DynamicError, uint8ArrayToBase64, uint8ArrayFromBase64 } from '@dynamic-labs/utils';
5
5
  import { withDynamicWaas } from '@dynamic-labs/waas';
6
6
  import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
7
7
  import { Logger } from '@dynamic-labs/logger';
@@ -159,6 +159,31 @@ class DynamicWaasMidnightConnector extends withDynamicWaas(WaasMidnightWalletCon
159
159
  midnightNetworkParam() {
160
160
  return { networkId: this.getSelectedMidnightNetwork() };
161
161
  }
162
+ getWalletProviderRequestParams(accountAddress, networkId) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ var _a, _b, _c;
165
+ if (this.activeAccountAddress !== accountAddress) {
166
+ throw new DynamicError('The active Midnight wallet changed after the contract wallet provider was created', 'midnight_wallet_provider_account_changed');
167
+ }
168
+ const signedSessionId = yield this.requireSignedSessionId();
169
+ const mfaToken = yield ((_a = this.getMfaToken) === null || _a === void 0 ? void 0 : _a.call(this, {
170
+ mfaAction: MFAAction.WalletWaasSign,
171
+ }));
172
+ const password = yield this.getPasswordIfNeeded({ accountAddress });
173
+ const elevatedAccessToken = yield ((_b = this.getElevatedAccessToken) === null || _b === void 0 ? void 0 : _b.call(this, {
174
+ scope: TokenScope.Walletsign,
175
+ }));
176
+ return {
177
+ accountAddress,
178
+ authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
179
+ elevatedAccessToken,
180
+ mfaToken,
181
+ networkId,
182
+ password,
183
+ signedSessionId,
184
+ };
185
+ });
186
+ }
162
187
  /**
163
188
  * Gets the active wallet address for the selected network.
164
189
  *
@@ -366,6 +391,67 @@ class DynamicWaasMidnightConnector extends withDynamicWaas(WaasMidnightWalletCon
366
391
  getProvider() {
367
392
  return undefined;
368
393
  }
394
+ /**
395
+ * Returns a midnight-js compatible provider whose wallet-bound operations
396
+ * execute inside the embedded-wallet iframe. Only public keys and serialized
397
+ * transactions cross the iframe boundary.
398
+ */
399
+ getWalletProvider() {
400
+ return __awaiter(this, void 0, void 0, function* () {
401
+ this.ensureActiveAccountFromVerifiedCredentials();
402
+ if (!this.activeAccountAddress) {
403
+ throw new DynamicError('Active account address is required', 'active_account_address_is_required');
404
+ }
405
+ const accountAddress = this.activeAccountAddress;
406
+ const networkId = this.getSelectedMidnightNetwork();
407
+ const walletClient = (yield this.getWaasWalletClient());
408
+ // The cast above asserts RPCs that older embedded-wallet clients do not
409
+ // expose. Without this check the caller gets an unattributable
410
+ // "is not a function" TypeError instead of the actual cause.
411
+ const missingRpcs = ['getWalletProvider', 'balanceWalletProviderTransaction'].filter((rpc) => typeof walletClient[rpc] !== 'function');
412
+ if (missingRpcs.length > 0) {
413
+ throw new DynamicError(`The embedded wallet client does not support Midnight contract wallet providers (missing: ${missingRpcs.join(', ')}). Upgrade @dynamic-labs-wallet/browser-wallet-client to a version that exposes these operations.`, 'midnight_wallet_provider_unsupported_client');
414
+ }
415
+ const initParams = yield this.getWalletProviderRequestParams(accountAddress, networkId);
416
+ const { coinPublicKey, encryptionPublicKey } = yield walletClient.getWalletProvider(initParams);
417
+ return {
418
+ balanceTx: (transaction, ttl) => __awaiter(this, void 0, void 0, function* () {
419
+ const requestParams = yield this.getWalletProviderRequestParams(accountAddress, networkId);
420
+ const transactionConstructor = transaction.constructor;
421
+ // Reached through `transaction.constructor` so this package never
422
+ // imports ledger-v8 and stays free of the consumer's ledger version.
423
+ // The type constraint only guarantees `serialize()`, so the static is
424
+ // checked rather than assumed — a wrapped or proxied transaction would
425
+ // otherwise fail with a bare "deserialize is not a function". Checked
426
+ // before the balance call below so a wrapper transaction fails
427
+ // side-effect free, rather than after UTXOs are already reserved.
428
+ if (typeof (transactionConstructor === null || transactionConstructor === void 0 ? void 0 : transactionConstructor.deserialize) !== 'function') {
429
+ throw new DynamicError('The transaction passed to balanceTx has no static deserialize; pass a ledger Transaction rather than a wrapper', 'midnight_transaction_not_deserializable');
430
+ }
431
+ const response = yield walletClient.balanceWalletProviderTransaction(Object.assign(Object.assign({}, requestParams), { transaction: uint8ArrayToBase64(transaction.serialize()), ttl: ttl === null || ttl === void 0 ? void 0 : ttl.toISOString() }));
432
+ return transactionConstructor.deserialize('signature', 'proof', 'binding', uint8ArrayFromBase64(response.transaction));
433
+ }),
434
+ getCoinPublicKey: () => coinPublicKey,
435
+ getEncryptionPublicKey: () => encryptionPublicKey,
436
+ submitTx: (transaction) => __awaiter(this, void 0, void 0, function* () {
437
+ const requestParams = yield this.getWalletProviderRequestParams(accountAddress, networkId);
438
+ // `txIdentifier` is newer than the published client's type, so it is
439
+ // read through a cast: this compiles against both, and an older client
440
+ // simply degrades to the hash.
441
+ const { txHash, txIdentifier } = (yield walletClient.submitTransaction(Object.assign(Object.assign({}, requestParams), { transaction: uint8ArrayToBase64(transaction.serialize()) })));
442
+ // Balances changed — drop the snapshot so the next send fetches fresh.
443
+ this.clearSendBalanceCache();
444
+ // midnight-js treats this return value as a TransactionId and polls
445
+ // `transactions(offset: { identifier })` to observe inclusion. The
446
+ // canonical hash is a different value and never matches, so returning
447
+ // it leaves callers such as deployContract waiting on a transaction
448
+ // that already succeeded. Prefer the submission identifier; fall back
449
+ // to the hash for older wallet clients that do not return it.
450
+ return txIdentifier !== null && txIdentifier !== void 0 ? txIdentifier : txHash;
451
+ }),
452
+ };
453
+ });
454
+ }
369
455
  /**
370
456
  * Creates a new Midnight wallet account.
371
457
  * Midnight wallets automatically create multiple address types:
@@ -89,6 +89,16 @@ class MidnightWallet extends walletConnectorCore.Wallet {
89
89
  });
90
90
  }
91
91
  // Exclusive for embedded Midnight wallets
92
+ /** Creates a midnight-js provider backed by the embedded-wallet iframe. */
93
+ getWalletProvider() {
94
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
95
+ const connector = this._connector;
96
+ if (!connector.getWalletProvider) {
97
+ throw new Error('Contract wallet providers are only supported for embedded Midnight wallets');
98
+ }
99
+ return connector.getWalletProvider();
100
+ });
101
+ }
92
102
  /** Builds an unsigned transaction from one or more transfer specs (step 1). */
93
103
  createTransferTransaction(...args) {
94
104
  return this._connector.createTransferTransaction(...args);
@@ -2,6 +2,7 @@ import { TokenType } from '@midnight-ntwrk/dapp-connector-api';
2
2
  import { type MidnightFormattedBalances, Wallet } from '@dynamic-labs/wallet-connector-core';
3
3
  import { WalletAddressType } from '@dynamic-labs/sdk-api-core';
4
4
  import { MidnightWalletConnector } from '../connectors/MidnightWalletConnector';
5
+ import type { MidnightContractWalletProvider, MidnightSerializableTransaction } from '../types';
5
6
  export declare class MidnightWallet extends Wallet<MidnightWalletConnector> {
6
7
  sendBalance({ amount, toAddress, token, }: {
7
8
  amount: string;
@@ -29,6 +30,8 @@ export declare class MidnightWallet extends Wallet<MidnightWalletConnector> {
29
30
  cap: string;
30
31
  }>;
31
32
  getFormattedBalances(): Promise<MidnightFormattedBalances>;
33
+ /** Creates a midnight-js provider backed by the embedded-wallet iframe. */
34
+ getWalletProvider<TUnboundTransaction extends MidnightSerializableTransaction = MidnightSerializableTransaction, TFinalizedTransaction extends MidnightSerializableTransaction = MidnightSerializableTransaction>(): Promise<MidnightContractWalletProvider<TUnboundTransaction, TFinalizedTransaction>>;
32
35
  /** Builds an unsigned transaction from one or more transfer specs (step 1). */
33
36
  createTransferTransaction(...args: Parameters<MidnightWalletConnector['createTransferTransaction']>): ReturnType<MidnightWalletConnector['createTransferTransaction']>;
34
37
  /** Signs and ZK-proves an unsigned transaction via MPC (step 2). */
@@ -85,6 +85,16 @@ class MidnightWallet extends Wallet {
85
85
  });
86
86
  }
87
87
  // Exclusive for embedded Midnight wallets
88
+ /** Creates a midnight-js provider backed by the embedded-wallet iframe. */
89
+ getWalletProvider() {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ const connector = this._connector;
92
+ if (!connector.getWalletProvider) {
93
+ throw new Error('Contract wallet providers are only supported for embedded Midnight wallets');
94
+ }
95
+ return connector.getWalletProvider();
96
+ });
97
+ }
88
98
  /** Builds an unsigned transaction from one or more transfer specs (step 1). */
89
99
  createTransferTransaction(...args) {
90
100
  return this._connector.createTransferTransaction(...args);