-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added functions to update the secrets and also paginated the token list
- Loading branch information
1 parent
db1c0df
commit 9b4079c
Showing
3 changed files
with
160 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import {IFunctionsCoordinator} from "@chainlink/contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsCoordinator.sol"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { viem } from "hardhat"; | ||
import { generateAndUploadEncryptedFile } from "../utils/generateAndUploadEncryptedFile"; | ||
import { | ||
Account, | ||
Chain, | ||
GetContractReturnType, | ||
PublicClient, | ||
Transport, | ||
WalletClient, | ||
getContract, | ||
} from "viem"; | ||
import { abi as FundManagerABI } from "../artifacts/contracts/FundManager.sol/FundManager.json"; | ||
import { FundManager$Type } from "../artifacts/contracts/FundManager.sol/FundManager"; | ||
|
||
const routerAddress = "0x6E2dc0F9DB014aE19888F539E59285D2Ea04244C"; | ||
const donId = "fun-polygon-mumbai-1"; | ||
const fundManagerAddress = "0x"; | ||
|
||
async function main() { | ||
const walletClient = (await viem.getWalletClients())[0]; | ||
const publicClient = await viem.getPublicClient(); | ||
|
||
const pinataAPIKey = process.env.PINATA_API_KEY || ""; | ||
|
||
const encryptedSecretsUrls = await generateAndUploadEncryptedFile({ | ||
walletClient, | ||
donId, | ||
routerAddress, | ||
secrets: { | ||
pinataApiKey: pinataAPIKey, | ||
}, | ||
}); | ||
|
||
const fundManager = getContract({ | ||
abi: FundManagerABI, | ||
address: fundManagerAddress, | ||
walletClient: walletClient, | ||
publicClient: publicClient, | ||
}) as unknown as GetContractReturnType< | ||
FundManager$Type["abi"], | ||
PublicClient<Transport, Chain>, | ||
WalletClient<Transport, Chain, Account> | ||
>; | ||
|
||
await fundManager.write.setEncryptedSecretUrlsForPriceFetchFunction([ | ||
encryptedSecretsUrls, | ||
]); | ||
|
||
console.log(encryptedSecretsUrls); | ||
} | ||
|
||
main().catch((err) => console.error(err)); |