cheatcodes.adl
1 program test.alpha { 2 3 async transition main() -> Future { 4 assert_eq(self.signer, ax1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px); 5 assert_eq(self.caller, ax1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px); 6 7 // Setting the signer directly in a transition doesn't really make sense. 8 // Note that while the signer is set, the caller remains unchanged because we are already in the context of a transition. 9 // Setting the signer will come in handy once we support transaction generation and broadcast in a script. 10 11 CheatCode::set_signer("APrivateKey1zkp3Y81VuFryWBXTJ4w4owHmMWq9tg35hN5tst1sYJv2N27"); 12 assert_eq(self.signer, ax1wdune9hwf9ulz75rlus3sv5a978zfkezm8rnzk56qxrjg42gavrq8tz70m); 13 assert_eq(self.caller, ax1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px); 14 15 CheatCode::set_signer("APrivateKey1zkpJ5TGNDDiqSm71AcCpdarxZLHymvUFfkpAGprEUPQqDZp"); 16 assert_eq(self.signer, ax1njwre8svpvn8jytkldyj3x45ewnks44qkuvasf290399768fayqs7h0yru); 17 assert_eq(self.caller, ax1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px); 18 19 return finish(); 20 } 21 22 async function finish() { 23 CheatCode::set_block_height(1u32); 24 assert_eq(block.height, 1u32); 25 CheatCode::set_block_height(999u32); 26 assert_eq(block.height, 999u32); 27 28 CheatCode::set_block_timestamp(1i64); 29 assert_eq(block.timestamp, 1i64); 30 CheatCode::set_block_timestamp(999i64); 31 assert_eq(block.timestamp, 999i64); 32 } 33 }