@sidhujag/sysweb3-keyring 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +55 -47
  3. package/cjs/current-vault-refusal.js +6 -0
  4. package/cjs/current-vault-refusal.js.map +1 -0
  5. package/cjs/evm-fees.js +29 -1
  6. package/cjs/evm-fees.js.map +1 -1
  7. package/cjs/hardware-transaction-authority.js +36 -0
  8. package/cjs/hardware-transaction-authority.js.map +1 -0
  9. package/cjs/index.js +5 -5
  10. package/cjs/index.js.map +1 -1
  11. package/cjs/keyring-core.js +466 -250
  12. package/cjs/keyring-core.js.map +1 -1
  13. package/cjs/keyring-host.js +113 -0
  14. package/cjs/keyring-host.js.map +1 -0
  15. package/cjs/keyring-manager.js +15 -55
  16. package/cjs/keyring-manager.js.map +1 -1
  17. package/cjs/ledger/host-types.js.map +1 -1
  18. package/cjs/ledger/index.js +44 -19
  19. package/cjs/ledger/index.js.map +1 -1
  20. package/cjs/providers.js +3 -1
  21. package/cjs/providers.js.map +1 -1
  22. package/cjs/software.js +10 -43
  23. package/cjs/software.js.map +1 -1
  24. package/cjs/storage-core.js +44 -4
  25. package/cjs/storage-core.js.map +1 -1
  26. package/cjs/transactions/ethereum.js +358 -294
  27. package/cjs/transactions/ethereum.js.map +1 -1
  28. package/cjs/transactions/evm-cancellation.js +43 -0
  29. package/cjs/transactions/evm-cancellation.js.map +1 -0
  30. package/cjs/transactions/evm-local-signer.js +15 -0
  31. package/cjs/transactions/evm-local-signer.js.map +1 -1
  32. package/cjs/transactions/evm-submission.js +61 -65
  33. package/cjs/transactions/evm-submission.js.map +1 -1
  34. package/cjs/transactions/hardware-psbt.js +11 -8
  35. package/cjs/transactions/hardware-psbt.js.map +1 -1
  36. package/cjs/transactions/index.js +10 -2
  37. package/cjs/transactions/index.js.map +1 -1
  38. package/cjs/transactions/prepared-evm.js +10 -7
  39. package/cjs/transactions/prepared-evm.js.map +1 -1
  40. package/cjs/transactions/syscoin-core.js +282 -202
  41. package/cjs/transactions/syscoin-core.js.map +1 -1
  42. package/cjs/trezor/connect.js +19 -2
  43. package/cjs/trezor/connect.js.map +1 -1
  44. package/cjs/trezor/index.js +38 -16
  45. package/cjs/trezor/index.js.map +1 -1
  46. package/cjs/types.js.map +1 -1
  47. package/cjs/utils/owned-blockbook-account.js +45 -0
  48. package/cjs/utils/owned-blockbook-account.js.map +1 -0
  49. package/esm/current-vault-refusal.js +3 -0
  50. package/esm/current-vault-refusal.js.map +1 -0
  51. package/esm/evm-fees.js +242 -0
  52. package/esm/evm-fees.js.map +1 -0
  53. package/esm/hardware-transaction-authority.js +33 -0
  54. package/esm/hardware-transaction-authority.js.map +1 -0
  55. package/esm/initial-state.js +102 -0
  56. package/esm/initial-state.js.map +1 -0
  57. package/esm/keyring-core.js +2781 -0
  58. package/esm/keyring-core.js.map +1 -0
  59. package/esm/keyring-host.js +108 -0
  60. package/esm/keyring-host.js.map +1 -0
  61. package/esm/ledger/dmk-host.js +31 -0
  62. package/esm/ledger/dmk-host.js.map +1 -0
  63. package/esm/ledger/dmk-selected-host.js +6 -0
  64. package/esm/ledger/dmk-selected-host.js.map +1 -0
  65. package/esm/ledger/dmk-session.js +154 -34
  66. package/esm/ledger/dmk-session.js.map +1 -1
  67. package/esm/ledger/dmk-utxo.js +9 -3
  68. package/esm/ledger/dmk-utxo.js.map +1 -1
  69. package/esm/ledger/host-types.js.map +1 -1
  70. package/esm/ledger/index.js +44 -19
  71. package/esm/ledger/index.js.map +1 -1
  72. package/esm/ledger-host.js +3 -27
  73. package/esm/ledger-host.js.map +1 -1
  74. package/esm/network-utils.js +70 -0
  75. package/esm/network-utils.js.map +1 -0
  76. package/esm/providers.js +3 -1
  77. package/esm/providers.js.map +1 -1
  78. package/esm/software-hd-account.js +20 -0
  79. package/esm/software-hd-account.js.map +1 -0
  80. package/esm/storage-core.js +258 -0
  81. package/esm/storage-core.js.map +1 -0
  82. package/esm/transactions/ethereum.js +2753 -0
  83. package/esm/transactions/ethereum.js.map +1 -0
  84. package/esm/transactions/evm-cancellation.js +40 -0
  85. package/esm/transactions/evm-cancellation.js.map +1 -0
  86. package/esm/transactions/evm-local-signer.js +202 -0
  87. package/esm/transactions/evm-local-signer.js.map +1 -0
  88. package/esm/transactions/evm-submission.js +187 -0
  89. package/esm/transactions/evm-submission.js.map +1 -0
  90. package/esm/transactions/prepared-evm.js +194 -0
  91. package/esm/transactions/prepared-evm.js.map +1 -0
  92. package/esm/transactions/syscoin-core.js +691 -0
  93. package/esm/transactions/syscoin-core.js.map +1 -0
  94. package/esm/trezor/connect.js +19 -2
  95. package/esm/trezor/connect.js.map +1 -1
  96. package/esm/trezor/index.js +38 -16
  97. package/esm/trezor/index.js.map +1 -1
  98. package/esm/types.js.map +1 -1
  99. package/esm/utils/excluded-utxos.js +53 -0
  100. package/esm/utils/excluded-utxos.js.map +1 -0
  101. package/esm/utils/owned-blockbook-account.js +9 -0
  102. package/esm/utils/owned-blockbook-account.js.map +1 -0
  103. package/esm/utils/psbt.js +32 -0
  104. package/esm/utils/psbt.js.map +1 -0
  105. package/esm/utils/watch-descriptor.js +138 -0
  106. package/esm/utils/watch-descriptor.js.map +1 -0
  107. package/package.json +17 -11
  108. package/types/current-vault-refusal.d.ts +2 -0
  109. package/types/evm-fees.d.ts +25 -0
  110. package/types/hardware-transaction-authority.d.ts +5 -0
  111. package/types/index.d.ts +3 -3
  112. package/types/keyring-core.d.ts +48 -44
  113. package/types/keyring-host.d.ts +46 -0
  114. package/types/keyring-manager.d.ts +14 -7
  115. package/types/ledger/dmk-host.d.ts +7 -0
  116. package/types/ledger/dmk-selected-host.d.ts +7 -0
  117. package/types/ledger/dmk-session.d.ts +10 -2
  118. package/types/ledger/host-types.d.ts +4 -1
  119. package/types/ledger/index.d.ts +1 -1
  120. package/types/ledger/types.d.ts +3 -2
  121. package/types/ledger-host.d.ts +6 -2
  122. package/types/providers.d.ts +1 -1
  123. package/types/software.d.ts +7 -19
  124. package/types/storage-core.d.ts +3 -1
  125. package/types/transactions/ethereum.d.ts +14 -11
  126. package/types/transactions/evm-cancellation.d.ts +10 -0
  127. package/types/transactions/evm-local-signer.d.ts +2 -2
  128. package/types/transactions/evm-submission.d.ts +11 -4
  129. package/types/transactions/hardware-psbt.d.ts +1 -1
  130. package/types/transactions/index.d.ts +3 -2
  131. package/types/transactions/prepared-evm.d.ts +4 -1
  132. package/types/transactions/syscoin-core.d.ts +48 -21
  133. package/types/trezor/connect.d.ts +6 -3
  134. package/types/trezor/index.d.ts +4 -3
  135. package/types/types.d.ts +95 -63
  136. package/types/utils/owned-blockbook-account.d.ts +3 -0
  137. package/cjs/hardware-wallet-manager-singleton.js +0 -34
  138. package/cjs/hardware-wallet-manager-singleton.js.map +0 -1
  139. package/cjs/storage.js +0 -20
  140. package/cjs/storage.js.map +0 -1
  141. package/cjs/transactions/syscoin.js +0 -16
  142. package/cjs/transactions/syscoin.js.map +0 -1
  143. package/cjs/utils/blockbook-cache.js +0 -76
  144. package/cjs/utils/blockbook-cache.js.map +0 -1
  145. package/types/hardware-wallet-manager-singleton.d.ts +0 -19
  146. package/types/storage.d.ts +0 -5
  147. package/types/transactions/syscoin.d.ts +0 -9
  148. package/types/utils/blockbook-cache.d.ts +0 -6
