Skip to content

Commit

Permalink
cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
jawndiego committed Jun 24, 2024
1 parent 593a4c5 commit 7921a85
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 54 deletions.
16 changes: 2 additions & 14 deletions apps/site/app/api/post/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,10 @@ export const maxDuration = 30 // This function can run for a maximum of 30 secon
export async function POST(req: NextRequest) {
const post = await req.json()

if (!syndicateClientPost) {
return new Response(
JSON.stringify({
success: false,
hash: null,
error: 'Syndicate client not initialized',
}),
{
status: 500,
headers: { 'Content-Type': 'application/json' },
},
)
}
try {
const postTx =
await syndicateClientPost.officialActions.transact.sendTransaction(
// biome-ignore lint:
await syndicateClientPost!.officialActions.transact.sendTransaction(
generatePostTxnInput(post),
)

Expand Down
17 changes: 2 additions & 15 deletions apps/site/app/api/postBatch/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,10 @@ import { waitForHash } from '@syndicateio/syndicate-node/utils'
export async function POST(req: NextRequest) {
const postsArray = await req.json()

if (!syndicateClientPost) {
return new Response(
JSON.stringify({
success: false,
hash: null,
error: 'Syndicate client not initialized',
}),
{
status: 500,
headers: { 'Content-Type': 'application/json' },
},
)
}

try {
const postTx =
await syndicateClientPost.officialActions.transact.sendTransaction(
// biome-ignore lint:
await syndicateClientPost!.officialActions.transact.sendTransaction(
generatePostBatchTxnInput(postsArray),
)

Expand Down
26 changes: 2 additions & 24 deletions apps/site/app/api/registerFor/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,13 @@ export const maxDuration = 30 // This function can run for a maximum of 30 secon

export async function POST(req: NextRequest) {
const user = await req.json()
console.log({ user })

const { username, ...userWithoutUsername } = user
const { to, recovery, deadline, sig } = userWithoutUsername

console.log({ userWithoutUsername })

if (!syndicateClientIdRegistry) {
return new Response(
JSON.stringify({
success: false,
hash: null,
error: 'Syndicate client not initialized',
}),
{
status: 500,
headers: { 'Content-Type': 'application/json' },
},
)
}

try {
const registerTx =
await syndicateClientIdRegistry.officialActions.transact.sendTransaction(
// biome-ignore lint:
await syndicateClientIdRegistry!.officialActions.transact.sendTransaction(
generateIdRegistryInput({ to, recovery, deadline, sig }),
)

Expand All @@ -45,8 +28,6 @@ export async function POST(req: NextRequest) {
transactionId: registerTx.transactionId,
})

console.log({ successfulTxHash })

const txnReceipt = await optimismPubClient.waitForTransactionReceipt({
hash: successfulTxHash as Hex,
})
Expand All @@ -60,9 +41,6 @@ export async function POST(req: NextRequest) {
txnReceipt.logs[0].data,
)

console.log('rid: ', rid)
console.log('transaction receipt: ', successfulTxHash)

return new Response(
JSON.stringify({
success: true,
Expand Down
4 changes: 3 additions & 1 deletion apps/site/biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"rules": {
"recommended": true,
"style": {
"noUselessElse": "off"
"noUselessElse": "off",
"noNonNullAssertion":"off"

},
"suspicious": {
"noRedeclare": "off",
Expand Down

0 comments on commit 7921a85

Please sign in to comment.