@bounded-sh/client 0.0.50 → 0.0.52

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.
Files changed (58) hide show
  1. package/dist/auth/index.d.ts +8 -1
  2. package/dist/builds/apps.d.ts +2 -0
  3. package/dist/builds/client.d.ts +23 -1
  4. package/dist/builds/index.d.ts +7 -4
  5. package/dist/builds/types.d.ts +72 -0
  6. package/dist/{email-auth-provider-Dj66AuH0.js → email-auth-provider-6seVxrWq.js} +2 -2
  7. package/dist/{email-auth-provider-Dj66AuH0.js.map → email-auth-provider-6seVxrWq.js.map} +1 -1
  8. package/dist/{email-auth-provider-CmYs6Dcm.js → email-auth-provider-BCI1_WLA.js} +2 -2
  9. package/dist/{email-auth-provider-CmYs6Dcm.js.map → email-auth-provider-BCI1_WLA.js.map} +1 -1
  10. package/dist/{email-auth-provider-B7czfBEU.mjs → email-auth-provider-D22p_2xV.mjs} +2 -2
  11. package/dist/{email-auth-provider-DIZAETBC.mjs.map → email-auth-provider-D22p_2xV.mjs.map} +1 -1
  12. package/dist/{email-auth-provider-DIZAETBC.mjs → email-auth-provider-uZbdT_Bx.mjs} +2 -2
  13. package/dist/{email-auth-provider-B7czfBEU.mjs.map → email-auth-provider-uZbdT_Bx.mjs.map} +1 -1
  14. package/dist/global.d.ts +3 -3
  15. package/dist/{guest-auth-provider-CCpNvX3j.mjs → guest-auth-provider-B_9cVFL1.mjs} +2 -2
  16. package/dist/{guest-auth-provider-CCpNvX3j.mjs.map → guest-auth-provider-B_9cVFL1.mjs.map} +1 -1
  17. package/dist/{guest-auth-provider-B5sgg-q5.js → guest-auth-provider-BrSO-CUp.js} +2 -2
  18. package/dist/{guest-auth-provider-B5sgg-q5.js.map → guest-auth-provider-BrSO-CUp.js.map} +1 -1
  19. package/dist/{guest-auth-provider-CxsLCznO.js → guest-auth-provider-DY-u2wpK.js} +2 -2
  20. package/dist/{guest-auth-provider-CxsLCznO.js.map → guest-auth-provider-DY-u2wpK.js.map} +1 -1
  21. package/dist/{guest-auth-provider-BR0_YL8z.mjs → guest-auth-provider-ShmskrcH.mjs} +2 -2
  22. package/dist/{guest-auth-provider-BR0_YL8z.mjs.map → guest-auth-provider-ShmskrcH.mjs.map} +1 -1
  23. package/dist/{index-BYy1tSkr.mjs → index-BvUrIsky.mjs} +98 -15
  24. package/dist/index-BvUrIsky.mjs.map +1 -0
  25. package/dist/{index-m42Be5Oj.js → index-D4jNluH9.js} +100 -14
  26. package/dist/index-D4jNluH9.js.map +1 -0
  27. package/dist/index.d.ts +3 -1
  28. package/dist/index.js +12 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +2 -2
  31. package/dist/{index.native-BfoLJCZg.js → index.native-2Mmuh7RB.js} +100 -14
  32. package/dist/index.native-2Mmuh7RB.js.map +1 -0
  33. package/dist/{index.native-B-ldAbu2.mjs → index.native-gU1kSEmQ.mjs} +98 -15
  34. package/dist/index.native-gU1kSEmQ.mjs.map +1 -0
  35. package/dist/index.native.js +4 -1
  36. package/dist/index.native.js.map +1 -1
  37. package/dist/index.native.mjs +1 -1
  38. package/dist/{injected-evm-wallet-provider-BLQzWiBP.js → injected-evm-wallet-provider-BEGvuTUU.js} +2 -2
  39. package/dist/{injected-evm-wallet-provider-BLQzWiBP.js.map → injected-evm-wallet-provider-BEGvuTUU.js.map} +1 -1
  40. package/dist/{injected-evm-wallet-provider-ubsHX217.mjs → injected-evm-wallet-provider-CNnMBwAY.mjs} +2 -2
  41. package/dist/{injected-evm-wallet-provider-ubsHX217.mjs.map → injected-evm-wallet-provider-CNnMBwAY.mjs.map} +1 -1
  42. package/dist/{injected-evm-wallet-provider-sBCSkksr.mjs → injected-evm-wallet-provider-COM5BPuY.mjs} +2 -2
  43. package/dist/{injected-evm-wallet-provider-sBCSkksr.mjs.map → injected-evm-wallet-provider-COM5BPuY.mjs.map} +1 -1
  44. package/dist/{injected-evm-wallet-provider-BXj1YFaZ.js → injected-evm-wallet-provider-DoB2BLir.js} +2 -2
  45. package/dist/{injected-evm-wallet-provider-BXj1YFaZ.js.map → injected-evm-wallet-provider-DoB2BLir.js.map} +1 -1
  46. package/dist/{injected-wallet-provider-BfzoheDy.mjs → injected-wallet-provider-CGoMdKhp.mjs} +2 -2
  47. package/dist/{injected-wallet-provider-BfzoheDy.mjs.map → injected-wallet-provider-CGoMdKhp.mjs.map} +1 -1
  48. package/dist/{injected-wallet-provider-DG87X6AQ.mjs → injected-wallet-provider-CLeRnTLu.mjs} +2 -2
  49. package/dist/{injected-wallet-provider-DG87X6AQ.mjs.map → injected-wallet-provider-CLeRnTLu.mjs.map} +1 -1
  50. package/dist/{injected-wallet-provider-Cml9TkyV.js → injected-wallet-provider-CyCGjf2G.js} +2 -2
  51. package/dist/{injected-wallet-provider-Cml9TkyV.js.map → injected-wallet-provider-CyCGjf2G.js.map} +1 -1
  52. package/dist/{injected-wallet-provider-PYcvLO2Z.js → injected-wallet-provider-g0md2vEj.js} +2 -2
  53. package/dist/{injected-wallet-provider-PYcvLO2Z.js.map → injected-wallet-provider-g0md2vEj.js.map} +1 -1
  54. package/package.json +2 -2
  55. package/dist/index-BYy1tSkr.mjs.map +0 -1
  56. package/dist/index-m42Be5Oj.js.map +0 -1
  57. package/dist/index.native-B-ldAbu2.mjs.map +0 -1
  58. package/dist/index.native-BfoLJCZg.js.map +0 -1
@@ -1,11 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var index_native = require('./index.native-BfoLJCZg.js');
3
+ var index_native = require('./index.native-2Mmuh7RB.js');
4
4
  var core = require('@bounded-sh/core');
5
5
  require('react');
6
6
 
7
7
 
8
8
 
9
+ exports.BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA = index_native.BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA;
10
+ exports.BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA = index_native.BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA;
11
+ exports.BUILD_REVIEW_CAPABILITY_SCHEMA = index_native.BUILD_REVIEW_CAPABILITY_SCHEMA;
9
12
  exports.BuildsApiError = index_native.BuildsApiError;
10
13
  exports.FAILURE_REASONS = index_native.FAILURE_REASONS;
11
14
  exports.NON_TERMINAL_STATES = index_native.NON_TERMINAL_STATES;
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.native.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- export { I as BuildsApiError, K as FAILURE_REASONS, N as NON_TERMINAL_STATES, O as OffchainAuthProvider, J as PARK_REASONS, P as PrivyExpoProvider, R as RUN_STATES, T as TERMINAL_STATES, C as apps, H as builds, x as completeLoginFromRedirect, z as completeLoginInPopup, D as deserializeTransaction, m as getAuthLoading, t as getAuthProvider, k as getCurrentUser, F as getIdToken, g as getPlatform, j as init, p as login, y as loginWithPopup, v as loginWithPrivy, w as loginWithRedirect, q as logout, l as onAuthLoadingChanged, o as onAuthStateChanged, G as setPlatform, u as signInAnonymously, A as useAuth, B as useBuildRun } from './index.native-B-ldAbu2.mjs';
1
+ export { Q as BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA, M as BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA, L as BUILD_REVIEW_CAPABILITY_SCHEMA, I as BuildsApiError, K as FAILURE_REASONS, N as NON_TERMINAL_STATES, O as OffchainAuthProvider, J as PARK_REASONS, P as PrivyExpoProvider, R as RUN_STATES, T as TERMINAL_STATES, C as apps, H as builds, x as completeLoginFromRedirect, z as completeLoginInPopup, D as deserializeTransaction, m as getAuthLoading, t as getAuthProvider, k as getCurrentUser, F as getIdToken, g as getPlatform, j as init, p as login, y as loginWithPopup, v as loginWithPrivy, w as loginWithRedirect, q as logout, l as onAuthLoadingChanged, o as onAuthStateChanged, G as setPlatform, u as signInAnonymously, A as useAuth, B as useBuildRun } from './index.native-gU1kSEmQ.mjs';
2
2
  export * from '@bounded-sh/core';
3
3
  export { BoundedDeclineError, DECLINE_EVENT_NAME, aggregate, count, deriveDecline, dispatchDeclineEvent, docId, get, getConfig, getFiles, getMany, queryAggregate, runExpression, runExpressionMany, runQuery, runQueryMany, search, set, setFile, setMany, signAndSubmitTransaction, signMessage, signTransaction, subscribe } from '@bounded-sh/core';
4
4
  import 'react';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@bounded-sh/core');
4
- var index = require('./index-m42Be5Oj.js');
4
+ var index = require('./index-D4jNluH9.js');
5
5
  require('react');
6
6
 
7
7
  const STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';
@@ -340,4 +340,4 @@ InjectedEvmWalletProvider.instance = null;
340
340
 
341
341
  exports.defaultInjectedEvmProvider = index.defaultInjectedEvmProvider;
342
342
  exports.InjectedEvmWalletProvider = InjectedEvmWalletProvider;
