@truebit/cli 1.120.0-beta.241 → 1.120.0-beta.242

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/index.mjs +1 -1
  2. package/package.json +4 -4
package/build/index.mjs CHANGED
@@ -242,7 +242,7 @@ ${n.data.payload.instrumentedTaskId}`);else throw"Malformed instrumentation serv
242
242
  `),console.log(Rr.white("Wallet Address: ")+Rr.yellow(e)),console.log(Rr.white("Subscription Tier: ")+Rr.green(s.userSubscription.toUpperCase())),s.maxSolutions!==void 0&&console.log(Rr.white("Max Solutions: ")+Rr.green(`${s.maxSolutions}`)),s.quotaMax===0)console.log(Rr.white("Monthly Quota: ")+Rr.green("UNLIMITED")),s.currentUsage!==void 0&&console.log(Rr.white("Current Usage: ")+Rr.yellow(`${s.currentUsage} executions`));else{if(console.log(Rr.white("Monthly Quota: ")+Rr.green(`${s.quotaMax} executions`)),s.currentUsage!==void 0&&(console.log(Rr.white("Current Usage: ")+Rr.yellow(`${s.currentUsage} executions`)),s.remaining!==void 0)){let c=s.remaining===0?Rr.red:s.remaining<s.quotaMax*.2?Rr.yellow:Rr.green;console.log(Rr.white("Remaining: ")+c(`${s.remaining} executions`))}console.log(Rr.white("Quota Resets On: ")+Rr.yellow(u))}console.log(`
243
243
  `+Rr.cyan("=".repeat(60))+`
244
244
  `)}catch(t){throw t instanceof Error?console.error(Rr.red("Error fetching quota status: ")+t.message):console.error(Rr.red("Error fetching quota status: ")+String(t)),t}}qX();l0();async function oDe(t){try{console.log("Fetching execution status...");let n=await(await Ol()).get(`api/execution/${t}`).catch(J0);if(n.data.message)throw n.data.message;console.log("Task execution status: ",n.data.status),n.data.output&&console.log("Task execution output: ",n.data.output)}catch(e){console.error(`Couldn't fetch execution status for executionId ${t}: ${e}`)}}var fDe=Rt(_x(),1),y_=class{tokens=[];authInputs;parse(e,n){let r=this.parseKeyValuePairs(n);if(e.length==0){this.authInputs=r;return}let i=Object.keys(r);if(e.every(a=>i.includes(a))){let a={};for(let s of e)a[s]=r[s];this.authInputs=a}else throw new Error(`Invalid authString: ${e} are required`)}parseKeyValuePairs(e){try{let n=e.split(","),r={};for(let i of n){let[a,s]=i.split(":");r[a.trim()]=s.trim()}return r}catch{throw new Error("Invalid auth string")}}},rM=class extends y_{tokens=["accessKey","secretKey"];constructor(e){super(),this.parse(this.tokens,e)}authHeaders(e){return fDe.default.sign(e,{accessKeyId:this.authInputs.accessKey,secretAccessKey:this.authInputs.secretKey}).headers||{}}},iM=class extends y_{tokens=["username","password"];constructor(e){super(),this.parse(this.tokens,e)}authHeaders(e){return{Authorization:`Basic ${btoa(`${this.authInputs.username}:${this.authInputs.password}`)}`}}},aM=class extends y_{tokens=[];constructor(e){super(),this.parse([],e)}authHeaders(e){return{...this.authInputs}}};var vc;(function(t){t.AWS_SIGNATURE="aws-signature",t.BASIC_AUTH="basic-auth",t.CUSTOM_HEADER="custom-header"})(vc||(vc={}));var UX=(t,e)=>{switch(t){case vc.AWS_SIGNATURE:return new rM(e);case vc.BASIC_AUTH:return new iM(e);case vc.CUSTOM_HEADER:return new aM(e);default:throw new Error(`Invalid authentication method specified. Should be one of <${Object.values(vc)}>`)}};import Wzt from"chalk";import{ethers as Gzt}from"ethers";l0();import*as sM from"crypto";async function zzt(t){try{return(await t.get("/getkey")).data}catch(e){throw new Error(`Failed to get encryption key: ${e}`)}}function Hzt(t,e){try{let n=Buffer.from(e,"base64"),r=sM.randomBytes(16),i=sM.createCipheriv("aes-256-cbc",n,r),a=Buffer.concat([i.update(t,"utf8"),i.final()]);return n.fill(0),{encrypted_authString:a.toString("base64"),iv:r.toString("base64")}}catch(n){throw n instanceof Error?new Error(`Failed to encrypt credentials: ${n.message}`):new Error(`Failed to encrypt credentials: ${n}`)}}async function uDe(t,e){let n=await zzt(t),r=Hzt(e,n.plaintext_key);return{encrypted_authString:r.encrypted_authString,encrypted_data_key:n.encrypted_key,iv:r.iv}}async function cDe(t,e,n,r,i,a,s){console.log("Deploying the API Authentication Credentials");try{if(!zke(a))throw"Invalid private key provided";if(!Gzt.isAddress(s))throw"Invalid address provided";if(UX(r,i),!xb(t))throw"Invalid taskId";let o=await XRe();console.log("Encrypting credentials...");let f=await uDe(o,i);await o.post("credentials",{taskId:t,namespace:e,taskName:n,method:r,encrypted_authString:f.encrypted_authString,encrypted_data_key:f.encrypted_data_key,iv:f.iv}).catch(J0),console.log("The encrypted credentials were deployed "+Wzt.green("Successfully"))}catch(o){throw console.log(o),`There was an Error deploying credentials:
245
- Couldn't push api credentials to remote server: ${o}`}}import{inspect as PWt}from"util";import ls from"ora";import{v4 as RWt}from"uuid";import{ethers as vM}from"ethers";var lDe={name:"@truebit/cli",version:"1.120.0-beta.241",private:!1,description:"truebit-cli is a basic command line that allows interaction between users and truebit nextgen node.",author:{name:"Truebit Co.",url:"https://truebit.io/"},license:"https://truebit.io/terms/",repository:{type:"git",url:"https://github.com/TruebitProtocol"},homepage:"https://truebit.io/",main:"build/index.mjs",module:"build/index.mjs",types:"build/types/index.d.ts",type:"module",scripts:{prebuild:"rimraf build logs","prebuild:dev":"rimraf build logs","build:dev":"tsc && chmod +x build/index.mjs",build:"NODE_ENV=production node esbuild.config.mjs && chmod +x build/index.mjs",dev:"export NODE_ENV=development && npx nodemon",test:"vitest run --passWithNoTests tests/"},dependencies:{axios:"1.13.2",chalk:"5.6.2",colors:"1.4.0",commander:"14.0.2",ethers:"6.16.0",figlet:"1.9.4","form-data":"4.0.5","openapi-enforcer":"1.23.0",ora:"9.0.0","public-ip":"8.0.0","ts-retry":"6.0.0",uuid:"13.0.0"},bin:{truebit:"build/index.mjs"},files:["build"],devDependencies:{"@types/figlet":"1.7.0","@vitest/coverage-v8":"3.2.4",esbuild:"0.27.2",typescript:"5.9.3",vitest:"3.2.4"},engines:{node:">=22.13.0"}};Oo();l0();yp();Oo();import{createInterface as eHt}from"node:readline/promises";import $1 from"chalk";l0();import b_ from"axios";import{ethers as jX}from"ethers";import{randomBytes as Yzt}from"crypto";import{v4 as Zzt}from"uuid";Oo();import{ethers as oM}from"ethers";async function dDe(t){m_(t);let e=Pr(Fs(),Mt.AVAX),n=oM.keccak256(oM.toUtf8Bytes(t));return await e.authorization.registerAuthorization(n),n}async function fM(t,e,n=ar("address")){m_(t);let r=Pr(Fs(),Mt.AVAX),i=await r.authorization.getEIP712Domain(),a=await r.authorization.nonces(n),s=Math.floor(Date.now()/1e3)+3600,o={RegisterMeta:[{name:"user",type:"address"},{name:"apiKeyHash",type:"string"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},f=oM.keccak256(oM.toUtf8Bytes(t)),u={user:n,apiKeyHash:f,nonce:Number(a),deadline:s},c=await r.utils.signMeta(i,o,u);return(await Wke(n,f,s,c,e)).status==201?f:null}yp();import{isTooManyTries as pDe,retryAsync as hDe}from"ts-retry";var mDe="0x0000000000000000000000000000000000000000";async function yDe(t){let e=!0;return t===""?(e=!1,console.log("An email address is required. Please provide your email address to proceed.")):new RegExp(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(t)?await Xzt(t)&&(e=!1,console.log("The provided email address is already in use. Please enter a different email address.")):(e=!1,console.log("The email address provided is not valid. Please try again.")),e}function Mm(t){return t==="Y"||t==="N"}function bDe(t){return!jX.isAddress(t)||t.length!==42||!t.startsWith("0x")}async function gDe(){let t=await Jzt();try{if(!await fM(t,!0))throw Error("The API key could not been registered.")}catch(e){let n=e.message;if(n)throw Error(`There was an error registering the API key -> ${n}`)}return t}async function _De(){let t=await Qzt();try{if(!await eM(t,!0))throw Error("The namespace could not been registered.")}catch(e){let n=e.message,r=n?n.match(/execution reverted: "(.*?)" /)?.[1]:null;if(r)throw Error(`There was an error registering the namespace -> ${r}`);if(n)throw Error(`There was an error registering the namespace -> ${n}`)}return t}async function Xzt(t){let e=await Co();try{return(await e.get(`userexistence/${t}`)).data===!0}catch(n){if(b_.isAxiosError(n)&&n.response?.status===404&&typeof n.response?.data?.message=="string"&&n.response.data.message.includes("User not found"))return!1;throw n}}async function uM(t,e){try{let n={message:"I am a Truebit User"};if(!e)throw Error("Secret.json does not exists");let r=e.privateKey,i=e.address,a=Ya.createSignedBody(n,r,i);return(await(await Co()).get(`user/${t}`,{headers:{"truebit-auth":JSON.stringify(a)}})).data}catch(n){if(b_.isAxiosError(n)&&n.response?.status===401&&n.response?.data.message.includes("Entitlement Validation Error")||b_.isAxiosError(n)&&n.response?.status==404&&n.response?.data.message&&n.response?.data.message.includes("User not found"))return null;throw b_.isAxiosError(n)?n.response?Error(`The server responding with an error -> ${n.response.data.message||n.response.status+" - "+n.response.statusText}`):n.request?Error(`The server is not responding -> ${n.message}`):Error(`There was an error in the communication with the server -> ${n.message}`):Error(typeof n=="string"?`There was an error in the communication with the server -> ${n}`:"There was an error in the communication with the server.")}}async function vDe(t){try{return await(await Co()).post("user/register",t)}catch(e){throw b_.isAxiosError(e)?e.response?Error(`The server responding with an error -> ${e.response.data.message||e.response.status+" - "+e.response.statusText}`):e.request?Error(`The server is not responding -> ${e.message}`):Error(`There was an error in the communication with the server -> ${e.message}`):Error(typeof e=="string"?`There was an error in the communication with the server -> ${e}`:"There was an error in the communication with the server.")}}async function Jzt(){let t=Fs(),e=Pr(t,Mt.AVAX),n="";try{await hDe(async()=>{n=Zzt();let r=jX.keccak256(jX.toUtf8Bytes(n));return await e.authorization.getPayerAddress(r)===mDe},{delay:500,maxTry:5,until:r=>r===!0})}catch(r){throw pDe(r)?Error("Attempts to generate unique Api Key for the user exhausted."):r}return n}async function Qzt(){let t=Fs(),e=Pr(t,Mt.AVAX),n="";try{await hDe(async()=>(n=Yzt(4).toString("hex"),await e.taskRegistry.getNamespaceOwner(n)===mDe),{delay:500,maxTry:5,until:r=>r===!0})}catch(r){throw pDe(r)?Error("Attempts to generate unique namespace for the user exhausted."):r}return n}function ADe(t){t.fullNameAnswer="",t.emailAddressAnswer="",t.companyNameAnswer="",t.jobPositionAnswer="",t.eulaAnswer="",t.confirmRegistration=""}yp();u6();import tHt from"ora";import*as cM from"os";async function wDe(t,e,n){let r=$s(),i=r!==null,a=0,s,o=eHt({input:process.stdin,output:process.stdout,terminal:!0});switch(i&&(bDe(r.address)?a=1:(s=await uM(r.address,r),s?a=2:a=3)),a){case 1:console.log("The wallet set in the configuration must be a valid ethereum address. (ENS not supported yet)");break;case 2:console.log(Mr.SETUP_STEP1_SCENARIO1_P2(s));break;case 3:{console.log(Mr.SETUP_STEP2_SCENARIO3_P1),console.log();let f={user_ip:t,date_time:Ri(),os_version:cM.type+"_"+cM.release,node_version:process.version,cli_version:e};await n.sendEventToMixpanel("user_registration_begin",f);let u={confirmRegistration:"",fullNameAnswer:"",emailAddressAnswer:"",companyNameAnswer:"",jobPositionAnswer:"",eulaAnswer:""};try{for(;u.confirmRegistration!="Y";){for(u.fullNameAnswer=(await o.question($1.bold(" 1. Full Name: "))).trim();u.fullNameAnswer==="";)console.log("Your full name is required. Please provide your first and last name to proceed."),u.fullNameAnswer=(await o.question($1.bold(" 1. Full Name: "))).trim();for(u.emailAddressAnswer=(await o.question($1.bold(" 2. Email Address: "))).trim();!await yDe(u.emailAddressAnswer);)u.emailAddressAnswer=(await o.question($1.bold(" 2. Email Address: "))).trim();for(u.companyNameAnswer=(await o.question($1.bold(" 3. Company Name: "))).trim(),u.jobPositionAnswer=(await o.question($1.bold(" 4. Job Position: "))).trim();!Mm(u.eulaAnswer);)u.eulaAnswer=(await o.question($1.bold(` 5. Accept EULA? [Y|N] (${Mr.EULA_TERMS_LINK}): `))).toUpperCase();if(u.eulaAnswer=="N"){console.log(Mr.EULA_REGISTRATION_NO_ACCEPTED);break}for(;!Mm(u.confirmRegistration);)console.log(`
245
+ Couldn't push api credentials to remote server: ${o}`}}import{inspect as PWt}from"util";import ls from"ora";import{v4 as RWt}from"uuid";import{ethers as vM}from"ethers";var lDe={name:"@truebit/cli",version:"1.120.0-beta.242",private:!1,description:"truebit-cli is a basic command line that allows interaction between users and truebit nextgen node.",author:{name:"Truebit Co.",url:"https://truebit.io/"},license:"https://truebit.io/terms/",repository:{type:"git",url:"https://github.com/TruebitProtocol"},homepage:"https://truebit.io/",main:"build/index.mjs",module:"build/index.mjs",types:"build/types/index.d.ts",type:"module",scripts:{prebuild:"rimraf build logs","prebuild:dev":"rimraf build logs","build:dev":"tsc && chmod +x build/index.mjs",build:"NODE_ENV=production node esbuild.config.mjs && chmod +x build/index.mjs",dev:"export NODE_ENV=development && npx nodemon",test:"vitest run --passWithNoTests tests/"},dependencies:{axios:"1.13.2",chalk:"5.6.2",colors:"1.4.0",commander:"14.0.2",ethers:"6.16.0",figlet:"1.9.4","form-data":"4.0.5","openapi-enforcer":"1.23.0",ora:"9.0.0","public-ip":"8.0.0","ts-retry":"6.0.0",uuid:"13.0.0"},bin:{truebit:"build/index.mjs"},files:["build"],devDependencies:{"@types/figlet":"1.7.0","@vitest/coverage-v8":"4.0.16",esbuild:"0.27.2",typescript:"5.9.3",vitest:"4.0.16"},engines:{node:">=22.13.0"}};Oo();l0();yp();Oo();import{createInterface as eHt}from"node:readline/promises";import $1 from"chalk";l0();import b_ from"axios";import{ethers as jX}from"ethers";import{randomBytes as Yzt}from"crypto";import{v4 as Zzt}from"uuid";Oo();import{ethers as oM}from"ethers";async function dDe(t){m_(t);let e=Pr(Fs(),Mt.AVAX),n=oM.keccak256(oM.toUtf8Bytes(t));return await e.authorization.registerAuthorization(n),n}async function fM(t,e,n=ar("address")){m_(t);let r=Pr(Fs(),Mt.AVAX),i=await r.authorization.getEIP712Domain(),a=await r.authorization.nonces(n),s=Math.floor(Date.now()/1e3)+3600,o={RegisterMeta:[{name:"user",type:"address"},{name:"apiKeyHash",type:"string"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},f=oM.keccak256(oM.toUtf8Bytes(t)),u={user:n,apiKeyHash:f,nonce:Number(a),deadline:s},c=await r.utils.signMeta(i,o,u);return(await Wke(n,f,s,c,e)).status==201?f:null}yp();import{isTooManyTries as pDe,retryAsync as hDe}from"ts-retry";var mDe="0x0000000000000000000000000000000000000000";async function yDe(t){let e=!0;return t===""?(e=!1,console.log("An email address is required. Please provide your email address to proceed.")):new RegExp(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(t)?await Xzt(t)&&(e=!1,console.log("The provided email address is already in use. Please enter a different email address.")):(e=!1,console.log("The email address provided is not valid. Please try again.")),e}function Mm(t){return t==="Y"||t==="N"}function bDe(t){return!jX.isAddress(t)||t.length!==42||!t.startsWith("0x")}async function gDe(){let t=await Jzt();try{if(!await fM(t,!0))throw Error("The API key could not been registered.")}catch(e){let n=e.message;if(n)throw Error(`There was an error registering the API key -> ${n}`)}return t}async function _De(){let t=await Qzt();try{if(!await eM(t,!0))throw Error("The namespace could not been registered.")}catch(e){let n=e.message,r=n?n.match(/execution reverted: "(.*?)" /)?.[1]:null;if(r)throw Error(`There was an error registering the namespace -> ${r}`);if(n)throw Error(`There was an error registering the namespace -> ${n}`)}return t}async function Xzt(t){let e=await Co();try{return(await e.get(`userexistence/${t}`)).data===!0}catch(n){if(b_.isAxiosError(n)&&n.response?.status===404&&typeof n.response?.data?.message=="string"&&n.response.data.message.includes("User not found"))return!1;throw n}}async function uM(t,e){try{let n={message:"I am a Truebit User"};if(!e)throw Error("Secret.json does not exists");let r=e.privateKey,i=e.address,a=Ya.createSignedBody(n,r,i);return(await(await Co()).get(`user/${t}`,{headers:{"truebit-auth":JSON.stringify(a)}})).data}catch(n){if(b_.isAxiosError(n)&&n.response?.status===401&&n.response?.data.message.includes("Entitlement Validation Error")||b_.isAxiosError(n)&&n.response?.status==404&&n.response?.data.message&&n.response?.data.message.includes("User not found"))return null;throw b_.isAxiosError(n)?n.response?Error(`The server responding with an error -> ${n.response.data.message||n.response.status+" - "+n.response.statusText}`):n.request?Error(`The server is not responding -> ${n.message}`):Error(`There was an error in the communication with the server -> ${n.message}`):Error(typeof n=="string"?`There was an error in the communication with the server -> ${n}`:"There was an error in the communication with the server.")}}async function vDe(t){try{return await(await Co()).post("user/register",t)}catch(e){throw b_.isAxiosError(e)?e.response?Error(`The server responding with an error -> ${e.response.data.message||e.response.status+" - "+e.response.statusText}`):e.request?Error(`The server is not responding -> ${e.message}`):Error(`There was an error in the communication with the server -> ${e.message}`):Error(typeof e=="string"?`There was an error in the communication with the server -> ${e}`:"There was an error in the communication with the server.")}}async function Jzt(){let t=Fs(),e=Pr(t,Mt.AVAX),n="";try{await hDe(async()=>{n=Zzt();let r=jX.keccak256(jX.toUtf8Bytes(n));return await e.authorization.getPayerAddress(r)===mDe},{delay:500,maxTry:5,until:r=>r===!0})}catch(r){throw pDe(r)?Error("Attempts to generate unique Api Key for the user exhausted."):r}return n}async function Qzt(){let t=Fs(),e=Pr(t,Mt.AVAX),n="";try{await hDe(async()=>(n=Yzt(4).toString("hex"),await e.taskRegistry.getNamespaceOwner(n)===mDe),{delay:500,maxTry:5,until:r=>r===!0})}catch(r){throw pDe(r)?Error("Attempts to generate unique namespace for the user exhausted."):r}return n}function ADe(t){t.fullNameAnswer="",t.emailAddressAnswer="",t.companyNameAnswer="",t.jobPositionAnswer="",t.eulaAnswer="",t.confirmRegistration=""}yp();u6();import tHt from"ora";import*as cM from"os";async function wDe(t,e,n){let r=$s(),i=r!==null,a=0,s,o=eHt({input:process.stdin,output:process.stdout,terminal:!0});switch(i&&(bDe(r.address)?a=1:(s=await uM(r.address,r),s?a=2:a=3)),a){case 1:console.log("The wallet set in the configuration must be a valid ethereum address. (ENS not supported yet)");break;case 2:console.log(Mr.SETUP_STEP1_SCENARIO1_P2(s));break;case 3:{console.log(Mr.SETUP_STEP2_SCENARIO3_P1),console.log();let f={user_ip:t,date_time:Ri(),os_version:cM.type+"_"+cM.release,node_version:process.version,cli_version:e};await n.sendEventToMixpanel("user_registration_begin",f);let u={confirmRegistration:"",fullNameAnswer:"",emailAddressAnswer:"",companyNameAnswer:"",jobPositionAnswer:"",eulaAnswer:""};try{for(;u.confirmRegistration!="Y";){for(u.fullNameAnswer=(await o.question($1.bold(" 1. Full Name: "))).trim();u.fullNameAnswer==="";)console.log("Your full name is required. Please provide your first and last name to proceed."),u.fullNameAnswer=(await o.question($1.bold(" 1. Full Name: "))).trim();for(u.emailAddressAnswer=(await o.question($1.bold(" 2. Email Address: "))).trim();!await yDe(u.emailAddressAnswer);)u.emailAddressAnswer=(await o.question($1.bold(" 2. Email Address: "))).trim();for(u.companyNameAnswer=(await o.question($1.bold(" 3. Company Name: "))).trim(),u.jobPositionAnswer=(await o.question($1.bold(" 4. Job Position: "))).trim();!Mm(u.eulaAnswer);)u.eulaAnswer=(await o.question($1.bold(` 5. Accept EULA? [Y|N] (${Mr.EULA_TERMS_LINK}): `))).toUpperCase();if(u.eulaAnswer=="N"){console.log(Mr.EULA_REGISTRATION_NO_ACCEPTED);break}for(;!Mm(u.confirmRegistration);)console.log(`
246
246
  Is the information provided above correct?`),u.confirmRegistration=(await o.question($1.bold("Press [Y] to confirm or [N] to edit: "))).toUpperCase();u.confirmRegistration=="N"&&(console.log(`
247
247
  Please provide the following information:`),ADe(u))}}catch(l){if(l.name==="AbortError"||l.message.includes("Ctrl+C")){let p=l.message,h=f;h.error_details=p,h.date_time=Ri();let _={fullname:u.fullNameAnswer,email:u.emailAddressAnswer,company:u.companyNameAnswer,role:u.jobPositionAnswer};h.user_info=JSON.stringify(_),await n.sendEventToMixpanel("user_registration_failed",h),process.exit(0)}}if(u.eulaAnswer=="N")break;let c=f;console.log(),console.log("By completing registration, you'll be automatically subscribed to our newsletter."),console.log("To opt-out, please follow the steps described in our documentation portal."),console.log();let d=tHt({text:$1.bold("... registering your account."),stream:process.stdout}).start();try{let l=await _De(),p=await gDe(),h={name:u.fullNameAnswer,email:u.emailAddressAnswer,walletAddress:r?.address,company:u.companyNameAnswer,jobDescription:u.jobPositionAnswer,EULA:Ya.createSignedBody({ip:await HI(),date:new Date().toISOString()},r.privateKey),defaultNamespace:l,defaultApiKey:p};await vDe(h),d.stop(),console.log(Mr.SETUP_STEP2_SCENARIO3_P2(u,r.address,l,p)),c.distinct_id=h.walletAddress,c.date_time=Ri(),c.fullname=h.name,c.email=h.email,c.company=h.company,c.role=h.jobDescription,c.namespace=h.defaultNamespace,c.api_key=p,c.wallet_address=h.walletAddress,await n.sendEventToMixpanel("user_registration_success",c),await n.registerUserMixpanel(c.wallet_address,nHt(c))}catch(l){d.stop();let p=l.message,h=f;h.error_details=p,h.date_time=Ri();let _={fullname:u.fullNameAnswer,email:u.emailAddressAnswer,company:u.companyNameAnswer,role:u.jobPositionAnswer};h.user_info=JSON.stringify(_),await n.sendEventToMixpanel("user_registration_failed",h);let E=p?p.match(/CreateUserValidation - (.*?.*)/)?.[1]:null;if(E)throw Error(E);if(p.includes("Sender doesn't have enough funds to send tx"))throw Error("We are currently experiencing technical difficulties. Please try again later.");console.error(Mr.SETUP_STEP2_UNHANDLED_ERROR),process.exit(1)}finally{d.clear()}break}default:throw Error("An unexpected error occurred.")}o.close()}function nHt(t){return{apiKey:t.api_key,name:t.fullname,email:t.email,ip:t.user_ip,company:t.company,role:t.role,namespace:t.namespace,walletAddress:t.wallet_address}}import{setDefaultAutoSelectFamily as kWt}from"node:net";import rHt from"chalk";Oo();u6();import{createInterface as iHt}from"node:readline/promises";import*as lM from"os";async function EDe(t,e,n){let r=$s(),i=r!==null,a=0;switch(i?i&&!r.eula?a=2:a=3:a=1,a){case 1:case 2:{let s=iHt({input:process.stdin,output:process.stdout,terminal:!0}),o="",f={user_ip:t,date_time:Ri(),os_version:lM.type+"_"+lM.release,node_version:process.version,cli_version:e};for(console.log(Mr.EULA_INSTALLATION);!Mm(o);)o=(await s.question(rHt.bold(`
248
248
  Have you read, and do you accept the Terms of Use? [Y|N]: `))).toUpperCase(),await n.sendEventToMixpanel("TOS_shown",f);if(o=="N")throw f.date_time=Ri(),await n.sendEventToMixpanel("TOS_rejected",f),Mr.EULA_INSTALLATION_NO_ACCEPTED;f.date_time=Ri(),await n.sendEventToMixpanel("TOS_accepted",f);let u=Math.round(new Date().getTime()).toString();if(a===1){let c={..._X(),eula:u};tke(c)}else a===2&&f_({eula:u});s.close()}break;default:break}}Oo();u6();async function ef(t=!1){let e=$s(),n=e!==null,r=null,i=0;switch(n?n&&(!e.privateKey||!e.address)?i=2:(r=await uM(e.address,e),r?i=4:i=3):i=1,i){case 1:case 2:case 3:console.log(Mr.USER_NO_REGISTERED),process.exit(1);break;case 4:t&&console.log(`You are logged in as: ${r?.name} - ${r?.email}`);break}}import{createInterface as aHt}from"node:readline/promises";u6();Oo();import sHt from"chalk";async function SDe(){console.log(sHt.bold(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truebit/cli",
3
- "version": "1.120.0-beta.241",
3
+ "version": "1.120.0-beta.242",
4
4
  "private": false,
5
5
  "description": "truebit-cli is a basic command line that allows interaction between users and truebit nextgen node.",
6
6
  "author": {
@@ -47,13 +47,13 @@
47
47
  ],
48
48
  "devDependencies": {
49
49
  "@types/figlet": "1.7.0",
50
- "@vitest/coverage-v8": "3.2.4",
50
+ "@vitest/coverage-v8": "4.0.16",
51
51
  "esbuild": "0.27.2",
52
52
  "typescript": "5.9.3",
53
- "vitest": "3.2.4"
53
+ "vitest": "4.0.16"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">=22.13.0"
57
57
  },
58
- "gitHead": "98a2c1ec5654cc99768a7f9e5424732412b9fd16"
58
+ "gitHead": "0782245dc12916ab35212255fd122c8353fbfb90"
59
59
  }