Skip to content

Commit

Permalink
Add basics/close-account/poseidon
Browse files Browse the repository at this point in the history
  • Loading branch information
ved08 committed Oct 19, 2024
1 parent 3a36468 commit c8e7f19
Show file tree
Hide file tree
Showing 15 changed files with 1,716 additions and 0 deletions.
7 changes: 7 additions & 0 deletions basics/close-account/poseidon/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.anchor
.DS_Store
target
**/*.rs.bk
node_modules
test-ledger
.yarn
18 changes: 18 additions & 0 deletions basics/close-account/poseidon/Anchor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[toolchain]

[features]
resolution = true
skip-lint = false

[programs.localnet]
close_account = "4So9Jbx672BRL9RvfB8Sux2NMVX5QJRnhmdWyij3kkFg"

[registry]
url = "https://api.apr.dev"

[provider]
cluster = "Localnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
14 changes: 14 additions & 0 deletions basics/close-account/poseidon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[workspace]
members = [
"programs/*"
]
resolver = "2"

[profile.release]
overflow-checks = true
lto = "fat"
codegen-units = 1
[profile.release.build-override]
opt-level = 3
incremental = false
codegen-units = 1
13 changes: 13 additions & 0 deletions basics/close-account/poseidon/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Destroy an Account
> **_NOTE_:_** If you haven't installed poseidon yet, follow the installation steps [here](https://turbin3.github.io/poseidon/installation.html)
- We're writing our TypeScript program code in [/ts-programs](./ts-programs/)
- Once TypeScript program is completed, generate a program id and replace the `PROGRAM_ID` with the actual one. To generate a program id, run:
```
anchor keys list
# You'll get something similar, but it will definitely be different
close-account: At2EEHZ4zq2roeR5Cba6dryYEsmsHz7MKt9tjUCpCng1
```
- To convert your TypeScript Solana program to Anchor program, run
```
poseidon -i ./ts-programs/closeAccount.ts -o programs/close-account/src/lib.rs
```
12 changes: 12 additions & 0 deletions basics/close-account/poseidon/migrations/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Migrations are an early feature. Currently, they're nothing more than this
// single deploy script that's invoked from the CLI, injecting a provider
// configured from the workspace's Anchor.toml.

const anchor = require("@coral-xyz/anchor");

module.exports = async function (provider) {
// Configure client to use the provider.
anchor.setProvider(provider);

// Add your deploy script here.
};
21 changes: 21 additions & 0 deletions basics/close-account/poseidon/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"license": "ISC",
"scripts": {
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
},
"dependencies": {
"@coral-xyz/anchor": "^0.30.1"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@types/bn.js": "^5.1.6",
"@types/chai": "^4.3.20",
"@types/mocha": "^9.0.0",
"chai": "^4.5.0",
"mocha": "^9.0.3",
"prettier": "^2.8.8",
"ts-mocha": "^10.0.0",
"typescript": "^4.3.5"
}
}
Loading

0 comments on commit c8e7f19

Please sign in to comment.