shogun-relay-sdk 1.1.1 → 1.1.3
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/dist/modules/bridge.d.ts +26 -0
- package/dist/modules/bridge.js +18 -0
- package/package.json +1 -1
package/dist/modules/bridge.d.ts
CHANGED
|
@@ -61,6 +61,17 @@ export declare class BridgeModule {
|
|
|
61
61
|
balance: string;
|
|
62
62
|
balanceEth: string;
|
|
63
63
|
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Get the next nonce for a user (for withdrawal requests)
|
|
66
|
+
* This allows clients to include the nonce in their signed message
|
|
67
|
+
* @param userAddress User's Ethereum address
|
|
68
|
+
* @returns Last nonce and next nonce
|
|
69
|
+
*/
|
|
70
|
+
getNonce(userAddress: string): Promise<{
|
|
71
|
+
success: boolean;
|
|
72
|
+
lastNonce: string;
|
|
73
|
+
nextNonce: string;
|
|
74
|
+
}>;
|
|
64
75
|
/**
|
|
65
76
|
* Transfer balance from one user to another (L2 -> L2)
|
|
66
77
|
* @param params Transfer parameters
|
|
@@ -188,4 +199,19 @@ export declare class BridgeModule {
|
|
|
188
199
|
message?: string;
|
|
189
200
|
error?: string;
|
|
190
201
|
}>;
|
|
202
|
+
/**
|
|
203
|
+
* Reconcile user's L2 balance by recalculating from deposits, withdrawals, and L2 transfers
|
|
204
|
+
* This fixes balance discrepancies caused by old transfer implementations
|
|
205
|
+
* @param userAddress User's Ethereum address to reconcile
|
|
206
|
+
* @returns Reconciliation result
|
|
207
|
+
*/
|
|
208
|
+
reconcileBalance(userAddress: string): Promise<{
|
|
209
|
+
success: boolean;
|
|
210
|
+
user: string;
|
|
211
|
+
currentBalance: string;
|
|
212
|
+
calculatedBalance: string;
|
|
213
|
+
corrected: boolean;
|
|
214
|
+
message: string;
|
|
215
|
+
error?: string;
|
|
216
|
+
}>;
|
|
191
217
|
}
|
package/dist/modules/bridge.js
CHANGED
|
@@ -13,6 +13,15 @@ class BridgeModule {
|
|
|
13
13
|
async getBalance(userAddress) {
|
|
14
14
|
return this.client.get(`/api/v1/bridge/balance/${userAddress}`);
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Get the next nonce for a user (for withdrawal requests)
|
|
18
|
+
* This allows clients to include the nonce in their signed message
|
|
19
|
+
* @param userAddress User's Ethereum address
|
|
20
|
+
* @returns Last nonce and next nonce
|
|
21
|
+
*/
|
|
22
|
+
async getNonce(userAddress) {
|
|
23
|
+
return this.client.get(`/api/v1/bridge/nonce/${userAddress}`);
|
|
24
|
+
}
|
|
16
25
|
/**
|
|
17
26
|
* Transfer balance from one user to another (L2 -> L2)
|
|
18
27
|
* @param params Transfer parameters
|
|
@@ -88,5 +97,14 @@ class BridgeModule {
|
|
|
88
97
|
async processDeposit(txHash) {
|
|
89
98
|
return this.client.post('/api/v1/bridge/process-deposit', { txHash });
|
|
90
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Reconcile user's L2 balance by recalculating from deposits, withdrawals, and L2 transfers
|
|
102
|
+
* This fixes balance discrepancies caused by old transfer implementations
|
|
103
|
+
* @param userAddress User's Ethereum address to reconcile
|
|
104
|
+
* @returns Reconciliation result
|
|
105
|
+
*/
|
|
106
|
+
async reconcileBalance(userAddress) {
|
|
107
|
+
return this.client.post('/api/v1/bridge/reconcile-balance', { user: userAddress });
|
|
108
|
+
}
|
|
91
109
|
}
|
|
92
110
|
exports.BridgeModule = BridgeModule;
|
package/package.json
CHANGED