diff --git a/.yarn/cache/fsevents-patch-19706e7e35-10.zip b/.yarn/cache/fsevents-patch-19706e7e35-10.zip new file mode 100644 index 00000000000..aff1ab12ce5 Binary files /dev/null and b/.yarn/cache/fsevents-patch-19706e7e35-10.zip differ diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts index a2bd513397e..4be23a4a679 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/creditWithdrawal.ts @@ -28,37 +28,50 @@ const MIN_ASSET_UNLOCK_CORE_FEE_PER_BYTE = 1; const MINIMAL_WITHDRAWAL_AMOUNT = ASSET_UNLOCK_TX_SIZE * MIN_ASSET_UNLOCK_CORE_FEE_PER_BYTE * 1000; type WithdrawalOptions = { - signingKeyIndex: number + signingKeyIndex?: number + toAddress?: string }; /** Creates platform credits withdrawal request * @param identity - identity to withdraw from * @param amount - amount of credits to withdraw - * @param to - Dash L1 address * @param options - withdrawal options + * @param [options] - withdrawal options + * @param [options.toAddress] - withdrawal destination address */ export async function creditWithdrawal( this: Platform, identity: Identity, amount: number, - to: string, - options: WithdrawalOptions = { - signingKeyIndex: 3, - }, + options: WithdrawalOptions = { }, ): Promise { await this.initialize(); + // eslint-disable-next-line no-param-reassign + options = { + ...options, + signingKeyIndex: 3, + }; + const { dpp } = this; - let toAddress: Address; - try { - toAddress = new Address(to, this.client.network); - } catch (e) { - throw new Error(`Invalid core recipient "${to}" for network ${this.client.network}`); + let outputScriptBytes: Buffer | undefined; + if (options.toAddress) { + let toAddress: Address; + try { + toAddress = new Address(options.toAddress, this.client.network); + } catch (e) { + throw new Error(`Invalid core recipient "${options.toAddress}" for network ${this.client.network}`); + } + + const outputScript = Script.buildPublicKeyHashOut(toAddress); + // @ts-ignore + outputScriptBytes = outputScript.toBuffer(); + + this.logger.debug(`[Identity#creditWithdrawal] credits withdrawal from ${identity.getId().toString()} to ${toAddress.toString()} with amount ${amount}`); + } else { + this.logger.debug(`[Identity#creditWithdrawal] credits withdrawal from ${identity.getId().toString()} to recent withdrawal address with amount ${amount}`); } - this.logger.debug(`[Identity#creditWithdrawal] credits withdrawal from ${identity.getId().toString()} to ${toAddress.toString()} with amount ${amount}`); - - const outputScript = Script.buildPublicKeyHashOut(toAddress); const balance = identity.getBalance(); if (amount > balance) { @@ -88,8 +101,7 @@ export async function creditWithdrawal( BigInt(amount), coreFeePerByte, DEFAULT_POOLING, - // @ts-ignore - outputScript.toBuffer(), + outputScriptBytes, BigInt(identityNonce), ); diff --git a/packages/rs-dpp/src/identity/identity_facade.rs b/packages/rs-dpp/src/identity/identity_facade.rs index 919c68c6240..eecdf45e6e2 100644 --- a/packages/rs-dpp/src/identity/identity_facade.rs +++ b/packages/rs-dpp/src/identity/identity_facade.rs @@ -123,7 +123,7 @@ impl IdentityFacade { amount: u64, core_fee_per_byte: u32, pooling: Pooling, - output_script: CoreScript, + output_script: Option, identity_nonce: u64, ) -> Result { self.factory.create_identity_credit_withdrawal_transition( diff --git a/packages/rs-dpp/src/identity/identity_factory.rs b/packages/rs-dpp/src/identity/identity_factory.rs index c6aface5912..48f73698181 100644 --- a/packages/rs-dpp/src/identity/identity_factory.rs +++ b/packages/rs-dpp/src/identity/identity_factory.rs @@ -43,6 +43,8 @@ use crate::state_transition::identity_credit_transfer_transition::IdentityCredit #[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::identity_credit_withdrawal_transition::v0::IdentityCreditWithdrawalTransitionV0; #[cfg(all(feature = "state-transitions", feature = "client"))] +use crate::state_transition::identity_credit_withdrawal_transition::v1::IdentityCreditWithdrawalTransitionV1; +#[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition; #[cfg(all(feature = "state-transitions", feature = "client"))] use crate::state_transition::identity_topup_transition::accessors::IdentityTopUpTransitionAccessorsV0; @@ -233,22 +235,61 @@ impl IdentityFactory { amount: u64, core_fee_per_byte: u32, pooling: Pooling, - output_script: CoreScript, + output_script: Option, identity_nonce: IdentityNonce, ) -> Result { - let identity_credit_withdrawal_transition = IdentityCreditWithdrawalTransitionV0 { - identity_id, - amount, - core_fee_per_byte, - pooling, - output_script, - nonce: identity_nonce, - ..Default::default() + let platform_version = PlatformVersion::get(self.protocol_version)?; + + let identity_credit_withdrawal_transition = match platform_version + .dpp + .state_transitions + .identities + .credit_withdrawal + .default_constructor + { + 0 => { + let output_script = output_script.ok_or_else(|| { + ProtocolError::Generic( + "Output script is required for IdentityCreditWithdrawalTransitionV0" + .to_string(), + ) + })?; + + let transition = IdentityCreditWithdrawalTransitionV0 { + identity_id, + amount, + core_fee_per_byte, + pooling, + output_script, + nonce: identity_nonce, + ..Default::default() + }; + + IdentityCreditWithdrawalTransition::from(transition) + } + 1 => { + let transition = IdentityCreditWithdrawalTransitionV1 { + identity_id, + amount, + core_fee_per_byte, + pooling, + output_script, + nonce: identity_nonce, + ..Default::default() + }; + + IdentityCreditWithdrawalTransition::from(transition) + } + version => { + return Err(ProtocolError::UnknownVersionMismatch { + method: "create_identity_credit_withdrawal_transition".to_string(), + known_versions: vec![0, 1], + received: version, + }); + } }; - Ok(IdentityCreditWithdrawalTransition::from( - identity_credit_withdrawal_transition, - )) + Ok(identity_credit_withdrawal_transition) } #[cfg(all(feature = "state-transitions", feature = "client"))] diff --git a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs index 5b93592a365..0badee88b91 100644 --- a/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs +++ b/packages/rs-dpp/src/state_transition/state_transitions/identity/identity_credit_withdrawal_transition/mod.rs @@ -73,8 +73,10 @@ impl IdentityCreditWithdrawalTransition { pub fn default_versioned(platform_version: &PlatformVersion) -> Result { match platform_version .dpp - .identity_versions - .identity_structure_version + .state_transitions + .identities + .credit_withdrawal + .default_constructor { 0 => Ok(IdentityCreditWithdrawalTransition::V0( IdentityCreditWithdrawalTransitionV0::default(), diff --git a/packages/rs-platform-version/src/version/dpp_versions.rs b/packages/rs-platform-version/src/version/dpp_versions.rs index 7c84e660a49..713f9dc54af 100644 --- a/packages/rs-platform-version/src/version/dpp_versions.rs +++ b/packages/rs-platform-version/src/version/dpp_versions.rs @@ -27,6 +27,12 @@ pub struct StateTransitionVersions { pub struct IdentityTransitionVersions { pub max_public_keys_in_creation: u16, pub asset_locks: IdentityTransitionAssetLockVersions, + pub credit_withdrawal: IdentityCreditWithdrawalTransitionVersions, +} + +#[derive(Clone, Debug, Default)] +pub struct IdentityCreditWithdrawalTransitionVersions { + pub default_constructor: FeatureVersion, } #[derive(Clone, Debug, Default)] diff --git a/packages/rs-platform-version/src/version/mocks/v2_test.rs b/packages/rs-platform-version/src/version/mocks/v2_test.rs index 18698318596..28db2e2a7bb 100644 --- a/packages/rs-platform-version/src/version/mocks/v2_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v2_test.rs @@ -7,8 +7,9 @@ use crate::version::dpp_versions::{ DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, DocumentTypeMethodVersions, DocumentTypeSchemaVersions, DocumentTypeValidationVersions, DocumentTypeVersions, DocumentVersions, DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, - IdentityKeyTypeMethodVersions, IdentityTransitionAssetLockVersions, IdentityTransitionVersions, - IdentityVersions, JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, + IdentityCreditWithdrawalTransitionVersions, IdentityKeyTypeMethodVersions, + IdentityTransitionAssetLockVersions, IdentityTransitionVersions, IdentityVersions, + JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, VotingValidationVersions, VotingVersions, @@ -1183,6 +1184,9 @@ pub const TEST_PLATFORM_V2: PlatformVersion = PlatformVersion { validate_asset_lock_transaction_structure: 0, validate_instant_asset_lock_proof_structure: 0, }, + credit_withdrawal: IdentityCreditWithdrawalTransitionVersions { + default_constructor: 0, + }, }, }, contract_versions: ContractVersions { diff --git a/packages/rs-platform-version/src/version/mocks/v3_test.rs b/packages/rs-platform-version/src/version/mocks/v3_test.rs index 9fef855e85e..aab569b63ec 100644 --- a/packages/rs-platform-version/src/version/mocks/v3_test.rs +++ b/packages/rs-platform-version/src/version/mocks/v3_test.rs @@ -7,8 +7,9 @@ use crate::version::dpp_versions::{ DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, DocumentTypeMethodVersions, DocumentTypeSchemaVersions, DocumentTypeValidationVersions, DocumentTypeVersions, DocumentVersions, DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, - IdentityKeyTypeMethodVersions, IdentityTransitionAssetLockVersions, IdentityTransitionVersions, - IdentityVersions, JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, + IdentityCreditWithdrawalTransitionVersions, IdentityKeyTypeMethodVersions, + IdentityTransitionAssetLockVersions, IdentityTransitionVersions, IdentityVersions, + JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, VotingValidationVersions, VotingVersions, @@ -1183,6 +1184,9 @@ pub const TEST_PLATFORM_V3: PlatformVersion = PlatformVersion { validate_asset_lock_transaction_structure: 0, validate_instant_asset_lock_proof_structure: 0, }, + credit_withdrawal: IdentityCreditWithdrawalTransitionVersions { + default_constructor: 0, + }, }, }, contract_versions: ContractVersions { diff --git a/packages/rs-platform-version/src/version/v1.rs b/packages/rs-platform-version/src/version/v1.rs index 38200b9a61b..8104775a5e9 100644 --- a/packages/rs-platform-version/src/version/v1.rs +++ b/packages/rs-platform-version/src/version/v1.rs @@ -7,8 +7,9 @@ use crate::version::dpp_versions::{ DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, DocumentTypeMethodVersions, DocumentTypeSchemaVersions, DocumentTypeValidationVersions, DocumentTypeVersions, DocumentVersions, DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, - IdentityKeyTypeMethodVersions, IdentityTransitionAssetLockVersions, IdentityTransitionVersions, - IdentityVersions, JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, + IdentityCreditWithdrawalTransitionVersions, IdentityKeyTypeMethodVersions, + IdentityTransitionAssetLockVersions, IdentityTransitionVersions, IdentityVersions, + JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, VotingValidationVersions, VotingVersions, @@ -1182,6 +1183,9 @@ pub const PLATFORM_V1: PlatformVersion = PlatformVersion { validate_asset_lock_transaction_structure: 0, validate_instant_asset_lock_proof_structure: 0, }, + credit_withdrawal: IdentityCreditWithdrawalTransitionVersions { + default_constructor: 0, + }, }, }, contract_versions: ContractVersions { diff --git a/packages/rs-platform-version/src/version/v2.rs b/packages/rs-platform-version/src/version/v2.rs index 591e17d0c46..3f9931df8af 100644 --- a/packages/rs-platform-version/src/version/v2.rs +++ b/packages/rs-platform-version/src/version/v2.rs @@ -7,8 +7,9 @@ use crate::version::dpp_versions::{ DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, DocumentTypeMethodVersions, DocumentTypeSchemaVersions, DocumentTypeValidationVersions, DocumentTypeVersions, DocumentVersions, DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, - IdentityKeyTypeMethodVersions, IdentityTransitionAssetLockVersions, IdentityTransitionVersions, - IdentityVersions, JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, + IdentityCreditWithdrawalTransitionVersions, IdentityKeyTypeMethodVersions, + IdentityTransitionAssetLockVersions, IdentityTransitionVersions, IdentityVersions, + JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, VotingValidationVersions, VotingVersions, @@ -1182,6 +1183,9 @@ pub const PLATFORM_V2: PlatformVersion = PlatformVersion { validate_asset_lock_transaction_structure: 0, validate_instant_asset_lock_proof_structure: 0, }, + credit_withdrawal: IdentityCreditWithdrawalTransitionVersions { + default_constructor: 0, + }, }, }, contract_versions: ContractVersions { diff --git a/packages/rs-platform-version/src/version/v3.rs b/packages/rs-platform-version/src/version/v3.rs index 543c759df70..8a57cb65a6c 100644 --- a/packages/rs-platform-version/src/version/v3.rs +++ b/packages/rs-platform-version/src/version/v3.rs @@ -7,8 +7,9 @@ use crate::version::dpp_versions::{ DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, DocumentTypeMethodVersions, DocumentTypeSchemaVersions, DocumentTypeValidationVersions, DocumentTypeVersions, DocumentVersions, DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, - IdentityKeyTypeMethodVersions, IdentityTransitionAssetLockVersions, IdentityTransitionVersions, - IdentityVersions, JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, + IdentityCreditWithdrawalTransitionVersions, IdentityKeyTypeMethodVersions, + IdentityTransitionAssetLockVersions, IdentityTransitionVersions, IdentityVersions, + JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, VotingValidationVersions, VotingVersions, @@ -1189,6 +1190,9 @@ pub const PLATFORM_V3: PlatformVersion = PlatformVersion { validate_asset_lock_transaction_structure: 0, validate_instant_asset_lock_proof_structure: 0, }, + credit_withdrawal: IdentityCreditWithdrawalTransitionVersions { + default_constructor: 1, + }, }, }, contract_versions: ContractVersions { diff --git a/packages/rs-platform-version/src/version/v4.rs b/packages/rs-platform-version/src/version/v4.rs index 7c2752f29a2..0082ec27433 100644 --- a/packages/rs-platform-version/src/version/v4.rs +++ b/packages/rs-platform-version/src/version/v4.rs @@ -7,8 +7,9 @@ use crate::version::dpp_versions::{ DocumentTypeClassMethodVersions, DocumentTypeIndexVersions, DocumentTypeMethodVersions, DocumentTypeSchemaVersions, DocumentTypeValidationVersions, DocumentTypeVersions, DocumentVersions, DocumentsBatchTransitionValidationVersions, DocumentsBatchTransitionVersions, - IdentityKeyTypeMethodVersions, IdentityTransitionAssetLockVersions, IdentityTransitionVersions, - IdentityVersions, JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, + IdentityCreditWithdrawalTransitionVersions, IdentityKeyTypeMethodVersions, + IdentityTransitionAssetLockVersions, IdentityTransitionVersions, IdentityVersions, + JsonSchemaValidatorVersions, PublicKeyInCreationMethodVersions, RecursiveSchemaValidatorVersions, StateTransitionConversionVersions, StateTransitionMethodVersions, StateTransitionSerializationVersions, StateTransitionVersions, VotingValidationVersions, VotingVersions, @@ -1184,6 +1185,9 @@ pub const PLATFORM_V4: PlatformVersion = PlatformVersion { validate_asset_lock_transaction_structure: 0, validate_instant_asset_lock_proof_structure: 0, }, + credit_withdrawal: IdentityCreditWithdrawalTransitionVersions { + default_constructor: 1, + }, }, }, contract_versions: ContractVersions { diff --git a/packages/wasm-dpp/lib/test/fixtures/getIdentityCreditWithdrawalTransitionFixture.js b/packages/wasm-dpp/lib/test/fixtures/getIdentityCreditWithdrawalTransitionFixture.js index 892acc55c1d..2bc8478f3b0 100644 --- a/packages/wasm-dpp/lib/test/fixtures/getIdentityCreditWithdrawalTransitionFixture.js +++ b/packages/wasm-dpp/lib/test/fixtures/getIdentityCreditWithdrawalTransitionFixture.js @@ -6,7 +6,7 @@ module.exports = function getIdentityCreditWithdrawalTransitionFixture() { const privateKey = new PrivateKey('cSBnVM4xvxarwGQuAfQFwqDg9k5tErHUHzgWsEfD4zdwUasvqRVY'); const address = privateKey.toAddress(); - const stateTransition = new IdentityCreditWithdrawalTransition(1); + const stateTransition = new IdentityCreditWithdrawalTransition(3); stateTransition.setIdentityId(generateRandomIdentifier()); // eslint-disable-next-line stateTransition.setAmount(BigInt(1000)); diff --git a/packages/wasm-dpp/src/identity/identity_facade.rs b/packages/wasm-dpp/src/identity/identity_facade.rs index d14892d4f9f..bd4db7d491d 100644 --- a/packages/wasm-dpp/src/identity/identity_facade.rs +++ b/packages/wasm-dpp/src/identity/identity_facade.rs @@ -206,7 +206,7 @@ impl IdentityFacadeWasm { amount: u64, core_fee_per_byte: u32, pooling: u8, - output_script: Vec, + output_script: Option>, identity_nonce: u64, ) -> Result { let pooling = match pooling { @@ -222,7 +222,7 @@ impl IdentityFacadeWasm { amount, core_fee_per_byte, pooling, - CoreScript::from_bytes(output_script), + output_script.map(CoreScript::from_bytes), identity_nonce as IdentityNonce, ) .map(Into::into) diff --git a/packages/wasm-dpp/src/identity/identity_factory.rs b/packages/wasm-dpp/src/identity/identity_factory.rs index b4fcf35d551..799598b4560 100644 --- a/packages/wasm-dpp/src/identity/identity_factory.rs +++ b/packages/wasm-dpp/src/identity/identity_factory.rs @@ -210,7 +210,7 @@ impl IdentityFactoryWasm { amount: u64, core_fee_per_byte: u32, pooling: u8, - output_script: Vec, + output_script: Option>, identity_nonce: u64, ) -> Result { let pooling = match pooling { @@ -226,7 +226,7 @@ impl IdentityFactoryWasm { amount, core_fee_per_byte, pooling, - CoreScript::from_bytes(output_script), + output_script.map(CoreScript::from_bytes), identity_nonce as IdentityNonce, ) .map(Into::into) diff --git a/packages/wasm-dpp/test/integration/identity/IdentityFacade.spec.js b/packages/wasm-dpp/test/integration/identity/IdentityFacade.spec.js index 90778aa72e9..2ed05d3bcbf 100644 --- a/packages/wasm-dpp/test/integration/identity/IdentityFacade.spec.js +++ b/packages/wasm-dpp/test/integration/identity/IdentityFacade.spec.js @@ -24,7 +24,7 @@ describe('IdentityFacade', () => { beforeEach(async () => { dpp = new DashPlatformProtocol( { generate: () => crypto.randomBytes(32) }, - 1, + 3, ); const chainAssetLockProofJS = getChainAssetLockProofFixture(); diff --git a/packages/wasm-dpp/test/unit/identity/IdentityFactory.spec.js b/packages/wasm-dpp/test/unit/identity/IdentityFactory.spec.js index 25c23be0c91..1cd8fc84693 100644 --- a/packages/wasm-dpp/test/unit/identity/IdentityFactory.spec.js +++ b/packages/wasm-dpp/test/unit/identity/IdentityFactory.spec.js @@ -26,7 +26,7 @@ describe('IdentityFactory', () => { // const identityValidator = new IdentityValidator(blsAdapter); - factory = new IdentityFactory(1); + factory = new IdentityFactory(3); identity = await getIdentityFixture(instantAssetLockProof.createIdentifier()); identity.setBalance(0); diff --git a/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityCreditWithdrawalTransition/IdentityCreditWithdrawalTransition.spec.js b/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityCreditWithdrawalTransition/IdentityCreditWithdrawalTransition.spec.js index b80c611116e..503ecf4bef1 100644 --- a/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityCreditWithdrawalTransition/IdentityCreditWithdrawalTransition.spec.js +++ b/packages/wasm-dpp/test/unit/identity/stateTransition/IdentityCreditWithdrawalTransition/IdentityCreditWithdrawalTransition.spec.js @@ -75,7 +75,7 @@ describe('IdentityCreditWithdrawalTransition', () => { rawStateTransition = stateTransition.toObject(); expect(rawStateTransition).to.deep.equal({ - $version: '0', + $version: '1', type: StateTransitionTypes.IdentityCreditWithdrawal, identityId: stateTransition.getIdentityId().toBuffer(), amount: stateTransition.getAmount(), @@ -92,7 +92,7 @@ describe('IdentityCreditWithdrawalTransition', () => { rawStateTransition = stateTransition.toObject({ skipSignature: true }); expect(rawStateTransition).to.deep.equal({ - $version: '0', + $version: '1', type: StateTransitionTypes.IdentityCreditWithdrawal, identityId: stateTransition.getIdentityId().toBuffer(), amount: stateTransition.getAmount(), @@ -109,7 +109,7 @@ describe('IdentityCreditWithdrawalTransition', () => { const jsonStateTransition = stateTransition.toJSON(); expect(jsonStateTransition).to.deep.equal({ - $version: '0', + $version: '1', type: StateTransitionTypes.IdentityCreditWithdrawal, identityId: stateTransition.getIdentityId().toString(), amount: stateTransition.getAmount().toString(),