-
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): Create SignPsbt DA & task & s
- Loading branch information
1 parent
429473a
commit 038939d
Showing
25 changed files
with
1,306 additions
and
34 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 | ||
--- | ||
|
||
Create SignPsbt 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
// import { type AddressOptions } from "@api/model/AddressOptions"; | ||
// import { type Psbt } from "@api/model/Psbt"; | ||
// import { type Signature } from "@api/model/Signature"; | ||
// import { type Wallet } from "@api/model/Wallet"; | ||
import { type GetExtendedPublicKeyDAReturnType } from "@api/app-binder/GetExtendedPublicKeyDeviceActionTypes"; | ||
import { type SignMessageDAReturnType } from "@api/app-binder/SignMessageDeviceActionTypes"; | ||
import { type SignPsbtDAReturnType } from "@api/app-binder/SignPsbtDeviceActionTypes"; | ||
import { type AddressOptions } from "@api/model/AddressOptions"; | ||
import { | ||
type GetExtendedPublicKeyReturnType, | ||
type SignMessageDAReturnType, | ||
} from "@root/src"; | ||
import { type Psbt } from "@api/model/Psbt"; | ||
import { type Wallet } from "@api/model/Wallet"; | ||
|
||
export interface SignerBtc { | ||
getExtendedPublicKey: ( | ||
derivationPath: string, | ||
options: AddressOptions, | ||
) => GetExtendedPublicKeyReturnType; | ||
) => GetExtendedPublicKeyDAReturnType; | ||
signMessage: ( | ||
derivationPath: string, | ||
message: string, | ||
) => SignMessageDAReturnType; | ||
signPsbt: (wallet: Wallet, psbt: Psbt) => SignPsbtDAReturnType; | ||
// getAddress: (wallet: Wallet, options?: AddressOptions) => Promise<string>; | ||
// signPsbt: (wallet: Wallet, psbt: Psbt) => Promise<Psbt>; | ||
// signTransaction: (wallet: Wallet, psbt: Psbt) => Promise<Uint8Array>; | ||
} |
46 changes: 46 additions & 0 deletions
46
packages/signer/signer-btc/src/api/app-binder/SignPsbtDeviceActionTypes.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,46 @@ | ||
import { | ||
type CommandErrorResult, | ||
type DeviceActionState, | ||
type ExecuteDeviceActionReturnType, | ||
type OpenAppDAError, | ||
type OpenAppDARequiredInteraction, | ||
} from "@ledgerhq/device-management-kit"; | ||
|
||
import { type Psbt } from "@api/model/Psbt"; | ||
import { type Signature } from "@api/model/Signature"; | ||
import { type Wallet } from "@api/model/Wallet"; | ||
import { type BtcErrorCodes } from "@internal/app-binder/command/utils/bitcoinAppErrors"; | ||
|
||
export type SignPsbtDAOutput = Signature; | ||
|
||
export type SignPsbtDAInput = { | ||
psbt: Psbt; | ||
wallet: Wallet; | ||
}; | ||
|
||
export type SignPsbtDAError = | ||
| OpenAppDAError | ||
| CommandErrorResult<BtcErrorCodes>["error"]; | ||
|
||
type SignPsbtDARequiredInteraction = OpenAppDARequiredInteraction; | ||
|
||
export type SignPsbtDAIntermediateValue = { | ||
requiredUserInteraction: SignPsbtDARequiredInteraction; | ||
}; | ||
|
||
export type SignPsbtDAState = DeviceActionState< | ||
SignPsbtDAOutput, | ||
SignPsbtDAError, | ||
SignPsbtDAIntermediateValue | ||
>; | ||
|
||
export type SignPsbtDAInternalState = { | ||
readonly error: SignPsbtDAError | null; | ||
readonly signature: Signature | null; | ||
}; | ||
|
||
export type SignPsbtDAReturnType = ExecuteDeviceActionReturnType< | ||
SignPsbtDAOutput, | ||
SignPsbtDAError, | ||
SignPsbtDAIntermediateValue | ||
>; |
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
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
2 changes: 1 addition & 1 deletion
2
packages/signer/signer-btc/src/internal/app-binder/command/utils/constants.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const PROTOCOL_VERSION = 1; | ||
export const PROTOCOL_VERSION = 0; | ||
|
||
export const SHA256_SIZE = 32; | ||
|
||
|
Oops, something went wrong.