@formo/analytics 1.38.1 → 1.39.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.
Files changed (60) hide show
  1. package/dist/cjs/src/FormoAnalytics.d.ts +10 -1
  2. package/dist/cjs/src/FormoAnalytics.js +20 -5
  3. package/dist/cjs/src/FormoAnalyticsProvider.js +20 -0
  4. package/dist/cjs/src/evm/EvmEventTracker.d.ts +100 -9
  5. package/dist/cjs/src/evm/EvmEventTracker.js +357 -19
  6. package/dist/cjs/src/evm/EvmProviderRegistry.d.ts +34 -2
  7. package/dist/cjs/src/evm/EvmProviderRegistry.js +61 -4
  8. package/dist/cjs/src/evm/EvmRequestTracker.d.ts +9 -4
  9. package/dist/cjs/src/evm/EvmRequestTracker.js +26 -16
  10. package/dist/cjs/src/solana/SolanaManager.d.ts +37 -9
  11. package/dist/cjs/src/solana/SolanaManager.js +135 -20
  12. package/dist/cjs/src/solana/SolanaStoreHandler.d.ts +6 -0
  13. package/dist/cjs/src/solana/SolanaStoreHandler.js +17 -8
  14. package/dist/cjs/src/solana/SolanaWalletStandardRegistry.d.ts +163 -0
  15. package/dist/cjs/src/solana/SolanaWalletStandardRegistry.js +447 -0
  16. package/dist/cjs/src/solana/index.d.ts +10 -5
  17. package/dist/cjs/src/solana/index.js +12 -6
  18. package/dist/cjs/src/solana/storeTypes.d.ts +20 -1
  19. package/dist/cjs/src/solana/types.d.ts +32 -9
  20. package/dist/cjs/src/solana/types.js +15 -0
  21. package/dist/cjs/src/solana/walletStandardTypes.d.ts +54 -0
  22. package/dist/cjs/src/solana/walletStandardTypes.js +21 -0
  23. package/dist/cjs/src/types/base.d.ts +15 -5
  24. package/dist/cjs/src/version.d.ts +1 -1
  25. package/dist/cjs/src/version.js +1 -1
  26. package/dist/cjs/src/wagmi/WagmiEventHandler.d.ts +30 -1
  27. package/dist/cjs/src/wagmi/WagmiEventHandler.js +80 -1
  28. package/dist/cjs/src/wagmi/types.d.ts +6 -0
  29. package/dist/cjs/src/wagmi/utils.js +9 -1
  30. package/dist/esm/src/FormoAnalytics.d.ts +10 -1
  31. package/dist/esm/src/FormoAnalytics.js +20 -5
  32. package/dist/esm/src/FormoAnalyticsProvider.js +20 -0
  33. package/dist/esm/src/evm/EvmEventTracker.d.ts +100 -9
  34. package/dist/esm/src/evm/EvmEventTracker.js +357 -19
  35. package/dist/esm/src/evm/EvmProviderRegistry.d.ts +34 -2
  36. package/dist/esm/src/evm/EvmProviderRegistry.js +61 -4
  37. package/dist/esm/src/evm/EvmRequestTracker.d.ts +9 -4
  38. package/dist/esm/src/evm/EvmRequestTracker.js +26 -16
  39. package/dist/esm/src/solana/SolanaManager.d.ts +37 -9
  40. package/dist/esm/src/solana/SolanaManager.js +135 -20
  41. package/dist/esm/src/solana/SolanaStoreHandler.d.ts +6 -0
  42. package/dist/esm/src/solana/SolanaStoreHandler.js +18 -9
  43. package/dist/esm/src/solana/SolanaWalletStandardRegistry.d.ts +163 -0
  44. package/dist/esm/src/solana/SolanaWalletStandardRegistry.js +444 -0
  45. package/dist/esm/src/solana/index.d.ts +10 -5
  46. package/dist/esm/src/solana/index.js +10 -5
  47. package/dist/esm/src/solana/storeTypes.d.ts +20 -1
  48. package/dist/esm/src/solana/types.d.ts +32 -9
  49. package/dist/esm/src/solana/types.js +14 -0
  50. package/dist/esm/src/solana/walletStandardTypes.d.ts +54 -0
  51. package/dist/esm/src/solana/walletStandardTypes.js +18 -0
  52. package/dist/esm/src/types/base.d.ts +15 -5
  53. package/dist/esm/src/version.d.ts +1 -1
  54. package/dist/esm/src/version.js +1 -1
  55. package/dist/esm/src/wagmi/WagmiEventHandler.d.ts +30 -1
  56. package/dist/esm/src/wagmi/WagmiEventHandler.js +80 -1
  57. package/dist/esm/src/wagmi/types.d.ts +6 -0
  58. package/dist/esm/src/wagmi/utils.js +9 -1
  59. package/dist/index.umd.min.js +1 -1
  60. package/package.json +2 -2
