@ton-pay/ui-react 0.1.2 → 0.2.0-beta.2
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 +126 -98
- package/dist/index.d.mts +257 -28
- package/dist/index.d.ts +257 -28
- package/dist/index.js +3217 -319
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3155 -257
- package/dist/index.mjs.map +1 -1
- package/package.json +25 -6
package/README.md
CHANGED
|
@@ -1,145 +1,173 @@
|
|
|
1
1
|
# @ton-pay/ui-react
|
|
2
2
|
|
|
3
|
-
React components and hooks for TON
|
|
4
|
-
|
|
5
|
-
## Documentation
|
|
6
|
-
|
|
7
|
-
Full documentation: https://docs.tonpay.tech
|
|
3
|
+
Professional React components and hooks for integrating TON blockchain payments into your application.
|
|
8
4
|
|
|
9
5
|
## Installation
|
|
10
6
|
|
|
11
7
|
```bash
|
|
12
|
-
npm install @ton-pay/ui-react @tonconnect/ui-react
|
|
8
|
+
npm install @ton-pay/ui-react @ton-pay/api @tonconnect/ui-react
|
|
13
9
|
```
|
|
14
10
|
|
|
15
11
|
## Quick Start
|
|
16
12
|
|
|
17
|
-
### Basic Usage
|
|
18
|
-
|
|
19
13
|
```tsx
|
|
20
|
-
import {
|
|
14
|
+
import { TonConnectUIProvider } from "@tonconnect/ui-react";
|
|
15
|
+
import { TonPayButton, useTonPay } from "@ton-pay/ui-react";
|
|
21
16
|
import { createTonPayTransfer, TON } from "@ton-pay/api";
|
|
22
|
-
|
|
17
|
+
|
|
18
|
+
function App() {
|
|
19
|
+
return (
|
|
20
|
+
<TonConnectUIProvider manifestUrl="https://your-app.com/tonconnect-manifest.json">
|
|
21
|
+
<PaymentForm />
|
|
22
|
+
</TonConnectUIProvider>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
23
25
|
|
|
24
26
|
function PaymentForm() {
|
|
25
|
-
const
|
|
27
|
+
const { pay } = useTonPay();
|
|
26
28
|
|
|
27
29
|
const handlePay = async () => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
await pay(async (senderAddr) => {
|
|
31
|
+
return createTonPayTransfer(
|
|
32
|
+
{
|
|
33
|
+
amount: 10.5,
|
|
34
|
+
asset: TON,
|
|
35
|
+
recipientAddr: "EQC...",
|
|
36
|
+
senderAddr,
|
|
37
|
+
commentToSender: "Payment for order #123",
|
|
38
|
+
},
|
|
39
|
+
{ chain: "mainnet", apiKey: "your-api-key" }
|
|
40
|
+
);
|
|
41
|
+
});
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
return <TonPayButton handlePay={handlePay} />;
|
|
43
45
|
}
|
|
44
46
|
```
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
## Components
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
<TonPayButton preset="gradient" variant="long" handlePay={handlePay} />
|
|
50
|
-
```
|
|
50
|
+
### TonPayButton
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
Complete payment button with wallet connection, loading states, and error handling.
|
|
53
53
|
|
|
54
54
|
```tsx
|
|
55
55
|
<TonPayButton
|
|
56
|
-
bgColor="#000000"
|
|
57
|
-
textColor="#FFFFFF"
|
|
58
|
-
borderRadius={99}
|
|
59
|
-
variant="short"
|
|
60
56
|
handlePay={handlePay}
|
|
57
|
+
variant="long"
|
|
58
|
+
preset="gradient"
|
|
59
|
+
amount={10.5}
|
|
60
|
+
currency="TON"
|
|
61
61
|
/>
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
#### Props
|
|
65
|
+
|
|
66
|
+
| Prop | Type | Default | Description |
|
|
67
|
+
|------|------|---------|-------------|
|
|
68
|
+
| `handlePay` | `() => Promise<void>` | **required** | Payment handler |
|
|
69
|
+
| `isLoading` | `boolean` | `false` | Loading state |
|
|
70
|
+
| `variant` | `"long" \| "short"` | `"long"` | Button text variant |
|
|
71
|
+
| `preset` | `"default" \| "gradient"` | - | Theme preset |
|
|
72
|
+
| `bgColor` | `string` | `"#0098EA"` | Background color |
|
|
73
|
+
| `textColor` | `string` | `"#FFFFFF"` | Text color |
|
|
74
|
+
| `borderRadius` | `number \| string` | `8` | Border radius |
|
|
75
|
+
| `width` | `number \| string` | `300` | Button width |
|
|
76
|
+
| `height` | `number \| string` | `44` | Button height |
|
|
77
|
+
| `disabled` | `boolean` | `false` | Disabled state |
|
|
78
|
+
| `amount` | `number \| string` | - | Payment amount |
|
|
79
|
+
| `currency` | `string` | `"TON"` | Currency code |
|
|
80
|
+
| `apiKey` | `string` | - | API key for on-ramp |
|
|
81
|
+
| `onError` | `(error: unknown) => void` | - | Error callback |
|
|
82
|
+
| `showErrorNotification` | `boolean` | `true` | Show error toast |
|
|
83
|
+
|
|
84
|
+
## Hooks
|
|
85
|
+
|
|
86
|
+
### useTonPay
|
|
87
|
+
|
|
88
|
+
Core hook for TON wallet integration and payments.
|
|
65
89
|
|
|
66
90
|
```tsx
|
|
67
|
-
|
|
68
|
-
|
|
91
|
+
const { pay, address } = useTonPay();
|
|
92
|
+
|
|
93
|
+
const handlePayment = async () => {
|
|
94
|
+
const result = await pay(async (senderAddr) => {
|
|
95
|
+
return createTonPayTransfer({
|
|
96
|
+
amount: 10.5,
|
|
97
|
+
asset: TON,
|
|
98
|
+
recipientAddr: "EQC...",
|
|
99
|
+
senderAddr,
|
|
100
|
+
}, { chain: "mainnet", apiKey: "your-api-key" });
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
console.log("Transaction:", result.txResult);
|
|
104
|
+
};
|
|
105
|
+
```
|
|
69
106
|
|
|
70
|
-
|
|
71
|
-
const { pay, address } = useTonPay();
|
|
107
|
+
### useMoonPayIframe
|
|
72
108
|
|
|
73
|
-
|
|
74
|
-
const result = await pay(async (senderAddr) => {
|
|
75
|
-
const transfer = await createTonPayTransfer(
|
|
76
|
-
{
|
|
77
|
-
amount: 10.5,
|
|
78
|
-
asset: TON,
|
|
79
|
-
recipientAddr: "EQC...", // Optional if API key is provided
|
|
80
|
-
senderAddr,
|
|
81
|
-
commentToSender: "Payment for order #123",
|
|
82
|
-
},
|
|
83
|
-
{ chain: "mainnet", apiKey: "your-api-key" }
|
|
84
|
-
);
|
|
109
|
+
Hook for MoonPay on-ramp integration.
|
|
85
110
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
111
|
+
```tsx
|
|
112
|
+
const {
|
|
113
|
+
checkAvailability,
|
|
114
|
+
fetchOnRampLink,
|
|
115
|
+
loading
|
|
116
|
+
} = useMoonPayIframe({
|
|
117
|
+
apiKey: "your-api-key",
|
|
118
|
+
chain: "mainnet",
|
|
119
|
+
});
|
|
120
|
+
```
|
|
89
121
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
122
|
+
## Styling
|
|
123
|
+
|
|
124
|
+
### Presets
|
|
125
|
+
|
|
126
|
+
Built-in theme presets:
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
<TonPayButton preset="default" /> // Blue solid
|
|
130
|
+
<TonPayButton preset="gradient" /> // Blue gradient
|
|
97
131
|
```
|
|
98
132
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
- **Highly Customizable** - Background color, text color, border radius, font family
|
|
102
|
-
- **Presets** - Built-in themes (default, gradient) matching Figma designs
|
|
103
|
-
- **Variants** - Long ("Pay with TON Pay") and Short ("TON Pay") text options
|
|
104
|
-
- **Loading States** - Built-in spinner and loading text
|
|
105
|
-
- **Wallet Integration** - Connect, disconnect, copy address via dropdown menu
|
|
106
|
-
- **Responsive** - Flexible width and height
|
|
107
|
-
- **Zero Config** - Works out of the box with sensible defaults
|
|
108
|
-
|
|
109
|
-
## Props
|
|
110
|
-
|
|
111
|
-
| Prop | Type | Default | Description |
|
|
112
|
-
| -------------- | ------------------------- | ----------------- | ---------------------------- |
|
|
113
|
-
| `handlePay` | `() => Promise<void>` | **required** | Payment handler function |
|
|
114
|
-
| `isLoading` | `boolean` | `false` | Loading state |
|
|
115
|
-
| `variant` | `"long" \| "short"` | `"long"` | Button text variant |
|
|
116
|
-
| `preset` | `"default" \| "gradient"` | - | Predefined theme preset |
|
|
117
|
-
| `bgColor` | `string` | `"#0098EA"` | Background (hex or gradient) |
|
|
118
|
-
| `textColor` | `string` | `"#FFFFFF"` | Text color |
|
|
119
|
-
| `borderRadius` | `number \| string` | `8` | Border radius |
|
|
120
|
-
| `fontFamily` | `string` | `"inherit"` | Font family |
|
|
121
|
-
| `width` | `number \| string` | `300` | Button width |
|
|
122
|
-
| `height` | `number \| string` | `44` | Button height |
|
|
123
|
-
| `loadingText` | `string` | `"Processing..."` | Loading state text |
|
|
124
|
-
| `showMenu` | `boolean` | `false` | Show dropdown menu |
|
|
125
|
-
| `disabled` | `boolean` | `false` | Disabled state |
|
|
126
|
-
| `style` | `Record<string, any>` | - | Additional styles |
|
|
127
|
-
| `className` | `string` | - | Additional CSS class |
|
|
128
|
-
|
|
129
|
-
## Visual Showcase
|
|
130
|
-
|
|
131
|
-
Run the interactive button showcase to see all variants and styling options:
|
|
133
|
+
### Custom Styling
|
|
132
134
|
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
+
```tsx
|
|
136
|
+
<TonPayButton
|
|
137
|
+
bgColor="#000000"
|
|
138
|
+
textColor="#FFFFFF"
|
|
139
|
+
borderRadius={99}
|
|
140
|
+
fontFamily="'SF Pro Display', sans-serif"
|
|
141
|
+
width={280}
|
|
142
|
+
height={48}
|
|
143
|
+
/>
|
|
135
144
|
```
|
|
136
145
|
|
|
137
|
-
|
|
146
|
+
### CSS Variables
|
|
138
147
|
|
|
139
|
-
|
|
148
|
+
The button uses CSS variables for theming:
|
|
149
|
+
|
|
150
|
+
```css
|
|
151
|
+
--tp-bg: #0098EA;
|
|
152
|
+
--tp-text: #FFFFFF;
|
|
153
|
+
--tp-radius: 8px;
|
|
154
|
+
--tp-font: inherit;
|
|
155
|
+
--tp-width: 300px;
|
|
156
|
+
--tp-height: 44px;
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## TypeScript
|
|
140
160
|
|
|
141
|
-
|
|
142
|
-
|
|
161
|
+
Full TypeScript support with exported types:
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
import type {
|
|
165
|
+
TonPayButtonProps,
|
|
166
|
+
PayInfo,
|
|
167
|
+
GetMessageFn,
|
|
168
|
+
TonPayMessage,
|
|
169
|
+
} from "@ton-pay/ui-react";
|
|
170
|
+
```
|
|
143
171
|
|
|
144
172
|
## License
|
|
145
173
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
1
3
|
import { SendTransactionRequest, SendTransactionResponse } from '@tonconnect/sdk';
|
|
4
|
+
import { Chain, CreateMoonpayTransferParams, MoonpayGeoResult, MoonpayAmountLimits } from '@ton-pay/api';
|
|
5
|
+
export { Chain } from '@ton-pay/api';
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
7
|
|
|
3
8
|
type TonPayPreset = "default" | "gradient";
|
|
4
|
-
type
|
|
9
|
+
type TonPayVariant = "long" | "short";
|
|
10
|
+
type OnRampProvider = "moonpay";
|
|
11
|
+
type TonPayMessage = SendTransactionRequest["messages"][number] & {
|
|
12
|
+
payload: string;
|
|
13
|
+
};
|
|
14
|
+
type GetMessageFn<T extends object = object> = (senderAddr: string) => Promise<{
|
|
15
|
+
message: TonPayMessage;
|
|
16
|
+
} & T>;
|
|
17
|
+
type PayInfo<T extends object = object> = {
|
|
18
|
+
message: TonPayMessage;
|
|
19
|
+
txResult: SendTransactionResponse;
|
|
20
|
+
} & T;
|
|
21
|
+
interface TonPayButtonProps {
|
|
5
22
|
handlePay: () => Promise<void>;
|
|
6
23
|
isLoading?: boolean;
|
|
7
|
-
variant?:
|
|
24
|
+
variant?: TonPayVariant;
|
|
8
25
|
preset?: TonPayPreset;
|
|
9
26
|
onError?: (error: unknown) => void;
|
|
10
27
|
showErrorNotification?: boolean;
|
|
@@ -16,47 +33,259 @@ type TonPayButtonProps = {
|
|
|
16
33
|
height?: number | string;
|
|
17
34
|
text?: string;
|
|
18
35
|
loadingText?: string;
|
|
19
|
-
style?:
|
|
36
|
+
style?: CSSProperties;
|
|
20
37
|
className?: string;
|
|
21
38
|
showMenu?: boolean;
|
|
22
39
|
disabled?: boolean;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
amount?: number | string;
|
|
41
|
+
currency?: string;
|
|
42
|
+
apiKey?: string;
|
|
43
|
+
isOnRampAvailable?: boolean;
|
|
44
|
+
onCardPaymentSuccess?: () => void;
|
|
45
|
+
itemTitle?: string;
|
|
46
|
+
}
|
|
47
|
+
interface NotificationProps {
|
|
27
48
|
title: string;
|
|
28
49
|
text?: string;
|
|
29
|
-
icon?:
|
|
50
|
+
icon?: ReactNode;
|
|
30
51
|
className?: string;
|
|
31
|
-
style?:
|
|
32
|
-
}
|
|
52
|
+
style?: CSSProperties;
|
|
53
|
+
}
|
|
54
|
+
interface PaymentModalProps {
|
|
55
|
+
isOpen: boolean;
|
|
56
|
+
onClose: () => void;
|
|
57
|
+
onPayWithCrypto: () => void;
|
|
58
|
+
amount?: string;
|
|
59
|
+
currency?: string;
|
|
60
|
+
itemTitle?: string;
|
|
61
|
+
walletAddress?: string;
|
|
62
|
+
onDisconnect?: () => void;
|
|
63
|
+
fetchOnRampLink?: (providerId: string) => Promise<string>;
|
|
64
|
+
onRampAvailable?: boolean;
|
|
65
|
+
onPaymentSuccess?: () => void;
|
|
66
|
+
}
|
|
67
|
+
type PaymentViewState = "main" | "card" | "success" | "error";
|
|
68
|
+
interface BottomSheetProps {
|
|
69
|
+
isOpen: boolean;
|
|
70
|
+
onClose: () => void;
|
|
71
|
+
detents?: number[];
|
|
72
|
+
initialDetent?: number;
|
|
73
|
+
children: ReactNode;
|
|
74
|
+
className?: string;
|
|
75
|
+
backdropClassName?: string;
|
|
76
|
+
handleClassName?: string;
|
|
77
|
+
contentClassName?: string;
|
|
78
|
+
enableBackdropClose?: boolean;
|
|
79
|
+
enableSwipeToClose?: boolean;
|
|
80
|
+
maxHeight?: number | string;
|
|
81
|
+
minHeight?: number | string;
|
|
82
|
+
}
|
|
83
|
+
interface UseMoonPayIframeOptions {
|
|
84
|
+
apiKey?: string;
|
|
85
|
+
chain?: Chain;
|
|
86
|
+
provider?: OnRampProvider;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare const TonPayButton: React.FC<TonPayButtonProps>;
|
|
90
|
+
|
|
91
|
+
declare const PaymentModal: React.FC<PaymentModalProps>;
|
|
92
|
+
|
|
93
|
+
declare const BottomSheet: React.FC<BottomSheetProps>;
|
|
94
|
+
|
|
33
95
|
declare const NotificationCard: React.FC<NotificationProps>;
|
|
34
96
|
declare const NotificationRoot: React.FC<{
|
|
35
97
|
children?: React.ReactNode;
|
|
36
98
|
}>;
|
|
37
|
-
declare const ErrorDotIcon: React.FC<{
|
|
38
|
-
color?: string;
|
|
39
|
-
}>;
|
|
40
99
|
|
|
41
|
-
|
|
100
|
+
interface ErrorTransactionNotificationProps {
|
|
42
101
|
text?: string;
|
|
43
102
|
className?: string;
|
|
44
103
|
style?: React.CSSProperties;
|
|
45
|
-
}
|
|
104
|
+
}
|
|
105
|
+
declare const ErrorTransactionNotification: React.FC<ErrorTransactionNotificationProps>;
|
|
46
106
|
|
|
47
|
-
|
|
48
|
-
|
|
107
|
+
declare function useTonPay(): {
|
|
108
|
+
pay: <T extends object = object>(getMessage: GetMessageFn<T>) => Promise<PayInfo<T>>;
|
|
109
|
+
address: string;
|
|
49
110
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
address: string | null;
|
|
111
|
+
|
|
112
|
+
declare function useMoonPayIframe({ apiKey, chain, }: UseMoonPayIframeOptions): {
|
|
113
|
+
loading: boolean;
|
|
114
|
+
error: string | null;
|
|
115
|
+
link: string | null;
|
|
116
|
+
fetchOnRampLink: (params: CreateMoonpayTransferParams) => Promise<string>;
|
|
117
|
+
checkAvailability: (amount: number, asset: string, ipAddress: string) => Promise<boolean>;
|
|
118
|
+
geoResult: MoonpayGeoResult | null;
|
|
119
|
+
limits: MoonpayAmountLimits | null;
|
|
60
120
|
};
|
|
61
121
|
|
|
62
|
-
|
|
122
|
+
interface KeyPair {
|
|
123
|
+
publicKey: Uint8Array;
|
|
124
|
+
privateKey: Uint8Array;
|
|
125
|
+
}
|
|
126
|
+
declare function generateKeyPair(): Promise<KeyPair>;
|
|
127
|
+
declare function signMessage(privateKey: Uint8Array, message: Uint8Array): Promise<Uint8Array>;
|
|
128
|
+
declare function verifySignlessSignature(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
129
|
+
|
|
130
|
+
interface EncryptedKeyVault {
|
|
131
|
+
salt: string;
|
|
132
|
+
iv: string;
|
|
133
|
+
encryptedBlob: string;
|
|
134
|
+
publicKey: string;
|
|
135
|
+
version: number;
|
|
136
|
+
}
|
|
137
|
+
declare function encryptPrivateKey(privateKey: Uint8Array, publicKey: Uint8Array, pin: string): Promise<EncryptedKeyVault>;
|
|
138
|
+
declare function decryptPrivateKey(vault: EncryptedKeyVault, pin: string): Promise<Uint8Array>;
|
|
139
|
+
|
|
140
|
+
interface WebAuthnCredentialInfo {
|
|
141
|
+
credentialId: string;
|
|
142
|
+
publicKey: string;
|
|
143
|
+
transports?: AuthenticatorTransport[];
|
|
144
|
+
}
|
|
145
|
+
declare function isWebAuthnSupported(): boolean;
|
|
146
|
+
declare function createWebAuthnCredential(walletAddress: string): Promise<WebAuthnCredentialInfo>;
|
|
147
|
+
declare function getWebAuthnCredential(credentialInfo: WebAuthnCredentialInfo): Promise<ArrayBuffer>;
|
|
148
|
+
|
|
149
|
+
type SignlessAuthMethod = "pin" | "biometric" | "none";
|
|
150
|
+
type SignlessStatus = "disabled" | "not_setup" | "locked" | "unlocked" | "setting_up";
|
|
151
|
+
interface SignlessConfig {
|
|
152
|
+
enabled: boolean;
|
|
153
|
+
authMethod: SignlessAuthMethod;
|
|
154
|
+
autoLockTimeout?: number;
|
|
155
|
+
storageKey?: string;
|
|
156
|
+
}
|
|
157
|
+
interface SignlessState {
|
|
158
|
+
status: SignlessStatus;
|
|
159
|
+
isEnabled: boolean;
|
|
160
|
+
isSetup: boolean;
|
|
161
|
+
isUnlocked: boolean;
|
|
162
|
+
authMethod: SignlessAuthMethod;
|
|
163
|
+
publicKey: string | null;
|
|
164
|
+
walletAddress: string | null;
|
|
165
|
+
}
|
|
166
|
+
interface SignlessVaultData {
|
|
167
|
+
vault: EncryptedKeyVault;
|
|
168
|
+
authMethod: SignlessAuthMethod;
|
|
169
|
+
walletAddress: string;
|
|
170
|
+
webauthnCredential?: WebAuthnCredentialInfo;
|
|
171
|
+
createdAt: number;
|
|
172
|
+
updatedAt: number;
|
|
173
|
+
}
|
|
174
|
+
interface SignlessSetupParams {
|
|
175
|
+
authMethod: SignlessAuthMethod;
|
|
176
|
+
pin?: string;
|
|
177
|
+
}
|
|
178
|
+
interface SignlessUnlockParams {
|
|
179
|
+
pin?: string;
|
|
180
|
+
}
|
|
181
|
+
interface SignlessPayloadParams {
|
|
182
|
+
recipient: string;
|
|
183
|
+
amount: string;
|
|
184
|
+
token?: string;
|
|
185
|
+
payload?: string;
|
|
186
|
+
reference?: string;
|
|
187
|
+
validUntil?: number;
|
|
188
|
+
}
|
|
189
|
+
interface SignlessSignedPayload {
|
|
190
|
+
payload: Uint8Array;
|
|
191
|
+
signature: Uint8Array;
|
|
192
|
+
publicKey: string;
|
|
193
|
+
reference: string;
|
|
194
|
+
validUntil: number;
|
|
195
|
+
}
|
|
196
|
+
interface SignlessContextValue {
|
|
197
|
+
state: SignlessState;
|
|
198
|
+
config: SignlessConfig;
|
|
199
|
+
setup: (params: SignlessSetupParams) => Promise<void>;
|
|
200
|
+
unlock: (params: SignlessUnlockParams) => Promise<void>;
|
|
201
|
+
lock: () => void;
|
|
202
|
+
reset: () => Promise<void>;
|
|
203
|
+
signPayload: (params: SignlessPayloadParams) => Promise<SignlessSignedPayload>;
|
|
204
|
+
updateConfig: (config: Partial<SignlessConfig>) => void;
|
|
205
|
+
isBiometricAvailable: boolean;
|
|
206
|
+
}
|
|
207
|
+
interface PinInputProps {
|
|
208
|
+
length?: number;
|
|
209
|
+
onComplete: (pin: string) => void;
|
|
210
|
+
onCancel?: () => void;
|
|
211
|
+
title?: string;
|
|
212
|
+
subtitle?: string;
|
|
213
|
+
error?: string | null;
|
|
214
|
+
isLoading?: boolean;
|
|
215
|
+
showBiometric?: boolean;
|
|
216
|
+
onBiometricPress?: () => void;
|
|
217
|
+
}
|
|
218
|
+
interface SignlessSetupModalProps {
|
|
219
|
+
isOpen: boolean;
|
|
220
|
+
onClose: () => void;
|
|
221
|
+
onComplete: () => void;
|
|
222
|
+
showBiometric?: boolean;
|
|
223
|
+
}
|
|
224
|
+
interface SignlessUnlockModalProps {
|
|
225
|
+
isOpen: boolean;
|
|
226
|
+
onClose: () => void;
|
|
227
|
+
onUnlock: () => void;
|
|
228
|
+
showBiometric?: boolean;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
interface SignlessProviderProps {
|
|
232
|
+
children: React.ReactNode;
|
|
233
|
+
config?: Partial<SignlessConfig>;
|
|
234
|
+
}
|
|
235
|
+
declare function SignlessProvider({ children, config }: SignlessProviderProps): react_jsx_runtime.JSX.Element;
|
|
236
|
+
declare function useSignless(): SignlessContextValue;
|
|
237
|
+
|
|
238
|
+
interface UseTonPaySignlessResult {
|
|
239
|
+
pay: <T extends object = object>(getMessage: GetMessageFn<T>) => Promise<PayInfo<T>>;
|
|
240
|
+
paySignless: (params: SignlessPayloadParams) => Promise<SignlessSignedPayload>;
|
|
241
|
+
address: string;
|
|
242
|
+
signless: {
|
|
243
|
+
state: SignlessState;
|
|
244
|
+
config: SignlessConfig;
|
|
245
|
+
setup: (params: SignlessSetupParams) => Promise<void>;
|
|
246
|
+
unlock: (params: SignlessUnlockParams) => Promise<void>;
|
|
247
|
+
lock: () => void;
|
|
248
|
+
reset: () => Promise<void>;
|
|
249
|
+
updateConfig: (config: Partial<SignlessConfig>) => void;
|
|
250
|
+
isBiometricAvailable: boolean;
|
|
251
|
+
isEnabled: boolean;
|
|
252
|
+
isSetup: boolean;
|
|
253
|
+
isUnlocked: boolean;
|
|
254
|
+
requiresUnlock: boolean;
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
declare function useTonPaySignless(): UseTonPaySignlessResult;
|
|
258
|
+
|
|
259
|
+
type SignlessModalType = "setup" | "unlock" | null;
|
|
260
|
+
interface UseSignlessModalResult {
|
|
261
|
+
modalType: SignlessModalType;
|
|
262
|
+
isOpen: boolean;
|
|
263
|
+
openSetup: () => void;
|
|
264
|
+
openUnlock: () => void;
|
|
265
|
+
close: () => void;
|
|
266
|
+
onSetupComplete: () => void;
|
|
267
|
+
onUnlockComplete: () => void;
|
|
268
|
+
}
|
|
269
|
+
declare function useSignlessModal(): UseSignlessModalResult;
|
|
270
|
+
|
|
271
|
+
declare const PinInput: React.FC<PinInputProps>;
|
|
272
|
+
|
|
273
|
+
declare const SignlessSetupModal: React.FC<SignlessSetupModalProps>;
|
|
274
|
+
|
|
275
|
+
declare const SignlessUnlockModal: React.FC<SignlessUnlockModalProps>;
|
|
276
|
+
|
|
277
|
+
declare class SignlessStorage {
|
|
278
|
+
private storageKey;
|
|
279
|
+
constructor(storageKey?: string);
|
|
280
|
+
private getStorage;
|
|
281
|
+
saveVault(walletAddress: string, vault: EncryptedKeyVault, authMethod: SignlessAuthMethod, webauthnCredential?: WebAuthnCredentialInfo): Promise<void>;
|
|
282
|
+
loadVault(walletAddress: string): Promise<SignlessVaultData | null>;
|
|
283
|
+
deleteVault(walletAddress: string): Promise<void>;
|
|
284
|
+
hasVault(walletAddress: string): Promise<boolean>;
|
|
285
|
+
updateVaultTimestamp(walletAddress: string): Promise<void>;
|
|
286
|
+
getAllWalletsWithVaults(): Promise<string[]>;
|
|
287
|
+
private getStorageKeyForWallet;
|
|
288
|
+
}
|
|
289
|
+
declare const signlessStorage: SignlessStorage;
|
|
290
|
+
|
|
291
|
+
export { BottomSheet, type BottomSheetProps, type EncryptedKeyVault, ErrorTransactionNotification, type GetMessageFn, NotificationCard, type NotificationProps, NotificationRoot, type OnRampProvider, type PayInfo, PaymentModal, type PaymentModalProps, type PaymentViewState, PinInput, type PinInputProps, type SignlessAuthMethod, type SignlessConfig, type SignlessContextValue, type SignlessModalType, type SignlessPayloadParams, SignlessProvider, SignlessSetupModal, type SignlessSetupModalProps, type SignlessSetupParams, type SignlessSignedPayload, type SignlessState, type SignlessStatus, SignlessStorage, SignlessUnlockModal, type SignlessUnlockModalProps, type SignlessUnlockParams, type SignlessVaultData, TonPayButton, type TonPayButtonProps, type TonPayMessage, type TonPayPreset, type TonPayVariant, type UseMoonPayIframeOptions, type UseSignlessModalResult, type UseTonPaySignlessResult, type WebAuthnCredentialInfo, createWebAuthnCredential, decryptPrivateKey, encryptPrivateKey, generateKeyPair, getWebAuthnCredential, isWebAuthnSupported, signMessage, signlessStorage, useMoonPayIframe, useSignless, useSignlessModal, useTonPay, useTonPaySignless, verifySignlessSignature };
|