@@ -6,12 +6,6 @@ import {
66 TransferrableModuleUI ,
77} from "./Transferrable" ;
88
9- import { ThirdwebProvider , useActiveAccount , ConnectButton , useSendTransaction } from "thirdweb/react" ;
10- import { createThirdwebClient , getContract } from "thirdweb" ;
11- import { anvil } from "thirdweb/chains" ;
12- import { useSendBatchTransaction , useReadContract } from "thirdweb/react" ;
13- import { TransferableERC721 } from "thirdweb/modules" ;
14-
159const meta = {
1610 title : "Modules/Transferrable" ,
1711 component : Component ,
@@ -37,62 +31,6 @@ export const Mobile: Story = {
3731const testAddress1 = "0x1F846F6DAE38E1C88D71EAA191760B15f38B7A37" ;
3832const testAddress2 = "0x83Dd93fA5D8343094f850f90B3fb90088C1bB425" ;
3933
40- // TESTING: used to test out the SDK in story book for now
41- const client = createThirdwebClient ( {
42- //clientId: process.env.NEXT_PUBLIC_DASHBOARD_CLIENT_ID!,
43- secretKey : process . env . DASHBOARD_SECRET_KEY !
44- } ) ;
45-
46- const contract = getContract ( {
47- client,
48- address : "0x5FbDB2315678afecb367f032d93F642f64180aa3" ,
49- chain : anvil ,
50- } ) ;
51-
52- function AnvilComponent ( ) {
53- const account = useActiveAccount ( ) ;
54- const { mutateAsync : sendTransaction , error } = useSendTransaction ( ) ;
55- const { data : isTransferEnabled , isLoading } = useReadContract ( TransferableERC721 . isTransferEnabled , {
56- contract
57- } ) ;
58-
59- async function anvilUpdate ( values : TransferrableModuleFormValues ) {
60-
61- if ( isTransferEnabled !== values . isRestricted ) {
62- const setTransferableTransaction = TransferableERC721 . setTransferable ( {
63- contract,
64- enableTransfer : values . isRestricted ,
65- } ) ;
66-
67- await sendTransaction ( setTransferableTransaction )
68- }
69-
70- const setTransferableForTransactions = values . allowList . map ( allowlistedAddress => TransferableERC721 . setTransferableFor ( {
71- contract,
72- enableTransfer : true ,
73- target : allowlistedAddress . address ,
74- } ) )
75-
76- await Promise . allSettled ( setTransferableForTransactions . map ( transaction => sendTransaction ( transaction ) ) )
77- } ;
78-
79- return (
80- < >
81- < ConnectButton client = { client } />
82-
83- < BadgeContainer label = "Anvil localhost test" >
84- < TransferrableModuleUI
85- allowList = { [ ] }
86- isPending = { isLoading }
87- transferEnabled = { isLoading ? false : isTransferEnabled ! }
88- adminAddress = { account ?. address ?? "" }
89- update = { anvilUpdate }
90- />
91- </ BadgeContainer >
92- </ >
93- )
94- }
95-
9634function Component ( ) {
9735
9836 async function updateStub ( values : TransferrableModuleFormValues ) {
@@ -101,63 +39,54 @@ function Component() {
10139 }
10240
10341 return (
104- < ThirdwebProvider >
105- < div className = "container flex max-w-[1150px] flex-col gap-10 py-10" >
42+ < div className = "container flex max-w-[1150px] flex-col gap-10 py-10" >
10643
107- < AnvilComponent />
108-
109- < BadgeContainer label = "Empty AllowList, Not Restricted" >
110- < TransferrableModuleUI
111- allowList = { [ ] }
112- isPending = { false }
113- transferEnabled = { false }
114- adminAddress = { testAddress1 }
115- update = { updateStub }
116- />
117- </ BadgeContainer >
44+ < BadgeContainer label = "Empty AllowList, Not Restricted" >
45+ < TransferrableModuleUI
46+ isPending = { false }
47+ isRestricted = { false }
48+ adminAddress = { testAddress1 }
49+ update = { updateStub }
50+ />
51+ </ BadgeContainer >
11852
119- < BadgeContainer label = "Empty AllowList, Restricted" >
120- < TransferrableModuleUI
121- allowList = { [ ] }
122- isPending = { false }
123- transferEnabled = { true }
124- adminAddress = { testAddress1 }
125- update = { updateStub }
126- />
127- </ BadgeContainer >
53+ < BadgeContainer label = "Empty AllowList, Restricted" >
54+ < TransferrableModuleUI
55+ isPending = { false }
56+ isRestricted = { true }
57+ adminAddress = { testAddress1 }
58+ update = { updateStub }
59+ />
60+ </ BadgeContainer >
12861
129- < BadgeContainer label = "Length 1 AllowList, Restricted" >
130- < TransferrableModuleUI
131- allowList = { [ testAddress1 ] }
132- isPending = { false }
133- transferEnabled = { true }
134- adminAddress = { testAddress1 }
135- update = { updateStub }
136- />
137- </ BadgeContainer >
62+ < BadgeContainer label = "Length 1 AllowList, Restricted" >
63+ < TransferrableModuleUI
64+ isPending = { false }
65+ isRestricted = { true }
66+ adminAddress = { testAddress1 }
67+ update = { updateStub }
68+ />
69+ </ BadgeContainer >
13870
139- < BadgeContainer label = "Length 2 AllowList, Restricted" >
140- < TransferrableModuleUI
141- allowList = { [ testAddress1 , testAddress2 ] }
142- isPending = { false }
143- transferEnabled = { true }
144- adminAddress = { testAddress1 }
145- update = { updateStub }
146- />
147- </ BadgeContainer >
71+ < BadgeContainer label = "Length 2 AllowList, Restricted" >
72+ < TransferrableModuleUI
73+ isPending = { false }
74+ isRestricted = { true }
75+ adminAddress = { testAddress1 }
76+ update = { updateStub }
77+ />
78+ </ BadgeContainer >
14879
149- < BadgeContainer label = "Pending" >
150- < TransferrableModuleUI
151- allowList = { [ ] }
152- isPending = { true }
153- adminAddress = { testAddress1 }
154- transferEnabled = { false }
155- update = { updateStub }
156- />
157- </ BadgeContainer >
80+ < BadgeContainer label = "Pending" >
81+ < TransferrableModuleUI
82+ isPending = { true }
83+ adminAddress = { testAddress1 }
84+ isRestricted = { false }
85+ update = { updateStub }
86+ />
87+ </ BadgeContainer >
15888
159- < Toaster richColors />
160- </ div >
161- </ ThirdwebProvider >
89+ < Toaster richColors />
90+ </ div >
16291 ) ;
16392}
0 commit comments