From 44bb41e39fe89f81b505b6baef79fd211989f091 Mon Sep 17 00:00:00 2001 From: chizor iwuh Date: Tue, 29 Oct 2024 06:27:33 +0100 Subject: [PATCH 1/6] counter/steel --- Cargo.lock | 191 ++- Cargo.toml | 1 + basics/counter/steel/README.md | 14 + basics/counter/steel/package.json | 28 + basics/counter/steel/pnpm-lock.yaml | 1288 +++++++++++++++++ basics/counter/steel/program/Cargo.toml | 13 + basics/counter/steel/program/src/lib.rs | 49 + basics/counter/steel/program/src/state.rs | 15 + basics/counter/steel/tests/counter.test.ts | 127 ++ basics/counter/steel/tests/tsconfig.test.json | 10 + 10 files changed, 1694 insertions(+), 42 deletions(-) create mode 100644 basics/counter/steel/README.md create mode 100644 basics/counter/steel/package.json create mode 100644 basics/counter/steel/pnpm-lock.yaml create mode 100644 basics/counter/steel/program/Cargo.toml create mode 100644 basics/counter/steel/program/src/lib.rs create mode 100644 basics/counter/steel/program/src/state.rs create mode 100644 basics/counter/steel/tests/counter.test.ts create mode 100644 basics/counter/steel/tests/tsconfig.test.json diff --git a/Cargo.lock b/Cargo.lock index f54b45b7b..58e8e7878 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -219,7 +219,7 @@ dependencies = [ "borsh 0.10.3", "bytemuck", "getrandom 0.2.15", - "solana-program", + "solana-program 1.18.17", "thiserror", ] @@ -451,6 +451,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "bincode" version = "1.3.3" @@ -738,7 +744,7 @@ dependencies = [ name = "checking-accounts-program" version = "0.1.0" dependencies = [ - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -765,7 +771,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -807,7 +813,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "shank", - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -815,7 +821,17 @@ name = "counter-solana-native" version = "0.1.0" dependencies = [ "borsh 0.9.3", - "solana-program", + "solana-program 1.18.17", +] + +[[package]] +name = "counter-solana-steel" +version = "0.1.0" +dependencies = [ + "bytemuck", + "num_enum 0.7.3", + "solana-program 1.18.17", + "steel 2.1.1", ] [[package]] @@ -838,7 +854,7 @@ dependencies = [ name = "create-account-program" version = "0.1.0" dependencies = [ - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -1154,7 +1170,7 @@ dependencies = [ name = "hello-solana-program" version = "0.1.0" dependencies = [ - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -1571,7 +1587,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -1674,7 +1690,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -1683,7 +1699,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -1692,7 +1708,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -1830,7 +1846,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -1884,7 +1900,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -2202,13 +2218,59 @@ dependencies = [ "sha3 0.10.8", "solana-frozen-abi", "solana-frozen-abi-macro", - "solana-sdk-macro", + "solana-sdk-macro 1.18.17", "thiserror", "tiny-bip39", "wasm-bindgen", "zeroize", ] +[[package]] +name = "solana-program" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2625a23c3813b620141ee447819b08d1b9a5f1c69a309754834e3f35798a21fb" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "base64 0.22.1", + "bincode", + "bitflags", + "blake3", + "borsh 0.10.3", + "borsh 1.5.1", + "bs58 0.5.1", + "bv", + "bytemuck", + "bytemuck_derive", + "console_error_panic_hook", + "console_log", + "curve25519-dalek", + "getrandom 0.2.15", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "memoffset", + "num-bigint", + "num-derive 0.4.2", + "num-traits", + "parking_lot", + "rand 0.8.5", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "sha2 0.10.8", + "sha3 0.10.8", + "solana-sdk-macro 2.0.14", + "thiserror", + "wasm-bindgen", +] + [[package]] name = "solana-sdk" version = "1.18.17" @@ -2257,8 +2319,8 @@ dependencies = [ "solana-frozen-abi", "solana-frozen-abi-macro", "solana-logger", - "solana-program", - "solana-sdk-macro", + "solana-program 1.18.17", + "solana-sdk-macro 1.18.17", "thiserror", "uriparse", "wasm-bindgen", @@ -2277,6 +2339,19 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "solana-sdk-macro" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93a5a1eabc890415d326707afe62cd7a2009236e8d899c1519566fc8f7e3977b" +dependencies = [ + "bs58 0.5.1", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.72", +] + [[package]] name = "solana-security-txt" version = "1.1.1" @@ -2305,7 +2380,7 @@ dependencies = [ "serde", "serde_json", "sha3 0.9.1", - "solana-program", + "solana-program 1.18.17", "solana-sdk", "subtle", "thiserror", @@ -2322,7 +2397,7 @@ dependencies = [ "borsh 0.10.3", "num-derive 0.4.2", "num-traits", - "solana-program", + "solana-program 1.18.17", "spl-token", "spl-token-2022 1.0.0", "thiserror", @@ -2335,7 +2410,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cce5d563b58ef1bb2cdbbfe0dfb9ffdc24903b10ae6a4df2d8f425ece375033f" dependencies = [ "bytemuck", - "solana-program", + "solana-program 1.18.17", "spl-discriminator-derive", ] @@ -2369,7 +2444,7 @@ version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325" dependencies = [ - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -2378,7 +2453,7 @@ version = "4.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a49f49f95f2d02111ded31696ab38a081fab623d4c76bd4cb074286db4560836" dependencies = [ - "solana-program", + "solana-program 1.18.17", ] [[package]] @@ -2389,7 +2464,7 @@ checksum = "2881dddfca792737c0706fa0175345ab282b1b0879c7d877bad129645737c079" dependencies = [ "borsh 0.10.3", "bytemuck", - "solana-program", + "solana-program 1.18.17", "solana-zk-token-sdk", "spl-program-error 0.3.0", ] @@ -2402,7 +2477,7 @@ checksum = "af92f74cd3b0fdfda59fef4b571a92123e4df0f67cc43f73163975d31118ef82" dependencies = [ "num-derive 0.3.3", "num-traits", - "solana-program", + "solana-program 1.18.17", "spl-program-error-derive 0.2.0", "thiserror", ] @@ -2415,7 +2490,7 @@ checksum = "249e0318493b6bcf27ae9902600566c689b7dfba9f1bdff5893e92253374e78c" dependencies = [ "num-derive 0.4.2", "num-traits", - "solana-program", + "solana-program 1.18.17", "spl-program-error-derive 0.3.2", "thiserror", ] @@ -2450,7 +2525,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82149a5a06b5f158d03904066375eaf0c8a2422557cc3d5a25d277260d9a3b16" dependencies = [ "bytemuck", - "solana-program", + "solana-program 1.18.17", "spl-discriminator", "spl-program-error 0.2.0", "spl-type-length-value 0.2.0", @@ -2463,7 +2538,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "615d381f48ddd2bb3c57c7f7fb207591a2a05054639b18a62e785117dd7a8683" dependencies = [ "bytemuck", - "solana-program", + "solana-program 1.18.17", "spl-discriminator", "spl-pod", "spl-program-error 0.3.0", @@ -2481,7 +2556,7 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "num_enum 0.7.3", - "solana-program", + "solana-program 1.18.17", "thiserror", ] @@ -2496,7 +2571,7 @@ dependencies = [ "num-derive 0.3.3", "num-traits", "num_enum 0.6.1", - "solana-program", + "solana-program 1.18.17", "solana-zk-token-sdk", "spl-memo 3.0.1", "spl-token", @@ -2515,7 +2590,7 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "num_enum 0.7.3", - "solana-program", + "solana-program 1.18.17", "solana-security-txt", "solana-zk-token-sdk", "spl-memo 4.0.4", @@ -2535,7 +2610,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b889509d49fa74a4a033ca5dae6c2307e9e918122d97e58562f5c4ffa795c75d" dependencies = [ "bytemuck", - "solana-program", + "solana-program 1.18.17", "spl-discriminator", "spl-pod", "spl-program-error 0.3.0", @@ -2548,7 +2623,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c16ce3ba6979645fb7627aa1e435576172dd63088dc7848cb09aa331fa1fe4f" dependencies = [ "borsh 0.10.3", - "solana-program", + "solana-program 1.18.17", "spl-discriminator", "spl-pod", "spl-program-error 0.3.0", @@ -2566,7 +2641,7 @@ dependencies = [ "num-derive 0.3.3", "num-traits", "num_enum 0.6.1", - "solana-program", + "solana-program 1.18.17", "spl-discriminator", "spl-tlv-account-resolution 0.2.0", "spl-type-length-value 0.2.0", @@ -2581,7 +2656,7 @@ checksum = "7aabdb7c471566f6ddcee724beb8618449ea24b399e58d464d6b5bc7db550259" dependencies = [ "arrayref", "bytemuck", - "solana-program", + "solana-program 1.18.17", "spl-discriminator", "spl-pod", "spl-program-error 0.3.0", @@ -2596,7 +2671,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1d085f426b33b8365fb98383d1b8b3925e21bdfe579c851ceaa7f511dbec191" dependencies = [ "bytemuck", - "solana-program", + "solana-program 1.18.17", "spl-discriminator", "spl-program-error 0.2.0", ] @@ -2608,12 +2683,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a468e6f6371f9c69aae760186ea9f1a01c2908351b06a5e0026d21cfc4d7ecac" dependencies = [ "bytemuck", - "solana-program", + "solana-program 1.18.17", "spl-discriminator", "spl-pod", "spl-program-error 0.3.0", ] +[[package]] +name = "steel" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d88c610ca9fd5e4e51bdb6e9964114133a42f006713fe38aff37266fac91e1be" +dependencies = [ + "bytemuck", + "num_enum 0.7.3", + "solana-program 1.18.17", + "thiserror", +] + +[[package]] +name = "steel" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ca3cc310b7b71ce7944af64fb4fdaa5d0c2848ac79616d75e401913b6f781" +dependencies = [ + "bytemuck", + "num_enum 0.7.3", + "solana-program 1.18.17", + "thiserror", +] + +[[package]] +name = "steel-hello-solana" +version = "0.1.0" +dependencies = [ + "solana-program 2.0.14", + "steel 1.3.0", +] + [[package]] name = "strsim" version = "0.11.1" @@ -2729,7 +2836,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", "spl-associated-token-account", "spl-token-2022 0.7.0", ] @@ -2740,7 +2847,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", "spl-associated-token-account", "spl-token-2022 0.7.0", ] @@ -2751,7 +2858,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", "spl-associated-token-account", "spl-token-2022 0.7.0", ] @@ -2762,7 +2869,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", "spl-associated-token-account", "spl-token-2022 0.7.0", ] @@ -2773,7 +2880,7 @@ version = "0.1.0" dependencies = [ "borsh 0.10.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", "spl-associated-token-account", "spl-token-2022 0.7.0", ] @@ -2856,7 +2963,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program", + "solana-program 1.18.17", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index c13e8b8c0..3bb44c956 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ members = [ "basics/close-account/native/program", "basics/close-account/anchor/programs/close-account", "basics/counter/native/program", + "basics/counter/steel/program", "basics/counter/anchor/programs/counter_anchor", "basics/counter/mpl-stack", "basics/create-account/native/program", diff --git a/basics/counter/steel/README.md b/basics/counter/steel/README.md new file mode 100644 index 000000000..6369c41d7 --- /dev/null +++ b/basics/counter/steel/README.md @@ -0,0 +1,14 @@ +# Counter: Solana Native + +This example program is written in Solana using only the Solana toolsuite. + +## Setup + +1. Build the program with `cargo build-sbf` +2. Run tests + local validator with `yarn test` + +## Debugging + +1. Start test validator with `yarn start-validator` +2. Start listening to program logs with `solana config set -ul && solana logs` +3. Run tests with `yarn run-tests` diff --git a/basics/counter/steel/package.json b/basics/counter/steel/package.json new file mode 100644 index 000000000..bc7f404d1 --- /dev/null +++ b/basics/counter/steel/package.json @@ -0,0 +1,28 @@ +{ + "name": "counter-solana-native", + "version": "0.1.0", + "description": "Counter program written using only Solana tooling", + "main": "index.js", + "author": "ngundotra", + "license": "Apache-2.0", + "private": false, + "scripts": { + "test": "pnpm ts-mocha -p ./tests/tsconfig.test.json -t 1000000 ./tests/counter.test.ts", + "build-and-test": "cargo build-sbf --manifest-path=./program/Cargo.toml --sbf-out-dir=./tests/fixtures && pnpm test", + "build": "cargo build-sbf --manifest-path=./program/Cargo.toml --sbf-out-dir=./program/target/so", + "deploy": "solana program deploy ./program/target/so/program.so" + }, + "devDependencies": { + "@types/bn.js": "^5.1.0", + "@types/chai": "^4.3.1", + "@types/mocha": "^9.1.1", + "chai": "^4.3.4", + "mocha": "^9.0.3", + "solana-bankrun": "^0.3.0", + "ts-mocha": "^10.0.0", + "typescript": "^4.3.5" + }, + "dependencies": { + "@solana/web3.js": "^1.91.4" + } +} diff --git a/basics/counter/steel/pnpm-lock.yaml b/basics/counter/steel/pnpm-lock.yaml new file mode 100644 index 000000000..2de6e4c16 --- /dev/null +++ b/basics/counter/steel/pnpm-lock.yaml @@ -0,0 +1,1288 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@solana/web3.js': + specifier: ^1.91.4 + version: 1.91.8 + devDependencies: + '@types/bn.js': + specifier: ^5.1.0 + version: 5.1.5 + '@types/chai': + specifier: ^4.3.1 + version: 4.3.16 + '@types/mocha': + specifier: ^9.1.1 + version: 9.1.1 + chai: + specifier: ^4.3.4 + version: 4.4.1 + mocha: + specifier: ^9.0.3 + version: 9.2.2 + solana-bankrun: + specifier: ^0.3.0 + version: 0.3.0 + ts-mocha: + specifier: ^10.0.0 + version: 10.0.0(mocha@9.2.2) + typescript: + specifier: ^4.3.5 + version: 4.9.5 + +packages: + + '@babel/runtime@7.24.5': + resolution: {integrity: sha512-Nms86NXrsaeU9vbBJKni6gXiEXZ4CVpYVzEjDH9Sb8vmZ3UljyA1GSOJl/6LGPO8EHLuSF9H+IxNXHPX8QHJ4g==} + engines: {node: '>=6.9.0'} + + '@noble/curves@1.4.0': + resolution: {integrity: sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==} + + '@noble/hashes@1.4.0': + resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} + engines: {node: '>= 16'} + + '@solana/buffer-layout@4.0.1': + resolution: {integrity: sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==} + engines: {node: '>=5.10'} + + '@solana/web3.js@1.91.8': + resolution: {integrity: sha512-USa6OS1jbh8zOapRJ/CBZImZ8Xb7AJjROZl5adql9TpOoBN9BUzyyouS5oPuZHft7S7eB8uJPuXWYjMi6BHgOw==} + + '@types/bn.js@5.1.5': + resolution: {integrity: sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A==} + + '@types/chai@4.3.16': + resolution: {integrity: sha512-PatH4iOdyh3MyWtmHVFXLWCCIhUbopaltqddG9BzB+gMIzee2MJrvd+jouii9Z3wzQJruGWAm7WOMjgfG8hQlQ==} + + '@types/connect@3.4.38': + resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} + + '@types/json5@0.0.29': + resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} + + '@types/mocha@9.1.1': + resolution: {integrity: sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==} + + '@types/node@12.20.55': + resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} + + '@types/node@20.12.11': + resolution: {integrity: sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==} + + '@types/ws@7.4.7': + resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} + + '@ungap/promise-all-settled@1.1.2': + resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} + + JSONStream@1.3.5: + resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} + hasBin: true + + agentkeepalive@4.5.0: + resolution: {integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==} + engines: {node: '>= 8.0.0'} + + ansi-colors@4.1.1: + resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} + engines: {node: '>=6'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + + arrify@1.0.1: + resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} + engines: {node: '>=0.10.0'} + + assertion-error@1.1.0: + resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + + balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + + base-x@3.0.9: + resolution: {integrity: sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==} + + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + bigint-buffer@1.1.5: + resolution: {integrity: sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==} + engines: {node: '>= 10.0.0'} + + binary-extensions@2.3.0: + resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} + engines: {node: '>=8'} + + bindings@1.5.0: + resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} + + bn.js@5.2.1: + resolution: {integrity: sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==} + + borsh@0.7.0: + resolution: {integrity: sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==} + + brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + + braces@3.0.2: + resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} + engines: {node: '>=8'} + + browser-stdout@1.3.1: + resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} + + bs58@4.0.1: + resolution: {integrity: sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==} + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + + bufferutil@4.0.8: + resolution: {integrity: sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==} + engines: {node: '>=6.14.2'} + + camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + + chai@4.4.1: + resolution: {integrity: sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==} + engines: {node: '>=4'} + + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + + check-error@1.0.3: + resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + + chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + + cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + + concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + + debug@4.3.3: + resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + decamelize@4.0.0: + resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} + engines: {node: '>=10'} + + deep-eql@4.1.3: + resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} + engines: {node: '>=6'} + + delay@5.0.0: + resolution: {integrity: sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==} + engines: {node: '>=10'} + + diff@3.5.0: + resolution: {integrity: sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==} + engines: {node: '>=0.3.1'} + + diff@5.0.0: + resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} + engines: {node: '>=0.3.1'} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + es6-promise@4.2.8: + resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} + + es6-promisify@5.0.0: + resolution: {integrity: sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==} + + escalade@3.1.2: + resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} + engines: {node: '>=6'} + + escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + + eventemitter3@4.0.7: + resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} + + eyes@0.1.8: + resolution: {integrity: sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==} + engines: {node: '> 0.1.90'} + + fast-stable-stringify@1.0.0: + resolution: {integrity: sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==} + + file-uri-to-path@1.0.0: + resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} + + fill-range@7.0.1: + resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} + engines: {node: '>=8'} + + find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + + flat@5.0.2: + resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} + hasBin: true + + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + get-func-name@2.0.2: + resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + glob@7.2.0: + resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} + + growl@1.10.5: + resolution: {integrity: sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==} + engines: {node: '>=4.x'} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + he@1.2.0: + resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} + hasBin: true + + humanize-ms@1.2.1: + resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-plain-obj@2.1.0: + resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} + engines: {node: '>=8'} + + is-unicode-supported@0.1.0: + resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} + engines: {node: '>=10'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + isomorphic-ws@4.0.1: + resolution: {integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==} + peerDependencies: + ws: '*' + + jayson@4.1.0: + resolution: {integrity: sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==} + engines: {node: '>=8'} + hasBin: true + + js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + + json-stringify-safe@5.0.1: + resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} + + json5@1.0.2: + resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} + hasBin: true + + jsonparse@1.3.1: + resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} + engines: {'0': node >= 0.2.0} + + locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + + log-symbols@4.1.0: + resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} + engines: {node: '>=10'} + + loupe@2.3.7: + resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + + make-error@1.3.6: + resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + + minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + + minimatch@4.2.1: + resolution: {integrity: sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==} + engines: {node: '>=10'} + + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + mkdirp@0.5.6: + resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} + hasBin: true + + mocha@9.2.2: + resolution: {integrity: sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==} + engines: {node: '>= 12.0.0'} + hasBin: true + + ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + nanoid@3.3.1: + resolution: {integrity: sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + + node-gyp-build@4.8.1: + resolution: {integrity: sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==} + hasBin: true + + normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + + p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + + pathval@1.1.1: + resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + + readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + + regenerator-runtime@0.14.1: + resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + rpc-websockets@7.11.0: + resolution: {integrity: sha512-IkLYjayPv6Io8C/TdCL5gwgzd1hFz2vmBZrjMw/SPEXo51ETOhnzgS4Qy5GWi2JQN7HKHa66J3+2mv0fgNh/7w==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + serialize-javascript@6.0.0: + resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} + + solana-bankrun-darwin-arm64@0.3.0: + resolution: {integrity: sha512-+NbDncf0U6l3knuacRBiqpjZ2DSp+5lZaAU518gH7/x6qubbui/d000STaIBK+uNTPBS/AL/bCN+7PkXqmA3lA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + + solana-bankrun-darwin-universal@0.3.0: + resolution: {integrity: sha512-1/F0xdMa4qvc5o6z16FCCbZ5jbdvKvxpx5kyPcMWRiRPwyvi+zltMxciPAYMlg3wslQqGz88uFhrBEzq2eTumQ==} + engines: {node: '>= 10'} + os: [darwin] + + solana-bankrun-darwin-x64@0.3.0: + resolution: {integrity: sha512-U6CANjkmMl+lgNA7UH0GKs5V7LtVIUDzJBZefGGqLfqUNv3EjA/PrrToM0hAOWJgkxSwdz6zW+p5sw5FmnbXtg==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + + solana-bankrun-linux-x64-gnu@0.3.0: + resolution: {integrity: sha512-qJSkCFs0k2n4XtTnyxGMiZsuqO2TiqTYgWjQ+3mZhGNUAMys/Vq8bd7/SyBm6RR7EfVuRXRxZvh+F8oKZ77V4w==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + + solana-bankrun-linux-x64-musl@0.3.0: + resolution: {integrity: sha512-xsS2CS2xb1Sw4ivNXM0gPz/qpW9BX0neSvt/pnok5L330Nu9xlTnKAY8FhzzqOP9P9sJlGRM787Y6d0yYwt6xQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + + solana-bankrun@0.3.0: + resolution: {integrity: sha512-YkH7sa8TB/AoRPzG17CXJtYsRIQHEkEqGLz1Vwc13taXhDBkjO7z6NI5JYw7n0ybRymDHwMYTc7sd+5J40TyVQ==} + engines: {node: '>= 10'} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-bom@3.0.0: + resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} + engines: {node: '>=4'} + + strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + + superstruct@0.14.2: + resolution: {integrity: sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + text-encoding-utf-8@1.0.2: + resolution: {integrity: sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==} + + through@2.3.8: + resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + + ts-mocha@10.0.0: + resolution: {integrity: sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw==} + engines: {node: '>= 6.X.X'} + hasBin: true + peerDependencies: + mocha: ^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X + + ts-node@7.0.1: + resolution: {integrity: sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==} + engines: {node: '>=4.2.0'} + hasBin: true + + tsconfig-paths@3.15.0: + resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} + + type-detect@4.0.8: + resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} + engines: {node: '>=4'} + + typescript@4.9.5: + resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} + engines: {node: '>=4.2.0'} + hasBin: true + + undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + + utf-8-validate@5.0.10: + resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} + engines: {node: '>=6.14.2'} + + uuid@8.3.2: + resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} + hasBin: true + + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + workerpool@6.2.0: + resolution: {integrity: sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + ws@7.5.9: + resolution: {integrity: sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==} + engines: {node: '>=8.3.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + ws@8.17.0: + resolution: {integrity: sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yargs-parser@20.2.4: + resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} + engines: {node: '>=10'} + + yargs-unparser@2.0.0: + resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} + engines: {node: '>=10'} + + yargs@16.2.0: + resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} + engines: {node: '>=10'} + + yn@2.0.0: + resolution: {integrity: sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==} + engines: {node: '>=4'} + + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + +snapshots: + + '@babel/runtime@7.24.5': + dependencies: + regenerator-runtime: 0.14.1 + + '@noble/curves@1.4.0': + dependencies: + '@noble/hashes': 1.4.0 + + '@noble/hashes@1.4.0': {} + + '@solana/buffer-layout@4.0.1': + dependencies: + buffer: 6.0.3 + + '@solana/web3.js@1.91.8': + dependencies: + '@babel/runtime': 7.24.5 + '@noble/curves': 1.4.0 + '@noble/hashes': 1.4.0 + '@solana/buffer-layout': 4.0.1 + agentkeepalive: 4.5.0 + bigint-buffer: 1.1.5 + bn.js: 5.2.1 + borsh: 0.7.0 + bs58: 4.0.1 + buffer: 6.0.3 + fast-stable-stringify: 1.0.0 + jayson: 4.1.0 + node-fetch: 2.7.0 + rpc-websockets: 7.11.0 + superstruct: 0.14.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + '@types/bn.js@5.1.5': + dependencies: + '@types/node': 20.12.11 + + '@types/chai@4.3.16': {} + + '@types/connect@3.4.38': + dependencies: + '@types/node': 12.20.55 + + '@types/json5@0.0.29': + optional: true + + '@types/mocha@9.1.1': {} + + '@types/node@12.20.55': {} + + '@types/node@20.12.11': + dependencies: + undici-types: 5.26.5 + + '@types/ws@7.4.7': + dependencies: + '@types/node': 12.20.55 + + '@ungap/promise-all-settled@1.1.2': {} + + JSONStream@1.3.5: + dependencies: + jsonparse: 1.3.1 + through: 2.3.8 + + agentkeepalive@4.5.0: + dependencies: + humanize-ms: 1.2.1 + + ansi-colors@4.1.1: {} + + ansi-regex@5.0.1: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + anymatch@3.1.3: + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + + argparse@2.0.1: {} + + arrify@1.0.1: {} + + assertion-error@1.1.0: {} + + balanced-match@1.0.2: {} + + base-x@3.0.9: + dependencies: + safe-buffer: 5.2.1 + + base64-js@1.5.1: {} + + bigint-buffer@1.1.5: + dependencies: + bindings: 1.5.0 + + binary-extensions@2.3.0: {} + + bindings@1.5.0: + dependencies: + file-uri-to-path: 1.0.0 + + bn.js@5.2.1: {} + + borsh@0.7.0: + dependencies: + bn.js: 5.2.1 + bs58: 4.0.1 + text-encoding-utf-8: 1.0.2 + + brace-expansion@1.1.11: + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + + braces@3.0.2: + dependencies: + fill-range: 7.0.1 + + browser-stdout@1.3.1: {} + + bs58@4.0.1: + dependencies: + base-x: 3.0.9 + + buffer-from@1.1.2: {} + + buffer@6.0.3: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + bufferutil@4.0.8: + dependencies: + node-gyp-build: 4.8.1 + + camelcase@6.3.0: {} + + chai@4.4.1: + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.3 + deep-eql: 4.1.3 + get-func-name: 2.0.2 + loupe: 2.3.7 + pathval: 1.1.1 + type-detect: 4.0.8 + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + check-error@1.0.3: + dependencies: + get-func-name: 2.0.2 + + chokidar@3.5.3: + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + + cliui@7.0.4: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + + commander@2.20.3: {} + + concat-map@0.0.1: {} + + debug@4.3.3(supports-color@8.1.1): + dependencies: + ms: 2.1.2 + supports-color: 8.1.1 + + decamelize@4.0.0: {} + + deep-eql@4.1.3: + dependencies: + type-detect: 4.0.8 + + delay@5.0.0: {} + + diff@3.5.0: {} + + diff@5.0.0: {} + + emoji-regex@8.0.0: {} + + es6-promise@4.2.8: {} + + es6-promisify@5.0.0: + dependencies: + es6-promise: 4.2.8 + + escalade@3.1.2: {} + + escape-string-regexp@4.0.0: {} + + eventemitter3@4.0.7: {} + + eyes@0.1.8: {} + + fast-stable-stringify@1.0.0: {} + + file-uri-to-path@1.0.0: {} + + fill-range@7.0.1: + dependencies: + to-regex-range: 5.0.1 + + find-up@5.0.0: + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 + + flat@5.0.2: {} + + fs.realpath@1.0.0: {} + + fsevents@2.3.3: + optional: true + + get-caller-file@2.0.5: {} + + get-func-name@2.0.2: {} + + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + + glob@7.2.0: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + + growl@1.10.5: {} + + has-flag@4.0.0: {} + + he@1.2.0: {} + + humanize-ms@1.2.1: + dependencies: + ms: 2.1.3 + + ieee754@1.2.1: {} + + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + + inherits@2.0.4: {} + + is-binary-path@2.1.0: + dependencies: + binary-extensions: 2.3.0 + + is-extglob@2.1.1: {} + + is-fullwidth-code-point@3.0.0: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-number@7.0.0: {} + + is-plain-obj@2.1.0: {} + + is-unicode-supported@0.1.0: {} + + isexe@2.0.0: {} + + isomorphic-ws@4.0.1(ws@7.5.9): + dependencies: + ws: 7.5.9 + + jayson@4.1.0: + dependencies: + '@types/connect': 3.4.38 + '@types/node': 12.20.55 + '@types/ws': 7.4.7 + JSONStream: 1.3.5 + commander: 2.20.3 + delay: 5.0.0 + es6-promisify: 5.0.0 + eyes: 0.1.8 + isomorphic-ws: 4.0.1(ws@7.5.9) + json-stringify-safe: 5.0.1 + uuid: 8.3.2 + ws: 7.5.9 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + js-yaml@4.1.0: + dependencies: + argparse: 2.0.1 + + json-stringify-safe@5.0.1: {} + + json5@1.0.2: + dependencies: + minimist: 1.2.8 + optional: true + + jsonparse@1.3.1: {} + + locate-path@6.0.0: + dependencies: + p-locate: 5.0.0 + + log-symbols@4.1.0: + dependencies: + chalk: 4.1.2 + is-unicode-supported: 0.1.0 + + loupe@2.3.7: + dependencies: + get-func-name: 2.0.2 + + make-error@1.3.6: {} + + minimatch@3.1.2: + dependencies: + brace-expansion: 1.1.11 + + minimatch@4.2.1: + dependencies: + brace-expansion: 1.1.11 + + minimist@1.2.8: {} + + mkdirp@0.5.6: + dependencies: + minimist: 1.2.8 + + mocha@9.2.2: + dependencies: + '@ungap/promise-all-settled': 1.1.2 + ansi-colors: 4.1.1 + browser-stdout: 1.3.1 + chokidar: 3.5.3 + debug: 4.3.3(supports-color@8.1.1) + diff: 5.0.0 + escape-string-regexp: 4.0.0 + find-up: 5.0.0 + glob: 7.2.0 + growl: 1.10.5 + he: 1.2.0 + js-yaml: 4.1.0 + log-symbols: 4.1.0 + minimatch: 4.2.1 + ms: 2.1.3 + nanoid: 3.3.1 + serialize-javascript: 6.0.0 + strip-json-comments: 3.1.1 + supports-color: 8.1.1 + which: 2.0.2 + workerpool: 6.2.0 + yargs: 16.2.0 + yargs-parser: 20.2.4 + yargs-unparser: 2.0.0 + + ms@2.1.2: {} + + ms@2.1.3: {} + + nanoid@3.3.1: {} + + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + + node-gyp-build@4.8.1: {} + + normalize-path@3.0.0: {} + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + p-limit@3.1.0: + dependencies: + yocto-queue: 0.1.0 + + p-locate@5.0.0: + dependencies: + p-limit: 3.1.0 + + path-exists@4.0.0: {} + + path-is-absolute@1.0.1: {} + + pathval@1.1.1: {} + + picomatch@2.3.1: {} + + randombytes@2.1.0: + dependencies: + safe-buffer: 5.2.1 + + readdirp@3.6.0: + dependencies: + picomatch: 2.3.1 + + regenerator-runtime@0.14.1: {} + + require-directory@2.1.1: {} + + rpc-websockets@7.11.0: + dependencies: + eventemitter3: 4.0.7 + uuid: 8.3.2 + ws: 8.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + + safe-buffer@5.2.1: {} + + serialize-javascript@6.0.0: + dependencies: + randombytes: 2.1.0 + + solana-bankrun-darwin-arm64@0.3.0: + optional: true + + solana-bankrun-darwin-universal@0.3.0: + optional: true + + solana-bankrun-darwin-x64@0.3.0: + optional: true + + solana-bankrun-linux-x64-gnu@0.3.0: + optional: true + + solana-bankrun-linux-x64-musl@0.3.0: + optional: true + + solana-bankrun@0.3.0: + dependencies: + '@solana/web3.js': 1.91.8 + bs58: 4.0.1 + optionalDependencies: + solana-bankrun-darwin-arm64: 0.3.0 + solana-bankrun-darwin-universal: 0.3.0 + solana-bankrun-darwin-x64: 0.3.0 + solana-bankrun-linux-x64-gnu: 0.3.0 + solana-bankrun-linux-x64-musl: 0.3.0 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-bom@3.0.0: + optional: true + + strip-json-comments@3.1.1: {} + + superstruct@0.14.2: {} + + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + text-encoding-utf-8@1.0.2: {} + + through@2.3.8: {} + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + tr46@0.0.3: {} + + ts-mocha@10.0.0(mocha@9.2.2): + dependencies: + mocha: 9.2.2 + ts-node: 7.0.1 + optionalDependencies: + tsconfig-paths: 3.15.0 + + ts-node@7.0.1: + dependencies: + arrify: 1.0.1 + buffer-from: 1.1.2 + diff: 3.5.0 + make-error: 1.3.6 + minimist: 1.2.8 + mkdirp: 0.5.6 + source-map-support: 0.5.21 + yn: 2.0.0 + + tsconfig-paths@3.15.0: + dependencies: + '@types/json5': 0.0.29 + json5: 1.0.2 + minimist: 1.2.8 + strip-bom: 3.0.0 + optional: true + + type-detect@4.0.8: {} + + typescript@4.9.5: {} + + undici-types@5.26.5: {} + + utf-8-validate@5.0.10: + dependencies: + node-gyp-build: 4.8.1 + + uuid@8.3.2: {} + + webidl-conversions@3.0.1: {} + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + workerpool@6.2.0: {} + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrappy@1.0.2: {} + + ws@7.5.9: {} + + ws@8.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): + dependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 + + y18n@5.0.8: {} + + yargs-parser@20.2.4: {} + + yargs-unparser@2.0.0: + dependencies: + camelcase: 6.3.0 + decamelize: 4.0.0 + flat: 5.0.2 + is-plain-obj: 2.1.0 + + yargs@16.2.0: + dependencies: + cliui: 7.0.4 + escalade: 3.1.2 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.4 + + yn@2.0.0: {} + + yocto-queue@0.1.0: {} diff --git a/basics/counter/steel/program/Cargo.toml b/basics/counter/steel/program/Cargo.toml new file mode 100644 index 000000000..7ac1eb535 --- /dev/null +++ b/basics/counter/steel/program/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "counter-solana-steel" +version = "0.1.0" +edition = "2021" + +[dependencies] +solana-program = "=1.18.17" +steel = "2.1" +bytemuck = "1.4" +num_enum = "0.7" + +[lib] +crate-type = ["cdylib", "lib"] diff --git a/basics/counter/steel/program/src/lib.rs b/basics/counter/steel/program/src/lib.rs new file mode 100644 index 000000000..65b25aa40 --- /dev/null +++ b/basics/counter/steel/program/src/lib.rs @@ -0,0 +1,49 @@ +mod state; + +use solana_program::msg; +use state::*; +use steel::*; + +declare_id!("z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35"); + +entrypoint!(process_instruction); + +pub fn process_instruction( + program_id: &Pubkey, + accounts: &[AccountInfo], + instruction_data: &[u8], +) -> ProgramResult { + let (instruction_discriminant, instruction_data_inner) = instruction_data.split_at(1); + + match instruction_discriminant[0] { + 0 => { + msg!("Instruction: Increment"); + process_increment_counter(program_id, accounts, instruction_data_inner)?; + } + _ => { + msg!("Error: unknown instruction") + } + } + Ok(()) +} + +pub fn process_increment_counter( + program_id: &Pubkey, + accounts: &[AccountInfo], + _instruction_data: &[u8], +) -> Result<(), ProgramError> { + let [counter_info] = accounts else { + return Err(ProgramError::NotEnoughAccountKeys); + }; + + counter_info.is_writable()?; + + let counter = counter_info.as_account_mut::(program_id)?; + + counter.count += 1; + + let count = counter.count; + + msg!("Counter state incremented to {:?}", count); + Ok(()) +} diff --git a/basics/counter/steel/program/src/state.rs b/basics/counter/steel/program/src/state.rs new file mode 100644 index 000000000..24a3ff0fa --- /dev/null +++ b/basics/counter/steel/program/src/state.rs @@ -0,0 +1,15 @@ +use steel::*; + +account!(SteelAccount, Counter); + +#[repr(C, packed)] +#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] +pub struct Counter { + pub count: u64 +} + +#[repr(u8)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)] +pub enum SteelAccount { + Counter = 0 +} diff --git a/basics/counter/steel/tests/counter.test.ts b/basics/counter/steel/tests/counter.test.ts new file mode 100644 index 000000000..6656671de --- /dev/null +++ b/basics/counter/steel/tests/counter.test.ts @@ -0,0 +1,127 @@ +import { describe, test } from 'node:test'; +import { Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction } from '@solana/web3.js'; +import BN from 'bn.js'; +import { assert } from 'chai'; +import { start } from 'solana-bankrun'; + +const COUNTER_ACCOUNT_SIZE = 8 + 8; // 8 byte u64 count + 8 byte disciminator + +type Counter = { + count: BN; +}; + +function deserializeCounterAccount(data: Buffer): Counter { + if (data.byteLength !== 16) { + throw Error('Need exactly 16 bytes to deserialize counter'); + } + + return { + count: new BN(data.slice(8), 'le'), // slice off the 8 byte descriminator to get the count + }; +} + +describe('Counter Solana Native', async () => { + // Randomly generate the program keypair and load the program to solana-bankrun + const PROGRAM_ID = PublicKey.unique(); + + const context = await start([{ name: 'counter_solana_steel', programId: PROGRAM_ID }], []); + + const client = context.banksClient; + // Get the payer keypair from the context, this will be used to sign transactions with enough lamports + const payer = context.payer; + // Get the rent object to calculate rent for the accounts + const rent = await client.getRent(); + + function createIncrementInstruction(counter: PublicKey): TransactionInstruction { + return new TransactionInstruction({ + programId: PROGRAM_ID, + keys: [ + { + pubkey: counter, + isSigner: false, + isWritable: true, + }, + ], + data: Buffer.from([0x0]), + }); + } + + const counterKeypair = Keypair.generate(); + const counter = counterKeypair.publicKey; + + test('Test allocate counter + increment tx', async () => { + // Randomly generate the account key + // to sign for setting up the Counter state + + // Create a TransactionInstruction to interact with our counter program + const allocIx = SystemProgram.createAccount({ + fromPubkey: payer.publicKey, + newAccountPubkey: counter, + lamports: Number(rent.minimumBalance(BigInt(COUNTER_ACCOUNT_SIZE))), + space: COUNTER_ACCOUNT_SIZE, + programId: PROGRAM_ID, + }); + + const incrementIx = createIncrementInstruction(counter); + + // create the counter, and then increment the count + const tx = new Transaction().add(allocIx).add(incrementIx); + + // Explicitly set the feePayer to be our wallet (this is set to first signer by default) + tx.feePayer = payer.publicKey; + + // Fetch a "timestamp" so validators know this is a recent transaction + const blockhash = context.lastBlockhash; + tx.recentBlockhash = blockhash; + + // Sign the transaction with the payer's keypair + tx.sign(payer, counterKeypair); + + // Send transaction to bankrun + await client.processTransaction(tx); + + // Get the counter account info from network + const counterAccountInfo = await client.getAccount(counter); + assert(counterAccountInfo, 'Expected counter account to have been created'); + + // Deserialize the counter & check count has been incremented + const counterAccount = deserializeCounterAccount(Buffer.from(counterAccountInfo.data)); + + assert(counterAccount.count.toNumber() === 1, 'Expected count to have been 1'); + console.log(`[alloc+increment] count is: ${counterAccount.count.toNumber()}`); + }); + + test('Increment the counter again', async () => { + let counterAccountInfo = await client.getAccount(counter); + + assert(counterAccountInfo, 'Expected counter account to have been created'); + + let counterAccount = deserializeCounterAccount(Buffer.from(counterAccountInfo.data)); + + assert(counterAccount.count.toNumber() === 1, 'Expected count to have been 1'); + + console.log(`[allocate] count is: ${counterAccount.count.toNumber()}`); + + // Check increment tx + const incrementIx: TransactionInstruction = createIncrementInstruction(counter); + + const tx = new Transaction().add(incrementIx); + tx.feePayer = payer.publicKey; + + const blockhash = context.lastBlockhash; + tx.recentBlockhash = blockhash; + tx.sign(payer); + + await client.processTransaction(tx); + + counterAccountInfo = await client.getAccount(counter); + + assert(counterAccountInfo, 'Expected counter account to have been created'); + + counterAccount = deserializeCounterAccount(Buffer.from(counterAccountInfo.data)); + + assert(counterAccount.count.toNumber() === 2, 'Expected count to have been 2'); + + console.log(`[increment] count is: ${counterAccount.count.toNumber()}`); + }); +}); diff --git a/basics/counter/steel/tests/tsconfig.test.json b/basics/counter/steel/tests/tsconfig.test.json new file mode 100644 index 000000000..cd5d2e3d0 --- /dev/null +++ b/basics/counter/steel/tests/tsconfig.test.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "types": ["mocha", "chai"], + "typeRoots": ["./node_modules/@types"], + "lib": ["es2015"], + "module": "commonjs", + "target": "es6", + "esModuleInterop": true + } +} From 2e757787ce6deaacc4b81fceea894bcd606e8166 Mon Sep 17 00:00:00 2001 From: chizor iwuh Date: Wed, 30 Oct 2024 20:03:27 +0100 Subject: [PATCH 2/6] steel/counter - cleanup --- basics/counter/steel/README.md | 15 +--- basics/counter/steel/package.json | 8 +-- basics/counter/steel/pnpm-lock.yaml | 81 ++++++++++++---------- basics/counter/steel/tests/counter.test.ts | 10 +-- 4 files changed, 55 insertions(+), 59 deletions(-) diff --git a/basics/counter/steel/README.md b/basics/counter/steel/README.md index 6369c41d7..9af7b5edb 100644 --- a/basics/counter/steel/README.md +++ b/basics/counter/steel/README.md @@ -1,14 +1,3 @@ -# Counter: Solana Native +# Counter: Solana Steel -This example program is written in Solana using only the Solana toolsuite. - -## Setup - -1. Build the program with `cargo build-sbf` -2. Run tests + local validator with `yarn test` - -## Debugging - -1. Start test validator with `yarn start-validator` -2. Start listening to program logs with `solana config set -ul && solana logs` -3. Run tests with `yarn run-tests` +This example program is written in Solana using Steel toolsuite. diff --git a/basics/counter/steel/package.json b/basics/counter/steel/package.json index bc7f404d1..7726d342a 100644 --- a/basics/counter/steel/package.json +++ b/basics/counter/steel/package.json @@ -1,9 +1,9 @@ { - "name": "counter-solana-native", + "name": "counter-solana-steel", "version": "0.1.0", - "description": "Counter program written using only Solana tooling", + "description": "Counter program written using Steel framework", "main": "index.js", - "author": "ngundotra", + "author": "The Wuh", "license": "Apache-2.0", "private": false, "scripts": { @@ -18,7 +18,7 @@ "@types/mocha": "^9.1.1", "chai": "^4.3.4", "mocha": "^9.0.3", - "solana-bankrun": "^0.3.0", + "solana-bankrun": "^0.4.0", "ts-mocha": "^10.0.0", "typescript": "^4.3.5" }, diff --git a/basics/counter/steel/pnpm-lock.yaml b/basics/counter/steel/pnpm-lock.yaml index 2de6e4c16..122e3565d 100644 --- a/basics/counter/steel/pnpm-lock.yaml +++ b/basics/counter/steel/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: dependencies: '@solana/web3.js': specifier: ^1.91.4 - version: 1.91.8 + version: 1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) devDependencies: '@types/bn.js': specifier: ^5.1.0 @@ -28,8 +28,8 @@ importers: specifier: ^9.0.3 version: 9.2.2 solana-bankrun: - specifier: ^0.3.0 - version: 0.3.0 + specifier: ^0.4.0 + version: 0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) ts-mocha: specifier: ^10.0.0 version: 10.0.0(mocha@9.2.2) @@ -485,37 +485,37 @@ packages: serialize-javascript@6.0.0: resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} - solana-bankrun-darwin-arm64@0.3.0: - resolution: {integrity: sha512-+NbDncf0U6l3knuacRBiqpjZ2DSp+5lZaAU518gH7/x6qubbui/d000STaIBK+uNTPBS/AL/bCN+7PkXqmA3lA==} + solana-bankrun-darwin-arm64@0.4.0: + resolution: {integrity: sha512-6dz78Teoz7ez/3lpRLDjktYLJb79FcmJk2me4/YaB8WiO6W43OdExU4h+d2FyuAryO2DgBPXaBoBNY/8J1HJmw==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - solana-bankrun-darwin-universal@0.3.0: - resolution: {integrity: sha512-1/F0xdMa4qvc5o6z16FCCbZ5jbdvKvxpx5kyPcMWRiRPwyvi+zltMxciPAYMlg3wslQqGz88uFhrBEzq2eTumQ==} + solana-bankrun-darwin-universal@0.4.0: + resolution: {integrity: sha512-zSSw/Jx3KNU42pPMmrEWABd0nOwGJfsj7nm9chVZ3ae7WQg3Uty0hHAkn5NSDCj3OOiN0py9Dr1l9vmRJpOOxg==} engines: {node: '>= 10'} os: [darwin] - solana-bankrun-darwin-x64@0.3.0: - resolution: {integrity: sha512-U6CANjkmMl+lgNA7UH0GKs5V7LtVIUDzJBZefGGqLfqUNv3EjA/PrrToM0hAOWJgkxSwdz6zW+p5sw5FmnbXtg==} + solana-bankrun-darwin-x64@0.4.0: + resolution: {integrity: sha512-LWjs5fsgHFtyr7YdJR6r0Ho5zrtzI6CY4wvwPXr8H2m3b4pZe6RLIZjQtabCav4cguc14G0K8yQB2PTMuGub8w==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - solana-bankrun-linux-x64-gnu@0.3.0: - resolution: {integrity: sha512-qJSkCFs0k2n4XtTnyxGMiZsuqO2TiqTYgWjQ+3mZhGNUAMys/Vq8bd7/SyBm6RR7EfVuRXRxZvh+F8oKZ77V4w==} + solana-bankrun-linux-x64-gnu@0.4.0: + resolution: {integrity: sha512-SrlVrb82UIxt21Zr/XZFHVV/h9zd2/nP25PMpLJVLD7Pgl2yhkhfi82xj3OjxoQqWe+zkBJ+uszA0EEKr67yNw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - solana-bankrun-linux-x64-musl@0.3.0: - resolution: {integrity: sha512-xsS2CS2xb1Sw4ivNXM0gPz/qpW9BX0neSvt/pnok5L330Nu9xlTnKAY8FhzzqOP9P9sJlGRM787Y6d0yYwt6xQ==} + solana-bankrun-linux-x64-musl@0.4.0: + resolution: {integrity: sha512-Nv328ZanmURdYfcLL+jwB1oMzX4ZzK57NwIcuJjGlf0XSNLq96EoaO5buEiUTo4Ls7MqqMyLbClHcrPE7/aKyA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - solana-bankrun@0.3.0: - resolution: {integrity: sha512-YkH7sa8TB/AoRPzG17CXJtYsRIQHEkEqGLz1Vwc13taXhDBkjO7z6NI5JYw7n0ybRymDHwMYTc7sd+5J40TyVQ==} + solana-bankrun@0.4.0: + resolution: {integrity: sha512-NMmXUipPBkt8NgnyNO3SCnPERP6xT/AMNMBooljGA3+rG6NN8lmXJsKeLqQTiFsDeWD74U++QM/DgcueSWvrIg==} engines: {node: '>= 10'} source-map-support@0.5.21: @@ -685,7 +685,7 @@ snapshots: dependencies: buffer: 6.0.3 - '@solana/web3.js@1.91.8': + '@solana/web3.js@1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: '@babel/runtime': 7.24.5 '@noble/curves': 1.4.0 @@ -698,7 +698,7 @@ snapshots: bs58: 4.0.1 buffer: 6.0.3 fast-stable-stringify: 1.0.0 - jayson: 4.1.0 + jayson: 4.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) node-fetch: 2.7.0 rpc-websockets: 7.11.0 superstruct: 0.14.2 @@ -813,6 +813,7 @@ snapshots: bufferutil@4.0.8: dependencies: node-gyp-build: 4.8.1 + optional: true camelcase@6.3.0: {} @@ -866,6 +867,7 @@ snapshots: debug@4.3.3(supports-color@8.1.1): dependencies: ms: 2.1.2 + optionalDependencies: supports-color: 8.1.1 decamelize@4.0.0: {} @@ -972,11 +974,11 @@ snapshots: isexe@2.0.0: {} - isomorphic-ws@4.0.1(ws@7.5.9): + isomorphic-ws@4.0.1(ws@7.5.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)): dependencies: - ws: 7.5.9 + ws: 7.5.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) - jayson@4.1.0: + jayson@4.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): dependencies: '@types/connect': 3.4.38 '@types/node': 12.20.55 @@ -986,10 +988,10 @@ snapshots: delay: 5.0.0 es6-promisify: 5.0.0 eyes: 0.1.8 - isomorphic-ws: 4.0.1(ws@7.5.9) + isomorphic-ws: 4.0.1(ws@7.5.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)) json-stringify-safe: 5.0.1 uuid: 8.3.2 - ws: 7.5.9 + ws: 7.5.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - utf-8-validate @@ -1073,7 +1075,8 @@ snapshots: dependencies: whatwg-url: 5.0.0 - node-gyp-build@4.8.1: {} + node-gyp-build@4.8.1: + optional: true normalize-path@3.0.0: {} @@ -1124,31 +1127,31 @@ snapshots: dependencies: randombytes: 2.1.0 - solana-bankrun-darwin-arm64@0.3.0: + solana-bankrun-darwin-arm64@0.4.0: optional: true - solana-bankrun-darwin-universal@0.3.0: + solana-bankrun-darwin-universal@0.4.0: optional: true - solana-bankrun-darwin-x64@0.3.0: + solana-bankrun-darwin-x64@0.4.0: optional: true - solana-bankrun-linux-x64-gnu@0.3.0: + solana-bankrun-linux-x64-gnu@0.4.0: optional: true - solana-bankrun-linux-x64-musl@0.3.0: + solana-bankrun-linux-x64-musl@0.4.0: optional: true - solana-bankrun@0.3.0: + solana-bankrun@0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): dependencies: - '@solana/web3.js': 1.91.8 + '@solana/web3.js': 1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) bs58: 4.0.1 optionalDependencies: - solana-bankrun-darwin-arm64: 0.3.0 - solana-bankrun-darwin-universal: 0.3.0 - solana-bankrun-darwin-x64: 0.3.0 - solana-bankrun-linux-x64-gnu: 0.3.0 - solana-bankrun-linux-x64-musl: 0.3.0 + solana-bankrun-darwin-arm64: 0.4.0 + solana-bankrun-darwin-universal: 0.4.0 + solana-bankrun-darwin-x64: 0.4.0 + solana-bankrun-linux-x64-gnu: 0.4.0 + solana-bankrun-linux-x64-musl: 0.4.0 transitivePeerDependencies: - bufferutil - encoding @@ -1231,6 +1234,7 @@ snapshots: utf-8-validate@5.0.10: dependencies: node-gyp-build: 4.8.1 + optional: true uuid@8.3.2: {} @@ -1255,10 +1259,13 @@ snapshots: wrappy@1.0.2: {} - ws@7.5.9: {} + ws@7.5.9(bufferutil@4.0.8)(utf-8-validate@5.0.10): + optionalDependencies: + bufferutil: 4.0.8 + utf-8-validate: 5.0.10 ws@8.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): - dependencies: + optionalDependencies: bufferutil: 4.0.8 utf-8-validate: 5.0.10 diff --git a/basics/counter/steel/tests/counter.test.ts b/basics/counter/steel/tests/counter.test.ts index 6656671de..d918f106f 100644 --- a/basics/counter/steel/tests/counter.test.ts +++ b/basics/counter/steel/tests/counter.test.ts @@ -10,7 +10,7 @@ type Counter = { count: BN; }; -function deserializeCounterAccount(data: Buffer): Counter { +function deserializeCounterAccount(data: Uint8Array): Counter { if (data.byteLength !== 16) { throw Error('Need exactly 16 bytes to deserialize counter'); } @@ -20,7 +20,7 @@ function deserializeCounterAccount(data: Buffer): Counter { }; } -describe('Counter Solana Native', async () => { +describe('Counter Solana Steel!', async () => { // Randomly generate the program keypair and load the program to solana-bankrun const PROGRAM_ID = PublicKey.unique(); @@ -85,7 +85,7 @@ describe('Counter Solana Native', async () => { assert(counterAccountInfo, 'Expected counter account to have been created'); // Deserialize the counter & check count has been incremented - const counterAccount = deserializeCounterAccount(Buffer.from(counterAccountInfo.data)); + const counterAccount = deserializeCounterAccount(counterAccountInfo.data); assert(counterAccount.count.toNumber() === 1, 'Expected count to have been 1'); console.log(`[alloc+increment] count is: ${counterAccount.count.toNumber()}`); @@ -96,11 +96,11 @@ describe('Counter Solana Native', async () => { assert(counterAccountInfo, 'Expected counter account to have been created'); - let counterAccount = deserializeCounterAccount(Buffer.from(counterAccountInfo.data)); + let counterAccount = deserializeCounterAccount(counterAccountInfo.data); assert(counterAccount.count.toNumber() === 1, 'Expected count to have been 1'); - console.log(`[allocate] count is: ${counterAccount.count.toNumber()}`); + console.log(`[before-increment] count is: ${counterAccount.count.toNumber()}`); // Check increment tx const incrementIx: TransactionInstruction = createIncrementInstruction(counter); From dfa6d7c732e3a37a98b4a6e16b10c05077299713 Mon Sep 17 00:00:00 2001 From: chizor iwuh Date: Wed, 30 Oct 2024 21:49:03 +0100 Subject: [PATCH 3/6] counter/steel - remodel to fit anchor example --- basics/counter/steel/program/src/lib.rs | 108 +++++++++++++++------ basics/counter/steel/program/src/state.rs | 15 --- basics/counter/steel/tests/counter.test.ts | 85 ++++++++-------- 3 files changed, 123 insertions(+), 85 deletions(-) delete mode 100644 basics/counter/steel/program/src/state.rs diff --git a/basics/counter/steel/program/src/lib.rs b/basics/counter/steel/program/src/lib.rs index 65b25aa40..ea7281374 100644 --- a/basics/counter/steel/program/src/lib.rs +++ b/basics/counter/steel/program/src/lib.rs @@ -1,7 +1,3 @@ -mod state; - -use solana_program::msg; -use state::*; use steel::*; declare_id!("z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35"); @@ -11,39 +7,91 @@ entrypoint!(process_instruction); pub fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], - instruction_data: &[u8], + data: &[u8], ) -> ProgramResult { - let (instruction_discriminant, instruction_data_inner) = instruction_data.split_at(1); - - match instruction_discriminant[0] { - 0 => { - msg!("Instruction: Increment"); - process_increment_counter(program_id, accounts, instruction_data_inner)?; - } - _ => { - msg!("Error: unknown instruction") - } + // Use `crate::ID` for program_id in your program instead: + // + // e.g parse_instruction(&crate::ID, program_id, data) + // or counter_account.as_account_mut::(&crate::ID)? + // + let (ix, _data) = parse_instruction(program_id, program_id, data)?; + + match ix { + CounterInstruction::Initialize => Initialize::process(program_id, accounts), + CounterInstruction::Increment => Increment::process(program_id, accounts), } - Ok(()) } -pub fn process_increment_counter( - program_id: &Pubkey, - accounts: &[AccountInfo], - _instruction_data: &[u8], -) -> Result<(), ProgramError> { - let [counter_info] = accounts else { - return Err(ProgramError::NotEnoughAccountKeys); - }; +#[repr(u8)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)] +pub enum CounterInstruction { + Initialize = 0, + Increment = 1, +} + +instruction!(CounterInstruction, Initialize); +// Initialize +#[repr(C, packed)] +#[derive(Clone, Copy, Debug, Pod, Zeroable)] +pub struct Initialize {} - counter_info.is_writable()?; +impl Initialize { + pub fn process(program_id: &Pubkey, accounts: &[AccountInfo<'_>]) -> ProgramResult { + let [counter_account, payer, system_program] = accounts else { + return Err(ProgramError::NotEnoughAccountKeys); + }; - let counter = counter_info.as_account_mut::(program_id)?; + payer.is_writable()?.is_signer()?; // make use payer is writable and signer + system_program.is_program(&system_program::ID)?; // system program check + counter_account.is_writable()?; // check the account is writable - counter.count += 1; + // create the counter account + create_account::(counter_account, system_program, payer, program_id, &[])?; + + let counter = counter_account.as_account::(program_id)?; + let count = counter.count; + + solana_program::msg!("Counter initialized! Count is {}", count); + + Ok(()) + } +} - let count = counter.count; +instruction!(CounterInstruction, Increment); +// Increment +#[repr(C, packed)] +#[derive(Clone, Copy, Debug, Pod, Zeroable)] +pub struct Increment {} + +impl Increment { + pub fn process(program_id: &Pubkey, accounts: &[AccountInfo<'_>]) -> ProgramResult { + let [counter_account] = accounts else { + return Err(ProgramError::NotEnoughAccountKeys); + }; + + counter_account.is_writable()?; // check the account is writable + + let counter = counter_account.as_account_mut::(program_id)?; + counter.count += 1; + + let count = counter.count; + + solana_program::msg!("Counter state incremented to {:?}", count); + + Ok(()) + } +} + +#[repr(u8)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)] +pub enum CounterAccount { + Counter = 0, +} - msg!("Counter state incremented to {:?}", count); - Ok(()) +account!(CounterAccount, Counter); +// Counter +#[repr(C, packed)] +#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] +pub struct Counter { + pub count: u64, } diff --git a/basics/counter/steel/program/src/state.rs b/basics/counter/steel/program/src/state.rs deleted file mode 100644 index 24a3ff0fa..000000000 --- a/basics/counter/steel/program/src/state.rs +++ /dev/null @@ -1,15 +0,0 @@ -use steel::*; - -account!(SteelAccount, Counter); - -#[repr(C, packed)] -#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] -pub struct Counter { - pub count: u64 -} - -#[repr(u8)] -#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)] -pub enum SteelAccount { - Counter = 0 -} diff --git a/basics/counter/steel/tests/counter.test.ts b/basics/counter/steel/tests/counter.test.ts index d918f106f..c573a07b3 100644 --- a/basics/counter/steel/tests/counter.test.ts +++ b/basics/counter/steel/tests/counter.test.ts @@ -4,8 +4,6 @@ import BN from 'bn.js'; import { assert } from 'chai'; import { start } from 'solana-bankrun'; -const COUNTER_ACCOUNT_SIZE = 8 + 8; // 8 byte u64 count + 8 byte disciminator - type Counter = { count: BN; }; @@ -20,9 +18,14 @@ function deserializeCounterAccount(data: Uint8Array): Counter { }; } +enum CounterInstruction { + Initialize = 0, + Increment = 1, +} + describe('Counter Solana Steel!', async () => { - // Randomly generate the program keypair and load the program to solana-bankrun - const PROGRAM_ID = PublicKey.unique(); + // Load the program id + const PROGRAM_ID = new PublicKey('z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35'); const context = await start([{ name: 'counter_solana_steel', programId: PROGRAM_ID }], []); @@ -32,6 +35,30 @@ describe('Counter Solana Steel!', async () => { // Get the rent object to calculate rent for the accounts const rent = await client.getRent(); + function createInitializeInstruction(counter: PublicKey): TransactionInstruction { + return new TransactionInstruction({ + programId: PROGRAM_ID, + keys: [ + { + pubkey: counter, + isSigner: true, // will need to sign create an account + isWritable: true, // set to true so we can modify its data + }, + { + pubkey: payer.publicKey, // payer publickey + isSigner: true, // make sure it is a signer + isWritable: true, // make sure it is writable + }, + { + pubkey: SystemProgram.programId, + isSigner: false, + isWritable: true, + }, + ], + data: Buffer.from([CounterInstruction.Initialize]), + }); + } + function createIncrementInstruction(counter: PublicKey): TransactionInstruction { return new TransactionInstruction({ programId: PROGRAM_ID, @@ -42,30 +69,20 @@ describe('Counter Solana Steel!', async () => { isWritable: true, }, ], - data: Buffer.from([0x0]), + data: Buffer.from([CounterInstruction.Increment]), }); } + // Randomly generate the account key + // to sign for setting up the Counter state const counterKeypair = Keypair.generate(); const counter = counterKeypair.publicKey; - test('Test allocate counter + increment tx', async () => { - // Randomly generate the account key - // to sign for setting up the Counter state + test('Initialize counter', async () => { + // Let's create the initialize counter instruction + const incrementIx = createInitializeInstruction(counter); - // Create a TransactionInstruction to interact with our counter program - const allocIx = SystemProgram.createAccount({ - fromPubkey: payer.publicKey, - newAccountPubkey: counter, - lamports: Number(rent.minimumBalance(BigInt(COUNTER_ACCOUNT_SIZE))), - space: COUNTER_ACCOUNT_SIZE, - programId: PROGRAM_ID, - }); - - const incrementIx = createIncrementInstruction(counter); - - // create the counter, and then increment the count - const tx = new Transaction().add(allocIx).add(incrementIx); + const tx = new Transaction().add(incrementIx); // Explicitly set the feePayer to be our wallet (this is set to first signer by default) tx.feePayer = payer.publicKey; @@ -86,23 +103,13 @@ describe('Counter Solana Steel!', async () => { // Deserialize the counter & check count has been incremented const counterAccount = deserializeCounterAccount(counterAccountInfo.data); + assert(counterAccount.count.toNumber() === 0, 'Expected count to have been 0'); - assert(counterAccount.count.toNumber() === 1, 'Expected count to have been 1'); - console.log(`[alloc+increment] count is: ${counterAccount.count.toNumber()}`); + console.log(`[initialize] count is: ${counterAccount.count.toNumber()}`); }); - test('Increment the counter again', async () => { - let counterAccountInfo = await client.getAccount(counter); - - assert(counterAccountInfo, 'Expected counter account to have been created'); - - let counterAccount = deserializeCounterAccount(counterAccountInfo.data); - - assert(counterAccount.count.toNumber() === 1, 'Expected count to have been 1'); - - console.log(`[before-increment] count is: ${counterAccount.count.toNumber()}`); - - // Check increment tx + test('Increment counter!', async () => { + // let's create the increment counter instruction const incrementIx: TransactionInstruction = createIncrementInstruction(counter); const tx = new Transaction().add(incrementIx); @@ -114,13 +121,11 @@ describe('Counter Solana Steel!', async () => { await client.processTransaction(tx); - counterAccountInfo = await client.getAccount(counter); - + const counterAccountInfo = await client.getAccount(counter); assert(counterAccountInfo, 'Expected counter account to have been created'); - counterAccount = deserializeCounterAccount(Buffer.from(counterAccountInfo.data)); - - assert(counterAccount.count.toNumber() === 2, 'Expected count to have been 2'); + const counterAccount = deserializeCounterAccount(counterAccountInfo.data); + assert(counterAccount.count.toNumber() === 1, 'Expected count to have been 1'); console.log(`[increment] count is: ${counterAccount.count.toNumber()}`); }); From 5435087273db934055d81e6d00217ecab4b25865 Mon Sep 17 00:00:00 2001 From: chizor iwuh Date: Thu, 31 Oct 2024 09:59:35 +0100 Subject: [PATCH 4/6] counter/steel - create_account bug fix, use seeds --- basics/counter/steel/package.json | 9 +- basics/counter/steel/pnpm-lock.yaml | 417 ++++++++---------- basics/counter/steel/program/src/lib.rs | 18 +- basics/counter/steel/tests/counter.test.ts | 53 +-- basics/counter/steel/tests/tsconfig.test.json | 2 +- 5 files changed, 238 insertions(+), 261 deletions(-) diff --git a/basics/counter/steel/package.json b/basics/counter/steel/package.json index 7726d342a..e758a7e15 100644 --- a/basics/counter/steel/package.json +++ b/basics/counter/steel/package.json @@ -15,14 +15,15 @@ "devDependencies": { "@types/bn.js": "^5.1.0", "@types/chai": "^4.3.1", - "@types/mocha": "^9.1.1", + "@types/mocha": "^10.0.9", + "@types/node": "^22.8.5", "chai": "^4.3.4", - "mocha": "^9.0.3", + "mocha": "^10.8.2", "solana-bankrun": "^0.4.0", "ts-mocha": "^10.0.0", - "typescript": "^4.3.5" + "typescript": "^5" }, "dependencies": { - "@solana/web3.js": "^1.91.4" + "@solana/web3.js": "^1.95.4" } } diff --git a/basics/counter/steel/pnpm-lock.yaml b/basics/counter/steel/pnpm-lock.yaml index 122e3565d..fa5ac7ec0 100644 --- a/basics/counter/steel/pnpm-lock.yaml +++ b/basics/counter/steel/pnpm-lock.yaml @@ -9,59 +9,66 @@ importers: .: dependencies: '@solana/web3.js': - specifier: ^1.91.4 - version: 1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) + specifier: ^1.95.4 + version: 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) devDependencies: '@types/bn.js': specifier: ^5.1.0 - version: 5.1.5 + version: 5.1.6 '@types/chai': specifier: ^4.3.1 - version: 4.3.16 + version: 4.3.20 '@types/mocha': - specifier: ^9.1.1 - version: 9.1.1 + specifier: ^10.0.9 + version: 10.0.9 + '@types/node': + specifier: ^22.8.5 + version: 22.8.5 chai: specifier: ^4.3.4 - version: 4.4.1 + version: 4.5.0 mocha: - specifier: ^9.0.3 - version: 9.2.2 + specifier: ^10.8.2 + version: 10.8.2 solana-bankrun: specifier: ^0.4.0 version: 0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) ts-mocha: specifier: ^10.0.0 - version: 10.0.0(mocha@9.2.2) + version: 10.0.0(mocha@10.8.2) typescript: - specifier: ^4.3.5 - version: 4.9.5 + specifier: ^5 + version: 5.6.3 packages: - '@babel/runtime@7.24.5': - resolution: {integrity: sha512-Nms86NXrsaeU9vbBJKni6gXiEXZ4CVpYVzEjDH9Sb8vmZ3UljyA1GSOJl/6LGPO8EHLuSF9H+IxNXHPX8QHJ4g==} + '@babel/runtime@7.26.0': + resolution: {integrity: sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==} engines: {node: '>=6.9.0'} - '@noble/curves@1.4.0': - resolution: {integrity: sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==} + '@noble/curves@1.6.0': + resolution: {integrity: sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==} + engines: {node: ^14.21.3 || >=16} - '@noble/hashes@1.4.0': - resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} - engines: {node: '>= 16'} + '@noble/hashes@1.5.0': + resolution: {integrity: sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==} + engines: {node: ^14.21.3 || >=16} '@solana/buffer-layout@4.0.1': resolution: {integrity: sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==} engines: {node: '>=5.10'} - '@solana/web3.js@1.91.8': - resolution: {integrity: sha512-USa6OS1jbh8zOapRJ/CBZImZ8Xb7AJjROZl5adql9TpOoBN9BUzyyouS5oPuZHft7S7eB8uJPuXWYjMi6BHgOw==} + '@solana/web3.js@1.95.4': + resolution: {integrity: sha512-sdewnNEA42ZSMxqkzdwEWi6fDgzwtJHaQa5ndUGEJYtoOnM6X5cvPmjoTUp7/k7bRrVAxfBgDnvQQHD6yhlLYw==} - '@types/bn.js@5.1.5': - resolution: {integrity: sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A==} + '@swc/helpers@0.5.13': + resolution: {integrity: sha512-UoKGxQ3r5kYI9dALKJapMmuK+1zWM/H17Z1+iwnNmzcJRnfFuevZs375TA5rW31pu4BS4NoSy1fRsexDXfWn5w==} - '@types/chai@4.3.16': - resolution: {integrity: sha512-PatH4iOdyh3MyWtmHVFXLWCCIhUbopaltqddG9BzB+gMIzee2MJrvd+jouii9Z3wzQJruGWAm7WOMjgfG8hQlQ==} + '@types/bn.js@5.1.6': + resolution: {integrity: sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w==} + + '@types/chai@4.3.20': + resolution: {integrity: sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ==} '@types/connect@3.4.38': resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} @@ -69,20 +76,23 @@ packages: '@types/json5@0.0.29': resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} - '@types/mocha@9.1.1': - resolution: {integrity: sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==} + '@types/mocha@10.0.9': + resolution: {integrity: sha512-sicdRoWtYevwxjOHNMPTl3vSfJM6oyW8o1wXeI7uww6b6xHg8eBznQDNSGBCDJmsE8UMxP05JgZRtsKbTqt//Q==} '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} - '@types/node@20.12.11': - resolution: {integrity: sha512-vDg9PZ/zi+Nqp6boSOT7plNuthRugEKixDv5sFTIpkE89MmNtEArAShI4mxuX2+UrLEe9pxC1vm2cjm9YlWbJw==} + '@types/node@22.8.5': + resolution: {integrity: sha512-5iYk6AMPtsMbkZqCO1UGF9W5L38twq11S2pYWkybGHH2ogPUvXWNlQqJBzuEZWKj/WRH+QTeiv6ySWqJtvIEgA==} + + '@types/uuid@8.3.4': + resolution: {integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==} '@types/ws@7.4.7': resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} - '@ungap/promise-all-settled@1.1.2': - resolution: {integrity: sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==} + '@types/ws@8.5.12': + resolution: {integrity: sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==} JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} @@ -92,8 +102,8 @@ packages: resolution: {integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==} engines: {node: '>= 8.0.0'} - ansi-colors@4.1.1: - resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} + ansi-colors@4.1.3: + resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} engines: {node: '>=6'} ansi-regex@5.0.1: @@ -121,8 +131,8 @@ packages: balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - base-x@3.0.9: - resolution: {integrity: sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==} + base-x@3.0.10: + resolution: {integrity: sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ==} base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} @@ -144,11 +154,11 @@ packages: borsh@0.7.0: resolution: {integrity: sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==} - brace-expansion@1.1.11: - resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} - braces@3.0.2: - resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} browser-stdout@1.3.1: @@ -171,8 +181,8 @@ packages: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} - chai@4.4.1: - resolution: {integrity: sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==} + chai@4.5.0: + resolution: {integrity: sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==} engines: {node: '>=4'} chalk@4.1.2: @@ -182,8 +192,8 @@ packages: check-error@1.0.3: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} - chokidar@3.5.3: - resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} cliui@7.0.4: @@ -199,11 +209,8 @@ packages: commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} - concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} - - debug@4.3.3: - resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} + debug@4.3.7: + resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} engines: {node: '>=6.0'} peerDependencies: supports-color: '*' @@ -215,8 +222,8 @@ packages: resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} engines: {node: '>=10'} - deep-eql@4.1.3: - resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} + deep-eql@4.1.4: + resolution: {integrity: sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==} engines: {node: '>=6'} delay@5.0.0: @@ -227,8 +234,8 @@ packages: resolution: {integrity: sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==} engines: {node: '>=0.3.1'} - diff@5.0.0: - resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} + diff@5.2.0: + resolution: {integrity: sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==} engines: {node: '>=0.3.1'} emoji-regex@8.0.0: @@ -240,16 +247,16 @@ packages: es6-promisify@5.0.0: resolution: {integrity: sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==} - escalade@3.1.2: - resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - eventemitter3@4.0.7: - resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} + eventemitter3@5.0.1: + resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} eyes@0.1.8: resolution: {integrity: sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==} @@ -261,8 +268,8 @@ packages: file-uri-to-path@1.0.0: resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} - fill-range@7.0.1: - resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} find-up@5.0.0: @@ -292,12 +299,10 @@ packages: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} - glob@7.2.0: - resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} - - growl@1.10.5: - resolution: {integrity: sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==} - engines: {node: '>=4.x'} + glob@8.1.0: + resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} + engines: {node: '>=12'} + deprecated: Glob versions prior to v9 are no longer supported has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} @@ -315,6 +320,7 @@ packages: inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} @@ -347,16 +353,13 @@ packages: resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} engines: {node: '>=10'} - isexe@2.0.0: - resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - isomorphic-ws@4.0.1: resolution: {integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==} peerDependencies: ws: '*' - jayson@4.1.0: - resolution: {integrity: sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==} + jayson@4.1.2: + resolution: {integrity: sha512-5nzMWDHy6f+koZOuYsArh2AXs73NfWYVlFyJJuCedr93GpY+Ku8qq10ropSXVfHK+H0T6paA88ww+/dV+1fBNA==} engines: {node: '>=8'} hasBin: true @@ -389,11 +392,8 @@ packages: make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - minimatch@3.1.2: - resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} - - minimatch@4.2.1: - resolution: {integrity: sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==} + minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} engines: {node: '>=10'} minimist@1.2.8: @@ -403,22 +403,14 @@ packages: resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} hasBin: true - mocha@9.2.2: - resolution: {integrity: sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==} - engines: {node: '>= 12.0.0'} + mocha@10.8.2: + resolution: {integrity: sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==} + engines: {node: '>= 14.0.0'} hasBin: true - ms@2.1.2: - resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - nanoid@3.3.1: - resolution: {integrity: sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==} - engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} - hasBin: true - node-fetch@2.7.0: resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} engines: {node: 4.x || >=6.0.0} @@ -428,8 +420,8 @@ packages: encoding: optional: true - node-gyp-build@4.8.1: - resolution: {integrity: sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==} + node-gyp-build@4.8.2: + resolution: {integrity: sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==} hasBin: true normalize-path@3.0.0: @@ -451,10 +443,6 @@ packages: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} - path-is-absolute@1.0.1: - resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} - engines: {node: '>=0.10.0'} - pathval@1.1.1: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} @@ -476,14 +464,14 @@ packages: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} - rpc-websockets@7.11.0: - resolution: {integrity: sha512-IkLYjayPv6Io8C/TdCL5gwgzd1hFz2vmBZrjMw/SPEXo51ETOhnzgS4Qy5GWi2JQN7HKHa66J3+2mv0fgNh/7w==} + rpc-websockets@9.0.4: + resolution: {integrity: sha512-yWZWN0M+bivtoNLnaDbtny4XchdAIF5Q4g/ZsC5UC61Ckbp0QczwO8fg44rV3uYmY4WHd+EZQbn90W1d8ojzqQ==} safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - serialize-javascript@6.0.0: - resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} + serialize-javascript@6.0.2: + resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} solana-bankrun-darwin-arm64@0.4.0: resolution: {integrity: sha512-6dz78Teoz7ez/3lpRLDjktYLJb79FcmJk2me4/YaB8WiO6W43OdExU4h+d2FyuAryO2DgBPXaBoBNY/8J1HJmw==} @@ -541,8 +529,9 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} - superstruct@0.14.2: - resolution: {integrity: sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==} + superstruct@2.0.2: + resolution: {integrity: sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==} + engines: {node: '>=14.0.0'} supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} @@ -580,17 +569,20 @@ packages: tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} - type-detect@4.0.8: - resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} + tslib@2.8.0: + resolution: {integrity: sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==} + + type-detect@4.1.0: + resolution: {integrity: sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==} engines: {node: '>=4'} - typescript@4.9.5: - resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} - engines: {node: '>=4.2.0'} + typescript@5.6.3: + resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} + engines: {node: '>=14.17'} hasBin: true - undici-types@5.26.5: - resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + undici-types@6.19.8: + resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} utf-8-validate@5.0.10: resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} @@ -606,13 +598,8 @@ packages: whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} - which@2.0.2: - resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} - engines: {node: '>= 8'} - hasBin: true - - workerpool@6.2.0: - resolution: {integrity: sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==} + workerpool@6.5.1: + resolution: {integrity: sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==} wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} @@ -621,8 +608,8 @@ packages: wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - ws@7.5.9: - resolution: {integrity: sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==} + ws@7.5.10: + resolution: {integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==} engines: {node: '>=8.3.0'} peerDependencies: bufferutil: ^4.0.1 @@ -633,8 +620,8 @@ packages: utf-8-validate: optional: true - ws@8.17.0: - resolution: {integrity: sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==} + ws@8.18.0: + resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} engines: {node: '>=10.0.0'} peerDependencies: bufferutil: ^4.0.1 @@ -649,8 +636,8 @@ packages: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} - yargs-parser@20.2.4: - resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} + yargs-parser@20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} engines: {node: '>=10'} yargs-unparser@2.0.0: @@ -671,25 +658,25 @@ packages: snapshots: - '@babel/runtime@7.24.5': + '@babel/runtime@7.26.0': dependencies: regenerator-runtime: 0.14.1 - '@noble/curves@1.4.0': + '@noble/curves@1.6.0': dependencies: - '@noble/hashes': 1.4.0 + '@noble/hashes': 1.5.0 - '@noble/hashes@1.4.0': {} + '@noble/hashes@1.5.0': {} '@solana/buffer-layout@4.0.1': dependencies: buffer: 6.0.3 - '@solana/web3.js@1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10)': + '@solana/web3.js@1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10)': dependencies: - '@babel/runtime': 7.24.5 - '@noble/curves': 1.4.0 - '@noble/hashes': 1.4.0 + '@babel/runtime': 7.26.0 + '@noble/curves': 1.6.0 + '@noble/hashes': 1.5.0 '@solana/buffer-layout': 4.0.1 agentkeepalive: 4.5.0 bigint-buffer: 1.1.5 @@ -698,41 +685,49 @@ snapshots: bs58: 4.0.1 buffer: 6.0.3 fast-stable-stringify: 1.0.0 - jayson: 4.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + jayson: 4.1.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) node-fetch: 2.7.0 - rpc-websockets: 7.11.0 - superstruct: 0.14.2 + rpc-websockets: 9.0.4 + superstruct: 2.0.2 transitivePeerDependencies: - bufferutil - encoding - utf-8-validate - '@types/bn.js@5.1.5': + '@swc/helpers@0.5.13': + dependencies: + tslib: 2.8.0 + + '@types/bn.js@5.1.6': dependencies: - '@types/node': 20.12.11 + '@types/node': 22.8.5 - '@types/chai@4.3.16': {} + '@types/chai@4.3.20': {} '@types/connect@3.4.38': dependencies: - '@types/node': 12.20.55 + '@types/node': 22.8.5 '@types/json5@0.0.29': optional: true - '@types/mocha@9.1.1': {} + '@types/mocha@10.0.9': {} '@types/node@12.20.55': {} - '@types/node@20.12.11': + '@types/node@22.8.5': dependencies: - undici-types: 5.26.5 + undici-types: 6.19.8 + + '@types/uuid@8.3.4': {} '@types/ws@7.4.7': dependencies: - '@types/node': 12.20.55 + '@types/node': 22.8.5 - '@ungap/promise-all-settled@1.1.2': {} + '@types/ws@8.5.12': + dependencies: + '@types/node': 22.8.5 JSONStream@1.3.5: dependencies: @@ -743,7 +738,7 @@ snapshots: dependencies: humanize-ms: 1.2.1 - ansi-colors@4.1.1: {} + ansi-colors@4.1.3: {} ansi-regex@5.0.1: {} @@ -764,7 +759,7 @@ snapshots: balanced-match@1.0.2: {} - base-x@3.0.9: + base-x@3.0.10: dependencies: safe-buffer: 5.2.1 @@ -788,20 +783,19 @@ snapshots: bs58: 4.0.1 text-encoding-utf-8: 1.0.2 - brace-expansion@1.1.11: + brace-expansion@2.0.1: dependencies: balanced-match: 1.0.2 - concat-map: 0.0.1 - braces@3.0.2: + braces@3.0.3: dependencies: - fill-range: 7.0.1 + fill-range: 7.1.1 browser-stdout@1.3.1: {} bs58@4.0.1: dependencies: - base-x: 3.0.9 + base-x: 3.0.10 buffer-from@1.1.2: {} @@ -812,20 +806,20 @@ snapshots: bufferutil@4.0.8: dependencies: - node-gyp-build: 4.8.1 + node-gyp-build: 4.8.2 optional: true camelcase@6.3.0: {} - chai@4.4.1: + chai@4.5.0: dependencies: assertion-error: 1.1.0 check-error: 1.0.3 - deep-eql: 4.1.3 + deep-eql: 4.1.4 get-func-name: 2.0.2 loupe: 2.3.7 pathval: 1.1.1 - type-detect: 4.0.8 + type-detect: 4.1.0 chalk@4.1.2: dependencies: @@ -836,10 +830,10 @@ snapshots: dependencies: get-func-name: 2.0.2 - chokidar@3.5.3: + chokidar@3.6.0: dependencies: anymatch: 3.1.3 - braces: 3.0.2 + braces: 3.0.3 glob-parent: 5.1.2 is-binary-path: 2.1.0 is-glob: 4.0.3 @@ -862,25 +856,23 @@ snapshots: commander@2.20.3: {} - concat-map@0.0.1: {} - - debug@4.3.3(supports-color@8.1.1): + debug@4.3.7(supports-color@8.1.1): dependencies: - ms: 2.1.2 + ms: 2.1.3 optionalDependencies: supports-color: 8.1.1 decamelize@4.0.0: {} - deep-eql@4.1.3: + deep-eql@4.1.4: dependencies: - type-detect: 4.0.8 + type-detect: 4.1.0 delay@5.0.0: {} diff@3.5.0: {} - diff@5.0.0: {} + diff@5.2.0: {} emoji-regex@8.0.0: {} @@ -890,11 +882,11 @@ snapshots: dependencies: es6-promise: 4.2.8 - escalade@3.1.2: {} + escalade@3.2.0: {} escape-string-regexp@4.0.0: {} - eventemitter3@4.0.7: {} + eventemitter3@5.0.1: {} eyes@0.1.8: {} @@ -902,7 +894,7 @@ snapshots: file-uri-to-path@1.0.0: {} - fill-range@7.0.1: + fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -926,16 +918,13 @@ snapshots: dependencies: is-glob: 4.0.3 - glob@7.2.0: + glob@8.1.0: dependencies: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.1.2 + minimatch: 5.1.6 once: 1.4.0 - path-is-absolute: 1.0.1 - - growl@1.10.5: {} has-flag@4.0.0: {} @@ -972,13 +961,11 @@ snapshots: is-unicode-supported@0.1.0: {} - isexe@2.0.0: {} - - isomorphic-ws@4.0.1(ws@7.5.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)): + isomorphic-ws@4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)): dependencies: - ws: 7.5.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) - jayson@4.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): + jayson@4.1.2(bufferutil@4.0.8)(utf-8-validate@5.0.10): dependencies: '@types/connect': 3.4.38 '@types/node': 12.20.55 @@ -988,10 +975,10 @@ snapshots: delay: 5.0.0 es6-promisify: 5.0.0 eyes: 0.1.8 - isomorphic-ws: 4.0.1(ws@7.5.9(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + isomorphic-ws: 4.0.1(ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10)) json-stringify-safe: 5.0.1 uuid: 8.3.2 - ws: 7.5.9(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - utf-8-validate @@ -1024,13 +1011,9 @@ snapshots: make-error@1.3.6: {} - minimatch@3.1.2: + minimatch@5.1.6: dependencies: - brace-expansion: 1.1.11 - - minimatch@4.2.1: - dependencies: - brace-expansion: 1.1.11 + brace-expansion: 2.0.1 minimist@1.2.8: {} @@ -1038,44 +1021,36 @@ snapshots: dependencies: minimist: 1.2.8 - mocha@9.2.2: + mocha@10.8.2: dependencies: - '@ungap/promise-all-settled': 1.1.2 - ansi-colors: 4.1.1 + ansi-colors: 4.1.3 browser-stdout: 1.3.1 - chokidar: 3.5.3 - debug: 4.3.3(supports-color@8.1.1) - diff: 5.0.0 + chokidar: 3.6.0 + debug: 4.3.7(supports-color@8.1.1) + diff: 5.2.0 escape-string-regexp: 4.0.0 find-up: 5.0.0 - glob: 7.2.0 - growl: 1.10.5 + glob: 8.1.0 he: 1.2.0 js-yaml: 4.1.0 log-symbols: 4.1.0 - minimatch: 4.2.1 + minimatch: 5.1.6 ms: 2.1.3 - nanoid: 3.3.1 - serialize-javascript: 6.0.0 + serialize-javascript: 6.0.2 strip-json-comments: 3.1.1 supports-color: 8.1.1 - which: 2.0.2 - workerpool: 6.2.0 + workerpool: 6.5.1 yargs: 16.2.0 - yargs-parser: 20.2.4 + yargs-parser: 20.2.9 yargs-unparser: 2.0.0 - ms@2.1.2: {} - ms@2.1.3: {} - nanoid@3.3.1: {} - node-fetch@2.7.0: dependencies: whatwg-url: 5.0.0 - node-gyp-build@4.8.1: + node-gyp-build@4.8.2: optional: true normalize-path@3.0.0: {} @@ -1094,8 +1069,6 @@ snapshots: path-exists@4.0.0: {} - path-is-absolute@1.0.1: {} - pathval@1.1.1: {} picomatch@2.3.1: {} @@ -1112,18 +1085,22 @@ snapshots: require-directory@2.1.1: {} - rpc-websockets@7.11.0: + rpc-websockets@9.0.4: dependencies: - eventemitter3: 4.0.7 + '@swc/helpers': 0.5.13 + '@types/uuid': 8.3.4 + '@types/ws': 8.5.12 + buffer: 6.0.3 + eventemitter3: 5.0.1 uuid: 8.3.2 - ws: 8.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) optionalDependencies: bufferutil: 4.0.8 utf-8-validate: 5.0.10 safe-buffer@5.2.1: {} - serialize-javascript@6.0.0: + serialize-javascript@6.0.2: dependencies: randombytes: 2.1.0 @@ -1144,7 +1121,7 @@ snapshots: solana-bankrun@0.4.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): dependencies: - '@solana/web3.js': 1.91.8(bufferutil@4.0.8)(utf-8-validate@5.0.10) + '@solana/web3.js': 1.95.4(bufferutil@4.0.8)(utf-8-validate@5.0.10) bs58: 4.0.1 optionalDependencies: solana-bankrun-darwin-arm64: 0.4.0 @@ -1179,7 +1156,7 @@ snapshots: strip-json-comments@3.1.1: {} - superstruct@0.14.2: {} + superstruct@2.0.2: {} supports-color@7.2.0: dependencies: @@ -1199,9 +1176,9 @@ snapshots: tr46@0.0.3: {} - ts-mocha@10.0.0(mocha@9.2.2): + ts-mocha@10.0.0(mocha@10.8.2): dependencies: - mocha: 9.2.2 + mocha: 10.8.2 ts-node: 7.0.1 optionalDependencies: tsconfig-paths: 3.15.0 @@ -1225,15 +1202,17 @@ snapshots: strip-bom: 3.0.0 optional: true - type-detect@4.0.8: {} + tslib@2.8.0: {} + + type-detect@4.1.0: {} - typescript@4.9.5: {} + typescript@5.6.3: {} - undici-types@5.26.5: {} + undici-types@6.19.8: {} utf-8-validate@5.0.10: dependencies: - node-gyp-build: 4.8.1 + node-gyp-build: 4.8.2 optional: true uuid@8.3.2: {} @@ -1245,11 +1224,7 @@ snapshots: tr46: 0.0.3 webidl-conversions: 3.0.1 - which@2.0.2: - dependencies: - isexe: 2.0.0 - - workerpool@6.2.0: {} + workerpool@6.5.1: {} wrap-ansi@7.0.0: dependencies: @@ -1259,19 +1234,19 @@ snapshots: wrappy@1.0.2: {} - ws@7.5.9(bufferutil@4.0.8)(utf-8-validate@5.0.10): + ws@7.5.10(bufferutil@4.0.8)(utf-8-validate@5.0.10): optionalDependencies: bufferutil: 4.0.8 utf-8-validate: 5.0.10 - ws@8.17.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): + ws@8.18.0(bufferutil@4.0.8)(utf-8-validate@5.0.10): optionalDependencies: bufferutil: 4.0.8 utf-8-validate: 5.0.10 y18n@5.0.8: {} - yargs-parser@20.2.4: {} + yargs-parser@20.2.9: {} yargs-unparser@2.0.0: dependencies: @@ -1283,12 +1258,12 @@ snapshots: yargs@16.2.0: dependencies: cliui: 7.0.4 - escalade: 3.1.2 + escalade: 3.2.0 get-caller-file: 2.0.5 require-directory: 2.1.1 string-width: 4.2.3 y18n: 5.0.8 - yargs-parser: 20.2.4 + yargs-parser: 20.2.9 yn@2.0.0: {} diff --git a/basics/counter/steel/program/src/lib.rs b/basics/counter/steel/program/src/lib.rs index ea7281374..2e8f9e60a 100644 --- a/basics/counter/steel/program/src/lib.rs +++ b/basics/counter/steel/program/src/lib.rs @@ -43,10 +43,18 @@ impl Initialize { payer.is_writable()?.is_signer()?; // make use payer is writable and signer system_program.is_program(&system_program::ID)?; // system program check - counter_account.is_writable()?; // check the account is writable + counter_account + .is_writable()? // check the account is writable + .has_seeds(&[b"counter"], program_id)?; // check the address is derived from the right seeds // create the counter account - create_account::(counter_account, system_program, payer, program_id, &[])?; + create_account::( + counter_account, // account to be created + system_program, // system program + payer, // payer + program_id, // program id + &[COUNTER_SEEDS], // seeds + )?; let counter = counter_account.as_account::(program_id)?; let count = counter.count; @@ -69,7 +77,9 @@ impl Increment { return Err(ProgramError::NotEnoughAccountKeys); }; - counter_account.is_writable()?; // check the account is writable + counter_account + .is_writable()? // check the account is writable + .has_seeds(&[COUNTER_SEEDS], program_id)?; // check the address is derived from the right seeds let counter = counter_account.as_account_mut::(program_id)?; counter.count += 1; @@ -95,3 +105,5 @@ account!(CounterAccount, Counter); pub struct Counter { pub count: u64, } + +pub const COUNTER_SEEDS: &[u8] = b"counter"; // counter seeds diff --git a/basics/counter/steel/tests/counter.test.ts b/basics/counter/steel/tests/counter.test.ts index c573a07b3..adb686a8a 100644 --- a/basics/counter/steel/tests/counter.test.ts +++ b/basics/counter/steel/tests/counter.test.ts @@ -1,5 +1,6 @@ +import { Buffer } from 'node:buffer'; import { describe, test } from 'node:test'; -import { Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction } from '@solana/web3.js'; +import { PublicKey, SystemProgram, Transaction, TransactionInstruction } from '@solana/web3.js'; import BN from 'bn.js'; import { assert } from 'chai'; import { start } from 'solana-bankrun'; @@ -32,16 +33,18 @@ describe('Counter Solana Steel!', async () => { const client = context.banksClient; // Get the payer keypair from the context, this will be used to sign transactions with enough lamports const payer = context.payer; - // Get the rent object to calculate rent for the accounts - const rent = await client.getRent(); - function createInitializeInstruction(counter: PublicKey): TransactionInstruction { - return new TransactionInstruction({ + // our counter address derived from the seeds + const counter = PublicKey.findProgramAddressSync([Buffer.from('counter')], PROGRAM_ID)[0]; + + test('Initialize counter', async () => { + // Let's create the initialize counter instruction + const incrementIx = new TransactionInstruction({ programId: PROGRAM_ID, keys: [ { pubkey: counter, - isSigner: true, // will need to sign create an account + isSigner: false, isWritable: true, // set to true so we can modify its data }, { @@ -57,30 +60,6 @@ describe('Counter Solana Steel!', async () => { ], data: Buffer.from([CounterInstruction.Initialize]), }); - } - - function createIncrementInstruction(counter: PublicKey): TransactionInstruction { - return new TransactionInstruction({ - programId: PROGRAM_ID, - keys: [ - { - pubkey: counter, - isSigner: false, - isWritable: true, - }, - ], - data: Buffer.from([CounterInstruction.Increment]), - }); - } - - // Randomly generate the account key - // to sign for setting up the Counter state - const counterKeypair = Keypair.generate(); - const counter = counterKeypair.publicKey; - - test('Initialize counter', async () => { - // Let's create the initialize counter instruction - const incrementIx = createInitializeInstruction(counter); const tx = new Transaction().add(incrementIx); @@ -92,7 +71,7 @@ describe('Counter Solana Steel!', async () => { tx.recentBlockhash = blockhash; // Sign the transaction with the payer's keypair - tx.sign(payer, counterKeypair); + tx.sign(payer); // Send transaction to bankrun await client.processTransaction(tx); @@ -110,7 +89,17 @@ describe('Counter Solana Steel!', async () => { test('Increment counter!', async () => { // let's create the increment counter instruction - const incrementIx: TransactionInstruction = createIncrementInstruction(counter); + const incrementIx: TransactionInstruction = new TransactionInstruction({ + programId: PROGRAM_ID, + keys: [ + { + pubkey: counter, + isSigner: false, + isWritable: true, + }, + ], + data: Buffer.from([CounterInstruction.Increment]), + }); const tx = new Transaction().add(incrementIx); tx.feePayer = payer.publicKey; diff --git a/basics/counter/steel/tests/tsconfig.test.json b/basics/counter/steel/tests/tsconfig.test.json index cd5d2e3d0..8c20b2236 100644 --- a/basics/counter/steel/tests/tsconfig.test.json +++ b/basics/counter/steel/tests/tsconfig.test.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "types": ["mocha", "chai"], + "types": ["mocha", "chai", "node"], "typeRoots": ["./node_modules/@types"], "lib": ["es2015"], "module": "commonjs", From 22e9e1d0158045f5fb991283b775a35527701933 Mon Sep 17 00:00:00 2001 From: chizor iwuh Date: Sat, 2 Nov 2024 21:01:12 +0100 Subject: [PATCH 5/6] counter/steel - use workspaces, avoid conflicts --- Cargo.lock | 191 ++++++------------------ Cargo.toml | 1 - basics/counter/steel/Cargo.toml | 3 + basics/counter/steel/program/src/lib.rs | 31 ++-- 4 files changed, 58 insertions(+), 168 deletions(-) create mode 100644 basics/counter/steel/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 58e8e7878..f54b45b7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -219,7 +219,7 @@ dependencies = [ "borsh 0.10.3", "bytemuck", "getrandom 0.2.15", - "solana-program 1.18.17", + "solana-program", "thiserror", ] @@ -451,12 +451,6 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - [[package]] name = "bincode" version = "1.3.3" @@ -744,7 +738,7 @@ dependencies = [ name = "checking-accounts-program" version = "0.1.0" dependencies = [ - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -771,7 +765,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -813,7 +807,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "shank", - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -821,17 +815,7 @@ name = "counter-solana-native" version = "0.1.0" dependencies = [ "borsh 0.9.3", - "solana-program 1.18.17", -] - -[[package]] -name = "counter-solana-steel" -version = "0.1.0" -dependencies = [ - "bytemuck", - "num_enum 0.7.3", - "solana-program 1.18.17", - "steel 2.1.1", + "solana-program", ] [[package]] @@ -854,7 +838,7 @@ dependencies = [ name = "create-account-program" version = "0.1.0" dependencies = [ - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -1170,7 +1154,7 @@ dependencies = [ name = "hello-solana-program" version = "0.1.0" dependencies = [ - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -1587,7 +1571,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -1690,7 +1674,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -1699,7 +1683,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -1708,7 +1692,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -1846,7 +1830,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -1900,7 +1884,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -2218,59 +2202,13 @@ dependencies = [ "sha3 0.10.8", "solana-frozen-abi", "solana-frozen-abi-macro", - "solana-sdk-macro 1.18.17", + "solana-sdk-macro", "thiserror", "tiny-bip39", "wasm-bindgen", "zeroize", ] -[[package]] -name = "solana-program" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2625a23c3813b620141ee447819b08d1b9a5f1c69a309754834e3f35798a21fb" -dependencies = [ - "ark-bn254", - "ark-ec", - "ark-ff", - "ark-serialize", - "base64 0.22.1", - "bincode", - "bitflags", - "blake3", - "borsh 0.10.3", - "borsh 1.5.1", - "bs58 0.5.1", - "bv", - "bytemuck", - "bytemuck_derive", - "console_error_panic_hook", - "console_log", - "curve25519-dalek", - "getrandom 0.2.15", - "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "memoffset", - "num-bigint", - "num-derive 0.4.2", - "num-traits", - "parking_lot", - "rand 0.8.5", - "rustc_version", - "rustversion", - "serde", - "serde_bytes", - "serde_derive", - "sha2 0.10.8", - "sha3 0.10.8", - "solana-sdk-macro 2.0.14", - "thiserror", - "wasm-bindgen", -] - [[package]] name = "solana-sdk" version = "1.18.17" @@ -2319,8 +2257,8 @@ dependencies = [ "solana-frozen-abi", "solana-frozen-abi-macro", "solana-logger", - "solana-program 1.18.17", - "solana-sdk-macro 1.18.17", + "solana-program", + "solana-sdk-macro", "thiserror", "uriparse", "wasm-bindgen", @@ -2339,19 +2277,6 @@ dependencies = [ "syn 2.0.72", ] -[[package]] -name = "solana-sdk-macro" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93a5a1eabc890415d326707afe62cd7a2009236e8d899c1519566fc8f7e3977b" -dependencies = [ - "bs58 0.5.1", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.72", -] - [[package]] name = "solana-security-txt" version = "1.1.1" @@ -2380,7 +2305,7 @@ dependencies = [ "serde", "serde_json", "sha3 0.9.1", - "solana-program 1.18.17", + "solana-program", "solana-sdk", "subtle", "thiserror", @@ -2397,7 +2322,7 @@ dependencies = [ "borsh 0.10.3", "num-derive 0.4.2", "num-traits", - "solana-program 1.18.17", + "solana-program", "spl-token", "spl-token-2022 1.0.0", "thiserror", @@ -2410,7 +2335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cce5d563b58ef1bb2cdbbfe0dfb9ffdc24903b10ae6a4df2d8f425ece375033f" dependencies = [ "bytemuck", - "solana-program 1.18.17", + "solana-program", "spl-discriminator-derive", ] @@ -2444,7 +2369,7 @@ version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325" dependencies = [ - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -2453,7 +2378,7 @@ version = "4.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a49f49f95f2d02111ded31696ab38a081fab623d4c76bd4cb074286db4560836" dependencies = [ - "solana-program 1.18.17", + "solana-program", ] [[package]] @@ -2464,7 +2389,7 @@ checksum = "2881dddfca792737c0706fa0175345ab282b1b0879c7d877bad129645737c079" dependencies = [ "borsh 0.10.3", "bytemuck", - "solana-program 1.18.17", + "solana-program", "solana-zk-token-sdk", "spl-program-error 0.3.0", ] @@ -2477,7 +2402,7 @@ checksum = "af92f74cd3b0fdfda59fef4b571a92123e4df0f67cc43f73163975d31118ef82" dependencies = [ "num-derive 0.3.3", "num-traits", - "solana-program 1.18.17", + "solana-program", "spl-program-error-derive 0.2.0", "thiserror", ] @@ -2490,7 +2415,7 @@ checksum = "249e0318493b6bcf27ae9902600566c689b7dfba9f1bdff5893e92253374e78c" dependencies = [ "num-derive 0.4.2", "num-traits", - "solana-program 1.18.17", + "solana-program", "spl-program-error-derive 0.3.2", "thiserror", ] @@ -2525,7 +2450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82149a5a06b5f158d03904066375eaf0c8a2422557cc3d5a25d277260d9a3b16" dependencies = [ "bytemuck", - "solana-program 1.18.17", + "solana-program", "spl-discriminator", "spl-program-error 0.2.0", "spl-type-length-value 0.2.0", @@ -2538,7 +2463,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "615d381f48ddd2bb3c57c7f7fb207591a2a05054639b18a62e785117dd7a8683" dependencies = [ "bytemuck", - "solana-program 1.18.17", + "solana-program", "spl-discriminator", "spl-pod", "spl-program-error 0.3.0", @@ -2556,7 +2481,7 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "num_enum 0.7.3", - "solana-program 1.18.17", + "solana-program", "thiserror", ] @@ -2571,7 +2496,7 @@ dependencies = [ "num-derive 0.3.3", "num-traits", "num_enum 0.6.1", - "solana-program 1.18.17", + "solana-program", "solana-zk-token-sdk", "spl-memo 3.0.1", "spl-token", @@ -2590,7 +2515,7 @@ dependencies = [ "num-derive 0.4.2", "num-traits", "num_enum 0.7.3", - "solana-program 1.18.17", + "solana-program", "solana-security-txt", "solana-zk-token-sdk", "spl-memo 4.0.4", @@ -2610,7 +2535,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b889509d49fa74a4a033ca5dae6c2307e9e918122d97e58562f5c4ffa795c75d" dependencies = [ "bytemuck", - "solana-program 1.18.17", + "solana-program", "spl-discriminator", "spl-pod", "spl-program-error 0.3.0", @@ -2623,7 +2548,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c16ce3ba6979645fb7627aa1e435576172dd63088dc7848cb09aa331fa1fe4f" dependencies = [ "borsh 0.10.3", - "solana-program 1.18.17", + "solana-program", "spl-discriminator", "spl-pod", "spl-program-error 0.3.0", @@ -2641,7 +2566,7 @@ dependencies = [ "num-derive 0.3.3", "num-traits", "num_enum 0.6.1", - "solana-program 1.18.17", + "solana-program", "spl-discriminator", "spl-tlv-account-resolution 0.2.0", "spl-type-length-value 0.2.0", @@ -2656,7 +2581,7 @@ checksum = "7aabdb7c471566f6ddcee724beb8618449ea24b399e58d464d6b5bc7db550259" dependencies = [ "arrayref", "bytemuck", - "solana-program 1.18.17", + "solana-program", "spl-discriminator", "spl-pod", "spl-program-error 0.3.0", @@ -2671,7 +2596,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1d085f426b33b8365fb98383d1b8b3925e21bdfe579c851ceaa7f511dbec191" dependencies = [ "bytemuck", - "solana-program 1.18.17", + "solana-program", "spl-discriminator", "spl-program-error 0.2.0", ] @@ -2683,44 +2608,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a468e6f6371f9c69aae760186ea9f1a01c2908351b06a5e0026d21cfc4d7ecac" dependencies = [ "bytemuck", - "solana-program 1.18.17", + "solana-program", "spl-discriminator", "spl-pod", "spl-program-error 0.3.0", ] -[[package]] -name = "steel" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d88c610ca9fd5e4e51bdb6e9964114133a42f006713fe38aff37266fac91e1be" -dependencies = [ - "bytemuck", - "num_enum 0.7.3", - "solana-program 1.18.17", - "thiserror", -] - -[[package]] -name = "steel" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ca3cc310b7b71ce7944af64fb4fdaa5d0c2848ac79616d75e401913b6f781" -dependencies = [ - "bytemuck", - "num_enum 0.7.3", - "solana-program 1.18.17", - "thiserror", -] - -[[package]] -name = "steel-hello-solana" -version = "0.1.0" -dependencies = [ - "solana-program 2.0.14", - "steel 1.3.0", -] - [[package]] name = "strsim" version = "0.11.1" @@ -2836,7 +2729,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", "spl-associated-token-account", "spl-token-2022 0.7.0", ] @@ -2847,7 +2740,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", "spl-associated-token-account", "spl-token-2022 0.7.0", ] @@ -2858,7 +2751,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", "spl-associated-token-account", "spl-token-2022 0.7.0", ] @@ -2869,7 +2762,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", "spl-associated-token-account", "spl-token-2022 0.7.0", ] @@ -2880,7 +2773,7 @@ version = "0.1.0" dependencies = [ "borsh 0.10.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", "spl-associated-token-account", "spl-token-2022 0.7.0", ] @@ -2963,7 +2856,7 @@ version = "0.1.0" dependencies = [ "borsh 0.9.3", "borsh-derive 0.9.3", - "solana-program 1.18.17", + "solana-program", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3bb44c956..c13e8b8c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ members = [ "basics/close-account/native/program", "basics/close-account/anchor/programs/close-account", "basics/counter/native/program", - "basics/counter/steel/program", "basics/counter/anchor/programs/counter_anchor", "basics/counter/mpl-stack", "basics/create-account/native/program", diff --git a/basics/counter/steel/Cargo.toml b/basics/counter/steel/Cargo.toml new file mode 100644 index 000000000..39fc8ab65 --- /dev/null +++ b/basics/counter/steel/Cargo.toml @@ -0,0 +1,3 @@ +[workspace] +members = ["program"] +resolver = "2" diff --git a/basics/counter/steel/program/src/lib.rs b/basics/counter/steel/program/src/lib.rs index 2e8f9e60a..5200b8375 100644 --- a/basics/counter/steel/program/src/lib.rs +++ b/basics/counter/steel/program/src/lib.rs @@ -9,16 +9,11 @@ pub fn process_instruction( accounts: &[AccountInfo], data: &[u8], ) -> ProgramResult { - // Use `crate::ID` for program_id in your program instead: - // - // e.g parse_instruction(&crate::ID, program_id, data) - // or counter_account.as_account_mut::(&crate::ID)? - // - let (ix, _data) = parse_instruction(program_id, program_id, data)?; + let (ix, _data) = parse_instruction(&crate::ID, program_id, data)?; match ix { - CounterInstruction::Initialize => Initialize::process(program_id, accounts), - CounterInstruction::Increment => Increment::process(program_id, accounts), + CounterInstruction::Initialize => Initialize::process(accounts), + CounterInstruction::Increment => Increment::process(accounts), } } @@ -36,7 +31,7 @@ instruction!(CounterInstruction, Initialize); pub struct Initialize {} impl Initialize { - pub fn process(program_id: &Pubkey, accounts: &[AccountInfo<'_>]) -> ProgramResult { + pub fn process(accounts: &[AccountInfo<'_>]) -> ProgramResult { let [counter_account, payer, system_program] = accounts else { return Err(ProgramError::NotEnoughAccountKeys); }; @@ -45,18 +40,18 @@ impl Initialize { system_program.is_program(&system_program::ID)?; // system program check counter_account .is_writable()? // check the account is writable - .has_seeds(&[b"counter"], program_id)?; // check the address is derived from the right seeds + .has_seeds(&[b"counter"], &crate::ID)?; // check the address is derived from the right seeds // create the counter account create_account::( - counter_account, // account to be created - system_program, // system program - payer, // payer - program_id, // program id + counter_account, // account to be created + system_program, // system program + payer, // payer + &crate::ID, // program id &[COUNTER_SEEDS], // seeds )?; - let counter = counter_account.as_account::(program_id)?; + let counter = counter_account.as_account::(&crate::ID)?; let count = counter.count; solana_program::msg!("Counter initialized! Count is {}", count); @@ -72,16 +67,16 @@ instruction!(CounterInstruction, Increment); pub struct Increment {} impl Increment { - pub fn process(program_id: &Pubkey, accounts: &[AccountInfo<'_>]) -> ProgramResult { + pub fn process(accounts: &[AccountInfo<'_>]) -> ProgramResult { let [counter_account] = accounts else { return Err(ProgramError::NotEnoughAccountKeys); }; counter_account .is_writable()? // check the account is writable - .has_seeds(&[COUNTER_SEEDS], program_id)?; // check the address is derived from the right seeds + .has_seeds(&[COUNTER_SEEDS], &crate::ID)?; // check the address is derived from the right seeds - let counter = counter_account.as_account_mut::(program_id)?; + let counter = counter_account.as_account_mut::(&crate::ID)?; counter.count += 1; let count = counter.count; From 03758f2bae5591a360ce086f161a57c6d6024721 Mon Sep 17 00:00:00 2001 From: chizor iwuh Date: Fri, 8 Nov 2024 10:47:35 +0100 Subject: [PATCH 6/6] counter/steel - add api --- basics/counter/steel/Cargo.toml | 8 +- basics/counter/steel/api/Cargo.toml | 13 +++ basics/counter/steel/api/src/consts.rs | 1 + basics/counter/steel/api/src/instruction.rs | 72 ++++++++++++++++ basics/counter/steel/api/src/lib.rs | 13 +++ basics/counter/steel/api/src/state.rs | 15 ++++ basics/counter/steel/program/Cargo.toml | 6 +- basics/counter/steel/program/src/lib.rs | 91 +-------------------- 8 files changed, 125 insertions(+), 94 deletions(-) create mode 100644 basics/counter/steel/api/Cargo.toml create mode 100644 basics/counter/steel/api/src/consts.rs create mode 100644 basics/counter/steel/api/src/instruction.rs create mode 100644 basics/counter/steel/api/src/lib.rs create mode 100644 basics/counter/steel/api/src/state.rs diff --git a/basics/counter/steel/Cargo.toml b/basics/counter/steel/Cargo.toml index 39fc8ab65..ffbe888f0 100644 --- a/basics/counter/steel/Cargo.toml +++ b/basics/counter/steel/Cargo.toml @@ -1,3 +1,9 @@ [workspace] -members = ["program"] +members = ["api", "program"] resolver = "2" + +[workspace.dependencies] +solana-program = "1.18.17" +steel = "2.1" +bytemuck = "1.4" +num_enum = "0.7" \ No newline at end of file diff --git a/basics/counter/steel/api/Cargo.toml b/basics/counter/steel/api/Cargo.toml new file mode 100644 index 000000000..19bae0272 --- /dev/null +++ b/basics/counter/steel/api/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "counter-solana-steel-api" +version = "0.1.0" +edition = "2021" + +[dependencies] +solana-program = "=1.18.17" +steel = "2.1" +bytemuck = "1.4" +num_enum = "0.7" + +[lib] +crate-type = ["cdylib", "lib"] diff --git a/basics/counter/steel/api/src/consts.rs b/basics/counter/steel/api/src/consts.rs new file mode 100644 index 000000000..f7dd3fd1e --- /dev/null +++ b/basics/counter/steel/api/src/consts.rs @@ -0,0 +1 @@ +pub const COUNTER_SEEDS: &[u8] = b"counter"; // counter seeds diff --git a/basics/counter/steel/api/src/instruction.rs b/basics/counter/steel/api/src/instruction.rs new file mode 100644 index 000000000..92f85c448 --- /dev/null +++ b/basics/counter/steel/api/src/instruction.rs @@ -0,0 +1,72 @@ +use crate::{consts::*, state::*}; +use steel::*; + +#[repr(u8)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)] +pub enum CounterInstruction { + Initialize = 0, + Increment = 1, +} + +instruction!(CounterInstruction, Initialize); +// Initialize +#[repr(C, packed)] +#[derive(Clone, Copy, Debug, Pod, Zeroable)] +pub struct Initialize {} + +impl Initialize { + pub fn process(accounts: &[AccountInfo<'_>]) -> ProgramResult { + let [counter_account, payer, system_program] = accounts else { + return Err(ProgramError::NotEnoughAccountKeys); + }; + + payer.is_writable()?.is_signer()?; // make use payer is writable and signer + system_program.is_program(&system_program::ID)?; // system program check + counter_account + .is_writable()? // check the account is writable + .has_seeds(&[b"counter"], &crate::ID)?; // check the address is derived from the right seeds + + // create the counter account + create_account::( + counter_account, // account to be created + system_program, // system program + payer, // payer + &crate::ID, // program id + &[COUNTER_SEEDS], // seeds + )?; + + let counter = counter_account.as_account::(&crate::ID)?; + let count = counter.count; + + solana_program::msg!("Counter initialized! Count is {}", count); + + Ok(()) + } +} + +instruction!(CounterInstruction, Increment); +// Increment +#[repr(C, packed)] +#[derive(Clone, Copy, Debug, Pod, Zeroable)] +pub struct Increment {} + +impl Increment { + pub fn process(accounts: &[AccountInfo<'_>]) -> ProgramResult { + let [counter_account] = accounts else { + return Err(ProgramError::NotEnoughAccountKeys); + }; + + counter_account + .is_writable()? // check the account is writable + .has_seeds(&[COUNTER_SEEDS], &crate::ID)?; // check the address is derived from the right seeds + + let counter = counter_account.as_account_mut::(&crate::ID)?; + counter.count += 1; + + let count = counter.count; + + solana_program::msg!("Counter state incremented to {:?}", count); + + Ok(()) + } +} diff --git a/basics/counter/steel/api/src/lib.rs b/basics/counter/steel/api/src/lib.rs new file mode 100644 index 000000000..0fbc5f88f --- /dev/null +++ b/basics/counter/steel/api/src/lib.rs @@ -0,0 +1,13 @@ +pub mod consts; +pub mod instruction; +pub mod state; + +pub mod prelude { + pub use crate::consts::*; + pub use crate::instruction::*; + pub use crate::state::*; +} + +use steel::*; + +declare_id!("z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35"); diff --git a/basics/counter/steel/api/src/state.rs b/basics/counter/steel/api/src/state.rs new file mode 100644 index 000000000..775ac93b5 --- /dev/null +++ b/basics/counter/steel/api/src/state.rs @@ -0,0 +1,15 @@ +use steel::*; + +#[repr(u8)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)] +pub enum CounterAccount { + Counter = 0, +} + +account!(CounterAccount, Counter); +// Counter +#[repr(C, packed)] +#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] +pub struct Counter { + pub count: u64, +} diff --git a/basics/counter/steel/program/Cargo.toml b/basics/counter/steel/program/Cargo.toml index 7ac1eb535..7153fd647 100644 --- a/basics/counter/steel/program/Cargo.toml +++ b/basics/counter/steel/program/Cargo.toml @@ -4,10 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -solana-program = "=1.18.17" -steel = "2.1" -bytemuck = "1.4" -num_enum = "0.7" +steel.workspace = true +counter-solana-steel-api = {path = "../api"} [lib] crate-type = ["cdylib", "lib"] diff --git a/basics/counter/steel/program/src/lib.rs b/basics/counter/steel/program/src/lib.rs index 5200b8375..d9882d6ad 100644 --- a/basics/counter/steel/program/src/lib.rs +++ b/basics/counter/steel/program/src/lib.rs @@ -1,7 +1,6 @@ +use counter_solana_steel_api::prelude::*; use steel::*; -declare_id!("z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35"); - entrypoint!(process_instruction); pub fn process_instruction( @@ -9,96 +8,10 @@ pub fn process_instruction( accounts: &[AccountInfo], data: &[u8], ) -> ProgramResult { - let (ix, _data) = parse_instruction(&crate::ID, program_id, data)?; + let (ix, _data) = parse_instruction(&counter_solana_steel_api::ID, program_id, data)?; match ix { CounterInstruction::Initialize => Initialize::process(accounts), CounterInstruction::Increment => Increment::process(accounts), } } - -#[repr(u8)] -#[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)] -pub enum CounterInstruction { - Initialize = 0, - Increment = 1, -} - -instruction!(CounterInstruction, Initialize); -// Initialize -#[repr(C, packed)] -#[derive(Clone, Copy, Debug, Pod, Zeroable)] -pub struct Initialize {} - -impl Initialize { - pub fn process(accounts: &[AccountInfo<'_>]) -> ProgramResult { - let [counter_account, payer, system_program] = accounts else { - return Err(ProgramError::NotEnoughAccountKeys); - }; - - payer.is_writable()?.is_signer()?; // make use payer is writable and signer - system_program.is_program(&system_program::ID)?; // system program check - counter_account - .is_writable()? // check the account is writable - .has_seeds(&[b"counter"], &crate::ID)?; // check the address is derived from the right seeds - - // create the counter account - create_account::( - counter_account, // account to be created - system_program, // system program - payer, // payer - &crate::ID, // program id - &[COUNTER_SEEDS], // seeds - )?; - - let counter = counter_account.as_account::(&crate::ID)?; - let count = counter.count; - - solana_program::msg!("Counter initialized! Count is {}", count); - - Ok(()) - } -} - -instruction!(CounterInstruction, Increment); -// Increment -#[repr(C, packed)] -#[derive(Clone, Copy, Debug, Pod, Zeroable)] -pub struct Increment {} - -impl Increment { - pub fn process(accounts: &[AccountInfo<'_>]) -> ProgramResult { - let [counter_account] = accounts else { - return Err(ProgramError::NotEnoughAccountKeys); - }; - - counter_account - .is_writable()? // check the account is writable - .has_seeds(&[COUNTER_SEEDS], &crate::ID)?; // check the address is derived from the right seeds - - let counter = counter_account.as_account_mut::(&crate::ID)?; - counter.count += 1; - - let count = counter.count; - - solana_program::msg!("Counter state incremented to {:?}", count); - - Ok(()) - } -} - -#[repr(u8)] -#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)] -pub enum CounterAccount { - Counter = 0, -} - -account!(CounterAccount, Counter); -// Counter -#[repr(C, packed)] -#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)] -pub struct Counter { - pub count: u64, -} - -pub const COUNTER_SEEDS: &[u8] = b"counter"; // counter seeds