Skip to content

Commit

Permalink
explain getTransactionPhase
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharqiewicz committed Jan 3, 2025
1 parent a25d418 commit 544b4f8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/services/phases/signedTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ApiPromise, Keyring } from '@polkadot/api';
import { Extrinsic } from '@pendulum-chain/api-solang';
import { Keypair } from 'stellar-sdk';

import { isNetworkEVM } from '../../helpers/networks';
import { isNetworkEVM, Networks } from '../../helpers/networks';
import { ExecutionContext, OfframpingState } from '../offrampingFlow';
import { fetchSigningServiceAccountId } from '../signingService';
import { storeDataInBackend } from '../storage/remote';
Expand All @@ -11,6 +11,11 @@ import { prepareNablaApproveTransaction, prepareNablaSwapTransaction } from './n
import { setUpAccountAndOperations, stellarCreateEphemeral } from './stellar';
import { prepareSpacewalkRedeemTransaction } from './polkadot';

export const getTransactionPhase = (network: Networks): 'squidRouter' | 'pendulumFundEphemeral' => {
// For AssetHub we skip the squidRouter and go straight to the pendulumFundEphemeral phase
return isNetworkEVM(network) ? 'squidRouter' : 'pendulumFundEphemeral';
};

export function encodeSubmittableExtrinsic(extrinsic: Extrinsic) {
return extrinsic.toHex();
}
Expand Down Expand Up @@ -94,6 +99,6 @@ export async function prepareTransactions(state: OfframpingState, context: Execu
return {
...state,
transactions,
phase: isNetworkEVM(state.network) ? 'squidRouter' : 'pendulumFundEphemeral',
phase: getTransactionPhase(state.network),
};
}

0 comments on commit 544b4f8

Please sign in to comment.