@augustdigital/sdk 9.4.0 → 9.6.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/lib/adapters/evm/index.d.ts +1 -1
- package/lib/adapters/evm/index.js +29 -29
- package/lib/core/analytics/app-name.js +1 -1
- package/lib/core/analytics/constants.d.ts +10 -0
- package/lib/core/analytics/constants.js +17 -1
- package/lib/core/analytics/index.d.ts +7 -4
- package/lib/core/analytics/index.js +8 -4
- package/lib/core/analytics/instrumentation.js +8 -4
- package/lib/core/analytics/method-taxonomy.js +13 -0
- package/lib/core/analytics/metrics.d.ts +25 -10
- package/lib/core/analytics/metrics.js +41 -15
- package/lib/core/analytics/sentry.d.ts +24 -3
- package/lib/core/analytics/sentry.js +49 -18
- package/lib/core/analytics/types.d.ts +11 -4
- package/lib/core/analytics/user-identity.d.ts +19 -5
- package/lib/core/analytics/user-identity.js +35 -21
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/auth/verify.js +5 -1
- package/lib/core/base.class.js +3 -0
- package/lib/core/constants/core.d.ts +3 -0
- package/lib/core/constants/core.js +3 -0
- package/lib/core/constants/swap-router.d.ts +16 -0
- package/lib/core/constants/swap-router.js +16 -0
- package/lib/core/errors/index.d.ts +36 -1
- package/lib/core/errors/index.js +40 -1
- package/lib/core/fetcher.d.ts +13 -0
- package/lib/core/fetcher.js +33 -0
- package/lib/main.d.ts +5 -0
- package/lib/main.js +5 -0
- package/lib/modules/vaults/getters.d.ts +55 -0
- package/lib/modules/vaults/getters.js +58 -14
- package/lib/modules/vaults/main.d.ts +4 -0
- package/lib/modules/vaults/main.js +4 -0
- package/lib/modules/vaults/write.actions.d.ts +57 -1
- package/lib/modules/vaults/write.actions.js +86 -2
- package/lib/sdk.d.ts +13032 -12798
- package/lib/services/debank/utils.js +6 -5
- package/lib/types/vaults.d.ts +3 -0
- package/package.json +2 -2
|
@@ -28,7 +28,7 @@ declare class EVMAdapter {
|
|
|
28
28
|
* Get the normalized ethers-compatible signer
|
|
29
29
|
* Converts viem WalletClient to ethers Signer if needed
|
|
30
30
|
*/
|
|
31
|
-
private
|
|
31
|
+
private _getSigner;
|
|
32
32
|
vaultApprove(options: IContractWriteOptions): Promise<string>;
|
|
33
33
|
/**
|
|
34
34
|
* Approve a vault to spend a deposit token, returning a discriminated
|
|
@@ -49,7 +49,7 @@ class EVMAdapter {
|
|
|
49
49
|
* Get the normalized ethers-compatible signer
|
|
50
50
|
* Converts viem WalletClient to ethers Signer if needed
|
|
51
51
|
*/
|
|
52
|
-
async
|
|
52
|
+
async _getSigner() {
|
|
53
53
|
if (!this.rawSigner) {
|
|
54
54
|
throw new Error('No signer provided');
|
|
55
55
|
}
|
|
@@ -65,7 +65,7 @@ class EVMAdapter {
|
|
|
65
65
|
}
|
|
66
66
|
// Core EVM operations
|
|
67
67
|
async vaultApprove(options) {
|
|
68
|
-
const signer = await this.
|
|
68
|
+
const signer = await this._getSigner();
|
|
69
69
|
return (0, write_actions_1.vaultApprove)(signer, options);
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -86,7 +86,7 @@ class EVMAdapter {
|
|
|
86
86
|
* ```
|
|
87
87
|
*/
|
|
88
88
|
async approve(options) {
|
|
89
|
-
const signer = await this.
|
|
89
|
+
const signer = await this._getSigner();
|
|
90
90
|
return (0, write_actions_1.approve)(signer, options);
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
@@ -112,7 +112,7 @@ class EVMAdapter {
|
|
|
112
112
|
* ```
|
|
113
113
|
*/
|
|
114
114
|
async vaultAllowance(options) {
|
|
115
|
-
const signer = await this.
|
|
115
|
+
const signer = await this._getSigner();
|
|
116
116
|
return (0, read_actions_1.vaultAllowance)(signer, options);
|
|
117
117
|
}
|
|
118
118
|
// Vault operations (delegate to modules)
|
|
@@ -143,7 +143,7 @@ class EVMAdapter {
|
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
145
145
|
async vaultDeposit(options) {
|
|
146
|
-
const signer = await this.
|
|
146
|
+
const signer = await this._getSigner();
|
|
147
147
|
return (0, write_actions_1.vaultDeposit)(signer, options);
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
@@ -171,7 +171,7 @@ class EVMAdapter {
|
|
|
171
171
|
* ```
|
|
172
172
|
*/
|
|
173
173
|
async vaultRequestRedeem(options) {
|
|
174
|
-
const signer = await this.
|
|
174
|
+
const signer = await this._getSigner();
|
|
175
175
|
return (0, write_actions_1.vaultRequestRedeem)(signer, options);
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
@@ -197,7 +197,7 @@ class EVMAdapter {
|
|
|
197
197
|
* ```
|
|
198
198
|
*/
|
|
199
199
|
async depositNative(options) {
|
|
200
|
-
const signer = await this.
|
|
200
|
+
const signer = await this._getSigner();
|
|
201
201
|
return (0, write_actions_1.depositNative)(signer, options);
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
@@ -227,7 +227,7 @@ class EVMAdapter {
|
|
|
227
227
|
* ```
|
|
228
228
|
*/
|
|
229
229
|
async swapAndDeposit(options) {
|
|
230
|
-
const signer = await this.
|
|
230
|
+
const signer = await this._getSigner();
|
|
231
231
|
return (0, write_actions_1.swapAndDeposit)(signer, options);
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
@@ -239,7 +239,7 @@ class EVMAdapter {
|
|
|
239
239
|
* @returns The transaction hash of the `deposit` call.
|
|
240
240
|
*/
|
|
241
241
|
async depositViaSwapRouter(options) {
|
|
242
|
-
const signer = await this.
|
|
242
|
+
const signer = await this._getSigner();
|
|
243
243
|
return (0, write_actions_1.depositViaSwapRouter)(signer, options);
|
|
244
244
|
}
|
|
245
245
|
/**
|
|
@@ -251,7 +251,7 @@ class EVMAdapter {
|
|
|
251
251
|
* @returns The transaction hash of the `depositNativeToken` call.
|
|
252
252
|
*/
|
|
253
253
|
async depositNativeViaSwapRouter(options) {
|
|
254
|
-
const signer = await this.
|
|
254
|
+
const signer = await this._getSigner();
|
|
255
255
|
return (0, write_actions_1.depositNativeViaSwapRouter)(signer, options);
|
|
256
256
|
}
|
|
257
257
|
/**
|
|
@@ -277,7 +277,7 @@ class EVMAdapter {
|
|
|
277
277
|
* ```
|
|
278
278
|
*/
|
|
279
279
|
async swapRouterDeposit(options) {
|
|
280
|
-
const signer = await this.
|
|
280
|
+
const signer = await this._getSigner();
|
|
281
281
|
return (0, write_actions_1.swapRouterDeposit)(signer, options);
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
@@ -296,7 +296,7 @@ class EVMAdapter {
|
|
|
296
296
|
* ```
|
|
297
297
|
*/
|
|
298
298
|
async getSwapRouterDepositResult(options) {
|
|
299
|
-
const signer = await this.
|
|
299
|
+
const signer = await this._getSigner();
|
|
300
300
|
return (0, swap_router_1.getSwapRouterDepositResult)(signer, options);
|
|
301
301
|
}
|
|
302
302
|
/**
|
|
@@ -329,7 +329,7 @@ class EVMAdapter {
|
|
|
329
329
|
* ```
|
|
330
330
|
*/
|
|
331
331
|
async vaultRedeem(options) {
|
|
332
|
-
const signer = await this.
|
|
332
|
+
const signer = await this._getSigner();
|
|
333
333
|
return (0, write_actions_1.vaultRedeem)(signer, options);
|
|
334
334
|
}
|
|
335
335
|
/**
|
|
@@ -362,23 +362,23 @@ class EVMAdapter {
|
|
|
362
362
|
* ```
|
|
363
363
|
*/
|
|
364
364
|
async claimWithdrawal(options) {
|
|
365
|
-
const signer = await this.
|
|
365
|
+
const signer = await this._getSigner();
|
|
366
366
|
return (0, write_actions_1.claimWithdrawal)(signer, options);
|
|
367
367
|
}
|
|
368
368
|
async sendersWhitelistAddress(options) {
|
|
369
|
-
const signer = await this.
|
|
369
|
+
const signer = await this._getSigner();
|
|
370
370
|
return (0, read_actions_1.sendersWhitelistAddress)(signer, options);
|
|
371
371
|
}
|
|
372
372
|
async isWhitelisted(options) {
|
|
373
|
-
const signer = await this.
|
|
373
|
+
const signer = await this._getSigner();
|
|
374
374
|
return (0, read_actions_1.isWhitelisted)(signer, options);
|
|
375
375
|
}
|
|
376
376
|
async getDeposited(options) {
|
|
377
|
-
const signer = await this.
|
|
377
|
+
const signer = await this._getSigner();
|
|
378
378
|
return (0, read_actions_1.getDeposited)(signer, options);
|
|
379
379
|
}
|
|
380
380
|
async getRemainingAllocations(options) {
|
|
381
|
-
const signer = await this.
|
|
381
|
+
const signer = await this._getSigner();
|
|
382
382
|
return (0, read_actions_1.getRemainingAllocations)(signer, options);
|
|
383
383
|
}
|
|
384
384
|
/**
|
|
@@ -397,7 +397,7 @@ class EVMAdapter {
|
|
|
397
397
|
* ```
|
|
398
398
|
*/
|
|
399
399
|
async previewDeposit(options) {
|
|
400
|
-
const signer = await this.
|
|
400
|
+
const signer = await this._getSigner();
|
|
401
401
|
return (0, read_actions_1.previewDeposit)(signer, options);
|
|
402
402
|
}
|
|
403
403
|
/**
|
|
@@ -415,7 +415,7 @@ class EVMAdapter {
|
|
|
415
415
|
* ```
|
|
416
416
|
*/
|
|
417
417
|
async previewRedeem(options) {
|
|
418
|
-
const signer = await this.
|
|
418
|
+
const signer = await this._getSigner();
|
|
419
419
|
return (0, read_actions_1.previewRedeem)(signer, options);
|
|
420
420
|
}
|
|
421
421
|
/**
|
|
@@ -430,7 +430,7 @@ class EVMAdapter {
|
|
|
430
430
|
* ```
|
|
431
431
|
*/
|
|
432
432
|
async allowance(options) {
|
|
433
|
-
const signer = await this.
|
|
433
|
+
const signer = await this._getSigner();
|
|
434
434
|
return (0, read_actions_1.allowance)(signer, options);
|
|
435
435
|
}
|
|
436
436
|
/**
|
|
@@ -444,7 +444,7 @@ class EVMAdapter {
|
|
|
444
444
|
* ```
|
|
445
445
|
*/
|
|
446
446
|
async balanceOf(options) {
|
|
447
|
-
const signer = await this.
|
|
447
|
+
const signer = await this._getSigner();
|
|
448
448
|
return (0, read_actions_1.balanceOf)(signer, options);
|
|
449
449
|
}
|
|
450
450
|
/**
|
|
@@ -459,7 +459,7 @@ class EVMAdapter {
|
|
|
459
459
|
* ```
|
|
460
460
|
*/
|
|
461
461
|
async maxDeposit(options) {
|
|
462
|
-
const signer = await this.
|
|
462
|
+
const signer = await this._getSigner();
|
|
463
463
|
return (0, read_actions_1.maxDeposit)(signer, options);
|
|
464
464
|
}
|
|
465
465
|
/**
|
|
@@ -475,7 +475,7 @@ class EVMAdapter {
|
|
|
475
475
|
* ```
|
|
476
476
|
*/
|
|
477
477
|
async getIdleLiquidity(options) {
|
|
478
|
-
const signer = await this.
|
|
478
|
+
const signer = await this._getSigner();
|
|
479
479
|
return (0, read_actions_1.getIdleLiquidity)(signer, options);
|
|
480
480
|
}
|
|
481
481
|
/**
|
|
@@ -489,7 +489,7 @@ class EVMAdapter {
|
|
|
489
489
|
* ```
|
|
490
490
|
*/
|
|
491
491
|
async lagDuration(options) {
|
|
492
|
-
const signer = await this.
|
|
492
|
+
const signer = await this._getSigner();
|
|
493
493
|
return (0, read_actions_1.lagDuration)(signer, options);
|
|
494
494
|
}
|
|
495
495
|
/**
|
|
@@ -504,7 +504,7 @@ class EVMAdapter {
|
|
|
504
504
|
* ```
|
|
505
505
|
*/
|
|
506
506
|
async getWithdrawalEpoch(options) {
|
|
507
|
-
const signer = await this.
|
|
507
|
+
const signer = await this._getSigner();
|
|
508
508
|
return (0, read_actions_1.getWithdrawalEpoch)(signer, options);
|
|
509
509
|
}
|
|
510
510
|
/**
|
|
@@ -521,7 +521,7 @@ class EVMAdapter {
|
|
|
521
521
|
* ```
|
|
522
522
|
*/
|
|
523
523
|
async getBurnableAmountByReceiver(options) {
|
|
524
|
-
const signer = await this.
|
|
524
|
+
const signer = await this._getSigner();
|
|
525
525
|
return (0, read_actions_1.getBurnableAmountByReceiver)(signer, options);
|
|
526
526
|
}
|
|
527
527
|
/**
|
|
@@ -536,7 +536,7 @@ class EVMAdapter {
|
|
|
536
536
|
* ```
|
|
537
537
|
*/
|
|
538
538
|
async getRequirementByDate(options) {
|
|
539
|
-
const signer = await this.
|
|
539
|
+
const signer = await this._getSigner();
|
|
540
540
|
return (0, read_actions_1.getRequirementByDate)(signer, options);
|
|
541
541
|
}
|
|
542
542
|
/**
|
|
@@ -551,7 +551,7 @@ class EVMAdapter {
|
|
|
551
551
|
* ```
|
|
552
552
|
*/
|
|
553
553
|
async getScheduledTransactionsByDate(options) {
|
|
554
|
-
const signer = await this.
|
|
554
|
+
const signer = await this._getSigner();
|
|
555
555
|
return (0, read_actions_1.getScheduledTransactionsByDate)(signer, options);
|
|
556
556
|
}
|
|
557
557
|
}
|
|
@@ -29,7 +29,7 @@ const errors_1 = require("../errors");
|
|
|
29
29
|
* characters, or is shaped like an EVM address.
|
|
30
30
|
*/
|
|
31
31
|
function validateAppName(value) {
|
|
32
|
-
const docsHint = 'See https://docs.augustdigital.io/developers/typescript-sdk#app-name';
|
|
32
|
+
const docsHint = 'See https://docs.augustdigital.io/developers/typescript-sdk/javascript-sdk#app-name';
|
|
33
33
|
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
34
34
|
throw new errors_1.AugustValidationError('INVALID_INPUT', `August SDK: \`appName\` is required. Pass a stable kebab-case slug identifying your application (e.g. "acme-trader"). ${docsHint}`);
|
|
35
35
|
}
|
|
@@ -3,3 +3,13 @@
|
|
|
3
3
|
* This is an internal constant - not exposed to SDK users.
|
|
4
4
|
*/
|
|
5
5
|
export declare const SENTRY_DSN = "https://ca39246016d0b43154f0640314cbd3b5@o4507215496609792.ingest.de.sentry.io/4511864614813776";
|
|
6
|
+
/**
|
|
7
|
+
* `appName` slugs of applications August/Upshift operate themselves.
|
|
8
|
+
*
|
|
9
|
+
* Traffic from these is tagged `partner.tier: 'internal'` so that
|
|
10
|
+
* `partner.tier:unverified` in Sentry already means "external integrator"
|
|
11
|
+
* before the backend verification endpoint exists. Anything not listed stays
|
|
12
|
+
* `unverified`; the future verified flow adds a `verified` tier alongside
|
|
13
|
+
* rather than replacing this list.
|
|
14
|
+
*/
|
|
15
|
+
export declare const FIRST_PARTY_APP_NAMES: ReadonlySet<string>;
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SENTRY_DSN = void 0;
|
|
3
|
+
exports.FIRST_PARTY_APP_NAMES = exports.SENTRY_DSN = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Sentry DSN for SDK analytics.
|
|
6
6
|
* This is an internal constant - not exposed to SDK users.
|
|
7
7
|
*/
|
|
8
8
|
exports.SENTRY_DSN = 'https://ca39246016d0b43154f0640314cbd3b5@o4507215496609792.ingest.de.sentry.io/4511864614813776';
|
|
9
|
+
/**
|
|
10
|
+
* `appName` slugs of applications August/Upshift operate themselves.
|
|
11
|
+
*
|
|
12
|
+
* Traffic from these is tagged `partner.tier: 'internal'` so that
|
|
13
|
+
* `partner.tier:unverified` in Sentry already means "external integrator"
|
|
14
|
+
* before the backend verification endpoint exists. Anything not listed stays
|
|
15
|
+
* `unverified`; the future verified flow adds a `verified` tier alongside
|
|
16
|
+
* rather than replacing this list.
|
|
17
|
+
*/
|
|
18
|
+
exports.FIRST_PARTY_APP_NAMES = new Set([
|
|
19
|
+
'upshift-web-app',
|
|
20
|
+
'upshift-earn',
|
|
21
|
+
'upshift-prime',
|
|
22
|
+
'august-cli',
|
|
23
|
+
'august-mcp',
|
|
24
|
+
]);
|
|
9
25
|
//# sourceMappingURL=constants.js.map
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Analytics module for SDK usage tracking via Sentry.
|
|
3
3
|
*
|
|
4
4
|
* Features:
|
|
5
|
-
* - User identification (API key hash, wallet, fingerprint, session)
|
|
6
|
-
* - Method call tracking with timing
|
|
7
|
-
* -
|
|
5
|
+
* - User identification (API key hash, wallet, domain, fingerprint, session)
|
|
6
|
+
* - Method call tracking with timing, classified by {@link METHOD_CATEGORIES}
|
|
7
|
+
* - Application attribution (`app.name`, `partner.id`, `partner.tier`,
|
|
8
|
+
* `sdk.surface`) on every event and span
|
|
8
9
|
* - API response time tracking
|
|
9
10
|
* - Chain/network usage distribution
|
|
10
11
|
*
|
|
@@ -12,12 +13,14 @@
|
|
|
12
13
|
* ```typescript
|
|
13
14
|
* // Analytics enabled by default
|
|
14
15
|
* const sdk = new AugustSDK({
|
|
16
|
+
* appName: 'acme-trader',
|
|
15
17
|
* providers: { 1: 'https://...' },
|
|
16
18
|
* keys: { august: '...' },
|
|
17
19
|
* });
|
|
18
20
|
*
|
|
19
21
|
* // Opt-out of analytics
|
|
20
22
|
* const sdk = new AugustSDK({
|
|
23
|
+
* appName: 'acme-trader',
|
|
21
24
|
* providers: { 1: 'https://...' },
|
|
22
25
|
* keys: { august: '...' },
|
|
23
26
|
* analytics: { enabled: false },
|
|
@@ -29,7 +32,7 @@ export { hashApiKey, getSessionId, generateFingerprint, createUserIdentity, getU
|
|
|
29
32
|
export { initializeSentry, updateUser, clearUser, isAnalyticsEnabled, getSentry, resetAnalytics, captureSdkException, } from './sentry';
|
|
30
33
|
export { getSentrySDK, getSentryRuntime } from './sentry-runtime';
|
|
31
34
|
export { readEnv, isAnalyticsDisabledViaEnv, isAnalyticsForcedOnViaEnv, isNodeDevOrTestEnv, } from './env';
|
|
32
|
-
export { trackApiCall, trackNetworkSwitch, getCacheStats, resetCacheStats, } from './metrics';
|
|
35
|
+
export { trackApiCall, trackNetworkSwitch, trackKeyVerification, getCacheStats, resetCacheStats, } from './metrics';
|
|
33
36
|
export { sanitizeArgs, sanitizeObject, computeArgShape } from './sanitize';
|
|
34
37
|
export { withMethodTracking, withSyncMethodTracking, instrumentClass, } from './instrumentation';
|
|
35
38
|
export { METHOD_CATEGORIES, getMethodCategory, type MethodCategory, } from './method-taxonomy';
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Analytics module for SDK usage tracking via Sentry.
|
|
4
4
|
*
|
|
5
5
|
* Features:
|
|
6
|
-
* - User identification (API key hash, wallet, fingerprint, session)
|
|
7
|
-
* - Method call tracking with timing
|
|
8
|
-
* -
|
|
6
|
+
* - User identification (API key hash, wallet, domain, fingerprint, session)
|
|
7
|
+
* - Method call tracking with timing, classified by {@link METHOD_CATEGORIES}
|
|
8
|
+
* - Application attribution (`app.name`, `partner.id`, `partner.tier`,
|
|
9
|
+
* `sdk.surface`) on every event and span
|
|
9
10
|
* - API response time tracking
|
|
10
11
|
* - Chain/network usage distribution
|
|
11
12
|
*
|
|
@@ -13,12 +14,14 @@
|
|
|
13
14
|
* ```typescript
|
|
14
15
|
* // Analytics enabled by default
|
|
15
16
|
* const sdk = new AugustSDK({
|
|
17
|
+
* appName: 'acme-trader',
|
|
16
18
|
* providers: { 1: 'https://...' },
|
|
17
19
|
* keys: { august: '...' },
|
|
18
20
|
* });
|
|
19
21
|
*
|
|
20
22
|
* // Opt-out of analytics
|
|
21
23
|
* const sdk = new AugustSDK({
|
|
24
|
+
* appName: 'acme-trader',
|
|
22
25
|
* providers: { 1: 'https://...' },
|
|
23
26
|
* keys: { august: '...' },
|
|
24
27
|
* analytics: { enabled: false },
|
|
@@ -26,7 +29,7 @@
|
|
|
26
29
|
* ```
|
|
27
30
|
*/
|
|
28
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
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;
|
|
32
|
+
exports.chainIdToTagValue = exports.getMethodCategory = exports.METHOD_CATEGORIES = exports.instrumentClass = exports.withSyncMethodTracking = exports.withMethodTracking = exports.computeArgShape = exports.sanitizeObject = exports.sanitizeArgs = exports.resetCacheStats = exports.getCacheStats = exports.trackKeyVerification = 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;
|
|
30
33
|
// User identity utilities
|
|
31
34
|
var user_identity_1 = require("./user-identity");
|
|
32
35
|
Object.defineProperty(exports, "hashApiKey", { enumerable: true, get: function () { return user_identity_1.hashApiKey; } });
|
|
@@ -57,6 +60,7 @@ Object.defineProperty(exports, "isNodeDevOrTestEnv", { enumerable: true, get: fu
|
|
|
57
60
|
var metrics_1 = require("./metrics");
|
|
58
61
|
Object.defineProperty(exports, "trackApiCall", { enumerable: true, get: function () { return metrics_1.trackApiCall; } });
|
|
59
62
|
Object.defineProperty(exports, "trackNetworkSwitch", { enumerable: true, get: function () { return metrics_1.trackNetworkSwitch; } });
|
|
63
|
+
Object.defineProperty(exports, "trackKeyVerification", { enumerable: true, get: function () { return metrics_1.trackKeyVerification; } });
|
|
60
64
|
Object.defineProperty(exports, "getCacheStats", { enumerable: true, get: function () { return metrics_1.getCacheStats; } });
|
|
61
65
|
Object.defineProperty(exports, "resetCacheStats", { enumerable: true, get: function () { return metrics_1.resetCacheStats; } });
|
|
62
66
|
// Sanitization utilities
|
|
@@ -40,6 +40,10 @@ function withMethodTracking(methodName, method, getChainId) {
|
|
|
40
40
|
op: 'sdk.method',
|
|
41
41
|
name: methodName,
|
|
42
42
|
attributes: {
|
|
43
|
+
// Scope tags only reach the root span in Sentry's span dataset;
|
|
44
|
+
// child spans need the identity copied on as attributes or they
|
|
45
|
+
// cannot be filtered by app or partner.
|
|
46
|
+
...(0, sentry_1.getSpanAttributes)(),
|
|
43
47
|
chainId: chainId?.toString() || 'unknown',
|
|
44
48
|
'sdk.chain': (0, chain_name_1.chainIdToTagValue)(chainId),
|
|
45
49
|
'sdk.category': category,
|
|
@@ -222,12 +226,12 @@ function trackSyncMethodCall(methodName, metrics, args) {
|
|
|
222
226
|
// Measurements omitted: sync methods have no span of their own, so setMeasurement
|
|
223
227
|
// would attach to whatever parent transaction happens to be active on the scope,
|
|
224
228
|
// overwriting its counters. The breadcrumb above already captures success/failure.
|
|
229
|
+
// `sdk.category` and `sdk.chain` stay off the global scope: concurrent sync
|
|
230
|
+
// calls would race on them and stamp stale values onto unrelated events (the
|
|
231
|
+
// breadcrumb above carries both per call). `sdk.last_chainId` stays because
|
|
232
|
+
// `isMutedChainEvent` in sentry.ts reads it to drop muted-chain events.
|
|
225
233
|
sdk.setTag('sdk.last_sync_method', methodName);
|
|
226
|
-
if (metrics.category) {
|
|
227
|
-
sdk.setTag('sdk.category', metrics.category);
|
|
228
|
-
}
|
|
229
234
|
if (metrics.chainId !== undefined) {
|
|
230
|
-
sdk.setTag('sdk.chain', (0, chain_name_1.chainIdToTagValue)(metrics.chainId));
|
|
231
235
|
sdk.setTag('sdk.last_chainId', metrics.chainId.toString());
|
|
232
236
|
}
|
|
233
237
|
}
|
|
@@ -64,6 +64,7 @@ exports.METHOD_CATEGORIES = {
|
|
|
64
64
|
getVaultWithdrawals: 'read.redemption',
|
|
65
65
|
getWithdrawalRequestsWithStatus: 'read.redemption',
|
|
66
66
|
previewRedemption: 'read.redemption',
|
|
67
|
+
previewRwaRedemption: 'read.redemption',
|
|
67
68
|
getBurnableAmountByReceiver: 'read.redemption',
|
|
68
69
|
getRequirementByDate: 'read.redemption',
|
|
69
70
|
getScheduledTransactionsByDate: 'read.redemption',
|
|
@@ -94,6 +95,7 @@ exports.METHOD_CATEGORIES = {
|
|
|
94
95
|
// sees program-targeting calls instead of dropping them into 'unknown'.
|
|
95
96
|
getProgram: 'read.solana',
|
|
96
97
|
getProgramId: 'read.solana',
|
|
98
|
+
setWalletProvider: 'network',
|
|
97
99
|
// submitTransaction broadcasts a signed Soroban tx — it mutates on-chain
|
|
98
100
|
// state and belongs in the write bucket even though Stellar adapter call
|
|
99
101
|
// shape mirrors the read helpers (returns a hash, takes signed XDR).
|
|
@@ -102,8 +104,19 @@ exports.METHOD_CATEGORIES = {
|
|
|
102
104
|
// convertToShares is a read-only Soroban simulation despite its mutative-
|
|
103
105
|
// sounding name — runs through queryContract, no broadcast.
|
|
104
106
|
convertToShares: 'read.stellar',
|
|
107
|
+
// Offline helpers on the public adapter surface, classified under the
|
|
108
|
+
// chain's read bucket like getProgram/getProgramId above rather than
|
|
109
|
+
// leaking into 'unknown'.
|
|
110
|
+
isStellarAddress: 'read.stellar',
|
|
111
|
+
getExplorerLink: 'read.stellar',
|
|
105
112
|
getEmberVaults: 'read.sui',
|
|
106
113
|
getEmberTVL: 'read.sui',
|
|
114
|
+
convertFromE9: 'read.sui',
|
|
115
|
+
calculateUtilization: 'read.sui',
|
|
116
|
+
isSuiAddress: 'read.sui',
|
|
117
|
+
isSuiVault: 'read.sui',
|
|
118
|
+
transformEmberVaultToIVault: 'read.sui',
|
|
119
|
+
transformEmberVaultsToIVaults: 'read.sui',
|
|
107
120
|
vaultAllowance: 'read.evm',
|
|
108
121
|
sendersWhitelistAddress: 'read.evm',
|
|
109
122
|
isWhitelisted: 'read.evm',
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Aggregated cache statistics for monitoring.
|
|
3
|
-
*/
|
|
4
|
-
declare let cacheStats: {
|
|
5
|
-
hits: number;
|
|
6
|
-
misses: number;
|
|
7
|
-
sets: number;
|
|
8
|
-
};
|
|
9
1
|
/**
|
|
10
2
|
* Track API response times and status.
|
|
11
3
|
*
|
|
@@ -23,11 +15,34 @@ export declare function trackApiCall(endpoint: string, method: string, startTime
|
|
|
23
15
|
*/
|
|
24
16
|
export declare function trackNetworkSwitch(chainId: number): void;
|
|
25
17
|
/**
|
|
26
|
-
*
|
|
18
|
+
* Track the outcome of an API-key verification check (e.g. `verifyAugustKey`).
|
|
19
|
+
* Records success/failure as a breadcrumb and a low-cardinality tag so
|
|
20
|
+
* verification failures are visible in the dashboard without leaking the key
|
|
21
|
+
* itself — callers must never pass the raw key value.
|
|
22
|
+
*
|
|
23
|
+
* @param keyType - Which key was verified (e.g. `'august'`)
|
|
24
|
+
* @param success - Whether the key was accepted
|
|
25
|
+
*/
|
|
26
|
+
export declare function trackKeyVerification(keyType: string, success: boolean): void;
|
|
27
|
+
declare let cacheStats: {
|
|
28
|
+
hits: number;
|
|
29
|
+
misses: number;
|
|
30
|
+
sets: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Cache statistics snapshot. The SDK never recorded cache hits, misses, or
|
|
34
|
+
* sets, so every field is always `0`.
|
|
35
|
+
*
|
|
36
|
+
* @deprecated Always returns zeros. Kept only for API compatibility and will
|
|
37
|
+
* be removed in the next major release; there is no replacement.
|
|
27
38
|
*/
|
|
28
39
|
export declare function getCacheStats(): typeof cacheStats;
|
|
29
40
|
/**
|
|
30
|
-
* Reset cache statistics
|
|
41
|
+
* Reset the cache statistics snapshot to zeros. The SDK never records any, so
|
|
42
|
+
* this has no observable effect.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated Has no effect. Kept only for API compatibility and will be
|
|
45
|
+
* removed in the next major release; there is no replacement.
|
|
31
46
|
*/
|
|
32
47
|
export declare function resetCacheStats(): void;
|
|
33
48
|
export {};
|
|
@@ -2,19 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.trackApiCall = trackApiCall;
|
|
4
4
|
exports.trackNetworkSwitch = trackNetworkSwitch;
|
|
5
|
+
exports.trackKeyVerification = trackKeyVerification;
|
|
5
6
|
exports.getCacheStats = getCacheStats;
|
|
6
7
|
exports.resetCacheStats = resetCacheStats;
|
|
7
8
|
const chain_name_1 = require("./chain-name");
|
|
8
9
|
const sentry_runtime_1 = require("./sentry-runtime");
|
|
9
10
|
const sentry_1 = require("./sentry");
|
|
10
|
-
/**
|
|
11
|
-
* Aggregated cache statistics for monitoring.
|
|
12
|
-
*/
|
|
13
|
-
let cacheStats = {
|
|
14
|
-
hits: 0,
|
|
15
|
-
misses: 0,
|
|
16
|
-
sets: 0,
|
|
17
|
-
};
|
|
18
11
|
/**
|
|
19
12
|
* Track API response times and status.
|
|
20
13
|
*
|
|
@@ -47,11 +40,7 @@ function trackApiCall(endpoint, method, startTime, status, server) {
|
|
|
47
40
|
server,
|
|
48
41
|
},
|
|
49
42
|
});
|
|
50
|
-
// Set measurement for performance tracking
|
|
51
43
|
sdk.setMeasurement('api.duration', duration, 'millisecond');
|
|
52
|
-
// Update tags for filtering
|
|
53
|
-
sdk.setTag('api.last_endpoint', normalizedEndpoint);
|
|
54
|
-
sdk.setTag('api.server', server);
|
|
55
44
|
}
|
|
56
45
|
catch {
|
|
57
46
|
// Silently fail - analytics should never break SDK
|
|
@@ -76,13 +65,41 @@ function trackNetworkSwitch(chainId) {
|
|
|
76
65
|
level: 'info',
|
|
77
66
|
data: { chainId, chain: chainLabel },
|
|
78
67
|
});
|
|
79
|
-
sdk.setTag('active.chainId', chainId.toString());
|
|
80
68
|
sdk.setTag('sdk.chain', chainLabel);
|
|
81
69
|
}
|
|
82
70
|
catch {
|
|
83
71
|
// Silently fail - analytics should never break SDK
|
|
84
72
|
}
|
|
85
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Track the outcome of an API-key verification check (e.g. `verifyAugustKey`).
|
|
76
|
+
* Records success/failure as a breadcrumb and a low-cardinality tag so
|
|
77
|
+
* verification failures are visible in the dashboard without leaking the key
|
|
78
|
+
* itself — callers must never pass the raw key value.
|
|
79
|
+
*
|
|
80
|
+
* @param keyType - Which key was verified (e.g. `'august'`)
|
|
81
|
+
* @param success - Whether the key was accepted
|
|
82
|
+
*/
|
|
83
|
+
function trackKeyVerification(keyType, success) {
|
|
84
|
+
if (!(0, sentry_1.isAnalyticsEnabled)())
|
|
85
|
+
return;
|
|
86
|
+
try {
|
|
87
|
+
const sdk = (0, sentry_runtime_1.getSentrySDK)();
|
|
88
|
+
if (!sdk)
|
|
89
|
+
return;
|
|
90
|
+
sdk.addBreadcrumb({
|
|
91
|
+
category: 'auth.verify',
|
|
92
|
+
message: `${keyType} key verification ${success ? 'succeeded' : 'failed'}`,
|
|
93
|
+
level: success ? 'info' : 'warning',
|
|
94
|
+
data: { keyType, success },
|
|
95
|
+
});
|
|
96
|
+
sdk.setTag('auth.last_verified_key_type', keyType);
|
|
97
|
+
sdk.setTag('auth.last_verification_result', success ? 'success' : 'failure');
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
// Silently fail - analytics should never break SDK
|
|
101
|
+
}
|
|
102
|
+
}
|
|
86
103
|
/**
|
|
87
104
|
* Normalize endpoint URLs for aggregation.
|
|
88
105
|
* Replaces dynamic segments (addresses, IDs) with placeholders.
|
|
@@ -101,14 +118,23 @@ function normalizeEndpoint(endpoint) {
|
|
|
101
118
|
// Replace numeric IDs in paths
|
|
102
119
|
.replace(/\/\d+(?=\/|$)/g, '/:id'));
|
|
103
120
|
}
|
|
121
|
+
let cacheStats = { hits: 0, misses: 0, sets: 0 };
|
|
104
122
|
/**
|
|
105
|
-
*
|
|
123
|
+
* Cache statistics snapshot. The SDK never recorded cache hits, misses, or
|
|
124
|
+
* sets, so every field is always `0`.
|
|
125
|
+
*
|
|
126
|
+
* @deprecated Always returns zeros. Kept only for API compatibility and will
|
|
127
|
+
* be removed in the next major release; there is no replacement.
|
|
106
128
|
*/
|
|
107
129
|
function getCacheStats() {
|
|
108
130
|
return { ...cacheStats };
|
|
109
131
|
}
|
|
110
132
|
/**
|
|
111
|
-
* Reset cache statistics
|
|
133
|
+
* Reset the cache statistics snapshot to zeros. The SDK never records any, so
|
|
134
|
+
* this has no observable effect.
|
|
135
|
+
*
|
|
136
|
+
* @deprecated Has no effect. Kept only for API compatibility and will be
|
|
137
|
+
* removed in the next major release; there is no replacement.
|
|
112
138
|
*/
|
|
113
139
|
function resetCacheStats() {
|
|
114
140
|
cacheStats = { hits: 0, misses: 0, sets: 0 };
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type * as Sentry from '@sentry/browser';
|
|
2
2
|
import type { IEnv } from '../../types';
|
|
3
3
|
import type { IAnalyticsConfig } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* The August SDK build version, read from the generated `version.ts`.
|
|
6
|
+
* Falls back to `'development'` in an unbuilt checkout, where that file does
|
|
7
|
+
* not exist. Shared by the Sentry `release` tag and the
|
|
8
|
+
* `x-august-sdk-version` request header so the two can never disagree.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSDKVersion(): string;
|
|
4
13
|
/**
|
|
5
14
|
* Clear the error dedupe bookkeeping. Test-only — the rate limiter is process
|
|
6
15
|
* lifetime state and would otherwise leak between test cases.
|
|
@@ -19,7 +28,8 @@ export declare function resetErrorDedupe(): void;
|
|
|
19
28
|
* error rather than silently anonymous events.
|
|
20
29
|
*
|
|
21
30
|
* @param config - Analytics configuration. Pass `tracesSampleRate` to
|
|
22
|
-
* override the default of `0.1
|
|
31
|
+
* override the default of `0.1`, and `surface` to label the emitting
|
|
32
|
+
* surface (`sdk.surface` tag; defaults to `'sdk'`).
|
|
23
33
|
* @param environment - Current environment (DEV or PROD).
|
|
24
34
|
* @param appName - App-name slug, required. Set as the global `app.name`
|
|
25
35
|
* tag on every event and used to derive `partner.id`. Identifier-shaped:
|
|
@@ -51,6 +61,16 @@ export declare function clearUser(): void;
|
|
|
51
61
|
* Check if analytics is enabled and initialized.
|
|
52
62
|
*/
|
|
53
63
|
export declare function isAnalyticsEnabled(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Identity tags resolved by `initializeSentry`, for `withMethodTracking` to
|
|
66
|
+
* copy onto each span as attributes. Sentry's span dataset carries scope tags
|
|
67
|
+
* on the root span only, so without this copy child `sdk.method` rows cannot
|
|
68
|
+
* be filtered by `app.name` or `partner.id`.
|
|
69
|
+
*
|
|
70
|
+
* @returns The tag snapshot, or `{}` until analytics has been enabled.
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
export declare function getSpanAttributes(): Readonly<Record<string, string>>;
|
|
54
74
|
/**
|
|
55
75
|
* Get the current Sentry instance for advanced usage.
|
|
56
76
|
* Returns null if analytics is disabled.
|
|
@@ -67,12 +87,13 @@ export declare function resetAnalytics(): void;
|
|
|
67
87
|
* surface. No-ops when analytics is disabled.
|
|
68
88
|
*
|
|
69
89
|
* @param error - Thrown value. Non-Error values are wrapped.
|
|
70
|
-
* @param options - `surface` ('cli' | 'sdk' | 'react' | string)
|
|
90
|
+
* @param options - `surface` ('cli' | 'mcp' | 'sdk' | 'react' | string)
|
|
91
|
+
* overriding the init-time `sdk.surface` tag for this event, extra `tags`,
|
|
71
92
|
* `extra` data, and a `flushTimeoutMs` to await before resolving (needed
|
|
72
93
|
* in Node when the process is about to exit).
|
|
73
94
|
*/
|
|
74
95
|
export declare function captureSdkException(error: unknown, options?: {
|
|
75
|
-
surface?: 'cli' | 'sdk' | 'react' | string;
|
|
96
|
+
surface?: 'cli' | 'mcp' | 'sdk' | 'react' | string;
|
|
76
97
|
tags?: Record<string, string>;
|
|
77
98
|
extra?: Record<string, unknown>;
|
|
78
99
|
flushTimeoutMs?: number;
|