@@ -39,7 +39,7 @@ declare class BaseProvider extends JsonRpcProvider {
39
39
  private bindMethods;
40
40
  private throttledRequest;
41
41
  private canMakeRequest;
42
- verifyConfiguredChainId(): Promise<void>;
42
+ verifyConfiguredChainId(fresh?: boolean): Promise<void>;
43
43
  private fetchAndVerifyConfiguredChainId;
44
44
  private cooldown;
45
45
  private validateRpcResponses;
@@ -1,20 +1,10 @@
1
1
  /** Software-only entry: explicit host storage, no browser/device initialization. */
2
2
  import { KeyringCore } from './keyring-core';
3
- import type { KeyringStoragePort } from './keyring-core';
3
+ import type { KeyringHost, KeyringOptions } from './keyring-host';
4
4
  import type { EncryptedEvmHdRuntimeAccount, EvmHdRuntimeAccountOptions, EvmHdRuntimeAccountRequest } from './software-hd-account';
5
- import type { CaptureEvmSubmission } from './transactions/evm-submission';
6
5
  import type { PreparedEvmSigningOptions, PreparedSoftwareEvmSigningRequest, SignedPreparedEvmTransaction } from './transactions/prepared-evm';
7
- declare const softwareHostBrand: unique symbol;
8
- /** Opaque handle minted by createSoftwareKeyringHost; no injectable persistence. */
9
- export interface SoftwareKeyringHost {
10
- readonly [softwareHostBrand]: true;
11
- }
12
- /** Create once per wallet authority, then share with its per-network keyrings. */
13
- export declare const createSoftwareKeyringHost: (storage: KeyringStoragePort, options?: {
14
- captureEvmSubmission?: CaptureEvmSubmission;
15
- }) => SoftwareKeyringHost;
16
6
  export declare class SoftwareKeyring extends KeyringCore<undefined, undefined> {
17
- constructor(host: SoftwareKeyringHost);
7
+ constructor(host: KeyringHost, options: KeyringOptions);
18
8
  /**
19
9
  * Derive a fixed-path Ethereum HD runtime account without network or storage
20
10
  * writes. The returned password-encrypted xprv is internal runtime state,
@@ -27,17 +17,15 @@ export declare class SoftwareKeyring extends KeyringCore<undefined, undefined> {
27
17
  * A later lock cannot revoke already returned signed bytes.
28
18
  */
29
19
  signPreparedEvmTransaction(request: PreparedSoftwareEvmSigningRequest, options: PreparedEvmSigningOptions): SignedPreparedEvmTransaction;
30
- /** Software authorities cannot rebind their backing store after creation. */
31
- setStorage: (client: any) => never;
32
- /** Sessions may move only through the core's same-authority transfer path. */
33
- receiveSessionOwnership: (...session: Parameters<KeyringCore["receiveSessionOwnership"]>) => never;
34
- static createInitialized(host: SoftwareKeyringHost, seed: string, password: string, vaultStateGetter: () => any): Promise<SoftwareKeyring>;
20
+ static createInitialized(host: KeyringHost, seed: string, password: string, vaultStateGetter: () => any, options: KeyringOptions): Promise<SoftwareKeyring>;
35
21
  }
22
+ export { createKeyringHost } from './keyring-host';
23
+ export type { KeyringHost, KeyringOptions } from './keyring-host';
36
24
  export { KeyringAccountType } from './types';
37
25
  export { INetworkType } from '@sidhujag/sysweb3-network';
38
26
  export type { INetwork } from '@sidhujag/sysweb3-network';
39
- export type { KeyringStoragePort } from './keyring-core';
40
- export type { IKeyringAccountState } from './types';
27
+ export type { DeviceUnlockControls, DeviceUnlockCredential, DeviceUnlockPort, DeviceUnlockVaultPair, KeyringStoragePort, } from './keyring-core';
28
+ export type { IKeyringAccountState, SyscoinOwnedReadOptions, SyscoinOwnedSubmissionOptions, SyscoinSubmissionDescriptor, } from './types';
41
29
  export type { PreparedEvmTransaction, PreparedEvmSigningOptions, PreparedSoftwareEvmSigningRequest, SignedPreparedEvmTransaction, } from './transactions/prepared-evm';
42
30
  export type { EncryptedEvmHdRuntimeAccount, EvmHdRuntimeAccountOptions, EvmHdRuntimeAccountRequest, } from './software-hd-account';
43
31
  export { captureEvmSubmission, submitSignedEvmTransaction, evmSubmissionFailure, } from './transactions/evm-submission';
@@ -8,13 +8,15 @@ export interface VaultStoragePort {
8
8
  export interface VaultPersistence {
9
9
  setEncryptedVault(decryptedVault: any, pwd: string, freshVaultKeys?: {
10
10
  salt: string;
11
- }): Promise<void>;
11
+ }, assertCurrent?: () => void): Promise<void>;
12
12
  getDecryptedVault(pwd: string, legacyPassword?: string): Promise<any>;
13
13
  }
