|
4 | 4 | import { DecodedUtxoObj } from './iface'; |
5 | 5 |
|
6 | 6 | /** |
7 | | - * Extended transaction interface with additional properties |
8 | | - * used by transaction builders |
| 7 | + * Base extended transaction interface with common optional properties |
9 | 8 | */ |
10 | | -export interface ExtendedTransaction { |
11 | | - _rewardAddresses?: string[]; |
12 | | - _outputAmount?: string; |
| 9 | +export interface BaseExtendedTransaction { |
13 | 10 | _memo?: Uint8Array; |
14 | | - _delegationFeeRate?: number; |
15 | | - _blsPublicKey?: string; |
16 | | - _blsSignature?: string; |
| 11 | + _outputAmount?: string; |
| 12 | + _utxos?: DecodedUtxoObj[]; |
| 13 | +} |
| 14 | + |
| 15 | +/** |
| 16 | + * Extended transaction for staking transactions (delegator/validator) |
| 17 | + */ |
| 18 | +export interface StakingExtendedTransaction extends BaseExtendedTransaction { |
| 19 | + _rewardAddresses: string[]; // Required for all staking transactions |
17 | 20 | _nodeID?: string; |
18 | 21 | _startTime?: bigint; |
19 | 22 | _endTime?: bigint; |
20 | 23 | _stakeAmount?: bigint; |
21 | | - _utxos?: DecodedUtxoObj[]; |
| 24 | +} |
| 25 | + |
| 26 | +/** |
| 27 | + * Extended transaction for validator transactions |
| 28 | + */ |
| 29 | +export interface ValidatorExtendedTransaction extends StakingExtendedTransaction { |
| 30 | + _delegationFeeRate?: number; |
| 31 | +} |
| 32 | + |
| 33 | +/** |
| 34 | + * Extended transaction for permissionless validator transactions |
| 35 | + */ |
| 36 | +export interface PermissionlessValidatorExtendedTransaction extends ValidatorExtendedTransaction { |
| 37 | + _blsPublicKey?: string; |
| 38 | + _blsSignature?: string; |
22 | 39 | } |
23 | 40 |
|
24 | 41 | /** |
@@ -73,6 +90,10 @@ export type RawTransactionData = |
73 | 90 | | PermissionlessValidatorRawTransactionData; |
74 | 91 |
|
75 | 92 | /** |
76 | | - * Transaction with extended properties type assertion helper |
| 93 | + * Specific transaction extension types for better type safety |
77 | 94 | */ |
78 | | -export type TransactionWithExtensions = ExtendedTransaction & Record<string, unknown>; |
| 95 | +export type TransactionWithBaseExtensions = BaseExtendedTransaction & Record<string, unknown>; |
| 96 | +export type TransactionWithStakingExtensions = StakingExtendedTransaction & Record<string, unknown>; |
| 97 | +export type TransactionWithValidatorExtensions = ValidatorExtendedTransaction & Record<string, unknown>; |
| 98 | +export type TransactionWithPermissionlessValidatorExtensions = PermissionlessValidatorExtendedTransaction & |
| 99 | + Record<string, unknown>; |
0 commit comments