Skip to content

Commit 66245eb

Browse files
Merge remote-tracking branch 'origin/HSM-850'
2 parents ecc391e + c8ec337 commit 66245eb

File tree

5 files changed

+20
-7
lines changed

5 files changed

+20
-7
lines changed

modules/abstract-eth/src/lib/transaction.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,21 @@ export class Transaction extends BaseTransaction {
3434
* @param coinConfig The coin configuration object
3535
* @param common network commons
3636
* @param serializedTx The serialized tx string with which to initialize the transaction
37+
* @param isFirstSigner whether the transaction is being signed by the first signer
3738
* @returns a new transaction object
3839
*/
3940
public static fromSerialized(
4041
coinConfig: Readonly<CoinConfig>,
4142
common: EthereumCommon,
42-
serializedTx: string
43+
serializedTx: string,
44+
isFirstSigner?: boolean
4345
): Transaction {
44-
return new Transaction(coinConfig, common, EthTransactionData.fromSerialized(serializedTx, common).toJson());
46+
return new Transaction(
47+
coinConfig,
48+
common,
49+
EthTransactionData.fromSerialized(serializedTx, common).toJson(),
50+
isFirstSigner
51+
);
4552
}
4653

4754
/**
@@ -50,19 +57,21 @@ export class Transaction extends BaseTransaction {
5057
* @param {Readonly<CoinConfig>} coinConfig
5158
* @param common the network commons
5259
* @param {TxData} txData The object transaction data or encoded transaction data
60+
* @param {boolean} isFirstSigner whether the transaction is being signed by the first signer
5361
*/
54-
constructor(coinConfig: Readonly<CoinConfig>, common: EthereumCommon, txData?: TxData) {
62+
constructor(coinConfig: Readonly<CoinConfig>, common: EthereumCommon, txData?: TxData, isFirstSigner?: boolean) {
5563
super(coinConfig);
5664
this._common = common;
5765
if (txData) {
58-
this.setTransactionData(txData);
66+
this.setTransactionData(txData, isFirstSigner);
5967
}
6068
}
6169

6270
/**
6371
* Set the transaction data
6472
*
6573
* @param {TxData} txData The transaction data to set
74+
* @param {boolean} isFirstSigner Whether the transaction is being signed by the first signer
6675
*/
6776
setTransactionData(txData: TxData, isFirstSigner?: boolean): void {
6877
this._transactionData = EthTransactionData.fromJson(txData, this._common);

modules/abstract-eth/src/lib/transactionBuilder.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
157157
protected fromImplementation(rawTransaction: string, isFirstSigner?: boolean): Transaction {
158158
let tx: Transaction;
159159
if (/^0x?[0-9a-f]{1,}$/.test(rawTransaction.toLowerCase())) {
160-
tx = Transaction.fromSerialized(this._coinConfig, this._common, rawTransaction);
160+
tx = Transaction.fromSerialized(this._coinConfig, this._common, rawTransaction, isFirstSigner);
161161
this.loadBuilderInput(tx.toJson(), isFirstSigner);
162162
} else {
163163
const txData = JSON.parse(rawTransaction);
@@ -618,7 +618,8 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
618618
/**
619619
* Gets the transfer funds builder if exist, or creates a new one for this transaction and returns it
620620
*
621-
* @param [data] transfer data to initialize the transfer builder with, empty if none given
621+
* @param {string} data transfer data to initialize the transfer builder with, empty if none given
622+
* @param {boolean} isFirstSigner whether the transaction is being signed by the first signer
622623
* @returns {TransferBuilder | ERC721TransferBuilder | ERC1155TransferBuilder} the transfer builder
623624
*/
624625
abstract transfer(

modules/abstract-eth/src/lib/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ export function decodeWalletCreationData(data: string): WalletInitializationData
292292
* Decode the given ABI-encoded transfer data and return parsed fields
293293
*
294294
* @param data The data to decode
295+
* @param isFirstSigner whether transaction is being built for a first signer
295296
* @returns parsed transfer data
296297
*/
297298
export function decodeTransferData(data: string, isFirstSigner?: boolean): TransferData {

modules/sdk-coin-eth/src/lib/transactionBuilder.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export class TransactionBuilder extends EthLikeTransactionBuilder {
2626
/**
2727
* Gets the transfer funds builder if exist, or creates a new one for this transaction and returns it
2828
*
29-
* @param [data] transfer data to initialize the transfer builder with, empty if none given
29+
* @param {string} data transfer data to initialize the transfer builder with, empty if none given
30+
* @param {boolean} isFirstSigner whether the transaction is being signed by the first signer
3031
* @returns {TransferBuilder | ERC721TransferBuilder | ERC1155TransferBuilder} the transfer builder
3132
*/
3233
transfer(data?: string, isFirstSigner?: boolean): TransferBuilder | ERC721TransferBuilder | ERC1155TransferBuilder {

modules/sdk-core/src/account-lib/baseCoin/baseTransactionBuilder.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export abstract class BaseTransactionBuilder {
2424
* extending this class. Some examples are hex, base64, or JSON.
2525
*
2626
* @param rawTransaction A raw transaction to be parsed
27+
* @param isFirstSigner Whether the transaction is being signed by the first signer
2728
*/
2829
from(rawTransaction: any, isFirstSigner?: boolean): void {
2930
this.validateRawTransaction(rawTransaction);

0 commit comments

Comments
 (0)