@@ -1,17 +1,22 @@
1
1
  /**
2
2
  * Solana integration module
3
3
  *
4
- * Provides automatic event capture for Solana wallets via framework-kit's
5
- * zustand store. Connect/disconnect and transaction events are tracked
6
- * automatically. Signature events (signMessage/signTransaction) require
7
- * explicit tracking via formo.signature() since framework-kit
8
- * doesn't track these in store state.
4
+ * Wallets are discovered through the Wallet Standard and their connect /
5
+ * disconnect events captured automatically for wallets registered with the
6
+ * page through Wallet Standard.
7
+ * Framework-kit apps can additionally pass their zustand store for
8
+ * transaction lifecycle events. Signature events (signMessage /
9
+ * signTransaction) require explicit tracking via formo.signature(), since
10
+ * neither source reports them.
9
11
  *
12
+ * @see https://github.com/wallet-standard/wallet-standard
10
13
  * @see https://github.com/solana-foundation/framework-kit
11
14
  */
12
15
  export { SolanaStoreHandler } from "./SolanaStoreHandler";
16
+ export { SolanaWalletStandardRegistry } from "./SolanaWalletStandardRegistry";
13
17
  export { SolanaManager } from "./SolanaManager";
14
18
  export * from "./types";
15
19
  export * from "./storeTypes";
20
+ export * from "./walletStandardTypes";
16
21
  export * from "./address";
17
22
  //# sourceMappingURL=index.d.ts.map
@@ -1,17 +1,22 @@
1
1
  /**
2
2
  * Solana integration module
3
3
  *
4
- * Provides automatic event capture for Solana wallets via framework-kit's
5
- * zustand store. Connect/disconnect and transaction events are tracked
6
- * automatically. Signature events (signMessage/signTransaction) require
7
- * explicit tracking via formo.signature() since framework-kit
8
- * doesn't track these in store state.
4
+ * Wallets are discovered through the Wallet Standard and their connect /
5
+ * disconnect events captured automatically for wallets registered with the
6
+ * page through Wallet Standard.
7
+ * Framework-kit apps can additionally pass their zustand store for
8
+ * transaction lifecycle events. Signature events (signMessage /
9
+ * signTransaction) require explicit tracking via formo.signature(), since
10
+ * neither source reports them.
9
11
  *
12
+ * @see https://github.com/wallet-standard/wallet-standard
10
13
  * @see https://github.com/solana-foundation/framework-kit
11
14
  */
12
15
  export { SolanaStoreHandler } from "./SolanaStoreHandler";
16
+ export { SolanaWalletStandardRegistry } from "./SolanaWalletStandardRegistry";
13
17
  export { SolanaManager } from "./SolanaManager";
14
18
  export * from "./types";
15
19
  export * from "./storeTypes";
20
+ export * from "./walletStandardTypes";
16
21
  export * from "./address";
17
22
  //# sourceMappingURL=index.js.map
@@ -72,13 +72,32 @@ export interface SolanaWalletConnectorMetadata {
72
72
  readonly name: string;
73
73
  readonly icon?: string;
74
74
  }
