Skip to content

Commit

Permalink
chore: refactored wallet enum type
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth9890 committed Oct 2, 2024
1 parent a7ce912 commit 347fea8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions scripts/generate-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ import { WalletService } from '../services/wallet-service';
signingKey: string;
}\n\n`,
`export enum WalletTypeEnum {
ED25519 = 'ED25519',
SECP256K1 = 'SECP256K1',
Etherum = 'etherum',
Solana = 'solana',
}\n\n`,
`export interface JWTData {
did: string;
Expand Down
4 changes: 2 additions & 2 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export interface WalletSignMessageType {
}

export enum WalletTypeEnum {
ED25519 = 'ED25519',
SECP256K1 = 'SECP256K1',
Etherum = 'etherum',
Solana = 'solana',
}

export interface JWTData {
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ export const parameterChecker = (
throw new Error('Need jwt or private key');
}

const urls = ['https://dev.api.gateway.tech'];
const urls = ['https://dev.api.gateway.tech', 'https://api.gateway.tech'];

if (environment === 'dev') return { url: urls[0], mode, value };
else if (environment === 'prod') return { url: urls[1], mode, value };
else throw new Error('No valid url found!. Use sandbox or production url');
};

Expand Down
4 changes: 2 additions & 2 deletions src/services/wallet-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export class WalletService {
walletType?: WalletTypeEnum | undefined;
}) {
this.walletPrivateKey = walletPrivateKey;
this.walletType = walletType ? walletType : WalletTypeEnum.SECP256K1;
this.walletType = walletType ? walletType : WalletTypeEnum.Etherum;
this.wallet =
this.walletType === WalletTypeEnum.SECP256K1
this.walletType === WalletTypeEnum.Etherum
? new EtherumService(this.walletPrivateKey)
: new SolanaService(this.walletPrivateKey);
}
Expand Down

0 comments on commit 347fea8

Please sign in to comment.