14
14
  export declare class VaultAuthenticationError extends Error {
15
15
  readonly code = "INVALID_PASSWORD";
16
16
  constructor();
17
17
  }
18
+ /** Authenticate a captured current-format vault. This path has no CBC fallback. */
19
+ export declare const decryptCurrentVault: (vault: string, key: string) => Promise<unknown>;
18
20
  /**
19
21
  * Create once per wallet authority and share across its network keyrings.
20
22
  * The host owns storage durability and cross-context atomic creation.
@@ -2,7 +2,7 @@ import { TypedMessage, SignTypedDataVersion, TypedDataV1 } from '@metamask/eth-s
2
2
  import { INetwork } from '@sidhujag/sysweb3-network';
3
3
  import { BigNumber, TransactionResponse } from '../ethers-v6';
4
4
  import { CustomJsonRpcProvider } from '../providers';
5
- import { IResponseFromSendErcSignedTransaction, ISendSignedErcTransactionProps, IEthereumTransactions, IEvmCancellationOptions, IEvmReplacementOptions, IEvmSendOptions, SimpleTransactionRequest, KeyringAccountType, accountType, IGasParams } from '../types';
5
+ import { IResponseFromSendErcSignedTransaction, ISendSignedErc20TransactionProps, ISendSignedErc721TransactionProps, ISendSignedErc1155TransactionProps, IReviewedEvmTokenApproval, IEthereumTransactions, IEvmCancellationOptions, IEvmReplacementOptions, EvmFormattedSendArguments, SimpleTransactionRequest, KeyringAccountType, accountType, IGasParams } from '../types';
6
6
  import { type CaptureEvmSubmission } from './evm-submission';
7
7
  import type { LedgerKeyring } from '../ledger';
8
8
  import type { TrezorKeyring } from '../trezor';
@@ -18,8 +18,8 @@ export declare class EthereumTransactions<TLedger extends EthereumLedgerSigner |
18
18
  trezorSigner: TTrezor;
19
19
  ledgerSigner: TLedger;
20
20
  private getNetwork;
21
- private captureSigningContext?;
22
- private readonly captureSubmissionLifecycle?;
21
+ private readonly captureSigningContext;
22
+ private readonly captureSubmissionLifecycle;
23
23
  private abortController;
24
24
  private getDecryptedPrivateKey;
25
25
  private gasOverrides;
@@ -37,15 +37,17 @@ export declare class EthereumTransactions<TLedger extends EthereumLedgerSigner |
37
37
  activeAccountId: number;
38
38
  activeAccountType: KeyringAccountType;
39
39
  activeNetwork: INetwork;
40
- }, ledgerSigner: TLedger, trezorSigner: TTrezor, captureSigningContext?: () => () => void, captureSubmissionLifecycle?: CaptureEvmSubmission);
40
+ }, ledgerSigner: TLedger, trezorSigner: TTrezor, captureSigningContext: () => () => void, captureSubmissionLifecycle: CaptureEvmSubmission | null);
41
41
  private requireLedgerSigner;
42
42
  private requireTrezorSigner;
43
43
  private assertHardwareSignerAvailable;
44
+ private captureSessionGuard;
44
45
  private captureEvmSigningContext;
45
46
  private captureSubmission;
47
+ private authorizeHardwareTransaction;
48
+ private submitSignedHardwareTransaction;
46
49
  get web3Provider(): CustomJsonRpcProvider;
47
50
  private ensureProvidersInitialized;
48
- private isUtxoNetwork;
49
51
  signTypedData: (addr: string, typedData: TypedDataV1 | TypedMessage<any>, version: SignTypedDataVersion) => Promise<string>;
50
52
  verifyUtxoAddress: (accountIndex: number, currency: string, slip44: number) => Promise<string | undefined>;
51
53
  verifyTypedSignature: (data: TypedDataV1 | TypedMessage<any>, signature: string, version: SignTypedDataVersion) => string;
@@ -57,7 +59,8 @@ export declare class EthereumTransactions<TLedger extends EthereumLedgerSigner |
57
59
  decryptMessage: (msgParams: string[]) => string;
58
60
  toBigNumber: (aBigNumberish: string | number) => BigNumber;
59
61
  private toHex0x;
60
- private resolveEvmFeeParams;
62
+ private captureReviewedTokenApproval;
63
+ private reviewedTokenFees;
61
64
  getData: ({ contractAddress, receivingAddress, value, }: {
62
65
  contractAddress: string;
63
66
  receivingAddress: string;
@@ -78,9 +81,9 @@ export declare class EthereumTransactions<TLedger extends EthereumLedgerSigner |
78
81
  maximumFee?: string;
79
82
  transaction?: TransactionResponse;
80
83
  }>;
81
- sendFormattedTransaction: (params: SimpleTransactionRequest, isLegacy?: boolean, options?: IEvmSendOptions) => Promise<any>;
84
+ sendFormattedTransaction: (...args: EvmFormattedSendArguments) => Promise<any>;
82
85
  private sendFormattedTransactionInternal;
83
- sendTransactionWithEditedFee: (txHash: string, isLegacy?: boolean, options?: IEvmReplacementOptions) => Promise<{
86
+ sendTransactionWithEditedFee: (txHash: string, isLegacy: boolean | undefined, options: IEvmReplacementOptions) => Promise<{
84
87
  maximumFee?: string;
85
88
  error?: boolean;
86
89
  isSpeedUp: boolean;
@@ -90,9 +93,9 @@ export declare class EthereumTransactions<TLedger extends EthereumLedgerSigner |
90
93
  code?: string;
91
94
  message?: string;
92
95
  }>;
93
- sendSignedErc20Transaction: ({ receiver, tokenAddress, tokenAmount, isLegacy, maxPriorityFeePerGas, maxFeePerGas, gasPrice, decimals, gasLimit, saveTrezorTx, }: ISendSignedErcTransactionProps) => Promise<IResponseFromSendErcSignedTransaction>;
94
- sendSignedErc721Transaction: ({ receiver, tokenAddress, tokenId, isLegacy, maxPriorityFeePerGas, maxFeePerGas, gasPrice, gasLimit, }: ISendSignedErcTransactionProps) => Promise<IResponseFromSendErcSignedTransaction>;
95
- sendSignedErc1155Transaction: ({ receiver, tokenAddress, tokenId, tokenAmount, isLegacy, maxPriorityFeePerGas, maxFeePerGas, gasPrice, gasLimit, }: ISendSignedErcTransactionProps) => Promise<IResponseFromSendErcSignedTransaction>;
96
+ sendSignedErc20Transaction: (request: ISendSignedErc20TransactionProps, approval: IReviewedEvmTokenApproval) => Promise<IResponseFromSendErcSignedTransaction>;
97
+ sendSignedErc721Transaction: (request: ISendSignedErc721TransactionProps, approval: IReviewedEvmTokenApproval) => Promise<IResponseFromSendErcSignedTransaction>;
98
+ sendSignedErc1155Transaction: (request: ISendSignedErc1155TransactionProps, approval: IReviewedEvmTokenApproval) => Promise<IResponseFromSendErcSignedTransaction>;
96
99
  getRecommendedNonce: (address: string) => Promise<number>;
97
100
  getFeeByType: (type: string) => Promise<string>;
98
101
  getGasLimit: (toAddress: string) => Promise<number>;
@@ -0,0 +1,10 @@
1
+ import type { planEvmCancellationFees } from '../evm-fees';
2
+ /** A host supplies the authenticated original identity and the captured fee plan. */
3
+ export type EvmCancellationEnvelopeIntent = Readonly<{
4
+ payer: string;
5
+ chainId: number | string;
6
+ nonce: number | string;
7
+ feePlan: ReturnType<typeof planEvmCancellationFees>;
8
+ }>;
9
+ /** Checks the exact unsigned bytes. Original eligibility and approval remain host checks. */
10
+ export declare function assertEvmCancellationEnvelope(unsigned: string, { payer, chainId, nonce, feePlan }: EvmCancellationEnvelopeIntent): void;
@@ -23,7 +23,7 @@ export declare const parsePersonalMessage: (hexMessage: string) => string;
23
23
  /** Pin the checked gas and chain to the same detached envelope that is serialized. */
