@sidhujag/sysweb3-keyring 1.0.491

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 (104) hide show
  1. package/README.md +201 -0
  2. package/cjs/errorUtils.js +75 -0
  3. package/cjs/errorUtils.js.map +1 -0
  4. package/cjs/hardware-wallet-manager.js +462 -0
  5. package/cjs/hardware-wallet-manager.js.map +1 -0
  6. package/cjs/index.js +31 -0
  7. package/cjs/index.js.map +1 -0
  8. package/cjs/initial-state.js +105 -0
  9. package/cjs/initial-state.js.map +1 -0
  10. package/cjs/keyring-manager.js +1687 -0
  11. package/cjs/keyring-manager.js.map +1 -0
  12. package/cjs/ledger/bitcoin_client/index.js +47 -0
  13. package/cjs/ledger/bitcoin_client/index.js.map +1 -0
  14. package/cjs/ledger/bitcoin_client/lib/appClient.js +408 -0
  15. package/cjs/ledger/bitcoin_client/lib/appClient.js.map +1 -0
  16. package/cjs/ledger/bitcoin_client/lib/bip32.js +61 -0
  17. package/cjs/ledger/bitcoin_client/lib/bip32.js.map +1 -0
  18. package/cjs/ledger/bitcoin_client/lib/buffertools.js +126 -0
  19. package/cjs/ledger/bitcoin_client/lib/buffertools.js.map +1 -0
  20. package/cjs/ledger/bitcoin_client/lib/clientCommands.js +270 -0
  21. package/cjs/ledger/bitcoin_client/lib/clientCommands.js.map +1 -0
  22. package/cjs/ledger/bitcoin_client/lib/constants.js +16 -0
  23. package/cjs/ledger/bitcoin_client/lib/constants.js.map +1 -0
  24. package/cjs/ledger/bitcoin_client/lib/merkelizedPsbt.js +54 -0
  25. package/cjs/ledger/bitcoin_client/lib/merkelizedPsbt.js.map +1 -0
  26. package/cjs/ledger/bitcoin_client/lib/merkle.js +109 -0
  27. package/cjs/ledger/bitcoin_client/lib/merkle.js.map +1 -0
  28. package/cjs/ledger/bitcoin_client/lib/merkleMap.js +46 -0
  29. package/cjs/ledger/bitcoin_client/lib/merkleMap.js.map +1 -0
  30. package/cjs/ledger/bitcoin_client/lib/policy.js +66 -0
  31. package/cjs/ledger/bitcoin_client/lib/policy.js.map +1 -0
  32. package/cjs/ledger/bitcoin_client/lib/psbtv2.js +640 -0
  33. package/cjs/ledger/bitcoin_client/lib/psbtv2.js.map +1 -0
  34. package/cjs/ledger/bitcoin_client/lib/varint.js +113 -0
  35. package/cjs/ledger/bitcoin_client/lib/varint.js.map +1 -0
  36. package/cjs/ledger/consts.js +7 -0
  37. package/cjs/ledger/consts.js.map +1 -0
  38. package/cjs/ledger/index.js +319 -0
  39. package/cjs/ledger/index.js.map +1 -0
  40. package/cjs/ledger/types.js +3 -0
  41. package/cjs/ledger/types.js.map +1 -0
  42. package/cjs/network-utils.js +76 -0
  43. package/cjs/network-utils.js.map +1 -0
  44. package/cjs/providers.js +270 -0
  45. package/cjs/providers.js.map +1 -0
  46. package/cjs/signers.js +64 -0
  47. package/cjs/signers.js.map +1 -0
  48. package/cjs/storage.js +30 -0
  49. package/cjs/storage.js.map +1 -0
  50. package/cjs/transactions/__tests__/integration.test.js +237 -0
  51. package/cjs/transactions/__tests__/integration.test.js.map +1 -0
  52. package/cjs/transactions/__tests__/syscoin.test.js +361 -0
  53. package/cjs/transactions/__tests__/syscoin.test.js.map +1 -0
  54. package/cjs/transactions/ethereum.js +1577 -0
  55. package/cjs/transactions/ethereum.js.map +1 -0
  56. package/cjs/transactions/index.js +19 -0
  57. package/cjs/transactions/index.js.map +1 -0
  58. package/cjs/transactions/syscoin.js +328 -0
  59. package/cjs/transactions/syscoin.js.map +1 -0
  60. package/cjs/trezor/index.js +718 -0
  61. package/cjs/trezor/index.js.map +1 -0
  62. package/cjs/types.js +12 -0
  63. package/cjs/types.js.map +1 -0
  64. package/cjs/utils/derivation-paths.js +99 -0
  65. package/cjs/utils/derivation-paths.js.map +1 -0
  66. package/cjs/utils/psbt.js +60 -0
  67. package/cjs/utils/psbt.js.map +1 -0
  68. package/cjs/utils.js +130 -0
  69. package/cjs/utils.js.map +1 -0
  70. package/package.json +46 -0
  71. package/types/errorUtils.d.ts +1 -0
  72. package/types/hardware-wallet-manager.d.ts +110 -0
  73. package/types/index.d.ts +12 -0
  74. package/types/initial-state.d.ts +79 -0
  75. package/types/keyring-manager.d.ts +184 -0
  76. package/types/ledger/bitcoin_client/index.d.ts +5 -0
  77. package/types/ledger/bitcoin_client/lib/appClient.d.ts +106 -0
  78. package/types/ledger/bitcoin_client/lib/bip32.d.ts +11 -0
  79. package/types/ledger/bitcoin_client/lib/buffertools.d.ts +28 -0
  80. package/types/ledger/bitcoin_client/lib/clientCommands.d.ts +77 -0
  81. package/types/ledger/bitcoin_client/lib/constants.d.ts +12 -0
  82. package/types/ledger/bitcoin_client/lib/merkelizedPsbt.d.ts +24 -0
  83. package/types/ledger/bitcoin_client/lib/merkle.d.ts +32 -0
  84. package/types/ledger/bitcoin_client/lib/merkleMap.d.ts +23 -0
  85. package/types/ledger/bitcoin_client/lib/policy.d.ts +36 -0
  86. package/types/ledger/bitcoin_client/lib/psbtv2.d.ts +167 -0
  87. package/types/ledger/bitcoin_client/lib/varint.d.ts +23 -0
  88. package/types/ledger/consts.d.ts +3 -0
  89. package/types/ledger/index.d.ts +51 -0
  90. package/types/ledger/types.d.ts +48 -0
  91. package/types/network-utils.d.ts +14 -0
  92. package/types/providers.d.ts +47 -0
  93. package/types/signers.d.ts +95 -0
  94. package/types/storage.d.ts +2 -0
  95. package/types/transactions/__tests__/integration.test.d.ts +1 -0
  96. package/types/transactions/__tests__/syscoin.test.d.ts +1 -0
  97. package/types/transactions/ethereum.d.ts +80 -0
  98. package/types/transactions/index.d.ts +2 -0
  99. package/types/transactions/syscoin.d.ts +61 -0
  100. package/types/trezor/index.d.ts +170 -0
  101. package/types/types.d.ts +294 -0
  102. package/types/utils/derivation-paths.d.ts +35 -0
  103. package/types/utils/psbt.d.ts +17 -0
  104. package/types/utils.d.ts +4 -0
