repairing cowsay

This commit is contained in:
taylor hulsmans 2024-10-28 07:25:46 -07:00
parent c1b0d2eca5
commit 659754f847
9 changed files with 1414 additions and 178 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,147 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "LilypadClient",
"sourceName": "contracts/LilypadClient/LilypadClient.sol",
"address": "0x780B0Cb2Bb975C8303E76b066c876588a5e5a6B3",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_jobManagerAddress",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "dealId",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "dataId",
"type": "string"
}
],
"name": "JobCompleted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "message",
"type": "string"
}
],
"name": "JobCreated",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_jobID",
"type": "uint256"
}
],
"name": "getJobResult",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "jobResults",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "message",
"type": "string"
}
],
"name": "runCowsay",
"outputs": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "string",
"name": "dealId",
"type": "string"
},
{
"internalType": "string",
"name": "dataId",
"type": "string"
}
],
"name": "submitResults",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5060405161093b38038061093b83398101604081905261002f916100b8565b6001600160a01b0381166100895760405162461bcd60e51b815260206004820152601360248201527f4a6f62206d616e61676572206164647265737300000000000000000000000000604482015260640160405180910390fd5b600080546001600160a01b039092166001600160a01b03199283168117909155600180549092161790556100e8565b6000602082840312156100ca57600080fd5b81516001600160a01b03811681146100e157600080fd5b9392505050565b610844806100f76000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80633b89dcab146100515780636c0f1f581461007a578063a3d606451461008f578063cabc00d1146100a2575b600080fd5b61006461005f3660046103a1565b6100c3565b604051610071919061040a565b60405180910390f35b61008d6100883660046104c7565b610165565b005b61006461009d3660046103a1565b6101bd565b6100b56100b0366004610534565b610257565b604051908152602001610071565b60008181526002602052604090208054606091906100e090610571565b80601f016020809104026020016040519081016040528092919081815260200182805461010c90610571565b80156101595780601f1061012e57610100808354040283529160200191610159565b820191906000526020600020905b81548152906001019060200180831161013c57829003601f168201915b50505050509050919050565b600083815260026020526040902061017d82826105fa565b50827f3849c58b4b39b379bddc5973e71a10ded174f54140916d81986c7eec092e5c4283836040516101b09291906106ba565b60405180910390a2505050565b600260205260009081526040902080546101d690610571565b80601f016020809104026020016040519081016040528092919081815260200182805461020290610571565b801561024f5780601f106102245761010080835404028352916020019161024f565b820191906000526020600020905b81548152906001019060200180831161023257829003601f168201915b505050505081565b604080516001808252818301909252600091829190816020015b60608152602001906001900390816102715790505090508260405160200161029991906106e8565b604051602081830303815290604052816000815181106102bb576102bb61072d565b60209081029190910101526001546040517fc75555fa00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063c75555fa9061031e9084903390600401610743565b6020604051808303816000875af115801561033d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036191906107f5565b9150817fb63f0fdfb200b05c8b95fb4dcf8f8abd30f0b6884d532792e705afab4f37380a84604051610393919061040a565b60405180910390a250919050565b6000602082840312156103b357600080fd5b5035919050565b60005b838110156103d55781810151838201526020016103bd565b50506000910152565b600081518084526103f68160208601602086016103ba565b601f01601f19169290920160200192915050565b60208152600061041d60208301846103de565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261044b57600080fd5b813567ffffffffffffffff8082111561046657610466610424565b604051601f8301601f19908116603f0116810190828211818310171561048e5761048e610424565b816040528381528660208588010111156104a757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000606084860312156104dc57600080fd5b83359250602084013567ffffffffffffffff808211156104fb57600080fd5b6105078783880161043a565b9350604086013591508082111561051d57600080fd5b5061052a8682870161043a565b9150509250925092565b60006020828403121561054657600080fd5b813567ffffffffffffffff81111561055d57600080fd5b6105698482850161043a565b949350505050565b600181811c9082168061058557607f821691505b6020821081036105a557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156105f557600081815260208120601f850160051c810160208610156105d25750805b601f850160051c820191505b818110156105f1578281556001016105de565b5050505b505050565b815167ffffffffffffffff81111561061457610614610424565b610628816106228454610571565b846105ab565b602080601f83116001811461065d57600084156106455750858301515b600019600386901b1c1916600185901b1785556105f1565b600085815260208120601f198616915b8281101561068c5788860151825594840194600190910190840161066d565b50858210156106aa5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6040815260006106cd60408301856103de565b82810360208401526106df81856103de565b95945050505050565b7f4d6573736167653d0000000000000000000000000000000000000000000000008152600082516107208160088501602087016103ba565b9190910160080192915050565b634e487b7160e01b600052603260045260246000fd5b60608152600d60608201527f636f777361793a76302e302e34000000000000000000000000000000000000006080820152600060a08201602060a08185015281865180845260c08601915060c08160051b870101935082880160005b828110156107cd5760bf198887030184526107bb8683516103de565b9550928401929084019060010161079f565b5050505073ffffffffffffffffffffffffffffffffffffffff8516604085015250905061041d565b60006020828403121561080757600080fd5b505191905056fea2646970667358221220dc210b952a009e017c8fc29f5993a10b8256fa2cb43548cdd646358b9ec614f264736f6c63430008140033",
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80633b89dcab146100515780636c0f1f581461007a578063a3d606451461008f578063cabc00d1146100a2575b600080fd5b61006461005f3660046103a1565b6100c3565b604051610071919061040a565b60405180910390f35b61008d6100883660046104c7565b610165565b005b61006461009d3660046103a1565b6101bd565b6100b56100b0366004610534565b610257565b604051908152602001610071565b60008181526002602052604090208054606091906100e090610571565b80601f016020809104026020016040519081016040528092919081815260200182805461010c90610571565b80156101595780601f1061012e57610100808354040283529160200191610159565b820191906000526020600020905b81548152906001019060200180831161013c57829003601f168201915b50505050509050919050565b600083815260026020526040902061017d82826105fa565b50827f3849c58b4b39b379bddc5973e71a10ded174f54140916d81986c7eec092e5c4283836040516101b09291906106ba565b60405180910390a2505050565b600260205260009081526040902080546101d690610571565b80601f016020809104026020016040519081016040528092919081815260200182805461020290610571565b801561024f5780601f106102245761010080835404028352916020019161024f565b820191906000526020600020905b81548152906001019060200180831161023257829003601f168201915b505050505081565b604080516001808252818301909252600091829190816020015b60608152602001906001900390816102715790505090508260405160200161029991906106e8565b604051602081830303815290604052816000815181106102bb576102bb61072d565b60209081029190910101526001546040517fc75555fa00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063c75555fa9061031e9084903390600401610743565b6020604051808303816000875af115801561033d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036191906107f5565b9150817fb63f0fdfb200b05c8b95fb4dcf8f8abd30f0b6884d532792e705afab4f37380a84604051610393919061040a565b60405180910390a250919050565b6000602082840312156103b357600080fd5b5035919050565b60005b838110156103d55781810151838201526020016103bd565b50506000910152565b600081518084526103f68160208601602086016103ba565b601f01601f19169290920160200192915050565b60208152600061041d60208301846103de565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261044b57600080fd5b813567ffffffffffffffff8082111561046657610466610424565b604051601f8301601f19908116603f0116810190828211818310171561048e5761048e610424565b816040528381528660208588010111156104a757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000606084860312156104dc57600080fd5b83359250602084013567ffffffffffffffff808211156104fb57600080fd5b6105078783880161043a565b9350604086013591508082111561051d57600080fd5b5061052a8682870161043a565b9150509250925092565b60006020828403121561054657600080fd5b813567ffffffffffffffff81111561055d57600080fd5b6105698482850161043a565b949350505050565b600181811c9082168061058557607f821691505b6020821081036105a557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156105f557600081815260208120601f850160051c810160208610156105d25750805b601f850160051c820191505b818110156105f1578281556001016105de565b5050505b505050565b815167ffffffffffffffff81111561061457610614610424565b610628816106228454610571565b846105ab565b602080601f83116001811461065d57600084156106455750858301515b600019600386901b1c1916600185901b1785556105f1565b600085815260208120601f198616915b8281101561068c5788860151825594840194600190910190840161066d565b50858210156106aa5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6040815260006106cd60408301856103de565b82810360208401526106df81856103de565b95945050505050565b7f4d6573736167653d0000000000000000000000000000000000000000000000008152600082516107208160088501602087016103ba565b9190910160080192915050565b634e487b7160e01b600052603260045260246000fd5b60608152600d60608201527f636f777361793a76302e302e34000000000000000000000000000000000000006080820152600060a08201602060a08185015281865180845260c08601915060c08160051b870101935082880160005b828110156107cd5760bf198887030184526107bb8683516103de565b9550928401929084019060010161079f565b5050505073ffffffffffffffffffffffffffffffffffffffff8516604085015250905061041d565b60006020828403121561080757600080fd5b505191905056fea2646970667358221220dc210b952a009e017c8fc29f5993a10b8256fa2cb43548cdd646358b9ec614f264736f6c63430008140033",
"linkReferences": {},
"deployedLinkReferences": {}
}

