This commit is contained in:
Hardhat Chad
2024-11-03 15:41:21 +00:00
5 changed files with 1800 additions and 0 deletions

44
Cargo.lock generated
View File

@@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "adler2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
[[package]]
name = "aead"
version = "0.4.3"
@@ -575,6 +581,15 @@ dependencies = [
"libc",
]
[[package]]
name = "crc32fast"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.5"
@@ -846,6 +861,16 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b31a14f5ee08ed1a40e1252b35af18bed062e3f39b69aab34decde36bc43e40"
[[package]]
name = "flate2"
version = "1.0.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0"
dependencies = [
"crc32fast",
"miniz_oxide",
]
[[package]]
name = "fnv"
version = "1.0.7"
@@ -1189,6 +1214,15 @@ dependencies = [
"zeroize",
]
[[package]]
name = "miniz_oxide"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
dependencies = [
"adler2",
]
[[package]]
name = "mpl-token-metadata"
version = "4.1.2"
@@ -1330,6 +1364,7 @@ dependencies = [
"ore-api",
"ore-boost-api",
"rand 0.8.5",
"solana-include-idl",
"solana-program",
"spl-associated-token-account",
"spl-token",
@@ -1853,6 +1888,15 @@ dependencies = [
"syn 2.0.79",
]
[[package]]
name = "solana-include-idl"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "754cc8fce28c62e67593ef317d715567b4610abfce1fa9ffa1d94f6eed8ad701"
dependencies = [
"flate2",
]
[[package]]
name = "solana-logger"
version = "1.18.25"

1730
api/idl.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,7 @@ documentation.workspace = true
repository.workspace = true
readme.workspace = true
keywords.workspace = true
build = "build.rs"
[lib]
crate-type = ["cdylib", "lib"]
@@ -19,6 +20,7 @@ default = []
[dependencies]
drillx.workspace = true
solana-include-idl = "0.1"
mpl-token-metadata.workspace = true
ore-api.workspace = true
ore-boost-api.workspace = true
@@ -29,3 +31,6 @@ steel.workspace = true
[dev-dependencies]
rand = "0.8.5"
[build-dependencies]
solana-include-idl = { version = "0.1", features = ["shrink"] }

18
program/build.rs Normal file
View File

@@ -0,0 +1,18 @@
use std::env;
use std::path::PathBuf;
use solana_include_idl::compress_idl;
/// Build script to compress the IDL file to a zip file when building the program.
///
/// The compressed IDL is then included in a separate ELF section on the program binary
/// when the program is built.
fn main() {
// Get the IDL path.
let idl_path = PathBuf::from("../api").join("idl.json");
// Compress the IDL file to a zip file.
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = PathBuf::from(out_dir).join("codama.idl.zip");
compress_idl(&idl_path, &dest_path);
}

View File

@@ -19,8 +19,11 @@ use update::*;
use upgrade::*;
use ore_api::instruction::*;
use solana_include_idl::{include_idl, parse::IdlType};
use steel::*;
// Include the compressed IDL in an ELF section on the program binary.
include_idl!(IdlType::Codama, concat!(env!("OUT_DIR"), "/codama.idl.zip"));
#[allow(deprecated)]
pub fn process_instruction(
program_id: &Pubkey,