@formo/analytics 1.38.2 → 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.
- package/dist/cjs/src/FormoAnalytics.js +9 -4
- package/dist/cjs/src/FormoAnalyticsProvider.js +20 -0
- package/dist/cjs/src/solana/SolanaManager.d.ts +37 -9
- package/dist/cjs/src/solana/SolanaManager.js +135 -20
- package/dist/cjs/src/solana/SolanaStoreHandler.d.ts +6 -0
- package/dist/cjs/src/solana/SolanaStoreHandler.js +17 -8
- package/dist/cjs/src/solana/SolanaWalletStandardRegistry.d.ts +163 -0
- package/dist/cjs/src/solana/SolanaWalletStandardRegistry.js +447 -0
- package/dist/cjs/src/solana/index.d.ts +10 -5
- package/dist/cjs/src/solana/index.js +12 -6
- package/dist/cjs/src/solana/storeTypes.d.ts +20 -1
- package/dist/cjs/src/solana/types.d.ts +32 -9
- package/dist/cjs/src/solana/types.js +15 -0
- package/dist/cjs/src/solana/walletStandardTypes.d.ts +54 -0
- package/dist/cjs/src/solana/walletStandardTypes.js +21 -0
- package/dist/cjs/src/types/base.d.ts +15 -5
- package/dist/cjs/src/version.d.ts +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/esm/src/FormoAnalytics.js +9 -4
- package/dist/esm/src/FormoAnalyticsProvider.js +20 -0
- package/dist/esm/src/solana/SolanaManager.d.ts +37 -9
- package/dist/esm/src/solana/SolanaManager.js +135 -20
- package/dist/esm/src/solana/SolanaStoreHandler.d.ts +6 -0
- package/dist/esm/src/solana/SolanaStoreHandler.js +18 -9
- package/dist/esm/src/solana/SolanaWalletStandardRegistry.d.ts +163 -0
- package/dist/esm/src/solana/SolanaWalletStandardRegistry.js +444 -0
- package/dist/esm/src/solana/index.d.ts +10 -5
- package/dist/esm/src/solana/index.js +10 -5
- package/dist/esm/src/solana/storeTypes.d.ts +20 -1
- package/dist/esm/src/solana/types.d.ts +32 -9
- package/dist/esm/src/solana/types.js +14 -0
- package/dist/esm/src/solana/walletStandardTypes.d.ts +54 -0
- package/dist/esm/src/solana/walletStandardTypes.js +18 -0
- package/dist/esm/src/types/base.d.ts +15 -5
- package/dist/esm/src/version.d.ts +1 -1
- package/dist/esm/src/version.js +1 -1
- package/dist/index.umd.min.js +1 -1
- package/package.json +2 -2
|
@@ -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
|
-
|
|
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
|
-
*
|
|
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)
|
|
54
|
-
* When provided,
|
|
55
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
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
|
|
250
|
-
*
|
|
251
|
-
*
|
|
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
|
|
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.
|
|
1
|
+
export declare const version = "1.39.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/esm/src/version.js
CHANGED