From fa84f69f12ba326c15a42a2996dd860fcbca6bea Mon Sep 17 00:00:00 2001 From: Reisen Date: Fri, 23 Apr 2021 10:23:32 +0000 Subject: [PATCH] Add barebones anchor generated skeleton. Change-Id: Ia8e77942ea31521f09fbb1586349d02a21508444 --- solana/anchor-bridge/.gitignore | 9 +++++++++ solana/anchor-bridge/Anchor.toml | 2 ++ solana/anchor-bridge/Cargo.toml | 4 ++++ solana/anchor-bridge/migrations/deploy.js | 13 +++++++++++++ .../programs/anchor-bridge/Cargo.toml | 18 ++++++++++++++++++ .../programs/anchor-bridge/Xargo.toml | 2 ++ .../programs/anchor-bridge/src/lib.rs | 12 ++++++++++++ solana/anchor-bridge/tests/anchor-bridge.js | 14 ++++++++++++++ 8 files changed, 74 insertions(+) create mode 100644 solana/anchor-bridge/.gitignore create mode 100644 solana/anchor-bridge/Anchor.toml create mode 100644 solana/anchor-bridge/Cargo.toml create mode 100644 solana/anchor-bridge/migrations/deploy.js create mode 100644 solana/anchor-bridge/programs/anchor-bridge/Cargo.toml create mode 100644 solana/anchor-bridge/programs/anchor-bridge/Xargo.toml create mode 100644 solana/anchor-bridge/programs/anchor-bridge/src/lib.rs create mode 100644 solana/anchor-bridge/tests/anchor-bridge.js diff --git a/solana/anchor-bridge/.gitignore b/solana/anchor-bridge/.gitignore new file mode 100644 index 00000000..c40e0fab --- /dev/null +++ b/solana/anchor-bridge/.gitignore @@ -0,0 +1,9 @@ +# ignore Mac OS noise +.DS_Store + +# ignore the build directory for Rust/Anchor +target + +# Ignore backup files creates by cargo fmt. +**/*.rs.bk + \ No newline at end of file diff --git a/solana/anchor-bridge/Anchor.toml b/solana/anchor-bridge/Anchor.toml new file mode 100644 index 00000000..6f52f52e --- /dev/null +++ b/solana/anchor-bridge/Anchor.toml @@ -0,0 +1,2 @@ +cluster = "localnet" +wallet = "/root/.config/solana/id.json" diff --git a/solana/anchor-bridge/Cargo.toml b/solana/anchor-bridge/Cargo.toml new file mode 100644 index 00000000..a60de986 --- /dev/null +++ b/solana/anchor-bridge/Cargo.toml @@ -0,0 +1,4 @@ +[workspace] +members = [ + "programs/*" +] diff --git a/solana/anchor-bridge/migrations/deploy.js b/solana/anchor-bridge/migrations/deploy.js new file mode 100644 index 00000000..7cca2719 --- /dev/null +++ b/solana/anchor-bridge/migrations/deploy.js @@ -0,0 +1,13 @@ + +// 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. +} diff --git a/solana/anchor-bridge/programs/anchor-bridge/Cargo.toml b/solana/anchor-bridge/programs/anchor-bridge/Cargo.toml new file mode 100644 index 00000000..94b2b9b5 --- /dev/null +++ b/solana/anchor-bridge/programs/anchor-bridge/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "anchor-bridge" +version = "0.1.0" +description = "Created with Anchor" +edition = "2018" + +[lib] +crate-type = ["cdylib", "lib"] +name = "anchor_bridge" + +[features] +no-entrypoint = [] +no-idl = [] +cpi = ["no-entrypoint"] +default = [] + +[dependencies] +anchor-lang = "0.4.4" diff --git a/solana/anchor-bridge/programs/anchor-bridge/Xargo.toml b/solana/anchor-bridge/programs/anchor-bridge/Xargo.toml new file mode 100644 index 00000000..1744f098 --- /dev/null +++ b/solana/anchor-bridge/programs/anchor-bridge/Xargo.toml @@ -0,0 +1,2 @@ +[target.bpfel-unknown-unknown.dependencies.std] +features = [] \ No newline at end of file diff --git a/solana/anchor-bridge/programs/anchor-bridge/src/lib.rs b/solana/anchor-bridge/programs/anchor-bridge/src/lib.rs new file mode 100644 index 00000000..7a157c87 --- /dev/null +++ b/solana/anchor-bridge/programs/anchor-bridge/src/lib.rs @@ -0,0 +1,12 @@ +use anchor_lang::prelude::*; + +#[program] +pub mod anchor_bridge { + use super::*; + pub fn initialize(ctx: Context) -> ProgramResult { + Ok(()) + } +} + +#[derive(Accounts)] +pub struct Initialize {} \ No newline at end of file diff --git a/solana/anchor-bridge/tests/anchor-bridge.js b/solana/anchor-bridge/tests/anchor-bridge.js new file mode 100644 index 00000000..46bf1869 --- /dev/null +++ b/solana/anchor-bridge/tests/anchor-bridge.js @@ -0,0 +1,14 @@ +const anchor = require('@project-serum/anchor'); + +describe('anchor-bridge', () => { + + // Configure the client to use the local cluster. + anchor.setProvider(anchor.Provider.env()); + + it('Is initialized!', async () => { + // Add your test here. + const program = anchor.workspace.AnchorBridge; + const tx = await program.rpc.initialize(); + console.log("Your transaction signature", tx); + }); +});