@silentswap/sdk 0.1.46 → 0.1.48
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/bridge.d.ts +2 -0
- package/dist/bridge.js +3 -1
- package/dist/chain.d.ts +1 -0
- package/dist/chain.js +3 -1
- package/package.json +1 -1
package/dist/bridge.d.ts
CHANGED
|
@@ -65,6 +65,8 @@ export interface BridgeStatus {
|
|
|
65
65
|
txHashes?: (Hex | string)[];
|
|
66
66
|
details?: string;
|
|
67
67
|
requestId?: string;
|
|
68
|
+
/** Actual bridge provider used during execution (may differ from quote if fallback occurred) */
|
|
69
|
+
provider?: BridgeProvider;
|
|
68
70
|
}
|
|
69
71
|
/**
|
|
70
72
|
* Bridge quote parameters
|
package/dist/bridge.js
CHANGED
|
@@ -127,6 +127,7 @@ export async function executeRelayBridge(quote, executeTransaction, switchChain,
|
|
|
127
127
|
status: 'pending',
|
|
128
128
|
txHashes: txHashes, // Type assertion for compatibility
|
|
129
129
|
requestId,
|
|
130
|
+
provider: 'relay',
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
133
|
/**
|
|
@@ -159,6 +160,7 @@ export async function executeDebridgeBridge(quote, executeTransaction, switchCha
|
|
|
159
160
|
status: 'pending',
|
|
160
161
|
txHashes: txHashes, // Type assertion for compatibility
|
|
161
162
|
requestId: quote.route.orderId,
|
|
163
|
+
provider: 'debridge',
|
|
162
164
|
};
|
|
163
165
|
}
|
|
164
166
|
/**
|
|
@@ -243,7 +245,7 @@ function mapDebridgeStatus(status) {
|
|
|
243
245
|
* Fetch a relay.link quote with detailed response
|
|
244
246
|
*/
|
|
245
247
|
export async function fetchRelayQuote(params, signal) {
|
|
246
|
-
const response = await fetch('https://api.relay.link/quote', {
|
|
248
|
+
const response = await fetch('https://api.relay.link/quote/v2', {
|
|
247
249
|
method: 'POST',
|
|
248
250
|
headers: {
|
|
249
251
|
'Content-Type': 'application/json',
|
package/dist/chain.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export declare function createPublicClientWithRpc(chainId: number, chain?: Chain
|
|
|
56
56
|
export declare function waitForTransactionConfirmation(hash: Hex, publicClient: PublicClient, timeoutMs?: number): Promise<{
|
|
57
57
|
status: 'success' | 'failed';
|
|
58
58
|
transactionHash: Hex;
|
|
59
|
+
reason?: 'reverted' | 'timeout' | 'error';
|
|
59
60
|
}>;
|
|
60
61
|
/**
|
|
61
62
|
* Execute a transaction with confirmation waiting
|
package/dist/chain.js
CHANGED
|
@@ -208,6 +208,7 @@ export async function waitForTransactionConfirmation(hash, publicClient, timeout
|
|
|
208
208
|
]);
|
|
209
209
|
return {
|
|
210
210
|
status: receipt.status === 'success' ? 'success' : 'failed',
|
|
211
|
+
reason: receipt.status === 'success' ? undefined : 'reverted',
|
|
211
212
|
transactionHash: hash,
|
|
212
213
|
};
|
|
213
214
|
}
|
|
@@ -220,9 +221,10 @@ export async function waitForTransactionConfirmation(hash, publicClient, timeout
|
|
|
220
221
|
isTimeout,
|
|
221
222
|
});
|
|
222
223
|
// Return failed status instead of throwing to allow callers to handle gracefully
|
|
223
|
-
// Callers can check
|
|
224
|
+
// Callers can check reason to distinguish timeout from on-chain revert
|
|
224
225
|
return {
|
|
225
226
|
status: 'failed',
|
|
227
|
+
reason: isTimeout ? 'timeout' : 'error',
|
|
226
228
|
transactionHash: hash,
|
|
227
229
|
};
|
|
228
230
|
}
|