Skip to content

Commit

Permalink
[add] test
Browse files Browse the repository at this point in the history
  • Loading branch information
ymuichiro committed Aug 5, 2023
1 parent a820f2b commit a82218a
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions packages/app/services/AccountBase.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { mosaicRoutesApi } from '@/services/InitOas';
import { Mosaic } from 'symbol-oas/types/models';
import { Address, PublicAccount } from 'symbol-sdk/dist/src/model/account';
import { NetworkType } from 'symbol-sdk/dist/src/model/network';
import { Mosaic } from 'symbol-oas/types/models';
import { NetworkSymbol } from './NetworkSymbol';
import { mosaicRoutesApi } from '@/services/InitOas';

interface MosaicInfo {
id: string;
Expand All @@ -18,6 +18,7 @@ export default class AccountBase {

protected constructor(publicKey: string, networkType: NetworkType) {
this.privateMessage = 'this is a private message!';
console.log({ publicKey, networkType });
this.account = PublicAccount.createFromPublicKey(publicKey, networkType);
this.networkType = networkType;
}
Expand Down Expand Up @@ -51,14 +52,4 @@ export default class AccountBase {
}
return parsedMosaics;
}

static isCorrectPublicKey(publicKey: string): boolean {
if (publicKey.length > 79 || publicKey.length < 19) return false;
try {
Address.createFromPublicKey(publicKey, NetworkType.MAIN_NET); // ネットワークタイプは考慮不要
} catch {
return false;
}
return true;
}
}

0 comments on commit a82218a

Please sign in to comment.