diff --git a/src/client/staking-client.ts b/src/client/staking-client.ts index 8a79528..65c102a 100644 --- a/src/client/staking-client.ts +++ b/src/client/staking-client.ts @@ -337,6 +337,22 @@ export function isWaitStepOutput( return (step as WorkflowStep).waitStepOutput !== undefined; } +export function getUnsignedTx(workflow: Workflow): string { + if (workflow.steps === undefined) { + throw new Error('No steps found in workflow'); + } + + if (workflow.currentStepId === undefined) { + throw new Error('No current step found in workflow'); + } + + if (workflow.steps[workflow.currentStepId].txStepOutput === undefined) { + throw new Error(`No txStepOutput found in workflow step ${workflow.currentStepId}`); + } + + return workflow.steps[workflow.currentStepId].txStepOutput?.unsignedTx; +} + async function getAuthDetails( url: string, path: string, diff --git a/src/index.ts b/src/index.ts index 870ba28..f7a608c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,4 +2,12 @@ import * as Utils from './utils/date'; export { Utils }; -export { StakingClient } from './client/staking-client'; +export { StakingClient, + workflowHasFinished, + workflowWaitingForExternalBroadcast, + isTxStepOutput, + isWaitStepOutput, + getUnsignedTx, +} from './client/staking-client'; + +export { TxSignerFactory } from './signers'