343
- //# sourceMappingURL=injected-evm-wallet-provider-BLQzWiBP.js.map
343
+ //# sourceMappingURL=injected-evm-wallet-provider-BEGvuTUU.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"injected-evm-wallet-provider-BLQzWiBP.js","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, assertCanonicalBoundedRuntimeWriteCalldata, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { getPlatform } from '../../platform';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\nconst STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login signs+submits transactions in one step (eth_sendTransaction) and has no Solana ' +\n 'transaction surface. Use an onchain WRITE (setMany) — the worker returns a pre-built EVM tx that ' +\n 'runTransaction submits — instead of signTransaction/signAndSubmitTransaction.';\n// Bounded polling for the tx receipt: ~60s at 2s cadence (L2 blocks are seconds).\nconst RECEIPT_POLL_ATTEMPTS = 30;\nconst RECEIPT_POLL_INTERVAL_MS = 2000;\nfunction normalizeConfig(config) {\n var _a;\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n let runtimeAddress;\n if (config.runtimeAddress !== undefined) {\n runtimeAddress = (_a = normalizeEvmAddress(config.runtimeAddress)) !== null && _a !== void 0 ? _a : undefined;\n if (!runtimeAddress)\n throw new Error('EVM wallet runtimeAddress is invalid');\n if (config.chainId === undefined)\n throw new Error('EVM wallet runtimeAddress requires an explicit chainId');\n }\n let runtimeAddresses;\n if (config.runtimeAddresses !== undefined) {\n runtimeAddresses = {};\n for (const [rawChainId, rawAddress] of Object.entries(config.runtimeAddresses)) {\n const chainId = Number(rawChainId);\n const address = normalizeEvmAddress(rawAddress);\n if (!Number.isSafeInteger(chainId) || chainId <= 0 || String(chainId) !== rawChainId || !address) {\n throw new Error(`Invalid EVM runtime allowlist entry for chain ${rawChainId}`);\n }\n runtimeAddresses[rawChainId] = address;\n }\n }\n return Object.assign(Object.assign({}, config), { runtimeAddress, runtimeAddresses });\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login. User.address\n // is typed `string` for legacy reasons — email logins cast the same null the same\n // way (email-auth-provider.ts) — so the null is cast here in one place.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n try {\n getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY, INJECTED_EVM_AUTH_METHOD);\n }\n catch ( /* no storage */_a) { /* no storage */ }\n }\n async restoreSession() {\n const session = await SessionManager().getSession();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet — the\n // EVM onchain write goes through runTransaction (eth_sendTransaction).\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n /**\n * Onchain write path: submit the worker's PRE-BUILT EIP-1559 tx via\n * eth_sendTransaction (the injected wallet signs + submits in one step), then\n * poll for the receipt. The EVM branch of operations.ts's 202 dispatch calls\n * this with the pre-built payload in the EVM slot and the Solana slot undefined.\n */\n async runTransaction(evmTransactionData, solTransactionData, options) {\n var _a, _b, _c;\n const evmTx = evmTransactionData;\n if (evmTx && solTransactionData) {\n throw new Error('A transaction cannot target EVM and Solana at the same time.');\n }\n if (!evmTx || !normalizeEvmAddress(evmTx.to) || typeof evmTx.data !== 'string' || !/^0x(?:[0-9a-fA-F]{2})+$/.test(evmTx.data)) {\n throw new Error('EVM transaction data (pre-built { to, data, chainId }) is required for an EVM onchain write');\n }\n // Exact decode, rather than a four-byte prefix check: permits the\n // ordinary and attested document-write entrypoints while rejecting\n // malformed/trailing calldata before the wallet sees a signing prompt.\n assertCanonicalBoundedRuntimeWriteCalldata(evmTx.data);\n if (!Number.isSafeInteger(evmTx.chainId) || evmTx.chainId <= 0) {\n throw new Error('EVM transaction chainId is required and must be a positive safe integer');\n }\n const chainId = evmTx.chainId;\n const trustedRuntime = (_b = (_a = this.config.runtimeAddresses) === null || _a === void 0 ? void 0 : _a[String(chainId)]) !== null && _b !== void 0 ? _b : (this.config.chainId === chainId ? this.config.runtimeAddress : undefined);\n if (!trustedRuntime)\n throw new Error(`No trusted BoundedRuntime address configured for EVM chain ${chainId}`);\n if (normalizeEvmAddress(evmTx.to) !== trustedRuntime) {\n throw new Error('EVM transaction target is not the configured BoundedRuntime');\n }\n if (evmTx.nonce !== undefined) {\n throw new Error('Server-supplied EVM nonces are not accepted');\n }\n try {\n if (BigInt((_c = evmTx.value) !== null && _c !== void 0 ? _c : '0') !== BigInt(0)) {\n throw new Error('BoundedRuntime.setDocuments cannot transfer native value');\n }\n }\n catch (error) {\n if (error instanceof Error && error.message.includes('cannot transfer'))\n throw error;\n throw new Error('Invalid EVM transaction value');\n }\n if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {\n // Injected EVM wallets sign+submit atomically; eth_signTransaction is not\n // broadly supported (MetaMask removed it), so we cannot return a signed-\n // but-unsubmitted tx here. Fail clearly instead of silently submitting.\n throw new Error('shouldSubmitTx:false is unsupported for injected EVM wallets (they sign and submit atomically).');\n }\n const provider = this.resolveProvider();\n const from = await this.connectAddress(provider);\n if (!this.authenticatedAddress || from !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before submitting this write.');\n }\n // Chain-switch guard: the pre-built tx names the chain it MUST execute on.\n if (typeof evmTx.chainId === 'number') {\n const current = await this.currentChainId(provider);\n if (current === null)\n throw new Error('Could not verify the EVM wallet chain; refusing to submit the transaction.');\n if (current !== evmTx.chainId) {\n const targetHex = '0x' + evmTx.chainId.toString(16);\n try {\n await provider.request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: targetHex }],\n });\n }\n catch (err) {\n throw new Error(`EVM wallet is on chain ${current} but this write targets chain ${evmTx.chainId}, ` +\n `and the chain switch was rejected or failed${(err === null || err === void 0 ? void 0 : err.message) ? `: ${err.message}` : ''}. ` +\n `Switch your wallet to chain ${evmTx.chainId} and retry.`);\n }\n const switched = await this.currentChainId(provider);\n if (switched !== evmTx.chainId) {\n throw new Error(`EVM wallet did not switch to required chain ${evmTx.chainId}; refusing to submit.`);\n }\n }\n }\n const txParams = { from, to: normalizeEvmAddress(evmTx.to), data: evmTx.data.toLowerCase() };\n txParams.value = '0x0';\n // Gas, fee and nonce hints come from the server and are not part of the\n // governed action. Deliberately omit them: the wallet estimates locally,\n // preventing a compromised response from forcing an abusive fee/nonce.\n const txHash = await provider.request({\n method: 'eth_sendTransaction',\n params: [txParams],\n });\n if (typeof txHash !== 'string' || !/^0x[0-9a-fA-F]{64}$/.test(txHash)) {\n throw new Error('EVM wallet returned an invalid transaction hash');\n }\n const receipt = await this.waitForReceipt(provider, txHash);\n if (!receipt || typeof receipt.status !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.status)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid receipt status`);\n }\n if (BigInt(receipt.status) !== BigInt(1)) {\n throw new Error(`EVM transaction ${txHash} reverted on-chain`);\n }\n if (typeof receipt.blockNumber !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.blockNumber)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid block number`);\n }\n const blockNumber = BigInt(receipt.blockNumber);\n if (blockNumber > BigInt(Number.MAX_SAFE_INTEGER))\n throw new Error('EVM receipt block number exceeds the SDK safe-integer range');\n if (typeof receipt.gasUsed !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.gasUsed)) {\n throw new Error(`EVM transaction ${txHash} returned invalid gas usage`);\n }\n return {\n transactionSignature: txHash,\n blockNumber: Number(blockNumber),\n gasUsed: BigInt(receipt.gasUsed).toString(),\n data: receipt,\n };\n }\n /** Poll eth_getTransactionReceipt until it lands (bounded retries) or throw. */\n async waitForReceipt(provider, txHash) {\n for (let attempt = 0; attempt < RECEIPT_POLL_ATTEMPTS; attempt++) {\n const receipt = await provider.request({\n method: 'eth_getTransactionReceipt',\n params: [txHash],\n });\n if (receipt)\n return receipt;\n await new Promise((r) => setTimeout(r, RECEIPT_POLL_INTERVAL_MS));\n }\n throw new Error(`EVM transaction ${txHash} was submitted but no receipt confirmed within ` +\n `${(RECEIPT_POLL_ATTEMPTS * RECEIPT_POLL_INTERVAL_MS) / 1000}s. It may still land; check the explorer.`);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["normalizeEvmAddress","defaultInjectedEvmProvider","setAuthLoading","SessionManager","setCurrentUser","genAuthNonce","getConfig","genSiweMessage","createSessionWithSignature","getPlatform","assertCanonicalBoundedRuntimeWriteCalldata"],"mappings":";;;;;;AAOA,MAAM,sBAAsB,GAAG,0BAA0B;AACzD;AACA;AACA,MAAM,wBAAwB,GAAG,YAAY;AAC7C;AACA,MAAM,mBAAmB,GAAG,MAAM;AAClC,MAAM,aAAa,GAAG,qGAAqG;AAC3H,IAAI,qEAAqE;AACzE,MAAM,aAAa,GAAG,kGAAkG;AACxH,IAAI,mGAAmG;AACvG,IAAI,+EAA+E;AACnF;AACA,MAAM,qBAAqB,GAAG,EAAE;AAChC,MAAM,wBAAwB,GAAG,IAAI;AACrC,SAAS,eAAe,CAAC,MAAM,EAAE;AACjC,IAAI,IAAI,EAAE;AACV,IAAI,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,EAAE;AACxG,QAAQ,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC;AAC7E,IAAI;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AM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE;AACvD,YAAY,IAAI,EAAE,OAAO;AACzB,SAAS;AACT,IAAI;AACJ;AACA,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE;AAC3C,QAAQ,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,qBAAqB,EAAE,OAAO,EAAE,EAAE;AAC1E,YAAY,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC;AACnD,gBAAgB,MAAM,EAAE,2BAA2B;AACnD,gBAAgB,MAAM,EAAE,CAAC,MAAM,CAAC;AAChC,aAAa,CAAC;AACd,YAAY,IAAI,OAAO;AACvB,gBAAgB,OAAO,OAAO;AAC9B,YAAY,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC;AAC7E,QAAQ;AACR,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,gBAAgB,EAAE,MAAM,CAAC,+CAA+C,CAAC;AAClG,YAAY,CAAC,EAAE,CAAC,qBAAqB,GAAG,wBAAwB,IAAI,IAAI,CAAC,yCAAyC,CAAC,CAAC;AACpH,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;;"}
1
+ {"version":3,"file":"injected-evm-wallet-provider-BEGvuTUU.js","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, assertCanonicalBoundedRuntimeWriteCalldata, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { getPlatform } from '../../platform';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\nconst STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login signs+submits transactions in one step (eth_sendTransaction) and has no Solana ' +\n 'transaction surface. Use an onchain WRITE (setMany) — the worker returns a pre-built EVM tx that ' +\n 'runTransaction submits — instead of signTransaction/signAndSubmitTransaction.';\n// Bounded polling for the tx receipt: ~60s at 2s cadence (L2 blocks are seconds).\nconst RECEIPT_POLL_ATTEMPTS = 30;\nconst RECEIPT_POLL_INTERVAL_MS = 2000;\nfunction normalizeConfig(config) {\n var _a;\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n let runtimeAddress;\n if (config.runtimeAddress !== undefined) {\n runtimeAddress = (_a = normalizeEvmAddress(config.runtimeAddress)) !== null && _a !== void 0 ? _a : undefined;\n if (!runtimeAddress)\n throw new Error('EVM wallet runtimeAddress is invalid');\n if (config.chainId === undefined)\n throw new Error('EVM wallet runtimeAddress requires an explicit chainId');\n }\n let runtimeAddresses;\n if (config.runtimeAddresses !== undefined) {\n runtimeAddresses = {};\n for (const [rawChainId, rawAddress] of Object.entries(config.runtimeAddresses)) {\n const chainId = Number(rawChainId);\n const address = normalizeEvmAddress(rawAddress);\n if (!Number.isSafeInteger(chainId) || chainId <= 0 || String(chainId) !== rawChainId || !address) {\n throw new Error(`Invalid EVM runtime allowlist entry for chain ${rawChainId}`);\n }\n runtimeAddresses[rawChainId] = address;\n }\n }\n return Object.assign(Object.assign({}, config), { runtimeAddress, runtimeAddresses });\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login. User.address\n // is typed `string` for legacy reasons — email logins cast the same null the same\n // way (email-auth-provider.ts) — so the null is cast here in one place.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n try {\n getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY, INJECTED_EVM_AUTH_METHOD);\n }\n catch ( /* no storage */_a) { /* no storage */ }\n }\n async restoreSession() {\n const session = await SessionManager().getSession();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet — the\n // EVM onchain write goes through runTransaction (eth_sendTransaction).\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n /**\n * Onchain write path: submit the worker's PRE-BUILT EIP-1559 tx via\n * eth_sendTransaction (the injected wallet signs + submits in one step), then\n * poll for the receipt. The EVM branch of operations.ts's 202 dispatch calls\n * this with the pre-built payload in the EVM slot and the Solana slot undefined.\n */\n async runTransaction(evmTransactionData, solTransactionData, options) {\n var _a, _b, _c;\n const evmTx = evmTransactionData;\n if (evmTx && solTransactionData) {\n throw new Error('A transaction cannot target EVM and Solana at the same time.');\n }\n if (!evmTx || !normalizeEvmAddress(evmTx.to) || typeof evmTx.data !== 'string' || !/^0x(?:[0-9a-fA-F]{2})+$/.test(evmTx.data)) {\n throw new Error('EVM transaction data (pre-built { to, data, chainId }) is required for an EVM onchain write');\n }\n // Exact decode, rather than a four-byte prefix check: permits the\n // ordinary and attested document-write entrypoints while rejecting\n // malformed/trailing calldata before the wallet sees a signing prompt.\n assertCanonicalBoundedRuntimeWriteCalldata(evmTx.data);\n if (!Number.isSafeInteger(evmTx.chainId) || evmTx.chainId <= 0) {\n throw new Error('EVM transaction chainId is required and must be a positive safe integer');\n }\n const chainId = evmTx.chainId;\n const trustedRuntime = (_b = (_a = this.config.runtimeAddresses) === null || _a === void 0 ? void 0 : _a[String(chainId)]) !== null && _b !== void 0 ? _b : (this.config.chainId === chainId ? this.config.runtimeAddress : undefined);\n if (!trustedRuntime)\n throw new Error(`No trusted BoundedRuntime address configured for EVM chain ${chainId}`);\n if (normalizeEvmAddress(evmTx.to) !== trustedRuntime) {\n throw new Error('EVM transaction target is not the configured BoundedRuntime');\n }\n if (evmTx.nonce !== undefined) {\n throw new Error('Server-supplied EVM nonces are not accepted');\n }\n try {\n if (BigInt((_c = evmTx.value) !== null && _c !== void 0 ? _c : '0') !== BigInt(0)) {\n throw new Error('BoundedRuntime.setDocuments cannot transfer native value');\n }\n }\n catch (error) {\n if (error instanceof Error && error.message.includes('cannot transfer'))\n throw error;\n throw new Error('Invalid EVM transaction value');\n }\n if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {\n // Injected EVM wallets sign+submit atomically; eth_signTransaction is not\n // broadly supported (MetaMask removed it), so we cannot return a signed-\n // but-unsubmitted tx here. Fail clearly instead of silently submitting.\n throw new Error('shouldSubmitTx:false is unsupported for injected EVM wallets (they sign and submit atomically).');\n }\n const provider = this.resolveProvider();\n const from = await this.connectAddress(provider);\n if (!this.authenticatedAddress || from !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before submitting this write.');\n }\n // Chain-switch guard: the pre-built tx names the chain it MUST execute on.\n if (typeof evmTx.chainId === 'number') {\n const current = await this.currentChainId(provider);\n if (current === null)\n throw new Error('Could not verify the EVM wallet chain; refusing to submit the transaction.');\n if (current !== evmTx.chainId) {\n const targetHex = '0x' + evmTx.chainId.toString(16);\n try {\n await provider.request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: targetHex }],\n });\n }\n catch (err) {\n throw new Error(`EVM wallet is on chain ${current} but this write targets chain ${evmTx.chainId}, ` +\n `and the chain switch was rejected or failed${(err === null || err === void 0 ? void 0 : err.message) ? `: ${err.message}` : ''}. ` +\n `Switch your wallet to chain ${evmTx.chainId} and retry.`);\n }\n const switched = await this.currentChainId(provider);\n if (switched !== evmTx.chainId) {\n throw new Error(`EVM wallet did not switch to required chain ${evmTx.chainId}; refusing to submit.`);\n }\n }\n }\n const txParams = { from, to: normalizeEvmAddress(evmTx.to), data: evmTx.data.toLowerCase() };\n txParams.value = '0x0';\n // Gas, fee and nonce hints come from the server and are not part of the\n // governed action. Deliberately omit them: the wallet estimates locally,\n // preventing a compromised response from forcing an abusive fee/nonce.\n const txHash = await provider.request({\n method: 'eth_sendTransaction',\n params: [txParams],\n });\n if (typeof txHash !== 'string' || !/^0x[0-9a-fA-F]{64}$/.test(txHash)) {\n throw new Error('EVM wallet returned an invalid transaction hash');\n }\n const receipt = await this.waitForReceipt(provider, txHash);\n if (!receipt || typeof receipt.status !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.status)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid receipt status`);\n }\n if (BigInt(receipt.status) !== BigInt(1)) {\n throw new Error(`EVM transaction ${txHash} reverted on-chain`);\n }\n if (typeof receipt.blockNumber !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.blockNumber)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid block number`);\n }\n const blockNumber = BigInt(receipt.blockNumber);\n if (blockNumber > BigInt(Number.MAX_SAFE_INTEGER))\n throw new Error('EVM receipt block number exceeds the SDK safe-integer range');\n if (typeof receipt.gasUsed !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.gasUsed)) {\n throw new Error(`EVM transaction ${txHash} returned invalid gas usage`);\n }\n return {\n transactionSignature: txHash,\n blockNumber: Number(blockNumber),\n gasUsed: BigInt(receipt.gasUsed).toString(),\n data: receipt,\n };\n }\n /** Poll eth_getTransactionReceipt until it lands (bounded retries) or throw. */\n async waitForReceipt(provider, txHash) {\n for (let attempt = 0; attempt < RECEIPT_POLL_ATTEMPTS; attempt++) {\n const receipt = await provider.request({\n method: 'eth_getTransactionReceipt',\n params: [txHash],\n });\n if (receipt)\n return receipt;\n await new Promise((r) => setTimeout(r, RECEIPT_POLL_INTERVAL_MS));\n }\n throw new Error(`EVM transaction ${txHash} was submitted but no receipt confirmed within ` +\n `${(RECEIPT_POLL_ATTEMPTS * RECEIPT_POLL_INTERVAL_MS) / 1000}s. It may still land; check the explorer.`);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["normalizeEvmAddress","defaultInjectedEvmProvider","setAuthLoading","SessionManager","setCurrentUser","genAuthNonce","getConfig","genSiweMessage","createSessionWithSignature","getPlatform","assertCanonicalBoundedRuntimeWriteCalldata"],"mappings":";;;;;;AAOA,MAAM,sBAAsB,GAAG,0BAA0B;AACzD;AACA;AACA,MAAM,wBAAwB,GAAG,YAAY;AAC7C;AACA,MAAM,mBAAmB,GAAG,MAAM;AAClC,MAAM,aAAa,GAAG,qGAAqG;AAC3H,IAAI,qEAAqE;AACzE,MAAM,aAAa,GAAG,kGAAkG;AACxH,IAAI,mGAAmG;AACvG,IAAI,+EAA+E;AACnF;AACA,MAAM,qBAAqB,GAAG,EAAE;AAChC,MAAM,wBAAwB,GAAG,IAAI;AACrC,SAAS,eAAe,CAAC,MAAM,EAAE;AACjC,IAAI,IAAI,EAAE;AACV,IAAI,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,EAAE;AACxG,QAAQ,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC;AAC7E,IAAI;AACJ,IAAI,IAAI,cAAc;AACtB,IAAI,IAAI,MAAM,CAAC,cAAc,KAAK,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AAI,EAAE,OAAO;AACzB,SAAS;AACT,IAAI;AACJ;AACA,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE;AAC3C,QAAQ,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,qBAAqB,EAAE,OAAO,EAAE,EAAE;AAC1E,YAAY,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC;AACnD,gBAAgB,MAAM,EAAE,2BAA2B;AACnD,gBAAgB,MAAM,EAAE,CAAC,MAAM,CAAC;AAChC,aAAa,CAAC;AACd,YAAY,IAAI,OAAO;AACvB,gBAAgB,OAAO,OAAO;AAC9B,YAAY,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC;AAC7E,QAAQ;AACR,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,gBAAgB,EAAE,MAAM,CAAC,+CAA+C,CAAC;AAClG,YAAY,CAAC,EAAE,CAAC,qBAAqB,GAAG,wBAAwB,IAAI,IAAI,CAAC,yCAAyC,CAAC,CAAC;AACpH,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { normalizeEvmAddress, getActiveSessionManager, genAuthNonce, getConfig, genSiweMessage, createSessionWithSignature, assertCanonicalBoundedRuntimeWriteCalldata } from '@bounded-sh/core';
2
- import { c as setAuthLoading, s as setCurrentUser, g as getPlatform } from './index.native-B-ldAbu2.mjs';
2
+ import { c as setAuthLoading, s as setCurrentUser, g as getPlatform } from './index.native-gU1kSEmQ.mjs';
3
3
  import 'react';
4
4
 
5
5
  // injected-evm-wallet-types.ts — tiny, dependency-free surface for the EVM
@@ -403,4 +403,4 @@ class InjectedEvmWalletProvider {
403
403
  InjectedEvmWalletProvider.instance = null;
404
404
 
405
405
  export { InjectedEvmWalletProvider, defaultInjectedEvmProvider };
406
- //# sourceMappingURL=injected-evm-wallet-provider-ubsHX217.mjs.map
406
+ //# sourceMappingURL=injected-evm-wallet-provider-CNnMBwAY.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"injected-evm-wallet-provider-ubsHX217.mjs","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-types.js","../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["// injected-evm-wallet-types.ts — tiny, dependency-free surface for the EVM\n// WALLET LOGIN path (BYO wallet via SIWE). The EVM twin of\n// injected-wallet-types.ts: kept separate from injected-evm-wallet-provider.ts\n// so the SDK entry can eagerly export the type surface + the provider-discovery\n// helper WITHOUT dragging the provider class into the default bundle. The\n// provider is lazy-loaded by getAuthProvider() when an app opts into\n// authMethod:'evm-wallet'.\n//\n// It rides the standard EIP-1193 injected provider a browser wallet exposes\n// (MetaMask / Rabby / Coinbase Wallet / any window.ethereum), discovered via\n// EIP-6963 (multi-wallet, collision-free) with a window.ethereum fallback. It\n// needs NO viem/ethers and NO React — EIP-1193 request() + hex strings suffice.\n// EIP-6963 is announcement-based: wallets add an `eip6963:requestProvider`\n// listener and synchronously dispatch `eip6963:announceProvider` in response. We\n// keep a persistent collector so announcements (including late ones) are\n// captured, and re-request on demand.\nconst announcedProviders = [];\nlet announceListenerAttached = false;\nfunction attachAnnounceListener() {\n if (announceListenerAttached || typeof window === 'undefined')\n return;\n announceListenerAttached = true;\n window.addEventListener('eip6963:announceProvider', (event) => {\n const detail = event === null || event === void 0 ? void 0 : event.detail;\n if (detail &&\n detail.provider &&\n typeof detail.provider.request === 'function' &&\n !announcedProviders.some((d) => { var _a, _b; return ((_a = d.info) === null || _a === void 0 ? void 0 : _a.uuid) === ((_b = detail.info) === null || _b === void 0 ? void 0 : _b.uuid); })) {\n announcedProviders.push(detail);\n }\n });\n}\n/**\n * Request + collect EIP-6963 providers. Dispatches `eip6963:requestProvider`\n * (synchronous — already-loaded wallets announce in the same tick) and returns\n * every wallet announced so far. Kept synchronous so it works inside a user\n * gesture and can be eagerly exported from the SDK entry.\n */\nexport function requestEip6963Providers() {\n if (typeof window === 'undefined')\n return [];\n attachAnnounceListener();\n try {\n window.dispatchEvent(new Event('eip6963:requestProvider'));\n }\n catch (_a) {\n /* older browsers without Event constructor — fall through to window.ethereum */\n }\n return announcedProviders.slice();\n}\n/**\n * Default EVM provider discovery: EIP-6963 first (multi-wallet, collision-free),\n * then legacy `window.ethereum`. Returns null when no injected wallet is present.\n */\nexport function defaultInjectedEvmProvider() {\n if (typeof window === 'undefined')\n return null;\n const details = requestEip6963Providers();\n if (details.length > 0)\n return details[0].provider;\n const eth = window.ethereum;\n if (eth && typeof eth.request === 'function')\n return eth;\n return null;\n}\n","import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, assertCanonicalBoundedRuntimeWriteCalldata, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { getPlatform } from '../../platform';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\nconst STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login signs+submits transactions in one step (eth_sendTransaction) and has no Solana ' +\n 'transaction surface. Use an onchain WRITE (setMany) — the worker returns a pre-built EVM tx that ' +\n 'runTransaction submits — instead of signTransaction/signAndSubmitTransaction.';\n// Bounded polling for the tx receipt: ~60s at 2s cadence (L2 blocks are seconds).\nconst RECEIPT_POLL_ATTEMPTS = 30;\nconst RECEIPT_POLL_INTERVAL_MS = 2000;\nfunction normalizeConfig(config) {\n var _a;\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n let runtimeAddress;\n if (config.runtimeAddress !== undefined) {\n runtimeAddress = (_a = normalizeEvmAddress(config.runtimeAddress)) !== null && _a !== void 0 ? _a : undefined;\n if (!runtimeAddress)\n throw new Error('EVM wallet runtimeAddress is invalid');\n if (config.chainId === undefined)\n throw new Error('EVM wallet runtimeAddress requires an explicit chainId');\n }\n let runtimeAddresses;\n if (config.runtimeAddresses !== undefined) {\n runtimeAddresses = {};\n for (const [rawChainId, rawAddress] of Object.entries(config.runtimeAddresses)) {\n const chainId = Number(rawChainId);\n const address = normalizeEvmAddress(rawAddress);\n if (!Number.isSafeInteger(chainId) || chainId <= 0 || String(chainId) !== rawChainId || !address) {\n throw new Error(`Invalid EVM runtime allowlist entry for chain ${rawChainId}`);\n }\n runtimeAddresses[rawChainId] = address;\n }\n }\n return Object.assign(Object.assign({}, config), { runtimeAddress, runtimeAddresses });\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login. User.address\n // is typed `string` for legacy reasons — email logins cast the same null the same\n // way (email-auth-provider.ts) — so the null is cast here in one place.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n try {\n getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY, INJECTED_EVM_AUTH_METHOD);\n }\n catch ( /* no storage */_a) { /* no storage */ }\n }\n async restoreSession() {\n const session = await SessionManager().getSession();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet — the\n // EVM onchain write goes through runTransaction (eth_sendTransaction).\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n /**\n * Onchain write path: submit the worker's PRE-BUILT EIP-1559 tx via\n * eth_sendTransaction (the injected wallet signs + submits in one step), then\n * poll for the receipt. The EVM branch of operations.ts's 202 dispatch calls\n * this with the pre-built payload in the EVM slot and the Solana slot undefined.\n */\n async runTransaction(evmTransactionData, solTransactionData, options) {\n var _a, _b, _c;\n const evmTx = evmTransactionData;\n if (evmTx && solTransactionData) {\n throw new Error('A transaction cannot target EVM and Solana at the same time.');\n }\n if (!evmTx || !normalizeEvmAddress(evmTx.to) || typeof evmTx.data !== 'string' || !/^0x(?:[0-9a-fA-F]{2})+$/.test(evmTx.data)) {\n throw new Error('EVM transaction data (pre-built { to, data, chainId }) is required for an EVM onchain write');\n }\n // Exact decode, rather than a four-byte prefix check: permits the\n // ordinary and attested document-write entrypoints while rejecting\n // malformed/trailing calldata before the wallet sees a signing prompt.\n assertCanonicalBoundedRuntimeWriteCalldata(evmTx.data);\n if (!Number.isSafeInteger(evmTx.chainId) || evmTx.chainId <= 0) {\n throw new Error('EVM transaction chainId is required and must be a positive safe integer');\n }\n const chainId = evmTx.chainId;\n const trustedRuntime = (_b = (_a = this.config.runtimeAddresses) === null || _a === void 0 ? void 0 : _a[String(chainId)]) !== null && _b !== void 0 ? _b : (this.config.chainId === chainId ? this.config.runtimeAddress : undefined);\n if (!trustedRuntime)\n throw new Error(`No trusted BoundedRuntime address configured for EVM chain ${chainId}`);\n if (normalizeEvmAddress(evmTx.to) !== trustedRuntime) {\n throw new Error('EVM transaction target is not the configured BoundedRuntime');\n }\n if (evmTx.nonce !== undefined) {\n throw new Error('Server-supplied EVM nonces are not accepted');\n }\n try {\n if (BigInt((_c = evmTx.value) !== null && _c !== void 0 ? _c : '0') !== BigInt(0)) {\n throw new Error('BoundedRuntime.setDocuments cannot transfer native value');\n }\n }\n catch (error) {\n if (error instanceof Error && error.message.includes('cannot transfer'))\n throw error;\n throw new Error('Invalid EVM transaction value');\n }\n if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {\n // Injected EVM wallets sign+submit atomically; eth_signTransaction is not\n // broadly supported (MetaMask removed it), so we cannot return a signed-\n // but-unsubmitted tx here. Fail clearly instead of silently submitting.\n throw new Error('shouldSubmitTx:false is unsupported for injected EVM wallets (they sign and submit atomically).');\n }\n const provider = this.resolveProvider();\n const from = await this.connectAddress(provider);\n if (!this.authenticatedAddress || from !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before submitting this write.');\n }\n // Chain-switch guard: the pre-built tx names the chain it MUST execute on.\n if (typeof evmTx.chainId === 'number') {\n const current = await this.currentChainId(provider);\n if (current === null)\n throw new Error('Could not verify the EVM wallet chain; refusing to submit the transaction.');\n if (current !== evmTx.chainId) {\n const targetHex = '0x' + evmTx.chainId.toString(16);\n try {\n await provider.request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: targetHex }],\n });\n }\n catch (err) {\n throw new Error(`EVM wallet is on chain ${current} but this write targets chain ${evmTx.chainId}, ` +\n `and the chain switch was rejected or failed${(err === null || err === void 0 ? void 0 : err.message) ? `: ${err.message}` : ''}. ` +\n `Switch your wallet to chain ${evmTx.chainId} and retry.`);\n }\n const switched = await this.currentChainId(provider);\n if (switched !== evmTx.chainId) {\n throw new Error(`EVM wallet did not switch to required chain ${evmTx.chainId}; refusing to submit.`);\n }\n }\n }\n const txParams = { from, to: normalizeEvmAddress(evmTx.to), data: evmTx.data.toLowerCase() };\n txParams.value = '0x0';\n // Gas, fee and nonce hints come from the server and are not part of the\n // governed action. Deliberately omit them: the wallet estimates locally,\n // preventing a compromised response from forcing an abusive fee/nonce.\n const txHash = await provider.request({\n method: 'eth_sendTransaction',\n params: [txParams],\n });\n if (typeof txHash !== 'string' || !/^0x[0-9a-fA-F]{64}$/.test(txHash)) {\n throw new Error('EVM wallet returned an invalid transaction hash');\n }\n const receipt = await this.waitForReceipt(provider, txHash);\n if (!receipt || typeof receipt.status !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.status)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid receipt status`);\n }\n if (BigInt(receipt.status) !== BigInt(1)) {\n throw new Error(`EVM transaction ${txHash} reverted on-chain`);\n }\n if (typeof receipt.blockNumber !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.blockNumber)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid block number`);\n }\n const blockNumber = BigInt(receipt.blockNumber);\n if (blockNumber > BigInt(Number.MAX_SAFE_INTEGER))\n throw new Error('EVM receipt block number exceeds the SDK safe-integer range');\n if (typeof receipt.gasUsed !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.gasUsed)) {\n throw new Error(`EVM transaction ${txHash} returned invalid gas usage`);\n }\n return {\n transactionSignature: txHash,\n blockNumber: Number(blockNumber),\n gasUsed: BigInt(receipt.gasUsed).toString(),\n data: receipt,\n };\n }\n /** Poll eth_getTransactionReceipt until it lands (bounded retries) or throw. */\n async waitForReceipt(provider, txHash) {\n for (let attempt = 0; attempt < RECEIPT_POLL_ATTEMPTS; attempt++) {\n const receipt = await provider.request({\n method: 'eth_getTransactionReceipt',\n params: [txHash],\n });\n if (receipt)\n return receipt;\n await new Promise((r) => setTimeout(r, RECEIPT_POLL_INTERVAL_MS));\n }\n throw new Error(`EVM transaction ${txHash} was submitted but no receipt confirmed within ` +\n `${(RECEIPT_POLL_ATTEMPTS * RECEIPT_POLL_INTERVAL_MS) / 1000}s. It may still land; check the explorer.`);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["SessionManager"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE;AAC3C,QAAQ,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,qBAAqB,EAAE,OAAO,EAAE,EAAE;AAC1E,YAAY,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC;AACnD,gBAAgB,MAAM,EAAE,2BAA2B;AACnD,gBAAgB,MAAM,EAAE,CAAC,MAAM,CAAC;AAChC,aAAa,CAAC;AACd,YAAY,IAAI,OAAO;AACvB,gBAAgB,OAAO,OAAO;AAC9B,YAAY,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC;AAC7E,QAAQ;AACR,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,gBAAgB,EAAE,MAAM,CAAC,+CAA+C,CAAC;AAClG,YAAY,CAAC,EAAE,CAAC,qBAAqB,GAAG,wBAAwB,IAAI,IAAI,CAAC,yCAAyC,CAAC,CAAC;AACpH,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;"}
1
+ {"version":3,"file":"injected-evm-wallet-provider-CNnMBwAY.mjs","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-types.js","../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["// injected-evm-wallet-types.ts — tiny, dependency-free surface for the EVM\n// WALLET LOGIN path (BYO wallet via SIWE). The EVM twin of\n// injected-wallet-types.ts: kept separate from injected-evm-wallet-provider.ts\n// so the SDK entry can eagerly export the type surface + the provider-discovery\n// helper WITHOUT dragging the provider class into the default bundle. The\n// provider is lazy-loaded by getAuthProvider() when an app opts into\n// authMethod:'evm-wallet'.\n//\n// It rides the standard EIP-1193 injected provider a browser wallet exposes\n// (MetaMask / Rabby / Coinbase Wallet / any window.ethereum), discovered via\n// EIP-6963 (multi-wallet, collision-free) with a window.ethereum fallback. It\n// needs NO viem/ethers and NO React — EIP-1193 request() + hex strings suffice.\n// EIP-6963 is announcement-based: wallets add an `eip6963:requestProvider`\n// listener and synchronously dispatch `eip6963:announceProvider` in response. We\n// keep a persistent collector so announcements (including late ones) are\n// captured, and re-request on demand.\nconst announcedProviders = [];\nlet announceListenerAttached = false;\nfunction attachAnnounceListener() {\n if (announceListenerAttached || typeof window === 'undefined')\n return;\n announceListenerAttached = true;\n window.addEventListener('eip6963:announceProvider', (event) => {\n const detail = event === null || event === void 0 ? void 0 : event.detail;\n if (detail &&\n detail.provider &&\n typeof detail.provider.request === 'function' &&\n !announcedProviders.some((d) => { var _a, _b; return ((_a = d.info) === null || _a === void 0 ? void 0 : _a.uuid) === ((_b = detail.info) === null || _b === void 0 ? void 0 : _b.uuid); })) {\n announcedProviders.push(detail);\n }\n });\n}\n/**\n * Request + collect EIP-6963 providers. Dispatches `eip6963:requestProvider`\n * (synchronous — already-loaded wallets announce in the same tick) and returns\n * every wallet announced so far. Kept synchronous so it works inside a user\n * gesture and can be eagerly exported from the SDK entry.\n */\nexport function requestEip6963Providers() {\n if (typeof window === 'undefined')\n return [];\n attachAnnounceListener();\n try {\n window.dispatchEvent(new Event('eip6963:requestProvider'));\n }\n catch (_a) {\n /* older browsers without Event constructor — fall through to window.ethereum */\n }\n return announcedProviders.slice();\n}\n/**\n * Default EVM provider discovery: EIP-6963 first (multi-wallet, collision-free),\n * then legacy `window.ethereum`. Returns null when no injected wallet is present.\n */\nexport function defaultInjectedEvmProvider() {\n if (typeof window === 'undefined')\n return null;\n const details = requestEip6963Providers();\n if (details.length > 0)\n return details[0].provider;\n const eth = window.ethereum;\n if (eth && typeof eth.request === 'function')\n return eth;\n return null;\n}\n","import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, assertCanonicalBoundedRuntimeWriteCalldata, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { getPlatform } from '../../platform';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\nconst STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login signs+submits transactions in one step (eth_sendTransaction) and has no Solana ' +\n 'transaction surface. Use an onchain WRITE (setMany) — the worker returns a pre-built EVM tx that ' +\n 'runTransaction submits — instead of signTransaction/signAndSubmitTransaction.';\n// Bounded polling for the tx receipt: ~60s at 2s cadence (L2 blocks are seconds).\nconst RECEIPT_POLL_ATTEMPTS = 30;\nconst RECEIPT_POLL_INTERVAL_MS = 2000;\nfunction normalizeConfig(config) {\n var _a;\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n let runtimeAddress;\n if (config.runtimeAddress !== undefined) {\n runtimeAddress = (_a = normalizeEvmAddress(config.runtimeAddress)) !== null && _a !== void 0 ? _a : undefined;\n if (!runtimeAddress)\n throw new Error('EVM wallet runtimeAddress is invalid');\n if (config.chainId === undefined)\n throw new Error('EVM wallet runtimeAddress requires an explicit chainId');\n }\n let runtimeAddresses;\n if (config.runtimeAddresses !== undefined) {\n runtimeAddresses = {};\n for (const [rawChainId, rawAddress] of Object.entries(config.runtimeAddresses)) {\n const chainId = Number(rawChainId);\n const address = normalizeEvmAddress(rawAddress);\n if (!Number.isSafeInteger(chainId) || chainId <= 0 || String(chainId) !== rawChainId || !address) {\n throw new Error(`Invalid EVM runtime allowlist entry for chain ${rawChainId}`);\n }\n runtimeAddresses[rawChainId] = address;\n }\n }\n return Object.assign(Object.assign({}, config), { runtimeAddress, runtimeAddresses });\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login. User.address\n // is typed `string` for legacy reasons — email logins cast the same null the same\n // way (email-auth-provider.ts) — so the null is cast here in one place.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n try {\n getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY, INJECTED_EVM_AUTH_METHOD);\n }\n catch ( /* no storage */_a) { /* no storage */ }\n }\n async restoreSession() {\n const session = await SessionManager().getSession();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet — the\n // EVM onchain write goes through runTransaction (eth_sendTransaction).\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n /**\n * Onchain write path: submit the worker's PRE-BUILT EIP-1559 tx via\n * eth_sendTransaction (the injected wallet signs + submits in one step), then\n * poll for the receipt. The EVM branch of operations.ts's 202 dispatch calls\n * this with the pre-built payload in the EVM slot and the Solana slot undefined.\n */\n async runTransaction(evmTransactionData, solTransactionData, options) {\n var _a, _b, _c;\n const evmTx = evmTransactionData;\n if (evmTx && solTransactionData) {\n throw new Error('A transaction cannot target EVM and Solana at the same time.');\n }\n if (!evmTx || !normalizeEvmAddress(evmTx.to) || typeof evmTx.data !== 'string' || !/^0x(?:[0-9a-fA-F]{2})+$/.test(evmTx.data)) {\n throw new Error('EVM transaction data (pre-built { to, data, chainId }) is required for an EVM onchain write');\n }\n // Exact decode, rather than a four-byte prefix check: permits the\n // ordinary and attested document-write entrypoints while rejecting\n // malformed/trailing calldata before the wallet sees a signing prompt.\n assertCanonicalBoundedRuntimeWriteCalldata(evmTx.data);\n if (!Number.isSafeInteger(evmTx.chainId) || evmTx.chainId <= 0) {\n throw new Error('EVM transaction chainId is required and must be a positive safe integer');\n }\n const chainId = evmTx.chainId;\n const trustedRuntime = (_b = (_a = this.config.runtimeAddresses) === null || _a === void 0 ? void 0 : _a[String(chainId)]) !== null && _b !== void 0 ? _b : (this.config.chainId === chainId ? this.config.runtimeAddress : undefined);\n if (!trustedRuntime)\n throw new Error(`No trusted BoundedRuntime address configured for EVM chain ${chainId}`);\n if (normalizeEvmAddress(evmTx.to) !== trustedRuntime) {\n throw new Error('EVM transaction target is not the configured BoundedRuntime');\n }\n if (evmTx.nonce !== undefined) {\n throw new Error('Server-supplied EVM nonces are not accepted');\n }\n try {\n if (BigInt((_c = evmTx.value) !== null && _c !== void 0 ? _c : '0') !== BigInt(0)) {\n throw new Error('BoundedRuntime.setDocuments cannot transfer native value');\n }\n }\n catch (error) {\n if (error instanceof Error && error.message.includes('cannot transfer'))\n throw error;\n throw new Error('Invalid EVM transaction value');\n }\n if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {\n // Injected EVM wallets sign+submit atomically; eth_signTransaction is not\n // broadly supported (MetaMask removed it), so we cannot return a signed-\n // but-unsubmitted tx here. Fail clearly instead of silently submitting.\n throw new Error('shouldSubmitTx:false is unsupported for injected EVM wallets (they sign and submit atomically).');\n }\n const provider = this.resolveProvider();\n const from = await this.connectAddress(provider);\n if (!this.authenticatedAddress || from !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before submitting this write.');\n }\n // Chain-switch guard: the pre-built tx names the chain it MUST execute on.\n if (typeof evmTx.chainId === 'number') {\n const current = await this.currentChainId(provider);\n if (current === null)\n throw new Error('Could not verify the EVM wallet chain; refusing to submit the transaction.');\n if (current !== evmTx.chainId) {\n const targetHex = '0x' + evmTx.chainId.toString(16);\n try {\n await provider.request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: targetHex }],\n });\n }\n catch (err) {\n throw new Error(`EVM wallet is on chain ${current} but this write targets chain ${evmTx.chainId}, ` +\n `and the chain switch was rejected or failed${(err === null || err === void 0 ? void 0 : err.message) ? `: ${err.message}` : ''}. ` +\n `Switch your wallet to chain ${evmTx.chainId} and retry.`);\n }\n const switched = await this.currentChainId(provider);\n if (switched !== evmTx.chainId) {\n throw new Error(`EVM wallet did not switch to required chain ${evmTx.chainId}; refusing to submit.`);\n }\n }\n }\n const txParams = { from, to: normalizeEvmAddress(evmTx.to), data: evmTx.data.toLowerCase() };\n txParams.value = '0x0';\n // Gas, fee and nonce hints come from the server and are not part of the\n // governed action. Deliberately omit them: the wallet estimates locally,\n // preventing a compromised response from forcing an abusive fee/nonce.\n const txHash = await provider.request({\n method: 'eth_sendTransaction',\n params: [txParams],\n });\n if (typeof txHash !== 'string' || !/^0x[0-9a-fA-F]{64}$/.test(txHash)) {\n throw new Error('EVM wallet returned an invalid transaction hash');\n }\n const receipt = await this.waitForReceipt(provider, txHash);\n if (!receipt || typeof receipt.status !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.status)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid receipt status`);\n }\n if (BigInt(receipt.status) !== BigInt(1)) {\n throw new Error(`EVM transaction ${txHash} reverted on-chain`);\n }\n if (typeof receipt.blockNumber !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.blockNumber)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid block number`);\n }\n const blockNumber = BigInt(receipt.blockNumber);\n if (blockNumber > BigInt(Number.MAX_SAFE_INTEGER))\n throw new Error('EVM receipt block number exceeds the SDK safe-integer range');\n if (typeof receipt.gasUsed !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.gasUsed)) {\n throw new Error(`EVM transaction ${txHash} returned invalid gas usage`);\n }\n return {\n transactionSignature: txHash,\n blockNumber: Number(blockNumber),\n gasUsed: BigInt(receipt.gasUsed).toString(),\n data: receipt,\n };\n }\n /** Poll eth_getTransactionReceipt until it lands (bounded retries) or throw. */\n async waitForReceipt(provider, txHash) {\n for (let attempt = 0; attempt < RECEIPT_POLL_ATTEMPTS; attempt++) {\n const receipt = await provider.request({\n method: 'eth_getTransactionReceipt',\n params: [txHash],\n });\n if (receipt)\n return receipt;\n await new Promise((r) => setTimeout(r, RECEIPT_POLL_INTERVAL_MS));\n }\n throw new Error(`EVM transaction ${txHash} was submitted but no receipt confirmed within ` +\n `${(RECEIPT_POLL_ATTEMPTS * RECEIPT_POLL_INTERVAL_MS) / 1000}s. It may still land; check the explorer.`);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["SessionManager"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,EAAE;AAC7B,IAAI,wBAAwB,GAAG,KAAK;AACpC,SAAS,sBAAsB,GAAG;AAClC,IAAI,IAAI,wBAAwB,IAAI,OAAO,MAAM,KAAK,WAAW;AACjE,QAAQ;AACR,IAAI,wBAAwB,GAAG,IAAI;AACnC,IAAI,MAAM,CAAC,gBAAgB,CAAC,0BAA0B,EAAE,CAAC,KAAK,KAAK;AACnE,QAAQ,MAAM,MAAM,GAAG,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM;AACjF,QAAQ,IAAI,MAAM;AAClB,YAAY,MAAM,CAAC,QAAQ;AAC3B,YAAY,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,KAAK,UAAU;AACzD,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,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CAAC;AACpH,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { normalizeEvmAddress, getActiveSessionManager, genAuthNonce, getConfig, genSiweMessage, createSessionWithSignature, assertCanonicalBoundedRuntimeWriteCalldata } from '@bounded-sh/core';
2
- import { k as defaultInjectedEvmProvider, c as setAuthLoading, s as setCurrentUser, g as getPlatform } from './index-BYy1tSkr.mjs';
2
+ import { k as defaultInjectedEvmProvider, c as setAuthLoading, s as setCurrentUser, g as getPlatform } from './index-BvUrIsky.mjs';
3
3
  import 'react';
4
4
 
5
5
  const STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';
@@ -337,4 +337,4 @@ class InjectedEvmWalletProvider {
337
337
  InjectedEvmWalletProvider.instance = null;
338
338
 
339
339
  export { InjectedEvmWalletProvider, defaultInjectedEvmProvider };
340
- //# sourceMappingURL=injected-evm-wallet-provider-sBCSkksr.mjs.map
340
+ //# sourceMappingURL=injected-evm-wallet-provider-COM5BPuY.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"injected-evm-wallet-provider-sBCSkksr.mjs","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, assertCanonicalBoundedRuntimeWriteCalldata, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { getPlatform } from '../../platform';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\nconst STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login signs+submits transactions in one step (eth_sendTransaction) and has no Solana ' +\n 'transaction surface. Use an onchain WRITE (setMany) — the worker returns a pre-built EVM tx that ' +\n 'runTransaction submits — instead of signTransaction/signAndSubmitTransaction.';\n// Bounded polling for the tx receipt: ~60s at 2s cadence (L2 blocks are seconds).\nconst RECEIPT_POLL_ATTEMPTS = 30;\nconst RECEIPT_POLL_INTERVAL_MS = 2000;\nfunction normalizeConfig(config) {\n var _a;\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n let runtimeAddress;\n if (config.runtimeAddress !== undefined) {\n runtimeAddress = (_a = normalizeEvmAddress(config.runtimeAddress)) !== null && _a !== void 0 ? _a : undefined;\n if (!runtimeAddress)\n throw new Error('EVM wallet runtimeAddress is invalid');\n if (config.chainId === undefined)\n throw new Error('EVM wallet runtimeAddress requires an explicit chainId');\n }\n let runtimeAddresses;\n if (config.runtimeAddresses !== undefined) {\n runtimeAddresses = {};\n for (const [rawChainId, rawAddress] of Object.entries(config.runtimeAddresses)) {\n const chainId = Number(rawChainId);\n const address = normalizeEvmAddress(rawAddress);\n if (!Number.isSafeInteger(chainId) || chainId <= 0 || String(chainId) !== rawChainId || !address) {\n throw new Error(`Invalid EVM runtime allowlist entry for chain ${rawChainId}`);\n }\n runtimeAddresses[rawChainId] = address;\n }\n }\n return Object.assign(Object.assign({}, config), { runtimeAddress, runtimeAddresses });\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login. User.address\n // is typed `string` for legacy reasons — email logins cast the same null the same\n // way (email-auth-provider.ts) — so the null is cast here in one place.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n try {\n getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY, INJECTED_EVM_AUTH_METHOD);\n }\n catch ( /* no storage */_a) { /* no storage */ }\n }\n async restoreSession() {\n const session = await SessionManager().getSession();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet — the\n // EVM onchain write goes through runTransaction (eth_sendTransaction).\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n /**\n * Onchain write path: submit the worker's PRE-BUILT EIP-1559 tx via\n * eth_sendTransaction (the injected wallet signs + submits in one step), then\n * poll for the receipt. The EVM branch of operations.ts's 202 dispatch calls\n * this with the pre-built payload in the EVM slot and the Solana slot undefined.\n */\n async runTransaction(evmTransactionData, solTransactionData, options) {\n var _a, _b, _c;\n const evmTx = evmTransactionData;\n if (evmTx && solTransactionData) {\n throw new Error('A transaction cannot target EVM and Solana at the same time.');\n }\n if (!evmTx || !normalizeEvmAddress(evmTx.to) || typeof evmTx.data !== 'string' || !/^0x(?:[0-9a-fA-F]{2})+$/.test(evmTx.data)) {\n throw new Error('EVM transaction data (pre-built { to, data, chainId }) is required for an EVM onchain write');\n }\n // Exact decode, rather than a four-byte prefix check: permits the\n // ordinary and attested document-write entrypoints while rejecting\n // malformed/trailing calldata before the wallet sees a signing prompt.\n assertCanonicalBoundedRuntimeWriteCalldata(evmTx.data);\n if (!Number.isSafeInteger(evmTx.chainId) || evmTx.chainId <= 0) {\n throw new Error('EVM transaction chainId is required and must be a positive safe integer');\n }\n const chainId = evmTx.chainId;\n const trustedRuntime = (_b = (_a = this.config.runtimeAddresses) === null || _a === void 0 ? void 0 : _a[String(chainId)]) !== null && _b !== void 0 ? _b : (this.config.chainId === chainId ? this.config.runtimeAddress : undefined);\n if (!trustedRuntime)\n throw new Error(`No trusted BoundedRuntime address configured for EVM chain ${chainId}`);\n if (normalizeEvmAddress(evmTx.to) !== trustedRuntime) {\n throw new Error('EVM transaction target is not the configured BoundedRuntime');\n }\n if (evmTx.nonce !== undefined) {\n throw new Error('Server-supplied EVM nonces are not accepted');\n }\n try {\n if (BigInt((_c = evmTx.value) !== null && _c !== void 0 ? _c : '0') !== BigInt(0)) {\n throw new Error('BoundedRuntime.setDocuments cannot transfer native value');\n }\n }\n catch (error) {\n if (error instanceof Error && error.message.includes('cannot transfer'))\n throw error;\n throw new Error('Invalid EVM transaction value');\n }\n if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {\n // Injected EVM wallets sign+submit atomically; eth_signTransaction is not\n // broadly supported (MetaMask removed it), so we cannot return a signed-\n // but-unsubmitted tx here. Fail clearly instead of silently submitting.\n throw new Error('shouldSubmitTx:false is unsupported for injected EVM wallets (they sign and submit atomically).');\n }\n const provider = this.resolveProvider();\n const from = await this.connectAddress(provider);\n if (!this.authenticatedAddress || from !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before submitting this write.');\n }\n // Chain-switch guard: the pre-built tx names the chain it MUST execute on.\n if (typeof evmTx.chainId === 'number') {\n const current = await this.currentChainId(provider);\n if (current === null)\n throw new Error('Could not verify the EVM wallet chain; refusing to submit the transaction.');\n if (current !== evmTx.chainId) {\n const targetHex = '0x' + evmTx.chainId.toString(16);\n try {\n await provider.request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: targetHex }],\n });\n }\n catch (err) {\n throw new Error(`EVM wallet is on chain ${current} but this write targets chain ${evmTx.chainId}, ` +\n `and the chain switch was rejected or failed${(err === null || err === void 0 ? void 0 : err.message) ? `: ${err.message}` : ''}. ` +\n `Switch your wallet to chain ${evmTx.chainId} and retry.`);\n }\n const switched = await this.currentChainId(provider);\n if (switched !== evmTx.chainId) {\n throw new Error(`EVM wallet did not switch to required chain ${evmTx.chainId}; refusing to submit.`);\n }\n }\n }\n const txParams = { from, to: normalizeEvmAddress(evmTx.to), data: evmTx.data.toLowerCase() };\n txParams.value = '0x0';\n // Gas, fee and nonce hints come from the server and are not part of the\n // governed action. Deliberately omit them: the wallet estimates locally,\n // preventing a compromised response from forcing an abusive fee/nonce.\n const txHash = await provider.request({\n method: 'eth_sendTransaction',\n params: [txParams],\n });\n if (typeof txHash !== 'string' || !/^0x[0-9a-fA-F]{64}$/.test(txHash)) {\n throw new Error('EVM wallet returned an invalid transaction hash');\n }\n const receipt = await this.waitForReceipt(provider, txHash);\n if (!receipt || typeof receipt.status !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.status)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid receipt status`);\n }\n if (BigInt(receipt.status) !== BigInt(1)) {\n throw new Error(`EVM transaction ${txHash} reverted on-chain`);\n }\n if (typeof receipt.blockNumber !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.blockNumber)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid block number`);\n }\n const blockNumber = BigInt(receipt.blockNumber);\n if (blockNumber > BigInt(Number.MAX_SAFE_INTEGER))\n throw new Error('EVM receipt block number exceeds the SDK safe-integer range');\n if (typeof receipt.gasUsed !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.gasUsed)) {\n throw new Error(`EVM transaction ${txHash} returned invalid gas usage`);\n }\n return {\n transactionSignature: txHash,\n blockNumber: Number(blockNumber),\n gasUsed: BigInt(receipt.gasUsed).toString(),\n data: receipt,\n };\n }\n /** Poll eth_getTransactionReceipt until it lands (bounded retries) or throw. */\n async waitForReceipt(provider, txHash) {\n for (let attempt = 0; attempt < RECEIPT_POLL_ATTEMPTS; attempt++) {\n const receipt = await provider.request({\n method: 'eth_getTransactionReceipt',\n params: [txHash],\n });\n if (receipt)\n return receipt;\n await new Promise((r) => setTimeout(r, RECEIPT_POLL_INTERVAL_MS));\n }\n throw new Error(`EVM transaction ${txHash} was submitted but no receipt confirmed within ` +\n `${(RECEIPT_POLL_ATTEMPTS * RECEIPT_POLL_INTERVAL_MS) / 1000}s. It may still land; check the explorer.`);\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n}\nInjectedEvmWalletProvider.instance = null;\n"],"names":["SessionManager"],"mappings":";;;;AAOA,MAAM,sBAAsB,GAAG,0BAA0B;AACzD;AACA;AACA,MAAM,wBAAwB,GAAG,YAAY;AAC7C;AACA,MAAM,mBAAmB,GAAG,MAAM;AAClC,MAAM,aAAa,GAAG,qGAAqG;AAC3H,IAAI,qEAAqE;AACzE,MAAM,aAAa,GAAG,kGAAkG;AACxH,IAAI,mGAAmG;AACvG,IAAI,+EAA+E;AACnF;AACA,MAAM,qBAAqB,GAAG,EAAE;AAChC,MAAM,wBAAwB,GAAG,IAAI;AACrC,SAAS,eAAe,CAAC,MAAM,EAAE;AACjC,IAAI,IAAI,EAAE;AACV,IAAI,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC,EAAE;AACxG,QAAQ,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC;AAC7E,IAAI;AACJ,IAAI,IAAI,cAAc;AACtB,IAAI,IAAI,MAAM,CAAC,cAAc,KAAK,SAAS,EAAE;AAC7C,QAAQ,cAAc,GAAG,CAAC,EAAE,GAAG,mBAAmB,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,SAAS;AACrH,QAAQ,IAAI,CAAC,cAAc;AAC3B,YAAY,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC;AACnE,QAAQ,IAAI,MAAM,CAAC,OAAO,KAAK,SA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EAAE,CAAC,MAAM,CAAC;AAChC,aAAa,CAAC;AACd,YAAY,IAAI,OAAO;AACvB,gBAAgB,OAAO,OAAO;AAC9B,YAAY,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC;AAC7E,QAAQ;AACR,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,gBAAgB,EAAE,MAAM,CAAC,+CAA+C,CAAC;AAClG,YAAY,CAAC,EAAE,CAAC,qBAAqB,GAAG,wBAAwB,IAAI,IAAI,CAAC,yCAAyC,CAAC,CAAC;AACpH,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;"}
1
+ {"version":3,"file":"injected-evm-wallet-provider-COM5BPuY.mjs","sources":["../.rollup-tmp/auth/providers/injected-evm-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSiweMessage, getConfig, normalizeEvmAddress, assertCanonicalBoundedRuntimeWriteCalldata, } from '@bounded-sh/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { getPlatform } from '../../platform';\nimport { defaultInjectedEvmProvider, } from './injected-evm-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedEvmProvider };\nconst STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';\n// Must equal the authMethod the registry (auth/index.ts) sets as currentAuthMethod,\n// so clearIncompatibleSession() keeps (not wipes) this session on the next init().\nconst INJECTED_EVM_AUTH_METHOD = 'evm-wallet';\n// The /session issuer's discriminator for the SIWE (EIP-4361 secp256k1) exchange.\nconst SIWE_SESSION_METHOD = 'siwe';\nconst NO_WALLET_ERR = 'No injected EVM wallet found. Install a wallet like MetaMask (metamask.io) or Rabby and try again, ' +\n 'or pass config.evmWalletConfig.getProvider to point at your wallet.';\nconst NO_SOL_TX_ERR = 'EVM wallet login signs+submits transactions in one step (eth_sendTransaction) and has no Solana ' +\n 'transaction surface. Use an onchain WRITE (setMany) — the worker returns a pre-built EVM tx that ' +\n 'runTransaction submits — instead of signTransaction/signAndSubmitTransaction.';\n// Bounded polling for the tx receipt: ~60s at 2s cadence (L2 blocks are seconds).\nconst RECEIPT_POLL_ATTEMPTS = 30;\nconst RECEIPT_POLL_INTERVAL_MS = 2000;\nfunction normalizeConfig(config) {\n var _a;\n if (config.chainId !== undefined && (!Number.isSafeInteger(config.chainId) || config.chainId <= 0)) {\n throw new Error('EVM wallet chainId must be a positive safe integer');\n }\n let runtimeAddress;\n if (config.runtimeAddress !== undefined) {\n runtimeAddress = (_a = normalizeEvmAddress(config.runtimeAddress)) !== null && _a !== void 0 ? _a : undefined;\n if (!runtimeAddress)\n throw new Error('EVM wallet runtimeAddress is invalid');\n if (config.chainId === undefined)\n throw new Error('EVM wallet runtimeAddress requires an explicit chainId');\n }\n let runtimeAddresses;\n if (config.runtimeAddresses !== undefined) {\n runtimeAddresses = {};\n for (const [rawChainId, rawAddress] of Object.entries(config.runtimeAddresses)) {\n const chainId = Number(rawChainId);\n const address = normalizeEvmAddress(rawAddress);\n if (!Number.isSafeInteger(chainId) || chainId <= 0 || String(chainId) !== rawChainId || !address) {\n throw new Error(`Invalid EVM runtime allowlist entry for chain ${rawChainId}`);\n }\n runtimeAddresses[rawChainId] = address;\n }\n }\n return Object.assign(Object.assign({}, config), { runtimeAddress, runtimeAddresses });\n}\nexport class InjectedEvmWalletProvider {\n constructor(config = {}) {\n this.authenticatedAddress = null;\n if (typeof window === 'undefined') {\n throw new Error('InjectedEvmWalletProvider can only be instantiated in a browser environment');\n }\n const normalized = normalizeConfig(config);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedEvmWalletProvider.instance) {\n InjectedEvmWalletProvider.instance.config = normalized;\n InjectedEvmWalletProvider.instance.authenticatedAddress = null;\n return InjectedEvmWalletProvider.instance;\n }\n this.config = normalized;\n InjectedEvmWalletProvider.instance = this;\n }\n // @user.address (the Solana wallet) is null for an EVM-wallet login. User.address\n // is typed `string` for legacy reasons — email logins cast the same null the same\n // way (email-auth-provider.ts) — so the null is cast here in one place.\n evmUser(address) {\n return { id: address, address: null, evmAddress: address, provider: this };\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedEvmProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet and return its canonical lowercase EVM address. */\n async connectAddress(provider) {\n const accounts = await provider.request({ method: 'eth_requestAccounts' });\n const raw = Array.isArray(accounts) ? accounts[0] : undefined;\n const address = normalizeEvmAddress(raw);\n if (!address)\n throw new Error('Wallet did not return a valid EVM address on connect');\n return address;\n }\n /** Current chain id the wallet is connected to (EIP-155 number), or null. */\n async currentChainId(provider) {\n try {\n const hex = await provider.request({ method: 'eth_chainId' });\n if (typeof hex !== 'string' || !/^0x[0-9a-fA-F]+$/.test(hex))\n return null;\n const n = Number(BigInt(hex));\n return Number.isSafeInteger(n) && n > 0 ? n : null;\n }\n catch (_a) {\n return null;\n }\n }\n async login() {\n var _a;\n setAuthLoading(true);\n try {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n // Reuse a still-valid session for THIS wallet.\n const existing = await SessionManager().getSession();\n if (existing && existing.address === address) {\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWE: nonce -> canonical EIP-4361 prompt -> the wallet personal_sign's it.\n const nonce = await genAuthNonce();\n const appId = (await getConfig()).appId;\n const chainId = (_a = this.config.chainId) !== null && _a !== void 0 ? _a : await this.currentChainId(provider);\n if (chainId === null)\n throw new Error('Could not verify the EVM wallet chain for SIWE login');\n const message = genSiweMessage(address, nonce, appId, this.resolveDomain(), this.resolveUri(), { chainId });\n // personal_sign(message, address) -> 0x r‖s‖v hex (the shape the\n // bounded-auth verifier's recoverSiweSigner consumes). The raw UTF-8\n // message is signed under the EIP-191 envelope the verifier hashes.\n const signature = await provider.request({\n method: 'personal_sign',\n params: [message, address],\n });\n const result = await createSessionWithSignature(address, message, signature, SIWE_SESSION_METHOD);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = this.evmUser(address);\n this.authenticatedAddress = address;\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n resolveDomain() {\n const actual = window.location.host.toLowerCase();\n if (this.config.domain && this.config.domain.toLowerCase() !== actual) {\n throw new Error('SIWE domain override must match the current browser origin');\n }\n return actual;\n }\n resolveUri() {\n const actual = window.location.origin.toLowerCase();\n if (this.config.uri) {\n let configured;\n try {\n configured = new URL(this.config.uri).origin.toLowerCase();\n }\n catch (_a) {\n throw new Error('SIWE URI override must be an absolute URL');\n }\n if (configured !== actual)\n throw new Error('SIWE URI override must match the current browser origin');\n }\n return actual;\n }\n markAuthMethod() {\n try {\n getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY, INJECTED_EVM_AUTH_METHOD);\n }\n catch ( /* no storage */_a) { /* no storage */ }\n }\n async restoreSession() {\n const session = await SessionManager().getSession();\n if (!session)\n return null;\n // An EVM-wallet session stores the EVM address as its address; @user.address\n // (the Solana wallet) is null for this login.\n const address = normalizeEvmAddress(session.address);\n if (!address) {\n SessionManager().clearSession();\n return null;\n }\n this.authenticatedAddress = address;\n const user = this.evmUser(address);\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // EIP-1193 has no standard disconnect; clearing the Bounded session is the\n // logout. (wallet_revokePermissions is non-standard/opt-in — skip it.)\n SessionManager().clearSession();\n this.authenticatedAddress = null;\n setCurrentUser(null);\n }\n // --- Signing surface -------------------------------------------------------\n /** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */\n async signMessage(message) {\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider);\n if (!this.authenticatedAddress || address !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before signing.');\n }\n return provider.request({ method: 'personal_sign', params: [message, address] });\n }\n // Solana-typed methods are structurally unsupported on an EVM wallet — the\n // EVM onchain write goes through runTransaction (eth_sendTransaction).\n async signTransaction(_transaction) {\n throw new Error(NO_SOL_TX_ERR);\n }\n async signAndSubmitTransaction(_transaction, _feePayer) {\n throw new Error(NO_SOL_TX_ERR);\n }\n /**\n * Onchain write path: submit the worker's PRE-BUILT EIP-1559 tx via\n * eth_sendTransaction (the injected wallet signs + submits in one step), then\n * poll for the receipt. The EVM branch of operations.ts's 202 dispatch calls\n * this with the pre-built payload in the EVM slot and the Solana slot undefined.\n */\n async runTransaction(evmTransactionData, solTransactionData, options) {\n var _a, _b, _c;\n const evmTx = evmTransactionData;\n if (evmTx && solTransactionData) {\n throw new Error('A transaction cannot target EVM and Solana at the same time.');\n }\n if (!evmTx || !normalizeEvmAddress(evmTx.to) || typeof evmTx.data !== 'string' || !/^0x(?:[0-9a-fA-F]{2})+$/.test(evmTx.data)) {\n throw new Error('EVM transaction data (pre-built { to, data, chainId }) is required for an EVM onchain write');\n }\n // Exact decode, rather than a four-byte prefix check: permits the\n // ordinary and attested document-write entrypoints while rejecting\n // malformed/trailing calldata before the wallet sees a signing prompt.\n assertCanonicalBoundedRuntimeWriteCalldata(evmTx.data);\n if (!Number.isSafeInteger(evmTx.chainId) || evmTx.chainId <= 0) {\n throw new Error('EVM transaction chainId is required and must be a positive safe integer');\n }\n const chainId = evmTx.chainId;\n const trustedRuntime = (_b = (_a = this.config.runtimeAddresses) === null || _a === void 0 ? void 0 : _a[String(chainId)]) !== null && _b !== void 0 ? _b : (this.config.chainId === chainId ? this.config.runtimeAddress : undefined);\n if (!trustedRuntime)\n throw new Error(`No trusted BoundedRuntime address configured for EVM chain ${chainId}`);\n if (normalizeEvmAddress(evmTx.to) !== trustedRuntime) {\n throw new Error('EVM transaction target is not the configured BoundedRuntime');\n }\n if (evmTx.nonce !== undefined) {\n throw new Error('Server-supplied EVM nonces are not accepted');\n }\n try {\n if (BigInt((_c = evmTx.value) !== null && _c !== void 0 ? _c : '0') !== BigInt(0)) {\n throw new Error('BoundedRuntime.setDocuments cannot transfer native value');\n }\n }\n catch (error) {\n if (error instanceof Error && error.message.includes('cannot transfer'))\n throw error;\n throw new Error('Invalid EVM transaction value');\n }\n if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {\n // Injected EVM wallets sign+submit atomically; eth_signTransaction is not\n // broadly supported (MetaMask removed it), so we cannot return a signed-\n // but-unsubmitted tx here. Fail clearly instead of silently submitting.\n throw new Error('shouldSubmitTx:false is unsupported for injected EVM wallets (they sign and submit atomically).');\n }\n const provider = this.resolveProvider();\n const from = await this.connectAddress(provider);\n if (!this.authenticatedAddress || from !== this.authenticatedAddress) {\n throw new Error('The connected EVM wallet account changed after login. Sign in again before submitting this write.');\n }\n // Chain-switch guard: the pre-built tx names the chain it MUST execute on.\n if (typeof evmTx.chainId === 'number') {\n const current = await this.currentChainId(provider);\n if (current === null)\n throw new Error('Could not verify the EVM wallet chain; refusing to submit the transaction.');\n if (current !== evmTx.chainId) {\n const targetHex = '0x' + evmTx.chainId.toString(16);\n try {\n await provider.request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: targetHex }],\n });\n }\n catch (err) {\n throw new Error(`EVM wallet is on chain ${current} but this write targets chain ${evmTx.chainId}, ` +\n `and the chain switch was rejected or failed${(err === null || err === void 0 ? void 0 : err.message) ? `: ${err.message}` : ''}. ` +\n `Switch your wallet to chain ${evmTx.chainId} and retry.`);\n }\n const switched = await this.currentChainId(provider);\n if (switched !== evmTx.chainId) {\n throw new Error(`EVM wallet did not switch to required chain ${evmTx.chainId}; refusing to submit.`);\n }\n }\n }\n const txParams = { from, to: normalizeEvmAddress(evmTx.to), data: evmTx.data.toLowerCase() };\n txParams.value = '0x0';\n // Gas, fee and nonce hints come from the server and are not part of the\n // governed action. Deliberately omit them: the wallet estimates locally,\n // preventing a compromised response from forcing an abusive fee/nonce.\n const txHash = await provider.request({\n method: 'eth_sendTransaction',\n params: [txParams],\n });\n if (typeof txHash !== 'string' || !/^0x[0-9a-fA-F]{64}$/.test(txHash)) {\n throw new Error('EVM wallet returned an invalid transaction hash');\n }\n const receipt = await this.waitForReceipt(provider, txHash);\n if (!receipt || typeof receipt.status !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.status)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid receipt status`);\n }\n if (BigInt(receipt.status) !== BigInt(1)) {\n throw new Error(`EVM transaction ${txHash} reverted on-chain`);\n }\n if (typeof receipt.blockNumber !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.blockNumber)) {\n throw new Error(`EVM transaction ${txHash} returned an invalid block number`);\n }\n const blockNumber = BigInt(receipt.blockNumber);\n if (blockNumber > BigInt(Number.MAX_SAFE_INTEGER))\n throw new Error('EVM receipt block number exceeds the SDK safe-integer range');\n if (typeof receipt.gasUsed !== 'string' || !/^0x[0-9a-fA-F]+$/.test(receipt.gasUsed)) {\n throw new Error(`EVM transaction ${txHash} returned invalid gas usage`);\n }\n return {\n transactionSignature: txHash,\n blockNumber: Number(blockNumber),\n gasUsed: BigInt(receipt.gasUsed).toString(),\n data: receipt,\n };\n }\n /** Poll eth_getTransactionReceipt until it lands (bounded retries) or throw. */\n async waitForReceipt(provider, txHash) {\n for (let attempt = 0; attempt < RECEIPT_POLL_ATTEMPTS; attempt++) {\n const receipt = await provider.request({\n method: 'eth_getTransactionReceipt',\n params: [txHash],\n });\n if (receipt)\n return receipt;\n await new Promise((r) => setTimeout(r, RECEIPT_POLL_INTERVAL_MS));\n }\n throw new Error(`EVM transaction ${txHash} was submitted but no receipt confirmed within ` +\n `${(RECEIPT_POLL_ATTEMPTS * RECEIPT_POLL_INTERVAL_MS) / 1000}s. It may still land; check the explorer.`);\n }\n async getNativeMethods() {\n return this.res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AM,IAAI,KAAK,CAAC,CAAC,gBAAgB,EAAE,MAAM,CAAC,+CAA+C,CAAC;AAClG,YAAY,CAAC,EAAE,CAAC,qBAAqB,GAAG,wBAAwB,IAAI,IAAI,CAAC,yCAAyC,CAAC,CAAC;AACpH,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ;AACA,yBAAyB,CAAC,QAAQ,GAAG,IAAI;;;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@bounded-sh/core');
4
- var index_native = require('./index.native-BfoLJCZg.js');
4
+ var index_native = require('./index.native-2Mmuh7RB.js');
5
5
  require('react');
6
6
 
7
7
  // injected-evm-wallet-types.ts — tiny, dependency-free surface for the EVM
@@ -406,4 +406,4 @@ InjectedEvmWalletProvider.instance = null;
406
406
 
407
407
  exports.InjectedEvmWalletProvider = InjectedEvmWalletProvider;
408
408
  exports.defaultInjectedEvmProvider = defaultInjectedEvmProvider;
409
- //# sourceMappingURL=injected-evm-wallet-provider-BXj1YFaZ.js.map
409
+ //# sourceMappingURL=injected-evm-wallet-provider-DoB2BLir.js.map