@bounded-sh/client 0.0.62 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/providers/email-auth-provider.d.ts +4 -4
- package/dist/auth/providers/injected-wallet-provider.d.ts +1 -1
- package/dist/auth/providers/privy-expo-provider.d.ts +1 -1
- package/dist/auth/turnkey-signer-bridge.d.ts +5 -0
- package/dist/auth/turnkey-signing-capability.d.ts +20 -0
- package/dist/{email-auth-provider-vWv0rnbd.mjs → email-auth-provider-BLHNLu5l.mjs} +27 -30
- package/dist/email-auth-provider-BLHNLu5l.mjs.map +1 -0
- package/dist/{email-auth-provider-BxV1zZA_.js → email-auth-provider-CJVJsWXv.js} +27 -30
- package/dist/email-auth-provider-CJVJsWXv.js.map +1 -0
- package/dist/{email-auth-provider-BttT2sZK.js → email-auth-provider-DYtoSrdm.js} +27 -30
- package/dist/email-auth-provider-DYtoSrdm.js.map +1 -0
- package/dist/{email-auth-provider-Cb4VKA1E.mjs → email-auth-provider-wqNimboO.mjs} +27 -30
- package/dist/email-auth-provider-wqNimboO.mjs.map +1 -0
- package/dist/{guest-auth-provider-BBPpydtM.mjs → guest-auth-provider-C3EGlSSp.mjs} +2 -2
- package/dist/{guest-auth-provider-CeIZw5x6.mjs.map → guest-auth-provider-C3EGlSSp.mjs.map} +1 -1
- package/dist/{guest-auth-provider-CeIZw5x6.mjs → guest-auth-provider-CKkNZ-1p.mjs} +2 -2
- package/dist/{guest-auth-provider-BBPpydtM.mjs.map → guest-auth-provider-CKkNZ-1p.mjs.map} +1 -1
- package/dist/{guest-auth-provider-BcR-MQ0g.js → guest-auth-provider-CoI0r92a.js} +2 -2
- package/dist/{guest-auth-provider-BcR-MQ0g.js.map → guest-auth-provider-CoI0r92a.js.map} +1 -1
- package/dist/{guest-auth-provider-peD5Zasl.js → guest-auth-provider-UMP8Z_bK.js} +2 -2
- package/dist/{guest-auth-provider-peD5Zasl.js.map → guest-auth-provider-UMP8Z_bK.js.map} +1 -1
- package/dist/{index-DpJl_Cpa.mjs → index-Cgbr0abz.mjs} +2190 -2340
- package/dist/index-Cgbr0abz.mjs.map +1 -0
- package/dist/{index-DEDYfO2p.js → index-FkEGh6dx.js} +2192 -2344
- package/dist/index-FkEGh6dx.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{index.native-BSheiGj2.js → index.native-CAHw3k3_.js} +621 -323
- package/dist/index.native-CAHw3k3_.js.map +1 -0
- package/dist/{index.native-BIUs8t7F.mjs → index.native-wyaknPBR.mjs} +619 -319
- package/dist/index.native-wyaknPBR.mjs.map +1 -0
- package/dist/index.native.d.ts +0 -1
- package/dist/index.native.js +1 -2
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +1 -1
- package/dist/{injected-evm-wallet-provider-DnOrVMDX.mjs → injected-evm-wallet-provider-B8x7dNuL.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-DnOrVMDX.mjs.map → injected-evm-wallet-provider-B8x7dNuL.mjs.map} +1 -1
- package/dist/{injected-evm-wallet-provider-7XawIUdJ.js → injected-evm-wallet-provider-BAToKWZo.js} +2 -2
- package/dist/{injected-evm-wallet-provider-7XawIUdJ.js.map → injected-evm-wallet-provider-BAToKWZo.js.map} +1 -1
- package/dist/{injected-evm-wallet-provider-B-9VXQcH.js → injected-evm-wallet-provider-D-7Eg6TS.js} +2 -2
- package/dist/{injected-evm-wallet-provider-B-9VXQcH.js.map → injected-evm-wallet-provider-D-7Eg6TS.js.map} +1 -1
- package/dist/{injected-evm-wallet-provider-BVsxOzYr.mjs → injected-evm-wallet-provider-pVKJtDHL.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-BVsxOzYr.mjs.map → injected-evm-wallet-provider-pVKJtDHL.mjs.map} +1 -1
- package/dist/{injected-wallet-provider-D574oPzH.js → injected-wallet-provider-28GE3rH9.js} +8 -75
- package/dist/injected-wallet-provider-28GE3rH9.js.map +1 -0
- package/dist/{injected-wallet-provider-ZkPzVj5W.mjs → injected-wallet-provider-5NeXEzui.mjs} +9 -76
- package/dist/injected-wallet-provider-5NeXEzui.mjs.map +1 -0
- package/dist/{injected-wallet-provider-Bqk33sir.mjs → injected-wallet-provider-BojBmTAQ.mjs} +9 -76
- package/dist/injected-wallet-provider-BojBmTAQ.mjs.map +1 -0
- package/dist/{injected-wallet-provider-BMDJntMD.js → injected-wallet-provider-DvwlPJea.js} +8 -75
- package/dist/injected-wallet-provider-DvwlPJea.js.map +1 -0
- package/dist/onramp.d.ts +4 -1
- package/package.json +2 -2
- package/dist/auth/crossmint-signer-bridge.d.ts +0 -45
- package/dist/auth/providers/phantom-wallet-provider.d.ts +0 -111
- package/dist/auth/providers/privy-wallet-provider.d.ts +0 -83
- package/dist/auth/providers/sol/sol-utils.d.ts +0 -2
- package/dist/auth/providers/solana-mobile-wallet-provider.d.ts +0 -151
- package/dist/email-auth-provider-BttT2sZK.js.map +0 -1
- package/dist/email-auth-provider-BxV1zZA_.js.map +0 -1
- package/dist/email-auth-provider-Cb4VKA1E.mjs.map +0 -1
- package/dist/email-auth-provider-vWv0rnbd.mjs.map +0 -1
- package/dist/index-DEDYfO2p.js.map +0 -1
- package/dist/index-DpJl_Cpa.mjs.map +0 -1
- package/dist/index.native-BIUs8t7F.mjs.map +0 -1
- package/dist/index.native-BSheiGj2.js.map +0 -1
- package/dist/injected-wallet-provider-BMDJntMD.js.map +0 -1
- package/dist/injected-wallet-provider-Bqk33sir.mjs.map +0 -1
- package/dist/injected-wallet-provider-D574oPzH.js.map +0 -1
- package/dist/injected-wallet-provider-ZkPzVj5W.mjs.map +0 -1
package/dist/{injected-evm-wallet-provider-BVsxOzYr.mjs → injected-evm-wallet-provider-pVKJtDHL.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeEvmAddress, getActiveSessionManager, genAuthNonce, getConfig, genSiweMessage, createSessionWithSignature, assertCanonicalBoundedRuntimeWriteCalldata } from '@bounded-sh/core';
|
|
2
|
-
import { k as defaultInjectedEvmProvider,
|
|
2
|
+
import { k as defaultInjectedEvmProvider, e as setAuthLoading, s as setCurrentUser, g as getPlatform } from './index-Cgbr0abz.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-
|
|
340
|
+
//# sourceMappingURL=injected-evm-wallet-provider-pVKJtDHL.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injected-evm-wallet-provider-BVsxOzYr.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 await 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 await 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.resol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R,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-pVKJtDHL.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 await 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 await 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,a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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 = require('./index-
|
|
4
|
+
var index = require('./index-FkEGh6dx.js');
|
|
5
5
|
require('react');
|
|
6
6
|
|
|
7
7
|
const STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';
|
|
@@ -173,79 +173,12 @@ class InjectedWalletProvider {
|
|
|
173
173
|
* set-documents transaction with the injected wallet as payer, then sign +
|
|
174
174
|
* submit with the wallet's own keypair.
|
|
175
175
|
*/
|
|
176
|
-
async runTransaction(_evmTransactionData,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const { Connection, PublicKey, VersionedTransaction } = chainSdk;
|
|
183
|
-
if (!solTransactionData) {
|
|
184
|
-
throw new Error('Solana transaction data is required for wallet login');
|
|
185
|
-
}
|
|
186
|
-
const provider = this.resolveProvider();
|
|
187
|
-
const address = await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));
|
|
188
|
-
const publicKey = new PublicKey(address);
|
|
189
|
-
const rpcUrl = this.getRpcUrl(solTransactionData.network);
|
|
190
|
-
const connection = new Connection(rpcUrl, 'confirmed');
|
|
191
|
-
const app_id = solTransactionData.appId;
|
|
192
|
-
if (!app_id)
|
|
193
|
-
throw new Error('App ID is required');
|
|
194
|
-
const walletAdapter = {
|
|
195
|
-
publicKey,
|
|
196
|
-
signTransaction: async (tx) => provider.signTransaction(tx),
|
|
197
|
-
signAllTransactions: async (txs) => provider.signAllTransactions
|
|
198
|
-
? provider.signAllTransactions(txs)
|
|
199
|
-
: Promise.all(txs.map((t) => provider.signTransaction(t))),
|
|
200
|
-
};
|
|
201
|
-
const ProviderClass = programSdk[['Anch', 'orProvider'].join('')];
|
|
202
|
-
const programProvider = new ProviderClass(connection, walletAdapter, ProviderClass.defaultOptions());
|
|
203
|
-
const remainingAccounts = core.convertRemainingAccounts(solTransactionData.txArgs[0].remainingAccounts);
|
|
204
|
-
const finalDeduped = [];
|
|
205
|
-
for (const acc of remainingAccounts) {
|
|
206
|
-
const existing = finalDeduped.find((d) => d.pubkey.equals(acc.pubkey));
|
|
207
|
-
if (existing) {
|
|
208
|
-
existing.isSigner = existing.isSigner || acc.isSigner;
|
|
209
|
-
existing.isWritable = existing.isWritable || acc.isWritable;
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
finalDeduped.push(acc);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
let tx;
|
|
216
|
-
if (solTransactionData.signedTransaction) {
|
|
217
|
-
// Server co-signed (CPI attestation) — just add the wallet signature.
|
|
218
|
-
tx = VersionedTransaction.deserialize(index.bufferExports.Buffer.from(solTransactionData.signedTransaction, 'base64'));
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
const result = await core.buildSetDocumentsTransaction(connection, solTransactionData.txArgs[0].idl, programProvider, publicKey, {
|
|
222
|
-
app_id,
|
|
223
|
-
documents: solTransactionData.txArgs[0].setDocumentData,
|
|
224
|
-
delete_paths: solTransactionData.txArgs[0].deletePaths,
|
|
225
|
-
txData: solTransactionData.txArgs[0].txData,
|
|
226
|
-
}, finalDeduped, solTransactionData.lutKey, solTransactionData.preInstructions, false, solTransactionData.additionalLutAddresses);
|
|
227
|
-
tx = result.tx;
|
|
228
|
-
}
|
|
229
|
-
if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
|
|
230
|
-
const signedTx = await walletAdapter.signTransaction(tx);
|
|
231
|
-
return { signedTransaction: signedTx, blockNumber: 0, gasUsed: '0', data: '' };
|
|
232
|
-
}
|
|
233
|
-
let signature;
|
|
234
|
-
if (typeof provider.signAndSendTransaction === 'function') {
|
|
235
|
-
const res = await provider.signAndSendTransaction(tx);
|
|
236
|
-
signature = res.signature;
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
const signedTx = await walletAdapter.signTransaction(tx);
|
|
240
|
-
signature = await connection.sendRawTransaction(signedTx.serialize());
|
|
241
|
-
}
|
|
242
|
-
const txInfo = await index.confirmAndCheckTransaction(connection, signature);
|
|
243
|
-
return {
|
|
244
|
-
transactionSignature: signature,
|
|
245
|
-
blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,
|
|
246
|
-
gasUsed: ((_b = (_a = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _a === void 0 ? void 0 : _a.fee) === null || _b === void 0 ? void 0 : _b.toString()) || '0',
|
|
247
|
-
data: txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta,
|
|
248
|
-
};
|
|
176
|
+
async runTransaction(_evmTransactionData, _solTransactionData, _options) {
|
|
177
|
+
// Client-side Solana transaction building is retired: the realtime
|
|
178
|
+
// worker returns a fully-built (and, when sponsored, partially-signed)
|
|
179
|
+
// transaction on its 202, which the SDK validates and signs via
|
|
180
|
+
// signTransaction. This provider serves no EVM payload either.
|
|
181
|
+
throw new Error('runTransaction is not supported by this provider; Bounded returns pre-built Solana transactions that are signed with signTransaction.');
|
|
249
182
|
}
|
|
250
183
|
async getNativeMethods() {
|
|
251
184
|
return this.resolveProvider();
|
|
@@ -258,4 +191,4 @@ InjectedWalletProvider.instance = null;
|
|
|
258
191
|
|
|
259
192
|
exports.defaultInjectedProvider = index.defaultInjectedProvider;
|
|
260
193
|
exports.InjectedWalletProvider = InjectedWalletProvider;
|
|
261
|
-
//# sourceMappingURL=injected-wallet-provider-
|
|
194
|
+
//# sourceMappingURL=injected-wallet-provider-28GE3rH9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injected-wallet-provider-28GE3rH9.js","sources":["../.rollup-tmp/auth/providers/injected-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSolanaMessage, } from '@bounded-sh/core';\nimport { Buffer } from 'buffer';\nimport bs58 from 'bs58';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { getPlatform } from '../../platform';\nimport { normalizeSolanaRpcUrl, resolveSolanaRpcUrl } from '../solana-rpc';\nimport { confirmAndCheckTransaction } from './transaction-utils';\nimport { defaultInjectedProvider, } from './injected-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedProvider };\nconst STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';\nconst INJECTED_AUTH_METHOD = 'phantom';\nconst NO_WALLET_ERR = 'No injected Solana wallet found. Install a wallet like Phantom (phantom.app) and try again, ' +\n 'or pass config.injectedWalletConfig.getProvider to point at your wallet.';\nexport class InjectedWalletProvider {\n constructor(config = {}, networkUrl = null, configuredNetwork = null) {\n var _a;\n if (typeof window === 'undefined') {\n throw new Error('InjectedWalletProvider can only be instantiated in a browser environment');\n }\n // `config.rpcUrl` is the legacy wallet-login-local override. Normalize\n // it before precedence so an empty legacy value cannot shadow the\n // current top-level config.rpcUrl. Re-initialization must also replace\n // every singleton field; otherwise a previous app's provider/RPC can\n // survive getAuthProvider()'s config-key rotation.\n const resolvedNetworkUrl = (_a = normalizeSolanaRpcUrl(config.rpcUrl)) !== null && _a !== void 0 ? _a : normalizeSolanaRpcUrl(networkUrl);\n const localNetwork = typeof config.network === 'string' && config.network.trim() !== ''\n ? config.network.trim()\n : null;\n const resolvedConfiguredNetwork = localNetwork !== null && localNetwork !== void 0 ? localNetwork : (typeof configuredNetwork === 'string' && configuredNetwork.trim() !== ''\n ? configuredNetwork.trim()\n : null);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedWalletProvider.instance) {\n InjectedWalletProvider.instance.config = Object.assign({}, config);\n InjectedWalletProvider.instance.networkUrl = resolvedNetworkUrl;\n InjectedWalletProvider.instance.configuredNetwork = resolvedConfiguredNetwork;\n return InjectedWalletProvider.instance;\n }\n this.config = Object.assign({}, config);\n this.networkUrl = resolvedNetworkUrl;\n this.configuredNetwork = resolvedConfiguredNetwork;\n InjectedWalletProvider.instance = this;\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet (if needed) and return its Solana address. */\n async connectAddress(provider, onlyIfTrusted = false) {\n var _a, _b;\n // Already connected — reuse the pubkey.\n if (provider.publicKey && ((_a = provider.isConnected) !== null && _a !== void 0 ? _a : true)) {\n return provider.publicKey.toString();\n }\n const res = await provider.connect(onlyIfTrusted ? { onlyIfTrusted: true } : undefined);\n const pk = (_b = res === null || res === void 0 ? void 0 : res.publicKey) !== null && _b !== void 0 ? _b : provider.publicKey;\n if (!pk)\n throw new Error('Wallet did not return a public key on connect');\n return pk.toString();\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 = { address, id: address, provider: this };\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWS: nonce -> canonical prompt -> the wallet signs it locally.\n const nonce = await genAuthNonce();\n const message = await genSolanaMessage(address, nonce);\n const messageBytes = getPlatform().textEncode(message);\n const signResult = await provider.signMessage(messageBytes, 'utf8');\n const signatureBytes = (_a = signResult === null || signResult === void 0 ? void 0 : signResult.signature) !== null && _a !== void 0 ? _a : signResult;\n // base64 detached ed25519 signature — matches guest/privy providers and\n // the bounded-auth issuer's base64ToBytes() verify path.\n const signature = Buffer.from(signatureBytes).toString('base64');\n const result = await createSessionWithSignature(address, message, signature);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = { address, id: address, provider: this };\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n markAuthMethod() {\n // Mark the auth method so clearIncompatibleSession() doesn't wipe this\n // wallet session on the next init().\n try {\n getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY, INJECTED_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 const user = { address: session.address, id: session.address, provider: this };\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // Clear the Bounded session; best-effort disconnect the wallet.\n await SessionManager().clearSession();\n try {\n const provider = this.config.getProvider ? this.config.getProvider() : defaultInjectedProvider();\n if (provider && typeof provider.disconnect === 'function')\n await provider.disconnect();\n }\n catch ( /* ignore */_a) { /* ignore */ }\n setCurrentUser(null);\n }\n // --- Full local-keypair signing surface (the wallet's OWN methods) --------\n async signMessage(message) {\n var _a;\n const provider = this.resolveProvider();\n await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));\n const messageBytes = getPlatform().textEncode(message);\n const res = await provider.signMessage(messageBytes, 'utf8');\n const signatureBytes = (_a = res === null || res === void 0 ? void 0 : res.signature) !== null && _a !== void 0 ? _a : res;\n // base58 is the standard Solana signature encoding for app-facing signMessage.\n return bs58.encode(signatureBytes instanceof Uint8Array ? signatureBytes : new Uint8Array(signatureBytes));\n }\n async signTransaction(transaction) {\n const provider = this.resolveProvider();\n await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));\n return provider.signTransaction(transaction);\n }\n async signAndSubmitTransaction(transaction, _feePayer) {\n const { Connection, PublicKey } = await import(\"@solana/web3.js\");\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));\n const rpcUrl = this.getRpcUrl();\n const connection = new Connection(rpcUrl, 'confirmed');\n // Set a fresh blockhash on the tx (mirrors the other providers).\n const { blockhash } = await connection.getLatestBlockhash('confirmed');\n const isLegacy = 'recentBlockhash' in transaction &&\n !('message' in transaction && 'staticAccountKeys' in transaction.message);\n if (isLegacy) {\n const legacy = transaction;\n legacy.recentBlockhash = blockhash;\n if (!legacy.feePayer)\n legacy.feePayer = new PublicKey(address);\n }\n else {\n transaction.message.recentBlockhash = blockhash;\n }\n // Prefer the wallet's native signAndSend; fall back to\n // sign + manual submit for wallets without send.\n if (typeof provider.signAndSendTransaction === 'function') {\n const res = await provider.signAndSendTransaction(transaction);\n const signature = res.signature;\n await confirmAndCheckTransaction(connection, signature);\n return signature;\n }\n const signed = await provider.signTransaction(transaction);\n const raw = signed.serialize();\n const signature = await connection.sendRawTransaction(raw);\n await confirmAndCheckTransaction(connection, signature);\n return signature;\n }\n /**\n * Onchain write path (mirrors the other wallet providers): build the Bounded\n * set-documents transaction with the injected wallet as payer, then sign +\n * submit with the wallet's own keypair.\n */\n async runTransaction(_evmTransactionData, _solTransactionData, _options) {\n // Client-side Solana transaction building is retired: the realtime\n // worker returns a fully-built (and, when sponsored, partially-signed)\n // transaction on its 202, which the SDK validates and signs via\n // signTransaction. This provider serves no EVM payload either.\n throw new Error('runTransaction is not supported by this provider; Bounded returns pre-built Solana transactions that are signed with signTransaction.');\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n getRpcUrl(network) {\n return resolveSolanaRpcUrl(this.networkUrl, network !== null && network !== void 0 ? network : this.configuredNetwork, 'Wallet-login Solana transaction');\n }\n}\nInjectedWalletProvider.instance = null;\n"],"names":["normalizeSolanaRpcUrl","defaultInjectedProvider","setAuthLoading","SessionManager","setCurrentUser","genAuthNonce","genSolanaMessage","getPlatform","Buffer","createSessionWithSignature","bs58","confirmAndCheckTransaction","resolveSolanaRpcUrl"],"mappings":";;;;;;AAWA,MAAM,sBAAsB,GAAG,0BAA0B;AACzD,MAAM,oBAAoB,GAAG,SAAS;AACtC,MAAM,aAAa,GAAG,8FAA8F;AACpH,IAAI,0EAA0E;AACvE,MAAM,sBAAsB,CAAC;AACpC,IAAI,WAAW,CAAC,MAAM,GAAG,EAAE,EAAE,UAAU,GAAG,IAAI,EAAE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createSessionWithSignature
|
|
2
|
-
import { n as normalizeSolanaRpcUrl,
|
|
1
|
+
import { getActiveSessionManager, genAuthNonce, genSolanaMessage, createSessionWithSignature } from '@bounded-sh/core';
|
|
2
|
+
import { n as normalizeSolanaRpcUrl, d as setAuthLoading, s as setCurrentUser, g as getPlatform, e as bufferExports, f as bs58, i as confirmAndCheckTransaction, r as resolveSolanaRpcUrl } from './index.native-wyaknPBR.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -190,79 +190,12 @@ class InjectedWalletProvider {
|
|
|
190
190
|
* set-documents transaction with the injected wallet as payer, then sign +
|
|
191
191
|
* submit with the wallet's own keypair.
|
|
192
192
|
*/
|
|
193
|
-
async runTransaction(_evmTransactionData,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const { Connection, PublicKey, VersionedTransaction } = chainSdk;
|
|
200
|
-
if (!solTransactionData) {
|
|
201
|
-
throw new Error('Solana transaction data is required for wallet login');
|
|
202
|
-
}
|
|
203
|
-
const provider = this.resolveProvider();
|
|
204
|
-
const address = await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));
|
|
205
|
-
const publicKey = new PublicKey(address);
|
|
206
|
-
const rpcUrl = this.getRpcUrl(solTransactionData.network);
|
|
207
|
-
const connection = new Connection(rpcUrl, 'confirmed');
|
|
208
|
-
const app_id = solTransactionData.appId;
|
|
209
|
-
if (!app_id)
|
|
210
|
-
throw new Error('App ID is required');
|
|
211
|
-
const walletAdapter = {
|
|
212
|
-
publicKey,
|
|
213
|
-
signTransaction: async (tx) => provider.signTransaction(tx),
|
|
214
|
-
signAllTransactions: async (txs) => provider.signAllTransactions
|
|
215
|
-
? provider.signAllTransactions(txs)
|
|
216
|
-
: Promise.all(txs.map((t) => provider.signTransaction(t))),
|
|
217
|
-
};
|
|
218
|
-
const ProviderClass = programSdk[['Anch', 'orProvider'].join('')];
|
|
219
|
-
const programProvider = new ProviderClass(connection, walletAdapter, ProviderClass.defaultOptions());
|
|
220
|
-
const remainingAccounts = convertRemainingAccounts(solTransactionData.txArgs[0].remainingAccounts);
|
|
221
|
-
const finalDeduped = [];
|
|
222
|
-
for (const acc of remainingAccounts) {
|
|
223
|
-
const existing = finalDeduped.find((d) => d.pubkey.equals(acc.pubkey));
|
|
224
|
-
if (existing) {
|
|
225
|
-
existing.isSigner = existing.isSigner || acc.isSigner;
|
|
226
|
-
existing.isWritable = existing.isWritable || acc.isWritable;
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
finalDeduped.push(acc);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
let tx;
|
|
233
|
-
if (solTransactionData.signedTransaction) {
|
|
234
|
-
// Server co-signed (CPI attestation) — just add the wallet signature.
|
|
235
|
-
tx = VersionedTransaction.deserialize(bufferExports.Buffer.from(solTransactionData.signedTransaction, 'base64'));
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
const result = await buildSetDocumentsTransaction(connection, solTransactionData.txArgs[0].idl, programProvider, publicKey, {
|
|
239
|
-
app_id,
|
|
240
|
-
documents: solTransactionData.txArgs[0].setDocumentData,
|
|
241
|
-
delete_paths: solTransactionData.txArgs[0].deletePaths,
|
|
242
|
-
txData: solTransactionData.txArgs[0].txData,
|
|
243
|
-
}, finalDeduped, solTransactionData.lutKey, solTransactionData.preInstructions, false, solTransactionData.additionalLutAddresses);
|
|
244
|
-
tx = result.tx;
|
|
245
|
-
}
|
|
246
|
-
if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
|
|
247
|
-
const signedTx = await walletAdapter.signTransaction(tx);
|
|
248
|
-
return { signedTransaction: signedTx, blockNumber: 0, gasUsed: '0', data: '' };
|
|
249
|
-
}
|
|
250
|
-
let signature;
|
|
251
|
-
if (typeof provider.signAndSendTransaction === 'function') {
|
|
252
|
-
const res = await provider.signAndSendTransaction(tx);
|
|
253
|
-
signature = res.signature;
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
const signedTx = await walletAdapter.signTransaction(tx);
|
|
257
|
-
signature = await connection.sendRawTransaction(signedTx.serialize());
|
|
258
|
-
}
|
|
259
|
-
const txInfo = await confirmAndCheckTransaction(connection, signature);
|
|
260
|
-
return {
|
|
261
|
-
transactionSignature: signature,
|
|
262
|
-
blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,
|
|
263
|
-
gasUsed: ((_b = (_a = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _a === void 0 ? void 0 : _a.fee) === null || _b === void 0 ? void 0 : _b.toString()) || '0',
|
|
264
|
-
data: txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta,
|
|
265
|
-
};
|
|
193
|
+
async runTransaction(_evmTransactionData, _solTransactionData, _options) {
|
|
194
|
+
// Client-side Solana transaction building is retired: the realtime
|
|
195
|
+
// worker returns a fully-built (and, when sponsored, partially-signed)
|
|
196
|
+
// transaction on its 202, which the SDK validates and signs via
|
|
197
|
+
// signTransaction. This provider serves no EVM payload either.
|
|
198
|
+
throw new Error('runTransaction is not supported by this provider; Bounded returns pre-built Solana transactions that are signed with signTransaction.');
|
|
266
199
|
}
|
|
267
200
|
async getNativeMethods() {
|
|
268
201
|
return this.resolveProvider();
|
|
@@ -274,4 +207,4 @@ class InjectedWalletProvider {
|
|
|
274
207
|
InjectedWalletProvider.instance = null;
|
|
275
208
|
|
|
276
209
|
export { InjectedWalletProvider, defaultInjectedProvider };
|
|
277
|
-
//# sourceMappingURL=injected-wallet-provider-
|
|
210
|
+
//# sourceMappingURL=injected-wallet-provider-5NeXEzui.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injected-wallet-provider-5NeXEzui.mjs","sources":["../.rollup-tmp/auth/providers/injected-wallet-types.js","../.rollup-tmp/auth/providers/injected-wallet-provider.js"],"sourcesContent":["/**\n * Default provider discovery: Phantom-first, then any Wallet-Standard\n * `window.solana`. Kept tiny + synchronous (no heavy imports) so it works inside\n * a user gesture and can be eagerly exported from the SDK entry.\n */\nexport function defaultInjectedProvider() {\n var _a;\n if (typeof window === 'undefined')\n return null;\n const w = window;\n const phantom = (_a = w === null || w === void 0 ? void 0 : w.phantom) === null || _a === void 0 ? void 0 : _a.solana;\n if (phantom && typeof phantom.signMessage === 'function')\n return phantom;\n const generic = w === null || w === void 0 ? void 0 : w.solana;\n if (generic && typeof generic.signMessage === 'function')\n return generic;\n return null;\n}\n","import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSolanaMessage, } from '@bounded-sh/core';\nimport { Buffer } from 'buffer';\nimport bs58 from 'bs58';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { getPlatform } from '../../platform';\nimport { normalizeSolanaRpcUrl, resolveSolanaRpcUrl } from '../solana-rpc';\nimport { confirmAndCheckTransaction } from './transaction-utils';\nimport { defaultInjectedProvider, } from './injected-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedProvider };\nconst STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';\nconst INJECTED_AUTH_METHOD = 'phantom';\nconst NO_WALLET_ERR = 'No injected Solana wallet found. Install a wallet like Phantom (phantom.app) and try again, ' +\n 'or pass config.injectedWalletConfig.getProvider to point at your wallet.';\nexport class InjectedWalletProvider {\n constructor(config = {}, networkUrl = null, configuredNetwork = null) {\n var _a;\n if (typeof window === 'undefined') {\n throw new Error('InjectedWalletProvider can only be instantiated in a browser environment');\n }\n // `config.rpcUrl` is the legacy wallet-login-local override. Normalize\n // it before precedence so an empty legacy value cannot shadow the\n // current top-level config.rpcUrl. Re-initialization must also replace\n // every singleton field; otherwise a previous app's provider/RPC can\n // survive getAuthProvider()'s config-key rotation.\n const resolvedNetworkUrl = (_a = normalizeSolanaRpcUrl(config.rpcUrl)) !== null && _a !== void 0 ? _a : normalizeSolanaRpcUrl(networkUrl);\n const localNetwork = typeof config.network === 'string' && config.network.trim() !== ''\n ? config.network.trim()\n : null;\n const resolvedConfiguredNetwork = localNetwork !== null && localNetwork !== void 0 ? localNetwork : (typeof configuredNetwork === 'string' && configuredNetwork.trim() !== ''\n ? configuredNetwork.trim()\n : null);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedWalletProvider.instance) {\n InjectedWalletProvider.instance.config = Object.assign({}, config);\n InjectedWalletProvider.instance.networkUrl = resolvedNetworkUrl;\n InjectedWalletProvider.instance.configuredNetwork = resolvedConfiguredNetwork;\n return InjectedWalletProvider.instance;\n }\n this.config = Object.assign({}, config);\n this.networkUrl = resolvedNetworkUrl;\n this.configuredNetwork = resolvedConfiguredNetwork;\n InjectedWalletProvider.instance = this;\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet (if needed) and return its Solana address. */\n async connectAddress(provider, onlyIfTrusted = false) {\n var _a, _b;\n // Already connected — reuse the pubkey.\n if (provider.publicKey && ((_a = provider.isConnected) !== null && _a !== void 0 ? _a : true)) {\n return provider.publicKey.toString();\n }\n const res = await provider.connect(onlyIfTrusted ? { onlyIfTrusted: true } : undefined);\n const pk = (_b = res === null || res === void 0 ? void 0 : res.publicKey) !== null && _b !== void 0 ? _b : provider.publicKey;\n if (!pk)\n throw new Error('Wallet did not return a public key on connect');\n return pk.toString();\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 = { address, id: address, provider: this };\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWS: nonce -> canonical prompt -> the wallet signs it locally.\n const nonce = await genAuthNonce();\n const message = await genSolanaMessage(address, nonce);\n const messageBytes = getPlatform().textEncode(message);\n const signResult = await provider.signMessage(messageBytes, 'utf8');\n const signatureBytes = (_a = signResult === null || signResult === void 0 ? void 0 : signResult.signature) !== null && _a !== void 0 ? _a : signResult;\n // base64 detached ed25519 signature — matches guest/privy providers and\n // the bounded-auth issuer's base64ToBytes() verify path.\n const signature = Buffer.from(signatureBytes).toString('base64');\n const result = await createSessionWithSignature(address, message, signature);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = { address, id: address, provider: this };\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n markAuthMethod() {\n // Mark the auth method so clearIncompatibleSession() doesn't wipe this\n // wallet session on the next init().\n try {\n getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY, INJECTED_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 const user = { address: session.address, id: session.address, provider: this };\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // Clear the Bounded session; best-effort disconnect the wallet.\n await SessionManager().clearSession();\n try {\n const provider = this.config.getProvider ? this.config.getProvider() : defaultInjectedProvider();\n if (provider && typeof provider.disconnect === 'function')\n await provider.disconnect();\n }\n catch ( /* ignore */_a) { /* ignore */ }\n setCurrentUser(null);\n }\n // --- Full local-keypair signing surface (the wallet's OWN methods) --------\n async signMessage(message) {\n var _a;\n const provider = this.resolveProvider();\n await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));\n const messageBytes = getPlatform().textEncode(message);\n const res = await provider.signMessage(messageBytes, 'utf8');\n const signatureBytes = (_a = res === null || res === void 0 ? void 0 : res.signature) !== null && _a !== void 0 ? _a : res;\n // base58 is the standard Solana signature encoding for app-facing signMessage.\n return bs58.encode(signatureBytes instanceof Uint8Array ? signatureBytes : new Uint8Array(signatureBytes));\n }\n async signTransaction(transaction) {\n const provider = this.resolveProvider();\n await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));\n return provider.signTransaction(transaction);\n }\n async signAndSubmitTransaction(transaction, _feePayer) {\n const { Connection, PublicKey } = await import(\"@solana/web3.js\");\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));\n const rpcUrl = this.getRpcUrl();\n const connection = new Connection(rpcUrl, 'confirmed');\n // Set a fresh blockhash on the tx (mirrors the other providers).\n const { blockhash } = await connection.getLatestBlockhash('confirmed');\n const isLegacy = 'recentBlockhash' in transaction &&\n !('message' in transaction && 'staticAccountKeys' in transaction.message);\n if (isLegacy) {\n const legacy = transaction;\n legacy.recentBlockhash = blockhash;\n if (!legacy.feePayer)\n legacy.feePayer = new PublicKey(address);\n }\n else {\n transaction.message.recentBlockhash = blockhash;\n }\n // Prefer the wallet's native signAndSend; fall back to\n // sign + manual submit for wallets without send.\n if (typeof provider.signAndSendTransaction === 'function') {\n const res = await provider.signAndSendTransaction(transaction);\n const signature = res.signature;\n await confirmAndCheckTransaction(connection, signature);\n return signature;\n }\n const signed = await provider.signTransaction(transaction);\n const raw = signed.serialize();\n const signature = await connection.sendRawTransaction(raw);\n await confirmAndCheckTransaction(connection, signature);\n return signature;\n }\n /**\n * Onchain write path (mirrors the other wallet providers): build the Bounded\n * set-documents transaction with the injected wallet as payer, then sign +\n * submit with the wallet's own keypair.\n */\n async runTransaction(_evmTransactionData, _solTransactionData, _options) {\n // Client-side Solana transaction building is retired: the realtime\n // worker returns a fully-built (and, when sponsored, partially-signed)\n // transaction on its 202, which the SDK validates and signs via\n // signTransaction. This provider serves no EVM payload either.\n throw new Error('runTransaction is not supported by this provider; Bounded returns pre-built Solana transactions that are signed with signTransaction.');\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n getRpcUrl(network) {\n return resolveSolanaRpcUrl(this.networkUrl, network !== null && network !== void 0 ? network : this.configuredNetwork, 'Wallet-login Solana transaction');\n }\n}\nInjectedWalletProvider.instance = null;\n"],"names":["SessionManager","Buffer"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;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,SAAS,EAAE;AACtC,QAAQ,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC,GAAG,CAAC;AAClE,QAAQ,MAAM,0BAA0B,CAAC,UAAU,EAAE,SAAS,CAAC;AAC/D,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,cAAc,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE;AAC7E;AACA;AACA;AACA;AACA,QAAQ,MAAM,IAAI,KAAK,CAAC,uIAAuI,CAAC;AAChK,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,IAAI,CAAC,eAAe,EAAE;AACrC,IAAI;AACJ,IAAI,SAAS,CAAC,OAAO,EAAE;AACvB,QAAQ,OAAO,mBAAmB,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,iBAAiB,EAAE,iCAAiC,CAAC;AACjK,IAAI;AACJ;AACA,sBAAsB,CAAC,QAAQ,GAAG,IAAI;;;;"}
|
package/dist/{injected-wallet-provider-Bqk33sir.mjs → injected-wallet-provider-BojBmTAQ.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getActiveSessionManager, genAuthNonce, genSolanaMessage, createSessionWithSignature
|
|
2
|
-
import { n as normalizeSolanaRpcUrl, d as defaultInjectedProvider,
|
|
1
|
+
import { getActiveSessionManager, genAuthNonce, genSolanaMessage, createSessionWithSignature } from '@bounded-sh/core';
|
|
2
|
+
import { n as normalizeSolanaRpcUrl, d as defaultInjectedProvider, e as setAuthLoading, s as setCurrentUser, g as getPlatform, f as bufferExports, i as bs58, j as confirmAndCheckTransaction, r as resolveSolanaRpcUrl } from './index-Cgbr0abz.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
const STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';
|
|
@@ -171,79 +171,12 @@ class InjectedWalletProvider {
|
|
|
171
171
|
* set-documents transaction with the injected wallet as payer, then sign +
|
|
172
172
|
* submit with the wallet's own keypair.
|
|
173
173
|
*/
|
|
174
|
-
async runTransaction(_evmTransactionData,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const { Connection, PublicKey, VersionedTransaction } = chainSdk;
|
|
181
|
-
if (!solTransactionData) {
|
|
182
|
-
throw new Error('Solana transaction data is required for wallet login');
|
|
183
|
-
}
|
|
184
|
-
const provider = this.resolveProvider();
|
|
185
|
-
const address = await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));
|
|
186
|
-
const publicKey = new PublicKey(address);
|
|
187
|
-
const rpcUrl = this.getRpcUrl(solTransactionData.network);
|
|
188
|
-
const connection = new Connection(rpcUrl, 'confirmed');
|
|
189
|
-
const app_id = solTransactionData.appId;
|
|
190
|
-
if (!app_id)
|
|
191
|
-
throw new Error('App ID is required');
|
|
192
|
-
const walletAdapter = {
|
|
193
|
-
publicKey,
|
|
194
|
-
signTransaction: async (tx) => provider.signTransaction(tx),
|
|
195
|
-
signAllTransactions: async (txs) => provider.signAllTransactions
|
|
196
|
-
? provider.signAllTransactions(txs)
|
|
197
|
-
: Promise.all(txs.map((t) => provider.signTransaction(t))),
|
|
198
|
-
};
|
|
199
|
-
const ProviderClass = programSdk[['Anch', 'orProvider'].join('')];
|
|
200
|
-
const programProvider = new ProviderClass(connection, walletAdapter, ProviderClass.defaultOptions());
|
|
201
|
-
const remainingAccounts = convertRemainingAccounts(solTransactionData.txArgs[0].remainingAccounts);
|
|
202
|
-
const finalDeduped = [];
|
|
203
|
-
for (const acc of remainingAccounts) {
|
|
204
|
-
const existing = finalDeduped.find((d) => d.pubkey.equals(acc.pubkey));
|
|
205
|
-
if (existing) {
|
|
206
|
-
existing.isSigner = existing.isSigner || acc.isSigner;
|
|
207
|
-
existing.isWritable = existing.isWritable || acc.isWritable;
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
finalDeduped.push(acc);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
let tx;
|
|
214
|
-
if (solTransactionData.signedTransaction) {
|
|
215
|
-
// Server co-signed (CPI attestation) — just add the wallet signature.
|
|
216
|
-
tx = VersionedTransaction.deserialize(bufferExports.Buffer.from(solTransactionData.signedTransaction, 'base64'));
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
const result = await buildSetDocumentsTransaction(connection, solTransactionData.txArgs[0].idl, programProvider, publicKey, {
|
|
220
|
-
app_id,
|
|
221
|
-
documents: solTransactionData.txArgs[0].setDocumentData,
|
|
222
|
-
delete_paths: solTransactionData.txArgs[0].deletePaths,
|
|
223
|
-
txData: solTransactionData.txArgs[0].txData,
|
|
224
|
-
}, finalDeduped, solTransactionData.lutKey, solTransactionData.preInstructions, false, solTransactionData.additionalLutAddresses);
|
|
225
|
-
tx = result.tx;
|
|
226
|
-
}
|
|
227
|
-
if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
|
|
228
|
-
const signedTx = await walletAdapter.signTransaction(tx);
|
|
229
|
-
return { signedTransaction: signedTx, blockNumber: 0, gasUsed: '0', data: '' };
|
|
230
|
-
}
|
|
231
|
-
let signature;
|
|
232
|
-
if (typeof provider.signAndSendTransaction === 'function') {
|
|
233
|
-
const res = await provider.signAndSendTransaction(tx);
|
|
234
|
-
signature = res.signature;
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
const signedTx = await walletAdapter.signTransaction(tx);
|
|
238
|
-
signature = await connection.sendRawTransaction(signedTx.serialize());
|
|
239
|
-
}
|
|
240
|
-
const txInfo = await confirmAndCheckTransaction(connection, signature);
|
|
241
|
-
return {
|
|
242
|
-
transactionSignature: signature,
|
|
243
|
-
blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,
|
|
244
|
-
gasUsed: ((_b = (_a = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _a === void 0 ? void 0 : _a.fee) === null || _b === void 0 ? void 0 : _b.toString()) || '0',
|
|
245
|
-
data: txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta,
|
|
246
|
-
};
|
|
174
|
+
async runTransaction(_evmTransactionData, _solTransactionData, _options) {
|
|
175
|
+
// Client-side Solana transaction building is retired: the realtime
|
|
176
|
+
// worker returns a fully-built (and, when sponsored, partially-signed)
|
|
177
|
+
// transaction on its 202, which the SDK validates and signs via
|
|
178
|
+
// signTransaction. This provider serves no EVM payload either.
|
|
179
|
+
throw new Error('runTransaction is not supported by this provider; Bounded returns pre-built Solana transactions that are signed with signTransaction.');
|
|
247
180
|
}
|
|
248
181
|
async getNativeMethods() {
|
|
249
182
|
return this.resolveProvider();
|
|
@@ -255,4 +188,4 @@ class InjectedWalletProvider {
|
|
|
255
188
|
InjectedWalletProvider.instance = null;
|
|
256
189
|
|
|
257
190
|
export { InjectedWalletProvider, defaultInjectedProvider };
|
|
258
|
-
//# sourceMappingURL=injected-wallet-provider-
|
|
191
|
+
//# sourceMappingURL=injected-wallet-provider-BojBmTAQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injected-wallet-provider-BojBmTAQ.mjs","sources":["../.rollup-tmp/auth/providers/injected-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSolanaMessage, } from '@bounded-sh/core';\nimport { Buffer } from 'buffer';\nimport bs58 from 'bs58';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { getPlatform } from '../../platform';\nimport { normalizeSolanaRpcUrl, resolveSolanaRpcUrl } from '../solana-rpc';\nimport { confirmAndCheckTransaction } from './transaction-utils';\nimport { defaultInjectedProvider, } from './injected-wallet-types';\n// Re-export the type surface + discovery helper for callers who import the\n// provider module directly.\nexport { defaultInjectedProvider };\nconst STORED_AUTH_METHOD_KEY = 'bounded_last_auth_method';\nconst INJECTED_AUTH_METHOD = 'phantom';\nconst NO_WALLET_ERR = 'No injected Solana wallet found. Install a wallet like Phantom (phantom.app) and try again, ' +\n 'or pass config.injectedWalletConfig.getProvider to point at your wallet.';\nexport class InjectedWalletProvider {\n constructor(config = {}, networkUrl = null, configuredNetwork = null) {\n var _a;\n if (typeof window === 'undefined') {\n throw new Error('InjectedWalletProvider can only be instantiated in a browser environment');\n }\n // `config.rpcUrl` is the legacy wallet-login-local override. Normalize\n // it before precedence so an empty legacy value cannot shadow the\n // current top-level config.rpcUrl. Re-initialization must also replace\n // every singleton field; otherwise a previous app's provider/RPC can\n // survive getAuthProvider()'s config-key rotation.\n const resolvedNetworkUrl = (_a = normalizeSolanaRpcUrl(config.rpcUrl)) !== null && _a !== void 0 ? _a : normalizeSolanaRpcUrl(networkUrl);\n const localNetwork = typeof config.network === 'string' && config.network.trim() !== ''\n ? config.network.trim()\n : null;\n const resolvedConfiguredNetwork = localNetwork !== null && localNetwork !== void 0 ? localNetwork : (typeof configuredNetwork === 'string' && configuredNetwork.trim() !== ''\n ? configuredNetwork.trim()\n : null);\n // Singleton so the SDK reuses one instance (mirrors the other providers).\n if (InjectedWalletProvider.instance) {\n InjectedWalletProvider.instance.config = Object.assign({}, config);\n InjectedWalletProvider.instance.networkUrl = resolvedNetworkUrl;\n InjectedWalletProvider.instance.configuredNetwork = resolvedConfiguredNetwork;\n return InjectedWalletProvider.instance;\n }\n this.config = Object.assign({}, config);\n this.networkUrl = resolvedNetworkUrl;\n this.configuredNetwork = resolvedConfiguredNetwork;\n InjectedWalletProvider.instance = this;\n }\n resolveProvider() {\n var _a;\n const provider = (_a = (this.config.getProvider ? this.config.getProvider() : null)) !== null && _a !== void 0 ? _a : defaultInjectedProvider();\n if (!provider)\n throw new Error(NO_WALLET_ERR);\n return provider;\n }\n /** Connect the injected wallet (if needed) and return its Solana address. */\n async connectAddress(provider, onlyIfTrusted = false) {\n var _a, _b;\n // Already connected — reuse the pubkey.\n if (provider.publicKey && ((_a = provider.isConnected) !== null && _a !== void 0 ? _a : true)) {\n return provider.publicKey.toString();\n }\n const res = await provider.connect(onlyIfTrusted ? { onlyIfTrusted: true } : undefined);\n const pk = (_b = res === null || res === void 0 ? void 0 : res.publicKey) !== null && _b !== void 0 ? _b : provider.publicKey;\n if (!pk)\n throw new Error('Wallet did not return a public key on connect');\n return pk.toString();\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 = { address, id: address, provider: this };\n setCurrentUser(user);\n this.markAuthMethod();\n return user;\n }\n // SIWS: nonce -> canonical prompt -> the wallet signs it locally.\n const nonce = await genAuthNonce();\n const message = await genSolanaMessage(address, nonce);\n const messageBytes = getPlatform().textEncode(message);\n const signResult = await provider.signMessage(messageBytes, 'utf8');\n const signatureBytes = (_a = signResult === null || signResult === void 0 ? void 0 : signResult.signature) !== null && _a !== void 0 ? _a : signResult;\n // base64 detached ed25519 signature — matches guest/privy providers and\n // the bounded-auth issuer's base64ToBytes() verify path.\n const signature = Buffer.from(signatureBytes).toString('base64');\n const result = await createSessionWithSignature(address, message, signature);\n await SessionManager().storeSession(address, result.accessToken, result.idToken, result.refreshToken);\n this.markAuthMethod();\n const user = { address, id: address, provider: this };\n setCurrentUser(user);\n return user;\n }\n finally {\n setAuthLoading(false);\n }\n }\n markAuthMethod() {\n // Mark the auth method so clearIncompatibleSession() doesn't wipe this\n // wallet session on the next init().\n try {\n getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY, INJECTED_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 const user = { address: session.address, id: session.address, provider: this };\n setCurrentUser(user);\n return user;\n }\n async logout() {\n // Clear the Bounded session; best-effort disconnect the wallet.\n await SessionManager().clearSession();\n try {\n const provider = this.config.getProvider ? this.config.getProvider() : defaultInjectedProvider();\n if (provider && typeof provider.disconnect === 'function')\n await provider.disconnect();\n }\n catch ( /* ignore */_a) { /* ignore */ }\n setCurrentUser(null);\n }\n // --- Full local-keypair signing surface (the wallet's OWN methods) --------\n async signMessage(message) {\n var _a;\n const provider = this.resolveProvider();\n await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));\n const messageBytes = getPlatform().textEncode(message);\n const res = await provider.signMessage(messageBytes, 'utf8');\n const signatureBytes = (_a = res === null || res === void 0 ? void 0 : res.signature) !== null && _a !== void 0 ? _a : res;\n // base58 is the standard Solana signature encoding for app-facing signMessage.\n return bs58.encode(signatureBytes instanceof Uint8Array ? signatureBytes : new Uint8Array(signatureBytes));\n }\n async signTransaction(transaction) {\n const provider = this.resolveProvider();\n await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));\n return provider.signTransaction(transaction);\n }\n async signAndSubmitTransaction(transaction, _feePayer) {\n const { Connection, PublicKey } = await import(\"@solana/web3.js\");\n const provider = this.resolveProvider();\n const address = await this.connectAddress(provider, true).catch(() => this.connectAddress(provider));\n const rpcUrl = this.getRpcUrl();\n const connection = new Connection(rpcUrl, 'confirmed');\n // Set a fresh blockhash on the tx (mirrors the other providers).\n const { blockhash } = await connection.getLatestBlockhash('confirmed');\n const isLegacy = 'recentBlockhash' in transaction &&\n !('message' in transaction && 'staticAccountKeys' in transaction.message);\n if (isLegacy) {\n const legacy = transaction;\n legacy.recentBlockhash = blockhash;\n if (!legacy.feePayer)\n legacy.feePayer = new PublicKey(address);\n }\n else {\n transaction.message.recentBlockhash = blockhash;\n }\n // Prefer the wallet's native signAndSend; fall back to\n // sign + manual submit for wallets without send.\n if (typeof provider.signAndSendTransaction === 'function') {\n const res = await provider.signAndSendTransaction(transaction);\n const signature = res.signature;\n await confirmAndCheckTransaction(connection, signature);\n return signature;\n }\n const signed = await provider.signTransaction(transaction);\n const raw = signed.serialize();\n const signature = await connection.sendRawTransaction(raw);\n await confirmAndCheckTransaction(connection, signature);\n return signature;\n }\n /**\n * Onchain write path (mirrors the other wallet providers): build the Bounded\n * set-documents transaction with the injected wallet as payer, then sign +\n * submit with the wallet's own keypair.\n */\n async runTransaction(_evmTransactionData, _solTransactionData, _options) {\n // Client-side Solana transaction building is retired: the realtime\n // worker returns a fully-built (and, when sponsored, partially-signed)\n // transaction on its 202, which the SDK validates and signs via\n // signTransaction. This provider serves no EVM payload either.\n throw new Error('runTransaction is not supported by this provider; Bounded returns pre-built Solana transactions that are signed with signTransaction.');\n }\n async getNativeMethods() {\n return this.resolveProvider();\n }\n getRpcUrl(network) {\n return resolveSolanaRpcUrl(this.networkUrl, network !== null && network !== void 0 ? network : this.configuredNetwork, 'Wallet-login Solana transaction');\n }\n}\nInjectedWalletProvider.instance = null;\n"],"names":["SessionManager","Buffer"],"mappings":";;;;AAWA,MAAM,sBAAsB,GAAG,0BAA0B;AACzD,MAAM,oBAAoB,GAAG,SAAS;AACtC,MAAM,aAAa,GAAG,8FAA8F;AACpH,IAAI,0EAA0E;AACvE,MAAM,sBAAsB,CAAC;AACpC,IAAI,WAAW,CAAC,MAAM,GAAG,EAAE,EAAE,UAAU,GAAG,IAAI,EAAE,iBAAiB,GAAG,IAAI,EAAE;AAC1E,QAAQ,IAAI,EAAE;AACd,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAC3C,YAAY,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC;AACvG,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,QAAQ,MAAM,kBAAkB,GAAG,CAAC,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,qBAAqB,CAAC,UAAU,CAAC;AACjJ,QAAQ,MAAM,YAAY,GAAG,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK;AAC7F,cAAc,MAAM,CAAC,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