Hello,
Bit of a new dev here
I want to use the SDK to access the API described in the below link as part of my smart contract, so my smart contract can check a users balance at a previous point in time.
https://api-docs.aeternity.io/#/account/GetAccountByPubkeyAndHeight
I have the aeproject downloaded and my project in /aepp-cli-js/my-project/
how can I use javascript to access both my contract and these API? Can you link any examples?
2 Likes
Ive used vue before so any pointers on doing it with vue are exta helpful
Hello @pizzaGee ,
You can check out the How to build a ToDO list aepp Tutorial using the below Links
Part One:
# TUTORIAL: How to build a To-do list Æpp - Part 1
## Tutorial Overview
This tutorial series will teach you how to build a To-do list Æpp. You will learn how to:
- Develop a ToDoManager Sophia smart contract and write unit tests for it;
- Use the **aeproject** framework to build æpps: configuration of the project structure, compilation, deployment, running tests;
- Communicate between the frontend(SPA with Vue.js) and the Sophia smart contract;
The To-do list Æpp will be able to:
- create new tasks;
- list existing tasks;
- edit task name;
- change task status;
- delete task;
Once finished it will look like this:

## Prerequisites
- Installed **aeproject** framework (take a look over [installing aeproject](smart-contract-deployment-in-aeproject.md) section)
This file has been truncated. show original
Part Two which shows how to use AEproject and aepp-sdk-js to get the client height, balance and lots more:
# TUTORIAL: How to build a To-do list Æpp - Part 2
## Tutorial Overview
This tutorial will teach you how to develop the communication process between the client side and the *ToDoManager* smart contract. We will setup the basic infrastructure in order to interact with the smart contract from the frontend.
## Prerequisites
- Before we go any further, please make sure you have followed the [first part](build-to-do-list-aepp-1.md) of *How to build a To-do list Æpp*.
## Plan
I have published the simple frontend project in Github. We will start with cloning the github repository and I will explain the most important segments of the *To-do list Æpp*.
## To-do list Æpp content
The tutorial is created to showcase the aeternity SDK implementation for simple To-do list Æpp "depending" on an Identity Aepp.
The To-do list Æpp consists of two parts:
- Identity Aepp;
- To-do list Æpp;
## Getting started
Clone the Github repository and open your IDE at the directory:
```
git clone https://github.com/aekiti/to-do-list-aepp.git
This file has been truncated. show original
You can also make use of the Tutorial Videos to follow up at:
VIDEO
I hope this helps out.
Regard.
2 Likes
I’m trying to follow this but a lot of it isn’t relevent to my goal so it’s confusing me a bit. Seems like a wonderful tutorial but I am not trying to use the identity app.
How can I add a front end to my contract with vue?
That being the case, you can make use of the Universal
method to get your sdkInstance/client which you can now use to get your contract instance.
I could send you a code snippet if need be.
Regards
I see the Universal method used in the test file.
before(async () => {
client = await Universal({
url: “localhost:3001”,
internalUrl: “localhost:3001/internal”,
accounts: [
MemoryAccount({keypair: wallets[0]}),
MemoryAccount({keypair: wallets[1]}),
MemoryAccount({keypair: wallets[2]}),
MemoryAccount({keypair: wallets[3]})
],
networkId: “ae_devnet”,
compilerUrl: “localhost:3080”
})
How can i use it with vue/or any front end to access my contract’s functions?
Im considering attempting to create a vue project inside of aeproject, and using npm serve to host it
vue describes this here:Deployment | Vue CLI
but then I am trying to run both vue and aeproject on the same localhost server, so I feel it will not work.
maybe I can just create a vue project inside of aeproject, using “vue create my-project”? but then will aeproject actually run my html/css/javascript/vue? This seems possible, and its what I will try next.
Thank you for your help and tutorials.
1 Like
I recently updated the codes for the Todo List aepp where the identity aepp was not used. It’s still in the test phase but I guess it should do the tricks.
The above link leads to the GitHub Repo, you can head straight to the ToDo.vue file to see how the Universal method was used.
By the way, you can preview this update at vue-project
Realizing I made the title a bit misleading.
My goal is to have a frontend with html and css
a backend with my sophia contract, the aeternity SDK
connect the two with vue/javascript
1 Like
With this, you will see the Universal method written this way:
async getClient() {
const getSdkInstance = async (secretKey, publicKey) => {
const sdkInstance = await Universal({
nodes: [{
name: 'testnet',
instance: await Node({
url: config.nodeUrl,
internalUrl: config.nodeUrl
})
}],
accounts: [
MemoryAccount({
keypair: {
secretKey: secretKey,
publicKey: publicKey
}
})
],
compilerUrl: config.compilerUrl,
})
return sdkInstance;
};
try {
this.client = await getSdkInstance(config.priv, config.pub);
this.$store.dispatch('setAccount', this.client);
this.contractInstance = await this.client.getContractInstance(contractDetails.contractSource, { contractAddress: contractDetails.contractAddress });
} catch (err) {
console.log(err);
}
},