@oracle-agent/oracle 0.22.14 → 0.22.16
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.
- package/SETUP.md +30 -4
- package/artifacts/specialist-packs/oracle-full-crypto.json +3 -1
- package/dist/assets/knowledge/corpus.json +1 -0
- package/dist/bin/desk-server.mjs +17 -17
- package/dist/bin/oracle-data-mcp.mjs +6 -6
- package/dist/bin/oracle-public-server.mjs +4 -4
- package/dist/bin/oracle-route.mjs +1 -1
- package/dist/bin/oracle.mjs +54 -40
- package/dist/cli/commands/arm.mjs +17 -0
- package/dist/cli/commands/chat.mjs +79 -79
- package/dist/cli/commands/doctor.mjs +6 -6
- package/dist/cli/commands/eval.mjs +1 -1
- package/dist/cli/commands/model.mjs +84 -84
- package/dist/cli/commands/revoke.mjs +40 -0
- package/dist/cli/commands/snipe.mjs +39 -0
- package/dist/cli/commands/swap.mjs +2 -2
- package/dist/cli/commands/vault.mjs +29 -0
- package/dist/data/desk-data.mjs +14 -14
- package/dist/index.mjs +20 -20
- package/dist/local-vault/index.mjs +6 -0
- package/dist/router/index.mjs +1 -1
- package/dist/router/prepare-bridge.mjs +1 -1
- package/package.json +3 -2
- package/public/oracle-splash/downloads/index.html +4 -4
- package/public/oracle-splash/index.html +1 -1
package/dist/bin/oracle.mjs
CHANGED
|
@@ -1,50 +1,64 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{realpathSync as U}from"node:fs";import{fileURLToPath as re}from"node:url";import h from"node:fs";import g from"node:path";import{pathToFileURL as
|
|
3
|
-
oracle
|
|
4
|
-
oracle
|
|
5
|
-
oracle
|
|
6
|
-
oracle
|
|
7
|
-
oracle
|
|
8
|
-
oracle
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
oracle
|
|
12
|
-
oracle setup model choose Claude/Codex/Grok standalone OAuth
|
|
13
|
-
oracle setup standalone model + optional Hermes messaging menu
|
|
14
|
-
oracle harness detect detect installed clients (capability only; no backend change)
|
|
2
|
+
import{realpathSync as U}from"node:fs";import{fileURLToPath as re}from"node:url";import h from"node:fs";import g from"node:path";import{pathToFileURL as W}from"node:url";import d from"node:fs";import D from"node:os";import i from"node:path";import{fileURLToPath as T}from"node:url";var P=i.dirname(T(import.meta.url)),l=i.resolve(P,"../..");function u(){return process.env.ORACLE_FAKE_HOME||D.homedir()}function v(){return process.env.ORACLE_PUBLIC_DESKTOP==="1"}function f(){return v()?process.env.ORACLE_CONFIG_DIR||i.join(u(),".config","oracle"):i.join(u(),".config","oracle")}function $(){return i.join(f(),"exec.env")}function E(){return i.join(f(),"desk.json")}function A(){return i.join(f(),"env")}function p({force:e=!1}={}){if(p._done&&!e)return p._result||null;p._done=!0;let o={},r=(a,t)=>{if(t==null)return;let n=String(t).trim();n&&(process.env[a]!=null&&String(process.env[a]).trim()!==""||(process.env[a]=n,o[a]=n))};try{let a=A();if(d.existsSync(a))for(let t of d.readFileSync(a,"utf8").split(/\r?\n/)){let n=t.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*?)\s*$/);if(!n||n[2].startsWith("#"))continue;let c=n[2];(c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),r(n[1],c)}}catch{}try{let a=E();if(d.existsSync(a)){let t=JSON.parse(d.readFileSync(a,"utf8"));t&&typeof t=="object"&&(r("ORACLE_DESK_URL",t.deskUrl||t.dataUrl||t.url),r("ORACLE_DATA_URL",t.dataUrl||t.deskUrl||t.url),r("ORACLE_API_URL",t.apiUrl||t.dataUrl||t.deskUrl),r("ORACLE_PUBLIC_URL",t.publicUrl||t.deskUrl||t.dataUrl),r("ORACLE_EXEC_URL",t.execUrl),r("MAD_DESK_URL",t.deskUrl||t.dataUrl))}}catch{}let s=process.env.ORACLE_DESK_URL||process.env.ORACLE_DATA_URL||"";return s&&(r("ORACLE_DESK_URL",s),r("ORACLE_DATA_URL",s),r("ORACLE_API_URL",s),r("ORACLE_PUBLIC_URL",s),r("MAD_DESK_URL",s)),p._result=Object.keys(o).length?o:null,p._result}try{p()}catch{}function M(){return process.env.HERMES_HOME?i.resolve(process.env.HERMES_HOME):i.join(u(),".hermes")}function H(){return i.join(u(),".claude.json")}function I(e=process.cwd()){return i.join(e,".mcp.json")}function F(){return process.platform==="darwin"?i.join(u(),"Library","Application Support","Claude","claude_desktop_config.json"):i.join(u(),".config","Claude","claude_desktop_config.json")}function N(){return i.join(u(),".codex","config.toml")}function _(){return i.join(f(),"connectors")}function q(){return i.join(_(),"chatgpt-openapi.json")}function K(){return i.join(f(),"active-chain.json")}function y(e){let o=[i.join(l,"bin",e),i.join(l,"dist","bin",e),i.join(l,"..","bin",e)];return o.find(r=>d.existsSync(r))||o[0]}function B(e){return d.mkdirSync(e,{recursive:!0}),e}var C={homeDir:u,isPublicDesktop:v,oracleConfigDir:f,oracleExecEnvPath:$,oracleDeskJsonPath:E,oracleEnvFilePath:A,loadDeskRouting:p,hermesRoot:M,activeChainPath:K,claudeCodeUserConfigPath:H,claudeCodeProjectMcpPath:I,claudeDesktopConfigPath:F,codexConfigPath:N,chatgptConnectorDir:_,chatgptOpenApiPath:q,packageBin:y,ensureDir:B,PACKAGE_ROOT:l};import{execFile as G}from"node:child_process";import{existsSync as de,mkdirSync as fe,readFileSync as V,realpathSync as me,writeFileSync as he}from"node:fs";import R from"node:path";import{promisify as Y}from"node:util";var xe=Y(G);var ke=1440*60*1e3;function j(e,o){let r=t=>String(t).replace(/^v/,"").split("-")[0].split(".").map(n=>Number.parseInt(n,10)||0),s=r(e),a=r(o);for(let t=0;t<Math.max(s.length,a.length);t+=1){let n=s[t]??0,c=a[t]??0;if(n>c)return 1;if(n<c)return-1}return 0}function J(e){let o=e?.stateDir||R.join(process.env.HOME||".",".oracle");return R.join(o,"update-check.json")}function w(e){try{return JSON.parse(V(J(e),"utf8"))}catch{return null}}var z="\u25C7 ORACLE // self-custody multichain agent control plane",X=`START
|
|
3
|
+
oracle open the native Oracle chat (TTY)
|
|
4
|
+
oracle chat open chat explicitly
|
|
5
|
+
oracle setup connect a model and optional messaging
|
|
6
|
+
oracle model switch provider or model
|
|
7
|
+
oracle auth manage Claude, Codex, Grok, or API-key auth
|
|
8
|
+
oracle chain list/select working chains (hyperliquid, base, ...)
|
|
9
|
+
|
|
10
|
+
READ / RESEARCH
|
|
11
|
+
oracle doctor check the read plane
|
|
15
12
|
oracle data serve|call|catalog|health
|
|
16
|
-
oracle data-mcp start the read-only MCP server
|
|
17
13
|
oracle scan chains|head|token|pools|risk|quote|sell
|
|
14
|
+
oracle farm methods \xB7 discover \xB7 airdrop
|
|
15
|
+
oracle equities venues \xB7 quote \xB7 prepare
|
|
16
|
+
|
|
17
|
+
PREPARE
|
|
18
18
|
oracle route swap|bridge|prepare|prepare-bridge
|
|
19
|
-
oracle swap
|
|
20
|
-
oracle
|
|
21
|
-
oracle
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
oracle
|
|
25
|
-
|
|
26
|
-
oracle
|
|
27
|
-
|
|
28
|
-
oracle
|
|
29
|
-
|
|
30
|
-
oracle
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
oracle
|
|
19
|
+
oracle swap unsigned route and wallet-signable calldata
|
|
20
|
+
oracle prepare build an unsigned swap (alias of route prepare)
|
|
21
|
+
oracle strategy draft|validate|backtest|optimize|evidence \xB7 shadow \xB7 prepare
|
|
22
|
+
|
|
23
|
+
LOCAL SELF-CUSTODY (optional, your machine, your key)
|
|
24
|
+
oracle vault import|unlock|lock|status
|
|
25
|
+
encrypted key vault under ~/.config/oracle
|
|
26
|
+
oracle arm --max <eth> --chain base[,...] / oracle arm --off
|
|
27
|
+
cap local execution; default disarmed
|
|
28
|
+
oracle snipe <CA|symbol> [--chain base] [--amount 0.01] [--execute]
|
|
29
|
+
prepare buy; --execute signs via unlocked local vault only
|
|
30
|
+
oracle revoke emergency --type erc20|nft|cancel [--nonce N] [--execute]
|
|
31
|
+
prepare revokes/cancels; local vault signs only
|
|
32
|
+
|
|
33
|
+
EXTEND
|
|
34
|
+
oracle data-mcp expose the read-only MCP server
|
|
35
|
+
oracle mcp install <t> wire Oracle into claude-code|claude-desktop|codex|chatgpt
|
|
36
|
+
oracle plugins install \xB7 list \xB7 remove \xB7 scan \xB7 setup
|
|
37
|
+
oracle harness detect \xB7 list installed agent clients
|
|
38
|
+
|
|
39
|
+
SYSTEM
|
|
40
|
+
oracle init optional Hermes lane install (dry-run by default)
|
|
41
|
+
oracle bootstrap optional Hermes installation
|
|
42
|
+
oracle public serve secret-free public HTTP surface
|
|
43
|
+
oracle fees status \xB7 check
|
|
44
|
+
oracle eval desk \xB7 fidelity \xB7 hybrid \xB7 guards \xB7 all
|
|
45
|
+
oracle upgrade update installed agent lanes
|
|
35
46
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
BOUNDARY
|
|
48
|
+
Default install is prepare-only.
|
|
49
|
+
Signing requires an explicit local vault, unlock, arm, and --execute on this host.
|
|
50
|
+
The public HTTP plane never holds keys or broadcasts transactions.
|
|
51
|
+
Use oracle <command> --help for command details.
|
|
52
|
+
`;function S(){try{return JSON.parse(h.readFileSync(g.join(l,"package.json"),"utf8")).version||"0.0.0"}catch{return"0.0.0"}}function Q(){let e=g.join(l,"src","cli","commands");return h.existsSync(e)?e:g.join(l,"dist","cli","commands")}async function m(){let e=Q(),o=new Map;if(!h.existsSync(e))return o;let r=h.readdirSync(e).filter(s=>s.endsWith(".mjs")).sort();for(let s of r){let a=g.join(e,s);try{let n=(await import(W(a).href+`?t=${Date.now()}`)).default;if(!n||typeof n!="object"||typeof n.run!="function")continue;let c=n.name||s.replace(/\.mjs$/,"");o.set(c,{...n,name:c,__file:a})}catch(t){process.env.ORACLE_CLI_DEBUG&&console.error(`oracle: failed loading command ${s}: ${t.message}`)}}return o}function Z(e,o=w()){return!o?.latest||!e||j(o.latest,e)<=0?"":`
|
|
39
53
|
Update available: ${e} \u2192 ${o.latest}. Run 'oracle update'.
|
|
40
|
-
`}function
|
|
54
|
+
`}function x(e,o){let r=[];r.push(`${z} (v${e})`),r.push(""),r.push(X.trimEnd());let s=[];for(let a of o.values()){if(["help","version"].includes(a.name))continue;!new Set(["init","doctor","chat","model","auth","chain","setup","data","data-mcp","scan","route","prepare","swap","farm","follow","equities","strategy","public","mcp","plugins","harness","upgrade","bootstrap","eval","fees","vault","arm","snipe","revoke"]).has(a.name)&&a.summary&&s.push(` oracle ${a.name.padEnd(20)} ${a.summary}`)}return s.length&&(r.push(""),r.push("ADDITIONAL"),r.push(...s)),r.join(`
|
|
41
55
|
`)+`
|
|
42
|
-
`+Z(e)}function
|
|
56
|
+
`+Z(e)}function L(e,o){let r=[...o.keys()].sort(),s=r.length?r.join(", "):"(none loaded yet)";return`oracle: unknown command '${e}'. Known: ${s}
|
|
43
57
|
Try: oracle --help
|
|
44
|
-
`}function
|
|
58
|
+
`}function k(e){return{argv:e,root:l,bin:y,paths:C}}async function O(e=[]){let o=S();if(e.includes("--version")||e.includes("-V"))return b();if(e[0]==="--help"||e[0]==="-h"){let n=await m();return process.stdout.write(x(o,n)),0}if(e.length===0){let n=await m();if(ee(e)){let c=n.get("chat");if(c)return c.run(k([]))}return process.stdout.write(x(o,n)),0}if(te(e[0])){let c=(await m()).get("chat");if(c)return c.run(k(e))}let r=e[0],s=e.slice(1);if(r==="version")return b();if(r==="help"){let n=await m();if(s[0]){let c=n.get(s[0]);return c?(process.stdout.write((c.usage||`oracle ${c.name}`)+`
|
|
45
59
|
`),c.summary&&process.stdout.write(c.summary+`
|
|
46
|
-
`),0):(process.stderr.write(
|
|
60
|
+
`),0):(process.stderr.write(L(s[0],n)),1)}return process.stdout.write(x(o,n)),0}let a=await m(),t=a.get(r);if(t){if(s[0]==="--help"||s[0]==="-h")return process.stdout.write((t.usage||`oracle ${t.name}`)+`
|
|
47
61
|
`),t.summary&&process.stdout.write(t.summary+`
|
|
48
|
-
`),0;try{let n=await t.run(
|
|
49
|
-
`),1}}return process.stderr.write(
|
|
50
|
-
`),0}function ee(e=[],o={stdin:process.stdin,stdout:process.stdout}){return e.length!==0?!1:process.env.ORACLE_FORCE_CHAT==="1"?!0:o.stdin?.isTTY===!0&&o.stdout?.isTTY===!0}function te(e){return["-m","--model","--provider","-q","--query","-Q","--quiet","-c","--continue","-r","--resume","-s","--skills","-t","--toolsets","--reasoning","--tui","--cli","--yolo","--checkpoints","--source","--max-turns"].includes(String(e||""))}var
|
|
62
|
+
`),0;try{let n=await t.run(k(s));return typeof n=="number"?n:0}catch(n){return process.stderr.write(`oracle ${r}: ${n?.message||n}
|
|
63
|
+
`),1}}return process.stderr.write(L(r,a)),1}async function b(){let e=S();return process.stdout.write(`oracle ${e}
|
|
64
|
+
`),0}function ee(e=[],o={stdin:process.stdin,stdout:process.stdout}){return e.length!==0?!1:process.env.ORACLE_FORCE_CHAT==="1"?!0:o.stdin?.isTTY===!0&&o.stdout?.isTTY===!0}function te(e){return["-m","--model","--provider","-q","--query","-Q","--quiet","-c","--continue","-r","--resume","-s","--skills","-t","--toolsets","--reasoning","--tui","--cli","--yolo","--checkpoints","--source","--max-turns"].includes(String(e||""))}var Se=Object.freeze({data:"./desk-server.mjs",public:"./oracle-public-server.mjs","data-mcp":"./oracle-data-mcp.mjs",init:"./oracle-init.mjs",upgrade:"./oracle-upgrade.mjs",scan:"./oracle-scan.mjs",route:"./oracle-route.mjs",equities:"./oracle-equities.mjs"});function ne(){if(!process.argv[1])return!1;try{return U(re(import.meta.url))===U(process.argv[1])}catch{return!1}}async function oe(e=process.argv.slice(2)){return O(e)}if(ne()){let e=await oe();process.exit(typeof e=="number"?e:0)}export{Se as COMMANDS,oe as main};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var u=o(()=>{});var C=o(()=>{});var f=o(()=>{});var s=o(()=>{C();f()});var H=o(()=>{});var wt,bt,l=o(()=>{wt=300*1e3,bt=(()=>{let e=Number(process.env.ORACLE_PREPARE_HARD_MAX_AGE_MS);return Number.isFinite(e)&&e>0?e:1800*1e3})()});import{Contract as xt,JsonRpcProvider as At}from"ethers";var J=o(()=>{});var It,_=o(()=>{J();It=Object.freeze({swap:5,bridge:5,perps:0,nft:0})});var Z=o(()=>{u();s();H();l();_()});var ee=o(()=>{u();s();l();_()});var j=o(()=>{});var te=o(()=>{u();s();j();l()});var Qt,re=o(()=>{Qt=Object.freeze({READ:"read",PREPARE:"prepare",EXECUTE:"execute",AUTONOMOUS:"autonomous"})});import{TypedDataEncoder as nr,getAddress as or,isAddress as ar}from"ethers";var pr,fr,mr,hr,ne=o(()=>{u();s();re();H();l();pr=Object.freeze({1:"0x9008D19f58AAbD9eD0D60971565AA8510560ab41",100:"0x9008D19f58AAbD9eD0D60971565AA8510560ab41",42161:"0x9008D19f58AAbD9eD0D60971565AA8510560ab41",8453:"0x9008D19f58AAbD9eD0D60971565AA8510560ab41"}),fr=Object.freeze({1:"0xC92E8bdf79f0507f65a392b0ab4667716BFE0110",100:"0xC92E8bdf79f0507f65a392b0ab4667716BFE0110",42161:"0xC92E8bdf79f0507f65a392b0ab4667716BFE0110",8453:"0xC92E8bdf79f0507f65a392b0ab4667716BFE0110"}),mr=Object.freeze({Order:[{name:"sellToken",type:"address"},{name:"buyToken",type:"address"},{name:"receiver",type:"address"},{name:"sellAmount",type:"uint256"},{name:"buyAmount",type:"uint256"},{name:"validTo",type:"uint32"},{name:"appData",type:"bytes32"},{name:"feeAmount",type:"uint256"},{name:"kind",type:"string"},{name:"partiallyFillable",type:"bool"},{name:"sellTokenBalance",type:"string"},{name:"buyTokenBalance",type:"string"}]}),hr=Object.freeze({OrderCancellations:[{name:"orderUids",type:"bytes[]"}]})});var T,br,L=o(()=>{T={robinhood:{chainId:4663,name:"Robinhood Chain",rpcEnv:["RH_CHAIN_RPC"],evm:!0},ethereum:{chainId:1,name:"Ethereum",rpcEnv:["ETH_RPC_URL","ETHEREUM_RPC_URL","MAINNET_RPC_URL"],evm:!0},polygon:{chainId:137,name:"Polygon",rpcEnv:["POLYGON_RPC_URL","POLYGON_RPC"],evm:!0},arbitrum:{chainId:42161,name:"Arbitrum One",rpcEnv:["ARBITRUM_RPC_URL","ARB_RPC_URL"],evm:!0},base:{chainId:8453,name:"Base",rpcEnv:["BASE_RPC_URL"],evm:!0},hyperevm:{chainId:999,name:"HyperEVM",rpcEnv:["HYPEREVM_RPC_URL","HYPER_EVM_RPC"],evm:!0},bsc:{chainId:56,name:"BNB Smart Chain",rpcEnv:["BSC_RPC_URL","BNB_RPC_URL"],evm:!0},avalanche:{chainId:43114,name:"Avalanche C-Chain",rpcEnv:["AVALANCHE_RPC_URL","AVAX_RPC_URL"],evm:!0},optimism:{chainId:10,name:"OP Mainnet",rpcEnv:["OPTIMISM_RPC_URL","OP_RPC_URL"],evm:!0},abstract:{chainId:2741,name:"Abstract",rpcEnv:["ABSTRACT_RPC_URL","ABS_RPC_URL"],evm:!0},stable:{chainId:988,name:"Stable Mainnet",rpcEnv:["STABLE_RPC_URL","STABLE_RPC"],evm:!0}},br=new Map(Object.values(T).map(e=>[e.chainId,e]))});import{Interface as ke,getAddress as yr}from"ethers";var Sr,x=o(()=>{u();L();Sr=new ke(["function allowance(address owner,address spender) view returns (uint256)","function balanceOf(address account) view returns (uint256)"])});var Cr,R=o(()=>{u();Cr=Object.freeze({1:"ethereum",10:"optimism",56:"bsc",137:"polygon",8453:"base",42161:"arbitrum",43114:"avalanche",999:"hyperevm",4663:"robinhood"})});import{Interface as se,getAddress as _r,isAddress as Or}from"ethers";var Fr,Dr,W=o(()=>{x();R();s();l();Fr=new se(["function quoteExactInputSingle((address tokenIn, address tokenOut, uint256 amountIn, uint24 fee, uint160 sqrtPriceLimitX96) params) returns (uint256 amountOut, uint160 sqrtPriceX96After, uint32 initializedTicksCrossed, uint256 gasEstimate)","function quoteExactInput(bytes path, uint256 amountIn) returns (uint256 amountOut, uint160[] sqrtPriceX96AfterList, uint32[] initializedTicksCrossedList, uint256 gasEstimate)"]),Dr=new se(["function exactInputSingle((address tokenIn,address tokenOut,uint24 fee,address recipient,uint256 amountIn,uint256 amountOutMinimum,uint160 sqrtPriceLimitX96) params) payable returns (uint256 amountOut)","function multicall(uint256 deadline,bytes[] data) payable returns (bytes[] results)"])});import{AbiCoder as _e,Interface as ce,getAddress as Pr,isAddress as qr,keccak256 as Mr}from"ethers";var Gr,Kr,zr,ue=o(()=>{x();R();s();l();Gr=_e.defaultAbiCoder(),Kr=new ce(["function quoteExactInputSingle(((address currency0,address currency1,uint24 fee,int24 tickSpacing,address hooks) poolKey,bool zeroForOne,uint128 exactAmount,bytes hookData) params) returns (uint256 amountOut, uint256 gasEstimate)"]),zr=new ce(["function execute(bytes commands,bytes[] inputs,uint256 deadline) payable"])});var We=1<<17;var Ge=256*1024*1024;import c from"node:fs";import X from"node:fs";import he from"node:os";import p from"node:path";function Y(e=process.env){return e.ORACLE_CONFIG_DIR?p.resolve(e.ORACLE_CONFIG_DIR):e.ORACLE_FAKE_HOME?p.join(p.resolve(e.ORACLE_FAKE_HOME),".config","oracle"):p.join(he.homedir(),".config","oracle")}function F(e=process.env){let t=Y(e);X.mkdirSync(t,{recursive:!0,mode:448});try{X.chmodSync(t,448)}catch{}return t}function D(e=process.env){return p.join(F(e),"keys","default.vault")}function $(e=process.env){return p.join(F(e),"local-session.json")}function g(e=process.env){return p.join(F(e),"local-arm.json")}var rt=1800*1e3;function P(e){return JSON.parse(c.readFileSync(e,"utf8"))}function Ae(e,t){c.writeFileSync(e,JSON.stringify(t,null,2)+`
|
|
2
|
+
`,{mode:384});try{c.chmodSync(e,384)}catch{}}function I(e=process.env){let t=e.ORACLE_VAULT_PATH||D(e),n=$(e),r=g(e),a=!1,w=null;try{c.existsSync(t)&&(a=!0,w=JSON.parse(c.readFileSync(t,"utf8"))?.meta||null)}catch{a=c.existsSync(t)}let y=!1,d=null,i=null;try{if(c.existsSync(n)){let b=P(n);b?.expiresAt&&Date.parse(b.expiresAt)>Date.now()&&b?.vaultPath&&(y=!0,d=b.expiresAt,i=b.address||null)}}catch{y=!1}let S=!1,v=null;try{c.existsSync(r)&&(v=P(r),S=v?.armed===!0,S&&v.expiresAt&&Date.parse(v.expiresAt)<=Date.now()&&(S=!1))}catch{S=!1}return{vaultPath:t,vaultExists:a,vaultMeta:w,unlocked:y,sessionExpiresAt:d,address:i,armed:S,arm:v,plane:"local-self-custody",note:"Keys never leave this machine. Public HTTP plane stays prepare-only."}}function U(e,t,n){for(let r of n)if(e[r]!=null)return(Array.isArray(e[r])?e[r]:String(e[r]).split(",")).map(w=>String(w).trim()).filter(Boolean);for(let r of n)if(Array.isArray(t[r]))return t[r];return[]}function N(e={},t=process.env){let n=c.existsSync(g(t))?P(g(t)):{},r={armed:e.armed===!0,maxSpendEth:e.maxSpendEth!=null?String(e.maxSpendEth):n.maxSpendEth||null,chains:Array.isArray(e.chains)?e.chains.map(String):Array.isArray(n.chains)?n.chains:[],maxSlippageBps:e.maxSlippageBps!=null?Number(e.maxSlippageBps):n.maxSlippageBps??500,destinations:U(e,n,["destinations","destinationAllowlist"]),spenders:U(e,n,["spenders","operators","spenderAllowlist"]),selectors:U(e,n,["selectors","selectorAllowlist"]),maxSpendWei:e.maxSpendWei!=null?String(e.maxSpendWei):n.maxSpendWei||null,ttlMinutes:e.ttlMinutes!=null?Number(e.ttlMinutes):n.ttlMinutes??30,armedAt:null,expiresAt:null};return r.armed&&(r.armedAt=new Date().toISOString(),r.expiresAt=new Date(Date.now()+Math.max(1,r.ttlMinutes)*6e4).toISOString()),Ae(g(t),r),r}import{Wallet as Ya,JsonRpcProvider as Ja,getAddress as Qa,isAddress as Za,parseUnits as ei}from"ethers";var ot=Object.freeze(["blockNumber","nativeBalance","tokenBalance","resolveToken","resolvePools","scanBlocks","scoreRisk","quote","sellSimulation","prepareUnsignedTx"]),q=Object.freeze({LIVE:"LIVE",CACHED:"CACHED",STALE:"STALE",UNKNOWN:"UNKNOWN",UNAVAILABLE:"UNAVAILABLE"}),M=Object.freeze({PASS:"PASS",CAUTION:"CAUTION",FAIL:"FAIL",UNKNOWN:"UNKNOWN"});var ye=Object.freeze({FULL:"FULL",NO_GAS:"NO_GAS",FAILED:"FAILED"});Z();ee();te();u();s();j();l();ne();W();ue();u();var gn=Object.freeze({across:["across"],relay:["relaychain","relay"],lifi:["jumper-(li.fi-powered)","lifi"],stargate:["stargate-v2","stargate-v1","stargate"],hop:["hop-protocol","hop"],debridge:["debridge"],synapse:["synapse"],connext:["connext"],cbridge:["celer-bridge","celer-cbridge","cbridge"],celer:["celer-bridge","celer-cbridge","cbridge"],squid:["squid"],symbiosis:["symbiosis"],wormhole:["wormhole"],mayan:["mayan"],allbridge:["allbridge"],thorchain:["thorchain"]});_();l();var Dn=Object.freeze({TRANSACTION:"unsigned-transaction",TYPED_DATA_ORDER:"typed-data-order"});var $n=new Set(["0x0000000000000000000000000000000000000000","0x000000000000000000000000000000000000dead","0x0000000000000000000000000000000000000001","0x00000000000000000000000000000000000a1ce5"].map(e=>e.toLowerCase()));x();R();x();x();var so=Object.freeze([{key:"ethereum",chainId:1,name:"Ethereum",rpcEnv:["ETH_RPC_URL","ETHEREUM_RPC_URL","MAINNET_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://etherscan.io",dexscreenerSlug:"ethereum",venueKind:"uniswap-v3",wrappedNative:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDC fee 500 quoted 1908.71 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:1}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:1}}]},{key:"optimism",chainId:10,name:"OP Mainnet",rpcEnv:["OPTIMISM_RPC_URL","OP_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://optimistic.etherscan.io",dexscreenerSlug:"optimism",venueKind:"uniswap-v3",wrappedNative:"0x4200000000000000000000000000000000000006",venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDC fee 500 quoted 1905.23 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:10}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:10}}]},{key:"bsc",chainId:56,name:"BNB Smart Chain",rpcEnv:["BSC_RPC_URL","BNB_RPC_URL"],nativeCurrency:{symbol:"BNB",decimals:18},explorer:"https://bscscan.com",dexscreenerSlug:"bsc",venueKind:"uniswap-v3",wrappedNative:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",venues:[{kind:"quoter",address:"0x78D78E420Da98ad378D7799bE8f4AF69033EB077",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WBNB->USDC fee 500 quoted 413.86 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:56}},{kind:"router",address:"0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:56}}]},{key:"polygon",chainId:137,name:"Polygon",rpcEnv:["POLYGON_RPC_URL","POLYGON_RPC"],nativeCurrency:{symbol:"POL",decimals:18},explorer:"https://polygonscan.com",dexscreenerSlug:"polygon",venueKind:"uniswap-v3",wrappedNative:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WMATIC->USDC fee 500 quoted 0.0720 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:137}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:137}}]},{key:"stable",chainId:988,name:"Stable Mainnet",rpcEnv:["STABLE_RPC_URL","STABLE_RPC"],nativeCurrency:{symbol:"USDT0",decimals:18},venueKind:"uniswap-v3",wrappedNative:"0x5d442b349590a6048Eb2dC0eC346cAA5F47A9ab5",venues:[{kind:"quoter",address:"0xb070179E7032CdA868b53e6C1742F80c9e940d1A",label:"Uniswap V3 QuoterV2 (canonical)",verified:{method:"Stable is on the OFFICIAL Uniswap v3 Deployments List (governance-recognised 2026-05-12, UAC process completed 2026-04, deployed by Protofire), so this is a canonical deployment rather than a fork. eth_getCode returned 8273 bytes, the same size as the canonical quoter on the seven already-verified chains. Functional probe on a live pool (TOAST -> USDT0, fee 10000): 100 in -> 0.000003, 1000 -> 0.000031, 10000 -> 0.000319 USDT0. Output scales monotonically with input, which is a working quoter answering, not a revert. Two of three sampled pools carry non-zero liquidity. NOTE: the pools discovered so far are thin, so real routing size is limited -- the venue is proved, deep liquidity is not.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:988}},{kind:"router",address:"0x32eaf9B5d5F2CD7361c5012890C943D7de84C22a",label:"Uniswap SwapRouter02 (canonical)",verified:{method:"eth_getCode returned 24497 bytes. Cross-checked on-chain rather than trusted from docs: router.factory() returns 0x88f0a512ef09175d456bc9547f914f48c013e4aa, the same v3 core factory that created the pools quoted above, and router.WETH9() returns the wrappedNative recorded on this chain entry. Address published in the Stable docs DEX reference and the Uniswap deployments list.",source:"docs.stable.xyz/en/reference/dexes + on-chain factory()/WETH9() round-trip",date:"2026-08-05",chainId:988}}]},{key:"hyperevm",chainId:999,name:"HyperEVM",rpcEnv:["HYPEREVM_RPC_URL","HYPER_EVM_RPC"],nativeCurrency:{symbol:"HYPE",decimals:18},dexscreenerSlug:"hyperevm",venueKind:"uniswap-v3",wrappedNative:"0x5555555555555555555555555555555555555555",venues:[{kind:"quoter",address:"0x03A918028f22D9E1473B7959C927AD7425A45C7C",label:"HyperSwap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle(1 WHYPE -> USDT0) returned live output on all four fee tiers (100: 57.3385, 500: 57.4187, 3000: 57.3237, 10000: 56.1963 USDT0). Decimals read on-chain: WHYPE 18, USDT0 6. Best tier checked against an INDEPENDENT control the same minute -- Hyperliquid allMids put HYPE at 57.3205, so the pool is 0.171% from the perp mid, which is the right shape for fee plus impact rather than a wrong contract or a decimals bug.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:999}},{kind:"router",address:"0x4E2960a8cd19B467b82d26D83fAcb0fAE26b094D",label:"HyperSwap V3 SwapRouter",verified:{method:"eth_getCode returned 12070 bytes, and it is the router paired with the quoter proved above -- the same pair already shipped in UNI_V3_VENUES[999].hyperswap, which is the map the quote/prepare path actually routes through.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:999}}]},{key:"abstract",chainId:2741,name:"Abstract",rpcEnv:["ABSTRACT_RPC_URL","ABS_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},venueKind:"uniswap-v3",wrappedNative:"0x3439153EB7AF838Ad19d56E1571FBD09333C2809",venues:[{kind:"quoter",address:"0x728BD3eC25D5EDBafebB84F3d67367Cd9EBC7693",label:"Uniswap V3 QuoterV2 (Abstract deployment)",verified:{method:"Abstract is a ZK-stack chain, so CREATE2 addresses differ and the canonical Uniswap addresses are NOT valid here -- probing them returns codesize 0, which is what previously made this chain look like it had no V3 at all. Found the real deployment from live traffic instead: scanned recent Swap(...) logs, took the busiest pool, read pool.factory() = 0xa1160e73b63f322ae88cc2d8e700833e71d0b2a1, then enumerated that factory's deployer (0xf3d63166F0Ca56C3c1A3508FcE03Ff0Cf3Fb691e) and probed each of its 56 contracts with a real quoteExactInputSingle call. Exactly one answered: 1 WETH -> 1846.475731 USDC.e at fee 500. Independent sanity check: the pool's own slot0() spot price is 1873.11 USDC.e per WETH, so the quoter sits ~1.4% below spot, the right shape for fee plus price impact on this size.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:2741}},{kind:"router",address:"0x7712FA47387542819d4E35A23f8116C90C18767C",label:"Uniswap SwapRouter02 (Abstract deployment)",verified:{method:"eth_getCode returned 167392 bytes and the runtime contains the exactInputSingle selector. router.factory() matches the factory proved above and router.WETH9() matches the wrappedNative on this entry. Chosen over its byte-identical twin (0xfD6257F4...) because this is the address real users actually route through: it appeared as tx.to on live swaps against the WETH/USDC.e pool.",source:"on-chain factory()/WETH9() round-trip + live swap tx.to sampling",date:"2026-08-05",chainId:2741}}]},{key:"robinhood",chainId:4663,name:"Robinhood Chain",rpcEnv:["RH_CHAIN_RPC","ROBINHOOD_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},dexscreenerSlug:"robinhood",venueKind:"uniswap-v3",wrappedNative:"0x0bd7d308f8e1639fab988df18a8011f41eacad73",venues:[{kind:"quoter",address:"0x33e885ed0ec9bf04ecfb19341582aadcb4c8a9e7",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDG fee 100 quoted 1866.58 USDG, and USDG->CASHCAT fee 10000 quoted a live amount). A contract that correctly prices known pairs IS a working V3 quoter",source:"live eth_call against rpc.mainnet.chain.robinhood.com",date:"2026-07-31",chainId:4663}},{kind:"router",address:"0xcaf681a66d020601342297493863e78c959e5cb2",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode (24497 bytes) on this chain and the paired quoter at the same deployment passed a live functional quote",source:"live eth_getCode against rpc.mainnet.chain.robinhood.com",date:"2026-07-31",chainId:4663}},{kind:"factory",address:"0x1f7d7550b1b028f7571e69a784071f0205fd2efa",label:"Uniswap V3 Factory",verified:{method:"eth_getCode returned real bytecode (24535 bytes) and a PoolCreated log scan over this factory returned 76 pools in ~9000 recent blocks",source:"live eth_getLogs against rpc.mainnet.chain.robinhood.com",date:"2026-07-31",chainId:4663}}]},{key:"base",chainId:8453,name:"Base",rpcEnv:["BASE_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://basescan.org",dexscreenerSlug:"base",venueKind:"uniswap-v3",wrappedNative:"0x4200000000000000000000000000000000000006",venues:[{kind:"quoter",address:"0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",label:"Uniswap V3 QuoterV2 (Base)",verified:{method:"functional probe: quoteExactInputSingle returned WETH->USDC at fee 500 = 1908.44 USDC, a live sane price. The canonical mainnet quoter address also has bytecode on Base but does NOT price this pair, which is exactly the false positive a codesize-only check accepts",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:8453}},{kind:"router",address:"0x2626664c2603336E57B271c5C0b26F421741e481",label:"Uniswap V3 SwapRouter02 (Base)",verified:{method:"eth_getCode returned real bytecode and the paired Base quoter passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:8453}},{kind:"router-v2",address:"0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",label:"Uniswap V2 Router02 (Base)",verified:{method:"eth_getCode returned 17891 bytes; live getAmountsOut on WETH->USDC round-tripped to 98.75% (2x0.30% fee + impact)",source:"https://docs.uniswap.org/contracts/v2/reference/smart-contracts/v2-deployments",date:"2026-07-30",chainId:8453}}]},{key:"arbitrum",chainId:42161,name:"Arbitrum One",rpcEnv:["ARBITRUM_RPC_URL","ARB_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://arbiscan.io",dexscreenerSlug:"arbitrum",venueKind:"uniswap-v3",wrappedNative:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDC fee 500 quoted 1908.72 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:42161}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:42161}}]},{key:"avalanche",chainId:43114,name:"Avalanche C-Chain",rpcEnv:["AVALANCHE_RPC_URL","AVAX_RPC_URL"],nativeCurrency:{symbol:"AVAX",decimals:18},explorer:"https://snowtrace.io",dexscreenerSlug:"avalanche",venueKind:"uniswap-v3",wrappedNative:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",venues:[{kind:"quoter",address:"0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WAVAX->USDC fee 500 quoted 6.48 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:43114}},{kind:"router",address:"0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:43114}}]}]);W();L();import{homedir as G}from"node:os";import{join as K}from"node:path";var le=process.env.ORACLE_PUBLIC_DESKTOP==="1",Le=le?process.env.ORACLE_CONFIG_DIR||K(G(),".config","oracle"):K(G(),".config","oracle"),yo=le?Le:K(G(),".config","mad-desk");s();import{Interface as $e,MaxUint256 as Yo,isAddress as Jo,keccak256 as Qo,toUtf8Bytes as Zo}from"ethers";import{Interface as Fe,isAddress as To}from"ethers";s();C();f();import{isAddress as Io}from"ethers";C();f();var Fo=new Fe(["function approve(address spender,uint256 amount) returns (bool)"]);import{Interface as De,isAddress as Uo}from"ethers";C();f();var Vo=new De(["function approve(address spender,uint256 amount) returns (bool)"]),Ho=Object.freeze({42161:"0x1c3fa76e6e1088bce750f23a5bfcffa1efef6a41",43114:"0x8f550e53dfe96c055d5bdb267c21f268fcaf63b2"});f();var aa=new $e(["function approve(address spender,uint256 amount) returns (bool)"]);import{Interface as Ue,isAddress as ca}from"ethers";f();var da=new Ue(["function setApprovalForAll(address operator,bool approved)"]);import{Interface as Pe,MaxUint256 as ma,isAddress as ha}from"ethers";var wa=new Pe(["function transfer(address to,uint256 amount) returns (bool)","function transferFrom(address from,address to,uint256 amount) returns (bool)"]);import{isAddress as Ha}from"ethers";import{Wallet as li,JsonRpcProvider as di,getAddress as pi,isAddress as fi,parseUnits as mi}from"ethers";L();var me=`oracle arm [--max <eth>] [--chain base[,eth]] [--slip-bps 500] [--ttl-min 30]
|
|
3
|
+
[--destination 0xRouter[,0xRouter2]] [--spender 0xSpender[,0xOperator]] [--selector 0x095ea7b3]
|
|
4
|
+
oracle arm --off
|
|
5
|
+
|
|
6
|
+
Arm the LOCAL vault session for capped snipes on this machine.
|
|
7
|
+
Does nothing on the public cloud plane.
|
|
8
|
+
|
|
9
|
+
oracle arm --max 0.05 --chain base --slip-bps 500 --ttl-min 30
|
|
10
|
+
oracle arm --off
|
|
11
|
+
`;function A(e,t){let n=e.find(a=>a.startsWith(`--${t}=`));if(n)return n.split("=").slice(1).join("=");let r=e.indexOf(`--${t}`);return r>=0&&e[r+1]&&!e[r+1].startsWith("--")?e[r+1]:null}function z(e,t){for(let n of t){let r=A(e,n);if(r!=null)return String(r).split(",").map(a=>a.trim()).filter(Boolean)}return[]}var Ui={name:"arm",summary:"arm local vault spend policy for snipes",group:"local",usage:me,async run(e){let t=e.argv||[];if(t.includes("--help")||t.includes("-h"))return process.stdout.write(me+`
|
|
12
|
+
`),0;if(t.includes("--off")||t.includes("--disarm")){let i=N({armed:!1});return process.stdout.write(`disarmed
|
|
13
|
+
`),0}let n=A(t,"max")||A(t,"max-spend");if(!n){let i=I();return i.armed?(process.stdout.write(`armed max=${i.arm?.maxSpendEth} chains=${(i.arm?.chains||[]).join(",")} exp=${i.arm?.expiresAt}
|
|
14
|
+
`),0):(process.stderr.write(`error: --max <eth> required to arm (or --off to disarm)
|
|
15
|
+
`),1)}let r=A(t,"chain")||"base",a=String(r).split(",").map(i=>i.trim()).filter(Boolean),w=Number(A(t,"slip-bps")||500),y=Number(A(t,"ttl-min")||30),d=N({armed:!0,maxSpendEth:n,chains:a,maxSlippageBps:w,destinations:z(t,["destination","dest","to"]),spenders:z(t,["spender","operator"]),selectors:z(t,["selector","method"]),ttlMinutes:y});return process.stdout.write(`armed max=${d.maxSpendEth} eth chains=${d.chains.join(",")} slip=${d.maxSlippageBps}bps until ${d.expiresAt}
|
|
16
|
+
`),process.stdout.write(`snipe: oracle snipe 0xCA... --chain base --execute
|
|
17
|
+
`),0}};export{Ui as default};
|