Skip to content

Commit

Permalink
Revert "fix: provide network's pubKeyHash in transfer serializer (#16
Browse files Browse the repository at this point in the history
…)"

This reverts commit dc6e043.
  • Loading branch information
goga-m committed Nov 9, 2022
1 parent 169b10d commit 4d0b53e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/ark/source/crypto/identities/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Address {
return Base58Check.encode(buffer);
}

public static toBuffer(address: string, network?: Pick<Network, "pubKeyHash">): Buffer {
public static toBuffer(address: string, network?: Network): Buffer {
const result: Buffer = Base58Check.decode(address);

if (result[0] !== getPubKeyHash(network)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ark/source/crypto/identities/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { configManager } from "../managers/index.js";

export const getWIF = (network?: Network): number => (network ? network.wif : configManager.get("network.wif"));

export const getPubKeyHash = (network?: Pick<Network, "pubKeyHash">): number =>
export const getPubKeyHash = (network?: Network): number =>
network ? network.pubKeyHash : configManager.get("network.pubKeyHash");
6 changes: 2 additions & 4 deletions packages/ark/source/crypto/transactions/types/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BigNumber, ByteBuffer } from "@ardenthq/sdk-helpers";

import { TransactionType, TransactionTypeGroup } from "../../enums.js";
import { Address } from "../../identities/address.js";
import { ISerializeOptions, Network } from "../../interfaces/index.js";
import { ISerializeOptions } from "../../interfaces/index.js";
import * as schemas from "./schemas.js";
import { Transaction } from "./transaction.js";

Expand All @@ -28,9 +28,7 @@ export abstract class TransferTransaction extends Transaction {
buff.writeUInt32LE(data.expiration || 0);

if (data.recipientId) {
buff.writeBuffer(
Address.toBuffer(data.recipientId, data.network ? { pubKeyHash: data.network } : undefined),
);
buff.writeBuffer(Address.toBuffer(data.recipientId));
}

return buff;
Expand Down

0 comments on commit 4d0b53e

Please sign in to comment.