-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ (keyring-eth) [DSDK-425]: Add SignTransactionDeviceAction (#227)
- Loading branch information
Showing
17 changed files
with
1,261 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ledgerhq/keyring-eth": patch | ||
--- | ||
|
||
Implement SignTransactionDeviceAction |
61 changes: 61 additions & 0 deletions
61
packages/signer/keyring-eth/src/api/app-binder/SignTransactionDeviceActionTypes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { | ||
ClearSignContextSuccess, | ||
ContextModule, | ||
} from "@ledgerhq/context-module"; | ||
import { | ||
CommandErrorResult, | ||
DeviceActionState, | ||
ExecuteDeviceActionReturnType, | ||
OpenAppDAError, | ||
OpenAppDARequiredInteraction, | ||
UserInteractionRequired, | ||
} from "@ledgerhq/device-sdk-core"; | ||
|
||
import { Signature } from "@api/model/Signature"; | ||
import { Transaction } from "@api/model/Transaction"; | ||
import { TransactionOptions } from "@api/model/TransactionOptions"; | ||
import { ProvideTransactionContextTaskErrorCodes } from "@internal/app-binder/task/ProvideTransactionContextTask"; | ||
import { TransactionMapperService } from "@internal/transaction/service/mapper/TransactionMapperService"; | ||
|
||
export type SignTransactionDAOutput = Signature; | ||
|
||
export type SignTransactionDAInput = { | ||
readonly derivationPath: string; | ||
readonly transaction: Transaction; | ||
readonly mapper: TransactionMapperService; | ||
readonly contextModule: ContextModule; | ||
readonly options: TransactionOptions; | ||
}; | ||
|
||
export type SignTransactionDAError = | ||
| OpenAppDAError | ||
| CommandErrorResult["error"] | ||
| CommandErrorResult<ProvideTransactionContextTaskErrorCodes>["error"]; | ||
|
||
type SignTransactionDARequiredInteraction = | ||
| OpenAppDARequiredInteraction | ||
| UserInteractionRequired.SignTransaction; | ||
|
||
export type SignTransactionDAIntermediateValue = { | ||
requiredUserInteraction: SignTransactionDARequiredInteraction; | ||
}; | ||
|
||
export type SignTransactionDAState = DeviceActionState< | ||
SignTransactionDAOutput, | ||
SignTransactionDAError, | ||
SignTransactionDAIntermediateValue | ||
>; | ||
|
||
export type SignTransactionDAInternalState = { | ||
readonly error: SignTransactionDAError | null; | ||
readonly challenge: string | null; | ||
readonly clearSignContexts: ClearSignContextSuccess[] | null; | ||
readonly serializedTransaction: Uint8Array | null; | ||
readonly signature: Signature | null; | ||
}; | ||
|
||
export type SignTransactionDAReturnType = ExecuteDeviceActionReturnType< | ||
SignTransactionDAOutput, | ||
SignTransactionDAError, | ||
SignTransactionDAIntermediateValue | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.