@formo/analytics 1.28.0 → 1.28.2
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.d.ts +1 -2
- package/dist/cjs/src/FormoAnalytics.js +9 -6
- package/dist/cjs/src/event/EventFactory.d.ts +1 -1
- package/dist/cjs/src/event/EventFactory.js +3 -3
- package/dist/cjs/src/privy/types.d.ts +65 -64
- package/dist/cjs/src/privy/utils.js +26 -23
- package/dist/cjs/src/types/events.d.ts +0 -1
- package/dist/cjs/src/utils/index.d.ts +0 -1
- package/dist/cjs/src/utils/index.js +0 -1
- package/dist/cjs/src/version.d.ts +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/cjs/src/wagmi/WagmiEventHandler.js +12 -9
- package/dist/esm/src/FormoAnalytics.d.ts +1 -2
- package/dist/esm/src/FormoAnalytics.js +9 -6
- package/dist/esm/src/event/EventFactory.d.ts +1 -1
- package/dist/esm/src/event/EventFactory.js +3 -3
- package/dist/esm/src/privy/types.d.ts +65 -64
- package/dist/esm/src/privy/utils.js +26 -23
- package/dist/esm/src/types/events.d.ts +0 -1
- package/dist/esm/src/utils/index.d.ts +0 -1
- package/dist/esm/src/utils/index.js +0 -1
- package/dist/esm/src/version.d.ts +1 -1
- package/dist/esm/src/version.js +1 -1
- package/dist/esm/src/wagmi/WagmiEventHandler.js +12 -9
- package/dist/index.umd.min.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/src/utils/builderCode.d.ts +0 -30
- package/dist/cjs/src/utils/builderCode.js +0 -143
- package/dist/esm/src/utils/builderCode.d.ts +0 -30
- package/dist/esm/src/utils/builderCode.js +0 -140
|
@@ -150,7 +150,7 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
150
150
|
* @param {(...args: unknown[]) => void} callback
|
|
151
151
|
* @returns {Promise<void>}
|
|
152
152
|
*/
|
|
153
|
-
transaction({ status, chainId, address, data, to, value, transactionHash, function_name, function_args,
|
|
153
|
+
transaction({ status, chainId, address, data, to, value, transactionHash, function_name, function_args, }: {
|
|
154
154
|
status: TransactionStatus;
|
|
155
155
|
chainId: ChainID;
|
|
156
156
|
address: Address;
|
|
@@ -160,7 +160,6 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
160
160
|
transactionHash?: string;
|
|
161
161
|
function_name?: string;
|
|
162
162
|
function_args?: Record<string, unknown>;
|
|
163
|
-
builder_codes?: string;
|
|
164
163
|
}, properties?: IFormoEventProperties, context?: IFormoEventContext, callback?: (...args: unknown[]) => void): Promise<void>;
|
|
165
164
|
/**
|
|
166
165
|
* Emits an identify event with current wallet address and provider info.
|
|
@@ -68,7 +68,6 @@ var provider_1 = require("./provider");
|
|
|
68
68
|
var session_1 = require("./session");
|
|
69
69
|
var types_1 = require("./types");
|
|
70
70
|
var address_1 = require("./utils/address");
|
|
71
|
-
var builderCode_1 = require("./utils/builderCode");
|
|
72
71
|
var validators_1 = require("./validators");
|
|
73
72
|
var chain_1 = require("./utils/chain");
|
|
74
73
|
var wagmi_1 = require("./wagmi");
|
|
@@ -468,10 +467,10 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
468
467
|
*/
|
|
469
468
|
FormoAnalytics.prototype.transaction = function (_a, properties_1, context_1, callback_1) {
|
|
470
469
|
return __awaiter(this, arguments, void 0, function (_b, properties, context, callback) {
|
|
471
|
-
var status = _b.status, chainId = _b.chainId, address = _b.address, data = _b.data, to = _b.to, value = _b.value, transactionHash = _b.transactionHash, function_name = _b.function_name, function_args = _b.function_args
|
|
470
|
+
var status = _b.status, chainId = _b.chainId, address = _b.address, data = _b.data, to = _b.to, value = _b.value, transactionHash = _b.transactionHash, function_name = _b.function_name, function_args = _b.function_args;
|
|
472
471
|
return __generator(this, function (_c) {
|
|
473
472
|
switch (_c.label) {
|
|
474
|
-
case 0: return [4 /*yield*/, this.trackEvent(constants_1.EventType.TRANSACTION, __assign(__assign(__assign(
|
|
473
|
+
case 0: return [4 /*yield*/, this.trackEvent(constants_1.EventType.TRANSACTION, __assign(__assign(__assign({ status: status, chainId: chainId, address: address, data: data, to: to, value: value }, (transactionHash && { transactionHash: transactionHash })), (function_name && { function_name: function_name })), (function_args && { function_args: function_args })), properties, context, callback)];
|
|
475
474
|
case 1:
|
|
476
475
|
_c.sent();
|
|
477
476
|
return [2 /*return*/];
|
|
@@ -1903,7 +1902,7 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1903
1902
|
};
|
|
1904
1903
|
FormoAnalytics.prototype.buildTransactionEventPayload = function (params, provider) {
|
|
1905
1904
|
return __awaiter(this, void 0, void 0, function () {
|
|
1906
|
-
var _a, data, from, to, value, validAddress,
|
|
1905
|
+
var _a, data, from, to, value, validAddress, _b;
|
|
1907
1906
|
var _c;
|
|
1908
1907
|
return __generator(this, function (_d) {
|
|
1909
1908
|
switch (_d.label) {
|
|
@@ -1913,7 +1912,6 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1913
1912
|
if (!validAddress) {
|
|
1914
1913
|
throw new Error("Invalid address in transaction payload: ".concat(from));
|
|
1915
1914
|
}
|
|
1916
|
-
builder_codes = (0, builderCode_1.extractBuilderCodes)(data);
|
|
1917
1915
|
_c = {};
|
|
1918
1916
|
_b = this._evmChainId;
|
|
1919
1917
|
if (_b) return [3 /*break*/, 2];
|
|
@@ -1921,7 +1919,12 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1921
1919
|
case 1:
|
|
1922
1920
|
_b = (_d.sent());
|
|
1923
1921
|
_d.label = 2;
|
|
1924
|
-
case 2: return [2 /*return*/,
|
|
1922
|
+
case 2: return [2 /*return*/, (_c.chainId = _b,
|
|
1923
|
+
_c.data = data,
|
|
1924
|
+
_c.address = validAddress,
|
|
1925
|
+
_c.to = to,
|
|
1926
|
+
_c.value = value,
|
|
1927
|
+
_c)];
|
|
1925
1928
|
}
|
|
1926
1929
|
});
|
|
1927
1930
|
});
|
|
@@ -35,7 +35,7 @@ declare class EventFactory implements IEventFactory {
|
|
|
35
35
|
generateDisconnectEvent(chainId?: ChainID, address?: Address, properties?: IFormoEventProperties, context?: IFormoEventContext): Promise<IFormoEvent>;
|
|
36
36
|
generateChainChangedEvent(chainId: ChainID, address: Address, properties?: IFormoEventProperties, context?: IFormoEventContext): Promise<IFormoEvent>;
|
|
37
37
|
generateSignatureEvent(status: SignatureStatus, chainId: ChainID, address: Address, message: string, signatureHash?: string, properties?: IFormoEventProperties, context?: IFormoEventContext): Promise<IFormoEvent>;
|
|
38
|
-
generateTransactionEvent(status: TransactionStatus, chainId: ChainID, address: Address, data?: string, to?: string, value?: string, transactionHash?: string, function_name?: string, function_args?: Record<string, unknown>,
|
|
38
|
+
generateTransactionEvent(status: TransactionStatus, chainId: ChainID, address: Address, data?: string, to?: string, value?: string, transactionHash?: string, function_name?: string, function_args?: Record<string, unknown>, properties?: IFormoEventProperties, context?: IFormoEventContext): Promise<IFormoEvent>;
|
|
39
39
|
generateTrackEvent(event: string, properties?: IFormoEventProperties, context?: IFormoEventContext): Promise<IFormoEvent>;
|
|
40
40
|
create(event: APIEvent, address?: Address, userId?: string): Promise<IFormoEvent>;
|
|
41
41
|
}
|
|
@@ -419,12 +419,12 @@ var EventFactory = /** @class */ (function () {
|
|
|
419
419
|
});
|
|
420
420
|
});
|
|
421
421
|
};
|
|
422
|
-
EventFactory.prototype.generateTransactionEvent = function (status, chainId, address, data, to, value, transactionHash, function_name, function_args,
|
|
422
|
+
EventFactory.prototype.generateTransactionEvent = function (status, chainId, address, data, to, value, transactionHash, function_name, function_args, properties, context) {
|
|
423
423
|
return __awaiter(this, void 0, void 0, function () {
|
|
424
424
|
var transactionEvent;
|
|
425
425
|
return __generator(this, function (_a) {
|
|
426
426
|
transactionEvent = {
|
|
427
|
-
properties: __assign(__assign(__assign(__assign(__assign(__assign(__assign(
|
|
427
|
+
properties: __assign(__assign(__assign(__assign(__assign(__assign(__assign({ status: status, chainId: chainId }, (data && { data: data })), (to && { to: to })), (value && { value: value })), (transactionHash && { transactionHash: transactionHash })), (function_name && { function_name: function_name })), (function_args && { function_args: function_args })), properties),
|
|
428
428
|
address: address,
|
|
429
429
|
type: "transaction",
|
|
430
430
|
};
|
|
@@ -503,7 +503,7 @@ var EventFactory = /** @class */ (function () {
|
|
|
503
503
|
case 14:
|
|
504
504
|
formoEvent = _b.sent();
|
|
505
505
|
return [3 /*break*/, 19];
|
|
506
|
-
case 15: return [4 /*yield*/, this.generateTransactionEvent(event.status, event.chainId, event.address, event.data, event.to, event.value, event.transactionHash, event.function_name, event.function_args, event.
|
|
506
|
+
case 15: return [4 /*yield*/, this.generateTransactionEvent(event.status, event.chainId, event.address, event.data, event.to, event.value, event.transactionHash, event.function_name, event.function_args, event.properties, event.context)];
|
|
507
507
|
case 16:
|
|
508
508
|
formoEvent = _b.sent();
|
|
509
509
|
return [3 /*break*/, 19];
|
|
@@ -10,37 +10,36 @@
|
|
|
10
10
|
/**
|
|
11
11
|
* Valid Privy linked account type strings.
|
|
12
12
|
*/
|
|
13
|
-
export type PrivyAccountType = "email" | "phone" | "wallet" | "farcaster" | "telegram" | "apple_oauth" | "discord_oauth" | "github_oauth" | "google_oauth" | "instagram_oauth" | "linkedin_oauth" | "spotify_oauth" | "tiktok_oauth" | "twitter_oauth" | "
|
|
13
|
+
export type PrivyAccountType = "email" | "phone" | "wallet" | "smart_wallet" | "farcaster" | "telegram" | "apple_oauth" | "discord_oauth" | "github_oauth" | "google_oauth" | "instagram_oauth" | "linkedin_oauth" | "spotify_oauth" | "tiktok_oauth" | "twitter_oauth" | "twitch_oauth" | "line_oauth" | "custom_auth" | "passkey" | "cross_app" | "guest" | string;
|
|
14
14
|
/**
|
|
15
15
|
* A linked account entry from the Privy user object.
|
|
16
16
|
* Each linked account has a `type` discriminator and type-specific fields.
|
|
17
17
|
*/
|
|
18
18
|
export interface PrivyLinkedAccount {
|
|
19
19
|
type: PrivyAccountType;
|
|
20
|
-
address?: string;
|
|
21
|
-
number?: string;
|
|
22
|
-
username?: string;
|
|
23
|
-
name?: string;
|
|
24
|
-
displayName?: string;
|
|
25
|
-
subject?: string;
|
|
26
|
-
email?: string;
|
|
27
|
-
chainType?: string;
|
|
28
|
-
walletClient?: string;
|
|
29
|
-
walletClientType?: string;
|
|
30
|
-
connectorType?: string;
|
|
20
|
+
address?: string | null;
|
|
21
|
+
number?: string | null;
|
|
22
|
+
username?: string | null;
|
|
23
|
+
name?: string | null;
|
|
24
|
+
displayName?: string | null;
|
|
25
|
+
subject?: string | null;
|
|
26
|
+
email?: string | null;
|
|
27
|
+
chainType?: string | null;
|
|
28
|
+
walletClient?: string | null;
|
|
29
|
+
walletClientType?: string | null;
|
|
30
|
+
connectorType?: string | null;
|
|
31
31
|
delegated?: boolean;
|
|
32
|
-
fid?: number;
|
|
33
|
-
ownerAddress?: string;
|
|
34
|
-
bio?: string;
|
|
35
|
-
pfp?: string;
|
|
36
|
-
url?: string;
|
|
37
|
-
signerPublicKey?: string;
|
|
38
|
-
telegramUserId?: string;
|
|
39
|
-
firstName?: string;
|
|
40
|
-
lastName?: string;
|
|
41
|
-
firstVerifiedAt?:
|
|
42
|
-
latestVerifiedAt?:
|
|
43
|
-
verifiedAt?: number | null;
|
|
32
|
+
fid?: number | null;
|
|
33
|
+
ownerAddress?: string | null;
|
|
34
|
+
bio?: string | null;
|
|
35
|
+
pfp?: string | null;
|
|
36
|
+
url?: string | null;
|
|
37
|
+
signerPublicKey?: string | null;
|
|
38
|
+
telegramUserId?: string | null;
|
|
39
|
+
firstName?: string | null;
|
|
40
|
+
lastName?: string | null;
|
|
41
|
+
firstVerifiedAt?: Date | null;
|
|
42
|
+
latestVerifiedAt?: Date | null;
|
|
44
43
|
}
|
|
45
44
|
/**
|
|
46
45
|
* Privy user object as returned by the Privy React SDK.
|
|
@@ -53,7 +52,7 @@ export interface PrivyUser {
|
|
|
53
52
|
/** Privy user ID in DID format (e.g., "did:privy:cm3np...") */
|
|
54
53
|
id: string;
|
|
55
54
|
/** Account creation timestamp */
|
|
56
|
-
createdAt?:
|
|
55
|
+
createdAt?: Date;
|
|
57
56
|
/** All linked accounts */
|
|
58
57
|
linkedAccounts?: PrivyLinkedAccount[];
|
|
59
58
|
/** Optional custom metadata */
|
|
@@ -72,67 +71,69 @@ export interface PrivyUser {
|
|
|
72
71
|
connectorType?: string;
|
|
73
72
|
};
|
|
74
73
|
google?: {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
subject: string;
|
|
75
|
+
email: string;
|
|
76
|
+
name: string | null;
|
|
78
77
|
};
|
|
79
78
|
discord?: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
email
|
|
79
|
+
subject: string;
|
|
80
|
+
username: string | null;
|
|
81
|
+
email: string | null;
|
|
83
82
|
};
|
|
84
83
|
twitter?: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
profilePictureUrl
|
|
84
|
+
subject: string;
|
|
85
|
+
username: string | null;
|
|
86
|
+
name: string | null;
|
|
87
|
+
profilePictureUrl: string | null;
|
|
89
88
|
};
|
|
90
89
|
farcaster?: {
|
|
91
|
-
fid
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
bio
|
|
96
|
-
pfp
|
|
90
|
+
fid: number | null;
|
|
91
|
+
ownerAddress: string;
|
|
92
|
+
username: string | null;
|
|
93
|
+
displayName: string | null;
|
|
94
|
+
bio: string | null;
|
|
95
|
+
pfp: string | null;
|
|
97
96
|
};
|
|
98
97
|
github?: {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
subject: string;
|
|
99
|
+
username: string | null;
|
|
100
|
+
name: string | null;
|
|
102
101
|
};
|
|
103
102
|
linkedin?: {
|
|
104
|
-
|
|
105
|
-
name
|
|
106
|
-
|
|
103
|
+
subject: string;
|
|
104
|
+
name: string | null;
|
|
105
|
+
email: string | null;
|
|
106
|
+
vanityName: string | null;
|
|
107
107
|
};
|
|
108
108
|
apple?: {
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
subject: string;
|
|
110
|
+
email: string;
|
|
111
111
|
};
|
|
112
112
|
instagram?: {
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
subject: string;
|
|
114
|
+
username: string | null;
|
|
115
115
|
};
|
|
116
116
|
spotify?: {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
subject: string;
|
|
118
|
+
email: string | null;
|
|
119
|
+
name: string | null;
|
|
120
120
|
};
|
|
121
121
|
tiktok?: {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
subject: string;
|
|
123
|
+
username: string | null;
|
|
124
|
+
name: string | null;
|
|
125
125
|
};
|
|
126
126
|
line?: {
|
|
127
|
-
|
|
128
|
-
name
|
|
129
|
-
|
|
127
|
+
subject: string;
|
|
128
|
+
name: string | null;
|
|
129
|
+
email: string | null;
|
|
130
130
|
};
|
|
131
131
|
telegram?: {
|
|
132
|
-
telegramUserId
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
telegramUserId: string;
|
|
133
|
+
firstName: string | null;
|
|
134
|
+
lastName: string | null;
|
|
135
|
+
username: string | null;
|
|
136
|
+
photoUrl: string | null;
|
|
136
137
|
};
|
|
137
138
|
/** MFA methods */
|
|
138
139
|
mfaMethods?: Array<string>;
|
|
@@ -28,52 +28,52 @@ exports.parsePrivyProperties = parsePrivyProperties;
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
function parsePrivyProperties(user) {
|
|
31
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
31
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
32
32
|
var accounts = user.linkedAccounts || [];
|
|
33
33
|
// Extract profile properties
|
|
34
34
|
var properties = {
|
|
35
35
|
privyDid: user.id,
|
|
36
|
-
privyCreatedAt: user.createdAt,
|
|
36
|
+
privyCreatedAt: (_a = user.createdAt) === null || _a === void 0 ? void 0 : _a.getTime(),
|
|
37
37
|
};
|
|
38
38
|
// Email
|
|
39
|
-
if ((
|
|
39
|
+
if ((_b = user.email) === null || _b === void 0 ? void 0 : _b.address) {
|
|
40
40
|
properties.email = user.email.address;
|
|
41
41
|
}
|
|
42
42
|
// Social accounts - extract usernames/identifiers
|
|
43
|
-
if ((
|
|
43
|
+
if ((_c = user.apple) === null || _c === void 0 ? void 0 : _c.email) {
|
|
44
44
|
properties.apple = user.apple.email;
|
|
45
45
|
}
|
|
46
|
-
if ((
|
|
46
|
+
if ((_d = user.discord) === null || _d === void 0 ? void 0 : _d.username) {
|
|
47
47
|
properties.discord = user.discord.username;
|
|
48
48
|
}
|
|
49
|
-
if ((
|
|
49
|
+
if ((_e = user.farcaster) === null || _e === void 0 ? void 0 : _e.username) {
|
|
50
50
|
properties.farcaster = user.farcaster.username;
|
|
51
51
|
}
|
|
52
|
-
if ((
|
|
52
|
+
if ((_f = user.github) === null || _f === void 0 ? void 0 : _f.username) {
|
|
53
53
|
properties.github = user.github.username;
|
|
54
54
|
}
|
|
55
|
-
if ((
|
|
55
|
+
if ((_g = user.google) === null || _g === void 0 ? void 0 : _g.email) {
|
|
56
56
|
properties.google = user.google.email;
|
|
57
57
|
}
|
|
58
|
-
if ((
|
|
58
|
+
if ((_h = user.instagram) === null || _h === void 0 ? void 0 : _h.username) {
|
|
59
59
|
properties.instagram = user.instagram.username;
|
|
60
60
|
}
|
|
61
|
-
if ((
|
|
61
|
+
if ((_j = user.line) === null || _j === void 0 ? void 0 : _j.email) {
|
|
62
62
|
properties.line = user.line.email;
|
|
63
63
|
}
|
|
64
|
-
if ((
|
|
64
|
+
if ((_k = user.linkedin) === null || _k === void 0 ? void 0 : _k.email) {
|
|
65
65
|
properties.linkedin = user.linkedin.email;
|
|
66
66
|
}
|
|
67
|
-
if ((
|
|
67
|
+
if ((_l = user.spotify) === null || _l === void 0 ? void 0 : _l.email) {
|
|
68
68
|
properties.spotify = user.spotify.email;
|
|
69
69
|
}
|
|
70
|
-
if ((
|
|
70
|
+
if ((_m = user.telegram) === null || _m === void 0 ? void 0 : _m.username) {
|
|
71
71
|
properties.telegram = user.telegram.username;
|
|
72
72
|
}
|
|
73
|
-
if ((
|
|
73
|
+
if ((_o = user.tiktok) === null || _o === void 0 ? void 0 : _o.username) {
|
|
74
74
|
properties.tiktok = user.tiktok.username;
|
|
75
75
|
}
|
|
76
|
-
if ((
|
|
76
|
+
if ((_p = user.twitter) === null || _p === void 0 ? void 0 : _p.username) {
|
|
77
77
|
properties.twitter = user.twitter.username;
|
|
78
78
|
}
|
|
79
79
|
// Fallback to linkedAccounts if convenience accessors are not populated
|
|
@@ -123,7 +123,7 @@ function parsePrivyProperties(user) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
if (!properties.line) {
|
|
126
|
-
var lineAccount = accounts.find(function (a) { return a.type === "
|
|
126
|
+
var lineAccount = accounts.find(function (a) { return a.type === "line_oauth"; });
|
|
127
127
|
if (lineAccount === null || lineAccount === void 0 ? void 0 : lineAccount.email) {
|
|
128
128
|
properties.line = lineAccount.email;
|
|
129
129
|
}
|
|
@@ -176,13 +176,16 @@ function parsePrivyProperties(user) {
|
|
|
176
176
|
}
|
|
177
177
|
// Extract wallet addresses
|
|
178
178
|
var wallets = accounts
|
|
179
|
-
.filter(function (a) { return a.type === "wallet" && a.address; })
|
|
180
|
-
.map(function (a) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
179
|
+
.filter(function (a) { return (a.type === "wallet" || a.type === "smart_wallet") && a.address; })
|
|
180
|
+
.map(function (a) {
|
|
181
|
+
var _a, _b;
|
|
182
|
+
return ({
|
|
183
|
+
address: a.address,
|
|
184
|
+
walletClient: (_a = (a.walletClientType || a.walletClient)) !== null && _a !== void 0 ? _a : undefined,
|
|
185
|
+
chainType: (_b = a.chainType) !== null && _b !== void 0 ? _b : undefined,
|
|
186
|
+
isEmbedded: a.walletClientType === "privy" || a.walletClient === "privy",
|
|
187
|
+
});
|
|
188
|
+
});
|
|
186
189
|
return { properties: properties, wallets: wallets };
|
|
187
190
|
}
|
|
188
191
|
//# sourceMappingURL=utils.js.map
|
|
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./address"), exports);
|
|
18
18
|
__exportStar(require("./base"), exports);
|
|
19
|
-
__exportStar(require("./builderCode"), exports);
|
|
20
19
|
__exportStar(require("./converter"), exports);
|
|
21
20
|
__exportStar(require("./generate"), exports);
|
|
22
21
|
__exportStar(require("./hash"), exports);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.28.
|
|
1
|
+
export declare const version = "1.28.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/cjs/src/version.js
CHANGED
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.version = void 0;
|
|
4
4
|
// This file is auto-generated by scripts/update-version.js during npm version
|
|
5
5
|
// Do not edit manually - it will be overwritten
|
|
6
|
-
exports.version = '1.28.
|
|
6
|
+
exports.version = '1.28.2';
|
|
7
7
|
//# sourceMappingURL=version.js.map
|
|
@@ -58,7 +58,6 @@ exports.WagmiEventHandler = void 0;
|
|
|
58
58
|
var events_1 = require("../types/events");
|
|
59
59
|
var logger_1 = require("../logger");
|
|
60
60
|
var utils_1 = require("./utils");
|
|
61
|
-
var builderCode_1 = require("../utils/builderCode");
|
|
62
61
|
/**
|
|
63
62
|
* Built-in transaction fields that could collide with function args.
|
|
64
63
|
* Defined at module level to avoid recreating on every method call.
|
|
@@ -73,7 +72,6 @@ var RESERVED_FIELDS = new Set([
|
|
|
73
72
|
"transactionHash",
|
|
74
73
|
"function_name",
|
|
75
74
|
"function_args",
|
|
76
|
-
"builder_codes",
|
|
77
75
|
]);
|
|
78
76
|
/**
|
|
79
77
|
* Clean up old entries from a Set to prevent memory leaks.
|
|
@@ -388,7 +386,7 @@ var WagmiEventHandler = /** @class */ (function () {
|
|
|
388
386
|
chainId: chainId,
|
|
389
387
|
blockNumber: (_a = receipt === null || receipt === void 0 ? void 0 : receipt.blockNumber) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
390
388
|
});
|
|
391
|
-
this.formo.transaction(__assign(__assign(__assign(__assign(__assign(
|
|
389
|
+
this.formo.transaction(__assign(__assign(__assign(__assign(__assign({ status: txStatus, chainId: chainId || 0, address: address, transactionHash: transactionHash }, ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.data) && { data: pendingTx.data })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.to) && { to: pendingTx.to })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.value) && { value: pendingTx.value })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.function_name) && { function_name: pendingTx.function_name })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.function_args) && { function_args: pendingTx.function_args })),
|
|
392
390
|
// Spread function args as additional properties (only colliding keys are prefixed)
|
|
393
391
|
pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.safeFunctionArgs);
|
|
394
392
|
// Clean up the pending transaction after confirmation
|
|
@@ -551,7 +549,7 @@ var WagmiEventHandler = /** @class */ (function () {
|
|
|
551
549
|
// Encode the function data synchronously if viem is available
|
|
552
550
|
var encodedData = (0, utils_1.encodeWriteContractData)(abi, fnName, args);
|
|
553
551
|
if (encodedData) {
|
|
554
|
-
// Include dataSuffix (ERC-8021 builder code) so
|
|
552
|
+
// Include dataSuffix (e.g. ERC-8021 builder code) so full calldata is sent to server
|
|
555
553
|
data = (0, utils_1.concatCalldataWithSuffix)(encodedData, dataSuffix);
|
|
556
554
|
logger_1.logger.debug("WagmiEventHandler: Encoded writeContract data", data.substring(0, 10));
|
|
557
555
|
}
|
|
@@ -563,9 +561,14 @@ var WagmiEventHandler = /** @class */ (function () {
|
|
|
563
561
|
data = variables.data;
|
|
564
562
|
to = variables.to;
|
|
565
563
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
564
|
+
logger_1.logger.info("WagmiEventHandler: Tracking transaction event", {
|
|
565
|
+
status: status_2,
|
|
566
|
+
mutationType: mutationType,
|
|
567
|
+
address: userAddress,
|
|
568
|
+
chainId: chainId,
|
|
569
|
+
transactionHash: transactionHash,
|
|
570
|
+
function_name: function_name,
|
|
571
|
+
});
|
|
569
572
|
// Build safeFunctionArgs with collision handling and struct flattening
|
|
570
573
|
var safeFunctionArgs = (0, utils_1.buildSafeFunctionArgs)(function_args, RESERVED_FIELDS);
|
|
571
574
|
// Store transaction details for BROADCASTED status to use in CONFIRMED/REVERTED
|
|
@@ -573,7 +576,7 @@ var WagmiEventHandler = /** @class */ (function () {
|
|
|
573
576
|
// Include the sender address to handle wallet switches between broadcast and confirmation
|
|
574
577
|
if (status_2 === events_1.TransactionStatus.BROADCASTED && transactionHash) {
|
|
575
578
|
var normalizedHash = transactionHash.toLowerCase();
|
|
576
|
-
var txDetails = __assign(__assign(__assign(__assign(__assign(__assign(
|
|
579
|
+
var txDetails = __assign(__assign(__assign(__assign(__assign(__assign({ address: userAddress }, (data && { data: data })), (to && { to: to })), (value && { value: value })), (function_name && { function_name: function_name })), (function_args && { function_args: function_args })), (safeFunctionArgs && { safeFunctionArgs: safeFunctionArgs }));
|
|
577
580
|
this.pendingTransactions.set(normalizedHash, txDetails);
|
|
578
581
|
logger_1.logger.debug("WagmiEventHandler: Stored pending transaction for confirmation", {
|
|
579
582
|
transactionHash: normalizedHash,
|
|
@@ -587,7 +590,7 @@ var WagmiEventHandler = /** @class */ (function () {
|
|
|
587
590
|
}
|
|
588
591
|
}
|
|
589
592
|
}
|
|
590
|
-
this.formo.transaction(__assign(__assign(__assign(__assign(__assign(__assign(
|
|
593
|
+
this.formo.transaction(__assign(__assign(__assign(__assign(__assign(__assign({ status: status_2, chainId: chainId || 0, address: userAddress }, (data && { data: data })), (to && { to: to })), (value && { value: value })), (transactionHash && { transactionHash: transactionHash })), (function_name && { function_name: function_name })), (function_args && { function_args: function_args })),
|
|
591
594
|
// Spread function args as additional properties (only colliding keys are prefixed)
|
|
592
595
|
safeFunctionArgs);
|
|
593
596
|
}
|
|
@@ -150,7 +150,7 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
150
150
|
* @param {(...args: unknown[]) => void} callback
|
|
151
151
|
* @returns {Promise<void>}
|
|
152
152
|
*/
|
|
153
|
-
transaction({ status, chainId, address, data, to, value, transactionHash, function_name, function_args,
|
|
153
|
+
transaction({ status, chainId, address, data, to, value, transactionHash, function_name, function_args, }: {
|
|
154
154
|
status: TransactionStatus;
|
|
155
155
|
chainId: ChainID;
|
|
156
156
|
address: Address;
|
|
@@ -160,7 +160,6 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
160
160
|
transactionHash?: string;
|
|
161
161
|
function_name?: string;
|
|
162
162
|
function_args?: Record<string, unknown>;
|
|
163
|
-
builder_codes?: string;
|
|
164
163
|
}, properties?: IFormoEventProperties, context?: IFormoEventContext, callback?: (...args: unknown[]) => void): Promise<void>;
|
|
165
164
|
/**
|
|
166
165
|
* Emits an identify event with current wallet address and provider info.
|
|
@@ -65,7 +65,6 @@ import { detectInjectedProviderInfo, isValidProvider } from "./provider";
|
|
|
65
65
|
import { FormoAnalyticsSession, SESSION_WALLET_DETECTED_KEY, SESSION_WALLET_IDENTIFIED_KEY, } from "./session";
|
|
66
66
|
import { SignatureStatus, TransactionStatus, WRAPPED_REQUEST_SYMBOL, WRAPPED_REQUEST_REF_SYMBOL, } from "./types";
|
|
67
67
|
import { validateAddress, validateAndChecksumAddress } from "./utils/address";
|
|
68
|
-
import { extractBuilderCodes } from "./utils/builderCode";
|
|
69
68
|
import { isLocalhost } from "./validators";
|
|
70
69
|
import { parseChainId } from "./utils/chain";
|
|
71
70
|
import { WagmiEventHandler } from "./wagmi";
|
|
@@ -465,10 +464,10 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
465
464
|
*/
|
|
466
465
|
FormoAnalytics.prototype.transaction = function (_a, properties_1, context_1, callback_1) {
|
|
467
466
|
return __awaiter(this, arguments, void 0, function (_b, properties, context, callback) {
|
|
468
|
-
var status = _b.status, chainId = _b.chainId, address = _b.address, data = _b.data, to = _b.to, value = _b.value, transactionHash = _b.transactionHash, function_name = _b.function_name, function_args = _b.function_args
|
|
467
|
+
var status = _b.status, chainId = _b.chainId, address = _b.address, data = _b.data, to = _b.to, value = _b.value, transactionHash = _b.transactionHash, function_name = _b.function_name, function_args = _b.function_args;
|
|
469
468
|
return __generator(this, function (_c) {
|
|
470
469
|
switch (_c.label) {
|
|
471
|
-
case 0: return [4 /*yield*/, this.trackEvent(EventType.TRANSACTION, __assign(__assign(__assign(
|
|
470
|
+
case 0: return [4 /*yield*/, this.trackEvent(EventType.TRANSACTION, __assign(__assign(__assign({ status: status, chainId: chainId, address: address, data: data, to: to, value: value }, (transactionHash && { transactionHash: transactionHash })), (function_name && { function_name: function_name })), (function_args && { function_args: function_args })), properties, context, callback)];
|
|
472
471
|
case 1:
|
|
473
472
|
_c.sent();
|
|
474
473
|
return [2 /*return*/];
|
|
@@ -1900,7 +1899,7 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1900
1899
|
};
|
|
1901
1900
|
FormoAnalytics.prototype.buildTransactionEventPayload = function (params, provider) {
|
|
1902
1901
|
return __awaiter(this, void 0, void 0, function () {
|
|
1903
|
-
var _a, data, from, to, value, validAddress,
|
|
1902
|
+
var _a, data, from, to, value, validAddress, _b;
|
|
1904
1903
|
var _c;
|
|
1905
1904
|
return __generator(this, function (_d) {
|
|
1906
1905
|
switch (_d.label) {
|
|
@@ -1910,7 +1909,6 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1910
1909
|
if (!validAddress) {
|
|
1911
1910
|
throw new Error("Invalid address in transaction payload: ".concat(from));
|
|
1912
1911
|
}
|
|
1913
|
-
builder_codes = extractBuilderCodes(data);
|
|
1914
1912
|
_c = {};
|
|
1915
1913
|
_b = this._evmChainId;
|
|
1916
1914
|
if (_b) return [3 /*break*/, 2];
|
|
@@ -1918,7 +1916,12 @@ var FormoAnalytics = /** @class */ (function () {
|
|
|
1918
1916
|
case 1:
|
|
1919
1917
|
_b = (_d.sent());
|
|
1920
1918
|
_d.label = 2;
|
|
1921
|
-
case 2: return [2 /*return*/,
|
|
1919
|
+
case 2: return [2 /*return*/, (_c.chainId = _b,
|
|
1920
|
+
_c.data = data,
|
|
1921
|
+
_c.address = validAddress,
|
|
1922
|
+
_c.to = to,
|
|
1923
|
+
_c.value = value,
|
|
1924
|
+
_c)];
|
|
1922
1925
|
}
|
|
1923
1926
|
});
|
|
1924
1927
|
});
|
|
@@ -35,7 +35,7 @@ declare class EventFactory implements IEventFactory {
|
|
|
35
35
|
generateDisconnectEvent(chainId?: ChainID, address?: Address, properties?: IFormoEventProperties, context?: IFormoEventContext): Promise<IFormoEvent>;
|
|
36
36
|
generateChainChangedEvent(chainId: ChainID, address: Address, properties?: IFormoEventProperties, context?: IFormoEventContext): Promise<IFormoEvent>;
|
|
37
37
|
generateSignatureEvent(status: SignatureStatus, chainId: ChainID, address: Address, message: string, signatureHash?: string, properties?: IFormoEventProperties, context?: IFormoEventContext): Promise<IFormoEvent>;
|
|
38
|
-
generateTransactionEvent(status: TransactionStatus, chainId: ChainID, address: Address, data?: string, to?: string, value?: string, transactionHash?: string, function_name?: string, function_args?: Record<string, unknown>,
|
|
38
|
+
generateTransactionEvent(status: TransactionStatus, chainId: ChainID, address: Address, data?: string, to?: string, value?: string, transactionHash?: string, function_name?: string, function_args?: Record<string, unknown>, properties?: IFormoEventProperties, context?: IFormoEventContext): Promise<IFormoEvent>;
|
|
39
39
|
generateTrackEvent(event: string, properties?: IFormoEventProperties, context?: IFormoEventContext): Promise<IFormoEvent>;
|
|
40
40
|
create(event: APIEvent, address?: Address, userId?: string): Promise<IFormoEvent>;
|
|
41
41
|
}
|
|
@@ -413,12 +413,12 @@ var EventFactory = /** @class */ (function () {
|
|
|
413
413
|
});
|
|
414
414
|
});
|
|
415
415
|
};
|
|
416
|
-
EventFactory.prototype.generateTransactionEvent = function (status, chainId, address, data, to, value, transactionHash, function_name, function_args,
|
|
416
|
+
EventFactory.prototype.generateTransactionEvent = function (status, chainId, address, data, to, value, transactionHash, function_name, function_args, properties, context) {
|
|
417
417
|
return __awaiter(this, void 0, void 0, function () {
|
|
418
418
|
var transactionEvent;
|
|
419
419
|
return __generator(this, function (_a) {
|
|
420
420
|
transactionEvent = {
|
|
421
|
-
properties: __assign(__assign(__assign(__assign(__assign(__assign(__assign(
|
|
421
|
+
properties: __assign(__assign(__assign(__assign(__assign(__assign(__assign({ status: status, chainId: chainId }, (data && { data: data })), (to && { to: to })), (value && { value: value })), (transactionHash && { transactionHash: transactionHash })), (function_name && { function_name: function_name })), (function_args && { function_args: function_args })), properties),
|
|
422
422
|
address: address,
|
|
423
423
|
type: "transaction",
|
|
424
424
|
};
|
|
@@ -497,7 +497,7 @@ var EventFactory = /** @class */ (function () {
|
|
|
497
497
|
case 14:
|
|
498
498
|
formoEvent = _b.sent();
|
|
499
499
|
return [3 /*break*/, 19];
|
|
500
|
-
case 15: return [4 /*yield*/, this.generateTransactionEvent(event.status, event.chainId, event.address, event.data, event.to, event.value, event.transactionHash, event.function_name, event.function_args, event.
|
|
500
|
+
case 15: return [4 /*yield*/, this.generateTransactionEvent(event.status, event.chainId, event.address, event.data, event.to, event.value, event.transactionHash, event.function_name, event.function_args, event.properties, event.context)];
|
|
501
501
|
case 16:
|
|
502
502
|
formoEvent = _b.sent();
|
|
503
503
|
return [3 /*break*/, 19];
|