24
24
  export declare const normalizeGasLimitedTransaction: (transaction: TransactionRequest) => TransactionRequest;
25
25
  export declare const signTransaction: (transaction: TransactionRequest, privateKey: string | Uint8Array) => string;
26
- export declare const sendLocalEvmTransaction: (provider: CustomJsonRpcProvider, privateKey: string, transaction: Deferrable<Record<string, any>>, beforeBroadcast?: () => void, beforeSign?: () => void,
26
+ export declare const sendLocalEvmTransaction: (provider: CustomJsonRpcProvider, privateKey: string, transaction: Deferrable<Record<string, any>>, beforeBroadcast: (() => void) | undefined, beforeSign: (() => void) | undefined,
27
27
  /** Synchronous final-envelope check; throw to reject. Promise results are rejected. */
28
- validateBeforeSign?: (transaction: TransactionRequest) => void, submission?: EvmSubmissionBoundary) => Promise<any>;
28
+ validateBeforeSign: ((transaction: TransactionRequest) => void) | undefined, submission: EvmSubmissionBoundary) => Promise<any>;
29
29
  export declare const sameAddress: (left: string, right: string) => boolean;
@@ -31,13 +31,17 @@ export type EvmSubmissionLifecycle = Readonly<{
31
31
  persistSigned: (record: EvmSignedSubmission) => Promise<void>;
32
32
  }>;
