@exodus/web3-ethereum 12.22.0-rc.0 → 12.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3118,7 +3118,7 @@ export function parseAndValidateTypedData(value) {
3118
3118
  }
3119
3119
  }
3120
3120
  for (const key7 of Object.keys(data)) {
3121
- const sub18 = (() => {
3121
+ const sub16 = (() => {
3122
3122
  if (
3123
3123
  !(
3124
3124
  typeof data[key7] === 'object' &&
@@ -3130,85 +3130,85 @@ export function parseAndValidateTypedData(value) {
3130
3130
  return false
3131
3131
  return true
3132
3132
  })()
3133
- const sub19 = (() => {
3133
+ const sub17 = (() => {
3134
3134
  if (!(typeof data[key7] === 'boolean')) return false
3135
3135
  return true
3136
3136
  })()
3137
- const sub20 = (() => {
3137
+ const sub18 = (() => {
3138
3138
  if (!Number.isInteger(data[key7])) return false
3139
3139
  return true
3140
3140
  })()
3141
- const sub21 = (() => {
3141
+ const sub19 = (() => {
3142
3142
  if (!(typeof data[key7] === 'number')) return false
3143
3143
  return true
3144
3144
  })()
3145
- const sub22 = (() => {
3145
+ const sub20 = (() => {
3146
3146
  if (!(typeof data[key7] === 'string')) return false
3147
3147
  if (!format2.test(data[key7])) return false
3148
3148
  return true
3149
3149
  })()
3150
- const sub23 = (() => {
3150
+ const sub21 = (() => {
3151
3151
  if (!(typeof data[key7] === 'string')) return false
3152
3152
  if (data[key7].length > 100 && stringLength(data[key7]) > 100)
3153
3153
  return false
3154
3154
  if (!format3.test(data[key7])) return false
3155
3155
  return true
3156
3156
  })()
3157
- const sub24 = (() => {
3157
+ const sub22 = (() => {
3158
3158
  if (!Array.isArray(data[key7])) return false
3159
- for (let o = 0; o < data[key7].length; o++) {
3160
- if (data[key7][o] !== undefined && hasOwn(data[key7], o)) {
3161
- const sub25 = (() => {
3162
- if (!(typeof data[key7][o] === 'string')) return false
3163
- if (!format4.test(data[key7][o])) return false
3159
+ for (let l = 0; l < data[key7].length; l++) {
3160
+ if (data[key7][l] !== undefined && hasOwn(data[key7], l)) {
3161
+ const sub23 = (() => {
3162
+ if (!(typeof data[key7][l] === 'string')) return false
3163
+ if (!format4.test(data[key7][l])) return false
3164
3164
  return true
3165
3165
  })()
3166
- const sub26 = (() => {
3167
- if (!(typeof data[key7][o] === 'string')) return false
3168
- if (!format2.test(data[key7][o])) return false
3166
+ const sub24 = (() => {
3167
+ if (!(typeof data[key7][l] === 'string')) return false
3168
+ if (!format2.test(data[key7][l])) return false
3169
3169
  return true
3170
3170
  })()
3171
- const sub27 = (() => {
3172
- if (!(typeof data[key7][o] === 'string')) return false
3171
+ const sub25 = (() => {
3172
+ if (!(typeof data[key7][l] === 'string')) return false
3173
3173
  if (
3174
- data[key7][o].length > 100 &&
3175
- stringLength(data[key7][o]) > 100
3174
+ data[key7][l].length > 100 &&
3175
+ stringLength(data[key7][l]) > 100
3176
3176
  )
3177
3177
  return false
3178
- if (!format3.test(data[key7][o])) return false
3178
+ if (!format3.test(data[key7][l])) return false
3179
3179
  return true
3180
3180
  })()
3181
- const sub28 = (() => {
3182
- const err5 = validate.errors
3183
- const res5 = validate(data[key7][o])
3184
- const suberr5 = validate.errors
3185
- validate.errors = err5
3186
- if (!res5) return false
3181
+ const sub26 = (() => {
3182
+ const err2 = validate.errors
3183
+ const res2 = validate(data[key7][l])
3184
+ const suberr2 = validate.errors
3185
+ validate.errors = err2
3186
+ if (!res2) return false
3187
3187
  return true
3188
3188
  })()
3189
- if (!(sub25 || sub26 || sub27 || sub28)) return false
3189
+ if (!(sub23 || sub24 || sub25 || sub26)) return false
3190
3190
  }
3191
3191
  }
3192
3192
  return true
3193
3193
  })()
3194
- const sub29 = (() => {
3195
- const err6 = validate.errors
3196
- const res6 = validate(data[key7])
3197
- const suberr6 = validate.errors
3198
- validate.errors = err6
3199
- if (!res6) return false
3194
+ const sub27 = (() => {
3195
+ const err3 = validate.errors
3196
+ const res3 = validate(data[key7])
3197
+ const suberr3 = validate.errors
3198
+ validate.errors = err3
3199
+ if (!res3) return false
3200
3200
  return true
3201
3201
  })()
3202
3202
  if (
3203
3203
  !(
3204
+ sub16 ||
3205
+ sub17 ||
3204
3206
  sub18 ||
3205
3207
  sub19 ||
3206
3208
  sub20 ||
3207
3209
  sub21 ||
3208
3210
  sub22 ||
3209
- sub23 ||
3210
- sub24 ||
3211
- sub29
3211
+ sub27
3212
3212
  )
3213
3213
  ) {
3214
3214
  validate.errors = [
@@ -3288,219 +3288,67 @@ export function parseAndValidateTypedData(value) {
3288
3288
  }
3289
3289
  }
3290
3290
  if (
3291
- data.types.EIP712Domain !== undefined &&
3292
- hasOwn(data.types, 'EIP712Domain')
3291
+ !(
3292
+ data.types.EIP712Domain !== undefined &&
3293
+ hasOwn(data.types, 'EIP712Domain')
3294
+ )
3293
3295
  ) {
3294
- if (!Array.isArray(data.types.EIP712Domain)) {
3295
- validate.errors = [
3296
- {
3297
- keywordLocation:
3298
- '#/properties/types/properties/EIP712Domain/type',
3299
- instanceLocation: '#/types/EIP712Domain',
3300
- },
3301
- ]
3302
- return false
3303
- }
3304
- for (let i = 0; i < data.types.EIP712Domain.length; i++) {
3305
- if (
3306
- data.types.EIP712Domain[i] !== undefined &&
3307
- hasOwn(data.types.EIP712Domain, i)
3308
- ) {
3309
- const err0 = validate.errors
3310
- const res0 = ref2(data.types.EIP712Domain[i])
3311
- const suberr0 = ref2.errors
3312
- validate.errors = err0
3313
- if (!res0) {
3314
- validate.errors = [
3315
- errorMerge(
3316
- suberr0[0],
3317
- '#/properties/types/properties/EIP712Domain/items/$ref',
3318
- '#/types/EIP712Domain/' + i,
3319
- ),
3320
- ]
3321
- return false
3322
- }
3323
- if (
3324
- !(
3325
- typeof data.types.EIP712Domain[i] === 'object' &&
3326
- data.types.EIP712Domain[i] &&
3327
- !Array.isArray(data.types.EIP712Domain[i])
3328
- )
3329
- ) {
3330
- validate.errors = [
3331
- {
3332
- keywordLocation:
3333
- '#/properties/types/properties/EIP712Domain/items/type',
3334
- instanceLocation: '#/types/EIP712Domain/' + i,
3335
- },
3336
- ]
3337
- return false
3338
- }
3339
- }
3340
- }
3296
+ validate.errors = [
3297
+ {
3298
+ keywordLocation: '#/properties/types/required',
3299
+ instanceLocation: '#/types/EIP712Domain',
3300
+ },
3301
+ ]
3302
+ return false
3341
3303
  }
3342
- if (
3343
- data.types.OrderComponents !== undefined &&
3344
- hasOwn(data.types, 'OrderComponents')
3345
- ) {
3346
- if (!Array.isArray(data.types.OrderComponents)) {
3347
- validate.errors = [
3348
- {
3349
- keywordLocation:
3350
- '#/properties/types/properties/OrderComponents/type',
3351
- instanceLocation: '#/types/OrderComponents',
3352
- },
3353
- ]
3354
- return false
3355
- }
3356
- for (let j = 0; j < data.types.OrderComponents.length; j++) {
3357
- if (
3358
- data.types.OrderComponents[j] !== undefined &&
3359
- hasOwn(data.types.OrderComponents, j)
3360
- ) {
3361
- const err1 = validate.errors
3362
- const res1 = ref2(data.types.OrderComponents[j])
3363
- const suberr1 = ref2.errors
3364
- validate.errors = err1
3365
- if (!res1) {
3366
- validate.errors = [
3367
- errorMerge(
3368
- suberr1[0],
3369
- '#/properties/types/properties/OrderComponents/items/$ref',
3370
- '#/types/OrderComponents/' + j,
3371
- ),
3372
- ]
3373
- return false
3374
- }
3375
- if (
3376
- !(
3377
- typeof data.types.OrderComponents[j] === 'object' &&
3378
- data.types.OrderComponents[j] &&
3379
- !Array.isArray(data.types.OrderComponents[j])
3380
- )
3381
- ) {
3382
- validate.errors = [
3383
- {
3384
- keywordLocation:
3385
- '#/properties/types/properties/OrderComponents/items/type',
3386
- instanceLocation: '#/types/OrderComponents/' + j,
3387
- },
3388
- ]
3389
- return false
3390
- }
3391
- }
3392
- }
3304
+ if (!Array.isArray(data.types.EIP712Domain)) {
3305
+ validate.errors = [
3306
+ {
3307
+ keywordLocation: '#/properties/types/properties/EIP712Domain/type',
3308
+ instanceLocation: '#/types/EIP712Domain',
3309
+ },
3310
+ ]
3311
+ return false
3393
3312
  }
3394
- if (
3395
- data.types.OfferItem !== undefined &&
3396
- hasOwn(data.types, 'OfferItem')
3397
- ) {
3398
- if (!Array.isArray(data.types.OfferItem)) {
3399
- validate.errors = [
3400
- {
3401
- keywordLocation: '#/properties/types/properties/OfferItem/type',
3402
- instanceLocation: '#/types/OfferItem',
3403
- },
3404
- ]
3405
- return false
3406
- }
3407
- for (let k = 0; k < data.types.OfferItem.length; k++) {
3408
- if (
3409
- data.types.OfferItem[k] !== undefined &&
3410
- hasOwn(data.types.OfferItem, k)
3411
- ) {
3412
- const err2 = validate.errors
3413
- const res2 = ref2(data.types.OfferItem[k])
3414
- const suberr2 = ref2.errors
3415
- validate.errors = err2
3416
- if (!res2) {
3417
- validate.errors = [
3418
- errorMerge(
3419
- suberr2[0],
3420
- '#/properties/types/properties/OfferItem/items/$ref',
3421
- '#/types/OfferItem/' + k,
3422
- ),
3423
- ]
3424
- return false
3425
- }
3426
- if (
3427
- !(
3428
- typeof data.types.OfferItem[k] === 'object' &&
3429
- data.types.OfferItem[k] &&
3430
- !Array.isArray(data.types.OfferItem[k])
3431
- )
3432
- ) {
3433
- validate.errors = [
3434
- {
3435
- keywordLocation:
3436
- '#/properties/types/properties/OfferItem/items/type',
3437
- instanceLocation: '#/types/OfferItem/' + k,
3438
- },
3439
- ]
3440
- return false
3441
- }
3313
+ for (let i = 0; i < data.types.EIP712Domain.length; i++) {
3314
+ if (
3315
+ data.types.EIP712Domain[i] !== undefined &&
3316
+ hasOwn(data.types.EIP712Domain, i)
3317
+ ) {
3318
+ const err0 = validate.errors
3319
+ const res0 = ref2(data.types.EIP712Domain[i])
3320
+ const suberr0 = ref2.errors
3321
+ validate.errors = err0
3322
+ if (!res0) {
3323
+ validate.errors = [
3324
+ errorMerge(
3325
+ suberr0[0],
3326
+ '#/properties/types/properties/EIP712Domain/items/$ref',
3327
+ '#/types/EIP712Domain/' + i,
3328
+ ),
3329
+ ]
3330
+ return false
3442
3331
  }
3443
- }
3444
- }
3445
- if (
3446
- data.types.ConsiderationItem !== undefined &&
3447
- hasOwn(data.types, 'ConsiderationItem')
3448
- ) {
3449
- if (!Array.isArray(data.types.ConsiderationItem)) {
3450
- validate.errors = [
3451
- {
3452
- keywordLocation:
3453
- '#/properties/types/properties/ConsiderationItem/type',
3454
- instanceLocation: '#/types/ConsiderationItem',
3455
- },
3456
- ]
3457
- return false
3458
- }
3459
- for (let l = 0; l < data.types.ConsiderationItem.length; l++) {
3460
3332
  if (
3461
- data.types.ConsiderationItem[l] !== undefined &&
3462
- hasOwn(data.types.ConsiderationItem, l)
3333
+ !(
3334
+ typeof data.types.EIP712Domain[i] === 'object' &&
3335
+ data.types.EIP712Domain[i] &&
3336
+ !Array.isArray(data.types.EIP712Domain[i])
3337
+ )
3463
3338
  ) {
3464
- const err3 = validate.errors
3465
- const res3 = ref2(data.types.ConsiderationItem[l])
3466
- const suberr3 = ref2.errors
3467
- validate.errors = err3
3468
- if (!res3) {
3469
- validate.errors = [
3470
- errorMerge(
3471
- suberr3[0],
3472
- '#/properties/types/properties/ConsiderationItem/items/$ref',
3473
- '#/types/ConsiderationItem/' + l,
3474
- ),
3475
- ]
3476
- return false
3477
- }
3478
- if (
3479
- !(
3480
- typeof data.types.ConsiderationItem[l] === 'object' &&
3481
- data.types.ConsiderationItem[l] &&
3482
- !Array.isArray(data.types.ConsiderationItem[l])
3483
- )
3484
- ) {
3485
- validate.errors = [
3486
- {
3487
- keywordLocation:
3488
- '#/properties/types/properties/ConsiderationItem/items/type',
3489
- instanceLocation: '#/types/ConsiderationItem/' + l,
3490
- },
3491
- ]
3492
- return false
3493
- }
3339
+ validate.errors = [
3340
+ {
3341
+ keywordLocation:
3342
+ '#/properties/types/properties/EIP712Domain/items/type',
3343
+ instanceLocation: '#/types/EIP712Domain/' + i,
3344
+ },
3345
+ ]
3346
+ return false
3494
3347
  }
3495
3348
  }
3496
3349
  }
3497
3350
  for (const key2 of Object.keys(data.types)) {
3498
- if (
3499
- key2 !== 'EIP712Domain' &&
3500
- key2 !== 'OrderComponents' &&
3501
- key2 !== 'OfferItem' &&
3502
- key2 !== 'ConsiderationItem'
3503
- ) {
3351
+ if (key2 !== 'EIP712Domain') {
3504
3352
  if (!Array.isArray(data.types[key2])) {
3505
3353
  validate.errors = [
3506
3354
  {
@@ -3510,21 +3358,21 @@ export function parseAndValidateTypedData(value) {
3510
3358
  ]
3511
3359
  return false
3512
3360
  }
3513
- for (let m = 0; m < data.types[key2].length; m++) {
3361
+ for (let j = 0; j < data.types[key2].length; j++) {
3514
3362
  if (
3515
- data.types[key2][m] !== undefined &&
3516
- hasOwn(data.types[key2], m)
3363
+ data.types[key2][j] !== undefined &&
3364
+ hasOwn(data.types[key2], j)
3517
3365
  ) {
3518
- const err4 = validate.errors
3519
- const res4 = ref2(data.types[key2][m])
3520
- const suberr4 = ref2.errors
3521
- validate.errors = err4
3522
- if (!res4) {
3366
+ const err1 = validate.errors
3367
+ const res1 = ref2(data.types[key2][j])
3368
+ const suberr1 = ref2.errors
3369
+ validate.errors = err1
3370
+ if (!res1) {
3523
3371
  validate.errors = [
3524
3372
  errorMerge(
3525
- suberr4[0],
3373
+ suberr1[0],
3526
3374
  '#/properties/types/additionalProperties/items/$ref',
3527
- '#/types/' + pointerPart(key2) + '/' + m,
3375
+ '#/types/' + pointerPart(key2) + '/' + j,
3528
3376
  ),
3529
3377
  ]
3530
3378
  return false
@@ -3533,38 +3381,6 @@ export function parseAndValidateTypedData(value) {
3533
3381
  }
3534
3382
  }
3535
3383
  }
3536
- let passes0 = 0
3537
- const sub0 = (() => {
3538
- if (
3539
- !(
3540
- data.types.EIP712Domain !== undefined &&
3541
- hasOwn(data.types, 'EIP712Domain')
3542
- )
3543
- )
3544
- return false
3545
- return true
3546
- })()
3547
- if (sub0) passes0++
3548
- const sub1 = (() => {
3549
- if (
3550
- !(
3551
- data.types.OrderComponents !== undefined &&
3552
- hasOwn(data.types, 'OrderComponents')
3553
- )
3554
- )
3555
- return false
3556
- return true
3557
- })()
3558
- if (sub1) passes0++
3559
- if (passes0 !== 1) {
3560
- validate.errors = [
3561
- {
3562
- keywordLocation: '#/properties/types/oneOf',
3563
- instanceLocation: '#/types',
3564
- },
3565
- ]
3566
- return false
3567
- }
3568
3384
  if (!(typeof data.primaryType === 'string')) {
3569
3385
  validate.errors = [
3570
3386
  {
@@ -3592,7 +3408,7 @@ export function parseAndValidateTypedData(value) {
3592
3408
  ]
3593
3409
  return false
3594
3410
  }
3595
- const sub2 = (() => {
3411
+ const sub0 = (() => {
3596
3412
  if (
3597
3413
  !(
3598
3414
  typeof data.domain === 'object' &&
@@ -3604,7 +3420,7 @@ export function parseAndValidateTypedData(value) {
3604
3420
  return false
3605
3421
  return true
3606
3422
  })()
3607
- const sub3 = (() => {
3423
+ const sub1 = (() => {
3608
3424
  if (
3609
3425
  !(
3610
3426
  typeof data.domain === 'object' &&
@@ -3635,25 +3451,25 @@ export function parseAndValidateTypedData(value) {
3635
3451
  data.domain.chainId !== undefined &&
3636
3452
  hasOwn(data.domain, 'chainId')
3637
3453
  ) {
3638
- let passes1 = 0
3639
- const sub4 = (() => {
3454
+ let passes0 = 0
3455
+ const sub2 = (() => {
3640
3456
  if (!Number.isInteger(data.domain.chainId)) return false
3641
3457
  return true
3642
3458
  })()
3643
- if (sub4) passes1++
3644
- const sub5 = (() => {
3459
+ if (sub2) passes0++
3460
+ const sub3 = (() => {
3645
3461
  if (!(typeof data.domain.chainId === 'string')) return false
3646
3462
  if (!pattern0.test(data.domain.chainId)) return false
3647
3463
  return true
3648
3464
  })()
3649
- if (sub5) passes1++
3650
- const sub6 = (() => {
3465
+ if (sub3) passes0++
3466
+ const sub4 = (() => {
3651
3467
  if (!(typeof data.domain.chainId === 'string')) return false
3652
3468
  if (!format2.test(data.domain.chainId)) return false
3653
3469
  return true
3654
3470
  })()
3655
- if (sub6) passes1++
3656
- if (passes1 !== 1) return false
3471
+ if (sub4) passes0++
3472
+ if (passes0 !== 1) return false
3657
3473
  }
3658
3474
  if (
3659
3475
  data.domain.verifyingContract !== undefined &&
@@ -3678,7 +3494,7 @@ export function parseAndValidateTypedData(value) {
3678
3494
  }
3679
3495
  return true
3680
3496
  })()
3681
- if (!(sub2 || sub3)) {
3497
+ if (!(sub0 || sub1)) {
3682
3498
  validate.errors = [
3683
3499
  {
3684
3500
  keywordLocation: '#/properties/domain/anyOf',
@@ -3723,7 +3539,7 @@ export function parseAndValidateTypedData(value) {
3723
3539
  }
3724
3540
  }
3725
3541
  for (const key5 of Object.keys(data.message)) {
3726
- const sub7 = (() => {
3542
+ const sub5 = (() => {
3727
3543
  if (
3728
3544
  !(
3729
3545
  typeof data.message[key5] === 'object' &&
@@ -3735,24 +3551,24 @@ export function parseAndValidateTypedData(value) {
3735
3551
  return false
3736
3552
  return true
3737
3553
  })()
3738
- const sub8 = (() => {
3554
+ const sub6 = (() => {
3739
3555
  if (!(typeof data.message[key5] === 'boolean')) return false
3740
3556
  return true
3741
3557
  })()
3742
- const sub9 = (() => {
3558
+ const sub7 = (() => {
3743
3559
  if (!Number.isInteger(data.message[key5])) return false
3744
3560
  return true
3745
3561
  })()
3746
- const sub10 = (() => {
3562
+ const sub8 = (() => {
3747
3563
  if (!(typeof data.message[key5] === 'number')) return false
3748
3564
  return true
3749
3565
  })()
3750
- const sub11 = (() => {
3566
+ const sub9 = (() => {
3751
3567
  if (!(typeof data.message[key5] === 'string')) return false
3752
3568
  if (!format2.test(data.message[key5])) return false
3753
3569
  return true
3754
3570
  })()
3755
- const sub12 = (() => {
3571
+ const sub10 = (() => {
3756
3572
  if (!(typeof data.message[key5] === 'string')) return false
3757
3573
  if (
3758
3574
  data.message[key5].length > 100 &&
@@ -3762,56 +3578,56 @@ export function parseAndValidateTypedData(value) {
3762
3578
  if (!format3.test(data.message[key5])) return false
3763
3579
  return true
3764
3580
  })()
3765
- const sub13 = (() => {
3581
+ const sub11 = (() => {
3766
3582
  if (!Array.isArray(data.message[key5])) return false
3767
- for (let n = 0; n < data.message[key5].length; n++) {
3583
+ for (let k = 0; k < data.message[key5].length; k++) {
3768
3584
  if (
3769
- data.message[key5][n] !== undefined &&
3770
- hasOwn(data.message[key5], n)
3585
+ data.message[key5][k] !== undefined &&
3586
+ hasOwn(data.message[key5], k)
3771
3587
  ) {
3772
- const sub14 = (() => {
3773
- if (!(typeof data.message[key5][n] === 'string')) return false
3774
- if (!format4.test(data.message[key5][n])) return false
3588
+ const sub12 = (() => {
3589
+ if (!(typeof data.message[key5][k] === 'string')) return false
3590
+ if (!format4.test(data.message[key5][k])) return false
3775
3591
  return true
3776
3592
  })()
3777
- const sub15 = (() => {
3778
- if (!(typeof data.message[key5][n] === 'string')) return false
3779
- if (!format2.test(data.message[key5][n])) return false
3593
+ const sub13 = (() => {
3594
+ if (!(typeof data.message[key5][k] === 'string')) return false
3595
+ if (!format2.test(data.message[key5][k])) return false
3780
3596
  return true
3781
3597
  })()
3782
- const sub16 = (() => {
3783
- if (!(typeof data.message[key5][n] === 'string')) return false
3598
+ const sub14 = (() => {
3599
+ if (!(typeof data.message[key5][k] === 'string')) return false
3784
3600
  if (
3785
- data.message[key5][n].length > 100 &&
3786
- stringLength(data.message[key5][n]) > 100
3601
+ data.message[key5][k].length > 100 &&
3602
+ stringLength(data.message[key5][k]) > 100
3787
3603
  )
3788
3604
  return false
3789
- if (!format3.test(data.message[key5][n])) return false
3605
+ if (!format3.test(data.message[key5][k])) return false
3790
3606
  return true
3791
3607
  })()
3792
- const sub17 = (() => {
3793
- const err7 = validate.errors
3794
- const res7 = ref3(data.message[key5][n])
3795
- const suberr7 = ref3.errors
3796
- validate.errors = err7
3797
- if (!res7) return false
3608
+ const sub15 = (() => {
3609
+ const err4 = validate.errors
3610
+ const res4 = ref3(data.message[key5][k])
3611
+ const suberr4 = ref3.errors
3612
+ validate.errors = err4
3613
+ if (!res4) return false
3798
3614
  return true
3799
3615
  })()
3800
- if (!(sub14 || sub15 || sub16 || sub17)) return false
3616
+ if (!(sub12 || sub13 || sub14 || sub15)) return false
3801
3617
  }
3802
3618
  }
3803
3619
  return true
3804
3620
  })()
3805
- const sub30 = (() => {
3806
- const err8 = validate.errors
3807
- const res8 = ref3(data.message[key5])
3808
- const suberr8 = ref3.errors
3809
- validate.errors = err8
3810
- if (!res8) return false
3621
+ const sub28 = (() => {
3622
+ const err5 = validate.errors
3623
+ const res5 = ref3(data.message[key5])
3624
+ const suberr5 = ref3.errors
3625
+ validate.errors = err5
3626
+ if (!res5) return false
3811
3627
  return true
3812
3628
  })()
3813
3629
  if (
3814
- !(sub7 || sub8 || sub9 || sub10 || sub11 || sub12 || sub13 || sub30)
3630
+ !(sub5 || sub6 || sub7 || sub8 || sub9 || sub10 || sub11 || sub28)
3815
3631
  ) {
3816
3632
  validate.errors = [
3817
3633
  {
@@ -3843,12 +3659,12 @@ export function parseAndValidateTypedData(value) {
3843
3659
  }
3844
3660
  const ref0 = function validate(data) {
3845
3661
  validate.errors = null
3846
- const err9 = validate.errors
3847
- const res9 = ref1(data)
3848
- const suberr9 = ref1.errors
3849
- validate.errors = err9
3850
- if (!res9) {
3851
- validate.errors = [errorMerge(suberr9[0], '#/$ref', '#')]
3662
+ const err6 = validate.errors
3663
+ const res6 = ref1(data)
3664
+ const suberr6 = ref1.errors
3665
+ validate.errors = err6
3666
+ if (!res6) {
3667
+ validate.errors = [errorMerge(suberr6[0], '#/$ref', '#')]
3852
3668
  return false
3853
3669
  }
3854
3670
  return true
@@ -3885,838 +3701,3 @@ export function parseAndValidateTypedData(value) {
3885
3701
 
3886
3702
  return parsedObject.value
3887
3703
  }
3888
-
3889
- export function validateSeaportMessage(value) {
3890
- const validate = (function () {
3891
- 'use strict'
3892
- const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty)
3893
- const stringLength = (string) =>
3894
- /[\uD800-\uDFFF]/.test(string) ? [...string].length : string.length
3895
- const format0 = new RegExp('^(?![\\s_])[\\s\\w!?.,/()[\\]-]+$', '')
3896
- const pointerPart = (s) =>
3897
- /~\//.test(s) ? `${s}`.replace(/~/g, '~0').replace(/\//g, '~1') : s
3898
- const ref1 = function validate(data) {
3899
- validate.errors = null
3900
- if (!(typeof data === 'object' && data && !Array.isArray(data))) {
3901
- validate.errors = [{ keywordLocation: '#/type', instanceLocation: '#' }]
3902
- return false
3903
- }
3904
- if ('offerer' in data && hasOwn(data, 'offerer')) {
3905
- if (!(typeof data.offerer === 'string')) {
3906
- validate.errors = [
3907
- {
3908
- keywordLocation: '#/properties/offerer/type',
3909
- instanceLocation: '#/offerer',
3910
- },
3911
- ]
3912
- return false
3913
- }
3914
- if (data.offerer.length > 50 && stringLength(data.offerer) > 50) {
3915
- validate.errors = [
3916
- {
3917
- keywordLocation: '#/properties/offerer/maxLength',
3918
- instanceLocation: '#/offerer',
3919
- },
3920
- ]
3921
- return false
3922
- }
3923
- if (!format0.test(data.offerer)) {
3924
- validate.errors = [
3925
- {
3926
- keywordLocation: '#/properties/offerer/format',
3927
- instanceLocation: '#/offerer',
3928
- },
3929
- ]
3930
- return false
3931
- }
3932
- }
3933
- if ('offer' in data && hasOwn(data, 'offer')) {
3934
- if (!Array.isArray(data.offer)) {
3935
- validate.errors = [
3936
- {
3937
- keywordLocation: '#/properties/offer/type',
3938
- instanceLocation: '#/offer',
3939
- },
3940
- ]
3941
- return false
3942
- }
3943
- for (let i = 0; i < data.offer.length; i++) {
3944
- if (i in data.offer && hasOwn(data.offer, i)) {
3945
- if (
3946
- !(
3947
- typeof data.offer[i] === 'object' &&
3948
- data.offer[i] &&
3949
- !Array.isArray(data.offer[i])
3950
- )
3951
- ) {
3952
- validate.errors = [
3953
- {
3954
- keywordLocation: '#/properties/offer/items/type',
3955
- instanceLocation: '#/offer/' + i,
3956
- },
3957
- ]
3958
- return false
3959
- }
3960
- if (
3961
- 'itemType' in data.offer[i] &&
3962
- hasOwn(data.offer[i], 'itemType')
3963
- ) {
3964
- if (!(typeof data.offer[i].itemType === 'number')) {
3965
- validate.errors = [
3966
- {
3967
- keywordLocation:
3968
- '#/properties/offer/items/properties/itemType/type',
3969
- instanceLocation: '#/offer/' + i + '/itemType',
3970
- },
3971
- ]
3972
- return false
3973
- }
3974
- }
3975
- if ('token' in data.offer[i] && hasOwn(data.offer[i], 'token')) {
3976
- if (!(typeof data.offer[i].token === 'string')) {
3977
- validate.errors = [
3978
- {
3979
- keywordLocation:
3980
- '#/properties/offer/items/properties/token/type',
3981
- instanceLocation: '#/offer/' + i + '/token',
3982
- },
3983
- ]
3984
- return false
3985
- }
3986
- if (
3987
- data.offer[i].token.length > 50 &&
3988
- stringLength(data.offer[i].token) > 50
3989
- ) {
3990
- validate.errors = [
3991
- {
3992
- keywordLocation:
3993
- '#/properties/offer/items/properties/token/maxLength',
3994
- instanceLocation: '#/offer/' + i + '/token',
3995
- },
3996
- ]
3997
- return false
3998
- }
3999
- if (!format0.test(data.offer[i].token)) {
4000
- validate.errors = [
4001
- {
4002
- keywordLocation:
4003
- '#/properties/offer/items/properties/token/format',
4004
- instanceLocation: '#/offer/' + i + '/token',
4005
- },
4006
- ]
4007
- return false
4008
- }
4009
- }
4010
- if (
4011
- 'identifierOrCriteria' in data.offer[i] &&
4012
- hasOwn(data.offer[i], 'identifierOrCriteria')
4013
- ) {
4014
- if (!(typeof data.offer[i].identifierOrCriteria === 'string')) {
4015
- validate.errors = [
4016
- {
4017
- keywordLocation:
4018
- '#/properties/offer/items/properties/identifierOrCriteria/type',
4019
- instanceLocation: '#/offer/' + i + '/identifierOrCriteria',
4020
- },
4021
- ]
4022
- return false
4023
- }
4024
- if (
4025
- data.offer[i].identifierOrCriteria.length > 50 &&
4026
- stringLength(data.offer[i].identifierOrCriteria) > 50
4027
- ) {
4028
- validate.errors = [
4029
- {
4030
- keywordLocation:
4031
- '#/properties/offer/items/properties/identifierOrCriteria/maxLength',
4032
- instanceLocation: '#/offer/' + i + '/identifierOrCriteria',
4033
- },
4034
- ]
4035
- return false
4036
- }
4037
- if (!format0.test(data.offer[i].identifierOrCriteria)) {
4038
- validate.errors = [
4039
- {
4040
- keywordLocation:
4041
- '#/properties/offer/items/properties/identifierOrCriteria/format',
4042
- instanceLocation: '#/offer/' + i + '/identifierOrCriteria',
4043
- },
4044
- ]
4045
- return false
4046
- }
4047
- }
4048
- if (
4049
- 'startAmount' in data.offer[i] &&
4050
- hasOwn(data.offer[i], 'startAmount')
4051
- ) {
4052
- if (!(typeof data.offer[i].startAmount === 'string')) {
4053
- validate.errors = [
4054
- {
4055
- keywordLocation:
4056
- '#/properties/offer/items/properties/startAmount/type',
4057
- instanceLocation: '#/offer/' + i + '/startAmount',
4058
- },
4059
- ]
4060
- return false
4061
- }
4062
- if (
4063
- data.offer[i].startAmount.length > 50 &&
4064
- stringLength(data.offer[i].startAmount) > 50
4065
- ) {
4066
- validate.errors = [
4067
- {
4068
- keywordLocation:
4069
- '#/properties/offer/items/properties/startAmount/maxLength',
4070
- instanceLocation: '#/offer/' + i + '/startAmount',
4071
- },
4072
- ]
4073
- return false
4074
- }
4075
- if (!format0.test(data.offer[i].startAmount)) {
4076
- validate.errors = [
4077
- {
4078
- keywordLocation:
4079
- '#/properties/offer/items/properties/startAmount/format',
4080
- instanceLocation: '#/offer/' + i + '/startAmount',
4081
- },
4082
- ]
4083
- return false
4084
- }
4085
- }
4086
- if (
4087
- 'endAmount' in data.offer[i] &&
4088
- hasOwn(data.offer[i], 'endAmount')
4089
- ) {
4090
- if (!(typeof data.offer[i].endAmount === 'string')) {
4091
- validate.errors = [
4092
- {
4093
- keywordLocation:
4094
- '#/properties/offer/items/properties/endAmount/type',
4095
- instanceLocation: '#/offer/' + i + '/endAmount',
4096
- },
4097
- ]
4098
- return false
4099
- }
4100
- if (
4101
- data.offer[i].endAmount.length > 50 &&
4102
- stringLength(data.offer[i].endAmount) > 50
4103
- ) {
4104
- validate.errors = [
4105
- {
4106
- keywordLocation:
4107
- '#/properties/offer/items/properties/endAmount/maxLength',
4108
- instanceLocation: '#/offer/' + i + '/endAmount',
4109
- },
4110
- ]
4111
- return false
4112
- }
4113
- if (!format0.test(data.offer[i].endAmount)) {
4114
- validate.errors = [
4115
- {
4116
- keywordLocation:
4117
- '#/properties/offer/items/properties/endAmount/format',
4118
- instanceLocation: '#/offer/' + i + '/endAmount',
4119
- },
4120
- ]
4121
- return false
4122
- }
4123
- }
4124
- for (const key0 of Object.keys(data.offer[i])) {
4125
- if (
4126
- key0 !== 'itemType' &&
4127
- key0 !== 'token' &&
4128
- key0 !== 'identifierOrCriteria' &&
4129
- key0 !== 'startAmount' &&
4130
- key0 !== 'endAmount'
4131
- ) {
4132
- validate.errors = [
4133
- {
4134
- keywordLocation:
4135
- '#/properties/offer/items/additionalProperties',
4136
- instanceLocation: '#/offer/' + i + '/' + pointerPart(key0),
4137
- },
4138
- ]
4139
- return false
4140
- }
4141
- }
4142
- }
4143
- }
4144
- }
4145
- if ('consideration' in data && hasOwn(data, 'consideration')) {
4146
- if (!Array.isArray(data.consideration)) {
4147
- validate.errors = [
4148
- {
4149
- keywordLocation: '#/properties/consideration/type',
4150
- instanceLocation: '#/consideration',
4151
- },
4152
- ]
4153
- return false
4154
- }
4155
- for (let j = 0; j < data.consideration.length; j++) {
4156
- if (j in data.consideration && hasOwn(data.consideration, j)) {
4157
- if (
4158
- !(
4159
- typeof data.consideration[j] === 'object' &&
4160
- data.consideration[j] &&
4161
- !Array.isArray(data.consideration[j])
4162
- )
4163
- ) {
4164
- validate.errors = [
4165
- {
4166
- keywordLocation: '#/properties/consideration/items/type',
4167
- instanceLocation: '#/consideration/' + j,
4168
- },
4169
- ]
4170
- return false
4171
- }
4172
- if (
4173
- 'itemType' in data.consideration[j] &&
4174
- hasOwn(data.consideration[j], 'itemType')
4175
- ) {
4176
- if (!(typeof data.consideration[j].itemType === 'number')) {
4177
- validate.errors = [
4178
- {
4179
- keywordLocation:
4180
- '#/properties/consideration/items/properties/itemType/type',
4181
- instanceLocation: '#/consideration/' + j + '/itemType',
4182
- },
4183
- ]
4184
- return false
4185
- }
4186
- }
4187
- if (
4188
- 'token' in data.consideration[j] &&
4189
- hasOwn(data.consideration[j], 'token')
4190
- ) {
4191
- if (!(typeof data.consideration[j].token === 'string')) {
4192
- validate.errors = [
4193
- {
4194
- keywordLocation:
4195
- '#/properties/consideration/items/properties/token/type',
4196
- instanceLocation: '#/consideration/' + j + '/token',
4197
- },
4198
- ]
4199
- return false
4200
- }
4201
- if (
4202
- data.consideration[j].token.length > 50 &&
4203
- stringLength(data.consideration[j].token) > 50
4204
- ) {
4205
- validate.errors = [
4206
- {
4207
- keywordLocation:
4208
- '#/properties/consideration/items/properties/token/maxLength',
4209
- instanceLocation: '#/consideration/' + j + '/token',
4210
- },
4211
- ]
4212
- return false
4213
- }
4214
- if (!format0.test(data.consideration[j].token)) {
4215
- validate.errors = [
4216
- {
4217
- keywordLocation:
4218
- '#/properties/consideration/items/properties/token/format',
4219
- instanceLocation: '#/consideration/' + j + '/token',
4220
- },
4221
- ]
4222
- return false
4223
- }
4224
- }
4225
- if (
4226
- 'identifierOrCriteria' in data.consideration[j] &&
4227
- hasOwn(data.consideration[j], 'identifierOrCriteria')
4228
- ) {
4229
- if (
4230
- !(
4231
- typeof data.consideration[j].identifierOrCriteria === 'string'
4232
- )
4233
- ) {
4234
- validate.errors = [
4235
- {
4236
- keywordLocation:
4237
- '#/properties/consideration/items/properties/identifierOrCriteria/type',
4238
- instanceLocation:
4239
- '#/consideration/' + j + '/identifierOrCriteria',
4240
- },
4241
- ]
4242
- return false
4243
- }
4244
- if (
4245
- data.consideration[j].identifierOrCriteria.length > 50 &&
4246
- stringLength(data.consideration[j].identifierOrCriteria) > 50
4247
- ) {
4248
- validate.errors = [
4249
- {
4250
- keywordLocation:
4251
- '#/properties/consideration/items/properties/identifierOrCriteria/maxLength',
4252
- instanceLocation:
4253
- '#/consideration/' + j + '/identifierOrCriteria',
4254
- },
4255
- ]
4256
- return false
4257
- }
4258
- if (!format0.test(data.consideration[j].identifierOrCriteria)) {
4259
- validate.errors = [
4260
- {
4261
- keywordLocation:
4262
- '#/properties/consideration/items/properties/identifierOrCriteria/format',
4263
- instanceLocation:
4264
- '#/consideration/' + j + '/identifierOrCriteria',
4265
- },
4266
- ]
4267
- return false
4268
- }
4269
- }
4270
- if (
4271
- 'startAmount' in data.consideration[j] &&
4272
- hasOwn(data.consideration[j], 'startAmount')
4273
- ) {
4274
- if (!(typeof data.consideration[j].startAmount === 'string')) {
4275
- validate.errors = [
4276
- {
4277
- keywordLocation:
4278
- '#/properties/consideration/items/properties/startAmount/type',
4279
- instanceLocation: '#/consideration/' + j + '/startAmount',
4280
- },
4281
- ]
4282
- return false
4283
- }
4284
- if (
4285
- data.consideration[j].startAmount.length > 50 &&
4286
- stringLength(data.consideration[j].startAmount) > 50
4287
- ) {
4288
- validate.errors = [
4289
- {
4290
- keywordLocation:
4291
- '#/properties/consideration/items/properties/startAmount/maxLength',
4292
- instanceLocation: '#/consideration/' + j + '/startAmount',
4293
- },
4294
- ]
4295
- return false
4296
- }
4297
- if (!format0.test(data.consideration[j].startAmount)) {
4298
- validate.errors = [
4299
- {
4300
- keywordLocation:
4301
- '#/properties/consideration/items/properties/startAmount/format',
4302
- instanceLocation: '#/consideration/' + j + '/startAmount',
4303
- },
4304
- ]
4305
- return false
4306
- }
4307
- }
4308
- if (
4309
- 'endAmount' in data.consideration[j] &&
4310
- hasOwn(data.consideration[j], 'endAmount')
4311
- ) {
4312
- if (!(typeof data.consideration[j].endAmount === 'string')) {
4313
- validate.errors = [
4314
- {
4315
- keywordLocation:
4316
- '#/properties/consideration/items/properties/endAmount/type',
4317
- instanceLocation: '#/consideration/' + j + '/endAmount',
4318
- },
4319
- ]
4320
- return false
4321
- }
4322
- if (
4323
- data.consideration[j].endAmount.length > 50 &&
4324
- stringLength(data.consideration[j].endAmount) > 50
4325
- ) {
4326
- validate.errors = [
4327
- {
4328
- keywordLocation:
4329
- '#/properties/consideration/items/properties/endAmount/maxLength',
4330
- instanceLocation: '#/consideration/' + j + '/endAmount',
4331
- },
4332
- ]
4333
- return false
4334
- }
4335
- if (!format0.test(data.consideration[j].endAmount)) {
4336
- validate.errors = [
4337
- {
4338
- keywordLocation:
4339
- '#/properties/consideration/items/properties/endAmount/format',
4340
- instanceLocation: '#/consideration/' + j + '/endAmount',
4341
- },
4342
- ]
4343
- return false
4344
- }
4345
- }
4346
- if (
4347
- 'recipient' in data.consideration[j] &&
4348
- hasOwn(data.consideration[j], 'recipient')
4349
- ) {
4350
- if (!(typeof data.consideration[j].recipient === 'string')) {
4351
- validate.errors = [
4352
- {
4353
- keywordLocation:
4354
- '#/properties/consideration/items/properties/recipient/type',
4355
- instanceLocation: '#/consideration/' + j + '/recipient',
4356
- },
4357
- ]
4358
- return false
4359
- }
4360
- if (
4361
- data.consideration[j].recipient.length > 50 &&
4362
- stringLength(data.consideration[j].recipient) > 50
4363
- ) {
4364
- validate.errors = [
4365
- {
4366
- keywordLocation:
4367
- '#/properties/consideration/items/properties/recipient/maxLength',
4368
- instanceLocation: '#/consideration/' + j + '/recipient',
4369
- },
4370
- ]
4371
- return false
4372
- }
4373
- if (!format0.test(data.consideration[j].recipient)) {
4374
- validate.errors = [
4375
- {
4376
- keywordLocation:
4377
- '#/properties/consideration/items/properties/recipient/format',
4378
- instanceLocation: '#/consideration/' + j + '/recipient',
4379
- },
4380
- ]
4381
- return false
4382
- }
4383
- }
4384
- for (const key1 of Object.keys(data.consideration[j])) {
4385
- if (
4386
- key1 !== 'itemType' &&
4387
- key1 !== 'token' &&
4388
- key1 !== 'identifierOrCriteria' &&
4389
- key1 !== 'startAmount' &&
4390
- key1 !== 'endAmount' &&
4391
- key1 !== 'recipient'
4392
- ) {
4393
- validate.errors = [
4394
- {
4395
- keywordLocation:
4396
- '#/properties/consideration/items/additionalProperties',
4397
- instanceLocation:
4398
- '#/consideration/' + j + '/' + pointerPart(key1),
4399
- },
4400
- ]
4401
- return false
4402
- }
4403
- }
4404
- }
4405
- }
4406
- }
4407
- if ('startTime' in data && hasOwn(data, 'startTime')) {
4408
- if (!(typeof data.startTime === 'number')) {
4409
- validate.errors = [
4410
- {
4411
- keywordLocation: '#/properties/startTime/type',
4412
- instanceLocation: '#/startTime',
4413
- },
4414
- ]
4415
- return false
4416
- }
4417
- }
4418
- if ('endTime' in data && hasOwn(data, 'endTime')) {
4419
- if (!(typeof data.endTime === 'number')) {
4420
- validate.errors = [
4421
- {
4422
- keywordLocation: '#/properties/endTime/type',
4423
- instanceLocation: '#/endTime',
4424
- },
4425
- ]
4426
- return false
4427
- }
4428
- }
4429
- if ('orderType' in data && hasOwn(data, 'orderType')) {
4430
- if (!(typeof data.orderType === 'number')) {
4431
- validate.errors = [
4432
- {
4433
- keywordLocation: '#/properties/orderType/type',
4434
- instanceLocation: '#/orderType',
4435
- },
4436
- ]
4437
- return false
4438
- }
4439
- }
4440
- if ('zone' in data && hasOwn(data, 'zone')) {
4441
- if (!(typeof data.zone === 'string')) {
4442
- validate.errors = [
4443
- {
4444
- keywordLocation: '#/properties/zone/type',
4445
- instanceLocation: '#/zone',
4446
- },
4447
- ]
4448
- return false
4449
- }
4450
- if (data.zone.length > 50 && stringLength(data.zone) > 50) {
4451
- validate.errors = [
4452
- {
4453
- keywordLocation: '#/properties/zone/maxLength',
4454
- instanceLocation: '#/zone',
4455
- },
4456
- ]
4457
- return false
4458
- }
4459
- if (!format0.test(data.zone)) {
4460
- validate.errors = [
4461
- {
4462
- keywordLocation: '#/properties/zone/format',
4463
- instanceLocation: '#/zone',
4464
- },
4465
- ]
4466
- return false
4467
- }
4468
- }
4469
- if ('zoneHash' in data && hasOwn(data, 'zoneHash')) {
4470
- if (!(typeof data.zoneHash === 'string')) {
4471
- validate.errors = [
4472
- {
4473
- keywordLocation: '#/properties/zoneHash/type',
4474
- instanceLocation: '#/zoneHash',
4475
- },
4476
- ]
4477
- return false
4478
- }
4479
- if (data.zoneHash.length > 500 && stringLength(data.zoneHash) > 500) {
4480
- validate.errors = [
4481
- {
4482
- keywordLocation: '#/properties/zoneHash/maxLength',
4483
- instanceLocation: '#/zoneHash',
4484
- },
4485
- ]
4486
- return false
4487
- }
4488
- if (!format0.test(data.zoneHash)) {
4489
- validate.errors = [
4490
- {
4491
- keywordLocation: '#/properties/zoneHash/format',
4492
- instanceLocation: '#/zoneHash',
4493
- },
4494
- ]
4495
- return false
4496
- }
4497
- }
4498
- if ('salt' in data && hasOwn(data, 'salt')) {
4499
- if (!(typeof data.salt === 'string')) {
4500
- validate.errors = [
4501
- {
4502
- keywordLocation: '#/properties/salt/type',
4503
- instanceLocation: '#/salt',
4504
- },
4505
- ]
4506
- return false
4507
- }
4508
- if (data.salt.length > 500 && stringLength(data.salt) > 500) {
4509
- validate.errors = [
4510
- {
4511
- keywordLocation: '#/properties/salt/maxLength',
4512
- instanceLocation: '#/salt',
4513
- },
4514
- ]
4515
- return false
4516
- }
4517
- if (!format0.test(data.salt)) {
4518
- validate.errors = [
4519
- {
4520
- keywordLocation: '#/properties/salt/format',
4521
- instanceLocation: '#/salt',
4522
- },
4523
- ]
4524
- return false
4525
- }
4526
- }
4527
- if ('conduitKey' in data && hasOwn(data, 'conduitKey')) {
4528
- if (!(typeof data.conduitKey === 'string')) {
4529
- validate.errors = [
4530
- {
4531
- keywordLocation: '#/properties/conduitKey/type',
4532
- instanceLocation: '#/conduitKey',
4533
- },
4534
- ]
4535
- return false
4536
- }
4537
- if (
4538
- data.conduitKey.length > 500 &&
4539
- stringLength(data.conduitKey) > 500
4540
- ) {
4541
- validate.errors = [
4542
- {
4543
- keywordLocation: '#/properties/conduitKey/maxLength',
4544
- instanceLocation: '#/conduitKey',
4545
- },
4546
- ]
4547
- return false
4548
- }
4549
- if (!format0.test(data.conduitKey)) {
4550
- validate.errors = [
4551
- {
4552
- keywordLocation: '#/properties/conduitKey/format',
4553
- instanceLocation: '#/conduitKey',
4554
- },
4555
- ]
4556
- return false
4557
- }
4558
- }
4559
- if (
4560
- 'totalOriginalConsiderationItems' in data &&
4561
- hasOwn(data, 'totalOriginalConsiderationItems')
4562
- ) {
4563
- if (!(typeof data.totalOriginalConsiderationItems === 'number')) {
4564
- validate.errors = [
4565
- {
4566
- keywordLocation:
4567
- '#/properties/totalOriginalConsiderationItems/type',
4568
- instanceLocation: '#/totalOriginalConsiderationItems',
4569
- },
4570
- ]
4571
- return false
4572
- }
4573
- }
4574
- if ('counter' in data && hasOwn(data, 'counter')) {
4575
- if (!(typeof data.counter === 'string')) {
4576
- validate.errors = [
4577
- {
4578
- keywordLocation: '#/properties/counter/type',
4579
- instanceLocation: '#/counter',
4580
- },
4581
- ]
4582
- return false
4583
- }
4584
- if (data.counter.length > 50 && stringLength(data.counter) > 50) {
4585
- validate.errors = [
4586
- {
4587
- keywordLocation: '#/properties/counter/maxLength',
4588
- instanceLocation: '#/counter',
4589
- },
4590
- ]
4591
- return false
4592
- }
4593
- if (!format0.test(data.counter)) {
4594
- validate.errors = [
4595
- {
4596
- keywordLocation: '#/properties/counter/format',
4597
- instanceLocation: '#/counter',
4598
- },
4599
- ]
4600
- return false
4601
- }
4602
- }
4603
- if ('kind' in data && hasOwn(data, 'kind')) {
4604
- if (!(typeof data.kind === 'string')) {
4605
- validate.errors = [
4606
- {
4607
- keywordLocation: '#/properties/kind/type',
4608
- instanceLocation: '#/kind',
4609
- },
4610
- ]
4611
- return false
4612
- }
4613
- if (data.kind.length > 50 && stringLength(data.kind) > 50) {
4614
- validate.errors = [
4615
- {
4616
- keywordLocation: '#/properties/kind/maxLength',
4617
- instanceLocation: '#/kind',
4618
- },
4619
- ]
4620
- return false
4621
- }
4622
- if (!format0.test(data.kind)) {
4623
- validate.errors = [
4624
- {
4625
- keywordLocation: '#/properties/kind/format',
4626
- instanceLocation: '#/kind',
4627
- },
4628
- ]
4629
- return false
4630
- }
4631
- }
4632
- if ('signature' in data && hasOwn(data, 'signature')) {
4633
- if (!(typeof data.signature === 'string')) {
4634
- validate.errors = [
4635
- {
4636
- keywordLocation: '#/properties/signature/type',
4637
- instanceLocation: '#/signature',
4638
- },
4639
- ]
4640
- return false
4641
- }
4642
- if (data.signature.length > 500 && stringLength(data.signature) > 500) {
4643
- validate.errors = [
4644
- {
4645
- keywordLocation: '#/properties/signature/maxLength',
4646
- instanceLocation: '#/signature',
4647
- },
4648
- ]
4649
- return false
4650
- }
4651
- if (!format0.test(data.signature)) {
4652
- validate.errors = [
4653
- {
4654
- keywordLocation: '#/properties/signature/format',
4655
- instanceLocation: '#/signature',
4656
- },
4657
- ]
4658
- return false
4659
- }
4660
- }
4661
- for (const key2 of Object.keys(data)) {
4662
- if (
4663
- key2 !== 'offerer' &&
4664
- key2 !== 'offer' &&
4665
- key2 !== 'consideration' &&
4666
- key2 !== 'startTime' &&
4667
- key2 !== 'endTime' &&
4668
- key2 !== 'orderType' &&
4669
- key2 !== 'zone' &&
4670
- key2 !== 'zoneHash' &&
4671
- key2 !== 'salt' &&
4672
- key2 !== 'conduitKey' &&
4673
- key2 !== 'totalOriginalConsiderationItems' &&
4674
- key2 !== 'counter' &&
4675
- key2 !== 'kind' &&
4676
- key2 !== 'signature'
4677
- ) {
4678
- validate.errors = [
4679
- {
4680
- keywordLocation: '#/additionalProperties',
4681
- instanceLocation: '#/' + pointerPart(key2),
4682
- },
4683
- ]
4684
- return false
4685
- }
4686
- }
4687
- return true
4688
- }
4689
- const errorMerge = (
4690
- { keywordLocation, instanceLocation },
4691
- schemaBase,
4692
- dataBase,
4693
- ) => ({
4694
- keywordLocation: `${schemaBase}${keywordLocation.slice(1)}`,
4695
- instanceLocation: `${dataBase}${instanceLocation.slice(1)}`,
4696
- })
4697
- const ref0 = function validate(data) {
4698
- validate.errors = null
4699
- const err0 = validate.errors
4700
- const res0 = ref1(data)
4701
- const suberr0 = ref1.errors
4702
- validate.errors = err0
4703
- if (!res0) {
4704
- validate.errors = [errorMerge(suberr0[0], '#/$ref', '#')]
4705
- return false
4706
- }
4707
- return true
4708
- }
4709
- return ref0
4710
- })()
4711
-
4712
- const isValid = validate(value)
4713
- if (!isValid) {
4714
- const { keywordLocation, instanceLocation } = validate.errors[0]
4715
- const keyword = keywordLocation.slice(keywordLocation.lastIndexOf('/') + 1)
4716
- const message = `JSON validation failed for ${keyword} at ${instanceLocation}`
4717
- // TODO: Throw custom error (maybe -32700 from EIP-1474).
4718
- throw new Error(message)
4719
- }
4720
-
4721
- return value
4722
- }