@yodlpay/payment-decoder 1.2.0 → 1.2.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/dist/index.d.ts +4 -4
- package/dist/index.js +17 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -27,8 +27,8 @@ interface SwapInfo {
|
|
|
27
27
|
service: ServiceProvider;
|
|
28
28
|
}
|
|
29
29
|
interface BridgeInfo extends SwapInfo {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
sourceChainId: number;
|
|
31
|
+
sourceTxHash: Hex;
|
|
32
32
|
destinationChainId: number;
|
|
33
33
|
destinationTxHash: Hex;
|
|
34
34
|
tokenOutAmountGross: bigint;
|
|
@@ -59,8 +59,8 @@ interface YodlPayment {
|
|
|
59
59
|
data: Record<string, unknown>;
|
|
60
60
|
tokenIn: TokenInInfo;
|
|
61
61
|
tokenOut: TokenOutInfo;
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
sourceChainId: number;
|
|
63
|
+
sourceTxHash: Hex;
|
|
64
64
|
destinationChainId: number;
|
|
65
65
|
destinationTxHash: Hex;
|
|
66
66
|
solver: string | null;
|
package/dist/index.js
CHANGED
|
@@ -374,8 +374,8 @@ function parseRelayResponse(request) {
|
|
|
374
374
|
throw new NoBridgeFoundError();
|
|
375
375
|
}
|
|
376
376
|
return {
|
|
377
|
-
|
|
378
|
-
|
|
377
|
+
sourceChainId: inTx.chainId,
|
|
378
|
+
sourceTxHash: inTx.hash,
|
|
379
379
|
destinationChainId: outTx.chainId,
|
|
380
380
|
destinationTxHash: outTx.hash,
|
|
381
381
|
inputAmountGross: BigInt(data?.metadata?.currencyIn?.amount ?? 0)
|
|
@@ -384,18 +384,18 @@ function parseRelayResponse(request) {
|
|
|
384
384
|
async function decodeBridgePayment(hash, clients) {
|
|
385
385
|
const request = await fetchRelayRequest(hash);
|
|
386
386
|
const {
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
sourceChainId,
|
|
388
|
+
sourceTxHash,
|
|
389
389
|
destinationChainId,
|
|
390
390
|
destinationTxHash,
|
|
391
391
|
inputAmountGross
|
|
392
392
|
} = parseRelayResponse(request);
|
|
393
393
|
const destProvider = getClient(clients, destinationChainId);
|
|
394
|
-
const sourceProvider = getClient(clients,
|
|
394
|
+
const sourceProvider = getClient(clients, sourceChainId);
|
|
395
395
|
const { address: routerAddress } = getRouter(destinationChainId);
|
|
396
396
|
const [destReceipt, sourceReceipt] = await Promise.all([
|
|
397
397
|
destProvider.getTransactionReceipt({ hash: destinationTxHash }),
|
|
398
|
-
sourceProvider.getTransactionReceipt({ hash:
|
|
398
|
+
sourceProvider.getTransactionReceipt({ hash: sourceTxHash })
|
|
399
399
|
]);
|
|
400
400
|
const yodlEvent = decodeYodlFromLogs(destReceipt.logs, routerAddress);
|
|
401
401
|
if (!yodlEvent) {
|
|
@@ -406,7 +406,7 @@ async function decodeBridgePayment(hash, clients) {
|
|
|
406
406
|
const [destBlock, destTx, sender] = await Promise.all([
|
|
407
407
|
destProvider.getBlock({ blockNumber: destReceipt.blockNumber }),
|
|
408
408
|
destProvider.getTransaction({ hash: destinationTxHash }),
|
|
409
|
-
extractSenderFromSource(sourceReceipt, sourceProvider,
|
|
409
|
+
extractSenderFromSource(sourceReceipt, sourceProvider, sourceTxHash)
|
|
410
410
|
]);
|
|
411
411
|
const tokens = resolveBridgeTokens(
|
|
412
412
|
sourceReceipt,
|
|
@@ -414,12 +414,12 @@ async function decodeBridgePayment(hash, clients) {
|
|
|
414
414
|
yodlEvent,
|
|
415
415
|
sender,
|
|
416
416
|
inputAmountGross,
|
|
417
|
-
|
|
417
|
+
sourceChainId,
|
|
418
418
|
destinationChainId
|
|
419
419
|
);
|
|
420
420
|
const bridge = {
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
sourceChainId,
|
|
422
|
+
sourceTxHash,
|
|
423
423
|
destinationChainId,
|
|
424
424
|
destinationTxHash,
|
|
425
425
|
...tokens,
|
|
@@ -513,8 +513,8 @@ function extractTokenInfo(paymentInfo, chainId, txHash) {
|
|
|
513
513
|
inChainId: chainId,
|
|
514
514
|
outChainId: chainId
|
|
515
515
|
}),
|
|
516
|
-
|
|
517
|
-
|
|
516
|
+
sourceChainId: chainId,
|
|
517
|
+
sourceTxHash: txHash,
|
|
518
518
|
destinationChainId: chainId,
|
|
519
519
|
destinationTxHash: txHash,
|
|
520
520
|
solver: null
|
|
@@ -531,8 +531,8 @@ function extractTokenInfo(paymentInfo, chainId, txHash) {
|
|
|
531
531
|
inChainId: chainId,
|
|
532
532
|
outChainId: chainId
|
|
533
533
|
}),
|
|
534
|
-
|
|
535
|
-
|
|
534
|
+
sourceChainId: chainId,
|
|
535
|
+
sourceTxHash: txHash,
|
|
536
536
|
destinationChainId: chainId,
|
|
537
537
|
destinationTxHash: txHash,
|
|
538
538
|
solver: paymentInfo.service ?? null
|
|
@@ -546,11 +546,11 @@ function extractTokenInfo(paymentInfo, chainId, txHash) {
|
|
|
546
546
|
tokenOut: paymentInfo.tokenOut,
|
|
547
547
|
tokenOutAmountGross: paymentInfo.tokenOutAmountGross,
|
|
548
548
|
tokenOutAmountNet: paymentInfo.amount,
|
|
549
|
-
inChainId: paymentInfo.
|
|
549
|
+
inChainId: paymentInfo.sourceChainId,
|
|
550
550
|
outChainId: paymentInfo.destinationChainId
|
|
551
551
|
}),
|
|
552
|
-
|
|
553
|
-
|
|
552
|
+
sourceChainId: paymentInfo.sourceChainId,
|
|
553
|
+
sourceTxHash: paymentInfo.sourceTxHash,
|
|
554
554
|
destinationChainId: paymentInfo.destinationChainId,
|
|
555
555
|
destinationTxHash: paymentInfo.destinationTxHash,
|
|
556
556
|
solver: paymentInfo.service ?? null
|