-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ (signer-btc) [DSDK-472]: Implement update PSBT and extract transact…
…ion (#607)
- Loading branch information
Showing
30 changed files
with
2,034 additions
and
9 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/device-signer-kit-bitcoin": minor | ||
--- | ||
|
||
Sign transaction API |
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
63 changes: 63 additions & 0 deletions
63
packages/signer/signer-btc/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,63 @@ | ||
import { | ||
type CommandErrorResult, | ||
type DeviceActionState, | ||
type ExecuteDeviceActionReturnType, | ||
type HexaString, | ||
type OpenAppDAError, | ||
type OpenAppDARequiredInteraction, | ||
} from "@ledgerhq/device-management-kit"; | ||
|
||
import { type SignPsbtDARequiredInteraction } from "@api/app-binder/SignPsbtDeviceActionTypes"; | ||
import { type Psbt as ApiPsbt } from "@api/model/Psbt"; | ||
import { type PsbtSignature } from "@api/model/Signature"; | ||
import { type Wallet as ApiWallet } from "@api/model/Wallet"; | ||
import { type BtcErrorCodes } from "@internal/app-binder/command/utils/bitcoinAppErrors"; | ||
import { type DataStoreService } from "@internal/data-store/service/DataStoreService"; | ||
import { type Psbt as InternalPsbt } from "@internal/psbt/model/Psbt"; | ||
import { type PsbtMapper } from "@internal/psbt/service/psbt/PsbtMapper"; | ||
import { type ValueParser } from "@internal/psbt/service/value/ValueParser"; | ||
import { type WalletBuilder } from "@internal/wallet/service/WalletBuilder"; | ||
import { type WalletSerializer } from "@internal/wallet/service/WalletSerializer"; | ||
|
||
export type SignTransactionDAOutput = HexaString; | ||
|
||
export type SignTransactionDAInput = { | ||
psbt: ApiPsbt; | ||
wallet: ApiWallet; | ||
walletBuilder: WalletBuilder; | ||
walletSerializer: WalletSerializer; | ||
dataStoreService: DataStoreService; | ||
psbtMapper: PsbtMapper; | ||
valueParser: ValueParser; | ||
}; | ||
|
||
export type SignTransactionDAError = | ||
| OpenAppDAError | ||
| CommandErrorResult<BtcErrorCodes>["error"]; | ||
|
||
type SignTransactionDARequiredInteraction = | ||
| OpenAppDARequiredInteraction | ||
| SignPsbtDARequiredInteraction; | ||
|
||
export type SignTransactionDAIntermediateValue = { | ||
requiredUserInteraction: SignTransactionDARequiredInteraction; | ||
}; | ||
|
||
export type SignTransactionDAState = DeviceActionState< | ||
SignTransactionDAOutput, | ||
SignTransactionDAError, | ||
SignTransactionDAIntermediateValue | ||
>; | ||
|
||
export type SignTransactionDAInternalState = { | ||
readonly error: SignTransactionDAError | null; | ||
readonly signatures: PsbtSignature[] | null; | ||
readonly signedPsbt: InternalPsbt | null; | ||
readonly transaction: HexaString | 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
Oops, something went wrong.