@@ -3146,13 +3146,14 @@ fn validate_signature() {
3146
3146
let user_1_pair = sp_core:: sr25519:: Pair :: from_string ( "//Alice" , None ) . unwrap ( ) ;
3147
3147
let user_1_signer = MultiSigner :: Sr25519 ( user_1_pair. public ( ) ) ;
3148
3148
let user_1 = user_1_signer. clone ( ) . into_account ( ) ;
3149
- let mint_data: PreSignedMint < u32 , u32 , AccountId , u32 > = PreSignedMint {
3149
+ let mint_data: PreSignedMint < u32 , u32 , AccountId , u32 , u64 > = PreSignedMint {
3150
3150
collection : 0 ,
3151
3151
item : 0 ,
3152
3152
attributes : vec ! [ ] ,
3153
3153
metadata : vec ! [ ] ,
3154
3154
only_account : None ,
3155
3155
deadline : 100000 ,
3156
+ mint_price : None ,
3156
3157
} ;
3157
3158
let encoded_data = Encode :: encode ( & mint_data) ;
3158
3159
let signature = MultiSignature :: Sr25519 ( user_1_pair. sign ( & encoded_data) ) ;
@@ -3182,6 +3183,7 @@ fn pre_signed_mints_should_work() {
3182
3183
metadata : vec ! [ 0 , 1 ] ,
3183
3184
only_account : None ,
3184
3185
deadline : 10000000 ,
3186
+ mint_price : Some ( 10 ) ,
3185
3187
} ;
3186
3188
let message = Encode :: encode ( & mint_data) ;
3187
3189
let signature = MultiSignature :: Sr25519 ( user_1_pair. sign ( & message) ) ;
@@ -3198,7 +3200,7 @@ fn pre_signed_mints_should_work() {
3198
3200
3199
3201
assert_ok ! ( Nfts :: mint_pre_signed(
3200
3202
RuntimeOrigin :: signed( user_2. clone( ) ) ,
3201
- mint_data. clone( ) ,
3203
+ Box :: new ( mint_data. clone( ) ) ,
3202
3204
signature. clone( ) ,
3203
3205
user_1. clone( ) ,
3204
3206
) ) ;
@@ -3228,21 +3230,21 @@ fn pre_signed_mints_should_work() {
3228
3230
assert_eq ! ( deposit. account, Some ( user_2. clone( ) ) ) ;
3229
3231
assert_eq ! ( deposit. amount, 3 ) ;
3230
3232
3231
- assert_eq ! ( Balances :: free_balance( & user_0) , 100 - 2 ) ; // 2 - collection deposit
3232
- assert_eq ! ( Balances :: free_balance( & user_2) , 100 - 1 - 3 - 6 ) ; // 1 - item deposit, 3 - metadata, 6 - attributes
3233
+ assert_eq ! ( Balances :: free_balance( & user_0) , 100 - 2 + 10 ) ; // 2 - collection deposit, 10 - mint price
3234
+ assert_eq ! ( Balances :: free_balance( & user_2) , 100 - 1 - 3 - 6 - 10 ) ; // 1 - item deposit, 3 - metadata, 6 - attributes, 10 - mint price
3233
3235
3234
3236
assert_noop ! (
3235
3237
Nfts :: mint_pre_signed(
3236
3238
RuntimeOrigin :: signed( user_2. clone( ) ) ,
3237
- mint_data,
3239
+ Box :: new ( mint_data) ,
3238
3240
signature. clone( ) ,
3239
3241
user_1. clone( ) ,
3240
3242
) ,
3241
3243
Error :: <Test >:: AlreadyExists
3242
3244
) ;
3243
3245
3244
3246
assert_ok ! ( Nfts :: burn( RuntimeOrigin :: signed( user_2. clone( ) ) , 0 , 0 ) ) ;
3245
- assert_eq ! ( Balances :: free_balance( & user_2) , 100 - 6 ) ;
3247
+ assert_eq ! ( Balances :: free_balance( & user_2) , 100 - 6 - 10 ) ;
3246
3248
3247
3249
// validate the `only_account` field
3248
3250
let mint_data = PreSignedMint {
@@ -3252,13 +3254,14 @@ fn pre_signed_mints_should_work() {
3252
3254
metadata : vec ! [ ] ,
3253
3255
only_account : Some ( account ( 2 ) ) ,
3254
3256
deadline : 10000000 ,
3257
+ mint_price : None ,
3255
3258
} ;
3256
3259
3257
3260
// can't mint with the wrong signature
3258
3261
assert_noop ! (
3259
3262
Nfts :: mint_pre_signed(
3260
3263
RuntimeOrigin :: signed( user_2. clone( ) ) ,
3261
- mint_data. clone( ) ,
3264
+ Box :: new ( mint_data. clone( ) ) ,
3262
3265
signature. clone( ) ,
3263
3266
user_1. clone( ) ,
3264
3267
) ,
@@ -3271,7 +3274,7 @@ fn pre_signed_mints_should_work() {
3271
3274
assert_noop ! (
3272
3275
Nfts :: mint_pre_signed(
3273
3276
RuntimeOrigin :: signed( user_3) ,
3274
- mint_data. clone( ) ,
3277
+ Box :: new ( mint_data. clone( ) ) ,
3275
3278
signature. clone( ) ,
3276
3279
user_1. clone( ) ,
3277
3280
) ,
@@ -3283,7 +3286,7 @@ fn pre_signed_mints_should_work() {
3283
3286
assert_noop ! (
3284
3287
Nfts :: mint_pre_signed(
3285
3288
RuntimeOrigin :: signed( user_2. clone( ) ) ,
3286
- mint_data,
3289
+ Box :: new ( mint_data) ,
3287
3290
signature,
3288
3291
user_1. clone( ) ,
3289
3292
) ,
@@ -3299,14 +3302,15 @@ fn pre_signed_mints_should_work() {
3299
3302
metadata : vec ! [ ] ,
3300
3303
only_account : Some ( account ( 2 ) ) ,
3301
3304
deadline : 10000000 ,
3305
+ mint_price : None ,
3302
3306
} ;
3303
3307
let message = Encode :: encode ( & mint_data) ;
3304
3308
let signature = MultiSignature :: Sr25519 ( user_1_pair. sign ( & message) ) ;
3305
3309
3306
3310
assert_noop ! (
3307
3311
Nfts :: mint_pre_signed(
3308
3312
RuntimeOrigin :: signed( user_2. clone( ) ) ,
3309
- mint_data,
3313
+ Box :: new ( mint_data) ,
3310
3314
signature,
3311
3315
user_1. clone( ) ,
3312
3316
) ,
@@ -3321,13 +3325,14 @@ fn pre_signed_mints_should_work() {
3321
3325
metadata : vec ! [ 0 , 1 ] ,
3322
3326
only_account : None ,
3323
3327
deadline : 10000000 ,
3328
+ mint_price : None ,
3324
3329
} ;
3325
3330
let message = Encode :: encode ( & mint_data) ;
3326
3331
let signature = MultiSignature :: Sr25519 ( user_1_pair. sign ( & message) ) ;
3327
3332
assert_noop ! (
3328
3333
Nfts :: mint_pre_signed(
3329
3334
RuntimeOrigin :: signed( user_2) ,
3330
- mint_data,
3335
+ Box :: new ( mint_data) ,
3331
3336
signature,
3332
3337
user_1. clone( ) ,
3333
3338
) ,
0 commit comments