@thru/wallet 0.2.22
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 +67 -0
- package/android/build.gradle +37 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/org/thru/walletnative/ThruWebViewBridgeModule.kt +77 -0
- package/app.plugin.cjs +101 -0
- package/dist/BrowserSDK-CpRFiJsW.d.ts +409 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +941 -0
- package/dist/index.js.map +1 -0
- package/dist/native/react.d.ts +109 -0
- package/dist/native/react.js +2381 -0
- package/dist/native/react.js.map +1 -0
- package/dist/native.d.ts +329 -0
- package/dist/native.js +1126 -0
- package/dist/native.js.map +1 -0
- package/dist/react-ui.d.ts +5 -0
- package/dist/react-ui.js +266 -0
- package/dist/react-ui.js.map +1 -0
- package/dist/react.d.ts +66 -0
- package/dist/react.js +1151 -0
- package/dist/react.js.map +1 -0
- package/expo-module.config.json +6 -0
- package/package.json +114 -0
- package/src/BrowserSDK.ts +315 -0
- package/src/index.ts +27 -0
- package/src/interfaces/IThruChain.ts +37 -0
- package/src/interfaces/accounts.ts +61 -0
- package/src/interfaces/index.ts +9 -0
- package/src/interfaces/types.ts +95 -0
- package/src/native/NativeSDK.test.ts +819 -0
- package/src/native/NativeSDK.ts +773 -0
- package/src/native/index.ts +39 -0
- package/src/native/provider/NativeProvider.ts +363 -0
- package/src/native/provider/WebViewBridge.test.ts +339 -0
- package/src/native/provider/WebViewBridge.ts +339 -0
- package/src/native/provider/chains/ThruChain.ts +85 -0
- package/src/native/provider/shell.html +88 -0
- package/src/native/provider/shell.test.ts +56 -0
- package/src/native/provider/shell.ts +111 -0
- package/src/native/provider/shims-html.d.ts +4 -0
- package/src/native/react/ThruContext.ts +37 -0
- package/src/native/react/ThruProvider.tsx +168 -0
- package/src/native/react/ThruWalletSheet.tsx +1162 -0
- package/src/native/react/android-webauthn.ts +37 -0
- package/src/native/react/hooks/useAccounts.ts +35 -0
- package/src/native/react/hooks/useThru.ts +11 -0
- package/src/native/react/hooks/useWallet.ts +71 -0
- package/src/native/react/hooks/useWalletAvailability.ts +31 -0
- package/src/native/react/hooks/waitForWallet.ts +21 -0
- package/src/native/react/index.ts +29 -0
- package/src/protocol/index.ts +2 -0
- package/src/protocol/postMessage.ts +283 -0
- package/src/protocol/walletState.ts +12 -0
- package/src/provider/EmbeddedProvider.ts +330 -0
- package/src/provider/IframeManager.ts +438 -0
- package/src/provider/chains/ThruChain.ts +86 -0
- package/src/provider/index.ts +17 -0
- package/src/provider/types/messages.ts +37 -0
- package/src/react/ThruContext.ts +31 -0
- package/src/react/ThruProvider.tsx +169 -0
- package/src/react/hooks/useAccounts.ts +38 -0
- package/src/react/hooks/useThru.ts +11 -0
- package/src/react/hooks/useWallet.ts +81 -0
- package/src/react/index.ts +30 -0
- package/src/react-ui/ThruAccountSwitcher.tsx +187 -0
- package/src/react-ui/custom.d.ts +8 -0
- package/src/react-ui/index.ts +1 -0
- package/src/static/logo.png +0 -0
- package/src/static/logomark_red.svg +11 -0
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { B as BrowserSDK, a0 as WalletAccount, v as ManageAccountsResult, b as BrowserSDKConfig, s as IThruChain, d as ConnectOptions, g as ConnectResult } from './BrowserSDK-CpRFiJsW.js';
|
|
2
|
+
export { l as ErrorCode, S as SDKEvent, K as SignMessageParams, O as SignMessageResult, W as ThruSigningContext, X as ThruTransactionEncoding } from './BrowserSDK-CpRFiJsW.js';
|
|
3
|
+
import { Thru } from '@thru/sdk/client';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
interface ThruContextValue {
|
|
8
|
+
wallet: BrowserSDK | null;
|
|
9
|
+
isConnected: boolean;
|
|
10
|
+
accounts: WalletAccount[];
|
|
11
|
+
isConnecting: boolean;
|
|
12
|
+
error: Error | null;
|
|
13
|
+
thru: Thru | null;
|
|
14
|
+
selectedAccount: WalletAccount | null;
|
|
15
|
+
selectAccount: (account: WalletAccount) => Promise<void>;
|
|
16
|
+
manageAccounts: () => Promise<ManageAccountsResult>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ThruProviderProps {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
config: BrowserSDKConfig;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* ThruProvider - React context provider for Thru Wallet SDK
|
|
25
|
+
* Wraps the BrowserSDK and exposes state via context
|
|
26
|
+
*/
|
|
27
|
+
declare function ThruProvider({ children, config }: ThruProviderProps): react.JSX.Element;
|
|
28
|
+
|
|
29
|
+
interface UseAccountsResult {
|
|
30
|
+
accounts: WalletAccount[];
|
|
31
|
+
selectedAccount: WalletAccount | null;
|
|
32
|
+
isConnected: boolean;
|
|
33
|
+
isConnecting: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface UseAccountsOptions {
|
|
36
|
+
onAccountSelect?: (account: WalletAccount) => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* useAccounts - Exposes connected wallet accounts and selection helpers.
|
|
40
|
+
*/
|
|
41
|
+
declare function useAccounts(options?: UseAccountsOptions): UseAccountsResult;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* useThru - Access the Thru SDK context
|
|
45
|
+
* Must be used within a ThruProvider
|
|
46
|
+
*/
|
|
47
|
+
declare function useThru(): ThruContextValue;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* useThruChain - Hook for accessing the Thru chain API exposed by the Browser SDK.
|
|
51
|
+
* Returns the chain instance (if available) and a boolean indicating readiness.
|
|
52
|
+
*/
|
|
53
|
+
declare function useWallet(): {
|
|
54
|
+
wallet: IThruChain | undefined;
|
|
55
|
+
accounts: WalletAccount[];
|
|
56
|
+
connect: (options?: ConnectOptions) => Promise<ConnectResult>;
|
|
57
|
+
disconnect: () => Promise<void>;
|
|
58
|
+
mountInline: (container: HTMLElement) => Promise<void>;
|
|
59
|
+
manageAccounts: () => Promise<ManageAccountsResult>;
|
|
60
|
+
isConnected: boolean;
|
|
61
|
+
isConnecting: boolean;
|
|
62
|
+
selectedAccount: WalletAccount | null;
|
|
63
|
+
selectAccount: (account: WalletAccount) => Promise<void>;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export { BrowserSDK, BrowserSDKConfig, ConnectOptions, ConnectResult, IThruChain, type ThruContextValue, ThruProvider, type ThruProviderProps, type UseAccountsOptions, type UseAccountsResult, WalletAccount, useAccounts, useThru, useWallet };
|