75
+ /** Cluster health as exposed by framework-kit. */
76
+ export type SolanaClusterStatus = Readonly<{
77
+ status: "idle";
78
+ }> | Readonly<{
79
+ status: "connecting";
80
+ }> | Readonly<{
81
+ status: "ready";
82
+ latencyMs?: number;
83
+ }> | Readonly<{
84
+ status: "error";
85
+ error: unknown;
86
+ }>;
87
+ /** @deprecated framework-kit emits {@link SolanaClusterStatus} objects. */
88
+ export type LegacySolanaClusterStatus = SolanaClusterStatus["status"];
75
89
  /**
76
90
  * Cluster state from the store.
77
91
  */
78
92
  export interface SolanaClusterState {
79
93
  readonly endpoint: string;
80
94
  readonly commitment?: string;
81
- readonly status: "idle" | "connecting" | "ready" | "error";
95
+ /**
96
+ * framework-kit's `ClusterStatus` is a discriminated union such as
97
+ * `{ status: 'ready', latencyMs?: number }`. The pre-1.39 string form is
98
+ * retained so custom stores and test doubles remain source-compatible.
99
+ */
100
+ readonly status: SolanaClusterStatus | LegacySolanaClusterStatus;
82
101
  }
83
102
  /**
84
103
  * The zustand vanilla store API that framework-kit exposes via `client.store`.
@@ -46,15 +46,32 @@ export interface SolanaPublicKey {
46
46
  */
47
47
  export type UnsubscribeFn = () => void;
48
48
  /**
49
- * Solana options for FormoAnalytics
49
+ * The rdns reported for a Solana wallet.
50
+ *
51
+ * The Wallet Standard has no reverse-domain identifier, so one is derived
52
+ * from the wallet's normalized name. Lowercasing and removing whitespace
53
+ * preserves the values historically reported by the framework-kit store;
54
+ * encoding keeps delimiters and other special characters safe for storage.
55
+ * Both Solana paths (Wallet Standard discovery and the framework-kit store)
56
+ * derive it the same way, so a wallet's `detect` and its `connect` share one
57
+ * rdns whichever path reported each.
58
+ */
59
+ export declare function solanaWalletRdns(walletName: string): string;
60
+ /**
61
+ * Solana options for FormoAnalytics.
62
+ *
63
+ * Wallet discovery through the Wallet Standard is on by default and needs
64
+ * none of these. They add framework-kit's store, or name the cluster.
50
65
  */
51
66
  export interface SolanaOptions {
52
67
  /**
53
- * The framework-kit client store (client.store) for automatic event tracking.
54
- * When provided, wallet connect/disconnect and transaction events are tracked
55
- * automatically by subscribing to zustand store state changes.
68
+ * The framework-kit client store (client.store).
69
+ * When provided, transaction lifecycle events and cluster switches are
70
+ * tracked from the store, and connect/disconnect come from the store
71
+ * rather than from Wallet Standard discovery.
56
72
  *
57
- * This is the recommended approach for apps using framework-kit.
73
+ * Only for apps using framework-kit (`@solana/client`). Other integrations
74
+ * do not need a store when their wallets register through Wallet Standard.
58
75
  *
59
76
  * @example
60
77
  * ```tsx
@@ -65,10 +82,16 @@ export interface SolanaOptions {
65
82
  */
66
83
  store?: import("./storeTypes").SolanaClientStore;
67
84
  /**
68
- * The Solana cluster/network.
69
- * Usually auto-detected from the store's endpoint URL.
70
- * Only needed for custom RPC URLs that don't contain a recognizable cluster name.
71
- * @default auto-detected, or "mainnet-beta" if detection fails
85
+ * The Solana cluster/network the app is on.
86
+ *
87
+ * With a store, usually auto-detected from its endpoint URL; only needed
88
+ * for custom RPC URLs that don't contain a recognizable cluster name.
89
+ * Without a store, the Wallet Standard cannot say which cluster the app
90
+ * uses, so a devnet or testnet app should set this (or call
91
+ * `formo.solana.setCluster()`); otherwise connections are reported on
92
+ * mainnet-beta.
93
+ * @default auto-detected from the store; otherwise mainnet-beta when the
94
+ * wallet supports it, or its first supported Solana cluster
72
95
  */
73
96
  cluster?: SolanaCluster;
74
97
  }
