@partylayer/sdk 0.18.1 → 0.19.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/README.md CHANGED
@@ -125,6 +125,8 @@ await client.disconnect();
125
125
  | Cantor8 | devnet, mainnet | submitTransaction, transactionStatus | No | `@partylayer/adapter-cantor8` |
126
126
  | Bron | devnet, testnet, mainnet | signMessage, signTransaction | Yes | `@partylayer/adapter-bron` |
127
127
  | Nightly | devnet, testnet, mainnet | signMessage, submitTransaction | No | `@partylayer/adapter-nightly` |
128
+ | Cauri Wallet | devnet, mainnet | signMessage, signTransaction, submitTransaction, transactionStatus | No | `@lithiumdigital/cauri-dapp-sdk` |
129
+ | OneSwap V2 Wallet | devnet, mainnet | signMessage, submitTransaction | No | `@oneswap/wallet-cip0103-adapter` |
128
130
  | Send | mainnet | signMessage, submitTransaction, transactionStatus | No | `@partylayer/adapter-send` |
129
131
  | Walley | mainnet, testnet, devnet | signMessage, submitTransaction, transactionStatus | No | `@k2flabs/walley-dapp-sdk` |
130
132
  | WalletConnect | devnet, testnet, mainnet | signMessage, submitTransaction | Yes | `@partylayer/adapter-walletconnect` |
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _partylayer_core from '@partylayer/core';
2
- import { WalletAdapter, NetworkId, OfficialProviderAdapter, OfficialAdapterFactory, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult, CIP0103Provider, CapabilityKey, AdapterDetectResult, AdapterContext, AdapterConnectResult, NetworkHosts, PersistedSession } from '@partylayer/core';
3
- export { AdapterConnectResult, AdapterContext, AdapterDetectResult, AdapterNotRegisteredError, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, LedgerApiParams, LedgerApiResult, METRICS, MetricName, MetricsPayload, NetworkHosts, NetworkId, OfficialAdapterFactory, OfficialProviderAdapter, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TimeoutError, TransactionStatus, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName, isOfficialAdapterFactory, isOfficialProviderAdapter } from '@partylayer/core';
2
+ import { WalletAdapter, NetworkId, OfficialProviderAdapter, OfficialAdapterFactory, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult, TransferIntent, TransferResult, CIP0103Provider, CapabilityKey, AdapterDetectResult, AdapterContext, AdapterConnectResult, NetworkHosts, PersistedSession } from '@partylayer/core';
3
+ export { AdapterConnectResult, AdapterContext, AdapterDetectResult, AdapterNotRegisteredError, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, LedgerApiParams, LedgerApiResult, METRICS, MetricName, MetricsPayload, NetworkHosts, NetworkId, OfficialAdapterFactory, OfficialProviderAdapter, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TRANSFER_INTENT_FIELDS, TimeoutError, TokenInstrumentId, TransactionStatus, TransferIntent, TransferResult, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName, isOfficialAdapterFactory, isOfficialProviderAdapter, toTransferIntent } from '@partylayer/core';
4
4
  import { RegistryClient, RegistryStatus } from '@partylayer/registry-client';
5
5
  export { Cip0103StatusForDetection, Cip0103Support, ProviderDetection, ProviderMatcher, RegistryStatus, deriveGenericWalletName, findMatchingWallet, findMatchingWalletInfo, isCip0103Native, matchesProviderDetection } from '@partylayer/registry-client';
6
6
  export { CANTON_NETWORKS, CIP0103Account, CIP0103ConnectResult, CIP0103Event, CIP0103EventBus, CIP0103Method, CIP0103Network, CIP0103Provider, CIP0103StatusEvent, CIP0103TxChangedEvent, CIP0103TxStatus, CIP0103_EVENTS, CIP0103_MANDATORY_METHODS, CIP0103_METHODS, DiscoveredProvider, JSON_RPC_ERRORS, PartyLayerProvider, PartyLayerProviderOptions, ProviderRpcError, RPC_ERRORS, createProviderBridge, discoverInjectedProviders, fromCAIP2Network, isCIP0103Provider, isValidCAIP2, toCAIP2Network, waitForProvider } from '@partylayer/provider';
