initial commit

This commit is contained in:
thesn10
2026-05-27 23:15:18 +02:00
commit c88ebe67d3
20 changed files with 7747 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
.anchor
.DS_Store
target
**/*.rs.bk
node_modules
test-ledger
.yarn
.surfpool

7
.prettierignore Normal file
View File

@@ -0,0 +1,7 @@
.anchor
.DS_Store
target
node_modules
dist
build
test-ledger

1
.yarnrc.yml Normal file
View File

@@ -0,0 +1 @@
nodeLinker: node-modules

20
Anchor.toml Normal file
View 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

File diff suppressed because it is too large Load Diff

14
Cargo.toml Normal file
View 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

File diff suppressed because it is too large Load Diff

12
migrations/deploy.ts Normal file
View 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
View 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"
}
}

View 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"))'] }

View File

@@ -0,0 +1,4 @@
use anchor_lang::prelude::*;
#[constant]
pub const SEED: &str = "anchor";

View File

@@ -0,0 +1,7 @@
use anchor_lang::prelude::*;
#[error_code]
pub enum ErrorCode {
#[msg("Custom error message")]
CustomError,
}

View File

@@ -0,0 +1,3 @@
pub mod initialize;
pub use initialize::*;

View 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(())
}

View 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)
}
}

View File

View 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
View File

@@ -0,0 +1,4 @@
[toolchain]
channel = "1.89.0"
components = ["rustfmt","clippy","rust-src","rust-analyzer"]
profile = "minimal"

9
tsconfig.json Normal file
View File

@@ -0,0 +1,9 @@
{
"compilerOptions": {
"types": ["mocha", "chai"],
"lib": ["es2015"],
"module": "commonjs",
"target": "es6",
"esModuleInterop": true
}
}

1572
yarn.lock Normal file

File diff suppressed because it is too large Load Diff