Skip to content

Commit

Permalink
debug: add console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yashdesu committed Jul 9, 2024
1 parent 9af4101 commit 6c2c93f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devprotocol/send-transactions",
"version": "1.0.0",
"version": "1.0.1-beta.1",
"type": "module",
"description": "DEV protocol utility API for sending on-chain transactions.",
"scripts": {
Expand Down
20 changes: 10 additions & 10 deletions src/pages/api/send-transactions/AchievementsSBT/[contract].ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const POST: APIRoute = async ({
isAddress(_p.contract) ? true : new Error('Bad request data'),
) ?? new Error('Bad request data'),
)
console.log('HERE1')
console.log('HERE1', { isValidAuth, isParamValid })
const data = await whenNotErrorAll(
[isValidAuth, request],
async ([_iVA, _request]) =>
Expand Down Expand Up @@ -81,7 +81,7 @@ export const POST: APIRoute = async ({
.catch((err) => new Error(err))
}) ?? new Error('Invalid metadata'),
)
console.log('HERE2')
console.log('HERE2', { data })
const sbtContractAddress = whenNotErrorAll(
[isParamValid, params],
([_iPV, _params]) =>
Expand All @@ -91,7 +91,7 @@ export const POST: APIRoute = async ({
: _p.contract
}) ?? new Error('Invalid sbt contract address'),
)
console.log('HERE3')
console.log('HERE3', { sbtContractAddress })
const wallet = whenNotErrorAll(
[data],
([{ rpcUrl }]) => createWallet({ rpcUrl }) ?? new Error('Wallet error'),
Expand All @@ -114,7 +114,7 @@ export const POST: APIRoute = async ({
.then(always(db))
.catch((err) => new Error(err)),
)
console.log('HERE6')
console.log('HERE6, redis === error', redis instanceof Error)
const encodedMetadata = await whenNotErrorAll(
[contract, wallet, data, redis],
async ([contract_, , { metadata }]) => {
Expand All @@ -130,7 +130,7 @@ export const POST: APIRoute = async ({
.catch((err: Error) => err)
},
)
console.log('HERE7')
console.log('HERE7', { encodedMetadata })
const tx = await whenNotErrorAll(
[contract, wallet, data, redis, encodedMetadata],
async ([
Expand All @@ -154,7 +154,7 @@ export const POST: APIRoute = async ({
.catch((err: Error) => err)
},
)
console.log('HERE8')
console.log('HERE8', { tx })
const sbtMintLog = await whenNotErrorAll(
[contract, tx],
async ([contract_, tx_]) => {
Expand All @@ -167,15 +167,15 @@ export const POST: APIRoute = async ({
new Error('SBT Mint log not found')
},
)
console.log('HERE9')
console.log('HERE9', { sbtMintLog })
const sbtToBeMinted = whenNotErrorAll(
[tx, sbtMintLog],
([tx_, sbtMintLog_]) =>
whenDefinedAll([tx_, sbtMintLog_], ([, ml]) =>
Number(ml.args.at(0).toString()),
) ?? new Error('SBT minted not found'),
)
console.log('HERE10')
console.log('HERE10', { sbtToBeMinted })
const saved = await whenNotErrorAll(
[tx, redis, data, sbtContractAddress, sbtToBeMinted],
([_tx, db, { reqId }, ,]) =>
Expand All @@ -186,14 +186,14 @@ export const POST: APIRoute = async ({
'Missing TransactionResponse field to save the transaction: .to, .data',
),
)
console.log('HERE11')
console.log('HERE11', { saved })
const result = await whenNotErrorAll([redis], ([db]) =>
db
.quit()
.then((x) => x)
.catch((err: Error) => err),
)
console.log('HERE12')
console.log('HERE12', { result })
return result instanceof Error ||
sbtToBeMinted instanceof Error ||
saved instanceof Error
Expand Down

0 comments on commit 6c2c93f

Please sign in to comment.