@eos3/connect 0.1.0
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 +246 -0
- package/dist/index.d.ts +225 -0
- package/dist/index.js +1386 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# @eos3/connect
|
|
2
|
+
|
|
3
|
+
Framework-neutral browser SDK for EOS Passkey Connect.
|
|
4
|
+
|
|
5
|
+
Use this package inside a Telegram Mini App to create or restore an EOS wallet,
|
|
6
|
+
store the Bot-scoped local payment key in Telegram SecureStorage, unlock it with
|
|
7
|
+
Telegram biometrics, sign paylimit transfers locally, and push them through the
|
|
8
|
+
EOS Passkey API.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @eos3/connect
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The SDK expects a browser runtime with `fetch`, Web Crypto, and Telegram WebApp
|
|
17
|
+
APIs when real wallet creation or payment signing is used.
|
|
18
|
+
|
|
19
|
+
## Minimal Setup
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
createEosConnect,
|
|
24
|
+
isEosConnectError,
|
|
25
|
+
normalizeEosConnectError
|
|
26
|
+
} from '@eos3/connect';
|
|
27
|
+
|
|
28
|
+
const telegramWebApp = window.Telegram?.WebApp;
|
|
29
|
+
|
|
30
|
+
const eosConnect = createEosConnect({
|
|
31
|
+
network: 'testnet',
|
|
32
|
+
telegramWebApp
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
eosConnect.subscribe((state) => {
|
|
36
|
+
console.log('EOS wallet state:', state);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
await eosConnect.checkWallet();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`network` can be `testnet` or `mainnet`. It selects the default API base URL,
|
|
43
|
+
browser signing RPC failover list, chain id metadata, and balance asset. You can
|
|
44
|
+
still override `apiBaseUrl`, `rpcUrls`, or `balanceAsset` when running your own
|
|
45
|
+
deployment.
|
|
46
|
+
|
|
47
|
+
For now, the testnet preset uses `https://eospasskey.aiexsat.com` as its hosted
|
|
48
|
+
API. The mainnet preset keeps the same hosted API placeholder until a separate
|
|
49
|
+
mainnet endpoint is assigned.
|
|
50
|
+
|
|
51
|
+
## Connect a Telegram Wallet
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
const state = await eosConnect.connectTelegram({
|
|
55
|
+
assetLimits: [
|
|
56
|
+
{
|
|
57
|
+
tokenContract: 'core.vaulta',
|
|
58
|
+
symbol: 'A',
|
|
59
|
+
precision: 4,
|
|
60
|
+
perTxLimit: '1',
|
|
61
|
+
dailyLimit: '10',
|
|
62
|
+
totalBudget: '100'
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
if (state.status === 'pending' && state.bindUrl) {
|
|
68
|
+
// The SDK opens bindUrl by default. Keep this branch for custom UI.
|
|
69
|
+
console.log('Continue passkey binding:', state.bindUrl);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`connectTelegram()` generates a local EOS K1 payment key, encrypts the private
|
|
74
|
+
key with AES-GCM, stores the encrypted envelope in Telegram SecureStorage, saves
|
|
75
|
+
the unlock key as the Telegram biometric token, and starts the external passkey
|
|
76
|
+
binding flow.
|
|
77
|
+
|
|
78
|
+
Do not fall back to `localStorage` for the private key. If Telegram
|
|
79
|
+
SecureStorage or BiometricManager is missing, ask the user to open the Mini App
|
|
80
|
+
in a supported Telegram mobile client.
|
|
81
|
+
|
|
82
|
+
## Check Readiness
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
const capability = await eosConnect.checkWallet();
|
|
86
|
+
|
|
87
|
+
if (capability.status === 'ready') {
|
|
88
|
+
console.log('Ready to pay from', capability.account);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (capability.status === 'needs_local_key') {
|
|
92
|
+
// The server wallet exists, but this Telegram device does not have the
|
|
93
|
+
// matching encrypted local payment key. Prompt the user to rebind.
|
|
94
|
+
await eosConnect.connectTelegram({ replaceWallet: true });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (capability.status === 'pending' && capability.bindUrl) {
|
|
98
|
+
telegramWebApp?.openLink?.(capability.bindUrl);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Common capability statuses:
|
|
103
|
+
|
|
104
|
+
- `unsupported`: missing Telegram initData or secure Telegram APIs.
|
|
105
|
+
- `not_connected`: no wallet exists yet.
|
|
106
|
+
- `pending`: account creation or tgpay binding is not finished.
|
|
107
|
+
- `needs_local_key`: wallet exists, but this device cannot sign quick payments.
|
|
108
|
+
- `ready`: wallet and local payment key match.
|
|
109
|
+
|
|
110
|
+
## Pay
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
try {
|
|
114
|
+
const result = await eosConnect.pay({
|
|
115
|
+
to: 'merchant1111',
|
|
116
|
+
amount: '1.0000',
|
|
117
|
+
memo: 'order-123',
|
|
118
|
+
tokenContract: 'core.vaulta',
|
|
119
|
+
symbol: 'A'
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
console.log('Pushed transaction:', result.txid);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
const normalized = normalizeEosConnectError(error);
|
|
125
|
+
console.error(normalized.code, normalized.message, normalized.retryable);
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`pay()` uses these API endpoints:
|
|
130
|
+
|
|
131
|
+
- `POST /api/tg-wallet/transfer/build`
|
|
132
|
+
- `POST /api/tg-wallet/transfer/push`
|
|
133
|
+
|
|
134
|
+
The default confirmation sheet can be disabled or replaced:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
const eosConnect = createEosConnect({
|
|
138
|
+
network: 'testnet',
|
|
139
|
+
telegramWebApp,
|
|
140
|
+
confirmPayment: async (details) => {
|
|
141
|
+
return window.confirm(`Pay ${details.quantity} to ${details.to}?`);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
For production business actions, prefer project-specific build and push
|
|
147
|
+
endpoints that validate contract, action, authorization, amount, memo, and any
|
|
148
|
+
business parameters before broadcasting.
|
|
149
|
+
|
|
150
|
+
## Custom Transaction Signing
|
|
151
|
+
|
|
152
|
+
Use `signEosConnectTransaction()` when your own backend builds a validated
|
|
153
|
+
transaction and expects a signed payload:
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
import { signEosConnectTransaction } from '@eos3/connect';
|
|
157
|
+
|
|
158
|
+
const signedTransaction = await signEosConnectTransaction(transaction, {
|
|
159
|
+
telegramWebApp,
|
|
160
|
+
rpcUrls: ['https://jungle4.cryptolions.io:443']
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
await fetch('https://wallet.example.com/api/market/push', {
|
|
164
|
+
method: 'POST',
|
|
165
|
+
headers: { 'content-type': 'application/json' },
|
|
166
|
+
body: JSON.stringify({
|
|
167
|
+
initData: telegramWebApp?.initData,
|
|
168
|
+
signedTransaction
|
|
169
|
+
})
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## API Summary
|
|
174
|
+
|
|
175
|
+
- `createEosConnect(options)`: creates the SDK client.
|
|
176
|
+
- `client.getProviders()`: returns wallet provider metadata.
|
|
177
|
+
- `client.getSnapshot()`: returns the current state.
|
|
178
|
+
- `client.subscribe(listener)`: subscribes to state changes.
|
|
179
|
+
- `client.restore()`: loads wallet state from the API.
|
|
180
|
+
- `client.checkWallet()`: checks server wallet plus local key readiness.
|
|
181
|
+
- `client.connectTelegram(options)`: starts or resumes Telegram binding.
|
|
182
|
+
- `client.connectTokenPocket(options)`: starts TokenPocket binding.
|
|
183
|
+
- `client.pay(options)`: builds, signs, confirms, and pushes a paylimit payment.
|
|
184
|
+
- `client.disconnectLocal()`: clears the local in-memory SDK state.
|
|
185
|
+
|
|
186
|
+
## Network Presets
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
import { EOS_CONNECT_NETWORKS } from '@eos3/connect';
|
|
190
|
+
|
|
191
|
+
console.log(EOS_CONNECT_NETWORKS.testnet.rpcUrls);
|
|
192
|
+
console.log(EOS_CONNECT_NETWORKS.mainnet.chainId);
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Preset values:
|
|
196
|
+
|
|
197
|
+
- `testnet`: Jungle4 chain id, Jungle4 RPC failover list, hosted testnet API
|
|
198
|
+
`https://eospasskey.aiexsat.com`, and default asset `core.vaulta:A:4`.
|
|
199
|
+
- `mainnet`: EOS mainnet chain id, mainnet RPC failover list, hosted API
|
|
200
|
+
placeholder `https://eospasskey.aiexsat.com`, and default asset
|
|
201
|
+
`core.vaulta:A:4`.
|
|
202
|
+
|
|
203
|
+
Explicit options always win:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
createEosConnect({
|
|
207
|
+
network: 'testnet',
|
|
208
|
+
apiBaseUrl: 'https://my-testnet-wallet.example.com',
|
|
209
|
+
rpcUrls: ['https://my-jungle-rpc.example.com'],
|
|
210
|
+
telegramWebApp
|
|
211
|
+
});
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Error Handling
|
|
215
|
+
|
|
216
|
+
Use `normalizeEosConnectError(error)` at UI boundaries. It maps raw API, EOS RPC,
|
|
217
|
+
Telegram biometric, and contract errors into stable codes:
|
|
218
|
+
|
|
219
|
+
- `DAILY_LIMIT_EXCEEDED`
|
|
220
|
+
- `PER_TX_LIMIT_EXCEEDED`
|
|
221
|
+
- `TOTAL_BUDGET_EXCEEDED`
|
|
222
|
+
- `INSUFFICIENT_BALANCE`
|
|
223
|
+
- `RAM_INSUFFICIENT`
|
|
224
|
+
- `PAYMENT_PERMISSION_MISSING`
|
|
225
|
+
- `SIGNATURE_REJECTED`
|
|
226
|
+
- `SESSION_EXPIRED`
|
|
227
|
+
- `NETWORK_ERROR`
|
|
228
|
+
- `UNKNOWN_CHAIN_ERROR`
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
catch (error) {
|
|
232
|
+
const normalized = normalizeEosConnectError(error);
|
|
233
|
+
if (normalized.retryable) {
|
|
234
|
+
// Show a retry action.
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Security Notes
|
|
240
|
+
|
|
241
|
+
- Never send the local payment private key or biometric unlock token to a server.
|
|
242
|
+
- Never store the private key in `localStorage`, IndexedDB, cookies, or plain
|
|
243
|
+
Telegram CloudStorage.
|
|
244
|
+
- Treat missing Telegram SecureStorage or BiometricManager as unsupported.
|
|
245
|
+
- Keep `TELEGRAM_BOT_TOKEN`, account creator keys, resource sponsor keys, and
|
|
246
|
+
contract deployment keys on the backend only.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import type { PayLimitAssetConfig, PayLimitPayment, SignedTransferPayload } from '@eos3/shared';
|
|
2
|
+
export type EosConnectProviderId = 'telegram' | 'tokenpocket' | 'anchor';
|
|
3
|
+
export type EosConnectProviderState = 'available' | 'coming_soon' | 'disabled';
|
|
4
|
+
export type EosConnectStatus = 'idle' | 'not_connected' | 'pending' | 'connected' | 'unsupported' | 'error';
|
|
5
|
+
export type EosConnectNetwork = 'testnet' | 'mainnet';
|
|
6
|
+
export type EosConnectWalletCapabilityStatus = 'unsupported' | 'not_connected' | 'pending' | 'ready' | 'needs_local_key';
|
|
7
|
+
export type EosConnectWalletSetupStatus = 'missing_telegram_session' | 'secure_storage_unavailable' | 'pending_tgpay' | 'pay_binding_invalid' | 'ready' | 'not_connected';
|
|
8
|
+
export type EosConnectWalletSetupAction = 'none' | 'create' | 'continue' | 'rebind' | 'transfer';
|
|
9
|
+
export interface EosConnectProvider {
|
|
10
|
+
id: EosConnectProviderId;
|
|
11
|
+
name: string;
|
|
12
|
+
state: EosConnectProviderState;
|
|
13
|
+
description: string;
|
|
14
|
+
}
|
|
15
|
+
export interface EosConnectTelegramWebApp {
|
|
16
|
+
initData?: string;
|
|
17
|
+
platform?: string;
|
|
18
|
+
version?: string;
|
|
19
|
+
openLink?(url: string): void;
|
|
20
|
+
SecureStorage?: {
|
|
21
|
+
setItem(key: string, value: string, callback?: (error: string | null, isStored?: boolean) => void): void;
|
|
22
|
+
getItem(key: string, callback: (error: string | null, value?: string | null) => void): void;
|
|
23
|
+
removeItem?(key: string, callback?: (error: string | null, isRemoved?: boolean) => void): void;
|
|
24
|
+
};
|
|
25
|
+
BiometricManager?: {
|
|
26
|
+
isInited?: boolean;
|
|
27
|
+
isBiometricAvailable?: boolean;
|
|
28
|
+
isAccessRequested?: boolean;
|
|
29
|
+
isAccessGranted?: boolean;
|
|
30
|
+
isBiometricTokenSaved?: boolean;
|
|
31
|
+
init(callback?: () => void): void;
|
|
32
|
+
requestAccess?(params: {
|
|
33
|
+
reason?: string;
|
|
34
|
+
}, callback?: (isGranted: boolean) => void): void;
|
|
35
|
+
authenticate(params: {
|
|
36
|
+
reason?: string;
|
|
37
|
+
}, callback: (isAuthenticated: boolean, biometricToken?: string) => void): void;
|
|
38
|
+
updateBiometricToken(token: string, callback?: (isUpdated: boolean) => void): void;
|
|
39
|
+
openSettings?(): void;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface EosConnectState {
|
|
43
|
+
status: EosConnectStatus;
|
|
44
|
+
provider: EosConnectProviderId | null;
|
|
45
|
+
account: string | null;
|
|
46
|
+
balance: string | null;
|
|
47
|
+
bindId: string | null;
|
|
48
|
+
bindUrl: string | null;
|
|
49
|
+
canUse?: boolean;
|
|
50
|
+
needsLocalKey?: boolean;
|
|
51
|
+
expectedPublicKey?: string | null;
|
|
52
|
+
localPublicKey?: string | null;
|
|
53
|
+
reused?: boolean;
|
|
54
|
+
hasWallet?: boolean;
|
|
55
|
+
error: string | null;
|
|
56
|
+
}
|
|
57
|
+
export interface EosConnectWalletCapability {
|
|
58
|
+
status: EosConnectWalletCapabilityStatus;
|
|
59
|
+
hasWallet: boolean;
|
|
60
|
+
canUse: boolean;
|
|
61
|
+
needsLocalKey: boolean;
|
|
62
|
+
account: string | null;
|
|
63
|
+
balance: string | null;
|
|
64
|
+
bindId: string | null;
|
|
65
|
+
bindUrl: string | null;
|
|
66
|
+
expectedPublicKey: string | null;
|
|
67
|
+
localPublicKey: string | null;
|
|
68
|
+
reason: string | null;
|
|
69
|
+
wallet: EosConnectWalletInfo | null;
|
|
70
|
+
}
|
|
71
|
+
export interface EosConnectWalletSetupEnv {
|
|
72
|
+
hasTelegramSession?: boolean;
|
|
73
|
+
canStorePayKey?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface EosConnectWalletSetupState {
|
|
76
|
+
status: EosConnectWalletSetupStatus;
|
|
77
|
+
action: EosConnectWalletSetupAction;
|
|
78
|
+
account: string | null;
|
|
79
|
+
hasWallet: boolean;
|
|
80
|
+
bindId: string | null;
|
|
81
|
+
bindUrl: string | null;
|
|
82
|
+
isRecoverable: boolean;
|
|
83
|
+
showAction: boolean;
|
|
84
|
+
reason: string | null;
|
|
85
|
+
}
|
|
86
|
+
export interface EosConnectNetworkConfig {
|
|
87
|
+
id: EosConnectNetwork;
|
|
88
|
+
name: string;
|
|
89
|
+
apiBaseUrl: string;
|
|
90
|
+
chainId: string;
|
|
91
|
+
rpcUrls: readonly string[];
|
|
92
|
+
balanceAsset: EosConnectBalanceAsset;
|
|
93
|
+
}
|
|
94
|
+
export interface EosConnectOptions {
|
|
95
|
+
network?: EosConnectNetwork;
|
|
96
|
+
apiBaseUrl?: string;
|
|
97
|
+
botUsername?: string;
|
|
98
|
+
deviceLabel?: string;
|
|
99
|
+
balanceAsset?: EosConnectBalanceAsset;
|
|
100
|
+
rpcUrls?: string | string[];
|
|
101
|
+
signTransaction?: EosConnectTransactionSigner;
|
|
102
|
+
confirmPayment?: EosConnectPaymentConfirmer | false;
|
|
103
|
+
telegramWebApp?: EosConnectTelegramWebApp | null;
|
|
104
|
+
openExternal?: (url: string) => void;
|
|
105
|
+
fetch?: typeof fetch;
|
|
106
|
+
}
|
|
107
|
+
export interface EosConnectConnectOptions {
|
|
108
|
+
provider: EosConnectProviderId;
|
|
109
|
+
publicKey?: string;
|
|
110
|
+
assetLimits?: PayLimitAssetConfig[];
|
|
111
|
+
replaceWallet?: boolean;
|
|
112
|
+
openLink?: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface EosConnectTelegramOptions {
|
|
115
|
+
assetLimits?: PayLimitAssetConfig[];
|
|
116
|
+
replaceWallet?: boolean;
|
|
117
|
+
openLink?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface EosConnectClient {
|
|
120
|
+
getProviders(): EosConnectProvider[];
|
|
121
|
+
getSnapshot(): EosConnectState;
|
|
122
|
+
subscribe(listener: (state: EosConnectState) => void): () => void;
|
|
123
|
+
restore(): Promise<EosConnectState>;
|
|
124
|
+
checkWallet(): Promise<EosConnectWalletCapability>;
|
|
125
|
+
connect(options: EosConnectConnectOptions): Promise<EosConnectState>;
|
|
126
|
+
connectTelegram(options?: EosConnectTelegramOptions): Promise<EosConnectState>;
|
|
127
|
+
connectTokenPocket(options?: EosConnectTelegramOptions): Promise<EosConnectState>;
|
|
128
|
+
pay(options: EosConnectPayOptions): Promise<EosConnectPayResult>;
|
|
129
|
+
disconnectLocal(): EosConnectState;
|
|
130
|
+
}
|
|
131
|
+
export interface EosConnectBalanceAsset {
|
|
132
|
+
tokenContract: string;
|
|
133
|
+
symbol: string;
|
|
134
|
+
precision?: number;
|
|
135
|
+
}
|
|
136
|
+
export interface EosConnectTelegramDeviceDiagnostic {
|
|
137
|
+
label: string;
|
|
138
|
+
ok: boolean;
|
|
139
|
+
detail: string;
|
|
140
|
+
}
|
|
141
|
+
export interface EosConnectTelegramBiometricSettingsResult {
|
|
142
|
+
opened: boolean;
|
|
143
|
+
message: string;
|
|
144
|
+
}
|
|
145
|
+
export interface EosConnectPayOptions {
|
|
146
|
+
to: string;
|
|
147
|
+
amount: string;
|
|
148
|
+
memo?: string;
|
|
149
|
+
tokenContract?: string;
|
|
150
|
+
symbol?: string;
|
|
151
|
+
}
|
|
152
|
+
export interface EosConnectPayResult {
|
|
153
|
+
ok: true;
|
|
154
|
+
txid: string;
|
|
155
|
+
}
|
|
156
|
+
export type EosConnectErrorCode = 'DAILY_LIMIT_EXCEEDED' | 'PER_TX_LIMIT_EXCEEDED' | 'TOTAL_BUDGET_EXCEEDED' | 'INSUFFICIENT_BALANCE' | 'RAM_INSUFFICIENT' | 'PAYMENT_PERMISSION_MISSING' | 'SIGNATURE_REJECTED' | 'SESSION_EXPIRED' | 'NETWORK_ERROR' | 'UNKNOWN_CHAIN_ERROR';
|
|
157
|
+
export declare class EosConnectError extends Error {
|
|
158
|
+
readonly code: EosConnectErrorCode;
|
|
159
|
+
readonly rawMessage: string;
|
|
160
|
+
readonly retryable: boolean;
|
|
161
|
+
constructor(code: EosConnectErrorCode, message: string, options?: {
|
|
162
|
+
rawMessage?: string;
|
|
163
|
+
retryable?: boolean;
|
|
164
|
+
cause?: unknown;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
export declare function isEosConnectError(error: unknown): error is EosConnectError;
|
|
168
|
+
export interface EosConnectPaymentDetails {
|
|
169
|
+
intentId: string;
|
|
170
|
+
chainId: string;
|
|
171
|
+
from: string;
|
|
172
|
+
to: string;
|
|
173
|
+
tokenContract: string;
|
|
174
|
+
quantity: string;
|
|
175
|
+
memo: string;
|
|
176
|
+
payments: PayLimitPayment[];
|
|
177
|
+
}
|
|
178
|
+
export type EosConnectSignedTransaction = SignedTransferPayload;
|
|
179
|
+
export type EosConnectPaymentConfirmer = (details: EosConnectPaymentDetails) => boolean | Promise<boolean>;
|
|
180
|
+
export type EosConnectTransactionSigner = (transaction: Record<string, unknown>, context: {
|
|
181
|
+
telegramWebApp?: EosConnectTelegramWebApp | null;
|
|
182
|
+
rpcUrls: string[];
|
|
183
|
+
fetch: typeof fetch;
|
|
184
|
+
}) => Promise<EosConnectSignedTransaction>;
|
|
185
|
+
export interface EosConnectWalletInfo {
|
|
186
|
+
eosAccount: string | null;
|
|
187
|
+
balance: string;
|
|
188
|
+
hasWallet: boolean;
|
|
189
|
+
status?: string;
|
|
190
|
+
pendingAccount?: string | null;
|
|
191
|
+
bindId?: string | null;
|
|
192
|
+
bindUrl?: string | null;
|
|
193
|
+
bindingError?: string | null;
|
|
194
|
+
quickPublicKey?: string | null;
|
|
195
|
+
botPermission?: string | null;
|
|
196
|
+
}
|
|
197
|
+
export declare const EOS_CONNECT_PRIVATE_KEY_STORAGE = "tg_eos_wallet_pay_key_v1";
|
|
198
|
+
export declare const EOS_CONNECT_DEFAULT_API_BASE_URL = "https://eospasskey.aiexsat.com";
|
|
199
|
+
export declare const EOS_CONNECT_NETWORKS: Record<EosConnectNetwork, EosConnectNetworkConfig>;
|
|
200
|
+
export declare function eosConnectTelegramPayStorageDiagnostics(app: EosConnectTelegramWebApp): EosConnectTelegramDeviceDiagnostic[];
|
|
201
|
+
export declare function supportsEosConnectTelegramPayStorage(app: EosConnectTelegramWebApp): boolean;
|
|
202
|
+
export declare function initEosConnectTelegramBiometricManager(app: EosConnectTelegramWebApp, timeoutMs?: number): Promise<boolean>;
|
|
203
|
+
export declare function openEosConnectTelegramBiometricSettings(app: EosConnectTelegramWebApp): Promise<EosConnectTelegramBiometricSettingsResult>;
|
|
204
|
+
export declare function eosConnectWalletSetupState(wallet: EosConnectWalletInfo, env?: EosConnectWalletSetupEnv): EosConnectWalletSetupState;
|
|
205
|
+
export declare function normalizeEosConnectError(error: unknown): EosConnectError;
|
|
206
|
+
export declare function tokenPocketDappUrl(url: string): string;
|
|
207
|
+
export declare function generateEosConnectPaymentKey(): Promise<{
|
|
208
|
+
privateKey: string;
|
|
209
|
+
publicKey: string;
|
|
210
|
+
}>;
|
|
211
|
+
export declare function publicKeyFromEosPrivateKey(privateKey: string): Promise<string>;
|
|
212
|
+
export declare function saveEosConnectPaymentKey(privateKey: string, app?: EosConnectTelegramWebApp | null): Promise<void>;
|
|
213
|
+
export declare function loadEosConnectStoredPublicKey(app?: EosConnectTelegramWebApp | null): Promise<string | null>;
|
|
214
|
+
export declare function loadEosConnectPaymentSigningKey(app?: EosConnectTelegramWebApp | null): Promise<{
|
|
215
|
+
privateKey: string;
|
|
216
|
+
publicKey: string;
|
|
217
|
+
storedPublicKey: string | null;
|
|
218
|
+
}>;
|
|
219
|
+
export declare function removeEosConnectPaymentKey(app?: EosConnectTelegramWebApp | null): Promise<void>;
|
|
220
|
+
export declare function signEosConnectTransaction(transaction: Record<string, unknown>, context: {
|
|
221
|
+
telegramWebApp?: EosConnectTelegramWebApp | null;
|
|
222
|
+
rpcUrls: string[];
|
|
223
|
+
fetch?: typeof fetch;
|
|
224
|
+
}): Promise<EosConnectSignedTransaction>;
|
|
225
|
+
export declare function createEosConnect(options: EosConnectOptions): EosConnectClient;
|