@cookill/wallet-adapter 3.0.0 → 3.1.1
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 +160 -214
- package/dist/index.cjs +197 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +223 -3
- package/dist/index.d.ts +223 -3
- package/dist/index.js +197 -4
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +197 -4
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +197 -4
- package/dist/react.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @cookill/wallet-adapter v3.
|
|
2
|
+
* @cookill/wallet-adapter v3.1.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
|
|
4
9
|
*/
|
|
5
10
|
type RialoNetwork = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
|
|
6
11
|
type RialoChainId = `rialo:${RialoNetwork}`;
|
|
@@ -12,6 +17,8 @@ interface NetworkConfig {
|
|
|
12
17
|
explorerUrl?: string;
|
|
13
18
|
symbol: string;
|
|
14
19
|
decimals: number;
|
|
20
|
+
supportsREX?: boolean;
|
|
21
|
+
supportsSfS?: boolean;
|
|
15
22
|
}
|
|
16
23
|
declare const NETWORKS: Record<RialoNetwork, NetworkConfig>;
|
|
17
24
|
interface WalletAccount {
|
|
@@ -24,12 +31,20 @@ interface TransactionRequest {
|
|
|
24
31
|
value: string;
|
|
25
32
|
data?: string;
|
|
26
33
|
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;
|
|
27
38
|
}
|
|
28
39
|
interface TransactionResult {
|
|
29
40
|
hash: string;
|
|
30
41
|
signature?: string;
|
|
31
42
|
status: 'pending' | 'confirmed' | 'failed';
|
|
32
43
|
blockNumber?: number;
|
|
44
|
+
/** Whether gas was paid via SfS credits */
|
|
45
|
+
gasless?: boolean;
|
|
46
|
+
/** REX execution proof if confidential */
|
|
47
|
+
rexProof?: string;
|
|
33
48
|
}
|
|
34
49
|
interface SignedMessage {
|
|
35
50
|
signature: string;
|
|
@@ -41,14 +56,151 @@ interface BalanceResult {
|
|
|
41
56
|
balance: string;
|
|
42
57
|
formatted: string;
|
|
43
58
|
}
|
|
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
|
+
}
|
|
44
193
|
interface WalletInfo {
|
|
45
194
|
id: string;
|
|
46
195
|
name: string;
|
|
47
196
|
icon: string;
|
|
48
197
|
installed?: boolean;
|
|
49
198
|
downloadUrl?: string;
|
|
199
|
+
supportsREX?: boolean;
|
|
200
|
+
supportsSfS?: boolean;
|
|
201
|
+
supportsScanConnect?: boolean;
|
|
50
202
|
}
|
|
51
|
-
type WalletEventType = 'connect' | 'disconnect' | 'accountsChanged' | 'networkChanged' | 'chainChanged' | 'error';
|
|
203
|
+
type WalletEventType = 'connect' | 'disconnect' | 'accountsChanged' | 'networkChanged' | 'chainChanged' | 'scanConnect' | 'sfsUpdate' | 'error';
|
|
52
204
|
interface RialoProvider {
|
|
53
205
|
isRialo: boolean;
|
|
54
206
|
isSheepWallet?: boolean;
|
|
@@ -71,6 +223,18 @@ interface RialoProvider {
|
|
|
71
223
|
success: boolean;
|
|
72
224
|
}>;
|
|
73
225
|
getBalance(address?: string): Promise<BalanceResult | string>;
|
|
226
|
+
getREXCapabilities?(): Promise<REXCapabilities>;
|
|
227
|
+
submitREXTransaction?(tx: TransactionRequest): Promise<REXTransactionResult>;
|
|
228
|
+
getSfSPositions?(): Promise<SfSPosition[]>;
|
|
229
|
+
createSfSPosition?(params: SfSCreateParams): Promise<SfSPosition>;
|
|
230
|
+
updateSfSPosition?(params: SfSUpdateParams): Promise<SfSPosition>;
|
|
231
|
+
closeSfSPosition?(positionId: string): Promise<{
|
|
232
|
+
success: boolean;
|
|
233
|
+
}>;
|
|
234
|
+
getSfSCredits?(): Promise<SfSCreditBalance>;
|
|
235
|
+
createScanSession?(origin: 'wallet'): Promise<ScanConnectURI>;
|
|
236
|
+
approveScanSession?(sessionId: string): Promise<WalletAccount[]>;
|
|
237
|
+
rejectScanSession?(sessionId: string): Promise<void>;
|
|
74
238
|
on(event: WalletEventType, callback: (data: unknown) => void): () => void;
|
|
75
239
|
removeListener(event: WalletEventType, callback: (data: unknown) => void): void;
|
|
76
240
|
removeAllListeners(event?: WalletEventType): void;
|
|
@@ -147,9 +311,15 @@ declare function fromChainId(chainId: RialoChainId): RialoNetwork;
|
|
|
147
311
|
declare function normalizeAccounts(accounts: Array<string | WalletAccount>): WalletAccount[];
|
|
148
312
|
|
|
149
313
|
/**
|
|
150
|
-
* @cookill/wallet-adapter v3.
|
|
314
|
+
* @cookill/wallet-adapter v3.1.0
|
|
151
315
|
* Pure JavaScript wallet class (no React dependency)
|
|
152
316
|
*
|
|
317
|
+
* Supports:
|
|
318
|
+
* - Standard connect/disconnect/sign operations
|
|
319
|
+
* - REX (Rialo Extended Execution) confidential transactions
|
|
320
|
+
* - SfS (Stake-for-Service) gasless transactions
|
|
321
|
+
* - Scan-to-Connect QR-based pairing
|
|
322
|
+
*
|
|
153
323
|
* Usage:
|
|
154
324
|
* const wallet = new SheepWallet();
|
|
155
325
|
* if (!wallet.isInstalled) { ... prompt install ... }
|
|
@@ -177,6 +347,56 @@ declare class SheepWallet {
|
|
|
177
347
|
signTransaction(tx: TransactionRequest): Promise<string>;
|
|
178
348
|
sendTransaction(tx: TransactionRequest): Promise<TransactionResult>;
|
|
179
349
|
signAndSendTransaction(tx: TransactionRequest): Promise<TransactionResult>;
|
|
350
|
+
/**
|
|
351
|
+
* Check if the connected wallet/network supports REX
|
|
352
|
+
*/
|
|
353
|
+
getREXCapabilities(): Promise<REXCapabilities>;
|
|
354
|
+
/**
|
|
355
|
+
* Submit a confidential transaction via REX
|
|
356
|
+
* The transaction inputs are encrypted and executed in a TEE/MPC/FHE environment
|
|
357
|
+
*/
|
|
358
|
+
submitREXTransaction(tx: TransactionRequest): Promise<REXTransactionResult>;
|
|
359
|
+
/**
|
|
360
|
+
* Send a gasless transaction using Stake-for-Service credits
|
|
361
|
+
* Automatically sets tx.gasless = true
|
|
362
|
+
*/
|
|
363
|
+
sendGaslessTransaction(tx: Omit<TransactionRequest, 'gasless'>): Promise<TransactionResult>;
|
|
364
|
+
/**
|
|
365
|
+
* Get all Stake-for-Service positions for the connected account
|
|
366
|
+
*/
|
|
367
|
+
getSfSPositions(): Promise<SfSPosition[]>;
|
|
368
|
+
/**
|
|
369
|
+
* Create a new Stake-for-Service position
|
|
370
|
+
* Stakes RLO and routes a fraction of yield to service credits
|
|
371
|
+
*/
|
|
372
|
+
createSfSPosition(params: SfSCreateParams): Promise<SfSPosition>;
|
|
373
|
+
/**
|
|
374
|
+
* Update an existing SfS position (e.g., change routing fraction)
|
|
375
|
+
*/
|
|
376
|
+
updateSfSPosition(params: SfSUpdateParams): Promise<SfSPosition>;
|
|
377
|
+
/**
|
|
378
|
+
* Close an SfS position and unstake
|
|
379
|
+
*/
|
|
380
|
+
closeSfSPosition(positionId: string): Promise<{
|
|
381
|
+
success: boolean;
|
|
382
|
+
}>;
|
|
383
|
+
/**
|
|
384
|
+
* Get current SfS service credit balance
|
|
385
|
+
*/
|
|
386
|
+
getSfSCredits(): Promise<SfSCreditBalance>;
|
|
387
|
+
/**
|
|
388
|
+
* Generate a scan-to-connect URI from the wallet side
|
|
389
|
+
* Returns a URI that can be displayed as QR code for dApps to scan
|
|
390
|
+
*/
|
|
391
|
+
createScanSession(): Promise<ScanConnectURI>;
|
|
392
|
+
/**
|
|
393
|
+
* Approve a scan-to-connect session (after wallet scans dApp QR)
|
|
394
|
+
*/
|
|
395
|
+
approveScanSession(sessionId: string): Promise<WalletAccount[]>;
|
|
396
|
+
/**
|
|
397
|
+
* Reject a scan-to-connect session
|
|
398
|
+
*/
|
|
399
|
+
rejectScanSession(sessionId: string): Promise<void>;
|
|
180
400
|
getBalance(address?: string): Promise<string>;
|
|
181
401
|
switchNetwork(network: RialoNetwork): Promise<void>;
|
|
182
402
|
on(event: string, callback: (data: unknown) => void): () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @cookill/wallet-adapter v3.
|
|
2
|
+
* @cookill/wallet-adapter v3.1.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
|
|
4
9
|
*/
|
|
5
10
|
type RialoNetwork = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
|
|
6
11
|
type RialoChainId = `rialo:${RialoNetwork}`;
|
|
@@ -12,6 +17,8 @@ interface NetworkConfig {
|
|
|
12
17
|
explorerUrl?: string;
|
|
13
18
|
symbol: string;
|
|
14
19
|
decimals: number;
|
|
20
|
+
supportsREX?: boolean;
|
|
21
|
+
supportsSfS?: boolean;
|
|
15
22
|
}
|
|
16
23
|
declare const NETWORKS: Record<RialoNetwork, NetworkConfig>;
|
|
17
24
|
interface WalletAccount {
|
|
@@ -24,12 +31,20 @@ interface TransactionRequest {
|
|
|
24
31
|
value: string;
|
|
25
32
|
data?: string;
|
|
26
33
|
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;
|
|
27
38
|
}
|
|
28
39
|
interface TransactionResult {
|
|
29
40
|
hash: string;
|
|
30
41
|
signature?: string;
|
|
31
42
|
status: 'pending' | 'confirmed' | 'failed';
|
|
32
43
|
blockNumber?: number;
|
|
44
|
+
/** Whether gas was paid via SfS credits */
|
|
45
|
+
gasless?: boolean;
|
|
46
|
+
/** REX execution proof if confidential */
|
|
47
|
+
rexProof?: string;
|
|
33
48
|
}
|
|
34
49
|
interface SignedMessage {
|
|
35
50
|
signature: string;
|
|
@@ -41,14 +56,151 @@ interface BalanceResult {
|
|
|
41
56
|
balance: string;
|
|
42
57
|
formatted: string;
|
|
43
58
|
}
|
|
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
|
+
}
|
|
44
193
|
interface WalletInfo {
|
|
45
194
|
id: string;
|
|
46
195
|
name: string;
|
|
47
196
|
icon: string;
|
|
48
197
|
installed?: boolean;
|
|
49
198
|
downloadUrl?: string;
|
|
199
|
+
supportsREX?: boolean;
|
|
200
|
+
supportsSfS?: boolean;
|
|
201
|
+
supportsScanConnect?: boolean;
|
|
50
202
|
}
|
|
51
|
-
type WalletEventType = 'connect' | 'disconnect' | 'accountsChanged' | 'networkChanged' | 'chainChanged' | 'error';
|
|
203
|
+
type WalletEventType = 'connect' | 'disconnect' | 'accountsChanged' | 'networkChanged' | 'chainChanged' | 'scanConnect' | 'sfsUpdate' | 'error';
|
|
52
204
|
interface RialoProvider {
|
|
53
205
|
isRialo: boolean;
|
|
54
206
|
isSheepWallet?: boolean;
|
|
@@ -71,6 +223,18 @@ interface RialoProvider {
|
|
|
71
223
|
success: boolean;
|
|
72
224
|
}>;
|
|
73
225
|
getBalance(address?: string): Promise<BalanceResult | string>;
|
|
226
|
+
getREXCapabilities?(): Promise<REXCapabilities>;
|
|
227
|
+
submitREXTransaction?(tx: TransactionRequest): Promise<REXTransactionResult>;
|
|
228
|
+
getSfSPositions?(): Promise<SfSPosition[]>;
|
|
229
|
+
createSfSPosition?(params: SfSCreateParams): Promise<SfSPosition>;
|
|
230
|
+
updateSfSPosition?(params: SfSUpdateParams): Promise<SfSPosition>;
|
|
231
|
+
closeSfSPosition?(positionId: string): Promise<{
|
|
232
|
+
success: boolean;
|
|
233
|
+
}>;
|
|
234
|
+
getSfSCredits?(): Promise<SfSCreditBalance>;
|
|
235
|
+
createScanSession?(origin: 'wallet'): Promise<ScanConnectURI>;
|
|
236
|
+
approveScanSession?(sessionId: string): Promise<WalletAccount[]>;
|
|
237
|
+
rejectScanSession?(sessionId: string): Promise<void>;
|
|
74
238
|
on(event: WalletEventType, callback: (data: unknown) => void): () => void;
|
|
75
239
|
removeListener(event: WalletEventType, callback: (data: unknown) => void): void;
|
|
76
240
|
removeAllListeners(event?: WalletEventType): void;
|
|
@@ -147,9 +311,15 @@ declare function fromChainId(chainId: RialoChainId): RialoNetwork;
|
|
|
147
311
|
declare function normalizeAccounts(accounts: Array<string | WalletAccount>): WalletAccount[];
|
|
148
312
|
|
|
149
313
|
/**
|
|
150
|
-
* @cookill/wallet-adapter v3.
|
|
314
|
+
* @cookill/wallet-adapter v3.1.0
|
|
151
315
|
* Pure JavaScript wallet class (no React dependency)
|
|
152
316
|
*
|
|
317
|
+
* Supports:
|
|
318
|
+
* - Standard connect/disconnect/sign operations
|
|
319
|
+
* - REX (Rialo Extended Execution) confidential transactions
|
|
320
|
+
* - SfS (Stake-for-Service) gasless transactions
|
|
321
|
+
* - Scan-to-Connect QR-based pairing
|
|
322
|
+
*
|
|
153
323
|
* Usage:
|
|
154
324
|
* const wallet = new SheepWallet();
|
|
155
325
|
* if (!wallet.isInstalled) { ... prompt install ... }
|
|
@@ -177,6 +347,56 @@ declare class SheepWallet {
|
|
|
177
347
|
signTransaction(tx: TransactionRequest): Promise<string>;
|
|
178
348
|
sendTransaction(tx: TransactionRequest): Promise<TransactionResult>;
|
|
179
349
|
signAndSendTransaction(tx: TransactionRequest): Promise<TransactionResult>;
|
|
350
|
+
/**
|
|
351
|
+
* Check if the connected wallet/network supports REX
|
|
352
|
+
*/
|
|
353
|
+
getREXCapabilities(): Promise<REXCapabilities>;
|
|
354
|
+
/**
|
|
355
|
+
* Submit a confidential transaction via REX
|
|
356
|
+
* The transaction inputs are encrypted and executed in a TEE/MPC/FHE environment
|
|
357
|
+
*/
|
|
358
|
+
submitREXTransaction(tx: TransactionRequest): Promise<REXTransactionResult>;
|
|
359
|
+
/**
|
|
360
|
+
* Send a gasless transaction using Stake-for-Service credits
|
|
361
|
+
* Automatically sets tx.gasless = true
|
|
362
|
+
*/
|
|
363
|
+
sendGaslessTransaction(tx: Omit<TransactionRequest, 'gasless'>): Promise<TransactionResult>;
|
|
364
|
+
/**
|
|
365
|
+
* Get all Stake-for-Service positions for the connected account
|
|
366
|
+
*/
|
|
367
|
+
getSfSPositions(): Promise<SfSPosition[]>;
|
|
368
|
+
/**
|
|
369
|
+
* Create a new Stake-for-Service position
|
|
370
|
+
* Stakes RLO and routes a fraction of yield to service credits
|
|
371
|
+
*/
|
|
372
|
+
createSfSPosition(params: SfSCreateParams): Promise<SfSPosition>;
|
|
373
|
+
/**
|
|
374
|
+
* Update an existing SfS position (e.g., change routing fraction)
|
|
375
|
+
*/
|
|
376
|
+
updateSfSPosition(params: SfSUpdateParams): Promise<SfSPosition>;
|
|
377
|
+
/**
|
|
378
|
+
* Close an SfS position and unstake
|
|
379
|
+
*/
|
|
380
|
+
closeSfSPosition(positionId: string): Promise<{
|
|
381
|
+
success: boolean;
|
|
382
|
+
}>;
|
|
383
|
+
/**
|
|
384
|
+
* Get current SfS service credit balance
|
|
385
|
+
*/
|
|
386
|
+
getSfSCredits(): Promise<SfSCreditBalance>;
|
|
387
|
+
/**
|
|
388
|
+
* Generate a scan-to-connect URI from the wallet side
|
|
389
|
+
* Returns a URI that can be displayed as QR code for dApps to scan
|
|
390
|
+
*/
|
|
391
|
+
createScanSession(): Promise<ScanConnectURI>;
|
|
392
|
+
/**
|
|
393
|
+
* Approve a scan-to-connect session (after wallet scans dApp QR)
|
|
394
|
+
*/
|
|
395
|
+
approveScanSession(sessionId: string): Promise<WalletAccount[]>;
|
|
396
|
+
/**
|
|
397
|
+
* Reject a scan-to-connect session
|
|
398
|
+
*/
|
|
399
|
+
rejectScanSession(sessionId: string): Promise<void>;
|
|
180
400
|
getBalance(address?: string): Promise<string>;
|
|
181
401
|
switchNetwork(network: RialoNetwork): Promise<void>;
|
|
182
402
|
on(event: string, callback: (data: unknown) => void): () => void;
|