initial commit
This commit is contained in:
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
.anchor
|
||||
.DS_Store
|
||||
target
|
||||
**/*.rs.bk
|
||||
node_modules
|
||||
test-ledger
|
||||
.yarn
|
||||
.surfpool
|
||||
7
.prettierignore
Normal file
7
.prettierignore
Normal file
@@ -0,0 +1,7 @@
|
||||
.anchor
|
||||
.DS_Store
|
||||
target
|
||||
node_modules
|
||||
dist
|
||||
build
|
||||
test-ledger
|
||||
1
.yarnrc.yml
Normal file
1
.yarnrc.yml
Normal file
@@ -0,0 +1 @@
|
||||
nodeLinker: node-modules
|
||||
20
Anchor.toml
Normal file
20
Anchor.toml
Normal file
@@ -0,0 +1,20 @@
|
||||
[toolchain]
|
||||
package_manager = "yarn"
|
||||
|
||||
[features]
|
||||
resolution = true
|
||||
skip-lint = false
|
||||
|
||||
[programs.localnet]
|
||||
solisting = "DzwUAbpRvqcbA8QsEkRbZeXG4TEho5782cMySodrUHBU"
|
||||
descro = "DjVR4EuYV6USMJFfsGZwhZ3y8rtWsmG8EvDY96GTqqi3"
|
||||
descro_ext_resolvers = "GwUPAKs3HHzCpj8uhet4NAnxk9GWNwfrYbpihu5DyFp"
|
||||
|
||||
[provider]
|
||||
cluster = "localnet"
|
||||
wallet = "~/.config/solana/id.json"
|
||||
|
||||
[scripts]
|
||||
test = "cargo test"
|
||||
|
||||
[hooks]
|
||||
4143
Cargo.lock
generated
Normal file
4143
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
14
Cargo.toml
Normal file
14
Cargo.toml
Normal file
@@ -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
|
||||
1825
docs/superpowers/plans/2026-05-19-solisting.md
Normal file
1825
docs/superpowers/plans/2026-05-19-solisting.md
Normal file
File diff suppressed because it is too large
Load Diff
12
migrations/deploy.ts
Normal file
12
migrations/deploy.ts
Normal file
@@ -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.
|
||||
|
||||
import * as anchor from "@anchor-lang/core";
|
||||
|
||||
module.exports = async function (provider: anchor.AnchorProvider) {
|
||||
// Configure client to use the provider.
|
||||
anchor.setProvider(provider);
|
||||
|
||||
// Add your deploy script here.
|
||||
};
|
||||
21
package.json
Normal file
21
package.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "solisting",
|
||||
"license": "ISC",
|
||||
"scripts": {
|
||||
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
|
||||
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anchor-lang/core": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bn.js": "^5.2.0",
|
||||
"@types/chai": "^5.2.3",
|
||||
"@types/mocha": "^10.0.10",
|
||||
"chai": "^6.2.2",
|
||||
"mocha": "^11.7.6",
|
||||
"prettier": "^3.8.3",
|
||||
"ts-mocha": "^11.1.0",
|
||||
"typescript": "^6.0.3"
|
||||
}
|
||||
}
|
||||
35
programs/solisting/Cargo.toml
Normal file
35
programs/solisting/Cargo.toml
Normal file
@@ -0,0 +1,35 @@
|
||||
[package]
|
||||
name = "solisting"
|
||||
version = "0.1.0"
|
||||
description = "Created with Anchor"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
name = "solisting"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
cpi = ["no-entrypoint"]
|
||||
no-entrypoint = []
|
||||
no-idl = []
|
||||
no-log-ix-name = []
|
||||
idl-build = ["anchor-lang/idl-build"]
|
||||
anchor-debug = []
|
||||
custom-heap = []
|
||||
custom-panic = []
|
||||
|
||||
|
||||
[dependencies]
|
||||
anchor-lang = "1.0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
litesvm = "0.12.0"
|
||||
solana-message = "3.0.1"
|
||||
solana-transaction = "3.0.2"
|
||||
solana-signer = "3.0.0"
|
||||
solana-keypair = "3.0.1"
|
||||
|
||||
|
||||
[lints.rust]
|
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] }
|
||||
4
programs/solisting/src/constants.rs
Normal file
4
programs/solisting/src/constants.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
use anchor_lang::prelude::*;
|
||||
|
||||
#[constant]
|
||||
pub const SEED: &str = "anchor";
|
||||
7
programs/solisting/src/error.rs
Normal file
7
programs/solisting/src/error.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
use anchor_lang::prelude::*;
|
||||
|
||||
#[error_code]
|
||||
pub enum ErrorCode {
|
||||
#[msg("Custom error message")]
|
||||
CustomError,
|
||||
}
|
||||
3
programs/solisting/src/instructions.rs
Normal file
3
programs/solisting/src/instructions.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod initialize;
|
||||
|
||||
pub use initialize::*;
|
||||
9
programs/solisting/src/instructions/initialize.rs
Normal file
9
programs/solisting/src/instructions/initialize.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use anchor_lang::prelude::*;
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct Initialize {}
|
||||
|
||||
pub fn handler(ctx: Context<Initialize>) -> Result<()> {
|
||||
msg!("Greetings from: {:?}", ctx.program_id);
|
||||
Ok(())
|
||||
}
|
||||
21
programs/solisting/src/lib.rs
Normal file
21
programs/solisting/src/lib.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
pub mod constants;
|
||||
pub mod error;
|
||||
pub mod instructions;
|
||||
pub mod state;
|
||||
|
||||
use anchor_lang::prelude::*;
|
||||
|
||||
pub use constants::*;
|
||||
pub use instructions::*;
|
||||
pub use state::*;
|
||||
|
||||
declare_id!("DzwUAbpRvqcbA8QsEkRbZeXG4TEho5782cMySodrUHBU");
|
||||
|
||||
#[program]
|
||||
pub mod solisting {
|
||||
use super::*;
|
||||
|
||||
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
|
||||
initialize::handler(ctx)
|
||||
}
|
||||
}
|
||||
0
programs/solisting/src/state.rs
Normal file
0
programs/solisting/src/state.rs
Normal file
32
programs/solisting/tests/test_initialize.rs
Normal file
32
programs/solisting/tests/test_initialize.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
use {
|
||||
anchor_lang::{solana_program::instruction::Instruction, InstructionData, ToAccountMetas},
|
||||
litesvm::LiteSVM,
|
||||
solana_message::{Message, VersionedMessage},
|
||||
solana_signer::Signer,
|
||||
solana_keypair::Keypair,
|
||||
solana_transaction::versioned::VersionedTransaction,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_initialize() {
|
||||
let program_id = solisting::id();
|
||||
let payer = Keypair::new();
|
||||
let mut svm = LiteSVM::new();
|
||||
let bytes = include_bytes!("../../../target/deploy/solisting.so");
|
||||
svm.add_program(program_id, bytes).unwrap();
|
||||
svm.airdrop(&payer.pubkey(), 1_000_000_000).unwrap();
|
||||
|
||||
let instruction = Instruction::new_with_bytes(
|
||||
program_id,
|
||||
&solisting::instruction::Initialize {}.data(),
|
||||
solisting::accounts::Initialize {}.to_account_metas(None),
|
||||
);
|
||||
|
||||
let blockhash = svm.latest_blockhash();
|
||||
let msg = Message::new_with_blockhash(&[instruction], Some(&payer.pubkey()), &blockhash);
|
||||
let tx = VersionedTransaction::try_new(VersionedMessage::Legacy(msg), &[payer]).unwrap();
|
||||
|
||||
let res = svm.send_transaction(tx);
|
||||
assert!(res.is_ok());
|
||||
}
|
||||
4
rust-toolchain.toml
Normal file
4
rust-toolchain.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "1.89.0"
|
||||
components = ["rustfmt","clippy","rust-src","rust-analyzer"]
|
||||
profile = "minimal"
|
||||
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"types": ["mocha", "chai"],
|
||||
"lib": ["es2015"],
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user