@cookill/wallet-adapter 3.2.0 → 3.2.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 +234 -188
- package/dist/index.cjs +5 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -228
- package/dist/index.d.ts +4 -228
- package/dist/index.js +5 -211
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +5 -1871
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -147
- package/dist/react.d.ts +1 -147
- package/dist/react.js +6 -1846
- package/dist/react.js.map +1 -1
- package/dist/standard.cjs.map +1 -1
- package/dist/standard.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @cookill/wallet-adapter v3.
|
|
2
|
+
* @cookill/wallet-adapter v3.0.0
|
|
3
3
|
* Core type definitions
|
|
4
|
-
*
|
|
5
|
-
* Includes support for:
|
|
6
|
-
* - REX (Rialo Extended Execution) — confidential computation transactions
|
|
7
|
-
* - SfS (Stake-for-Service) — gasless transactions via staking yield
|
|
8
|
-
* - Scan-to-Connect — QR-based cross-device wallet pairing
|
|
9
4
|
*/
|
|
10
5
|
type RialoNetwork = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
|
|
11
6
|
type RialoChainId = `rialo:${RialoNetwork}`;
|
|
@@ -17,8 +12,6 @@ interface NetworkConfig {
|
|
|
17
12
|
explorerUrl?: string;
|
|
18
13
|
symbol: string;
|
|
19
14
|
decimals: number;
|
|
20
|
-
supportsREX?: boolean;
|
|
21
|
-
supportsSfS?: boolean;
|
|
22
15
|
}
|
|
23
16
|
declare const NETWORKS: Record<RialoNetwork, NetworkConfig>;
|
|
24
17
|
interface WalletAccount {
|
|
@@ -31,20 +24,12 @@ interface TransactionRequest {
|
|
|
31
24
|
value: string;
|
|
32
25
|
data?: string;
|
|
33
26
|
memo?: string;
|
|
34
|
-
/** If true, attempt to pay gas via Stake-for-Service credits */
|
|
35
|
-
gasless?: boolean;
|
|
36
|
-
/** REX confidential execution context */
|
|
37
|
-
rex?: REXConfig;
|
|
38
27
|
}
|
|
39
28
|
interface TransactionResult {
|
|
40
29
|
hash: string;
|
|
41
30
|
signature?: string;
|
|
42
31
|
status: 'pending' | 'confirmed' | 'failed';
|
|
43
32
|
blockNumber?: number;
|
|
44
|
-
/** Whether gas was paid via SfS credits */
|
|
45
|
-
gasless?: boolean;
|
|
46
|
-
/** REX execution proof if confidential */
|
|
47
|
-
rexProof?: string;
|
|
48
33
|
}
|
|
49
34
|
interface SignedMessage {
|
|
50
35
|
signature: string;
|
|
@@ -56,152 +41,14 @@ interface BalanceResult {
|
|
|
56
41
|
balance: string;
|
|
57
42
|
formatted: string;
|
|
58
43
|
}
|
|
59
|
-
/**
|
|
60
|
-
* REX enables privacy-preserving computation on Rialo.
|
|
61
|
-
* Transactions can be executed confidentially using TEEs, MPC, or FHE
|
|
62
|
-
* without exposing inputs to the public blockchain.
|
|
63
|
-
*/
|
|
64
|
-
/** Privacy technology used for confidential computation */
|
|
65
|
-
type REXPrivacyMode = 'tee' | 'mpc' | 'fhe' | 'auto';
|
|
66
|
-
interface REXConfig {
|
|
67
|
-
/** Enable confidential execution */
|
|
68
|
-
confidential: boolean;
|
|
69
|
-
/** Privacy technology to use (default: 'auto' — protocol selects optimal) */
|
|
70
|
-
privacyMode?: REXPrivacyMode;
|
|
71
|
-
/** Encrypted inputs (base64-encoded ciphertext) */
|
|
72
|
-
encryptedInputs?: string;
|
|
73
|
-
/** REX program ID to execute */
|
|
74
|
-
programId?: string;
|
|
75
|
-
/** Whether output should remain encrypted for future computation */
|
|
76
|
-
keepEncrypted?: boolean;
|
|
77
|
-
/** Access control — who can decrypt the result */
|
|
78
|
-
accessPolicy?: REXAccessPolicy;
|
|
79
|
-
}
|
|
80
|
-
interface REXAccessPolicy {
|
|
81
|
-
/** Addresses allowed to decrypt the result */
|
|
82
|
-
allowedDecryptors: string[];
|
|
83
|
-
/** Expiry timestamp (ms) for access */
|
|
84
|
-
expiresAt?: number;
|
|
85
|
-
}
|
|
86
|
-
interface REXTransactionResult extends TransactionResult {
|
|
87
|
-
/** Attestation proof from TEE/MPC */
|
|
88
|
-
attestation?: string;
|
|
89
|
-
/** Encrypted output (if keepEncrypted was true) */
|
|
90
|
-
encryptedOutput?: string;
|
|
91
|
-
/** Public output (if computation produced public results) */
|
|
92
|
-
publicOutput?: string;
|
|
93
|
-
}
|
|
94
|
-
/** REX capabilities query result */
|
|
95
|
-
interface REXCapabilities {
|
|
96
|
-
supported: boolean;
|
|
97
|
-
privacyModes: REXPrivacyMode[];
|
|
98
|
-
maxInputSize: number;
|
|
99
|
-
programs: string[];
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* SfS converts staking yield into service credits that automatically
|
|
103
|
-
* pay for network costs (gas, storage, scheduled executions).
|
|
104
|
-
* Users stake RLO, set a routing fraction, and the ServicePaymaster
|
|
105
|
-
* mints credits from their yield.
|
|
106
|
-
*/
|
|
107
|
-
interface SfSPosition {
|
|
108
|
-
/** Position ID */
|
|
109
|
-
id: string;
|
|
110
|
-
/** Staked principal in kelvins */
|
|
111
|
-
principal: string;
|
|
112
|
-
/** Validator/pool receiving the delegation */
|
|
113
|
-
validator: string;
|
|
114
|
-
/** Fraction of yield routed to service credits (0.0 - 1.0) */
|
|
115
|
-
routingFraction: number;
|
|
116
|
-
/** Current service credit balance */
|
|
117
|
-
creditBalance: string;
|
|
118
|
-
/** Estimated credits per epoch */
|
|
119
|
-
creditsPerEpoch: string;
|
|
120
|
-
/** Position status */
|
|
121
|
-
status: 'active' | 'pending' | 'closed';
|
|
122
|
-
/** Creation timestamp */
|
|
123
|
-
createdAt: number;
|
|
124
|
-
}
|
|
125
|
-
interface SfSCreateParams {
|
|
126
|
-
/** Amount of RLO to stake (in kelvins) */
|
|
127
|
-
amount: string;
|
|
128
|
-
/** Validator address to delegate to */
|
|
129
|
-
validator: string;
|
|
130
|
-
/** Fraction of yield to route to service credits (0.0 - 1.0) */
|
|
131
|
-
routingFraction: number;
|
|
132
|
-
}
|
|
133
|
-
interface SfSUpdateParams {
|
|
134
|
-
/** Position ID to update */
|
|
135
|
-
positionId: string;
|
|
136
|
-
/** New routing fraction (0.0 - 1.0) */
|
|
137
|
-
routingFraction?: number;
|
|
138
|
-
}
|
|
139
|
-
interface SfSCreditBalance {
|
|
140
|
-
/** Available service credits */
|
|
141
|
-
available: string;
|
|
142
|
-
/** Credits used this epoch */
|
|
143
|
-
usedThisEpoch: string;
|
|
144
|
-
/** Total credits earned */
|
|
145
|
-
totalEarned: string;
|
|
146
|
-
/** Estimated credits per epoch */
|
|
147
|
-
estimatedPerEpoch: string;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Enables connecting a wallet on one device to a dApp on another device
|
|
151
|
-
* via QR code scanning. Supports bidirectional flow:
|
|
152
|
-
* - dApp shows QR → wallet scans to connect
|
|
153
|
-
* - Wallet shows QR → dApp scans to connect
|
|
154
|
-
*/
|
|
155
|
-
interface ScanConnectSession {
|
|
156
|
-
/** Unique session identifier */
|
|
157
|
-
sessionId: string;
|
|
158
|
-
/** Session topic for relay */
|
|
159
|
-
topic: string;
|
|
160
|
-
/** Relay server URL */
|
|
161
|
-
relay: string;
|
|
162
|
-
/** Session encryption key (hex) */
|
|
163
|
-
symmetricKey: string;
|
|
164
|
-
/** Originator: 'dapp' or 'wallet' */
|
|
165
|
-
origin: 'dapp' | 'wallet';
|
|
166
|
-
/** dApp metadata */
|
|
167
|
-
dappMetadata?: ScanConnectDAppMetadata;
|
|
168
|
-
/** Wallet metadata */
|
|
169
|
-
walletMetadata?: ScanConnectWalletMetadata;
|
|
170
|
-
/** Requested chain IDs */
|
|
171
|
-
chains: RialoChainId[];
|
|
172
|
-
/** Expiry timestamp */
|
|
173
|
-
expiresAt: number;
|
|
174
|
-
}
|
|
175
|
-
interface ScanConnectDAppMetadata {
|
|
176
|
-
name: string;
|
|
177
|
-
url: string;
|
|
178
|
-
icon?: string;
|
|
179
|
-
description?: string;
|
|
180
|
-
}
|
|
181
|
-
interface ScanConnectWalletMetadata {
|
|
182
|
-
name: string;
|
|
183
|
-
icon?: string;
|
|
184
|
-
version?: string;
|
|
185
|
-
}
|
|
186
|
-
/** URI format for scan-to-connect QR codes */
|
|
187
|
-
interface ScanConnectURI {
|
|
188
|
-
/** Full URI string (rialo-wc://...) */
|
|
189
|
-
uri: string;
|
|
190
|
-
/** Parsed session info */
|
|
191
|
-
session: ScanConnectSession;
|
|
192
|
-
}
|
|
193
|
-
type ScanConnectStatus = 'idle' | 'generating' | 'waiting' | 'scanned' | 'approving' | 'connected' | 'expired' | 'rejected' | 'error';
|
|
194
44
|
interface WalletInfo {
|
|
195
45
|
id: string;
|
|
196
46
|
name: string;
|
|
197
47
|
icon: string;
|
|
198
48
|
installed?: boolean;
|
|
199
49
|
downloadUrl?: string;
|
|
200
|
-
supportsREX?: boolean;
|
|
201
|
-
supportsSfS?: boolean;
|
|
202
|
-
supportsScanConnect?: boolean;
|
|
203
50
|
}
|
|
204
|
-
type WalletEventType = 'connect' | 'disconnect' | 'accountsChanged' | 'networkChanged' | 'chainChanged' | '
|
|
51
|
+
type WalletEventType = 'connect' | 'disconnect' | 'accountsChanged' | 'networkChanged' | 'chainChanged' | 'error';
|
|
205
52
|
interface RialoProvider {
|
|
206
53
|
isRialo: boolean;
|
|
207
54
|
isSheepWallet?: boolean;
|
|
@@ -224,18 +71,6 @@ interface RialoProvider {
|
|
|
224
71
|
success: boolean;
|
|
225
72
|
}>;
|
|
226
73
|
getBalance(address?: string): Promise<BalanceResult | string>;
|
|
227
|
-
getREXCapabilities?(): Promise<REXCapabilities>;
|
|
228
|
-
submitREXTransaction?(tx: TransactionRequest): Promise<REXTransactionResult>;
|
|
229
|
-
getSfSPositions?(): Promise<SfSPosition[]>;
|
|
230
|
-
createSfSPosition?(params: SfSCreateParams): Promise<SfSPosition>;
|
|
231
|
-
updateSfSPosition?(params: SfSUpdateParams): Promise<SfSPosition>;
|
|
232
|
-
closeSfSPosition?(positionId: string): Promise<{
|
|
233
|
-
success: boolean;
|
|
234
|
-
}>;
|
|
235
|
-
getSfSCredits?(): Promise<SfSCreditBalance>;
|
|
236
|
-
createScanSession?(origin: 'wallet'): Promise<ScanConnectURI>;
|
|
237
|
-
approveScanSession?(sessionId: string): Promise<WalletAccount[]>;
|
|
238
|
-
rejectScanSession?(sessionId: string): Promise<void>;
|
|
239
74
|
on(event: WalletEventType, callback: (data: unknown) => void): () => void;
|
|
240
75
|
removeListener(event: WalletEventType, callback: (data: unknown) => void): void;
|
|
241
76
|
removeAllListeners(event?: WalletEventType): void;
|
|
@@ -312,15 +147,9 @@ declare function fromChainId(chainId: RialoChainId): RialoNetwork;
|
|
|
312
147
|
declare function normalizeAccounts(accounts: Array<string | WalletAccount>): WalletAccount[];
|
|
313
148
|
|
|
314
149
|
/**
|
|
315
|
-
* @cookill/wallet-adapter v3.
|
|
150
|
+
* @cookill/wallet-adapter v3.0.0
|
|
316
151
|
* Pure JavaScript wallet class (no React dependency)
|
|
317
152
|
*
|
|
318
|
-
* Supports:
|
|
319
|
-
* - Standard connect/disconnect/sign operations
|
|
320
|
-
* - REX (Rialo Extended Execution) confidential transactions
|
|
321
|
-
* - SfS (Stake-for-Service) gasless transactions
|
|
322
|
-
* - Scan-to-Connect QR-based pairing
|
|
323
|
-
*
|
|
324
153
|
* Usage:
|
|
325
154
|
* const wallet = new SheepWallet();
|
|
326
155
|
* if (!wallet.isInstalled) { ... prompt install ... }
|
|
@@ -334,10 +163,7 @@ declare class SheepWallet {
|
|
|
334
163
|
private _network;
|
|
335
164
|
private _cleanupFns;
|
|
336
165
|
constructor();
|
|
337
|
-
/** True only if the browser extension is installed (not web wallet) */
|
|
338
166
|
get isInstalled(): boolean;
|
|
339
|
-
/** True if any provider (extension or web wallet) is available */
|
|
340
|
-
get hasProvider(): boolean;
|
|
341
167
|
get connected(): boolean;
|
|
342
168
|
get accounts(): WalletAccount[];
|
|
343
169
|
get activeAccount(): WalletAccount | undefined;
|
|
@@ -351,56 +177,6 @@ declare class SheepWallet {
|
|
|
351
177
|
signTransaction(tx: TransactionRequest): Promise<string>;
|
|
352
178
|
sendTransaction(tx: TransactionRequest): Promise<TransactionResult>;
|
|
353
179
|
signAndSendTransaction(tx: TransactionRequest): Promise<TransactionResult>;
|
|
354
|
-
/**
|
|
355
|
-
* Check if the connected wallet/network supports REX
|
|
356
|
-
*/
|
|
357
|
-
getREXCapabilities(): Promise<REXCapabilities>;
|
|
358
|
-
/**
|
|
359
|
-
* Submit a confidential transaction via REX
|
|
360
|
-
* The transaction inputs are encrypted and executed in a TEE/MPC/FHE environment
|
|
361
|
-
*/
|
|
362
|
-
submitREXTransaction(tx: TransactionRequest): Promise<REXTransactionResult>;
|
|
363
|
-
/**
|
|
364
|
-
* Send a gasless transaction using Stake-for-Service credits
|
|
365
|
-
* Automatically sets tx.gasless = true
|
|
366
|
-
*/
|
|
367
|
-
sendGaslessTransaction(tx: Omit<TransactionRequest, 'gasless'>): Promise<TransactionResult>;
|
|
368
|
-
/**
|
|
369
|
-
* Get all Stake-for-Service positions for the connected account
|
|
370
|
-
*/
|
|
371
|
-
getSfSPositions(): Promise<SfSPosition[]>;
|
|
372
|
-
/**
|
|
373
|
-
* Create a new Stake-for-Service position
|
|
374
|
-
* Stakes RLO and routes a fraction of yield to service credits
|
|
375
|
-
*/
|
|
376
|
-
createSfSPosition(params: SfSCreateParams): Promise<SfSPosition>;
|
|
377
|
-
/**
|
|
378
|
-
* Update an existing SfS position (e.g., change routing fraction)
|
|
379
|
-
*/
|
|
380
|
-
updateSfSPosition(params: SfSUpdateParams): Promise<SfSPosition>;
|
|
381
|
-
/**
|
|
382
|
-
* Close an SfS position and unstake
|
|
383
|
-
*/
|
|
384
|
-
closeSfSPosition(positionId: string): Promise<{
|
|
385
|
-
success: boolean;
|
|
386
|
-
}>;
|
|
387
|
-
/**
|
|
388
|
-
* Get current SfS service credit balance
|
|
389
|
-
*/
|
|
390
|
-
getSfSCredits(): Promise<SfSCreditBalance>;
|
|
391
|
-
/**
|
|
392
|
-
* Generate a scan-to-connect URI from the wallet side
|
|
393
|
-
* Returns a URI that can be displayed as QR code for dApps to scan
|
|
394
|
-
*/
|
|
395
|
-
createScanSession(): Promise<ScanConnectURI>;
|
|
396
|
-
/**
|
|
397
|
-
* Approve a scan-to-connect session (after wallet scans dApp QR)
|
|
398
|
-
*/
|
|
399
|
-
approveScanSession(sessionId: string): Promise<WalletAccount[]>;
|
|
400
|
-
/**
|
|
401
|
-
* Reject a scan-to-connect session
|
|
402
|
-
*/
|
|
403
|
-
rejectScanSession(sessionId: string): Promise<void>;
|
|
404
180
|
getBalance(address?: string): Promise<string>;
|
|
405
181
|
switchNetwork(network: RialoNetwork): Promise<void>;
|
|
406
182
|
on(event: string, callback: (data: unknown) => void): () => void;
|
|
@@ -409,4 +185,4 @@ declare class SheepWallet {
|
|
|
409
185
|
private _setupEvents;
|
|
410
186
|
}
|
|
411
187
|
|
|
412
|
-
export { type BalanceResult, NETWORKS, type NetworkConfig, type
|
|
188
|
+
export { type BalanceResult, NETWORKS, type NetworkConfig, type RialoChainId, type RialoNetwork, type RialoProvider, SheepWallet as RialoWallet, SheepWallet, type SignedMessage, type TransactionRequest, type TransactionResult, type WalletAccount, type WalletEventType, type WalletInfo, SheepWallet as default, formatAddress, formatBalance, fromChainId, getProvider, getProvider as getRialoProvider, isInstalled, isInstalled as isRialoInstalled, isValidAddress, normalizeAccounts, parseBalance, toChainId, waitForProvider, waitForProvider as waitForRialoProvider, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @cookill/wallet-adapter v3.
|
|
2
|
+
* @cookill/wallet-adapter v3.0.0
|
|
3
3
|
* Core type definitions
|
|
4
|
-
*
|
|
5
|
-
* Includes support for:
|
|
6
|
-
* - REX (Rialo Extended Execution) — confidential computation transactions
|
|
7
|
-
* - SfS (Stake-for-Service) — gasless transactions via staking yield
|
|
8
|
-
* - Scan-to-Connect — QR-based cross-device wallet pairing
|
|
9
4
|
*/
|
|
10
5
|
type RialoNetwork = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
|
|
11
6
|
type RialoChainId = `rialo:${RialoNetwork}`;
|
|
@@ -17,8 +12,6 @@ interface NetworkConfig {
|
|
|
17
12
|
explorerUrl?: string;
|
|
18
13
|
symbol: string;
|
|
19
14
|
decimals: number;
|
|
20
|
-
supportsREX?: boolean;
|
|
21
|
-
supportsSfS?: boolean;
|
|
22
15
|
}
|
|
23
16
|
declare const NETWORKS: Record<RialoNetwork, NetworkConfig>;
|
|
24
17
|
interface WalletAccount {
|
|
@@ -31,20 +24,12 @@ interface TransactionRequest {
|
|
|
31
24
|
value: string;
|
|
32
25
|
data?: string;
|
|
33
26
|
memo?: string;
|
|
34
|
-
/** If true, attempt to pay gas via Stake-for-Service credits */
|
|
35
|
-
gasless?: boolean;
|
|
36
|
-
/** REX confidential execution context */
|
|
37
|
-
rex?: REXConfig;
|
|
38
27
|
}
|
|
39
28
|
interface TransactionResult {
|
|
40
29
|
hash: string;
|
|
41
30
|
signature?: string;
|
|
42
31
|
status: 'pending' | 'confirmed' | 'failed';
|
|
43
32
|
blockNumber?: number;
|
|
44
|
-
/** Whether gas was paid via SfS credits */
|
|
45
|
-
gasless?: boolean;
|
|
46
|
-
/** REX execution proof if confidential */
|
|
47
|
-
rexProof?: string;
|
|
48
33
|
}
|
|
49
34
|
interface SignedMessage {
|
|
50
35
|
signature: string;
|
|
@@ -56,152 +41,14 @@ interface BalanceResult {
|
|
|
56
41
|
balance: string;
|
|
57
42
|
formatted: string;
|
|
58
43
|
}
|
|
59
|
-
/**
|
|
60
|
-
* REX enables privacy-preserving computation on Rialo.
|
|
61
|
-
* Transactions can be executed confidentially using TEEs, MPC, or FHE
|
|
62
|
-
* without exposing inputs to the public blockchain.
|
|
63
|
-
*/
|
|
64
|
-
/** Privacy technology used for confidential computation */
|
|
65
|
-
type REXPrivacyMode = 'tee' | 'mpc' | 'fhe' | 'auto';
|
|
66
|
-
interface REXConfig {
|
|
67
|
-
/** Enable confidential execution */
|
|
68
|
-
confidential: boolean;
|
|
69
|
-
/** Privacy technology to use (default: 'auto' — protocol selects optimal) */
|
|
70
|
-
privacyMode?: REXPrivacyMode;
|
|
71
|
-
/** Encrypted inputs (base64-encoded ciphertext) */
|
|
72
|
-
encryptedInputs?: string;
|
|
73
|
-
/** REX program ID to execute */
|
|
74
|
-
programId?: string;
|
|
75
|
-
/** Whether output should remain encrypted for future computation */
|
|
76
|
-
keepEncrypted?: boolean;
|
|
77
|
-
/** Access control — who can decrypt the result */
|
|
78
|
-
accessPolicy?: REXAccessPolicy;
|
|
79
|
-
}
|
|
80
|
-
interface REXAccessPolicy {
|
|
81
|
-
/** Addresses allowed to decrypt the result */
|
|
82
|
-
allowedDecryptors: string[];
|
|
83
|
-
/** Expiry timestamp (ms) for access */
|
|
84
|
-
expiresAt?: number;
|
|
85
|
-
}
|
|
86
|
-
interface REXTransactionResult extends TransactionResult {
|
|
87
|
-
/** Attestation proof from TEE/MPC */
|
|
88
|
-
attestation?: string;
|
|
89
|
-
/** Encrypted output (if keepEncrypted was true) */
|
|
90
|
-
encryptedOutput?: string;
|
|
91
|
-
/** Public output (if computation produced public results) */
|
|
92
|
-
publicOutput?: string;
|
|
93
|
-
}
|
|
94
|
-
/** REX capabilities query result */
|
|
95
|
-
interface REXCapabilities {
|
|
96
|
-
supported: boolean;
|
|
97
|
-
privacyModes: REXPrivacyMode[];
|
|
98
|
-
maxInputSize: number;
|
|
99
|
-
programs: string[];
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* SfS converts staking yield into service credits that automatically
|
|
103
|
-
* pay for network costs (gas, storage, scheduled executions).
|
|
104
|
-
* Users stake RLO, set a routing fraction, and the ServicePaymaster
|
|
105
|
-
* mints credits from their yield.
|
|
106
|
-
*/
|
|
107
|
-
interface SfSPosition {
|
|
108
|
-
/** Position ID */
|
|
109
|
-
id: string;
|
|
110
|
-
/** Staked principal in kelvins */
|
|
111
|
-
principal: string;
|
|
112
|
-
/** Validator/pool receiving the delegation */
|
|
113
|
-
validator: string;
|
|
114
|
-
/** Fraction of yield routed to service credits (0.0 - 1.0) */
|
|
115
|
-
routingFraction: number;
|
|
116
|
-
/** Current service credit balance */
|
|
117
|
-
creditBalance: string;
|
|
118
|
-
/** Estimated credits per epoch */
|
|
119
|
-
creditsPerEpoch: string;
|
|
120
|
-
/** Position status */
|
|
121
|
-
status: 'active' | 'pending' | 'closed';
|
|
122
|
-
/** Creation timestamp */
|
|
123
|
-
createdAt: number;
|
|
124
|
-
}
|
|
125
|
-
interface SfSCreateParams {
|
|
126
|
-
/** Amount of RLO to stake (in kelvins) */
|
|
127
|
-
amount: string;
|
|
128
|
-
/** Validator address to delegate to */
|
|
129
|
-
validator: string;
|
|
130
|
-
/** Fraction of yield to route to service credits (0.0 - 1.0) */
|
|
131
|
-
routingFraction: number;
|
|
132
|
-
}
|
|
133
|
-
interface SfSUpdateParams {
|
|
134
|
-
/** Position ID to update */
|
|
135
|
-
positionId: string;
|
|
136
|
-
/** New routing fraction (0.0 - 1.0) */
|
|
137
|
-
routingFraction?: number;
|
|
138
|
-
}
|
|
139
|
-
interface SfSCreditBalance {
|
|
140
|
-
/** Available service credits */
|
|
141
|
-
available: string;
|
|
142
|
-
/** Credits used this epoch */
|
|
143
|
-
usedThisEpoch: string;
|
|
144
|
-
/** Total credits earned */
|
|
145
|
-
totalEarned: string;
|
|
146
|
-
/** Estimated credits per epoch */
|
|
147
|
-
estimatedPerEpoch: string;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Enables connecting a wallet on one device to a dApp on another device
|
|
151
|
-
* via QR code scanning. Supports bidirectional flow:
|
|
152
|
-
* - dApp shows QR → wallet scans to connect
|
|
153
|
-
* - Wallet shows QR → dApp scans to connect
|
|
154
|
-
*/
|
|
155
|
-
interface ScanConnectSession {
|
|
156
|
-
/** Unique session identifier */
|
|
157
|
-
sessionId: string;
|
|
158
|
-
/** Session topic for relay */
|
|
159
|
-
topic: string;
|
|
160
|
-
/** Relay server URL */
|
|
161
|
-
relay: string;
|
|
162
|
-
/** Session encryption key (hex) */
|
|
163
|
-
symmetricKey: string;
|
|
164
|
-
/** Originator: 'dapp' or 'wallet' */
|
|
165
|
-
origin: 'dapp' | 'wallet';
|
|
166
|
-
/** dApp metadata */
|
|
167
|
-
dappMetadata?: ScanConnectDAppMetadata;
|
|
168
|
-
/** Wallet metadata */
|
|
169
|
-
walletMetadata?: ScanConnectWalletMetadata;
|
|
170
|
-
/** Requested chain IDs */
|
|
171
|
-
chains: RialoChainId[];
|
|
172
|
-
/** Expiry timestamp */
|
|
173
|
-
expiresAt: number;
|
|
174
|
-
}
|
|
175
|
-
interface ScanConnectDAppMetadata {
|
|
176
|
-
name: string;
|
|
177
|
-
url: string;
|
|
178
|
-
icon?: string;
|
|
179
|
-
description?: string;
|
|
180
|
-
}
|
|
181
|
-
interface ScanConnectWalletMetadata {
|
|
182
|
-
name: string;
|
|
183
|
-
icon?: string;
|
|
184
|
-
version?: string;
|
|
185
|
-
}
|
|
186
|
-
/** URI format for scan-to-connect QR codes */
|
|
187
|
-
interface ScanConnectURI {
|
|
188
|
-
/** Full URI string (rialo-wc://...) */
|
|
189
|
-
uri: string;
|
|
190
|
-
/** Parsed session info */
|
|
191
|
-
session: ScanConnectSession;
|
|
192
|
-
}
|
|
193
|
-
type ScanConnectStatus = 'idle' | 'generating' | 'waiting' | 'scanned' | 'approving' | 'connected' | 'expired' | 'rejected' | 'error';
|
|
194
44
|
interface WalletInfo {
|
|
195
45
|
id: string;
|
|
196
46
|
name: string;
|
|
197
47
|
icon: string;
|
|
198
48
|
installed?: boolean;
|
|
199
49
|
downloadUrl?: string;
|
|
200
|
-
supportsREX?: boolean;
|
|
201
|
-
supportsSfS?: boolean;
|
|
202
|
-
supportsScanConnect?: boolean;
|
|
203
50
|
}
|
|
204
|
-
type WalletEventType = 'connect' | 'disconnect' | 'accountsChanged' | 'networkChanged' | 'chainChanged' | '
|
|
51
|
+
type WalletEventType = 'connect' | 'disconnect' | 'accountsChanged' | 'networkChanged' | 'chainChanged' | 'error';
|
|
205
52
|
interface RialoProvider {
|
|
206
53
|
isRialo: boolean;
|
|
207
54
|
isSheepWallet?: boolean;
|
|
@@ -224,18 +71,6 @@ interface RialoProvider {
|
|
|
224
71
|
success: boolean;
|
|
225
72
|
}>;
|
|
226
73
|
getBalance(address?: string): Promise<BalanceResult | string>;
|
|
227
|
-
getREXCapabilities?(): Promise<REXCapabilities>;
|
|
228
|
-
submitREXTransaction?(tx: TransactionRequest): Promise<REXTransactionResult>;
|
|
229
|
-
getSfSPositions?(): Promise<SfSPosition[]>;
|
|
230
|
-
createSfSPosition?(params: SfSCreateParams): Promise<SfSPosition>;
|
|
231
|
-
updateSfSPosition?(params: SfSUpdateParams): Promise<SfSPosition>;
|
|
232
|
-
closeSfSPosition?(positionId: string): Promise<{
|
|
233
|
-
success: boolean;
|
|
234
|
-
}>;
|
|
235
|
-
getSfSCredits?(): Promise<SfSCreditBalance>;
|
|
236
|
-
createScanSession?(origin: 'wallet'): Promise<ScanConnectURI>;
|
|
237
|
-
approveScanSession?(sessionId: string): Promise<WalletAccount[]>;
|
|
238
|
-
rejectScanSession?(sessionId: string): Promise<void>;
|
|
239
74
|
on(event: WalletEventType, callback: (data: unknown) => void): () => void;
|
|
240
75
|
removeListener(event: WalletEventType, callback: (data: unknown) => void): void;
|
|
241
76
|
removeAllListeners(event?: WalletEventType): void;
|
|
@@ -312,15 +147,9 @@ declare function fromChainId(chainId: RialoChainId): RialoNetwork;
|
|
|
312
147
|
declare function normalizeAccounts(accounts: Array<string | WalletAccount>): WalletAccount[];
|
|
313
148
|
|
|
314
149
|
/**
|
|
315
|
-
* @cookill/wallet-adapter v3.
|
|
150
|
+
* @cookill/wallet-adapter v3.0.0
|
|
316
151
|
* Pure JavaScript wallet class (no React dependency)
|
|
317
152
|
*
|
|
318
|
-
* Supports:
|
|
319
|
-
* - Standard connect/disconnect/sign operations
|
|
320
|
-
* - REX (Rialo Extended Execution) confidential transactions
|
|
321
|
-
* - SfS (Stake-for-Service) gasless transactions
|
|
322
|
-
* - Scan-to-Connect QR-based pairing
|
|
323
|
-
*
|
|
324
153
|
* Usage:
|
|
325
154
|
* const wallet = new SheepWallet();
|
|
326
155
|
* if (!wallet.isInstalled) { ... prompt install ... }
|
|
@@ -334,10 +163,7 @@ declare class SheepWallet {
|
|
|
334
163
|
private _network;
|
|
335
164
|
private _cleanupFns;
|
|
336
165
|
constructor();
|
|
337
|
-
/** True only if the browser extension is installed (not web wallet) */
|
|
338
166
|
get isInstalled(): boolean;
|
|
339
|
-
/** True if any provider (extension or web wallet) is available */
|
|
340
|
-
get hasProvider(): boolean;
|
|
341
167
|
get connected(): boolean;
|
|
342
168
|
get accounts(): WalletAccount[];
|
|
343
169
|
get activeAccount(): WalletAccount | undefined;
|
|
@@ -351,56 +177,6 @@ declare class SheepWallet {
|
|
|
351
177
|
signTransaction(tx: TransactionRequest): Promise<string>;
|
|
352
178
|
sendTransaction(tx: TransactionRequest): Promise<TransactionResult>;
|
|
353
179
|
signAndSendTransaction(tx: TransactionRequest): Promise<TransactionResult>;
|
|
354
|
-
/**
|
|
355
|
-
* Check if the connected wallet/network supports REX
|
|
356
|
-
*/
|
|
357
|
-
getREXCapabilities(): Promise<REXCapabilities>;
|
|
358
|
-
/**
|
|
359
|
-
* Submit a confidential transaction via REX
|
|
360
|
-
* The transaction inputs are encrypted and executed in a TEE/MPC/FHE environment
|
|
361
|
-
*/
|
|
362
|
-
submitREXTransaction(tx: TransactionRequest): Promise<REXTransactionResult>;
|
|
363
|
-
/**
|
|
364
|
-
* Send a gasless transaction using Stake-for-Service credits
|
|
365
|
-
* Automatically sets tx.gasless = true
|
|
366
|
-
*/
|
|
367
|
-
sendGaslessTransaction(tx: Omit<TransactionRequest, 'gasless'>): Promise<TransactionResult>;
|
|
368
|
-
/**
|
|
369
|
-
* Get all Stake-for-Service positions for the connected account
|
|
370
|
-
*/
|
|
371
|
-
getSfSPositions(): Promise<SfSPosition[]>;
|
|
372
|
-
/**
|
|
373
|
-
* Create a new Stake-for-Service position
|
|
374
|
-
* Stakes RLO and routes a fraction of yield to service credits
|
|
375
|
-
*/
|
|
376
|
-
createSfSPosition(params: SfSCreateParams): Promise<SfSPosition>;
|
|
377
|
-
/**
|
|
378
|
-
* Update an existing SfS position (e.g., change routing fraction)
|
|
379
|
-
*/
|
|
380
|
-
updateSfSPosition(params: SfSUpdateParams): Promise<SfSPosition>;
|
|
381
|
-
/**
|
|
382
|
-
* Close an SfS position and unstake
|
|
383
|
-
*/
|
|
384
|
-
closeSfSPosition(positionId: string): Promise<{
|
|
385
|
-
success: boolean;
|
|
386
|
-
}>;
|
|
387
|
-
/**
|
|
388
|
-
* Get current SfS service credit balance
|
|
389
|
-
*/
|
|
390
|
-
getSfSCredits(): Promise<SfSCreditBalance>;
|
|
391
|
-
/**
|
|
392
|
-
* Generate a scan-to-connect URI from the wallet side
|
|
393
|
-
* Returns a URI that can be displayed as QR code for dApps to scan
|
|
394
|
-
*/
|
|
395
|
-
createScanSession(): Promise<ScanConnectURI>;
|
|
396
|
-
/**
|
|
397
|
-
* Approve a scan-to-connect session (after wallet scans dApp QR)
|
|
398
|
-
*/
|
|
399
|
-
approveScanSession(sessionId: string): Promise<WalletAccount[]>;
|
|
400
|
-
/**
|
|
401
|
-
* Reject a scan-to-connect session
|
|
402
|
-
*/
|
|
403
|
-
rejectScanSession(sessionId: string): Promise<void>;
|
|
404
180
|
getBalance(address?: string): Promise<string>;
|
|
405
181
|
switchNetwork(network: RialoNetwork): Promise<void>;
|
|
406
182
|
on(event: string, callback: (data: unknown) => void): () => void;
|
|
@@ -409,4 +185,4 @@ declare class SheepWallet {
|
|
|
409
185
|
private _setupEvents;
|
|
410
186
|
}
|
|
411
187
|
|
|
412
|
-
export { type BalanceResult, NETWORKS, type NetworkConfig, type
|
|
188
|
+
export { type BalanceResult, NETWORKS, type NetworkConfig, type RialoChainId, type RialoNetwork, type RialoProvider, SheepWallet as RialoWallet, SheepWallet, type SignedMessage, type TransactionRequest, type TransactionResult, type WalletAccount, type WalletEventType, type WalletInfo, SheepWallet as default, formatAddress, formatBalance, fromChainId, getProvider, getProvider as getRialoProvider, isInstalled, isInstalled as isRialoInstalled, isValidAddress, normalizeAccounts, parseBalance, toChainId, waitForProvider, waitForProvider as waitForRialoProvider, withTimeout };
|