Skip to content

Commit e9546f3

Browse files
authored
add basics/close-account/poseidon (#143)
1 parent 86cbb2a commit e9546f3

File tree

15 files changed

+1713
-0
lines changed

15 files changed

+1713
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.anchor
2+
.DS_Store
3+
target
4+
**/*.rs.bk
5+
node_modules
6+
test-ledger
7+
.yarn
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[toolchain]
2+
3+
[features]
4+
resolution = true
5+
skip-lint = false
6+
7+
[programs.localnet]
8+
close_account = "4So9Jbx672BRL9RvfB8Sux2NMVX5QJRnhmdWyij3kkFg"
9+
10+
[registry]
11+
url = "https://api.apr.dev"
12+
13+
[provider]
14+
cluster = "Localnet"
15+
wallet = "~/.config/solana/id.json"
16+
17+
[scripts]
18+
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[workspace]
2+
members = [
3+
"programs/*"
4+
]
5+
resolver = "2"
6+
7+
[profile.release]
8+
overflow-checks = true
9+
lto = "fat"
10+
codegen-units = 1
11+
[profile.release.build-override]
12+
opt-level = 3
13+
incremental = false
14+
codegen-units = 1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Destroy an Account
2+
> **_NOTE_:_** If you haven't installed poseidon yet, follow the installation steps [here](https://turbin3.github.io/poseidon/installation.html)
3+
- We're writing our TypeScript program code in [/ts-programs](./ts-programs/)
4+
- Once TypeScript program is completed, generate a program id and replace the `PROGRAM_ID` with the actual one. To generate a program id, run:
5+
```
6+
anchor keys list
7+
# You'll get something similar, but it will definitely be different
8+
close-account: At2EEHZ4zq2roeR5Cba6dryYEsmsHz7MKt9tjUCpCng1
9+
```
10+
- To convert your TypeScript Solana program to Anchor program, run
11+
```
12+
poseidon -i ./ts-programs/closeAccount.ts -o programs/close-account/src/lib.rs
13+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Migrations are an early feature. Currently, they're nothing more than this
2+
// single deploy script that's invoked from the CLI, injecting a provider
3+
// configured from the workspace's Anchor.toml.
4+
5+
const anchor = require('@coral-xyz/anchor');
6+
7+
module.exports = async (provider) => {
8+
// Configure client to use the provider.
9+
anchor.setProvider(provider);
10+
11+
// Add your deploy script here.
12+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"license": "ISC",
3+
"scripts": {
4+
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
5+
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
6+
},
7+
"dependencies": {
8+
"@coral-xyz/anchor": "^0.30.1"
9+
},
10+
"devDependencies": {
11+
"@biomejs/biome": "^1.9.4",
12+
"@types/bn.js": "^5.1.6",
13+
"@types/chai": "^4.3.20",
14+
"@types/mocha": "^9.0.0",
15+
"chai": "^4.5.0",
16+
"mocha": "^9.0.3",
17+
"prettier": "^2.8.8",
18+
"ts-mocha": "^10.0.0",
19+
"typescript": "^4.3.5"
20+
}
21+
}

0 commit comments

Comments
 (0)