shogun-relay-sdk 1.1.2 → 1.1.4

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
@@ -203,4 +214,56 @@ export declare class BridgeModule {
203
214
  message: string;
204
215
  error?: string;
205
216
  }>;
217
+ /**
218
+ * Get all transactions (deposits, withdrawals, transfers) for a user
219
+ * Returns a unified list of all transaction types sorted by timestamp
220
+ * @param userAddress User's Ethereum address
221
+ * @returns Transaction history
222
+ */
223
+ getTransactions(userAddress: string): Promise<{
224
+ success: boolean;
225
+ user: string;
226
+ transactions: Array<{
227
+ type: 'deposit' | 'withdrawal' | 'transfer';
228
+ txHash: string;
229
+ from?: string;
230
+ to?: string;
231
+ amount: string;
232
+ amountEth: string;
233
+ timestamp: number;
234
+ blockNumber?: number;
235
+ nonce?: string;
236
+ batchId?: string;
237
+ status: 'pending' | 'completed' | 'batched';
238
+ }>;
239
+ count: number;
240
+ summary: {
241
+ deposits: number;
242
+ withdrawals: number;
243
+ transfers: number;
244
+ };
245
+ }>;
246
+ /**
247
+ * Get detailed information about a specific transaction by hash
248
+ * Searches across deposits, withdrawals, and transfers
249
+ * @param txHash Transaction hash
250
+ * @returns Transaction details
251
+ */
252
+ getTransaction(txHash: string): Promise<{
253
+ success: boolean;
254
+ transaction?: {
255
+ type: 'deposit' | 'withdrawal' | 'transfer';
256
+ txHash: string;
257
+ from?: string;
258
+ to?: string;
259
+ amount: string;
260
+ amountEth: string;
261
+ timestamp: number;
262
+ blockNumber?: number;
263
+ nonce?: string;
264
+ status: 'pending' | 'completed' | 'batched';
265
+ };
266
+ source?: 'deposit' | 'withdrawal' | 'transfer';
267
+ error?: string;
268
+ }>;
206
269
  }
@@ -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
@@ -97,5 +106,23 @@ class BridgeModule {
97
106
  async reconcileBalance(userAddress) {
98
107
  return this.client.post('/api/v1/bridge/reconcile-balance', { user: userAddress });
99
108
  }
109
+ /**
110
+ * Get all transactions (deposits, withdrawals, transfers) for a user
111
+ * Returns a unified list of all transaction types sorted by timestamp
112
+ * @param userAddress User's Ethereum address
113
+ * @returns Transaction history
114
+ */
115
+ async getTransactions(userAddress) {
116
+ return this.client.get(`/api/v1/bridge/transactions/${userAddress}`);
117
+ }
118
+ /**
119
+ * Get detailed information about a specific transaction by hash
120
+ * Searches across deposits, withdrawals, and transfers
121
+ * @param txHash Transaction hash
122
+ * @returns Transaction details
123
+ */
124
+ async getTransaction(txHash) {
125
+ return this.client.get(`/api/v1/bridge/transaction/${txHash}`);
126
+ }
100
127
  }
101
128
  exports.BridgeModule = BridgeModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shogun-relay-sdk",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
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",