@bounded-sh/client 0.0.36 → 0.0.38
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/README.md +20 -1
- package/dist/auth/hooks/useAuth.d.ts +2 -1
- package/dist/auth/providers/offchain-auth-provider.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +49 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -13
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.d.ts +2 -0
- package/dist/index.native.js +49 -12
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +34 -13
- package/dist/index.native.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.native.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getActiveSessionManager, genAuthNonce, genSolanaMessage, createSessionWithSignature, getConfig, WebSessionManager, ReactNativeSessionManager, revokeSession, init as init$1, reconnectWithNewAuth, deriveUserIdentityFromIdToken, getIdToken as getIdToken$1, convertRemainingAccounts, buildSetDocumentsTransaction } from '@bounded-sh/core';
|
|
2
2
|
export * from '@bounded-sh/core';
|
|
3
|
-
export { aggregate, count, docId, get, getConfig, getFiles, getMany, queryAggregate, runExpression, runExpressionMany, runQuery, runQueryMany, search, set, setFile, setMany, signAndSubmitTransaction, signMessage, signTransaction, subscribe } from '@bounded-sh/core';
|
|
3
|
+
export { BoundedDeclineError, DECLINE_EVENT_NAME, aggregate, count, deriveDecline, dispatchDeclineEvent, docId, get, getConfig, getFiles, getMany, queryAggregate, runExpression, runExpressionMany, runQuery, runQueryMany, search, set, setFile, setMany, signAndSubmitTransaction, signMessage, signTransaction, subscribe } from '@bounded-sh/core';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { VersionedTransaction, Transaction, Connection, PublicKey } from '@solana/web3.js';
|
|
6
6
|
import * as anchor from '@coral-xyz/anchor';
|
|
@@ -145,6 +145,15 @@ class OffchainAuthProvider {
|
|
|
145
145
|
}
|
|
146
146
|
return null;
|
|
147
147
|
}
|
|
148
|
+
// Forward per-call login overrides (theme/title/subtitle and the `method`
|
|
149
|
+
// directive) to the wrapped provider. Without this, the top-level login()
|
|
150
|
+
// forwarder (which duck-types `setLoginOverrides` on the active provider)
|
|
151
|
+
// skips the wrapper and the override — including `method` — is dropped on
|
|
152
|
+
// offchain/Poofnet builds.
|
|
153
|
+
setLoginOverrides(opts) {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
(_b = (_a = this.wrappedProvider).setLoginOverrides) === null || _b === void 0 ? void 0 : _b.call(_a, opts);
|
|
156
|
+
}
|
|
148
157
|
async logout() {
|
|
149
158
|
await this.wrappedProvider.logout();
|
|
150
159
|
}
|
|
@@ -178,6 +187,15 @@ class OffchainAuthProvider {
|
|
|
178
187
|
async getNativeMethods() {
|
|
179
188
|
return this.wrappedProvider.getNativeMethods();
|
|
180
189
|
}
|
|
190
|
+
// Forward wallet export to the wrapped provider (only Privy embedded wallets
|
|
191
|
+
// implement it). Duck-typed so wrappers around non-embedded providers throw
|
|
192
|
+
// a clear error rather than a "not a function" crash.
|
|
193
|
+
async exportWallet(address) {
|
|
194
|
+
if (typeof this.wrappedProvider.exportWallet !== 'function') {
|
|
195
|
+
throw new Error('Wallet export is not available for this wallet.');
|
|
196
|
+
}
|
|
197
|
+
await this.wrappedProvider.exportWallet(address);
|
|
198
|
+
}
|
|
181
199
|
// ============ signMessage delegates to wrapped provider ============
|
|
182
200
|
async signMessage(message) {
|
|
183
201
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -3407,7 +3425,7 @@ const IDB_STORE = 'keys';
|
|
|
3407
3425
|
const IDB_KEY = 'ed25519';
|
|
3408
3426
|
const GUEST_KEY_REQUIREMENT = 'Guest auth requires non-extractable WebCrypto Ed25519 keys persisted in IndexedDB; ' +
|
|
3409
3427
|
'stored-secret guest credentials are disabled.';
|
|
3410
|
-
function toBase64
|
|
3428
|
+
function toBase64(bytes) {
|
|
3411
3429
|
let bin = '';
|
|
3412
3430
|
for (let i = 0; i < bytes.length; i++)
|
|
3413
3431
|
bin += String.fromCharCode(bytes[i]);
|
|
@@ -3471,7 +3489,7 @@ async function webCryptoKey() {
|
|
|
3471
3489
|
async sign(message) {
|
|
3472
3490
|
const data = new TextEncoder().encode(message);
|
|
3473
3491
|
const sig = new Uint8Array(await s.sign({ name: 'Ed25519' }, pair.privateKey, data));
|
|
3474
|
-
return toBase64
|
|
3492
|
+
return toBase64(sig);
|
|
3475
3493
|
},
|
|
3476
3494
|
};
|
|
3477
3495
|
}
|
|
@@ -3747,19 +3765,22 @@ async function signViaSignerPopup(action) {
|
|
|
3747
3765
|
} }, 5 * 60 * 1000);
|
|
3748
3766
|
});
|
|
3749
3767
|
}
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
//
|
|
3754
|
-
//
|
|
3755
|
-
//
|
|
3768
|
+
// Serialize a legacy or versioned Solana transaction to BASE58 for the signer
|
|
3769
|
+
// page. Crossmint's smart-wallet createTransaction endpoint requires the
|
|
3770
|
+
// `serializedTransaction` string to be base58 — it rejects base64 with
|
|
3771
|
+
// "Invalid base58 string" (verified against Crossmint staging 2026-07-07). The
|
|
3772
|
+
// `wallets-sdk` object path bs58-encodes internally, so base58 is the contract.
|
|
3773
|
+
//
|
|
3774
|
+
// We do NOT require existing signatures (the smart wallet signs on the page);
|
|
3775
|
+
// Crossmint extracts the instructions, overrides the fee payer to its sponsor,
|
|
3776
|
+
// and re-wraps them for the smart wallet.
|
|
3756
3777
|
function serializeTransaction(transaction) {
|
|
3757
3778
|
const isLegacy = 'recentBlockhash' in transaction &&
|
|
3758
3779
|
!('message' in transaction && 'staticAccountKeys' in transaction.message);
|
|
3759
3780
|
const bytes = isLegacy
|
|
3760
3781
|
? transaction.serialize({ requireAllSignatures: false, verifySignatures: false })
|
|
3761
3782
|
: transaction.serialize();
|
|
3762
|
-
return
|
|
3783
|
+
return bs58.encode(bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes));
|
|
3763
3784
|
}
|
|
3764
3785
|
/**
|
|
3765
3786
|
* Whether the active session carries an embedded wallet (so the provider should
|
|
@@ -4844,7 +4865,7 @@ function useAuth() {
|
|
|
4844
4865
|
// Provide a fallback so server render doesn't break
|
|
4845
4866
|
if (isSSR) {
|
|
4846
4867
|
return {
|
|
4847
|
-
login: async () => undefined,
|
|
4868
|
+
login: async (_options) => undefined,
|
|
4848
4869
|
logout: async () => undefined,
|
|
4849
4870
|
loading: true,
|
|
4850
4871
|
user: null,
|
|
@@ -4866,10 +4887,10 @@ function useAuth() {
|
|
|
4866
4887
|
stopLoading();
|
|
4867
4888
|
};
|
|
4868
4889
|
}, []);
|
|
4869
|
-
const login$1 = async () => {
|
|
4890
|
+
const login$1 = async (options) => {
|
|
4870
4891
|
try {
|
|
4871
4892
|
setLoading(true);
|
|
4872
|
-
const user = await login();
|
|
4893
|
+
const user = await login(options);
|
|
4873
4894
|
setUser(user);
|
|
4874
4895
|
}
|
|
4875
4896
|
catch (error) {
|