Skip to content

Commit

Permalink
deployments of final V1 version
Browse files Browse the repository at this point in the history
  • Loading branch information
zapaz committed Nov 4, 2024
1 parent 3813b5e commit ed07188
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 31 deletions.
4 changes: 2 additions & 2 deletions foundry/addresses.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"11155420": {
"Counter": "0x8354Ef7b78012151c276f51F8d19147FF8C47288",
"OnChainAI": "0xd1ca741de2d2975822ADf4646Cf0A8AE3Df51c78",
"OnChainAIv1": "0xa043949B6984D8704501EC64519E2b6e00a4329A",
"OnChainAIv1": "0x879ae6BC9a6173A14111FE204ec0E14DCB619e9E",
"chainName": "optimism-sepolia"
},
"31337": {
Expand All @@ -13,7 +13,7 @@
},
"8453": {
"OnChainAI": "0xd798E6E526d7893e4F7aCED9F56DF69643bCf1B6",
"OnChainAIv1": "0x1F4666E268Ec7F1Fc46C467A8CdAF6b01f88B935",
"OnChainAIv1": "0x5095f726C40D0AE7360c6307B7cE57620ae8594c",
"chainName": "base"
},
"84532": {
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion svelte5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.46.0",
"globals": "^15.11.0",
"globals": "^15.12.0",
"postcss": "^8.4.47",
"postcss-load-config": "^6.0.1",
"prettier": "^3.3.3",
Expand Down
4 changes: 2 additions & 2 deletions svelte5/src/lib/deployments.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"8453": {
"OnChainAIv1": {
"address": "0x1F4666E268Ec7F1Fc46C467A8CdAF6b01f88B935",
"address": "0x5095f726C40D0AE7360c6307B7cE57620ae8594c",
"abi": [
{
"type": "constructor",
Expand Down Expand Up @@ -1495,7 +1495,7 @@
]
},
"OnChainAIv1": {
"address": "0xa043949B6984D8704501EC64519E2b6e00a4329A",
"address": "0x879ae6BC9a6173A14111FE204ec0E14DCB619e9E",
"abi": [
{
"type": "constructor",
Expand Down
2 changes: 0 additions & 2 deletions svelte5/src/lib/onchain-ai/components/Chat.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,3 @@
<div>{interactionsCount}/{interactionsMax}</div>
</button>
</div>


2 changes: 1 addition & 1 deletion svelte5/src/lib/onchain-ai/runes/contract.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const createOnchainAI = () => {
const config = $derived(readConfig(chainId));

// $inspect("createOnchainAI chainId", chainId)

return {
get client() {
return client;
Expand Down
9 changes: 4 additions & 5 deletions svelte5/src/lib/onchain-ai/runes/lastInteraction.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@ const createLastInteraction = (account: Address) => {
$effect(() => {
blockNumber;
fetch && fetch();
})
});

const { data: interactionTuple, fetch } = $derived.by(() => {
if (!account) return { data: null, fetch: null };

return createReadOnchainAI({ functionName: "lastInteraction", args: [account] });
});


const lastInteraction = $derived.by(() => {
if (!interactionTuple) return null;


const [requestId, sender, prompt, response] = interactionTuple as InteractionTypeTuple;
return { requestId, sender, prompt, response };

}) as InteractionType | null;

return {
get lastInteraction() { return lastInteraction; }
get lastInteraction() {
return lastInteraction;
}
};
};

Expand Down
12 changes: 6 additions & 6 deletions svelte5/src/lib/onchain-ai/ts/types.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { Address, Log } from "viem";

type InteractionTypeTuple = [string, Address, string, string]
type InteractionTypeTuple = [string, Address, string, string];
type InteractionType = {
requestId: string,
sender: Address,
prompt: string,
response: string,
isResponse?: boolean
requestId: string;
sender: Address;
prompt: string;
response: string;
isResponse?: boolean;
};

type InteractionLogWithArgs = Log & { args: InteractionType; index: number };
Expand Down
2 changes: 1 addition & 1 deletion svelte5/src/lib/scaffold.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const { PUBLIC_ALCHEMY_API_KEY, PUBLIC_WALLET_CONNECT_PROJECT_ID } = env as {

const scaffoldConfig = {
// The networks on which your DApp is live
targetNetworks: [chains.baseSepolia, chains.anvil, chains.optimismSepolia, chains.base],
targetNetworks: [chains.base, chains.baseSepolia, chains.optimismSepolia, chains.anvil],

// The interval at which your front-end polls the RPC servers for new data
// it has no effect if you only target the local network (default is 4000)
Expand Down
4 changes: 2 additions & 2 deletions svelte5/src/lib/wagmi/runes/blocks.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createConfig } from "./config.svelte";
import { createTargetNetworkId } from "$lib/scaffold-eth/runes/global.svelte";

const createBlockNumber = (params?: { chainId?: number; watch?: boolean }) => {
let { chainId, watch } = params || {}
let { chainId, watch } = params || {};
watch ??= true;

const config = $derived.by(createConfig());
Expand All @@ -20,7 +20,7 @@ const createBlockNumber = (params?: { chainId?: number; watch?: boolean }) => {
};
fetch();

let unwatch = (): void => { };
let unwatch = (): void => {};
$effect(() => {
unwatch();
unwatch = watchBlockNumber(config, {
Expand Down
5 changes: 2 additions & 3 deletions svelte5/src/lib/wagmi/runes/read.svelte.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Abi, AbiFunction, AbiParameter } from "abitype";
import type { Address } from "viem";
import { type ReadContractReturnType, readContract } from "@wagmi/core";
import { type ReadContractReturnType, readContract, deepEqual } from "@wagmi/core";
import { createConfig } from "$lib/wagmi/runes";

const createReadContract = ({
Expand Down Expand Up @@ -37,8 +37,7 @@ const createReadContract = ({

try {
const newData = await readContract(config, { address, abi, functionName, args });
if (JSON.stringify($state.snapshot(data)) == JSON.stringify(newData)) return;
data = newData;
if (!deepEqual($state.snapshot(data), newData)) data = newData;
} catch (e: unknown) {
console.error("createReadContract ERROR", e);
}
Expand Down
1 change: 0 additions & 1 deletion svelte5/src/routes/tests/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<h1 class="text-2xl font-bold mb-4">Tests</h1>

<ul class="list-disc pl-5 space-y-2">
<li><a class="text-blue-500 hover:underline" href="/tests/events">events</a></li>
<li><a class="text-blue-500 hover:underline" href="/tests/account">account</a></li>
<li><a class="text-blue-500 hover:underline" href="/tests/deployed">deployed</a></li>
<li><a class="text-blue-500 hover:underline" href="/tests/last">last</a></li>
Expand Down

0 comments on commit ed07188

Please sign in to comment.