@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.
@@ -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
- if (key === 'message' && typeof value === 'string') {
83
- safe[key] = sanitizeString(value);
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
- safe.message = sanitizeString(err.message);
105
+ define('message', sanitizeString(err.message));
94
106
  }
95
107
  if (!safe.stack && typeof err.stack === 'string') {
96
- safe.stack = sanitizeString(err.stack);
108
+ define('stack', sanitizeString(err.stack));
97
109
  }
98
- safe.name = err.name;
110
+ define('name', err.name);
99
111
  return safe;
100
112
  }
101
113
  /** Sanitize arbitrary log input (strings, errors, objects, arrays, primitives). */
@@ -3,4 +3,4 @@
3
3
  * Generated during publish from package.json version
4
4
  * This file is gitignored and created at publish time
5
5
  */
6
- export declare const SDK_VERSION = "9.7.0";
6
+ export declare const SDK_VERSION = "9.8.0";
@@ -6,5 +6,5 @@ exports.SDK_VERSION = void 0;
6
6
  * Generated during publish from package.json version
7
7
  * This file is gitignored and created at publish time
8
8
  */
9
- exports.SDK_VERSION = '9.7.0';
9
+ exports.SDK_VERSION = '9.8.0';
10
10
  //# sourceMappingURL=version.js.map
@@ -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
- * Mainnet value is the router's deployment block (its first emitted event, the
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
- * Mainnet value is the router's deployment block (its first emitted event, the
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
- * Mainnet value is the router's deployment block (its first emitted event, the
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augustdigital/sdk",
3
- "version": "9.7.0",
3
+ "version": "9.8.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/sdk.d.ts",
6
6
  "keywords": [