-
-
{t('address.transaction_rgbpp_digest')}
-
+ const { data, isFetched } = useQuery(['rgb-digest', hash], () => explorerService.api.fetchRGBDigest(hash))
+
+ const direction = useMemo(() => {
+ switch (data?.data.leapDirection) {
+ case 'in':
+ return TransactionLeapDirection.IN
+ case 'leapoutBTC':
+ return TransactionLeapDirection.OUT
+ case 'withinBTC':
+ return TransactionLeapDirection.WITH_IN_BTC
+ default:
+ return TransactionLeapDirection.NONE
+ }
+ }, [data])
+
+ if (isFetched && data?.data) {
+ return (
+
+
+
+ {t('address.transaction_rgbpp_digest')}
+ {direction !== TransactionLeapDirection.NONE && (
+ {t(`address.leap_${direction}`)}
+ )}
+
+
+
+
-
-
- )
+ )
+ }
+ return null
}
export default TransactionRGBPPDigestModal
diff --git a/src/components/TransactionItem/TransactionRGBPPDigestModal/styles.module.scss b/src/components/TransactionItem/TransactionRGBPPDigestModal/styles.module.scss
index 8c465ae34..377887d50 100644
--- a/src/components/TransactionItem/TransactionRGBPPDigestModal/styles.module.scss
+++ b/src/components/TransactionItem/TransactionRGBPPDigestModal/styles.module.scss
@@ -17,6 +17,13 @@
.header {
display: flex;
justify-content: space-between;
+ margin-bottom: 10px;
+
+ .left {
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ }
> span {
font-family: Roboto, sans-serif;
@@ -71,7 +78,9 @@
.txid,
.commitment {
+ max-width: 100%;
display: flex;
+ flex: 1 1;
flex-shrink: 1;
overflow: hidden;
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
diff --git a/src/components/TransactionItem/index.tsx b/src/components/TransactionItem/index.tsx
index d935e00e7..c15d64fe2 100644
--- a/src/components/TransactionItem/index.tsx
+++ b/src/components/TransactionItem/index.tsx
@@ -119,7 +119,7 @@ const TransactionItem = ({
>
{transaction.transactionHash}
- {transaction.isRgbTransaction &&
}
+ {transaction.isRgbTransaction && transaction.rgbTransferStep &&
}
diff --git a/src/locales/en.json b/src/locales/en.json
index 84cf12248..197b676d7 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -426,6 +426,7 @@
"tx_on_bitcoin": "Tx On Bitcoin",
"leap_in": "L1 → L2",
"leap_out": "L2 → L1",
+ "leap_with_in_btc": "L1 → L1",
"leap_in_tip": "This RGB++ transaction is marked as \"L1 → L2\", indicating that the number of cells with RGB++ lock in the output exceeds the number of cells with RGB++ lock in the input.",
"leap_out_tip": "This RGB++ transaction is marked as \"L2 → L1\", indicating that the number of cells with RGB++ lock in the input exceeds the number of cells with RGB++ lock in the output.",
"view_in_btc_explorer": "View in Bitcoin Explorer",
@@ -454,7 +455,11 @@
"btc_txid": "BTC TXID",
"cell": "Cell",
"cells": "Cells",
- "view_on_bitcoin_explorer": "View on Bitcoin Explorer"
+ "view_on_bitcoin_explorer": "View on Bitcoin Explorer",
+ "step": {
+ "isomorphic": "Isomorphic",
+ "unlock": "Unlock"
+ }
},
"amount": "Amount"
},
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 604ee793b..2be30bb20 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -426,6 +426,7 @@
"tx_on_bitcoin": "Tx On Bitcoin",
"leap_in": "L1 → L2",
"leap_out": "L2 → L1",
+ "leap_with_in_btc": "L1 → L1",
"leap_in_tip": "本笔 RGB++ 交易被标记为\"L1 → L2\",即存在一般 CKB 资产转化为 RGB++ 资产。",
"leap_out_tip": "本笔 RGB++ 交易被标记为\"L2 → L1\",即存在 RGB++ 资产转化为一般 CKB 资产。",
"view_in_btc_explorer": "在 Bitcoin 浏览器查看",
@@ -454,7 +455,11 @@
"btc_txid": "BTC 交易",
"cell": "Cell",
"cells": "Cells",
- "view_on_bitcoin_explorer": "在 Bitcoin 浏览器查看"
+ "view_on_bitcoin_explorer": "在 Bitcoin 浏览器查看",
+ "step": {
+ "isomorphic": "同构",
+ "unlock": "解锁"
+ }
},
"amount": "数量"
},
diff --git a/src/models/Transaction/index.ts b/src/models/Transaction/index.ts
index eeda134cb..75403c826 100644
--- a/src/models/Transaction/index.ts
+++ b/src/models/Transaction/index.ts
@@ -25,6 +25,7 @@ export interface Transaction {
displayOutputs: Cell[]
liveCellChanges: string
capacityInvolved: string
+ rgbTransferStep: string | null
txStatus: string
detailedMessage: string
bytes: number
diff --git a/src/pages/RGBPP/TransactionList/index.tsx b/src/pages/RGBPP/TransactionList/index.tsx
index eabf04c78..bdcc50792 100644
--- a/src/pages/RGBPP/TransactionList/index.tsx
+++ b/src/pages/RGBPP/TransactionList/index.tsx
@@ -31,7 +31,7 @@ const RGBPPTransactionList = () => {
leapDirection = TransactionLeapDirection.IN
}
- if (tx.leapDirection === 'out') {
+ if (tx.leapDirection === '') {
leapDirection = TransactionLeapDirection.OUT
}
diff --git a/src/pages/Transaction/TransactionComp/RGBDigestComp.tsx b/src/pages/Transaction/TransactionComp/RGBDigestComp.tsx
index ec5476d60..3e0bf055a 100644
--- a/src/pages/Transaction/TransactionComp/RGBDigestComp.tsx
+++ b/src/pages/Transaction/TransactionComp/RGBDigestComp.tsx
@@ -18,6 +18,10 @@ export const RGBDigestComp = ({ hash, txid }: { hash: string; txid?: string }) =
: undefined,
)
+ const { data: rgbDigest, isFetched: isDigestFetched } = useQuery(['rgb-digest', hash], () =>
+ explorerService.api.fetchRGBDigest(hash),
+ )
+
const { data: displayInputs } = useQuery(
['transaction_inputs', hash, 1, 10],
async () => {
@@ -64,27 +68,32 @@ export const RGBDigestComp = ({ hash, txid }: { hash: string; txid?: string }) =
}, [displayInputs, displayOutputs])
const direction = useMemo(() => {
- // FIXME: should be from API because inputs/outputs are paginated
- const inputCellCount = displayInputs.data.filter(c => c.rgbInfo).length
- const outputCellCount = displayOutputs.data.filter(c => c.rgbInfo).length
- if (inputCellCount === outputCellCount) {
- return TransactionLeapDirection.NONE
+ switch (rgbDigest?.data.leapDirection) {
+ case 'in':
+ return TransactionLeapDirection.IN
+ case 'leapoutBTC':
+ return TransactionLeapDirection.OUT
+ case 'withinBTC':
+ return TransactionLeapDirection.WITH_IN_BTC
+ default:
+ return TransactionLeapDirection.NONE
}
- if (inputCellCount > outputCellCount) {
- return TransactionLeapDirection.OUT
- }
- return TransactionLeapDirection.IN
- }, [displayInputs, displayOutputs])
+ }, [rgbDigest])
return (
<>
{t('transaction.rgb_digest')}
+ {direction !== TransactionLeapDirection.NONE && (
+
{t(`address.leap_${direction}`)}
+ )}
-
+ {rgbDigest && (
+
+ )}
{isBtcTxLoading ? : null}
{btcTx?.vout.some(v => v.scriptPubKey.asm.includes('OP_RETURN')) ? (
diff --git a/src/pages/Transaction/TransactionComp/TransactionDetailsHeader.module.scss b/src/pages/Transaction/TransactionComp/TransactionDetailsHeader.module.scss
index d0f7ec366..debb20936 100644
--- a/src/pages/Transaction/TransactionComp/TransactionDetailsHeader.module.scss
+++ b/src/pages/Transaction/TransactionComp/TransactionDetailsHeader.module.scss
@@ -27,9 +27,23 @@
.headerContent {
display: flex;
- justify-content: space-between;
+ gap: 8px;
align-items: center;
+ .leap {
+ border: 1px solid #b0fcd3;
+ border-radius: 4px;
+ background-color: #e8fff1;
+ color: #23bc98;
+ padding: 5px 8px;
+ font-size: 12px;
+ line-height: 14px;
+ }
+
+ .leap:hover {
+ cursor: pointer;
+ }
+
p {
font-size: 20px;
font-weight: 600;
diff --git a/src/pages/Transaction/TransactionComp/TransactionOverview.tsx b/src/pages/Transaction/TransactionComp/TransactionOverview.tsx
index d0803206e..9e24d87d5 100644
--- a/src/pages/Transaction/TransactionComp/TransactionOverview.tsx
+++ b/src/pages/Transaction/TransactionComp/TransactionOverview.tsx
@@ -199,6 +199,13 @@ export const TransactionOverviewCard: FC<{
overviewItems.push(liteTxSizeData, liteTxCyclesData)
}
+ if (transaction.rgbTransferStep) {
+ overviewItems.push({
+ title: 'RGB++',
+ content: t(`rgbpp.transaction.step.${transaction.rgbTransferStep}`),
+ })
+ }
+
const setToast = useSetToast()
const handleExportTxClick = async () => {
diff --git a/src/pages/Transaction/state.ts b/src/pages/Transaction/state.ts
index dcfdd0f40..7e37461c2 100644
--- a/src/pages/Transaction/state.ts
+++ b/src/pages/Transaction/state.ts
@@ -19,6 +19,7 @@ export const defaultTransactionInfo: Transaction = {
capacityInvolved: '',
txStatus: '',
detailedMessage: '',
+ rgbTransferStep: null,
bytes: 0,
largestTxInEpoch: 0,
largestTx: 0,
diff --git a/src/services/ExplorerService/types.ts b/src/services/ExplorerService/types.ts
index f0534e1ee..86890c6b7 100644
--- a/src/services/ExplorerService/types.ts
+++ b/src/services/ExplorerService/types.ts
@@ -330,6 +330,7 @@ export interface RGBDigest {
txid: string
confirmations: number
commitment: string
+ leapDirection: string | null
transfers: TransactionRecord[]
}
diff --git a/src/utils/transformer.ts b/src/utils/transformer.ts
index fa50c8f2e..940866376 100644
--- a/src/utils/transformer.ts
+++ b/src/utils/transformer.ts
@@ -28,6 +28,7 @@ export const transformToTransaction = (
liveCellChanges: '',
capacityInvolved: '',
detailedMessage: '',
+ rgbTransferStep: null,
bytes: 0,
largestTxInEpoch: 0,
largestTx: 0,