Skip to content

Commit

Permalink
Added logging env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrwitek committed Apr 16, 2024
1 parent 6fa74ad commit 28838a9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion sdk/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ ONE_INCH_API_URL='https://api-oasis.1inch.io'
ONE_INCH_ALLOWED_SWAP_PROTOCOLS='UNISWAP_V3,PMM1,PMM2,PMM3,PMM4,UNISWAP_V2,SUSHI,CURVE,CURVE_V2,PSM,WSTETH,BALANCER,BALANCER_V2,BALANCER_V2_WRAPPER,ST_ETH,WETH,ROCKET_POOL'

# ChainIDs where 1Inch swaps are allowed (comma separated)
ONE_INCH_SWAP_CHAIN_IDS='1'
ONE_INCH_SWAP_CHAIN_IDS='1'

SDK_LOGGING_ENABLED=
8 changes: 5 additions & 3 deletions sdk/sdk-server/src/TRPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ export const createCallerFactory = t.createCallerFactory

export const publicProcedure = t.procedure.use(async (opts) => {
const { getRawInput, path, type } = opts
console.log('- path => ', path)
console.log('- type => ', type)
console.log('- rawInput => ', JSON.stringify(await getRawInput(), null, 2))
if (process.env.SDK_LOGGING_ENABLED) {
console.log('- path => ', path)
console.log('- type => ', type)
console.log('- rawInput => ', JSON.stringify(await getRawInput(), null, 2))
}

const result = await opts.next()
return result
Expand Down
2 changes: 2 additions & 0 deletions stacks/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {
ONE_INCH_API_SPOT_URL,
ONE_INCH_API_SPOT_VERSION,
ONE_INCH_API_SPOT_KEY,
SDK_LOGGING_ENABLED,
} = process.env

export function addSdkConfig({ stack, api }: StackContext & { api: Api }) {
Expand Down Expand Up @@ -56,6 +57,7 @@ export function addSdkConfig({ stack, api }: StackContext & { api: Api }) {
ONE_INCH_API_SPOT_URL,
ONE_INCH_API_SPOT_VERSION,
ONE_INCH_API_SPOT_KEY,
SDK_LOGGING_ENABLED: SDK_LOGGING_ENABLED!,
},
})

Expand Down
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"ONE_INCH_ALLOWED_SWAP_PROTOCOLS",
"ONE_INCH_SWAP_CHAIN_IDS",
"SDK_API_URL",
"SDK_LOGGING_ENABLED",
"MAINNET_RPC_URL"
],
"pipeline": {
Expand Down

0 comments on commit 28838a9

Please sign in to comment.