33
33
  export type CaptureEvmSubmission = (context: EvmSubmissionContext) => EvmSubmissionLifecycle;
34
+ declare const evmSubmissionBrand: unique symbol;
34
35
  export type EvmSubmissionBoundary = Readonly<{
36
+ [evmSubmissionBrand]: true;
35
37
  context: EvmSubmissionContext;
36
38
  assertCurrent: () => void;
37
- persistSigned?: (record: EvmSignedSubmission) => Promise<void>;
39
+ persistSigned: (record: EvmSignedSubmission) => Promise<void>;
38
40
  }>;
39
41
  /** Capture once, before RPC or device work. Never reread host capabilities later. */
40
- export declare function captureEvmSubmission(input: EvmSubmissionContext, assertCurrent: () => void, capture?: CaptureEvmSubmission): EvmSubmissionBoundary;
42
+ export declare function captureEvmSubmission(input: EvmSubmissionContext, assertCurrent: () => void, capture: CaptureEvmSubmission): EvmSubmissionBoundary;
43
+ /** Refuse any new signature or dispatch without a captured durable port. */
44
+ export declare function assertDurableEvmSubmission(boundary: EvmSubmissionBoundary): void;
41
45
  /** Only local stage evidence can label an error as a possibly dispatched send. */
42
46
  export declare function evmSubmissionFailure(error: unknown): Readonly<{
43
47
  transactionNotBroadcast: boolean;
@@ -47,5 +51,8 @@ export declare function evmSubmissionFailure(error: unknown): Readonly<{
47
51
  export declare function copyEvmSubmissionFailure(source: unknown, target: Error): void;
48
52
  /** Compare signed wire bytes with the complete envelope captured before signing. */
49
53
  export declare function assertSignedEvmTransactionMatches(rawTransaction: string, expectedUnsignedTransaction: string, expectedFrom?: string): Transaction;
50
- /** The sole local-signature dispatch boundary. No nonce/fee selection or retry. */
51
- export declare function submitSignedEvmTransaction<T>(rawTransaction: string, broadcast: (rawTransaction: string) => Promise<T>, boundary?: EvmSubmissionBoundary, beforeBroadcast?: () => void, expectedUnsignedTransaction?: string): Promise<T>;
54
+ /** Submit software-signed bytes through the captured durable boundary. */
55
+ export declare function submitSignedEvmTransaction<T>(rawTransaction: string, broadcast: (rawTransaction: string) => Promise<T>, boundary: EvmSubmissionBoundary, beforeBroadcast: (() => void) | undefined, expectedUnsignedTransaction: string): Promise<T>;
56
+ /** @internal Device signatures always require a fresh live chain probe after persistence. */
57
+ export declare function submitSignedHardwareEvmTransaction<T>(rawTransaction: string, broadcast: (rawTransaction: string) => Promise<T>, boundary: EvmSubmissionBoundary, beforeBroadcast: (() => void) | undefined, expectedUnsignedTransaction: string, verifyCurrentChain: () => Promise<void>): Promise<T>;
58
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { type ISyscoinHardwareSigner } from './syscoin-core';
2
2
  import type { LedgerKeyring } from '../ledger';
3
3
  import type { TrezorKeyring } from '../trezor';
4
- /** Legacy device adapter. The software transaction engine never imports it. */
4
+ /** The software transaction engine never imports this device adapter. */
5
5
  export declare function createLedgerPsbtSigner(ledger: LedgerKeyring): ISyscoinHardwareSigner;
6
6
  /** Keep Trezor conversion and signing outside the software-only import graph. */
7
7
  export declare function createTrezorPsbtSigner(trezor: TrezorKeyring): ISyscoinHardwareSigner;
@@ -1,3 +1,4 @@
1
1
  export * from './ethereum';
2
- export * from './syscoin';
3
- export * from './evm-submission';
2
+ export { assertDurableEvmSubmission, assertSignedEvmTransactionMatches, captureEvmSubmission, copyEvmSubmissionFailure, evmSubmissionFailure, submitSignedEvmTransaction, } from './evm-submission';
3
+ export type { CaptureEvmSubmission, EvmSignedSubmission, EvmSubmissionBoundary, EvmSubmissionContext, EvmSubmissionLifecycle, } from './evm-submission';
4
+ export { readPublicSyscoinFee } from './syscoin-core';
@@ -50,4 +50,7 @@ export type SignedPreparedEvmTransaction = Readonly<{
50
50
  export declare function snapshotPreparedEvmRequest(input: unknown): PreparedSoftwareEvmSigningRequest;
51
51
  export declare function preparedEvmGuard(input: unknown): () => void;
52
52
  /** Internal, network-free signing. The key never becomes part of the result. */
53
- export declare function signPreparedEvmEnvelope(transaction: PreparedEvmTransaction, privateKey: string): SignedPreparedEvmTransaction;
53
+ export declare function signPreparedEvmEnvelope(transaction: PreparedEvmTransaction, privateKey: string): Readonly<{
54
+ signed: SignedPreparedEvmTransaction;
55
+ expectedUnsigned: string;
56
+ }>;
@@ -1,6 +1,6 @@
1
- import { ITxid, txUtils } from '@sidhujag/sysweb3-utils';
1
+ import { ITxid } from '@sidhujag/sysweb3-utils';
2
2
  import { Psbt } from 'bitcoinjs-lib';
3
- import { ISyscoinTransactions, KeyringAccountType, accountType } from '../types';
3
+ import { ISyscoinTransactions, KeyringAccountType, accountType, type SyscoinOwnedReadOptions, type SyscoinOwnedSubmissionOptions } from '../types';
4
4
  import { ExcludedOutpoint } from '../utils/excluded-utxos';
5
5
  import { type PsbtAccountScope } from '../utils/psbt-account-scope';
6
6
  import type { SyscoinHDSigner } from '../signers';
@@ -12,10 +12,11 @@ export interface ISyscoinHardwareSigningRequest {
12
12
  xpub: string;
13
13
  }>;
14
14
  assertCurrent: () => void;
15
- getRawTransaction?: ReturnType<typeof txUtils>['getRawTransaction'];
15
+ getRawTransaction?: (txid: string) => Promise<unknown>;
16
16
  readonly network: Readonly<INetwork>;
17
17
  psbt: Psbt;
18
18
  scope: PsbtAccountScope;
19
+ signal: AbortSignal;
19
20
  }
20
21
  /**
21
22
  * Trusted wallet-authority adapter, not an untrusted plugin entry point.
@@ -30,19 +31,48 @@ export interface ISyscoinHardwareSigners {
30
31
  export declare const createHardwareSignerUnavailableError: (hardware: string) => Error & {
31
32
  code: string;
32
33
  };
34
+ type BlockbookRead = Pick<SyscoinOwnedReadOptions, 'fetch' | 'signal'>;
35
+ /** Public network fee estimate. It has no wallet, account or signing access. */
36
+ export declare function readPublicSyscoinFee(explorerUrl: string, owner: SyscoinOwnedReadOptions): Promise<number>;
37
+ /** Internal captured context for the keyring's existing read-only builder and address lookup. */
38
+ export type SyscoinUtxoReadContext = Readonly<{
39
+ assertCurrent: () => void;
40
+ network: Readonly<INetwork>;
41
+ transport: BlockbookRead;
42
+ xpub: string;
43
+ }>;
44
+ type OwnedPreparation = Readonly<{
45
+ account: Readonly<{
46
+ address: string;
47
+ xpub: string;
48
+ }>;
49
+ accountId: number;
50
+ accountType: KeyringAccountType;
51
+ read: SyscoinUtxoReadContext;
52
+ }>;
53
+ type GetUtxoReadState = () => {
54
+ accounts: Partial<Record<KeyringAccountType, accountType>>;
55
+ activeAccountId: number;
56
+ activeAccountType: KeyringAccountType;
57
+ activeNetwork: INetwork;
58
+ };
59
+ /** Bind both transaction preparation and address reads to the active wallet. */
60
+ export declare function captureOwnedSyscoinRead(options: SyscoinOwnedReadOptions, getState: GetUtxoReadState, captureSigningContext: (bindSessionRevision: boolean) => () => void): OwnedPreparation;
61
+ type GetUtxoAddress = (xpub: string, isChangeAddress: boolean) => Promise<string>;
62
+ type ReadOnlySigner = {
63
+ main: any;
64
+ getOwnedAddress?: GetUtxoAddress;
65
+ };
33
66
  export declare class SyscoinTransactionsCore implements ISyscoinTransactions {
34
67
  private getSigner;
35
68
  private getReadOnlySigner;
36
69
  private hardwareSigners;
37
70
  private getState;
38
- private getAddress;
39
- private captureSigningContext?;
71
+ private captureSigningContext;
40
72
  constructor(getSyscoinSigner: () => {
41
73
  hd: SyscoinHDSigner;
42
74
  main: any;
43
- }, getReadOnlySigner: () => {
44
- main: any;
45
- }, getState: () => {
75
+ }, getReadOnlySigner: (read?: SyscoinUtxoReadContext) => ReadOnlySigner, getState: () => {
46
76
  accounts: {
47
77
  HDAccount: accountType;
48
78
  Imported: accountType;
@@ -52,14 +82,11 @@ export declare class SyscoinTransactionsCore implements ISyscoinTransactions {
52
82
  activeAccountId: number;
53
83
  activeAccountType: KeyringAccountType;
54
84
  activeNetwork: INetwork;
55
- }, getAddress: (xpub: string, isChangeAddress: boolean) => Promise<string>, hardwareSigners?: ISyscoinHardwareSigners, captureSigningContext?: () => () => void);
85
+ }, hardwareSigners: ISyscoinHardwareSigners, captureSigningContext: (bindSessionRevision: boolean) => () => void);
56
86
  private getTransactionPSBT;
57
87
  decodeRawTransaction: (psbtOrHex: any, isRawHex?: boolean) => any;
58
- private feeCache;
59
- getRecommendedFee: (explorerUrl: string) => Promise<number>;
60
- txUtilsFunctions: () => {
61
- getRawTransaction: (explorerUrl: string, txid: string) => Promise<any>;
62
- };
88
+ private captureOwnedRead;
89
+ getRecommendedFee: (explorerUrl: string, ownedRead: SyscoinOwnedReadOptions) => Promise<number>;
63
90
  private signPSBTWithSigner;
64
91
  private createNativeSweepPSBT;
65
92
  private createUnsignedPSBT;
@@ -76,17 +103,17 @@ export declare class SyscoinTransactionsCore implements ISyscoinTransactions {
76
103
  isMax?: boolean | false;
77
104
  nativeSweep?: boolean;
78
105
  excludedOutpoints?: readonly ExcludedOutpoint[];
79
- }) => Promise<{
106
+ }, ownedRead: SyscoinOwnedReadOptions) => Promise<{
80
107
  grossAmount?: string | undefined;
81
108
  recipientAmount?: string | undefined;
82
109
  fee: number;
83
110
  psbt: any;
84
111
  }>;
85
- private sendSignedTransaction;
86
- signPSBT: ({ psbt, isTrezor, isLedger, }: {
87
- psbt: any;
88
- isTrezor?: boolean;
112
+ signPSBT: ({ psbt }: {
89
113
  isLedger?: boolean;
90
- }) => Promise<any>;
91
- sendTransaction: (psbt: any) => Promise<ITxid>;
114
+ isTrezor?: boolean;
115
+ psbt: any;
116
+ }, ownedRead: SyscoinOwnedReadOptions) => Promise<any>;
117
+ sendTransaction: (rawTransaction: string, authority: SyscoinOwnedSubmissionOptions) => Promise<ITxid>;
92
118
  }
