Skip to content

Commit

Permalink
Merge pull request #25 from luxtagofficial/develop
Browse files Browse the repository at this point in the history
fix(ApostillePublicAccount): Fix transfer not removing previous owners
  • Loading branch information
aizaiz authored Nov 28, 2018
2 parents e987f76 + 4f00f20 commit c3cb86f
Show file tree
Hide file tree
Showing 14 changed files with 607 additions and 785 deletions.
450 changes: 236 additions & 214 deletions src/infrastructure/ApostilleHttp.ts

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions src/model/apostille/Apostille.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const fixPrivateKey = (privateKey) => {
* @class Apostille
*/
export class Apostille {

/**
* @description init apostille
* @static
Expand Down Expand Up @@ -41,6 +42,8 @@ export class Apostille {
return new Apostille(hdAccount);
}

private publicAccount;

/**
* Creates an instance of Apostille.
* @param {Account} hdAccount - the apostille account (HD account)
Expand All @@ -49,13 +52,17 @@ export class Apostille {
*/
public constructor(
public readonly HDAccount: Account,
) {}
) {
this.publicAccount = new ApostillePublicAccount(this.HDAccount.publicAccount);
}

/**
*
* @description - create a multisig contract to own the apostille account
* @param {PublicAccount[]} owners - array of public account that will become owners
* @param {PublicAccount[]} owners- array of public account that will become owners
* @param {number} quorum - the minimum number of owners necessary to agree on the apostille account activities
* @param {number} minRemoval - minimum number of owners necessary to agree to remove one or some owners
* @returns {SignedTransaction}
* @memberof Apostille
*/
public associate(owners: PublicAccount[], quorum: number, minRemoval: number): SignedTransaction {
Expand All @@ -66,21 +73,21 @@ export class Apostille {
MultisigCosignatoryModificationType.Add,
cosignatory));
});
const convertIntoMultisigTransaction = ModifyMultisigAccountTransaction.create(
const modifyMultisigTransaction = ModifyMultisigAccountTransaction.create(
Deadline.create(),
quorum,
minRemoval,
modifications,
this.HDAccount.address.networkType,
);

const signedTransaction = this.HDAccount.sign(convertIntoMultisigTransaction);
const signedTransaction = this.HDAccount.sign(modifyMultisigTransaction);

return signedTransaction;
return signedTransaction;
}

get apostillePublicAccount(): ApostillePublicAccount {
return new ApostillePublicAccount(this.HDAccount.publicAccount);
return this.publicAccount;
}

}
Loading

0 comments on commit c3cb86f

Please sign in to comment.