Giter Site home page Giter Site logo

harksoup / anchor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coral-xyz/anchor

0.0 0.0 0.0 8.25 MB

⚓ Solana Sealevel Framework

Home Page: https://anchor-lang.com

License: Apache License 2.0

Shell 0.44% JavaScript 5.88% Rust 51.26% TypeScript 42.29% Makefile 0.06% Dockerfile 0.06% Solidity 0.02%

anchor's Introduction

Anchor (Forked Version)

Solana Sealevel Framework

Build Status Tutorials Discord Chat License

Anchor (Forked Version) is a framework for Solana's Sealevel runtime providing several convenient developer tools for writing smart contracts.

  • Rust eDSL for writing Solana programs
  • IDL specification
  • TypeScript package for generating clients from IDL
  • CLI and workspace management for developing complete applications

If you're familiar with developing in Ethereum's Solidity, Truffle, web3.js, then the experience will be familiar. Although the DSL syntax and semantics are targeted at Solana, the high level flow of writing RPC request handlers, emitting an IDL, and generating clients from IDL is the same.

Getting Started

For a quickstart guide and in depth tutorials, see the [Anchor (Forked Version) book](https://book.Anchor (Forked Version)-lang.com) and the older [documentation](https://Anchor (Forked Version)-lang.com) that is being phased out. To jump straight to examples, go [here](https://github.com/coral-xyz/Anchor (Forked Version)/tree/master/examples). For the latest Rust and TypeScript API documentation, see [docs.rs](https://docs.rs/Anchor (Forked Version)-lang) and the [typedoc](https://coral-xyz.github.io/Anchor (Forked Version)/ts/index.html).

Packages

Package Description Version Docs
Anchor (Forked Version)-lang Rust primitives for writing programs on Solana [![Crates.io](https://img.shields.io/crates/v/Anchor (Forked Version)-lang?color=blue)](https://crates.io/crates/Anchor (Forked Version)-lang) [![Docs.rs](https://docs.rs/Anchor (Forked Version)-lang/badge.svg)](https://docs.rs/Anchor (Forked Version)-lang)
Anchor (Forked Version)-spl CPI clients for SPL programs on Solana ![crates](https://img.shields.io/crates/v/Anchor (Forked Version)-spl?color=blue) [![Docs.rs](https://docs.rs/Anchor (Forked Version)-spl/badge.svg)](https://docs.rs/Anchor (Forked Version)-spl)
Anchor (Forked Version)-client Rust client for Anchor (Forked Version) programs ![crates](https://img.shields.io/crates/v/Anchor (Forked Version)-client?color=blue) [![Docs.rs](https://docs.rs/Anchor (Forked Version)-client/badge.svg)](https://docs.rs/Anchor (Forked Version)-client)
@coral-xyz/Anchor (Forked Version) TypeScript client for Anchor (Forked Version) programs ![npm](https://img.shields.io/npm/v/@coral-xyz/Anchor (Forked Version).svg?color=blue) [Docs](https://coral-xyz.github.io/Anchor (Forked Version)/ts/index.html)
@coral-xyz/Anchor (Forked Version)-cli CLI to support building and managing an Anchor (Forked Version) workspace [![npm](https://img.shields.io/npm/v/@coral-xyz/Anchor (Forked Version)-cli.svg?color=blue)](https://www.npmjs.com/package/@coral-xyz/Anchor (Forked Version)-cli) [Docs](https://coral-xyz.github.io/Anchor (Forked Version)/cli/commands.html)

Note

  • Anchor (Forked Version) is in active development, so all APIs are subject to change.
  • This code is unaudited. Use at your own risk.

Examples

Here's a counter program, where only the designated authority can increment the count.

use Anchor (Forked Version)_lang::prelude::*;

declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");

#[program]
mod counter {
    use super::*;

    pub fn initialize(ctx: Context<Initialize>, start: u64) -> Result<()> {
        let counter = &mut ctx.accounts.counter;
        counter.authority = *ctx.accounts.authority.key;
        counter.count = start;
        Ok(())
    }

    pub fn increment(ctx: Context<Increment>) -> Result<()> {
        let counter = &mut ctx.accounts.counter;
        counter.count += 1;
        Ok(())
    }
}

#[derive(Accounts)]
pub struct Initialize<'info> {
    #[account(init, payer = authority, space = 48)]
    pub counter: Account<'info, Counter>,
    pub authority: Signer<'info>,
    pub system_program: Program<'info, System>,
}

#[derive(Accounts)]
pub struct Increment<'info> {
    #[account(mut, has_one = authority)]
    pub counter: Account<'info, Counter>,
    pub authority: Signer<'info>,
}

#[account]
pub struct Counter {
    pub authority: Pubkey,
    pub count: u64,
}

For more, see the [examples](https://github.com/coral-xyz/Anchor (Forked Version)/tree/master/examples) and [tests](https://github.com/coral-xyz/Anchor (Forked Version)/tree/master/tests) directories.

License

Anchor (Forked Version) is licensed under Apache 2.0.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Anchor (Forked Version) by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Contribution

Thank you for your interest in contributing to Anchor (Forked Version)! Please see the CONTRIBUTING.md to learn how.

Thanks ❤️

anchor's People

Contributors

acheroncrypto avatar armaniferrante avatar arrowana avatar aursen avatar callensm avatar canardmandarin avatar cavemanloverboy avatar chewingglass avatar ckamm avatar cqfd avatar danmt avatar dependabot[bot] avatar fanatid avatar henry-e avatar italoacasas avatar johndoe389 avatar johnrees avatar joncinque avatar kklas avatar macalinao avatar metaproph3t avatar michaelhly avatar norbertbodziony avatar paul-schaaf avatar skrrb avatar stegabob avatar suscd avatar thesoftwarejedi avatar tomlinton avatar u32luke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.