@augustdigital/sdk 6.0.1 → 7.0.1
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/lib/adapters/evm/getters.d.ts +1 -1
- package/lib/adapters/evm/getters.js +14 -19
- package/lib/adapters/evm/index.d.ts +8 -1
- package/lib/adapters/evm/index.js +24 -0
- package/lib/adapters/solana/index.d.ts +4 -4
- package/lib/adapters/solana/utils.d.ts +5 -4
- package/lib/adapters/solana/utils.js +82 -45
- package/lib/adapters/solana/vault.actions.d.ts +2 -2
- package/lib/adapters/solana/vault.actions.js +112 -74
- package/lib/adapters/stellar/actions.js +3 -2
- package/lib/adapters/stellar/constants.d.ts +2 -0
- package/lib/adapters/stellar/constants.js +3 -1
- package/lib/adapters/stellar/getters.js +2 -2
- package/lib/adapters/stellar/soroban.js +19 -8
- package/lib/adapters/stellar/submit.js +16 -6
- package/lib/adapters/stellar/utils.d.ts +2 -1
- package/lib/adapters/stellar/utils.js +7 -15
- package/lib/adapters/sui/utils.d.ts +1 -1
- package/lib/adapters/sui/utils.js +3 -7
- package/lib/core/analytics/chain-name.d.ts +1 -0
- package/lib/core/analytics/chain-name.js +26 -0
- package/lib/core/analytics/env.d.ts +4 -0
- package/lib/core/analytics/env.js +33 -0
- package/lib/core/analytics/index.d.ts +6 -2
- package/lib/core/analytics/index.js +16 -1
- package/lib/core/analytics/instrumentation.js +56 -48
- package/lib/core/analytics/method-taxonomy.d.ts +3 -0
- package/lib/core/analytics/method-taxonomy.js +82 -0
- package/lib/core/analytics/metrics.js +18 -42
- package/lib/core/analytics/sanitize.d.ts +1 -0
- package/lib/core/analytics/sanitize.js +34 -0
- package/lib/core/analytics/sentry-runtime.d.ts +4 -0
- package/lib/core/analytics/sentry-runtime.js +78 -0
- package/lib/core/analytics/sentry.d.ts +7 -1
- package/lib/core/analytics/sentry.js +107 -51
- package/lib/core/analytics/types.d.ts +2 -0
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/base.class.d.ts +2 -1
- package/lib/core/base.class.js +5 -1
- package/lib/core/cache.d.ts +4 -0
- package/lib/core/cache.js +25 -0
- package/lib/core/fetcher.d.ts +4 -4
- package/lib/core/fetcher.js +49 -60
- package/lib/core/helpers/chain-address.d.ts +3 -0
- package/lib/core/helpers/chain-address.js +36 -0
- package/lib/core/helpers/explorer-link.d.ts +2 -0
- package/lib/core/helpers/explorer-link.js +12 -0
- package/lib/core/helpers/vault-version.d.ts +4 -0
- package/lib/core/helpers/vault-version.js +59 -0
- package/lib/core/helpers/vaults.d.ts +3 -4
- package/lib/core/helpers/vaults.js +12 -62
- package/lib/core/helpers/web3.d.ts +6 -6
- package/lib/core/helpers/web3.js +142 -79
- package/lib/core/logger/slack.js +2 -2
- package/lib/core/vault-metadata.d.ts +6 -0
- package/lib/core/vault-metadata.js +36 -0
- package/lib/evm/methods/crossChainVault.js +72 -16
- package/lib/evm/types/crossChain.d.ts +4 -0
- package/lib/evm/types/crossChain.js +6 -0
- package/lib/modules/vaults/fetcher.d.ts +1 -6
- package/lib/modules/vaults/fetcher.js +27 -36
- package/lib/modules/vaults/getters.d.ts +1 -1
- package/lib/modules/vaults/getters.js +3 -2
- package/lib/modules/vaults/read.actions.d.ts +27 -0
- package/lib/modules/vaults/read.actions.js +220 -0
- package/lib/modules/vaults/utils/date-utils.js +1 -2
- package/lib/modules/vaults/utils.js +57 -36
- package/lib/modules/vaults/write.actions.d.ts +35 -2
- package/lib/modules/vaults/write.actions.js +254 -94
- package/package.json +3 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export type { IAnalyticsConfig, IUserIdentity, IMethodCallMetrics, } from './types';
|
|
2
2
|
export { hashApiKey, getSessionId, generateFingerprint, createUserIdentity, getUserId, } from './user-identity';
|
|
3
|
-
export { initializeSentry, updateUser, clearUser, isAnalyticsEnabled, getSentry, resetAnalytics, } from './sentry';
|
|
3
|
+
export { initializeSentry, updateUser, clearUser, isAnalyticsEnabled, getSentry, resetAnalytics, captureSdkException, } from './sentry';
|
|
4
|
+
export { getSentrySDK, getSentryRuntime } from './sentry-runtime';
|
|
5
|
+
export { readEnv, isAnalyticsDisabledViaEnv, isAnalyticsForcedOnViaEnv, isNodeDevOrTestEnv, } from './env';
|
|
4
6
|
export { trackApiCall, trackNetworkSwitch, getCacheStats, resetCacheStats, } from './metrics';
|
|
5
|
-
export { sanitizeArgs, sanitizeObject } from './sanitize';
|
|
7
|
+
export { sanitizeArgs, sanitizeObject, computeArgShape } from './sanitize';
|
|
6
8
|
export { withMethodTracking, withSyncMethodTracking, instrumentClass, } from './instrumentation';
|
|
9
|
+
export { METHOD_CATEGORIES, getMethodCategory, type MethodCategory, } from './method-taxonomy';
|
|
10
|
+
export { chainIdToTagValue } from './chain-name';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.instrumentClass = exports.withSyncMethodTracking = exports.withMethodTracking = exports.sanitizeObject = exports.sanitizeArgs = exports.resetCacheStats = exports.getCacheStats = exports.trackNetworkSwitch = exports.trackApiCall = exports.resetAnalytics = exports.getSentry = exports.isAnalyticsEnabled = exports.clearUser = exports.updateUser = exports.initializeSentry = exports.getUserId = exports.createUserIdentity = exports.generateFingerprint = exports.getSessionId = exports.hashApiKey = void 0;
|
|
3
|
+
exports.chainIdToTagValue = exports.getMethodCategory = exports.METHOD_CATEGORIES = exports.instrumentClass = exports.withSyncMethodTracking = exports.withMethodTracking = exports.computeArgShape = exports.sanitizeObject = exports.sanitizeArgs = exports.resetCacheStats = exports.getCacheStats = exports.trackNetworkSwitch = exports.trackApiCall = exports.isNodeDevOrTestEnv = exports.isAnalyticsForcedOnViaEnv = exports.isAnalyticsDisabledViaEnv = exports.readEnv = exports.getSentryRuntime = exports.getSentrySDK = exports.captureSdkException = exports.resetAnalytics = exports.getSentry = exports.isAnalyticsEnabled = exports.clearUser = exports.updateUser = exports.initializeSentry = exports.getUserId = exports.createUserIdentity = exports.generateFingerprint = exports.getSessionId = exports.hashApiKey = void 0;
|
|
4
4
|
var user_identity_1 = require("./user-identity");
|
|
5
5
|
Object.defineProperty(exports, "hashApiKey", { enumerable: true, get: function () { return user_identity_1.hashApiKey; } });
|
|
6
6
|
Object.defineProperty(exports, "getSessionId", { enumerable: true, get: function () { return user_identity_1.getSessionId; } });
|
|
@@ -14,6 +14,15 @@ Object.defineProperty(exports, "clearUser", { enumerable: true, get: function ()
|
|
|
14
14
|
Object.defineProperty(exports, "isAnalyticsEnabled", { enumerable: true, get: function () { return sentry_1.isAnalyticsEnabled; } });
|
|
15
15
|
Object.defineProperty(exports, "getSentry", { enumerable: true, get: function () { return sentry_1.getSentry; } });
|
|
16
16
|
Object.defineProperty(exports, "resetAnalytics", { enumerable: true, get: function () { return sentry_1.resetAnalytics; } });
|
|
17
|
+
Object.defineProperty(exports, "captureSdkException", { enumerable: true, get: function () { return sentry_1.captureSdkException; } });
|
|
18
|
+
var sentry_runtime_1 = require("./sentry-runtime");
|
|
19
|
+
Object.defineProperty(exports, "getSentrySDK", { enumerable: true, get: function () { return sentry_runtime_1.getSentrySDK; } });
|
|
20
|
+
Object.defineProperty(exports, "getSentryRuntime", { enumerable: true, get: function () { return sentry_runtime_1.getSentryRuntime; } });
|
|
21
|
+
var env_1 = require("./env");
|
|
22
|
+
Object.defineProperty(exports, "readEnv", { enumerable: true, get: function () { return env_1.readEnv; } });
|
|
23
|
+
Object.defineProperty(exports, "isAnalyticsDisabledViaEnv", { enumerable: true, get: function () { return env_1.isAnalyticsDisabledViaEnv; } });
|
|
24
|
+
Object.defineProperty(exports, "isAnalyticsForcedOnViaEnv", { enumerable: true, get: function () { return env_1.isAnalyticsForcedOnViaEnv; } });
|
|
25
|
+
Object.defineProperty(exports, "isNodeDevOrTestEnv", { enumerable: true, get: function () { return env_1.isNodeDevOrTestEnv; } });
|
|
17
26
|
var metrics_1 = require("./metrics");
|
|
18
27
|
Object.defineProperty(exports, "trackApiCall", { enumerable: true, get: function () { return metrics_1.trackApiCall; } });
|
|
19
28
|
Object.defineProperty(exports, "trackNetworkSwitch", { enumerable: true, get: function () { return metrics_1.trackNetworkSwitch; } });
|
|
@@ -22,8 +31,14 @@ Object.defineProperty(exports, "resetCacheStats", { enumerable: true, get: funct
|
|
|
22
31
|
var sanitize_1 = require("./sanitize");
|
|
23
32
|
Object.defineProperty(exports, "sanitizeArgs", { enumerable: true, get: function () { return sanitize_1.sanitizeArgs; } });
|
|
24
33
|
Object.defineProperty(exports, "sanitizeObject", { enumerable: true, get: function () { return sanitize_1.sanitizeObject; } });
|
|
34
|
+
Object.defineProperty(exports, "computeArgShape", { enumerable: true, get: function () { return sanitize_1.computeArgShape; } });
|
|
25
35
|
var instrumentation_1 = require("./instrumentation");
|
|
26
36
|
Object.defineProperty(exports, "withMethodTracking", { enumerable: true, get: function () { return instrumentation_1.withMethodTracking; } });
|
|
27
37
|
Object.defineProperty(exports, "withSyncMethodTracking", { enumerable: true, get: function () { return instrumentation_1.withSyncMethodTracking; } });
|
|
28
38
|
Object.defineProperty(exports, "instrumentClass", { enumerable: true, get: function () { return instrumentation_1.instrumentClass; } });
|
|
39
|
+
var method_taxonomy_1 = require("./method-taxonomy");
|
|
40
|
+
Object.defineProperty(exports, "METHOD_CATEGORIES", { enumerable: true, get: function () { return method_taxonomy_1.METHOD_CATEGORIES; } });
|
|
41
|
+
Object.defineProperty(exports, "getMethodCategory", { enumerable: true, get: function () { return method_taxonomy_1.getMethodCategory; } });
|
|
42
|
+
var chain_name_1 = require("./chain-name");
|
|
43
|
+
Object.defineProperty(exports, "chainIdToTagValue", { enumerable: true, get: function () { return chain_name_1.chainIdToTagValue; } });
|
|
29
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,58 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.withMethodTracking = withMethodTracking;
|
|
37
4
|
exports.withSyncMethodTracking = withSyncMethodTracking;
|
|
38
5
|
exports.instrumentClass = instrumentClass;
|
|
39
|
-
const
|
|
6
|
+
const chain_name_1 = require("./chain-name");
|
|
7
|
+
const method_taxonomy_1 = require("./method-taxonomy");
|
|
40
8
|
const sanitize_1 = require("./sanitize");
|
|
9
|
+
const sentry_runtime_1 = require("./sentry-runtime");
|
|
41
10
|
const sentry_1 = require("./sentry");
|
|
42
11
|
function withMethodTracking(methodName, method, getChainId) {
|
|
43
12
|
return async function trackedMethod(...args) {
|
|
44
13
|
if (!(0, sentry_1.isAnalyticsEnabled)()) {
|
|
45
14
|
return method(...args);
|
|
46
15
|
}
|
|
16
|
+
const sdk = (0, sentry_runtime_1.getSentrySDK)();
|
|
17
|
+
if (!sdk) {
|
|
18
|
+
return method(...args);
|
|
19
|
+
}
|
|
47
20
|
const startTime = performance.now();
|
|
48
21
|
const chainId = getChainId?.();
|
|
22
|
+
const category = (0, method_taxonomy_1.getMethodCategory)(methodName);
|
|
49
23
|
const sanitizedArgs = (0, sanitize_1.sanitizeArgs)(args);
|
|
24
|
+
const argShape = (0, sanitize_1.computeArgShape)(args);
|
|
50
25
|
try {
|
|
51
|
-
return await
|
|
26
|
+
return await sdk.startSpan({
|
|
52
27
|
op: 'sdk.method',
|
|
53
28
|
name: methodName,
|
|
54
29
|
attributes: {
|
|
55
30
|
chainId: chainId?.toString() || 'unknown',
|
|
31
|
+
'sdk.chain': (0, chain_name_1.chainIdToTagValue)(chainId),
|
|
32
|
+
'sdk.category': category,
|
|
33
|
+
'sdk.argShape': argShape.join('|'),
|
|
56
34
|
...sanitizedArgs,
|
|
57
35
|
},
|
|
58
36
|
}, async (span) => {
|
|
@@ -63,10 +41,11 @@ function withMethodTracking(methodName, method, getChainId) {
|
|
|
63
41
|
span?.setAttribute('success', true);
|
|
64
42
|
trackMethodCall(methodName, {
|
|
65
43
|
method: methodName,
|
|
44
|
+
category,
|
|
66
45
|
chainId,
|
|
67
46
|
duration,
|
|
68
47
|
success: true,
|
|
69
|
-
}, sanitizedArgs);
|
|
48
|
+
}, { ...sanitizedArgs, argShape: argShape.join('|') });
|
|
70
49
|
span?.setStatus({ code: 1 });
|
|
71
50
|
return result;
|
|
72
51
|
}
|
|
@@ -78,11 +57,12 @@ function withMethodTracking(methodName, method, getChainId) {
|
|
|
78
57
|
span?.setAttribute('error', error instanceof Error ? error.message : String(error));
|
|
79
58
|
trackMethodCall(methodName, {
|
|
80
59
|
method: methodName,
|
|
60
|
+
category,
|
|
81
61
|
chainId,
|
|
82
62
|
duration,
|
|
83
63
|
success: false,
|
|
84
64
|
errorType,
|
|
85
|
-
}, sanitizedArgs);
|
|
65
|
+
}, { ...sanitizedArgs, argShape: argShape.join('|') });
|
|
86
66
|
span?.setStatus({ code: 2, message: errorType });
|
|
87
67
|
throw error;
|
|
88
68
|
}
|
|
@@ -98,21 +78,31 @@ function withMethodTracking(methodName, method, getChainId) {
|
|
|
98
78
|
}
|
|
99
79
|
function trackMethodCall(methodName, metrics, args) {
|
|
100
80
|
try {
|
|
101
|
-
|
|
81
|
+
const sdk = (0, sentry_runtime_1.getSentrySDK)();
|
|
82
|
+
if (!sdk)
|
|
83
|
+
return;
|
|
84
|
+
sdk.addBreadcrumb({
|
|
102
85
|
category: 'sdk.method',
|
|
103
86
|
message: methodName,
|
|
104
87
|
level: metrics.success ? 'info' : 'error',
|
|
105
88
|
data: {
|
|
106
89
|
chainId: metrics.chainId,
|
|
90
|
+
category: metrics.category,
|
|
107
91
|
duration: Math.round(metrics.duration),
|
|
108
92
|
errorType: metrics.errorType,
|
|
109
93
|
...args,
|
|
110
94
|
},
|
|
111
95
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
96
|
+
sdk.setMeasurement('sdk.method.duration', metrics.duration, 'millisecond');
|
|
97
|
+
sdk.setMeasurement('sdk.method.invocation', 1, 'none');
|
|
98
|
+
sdk.setMeasurement('sdk.method.error', metrics.success ? 0 : 1, 'none');
|
|
99
|
+
sdk.setTag('sdk.last_method', methodName);
|
|
100
|
+
if (metrics.category) {
|
|
101
|
+
sdk.setTag('sdk.category', metrics.category);
|
|
102
|
+
}
|
|
103
|
+
if (metrics.chainId !== undefined) {
|
|
104
|
+
sdk.setTag('sdk.chain', (0, chain_name_1.chainIdToTagValue)(metrics.chainId));
|
|
105
|
+
sdk.setTag('sdk.last_chainId', metrics.chainId.toString());
|
|
116
106
|
}
|
|
117
107
|
}
|
|
118
108
|
catch {
|
|
@@ -130,18 +120,25 @@ function withSyncMethodTracking(methodName, method, getChainId) {
|
|
|
130
120
|
if (!(0, sentry_1.isAnalyticsEnabled)()) {
|
|
131
121
|
return method(...args);
|
|
132
122
|
}
|
|
123
|
+
const sdk = (0, sentry_runtime_1.getSentrySDK)();
|
|
124
|
+
if (!sdk) {
|
|
125
|
+
return method(...args);
|
|
126
|
+
}
|
|
133
127
|
const startTime = performance.now();
|
|
134
128
|
const chainId = getChainId?.();
|
|
129
|
+
const category = (0, method_taxonomy_1.getMethodCategory)(methodName);
|
|
135
130
|
const sanitizedArgs = (0, sanitize_1.sanitizeArgs)(args);
|
|
131
|
+
const argShape = (0, sanitize_1.computeArgShape)(args);
|
|
136
132
|
try {
|
|
137
133
|
const result = method(...args);
|
|
138
134
|
const duration = performance.now() - startTime;
|
|
139
135
|
trackSyncMethodCall(methodName, {
|
|
140
136
|
method: methodName,
|
|
137
|
+
category,
|
|
141
138
|
chainId,
|
|
142
139
|
duration,
|
|
143
140
|
success: true,
|
|
144
|
-
}, sanitizedArgs);
|
|
141
|
+
}, { ...sanitizedArgs, argShape: argShape.join('|') });
|
|
145
142
|
return result;
|
|
146
143
|
}
|
|
147
144
|
catch (error) {
|
|
@@ -149,31 +146,42 @@ function withSyncMethodTracking(methodName, method, getChainId) {
|
|
|
149
146
|
const errorType = error instanceof Error ? error.name : 'UnknownError';
|
|
150
147
|
trackSyncMethodCall(methodName, {
|
|
151
148
|
method: methodName,
|
|
149
|
+
category,
|
|
152
150
|
chainId,
|
|
153
151
|
duration,
|
|
154
152
|
success: false,
|
|
155
153
|
errorType,
|
|
156
|
-
}, sanitizedArgs);
|
|
154
|
+
}, { ...sanitizedArgs, argShape: argShape.join('|') });
|
|
157
155
|
throw error;
|
|
158
156
|
}
|
|
159
157
|
};
|
|
160
158
|
}
|
|
161
159
|
function trackSyncMethodCall(methodName, metrics, args) {
|
|
162
160
|
try {
|
|
163
|
-
|
|
161
|
+
const sdk = (0, sentry_runtime_1.getSentrySDK)();
|
|
162
|
+
if (!sdk)
|
|
163
|
+
return;
|
|
164
|
+
sdk.addBreadcrumb({
|
|
164
165
|
category: 'sdk.sync_method',
|
|
165
166
|
message: methodName,
|
|
166
167
|
level: metrics.success ? 'info' : 'error',
|
|
167
168
|
data: {
|
|
168
169
|
chainId: metrics.chainId,
|
|
170
|
+
category: metrics.category,
|
|
169
171
|
duration: Math.round(metrics.duration),
|
|
170
172
|
errorType: metrics.errorType,
|
|
171
173
|
...args,
|
|
172
174
|
},
|
|
173
175
|
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
176
|
+
sdk.setMeasurement('sdk.method.invocation', 1, 'none');
|
|
177
|
+
sdk.setMeasurement('sdk.method.error', metrics.success ? 0 : 1, 'none');
|
|
178
|
+
sdk.setTag('sdk.last_sync_method', methodName);
|
|
179
|
+
if (metrics.category) {
|
|
180
|
+
sdk.setTag('sdk.category', metrics.category);
|
|
181
|
+
}
|
|
182
|
+
if (metrics.chainId !== undefined) {
|
|
183
|
+
sdk.setTag('sdk.chain', (0, chain_name_1.chainIdToTagValue)(metrics.chainId));
|
|
184
|
+
sdk.setTag('sdk.last_chainId', metrics.chainId.toString());
|
|
177
185
|
}
|
|
178
186
|
}
|
|
179
187
|
catch {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type MethodCategory = 'read.vault' | 'read.position' | 'read.redemption' | 'read.price' | 'read.points' | 'read.subaccount' | 'read.staking' | 'read.layerzero' | 'read.solana' | 'read.stellar' | 'read.sui' | 'read.evm' | 'write.deposit' | 'write.redeem' | 'write.approve' | 'write.points' | 'write.stellar' | 'network' | 'bridge' | 'unknown';
|
|
2
|
+
export declare const METHOD_CATEGORIES: Readonly<Record<string, MethodCategory>>;
|
|
3
|
+
export declare function getMethodCategory(methodName: string): MethodCategory;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.METHOD_CATEGORIES = void 0;
|
|
4
|
+
exports.getMethodCategory = getMethodCategory;
|
|
5
|
+
exports.METHOD_CATEGORIES = {
|
|
6
|
+
getVault: 'read.vault',
|
|
7
|
+
getVaults: 'read.vault',
|
|
8
|
+
getTotalDeposited: 'read.vault',
|
|
9
|
+
getVaultLoans: 'read.vault',
|
|
10
|
+
getVaultSubaccountLoans: 'read.vault',
|
|
11
|
+
getVaultAllocations: 'read.vault',
|
|
12
|
+
getVaultApy: 'read.vault',
|
|
13
|
+
getVaultAnnualizedApy: 'read.vault',
|
|
14
|
+
getVaultTvl: 'read.vault',
|
|
15
|
+
getVaultHistoricalTimeseries: 'read.vault',
|
|
16
|
+
getVaultSummary: 'read.vault',
|
|
17
|
+
getVaultPnl: 'read.vault',
|
|
18
|
+
getVaultBorrowerHealthFactor: 'read.vault',
|
|
19
|
+
getYieldLastRealizedOn: 'read.vault',
|
|
20
|
+
getVaultPositions: 'read.position',
|
|
21
|
+
getVaultUserHistory: 'read.position',
|
|
22
|
+
getUserHistory: 'read.position',
|
|
23
|
+
getVaultUserTransfers: 'read.position',
|
|
24
|
+
getUserTransfers: 'read.position',
|
|
25
|
+
getVaultUserLifetimePnl: 'read.position',
|
|
26
|
+
getVaultAvailableRedemptions: 'read.redemption',
|
|
27
|
+
getVaultRedemptionHistory: 'read.redemption',
|
|
28
|
+
getVaultPendingRedemptions: 'read.redemption',
|
|
29
|
+
getVaultWithdrawals: 'read.redemption',
|
|
30
|
+
getWithdrawalRequestsWithStatus: 'read.redemption',
|
|
31
|
+
previewRedemption: 'read.redemption',
|
|
32
|
+
getPrice: 'read.price',
|
|
33
|
+
getUserPoints: 'read.points',
|
|
34
|
+
fetchPointsLeaderboard: 'read.points',
|
|
35
|
+
getSubaccountHealthFactor: 'read.subaccount',
|
|
36
|
+
getSubaccountLoans: 'read.subaccount',
|
|
37
|
+
getSubaccountCefiPositions: 'read.subaccount',
|
|
38
|
+
getSubaccountOtcPositions: 'read.subaccount',
|
|
39
|
+
getSubaccountSummary: 'read.subaccount',
|
|
40
|
+
getStakingPositions: 'read.staking',
|
|
41
|
+
getVaultStakingPositions: 'read.staking',
|
|
42
|
+
getLayerZeroDeposits: 'read.layerzero',
|
|
43
|
+
getLayerZeroRedeems: 'read.layerzero',
|
|
44
|
+
getVaultState: 'read.solana',
|
|
45
|
+
getVaultStateReadOnly: 'read.solana',
|
|
46
|
+
getToken: 'read.solana',
|
|
47
|
+
getTokenSymbol: 'read.solana',
|
|
48
|
+
fetchUserTokenBalance: 'read.solana',
|
|
49
|
+
fetchUserShareBalance: 'read.solana',
|
|
50
|
+
fetchUserShareBalanceRaw: 'read.solana',
|
|
51
|
+
submitTransaction: 'write.stellar',
|
|
52
|
+
getUserPosition: 'read.stellar',
|
|
53
|
+
convertToShares: 'read.stellar',
|
|
54
|
+
getEmberVaults: 'read.sui',
|
|
55
|
+
getEmberTVL: 'read.sui',
|
|
56
|
+
vaultAllowance: 'read.evm',
|
|
57
|
+
sendersWhitelistAddress: 'read.evm',
|
|
58
|
+
isWhitelisted: 'read.evm',
|
|
59
|
+
getDeposited: 'read.evm',
|
|
60
|
+
getRemainingAllocations: 'read.evm',
|
|
61
|
+
previewDeposit: 'read.vault',
|
|
62
|
+
previewRedeem: 'read.redemption',
|
|
63
|
+
allowance: 'read.evm',
|
|
64
|
+
balanceOf: 'read.evm',
|
|
65
|
+
maxDeposit: 'read.vault',
|
|
66
|
+
vaultDeposit: 'write.deposit',
|
|
67
|
+
depositNative: 'write.deposit',
|
|
68
|
+
vaultRedeem: 'write.redeem',
|
|
69
|
+
vaultRequestRedeem: 'write.redeem',
|
|
70
|
+
rwaRedeemAsset: 'write.redeem',
|
|
71
|
+
vaultApprove: 'write.approve',
|
|
72
|
+
approve: 'write.approve',
|
|
73
|
+
registerUserForPoints: 'write.points',
|
|
74
|
+
switchNetwork: 'network',
|
|
75
|
+
updateWallet: 'network',
|
|
76
|
+
clearWallet: 'network',
|
|
77
|
+
setSigner: 'network',
|
|
78
|
+
};
|
|
79
|
+
function getMethodCategory(methodName) {
|
|
80
|
+
return exports.METHOD_CATEGORIES[methodName] ?? 'unknown';
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=method-taxonomy.js.map
|
|
@@ -1,43 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.trackApiCall = trackApiCall;
|
|
37
4
|
exports.trackNetworkSwitch = trackNetworkSwitch;
|
|
38
5
|
exports.getCacheStats = getCacheStats;
|
|
39
6
|
exports.resetCacheStats = resetCacheStats;
|
|
40
|
-
const
|
|
7
|
+
const chain_name_1 = require("./chain-name");
|
|
8
|
+
const sentry_runtime_1 = require("./sentry-runtime");
|
|
41
9
|
const sentry_1 = require("./sentry");
|
|
42
10
|
let cacheStats = {
|
|
43
11
|
hits: 0,
|
|
@@ -48,9 +16,12 @@ function trackApiCall(endpoint, method, startTime, status, server) {
|
|
|
48
16
|
if (!(0, sentry_1.isAnalyticsEnabled)())
|
|
49
17
|
return;
|
|
50
18
|
try {
|
|
19
|
+
const sdk = (0, sentry_runtime_1.getSentrySDK)();
|
|
20
|
+
if (!sdk)
|
|
21
|
+
return;
|
|
51
22
|
const duration = performance.now() - startTime;
|
|
52
23
|
const normalizedEndpoint = normalizeEndpoint(endpoint);
|
|
53
|
-
|
|
24
|
+
sdk.addBreadcrumb({
|
|
54
25
|
category: 'api',
|
|
55
26
|
message: `${method} ${normalizedEndpoint}`,
|
|
56
27
|
level: status >= 400 || status === 0 ? 'error' : 'info',
|
|
@@ -62,9 +33,9 @@ function trackApiCall(endpoint, method, startTime, status, server) {
|
|
|
62
33
|
server,
|
|
63
34
|
},
|
|
64
35
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
36
|
+
sdk.setMeasurement('api.duration', duration, 'millisecond');
|
|
37
|
+
sdk.setTag('api.last_endpoint', normalizedEndpoint);
|
|
38
|
+
sdk.setTag('api.server', server);
|
|
68
39
|
}
|
|
69
40
|
catch {
|
|
70
41
|
}
|
|
@@ -73,13 +44,18 @@ function trackNetworkSwitch(chainId) {
|
|
|
73
44
|
if (!(0, sentry_1.isAnalyticsEnabled)())
|
|
74
45
|
return;
|
|
75
46
|
try {
|
|
76
|
-
|
|
47
|
+
const sdk = (0, sentry_runtime_1.getSentrySDK)();
|
|
48
|
+
if (!sdk)
|
|
49
|
+
return;
|
|
50
|
+
const chainLabel = (0, chain_name_1.chainIdToTagValue)(chainId);
|
|
51
|
+
sdk.addBreadcrumb({
|
|
77
52
|
category: 'network',
|
|
78
|
-
message: `Switched to chain ${chainId}`,
|
|
53
|
+
message: `Switched to chain ${chainId} (${chainLabel})`,
|
|
79
54
|
level: 'info',
|
|
80
|
-
data: { chainId },
|
|
55
|
+
data: { chainId, chain: chainLabel },
|
|
81
56
|
});
|
|
82
|
-
|
|
57
|
+
sdk.setTag('active.chainId', chainId.toString());
|
|
58
|
+
sdk.setTag('sdk.chain', chainLabel);
|
|
83
59
|
}
|
|
84
60
|
catch {
|
|
85
61
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function sanitizeString(input: string): string;
|
|
2
2
|
export declare function sanitizeError(err: unknown): unknown;
|
|
3
3
|
export declare function sanitizeForLogging(input: unknown, depth?: number): unknown;
|
|
4
|
+
export declare function computeArgShape(args: unknown[]): string[];
|
|
4
5
|
export declare function sanitizeArgs(args: unknown[]): Record<string, unknown>;
|
|
5
6
|
export declare function sanitizeObject(obj: Record<string, unknown>, depth?: number): Record<string, unknown>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.sanitizeString = sanitizeString;
|
|
4
4
|
exports.sanitizeError = sanitizeError;
|
|
5
5
|
exports.sanitizeForLogging = sanitizeForLogging;
|
|
6
|
+
exports.computeArgShape = computeArgShape;
|
|
6
7
|
exports.sanitizeArgs = sanitizeArgs;
|
|
7
8
|
exports.sanitizeObject = sanitizeObject;
|
|
8
9
|
const SENSITIVE_KEYS = [
|
|
@@ -91,6 +92,39 @@ function sanitizeForLogging(input, depth = 0) {
|
|
|
91
92
|
}
|
|
92
93
|
return `[${typeof input}]`;
|
|
93
94
|
}
|
|
95
|
+
function computeArgShape(args) {
|
|
96
|
+
return args.map((arg) => shapeOf(arg));
|
|
97
|
+
}
|
|
98
|
+
function shapeOf(value) {
|
|
99
|
+
if (value === null)
|
|
100
|
+
return 'null';
|
|
101
|
+
if (value === undefined)
|
|
102
|
+
return 'undefined';
|
|
103
|
+
const t = typeof value;
|
|
104
|
+
if (t === 'boolean' || t === 'number' || t === 'bigint' || t === 'function') {
|
|
105
|
+
return t;
|
|
106
|
+
}
|
|
107
|
+
if (t === 'string') {
|
|
108
|
+
const s = value;
|
|
109
|
+
if (/^0x[a-fA-F0-9]{40}$/.test(s))
|
|
110
|
+
return 'address';
|
|
111
|
+
if (/^0x[a-fA-F0-9]{64}$/.test(s))
|
|
112
|
+
return 'tx-hash';
|
|
113
|
+
if (/^0x[a-fA-F0-9]{6,}$/.test(s))
|
|
114
|
+
return 'hex';
|
|
115
|
+
return 'string';
|
|
116
|
+
}
|
|
117
|
+
if (Array.isArray(value)) {
|
|
118
|
+
return `array(${value.length})`;
|
|
119
|
+
}
|
|
120
|
+
if (t === 'object') {
|
|
121
|
+
const keys = Object.keys(value).sort();
|
|
122
|
+
const capped = keys.slice(0, 12);
|
|
123
|
+
const more = keys.length > 12 ? `,+${keys.length - 12}` : '';
|
|
124
|
+
return `options{${capped.join(',')}${more}}`;
|
|
125
|
+
}
|
|
126
|
+
return t;
|
|
127
|
+
}
|
|
94
128
|
function sanitizeArgs(args) {
|
|
95
129
|
const sanitized = {};
|
|
96
130
|
args.forEach((arg, index) => {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSentrySDK = getSentrySDK;
|
|
4
|
+
exports.getSentryRuntime = getSentryRuntime;
|
|
5
|
+
exports.resetSentryRuntime = resetSentryRuntime;
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
let cachedSdk = null;
|
|
8
|
+
let detectedRuntime = 'unknown';
|
|
9
|
+
function detectRuntime() {
|
|
10
|
+
try {
|
|
11
|
+
if (typeof window !== 'undefined' &&
|
|
12
|
+
typeof window.document !== 'undefined') {
|
|
13
|
+
return 'browser';
|
|
14
|
+
}
|
|
15
|
+
if (typeof process !== 'undefined' &&
|
|
16
|
+
!!process.versions?.node &&
|
|
17
|
+
typeof window === 'undefined') {
|
|
18
|
+
return 'node';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
}
|
|
23
|
+
return 'unknown';
|
|
24
|
+
}
|
|
25
|
+
function getNodeRequire() {
|
|
26
|
+
try {
|
|
27
|
+
const req = new Function('return typeof require === "function" ? require : null')();
|
|
28
|
+
return typeof req === 'function' ? req : null;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function loadSentrySDK() {
|
|
35
|
+
if (cachedSdk)
|
|
36
|
+
return cachedSdk;
|
|
37
|
+
detectedRuntime = detectRuntime();
|
|
38
|
+
if (detectedRuntime === 'node') {
|
|
39
|
+
const nodeRequire = getNodeRequire();
|
|
40
|
+
if (nodeRequire) {
|
|
41
|
+
try {
|
|
42
|
+
cachedSdk = nodeRequire('@sentry/node');
|
|
43
|
+
return cachedSdk;
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
logger_1.Logger.log.warn('analytics.runtime.sentry-node-missing', {
|
|
47
|
+
error: err instanceof Error ? err.message : String(err),
|
|
48
|
+
hint: 'Add @sentry/node to your dependencies for full Node telemetry coverage.',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
cachedSdk = require('@sentry/browser');
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
logger_1.Logger.log.warn('analytics.runtime.sentry-browser-missing', {
|
|
58
|
+
runtime: detectedRuntime,
|
|
59
|
+
error: err instanceof Error ? err.message : String(err),
|
|
60
|
+
});
|
|
61
|
+
cachedSdk = null;
|
|
62
|
+
}
|
|
63
|
+
return cachedSdk;
|
|
64
|
+
}
|
|
65
|
+
function getSentrySDK() {
|
|
66
|
+
return loadSentrySDK();
|
|
67
|
+
}
|
|
68
|
+
function getSentryRuntime() {
|
|
69
|
+
if (detectedRuntime === 'unknown') {
|
|
70
|
+
detectedRuntime = detectRuntime();
|
|
71
|
+
}
|
|
72
|
+
return detectedRuntime;
|
|
73
|
+
}
|
|
74
|
+
function resetSentryRuntime() {
|
|
75
|
+
cachedSdk = null;
|
|
76
|
+
detectedRuntime = 'unknown';
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=sentry-runtime.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as Sentry from '@sentry/browser';
|
|
1
|
+
import type * as Sentry from '@sentry/browser';
|
|
2
2
|
import { IEnv } from '../../types';
|
|
3
3
|
import { IAnalyticsConfig } from './types';
|
|
4
4
|
export declare function initializeSentry(config: IAnalyticsConfig, environment: IEnv, walletAddress?: string, apiKey?: string, appName?: string): void;
|
|
@@ -7,3 +7,9 @@ export declare function clearUser(): void;
|
|
|
7
7
|
export declare function isAnalyticsEnabled(): boolean;
|
|
8
8
|
export declare function getSentry(): typeof Sentry | null;
|
|
9
9
|
export declare function resetAnalytics(): void;
|
|
10
|
+
export declare function captureSdkException(error: unknown, options?: {
|
|
11
|
+
surface?: 'cli' | 'sdk' | 'react' | string;
|
|
12
|
+
tags?: Record<string, string>;
|
|
13
|
+
extra?: Record<string, unknown>;
|
|
14
|
+
flushTimeoutMs?: number;
|
|
15
|
+
}): Promise<void>;
|