Skip to content
This repository was archived by the owner on Mar 20, 2024. It is now read-only.

Commit ee71bea

Browse files
committed
Simplified initFunctions naming
- initFromSeed > fromSeed - initFromMasterKey > fromMasterKey
1 parent d1549d4 commit ee71bea

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

src/interfaces/network.interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export type IContentType = {
3434
newKeypairResponse?: IKeypairEncrypted;
3535
getMasterKeyResponse?: IMasterKeyEncrypted;
3636
initNewResponse?: [string, IMasterKeyEncrypted];
37-
initFromSeedResponse?: IMasterKeyEncrypted;
37+
fromSeedResponse?: IMasterKeyEncrypted;
3838
regenWalletResponse?: IKeypairEncrypted[];
3939
signMessageResponse?: IGenericKeyPair<string>;
4040
decryptKeypairResponse?: IKeypair;

src/services/ablock.service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ export class ABlockWallet {
114114
* @return {*} {IClientResponse}
115115
* @memberof ABlockWallet
116116
*/
117-
public async initFromMasterKey(
118-
config: IClientConfig,
117+
public async fromMasterKey(
119118
masterKey: IMasterKeyEncrypted,
119+
config: IClientConfig,
120120
initOffline = false,
121121
): Promise<IClientResponse> {
122122
this.keyMgmt = new mgmtClient();
123-
const initIResult = this.keyMgmt.initFromMasterKey(config.passPhrase, masterKey);
123+
const initIResult = this.keyMgmt.fromMasterKey(masterKey, config.passPhrase);
124124
if (!initOffline) {
125125
const initNetworkIResult = await this.initNetwork(config);
126126
if (initNetworkIResult.status === 'error') {
@@ -151,13 +151,13 @@ export class ABlockWallet {
151151
*
152152
* @memberof ABlockWallet
153153
*/
154-
public async initFromSeed(
154+
public async fromSeed(
155155
config: IClientConfig,
156156
seedPhrase: string,
157157
initOffline = false,
158158
): Promise<IClientResponse> {
159159
this.keyMgmt = new mgmtClient();
160-
const initIResult = this.keyMgmt.initFromSeed(config.passPhrase, seedPhrase);
160+
const initIResult = this.keyMgmt.fromSeed(config.passPhrase, seedPhrase);
161161
if (!initOffline) {
162162
const initNetworkIResult = await this.initNetwork(config);
163163
if (initNetworkIResult.status === 'error') {
@@ -174,7 +174,7 @@ export class ABlockWallet {
174174
status: 'success',
175175
reason: ISuccessInternal.ClientInitialized,
176176
content: {
177-
initFromSeedResponse: initIResult.value,
177+
fromSeedResponse: initIResult.value,
178178
},
179179
} as IClientResponse;
180180
}

src/services/mgmt.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class mgmtClient {
8484
* @return {*} {IResult<void>}
8585
* @memberof mgmtClient
8686
*/
87-
public initFromMasterKey(passphraseKey: string, masterKey: IMasterKeyEncrypted): IResult<void> {
87+
public fromMasterKey(masterKey: IMasterKeyEncrypted, passphraseKey: string): IResult<void> {
8888
const passphrase = getPassphraseBuffer(passphraseKey);
8989
if (passphrase.isErr()) return err(passphrase.error);
9090
this.passphraseKey = passphrase.value;
@@ -103,7 +103,7 @@ export class mgmtClient {
103103
* @return {*} {IResult<IMasterKeyEncrypted>}
104104
* @memberof mgmtClient
105105
*/
106-
public initFromSeed(passphraseKey: string, seedPhrase: string): IResult<IMasterKeyEncrypted> {
106+
public fromSeed(passphraseKey: string, seedPhrase: string): IResult<IMasterKeyEncrypted> {
107107
const passphrase = getPassphraseBuffer(passphraseKey);
108108
if (passphrase.isErr()) return err(passphrase.error);
109109
this.passphraseKey = passphrase.value;

src/tests/__tests__/ablock.service.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test('handles key-pair re-generation from wallet seed phrase', async () => {
2020
'28a7de5c30f8271be690db7a979e1be33d31f6b6aebaa3c82888354ba214c24d',
2121
];
2222

23-
await ablockInstance.initFromSeed(
23+
await ablockInstance.fromSeed(
2424
{ mempoolHost: '', intercomHost: '', passPhrase: 'passphrase' },
2525
SEED,
2626
true,

src/tests/__tests__/receipts.mgmt.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ test('creates a valid payload to create receipts', () => {
4141
"{'test': 'test'}",
4242
);
4343

44-
console.log('metadataPayload', metadataPayload);
45-
4644
if (payload.isOk()) {
4745
expect(payload.value).toEqual({
4846
receipt_amount: 1000,

0 commit comments

Comments
 (0)