Skip to content

Commit 66a09ac

Browse files
committed
fix: The first scriptURI should have no scriptId for backward compatibility with old data
1 parent 8579ee1 commit 66a09ac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

javascript/engine-js/src/repo/sources/ScriptURI.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class ScriptURI implements SourceInterface {
2525
if (!uris)
2626
throw new Error("ScriptURI is not set on this contract or chain");
2727

28-
for (const uri of uris){
28+
for (const [index, uri] of uris.entries()){
2929

3030
const tokenScript = await this.context.getTokenScriptFromUrl(uri);
3131

@@ -35,7 +35,8 @@ export class ScriptURI implements SourceInterface {
3535
order: 0,
3636
authenticated: true,
3737
sourceId: chain + "-" + contractAddr,
38-
scriptId: "5169_" + tokenScript.getName(),
38+
// The contracts first scriptUri acts as the default script. This is to be compatible with old data that uses tsId without a scriptId part.
39+
scriptId: index > 0 ? "5169_" + tokenScript.getName() : "",
3940
sourceUrl: uri,
4041
type: ScriptSourceType.SCRIPT_URI
4142
});

0 commit comments

Comments
 (0)