import { DebuggerClient, InitArguments } from "@sentio/debugger"

const url = 'https://test.sentio.xyz/api/v1/solidity/fetch_and_compile?txHash=0xfb6027725ccff056d8fe4065227fecd335fe123e8ab4da3a85a71377f7e9c6f9';
fetch(url)
.then(data => { return data.json() })
.then(res => {
  console.log(res);
  const shimmedCompilations = [];
  for (var key in res.result) {
    var value = res.result[key];
    // @ts-ignore
    shimmedCompilations.push(...value);
  }
  console.log(shimmedCompilations);
  const init_args: InitArguments = {
    providerURL: 'https://test.sentio.xyz/api/v1/solidity',
    txnHash: "0xfb6027725ccff056d8fe4065227fecd335fe123e8ab4da3a85a71377f7e9c6f9",
    shimmedCompilations: shimmedCompilations,
    chainId: "0x1"
  }
  const d = new DebuggerClient();
  d.initialize(init_args).then(
    () => {
    console.log(d.initialized);
    console.log("hello");
    
   
   d.getCallTrace().then(r => {
    console.log(r)
   })
  });
})

