Skip to content

Commit

Permalink
Fix puppet test
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Sep 27, 2024
1 parent 89eaccf commit 156a491
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 59 deletions.
2 changes: 1 addition & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ fn dev_create_activated_device(args: DevCreateActivatedDeviceCliArgs) {
eprintln!("Device: {}", device_pubkey);
eprintln!("Mint: {}", did_mint_pubkey);
eprintln!("AToken: {}", did_atoken_pubkey);
println!("{},{}", did_mint_pubkey, did_atoken_pubkey);
println!("{},{},{}", device_pubkey, did_mint_pubkey, did_atoken_pubkey);
}
Err(err) => {
eprintln!("Error: {:?}", err);
Expand Down
106 changes: 53 additions & 53 deletions extensions/puppet/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions extensions/puppet/programs/puppet/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anchor_lang::prelude::Pubkey;

pub const DEPHY_ID_PROGRAM: Pubkey = Pubkey::new_from_array([10, 104, 87, 71, 135, 225, 232, 69, 21, 185, 195, 236, 216, 23, 119, 79, 176, 27, 100, 193, 237, 38, 213, 50, 121, 184, 103, 109, 227, 77, 99, 44]);
pub const SPL_2022_PROGRAM: Pubkey = Pubkey::new_from_array([6, 221, 246, 225, 238, 117, 143, 222, 24, 66, 93, 188, 228, 108, 205, 218, 182, 26, 252, 77, 131, 185, 13, 39, 254, 189, 249, 40, 216, 161, 139, 252]);
pub const DEPHY_ID_PROGRAM: Pubkey = Pubkey::new_from_array([10u8, 104u8, 87u8, 71u8, 135u8, 225u8, 232u8, 69u8, 21u8, 185u8, 195u8, 236u8, 216u8, 23u8, 119u8, 79u8, 176u8, 27u8, 100u8, 193u8, 237u8, 38u8, 213u8, 50u8, 121u8, 184u8, 103u8, 109u8, 227u8, 77u8, 99u8, 44u8]);
pub const SPL_2022_PROGRAM: Pubkey = Pubkey::new_from_array([6u8, 221u8, 246u8, 225u8, 238u8, 117u8, 143u8, 222u8, 24u8, 66u8, 93u8, 188u8, 228u8, 108u8, 205u8, 218u8, 182u8, 26u8, 252u8, 77u8, 131u8, 185u8, 13u8, 39u8, 254u8, 189u8, 249u8, 40u8, 216u8, 161u8, 139u8, 252u8]);
pub const PRODUCT_MINT_SEED_PREFIX: &[u8; 16] = b"DePHY_ID-PRODUCT";
pub const DEVICE_MINT_SEED_PREFIX: &[u8; 15] = b"DePHY_ID-DEVICE";
8 changes: 5 additions & 3 deletions extensions/puppet/tests/puppet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ describe("puppet program", () => {

// write device secret key json
const deviceKeypair = Keypair.generate();
device = new PublicKey(deviceKeypair.publicKey);
fs.writeFileSync(DEVICE_PATH, `[${deviceKeypair.secretKey.toString()}]`);

// create product
Expand All @@ -84,11 +83,13 @@ describe("puppet program", () => {
product = new PublicKey(productPubkeyStr);

// create activated device
const { deviceMint: deviceMintStr, deviceAta: deviceAtaStr } = await createDevice(
const { devicePubKey: devicePubKeyStr, deviceMint: deviceMintStr, deviceAta: deviceAtaStr } = await createDevice(
product.toString(),
);
console.log("devicePubKey:", devicePubKeyStr);
console.log("deviceMint:", deviceMintStr);
console.log("deviceAta:", deviceAtaStr);
device = new PublicKey(devicePubKeyStr);
deviceMint = new PublicKey(deviceMintStr);
deviceAta = new PublicKey(deviceAtaStr);

Expand Down Expand Up @@ -240,9 +241,10 @@ const createDevice = async (
command,
);

const [deviceMint, deviceAta] = str.trimEnd().split(',')
const [devicePubKey, deviceMint, deviceAta] = str.trimEnd().split(',')

return {
devicePubKey,
deviceMint,
deviceAta,
};
Expand Down

0 comments on commit 156a491

Please sign in to comment.