Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 7, 2024
1 parent 120ba34 commit 31dacd1
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion projects/DAPIO/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,45 @@ export async function updateDataFeed(dataFeedAddress, dataFeedName, dataFeedDesc
return receipt;
}

export async function delete
export async function deleteDataFeed(dataFeedAddress) {
const txCount = await web3.eth.getTransactionCount();
const tx = {
from: '0x...YourEthereumAddress...',
to: dapioContract.address,
value: '0',
gas: '200000',
gasPrice: '20',
nonce: txCount,
data: dapioContract.methods.deleteDataFeed(dataFeedAddress).encodeABI(),
};

const signedTx = await web3.eth.accounts.signTransaction(tx, '0x...YourEthereumPrivateKey...');
const receipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);

return receipt;
}

export async function getDataFeed(dataFeedAddress) {
const dataFeed = await dapioContract.methods.getDataFeed(dataFeedAddress).call();
return dataFeed;
}

export async function getAiModel(aiModelAddress) {
const aiModel = await dapioContract.methods.getAiModel(aiModelAddress).call();
return aiModel;
}

export async function getAiModelForDataFeed(dataFeedAddress) {
const aiModelAddress = await dapioContract.methods.getAiModelForDataFeed(dataFeedAddress).call();
return aiModelAddress;
}

export async function getDataFeeds() {
const dataFeeds = await dapioContract.methods.getDataFeeds().call();
return dataFeeds;
}

export async function getAiModels() {
const aiModels = await dapioContract.methods.getAiModels().call();
return aiModels;
}

0 comments on commit 31dacd1

Please sign in to comment.