Quellcode durchsuchen

p-token: Add scripts (#27)

* Update workspace

* Rename interface crate

* Add readme

* Update cargo lock

* Update workspace

* Fix spelling

* Fix clippy warning

* Fix p-token binary name

* Add p-token scripts
Fernando Otero vor 7 Monaten
Ursprung
Commit
08540e264e

+ 1 - 1
interface/README.md

@@ -22,4 +22,4 @@ This will add the `spl-token-interface` dependency to your `Cargo.toml` file.
 
 ## Documentation
 
-Read more about the SPL Token program on the crate [documentation](https://docs.rs/spl-token-interface).
+Read more about the SPL Token interface on the crate [documentation](https://docs.rs/spl-token-interface).

+ 1 - 1
p-token/tests/amount_to_ui_amount.rs

@@ -9,7 +9,7 @@ use solana_sdk::{pubkey::Pubkey, signature::Signer, transaction::Transaction};
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn amount_to_ui_amount(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/approve.rs

@@ -14,7 +14,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn approve(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/approve_checked.rs

@@ -14,7 +14,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn approve_checked(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/burn.rs

@@ -14,7 +14,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn burn(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/burn_checked.rs

@@ -14,7 +14,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn burn_checked(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/close_account.rs

@@ -13,7 +13,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn close_account(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/freeze_account.rs

@@ -15,7 +15,7 @@ use spl_token::state::AccountState;
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn freeze_account(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/initialize_account.rs

@@ -15,7 +15,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn initialize_account(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/initialize_account2.rs

@@ -15,7 +15,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn initialize_account2(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/initialize_account3.rs

@@ -15,7 +15,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn initialize_account3(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/initialize_mint.rs

@@ -19,7 +19,7 @@ use spl_token_interface::state::mint::Mint;
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn initialize_mint(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/initialize_mint2.rs

@@ -19,7 +19,7 @@ use spl_token_interface::state::mint::Mint;
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn initialize_mint2(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/initialize_multisig.rs

@@ -16,7 +16,7 @@ use spl_token::state::Multisig;
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn initialize_multisig(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/initialize_multisig2.rs

@@ -16,7 +16,7 @@ use spl_token::state::Multisig;
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn initialize_multisig2(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/mint_to.rs

@@ -14,7 +14,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn mint_to(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/mint_to_checked.rs

@@ -14,7 +14,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn mint_to_checked(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/revoke.rs

@@ -14,7 +14,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn revoke(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/set_authority.rs

@@ -16,7 +16,7 @@ use spl_token::instruction::AuthorityType;
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn set_authority(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/thaw_account.rs

@@ -15,7 +15,7 @@ use spl_token::state::AccountState;
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn thaw_account(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/transfer.rs

@@ -14,7 +14,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn transfer(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/transfer_checked.rs

@@ -14,7 +14,7 @@ use solana_sdk::{
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn transfer_checked(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 1 - 1
p-token/tests/ui_amount_to_amount.rs

@@ -9,7 +9,7 @@ use solana_sdk::{pubkey::Pubkey, signature::Signer, transaction::Transaction};
 #[test_case::test_case(TOKEN_PROGRAM_ID ; "p-token")]
 #[tokio::test]
 async fn ui_amount_to_amount(token_program: Pubkey) {
-    let mut context = ProgramTest::new("token_program", TOKEN_PROGRAM_ID, None)
+    let mut context = ProgramTest::new("pinocchio_token_program", TOKEN_PROGRAM_ID, None)
         .start_with_context()
         .await;
 

+ 3 - 1
package.json

@@ -23,7 +23,9 @@
     "rust:spellcheck": "cargo spellcheck --code 1",
     "rust:audit": "zx ./scripts/rust/audit.mjs",
     "rust:publish": "zx ./scripts/rust/publish.mjs",
-    "rust:semver": "cargo semver-checks"
+    "rust:semver": "cargo semver-checks",
+    "p-token:build": "zx ./scripts/rust/build-sbf.mjs p-token",
+    "p-token:test": "zx ./scripts/rust/test-sbf.mjs p-token"
   },
   "devDependencies": {
     "@codama/renderers-js": "^1.2.7",