@@ -40,4 +40,18 @@ export function isSolanaChainId(chainId) {
40
40
  return false;
41
41
  return Object.values(SOLANA_CHAIN_IDS).includes(chainId);
42
42
  }
43
+ /**
44
+ * The rdns reported for a Solana wallet.
45
+ *
46
+ * The Wallet Standard has no reverse-domain identifier, so one is derived
47
+ * from the wallet's normalized name. Lowercasing and removing whitespace
48
+ * preserves the values historically reported by the framework-kit store;
49
+ * encoding keeps delimiters and other special characters safe for storage.
50
+ * Both Solana paths (Wallet Standard discovery and the framework-kit store)
51
+ * derive it the same way, so a wallet's `detect` and its `connect` share one
52
+ * rdns whichever path reported each.
53
+ */
54
+ export function solanaWalletRdns(walletName) {
55
+ return "sol.wallet.".concat(encodeURIComponent(walletName.toLowerCase().replace(/\s+/g, "")));
56
+ }
43
57
  //# sourceMappingURL=types.js.map
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The subset of the Wallet Standard this SDK reads.
3
+ *
4
+ * Duck-typed on purpose: the SDK must not depend on `@wallet-standard/*`
5
+ * packages (see the dependency policy), and a wallet is discovered through
6
+ * window events, so nothing here is ever imported from a wallet library.
7
+ * Every field is what a conforming wallet exposes; the shapes are looser
8
+ * than the reference types so a slightly off wallet is skipped, not thrown
9
+ * on.
10
+ *
11
+ * @see https://github.com/wallet-standard/wallet-standard
12
+ */
13
+ /** `namespace:reference`, e.g. `solana:mainnet` or `solana:devnet`. */
14
+ export type WalletStandardChain = string;
15
+ export interface WalletStandardAccount {
16
+ readonly address: string;
17
+ readonly publicKey?: unknown;
18
+ /** Chains this account can sign for. Absent on a non-conforming wallet. */
19
+ readonly chains?: readonly WalletStandardChain[];
20
+ readonly features?: readonly string[];
21
+ readonly label?: string;
22
+ readonly icon?: string;
23
+ }
24
+ export interface WalletStandardWallet {
25
+ readonly version?: string;
26
+ readonly name: string;
27
+ readonly icon?: string;
28
+ /** Every chain the wallet supports, NOT the one currently selected. */
29
+ readonly chains: readonly WalletStandardChain[];
30
+ readonly features: Readonly<Record<string, unknown>>;
31
+ /** Accounts the app is currently authorized for; empty until connected. */
32
+ readonly accounts: readonly WalletStandardAccount[];
33
+ }
34
+ /** What a `standard:events` `change` event carries: only what changed. */
35
+ export interface WalletStandardChangeProperties {
36
+ readonly chains?: readonly WalletStandardChain[];
37
+ readonly features?: Readonly<Record<string, unknown>>;
38
+ readonly accounts?: readonly WalletStandardAccount[];
39
+ }
40
+ /** The `standard:events` feature. */
41
+ export interface WalletStandardEventsFeature {
42
+ readonly version?: string;
43
+ on(event: "change", listener: (properties: WalletStandardChangeProperties) => void): () => void;
44
+ }
45
+ /** The API an app hands to wallets so they can announce themselves. */
46
+ export interface WalletStandardRegisterApi {
47
+ register(...wallets: WalletStandardWallet[]): () => void;
48
+ }
49
+ /** Dispatched by the app on `window`; `detail` is the register API. */
50
+ export declare const WALLET_STANDARD_APP_READY_EVENT = "wallet-standard:app-ready";
51
+ /** Dispatched by a wallet on `window`; `detail` is a callback taking the API. */
52
+ export declare const WALLET_STANDARD_REGISTER_WALLET_EVENT = "wallet-standard:register-wallet";
53
+ export declare const WALLET_STANDARD_EVENTS_FEATURE = "standard:events";
54
+ //# sourceMappingURL=walletStandardTypes.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The subset of the Wallet Standard this SDK reads.
3
+ *
4
+ * Duck-typed on purpose: the SDK must not depend on `@wallet-standard/*`
5
+ * packages (see the dependency policy), and a wallet is discovered through
6
+ * window events, so nothing here is ever imported from a wallet library.
7
+ * Every field is what a conforming wallet exposes; the shapes are looser
8
+ * than the reference types so a slightly off wallet is skipped, not thrown
9
+ * on.
10
+ *
11
+ * @see https://github.com/wallet-standard/wallet-standard
12
+ */
13
+ /** Dispatched by the app on `window`; `detail` is the register API. */
14
+ export var WALLET_STANDARD_APP_READY_EVENT = "wallet-standard:app-ready";
15
+ /** Dispatched by a wallet on `window`; `detail` is a callback taking the API. */
16
+ export var WALLET_STANDARD_REGISTER_WALLET_EVENT = "wallet-standard:register-wallet";
17
+ export var WALLET_STANDARD_EVENTS_FEATURE = "standard:events";
18
+ //# sourceMappingURL=walletStandardTypes.js.map
@@ -246,16 +246,26 @@ export interface Options {
246
246
  */
247
247
  wagmi?: WagmiOptions;
248
248
  /**
249
- * Solana integration configuration.
250
- * Pass `store: client.store` from framework-kit for automatic tracking of
251
- * wallet connect/disconnect and transaction events.
249
+ * Solana wallet tracking.
250
+ *
251
+ * On by default: wallets are discovered through the Wallet Standard, the
252
+ * Solana analogue of EIP-6963, so connect and disconnect are autocaptured
253
+ * for compatible wallets registered with the page, including wallets used
254
+ * through Solana Kit, wallet-adapter, and framework-kit.
255
+ *
256
+ * - `false`: disable Solana wallet discovery and tracking entirely.
257
+ * - `SolanaOptions`: additionally pass `store: client.store` from
258
+ * framework-kit for transaction lifecycle events and cluster switches,
259
+ * or `cluster` to name the network a non-mainnet app is on.
252
260
  *
253
261
  * For signMessage/signTransaction, use formo.signature() directly
254
- * (framework-kit doesn't track these in the store).
262
+ * (neither the Wallet Standard nor framework-kit's store reports these).
255
263
  *
264
+ * @see https://github.com/wallet-standard/wallet-standard
256
265
  * @see https://github.com/solana-foundation/framework-kit
266
+ * @default true
257
267
  */
258
- solana?: SolanaOptions;
268
+ solana?: boolean | SolanaOptions;
259
269
  /**
260
270
  * Custom API host for sending events through your own domain to bypass ad blockers
261
271
  * - If not provided, events are sent directly to events.formo.so
@@ -1,2 +1,2 @@
1
- export declare const version = "1.38.1";
1
+ export declare const version = "1.39.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // This file is auto-generated by scripts/update-version.js during npm version
2
2
  // Do not edit manually - it will be overwritten
3
- export var version = '1.38.1';
3
+ export var version = '1.39.0';
4
4
  //# sourceMappingURL=version.js.map
@@ -6,7 +6,7 @@
6
6
  * wrapping approach when Wagmi mode is enabled.
7
7
  */
8
8
  import { FormoAnalytics } from "../FormoAnalytics";
9
- import { WagmiConfig, QueryClient } from "./types";
9
+ import { QueryClient, WagmiConfig } from "./types";
10
10
  /**
11
11
  * How long the markers stay trustworthy after the last handler goes away.
12
12
  *
@@ -337,6 +337,35 @@ export declare class WagmiEventHandler {
337
337
  * (still connected through its own connector).
338
338
  */
339
339
  private isAddressConnected;
340
+ /**
341
+ * A specific connector's name and rdns, for the fallback-wrapped
342
+ * provider's request-derived events.
343
+ *
344
+ * The NAME is exactly what the hook path emits for that connector
345
+ * (`getConnectorName`: the live WalletConnect peer for a WalletConnect
346
+ * connector, the connector's own name otherwise), so a branded connector
347
+ * keeps its name on both paths and a session that changes wallets
348
+ * renames on both. The rdns is the connector's when wagmi knows it as
349
+ * ONE value (EIP-6963 discovered connectors carry theirs, some as a
350
+ * one-element list); a connector that matches several rdns values does
351
+ * not say which one this provider is, so nothing is passed and the
352
+ * registry keeps the sniffed one.
353
+ */
354
+ private attributionForConnector;
355
+ /**
356
+ * Resolver handed to the registry at wrap time, read at each request
357
+ * start. BOUND to the connector whose `getProvider` resolved to the
358
+ * wrapped provider, not to whichever connector is current: an app can
359
+ * keep a wallet client over a previous connector's provider and issue a
360
+ * request through it after switching, and that request belongs to the
361
+ * wallet that handles it. The peer name is still read live. A provider
362
+ * SHARED by two connectors is re-bound when the new connector's
363
+ * resolution lands (one microtask for an injected connector); a request
364
+ * issued inside that gap keeps the previous label.
365
+ */
366
+ private boundConnectorAttribution;
367
+ /** `getConnectorName` for a SPECIFIC connector, current or not. */
368
+ private nameForConnector;
340
369
  /**
341
370
  * Get the connector name from Wagmi state
342
371
  */
@@ -71,6 +71,16 @@ var RESERVED_FIELDS = new Set([
71
71
  "transactionHash",
72
72
  "function_name",
73
73
  "function_args",
74
+ // Wallet attribution. Function args are spread AFTER the attribution
75
+ // properties, so an ABI input named `providerName` would silently
76
+ // relabel the wallet on every broadcast and receipt event. `rdns` is
77
+ // reserved with it even though THIS path (wagmi mutation attribution)
78
+ // emits only the name: elsewhere in the SDK - the EIP-1193 request path
79
+ // and connect events - `rdns` is the wallet-identity key, so an ABI
80
+ // input by that name would land in the same warehouse column as real
81
+ // wallet identities.
82
+ "providerName",
83
+ "rdns",
74
84
  ]);
75
85
  /**
76
86
  * Connections already announced to a destination during this page load.
@@ -2333,6 +2343,75 @@ var WagmiEventHandler = /** @class */ (function () {
2333
2343
  });
2334
2344
  return found;
2335
2345
  };
