-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: default interval if singleExec & startTime (#30)
* chore: default interval if singleExec & startTime * fix: module sequence * chore: add test env example & check * chore: add ts-node dependency Co-authored-by: Sylvain Goumy <goumsss@protonmail.com>
- Loading branch information
1 parent
2ffa8f8
commit bfc333c
Showing
5 changed files
with
160 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PK= | ||
PROVIDER_URL= |
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,41 @@ | ||
import dotenv from "dotenv"; | ||
import { ethers } from "ethers"; | ||
import { GelatoOpsSDK } from "./lib"; | ||
dotenv.config(); | ||
|
||
if (!process.env.PK) throw new Error("Missing env PK"); | ||
const pk = process.env.PK; | ||
if (!process.env.PROVIDER_URL) throw new Error("Missing env PROVIDER_URL"); | ||
const providerUrl = process.env.PROVIDER_URL; | ||
const chainId = 80001; // mumbai | ||
|
||
const iceCreamAddress = "0xa5f9b728ecEB9A1F6FCC89dcc2eFd810bA4Dec41"; // mumbai IceCreamNFT | ||
const iceCreamAbi = ["function lick(uint256) external"]; | ||
const iceCreamInterface = new ethers.utils.Interface(iceCreamAbi); | ||
|
||
const main = async () => { | ||
const provider = new ethers.providers.JsonRpcProvider(providerUrl); | ||
|
||
const wallet = new ethers.Wallet(pk as string, provider); | ||
const sdk = new GelatoOpsSDK(chainId, wallet); | ||
|
||
const taskId = await sdk.createTask({ | ||
name: "OpsSdkTest", | ||
execAddress: iceCreamAddress, | ||
execSelector: iceCreamInterface.getSighash("lick"), | ||
dedicatedMsgSender: true, | ||
singleExec: true, | ||
startTime: (await provider.getBlock("latest")).timestamp + 300, | ||
}); | ||
|
||
console.log(taskId); | ||
}; | ||
|
||
main() | ||
.then(() => { | ||
process.exit(); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
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