Skip to content

Commit

Permalink
- Moved Codigo project into a new folder
Browse files Browse the repository at this point in the history
- Reverted Readme in root folder.
  • Loading branch information
joservrmdz committed Apr 24, 2024
1 parent 087a71a commit 2f1d450
Show file tree
Hide file tree
Showing 25 changed files with 43 additions and 9 deletions.
22 changes: 22 additions & 0 deletions Codigo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Encode-Solana-Decentralized-Twitter

<img src="https://i.ibb.co/0tfV7NF/image.png">

Encode Main Repo for Solana-Decentralized-Twitter

## Local Deployment

1. Start a local validator by running `solana-test-validator`.
2. Go to the `program` folder and run `cargo build-sbf`
2. Run `solana program deploy target/deploy/x_sol.so`. This will deploy the program on-chain.
3. Save the program Id returned by the deploy command.

## Testing Locally

1. Start a local validator by running `solana-test-validator`.
2. Run `solana logs` on a separate terminal to keep track of interactions with the local validator.
2. Go to the `program_client` folder and run `npm install`
2. Now run `npm install --save-dev ts-node`. This will install the TypeScript execution engine.
3. Use the program Id returned by the `deploy` command to set the `progId` constant in the `app.ts` file.
4. Run `npx ts-node app.ts`. This will trigger the transaction that creates a new tweet.
5. Check the logs terminal to see all interactions with the validator.
File renamed without changes.
2 changes: 1 addition & 1 deletion program/Cargo.toml → Codigo/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ toml_edit = "=0.21.0"

[lib]
crate-type = ["cdylib", "lib"]
path = "./lib.rs"
path = "lib.rs"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions program/src/add_tweet.rs → Codigo/program/src/add_tweet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,5 @@ pub fn add_tweet(
) -> ProgramResult {
// Implement your business logic here...
tweet_account.data.text = "test txt".to_string();





Ok(())
}
File renamed without changes.
5 changes: 3 additions & 2 deletions program_client/app.ts → Codigo/program_client/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import * as os from "os";

async function main(feePayer: Keypair) {
// TODO: Specify the program Id we saved from when we deploy it
const progId = new PublicKey("DeAgefytsTT6cucaWBAgah3LkYpN7gngWfxk5JHddWEL");
const progId = new PublicKey("9U8FpTpoP6j5uqBURoRUkGY7JLpUmAmALd6KWhMSKaXh");

// Create a new Solana connection
const connection = new Connection("http://127.0.0.1:8899", {
const connection = new Connection("https://api.devnet.solana.com ", {
commitment: "confirmed"
});

Expand All @@ -29,6 +29,7 @@ async function main(feePayer: Keypair) {
console.info(account);
console.log(await connection.getAccountInfo(tweetAccount.publicKey));
console.log(await connection.getAccountInfo(feePayer.publicKey));
console.log(await connection.getAccountInfo(feePayer.publicKey));

}

Expand Down
9 changes: 9 additions & 0 deletions Codigo/program_client/greeter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>TypeScript Greeter</title>
</head>
<body>
<script src="greeter.js"></script>
</body>
</html>
7 changes: 7 additions & 0 deletions Codigo/program_client/greeter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function greeter(person: string) {
return "Hello, " + person;
}

let user = "Jane User";

document.body.textContent = greeter(user);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

<img src="https://i.ibb.co/0tfV7NF/image.png">

Encode Main Repo for Solana-Decentralized-Twitter
Encode Main Repo for Solana-Decentralized-Twitter

0 comments on commit 2f1d450

Please sign in to comment.