Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixFan1992 committed Feb 4, 2025
1 parent dc422e6 commit b5522db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
12 changes: 7 additions & 5 deletions src/localFunctionsTestnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ export const startLocalFunctionsTestnet = async (
await anvil.start()
console.log(`Anvil started on port ${port} with chain ID 1337`)

// this is a private key provided by anvil
const admin = new Wallet(
'ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
new providers.JsonRpcProvider(`http://127.0.0.1:${port}`),
)
let privateKey = process.env.PRIVATE_KEY
if (!privateKey) {
// this is a private key provided by anvil
privateKey = 'ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
}

const admin = new Wallet(privateKey, new providers.JsonRpcProvider(`http://127.0.0.1:${port}`))

const contracts = await deployFunctionsOracle(admin)

Expand Down
4 changes: 2 additions & 2 deletions test/integration/localFunctionsTestnet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,14 @@ describe('Local Functions Testnet', () => {
})

it('getFunds throws error for invalid weiAmount', async () => {
expect(async () => {
await expect(async () => {
// @ts-ignore
await getFunds('0xc0ffee254729296a45a3885639AC7E10F9d54979', { weiAmount: 1 })
}).rejects.toThrow(/weiAmount must be a BigInt or string/)
})

it('getFunds throws error for invalid juelsAmount', async () => {
expect(async () => {
await expect(async () => {
// @ts-ignore
await getFunds('0xc0ffee254729296a45a3885639AC7E10F9d54979', { juelsAmount: 1 })
}).rejects.toThrow(/juelsAmount must be a BigInt or string/)
Expand Down
8 changes: 1 addition & 7 deletions test/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ export const setupLocalTestnetFixture = async (
utils.formatBytes32String(localFunctionsTestnet.donId),
)

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_admin, user_A, user_B_NoLINK, subFunder, _] = createTestWallets(port)
const [user_A, user_B_NoLINK, subFunder] = createTestWallets(port)

const juelsAmount = BigInt(utils.parseUnits('100', 'ether').toString())
await localFunctionsTestnet.getFunds(user_A.address, {
Expand Down Expand Up @@ -91,11 +90,6 @@ const createTestWallets = (port = 8545): Wallet[] => {
provider,
),
)
wallets.push(
new Wallet('47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a').connect(
provider,
),
)

return wallets
}

0 comments on commit b5522db

Please sign in to comment.