Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python/nodejs: fix DelegationOutput validator address #2110

Merged
merged 3 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions bindings/nodejs/lib/types/block/output/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { TokenScheme, TokenSchemeDiscriminator } from './token-scheme';
import { AccountId, NftId, AnchorId, DelegationId } from '../id';
import { EpochIndex } from '../../block/slot';
import { NativeToken } from '../../models/native-token';
import { Address, AddressDiscriminator, AccountAddress } from '../address';

export type OutputId = HexEncodedString;

Expand Down Expand Up @@ -344,7 +345,10 @@ class DelegationOutput extends Output {
/**
* The Account ID of the validator to which this output is delegating.
*/
readonly validatorId: AccountId;
@Type(() => Address, {
discriminator: AddressDiscriminator,
})
readonly validatorAddress: Address;
/**
* The index of the first epoch for which this output delegates.
*/
Expand All @@ -365,7 +369,7 @@ class DelegationOutput extends Output {
* @param amount The amount of the output.
* @param delegatedAmount The amount of delegated coins.
* @param delegationId Unique identifier of the Delegation Output, which is the BLAKE2b-256 hash of the Output ID that created it.
* @param validatorId The Account ID of the validator to which this output is delegating.
* @param validatorAddress The Account address of the validator to which this output is delegating.
* @param startEpoch The index of the first epoch for which this output delegates.
* @param endEpoch The index of the last epoch for which this output delegates.
* @param unlockConditions The unlock conditions of the output.
Expand All @@ -374,15 +378,15 @@ class DelegationOutput extends Output {
amount: u64,
delegatedAmount: u64,
delegationId: DelegationId,
validatorId: AccountId,
validatorAddress: AccountAddress,
startEpoch: EpochIndex,
endEpoch: EpochIndex,
unlockConditions: UnlockCondition[],
) {
super(OutputType.Delegation, amount);
this.delegatedAmount = delegatedAmount;
this.delegationId = delegationId;
this.validatorId = validatorId;
this.validatorAddress = validatorAddress;
this.startEpoch = startEpoch;
this.endEpoch = endEpoch;
this.unlockConditions = unlockConditions;
Expand Down
3 changes: 2 additions & 1 deletion bindings/python/iota_sdk/client/_node_core_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ def get_included_block(self, transaction_id: TransactionId) -> Block:
'transactionId': transaction_id
}))

def get_included_block_raw(self, transaction_id: TransactionId) -> List[int]:
def get_included_block_raw(
self, transaction_id: TransactionId) -> List[int]:
"""Returns the earliest confirmed block containing the transaction with the given ID, as raw bytes.
GET /api/core/v3/transactions/{transactionId}/included-block

Expand Down
3 changes: 2 additions & 1 deletion bindings/python/iota_sdk/types/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from iota_sdk.types.feature import deserialize_features, SenderFeature, IssuerFeature, MetadataFeature, TagFeature, NativeTokenFeature
from iota_sdk.types.token_scheme import SimpleTokenScheme
from iota_sdk.types.unlock_condition import deserialize_unlock_conditions, AddressUnlockCondition, StateControllerAddressUnlockCondition, GovernorAddressUnlockCondition, StorageDepositReturnUnlockCondition, TimelockUnlockCondition, ExpirationUnlockCondition, ImmutableAccountAddressUnlockCondition
from iota_sdk.types.address import AccountAddress


class OutputType(IntEnum):
Expand Down Expand Up @@ -284,7 +285,7 @@ class DelegationOutput:
encoder=str
))
delegation_id: HexStr
validator_address: HexStr
validator_address: AccountAddress
start_epoch: EpochIndex
end_epoch: EpochIndex
unlock_conditions: List[AddressUnlockCondition] = field(metadata=config(
Expand Down
Loading