@upshiftfinance/sdk 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +408 -2
- package/lib/abis/AddressResolver.d.ts +28 -0
- package/lib/abis/AddressResolver.js +23 -0
- package/lib/abis/ChainlinkV3.d.ts +87 -0
- package/lib/abis/ChainlinkV3.js +117 -0
- package/lib/abis/ERC20.d.ts +168 -0
- package/lib/abis/ERC20.js +226 -0
- package/lib/abis/ERC20_Bytes32.d.ts +139 -0
- package/lib/abis/ERC20_Bytes32.js +196 -0
- package/lib/abis/ERC4626.d.ts +364 -0
- package/lib/abis/ERC4626.js +507 -0
- package/lib/abis/ERC721.d.ts +231 -0
- package/lib/abis/ERC721.js +321 -0
- package/lib/abis/FeeOracle.d.ts +120 -0
- package/lib/abis/FeeOracle.js +162 -0
- package/lib/abis/LendingPool.d.ts +1393 -0
- package/lib/abis/LendingPool.js +1807 -0
- package/lib/abis/LendingPoolV2.d.ts +1413 -0
- package/lib/abis/LendingPoolV2.js +1833 -0
- package/lib/abis/LendingPoolV3.d.ts +1677 -0
- package/lib/abis/LendingPoolV3.js +1160 -0
- package/lib/abis/Loan.d.ts +837 -0
- package/lib/abis/Loan.js +1080 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.d.ts +137 -0
- package/lib/abis/MultiAssetNativeDepositWrapper.js +125 -0
- package/lib/abis/Multicall3.d.ts +30 -0
- package/lib/abis/Multicall3.js +97 -0
- package/lib/abis/OFT.d.ts +116 -0
- package/lib/abis/OFT.js +85 -0
- package/lib/abis/PoolAdapter.d.ts +36 -0
- package/lib/abis/PoolAdapter.js +51 -0
- package/lib/abis/RewardDistributor.d.ts +267 -0
- package/lib/abis/RewardDistributor.js +352 -0
- package/lib/abis/RwaRedeemSubaccount.d.ts +747 -0
- package/lib/abis/RwaRedeemSubaccount.js +548 -0
- package/lib/abis/SmartAccount.d.ts +17 -0
- package/lib/abis/SmartAccount.js +19 -0
- package/lib/abis/SwapRouter.d.ts +953 -0
- package/lib/abis/SwapRouter.js +1228 -0
- package/lib/abis/TextResolver.d.ts +16 -0
- package/lib/abis/TextResolver.js +16 -0
- package/lib/abis/TokenizedVaultV2.d.ts +1364 -0
- package/lib/abis/TokenizedVaultV2.js +1041 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.d.ts +1456 -0
- package/lib/abis/TokenizedVaultV2DepositWithPermit.js +1878 -0
- package/lib/abis/TokenizedVaultV2Receipt.d.ts +1568 -0
- package/lib/abis/TokenizedVaultV2Receipt.js +1061 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.d.ts +454 -0
- package/lib/abis/TokenizedVaultV2SenderAllocationWhitelist.js +327 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.d.ts +1466 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAllocation.js +1092 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.d.ts +274 -0
- package/lib/abis/TokenizedVaultV2WhitelistedAssets.js +167 -0
- package/lib/abis/UniversalResolverResolve.d.ts +69 -0
- package/lib/abis/UniversalResolverResolve.js +35 -0
- package/lib/abis/UniversalSignatureValidator.d.ts +17 -0
- package/lib/abis/UniversalSignatureValidator.js +30 -0
- package/lib/abis/WrapperAdapter.d.ts +71 -0
- package/lib/abis/WrapperAdapter.js +77 -0
- package/lib/abis/index.d.ts +34 -0
- package/lib/abis/index.js +51 -0
- package/lib/adapters/evm/getters.d.ts +19 -0
- package/lib/adapters/evm/getters.js +249 -0
- package/lib/adapters/evm/index.d.ts +539 -0
- package/lib/adapters/evm/index.js +656 -0
- package/lib/adapters/evm/utils.d.ts +8 -0
- package/lib/adapters/evm/utils.js +51 -0
- package/lib/adapters/solana/confirm.d.ts +88 -0
- package/lib/adapters/solana/confirm.js +291 -0
- package/lib/adapters/solana/constants.d.ts +42 -0
- package/lib/adapters/solana/constants.js +59 -0
- package/lib/adapters/solana/getters.d.ts +42 -0
- package/lib/adapters/solana/getters.js +275 -0
- package/lib/adapters/solana/idl/vault-idl.d.ts +700 -0
- package/lib/adapters/solana/idl/vault-idl.js +2101 -0
- package/lib/adapters/solana/idl/withdrawal-queue-idl.d.ts +795 -0
- package/lib/adapters/solana/idl/withdrawal-queue-idl.js +1864 -0
- package/lib/adapters/solana/index.d.ts +372 -0
- package/lib/adapters/solana/index.js +459 -0
- package/lib/adapters/solana/pricing.d.ts +184 -0
- package/lib/adapters/solana/pricing.js +239 -0
- package/lib/adapters/solana/queue-hints.d.ts +29 -0
- package/lib/adapters/solana/queue-hints.js +59 -0
- package/lib/adapters/solana/queue.actions.d.ts +97 -0
- package/lib/adapters/solana/queue.actions.js +468 -0
- package/lib/adapters/solana/token-reads.d.ts +108 -0
- package/lib/adapters/solana/token-reads.js +145 -0
- package/lib/adapters/solana/types.d.ts +325 -0
- package/lib/adapters/solana/types.js +3 -0
- package/lib/adapters/solana/utils.d.ts +229 -0
- package/lib/adapters/solana/utils.js +773 -0
- package/lib/adapters/solana/vault.actions.d.ts +140 -0
- package/lib/adapters/solana/vault.actions.js +657 -0
- package/lib/adapters/solana/withdrawal-queue.d.ts +125 -0
- package/lib/adapters/solana/withdrawal-queue.js +301 -0
- package/lib/adapters/stellar/actions.d.ts +41 -0
- package/lib/adapters/stellar/actions.js +126 -0
- package/lib/adapters/stellar/constants.d.ts +43 -0
- package/lib/adapters/stellar/constants.js +53 -0
- package/lib/adapters/stellar/getters.d.ts +68 -0
- package/lib/adapters/stellar/getters.js +290 -0
- package/lib/adapters/stellar/index.d.ts +126 -0
- package/lib/adapters/stellar/index.js +187 -0
- package/lib/adapters/stellar/invocation.d.ts +55 -0
- package/lib/adapters/stellar/invocation.js +92 -0
- package/lib/adapters/stellar/soroban.d.ts +131 -0
- package/lib/adapters/stellar/soroban.js +617 -0
- package/lib/adapters/stellar/submit.d.ts +42 -0
- package/lib/adapters/stellar/submit.js +195 -0
- package/lib/adapters/stellar/types.d.ts +57 -0
- package/lib/adapters/stellar/types.js +6 -0
- package/lib/adapters/stellar/utils.d.ts +24 -0
- package/lib/adapters/stellar/utils.js +34 -0
- package/lib/adapters/sui/client.d.ts +83 -0
- package/lib/adapters/sui/client.js +216 -0
- package/lib/adapters/sui/constants.d.ts +33 -0
- package/lib/adapters/sui/constants.js +31 -0
- package/lib/adapters/sui/index.d.ts +57 -0
- package/lib/adapters/sui/index.js +100 -0
- package/lib/adapters/sui/targets.d.ts +171 -0
- package/lib/adapters/sui/targets.js +225 -0
- package/lib/adapters/sui/utils.d.ts +8 -0
- package/lib/adapters/sui/utils.js +17 -0
- package/lib/core/analytics/app-name.d.ts +27 -0
- package/lib/core/analytics/app-name.js +48 -0
- package/lib/core/analytics/chain-name.d.ts +9 -0
- package/lib/core/analytics/chain-name.js +34 -0
- package/lib/core/analytics/constants.d.ts +15 -0
- package/lib/core/analytics/constants.js +28 -0
- package/lib/core/analytics/env.d.ts +46 -0
- package/lib/core/analytics/env.js +147 -0
- package/lib/core/analytics/index.d.ts +39 -0
- package/lib/core/analytics/index.js +83 -0
- package/lib/core/analytics/instrumentation.d.ts +29 -0
- package/lib/core/analytics/instrumentation.js +292 -0
- package/lib/core/analytics/method-taxonomy.d.ts +19 -0
- package/lib/core/analytics/method-taxonomy.js +156 -0
- package/lib/core/analytics/metrics.d.ts +48 -0
- package/lib/core/analytics/metrics.js +142 -0
- package/lib/core/analytics/sanitize.d.ts +57 -0
- package/lib/core/analytics/sanitize.js +272 -0
- package/lib/core/analytics/sentry-runtime.d.ts +15 -0
- package/lib/core/analytics/sentry-runtime.js +131 -0
- package/lib/core/analytics/sentry.d.ts +100 -0
- package/lib/core/analytics/sentry.js +696 -0
- package/lib/core/analytics/types.d.ts +55 -0
- package/lib/core/analytics/types.js +3 -0
- package/lib/core/analytics/user-identity.d.ts +55 -0
- package/lib/core/analytics/user-identity.js +218 -0
- package/lib/core/analytics/version.d.ts +6 -0
- package/lib/core/analytics/version.js +10 -0
- package/lib/core/attribution.d.ts +159 -0
- package/lib/core/attribution.js +194 -0
- package/lib/core/auth/index.d.ts +1 -0
- package/lib/core/auth/index.js +18 -0
- package/lib/core/auth/verify.d.ts +2 -0
- package/lib/core/auth/verify.js +35 -0
- package/lib/core/base.class.d.ts +193 -0
- package/lib/core/base.class.js +163 -0
- package/lib/core/cache.d.ts +9 -0
- package/lib/core/cache.js +31 -0
- package/lib/core/constants/adapters.d.ts +103 -0
- package/lib/core/constants/adapters.js +180 -0
- package/lib/core/constants/core.d.ts +162 -0
- package/lib/core/constants/core.js +281 -0
- package/lib/core/constants/swap-router.d.ts +180 -0
- package/lib/core/constants/swap-router.js +203 -0
- package/lib/core/constants/vaults.d.ts +93 -0
- package/lib/core/constants/vaults.js +277 -0
- package/lib/core/constants/web3.d.ts +106 -0
- package/lib/core/constants/web3.js +251 -0
- package/lib/core/errors/index.d.ts +177 -0
- package/lib/core/errors/index.js +257 -0
- package/lib/core/fetcher.d.ts +237 -0
- package/lib/core/fetcher.js +1103 -0
- package/lib/core/helpers/adapters.d.ts +13 -0
- package/lib/core/helpers/adapters.js +39 -0
- package/lib/core/helpers/chain-address.d.ts +13 -0
- package/lib/core/helpers/chain-address.js +47 -0
- package/lib/core/helpers/chain-error.d.ts +207 -0
- package/lib/core/helpers/chain-error.js +697 -0
- package/lib/core/helpers/chain-support.d.ts +98 -0
- package/lib/core/helpers/chain-support.js +139 -0
- package/lib/core/helpers/concurrency.d.ts +51 -0
- package/lib/core/helpers/concurrency.js +79 -0
- package/lib/core/helpers/core.d.ts +92 -0
- package/lib/core/helpers/core.js +368 -0
- package/lib/core/helpers/explorer-link.d.ts +16 -0
- package/lib/core/helpers/explorer-link.js +26 -0
- package/lib/core/helpers/multicall.d.ts +68 -0
- package/lib/core/helpers/multicall.js +103 -0
- package/lib/core/helpers/revert-decode.d.ts +248 -0
- package/lib/core/helpers/revert-decode.js +515 -0
- package/lib/core/helpers/signer.d.ts +61 -0
- package/lib/core/helpers/signer.js +184 -0
- package/lib/core/helpers/swap-router.d.ts +269 -0
- package/lib/core/helpers/swap-router.js +542 -0
- package/lib/core/helpers/vault-version.d.ts +24 -0
- package/lib/core/helpers/vault-version.js +83 -0
- package/lib/core/helpers/vaults.d.ts +89 -0
- package/lib/core/helpers/vaults.js +241 -0
- package/lib/core/helpers/web3.d.ts +366 -0
- package/lib/core/helpers/web3.js +1034 -0
- package/lib/core/index.d.ts +23 -0
- package/lib/core/index.js +40 -0
- package/lib/core/logger/curator-alert.d.ts +217 -0
- package/lib/core/logger/curator-alert.js +276 -0
- package/lib/core/logger/index.d.ts +99 -0
- package/lib/core/logger/index.js +163 -0
- package/lib/core/logger/slack.d.ts +49 -0
- package/lib/core/logger/slack.js +111 -0
- package/lib/core/vault-metadata.d.ts +12 -0
- package/lib/core/vault-metadata.js +42 -0
- package/lib/core/version-check.d.ts +58 -0
- package/lib/core/version-check.js +182 -0
- package/lib/evm/index.d.ts +2 -0
- package/lib/evm/index.js +19 -0
- package/lib/evm/methods/crossChainVault.d.ts +132 -0
- package/lib/evm/methods/crossChainVault.js +857 -0
- package/lib/evm/methods/crossChainVaultRegistry.d.ts +92 -0
- package/lib/evm/methods/crossChainVaultRegistry.js +239 -0
- package/lib/evm/methods/index.d.ts +2 -0
- package/lib/evm/methods/index.js +19 -0
- package/lib/evm/types/crossChain.d.ts +363 -0
- package/lib/evm/types/crossChain.js +20 -0
- package/lib/evm/types/index.d.ts +1 -0
- package/lib/evm/types/index.js +18 -0
- package/lib/index.d.ts +30 -0
- package/lib/index.js +52 -0
- package/lib/main.d.ts +596 -0
- package/lib/main.js +681 -0
- package/lib/modules/api/fetcher.d.ts +108 -0
- package/lib/modules/api/fetcher.js +187 -0
- package/lib/modules/api/index.d.ts +1 -0
- package/lib/modules/api/index.js +6 -0
- package/lib/modules/api/main.d.ts +587 -0
- package/lib/modules/api/main.js +911 -0
- package/lib/modules/sub-accounts/fetcher.d.ts +53 -0
- package/lib/modules/sub-accounts/fetcher.js +96 -0
- package/lib/modules/sub-accounts/index.d.ts +2 -0
- package/lib/modules/sub-accounts/index.js +19 -0
- package/lib/modules/sub-accounts/main.d.ts +249 -0
- package/lib/modules/sub-accounts/main.js +211 -0
- package/lib/modules/sub-accounts/utils.d.ts +106 -0
- package/lib/modules/sub-accounts/utils.js +112 -0
- package/lib/modules/vaults/adapter.helpers.d.ts +84 -0
- package/lib/modules/vaults/adapter.helpers.js +202 -0
- package/lib/modules/vaults/fetcher.d.ts +147 -0
- package/lib/modules/vaults/fetcher.js +357 -0
- package/lib/modules/vaults/getters.d.ts +1060 -0
- package/lib/modules/vaults/getters.js +4079 -0
- package/lib/modules/vaults/index.d.ts +20 -0
- package/lib/modules/vaults/index.js +44 -0
- package/lib/modules/vaults/main.d.ts +607 -0
- package/lib/modules/vaults/main.js +1687 -0
- package/lib/modules/vaults/prefetch.d.ts +65 -0
- package/lib/modules/vaults/prefetch.js +120 -0
- package/lib/modules/vaults/read.actions.d.ts +406 -0
- package/lib/modules/vaults/read.actions.js +891 -0
- package/lib/modules/vaults/types.d.ts +149 -0
- package/lib/modules/vaults/types.js +3 -0
- package/lib/modules/vaults/utils/call-data-decoder.d.ts +61 -0
- package/lib/modules/vaults/utils/call-data-decoder.js +194 -0
- package/lib/modules/vaults/utils/date-utils.d.ts +50 -0
- package/lib/modules/vaults/utils/date-utils.js +84 -0
- package/lib/modules/vaults/utils.d.ts +153 -0
- package/lib/modules/vaults/utils.js +818 -0
- package/lib/modules/vaults/write.actions.d.ts +812 -0
- package/lib/modules/vaults/write.actions.js +2377 -0
- package/lib/polyfills.d.ts +1 -0
- package/lib/polyfills.js +12 -0
- package/lib/sdk.d.ts +30173 -0
- package/lib/services/coingecko/fetcher.d.ts +15 -0
- package/lib/services/coingecko/fetcher.js +67 -0
- package/lib/services/coingecko/index.d.ts +2 -0
- package/lib/services/coingecko/index.js +19 -0
- package/lib/services/coingecko/utils.d.ts +1 -0
- package/lib/services/coingecko/utils.js +24 -0
- package/lib/services/debank/fetcher.d.ts +126 -0
- package/lib/services/debank/fetcher.js +47 -0
- package/lib/services/debank/index.d.ts +2 -0
- package/lib/services/debank/index.js +19 -0
- package/lib/services/debank/utils.d.ts +50 -0
- package/lib/services/debank/utils.js +325 -0
- package/lib/services/layerzero/deposits.d.ts +55 -0
- package/lib/services/layerzero/deposits.js +174 -0
- package/lib/services/layerzero/redeems.d.ts +20 -0
- package/lib/services/layerzero/redeems.js +92 -0
- package/lib/services/layerzero/utils.d.ts +9 -0
- package/lib/services/layerzero/utils.js +22 -0
- package/lib/services/octavfi/fetcher.d.ts +33 -0
- package/lib/services/octavfi/fetcher.js +39 -0
- package/lib/services/octavfi/index.d.ts +3 -0
- package/lib/services/octavfi/index.js +20 -0
- package/lib/services/octavfi/types.d.ts +34 -0
- package/lib/services/octavfi/types.js +3 -0
- package/lib/services/octavfi/utils.d.ts +16 -0
- package/lib/services/octavfi/utils.js +244 -0
- package/lib/services/subgraph/fetcher.d.ts +2 -0
- package/lib/services/subgraph/fetcher.js +66 -0
- package/lib/services/subgraph/index.d.ts +2 -0
- package/lib/services/subgraph/index.js +19 -0
- package/lib/services/subgraph/schema.d.ts +48 -0
- package/lib/services/subgraph/schema.js +87 -0
- package/lib/services/subgraph/vaults.d.ts +83 -0
- package/lib/services/subgraph/vaults.js +1282 -0
- package/lib/services/swap-quotes/index.d.ts +105 -0
- package/lib/services/swap-quotes/index.js +77 -0
- package/lib/services/swap-quotes/paraswap.d.ts +51 -0
- package/lib/services/swap-quotes/paraswap.js +138 -0
- package/lib/services/untangled/fetcher.d.ts +40 -0
- package/lib/services/untangled/fetcher.js +110 -0
- package/lib/services/untangled/index.d.ts +3 -0
- package/lib/services/untangled/index.js +20 -0
- package/lib/services/untangled/types.d.ts +83 -0
- package/lib/services/untangled/types.js +10 -0
- package/lib/services/untangled/utils.d.ts +91 -0
- package/lib/services/untangled/utils.js +339 -0
- package/lib/types/api.d.ts +498 -0
- package/lib/types/api.js +3 -0
- package/lib/types/index.d.ts +12 -0
- package/lib/types/index.js +28 -0
- package/lib/types/points.d.ts +28 -0
- package/lib/types/points.js +3 -0
- package/lib/types/pools.d.ts +144 -0
- package/lib/types/pools.js +3 -0
- package/lib/types/staking.d.ts +28 -0
- package/lib/types/staking.js +3 -0
- package/lib/types/sub-accounts.d.ts +150 -0
- package/lib/types/sub-accounts.js +3 -0
- package/lib/types/subgraph.d.ts +84 -0
- package/lib/types/subgraph.js +3 -0
- package/lib/types/typed-contract.d.ts +102 -0
- package/lib/types/typed-contract.js +3 -0
- package/lib/types/user.d.ts +1 -0
- package/lib/types/user.js +3 -0
- package/lib/types/vaults.d.ts +886 -0
- package/lib/types/vaults.js +30 -0
- package/lib/types/web3.d.ts +100 -0
- package/lib/types/web3.js +14 -0
- package/lib/types/webserver.d.ts +730 -0
- package/lib/types/webserver.js +3 -0
- package/package.json +79 -3
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateAppName = validateAppName;
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
/**
|
|
6
|
+
* Validate an `appName` slug at SDK boundary points (the `UpshiftSDK`
|
|
7
|
+
* constructor and the standalone {@link initializeSentry} entry point).
|
|
8
|
+
*
|
|
9
|
+
* Rules (kept intentionally narrow so the value is safe to use as a Sentry
|
|
10
|
+
* tag, an HTTP header value, and a filesystem-safe identifier — this is
|
|
11
|
+
* why we accept slugs only, not display names):
|
|
12
|
+
* - non-empty after trim
|
|
13
|
+
* - 3..64 characters
|
|
14
|
+
* - only `[a-zA-Z0-9._-]`
|
|
15
|
+
* - not shaped like an EVM address (`0x` + 40 hex chars) — an address
|
|
16
|
+
* passes the character rules but is a high-cardinality wallet
|
|
17
|
+
* identifier, not an application name. This also catches callers of
|
|
18
|
+
* `initializeSentry` still passing the pre-v9 positional argument
|
|
19
|
+
* order, where a wallet address occupied the slot `appName` now holds.
|
|
20
|
+
*
|
|
21
|
+
* Throws a descriptive `UpshiftValidationError` (code `INVALID_INPUT`) that
|
|
22
|
+
* names the failed rule and includes a remediation hint pointing at the
|
|
23
|
+
* docs link.
|
|
24
|
+
*
|
|
25
|
+
* @param value - The candidate app name, as received from the caller.
|
|
26
|
+
* @returns The trimmed, validated slug.
|
|
27
|
+
* @throws UpshiftValidationError when the value is missing, empty,
|
|
28
|
+
* mis-typed, out of the 3–64 length range, contains disallowed
|
|
29
|
+
* characters, or is shaped like an EVM address.
|
|
30
|
+
*/
|
|
31
|
+
function validateAppName(value) {
|
|
32
|
+
const docsHint = 'See https://docs.augustdigital.io/developers/typescript-sdk/javascript-sdk#app-name';
|
|
33
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
34
|
+
throw new errors_1.UpshiftValidationError('INVALID_INPUT', `Upshift SDK: \`appName\` is required. Pass a stable kebab-case slug identifying your application (e.g. "acme-trader"). ${docsHint}`);
|
|
35
|
+
}
|
|
36
|
+
const trimmed = value.trim();
|
|
37
|
+
if (trimmed.length < 3 || trimmed.length > 64) {
|
|
38
|
+
throw new errors_1.UpshiftValidationError('INVALID_INPUT', `Upshift SDK: \`appName\` must be 3-64 characters (got ${trimmed.length}). ${docsHint}`);
|
|
39
|
+
}
|
|
40
|
+
if (!/^[a-zA-Z0-9._-]+$/.test(trimmed)) {
|
|
41
|
+
throw new errors_1.UpshiftValidationError('INVALID_INPUT', `Upshift SDK: \`appName\` may only contain letters, digits, '.', '_' and '-' (got "${trimmed}"). Use a slug like "acme-trader", not a display name. ${docsHint}`);
|
|
42
|
+
}
|
|
43
|
+
if (/^0x[0-9a-fA-F]{40}$/.test(trimmed)) {
|
|
44
|
+
throw new errors_1.UpshiftValidationError('INVALID_INPUT', `Upshift SDK: \`appName\` looks like a wallet address ("${trimmed}"). Pass an application slug like "acme-trader" — if you are calling initializeSentry directly, note that since v9 the argument order is (config, environment, appName, walletAddress?, apiKey?). ${docsHint}`);
|
|
45
|
+
}
|
|
46
|
+
return trimmed;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=app-name.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map a numeric `chainId` to a stable lowercase slug for use as a Sentry tag
|
|
3
|
+
* value. Resolves both EVM chains ({@link NETWORKS}) and synthetic non-EVM
|
|
4
|
+
* chain IDs ({@link SPECIAL_CHAINS}); unknown IDs return `'unknown:<id>'`.
|
|
5
|
+
*
|
|
6
|
+
* @param chainId - Numeric chain ID, including negative IDs for non-EVM chains.
|
|
7
|
+
* @returns Slugified chain label (e.g. `'ethereum'`, `'arbitrum-one'`, `'solana'`).
|
|
8
|
+
*/
|
|
9
|
+
export declare function chainIdToTagValue(chainId: number | undefined): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chainIdToTagValue = chainIdToTagValue;
|
|
4
|
+
const web3_1 = require("../constants/web3");
|
|
5
|
+
/**
|
|
6
|
+
* Map a numeric `chainId` to a stable lowercase slug for use as a Sentry tag
|
|
7
|
+
* value. Resolves both EVM chains ({@link NETWORKS}) and synthetic non-EVM
|
|
8
|
+
* chain IDs ({@link SPECIAL_CHAINS}); unknown IDs return `'unknown:<id>'`.
|
|
9
|
+
*
|
|
10
|
+
* @param chainId - Numeric chain ID, including negative IDs for non-EVM chains.
|
|
11
|
+
* @returns Slugified chain label (e.g. `'ethereum'`, `'arbitrum-one'`, `'solana'`).
|
|
12
|
+
*/
|
|
13
|
+
function chainIdToTagValue(chainId) {
|
|
14
|
+
if (chainId === undefined || chainId === null || Number.isNaN(chainId)) {
|
|
15
|
+
return 'unknown';
|
|
16
|
+
}
|
|
17
|
+
for (const entry of Object.values(web3_1.SPECIAL_CHAINS)) {
|
|
18
|
+
if (entry.chainId === chainId) {
|
|
19
|
+
return slugify(entry.name);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const network = web3_1.NETWORKS[chainId];
|
|
23
|
+
if (network) {
|
|
24
|
+
return slugify(network.name);
|
|
25
|
+
}
|
|
26
|
+
return `unknown:${chainId}`;
|
|
27
|
+
}
|
|
28
|
+
function slugify(input) {
|
|
29
|
+
return input
|
|
30
|
+
.toLowerCase()
|
|
31
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
32
|
+
.replace(/^-+|-+$/g, '');
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=chain-name.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentry DSN for SDK analytics.
|
|
3
|
+
* This is an internal constant - not exposed to SDK users.
|
|
4
|
+
*/
|
|
5
|
+
export declare const SENTRY_DSN = "https://ca39246016d0b43154f0640314cbd3b5@o4507215496609792.ingest.de.sentry.io/4511864614813776";
|
|
6
|
+
/**
|
|
7
|
+
* `appName` slugs of applications 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>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FIRST_PARTY_APP_NAMES = exports.SENTRY_DSN = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Sentry DSN for SDK analytics.
|
|
6
|
+
* This is an internal constant - not exposed to SDK users.
|
|
7
|
+
*/
|
|
8
|
+
exports.SENTRY_DSN = 'https://ca39246016d0b43154f0640314cbd3b5@o4507215496609792.ingest.de.sentry.io/4511864614813776';
|
|
9
|
+
/**
|
|
10
|
+
* `appName` slugs of applications 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
|
+
'upshift-cli',
|
|
23
|
+
'upshift-mcp',
|
|
24
|
+
// Legacy slugs still emitted by pre-rebrand CLI/MCP installs.
|
|
25
|
+
'august-cli',
|
|
26
|
+
'august-mcp',
|
|
27
|
+
]);
|
|
28
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment-variable gates for analytics. Pure functions — safe to import
|
|
3
|
+
* anywhere, no Sentry side effects. Tested directly in `analytics.test.js`.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Read a process env var without crashing in browsers or in bundles where
|
|
7
|
+
* `process.env` is a frozen / proxied object that throws on missing keys.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readEnv(name: string): string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* `UPSHIFT_SDK_FORCE_ANALYTICS=1` bypasses the dev/test and localhost gates.
|
|
12
|
+
* Used by our own smoke-test script and by partners deliberately exercising
|
|
13
|
+
* telemetry in a non-prod environment.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isAnalyticsForcedOnViaEnv(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* `UPSHIFT_SDK_DISABLE_ANALYTICS=1` is the env equivalent of passing
|
|
18
|
+
* `analytics: { enabled: false }`. Useful when partners can't easily plumb
|
|
19
|
+
* config through (CI runners, ops scripts).
|
|
20
|
+
*/
|
|
21
|
+
export declare function isAnalyticsDisabledViaEnv(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* True when `NODE_ENV` is `'development'` or `'test'`. The SDK auto-disables
|
|
24
|
+
* analytics in these environments so partners' local dev runs and Jest suites
|
|
25
|
+
* don't pollute the production Sentry project.
|
|
26
|
+
*
|
|
27
|
+
* `NODE_ENV` undefined / `'production'` / `'staging'` / anything else → false.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isNodeDevOrTestEnv(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* True when the page is being served from a developer's own machine or private
|
|
32
|
+
* network.
|
|
33
|
+
*
|
|
34
|
+
* The browser counterpart to {@link isNodeDevOrTestEnv}: bundlers strip or
|
|
35
|
+
* stub `process.env`, so `NODE_ENV` cannot tell a `next dev` tab apart from a
|
|
36
|
+
* production deploy. The hostname can. Always false in Node, where
|
|
37
|
+
* `NODE_ENV` is the gate.
|
|
38
|
+
*
|
|
39
|
+
* Recognises `localhost` and the `.localhost` TLD (RFC 6761 reserves both for
|
|
40
|
+
* loopback), mDNS `.local` names, and any loopback / private / link-local IP
|
|
41
|
+
* literal in either address family. Anything else — including a public host
|
|
42
|
+
* that merely *contains* one of those names, like `localhost.acme.com` — is
|
|
43
|
+
* treated as a real deployment, because suppressing a genuine production
|
|
44
|
+
* origin is the more costly mistake of the two.
|
|
45
|
+
*/
|
|
46
|
+
export declare function isLocalhost(): boolean;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Environment-variable gates for analytics. Pure functions — safe to import
|
|
4
|
+
* anywhere, no Sentry side effects. Tested directly in `analytics.test.js`.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.readEnv = readEnv;
|
|
8
|
+
exports.isAnalyticsForcedOnViaEnv = isAnalyticsForcedOnViaEnv;
|
|
9
|
+
exports.isAnalyticsDisabledViaEnv = isAnalyticsDisabledViaEnv;
|
|
10
|
+
exports.isNodeDevOrTestEnv = isNodeDevOrTestEnv;
|
|
11
|
+
exports.isLocalhost = isLocalhost;
|
|
12
|
+
/**
|
|
13
|
+
* Read a process env var without crashing in browsers or in bundles where
|
|
14
|
+
* `process.env` is a frozen / proxied object that throws on missing keys.
|
|
15
|
+
*/
|
|
16
|
+
function readEnv(name) {
|
|
17
|
+
try {
|
|
18
|
+
if (typeof process !== 'undefined' && process.env) {
|
|
19
|
+
return process.env[name];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// Bundlers occasionally throw on `process.env` access. Treat as unset.
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
function isTruthyEnv(value) {
|
|
28
|
+
if (!value)
|
|
29
|
+
return false;
|
|
30
|
+
const v = value.toLowerCase();
|
|
31
|
+
return v === '1' || v === 'true' || v === 'yes' || v === 'on';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* `UPSHIFT_SDK_FORCE_ANALYTICS=1` bypasses the dev/test and localhost gates.
|
|
35
|
+
* Used by our own smoke-test script and by partners deliberately exercising
|
|
36
|
+
* telemetry in a non-prod environment.
|
|
37
|
+
*/
|
|
38
|
+
function isAnalyticsForcedOnViaEnv() {
|
|
39
|
+
return isTruthyEnv(readEnv('UPSHIFT_SDK_FORCE_ANALYTICS'));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* `UPSHIFT_SDK_DISABLE_ANALYTICS=1` is the env equivalent of passing
|
|
43
|
+
* `analytics: { enabled: false }`. Useful when partners can't easily plumb
|
|
44
|
+
* config through (CI runners, ops scripts).
|
|
45
|
+
*/
|
|
46
|
+
function isAnalyticsDisabledViaEnv() {
|
|
47
|
+
return isTruthyEnv(readEnv('UPSHIFT_SDK_DISABLE_ANALYTICS'));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* True when `NODE_ENV` is `'development'` or `'test'`. The SDK auto-disables
|
|
51
|
+
* analytics in these environments so partners' local dev runs and Jest suites
|
|
52
|
+
* don't pollute the production Sentry project.
|
|
53
|
+
*
|
|
54
|
+
* `NODE_ENV` undefined / `'production'` / `'staging'` / anything else → false.
|
|
55
|
+
*/
|
|
56
|
+
function isNodeDevOrTestEnv() {
|
|
57
|
+
const env = readEnv('NODE_ENV');
|
|
58
|
+
return env === 'development' || env === 'test';
|
|
59
|
+
}
|
|
60
|
+
/** Dotted-quad IPv4 literal. Anchored, so `10.acme.com` is not an address. */
|
|
61
|
+
const IPV4_LITERAL = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
|
|
62
|
+
/**
|
|
63
|
+
* True for an IPv4 literal that cannot be a public production origin: loopback
|
|
64
|
+
* (`127.0.0.0/8` — `127.0.0.1` is only the most common of 16.7M), the
|
|
65
|
+
* "this host" block (`0.0.0.0/8`), the three RFC 1918 private ranges, and
|
|
66
|
+
* link-local (`169.254.0.0/16`).
|
|
67
|
+
*
|
|
68
|
+
* Ranges are checked by octet rather than by string prefix on purpose: a
|
|
69
|
+
* `startsWith('10.')` test both misses `172.20.0.2` (a default Docker bridge
|
|
70
|
+
* address, and a very ordinary way to reach a container) and misfires on a
|
|
71
|
+
* public host that merely begins with those digits.
|
|
72
|
+
*/
|
|
73
|
+
function isPrivateIpv4(hostname) {
|
|
74
|
+
const octets = IPV4_LITERAL.exec(hostname);
|
|
75
|
+
if (!octets)
|
|
76
|
+
return false;
|
|
77
|
+
const [a, b, c, d] = octets.slice(1).map(Number);
|
|
78
|
+
// The regex counts digits, not values, so an out-of-range quad still matches
|
|
79
|
+
// its shape. `127.0.0.999` is not an address — the URL parser rejects it
|
|
80
|
+
// rather than handing it over as a `hostname` — so it is a name, and names
|
|
81
|
+
// that are not the reserved ones are treated as deployed.
|
|
82
|
+
if (a > 255 || b > 255 || c > 255 || d > 255)
|
|
83
|
+
return false;
|
|
84
|
+
return (a === 127 ||
|
|
85
|
+
a === 0 ||
|
|
86
|
+
a === 10 ||
|
|
87
|
+
(a === 172 && b >= 16 && b <= 31) ||
|
|
88
|
+
(a === 192 && b === 168) ||
|
|
89
|
+
(a === 169 && b === 254));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* True for an IPv6 literal that cannot be a public production origin:
|
|
93
|
+
* loopback (`::1`, in either notation), the unspecified address, an
|
|
94
|
+
* IPv4-mapped private address, unique-local (`fc00::/7`) and link-local
|
|
95
|
+
* (`fe80::/10`).
|
|
96
|
+
*
|
|
97
|
+
* `hostname` carries the brackets for an IPv6 host — `http://[::1]:3000/`
|
|
98
|
+
* yields `[::1]`, per the URL standard's host serialization — so they are
|
|
99
|
+
* stripped before matching.
|
|
100
|
+
*/
|
|
101
|
+
function isLocalIpv6(hostname) {
|
|
102
|
+
const host = hostname.replace(/^\[/, '').replace(/\]$/, '');
|
|
103
|
+
if (!host.includes(':'))
|
|
104
|
+
return false;
|
|
105
|
+
if (host === '::1' || host === '::')
|
|
106
|
+
return true;
|
|
107
|
+
if (/^(?:0{1,4}:){7}0{0,3}1$/.test(host))
|
|
108
|
+
return true;
|
|
109
|
+
if (host.startsWith('::ffff:'))
|
|
110
|
+
return isPrivateIpv4(host.slice(7));
|
|
111
|
+
return /^f[cd]/.test(host) || /^fe[89ab]/.test(host);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* True when the page is being served from a developer's own machine or private
|
|
115
|
+
* network.
|
|
116
|
+
*
|
|
117
|
+
* The browser counterpart to {@link isNodeDevOrTestEnv}: bundlers strip or
|
|
118
|
+
* stub `process.env`, so `NODE_ENV` cannot tell a `next dev` tab apart from a
|
|
119
|
+
* production deploy. The hostname can. Always false in Node, where
|
|
120
|
+
* `NODE_ENV` is the gate.
|
|
121
|
+
*
|
|
122
|
+
* Recognises `localhost` and the `.localhost` TLD (RFC 6761 reserves both for
|
|
123
|
+
* loopback), mDNS `.local` names, and any loopback / private / link-local IP
|
|
124
|
+
* literal in either address family. Anything else — including a public host
|
|
125
|
+
* that merely *contains* one of those names, like `localhost.acme.com` — is
|
|
126
|
+
* treated as a real deployment, because suppressing a genuine production
|
|
127
|
+
* origin is the more costly mistake of the two.
|
|
128
|
+
*/
|
|
129
|
+
function isLocalhost() {
|
|
130
|
+
try {
|
|
131
|
+
if (typeof window !== 'undefined' && window.location) {
|
|
132
|
+
// Hostnames are case-insensitive; browsers normalize, other runtimes
|
|
133
|
+
// hosting a `window` shim may not.
|
|
134
|
+
const hostname = String(window.location.hostname).toLowerCase();
|
|
135
|
+
return (hostname === 'localhost' ||
|
|
136
|
+
hostname.endsWith('.localhost') ||
|
|
137
|
+
hostname.endsWith('.local') ||
|
|
138
|
+
isPrivateIpv4(hostname) ||
|
|
139
|
+
isLocalIpv6(hostname));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
// Some embedded/sandboxed runtimes throw on `window.location`. Not local.
|
|
144
|
+
}
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics module for SDK usage tracking via Sentry.
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
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
|
|
9
|
+
* - API response time tracking
|
|
10
|
+
* - Chain/network usage distribution
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Analytics enabled by default
|
|
15
|
+
* const sdk = new UpshiftSDK({
|
|
16
|
+
* appName: 'acme-trader',
|
|
17
|
+
* providers: { 1: 'https://...' },
|
|
18
|
+
* keys: { upshift: '...' },
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Opt-out of analytics
|
|
22
|
+
* const sdk = new UpshiftSDK({
|
|
23
|
+
* appName: 'acme-trader',
|
|
24
|
+
* providers: { 1: 'https://...' },
|
|
25
|
+
* keys: { upshift: '...' },
|
|
26
|
+
* analytics: { enabled: false },
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export type { IAnalyticsConfig, IUserIdentity, IMethodCallMetrics, } from './types';
|
|
31
|
+
export { hashApiKey, getSessionId, generateFingerprint, createUserIdentity, getUserId, } from './user-identity';
|
|
32
|
+
export { initializeSentry, updateUser, clearUser, isAnalyticsEnabled, getSentry, resetAnalytics, captureSdkException, } from './sentry';
|
|
33
|
+
export { getSentrySDK, getSentryRuntime } from './sentry-runtime';
|
|
34
|
+
export { readEnv, isAnalyticsDisabledViaEnv, isAnalyticsForcedOnViaEnv, isNodeDevOrTestEnv, } from './env';
|
|
35
|
+
export { trackApiCall, trackNetworkSwitch, trackKeyVerification, getCacheStats, resetCacheStats, } from './metrics';
|
|
36
|
+
export { sanitizeArgs, sanitizeObject, computeArgShape } from './sanitize';
|
|
37
|
+
export { withMethodTracking, withSyncMethodTracking, instrumentClass, } from './instrumentation';
|
|
38
|
+
export { METHOD_CATEGORIES, getMethodCategory, type MethodCategory, } from './method-taxonomy';
|
|
39
|
+
export { chainIdToTagValue } from './chain-name';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Analytics module for SDK usage tracking via Sentry.
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
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
|
|
10
|
+
* - API response time tracking
|
|
11
|
+
* - Chain/network usage distribution
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Analytics enabled by default
|
|
16
|
+
* const sdk = new UpshiftSDK({
|
|
17
|
+
* appName: 'acme-trader',
|
|
18
|
+
* providers: { 1: 'https://...' },
|
|
19
|
+
* keys: { upshift: '...' },
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Opt-out of analytics
|
|
23
|
+
* const sdk = new UpshiftSDK({
|
|
24
|
+
* appName: 'acme-trader',
|
|
25
|
+
* providers: { 1: 'https://...' },
|
|
26
|
+
* keys: { upshift: '...' },
|
|
27
|
+
* analytics: { enabled: false },
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
33
|
+
// User identity utilities
|
|
34
|
+
var user_identity_1 = require("./user-identity");
|
|
35
|
+
Object.defineProperty(exports, "hashApiKey", { enumerable: true, get: function () { return user_identity_1.hashApiKey; } });
|
|
36
|
+
Object.defineProperty(exports, "getSessionId", { enumerable: true, get: function () { return user_identity_1.getSessionId; } });
|
|
37
|
+
Object.defineProperty(exports, "generateFingerprint", { enumerable: true, get: function () { return user_identity_1.generateFingerprint; } });
|
|
38
|
+
Object.defineProperty(exports, "createUserIdentity", { enumerable: true, get: function () { return user_identity_1.createUserIdentity; } });
|
|
39
|
+
Object.defineProperty(exports, "getUserId", { enumerable: true, get: function () { return user_identity_1.getUserId; } });
|
|
40
|
+
// Sentry core
|
|
41
|
+
var sentry_1 = require("./sentry");
|
|
42
|
+
Object.defineProperty(exports, "initializeSentry", { enumerable: true, get: function () { return sentry_1.initializeSentry; } });
|
|
43
|
+
Object.defineProperty(exports, "updateUser", { enumerable: true, get: function () { return sentry_1.updateUser; } });
|
|
44
|
+
Object.defineProperty(exports, "clearUser", { enumerable: true, get: function () { return sentry_1.clearUser; } });
|
|
45
|
+
Object.defineProperty(exports, "isAnalyticsEnabled", { enumerable: true, get: function () { return sentry_1.isAnalyticsEnabled; } });
|
|
46
|
+
Object.defineProperty(exports, "getSentry", { enumerable: true, get: function () { return sentry_1.getSentry; } });
|
|
47
|
+
Object.defineProperty(exports, "resetAnalytics", { enumerable: true, get: function () { return sentry_1.resetAnalytics; } });
|
|
48
|
+
Object.defineProperty(exports, "captureSdkException", { enumerable: true, get: function () { return sentry_1.captureSdkException; } });
|
|
49
|
+
// Isomorphic Sentry runtime resolver
|
|
50
|
+
var sentry_runtime_1 = require("./sentry-runtime");
|
|
51
|
+
Object.defineProperty(exports, "getSentrySDK", { enumerable: true, get: function () { return sentry_runtime_1.getSentrySDK; } });
|
|
52
|
+
Object.defineProperty(exports, "getSentryRuntime", { enumerable: true, get: function () { return sentry_runtime_1.getSentryRuntime; } });
|
|
53
|
+
// Env-variable gates
|
|
54
|
+
var env_1 = require("./env");
|
|
55
|
+
Object.defineProperty(exports, "readEnv", { enumerable: true, get: function () { return env_1.readEnv; } });
|
|
56
|
+
Object.defineProperty(exports, "isAnalyticsDisabledViaEnv", { enumerable: true, get: function () { return env_1.isAnalyticsDisabledViaEnv; } });
|
|
57
|
+
Object.defineProperty(exports, "isAnalyticsForcedOnViaEnv", { enumerable: true, get: function () { return env_1.isAnalyticsForcedOnViaEnv; } });
|
|
58
|
+
Object.defineProperty(exports, "isNodeDevOrTestEnv", { enumerable: true, get: function () { return env_1.isNodeDevOrTestEnv; } });
|
|
59
|
+
// Metrics tracking
|
|
60
|
+
var metrics_1 = require("./metrics");
|
|
61
|
+
Object.defineProperty(exports, "trackApiCall", { enumerable: true, get: function () { return metrics_1.trackApiCall; } });
|
|
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; } });
|
|
64
|
+
Object.defineProperty(exports, "getCacheStats", { enumerable: true, get: function () { return metrics_1.getCacheStats; } });
|
|
65
|
+
Object.defineProperty(exports, "resetCacheStats", { enumerable: true, get: function () { return metrics_1.resetCacheStats; } });
|
|
66
|
+
// Sanitization utilities
|
|
67
|
+
var sanitize_1 = require("./sanitize");
|
|
68
|
+
Object.defineProperty(exports, "sanitizeArgs", { enumerable: true, get: function () { return sanitize_1.sanitizeArgs; } });
|
|
69
|
+
Object.defineProperty(exports, "sanitizeObject", { enumerable: true, get: function () { return sanitize_1.sanitizeObject; } });
|
|
70
|
+
Object.defineProperty(exports, "computeArgShape", { enumerable: true, get: function () { return sanitize_1.computeArgShape; } });
|
|
71
|
+
// Method instrumentation
|
|
72
|
+
var instrumentation_1 = require("./instrumentation");
|
|
73
|
+
Object.defineProperty(exports, "withMethodTracking", { enumerable: true, get: function () { return instrumentation_1.withMethodTracking; } });
|
|
74
|
+
Object.defineProperty(exports, "withSyncMethodTracking", { enumerable: true, get: function () { return instrumentation_1.withSyncMethodTracking; } });
|
|
75
|
+
Object.defineProperty(exports, "instrumentClass", { enumerable: true, get: function () { return instrumentation_1.instrumentClass; } });
|
|
76
|
+
// Method taxonomy
|
|
77
|
+
var method_taxonomy_1 = require("./method-taxonomy");
|
|
78
|
+
Object.defineProperty(exports, "METHOD_CATEGORIES", { enumerable: true, get: function () { return method_taxonomy_1.METHOD_CATEGORIES; } });
|
|
79
|
+
Object.defineProperty(exports, "getMethodCategory", { enumerable: true, get: function () { return method_taxonomy_1.getMethodCategory; } });
|
|
80
|
+
// Chain name helper
|
|
81
|
+
var chain_name_1 = require("./chain-name");
|
|
82
|
+
Object.defineProperty(exports, "chainIdToTagValue", { enumerable: true, get: function () { return chain_name_1.chainIdToTagValue; } });
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Higher-order function to wrap SDK methods with performance tracking.
|
|
3
|
+
* Tracks method calls, timing, chain usage, and errors.
|
|
4
|
+
*
|
|
5
|
+
* @param methodName - Name of the method being wrapped
|
|
6
|
+
* @param method - The original async method
|
|
7
|
+
* @param getChainId - Function to get current chain ID
|
|
8
|
+
* @returns Wrapped method with tracking
|
|
9
|
+
*/
|
|
10
|
+
export declare function withMethodTracking<T extends (...args: unknown[]) => Promise<unknown>>(methodName: string, method: T, getChainId?: () => number | undefined): T;
|
|
11
|
+
/**
|
|
12
|
+
* Higher-order function to wrap synchronous SDK methods with tracking.
|
|
13
|
+
* Uses breadcrumbs for tracking since spans require async context.
|
|
14
|
+
*
|
|
15
|
+
* @param methodName - Name of the method being wrapped
|
|
16
|
+
* @param method - The original sync method
|
|
17
|
+
* @param getChainId - Function to get current chain ID
|
|
18
|
+
* @returns Wrapped method with tracking
|
|
19
|
+
*/
|
|
20
|
+
export declare function withSyncMethodTracking<T extends (...args: unknown[]) => unknown>(methodName: string, method: T, getChainId?: () => number | undefined): T;
|
|
21
|
+
/**
|
|
22
|
+
* Instrument all methods on a class instance with tracking.
|
|
23
|
+
* This auto-wraps all public methods (both async and sync) without boilerplate.
|
|
24
|
+
*
|
|
25
|
+
* @param instance - The class instance to instrument
|
|
26
|
+
* @param getChainId - Function to get current chain ID
|
|
27
|
+
* @returns The same instance with instrumented methods
|
|
28
|
+
*/
|
|
29
|
+
export declare function instrumentClass<T extends object>(instance: T, getChainId: () => number | undefined): T;
|