File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,27 @@ async function bridgeBaseSepoliaUSDCToEthereumSepolia() {
254254 const ethPrivateKey = ' 0xTHE_PKP_AUTHORIZED_SIGNER_PRIVATE_KEY' ;
255255
256256 const stateMachine = StateMachine .fromDefinition ({
257+ // Extend the action respository with a custom action we will define later. For example to send notification to the machine owner on transactions
258+ actionRepository: {
259+ notify: class NotificationAction extends Action {
260+ constructor ({
261+ stateMachine ,
262+ customParam ,
263+ }: {
264+ stateMachine: StateMachine ;
265+ customParam: string ;
266+ }) {
267+ super ({
268+ debug ,
269+ function : async () => {
270+ const transferData = stateMachine .getFromContext (' transfer' );
271+ console .log (' customParam' , customParam );
272+ console .log (' transferData' , transferData );
273+ },
274+ });
275+ }
276+ },
277+ },
257278 privateKey: ethPrivateKey , // Used only for authorization here, minting was done previously
258279 context: {
259280 // We can prepopulate the context, for example setting the pkp here instead of using state.usePkp later
@@ -371,6 +392,11 @@ async function bridgeBaseSepoliaUSDCToEthereumSepolia() {
371392 },
372393 ],
373394 },
395+ {
396+ // Our custom action to notify about the just executed transfer transaction
397+ key: ' notify' ,
398+ customParam: ' OUR_CUSTOM_PARAM' ,
399+ },
374400 ],
375401 // Going back to waitForFunds to suspend machine if we need more sepolia eth or sepolia USDC
376402 transitions: [{ toState: ' waitForFunds' }],
Original file line number Diff line number Diff line change @@ -38,8 +38,9 @@ export interface UpdatesContext {
3838// Action Types
3939export type ActionConstructor = new ( params : any ) => Action ;
4040
41- export interface RawActionDefinition extends ActionParams {
41+ export interface RawActionDefinition {
4242 key : string ;
43+ [ actionProperty : string ] : unknown ;
4344}
4445
4546export interface LitActionActionDefinition {
You can’t perform that action at this time.
0 commit comments