diff --git a/bun.lock b/bun.lock index 7981107..54ad8ae 100644 --- a/bun.lock +++ b/bun.lock @@ -64,7 +64,7 @@ "ai": ["ai@5.0.113", "", { "dependencies": { "@ai-sdk/gateway": "2.0.21", "@ai-sdk/provider": "2.0.0", "@ai-sdk/provider-utils": "3.0.19", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-26vivpSO/mzZj0k1Si2IpsFspp26ttQICHRySQiMrtWcRd5mnJMX2a8sG28vmZ38C+JUn1cWmfZrsLMxkSMw9g=="], - "alkahest-ts": ["alkahest-ts@github:VAR-META-Tech/alkahest#0610ef6", {}, "VAR-META-Tech-alkahest-0610ef6"], + "alkahest-ts": ["alkahest-ts@github:VAR-META-Tech/alkahest#d40de37", {}, "VAR-META-Tech-alkahest-d40de37"], "arkregex": ["arkregex@0.0.5", "", { "dependencies": { "@ark/util": "0.56.0" } }, "sha512-ncYjBdLlh5/QnVsAA8De16Tc9EqmYM7y/WU9j+236KcyYNUXogpz3sC4ATIZYzzLxwI+0sEOaQLEmLmRleaEXw=="], diff --git a/cli/client/collect-escrow.ts b/cli/client/collect-escrow.ts index 6e682ee..f144dd0 100644 --- a/cli/client/collect-escrow.ts +++ b/cli/client/collect-escrow.ts @@ -11,6 +11,7 @@ import { privateKeyToAccount } from "viem/accounts"; import { foundry } from "viem/chains"; import { existsSync, readFileSync } from "fs"; import { resolve } from "path"; +import { makeClient } from "alkahest-ts"; // Helper function to display usage function displayHelp() { @@ -116,9 +117,6 @@ async function main() { console.log(` ✅ Fulfillment UID: ${fulfillmentUid}`); console.log(` 🌐 RPC URL: ${rpcUrl}\n`); - // Import alkahest client - const { makeClient } = await import("../../../alkahest/sdks/ts/src/index.ts"); - // Create account and wallet const account = privateKeyToAccount(privateKey as `0x${string}`); const walletClient = createWalletClient({ diff --git a/cli/client/create-escrow.ts b/cli/client/create-escrow.ts index d760b8f..242437f 100644 --- a/cli/client/create-escrow.ts +++ b/cli/client/create-escrow.ts @@ -12,6 +12,9 @@ import { privateKeyToAccount } from "viem/accounts"; import { foundry } from "viem/chains"; import { existsSync, readFileSync } from "fs"; import { resolve } from "path"; +import { makeClient } from "alkahest-ts"; +import { makeLLMClient } from "../../clients/nla.ts"; +import {fixtures} from "alkahest-ts"; // Helper function to display usage function displayHelp() { @@ -139,10 +142,6 @@ async function main() { console.log(` ⚖️ Oracle: ${oracleAddress}`); console.log(` 🌐 RPC URL: ${rpcUrl}\n`); - // Import alkahest client - const { makeClient } = await import("../../../alkahest/sdks/ts/src/index.ts"); - const { makeLLMClient } = await import("../../clients/nla.ts"); - // Create account and wallet const account = privateKeyToAccount(privateKey as `0x${string}`); const walletClient = createWalletClient({ @@ -180,10 +179,9 @@ async function main() { }); // Check token balance - const MockERC20Permit = await import("../../../alkahest/sdks/ts/tests/fixtures/MockERC20Permit.json"); const tokenBalance = await walletClient.readContract({ address: tokenAddress as `0x${string}`, - abi: MockERC20Permit.abi, + abi: fixtures.MockERC20Permit.abi, functionName: "balanceOf", args: [account.address], }) as bigint; diff --git a/cli/client/fulfill-escrow.ts b/cli/client/fulfill-escrow.ts index 32c040a..7a24010 100644 --- a/cli/client/fulfill-escrow.ts +++ b/cli/client/fulfill-escrow.ts @@ -12,6 +12,7 @@ import { privateKeyToAccount } from "viem/accounts"; import { foundry } from "viem/chains"; import { existsSync, readFileSync } from "fs"; import { resolve } from "path"; +import { makeClient } from "alkahest-ts"; // Helper function to display usage function displayHelp() { @@ -128,9 +129,6 @@ async function main() { console.log(` ⚖️ Oracle: ${oracleAddress}`); console.log(` 🌐 RPC URL: ${rpcUrl}\n`); - // Import alkahest client - const { makeClient } = await import("../../../alkahest/sdks/ts/src/index.ts"); - // Create account and wallet const account = privateKeyToAccount(privateKey as `0x${string}`); const walletClient = createWalletClient({ diff --git a/cli/deployments/localhost.json b/cli/deployments/localhost.json index 03d9f68..5c43d7d 100644 --- a/cli/deployments/localhost.json +++ b/cli/deployments/localhost.json @@ -2,7 +2,7 @@ "network": "localhost", "chainId": 31337, "rpcUrl": "http://localhost:8545", - "deployedAt": "2025-12-15T10:47:17.495Z", + "deployedAt": "2025-12-15T17:03:01.822Z", "deployer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "addresses": { "easSchemaRegistry": "0x5fbdb2315678afecb367f032d93f642f64180aa3", diff --git a/cli/server/deploy.ts b/cli/server/deploy.ts index 8c83118..fa55ea7 100644 --- a/cli/server/deploy.ts +++ b/cli/server/deploy.ts @@ -12,6 +12,7 @@ import { privateKeyToAccount } from "viem/accounts"; import { mainnet, sepolia, foundry } from "viem/chains"; import { writeFileSync, existsSync, mkdirSync } from "fs"; import { resolve } from "path"; +import { fixtures, contracts } from "alkahest-ts"; // Helper function to display usage function displayHelp() { @@ -151,19 +152,14 @@ async function main() { // Import contract artifacts from alkahest console.log("📦 Loading contract artifacts...\n"); - // This requires alkahest to be properly set up - const alkahestPath = "../../../alkahest/sdks/ts"; - const contractsPath = `${alkahestPath}/src/contracts`; - - // Import necessary artifacts - const EAS = await import(`${alkahestPath}/tests/fixtures/EAS.json`); - const SchemaRegistry = await import(`${alkahestPath}/tests/fixtures/SchemaRegistry.json`); - const MockERC20Permit = await import(`${alkahestPath}/tests/fixtures/MockERC20Permit.json`); - const TrustedOracleArbiter = await import(`${contractsPath}/TrustedOracleArbiter.json`); - const StringObligation = await import(`${contractsPath}/StringObligation.json`); - const ERC20EscrowObligation = await import(`${contractsPath}/ERC20EscrowObligation.json`); - const ERC20PaymentObligation = await import(`${contractsPath}/ERC20PaymentObligation.json`); - const ERC20BarterCrossToken = await import(`${contractsPath}/ERC20BarterCrossToken.json`); + const EAS = fixtures.EAS; + const SchemaRegistry = fixtures.SchemaRegistry; + const MockERC20Permit = fixtures.MockERC20Permit; + const TrustedOracleArbiter = contracts.TrustedOracleArbiter; + const StringObligation = contracts.StringObligation; + const ERC20EscrowObligation = contracts.ERC20EscrowObligation; + const ERC20PaymentObligation = contracts.ERC20PaymentObligation; + const ERC20BarterCrossToken = contracts.ERC20BarterCrossToken; console.log("✅ Contract artifacts loaded\n"); diff --git a/cli/server/oracle.ts b/cli/server/oracle.ts index ad2c90c..335ce14 100644 --- a/cli/server/oracle.ts +++ b/cli/server/oracle.ts @@ -1,9 +1,13 @@ #!/usr/bin/env bun import { parseArgs } from "util"; -import { parseAbiParameters } from "viem"; +import { parseAbiParameters, createWalletClient, http, publicActions } from "viem"; +import { privateKeyToAccount } from "viem/accounts"; +import { foundry } from "viem/chains"; import { makeLLMClient } from "../../clients/nla"; import { existsSync, readFileSync } from "fs"; import { resolve } from "path"; +import { makeClient } from "alkahest-ts"; +import { fixtures } from "alkahest-ts"; // Helper function to display usage function displayHelp() { @@ -126,12 +130,6 @@ async function main() { process.exit(1); } - // Import alkahest client - const { makeClient } = await import("../../../alkahest/sdks/ts/src/index.ts"); - const { createWalletClient, http, publicActions } = await import("viem"); - const { privateKeyToAccount } = await import("viem/accounts"); - const { foundry } = await import("viem/chains"); - console.log("🚀 Starting Natural Language Agreement Oracle...\n"); console.log("Configuration:"); console.log(` 📡 RPC URL: ${rpcUrl}`);