@augustdigital/sdk 9.7.0 → 9.8.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/core/analytics/sanitize.d.ts +13 -0
- package/lib/core/analytics/sanitize.js +24 -12
- package/lib/core/analytics/version.d.ts +1 -1
- package/lib/core/analytics/version.js +1 -1
- package/lib/core/constants/swap-router.d.ts +1 -1
- package/lib/core/constants/swap-router.js +5 -1
- package/lib/sdk.d.ts +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,19 @@ export declare function sanitizeString(input: string): string;
|
|
|
12
12
|
* …), and `cause`. Subclass constructors are NOT invoked — they may have
|
|
13
13
|
* positional signatures (`new AugustAuthError(code, message, opts)`) that would
|
|
14
14
|
* misalign if we naively passed the sanitized message as the first arg.
|
|
15
|
+
*
|
|
16
|
+
* Every write onto the clone goes through `Object.defineProperty` rather than
|
|
17
|
+
* assignment: the clone inherits `err`'s prototype, and some libraries make
|
|
18
|
+
* properties read-only there — `@solana/web3.js` defines `name` as non-writable
|
|
19
|
+
* on its error classes (`TransactionExpiredTimeoutError`, …). Assigning to an
|
|
20
|
+
* inherited non-writable property throws a `TypeError` in strict mode, which
|
|
21
|
+
* would escape from inside a caller's `catch` (e.g. `Logger.log.error`) and
|
|
22
|
+
* replace the error being reported. Defining an own property shadows the
|
|
23
|
+
* prototype's instead; each one is writable, configurable and enumerable,
|
|
24
|
+
* exactly as the plain assignment used to create it.
|
|
25
|
+
*
|
|
26
|
+
* @param err - Any caught value; non-`Error` values are returned unchanged.
|
|
27
|
+
* @returns A redacted clone for `Error` instances, otherwise `err` itself.
|
|
15
28
|
*/
|
|
16
29
|
export declare function sanitizeError(err: unknown): unknown;
|
|
17
30
|
/** Sanitize arbitrary log input (strings, errors, objects, arrays, primitives). */
|
|
@@ -72,30 +72,42 @@ function sanitizeString(input) {
|
|
|
72
72
|
* …), and `cause`. Subclass constructors are NOT invoked — they may have
|
|
73
73
|
* positional signatures (`new AugustAuthError(code, message, opts)`) that would
|
|
74
74
|
* misalign if we naively passed the sanitized message as the first arg.
|
|
75
|
+
*
|
|
76
|
+
* Every write onto the clone goes through `Object.defineProperty` rather than
|
|
77
|
+
* assignment: the clone inherits `err`'s prototype, and some libraries make
|
|
78
|
+
* properties read-only there — `@solana/web3.js` defines `name` as non-writable
|
|
79
|
+
* on its error classes (`TransactionExpiredTimeoutError`, …). Assigning to an
|
|
80
|
+
* inherited non-writable property throws a `TypeError` in strict mode, which
|
|
81
|
+
* would escape from inside a caller's `catch` (e.g. `Logger.log.error`) and
|
|
82
|
+
* replace the error being reported. Defining an own property shadows the
|
|
83
|
+
* prototype's instead; each one is writable, configurable and enumerable,
|
|
84
|
+
* exactly as the plain assignment used to create it.
|
|
85
|
+
*
|
|
86
|
+
* @param err - Any caught value; non-`Error` values are returned unchanged.
|
|
87
|
+
* @returns A redacted clone for `Error` instances, otherwise `err` itself.
|
|
75
88
|
*/
|
|
76
89
|
function sanitizeError(err) {
|
|
77
90
|
if (!(err instanceof Error))
|
|
78
91
|
return err;
|
|
79
92
|
const safe = Object.create(Object.getPrototypeOf(err));
|
|
93
|
+
const define = (key, value) => Object.defineProperty(safe, key, {
|
|
94
|
+
value,
|
|
95
|
+
writable: true,
|
|
96
|
+
configurable: true,
|
|
97
|
+
enumerable: true,
|
|
98
|
+
});
|
|
80
99
|
for (const key of Object.getOwnPropertyNames(err)) {
|
|
81
100
|
const value = err[key];
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
else if (key === 'stack' && typeof value === 'string') {
|
|
86
|
-
safe[key] = sanitizeString(value);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
safe[key] = value;
|
|
90
|
-
}
|
|
101
|
+
const redact = (key === 'message' || key === 'stack') && typeof value === 'string';
|
|
102
|
+
define(key, redact ? sanitizeString(value) : value);
|
|
91
103
|
}
|
|
92
104
|
if (!safe.message && typeof err.message === 'string') {
|
|
93
|
-
|
|
105
|
+
define('message', sanitizeString(err.message));
|
|
94
106
|
}
|
|
95
107
|
if (!safe.stack && typeof err.stack === 'string') {
|
|
96
|
-
|
|
108
|
+
define('stack', sanitizeString(err.stack));
|
|
97
109
|
}
|
|
98
|
-
|
|
110
|
+
define('name', err.name);
|
|
99
111
|
return safe;
|
|
100
112
|
}
|
|
101
113
|
/** Sanitize arbitrary log input (strings, errors, objects, arrays, primitives). */
|
|
@@ -74,7 +74,7 @@ export declare const VAULTS_USING_SWAP_ROUTER: ReadonlySet<string>;
|
|
|
74
74
|
* from genesis) bounds it to the router's own lifetime — a few chunks — instead
|
|
75
75
|
* of the whole chain.
|
|
76
76
|
*
|
|
77
|
-
*
|
|
77
|
+
* Each value is the router's deployment block (its first emitted event, the
|
|
78
78
|
* constructor `OwnershipTransferred`). A too-low value only costs extra empty
|
|
79
79
|
* log ranges; a value ABOVE the first `TokenEnabled` would silently miss tokens,
|
|
80
80
|
* so err on the side of earlier.
|
|
@@ -11,6 +11,7 @@ exports.SWAP_ROUTER_DEX_AGGREGATOR = exports.SWAP_ROUTER_WRAPPED_NATIVE = export
|
|
|
11
11
|
*/
|
|
12
12
|
exports.SWAP_ROUTER_ADDRESSES = {
|
|
13
13
|
1: '0xAC771209FF2b71EECfF6E85a9AD01db8Ff2618B0',
|
|
14
|
+
999: '0xF47ce4B8df30bc3B3b6cc21Fe1552A2198A4A4F7',
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
17
|
* Human-readable display name of the `SwapRouter` periphery contract on each
|
|
@@ -27,6 +28,7 @@ exports.SWAP_ROUTER_ADDRESSES = {
|
|
|
27
28
|
*/
|
|
28
29
|
exports.SWAP_ROUTER_NAMES = {
|
|
29
30
|
1: 'Upshift Swap Router',
|
|
31
|
+
999: 'Upshift Swap Router',
|
|
30
32
|
};
|
|
31
33
|
/**
|
|
32
34
|
* Vaults whose UI **may offer the any-token SwapRouter deposit surface** —
|
|
@@ -85,13 +87,14 @@ exports.VAULTS_USING_SWAP_ROUTER = exports.SWAP_ROUTER_ELIGIBLE_VAULTS;
|
|
|
85
87
|
* from genesis) bounds it to the router's own lifetime — a few chunks — instead
|
|
86
88
|
* of the whole chain.
|
|
87
89
|
*
|
|
88
|
-
*
|
|
90
|
+
* Each value is the router's deployment block (its first emitted event, the
|
|
89
91
|
* constructor `OwnershipTransferred`). A too-low value only costs extra empty
|
|
90
92
|
* log ranges; a value ABOVE the first `TokenEnabled` would silently miss tokens,
|
|
91
93
|
* so err on the side of earlier.
|
|
92
94
|
*/
|
|
93
95
|
exports.SWAP_ROUTER_DEPLOY_BLOCKS = {
|
|
94
96
|
1: 25237804,
|
|
97
|
+
999: 47385042,
|
|
95
98
|
};
|
|
96
99
|
/**
|
|
97
100
|
* 32-byte origin codes registered on the `SwapRouter` via `addOrigin`.
|
|
@@ -140,6 +143,7 @@ exports.SWAP_ROUTER_MAX_SWAPS = 9;
|
|
|
140
143
|
*/
|
|
141
144
|
exports.SWAP_ROUTER_WRAPPED_NATIVE = {
|
|
142
145
|
1: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
146
|
+
999: '0x5555555555555555555555555555555555555555',
|
|
143
147
|
};
|
|
144
148
|
/**
|
|
145
149
|
* The DEX aggregator whitelisted on each chain's `SwapRouter` via
|
package/lib/sdk.d.ts
CHANGED
|
@@ -27244,7 +27244,7 @@ declare type AsArray<T> = T extends readonly unknown[] ? T : never;
|
|
|
27244
27244
|
* from genesis) bounds it to the router's own lifetime — a few chunks — instead
|
|
27245
27245
|
* of the whole chain.
|
|
27246
27246
|
*
|
|
27247
|
-
*
|
|
27247
|
+
* Each value is the router's deployment block (its first emitted event, the
|
|
27248
27248
|
* constructor `OwnershipTransferred`). A too-low value only costs extra empty
|
|
27249
27249
|
* log ranges; a value ABOVE the first `TokenEnabled` would silently miss tokens,
|
|
27250
27250
|
* so err on the side of earlier.
|