119
+ export {};
@@ -1,7 +1,8 @@
1
+ import type { HardwareTransactionAuthority } from '../hardware-transaction-authority';
1
2
  import type { ConnectDynamicSettings, TrezorConnectPublicAPI } from '@trezor/connect-webextension';
2
3
  type Client = TrezorConnectPublicAPI<ConnectDynamicSettings>;
3
- declare const methods: readonly ["getFeatures", "getAccountInfo", "ethereumGetAddress", "ethereumGetPublicKey", "getPublicKey", "getAddress", "signTransaction", "ethereumSignTransaction", "signMessage", "ethereumSignMessage", "ethereumSignTypedData", "verifyMessage", "ethereumVerifyMessage"];
4
- type Method = (typeof methods)[number];
4
+ declare const methods: readonly ["getFeatures", "getAccountInfo", "ethereumGetAddress", "ethereumGetPublicKey", "getPublicKey", "getAddress", "signMessage", "ethereumSignMessage", "ethereumSignTypedData", "verifyMessage", "ethereumVerifyMessage"];
5
+ type ForwardedMethod = (typeof methods)[number];
5
6
  type Compatible<T> = T extends {
6
7
  success: false;
7
8
  } ? T & {
@@ -20,7 +21,7 @@ type CompatibleCall<FunctionType> = FunctionType extends {
20
21
  (...args: C): Promise<Compatible<Awaited<T>>>;
21
22
  } : never;
22
23
  type Calls = {
23
- [Name in Method]: CompatibleCall<Client[Name]>;
24
+ [Name in ForwardedMethod]: CompatibleCall<Client[Name]>;
24
25
  };
25
26
  type ConnectionEvent = {
26
27
  type: 'disconnected';
@@ -30,6 +31,8 @@ type ConnectionEvent = {
30
31
  };
31
32
  export declare const subscribeTrezorEvents: (listener: (event: ConnectionEvent) => void) => (() => void);
32
33
  declare const TrezorConnect: Calls & {
34
+ ethereumSignTransactionOwned: (request: Parameters<Client['ethereumSignTransaction']>[0], authority: HardwareTransactionAuthority) => ReturnType<CompatibleCall<Client['ethereumSignTransaction']>>;
35
+ signTransactionOwned: (request: Parameters<Client['signTransaction']>[0], authority: HardwareTransactionAuthority) => ReturnType<CompatibleCall<Client['signTransaction']>>;
33
36
  init: Client['init'];
34
37
  dispose: () => Promise<void>;
35
38
  };
@@ -1,6 +1,7 @@
1
1
  import { TypedMessage, SignTypedDataVersion, TypedDataV1 } from '@metamask/eth-sig-util';
2
2
  import { Psbt } from 'bitcoinjs-lib';
3
3
  import { Buffer } from 'buffer';
4
+ import type { HardwareTransactionAuthority } from '../hardware-transaction-authority';
4
5
  import type { AccountInfo, EthereumTransaction, EthereumTransactionEIP1559 } from '@trezor/connect-webextension';
5
6
  export interface TrezorControllerState {
6
7
  hdPath: string;
@@ -28,7 +29,7 @@ export declare class TrezorKeyring {
28
29
  /**
29
30
  * Initialize Trezor script.
30
31
  */
31
- init(): Promise<boolean>;
32
+ init(assertCurrent?: () => void): Promise<boolean>;
32
33
  /**
33
34
  * Execute operation with automatic retry
34
35
  */
@@ -102,7 +103,7 @@ export declare class TrezorKeyring {
102
103
  * @param outputs - utxo transaction outputs
103
104
  * @returns signature object
104
105
  */
105
- signUtxoTransaction(utxoTransaction: any, psbt: Psbt): Promise<Psbt>;
106
+ signUtxoTransaction(utxoTransaction: any, psbt: Psbt, authority: HardwareTransactionAuthority): Promise<Psbt>;
106
107
  private setHdPath;
107
108
  convertToAddressNFormat(path: string): any[];
108
109
  isScriptHash(address: string, networkInfo: any): boolean;
@@ -122,7 +123,7 @@ export declare class TrezorKeyring {
122
123
  tx: EthereumTransaction | EthereumTransactionEIP1559;
123
124
  coin: string;
124
125
  slip44: number;
125
- }): Promise<import("@trezor/connect-webextension").OkWithDevice<{
126
+ }, authority: HardwareTransactionAuthority): Promise<import("@trezor/connect-webextension").OkWithDevice<{
126
127
  authorizationList?: {
127
128
  address: string;
128
129
  chainId: number;