Skip to content

Commit 28de86e

Browse files
committed
chore: 🎸 extract full interface for engine and ts to avoid consumer update
1 parent aa99ae0 commit 28de86e

File tree

8 files changed

+259
-190
lines changed

8 files changed

+259
-190
lines changed

‎javascript/engine-js/src/Engine.ts‎

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Repo} from "./repo/Repo";
2-
import {TokenScript} from "./TokenScript";
2+
import {FullTokenScript, TokenScript} from "./TokenScript";
33
import {IWalletAdapter} from "./wallet/IWalletAdapter";
44
import {ITokenDiscoveryAdapter} from "./tokens/ITokenDiscoveryAdapter";
55
import {IViewBinding} from "./view/IViewBinding";
@@ -9,7 +9,7 @@ import {AttestationDefinition} from "./tokenScript/attestation/AttestationDefini
99
import {TrustedKey} from "./security/TrustedKeyResolver";
1010
import {ILocalStorageAdapter} from "./view/data/ILocalStorageAdapter";
1111
import {ITxValidationInfo} from "./security/TransactionValidator";
12-
import {ResolvedScriptData, ScriptInfo} from "./repo/sources/SourceInterface";
12+
import {ScriptInfo} from "./repo/sources/SourceInterface";
1313

1414
export interface IEngineConfig {
1515
ipfsGateway?: string
@@ -32,15 +32,22 @@ export enum ScriptSourceType {
3232
}
3333

3434
export interface TokenScriptEngine {
35-
getWalletAdapter: () => Promise<IWalletAdapter>;
36-
readonly config?: IEngineConfig
37-
38-
processIpfsUrl(uri: string): string;
39-
getScriptUris(chain: string|number, contractAddr: string): Promise<string[] | null>;
40-
getTokenScriptFromUrl(url: string): Promise<TokenScript>;
41-
loadTokenScript(xml: string): Promise<TokenScript>;
42-
43-
resolveAllScripts(tsPath: string, forceReload?: boolean): Promise<ScriptInfo[]>;
35+
getWalletAdapter: () => Promise<IWalletAdapter>;
36+
readonly config?: IEngineConfig;
37+
38+
processIpfsUrl(uri: string): string;
39+
getScriptUris(chain: string | number, contractAddr: string): Promise<string[] | null>;
40+
getTokenScriptFromUrl(url: string): Promise<TokenScript>;
41+
loadTokenScript(xml: string): Promise<TokenScript>;
42+
43+
resolveAllScripts(tsPath: string, forceReload?: boolean): Promise<ScriptInfo[]>;
44+
45+
// Only for FullTokenScriptEngine
46+
getTokenDiscoveryAdapter?: () => Promise<ITokenDiscoveryAdapter>;
47+
getAttestationStorageAdapter?: () => IAttestationStorageAdapter;
48+
getLocalStorageAdapter?: () => ILocalStorageAdapter;
49+
getAttestationManager(): AttestationManager;
50+
signPersonalMessage(data: string): Promise<string>;
4451
}
4552

4653
/**
@@ -212,7 +219,7 @@ export class FullTokenScriptEngine implements TokenScriptEngine {
212219
}
213220
let tokenXml = parser.parseFromString(xml,"text/xml");
214221

215-
return new TokenScript(this, tokenXml, xml, source, sourceId, sourceUrl, scriptInfo, viewBinding);
222+
return new FullTokenScript(this, tokenXml, xml, source, sourceId, sourceUrl, scriptInfo, viewBinding);
216223
} catch (e){
217224
throw new Error("Failed to parse tokenscript definition: " + e.message);
218225
}

0 commit comments

Comments
 (0)