Skip to content

Commit

Permalink
chore: use find default token function in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
DNR500 committed May 30, 2024
1 parent a74ac41 commit 27cc82f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/node/examples/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
createConfig,
EVM,
} from '@lifi/sdk'
import { Address, Chain, parseUnits } from 'viem'
import type { Address, Chain } from 'viem'
import { createWalletClient, http } from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import { mainnet, arbitrum, optimism, polygon } from 'viem/chains'
Expand Down
1 change: 0 additions & 1 deletion examples/node/examples/constants.ts

This file was deleted.

9 changes: 6 additions & 3 deletions examples/node/examples/polynomialDeposit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ContractCallsQuoteRequest, StatusResponse } from '@lifi/sdk'
import * as lifiDataTypes from '@lifi/data-types'
import type { ContractCallsQuoteRequest, StatusResponse } from '@lifi/sdk'
import {
ChainId,
CoinKey,
createConfig,
EVM,
getContractCallsQuote,
Expand All @@ -19,10 +21,11 @@ import { privateKeyToAccount } from 'viem/accounts'
import { mainnet, arbitrum, optimism, polygon } from 'viem/chains'
import 'dotenv/config'
import { promptConfirm } from '../helpers/promptConfirm'
import { AddressZero } from './constants'
import { checkTokenAllowance } from './utils/checkTokenAllowance'
import { transformTxRequestToSendTxParams } from './utils/transformTxRequestToSendTxParams'

const { findDefaultToken } = (lifiDataTypes as any).default

const run = async () => {
console.info('>> Starting Polynomial Demo: Deposit sETH on Optimism')
console.info('>> Initialize LiFi SDK')
Expand Down Expand Up @@ -66,7 +69,7 @@ const run = async () => {
// config for polynomial deposit run
const config = {
fromChain: ChainId.ETH,
fromToken: AddressZero,
fromToken: findDefaultToken(CoinKey.ETH, ChainId.ETH).address,
amount: parseEther('0.00001').toString(),
polynomialContractAddress: '0x2D46292cbB3C601c6e2c74C32df3A4FCe99b59C7', // Polynomial Ethereum Contract on Optimism
polynomialContractToken: '0xE405de8F52ba7559f9df3C368500B6E6ae6Cee49', // sETH on Optimism
Expand Down
3 changes: 2 additions & 1 deletion examples/node/examples/utils/checkTokenAllowance.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { LiFiStep } from '@lifi/sdk'
import { getTokenAllowance, setTokenAllowance } from '@lifi/sdk'
import type { PrivateKeyAccount, PublicClient, WalletClient } from 'viem'
import { AddressZero } from '../constants'

const AddressZero = '0x0000000000000000000000000000000000000000'

export const checkTokenAllowance = async (
contactCallsQuoteResponse: LiFiStep,
Expand Down

0 comments on commit 27cc82f

Please sign in to comment.