@@ -298,7 +298,14 @@ interface SessionNetworkMismatchEvent {
298
298
  interface TxStatusEvent {
299
299
  type: 'tx:status';
300
300
  sessionId: SessionId;
301
- txId: TransactionHash;
301
+ /**
302
+ * The transaction id, when the wallet reported one. Optional for the same
303
+ * reason as `TxReceipt.transactionHash`, which is where it comes from: a
304
+ * wallet with no hash to give produces an event with no id, and saying so
305
+ * beats emitting an invented one. Prefer reading `updateId` off the receipt
306
+ * when you need a ledger identifier.
307
+ */
308
+ txId?: TransactionHash;
302
309
  status: TransactionStatus;
303
310
  raw?: unknown;
304
311
  }
@@ -548,6 +555,20 @@ declare class PartyLayerClient {
548
555
  * Proxy a JSON Ledger API request through the active wallet adapter
549
556
  */
550
557
  ledgerApi(params: LedgerApiParams): Promise<LedgerApiResult>;
558
+ /**
559
+ * Request a typed transfer. The application says what it wants; the wallet
560
+ * builds the command, shows the user what they are authorising, obtains their
561
+ * approval, signs, executes, and returns the real update id.
562
+ *
563
+ * The acting party comes from the active session, never from the caller, and
564
+ * the intent is narrowed to the allowlisted fields before any adapter sees it,
565
+ * so no caller-supplied option can reach the wallet.
566
+ *
567
+ * Throws `CapabilityNotSupportedError` when the active wallet does not
568
+ * implement it. Ask first with `session.capabilitiesSnapshot.includes('transfer')`,
569
+ * or require it at connect with `connect({ requiredCapabilities: ['transfer'] })`.
570
+ */
571
+ requestTransfer(intent: TransferIntent): Promise<TransferResult>;
551
572
  /**
552
573
  * Subscribe to events
553
574
  */
@@ -676,6 +697,15 @@ declare function announcedWalletId(announceId: string): WalletId;
676
697
  interface AnnounceAdapterConfig {
677
698
  /** Enable `on()` — bridge the provider's CIP-0103 `txChanged` → adapter `txStatus`. */
678
699
  events?: boolean;
700
+ /**
701
+ * Whether the wallet supports signMessage. Defaults to true, the CIP-0103
702
+ * baseline, so an entry that omits it is unchanged. Set false for a wallet that
703
+ * answers signMessage with the unsupported code (4200), so the reported
704
+ * capability set omits signMessage and a dApp never offers a sign action that
705
+ * would fail. This can only make the reported set more accurate, never more
706
+ * permissive.
707
+ */
708
+ signMessage?: boolean;
679
709
  /** Enable `restore()` — silent `status()`/`getPrimaryAccount()` probe + party-match. */
680
710
  restore?: boolean;
681
711
  /** Enable `ledgerApi()` — proxy the standard CIP-0103 `ledgerApi` call. */
@@ -735,13 +765,21 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
735
765
  private readonly staticMetadata?;
736
766
  private readonly mapError?;
737
767
  private readonly signMessageBase64;
768
+ /**
769
+ * Which execute verb this wallet turned out to support. Resolved on the first
770
+ * submit and reused, so the wallet is asked at most once.
771
+ */
772
+ private readonly executeVerb;
738
773
  restore?: WalletAdapter['restore'];
739
774
  on?: WalletAdapter['on'];
740
775
  ledgerApi?: WalletAdapter['ledgerApi'];
776
+ signMessage?: WalletAdapter['signMessage'];
741
777
  constructor(args: GenericAnnounceAdapterArgs);
742
778
  /**
743
- * Capabilities: the baseline three plus whatever optional methods were
744
- * configured (derived from actual presence, never advertised when absent).
779
+ * Capabilities derived from actual presence: connect and submitTransaction are
780
+ * always present; signMessage, restore, ledgerApi, and events are each included
781
+ * only when the matching method was assigned, so the set is never advertised
782
+ * beyond what the adapter can do.
745
783
  */
746
784
  getCapabilities(): CapabilityKey[];
747
785
  /**
@@ -751,8 +789,8 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
751
789
  detectInstalled(): Promise<AdapterDetectResult>;
752
790
  connect(ctx: AdapterContext): Promise<AdapterConnectResult>;
753
791
  disconnect(): Promise<void>;
754
- signMessage(_ctx: AdapterContext, session: Session, params: SignMessageParams): Promise<SignedMessage>;
755
- submitTransaction(_ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
792
+ private signMessageImpl;
793
+ submitTransaction(ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
756
794
  /** events: bridge the provider's CIP-0103 `txChanged` push event → `txStatus`. */
757
795
  private makeOn;
758
796
  /** restore: silent status()/getPrimaryAccount() probe + expiry + party-match. */
@@ -851,6 +889,11 @@ declare class GenericDiscoveryAdapter implements WalletAdapter {
851
889
  private networkHosts;
852
890
  /** Lazily resolved from `official.provider()` — NOT at construction (SSR-safe). */
853
891
  private providerInstance;
892
+ /**
893
+ * Which execute verb this wallet turned out to support. Resolved on the first
894
+ * submit and reused, so the wallet is asked at most once.
895
+ */
896
+ private readonly executeVerb;
854
897
  constructor(args: GenericDiscoveryAdapterArgs);
855
898
  /** Whether this bridge resolves its host from `networkHosts` (factory form). */
856
899
  usesFactory(): boolean;
@@ -904,7 +947,7 @@ declare class GenericDiscoveryAdapter implements WalletAdapter {
904
947
  restore(ctx: AdapterContext, persisted: PersistedSession): Promise<Session | null>;
905
948
  disconnect(): Promise<void>;
906
949
  signMessage(_ctx: AdapterContext, _session: Session, params: SignMessageParams): Promise<SignedMessage>;
907
- submitTransaction(_ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
950
+ submitTransaction(ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
908
951
  }
909
952
 
910
953
  /**
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _partylayer_core from '@partylayer/core';
2
- import { WalletAdapter, NetworkId, OfficialProviderAdapter, OfficialAdapterFactory, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult, CIP0103Provider, CapabilityKey, AdapterDetectResult, AdapterContext, AdapterConnectResult, NetworkHosts, PersistedSession } from '@partylayer/core';
3
- export { AdapterConnectResult, AdapterContext, AdapterDetectResult, AdapterNotRegisteredError, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, LedgerApiParams, LedgerApiResult, METRICS, MetricName, MetricsPayload, NetworkHosts, NetworkId, OfficialAdapterFactory, OfficialProviderAdapter, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TimeoutError, TransactionStatus, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName, isOfficialAdapterFactory, isOfficialProviderAdapter } from '@partylayer/core';
2
+ import { WalletAdapter, NetworkId, OfficialProviderAdapter, OfficialAdapterFactory, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult, TransferIntent, TransferResult, CIP0103Provider, CapabilityKey, AdapterDetectResult, AdapterContext, AdapterConnectResult, NetworkHosts, PersistedSession } from '@partylayer/core';
3
+ export { AdapterConnectResult, AdapterContext, AdapterDetectResult, AdapterNotRegisteredError, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, LedgerApiParams, LedgerApiResult, METRICS, MetricName, MetricsPayload, NetworkHosts, NetworkId, OfficialAdapterFactory, OfficialProviderAdapter, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TRANSFER_INTENT_FIELDS, TimeoutError, TokenInstrumentId, TransactionStatus, TransferIntent, TransferResult, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName, isOfficialAdapterFactory, isOfficialProviderAdapter, toTransferIntent } from '@partylayer/core';
4
4
  import { RegistryClient, RegistryStatus } from '@partylayer/registry-client';
5
5
  export { Cip0103StatusForDetection, Cip0103Support, ProviderDetection, ProviderMatcher, RegistryStatus, deriveGenericWalletName, findMatchingWallet, findMatchingWalletInfo, isCip0103Native, matchesProviderDetection } from '@partylayer/registry-client';
6
6
  export { CANTON_NETWORKS, CIP0103Account, CIP0103ConnectResult, CIP0103Event, CIP0103EventBus, CIP0103Method, CIP0103Network, CIP0103Provider, CIP0103StatusEvent, CIP0103TxChangedEvent, CIP0103TxStatus, CIP0103_EVENTS, CIP0103_MANDATORY_METHODS, CIP0103_METHODS, DiscoveredProvider, JSON_RPC_ERRORS, PartyLayerProvider, PartyLayerProviderOptions, ProviderRpcError, RPC_ERRORS, createProviderBridge, discoverInjectedProviders, fromCAIP2Network, isCIP0103Provider, isValidCAIP2, toCAIP2Network, waitForProvider } from '@partylayer/provider';
@@ -298,7 +298,14 @@ interface SessionNetworkMismatchEvent {
298
298
  interface TxStatusEvent {
299
299
  type: 'tx:status';
300
300
  sessionId: SessionId;
301
- txId: TransactionHash;
301
+ /**
302
+ * The transaction id, when the wallet reported one. Optional for the same
303
+ * reason as `TxReceipt.transactionHash`, which is where it comes from: a
304
+ * wallet with no hash to give produces an event with no id, and saying so
305
+ * beats emitting an invented one. Prefer reading `updateId` off the receipt
306
+ * when you need a ledger identifier.
307
+ */
308
+ txId?: TransactionHash;
302
309
  status: TransactionStatus;
303
310
  raw?: unknown;
304
311
  }
@@ -548,6 +555,20 @@ declare class PartyLayerClient {
548
555
  * Proxy a JSON Ledger API request through the active wallet adapter
549
556
  */
550
557
  ledgerApi(params: LedgerApiParams): Promise<LedgerApiResult>;
558
+ /**
559
+ * Request a typed transfer. The application says what it wants; the wallet
560
+ * builds the command, shows the user what they are authorising, obtains their
561
+ * approval, signs, executes, and returns the real update id.
562
+ *
563
+ * The acting party comes from the active session, never from the caller, and
564
+ * the intent is narrowed to the allowlisted fields before any adapter sees it,
565
+ * so no caller-supplied option can reach the wallet.
566
+ *
567
+ * Throws `CapabilityNotSupportedError` when the active wallet does not
568
+ * implement it. Ask first with `session.capabilitiesSnapshot.includes('transfer')`,
569
+ * or require it at connect with `connect({ requiredCapabilities: ['transfer'] })`.
570
+ */
571
+ requestTransfer(intent: TransferIntent): Promise<TransferResult>;
551
572
  /**
552
573
  * Subscribe to events
553
574
  */
@@ -676,6 +697,15 @@ declare function announcedWalletId(announceId: string): WalletId;
676
697
  interface AnnounceAdapterConfig {
677
698
  /** Enable `on()` — bridge the provider's CIP-0103 `txChanged` → adapter `txStatus`. */
678
699
  events?: boolean;
700
+ /**
701
+ * Whether the wallet supports signMessage. Defaults to true, the CIP-0103
702
+ * baseline, so an entry that omits it is unchanged. Set false for a wallet that
703
+ * answers signMessage with the unsupported code (4200), so the reported
704
+ * capability set omits signMessage and a dApp never offers a sign action that
705
+ * would fail. This can only make the reported set more accurate, never more
706
+ * permissive.
707
+ */
708
+ signMessage?: boolean;
679
709
  /** Enable `restore()` — silent `status()`/`getPrimaryAccount()` probe + party-match. */
680
710
  restore?: boolean;
681
711
  /** Enable `ledgerApi()` — proxy the standard CIP-0103 `ledgerApi` call. */
@@ -735,13 +765,21 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
735
765
  private readonly staticMetadata?;
736
766
  private readonly mapError?;
737
767
  private readonly signMessageBase64;
768
+ /**
769
+ * Which execute verb this wallet turned out to support. Resolved on the first
770
+ * submit and reused, so the wallet is asked at most once.
771
+ */
772
+ private readonly executeVerb;
738
773
  restore?: WalletAdapter['restore'];
739
774
  on?: WalletAdapter['on'];
740
775
  ledgerApi?: WalletAdapter['ledgerApi'];
776
+ signMessage?: WalletAdapter['signMessage'];
741
777
  constructor(args: GenericAnnounceAdapterArgs);
742
778
  /**
743
- * Capabilities: the baseline three plus whatever optional methods were
744
- * configured (derived from actual presence, never advertised when absent).
779
+ * Capabilities derived from actual presence: connect and submitTransaction are
780
+ * always present; signMessage, restore, ledgerApi, and events are each included
781
+ * only when the matching method was assigned, so the set is never advertised
782
+ * beyond what the adapter can do.
745
783
  */
746
784
  getCapabilities(): CapabilityKey[];
747
785
  /**
@@ -751,8 +789,8 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
751
789
  detectInstalled(): Promise<AdapterDetectResult>;
752
790
  connect(ctx: AdapterContext): Promise<AdapterConnectResult>;
753
791
  disconnect(): Promise<void>;
754
- signMessage(_ctx: AdapterContext, session: Session, params: SignMessageParams): Promise<SignedMessage>;
755
- submitTransaction(_ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
792
+ private signMessageImpl;
793
+ submitTransaction(ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
756
794
  /** events: bridge the provider's CIP-0103 `txChanged` push event → `txStatus`. */
757
795
  private makeOn;
758
796
  /** restore: silent status()/getPrimaryAccount() probe + expiry + party-match. */
@@ -851,6 +889,11 @@ declare class GenericDiscoveryAdapter implements WalletAdapter {
851
889
  private networkHosts;
852
890
  /** Lazily resolved from `official.provider()` — NOT at construction (SSR-safe). */
853
891
  private providerInstance;
892
+ /**
893
+ * Which execute verb this wallet turned out to support. Resolved on the first
894
+ * submit and reused, so the wallet is asked at most once.
895
+ */
896
+ private readonly executeVerb;
854
897
  constructor(args: GenericDiscoveryAdapterArgs);
855
898
  /** Whether this bridge resolves its host from `networkHosts` (factory form). */
856
899
  usesFactory(): boolean;
@@ -904,7 +947,7 @@ declare class GenericDiscoveryAdapter implements WalletAdapter {
904
947
  restore(ctx: AdapterContext, persisted: PersistedSession): Promise<Session | null>;
905
948
  disconnect(): Promise<void>;
906
949
  signMessage(_ctx: AdapterContext, _session: Session, params: SignMessageParams): Promise<SignedMessage>;
907
- submitTransaction(_ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
950
+ submitTransaction(ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
908
951
  }
909
952
 
910
953
  /**
package/dist/index.js CHANGED
@@ -11,6 +11,64 @@ var adapterSend = require('@partylayer/adapter-send');
11
11
  var adapterBron = require('@partylayer/adapter-bron');
12
12
 
13
13
  // src/client.ts
14
+ var UNSUPPORTED_METHOD = 4200;
15
+ var METHOD_NOT_FOUND = -32601;
16
+ function isUnsupportedMethod(err) {
17
+ const code = err?.code;
18
+ return code === UNSUPPORTED_METHOD || code === METHOD_NOT_FOUND;
19
+ }
20
+ function receiptFromExecutedTx(result) {
21
+ const tx = result?.tx;
22
+ const updateId = tx?.payload?.updateId;
23
+ if (typeof updateId !== "string" || updateId.length === 0) return null;
24
+ return {
25
+ transactionHash: core.toTransactionHash(updateId),
26
+ submittedAt: Date.now(),
27
+ commandId: typeof tx?.commandId === "string" ? tx.commandId : void 0,
28
+ updateId
29
+ };
30
+ }
31
+ function reportOnce(state, walletId, detail, logger) {
32
+ if (state.logged) return;
33
+ state.logged = true;
34
+ logger?.warn(
35
+ `[PartyLayer] ${walletId}: ${detail} Receipts from it carry no real updateId.`
36
+ );
37
+ }
38
+ async function submitViaPrepareExecute(provider, params, opts) {
39
+ const rpcParams = params;
40
+ const { walletId, state, logger } = opts;
41
+ if (state.verb !== "plain") {
42
+ try {
43
+ const result = await provider.request({
44
+ method: "prepareExecuteAndWait",
45
+ params: rpcParams
46
+ });
47
+ state.verb = "awaited";
48
+ const receipt = receiptFromExecutedTx(result);
49
+ if (receipt) return receipt;
50
+ reportOnce(
51
+ state,
52
+ walletId,
53
+ "prepareExecuteAndWait returned no updateId.",
54
+ logger
55
+ );
56
+ return result;
57
+ } catch (err) {
58
+ if (!isUnsupportedMethod(err)) throw err;
59
+ state.verb = "plain";
60
+ reportOnce(
61
+ state,
62
+ walletId,
63
+ "has no prepareExecuteAndWait; using prepareExecute, which the CIP-0103 types return as null.",
64
+ logger
65
+ );
66
+ }
67
+ }
68
+ return provider.request({ method: "prepareExecute", params: rpcParams });
69
+ }
70
+
71
+ // src/announce-adapter.ts
14
72
  var ANNOUNCED_WALLET_ID_PREFIX = "browser:ext:";
15
73
  function announcedWalletId(announceId) {
16
74
  return core.toWalletId(`${ANNOUNCED_WALLET_ID_PREFIX}${announceId}`);
@@ -44,11 +102,19 @@ var GenericAnnounceAdapter = class {
44
102
  staticMetadata;
45
103
  mapError;
46
104
  signMessageBase64;
105
+ /**
106
+ * Which execute verb this wallet turned out to support. Resolved on the first
107
+ * submit and reused, so the wallet is asked at most once.
108
+ */
109
+ executeVerb = {};
47
110
  // Optional WalletAdapter surface — assigned in the ctor ONLY when configured,
48
111
  // so `getCapabilities()` and `'x' in adapter` feature-detection stay honest.
49
112
  restore;
50
113
  on;
51
114
  ledgerApi;
115
+ // signMessage is optional too: assigned in the ctor only when the wallet
116
+ // declares support, so a wallet that cannot sign is not advertised as able to.
117
+ signMessage;
52
118
  constructor(args) {
53
119
  this.walletId = args.walletId ?? announcedWalletId(args.announceId);
54
120
  this.name = args.name && args.name.length > 0 ? args.name : `Canton Wallet (${args.announceId.slice(0, 6)}\u2026)`;
@@ -62,13 +128,18 @@ var GenericAnnounceAdapter = class {
62
128
  if (config?.events) this.on = this.makeOn();
63
129
  if (config?.restore) this.restore = this.makeRestore();
64
130
  if (config?.ledgerApi) this.ledgerApi = this.makeLedgerApi();
131
+ if (config?.signMessage !== false) this.signMessage = this.signMessageImpl.bind(this);
65
132
  }
66
133
  /**
67
- * Capabilities: the baseline three plus whatever optional methods were
68
- * configured (derived from actual presence, never advertised when absent).
134
+ * Capabilities derived from actual presence: connect and submitTransaction are
135
+ * always present; signMessage, restore, ledgerApi, and events are each included
136
+ * only when the matching method was assigned, so the set is never advertised
137
+ * beyond what the adapter can do.
69
138
  */
70
139
  getCapabilities() {
71
- const caps = ["connect", "signMessage", "submitTransaction"];
140
+ const caps = ["connect"];
141
+ if (this.signMessage) caps.push("signMessage");
142
+ caps.push("submitTransaction");
72
143
  if (this.restore) caps.push("restore");
73
144
  if (this.ledgerApi) caps.push("ledgerApi");
74
145
  if (this.on) caps.push("events");
@@ -114,7 +185,10 @@ var GenericAnnounceAdapter = class {
114
185
  } catch {
115
186
  }
116
187
  }
117
- async signMessage(_ctx, session, params) {
188
+ // Real signMessage implementation. Exposed as `this.signMessage` from the ctor
189
+ // only when the wallet declares support, so getCapabilities and feature
190
+ // detection stay honest for a wallet that cannot sign.
191
+ async signMessageImpl(_ctx, session, params) {
118
192
  return this.guarded(async () => {
119
193
  const rpcParams = this.signMessageBase64 ? { message: toBase64Message(params.message) } : { message: params.message };
120
194
  const res = await this.provider.request({ method: "signMessage", params: rpcParams });
@@ -128,11 +202,12 @@ var GenericAnnounceAdapter = class {
128
202
  };
129
203
  });
130
204
  }
131
- async submitTransaction(_ctx, _session, params) {
205
+ async submitTransaction(ctx, _session, params) {
132
206
  return this.guarded(
133
- () => this.provider.request({
134
- method: "prepareExecute",
135
- params
207
+ () => submitViaPrepareExecute(this.provider, params, {
208
+ walletId: String(this.walletId),
209
+ state: this.executeVerb,
210
+ logger: ctx.logger
136
211
  })
137
212
  );
138
213
  }
@@ -245,6 +320,11 @@ var GenericDiscoveryAdapter = class {
245
320
  networkHosts;
246
321
  /** Lazily resolved from `official.provider()` — NOT at construction (SSR-safe). */
247
322
  providerInstance = null;
323
+ /**
324
+ * Which execute verb this wallet turned out to support. Resolved on the first
325
+ * submit and reused, so the wallet is asked at most once.
326
+ */
327
+ executeVerb = {};
248
328
  constructor(args) {
249
329
  if (args.official) {
250
330
  this.official = args.official;
@@ -412,10 +492,11 @@ var GenericDiscoveryAdapter = class {
412
492
  params: { message: params.message }
413
493
  });
414
494
  }
415
- async submitTransaction(_ctx, _session, params) {
416
- return this.provider.request({
417
- method: "prepareExecute",
418
- params
495
+ async submitTransaction(ctx, _session, params) {
496
+ return submitViaPrepareExecute(this.provider, params, {
497
+ walletId: String(this.walletId),
498
+ state: this.executeVerb,
499
+ logger: ctx.logger
419
500
  });
420
501
  }
421
502
  };
@@ -844,6 +925,10 @@ function deriveAnnounceConfig(entry) {
844
925
  const cfg = entry.adapter?.config ?? {};
845
926
  const config = {
846
927
  events: entry.capabilities?.events === true,
928
+ // signMessage is ON unless the entry declares capabilities.signMessage:false,
929
+ // so a wallet that cannot sign is reported honestly. The default preserves the
930
+ // baseline for every entry that omits it or sets it true.
931
+ signMessage: entry.capabilities?.signMessage !== false,
847
932
  restore: cfg.restore === true,
848
933
  ledgerApi: cfg.ledgerApi === true,
849
934
  metadata: cfg.metadata === true,
@@ -1022,7 +1107,8 @@ var PartyLayerClient = class {
1022
1107
  );
1023
1108
  }
1024
1109
  if (!filter?.includeExperimental) {
1025
- return registryWallets.filter((walletInfo) => walletInfo.channel === "stable");
1110
+ const channel = this.config.channel || "stable";
1111
+ return registryWallets.filter((walletInfo) => walletInfo.channel === channel);
1026
1112
  }
1027
1113
  return registryWallets;
1028
1114
  }
@@ -1140,8 +1226,16 @@ var PartyLayerClient = class {
1140
1226
  if (!this.announceEnabled) return base;
1141
1227
  if (this.announceEntriesCache === null) {
1142
1228
  try {
1229
+ let injectionPaths;
1230
+ try {
1231
+ const registry = await this.registryClient.getRegistry();
1232
+ const props = registry.wallets.filter((w) => w.adapter?.transport === "announce").map((w) => w.installation?.windowProperty).filter((p) => typeof p === "string" && p.length > 0);
1233
+ if (props.length > 0) injectionPaths = [...new Set(props)];
1234
+ } catch {
1235
+ }
1143
1236
  const snapshot = await provider.discoverProviders({
1144
1237
  timeoutMs: this.config.discovery?.announceTimeoutMs,
1238
+ injectionPaths,
1145
1239
  // Working provider over the announce target channel; G4 (provider.md):
1146
1240
  // target defaults to id when omitted — never a shared slot.
1147
1241
  createProvider: (a) => provider.createExtensionChannelProvider({ target: a.target ?? a.id })
@@ -1663,6 +1757,55 @@ var PartyLayerClient = class {
1663
1757
  throw error;
1664
1758
  }
1665
1759
  }
1760
+ /**
1761
+ * Request a typed transfer. The application says what it wants; the wallet
1762
+ * builds the command, shows the user what they are authorising, obtains their
1763
+ * approval, signs, executes, and returns the real update id.
1764
+ *
1765
+ * The acting party comes from the active session, never from the caller, and
1766
+ * the intent is narrowed to the allowlisted fields before any adapter sees it,
1767
+ * so no caller-supplied option can reach the wallet.
1768
+ *
1769
+ * Throws `CapabilityNotSupportedError` when the active wallet does not
1770
+ * implement it. Ask first with `session.capabilitiesSnapshot.includes('transfer')`,
1771
+ * or require it at connect with `connect({ requiredCapabilities: ['transfer'] })`.
1772
+ */
1773
+ async requestTransfer(intent) {
1774
+ const session = await this.getActiveSession();
1775
+ if (!session) {
1776
+ throw new Error("No active session");
1777
+ }
1778
+ const adapter = this.adapters.get(session.walletId);
1779
+ if (!adapter || !adapter.requestTransfer) {
1780
+ throw new core.CapabilityNotSupportedError(
1781
+ session.walletId,
1782
+ "transfer"
1783
+ );
1784
+ }
1785
+ const safeIntent = core.toTransferIntent(intent);
1786
+ const correlationId = newCorrelationId();
1787
+ this.log("debug", "requestTransfer:start", "requestTransfer", {}, correlationId);
1788
+ try {
1789
+ this.assertNetworkOk(session);
1790
+ const ctx = this.createAdapterContext();
1791
+ const result = await adapter.requestTransfer(ctx, session, safeIntent);
1792
+ this.emit("tx:status", {
1793
+ type: "tx:status",
1794
+ sessionId: session.sessionId,
1795
+ txId: result.updateId,
1796
+ status: "committed",
1797
+ raw: result
1798
+ }, correlationId);
1799
+ return result;
1800
+ } catch (err) {
1801
+ const error = core.mapUnknownErrorToPartyLayerError(err, {
1802
+ phase: "requestTransfer",
1803
+ walletId: String(session.walletId)
1804
+ });
1805
+ this.emit("error", { type: "error", error }, correlationId);
1806
+ throw error;
1807
+ }
1808
+ }
1666
1809
  /**
1667
1810
  * Subscribe to events
1668
1811
  */
@@ -2023,6 +2166,10 @@ Object.defineProperty(exports, "SessionExpiredError", {
2023
2166
  enumerable: true,
2024
2167
  get: function () { return core.SessionExpiredError; }
2025
2168
  });
2169
+ Object.defineProperty(exports, "TRANSFER_INTENT_FIELDS", {
2170
+ enumerable: true,
2171
+ get: function () { return core.TRANSFER_INTENT_FIELDS; }
2172
+ });
2026
2173
  Object.defineProperty(exports, "TimeoutError", {
2027
2174
  enumerable: true,
2028
2175
  get: function () { return core.TimeoutError; }
@@ -2055,6 +2202,10 @@ Object.defineProperty(exports, "isOfficialProviderAdapter", {
2055
2202
  enumerable: true,
2056
2203
  get: function () { return core.isOfficialProviderAdapter; }
2057
2204
  });
2205
+ Object.defineProperty(exports, "toTransferIntent", {
2206
+ enumerable: true,
2207
+ get: function () { return core.toTransferIntent; }
2208
+ });
2058
2209
  Object.defineProperty(exports, "deriveGenericWalletName", {
2059
2210
  enumerable: true,
2060
2211
  get: function () { return registryClient.deriveGenericWalletName; }