@xswap-link/sdk 0.10.7 → 0.10.8
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/.github/workflows/publish.yml +10 -10
- package/CHANGELOG.md +6 -0
- package/dist/index.global.js +140 -140
- package/dist/index.js +6 -6
- package/dist/index.mjs +9 -9
- package/package.json +1 -1
- package/src/components/TxDataCard/TxDataCardUI/index.tsx +12 -18
- package/src/components/TxDataCard/index.tsx +6 -2
- package/src/services/solana/jupiter/extract-swap-data.ts +6 -7
package/package.json
CHANGED
|
@@ -32,22 +32,16 @@ export const TxDataCardUI = ({
|
|
|
32
32
|
|
|
33
33
|
const date = getDate(transaction.timestamp);
|
|
34
34
|
|
|
35
|
-
const transferredAmount =
|
|
36
|
-
transaction.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
? (transaction.tokenOutAmount as string)
|
|
46
|
-
: weiToHumanReadable({
|
|
47
|
-
amount: transaction?.tokenOutAmount || "0",
|
|
48
|
-
decimals: dstToken?.decimals || 18,
|
|
49
|
-
precisionFractionalPlaces: 4,
|
|
50
|
-
});
|
|
35
|
+
const transferredAmount = weiToHumanReadable({
|
|
36
|
+
amount: transaction.amountWei,
|
|
37
|
+
decimals: srcToken?.decimals || 18,
|
|
38
|
+
precisionFractionalPlaces: 4,
|
|
39
|
+
});
|
|
40
|
+
const receivedAmount = weiToHumanReadable({
|
|
41
|
+
amount: transaction?.tokenOutAmount || "0",
|
|
42
|
+
decimals: dstToken?.decimals || 18,
|
|
43
|
+
precisionFractionalPlaces: 4,
|
|
44
|
+
});
|
|
51
45
|
|
|
52
46
|
const srcChain = supportedChains.find(
|
|
53
47
|
(chain) => chain.chainId === transaction.sourceChainId,
|
|
@@ -84,11 +78,11 @@ export const TxDataCardUI = ({
|
|
|
84
78
|
</div>
|
|
85
79
|
) : transaction.status === "DONE" ? (
|
|
86
80
|
<div className="flex items-center grow justify-end text-xs">
|
|
87
|
-
<div className="
|
|
81
|
+
<div className="mr-1 text-t_text_green">Done</div>
|
|
88
82
|
</div>
|
|
89
83
|
) : transaction.status === "REVERTED" ? (
|
|
90
84
|
<div className="flex items-center grow justify-end text-xs">
|
|
91
|
-
<div className="
|
|
85
|
+
<div className="mr-1 text-t_text_red">Reverted</div>
|
|
92
86
|
</div>
|
|
93
87
|
) : null}
|
|
94
88
|
|
|
@@ -10,12 +10,16 @@ export const TxDataCard = ({ transaction }: Props) => {
|
|
|
10
10
|
const { supportedChains, findTokenDataByAddressAndChain } = useSwapContext();
|
|
11
11
|
|
|
12
12
|
const srcToken = findTokenDataByAddressAndChain(
|
|
13
|
-
transaction.
|
|
13
|
+
transaction.sourceChainId === "mainnet-beta"
|
|
14
|
+
? transaction.tokenAddress
|
|
15
|
+
: transaction.tokenAddress.toLowerCase(),
|
|
14
16
|
transaction.sourceChainId,
|
|
15
17
|
);
|
|
16
18
|
const dstToken = transaction.tokenOutAddress
|
|
17
19
|
? findTokenDataByAddressAndChain(
|
|
18
|
-
transaction.
|
|
20
|
+
transaction.sourceChainId === "mainnet-beta"
|
|
21
|
+
? transaction.tokenOutAddress
|
|
22
|
+
: transaction.tokenOutAddress?.toLowerCase(),
|
|
19
23
|
transaction.targetChainId,
|
|
20
24
|
)
|
|
21
25
|
: undefined;
|
|
@@ -89,8 +89,8 @@ export async function extractSolanaSwapData(
|
|
|
89
89
|
initialPositions?.includes(index) && swap.inMint === inMint,
|
|
90
90
|
);
|
|
91
91
|
|
|
92
|
-
const
|
|
93
|
-
return acc.plus(curr.
|
|
92
|
+
const inAmount = inSwapData.reduce((acc, curr) => {
|
|
93
|
+
return acc.plus(new BigNumber(curr.inAmount || "0"));
|
|
94
94
|
}, new BigNumber(0));
|
|
95
95
|
|
|
96
96
|
const outMint = swapData[finalPosition]?.outMint;
|
|
@@ -98,9 +98,8 @@ export async function extractSolanaSwapData(
|
|
|
98
98
|
(swap, index) =>
|
|
99
99
|
finalPositions?.includes(index) && swap.outMint === outMint,
|
|
100
100
|
);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return acc.plus(curr.outAmountInDecimal || 0);
|
|
101
|
+
const outAmount = outSwapData.reduce((acc, curr) => {
|
|
102
|
+
return acc.plus(new BigNumber(curr.outAmount || "0"));
|
|
104
103
|
}, new BigNumber(0));
|
|
105
104
|
|
|
106
105
|
const isSuccessful = tx.meta?.status?.Ok === null;
|
|
@@ -110,10 +109,10 @@ export async function extractSolanaSwapData(
|
|
|
110
109
|
swap.hash = signature;
|
|
111
110
|
swap.timestamp = tx.blockTime ?? 0;
|
|
112
111
|
|
|
113
|
-
swap.amountWei =
|
|
112
|
+
swap.amountWei = inAmount.toString();
|
|
114
113
|
swap.tokenAddress = inMint;
|
|
115
114
|
|
|
116
|
-
swap.tokenOutAmount =
|
|
115
|
+
swap.tokenOutAmount = outAmount.toString();
|
|
117
116
|
swap.tokenOutAddress = outMint;
|
|
118
117
|
|
|
119
118
|
swap.sourceChainId = "mainnet-beta";
|