Compare commits

..

No commits in common. "edc4cdc365f1560ca72c650cabff158ec622034f" and "912a07adfacf85a76b7418f9ef75ef6ee3c8288f" have entirely different histories.

4 changed files with 0 additions and 66 deletions

7
.gitignore vendored
View File

@ -1,7 +0,0 @@
/node_modules
/orbitdb
/receipts
/proyectsReceipts
package-lock.json
.env
.directory

View File

@ -1,30 +0,0 @@
import { formatUnits, Contract, Address, ABI, BigNumber } from "ethers";
import { ethers} from "./node_modules/ethers/dist/ethers.min.js";
export async function getDECACCDBAddress(providerURL: string): Promise<string> {
const provider = new ethers.JsonRpcProvider(providerURL);
let contract_address: Address = "0x3556A5005D5411603e0115efD9B875FdFb3ad7E9";
let abi: ABI = [
"function symbol() view returns (string)",
"function decimals() view returns (uint)",
"function _CCDBAddress() view returns (string)"
];
// Create a contract
let contract: Contract = new Contract(contract_address, abi, provider);
try {
let ccdbadd: string = await contract._CCDBAddress();
return ccdbadd;
} catch (error) {
console.error('Error fetching CCDBAddress:', error);
return '';
}
}
//async function main() {
// let ccdbadd: string = await getDECACCDBAddress();
// console.log(ccdbadd);
//}
//
//main();

View File

@ -1,24 +0,0 @@
import { getDECACCDBAddress } from './getDB.ts'
//import * as dotenv from 'dotenv';
//dotenv.config();
import { load } from "https://deno.land/std@0.217.0/dotenv/mod.ts";
async function main() {
const env = await load();
const providerUrl = env["PROVIDER_URL"];
if(providerUrl){
try {
const ccdbadd: string = await getDECACCDBAddress(providerUrl);
console.log('Greeting from contract:', ccdbadd);
} catch (error) {
console.error('Error:', error);
}
} else {
console.error("couldn't get provider from the .env")
}
}
main();

View File

@ -1,5 +0,0 @@
{
"dependencies": {
"ethers": "^6.11.1"
}
}