Init
This commit is contained in:
commit
5069145267
|
@ -0,0 +1,6 @@
|
|||
|
||||
.anchor
|
||||
.DS_Store
|
||||
target
|
||||
**/*.rs.bk
|
||||
node_modules
|
|
@ -0,0 +1,12 @@
|
|||
[programs.localnet]
|
||||
raw = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
|
||||
|
||||
[registry]
|
||||
url = "https://anchor.projectserum.com"
|
||||
|
||||
[provider]
|
||||
cluster = "localnet"
|
||||
wallet = "/home/armaniferrante/.config/solana/id.json"
|
||||
|
||||
[scripts]
|
||||
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,4 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"programs/*"
|
||||
]
|
|
@ -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("@project-serum/anchor");
|
||||
|
||||
module.exports = async function (provider) {
|
||||
// Configure client to use the provider.
|
||||
anchor.setProvider(provider);
|
||||
|
||||
// Add your deploy script here.
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"@project-serum/anchor": "^0.20.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.3.4",
|
||||
"mocha": "^9.0.3",
|
||||
"ts-mocha": "^8.0.0",
|
||||
"@types/mocha": "^9.0.0",
|
||||
"typescript": "^4.3.5"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
[package]
|
||||
name = "owner-checks-1"
|
||||
version = "0.1.0"
|
||||
description = "Created with Anchor"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
name = "owner_checks_1"
|
||||
|
||||
[features]
|
||||
no-entrypoint = []
|
||||
no-idl = []
|
||||
no-log-ix-name = []
|
||||
cpi = ["no-entrypoint"]
|
||||
default = []
|
||||
|
||||
[dependencies]
|
||||
anchor-lang = "0.20.1"
|
||||
anchor-spl = "0.20.1"
|
|
@ -0,0 +1,2 @@
|
|||
[target.bpfel-unknown-unknown.dependencies.std]
|
||||
features = []
|
|
@ -0,0 +1,42 @@
|
|||
use anchor_lang::prelude::*;
|
||||
use anchor_spl::token::{Token, TokenAccount};
|
||||
|
||||
declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
|
||||
|
||||
#[program]
|
||||
pub mod owner_checks_1 {
|
||||
use super::*;
|
||||
|
||||
pub fn create_user(ctx: Context<CreateUser>) -> ProgramResult {
|
||||
let user = &mut ctx.accounts.user;
|
||||
user.authority = ctx.accounts.authority.key();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn log_message(ctx: Context<LogMessage>) -> ProgramResult {
|
||||
let token = &ctx.accounts.token;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct CreateUser<'info> {
|
||||
#[account(init, payer = authority, space = 8+32)]
|
||||
user: Account<'info, User>,
|
||||
#[account(init, payer = authority, space = TokenAccount::LEN)]
|
||||
token: Account<'info, TokenAccount>,
|
||||
#[account(mut)]
|
||||
authority: Signer<'info>,
|
||||
token_program: Program<'info, Token>,
|
||||
system_program: Program<'info, System>,
|
||||
}
|
||||
|
||||
#[derive(Accounts)]
|
||||
pub struct LogMessage<'info> {
|
||||
token: AccountInfo<'info>,
|
||||
}
|
||||
|
||||
#[account]
|
||||
pub struct User {
|
||||
authority: Pubkey,
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import * as anchor from '@project-serum/anchor';
|
||||
import { Program } from '@project-serum/anchor';
|
||||
import { Raw } from '../target/types/raw';
|
||||
|
||||
describe('raw', () => {
|
||||
// Configure the client to use the local cluster.
|
||||
anchor.setProvider(anchor.Provider.env());
|
||||
|
||||
const program = anchor.workspace.Raw as Program<Raw>;
|
||||
|
||||
it('Is initialized!', async () => {
|
||||
// Add your test here.
|
||||
const tx = await program.rpc.initialize({});
|
||||
console.log("Your transaction signature", tx);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"types": ["mocha", "chai"],
|
||||
"typeRoots": ["./node_modules/@types"],
|
||||
"lib": ["es2015"],
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue