@@ -4,16 +4,16 @@ import {
44 QuickjsInterpreterLive ,
55 QuickjsConfig ,
66 TransactionInterpreter ,
7- fallbackInterpreter ,
8- getInterpreter ,
97} from '@3loop/transaction-interpreter'
108import { Effect , Layer } from 'effect'
11- import variant from '@jitl/quickjs-singlefile-browser -release-sync'
9+ import variant from '@jitl/quickjs-singlefile-cjs -release-sync'
1210
11+ // Server-side interpreter configuration using Node.js QuickJS variant
12+ // This runs in Node.js context where CORS restrictions don't apply
1313const config = Layer . succeed ( QuickjsConfig , {
1414 variant : variant ,
1515 runtimeConfig : {
16- timeout : 1000 ,
16+ timeout : 5000 ,
1717 useFetch : true ,
1818 } ,
1919} )
@@ -26,11 +26,11 @@ export interface Interpretation {
2626 error ?: string
2727}
2828
29- export async function applyInterpreter (
29+ export const applyInterpreterServer = async (
3030 decodedTx : DecodedTransaction ,
3131 interpreter : Interpreter ,
3232 interpretAsUserAddress ?: string ,
33- ) : Promise < Interpretation > {
33+ ) : Promise < Interpretation > => {
3434 const runnable = Effect . gen ( function * ( ) {
3535 const interpreterService = yield * TransactionInterpreter
3636 const interpretation = yield * interpreterService . interpretTransaction ( decodedTx , interpreter , {
@@ -54,18 +54,3 @@ export async function applyInterpreter(
5454 }
5555 } )
5656}
57-
58- export async function findAndRunInterpreter ( decodedTx : DecodedTransaction ) : Promise < Interpretation > {
59- let interpreter = getInterpreter ( decodedTx )
60-
61- if ( ! interpreter ) {
62- interpreter = fallbackInterpreter
63- }
64-
65- const res = await applyInterpreter ( decodedTx , {
66- id : 'default' ,
67- schema : interpreter ,
68- } )
69-
70- return res
71- }
0 commit comments