2346
+ /**
2347
+ * A specific connector's name and rdns, for the fallback-wrapped
2348
+ * provider's request-derived events.
2349
+ *
2350
+ * The NAME is exactly what the hook path emits for that connector
2351
+ * (`getConnectorName`: the live WalletConnect peer for a WalletConnect
2352
+ * connector, the connector's own name otherwise), so a branded connector
2353
+ * keeps its name on both paths and a session that changes wallets
2354
+ * renames on both. The rdns is the connector's when wagmi knows it as
2355
+ * ONE value (EIP-6963 discovered connectors carry theirs, some as a
2356
+ * one-element list); a connector that matches several rdns values does
2357
+ * not say which one this provider is, so nothing is passed and the
2358
+ * registry keeps the sniffed one.
2359
+ */
2360
+ WagmiEventHandler.prototype.attributionForConnector = function (connector, state) {
2361
+ var name = this.nameForConnector(connector, state);
2362
+ if (!name) {
2363
+ return undefined;
2364
+ }
2365
+ var raw = connector.rdns;
2366
+ var rdns = typeof raw === "string" && raw.length > 0
2367
+ ? raw
2368
+ : Array.isArray(raw) && raw.length === 1 && typeof raw[0] === "string" && raw[0].length > 0
2369
+ ? raw[0]
2370
+ : undefined;
2371
+ return __assign({ name: name }, (rdns && { rdns: rdns }));
2372
+ };
2373
+ /**
2374
+ * Resolver handed to the registry at wrap time, read at each request
2375
+ * start. BOUND to the connector whose `getProvider` resolved to the
2376
+ * wrapped provider, not to whichever connector is current: an app can
2377
+ * keep a wallet client over a previous connector's provider and issue a
2378
+ * request through it after switching, and that request belongs to the
2379
+ * wallet that handles it. The peer name is still read live. A provider
2380
+ * SHARED by two connectors is re-bound when the new connector's
2381
+ * resolution lands (one microtask for an injected connector); a request
2382
+ * issued inside that gap keeps the previous label.
2383
+ */
2384
+ WagmiEventHandler.prototype.boundConnectorAttribution = function (connector) {
2385
+ var _this = this;
2386
+ return function () {
2387
+ if (_this.disposed)
2388
+ return undefined;
2389
+ try {
2390
+ return _this.attributionForConnector(connector, _this.getState());
2391
+ }
2392
+ catch (_a) {
2393
+ return undefined;
2394
+ }
2395
+ };
2396
+ };
2397
+ /** `getConnectorName` for a SPECIFIC connector, current or not. */
2398
+ WagmiEventHandler.prototype.nameForConnector = function (connector, state) {
2399
+ var _a;
2400
+ var cached = walletConnectPeerNames.get(connector);
2401
+ if (cached) {
2402
+ return cached;
2403
+ }
2404
+ var current = state.current
2405
+ ? (_a = state.connections.get(state.current)) === null || _a === void 0 ? void 0 : _a.connector
2406
+ : undefined;
2407
+ if (current === connector) {
2408
+ // Backstop kick, as in getConnectorName; only the current connection
2409
+ // has a session to look up.
2410
+ this.kickWalletConnectPeerLookup(state);
2411
+ }
2412
+ var name = connector.name;
2413
+ return typeof name === "string" && name.length > 0 ? name : undefined;
2414
+ };
2336
2415
  /**
2337
2416
  * Get the connector name from Wagmi state
2338
2417
  */
