Skip to content

Commit 140796e

Browse files
committed
SDK Asset CreateHTLC returns hash
Signed-off-by: sandeep.nishad1 <[email protected]>
1 parent a4313de commit 140796e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

sdks/fabric/interoperation-node-sdk/src/AssetManager.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,33 +95,33 @@ const createHTLC = async (
9595
hashValue: string,
9696
expiryTimeSecs: number,
9797
timeoutCallback: (c: Contract, t: string, i: string, r: string, p: string, v: string) => any,
98-
): Promise<{ preimage: any; result: any }> => {
98+
): Promise<{ preimage: any; hash: any; result: any }> => {
9999

100100
if (!contract)
101101
{
102102
logger.error("Contract handle not supplied");
103-
return { preimage: "", result: false };
103+
return { preimage: "", hash: "", result: false };
104104
}
105105
if (!assetType)
106106
{
107107
logger.error("Asset type not supplied");
108-
return { preimage: "", result: false };
108+
return { preimage: "", hash: "", result: false };
109109
}
110110
if (!assetID)
111111
{
112112
logger.error("Asset ID not supplied");
113-
return { preimage: "", result: false };
113+
return { preimage: "", hash: "", result: false };
114114
}
115115
if (!recipientECert)
116116
{
117117
logger.error("Recipient ECert not supplied");
118-
return { preimage: "", result: false };
118+
return { preimage: "", hash: "", result: false };
119119
}
120120
const currTimeSecs = Math.floor(Date.now()/1000); // Convert epoch milliseconds to seconds
121121
if (expiryTimeSecs <= currTimeSecs)
122122
{
123123
logger.error("Supplied expiry time invalid or in the past: %s; current time: %s", new Date(expiryTimeSecs).toISOString(), new Date(currTimeSecs).toISOString());
124-
return { preimage: "", result: false };
124+
return { preimage: "", hash: "", result: false };
125125
}
126126

127127
if (!hashValue || hashValue.length == 0)
@@ -168,33 +168,33 @@ const createFungibleHTLC = async (
168168
hashValue: string,
169169
expiryTimeSecs: number,
170170
timeoutCallback: (c: Contract, i: string, t: string, n: number, r: string, p: string, v: string) => any,
171-
): Promise<{ preimage: any; result: any }> => {
171+
): Promise<{ preimage: any; hash:any; result: any }> => {
172172

173173
if (!contract)
174174
{
175175
logger.error("Contract handle not supplied");
176-
return { preimage: "", result: "" };
176+
return { preimage: "", hash: "", result: "" };
177177
}
178178
if (!assetType)
179179
{
180180
logger.error("Asset type not supplied");
181-
return { preimage: "", result: "" };
181+
return { preimage: "", hash: "", result: "" };
182182
}
183183
if (numUnits <= 0)
184184
{
185185
logger.error("Asset count must be a positive integer");
186-
return { preimage: "", result: "" };
186+
return { preimage: "", hash: "", result: "" };
187187
}
188188
if (!recipientECert)
189189
{
190190
logger.error("Recipient ECert not supplied");
191-
return { preimage: "", result: "" };
191+
return { preimage: "", hash: "", result: "" };
192192
}
193193
const currTimeSecs = Math.floor(Date.now()/1000); // Convert epoch milliseconds to seconds
194194
if (expiryTimeSecs <= currTimeSecs)
195195
{
196196
logger.error("Supplied expiry time invalid or in the past: %s; current time: %s", new Date(expiryTimeSecs).toISOString(), new Date(currTimeSecs).toISOString());
197-
return { preimage: "", result: "" };
197+
return { preimage: "", hash: "", result: "" };
198198
}
199199

200200
if (!hashValue || hashValue.length == 0)

0 commit comments

Comments
 (0)