@bounded-sh/client 0.0.43 → 0.0.44
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/crossmint-signer-bridge.d.ts +8 -0
- package/dist/auth/providers/email-auth-provider.d.ts +1 -1
- package/dist/auth/providers/injected-evm-wallet-provider.d.ts +37 -0
- package/dist/auth/providers/injected-evm-wallet-types.d.ts +65 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +519 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +519 -25
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.js +517 -23
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +518 -24
- package/dist/index.native.mjs.map +1 -1
- package/package.json +128 -128
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EVMTransaction, TransactionResult } from '@bounded-sh/core';
|
|
1
2
|
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
3
|
export type SignerAction = {
|
|
3
4
|
kind: 'sendToken';
|
|
@@ -7,6 +8,9 @@ export type SignerAction = {
|
|
|
7
8
|
} | {
|
|
8
9
|
kind: 'transaction';
|
|
9
10
|
serializedTransaction: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'evmTransaction';
|
|
13
|
+
transaction: Pick<EVMTransaction, 'to' | 'data' | 'value' | 'chainId'>;
|
|
10
14
|
};
|
|
11
15
|
export interface SignerResult {
|
|
12
16
|
hash?: string;
|
|
@@ -29,9 +33,13 @@ export declare function signViaSignerPopup(action: SignerAction): Promise<Signer
|
|
|
29
33
|
* route signing through the popup rather than throw "no wallet").
|
|
30
34
|
*/
|
|
31
35
|
export declare function hasEmbeddedWallet(): boolean;
|
|
36
|
+
/** Whether the active email/social session carries an embedded Crossmint EVM wallet. */
|
|
37
|
+
export declare function hasEmbeddedEvmWallet(): boolean;
|
|
32
38
|
/** signAndSubmitTransaction for embedded wallets: serialize + route through the
|
|
33
39
|
* signer popup, resolve with the on-chain transaction signature/hash. */
|
|
34
40
|
export declare function embeddedSignAndSubmit(transaction: Transaction | VersionedTransaction): Promise<string>;
|
|
35
41
|
/** Send a token from the embedded wallet (Crossmint `wallet.send`). Convenience
|
|
36
42
|
* primitive for the common "send crypto" case; returns the tx result. */
|
|
37
43
|
export declare function embeddedSendToken(recipient: string, token: string, amount: string): Promise<SignerResult>;
|
|
44
|
+
/** Submit a validated BoundedRuntime EVM write through the user's email signer. */
|
|
45
|
+
export declare function embeddedRunEvmTransaction(transaction: EVMTransaction): Promise<TransactionResult>;
|
|
@@ -6,7 +6,7 @@ export declare class EmailAuthProvider implements AuthProvider {
|
|
|
6
6
|
restoreSession(): Promise<User | null>;
|
|
7
7
|
logout(): Promise<void>;
|
|
8
8
|
signMessage(_message: string): Promise<string>;
|
|
9
|
-
runTransaction(
|
|
9
|
+
runTransaction(evm?: EVMTransaction, sol?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
10
10
|
signTransaction(_t: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
11
11
|
signAndSubmitTransaction(transaction: Transaction | VersionedTransaction, _feePayer?: PublicKey): Promise<string>;
|
|
12
12
|
getNativeMethods(): Promise<any>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { EVMTransaction, SolTransaction, TransactionResult, User, AuthProvider, SetOptions } from '@bounded-sh/core';
|
|
2
|
+
import type { Transaction, VersionedTransaction, PublicKey } from '@solana/web3.js';
|
|
3
|
+
import { defaultInjectedEvmProvider, type InjectedEvmProvider, type InjectedEvmWalletConfig } from './injected-evm-wallet-types';
|
|
4
|
+
export { defaultInjectedEvmProvider };
|
|
5
|
+
export type { InjectedEvmProvider, InjectedEvmWalletConfig };
|
|
6
|
+
export declare class InjectedEvmWalletProvider implements AuthProvider {
|
|
7
|
+
private static instance;
|
|
8
|
+
private config;
|
|
9
|
+
private authenticatedAddress;
|
|
10
|
+
constructor(config?: InjectedEvmWalletConfig);
|
|
11
|
+
private evmUser;
|
|
12
|
+
private resolveProvider;
|
|
13
|
+
/** Connect the injected wallet and return its canonical lowercase EVM address. */
|
|
14
|
+
private connectAddress;
|
|
15
|
+
/** Current chain id the wallet is connected to (EIP-155 number), or null. */
|
|
16
|
+
private currentChainId;
|
|
17
|
+
login(): Promise<User | null>;
|
|
18
|
+
private resolveDomain;
|
|
19
|
+
private resolveUri;
|
|
20
|
+
private markAuthMethod;
|
|
21
|
+
restoreSession(): Promise<User | null>;
|
|
22
|
+
logout(): Promise<void>;
|
|
23
|
+
/** App-facing message signing: EIP-191 personal_sign, returns 0x r‖s‖v hex. */
|
|
24
|
+
signMessage(message: string): Promise<string>;
|
|
25
|
+
signTransaction(_transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
|
|
26
|
+
signAndSubmitTransaction(_transaction: Transaction | VersionedTransaction, _feePayer?: PublicKey): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Onchain write path: submit the worker's PRE-BUILT EIP-1559 tx via
|
|
29
|
+
* eth_sendTransaction (the injected wallet signs + submits in one step), then
|
|
30
|
+
* poll for the receipt. The EVM branch of operations.ts's 202 dispatch calls
|
|
31
|
+
* this with the pre-built payload in the EVM slot and the Solana slot undefined.
|
|
32
|
+
*/
|
|
33
|
+
runTransaction(evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
34
|
+
/** Poll eth_getTransactionReceipt until it lands (bounded retries) or throw. */
|
|
35
|
+
private waitForReceipt;
|
|
36
|
+
getNativeMethods(): Promise<any>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal EIP-1193 provider shape. Every browser EVM wallet implements
|
|
3
|
+
* `request({ method, params })`; `on`/`removeListener` are optional (used for
|
|
4
|
+
* chain/account change events, which this path does not require).
|
|
5
|
+
*/
|
|
6
|
+
export interface InjectedEvmProvider {
|
|
7
|
+
request(args: {
|
|
8
|
+
method: string;
|
|
9
|
+
params?: any[] | Record<string, any>;
|
|
10
|
+
}): Promise<any>;
|
|
11
|
+
on?(event: string, listener: (...args: any[]) => void): void;
|
|
12
|
+
removeListener?(event: string, listener: (...args: any[]) => void): void;
|
|
13
|
+
isMetaMask?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** EIP-6963 provider metadata announced by a wallet. */
|
|
16
|
+
export interface Eip6963ProviderInfo {
|
|
17
|
+
uuid: string;
|
|
18
|
+
name: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
rdns: string;
|
|
21
|
+
}
|
|
22
|
+
/** EIP-6963 `eip6963:announceProvider` detail payload. */
|
|
23
|
+
export interface Eip6963ProviderDetail {
|
|
24
|
+
info: Eip6963ProviderInfo;
|
|
25
|
+
provider: InjectedEvmProvider;
|
|
26
|
+
}
|
|
27
|
+
export interface InjectedEvmWalletConfig {
|
|
28
|
+
/**
|
|
29
|
+
* Resolve/pick the injected EVM provider. Defaults to EIP-6963 discovery
|
|
30
|
+
* (first announced wallet) then `window.ethereum`. Pass this to point at a
|
|
31
|
+
* specific wallet, or to bridge a custom/mock provider.
|
|
32
|
+
*/
|
|
33
|
+
getProvider?: () => InjectedEvmProvider | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* EIP-155 chain id the app expects to write on. Used for the SIWE `Chain ID`
|
|
36
|
+
* line and as the chain-switch guard target in runTransaction (a pre-built tx
|
|
37
|
+
* always carries its own chainId, which takes precedence there).
|
|
38
|
+
*/
|
|
39
|
+
chainId?: number;
|
|
40
|
+
/** Explicit RPC URL override (reserved; the injected wallet submits via itself). */
|
|
41
|
+
rpcUrl?: string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Optional assertion of the SIWE `domain`. It must equal
|
|
44
|
+
* window.location.host; cross-origin overrides are rejected.
|
|
45
|
+
*/
|
|
46
|
+
domain?: string;
|
|
47
|
+
/** Optional assertion of the SIWE URI. Its origin must equal window.location.origin. */
|
|
48
|
+
uri?: string;
|
|
49
|
+
/** Trusted BoundedRuntime for `chainId`; required for single-chain writes. */
|
|
50
|
+
runtimeAddress?: string;
|
|
51
|
+
/** Trusted per-chain BoundedRuntime allowlist for multi-chain writes. */
|
|
52
|
+
runtimeAddresses?: Record<string, string>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Request + collect EIP-6963 providers. Dispatches `eip6963:requestProvider`
|
|
56
|
+
* (synchronous — already-loaded wallets announce in the same tick) and returns
|
|
57
|
+
* every wallet announced so far. Kept synchronous so it works inside a user
|
|
58
|
+
* gesture and can be eagerly exported from the SDK entry.
|
|
59
|
+
*/
|
|
60
|
+
export declare function requestEip6963Providers(): Eip6963ProviderDetail[];
|
|
61
|
+
/**
|
|
62
|
+
* Default EVM provider discovery: EIP-6963 first (multi-wallet, collision-free),
|
|
63
|
+
* then legacy `window.ethereum`. Returns null when no injected wallet is present.
|
|
64
|
+
*/
|
|
65
|
+
export declare function defaultInjectedEvmProvider(): InjectedEvmProvider | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -23,3 +23,6 @@ export type { PrivyExpoMethods } from "./auth/providers/privy-expo-provider";
|
|
|
23
23
|
export { defaultInjectedProvider } from "./auth/providers/injected-wallet-types";
|
|
24
24
|
export type { InjectedWalletConfig, InjectedSolanaProvider, } from "./auth/providers/injected-wallet-types";
|
|
25
25
|
export type { InjectedWalletProvider } from "./auth/providers/injected-wallet-provider";
|
|
26
|
+
export { defaultInjectedEvmProvider, requestEip6963Providers, } from "./auth/providers/injected-evm-wallet-types";
|
|
27
|
+
export type { InjectedEvmWalletConfig, InjectedEvmProvider, Eip6963ProviderDetail, Eip6963ProviderInfo, } from "./auth/providers/injected-evm-wallet-types";
|
|
28
|
+
export type { InjectedEvmWalletProvider } from "./auth/providers/injected-evm-wallet-provider";
|