@@ -172,6 +232,8 @@ export default function ViewXdr() {
<>
{xdrJsonDecoded?.jsonString ? (
+ <>{renderClaimableBalanceIds()}>
+
{
@@ -171,6 +172,7 @@ const ClaimantPredicatePicker = ({
/>
) : (
renderComponent({
+ parentId: id,
index,
nodes: transformPredicateDataForRender(predicateValue),
onUpdate: handleUpdate,
@@ -183,11 +185,13 @@ const ClaimantPredicatePicker = ({
};
const renderComponent = ({
+ parentId,
index,
nodes,
onUpdate,
error,
}: {
+ parentId: string;
index: number;
nodes: AnyObject[];
onUpdate: (val: AnyObject | undefined) => void;
@@ -203,6 +207,7 @@ const renderComponent = ({
return (
{
onUpdate({
@@ -273,7 +280,13 @@ const Predicate = ({
<>
{isConditional &&
- renderComponent({ nodes: nodeValue || [], onUpdate, error, index })}
+ renderComponent({
+ nodes: nodeValue || [],
+ onUpdate,
+ error,
+ index,
+ parentId,
+ })}
>
);
@@ -281,6 +294,7 @@ const Predicate = ({
const PredicateType = ({
index,
+ parentId,
parentPath,
type,
nodeValue,
@@ -288,6 +302,7 @@ const PredicateType = ({
error,
}: {
index: number;
+ parentId: string;
parentPath: string;
type: string;
nodeValue: AnyObject[];
@@ -299,7 +314,7 @@ const PredicateType = ({
return (
{
@@ -332,7 +347,15 @@ const PredicateType = ({
["and", "or"].includes(type) ? "PredicateWrapper__split" : ""
}
>
- <>{renderComponent({ nodes: nodeValue, onUpdate, error, index })}>
+ <>
+ {renderComponent({
+ nodes: nodeValue,
+ onUpdate,
+ error,
+ index,
+ parentId,
+ })}
+ >
)}
>
@@ -342,6 +365,7 @@ const PredicateType = ({
const PredicateTimeType = ({
index,
+ parentId,
parentPath,
type,
nodeValue,
@@ -349,6 +373,7 @@ const PredicateTimeType = ({
error,
}: {
index: number;
+ parentId: string;
parentPath: string;
type: string;
nodeValue: AnyObject[];
@@ -358,7 +383,7 @@ const PredicateTimeType = ({
return (
<>
{
@@ -376,19 +401,21 @@ const PredicateTimeType = ({
{nodeValue &&
nodeValue.length > 0 &&
- renderComponent({ nodes: nodeValue, onUpdate, error, index })}
+ renderComponent({ nodes: nodeValue, onUpdate, error, index, parentId })}
>
);
};
const PredicateTimeValue = ({
index,
+ parentId,
parentPath,
nodeValue,
onUpdate,
error,
}: {
index: number;
+ parentId: string;
parentPath: string;
nodeValue: string;
onUpdate: (val: {
@@ -412,7 +439,7 @@ const PredicateTimeValue = ({
{inputType === "absolute" && (
<>
{
+ if (!(xdr && networkPassphrase)) {
+ return "";
+ }
+
+ const txn = TransactionBuilder.fromXDR(xdr, networkPassphrase);
+ let balanceId = "";
+
+ try {
+ balanceId = (txn as any).getClaimableBalanceId(opIndex);
+ } catch (e) {
+ // Do nothing
+ }
+
+ return balanceId;
+};