Set Actions
Set Lit Action Code.
import { FetchAction, ContractAction } from "lit-listener-sdk"
const fetchAction: FetchAction = {
type: "fetch", // type
priority: 1, // execution priority
baseUrl: "https://api.example.com", // baseUrl
endpoint: "/data", // endPoint
responsePath: "data.value", // responsePath
apiKey: "your_api_key", // apiKey
toSign: [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100], // toSign
signCondition: [
{
type: "&&",
operator: "==",
value: "expected_value",
},
], // signCondition
};
const contractAction: ContractAction = {
type: "contract", // type
priority: 2, // execution priority
contractAddress: "0x6968105460f67c3bf751be7c15f92f5286fd0ce5", // contract address
abi: [
{
constant: true,
inputs: [{ name: "numberValue", type: "uint256" }],
name: "your_function_name",
outputs: [{ name: "", type: "uint256" }],
payable: false,
stateMutability: "external",
type: "function",
},
], // abi
functionName: "your_function_name", // function name
chainId: "polygon", // chainId
providerURL: "https://polygon-provider-url.com" // provider URL
nonce: 1, // nonce
gasLimit: 100000, // gas Limit
value: 0, // value
maxPriorityFeePerGas: 1000, // max priority gas fee
maxFeePerGas: 10000, // max fee per gas
args: [20], // function arguments
};
const {unsignedTransactionDataObject, litActionCode} = await newCircuit.setActions(
[
fetchAction,
contractAction
]
)Last updated