@@ -2470,7 +2549,7 @@ var WagmiEventHandler = /** @class */ (function () {
2470
2549
  return;
2471
2550
  }
2472
2551
  var chainId = (_b = _this.getActiveConnectionChainId(live)) !== null && _b !== void 0 ? _b : live.chainId;
2473
- var wrapped = (_d = (_c = _this.formo)._wrapWagmiProvider) === null || _d === void 0 ? void 0 : _d.call(_c, provider, typeof chainId === "number" ? chainId : undefined);
2552
+ var wrapped = (_d = (_c = _this.formo)._wrapWagmiProvider) === null || _d === void 0 ? void 0 : _d.call(_c, provider, typeof chainId === "number" ? chainId : undefined, _this.boundConnectorAttribution(connector));
2474
2553
  if (wrapped !== true) {
2475
2554
  // The provider was refused (invalid shape, frozen provider,
2476
2555
  // torn-down SDK).
@@ -31,6 +31,12 @@ export interface WagmiConnector {
31
31
  name: string;
32
32
  type: string;
33
33
  uid: string;
34
+ /**
35
+ * Any connector implementation may expose an rdns; EIP-6963 discovered
36
+ * connectors are one source. A connector matching several rdns values
37
+ * lists them all.
38
+ */
39
+ rdns?: string | readonly string[];
34
40
  }
35
41
  /**
36
42
  * Wagmi config interface
@@ -185,7 +185,15 @@ export function buildSafeFunctionArgs(functionArgs, reservedFields) {
185
185
  var result = {};
186
186
  for (var _i = 0, _a = Object.entries(functionArgs); _i < _a.length; _i++) {
187
187
  var _b = _a[_i], key = _b[0], val = _b[1];
188
- var safeKey = reservedFields.has(key) ? "arg_".concat(key) : key;
188
+ // A prefixed key must not land on another argument's own name: an ABI
189
+ // with both `to` and `arg_to` would otherwise keep only one of them,
190
+ // whichever came later. Keep prefixing until the name is free.
191
+ var safeKey = key;
192
+ if (reservedFields.has(key)) {
193
+ do {
194
+ safeKey = "arg_".concat(safeKey);
195
+ } while (safeKey in functionArgs);
196
+ }
189
197
  result[safeKey] = val;
190
198
  // If the value is a nested object (struct), flatten it
191
199
  // Skip flattened keys that would overwrite existing top-level args