@bounded-sh/client 0.0.64 → 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/injected-wallet-provider.d.ts +1 -1
- package/dist/auth/providers/privy-expo-provider.d.ts +1 -1
- package/dist/auth/turnkey-signing-capability.d.ts +20 -0
- package/dist/{email-auth-provider-v9xvY0Ky.mjs → email-auth-provider-BLHNLu5l.mjs} +2 -2
- package/dist/{email-auth-provider-v9xvY0Ky.mjs.map → email-auth-provider-BLHNLu5l.mjs.map} +1 -1
- package/dist/{email-auth-provider-97CluDlZ.js → email-auth-provider-CJVJsWXv.js} +2 -2
- package/dist/{email-auth-provider-97CluDlZ.js.map → email-auth-provider-CJVJsWXv.js.map} +1 -1
- package/dist/{email-auth-provider-CKM4O5Z1.js → email-auth-provider-DYtoSrdm.js} +2 -2
- package/dist/{email-auth-provider-CKM4O5Z1.js.map → email-auth-provider-DYtoSrdm.js.map} +1 -1
- package/dist/{email-auth-provider-h0fPnU76.mjs → email-auth-provider-wqNimboO.mjs} +2 -2
- package/dist/{email-auth-provider-h0fPnU76.mjs.map → email-auth-provider-wqNimboO.mjs.map} +1 -1
- package/dist/{guest-auth-provider-Dmup2WIL.mjs → guest-auth-provider-C3EGlSSp.mjs} +2 -2
- package/dist/{guest-auth-provider-BLRbjAv2.mjs.map → guest-auth-provider-C3EGlSSp.mjs.map} +1 -1
- package/dist/{guest-auth-provider-BLRbjAv2.mjs → guest-auth-provider-CKkNZ-1p.mjs} +2 -2
- package/dist/{guest-auth-provider-Dmup2WIL.mjs.map → guest-auth-provider-CKkNZ-1p.mjs.map} +1 -1
- package/dist/{guest-auth-provider-CLnFuodt.js → guest-auth-provider-CoI0r92a.js} +2 -2
- package/dist/{guest-auth-provider-CLnFuodt.js.map → guest-auth-provider-CoI0r92a.js.map} +1 -1
- package/dist/{guest-auth-provider-BvIf5W5c.js → guest-auth-provider-UMP8Z_bK.js} +2 -2
- package/dist/{guest-auth-provider-BvIf5W5c.js.map → guest-auth-provider-UMP8Z_bK.js.map} +1 -1
- package/dist/{index-7yz-Olrm.mjs → index-Cgbr0abz.mjs} +111 -108
- package/dist/index-Cgbr0abz.mjs.map +1 -0
- package/dist/{index-Bk0nEjB6.js → index-FkEGh6dx.js} +109 -107
- 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-Do-VhPUG.js → index.native-CAHw3k3_.js} +108 -106
- package/dist/index.native-CAHw3k3_.js.map +1 -0
- package/dist/{index.native-CWcQMPZd.mjs → index.native-wyaknPBR.mjs} +110 -107
- 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-xvZq9Zli.mjs → injected-evm-wallet-provider-B8x7dNuL.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-xvZq9Zli.mjs.map → injected-evm-wallet-provider-B8x7dNuL.mjs.map} +1 -1
- package/dist/{injected-evm-wallet-provider-BMiT8I-4.js → injected-evm-wallet-provider-BAToKWZo.js} +2 -2
- package/dist/{injected-evm-wallet-provider-BMiT8I-4.js.map → injected-evm-wallet-provider-BAToKWZo.js.map} +1 -1
- package/dist/{injected-evm-wallet-provider-B5MA0w8I.js → injected-evm-wallet-provider-D-7Eg6TS.js} +2 -2
- package/dist/{injected-evm-wallet-provider-B5MA0w8I.js.map → injected-evm-wallet-provider-D-7Eg6TS.js.map} +1 -1
- package/dist/{injected-evm-wallet-provider-DlPsOmik.mjs → injected-evm-wallet-provider-pVKJtDHL.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-DlPsOmik.mjs.map → injected-evm-wallet-provider-pVKJtDHL.mjs.map} +1 -1
- package/dist/{injected-wallet-provider-CSj0lY9H.js → injected-wallet-provider-28GE3rH9.js} +8 -75
- package/dist/injected-wallet-provider-28GE3rH9.js.map +1 -0
- package/dist/{injected-wallet-provider-Dd7ij6bc.mjs → injected-wallet-provider-5NeXEzui.mjs} +9 -76
- package/dist/injected-wallet-provider-5NeXEzui.mjs.map +1 -0
- package/dist/{injected-wallet-provider-YHhhFzsj.mjs → injected-wallet-provider-BojBmTAQ.mjs} +9 -76
- package/dist/injected-wallet-provider-BojBmTAQ.mjs.map +1 -0
- package/dist/{injected-wallet-provider-CoE5XQQn.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/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/index-7yz-Olrm.mjs.map +0 -1
- package/dist/index-Bk0nEjB6.js.map +0 -1
- package/dist/index.native-CWcQMPZd.mjs.map +0 -1
- package/dist/index.native-Do-VhPUG.js.map +0 -1
- package/dist/injected-wallet-provider-CSj0lY9H.js.map +0 -1
- package/dist/injected-wallet-provider-CoE5XQQn.js.map +0 -1
- package/dist/injected-wallet-provider-Dd7ij6bc.mjs.map +0 -1
- package/dist/injected-wallet-provider-YHhhFzsj.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,6 @@ export type { UseBuildRunOptions, UseBuildRunResult } from "./hooks/useBuildRun"
|
|
|
24
24
|
export * from "./builds";
|
|
25
25
|
export { apps } from "./builds/apps";
|
|
26
26
|
export type { AppListItem, CreatedApp, CreateAppOptions } from "./builds/apps";
|
|
27
|
-
export { deserializeTransaction } from "./auth/providers/sol/sol-utils";
|
|
28
27
|
export { signSolanaMessageViaTurnkey, getOrCreateTurnkeyWallet } from "./auth/turnkey-signer-bridge";
|
|
29
28
|
export type { TurnkeySignResult, TurnkeyWallet } from "./auth/turnkey-signer-bridge";
|
|
30
29
|
export { startTurnkeyEmailLogin } from "./auth/turnkey-auth";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-FkEGh6dx.js');
|
|
4
4
|
var core = require('@bounded-sh/core');
|
|
5
5
|
require('react');
|
|
6
6
|
|
|
@@ -23,7 +23,6 @@ exports.completeLoginFromRedirect = index.completeLoginFromRedirect;
|
|
|
23
23
|
exports.completeLoginInPopup = index.completeLoginInPopup;
|
|
24
24
|
exports.defaultInjectedEvmProvider = index.defaultInjectedEvmProvider;
|
|
25
25
|
exports.defaultInjectedProvider = index.defaultInjectedProvider;
|
|
26
|
-
exports.deserializeTransaction = index.deserializeTransaction;
|
|
27
26
|
exports.getAuthLoading = index.getAuthLoading;
|
|
28
27
|
exports.getAuthProvider = index.getAuthProvider;
|
|
29
28
|
exports.getCurrentUser = index.getCurrentUser;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a0 as BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA, $ as BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA, _ as BUILD_REVIEW_CAPABILITY_SCHEMA, U as BuildsApiError, Z as FAILURE_REASONS, V as NON_TERMINAL_STATES, Q as OffchainAuthProvider, Y as PARK_REASONS, R as PrivyExpoProvider, X as RUN_STATES, W as TERMINAL_STATES, H as apps, T as builds, A as completeLoginFromRedirect, C as completeLoginInPopup, k as defaultInjectedEvmProvider, d as defaultInjectedProvider, q as getAuthLoading, v as getAuthProvider, m as getCurrentUser, L as getIdToken, J as getOrCreateTurnkeyWallet, g as getPlatform, l as init, t as login, B as loginWithPopup, x as loginWithPrivy, z as loginWithRedirect, y as loginWithWallet, u as logout, p as onAuthLoadingChanged, o as onAuthStateChanged, M as onramp, N as onrampQuote, O as onrampStatus, D as openBoundedWidget, S as requestEip6963Providers, P as setPlatform, w as signInAnonymously, I as signSolanaMessageViaTurnkey, K as startTurnkeyEmailLogin, E as useAuth, G as useBuildRun, F as useQuery } from './index-Cgbr0abz.mjs';
|
|
2
2
|
export * from '@bounded-sh/core';
|
|
3
3
|
export { BoundedDeclineError, DECLINE_EVENT_NAME, RATE_LIMIT_EVENT_NAME, ScopedClientReadOnlyError, aggregate, count, createClient, deriveDecline, dispatchDeclineEvent, dispatchRateLimitEvent, 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';
|
|
@@ -3740,6 +3740,63 @@ async function runWidget(url, signerOrigin, ex, popupFallback) {
|
|
|
3740
3740
|
return run;
|
|
3741
3741
|
}
|
|
3742
3742
|
|
|
3743
|
+
// turnkey-signing-capability.ts - the pure AS-02 (DS2-0112) signing-capability logic,
|
|
3744
|
+
// kept import-free (no DOM, no session, no @bounded-sh/core) so it is unit-testable.
|
|
3745
|
+
//
|
|
3746
|
+
// The hosted Turnkey signer refuses to sign unless the request carries an issuer-signed
|
|
3747
|
+
// SIGNING CAPABILITY bound to the app id, the requesting origin, and the EXACT payload
|
|
3748
|
+
// hash. `requestTurnkeySigningCapability` mints one for the given bytes and
|
|
3749
|
+
// `buildTurnkeySignRequest` assembles the signer request that carries it. The bridge
|
|
3750
|
+
// (turnkey-signer-bridge.ts) supplies the base url + id token and routes through both,
|
|
3751
|
+
// so a regression here (a dropped capability, a wrong route, a swallowed error) is
|
|
3752
|
+
// caught without a browser.
|
|
3753
|
+
// POST the Bounded id token + payload hash to the issuer's capability mint route and
|
|
3754
|
+
// return the issuer-signed capability for exactly these bytes. Credential-free: identity
|
|
3755
|
+
// is proven with the id token in the body (not an ambient cookie the cross-origin fetch
|
|
3756
|
+
// would not carry). Throws with the same stable messages the bridge relied on inline.
|
|
3757
|
+
async function requestTurnkeySigningCapability(opts) {
|
|
3758
|
+
const base = opts.baseUrl.replace(/\/$/, '');
|
|
3759
|
+
let res;
|
|
3760
|
+
try {
|
|
3761
|
+
res = await opts.fetchImpl(`${base}/wallet/turnkey/capability`, {
|
|
3762
|
+
method: 'POST',
|
|
3763
|
+
headers: { 'content-type': 'application/json' },
|
|
3764
|
+
body: JSON.stringify({ idToken: opts.idToken, messageHex: opts.messageHex }),
|
|
3765
|
+
});
|
|
3766
|
+
}
|
|
3767
|
+
catch (_a) {
|
|
3768
|
+
throw new Error('Could not reach the Bounded signer to authorize this signature.');
|
|
3769
|
+
}
|
|
3770
|
+
if (!res.ok) {
|
|
3771
|
+
let error = 'signing_capability_denied';
|
|
3772
|
+
try {
|
|
3773
|
+
const d = (await res.json());
|
|
3774
|
+
if (d && typeof d.error === 'string')
|
|
3775
|
+
error = d.error;
|
|
3776
|
+
}
|
|
3777
|
+
catch (_b) {
|
|
3778
|
+
/* keep the default marker */
|
|
3779
|
+
}
|
|
3780
|
+
throw new Error(`Turnkey signing was not authorized (${error}).`);
|
|
3781
|
+
}
|
|
3782
|
+
const d = (await res.json());
|
|
3783
|
+
if (!d || typeof d.capability !== 'string' || !d.capability) {
|
|
3784
|
+
throw new Error('Turnkey signing capability was malformed.');
|
|
3785
|
+
}
|
|
3786
|
+
return d.capability;
|
|
3787
|
+
}
|
|
3788
|
+
// Assemble the `bounded:turnkey:sign` postMessage request, carrying the issuer-signed
|
|
3789
|
+
// capability for the same bytes. Without the capability the hosted signer refuses
|
|
3790
|
+
// (capability_required), so it is a required field of every sign request.
|
|
3791
|
+
function buildTurnkeySignRequest(opts) {
|
|
3792
|
+
return {
|
|
3793
|
+
type: 'bounded:turnkey:sign',
|
|
3794
|
+
requestId: opts.requestId,
|
|
3795
|
+
messageHex: opts.messageHex,
|
|
3796
|
+
capability: opts.capability,
|
|
3797
|
+
};
|
|
3798
|
+
}
|
|
3799
|
+
|
|
3743
3800
|
// turnkey-signer-bridge.ts - routes NON-CUSTODIAL Turnkey embedded-wallet signing
|
|
3744
3801
|
// through the Bounded-owned signer page (auth.bounded.sh/wallet/turnkey/signer).
|
|
3745
3802
|
//
|
|
@@ -3904,6 +3961,33 @@ async function runPopup(url, signerOrigin, ex) {
|
|
|
3904
3961
|
} }, 5 * 60 * 1000);
|
|
3905
3962
|
});
|
|
3906
3963
|
}
|
|
3964
|
+
// AS-02: the hosted signer refuses to sign unless the request carries an issuer-signed
|
|
3965
|
+
// SIGNING CAPABILITY bound to the app id, this origin, and the EXACT bytes (a bare postMessage
|
|
3966
|
+
// from any peer can no longer consent-phish a signature). Fetch one from the human-auth issuer
|
|
3967
|
+
// for exactly these bytes before posting the sign request. Credential-free: the caller proves
|
|
3968
|
+
// identity with the Bounded id token WE minted (a body secret, RS256-verified server-side), not
|
|
3969
|
+
// an ambient cookie - the issuer's session cookie is SameSite-scoped to its own origin and is
|
|
3970
|
+
// not sent on this cross-origin fetch, so the token is what carries the session's wallet.
|
|
3971
|
+
async function fetchSigningCapability(messageHex) {
|
|
3972
|
+
const cfg = await core.getConfig();
|
|
3973
|
+
const base = (cfg.humanAuthApiUrl || 'https://auth.bounded.sh').replace(/\/$/, '');
|
|
3974
|
+
let idToken = null;
|
|
3975
|
+
try {
|
|
3976
|
+
idToken = core.getActiveSessionManager().getIdToken();
|
|
3977
|
+
}
|
|
3978
|
+
catch (_a) {
|
|
3979
|
+
idToken = null;
|
|
3980
|
+
}
|
|
3981
|
+
if (!idToken) {
|
|
3982
|
+
throw new Error('This session has no Turnkey wallet. Sign in again to provision one.');
|
|
3983
|
+
}
|
|
3984
|
+
return requestTurnkeySigningCapability({
|
|
3985
|
+
baseUrl: base,
|
|
3986
|
+
idToken,
|
|
3987
|
+
messageHex,
|
|
3988
|
+
fetchImpl: (url, init) => fetch(url, init),
|
|
3989
|
+
});
|
|
3990
|
+
}
|
|
3907
3991
|
function hasTurnkeyWallet() {
|
|
3908
3992
|
return activeTurnkeyAddress() !== null;
|
|
3909
3993
|
}
|
|
@@ -3924,8 +4008,11 @@ async function signSolanaMessageViaTurnkey(message) {
|
|
|
3924
4008
|
const { url, origin } = await turnkeySignerPage();
|
|
3925
4009
|
const requestId = `tksign_${Date.now()}_${++requestSeq}`;
|
|
3926
4010
|
const messageHex = toHex(message);
|
|
4011
|
+
// AS-02: obtain the issuer-signed capability for THESE exact bytes first; the signer will
|
|
4012
|
+
// refuse (capability_required) without it. Fetched per signature (each is single-payload).
|
|
4013
|
+
const capability = await fetchSigningCapability(messageHex);
|
|
3927
4014
|
return await deliver(url, origin, {
|
|
3928
|
-
request: {
|
|
4015
|
+
request: buildTurnkeySignRequest({ requestId, messageHex, capability }),
|
|
3929
4016
|
onResult: (d) => {
|
|
3930
4017
|
if (d.ok && typeof d.signatureHex === 'string' && typeof d.address === 'string') {
|
|
3931
4018
|
return { done: true, value: { signature: fromHex(d.signatureHex), address: d.address, subOrgId: String(d.subOrgId || '') } };
|
|
@@ -4794,7 +4881,7 @@ async function getAuthProvider(config) {
|
|
|
4794
4881
|
// manager as legacy email sessions. Human login should be started
|
|
4795
4882
|
// with loginWithRedirect(); this provider is kept as the restore and
|
|
4796
4883
|
// logout surface for those sessions.
|
|
4797
|
-
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-
|
|
4884
|
+
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-DYtoSrdm.js'); })).EmailAuthProvider();
|
|
4798
4885
|
break;
|
|
4799
4886
|
case "wallet":
|
|
4800
4887
|
case "phantom": {
|
|
@@ -4813,7 +4900,7 @@ async function getAuthProvider(config) {
|
|
|
4813
4900
|
if (!isWalletLoginEnabled(config)) {
|
|
4814
4901
|
throw walletLoginNotEnabledError(authMethod);
|
|
4815
4902
|
}
|
|
4816
|
-
const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-
|
|
4903
|
+
const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-DvwlPJea.js'); });
|
|
4817
4904
|
currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
|
|
4818
4905
|
break;
|
|
4819
4906
|
}
|
|
@@ -4826,7 +4913,7 @@ async function getAuthProvider(config) {
|
|
|
4826
4913
|
// Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
|
|
4827
4914
|
// to point at a specific wallet or set chainId/domain.
|
|
4828
4915
|
const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
|
|
4829
|
-
const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-
|
|
4916
|
+
const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-BAToKWZo.js'); });
|
|
4830
4917
|
currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
|
|
4831
4918
|
break;
|
|
4832
4919
|
}
|
|
@@ -4854,7 +4941,7 @@ async function getAuthProvider(config) {
|
|
|
4854
4941
|
break;
|
|
4855
4942
|
case "guest":
|
|
4856
4943
|
// Anonymous auth: a device-local ed25519 keypair signs the challenge.
|
|
4857
|
-
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-
|
|
4944
|
+
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-CoI0r92a.js'); })).GuestAuthProvider();
|
|
4858
4945
|
break;
|
|
4859
4946
|
}
|
|
4860
4947
|
if (!currentAuthProvider) {
|
|
@@ -4910,7 +4997,7 @@ async function signInAnonymously() {
|
|
|
4910
4997
|
// Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
|
|
4911
4998
|
// the main bundle for data-only apps. Specifier is a static string literal
|
|
4912
4999
|
// so bundle-splitting can see it.
|
|
4913
|
-
const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-
|
|
5000
|
+
const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-CoI0r92a.js'); })).GuestAuthProvider();
|
|
4914
5001
|
setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
|
|
4915
5002
|
const commit = (user) => {
|
|
4916
5003
|
// No await/interleaving inside this block: provider/method/config/marker
|
|
@@ -6148,18 +6235,6 @@ async function list() {
|
|
|
6148
6235
|
*/
|
|
6149
6236
|
const apps = { create, list, buildCreateRedirectUrl };
|
|
6150
6237
|
|
|
6151
|
-
async function deserializeTransaction(tx) {
|
|
6152
|
-
// Literal specifier so bundlers can code-split the lazy chunk.
|
|
6153
|
-
const { Transaction, VersionedTransaction } = await import('@solana/web3.js');
|
|
6154
|
-
const buf = Buffer.isBuffer(tx) ? tx : Buffer.from(tx, 'base64');
|
|
6155
|
-
if ((buf[0] & 0x80) !== 0) {
|
|
6156
|
-
return VersionedTransaction.deserialize(buf);
|
|
6157
|
-
}
|
|
6158
|
-
else {
|
|
6159
|
-
return Transaction.from(buf);
|
|
6160
|
-
}
|
|
6161
|
-
}
|
|
6162
|
-
|
|
6163
6238
|
// bounded.onramp() - fund the signed-in user's wallet with Coinbase Onramp.
|
|
6164
6239
|
//
|
|
6165
6240
|
// Web-only. Opens Coinbase's hosted checkout (pay.coinbase.com) in a popup
|
|
@@ -6201,16 +6276,16 @@ async function readError(res) {
|
|
|
6201
6276
|
}
|
|
6202
6277
|
}
|
|
6203
6278
|
function sessionBody(options, extra) {
|
|
6204
|
-
return JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
6279
|
+
return JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (options.asset ? { asset: options.asset } : {})), (options.amountUsd !== undefined ? { amountUsd: options.amountUsd } : {})), (options.minAmountOut !== undefined ? { minAmountOut: options.minAmountOut } : {})), (options.slippagePad !== undefined ? { slippagePad: options.slippagePad } : {})), extra));
|
|
6205
6280
|
}
|
|
6206
|
-
function resolveAddress(
|
|
6207
|
-
var _a
|
|
6281
|
+
function resolveAddress() {
|
|
6282
|
+
var _a;
|
|
6208
6283
|
const user = getCurrentUser();
|
|
6209
|
-
const address = (
|
|
6284
|
+
const address = (_a = user === null || user === void 0 ? void 0 : user.address) !== null && _a !== void 0 ? _a : undefined;
|
|
6210
6285
|
if (!address) {
|
|
6211
6286
|
throw new Error(user
|
|
6212
|
-
? 'onramp: the signed-in account has no wallet address
|
|
6213
|
-
: 'onramp: no signed-in user - call login() first
|
|
6287
|
+
? 'onramp: the signed-in account has no wallet address (create one via the embedded wallet flow)'
|
|
6288
|
+
: 'onramp: no signed-in user - call login() first');
|
|
6214
6289
|
}
|
|
6215
6290
|
return address;
|
|
6216
6291
|
}
|
|
@@ -6221,7 +6296,7 @@ function resolveAddress(options) {
|
|
|
6221
6296
|
async function onrampQuote(options = {}) {
|
|
6222
6297
|
if (!hasDOM())
|
|
6223
6298
|
throw new Error('onrampQuote is web-only');
|
|
6224
|
-
resolveAddress(
|
|
6299
|
+
resolveAddress();
|
|
6225
6300
|
const res = await authedFetch('/__bounded/onramp/session', {
|
|
6226
6301
|
method: 'POST',
|
|
6227
6302
|
headers: { 'content-type': 'application/json' },
|
|
@@ -6279,7 +6354,7 @@ async function onramp(options = {}) {
|
|
|
6279
6354
|
var _a;
|
|
6280
6355
|
if (!hasDOM())
|
|
6281
6356
|
throw new Error('onramp() is web-only');
|
|
6282
|
-
resolveAddress(
|
|
6357
|
+
resolveAddress();
|
|
6283
6358
|
// Open the window synchronously so the click's user-activation window is not
|
|
6284
6359
|
// consumed by the fetch below (same hard-won pattern as loginWithPopup).
|
|
6285
6360
|
let popup = null;
|
|
@@ -6502,84 +6577,12 @@ class PrivyExpoProvider {
|
|
|
6502
6577
|
setCurrentUser(user);
|
|
6503
6578
|
return user;
|
|
6504
6579
|
}
|
|
6505
|
-
async runTransaction(_evmTransactionData,
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
]);
|
|
6512
|
-
if (!solTransactionData) {
|
|
6513
|
-
throw new Error('Solana transaction data is required');
|
|
6514
|
-
}
|
|
6515
|
-
const wallet = await this.getWalletOrThrow();
|
|
6516
|
-
const rpcUrl = this.getRpcUrl(solTransactionData.network);
|
|
6517
|
-
const connection = new Connection(rpcUrl, 'confirmed');
|
|
6518
|
-
const remainingAccounts = core.convertRemainingAccounts(solTransactionData.txArgs[0].remainingAccounts);
|
|
6519
|
-
const app_id = solTransactionData.appId;
|
|
6520
|
-
if (!app_id) {
|
|
6521
|
-
throw new Error('App ID is required');
|
|
6522
|
-
}
|
|
6523
|
-
// Create a mock wallet adapter for Anchor (only publicKey needed for building TX)
|
|
6524
|
-
const walletPublicKey = new PublicKey(wallet.address);
|
|
6525
|
-
const walletAdapter = {
|
|
6526
|
-
publicKey: walletPublicKey,
|
|
6527
|
-
signTransaction: async (tx) => tx,
|
|
6528
|
-
signAllTransactions: async (txs) => txs,
|
|
6529
|
-
};
|
|
6530
|
-
const ProviderClass = programSdk[['Anch', 'orProvider'].join('')];
|
|
6531
|
-
const programProvider = new ProviderClass(connection, walletAdapter, ProviderClass.defaultOptions());
|
|
6532
|
-
const finalDeduped = [];
|
|
6533
|
-
for (const acc of remainingAccounts) {
|
|
6534
|
-
const existing = finalDeduped.find((d) => d.pubkey.equals(acc.pubkey));
|
|
6535
|
-
if (existing) {
|
|
6536
|
-
existing.isSigner = existing.isSigner || acc.isSigner;
|
|
6537
|
-
existing.isWritable = existing.isWritable || acc.isWritable;
|
|
6538
|
-
}
|
|
6539
|
-
else {
|
|
6540
|
-
finalDeduped.push(acc);
|
|
6541
|
-
}
|
|
6542
|
-
}
|
|
6543
|
-
const { tx, blockhash, lastValidBlockHeight } = await core.buildSetDocumentsTransaction(connection, solTransactionData.txArgs[0].idl, programProvider, walletPublicKey, {
|
|
6544
|
-
app_id,
|
|
6545
|
-
documents: solTransactionData.txArgs[0].setDocumentData,
|
|
6546
|
-
delete_paths: solTransactionData.txArgs[0].deletePaths,
|
|
6547
|
-
txData: solTransactionData.txArgs[0].txData,
|
|
6548
|
-
}, finalDeduped, solTransactionData.lutKey, solTransactionData.preInstructions, false, solTransactionData.additionalLutAddresses);
|
|
6549
|
-
// Set blockhash
|
|
6550
|
-
const isLegacyTx = 'recentBlockhash' in tx &&
|
|
6551
|
-
!('message' in tx && 'staticAccountKeys' in tx.message);
|
|
6552
|
-
if (isLegacyTx) {
|
|
6553
|
-
tx.recentBlockhash = blockhash;
|
|
6554
|
-
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
6555
|
-
}
|
|
6556
|
-
else {
|
|
6557
|
-
tx.message.recentBlockhash = blockhash;
|
|
6558
|
-
}
|
|
6559
|
-
try {
|
|
6560
|
-
if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {
|
|
6561
|
-
// Sign only — don't submit
|
|
6562
|
-
const signed = await wallet.signTransaction(tx);
|
|
6563
|
-
return {
|
|
6564
|
-
signedTransaction: signed.signedTransaction,
|
|
6565
|
-
blockNumber: 0,
|
|
6566
|
-
gasUsed: '0',
|
|
6567
|
-
data: '',
|
|
6568
|
-
};
|
|
6569
|
-
}
|
|
6570
|
-
// Sign and submit
|
|
6571
|
-
const { signature, txInfo } = await this.signAndSubmitInternal(tx, wallet, connection);
|
|
6572
|
-
return {
|
|
6573
|
-
transactionSignature: signature,
|
|
6574
|
-
blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,
|
|
6575
|
-
gasUsed: ((_a = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _a === void 0 ? void 0 : _a.fee.toString()) || '0',
|
|
6576
|
-
data: txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta,
|
|
6577
|
-
};
|
|
6578
|
-
}
|
|
6579
|
-
catch (err) {
|
|
6580
|
-
console.error(err);
|
|
6581
|
-
throw err;
|
|
6582
|
-
}
|
|
6580
|
+
async runTransaction(_evmTransactionData, _solTransactionData, _options) {
|
|
6581
|
+
// Client-side Solana transaction building is retired: the realtime
|
|
6582
|
+
// worker returns a fully-built (and, when sponsored, partially-signed)
|
|
6583
|
+
// transaction on its 202, which the SDK validates and signs via
|
|
6584
|
+
// signTransaction. This provider serves no EVM payload either.
|
|
6585
|
+
throw new Error('runTransaction is not supported by this provider; Bounded returns pre-built Solana transactions that are signed with signTransaction.');
|
|
6583
6586
|
}
|
|
6584
6587
|
async signMessage(message) {
|
|
6585
6588
|
await this.ensureReady();
|
|
@@ -6754,7 +6757,6 @@ exports.builds = builds;
|
|
|
6754
6757
|
exports.completeLoginFromRedirect = completeLoginFromRedirect;
|
|
6755
6758
|
exports.completeLoginInPopup = completeLoginInPopup;
|
|
6756
6759
|
exports.confirmAndCheckTransaction = confirmAndCheckTransaction;
|
|
6757
|
-
exports.deserializeTransaction = deserializeTransaction;
|
|
6758
6760
|
exports.getAuthLoading = getAuthLoading;
|
|
6759
6761
|
exports.getAuthProvider = getAuthProvider;
|
|
6760
6762
|
exports.getCurrentUser = getCurrentUser;
|
|
@@ -6784,4 +6786,4 @@ exports.signTransactionWithTurnkey = signTransactionWithTurnkey;
|
|
|
6784
6786
|
exports.useAuth = useAuth;
|
|
6785
6787
|
exports.useBuildRun = useBuildRun;
|
|
6786
6788
|
exports.useQuery = useQuery;
|
|
6787
|
-
//# sourceMappingURL=index.native-
|
|
6789
|
+
//# sourceMappingURL=index.native-CAHw3k3_.js.map
|