794
artifacts/LilypadToken.json Normal file

File diff suppressed because one or more lines are too long

View file

@ -10,8 +10,11 @@ import { runCowsay } from 'src/lilypad/runCowsay';
import { dagGet } from './src/ipfs/dagGet'
import { cat } from './src/ipfs/cat'
import { add } from './src/ipfs/add'
import { ethers, Signer, Provider, JsonRpcProvider, Wallet } from 'ethers';
import ExampleClient from './artifacts/ExampleClient.json'
import { createWalletClient, createPublicClient, http, getContract } from 'viem'
import { privateKeyToAccount, type Account } from 'viem/accounts'
import { type WalletClient, type PublicClient } from 'viem'
import ExampleClient from './artifacts/LilypadClient.json'
import LilypadToken from './artifacts/LilypadToken.json'
import { getMolecule } from './src/plex/getMolecule'
import { getProtein } from './src/plex/getProtein'
import { runEquibind } from './src/plex/runEquibind'
@ -23,6 +26,10 @@ import {
} from './src/settings';
import { WalletModal } from './src/views/WalletView';
import {
localhost, arbitrumSepolia
} from 'viem/chains';
/*
import {
localhost,
mainnet,
@ -33,20 +40,23 @@ import {
import { createWeb3Modal, defaultWagmiConfig } from '@web3modal/wagmi/react'
import { WagmiConfig } from 'wagmi';
*/
export default class ObsidianDesci extends Plugin {
settings: ObsidianDesciSettings;
unloaded = false
provider: Provider
wallet: Wallet
signer: Signer
exampleClient: ethers.Contract
account: Account
walletClient: WalletClient
publicClient: PublicClient
lilypadToken: any
exampleClient: any
logDebug: (...args: unknown[]) => void = () => { }
async onload() {
await this.loadSettings();
/*
const projectId = 'ded360a934deb7668cafc3d5ae1928e4'
const chainsModal = [ mainnet, optimism, arbitrum, localhost]
const chainsModal = [arbitrumSepolia, localhost]
const metadata = {
name: 'Obsidian Desci',
description: 'Web3 x Obsidian.md x DeSci',
@ -64,6 +74,7 @@ export default class ObsidianDesci extends Plugin {
new WalletModal(this.app, wagmiConfig).open();
})
const walletStatus = this.addStatusBarItem()
const rootElement = walletStatus.createEl("span")
const root = createRoot(rootElement)
@ -72,15 +83,40 @@ export default class ObsidianDesci extends Plugin {
<WalletStatusBarItem/>
</WagmiConfig>
)
*/
this.provider = new JsonRpcProvider(this.settings.chain.rpcUrl)
if (this.settings.privateKey) {
this.wallet = new Wallet(this.settings.privateKey, this.provider)
this.signer = this.wallet.connect(this.provider)
this.exampleClient = new ethers.Contract(ExampleClient.address, ExampleClient.abi, this.signer)
// walletClient from privateKey
const account = privateKeyToAccount('0x' + this.settings.privateKey as `0x${string}`)
this.account = account
this.walletClient = createWalletClient({
account: this.account,
chain: arbitrumSepolia,
transport: http(this.settings.chain.rpcUrl)
})
this.publicClient = createPublicClient({
chain: arbitrumSepolia,
transport: http(this.settings.chain.rpcUrl)
})
this.lilypadToken = getContract({
address: LilypadToken.address as `0x${string}`,
abi: LilypadToken.abi,
client: {
public: this.publicClient,
wallet: this.walletClient
}
})
this.exampleClient = getContract({
address: ExampleClient.address as `0x${string}`,
abi: ExampleClient.abi,
client: {
public: this.publicClient,
wallet: this.walletClient
}
})
} else {
}
this.addCommand({

101
package-lock.json generated
View file

@ -22,7 +22,6 @@
"blockstore-core": "^5.0.2",
"datastore-core": "^10.0.2",
"esbuild-plugin-polyfill-node": "^0.3.0",
"ethers": "^6.13.4",
"events": "^3.3.0",
"helia": "^5.1.0",
"kubo-rpc-client": "^5.0.1",
@ -78,12 +77,6 @@
"xml2js": "^0.6.2"
}
},
"node_modules/@adraffy/ens-normalize": {
"version": "1.10.1",
"resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz",
"integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==",
"license": "MIT"
},
"node_modules/@ampproject/remapping": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
@ -8991,12 +8984,6 @@
"node": ">=0.3.0"
}
},
"node_modules/aes-js": {
"version": "4.0.0-beta.5",
"resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz",
"integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==",
"license": "MIT"
},
"node_modules/agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
@ -11541,94 +11528,6 @@
"node": ">=18.0.0"
}
},
"node_modules/ethers": {
"version": "6.13.4",
"resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.4.tgz",
"integrity": "sha512-21YtnZVg4/zKkCQPjrDj38B1r4nQvTZLopUGMLQ1ePU2zV/joCfDC3t3iKQjWRzjjjbzR+mdAIoikeBRNkdllA==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/ethers-io/"
},
{
"type": "individual",
"url": "https://www.buymeacoffee.com/ricmoo"
}
],
"license": "MIT",
"dependencies": {
"@adraffy/ens-normalize": "1.10.1",
"@noble/curves": "1.2.0",
"@noble/hashes": "1.3.2",
"@types/node": "22.7.5",
"aes-js": "4.0.0-beta.5",
"tslib": "2.7.0",
"ws": "8.17.1"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/ethers/node_modules/@noble/curves": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
"integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==",
"license": "MIT",
"dependencies": {
"@noble/hashes": "1.3.2"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/ethers/node_modules/@noble/hashes": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz",
"integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==",
"license": "MIT",
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/ethers/node_modules/@types/node": {
"version": "22.7.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz",
"integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.19.2"
}
},
"node_modules/ethers/node_modules/tslib": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz",
"integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==",
"license": "0BSD"
},
"node_modules/ethers/node_modules/ws": {
"version": "8.17.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/ethjs-util": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz",

View file

@ -40,7 +40,6 @@
"blockstore-core": "^5.0.2",
"datastore-core": "^10.0.2",
"esbuild-plugin-polyfill-node": "^0.3.0",
"ethers": "^6.13.4",
"events": "^3.3.0",
"helia": "^5.1.0",
"kubo-rpc-client": "^5.0.1",

View file

@ -1,3 +1,4 @@
import { parseEther } from 'viem'
import { requestUrl } from 'obsidian'
import { CanvasNode } from 'src/utils/canvas-internal'
import {
@ -7,7 +8,6 @@ import {
getNodeText
} from '../utils/canvas-util'
import {ethers} from 'ethers'
export const runCowsay = async function () {
if (this.unloaded) return
@ -35,7 +35,9 @@ export const runCowsay = async function () {
return
}
const created = createNode(canvas, node,
const created = createNode(
canvas,
node,
{
text: `Calling Lilpad Cowsay with ${nodeText}`,
size: { height: placeholderNoteHeight }
@ -46,32 +48,42 @@ export const runCowsay = async function () {
}
)
try {
const tx = await this.exampleClient.runCowsay(
nodeText, {
value: ethers.parseUnits('2', 'ether')
const approveHash = await this.lilypadToken.write.approve([
'0x4a83270045FB4BCd1bdFe1bD6B00762A9D8bbF4E',
parseEther('100'),
])
const approveReceipt = await this.publicClient.waitForTransactionReceipt({
hash: approveHash
})
console.log('approved')
const unwatch = this.exampleClient.watchEvent.JobCompleted({}, {
onLogs: (logs:any) => {
console.log('logs', logs)
}
)
})
const logs = await this.exampleClient.getEvents.JobCreated()
console.log('logs', logs)
const hash = await this.exampleClient.write.runCowsay([
nodeText
])
created.setText(`success! tx hash: ${tx.hash}, fetching ipfs.io cid`)
created.setText(`success! tx hash: ${hash}, waiting for receipt...`)
const receipt = await this.publicClient.waitForTransactionReceipt({ hash })
created.setText(`transaction confirmed, awaiting results... ` + receipt.logs[1].topics[1])
const res = await this.exampleClient.fetchAllResults()
console.log('receipt', receipt)
/*
const res = await this.exampleClient.getJobResult(receipt.log[0].data)
const ipfsio = res[res.length - 1][2]
const cid = res[res.length - 1][1]
created.setText(`job complete see on ${ipfsio}`)
const ipfsFetchNode = createNode(canvas, created,
{
text: `${cid}`,
size: { height: placeholderNoteHeight }
},
{
color: assistantColor,
chat_role: 'assistant'
}
)
*/
} catch (e) {
created.setText(`error :( ${e}`)
this.logDebug(`error :( : ${e}`)
created.setText(`error ${e}`)
this.logDebug(`error: ${e}`)
return
}
}

View file

@ -4,8 +4,8 @@ import {
assistantColor,
getNodeText
} from '../utils/canvas-util'
import { parseEther } from 'viem'
import { CanvasNode } from 'src/utils/canvas-internal'
import { ethers } from 'ethers'
export const runSdxl = async function () {
if (this.unloaded) return
@ -46,7 +46,7 @@ export const runSdxl = async function () {
try {
const tx = await this.exampleClient.runSDXL(
nodeText, {
value: ethers.parseUnits('4', 'ether')
value: parseEther('4')
}
)
const receipt = await tx.wait()

View file

@ -1,6 +1,6 @@
import type ObsidianDesci from '../main'
import { App, Plugin, PluginSettingTab, Setting } from 'obsidian';
import {ethers} from 'ethers'
import { privateKeyToAccount } from 'viem/accounts'
interface ChainConfig {
name: string;
rpcUrl: string;
@ -18,9 +18,9 @@ export const DEFAULT_SETTINGS: ObsidianDesciSettings = {
privateKey: '',
publicKey: '',
chain: {
name: 'lilypad',
rpcUrl: 'http://testnet.lilypadnetwork.org:8545',
chainId: 1337
name: 'arbitrum sepolia',
rpcUrl: 'https://sepolia-rollup.arbitrum.io/rpc',
chainId: 421614
},
kuboRpc: 'http:/127.0.0.1:5001/api/v0'
}
@ -46,7 +46,8 @@ export class ObsidianDesciSettingTab extends PluginSettingTab {
.setValue(this.plugin.settings.privateKey)
.onChange(async (value) => {
this.plugin.settings.privateKey = value;
this.plugin.settings.publicKey = new ethers.Wallet(value).address,
console.log(value)
this.plugin.settings.publicKey = privateKeyToAccount('0x' + value as `0x${string}`).address,
await this.plugin.saveSettings();
}));
new Setting(containerEl)