Skip to content

Commit

Permalink
Upgrade to 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
earrietadev committed Jan 9, 2025
1 parent 2d88524 commit 4d2a2c5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.4.1](https://github.com/Creit-Tech/Stellar-Wallets-Kit/compare/v1.4.0...v1.4.1) (2025-01-09)
### Fix
- Make the Trezor module to work with Webpack projects

### [1.4.0](https://github.com/Creit-Tech/Stellar-Wallets-Kit/compare/v1.3.0...v1.4.0) (2024-12-20)
### Add
- Add Trezor wallets support
Expand Down
15 changes: 9 additions & 6 deletions src/modules/trezor.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import { StellarSelectorModal } from '../components/selector-modal/stellar-selec
export const TREZOR_ID = 'TREZOR';

export class TrezorModule implements ModuleInterface {
TrezorConnect: typeof TrezorConnect =
'default' in TrezorConnect ? (TrezorConnect.default as typeof TrezorConnect) : TrezorConnect;

private _isAvailable: boolean = false;

moduleType: ModuleType = ModuleType.HW_WALLET;
Expand All @@ -29,7 +32,7 @@ export class TrezorModule implements ModuleInterface {
productIcon: string = 'https://stellar.creit.tech/wallet-icons/trezor.png';

constructor(params: ITrezorModuleParams) {
TrezorConnect.init({
this.TrezorConnect.init({
manifest: {
appUrl: params.appUrl,
email: params.email,
Expand Down Expand Up @@ -74,7 +77,7 @@ export class TrezorModule implements ModuleInterface {
const result = await this.openAccountSelector();
return { address: result.publicKey };
} else {
const result = await TrezorConnect.stellarGetAddress({ path: mnemonicPath, showOnTrezor: false });
const result = await this.TrezorConnect.stellarGetAddress({ path: mnemonicPath, showOnTrezor: false });
if (!result.success) {
throw parseError(new Error(result.payload.error));
}
Expand All @@ -99,7 +102,7 @@ export class TrezorModule implements ModuleInterface {
showOnTrezor: false,
}));

const result = await TrezorConnect.stellarGetAddress({ bundle });
const result = await this.TrezorConnect.stellarGetAddress({ bundle });
if (!result.success) {
throw parseError(new Error(result.payload.error));
}
Expand Down Expand Up @@ -177,7 +180,7 @@ export class TrezorModule implements ModuleInterface {
let account: string;
if (opts?.path) {
mnemonicPath = opts.path;
const result = await TrezorConnect.stellarGetAddress({ path: mnemonicPath, showOnTrezor: false });
const result = await this.TrezorConnect.stellarGetAddress({ path: mnemonicPath, showOnTrezor: false });
if (!result.success) {
throw new Error(result.payload.error);
}
Expand All @@ -192,7 +195,7 @@ export class TrezorModule implements ModuleInterface {
mnemonicPath = await firstValueFrom(mnemonicPath$);
if (!mnemonicPath)
throw parseError(new Error('There is no path available, please call the `getAddress` method first.'));
const result = await TrezorConnect.stellarGetAddress({ path: mnemonicPath, showOnTrezor: false });
const result = await this.TrezorConnect.stellarGetAddress({ path: mnemonicPath, showOnTrezor: false });
if (!result.success) {
throw new Error(result.payload.error);
}
Expand All @@ -204,7 +207,7 @@ export class TrezorModule implements ModuleInterface {

const tx: Transaction = new Transaction(xdr, network);
const parsedTx = transformTransaction(mnemonicPath, tx);
const result = await TrezorConnect.stellarSignTransaction(parsedTx);
const result = await this.TrezorConnect.stellarSignTransaction(parsedTx);

if (!result.success) {
throw parseError(new Error(result.payload.error));
Expand Down

0 comments on commit 4d2a2c5

Please sign in to comment.