@@ -740,6 +740,58 @@ fn test_sign_transfer_kusama_new_spec() {
740740 assert_eq ! ( signed. as_deref( ) , Some ( "450284009dca538b7a925b8ea979cc546464a3c5f81d2398a3a272f6f93bdf4803f2f78300fc5a463d3b6972ac7e0b701110f9d95d377be5b6a2f356765553104c04765fc0066c235c11dabde650d487760dc310003d607abceaf85a0a0f47f1a90e3680029501590200000400001a2447c661c9b168bba4a2a178baef7d79eee006c1d145ffc832be76ff6ee9ce0300943577" ) ) ;
741741}
742742
743+ #[ test]
744+ fn test_sign_transfer_kusama_asset_hub ( ) {
745+ let block_hash = "0xa08d580076533e7262904ea3105c7abb1923e10b4a44c2b8e2121fca23c99d63"
746+ . decode_hex ( )
747+ . unwrap ( ) ;
748+ let block_number = 11410063 ;
749+ let genesis_hash = "0x48239ef607d7928874027a43a67689209727dfb3d3dc5e5b03a39bdc2eda771a"
750+ . decode_hex ( )
751+ . unwrap ( ) ;
752+ // GtrrH11FcafS3wNr59t5PwZSr94Zatc3nj1dTN1ET3drJ5k
753+ let private_key = "f5636ddc5583a9d3f95748328b56f36b5a4197f9b8473c546378eee3648b070f"
754+ . decode_hex ( )
755+ . unwrap ( ) ;
756+
757+ let input = Proto :: SigningInput {
758+ network : 2 ,
759+ private_key : private_key. into ( ) ,
760+ multi_address : false ,
761+ nonce : 1 ,
762+ block_hash : block_hash. into ( ) ,
763+ genesis_hash : genesis_hash. into ( ) ,
764+ spec_version : 1009002 ,
765+ transaction_version : 15 ,
766+ charge_native_as_asset_tx_payment : true ,
767+ era : Some ( Proto :: Era {
768+ block_number,
769+ period : 64 ,
770+ } ) ,
771+ message_oneof : balance_call ( Proto :: mod_Balance:: OneOfmessage_oneof :: transfer (
772+ Proto :: mod_Balance:: Transfer {
773+ to_address : "DrRsYwWQN4QH6RCqyw5xLJbq8V37NodsJjuWKhMhx1GnJm1" . into ( ) ,
774+ value : Cow :: Owned ( U256 :: from ( 90_000_000_000u64 ) . to_big_endian ( ) . to_vec ( ) ) , // 0.09
775+ call_indices : Some ( Proto :: CallIndices {
776+ variant : Proto :: mod_CallIndices:: OneOfvariant :: custom (
777+ Proto :: CustomCallIndices {
778+ module_index : 0x0A , // Balances pallet
779+ method_index : 0x00 , // transfer_allow_death
780+ } ,
781+ ) ,
782+ } ) ,
783+ ..Default :: default ( )
784+ } ,
785+ ) ) ,
786+ ..Default :: default ( )
787+ } ;
788+
789+ let ( _preimage, signed) = helper_encode_and_maybe_sign ( CoinType :: Polkadot , input) ;
790+ // Successfully broadcasted tx:
791+ // https://assethub-kusama.subscan.io/extrinsic/0xc3dd4b245cbd31ca0b6ea17ad1f7aad12b5984e705da1bee8b127e1d338301a4
792+ assert_eq ! ( signed. as_deref( ) , Some ( "49028400bf14d379a6d161a3cfcbb12dc1ae6c9a5e89c9c22924060e8fecab41e6124acf00a26875c8f4f1760319ffaa1a4a44d0841fec3a7d7abf0c820ac931574e18cda960bedbc32886fc9d050b4ebf291db1ded94e6ee55cfb83372cc800fceeacea03f500040000000a000038858d284516bcf0991d66e09c18815afb33c22f1d0d29cf43be56debd5777610700046bf414" ) ) ;
793+ }
794+
743795// TEST(PolkadotExtrinsic, Polkadot_EncodePayloadWithNewSpec)
744796#[ test]
745797fn test_encode_payload_with_new_spec ( ) {
0 commit comments