@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 CHANGED
@@ -27,8 +27,8 @@ interface SwapInfo {
27
27
  service: ServiceProvider;
28
28
  }
29
29
  interface BridgeInfo extends SwapInfo {
30
- originChainId: number;
31
- originTxHash: Hex;
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
- originChainId: number;
63
- originTxHash: Hex;
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
- originChainId: inTx.chainId,
378
- originTxHash: inTx.hash,
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
- originChainId,
388
- originTxHash,
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, originChainId);
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: originTxHash })
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, originTxHash)
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
- originChainId,
417
+ sourceChainId,
418
418
  destinationChainId
419
419
  );
420
420
  const bridge = {
421
- originChainId,
422
- originTxHash,
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
- originChainId: chainId,
517
- originTxHash: txHash,
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
- originChainId: chainId,
535
- originTxHash: txHash,
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.originChainId,
549
+ inChainId: paymentInfo.sourceChainId,
550
550
  outChainId: paymentInfo.destinationChainId
551
551
  }),
552
- originChainId: paymentInfo.originChainId,
553
- originTxHash: paymentInfo.originTxHash,
552
+ sourceChainId: paymentInfo.sourceChainId,
553
+ sourceTxHash: paymentInfo.sourceTxHash,
554
554
  destinationChainId: paymentInfo.destinationChainId,
555
555
  destinationTxHash: paymentInfo.destinationTxHash,
556
556
  solver: paymentInfo.service ?? null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yodlpay/payment-decoder",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Decode Yodl payment hashes into structured payment data",
5
5
  "keywords": [
6
6
  "yodl",