Skip to content

Commit

Permalink
Expose helper functions to help get an e2e stake tx done very easily
Browse files Browse the repository at this point in the history
  • Loading branch information
drohit-cb committed May 21, 2024
1 parent 3749194 commit a073e66
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/client/staking-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);

Check failure on line 350 in src/client/staking-client.ts

View workflow job for this annotation

GitHub Actions / lint

Replace ``No·txStepOutput·found·in·workflow·step·${workflow.currentStepId}`` with `⏎······`No·txStepOutput·found·in·workflow·step·${workflow.currentStepId}`,⏎····`
}

return <string>workflow.steps[workflow.currentStepId].txStepOutput?.unsignedTx;

Check failure on line 353 in src/client/staking-client.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `workflow.steps[workflow.currentStepId].txStepOutput?.unsignedTx` with `(⏎····workflow.steps[workflow.currentStepId].txStepOutput?.unsignedTx⏎··)`
}

async function getAuthDetails(
url: string,
path: string,
Expand Down
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ import * as Utils from './utils/date';

export { Utils };

export { StakingClient } from './client/staking-client';
export { StakingClient,

Check failure on line 5 in src/index.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `⏎·`
workflowHasFinished,

Check failure on line 6 in src/index.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
workflowWaitingForExternalBroadcast,

Check failure on line 7 in src/index.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
isTxStepOutput,

Check failure on line 8 in src/index.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `····` with `··`
isWaitStepOutput,

Check failure on line 9 in src/index.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
getUnsignedTx,

Check failure on line 10 in src/index.ts

View workflow job for this annotation

GitHub Actions / lint

Delete `··`
} from './client/staking-client';

export { TxSignerFactory } from './signers'

Check failure on line 13 in src/index.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `;`

0 comments on commit a073e66

Please sign in to comment.