@@ -69,7 +69,7 @@ import { ItemCuration } from 'modules/curations/itemCuration/types'
69
69
import { subscribeToNewsletterRequest } from 'modules/newsletter/action'
70
70
import { Cheque } from 'modules/thirdParty/types'
71
71
import { CurationSortOptions , CurationStatus } from 'modules/curations/types'
72
- import { BuilderAPI , FetchCollectionsParams } from 'lib/api/builder'
72
+ import { BuilderAPI , FetchCollectionsParams , TermsOfServiceEvent } from 'lib/api/builder'
73
73
import { PaginatedResource , PaginationStats } from 'lib/api/pagination'
74
74
import { extractThirdPartyId } from 'lib/urn'
75
75
import {
@@ -903,6 +903,7 @@ describe('when executing the approval flow', () => {
903
903
describe ( 'when publishing a collection' , ( ) => {
904
904
let collection : Collection
905
905
let items : Item [ ]
906
+ let itemsContentHash : string [ ]
906
907
const email = 'email@domain.com'
907
908
908
909
const address = '0xa'
@@ -911,6 +912,7 @@ describe('when publishing a collection', () => {
911
912
beforeEach ( ( ) => {
912
913
collection = { salt : 'some salt' , id : 'someId' , name : 'name' } as Collection
913
914
items = [ ]
915
+ itemsContentHash = [ ]
914
916
} )
915
917
916
918
describe ( 'when saving the collection fails' , ( ) => {
@@ -957,7 +959,10 @@ describe('when publishing a collection', () => {
957
959
[ select ( getAddress ) , [ address ] ] ,
958
960
[ call ( getChainIdByNetwork , Network . MATIC ) , ChainId . MATIC_MUMBAI ] ,
959
961
[ retry ( 10 , 500 , mockBuilder . lockCollection , lockedCollection ) , newLock ] ,
960
- [ retry ( 10 , 500 , mockBuilder . saveTOS , lockedCollection , email ) , undefined ] ,
962
+ [
963
+ retry ( 10 , 500 , mockBuilder . saveTOS , TermsOfServiceEvent . PUBLISH_COLLECTION , lockedCollection , email , itemsContentHash ) ,
964
+ undefined
965
+ ] ,
961
966
[ matchers . call . fn ( sendTransaction ) , Promise . resolve ( txHash ) ]
962
967
] )
963
968
. not . put ( saveCollectionRequest ( collection ) )
@@ -1118,6 +1123,7 @@ describe('when publishing a collection', () => {
1118
1123
{ ...mockedItem , id : 'fstItem' , contents : { ...mockedItem . contents , 'aFile.png' : 'QmOldHash' } } ,
1119
1124
{ ...mockedItem , id : 'sndItem' , contents : { 'someFile.png' : 'newHash' } }
1120
1125
]
1126
+ itemsContentHash = items . map ( item => item . currentContentHash ?? '' ) . filter ( Boolean )
1121
1127
} )
1122
1128
1123
1129
it ( 'should put an action to save each of the items that have contents hashed with an older version' , ( ) => {
@@ -1133,7 +1139,7 @@ describe('when publishing a collection', () => {
1133
1139
[ select ( getAddress ) , [ address ] ] ,
1134
1140
[ call ( getChainIdByNetwork , Network . MATIC ) , ChainId . MATIC_MUMBAI ] ,
1135
1141
[ retry ( 10 , 500 , mockBuilder . lockCollection , collection ) , newLock ] ,
1136
- [ retry ( 10 , 500 , mockBuilder . saveTOS , collection , email ) , undefined ] ,
1142
+ [ retry ( 10 , 500 , mockBuilder . saveTOS , TermsOfServiceEvent . PUBLISH_COLLECTION , collection , email , itemsContentHash ) , undefined ] ,
1137
1143
[ matchers . call . fn ( sendTransaction ) , Promise . resolve ( txHash ) ]
1138
1144
] )
1139
1145
. put ( saveItemRequest ( items [ 0 ] , { } ) )
@@ -1191,7 +1197,7 @@ describe('when publishing a collection', () => {
1191
1197
[ select ( getAddress ) , [ address ] ] ,
1192
1198
[ call ( getChainIdByNetwork , Network . MATIC ) , ChainId . MATIC_MUMBAI ] ,
1193
1199
[ retry ( 10 , 500 , mockBuilder . lockCollection , collection ) , newLock ] ,
1194
- [ retry ( 10 , 500 , mockBuilder . saveTOS , collection , email ) , undefined ] ,
1200
+ [ retry ( 10 , 500 , mockBuilder . saveTOS , TermsOfServiceEvent . PUBLISH_COLLECTION , collection , email , itemsContentHash ) , undefined ] ,
1195
1201
[ matchers . call . fn ( sendTransaction ) , Promise . resolve ( txHash ) ]
1196
1202
] )
1197
1203
. put ( saveCollectionRequest ( collection ) )
@@ -2024,6 +2030,7 @@ describe('when publishing a collection with fiat', () => {
2024
2030
let subscribeToNewsletter : boolean
2025
2031
let collection : Collection
2026
2032
let items : Item [ ]
2033
+ let itemsContentHash : string [ ]
2027
2034
let serverItems : Item [ ]
2028
2035
let email : string
2029
2036
let paymentMethod : PaymentMethod
@@ -2058,6 +2065,7 @@ describe('when publishing a collection with fiat', () => {
2058
2065
describe ( 'when no items are provided' , ( ) => {
2059
2066
beforeEach ( ( ) => {
2060
2067
items = [ ]
2068
+ itemsContentHash = [ ]
2061
2069
} )
2062
2070
2063
2071
describe ( 'when the collection has the same amount of items in the server as locally' , ( ) => {
@@ -2081,7 +2089,10 @@ describe('when publishing a collection with fiat', () => {
2081
2089
[ call ( [ mockBuilder , 'fetchCollectionItems' ] , collection . id ) , serverItems ] ,
2082
2090
[ select ( getAddress ) , 'address' ] ,
2083
2091
[ call ( getChainIdByNetwork , Network . MATIC ) , ChainId . MATIC_MUMBAI ] ,
2084
- [ retry ( 10 , 500 , mockBuilder . saveTOS , collection , email ) , undefined ] ,
2092
+ [
2093
+ retry ( 10 , 500 , mockBuilder . saveTOS , TermsOfServiceEvent . PUBLISH_COLLECTION , collection , email , itemsContentHash ) ,
2094
+ undefined
2095
+ ] ,
2085
2096
[ call ( [ config , config . get ] , 'WERT_PUBLISH_FEES_ENV' ) , wertEnv ]
2086
2097
] )
2087
2098
. dispatch ( publishCollectionRequest ( collection , items , email , subscribeToNewsletter , paymentMethod ) )
@@ -2101,7 +2112,10 @@ describe('when publishing a collection with fiat', () => {
2101
2112
[ call ( [ mockBuilder , 'fetchCollectionItems' ] , collection . id ) , serverItems ] ,
2102
2113
[ select ( getAddress ) , 'address' ] ,
2103
2114
[ call ( getChainIdByNetwork , Network . MATIC ) , ChainId . MATIC_MUMBAI ] ,
2104
- [ retry ( 10 , 500 , mockBuilder . saveTOS , collection , email ) , undefined ] ,
2115
+ [
2116
+ retry ( 10 , 500 , mockBuilder . saveTOS , TermsOfServiceEvent . PUBLISH_COLLECTION , collection , email , itemsContentHash ) ,
2117
+ undefined
2118
+ ] ,
2105
2119
[ call ( [ config , config . get ] , 'WERT_PUBLISH_FEES_ENV' ) , wertEnv ]
2106
2120
] )
2107
2121
. dispatch ( publishCollectionRequest ( collection , items , email , subscribeToNewsletter , paymentMethod ) )
@@ -2122,7 +2136,10 @@ describe('when publishing a collection with fiat', () => {
2122
2136
[ call ( [ mockBuilder , 'fetchCollectionItems' ] , collection . id ) , serverItems ] ,
2123
2137
[ select ( getAddress ) , from ] ,
2124
2138
[ call ( getChainIdByNetwork , Network . MATIC ) , ChainId . MATIC_MUMBAI ] ,
2125
- [ retry ( 10 , 500 , mockBuilder . saveTOS , collection , email ) , undefined ] ,
2139
+ [
2140
+ retry ( 10 , 500 , mockBuilder . saveTOS , TermsOfServiceEvent . PUBLISH_COLLECTION , collection , email , itemsContentHash ) ,
2141
+ undefined
2142
+ ] ,
2126
2143
[ call ( [ config , config . get ] , 'WERT_PUBLISH_FEES_ENV' ) , wertEnv ] ,
2127
2144
[ put ( fetchRaritiesRequest ( ) ) , undefined ] ,
2128
2145
[
@@ -2148,7 +2165,18 @@ describe('when publishing a collection with fiat', () => {
2148
2165
[ call ( [ mockBuilder , 'fetchCollectionItems' ] , collection . id ) , serverItems ] ,
2149
2166
[ select ( getAddress ) , from ] ,
2150
2167
[ call ( getChainIdByNetwork , Network . MATIC ) , ChainId . MATIC_MUMBAI ] ,
2151
- [ retry ( 10 , 500 , mockBuilder . saveTOS , collection , email ) , undefined ] ,
2168
+ [
2169
+ retry (
2170
+ 10 ,
2171
+ 500 ,
2172
+ mockBuilder . saveTOS ,
2173
+ TermsOfServiceEvent . PUBLISH_COLLECTION ,
2174
+ collection ,
2175
+ email ,
2176
+ itemsContentHash
2177
+ ) ,
2178
+ undefined
2179
+ ] ,
2152
2180
[ call ( [ config , config . get ] , 'WERT_PUBLISH_FEES_ENV' ) , wertEnv ] ,
2153
2181
[ put ( fetchRaritiesRequest ( ) ) , undefined ] ,
2154
2182
[
@@ -2174,7 +2202,18 @@ describe('when publishing a collection with fiat', () => {
2174
2202
[ call ( [ mockBuilder , 'fetchCollectionItems' ] , collection . id ) , serverItems ] ,
2175
2203
[ select ( getAddress ) , from ] ,
2176
2204
[ call ( getChainIdByNetwork , Network . MATIC ) , ChainId . MATIC_MUMBAI ] ,
2177
- [ retry ( 10 , 500 , mockBuilder . saveTOS , collection , email ) , undefined ] ,
2205
+ [
2206
+ retry (
2207
+ 10 ,
2208
+ 500 ,
2209
+ mockBuilder . saveTOS ,
2210
+ TermsOfServiceEvent . PUBLISH_COLLECTION ,
2211
+ collection ,
2212
+ email ,
2213
+ itemsContentHash
2214
+ ) ,
2215
+ undefined
2216
+ ] ,
2178
2217
[ call ( [ config , config . get ] , 'WERT_PUBLISH_FEES_ENV' ) , wertEnv ] ,
2179
2218
[ put ( fetchRaritiesRequest ( ) ) , undefined ] ,
2180
2219
[
0 commit comments