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.
@@ -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
  }
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shogun-relay-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "SDK for interacting with Shogun Relay API - HTTP client for IPFS, deals, registry, and network operations",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",