Skip to content

Commit fc1f1b2

Browse files
committed
feat: convert scriptsTree output to Buffer
1 parent 1b96e6d commit fc1f1b2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/payments.utils.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ export function preform(x: any): any {
147147
if (x.redeem.network)
148148
x.redeem.network = (BNETWORKS as any)[x.redeem.network];
149149
}
150-
150+
if (x.scriptsTree)
151+
x.scriptsTree = convertScriptsTree(x.scriptsTree)
151152
return x;
152153
}
153154

@@ -170,3 +171,15 @@ export function from(path: string, object: any, result?: any): any {
170171

171172
return result;
172173
}
174+
175+
// todo: solve any type
176+
function convertScriptsTree(scriptsTree: any): any {
177+
if (Array.isArray(scriptsTree))
178+
return scriptsTree.map(convertScriptsTree)
179+
180+
181+
const script = Object.assign({}, scriptsTree);
182+
if ((typeof script.output === 'string'))
183+
script.output = asmToBuffer(scriptsTree.output)
184+
return script
185+
}

0 commit comments

Comments
 (0)