@@ -0,0 +1,170 @@
1
+ import { AccountInfo, EthereumTransaction, EthereumTransactionEIP1559 } from '@trezor/connect-webextension';
2
+ import { Buffer } from 'buffer';
3
+ import { Version } from 'eth-sig-util';
4
+ import { SyscoinHDSigner } from '../signers';
5
+ export interface TrezorControllerState {
6
+ hdPath: string;
7
+ paths: Record<string, number>;
8
+ }
9
+ declare global {
10
+ interface Window {
11
+ TrezorConnect: any;
12
+ }
13
+ }
14
+ export declare class TrezorKeyring {
15
+ hdPath: string;
16
+ publicKey: Buffer;
17
+ chainCode: Buffer;
18
+ paths: Record<string, number>;
19
+ model?: string;
20
+ private getSigner;
21
+ private hardwareWalletManager;
22
+ private initialized;
23
+ constructor(getSyscoinSigner: () => {
24
+ hd: SyscoinHDSigner;
25
+ main: any;
26
+ });
27
+ /**
28
+ * Initialize Trezor script.
29
+ */
30
+ init(): Promise<boolean>;
31
+ /**
32
+ * Execute operation with automatic retry
33
+ */
34
+ private executeWithRetry;
35
+ /**
36
+ * This return account info based in params provided.
37
+ *
38
+ * @param coin - network symbol. Example: eth, sys, btc
39
+ * @param slip44 - network slip44 number
40
+ * @param hdPath - path derivation. Example: m/84'/57'/0'
41
+ * @param index - index of account for path derivation
42
+ * @returns derivated account info or error
43
+ */
44
+ getAccountInfo({ coin, slip44, hdPath, index, }: {
45
+ coin: string;
46
+ hdPath?: string;
47
+ index?: number;
48
+ slip44: number;
49
+ }): Promise<AccountInfo>;
50
+ /**
51
+ * Gets the model, if known.
52
+ * This may be `undefined` if the model hasn't been loaded yet.
53
+ *
54
+ * @returns
55
+ */
56
+ getModel(): string | undefined;
57
+ /**
58
+ * This removes the Trezor Connect iframe from the DOM
59
+ *
60
+ * @returns void
61
+ */
62
+ dispose(): void;
63
+ /**
64
+ * This verify if message is valid or not.
65
+ *
66
+ * @param coin - network symbol. Example: eth, sys, btc
67
+ * @param address - account address that signed message
68
+ * @param message - message to be verified. Example: 'Test message'
69
+ * @param signature - signature received in sign method. Example: I6BrpivjCwZmScZ6BMAHWGQPo+JjX2kzKXU5LcGVfEgvFb2VfJuKo3g6eSQcykQZiILoWNUDn5rDHkwJg3EcvuY=
70
+ * @returns derivated account info or error
71
+ */
72
+ verifyMessage({ coin, address, message, signature, }: {
73
+ address: string;
74
+ coin: string;
75
+ message: string;
76
+ signature: string;
77
+ }): Promise<{
78
+ success: any;
79
+ payload: any;
80
+ }>;
81
+ /**
82
+ * This return account public key.
83
+ *
84
+ * @param coin - network symbol. Example: eth, sys, btc
85
+ * @param slip44 - network slip44 number
86
+ * @param hdPath - path derivation. Example: m/44'/57'/0'/0/0
87
+ * @returns publicKey and chainCode
88
+ */
89
+ getPublicKey({ coin, slip44, hdPath, index, }: {
90
+ coin: string;
91
+ hdPath?: string;
92
+ index?: number;
93
+ slip44: number;
94
+ }): Promise<any>;
95
+ range(n: number): number[];
96
+ /**
97
+ * This sign UTXO tx.
98
+ *
99
+ * @param coin - network symbol. Example: eth, sys, btc
100
+ * @param inputs - utxo transaction inputs
101
+ * @param outputs - utxo transaction outputs
102
+ * @returns signature object
103
+ */
104
+ signUtxoTransaction(utxoTransaction: any, psbt: any): Promise<any>;
105
+ private setHdPath;
106
+ convertToAddressNFormat(path: string): any[];
107
+ isScriptHash(address: string, networkInfo: any): boolean;
108
+ isPaymentFactory(payment: any): (script: any) => boolean;
109
+ isBech32(address: string): boolean;
110
+ isP2WSHScript(script: any): boolean;
111
+ convertToTrezorFormat({ psbt, pathIn, coin }: any): any;
112
+ /**
113
+ * This sign EVM tx.
114
+ *
115
+ * @param index - index of account for path derivation
116
+ * @param tx - ethereum tx object
117
+ * @returns signature object
118
+ */
119
+ signEthTransaction({ tx, index, coin, slip44, }: {
120
+ index: string;
121
+ tx: EthereumTransaction | EthereumTransactionEIP1559;
122
+ coin: string;
123
+ slip44: number;
124
+ }): Promise<any>;
125
+ /**
126
+ * This sign message.
127
+ *
128
+ * @param coin - network symbol. Example: eth, sys, btc
129
+ * @param slip44 - network slip44 number
130
+ * @param message - message to be signed. Example: 'Test message'
131
+ * @param index - index of account for path derivation
132
+ * @returns signature object
133
+ */
134
+ signMessage({ index, message, coin, slip44, address, }: {
135
+ address: string;
136
+ coin: string;
137
+ index?: number;
138
+ message?: string;
139
+ slip44: number;
140
+ }): Promise<unknown>;
141
+ private _signUtxoPersonalMessage;
142
+ private _signEthPersonalMessage;
143
+ private _sanitizeData;
144
+ private _transformTypedData;
145
+ /**
146
+ * EIP-712 Sign Typed Data
147
+ */
148
+ signTypedData({ version, address, data, index, }: {
149
+ address: string;
150
+ data: any;
151
+ index: number;
152
+ version: Version;
153
+ }): Promise<any>;
154
+ /**
155
+ * Verify UTXO address by displaying it on the Trezor device
156
+ * @param accountIndex - The account index
157
+ * @param currency - The currency (coin type)
158
+ * @param slip44 - The slip44 value for the network
159
+ * @returns The verified address
160
+ */
161
+ verifyUtxoAddress(accountIndex: number, currency: string, slip44: number): Promise<string | undefined>;
162
+ /**
163
+ * Check Trezor status
164
+ */
165
+ getStatus(): import("../hardware-wallet-manager").HardwareWalletStatus | undefined;
166
+ /**
167
+ * Clean up resources
168
+ */
169
+ destroy(): Promise<void>;
170
+ }
@@ -0,0 +1,294 @@
1
+ import { TransactionResponse } from '@ethersproject/abstract-provider';
2
+ import { INetwork, INetworkType } from '@sidhujag/sysweb3-network';
3
+ import { ITxid } from '@sidhujag/sysweb3-utils';
4
+ import { TypedData, TypedMessage } from 'eth-sig-util';
5
+ import { ethers, BigNumber, BigNumberish } from 'ethers';
6
+ import { CustomJsonRpcProvider, CustomL2JsonRpcProvider } from 'providers';
7
+ import { LedgerKeyring } from './ledger';
8
+ import { SyscoinHDSigner } from './signers';
9
+ import { TrezorKeyring } from './trezor';
10
+ export interface ISendTransaction {
11
+ amount: number;
12
+ gasLimit?: number;
13
+ gasPrice?: number;
14
+ receivingAddress: string;
15
+ sender: string;
16
+ token?: any;
17
+ }
18
+ export type SimpleTransactionRequest = {
19
+ accessList?: ethers.utils.AccessListish;
20
+ ccipReadEnabled?: boolean;
21
+ chainId: number;
22
+ customData?: Record<string, any>;
23
+ data?: ethers.BytesLike;
24
+ from: string;
25
+ gasLimit?: ethers.BigNumberish;
26
+ gasPrice?: ethers.BigNumberish;
27
+ maxFeePerGas: ethers.BigNumberish;
28
+ maxPriorityFeePerGas: ethers.BigNumberish;
29
+ nonce?: ethers.BigNumberish;
30
+ r?: string;
31
+ s?: string;
32
+ to: string;
33
+ type?: number;
34
+ v?: string;
35
+ value?: ethers.BigNumberish;
36
+ };
37
+ export declare type Version = 'V1' | 'V2' | 'V3' | 'V4';
38
+ export interface IEthereumTransactions {
39
+ cancelSentTransaction: (txHash: string, isLegacy?: boolean) => Promise<{
40
+ error?: boolean;
41
+ isCanceled: boolean;
42
+ transaction?: TransactionResponse;
43
+ }>;
44
+ decryptMessage: (msgParams: string[]) => string;
45
+ ethSign: (params: string[]) => Promise<string>;
46
+ getBalance: (address: string) => Promise<number>;
47
+ getEncryptedPubKey: () => string;
48
+ getErc20TokensByAddress?: (address: string, isSupported: boolean, apiUrl: string) => Promise<any[]>;
49
+ getFeeByType: (type: string) => Promise<string>;
50
+ getFeeDataWithDynamicMaxPriorityFeePerGas: () => Promise<any>;
51
+ getGasLimit: (toAddress: string) => Promise<number>;
52
+ getGasOracle?: () => Promise<any>;
53
+ getRecommendedNonce: (address: string) => Promise<number>;
54
+ signTypedData: (addr: string, typedData: TypedData | TypedMessage<any>, version: Version) => Promise<string>;
55
+ sendTransaction: (data: ISendTransaction) => Promise<TransactionResponse>;
56
+ importAccount: (mnemonicOrPrivKey: string) => ethers.Wallet;
57
+ parsePersonalMessage: (hexMsg: string) => string;
58
+ sendFormattedTransaction: (params: SimpleTransactionRequest, isLegacy?: boolean) => Promise<TransactionResponse>;
59
+ sendSignedErc1155Transaction: ({ receiver, tokenAddress, tokenId, isLegacy, gasPrice, gasLimit, maxFeePerGas, maxPriorityFeePerGas, }: ISendSignedErcTransactionProps) => Promise<IResponseFromSendErcSignedTransaction>;
60
+ verifyPersonalMessage: (msg: string, sign: string) => string;
61
+ toBigNumber: (aBigNumberish: string | number) => ethers.BigNumber;
62
+ sendSignedErc20Transaction: ({ networkUrl, receiver, tokenAddress, tokenAmount, }: ISendSignedErcTransactionProps) => Promise<IResponseFromSendErcSignedTransaction>;
63
+ sendSignedErc721Transaction: ({ networkUrl, receiver, tokenAddress, tokenId, }: ISendSignedErcTransactionProps) => Promise<IResponseFromSendErcSignedTransaction>;
64
+ sendTransactionWithEditedFee: (txHash: string, isLegacy?: boolean) => Promise<{
65
+ isSpeedUp: boolean;
66
+ transaction?: TransactionResponse;
67
+ error?: boolean;
68
+ }>;
69
+ signPersonalMessage: (params: string[]) => Promise<string>;
70
+ verifyTypedSignature: (data: TypedData | TypedMessage<any>, signature: string, version: Version) => string;
71
+ setWeb3Provider: (network: INetwork) => void;
72
+ getRecommendedGasPrice: (formatted?: boolean) => Promise<string | {
73
+ ethers: string;
74
+ gwei: string;
75
+ }>;
76
+ web3Provider: CustomJsonRpcProvider | CustomL2JsonRpcProvider;
77
+ getTxGasLimit: (tx: SimpleTransactionRequest) => Promise<ethers.BigNumber>;
78
+ }
79
+ /**
80
+ * Error structure for Syscoin transaction operations.
81
+ * This interface documents the error format that consumers (like Pali) should expect
82
+ * when catching errors from ISyscoinTransactions methods.
83
+ *
84
+ * @example
85
+ * try {
86
+ * const result = await syscoinTransaction.getEstimateSysTransactionFee({...});
87
+ * } catch (error: unknown) {
88
+ * const sysError = error as ISyscoinTransactionError;
89
+ * if (sysError.code === 'INSUFFICIENT_FUNDS') {
90
+ * console.log(`Short by ${sysError.shortfall} SYS`);
91
+ * }
92
+ * }
93
+ */
94
+ export interface ISyscoinTransactionError {
95
+ error: boolean;
96
+ code: 'INSUFFICIENT_FUNDS' | 'INVALID_FEE_RATE' | 'INVALID_AMOUNT' | 'INVALID_MEMO' | 'INVALID_BLOB' | 'INVALID_OUTPUT_COUNT' | 'INVALID_ASSET_ALLOCATION' | 'INVALID_PARENT_NODES' | 'INVALID_TX_VALUE' | 'INVALID_RECEIPT_VALUE' | 'SUBTRACT_FEE_FAILED' | 'TRANSACTION_CREATION_FAILED' | 'TRANSACTION_SEND_FAILED';
97
+ message: string;
98
+ fee?: number;
99
+ remainingFee?: number;
100
+ shortfall?: number;
101
+ details?: {
102
+ inputTotal?: any;
103
+ outputTotal?: any;
104
+ requiredFee?: any;
105
+ message?: string;
106
+ markedOutputs?: number;
107
+ removedOutputs?: number;
108
+ guid?: string;
109
+ };
110
+ }
111
+ export interface ISyscoinTransactions {
112
+ getEstimateSysTransactionFee: ({ txOptions, amount, receivingAddress, feeRate, token, isMax, }: {
113
+ amount: number;
114
+ feeRate?: number;
115
+ receivingAddress: string;
116
+ token?: {
117
+ guid: string;
118
+ symbol?: string;
119
+ } | null;
120
+ txOptions?: any;
121
+ isMax?: boolean | false;
122
+ }) => Promise<{
123
+ fee: number;
124
+ psbt: any;
125
+ }>;
126
+ getRecommendedFee: (explorerUrl: string) => Promise<number>;
127
+ decodeRawTransaction: (psbtOrHex: any, isRawHex?: boolean) => any;
128
+ sendTransaction: (psbt: any) => Promise<ITxid>;
129
+ signPSBT: ({ psbt, isTrezor, isLedger, pathIn, }: {
130
+ isLedger?: boolean;
131
+ isTrezor?: boolean;
132
+ pathIn?: string;
133
+ psbt: any;
134
+ }) => Promise<any>;
135
+ }
136
+ export interface IKeyringManager {
137
+ addNewAccount: (label?: string) => Promise<IKeyringAccountState>;
138
+ ethereumTransaction: IEthereumTransactions;
139
+ forgetMainWallet: (pwd: string) => void;
140
+ getAccountById: (id: number, accountType: KeyringAccountType) => Omit<IKeyringAccountState, 'xprv'>;
141
+ getAccountXpub: () => string;
142
+ getEncryptedXprv: (hd: SyscoinHDSigner) => string;
143
+ unlock: (password: string, isForPvtKey?: boolean) => Promise<{
144
+ canLogin: boolean;
145
+ needsAccountCreation?: boolean;
146
+ }>;
147
+ isUnlocked: () => boolean;
148
+ logout: () => void;
149
+ ledgerSigner: LedgerKeyring;
150
+ trezorSigner: TrezorKeyring;
151
+ setSignerNetwork: (network: INetwork) => Promise<{
152
+ success: boolean;
153
+ }>;
154
+ getPrivateKeyByAccountId: (id: number, accountType: KeyringAccountType, pwd: string) => Promise<string>;
155
+ setStorage: (client: any) => void;
156
+ syscoinTransaction: ISyscoinTransactions;
157
+ isSeedValid: (seedPhrase: string) => boolean;
158
+ getSeed: (pwd: string) => Promise<string>;
159
+ importTrezorAccount: (label?: string) => Promise<IKeyringAccountState>;
160
+ utf8Error: boolean;
161
+ validateZprv: (zprv: string, targetNetwork?: INetwork) => IValidateZprvResponse;
162
+ importAccount: (privKey: string, label?: string) => Promise<IKeyringAccountState>;
163
+ getNewChangeAddress: () => Promise<string>;
164
+ getChangeAddress: (id: number) => Promise<string>;
165
+ getPubkey: (id: number, isChangeAddress: boolean) => Promise<string>;
166
+ getBip32Path: (id: number, isChangeAddress: boolean) => Promise<string>;
167
+ updateReceivingAddress: () => Promise<string>;
168
+ getActiveAccount: () => {
169
+ activeAccount: Omit<IKeyringAccountState, 'xprv'>;
170
+ activeAccountType: KeyringAccountType;
171
+ };
172
+ importWeb3Account: (mnemonicOrPrivKey: string) => any;
173
+ createNewSeed: () => string;
174
+ getUTXOState: () => any;
175
+ importLedgerAccount: (label?: string) => Promise<IKeyringAccountState | undefined>;
176
+ getActiveUTXOAccountState: () => any;
177
+ createEthAccount: (privateKey: string) => any;
178
+ getAddress: (xpub: string, isChangeAddress: boolean) => Promise<string>;
179
+ initializeWalletSecurely: (seedPhrase: string, password: string, prvPassword?: string) => Promise<IKeyringAccountState>;
180
+ initializeSession: (seedPhrase: string, password: string) => Promise<void>;
181
+ createFirstAccount: (label?: string) => Promise<IKeyringAccountState>;
182
+ transferSessionTo: (targetKeyring: IKeyringManager) => void;
183
+ receiveSessionOwnership: (sessionPassword: any, sessionMnemonic: any) => void;
184
+ lockWallet: () => void;
185
+ setVaultStateGetter: (getter: () => any) => void;
186
+ }
187
+ export declare enum KeyringAccountType {
188
+ HDAccount = "HDAccount",
189
+ Imported = "Imported",
190
+ Ledger = "Ledger",
191
+ Trezor = "Trezor"
192
+ }
193
+ export type IKeyringDApp = {
194
+ active: boolean;
195
+ id: number;
196
+ url: string;
197
+ };
198
+ export type accountType = {
199
+ [id: number]: IKeyringAccountState;
200
+ };
201
+ export type IKeyringBalances = {
202
+ [INetworkType.Syscoin]: number;
203
+ [INetworkType.Ethereum]: number;
204
+ };
205
+ interface INetworkParams {
206
+ bech32: string;
207
+ bip32: {
208
+ private: number;
209
+ public: number;
210
+ };
211
+ messagePrefix: string;
212
+ pubKeyHash: number;
213
+ scriptHash: number;
214
+ slip44: number;
215
+ wif: number;
216
+ }
217
+ interface IValidateZprvResponse {
218
+ isValid: boolean;
219
+ message: string;
220
+ network?: INetworkParams | null;
221
+ node?: any;
222
+ }
223
+ export interface IKeyringAccountState {
224
+ address: string;
225
+ balances: IKeyringBalances;
226
+ id: number;
227
+ isImported: boolean;
228
+ isLedgerWallet: boolean;
229
+ isTrezorWallet: boolean;
230
+ label: string;
231
+ xprv: string;
232
+ xpub: string;
233
+ }
234
+ export interface ISyscoinBackendAccount {
235
+ address: string;
236
+ balance: string;
237
+ itemsOnPage: number;
238
+ page: number;
239
+ totalPages: number;
240
+ totalReceived: string;
241
+ totalSent: string;
242
+ txs: number;
243
+ unconfirmedBalance: string;
244
+ unconfirmedTxs: number;
245
+ }
246
+ export interface ILatestUpdateForSysAccount {
247
+ balances: {
248
+ ethereum: number;
249
+ syscoin: number;
250
+ };
251
+ receivingAddress: any;
252
+ xpub: any;
253
+ }
254
+ export interface ISendSignedErcTransactionProps {
255
+ decimals?: number;
256
+ gasLimit?: BigNumberish;
257
+ gasPrice?: BigNumberish;
258
+ isLegacy?: boolean;
259
+ maxFeePerGas?: BigNumberish;
260
+ maxPriorityFeePerGas?: BigNumberish;
261
+ networkUrl: string;
262
+ receiver: string;
263
+ saveTrezorTx?: (tx: any) => void;
264
+ tokenAddress: string;
265
+ tokenAmount?: string;
266
+ tokenId?: number;
267
+ }
268
+ export interface IResponseFromSendErcSignedTransaction {
269
+ accessList: any[];
270
+ chainId: number;
271
+ confirmations: number | null;
272
+ data: string;
273
+ from: string;
274
+ gasLimit: BigNumber;
275
+ gasPrice: BigNumber | null;
276
+ hash: string;
277
+ maxFeePerGas: BigNumber;
278
+ maxPriorityFeePerGas: BigNumber;
279
+ nonce: number;
280
+ r: string;
281
+ s: string;
282
+ to: string;
283
+ type: number;
284
+ v: number | null;
285
+ value: BigNumber;
286
+ wait: any;
287
+ }
288
+ export interface IGasParams {
289
+ gasLimit?: BigNumber;
290
+ gasPrice?: BigNumber;
291
+ maxFeePerGas?: BigNumber;
292
+ maxPriorityFeePerGas?: BigNumber;
293
+ }
294
+ export {};
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Get coin information by coin shortcut or slip44
3
+ * Priority: 1) Check if slip44=60 (EVM), 2) Check coins.ts (UTXO), 3) Default to unknown
4
+ */
5
+ export declare function getCoinInfo(coinShortcut: string, slip44: number): {
6
+ slip44: any;
7
+ segwit: any;
8
+ isEvm: boolean;
9
+ };
10
+ /**
11
+ * Determine if a coin is EVM-based (Ethereum-like)
12
+ */
13
+ export declare function isEvmCoin(coinShortcut: string, slip44: number): boolean;
14
+ /**
15
+ * Determine if a coin uses SegWit (BIP84 - m/84')
16
+ */
17
+ export declare function isSegwitCoin(coinShortcut: string, slip44: number): boolean;
18
+ /**
19
+ * Determine if a coin uses legacy derivation (BIP44 - m/44')
20
+ */
21
+ export declare function isLegacyCoin(coinShortcut: string, slip44: number): boolean;
22
+ /**
23
+ * Get the appropriate BIP standard for a coin
24
+ */
25
+ export declare function getBipStandard(coinShortcut: string, slip44: number): number;
26
+ /**
27
+ * Generate derivation path for account level (ending with account index)
28
+ * Example: m/84'/57'/0' for Syscoin account derivation
29
+ */
30
+ export declare function getAccountDerivationPath(coinShortcut: string, slip44: number, accountIndex?: number): string;
31
+ /**
32
+ * Generate derivation path for address level (full path to specific address)
33
+ * Example: m/84'/57'/0'/0/0 for first address of first Syscoin account
34
+ */
35
+ export declare function getAddressDerivationPath(coinShortcut: string, slip44: number, accountIndex?: number, isChangeAddress?: boolean, addressIndex?: number): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Utility functions for PSBT conversion between Pali and syscoinjs formats
3
+ */
4
+ export declare class PsbtUtils {
5
+ /**
6
+ * Import PSBT from Pali's exported format to syscoinjs PSBT object
7
+ * @param psbtFromPali - PSBT data exported from Pali
8
+ * @returns syscoinjs PSBT object
9
+ */
10
+ static fromPali(psbtFromPali: any): any;
11
+ /**
12
+ * Export syscoinjs PSBT object to Pali's expected format
13
+ * @param psbt - syscoinjs PSBT object
14
+ * @returns PSBT data in Pali's expected format
15
+ */
16
+ static toPali(psbt: any): any;
17
+ }
@@ -0,0 +1,4 @@
1
+ export declare function checkError(method: string, error: any, params: any): any;
2
+ export declare const SYSCOIN_BASIC_FEE = 0.00001;
3
+ export declare const ONE_HUNDRED_MILLION = 100000000;
4
+ export declare const BIP_84 = 84;