Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(unstaking): Instant unstake forecasting #11

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5b9f9a9
fix(suite): clear snowflakeBinaryPath when disabling from external feat
karliatto Oct 17, 2024
a72b06a
fix: cursor in search-action when collaped
peter-sanderson Oct 24, 2024
b02a26b
feat(suite-native): other ethereum network account types have labels
vytick Oct 24, 2024
0bab0aa
ci(suite-native): enable to dispatch preview build by label 'build-mo…
matejkriz Oct 25, 2024
c973365
feat(suite-native): enable Solana via feature flag
vytick Oct 21, 2024
96159d2
refactor(suite-native): fresh address selector
PeKne Oct 24, 2024
8fc9876
fix(connect): usedElsewhere only for localSession
mroz22 Oct 25, 2024
3419d53
feat(protobuf): stop skipping LoadDevice
karliatto Oct 24, 2024
950a3d0
feat(protobuf): add message for LoadDevice
karliatto Oct 24, 2024
0d5b592
feat(connect): implement method LoadDevice
karliatto Oct 25, 2024
14aec5d
feat(connect-explorer): implement method LoadDevice
karliatto Oct 25, 2024
4951e2d
test(connect-popup): method fixture for LoadDevice
karliatto Oct 25, 2024
f8a4740
test(connect): add fixture for LoadDevice method
karliatto Oct 25, 2024
d710912
ci(scripts): add loadDevice to connet core ci tests
karliatto Oct 25, 2024
3eb7512
fix(connect-explorer): deeplink core mode from options
martykan Oct 25, 2024
d57732d
feat(suite-native): solana local graph history movements
vytick Oct 24, 2024
db9824d
feat(blockchain-link): implement ethereum rpc call
tomasklim Oct 9, 2024
8ab607c
feat(connect): implement ethereum rpc call
tomasklim Oct 9, 2024
3f593fe
feat(suite): add staking/unstaking instant amount forecasting
tomasklim Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(connect): implement method LoadDevice
karliatto committed Oct 25, 2024
commit 0d5b592ae72d66b728dfc69958820e5143d3e115
1 change: 1 addition & 0 deletions packages/connect/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ export { default as recoveryDevice } from './recoveryDevice';
// export { default as renderWebUSBButton } from './composeTransaction';
export { default as requestLogin } from './requestLogin';
export { default as resetDevice } from './resetDevice';
export { default as loadDevice } from './loadDevice';
export { default as setBrightness } from './setBrightness';
export { default as setBusy } from './setBusy';
export { default as setProxy } from './setProxy';
48 changes: 48 additions & 0 deletions packages/connect/src/api/loadDevice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { AbstractMethod } from '../core/AbstractMethod';
import { UI } from '../events';
import { getFirmwareRange } from './common/paramsValidator';
import { PROTO } from '../constants';
import { Assert } from '@trezor/schema-utils';

export default class LoadDevice extends AbstractMethod<'loadDevice', PROTO.LoadDevice> {
init() {
this.allowDeviceMode = [UI.INITIALIZE, UI.SEEDLESS];
this.useDeviceState = false;
this.requiredPermissions = ['management'];
this.firmwareRange = getFirmwareRange(this.name, null, this.firmwareRange);

const { payload } = this;
// validate bundle type
Assert(PROTO.LoadDevice, payload);

this.params = {
mnemonics: payload.mnemonics,
pin: payload.pin,
passphrase_protection: payload.passphrase_protection,
language: payload.language,
label: payload.label,
skip_checksum: payload.skip_checksum,
u2f_counter: payload.u2f_counter,
needs_backup: payload.needs_backup,
no_backup: payload.no_backup,
};
}

get info() {
return 'Load seed and related internal settings.';
}

get confirmation() {
return {
view: 'device-management' as const,
label: 'Do you really you want to load device?',
};
}

async run() {
const cmd = this.device.getCommands();
const response = await cmd.typedCall('LoadDevice', 'Success', this.params);

return response.message;
}
}
2 changes: 2 additions & 0 deletions packages/connect/src/factory.ts
Original file line number Diff line number Diff line change
@@ -214,6 +214,8 @@ export const factory = <

resetDevice: params => call({ ...params, method: 'resetDevice' }),

loadDevice: params => call({ ...params, method: 'loadDevice' }),

wipeDevice: params => call({ ...params, method: 'wipeDevice' }),

applyFlags: params => call({ ...params, method: 'applyFlags' }),
4 changes: 4 additions & 0 deletions packages/connect/src/types/api/index.ts
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@ import { recoveryDevice } from './recoveryDevice';
import { removeAllListeners } from './removeAllListeners';
import { requestLogin } from './requestLogin';
import { resetDevice } from './resetDevice';
import { loadDevice } from './loadDevice';
import { rippleGetAddress } from './rippleGetAddress';
import { rippleSignTransaction } from './rippleSignTransaction';
import { setBrightness } from './setBrightness';
@@ -279,6 +280,9 @@ export interface TrezorConnect {
// https://connect.trezor.io/9/methods/device/resetDevice/
resetDevice: typeof resetDevice;

// https://connect.trezor.io/9/methods/device/loadDevice/
loadDevice: typeof loadDevice;

// https://connect.trezor.io/9/methods/ripple/rippleGetAddress/
rippleGetAddress: typeof rippleGetAddress;

8 changes: 8 additions & 0 deletions packages/connect/src/types/api/loadDevice.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Performs device setup and generates a new seed.
*/

import { PROTO } from '../../constants';
import type { Params, Response } from '../params';

export declare function loadDevice(params: Params<PROTO.LoadDevice>): Response<PROTO.Success>;