signet.js 0.0.12-beta1 → 0.2.0

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.
@@ -0,0 +1,2026 @@
1
+ import BN from "bn.js";
2
+ import { Address, Hash, Hex, PublicClient, SignableMessage, TransactionReceipt, TransactionRequest, TypedDataDefinition, WalletClient } from "viem";
3
+ import * as bitcoin from "bitcoinjs-lib";
4
+ import { EncodeObject } from "@cosmjs/proto-signing";
5
+ import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx.js";
6
+ import { AnchorProvider, Idl } from "@coral-xyz/anchor";
7
+ import { AccountMeta, Connection, PublicKey, Signer, TransactionInstruction } from "@solana/web3.js";
8
+
9
+ //#region rolldown:runtime
10
+ //#endregion
11
+ //#region src/contracts/ChainSignatureContract.d.ts
12
+ interface SignArgs {
13
+ /** The payload to sign as an array of 32 bytes */
14
+ payload: number[];
15
+ /** The derivation path for key generation */
16
+ path: string;
17
+ /** Version of the key to use */
18
+ key_version: number;
19
+ }
20
+ /**
21
+ * Base contract interface required for compatibility with ChainAdapter instances like EVM and Bitcoin.
22
+ *
23
+ * See {@link EVM} and {@link Bitcoin} for example implementations.
24
+ */
25
+ declare abstract class BaseChainSignatureContract {
26
+ /**
27
+ * Gets the current signature deposit required by the contract.
28
+ * This deposit amount helps manage network congestion.
29
+ *
30
+ * @returns Promise resolving to the required deposit amount as a BigNumber
31
+ */
32
+ abstract getCurrentSignatureDeposit(): Promise<BN>;
33
+ /**
34
+ * Derives a child public key using a\ derivation path and predecessor.
35
+ *
36
+ * @param args - Arguments for key derivation
37
+ * @param args.path - The string path to use derive the key
38
+ * @param args.predecessor - The id/address of the account requesting signature
39
+ * @param args.keyVersion - Optional key version controlling the derivation prefix (defaults to 0)
40
+ * @returns Promise resolving to the derived SEC1 uncompressed public key
41
+ */
42
+ abstract getDerivedPublicKey(args: {
43
+ path: string;
44
+ predecessor: string;
45
+ keyVersion: number;
46
+ } & Record<string, unknown>): Promise<UncompressedPubKeySEC1>;
47
+ }
48
+ /**
49
+ * Full contract interface that extends BaseChainSignatureContract to provide all Sig Network Smart Contract capabilities.
50
+ */
51
+ declare abstract class ChainSignatureContract extends BaseChainSignatureContract {
52
+ /**
53
+ * Signs a payload using Sig Network MPC.
54
+ *
55
+ * @param args - Arguments for the signing operation
56
+ * @param args.payload - The data to sign as an array of 32 bytes
57
+ * @param args.path - The string path to use derive the key
58
+ * @param args.key_version - Version of the key to use
59
+ * @returns Promise resolving to the RSV signature
60
+ */
61
+ abstract sign(args: SignArgs & Record<string, unknown>): Promise<RSVSignature>;
62
+ /**
63
+ * Gets the public key associated with this contract instance.
64
+ *
65
+ * @returns Promise resolving to the SEC1 uncompressed public key
66
+ */
67
+ abstract getPublicKey(): Promise<UncompressedPubKeySEC1>;
68
+ }
69
+ //#endregion
70
+ //#region src/types.d.ts
71
+ type HashToSign = SignArgs['payload'];
72
+ type Base58String = string;
73
+ type NajPublicKey = `secp256k1:${Base58String}`;
74
+ type UncompressedPubKeySEC1 = `04${string}`;
75
+ type CompressedPubKeySEC1 = `02${string}` | `03${string}`;
76
+ type KeyDerivationPath = string;
77
+ interface RSVSignature {
78
+ r: string;
79
+ s: string;
80
+ v: number;
81
+ }
82
+ interface SigNetEvmMpcSignature {
83
+ bigR: {
84
+ x: bigint;
85
+ y: bigint;
86
+ };
87
+ s: bigint;
88
+ recoveryId: number;
89
+ }
90
+ type MPCSignature = SigNetEvmMpcSignature;
91
+ declare namespace constants_d_exports {
92
+ export { CHAINS, CONTRACT_ADDRESSES, ENVS, KDF_CHAIN_IDS, ROOT_PUBLIC_KEYS };
93
+ }
94
+ declare const ENVS: {
95
+ readonly TESTNET_DEV: "TESTNET_DEV";
96
+ readonly TESTNET: "TESTNET";
97
+ readonly MAINNET: "MAINNET";
98
+ };
99
+ declare const CHAINS: {
100
+ readonly ETHEREUM: "ETHEREUM";
101
+ readonly SOLANA: "SOLANA";
102
+ };
103
+ /**
104
+ * Root public keys for the Sig Network Smart Contracts across different environments.
105
+ *
106
+ * These keys should never change.
107
+ */
108
+ declare const ROOT_PUBLIC_KEYS: Record<keyof typeof ENVS, NajPublicKey>;
109
+ /**
110
+ * Chain IDs used in the key derivation function (KDF) for deriving child public keys to
111
+ * distinguish between different chains.
112
+ *
113
+ * @see {@link deriveChildPublicKey} in cryptography.ts for usage details
114
+ */
115
+ declare const KDF_CHAIN_IDS: {
116
+ readonly ETHEREUM: "eip155:1";
117
+ readonly SOLANA: "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
118
+ };
119
+ /**
120
+ * Contract addresses for different chains and environments.
121
+ *
122
+ * - Testnet Dev: Used for internal development, very unstable
123
+ * - Testnet: Used for external development, stable
124
+ * - Mainnet: Production contract address
125
+ *
126
+ * @see ChainSignatureContract documentation for implementation details
127
+ */
128
+ declare const CONTRACT_ADDRESSES: Record<keyof typeof CHAINS, Record<keyof typeof ENVS, string>>;
129
+ declare namespace cryptography_d_exports {
130
+ export { compressPubKey, deriveChildPublicKey, najToUncompressedPubKeySEC1, toRSV, verifyRecoveredAddress };
131
+ }
132
+ declare const toRSV: (signature: MPCSignature) => RSVSignature;
133
+ /**
134
+ * Compresses an uncompressed public key to its compressed format following SEC1 standards.
135
+ * In SEC1, a compressed public key consists of a prefix (02 or 03) followed by the x-coordinate.
136
+ * The prefix indicates whether the y-coordinate is even (02) or odd (03).
137
+ *
138
+ * @param uncompressedPubKeySEC1 - The uncompressed public key in hex format, with or without '04' prefix
139
+ * @returns The compressed public key in hex format
140
+ * @throws Error if the uncompressed public key length is invalid
141
+ */
142
+ declare const compressPubKey: (uncompressedPubKeySEC1: UncompressedPubKeySEC1) => string;
143
+ /**
144
+ * Converts a NAJ public key to an uncompressed SEC1 public key.
145
+ *
146
+ * @param najPublicKey - The NAJ public key to convert (e.g. secp 256k1:3Ww8iFjqTHufye5aRGUvrQqETegR4gVUcW8FX5xzscaN9ENhpkffojsxJwi6N1RbbHMTxYa9UyKeqK3fsMuwxjR5)
147
+ * @returns The uncompressed SEC1 public key (e.g. 04 || x || y)
148
+ */
149
+ declare const najToUncompressedPubKeySEC1: (najPublicKey: NajPublicKey) => UncompressedPubKeySEC1;
150
+ /**
151
+ * Derives a child public key from a parent public key using the Sig.Network epsilon derivation scheme.
152
+ * The parent public keys are defined in @constants.ts
153
+ *
154
+ * @param rootUncompressedPubKeySEC1 - The parent public key in uncompressed SEC1 format (e.g. 04 || x || y)
155
+ * @param predecessorId - The predecessor ID is the address of the account calling the signer contract (e.g EOA or Contract Address)
156
+ * @param path - Optional derivation path suffix (defaults to empty string)
157
+ * @param chainId - CAIP-2 chain identifier used for derivation
158
+ * @param keyVersion - Key version controlling which derivation prefix to use (legacy v1 for 0, CAIP-2 v2 otherwise)
159
+ * @returns The derived child public key in uncompressed SEC1 format (04 || x || y)
160
+ */
161
+ declare function deriveChildPublicKey(rootUncompressedPubKeySEC1: UncompressedPubKeySEC1, predecessorId: string, path: string | undefined, chainId: string, keyVersion: number): UncompressedPubKeySEC1;
162
+ /**
163
+ * Verifies that a secp256k1 signature was created by the expected derived address
164
+ * by recovering the signing address and comparing it with the address derived from the contract.
165
+ *
166
+ * @param signature - The RSV signature to verify
167
+ * @param payload - The original message that was signed (as byte array)
168
+ * @param requesterAddress - The address of the requester
169
+ * @param path - The derivation path used for key generation
170
+ * @param contract - The contract instance for deriving addresses
171
+ * @returns Promise resolving to true if the recovered address matches the expected address
172
+ */
173
+ declare function verifyRecoveredAddress(signature: RSVSignature, payload: number[] | Uint8Array, requesterAddress: string, path: string, contract: BaseChainSignatureContract, keyVersion: number): Promise<boolean>;
174
+ declare namespace index_d_exports$2 {
175
+ export { cryptography_d_exports as cryptography };
176
+ }
177
+ //#endregion
178
+ //#region src/chain-adapters/ChainAdapter.d.ts
179
+ declare abstract class ChainAdapter<TransactionRequest$1, UnsignedTransaction> {
180
+ /**
181
+ * Gets the native token balance and decimals for a given address
182
+ *
183
+ * @param address - The address to check
184
+ * @returns Promise resolving to an object containing:
185
+ * - balance: The balance as a bigint, in the chain's base units
186
+ * - decimals: The number of decimals used to format the balance
187
+ */
188
+ abstract getBalance(address: string): Promise<{
189
+ balance: bigint;
190
+ decimals: number;
191
+ }>;
192
+ /**
193
+ * Uses Sig Network Key Derivation Function to derive the address and public key. from a signer ID and string path.
194
+ *
195
+ * @param predecessor - The id/address of the account requesting signature
196
+ * @param path - The string path used to derive the key
197
+ * @returns Promise resolving to the derived address and public key
198
+ */
199
+ abstract deriveAddressAndPublicKey(predecessor: string, path: KeyDerivationPath, keyVersion: number): Promise<{
200
+ address: string;
201
+ publicKey: string;
202
+ }>;
203
+ /**
204
+ * Serializes an unsigned transaction to a string format.
205
+ * This is useful for storing or transmitting the transaction.
206
+ *
207
+ * @param transaction - The unsigned transaction to serialize
208
+ * @returns The serialized transaction string
209
+ */
210
+ abstract serializeTransaction(transaction: UnsignedTransaction): string;
211
+ /**
212
+ * Deserializes a transaction string back into an unsigned transaction object.
213
+ * This reverses the serialization done by serializeTransaction().
214
+ *
215
+ * @param serialized - The serialized transaction string
216
+ * @returns The deserialized unsigned transaction
217
+ */
218
+ abstract deserializeTransaction(serialized: string): UnsignedTransaction;
219
+ /**
220
+ * Prepares a transaction for Sig Network MPC signing by creating the necessary payloads.
221
+ * This method handles chain-specific transaction preparation including:
222
+ * - Fee calculation
223
+ * - Nonce/sequence management
224
+ * - UTXO selection (for UTXO-based chains)
225
+ * - Transaction encoding
226
+ *
227
+ * @param transactionRequest - The transaction request containing parameters like recipient, amount, etc.
228
+ * @returns Promise resolving to an object containing:
229
+ * - transaction: The unsigned transaction
230
+ * - hashesToSign: Array of payloads to be signed by MPC. The order of these payloads must match
231
+ * the order of signatures provided to finalizeTransactionSigning()
232
+ */
233
+ abstract prepareTransactionForSigning(transactionRequest: TransactionRequest$1): Promise<{
234
+ transaction: UnsignedTransaction;
235
+ hashesToSign: HashToSign[];
236
+ }>;
237
+ /**
238
+ * Adds Sig Network MPC-generated signatures to an unsigned transaction.
239
+ *
240
+ * @param params - Parameters for adding signatures
241
+ * @param params.transaction - The unsigned transaction to add signatures to
242
+ * @param params.rsvSignatures - Array of RSV signatures generated through MPC. Must be in the same order
243
+ * as the payloads returned by prepareTransactionForSigning()
244
+ * @returns The serialized signed transaction ready for broadcast
245
+ */
246
+ abstract finalizeTransactionSigning(params: {
247
+ transaction: UnsignedTransaction;
248
+ rsvSignatures: RSVSignature[];
249
+ }): string;
250
+ /**
251
+ * Broadcasts a signed transaction to the network.
252
+ *
253
+ * @param txSerialized - The serialized signed transaction
254
+ * @returns Promise resolving to the transaction hash/ID
255
+ */
256
+ abstract broadcastTx(txSerialized: string): Promise<string>;
257
+ }
258
+ //#endregion
259
+ //#region src/chain-adapters/EVM/types.d.ts
260
+ type EVMUnsignedTransaction = TransactionRequest & {
261
+ type: 'eip1559';
262
+ chainId: number;
263
+ };
264
+ interface EVMTransactionRequest extends Omit<EVMUnsignedTransaction, 'chainId' | 'type'> {
265
+ from: Address;
266
+ }
267
+ type EVMMessage = SignableMessage;
268
+ type EVMTypedData = TypedDataDefinition;
269
+ interface UserOperationV7 {
270
+ sender: Hex;
271
+ nonce: Hex;
272
+ factory: Hex;
273
+ factoryData: Hex;
274
+ callData: Hex;
275
+ callGasLimit: Hex;
276
+ verificationGasLimit: Hex;
277
+ preVerificationGas: Hex;
278
+ maxFeePerGas: Hex;
279
+ maxPriorityFeePerGas: Hex;
280
+ paymaster: Hex;
281
+ paymasterVerificationGasLimit: Hex;
282
+ paymasterPostOpGasLimit: Hex;
283
+ paymasterData: Hex;
284
+ signature: Hex;
285
+ }
286
+ interface UserOperationV6 {
287
+ sender: Hex;
288
+ nonce: Hex;
289
+ initCode: Hex;
290
+ callData: Hex;
291
+ callGasLimit: Hex;
292
+ verificationGasLimit: Hex;
293
+ preVerificationGas: Hex;
294
+ maxFeePerGas: Hex;
295
+ maxPriorityFeePerGas: Hex;
296
+ paymasterAndData: Hex;
297
+ signature: Hex;
298
+ }
299
+ //#endregion
300
+ //#region src/chain-adapters/EVM/EVM.d.ts
301
+ /**
302
+ * Implementation of the ChainAdapter interface for EVM-compatible networks.
303
+ * Handles interactions with Ethereum Virtual Machine based blockchains like Ethereum, BSC, Polygon, etc.
304
+ */
305
+ declare class EVM extends ChainAdapter<EVMTransactionRequest, EVMUnsignedTransaction> {
306
+ private readonly client;
307
+ private readonly contract;
308
+ /**
309
+ * Creates a new EVM chain instance
310
+ * @param params - Configuration parameters
311
+ * @param params.publicClient - A Viem PublicClient instance for reading from the blockchain
312
+ * @param params.contract - Instance of the chain signature contract for MPC operations
313
+ */
314
+ constructor({
315
+ publicClient,
316
+ contract
317
+ }: {
318
+ publicClient: PublicClient;
319
+ contract: BaseChainSignatureContract;
320
+ });
321
+ private attachGasAndNonce;
322
+ private transformRSVSignature;
323
+ private assembleSignature;
324
+ deriveAddressAndPublicKey(predecessor: string, path: KeyDerivationPath, keyVersion: number): Promise<{
325
+ address: string;
326
+ publicKey: string;
327
+ }>;
328
+ getBalance(address: string): Promise<{
329
+ balance: bigint;
330
+ decimals: number;
331
+ }>;
332
+ serializeTransaction(transaction: EVMUnsignedTransaction): `0x${string}`;
333
+ deserializeTransaction(serialized: `0x${string}`): EVMUnsignedTransaction;
334
+ prepareTransactionForSigning(transactionRequest: EVMTransactionRequest): Promise<{
335
+ transaction: EVMUnsignedTransaction;
336
+ hashesToSign: HashToSign[];
337
+ }>;
338
+ prepareMessageForSigning(message: EVMMessage): Promise<{
339
+ hashToSign: HashToSign;
340
+ }>;
341
+ prepareTypedDataForSigning(typedDataRequest: EVMTypedData): Promise<{
342
+ hashToSign: HashToSign;
343
+ }>;
344
+ /**
345
+ * This implementation is a common step for Biconomy and Alchemy.
346
+ * Key differences between implementations:
347
+ * - Signature format: Biconomy omits 0x00 prefix when concatenating, Alchemy includes it
348
+ * - Version support: Biconomy only supports v6, Alchemy supports both v6 and v7
349
+ * - Validation: Biconomy uses modules for signature validation, Alchemy uses built-in validation
350
+ */
351
+ prepareUserOpForSigning(userOp: UserOperationV7 | UserOperationV6, entryPointAddress?: Address, chainIdArgs?: number): Promise<{
352
+ userOp: UserOperationV7 | UserOperationV6;
353
+ hashToSign: HashToSign;
354
+ }>;
355
+ finalizeTransactionSigning({
356
+ transaction,
357
+ rsvSignatures
358
+ }: {
359
+ transaction: EVMUnsignedTransaction;
360
+ rsvSignatures: RSVSignature[];
361
+ }): `0x02${string}`;
362
+ finalizeMessageSigning({
363
+ rsvSignature
364
+ }: {
365
+ rsvSignature: RSVSignature;
366
+ }): Hex;
367
+ finalizeTypedDataSigning({
368
+ rsvSignature
369
+ }: {
370
+ rsvSignature: RSVSignature;
371
+ }): Hex;
372
+ finalizeUserOpSigning({
373
+ userOp,
374
+ rsvSignature
375
+ }: {
376
+ userOp: UserOperationV7 | UserOperationV6;
377
+ rsvSignature: RSVSignature;
378
+ }): UserOperationV7 | UserOperationV6;
379
+ broadcastTx(txSerialized: `0x${string}`): Promise<Hash>;
380
+ }
381
+ //#endregion
382
+ //#region src/chain-adapters/EVM/utils.d.ts
383
+ interface EVMFeeProperties {
384
+ gas: bigint;
385
+ maxFeePerGas: bigint;
386
+ maxPriorityFeePerGas: bigint;
387
+ }
388
+ declare function fetchEVMFeeProperties(client: PublicClient, transaction: TransactionRequest): Promise<EVMFeeProperties>;
389
+ declare namespace index_d_exports$5 {
390
+ export { EVM, EVMMessage, EVMTransactionRequest, EVMTypedData, EVMUnsignedTransaction, fetchEVMFeeProperties };
391
+ }
392
+ //#endregion
393
+ //#region src/chain-adapters/Bitcoin/types.d.ts
394
+ interface BTCTransaction {
395
+ vout: Array<{
396
+ scriptpubkey: string;
397
+ value: number;
398
+ }>;
399
+ }
400
+ interface BTCInput {
401
+ txid: string;
402
+ vout: number;
403
+ value: number;
404
+ scriptPubKey: Buffer;
405
+ }
406
+ type BTCOutput = {
407
+ value: number;
408
+ } | {
409
+ address: string;
410
+ value: number;
411
+ } | {
412
+ script: Buffer;
413
+ value: number;
414
+ };
415
+ type BTCTransactionRequest = {
416
+ publicKey: string;
417
+ } & ({
418
+ inputs: BTCInput[];
419
+ outputs: BTCOutput[];
420
+ from?: never;
421
+ to?: never;
422
+ value?: never;
423
+ } | {
424
+ inputs?: never;
425
+ outputs?: never;
426
+ from: string;
427
+ to: string;
428
+ value: string;
429
+ });
430
+ interface BTCUnsignedTransaction {
431
+ psbt: bitcoin.Psbt;
432
+ publicKey: string;
433
+ }
434
+ type BTCNetworkIds = 'mainnet' | 'testnet' | 'regtest';
435
+ //#endregion
436
+ //#region src/chain-adapters/Bitcoin/BTCRpcAdapter/BTCRpcAdapter.d.ts
437
+ declare abstract class BTCRpcAdapter {
438
+ abstract selectUTXOs(from: string, targets: BTCOutput[]): Promise<{
439
+ inputs: BTCInput[];
440
+ outputs: BTCOutput[];
441
+ }>;
442
+ abstract broadcastTransaction(transactionHex: string): Promise<string>;
443
+ abstract getBalance(address: string): Promise<number>;
444
+ abstract getTransaction(txid: string): Promise<BTCTransaction>;
445
+ }
446
+ //#endregion
447
+ //#region src/chain-adapters/Bitcoin/BTCRpcAdapter/Mempool/Mempool.d.ts
448
+ declare class Mempool extends BTCRpcAdapter {
449
+ private readonly providerUrl;
450
+ constructor(providerUrl: string);
451
+ private fetchFeeRate;
452
+ private fetchUTXOs;
453
+ selectUTXOs(from: string, targets: BTCOutput[], confirmationTarget?: number): Promise<{
454
+ inputs: BTCInput[];
455
+ outputs: BTCOutput[];
456
+ }>;
457
+ broadcastTransaction(transactionHex: string): Promise<string>;
458
+ getBalance(address: string): Promise<number>;
459
+ getTransaction(txid: string): Promise<BTCTransaction>;
460
+ }
461
+ //#endregion
462
+ //#region src/chain-adapters/Bitcoin/BTCRpcAdapter/index.d.ts
463
+ declare const BTCRpcAdapters: {
464
+ Mempool: typeof Mempool;
465
+ };
466
+ //#endregion
467
+ //#region src/chain-adapters/Bitcoin/Bitcoin.d.ts
468
+ /**
469
+ * Implementation of the ChainAdapter interface for Bitcoin network.
470
+ * Handles interactions with both Bitcoin mainnet and testnet, supporting P2WPKH transactions.
471
+ */
472
+ declare class Bitcoin extends ChainAdapter<BTCTransactionRequest, BTCUnsignedTransaction> {
473
+ private static readonly SATOSHIS_PER_BTC;
474
+ private readonly network;
475
+ private readonly btcRpcAdapter;
476
+ private readonly contract;
477
+ /**
478
+ * Creates a new Bitcoin chain instance
479
+ * @param params - Configuration parameters
480
+ * @param params.network - Network identifier (mainnet/testnet)
481
+ * @param params.contract - Instance of the chain signature contract for MPC operations
482
+ * @param params.btcRpcAdapter - Bitcoin RPC adapter for network interactions
483
+ */
484
+ constructor({
485
+ network,
486
+ contract,
487
+ btcRpcAdapter
488
+ }: {
489
+ network: BTCNetworkIds;
490
+ contract: BaseChainSignatureContract;
491
+ btcRpcAdapter: BTCRpcAdapter;
492
+ });
493
+ /**
494
+ * Converts satoshis to BTC
495
+ * @param satoshis - Amount in satoshis
496
+ * @returns Amount in BTC
497
+ */
498
+ static toBTC(satoshis: number): number;
499
+ /**
500
+ * Converts BTC to satoshis
501
+ * @param btc - Amount in BTC
502
+ * @returns Amount in satoshis (rounded)
503
+ */
504
+ static toSatoshi(btc: number): number;
505
+ private fetchTransaction;
506
+ private static transformRSVSignature;
507
+ /**
508
+ * Creates a Partially Signed Bitcoin Transaction (PSBT)
509
+ * @param params - Parameters for creating the PSBT
510
+ * @param params.transactionRequest - Transaction request containing inputs and outputs
511
+ * @returns Created PSBT instance
512
+ */
513
+ createPSBT({
514
+ transactionRequest
515
+ }: {
516
+ transactionRequest: BTCTransactionRequest;
517
+ }): Promise<bitcoin.Psbt>;
518
+ getBalance(address: string): Promise<{
519
+ balance: bigint;
520
+ decimals: number;
521
+ }>;
522
+ deriveAddressAndPublicKey(predecessor: string, path: KeyDerivationPath, keyVersion: number): Promise<{
523
+ address: string;
524
+ publicKey: string;
525
+ }>;
526
+ serializeTransaction(transaction: BTCUnsignedTransaction): string;
527
+ deserializeTransaction(serialized: string): BTCUnsignedTransaction;
528
+ prepareTransactionForSigning(transactionRequest: BTCTransactionRequest): Promise<{
529
+ transaction: BTCUnsignedTransaction;
530
+ hashesToSign: HashToSign[];
531
+ }>;
532
+ finalizeTransactionSigning({
533
+ transaction: {
534
+ psbt,
535
+ publicKey
536
+ },
537
+ rsvSignatures
538
+ }: {
539
+ transaction: BTCUnsignedTransaction;
540
+ rsvSignatures: RSVSignature[];
541
+ }): string;
542
+ broadcastTx(txSerialized: string): Promise<string>;
543
+ }
544
+ declare namespace index_d_exports$6 {
545
+ export { BTCInput, BTCNetworkIds, BTCOutput, BTCRpcAdapter, BTCRpcAdapters, BTCTransaction, BTCTransactionRequest, BTCUnsignedTransaction, Bitcoin };
546
+ }
547
+ //#endregion
548
+ //#region src/chain-adapters/Cosmos/types.d.ts
549
+ type CosmosNetworkIds = string;
550
+ type CosmosUnsignedTransaction = TxRaw;
551
+ interface CosmosTransactionRequest {
552
+ address: string;
553
+ publicKey: string;
554
+ messages: EncodeObject[];
555
+ memo?: string;
556
+ gas?: number;
557
+ }
558
+ //#endregion
559
+ //#region src/chain-adapters/Cosmos/Cosmos.d.ts
560
+ /**
561
+ * Implementation of the ChainAdapter interface for Cosmos-based networks.
562
+ * Handles interactions with Cosmos SDK chains like Cosmos Hub, Osmosis, etc.
563
+ */
564
+ declare class Cosmos extends ChainAdapter<CosmosTransactionRequest, CosmosUnsignedTransaction> {
565
+ private readonly registry;
566
+ private readonly chainId;
567
+ private readonly contract;
568
+ private readonly endpoints?;
569
+ /**
570
+ * Creates a new Cosmos chain instance
571
+ * @param params - Configuration parameters
572
+ * @param params.chainId - Chain id for the Cosmos network
573
+ * @param params.contract - Instance of the chain signature contract for MPC operations
574
+ * @param params.endpoints - Optional RPC and REST endpoints
575
+ * @param params.endpoints.rpcUrl - Optional RPC endpoint URL
576
+ * @param params.endpoints.restUrl - Optional REST endpoint URL
577
+ */
578
+ constructor({
579
+ chainId,
580
+ contract,
581
+ endpoints
582
+ }: {
583
+ contract: BaseChainSignatureContract;
584
+ chainId: CosmosNetworkIds;
585
+ endpoints?: {
586
+ rpcUrl?: string;
587
+ restUrl?: string;
588
+ };
589
+ });
590
+ private transformRSVSignature;
591
+ private getChainInfo;
592
+ getBalance(address: string): Promise<{
593
+ balance: bigint;
594
+ decimals: number;
595
+ }>;
596
+ deriveAddressAndPublicKey(predecessor: string, path: KeyDerivationPath, keyVersion: number): Promise<{
597
+ address: string;
598
+ publicKey: string;
599
+ }>;
600
+ serializeTransaction(transaction: CosmosUnsignedTransaction): string;
601
+ deserializeTransaction(serialized: string): CosmosUnsignedTransaction;
602
+ prepareTransactionForSigning(transactionRequest: CosmosTransactionRequest): Promise<{
603
+ transaction: CosmosUnsignedTransaction;
604
+ hashesToSign: HashToSign[];
605
+ }>;
606
+ finalizeTransactionSigning({
607
+ transaction,
608
+ rsvSignatures
609
+ }: {
610
+ transaction: CosmosUnsignedTransaction;
611
+ rsvSignatures: RSVSignature[];
612
+ }): string;
613
+ broadcastTx(txSerialized: string): Promise<string>;
614
+ }
615
+ declare namespace index_d_exports$7 {
616
+ export { Cosmos, CosmosNetworkIds, CosmosTransactionRequest, CosmosUnsignedTransaction };
617
+ }
618
+ declare namespace index_d_exports {
619
+ export { ChainAdapter, index_d_exports$6 as btc, index_d_exports$7 as cosmos, index_d_exports$5 as evm };
620
+ }
621
+ declare namespace ChainSignaturesContractABI_d_exports {
622
+ export { abi };
623
+ }
624
+ declare const abi: ({
625
+ inputs: {
626
+ internalType: string;
627
+ name: string;
628
+ type: string;
629
+ }[];
630
+ stateMutability: string;
631
+ type: string;
632
+ name?: undefined;
633
+ anonymous?: undefined;
634
+ outputs?: undefined;
635
+ } | {
636
+ inputs: {
637
+ internalType: string;
638
+ name: string;
639
+ type: string;
640
+ }[];
641
+ name: string;
642
+ type: string;
643
+ stateMutability?: undefined;
644
+ anonymous?: undefined;
645
+ outputs?: undefined;
646
+ } | {
647
+ anonymous: boolean;
648
+ inputs: ({
649
+ indexed: boolean;
650
+ internalType: string;
651
+ name: string;
652
+ type: string;
653
+ components?: undefined;
654
+ } | {
655
+ components: ({
656
+ components: {
657
+ internalType: string;
658
+ name: string;
659
+ type: string;
660
+ }[];
661
+ internalType: string;
662
+ name: string;
663
+ type: string;
664
+ } | {
665
+ internalType: string;
666
+ name: string;
667
+ type: string;
668
+ components?: undefined;
669
+ })[];
670
+ indexed: boolean;
671
+ internalType: string;
672
+ name: string;
673
+ type: string;
674
+ })[];
675
+ name: string;
676
+ type: string;
677
+ stateMutability?: undefined;
678
+ outputs?: undefined;
679
+ } | {
680
+ inputs: {
681
+ internalType: string;
682
+ name: string;
683
+ type: string;
684
+ }[];
685
+ name: string;
686
+ outputs: {
687
+ internalType: string;
688
+ name: string;
689
+ type: string;
690
+ }[];
691
+ stateMutability: string;
692
+ type: string;
693
+ anonymous?: undefined;
694
+ } | {
695
+ inputs: {
696
+ components: ({
697
+ internalType: string;
698
+ name: string;
699
+ type: string;
700
+ components?: undefined;
701
+ } | {
702
+ components: ({
703
+ components: {
704
+ internalType: string;
705
+ name: string;
706
+ type: string;
707
+ }[];
708
+ internalType: string;
709
+ name: string;
710
+ type: string;
711
+ } | {
712
+ internalType: string;
713
+ name: string;
714
+ type: string;
715
+ components?: undefined;
716
+ })[];
717
+ internalType: string;
718
+ name: string;
719
+ type: string;
720
+ })[];
721
+ internalType: string;
722
+ name: string;
723
+ type: string;
724
+ }[];
725
+ name: string;
726
+ outputs: never[];
727
+ stateMutability: string;
728
+ type: string;
729
+ anonymous?: undefined;
730
+ })[];
731
+ declare namespace errors_d_exports$1 {
732
+ export { ChainSignatureError, SignatureContractError$1 as SignatureContractError, SignatureNotFoundError$1 as SignatureNotFoundError, SigningError$1 as SigningError };
733
+ }
734
+ declare class ChainSignatureError extends Error {
735
+ requestId: `0x${string}`;
736
+ receipt: TransactionReceipt;
737
+ constructor(message: string, requestId: `0x${string}`, receipt: TransactionReceipt);
738
+ }
739
+ declare class SignatureNotFoundError$1 extends ChainSignatureError {
740
+ constructor(requestId: `0x${string}`, receipt: TransactionReceipt);
741
+ }
742
+ declare class SignatureContractError$1 extends ChainSignatureError {
743
+ errorCode: string;
744
+ constructor(errorCode: string, requestId: `0x${string}`, receipt: TransactionReceipt);
745
+ }
746
+ declare class SigningError$1 extends ChainSignatureError {
747
+ originalError?: Error;
748
+ constructor(requestId: `0x${string}`, receipt: TransactionReceipt, originalError?: Error);
749
+ }
750
+ //#endregion
751
+ //#region src/contracts/evm/types.d.ts
752
+ interface RetryOptions {
753
+ delay?: number;
754
+ retryCount?: number;
755
+ }
756
+ interface SignOptions {
757
+ sign: {
758
+ algo?: string;
759
+ dest?: string;
760
+ params?: string;
761
+ };
762
+ retry: RetryOptions;
763
+ transaction?: {
764
+ gas?: bigint;
765
+ maxFeePerGas?: bigint;
766
+ maxPriorityFeePerGas?: bigint;
767
+ nonce?: number;
768
+ };
769
+ }
770
+ interface SignatureErrorData {
771
+ requestId: string;
772
+ error: string;
773
+ }
774
+ //#endregion
775
+ //#region src/contracts/evm/ChainSignaturesContract.d.ts
776
+ /**
777
+ * Implementation of the ChainSignatureContract for EVM chains.
778
+ *
779
+ * When signing data, the contract emits a SignatureRequested event with a requestId.
780
+ * This requestId is used to track the signature request and retrieve the signature
781
+ * once it's available. The sign method handles this process automatically by polling
782
+ * for the signature using the requestId.
783
+ */
784
+ declare class ChainSignatureContract$2 extends ChainSignatureContract {
785
+ private readonly publicClient;
786
+ private readonly walletClient;
787
+ private readonly contractAddress;
788
+ private readonly rootPublicKey;
789
+ /**
790
+ * Creates a new instance of the ChainSignatureContract for EVM chains.
791
+ *
792
+ * @param args - Configuration options for the contract
793
+ * @param args.publicClient - A Viem PublicClient instance for reading from the blockchain
794
+ * @param args.walletClient - A Viem WalletClient instance for sending transactions
795
+ * @param args.contractAddress - The address of the deployed ChainSignatures contract (e.g. `0x857ED3A242B59cC24144814a0DF41C397a3811E6`)
796
+ * @param args.rootPublicKey - Optional root public key. If not provided, it will be derived from the contract address
797
+ */
798
+ constructor(args: {
799
+ publicClient: PublicClient;
800
+ walletClient: WalletClient;
801
+ contractAddress: Hex;
802
+ rootPublicKey?: NajPublicKey;
803
+ });
804
+ getCurrentSignatureDeposit(): Promise<BN>;
805
+ getDerivedPublicKey(args: {
806
+ path: string;
807
+ predecessor: string;
808
+ keyVersion: number;
809
+ }): Promise<UncompressedPubKeySEC1>;
810
+ getPublicKey(): Promise<UncompressedPubKeySEC1>;
811
+ getLatestKeyVersion(): Promise<number>;
812
+ /**
813
+ * Sends a sign request transaction and return the transaction hash.
814
+ *
815
+ * @param args - The signature arguments
816
+ * @param options - The signing options
817
+ * @returns The transaction hash
818
+ */
819
+ createSignatureRequest(args: SignArgs, options?: Pick<SignOptions, 'sign' | 'transaction'>): Promise<{
820
+ txHash: Hex;
821
+ requestId: Hex;
822
+ }>;
823
+ /**
824
+ * Sends a transaction to the contract to request a signature, then
825
+ * polls for the signature result. If the signature is not found within the retry
826
+ * parameters, it will throw an error.
827
+ */
828
+ sign(args: SignArgs, options?: SignOptions): Promise<RSVSignature>;
829
+ pollForRequestId({
830
+ requestId,
831
+ payload,
832
+ path,
833
+ keyVersion,
834
+ fromBlock,
835
+ options
836
+ }: {
837
+ requestId: Hex;
838
+ payload: number[];
839
+ path: string;
840
+ keyVersion: number;
841
+ fromBlock: bigint;
842
+ options?: RetryOptions;
843
+ }): Promise<RSVSignature | SignatureErrorData | undefined>;
844
+ getSignRequestParams(args: SignArgs, options?: SignOptions['sign']): Promise<{
845
+ target: Hex;
846
+ data: Hex;
847
+ value: bigint;
848
+ }>;
849
+ /**
850
+ * Generates the request ID for a signature request allowing to track the response.
851
+ *
852
+ * @param args - The signature request object containing:
853
+ * @param args.payload - The data payload to be signed as a hex string
854
+ * @param args.path - The derivation path for the key
855
+ * @param args.keyVersion - The version of the key to use
856
+ * @param options - The signature request object containing:
857
+ * @param options.algo - The signing algorithm to use
858
+ * @param options.dest - The destination for the signature
859
+ * @param options.params - Additional parameters for the signing process
860
+ * @returns A hex string representing the unique request ID
861
+ *
862
+ * @example
863
+ * ```typescript
864
+ * const requestId = ChainSignatureContract.getRequestId({
865
+ * payload: payload: `0x${Buffer.from(args.payload).toString('hex')}`,,
866
+ * path: '',
867
+ * keyVersion: 0
868
+ * });
869
+ * console.log(requestId); // 0x...
870
+ * ```
871
+ */
872
+ getRequestId(args: SignArgs, options?: SignOptions['sign']): Hex;
873
+ getErrorFromEvents(requestId: Hex, fromBlock: bigint): Promise<SignatureErrorData | undefined>;
874
+ /**
875
+ * Searches for SignatureResponded events that match the given requestId.
876
+ * It works in conjunction with the getRequestId method which generates the unique
877
+ * identifier for a signature request.
878
+ *
879
+ * @param requestId - The identifier for the signature request
880
+ * @param fromBlock - The block number to start searching from
881
+ * @returns The RSV signature if found, undefined otherwise
882
+ */
883
+ getSignatureFromEvents(requestId: Hex, fromBlock: bigint): Promise<RSVSignature | undefined>;
884
+ }
885
+ declare namespace index_d_exports$3 {
886
+ export { ChainSignatureContract$2 as ChainSignatureContract, utils$1 as utils };
887
+ }
888
+ declare const utils$1: {
889
+ ChainSignaturesContractABI: typeof ChainSignaturesContractABI_d_exports;
890
+ errors: typeof errors_d_exports$1;
891
+ };
892
+ declare namespace errors_d_exports {
893
+ export { ResponseError, SignatureContractError, SignatureNotFoundError, SigningError };
894
+ }
895
+ declare class SignatureNotFoundError extends Error {
896
+ readonly requestId?: string;
897
+ readonly hash?: string;
898
+ constructor(requestId?: string, metadata?: {
899
+ hash?: string;
900
+ });
901
+ }
902
+ declare class SignatureContractError extends Error {
903
+ readonly requestId?: string;
904
+ readonly hash?: string;
905
+ readonly originalError?: {
906
+ hash: string;
907
+ };
908
+ constructor(message: string, requestId?: string, metadata?: {
909
+ hash?: string;
910
+ });
911
+ }
912
+ declare class SigningError extends Error {
913
+ readonly requestId: string;
914
+ readonly hash?: string;
915
+ readonly originalError?: Error;
916
+ constructor(requestId: string, metadata?: {
917
+ hash?: string;
918
+ }, originalError?: Error);
919
+ }
920
+ declare class ResponseError extends Error {
921
+ constructor(message: string);
922
+ }
923
+ //#endregion
924
+ //#region src/contracts/solana/types/chain_signatures_project.d.ts
925
+ /**
926
+ * Program IDL in camelCase format in order to be used in JS/TS.
927
+ *
928
+ * Note that this is only a type helper and is not the actual IDL. The original
929
+ * IDL can be found at `target/idl/chain_signatures_project.json`.
930
+ */
931
+ interface ChainSignaturesProject {
932
+ address: 'H5tHfpYoEnarrrzcV7sWBcZhiKMvL2aRpUYvb1ydWkwS';
933
+ metadata: {
934
+ name: 'chainSignatures';
935
+ version: '0.4.0';
936
+ spec: '0.1.0';
937
+ description: 'Chain signatures program for cross-chain signing on Solana';
938
+ repository: 'https://github.com/sig-net/signet-solana-program';
939
+ };
940
+ instructions: [{
941
+ name: 'getSignatureDeposit';
942
+ docs: ['* @dev Function to get the current signature deposit amount.\n * @return The current signature deposit amount.'];
943
+ discriminator: [45, 243, 86, 86, 58, 57, 172, 253];
944
+ accounts: [{
945
+ name: 'programState';
946
+ pda: {
947
+ seeds: [{
948
+ kind: 'const';
949
+ value: [112, 114, 111, 103, 114, 97, 109, 45, 115, 116, 97, 116, 101];
950
+ }];
951
+ };
952
+ }];
953
+ args: [];
954
+ returns: 'u64';
955
+ }, {
956
+ name: 'initialize';
957
+ docs: ['* @dev Function to initialize the program state.\n * @param signature_deposit The deposit required for signature requests.\n * @param chain_id The CAIP-2 chain identifier.'];
958
+ discriminator: [175, 175, 109, 31, 13, 152, 155, 237];
959
+ accounts: [{
960
+ name: 'programState';
961
+ writable: true;
962
+ pda: {
963
+ seeds: [{
964
+ kind: 'const';
965
+ value: [112, 114, 111, 103, 114, 97, 109, 45, 115, 116, 97, 116, 101];
966
+ }];
967
+ };
968
+ }, {
969
+ name: 'admin';
970
+ writable: true;
971
+ signer: true;
972
+ }, {
973
+ name: 'systemProgram';
974
+ address: '11111111111111111111111111111111';
975
+ }];
976
+ args: [{
977
+ name: 'signatureDeposit';
978
+ type: 'u64';
979
+ }, {
980
+ name: 'chainId';
981
+ type: 'string';
982
+ }];
983
+ }, {
984
+ name: 'respond';
985
+ docs: ['* @dev Function to respond to signature requests.\n * @param request_ids The array of request IDs.\n * @param signatures The array of signature responses.\n * @notice When multiple entries reuse a request id, events emit in canonical signature order (PSBT-style).'];
986
+ discriminator: [72, 65, 227, 97, 42, 255, 147, 12];
987
+ accounts: [{
988
+ name: 'responder';
989
+ signer: true;
990
+ }, {
991
+ name: 'eventAuthority';
992
+ pda: {
993
+ seeds: [{
994
+ kind: 'const';
995
+ value: [95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121];
996
+ }];
997
+ };
998
+ }, {
999
+ name: 'program';
1000
+ }];
1001
+ args: [{
1002
+ name: 'requestIds';
1003
+ type: {
1004
+ vec: {
1005
+ array: ['u8', 32];
1006
+ };
1007
+ };
1008
+ }, {
1009
+ name: 'signatures';
1010
+ type: {
1011
+ vec: {
1012
+ defined: {
1013
+ name: 'signature';
1014
+ };
1015
+ };
1016
+ };
1017
+ }];
1018
+ }, {
1019
+ name: 'respondBidirectional';
1020
+ docs: ['* @dev Function to finalize bidirectional flow\n * @param request_id The ID of the signature request to respond to\n * @param serialized_output output of the previously executed transaction\n * @param signature ECDSA signature of the serialized output and request_id (keccak256(request_id.concat(serialized_output)))'];
1021
+ discriminator: [138, 0, 45, 246, 236, 211, 109, 81];
1022
+ accounts: [{
1023
+ name: 'responder';
1024
+ signer: true;
1025
+ }];
1026
+ args: [{
1027
+ name: 'requestId';
1028
+ type: {
1029
+ array: ['u8', 32];
1030
+ };
1031
+ }, {
1032
+ name: 'serializedOutput';
1033
+ type: 'bytes';
1034
+ }, {
1035
+ name: 'signature';
1036
+ type: {
1037
+ defined: {
1038
+ name: 'signature';
1039
+ };
1040
+ };
1041
+ }];
1042
+ }, {
1043
+ name: 'respondError';
1044
+ docs: ['* @dev Function to emit signature generation errors.\n * @param errors The array of signature generation errors.'];
1045
+ discriminator: [3, 170, 41, 132, 72, 184, 252, 69];
1046
+ accounts: [{
1047
+ name: 'responder';
1048
+ signer: true;
1049
+ }];
1050
+ args: [{
1051
+ name: 'errors';
1052
+ type: {
1053
+ vec: {
1054
+ defined: {
1055
+ name: 'errorResponse';
1056
+ };
1057
+ };
1058
+ };
1059
+ }];
1060
+ }, {
1061
+ name: 'sign';
1062
+ docs: ['* @dev Function to request a signature.\n * @param payload The payload to be signed.\n * @param key_version The version of the key used for signing.\n * @param path The derivation path for the user account.\n * @param algo The algorithm used for signing.\n * @param dest The response destination.\n * @param params Additional parameters.'];
1063
+ discriminator: [5, 221, 155, 46, 237, 91, 28, 236];
1064
+ accounts: [{
1065
+ name: 'programState';
1066
+ writable: true;
1067
+ pda: {
1068
+ seeds: [{
1069
+ kind: 'const';
1070
+ value: [112, 114, 111, 103, 114, 97, 109, 45, 115, 116, 97, 116, 101];
1071
+ }];
1072
+ };
1073
+ }, {
1074
+ name: 'requester';
1075
+ writable: true;
1076
+ signer: true;
1077
+ }, {
1078
+ name: 'feePayer';
1079
+ writable: true;
1080
+ signer: true;
1081
+ optional: true;
1082
+ }, {
1083
+ name: 'systemProgram';
1084
+ address: '11111111111111111111111111111111';
1085
+ }, {
1086
+ name: 'eventAuthority';
1087
+ pda: {
1088
+ seeds: [{
1089
+ kind: 'const';
1090
+ value: [95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121];
1091
+ }];
1092
+ };
1093
+ }, {
1094
+ name: 'program';
1095
+ }];
1096
+ args: [{
1097
+ name: 'payload';
1098
+ type: {
1099
+ array: ['u8', 32];
1100
+ };
1101
+ }, {
1102
+ name: 'keyVersion';
1103
+ type: 'u32';
1104
+ }, {
1105
+ name: 'path';
1106
+ type: 'string';
1107
+ }, {
1108
+ name: 'algo';
1109
+ type: 'string';
1110
+ }, {
1111
+ name: 'dest';
1112
+ type: 'string';
1113
+ }, {
1114
+ name: 'params';
1115
+ type: 'string';
1116
+ }];
1117
+ }, {
1118
+ name: 'signBidirectional';
1119
+ docs: ['* @dev Function to initiate bidirectional flow\n * @param serialized_transaction transaction to be signed\n * @param caip2_id chain identifier\n * @param key_version The version of the key used for signing.\n * @param path The derivation path for the user account.\n * @param algo The algorithm used for signing.\n * @param dest The response destination.\n * @param params Additional parameters.\n * @param program_id Program ID to callback after execution (not yet enabled).\n * @param output_deserialization_schema schema for transaction output deserialization\n * @param respond_serialization_schema serialization schema for respond_bidirectional payload'];
1120
+ discriminator: [21, 104, 182, 213, 189, 143, 219, 48];
1121
+ accounts: [{
1122
+ name: 'programState';
1123
+ writable: true;
1124
+ pda: {
1125
+ seeds: [{
1126
+ kind: 'const';
1127
+ value: [112, 114, 111, 103, 114, 97, 109, 45, 115, 116, 97, 116, 101];
1128
+ }];
1129
+ };
1130
+ }, {
1131
+ name: 'requester';
1132
+ writable: true;
1133
+ signer: true;
1134
+ }, {
1135
+ name: 'feePayer';
1136
+ writable: true;
1137
+ signer: true;
1138
+ optional: true;
1139
+ }, {
1140
+ name: 'systemProgram';
1141
+ address: '11111111111111111111111111111111';
1142
+ }, {
1143
+ name: 'instructions';
1144
+ optional: true;
1145
+ }, {
1146
+ name: 'eventAuthority';
1147
+ pda: {
1148
+ seeds: [{
1149
+ kind: 'const';
1150
+ value: [95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121];
1151
+ }];
1152
+ };
1153
+ }, {
1154
+ name: 'program';
1155
+ }];
1156
+ args: [{
1157
+ name: 'serializedTransaction';
1158
+ type: 'bytes';
1159
+ }, {
1160
+ name: 'caip2Id';
1161
+ type: 'string';
1162
+ }, {
1163
+ name: 'keyVersion';
1164
+ type: 'u32';
1165
+ }, {
1166
+ name: 'path';
1167
+ type: 'string';
1168
+ }, {
1169
+ name: 'algo';
1170
+ type: 'string';
1171
+ }, {
1172
+ name: 'dest';
1173
+ type: 'string';
1174
+ }, {
1175
+ name: 'params';
1176
+ type: 'string';
1177
+ }, {
1178
+ name: 'programId';
1179
+ type: 'pubkey';
1180
+ }, {
1181
+ name: 'outputDeserializationSchema';
1182
+ type: 'bytes';
1183
+ }, {
1184
+ name: 'respondSerializationSchema';
1185
+ type: 'bytes';
1186
+ }];
1187
+ }, {
1188
+ name: 'updateDeposit';
1189
+ docs: ['* @dev Function to set the signature deposit amount.\n * @param new_deposit The new deposit amount.'];
1190
+ discriminator: [126, 116, 15, 164, 238, 179, 155, 59];
1191
+ accounts: [{
1192
+ name: 'programState';
1193
+ writable: true;
1194
+ pda: {
1195
+ seeds: [{
1196
+ kind: 'const';
1197
+ value: [112, 114, 111, 103, 114, 97, 109, 45, 115, 116, 97, 116, 101];
1198
+ }];
1199
+ };
1200
+ }, {
1201
+ name: 'admin';
1202
+ writable: true;
1203
+ signer: true;
1204
+ relations: ['programState'];
1205
+ }, {
1206
+ name: 'systemProgram';
1207
+ address: '11111111111111111111111111111111';
1208
+ }];
1209
+ args: [{
1210
+ name: 'newDeposit';
1211
+ type: 'u64';
1212
+ }];
1213
+ }, {
1214
+ name: 'withdrawFunds';
1215
+ docs: ['* @dev Function to withdraw funds from the program.\n * @param amount The amount to withdraw.'];
1216
+ discriminator: [241, 36, 29, 111, 208, 31, 104, 217];
1217
+ accounts: [{
1218
+ name: 'programState';
1219
+ writable: true;
1220
+ pda: {
1221
+ seeds: [{
1222
+ kind: 'const';
1223
+ value: [112, 114, 111, 103, 114, 97, 109, 45, 115, 116, 97, 116, 101];
1224
+ }];
1225
+ };
1226
+ }, {
1227
+ name: 'admin';
1228
+ writable: true;
1229
+ signer: true;
1230
+ relations: ['programState'];
1231
+ }, {
1232
+ name: 'recipient';
1233
+ docs: ['function by checking it is not the zero address.'];
1234
+ writable: true;
1235
+ }, {
1236
+ name: 'systemProgram';
1237
+ address: '11111111111111111111111111111111';
1238
+ }];
1239
+ args: [{
1240
+ name: 'amount';
1241
+ type: 'u64';
1242
+ }];
1243
+ }];
1244
+ accounts: [{
1245
+ name: 'programState';
1246
+ discriminator: [77, 209, 137, 229, 149, 67, 167, 230];
1247
+ }];
1248
+ events: [{
1249
+ name: 'depositUpdatedEvent';
1250
+ discriminator: [215, 193, 53, 27, 221, 101, 249, 108];
1251
+ }, {
1252
+ name: 'fundsWithdrawnEvent';
1253
+ discriminator: [86, 232, 194, 4, 211, 69, 172, 202];
1254
+ }, {
1255
+ name: 'respondBidirectionalEvent';
1256
+ discriminator: [195, 195, 28, 1, 102, 100, 189, 234];
1257
+ }, {
1258
+ name: 'signBidirectionalEvent';
1259
+ discriminator: [135, 205, 217, 152, 96, 187, 11, 124];
1260
+ }, {
1261
+ name: 'signatureErrorEvent';
1262
+ discriminator: [42, 28, 210, 105, 9, 196, 189, 51];
1263
+ }, {
1264
+ name: 'signatureRequestedEvent';
1265
+ discriminator: [171, 129, 105, 91, 154, 49, 160, 34];
1266
+ }, {
1267
+ name: 'signatureRespondedEvent';
1268
+ discriminator: [118, 146, 248, 151, 194, 93, 18, 86];
1269
+ }];
1270
+ errors: [{
1271
+ code: 6000;
1272
+ name: 'insufficientDeposit';
1273
+ msg: 'Insufficient deposit amount';
1274
+ }, {
1275
+ code: 6001;
1276
+ name: 'invalidInputLength';
1277
+ msg: 'Arrays must have the same length';
1278
+ }, {
1279
+ code: 6002;
1280
+ name: 'unauthorized';
1281
+ msg: 'Unauthorized access';
1282
+ }, {
1283
+ code: 6003;
1284
+ name: 'insufficientFunds';
1285
+ msg: 'Insufficient funds for withdrawal';
1286
+ }, {
1287
+ code: 6004;
1288
+ name: 'invalidRecipient';
1289
+ msg: 'Invalid recipient address';
1290
+ }, {
1291
+ code: 6005;
1292
+ name: 'invalidTransaction';
1293
+ msg: 'Invalid transaction data';
1294
+ }, {
1295
+ code: 6006;
1296
+ name: 'missingInstructionSysvar';
1297
+ msg: 'Missing instruction sysvar';
1298
+ }];
1299
+ types: [{
1300
+ name: 'affinePoint';
1301
+ type: {
1302
+ kind: 'struct';
1303
+ fields: [{
1304
+ name: 'x';
1305
+ type: {
1306
+ array: ['u8', 32];
1307
+ };
1308
+ }, {
1309
+ name: 'y';
1310
+ type: {
1311
+ array: ['u8', 32];
1312
+ };
1313
+ }];
1314
+ };
1315
+ }, {
1316
+ name: 'depositUpdatedEvent';
1317
+ docs: ['* @dev Emitted when the deposit amount is updated.\n * @param old_deposit The previous deposit amount.\n * @param new_deposit The new deposit amount.'];
1318
+ type: {
1319
+ kind: 'struct';
1320
+ fields: [{
1321
+ name: 'oldDeposit';
1322
+ type: 'u64';
1323
+ }, {
1324
+ name: 'newDeposit';
1325
+ type: 'u64';
1326
+ }];
1327
+ };
1328
+ }, {
1329
+ name: 'errorResponse';
1330
+ type: {
1331
+ kind: 'struct';
1332
+ fields: [{
1333
+ name: 'requestId';
1334
+ type: {
1335
+ array: ['u8', 32];
1336
+ };
1337
+ }, {
1338
+ name: 'errorMessage';
1339
+ type: 'string';
1340
+ }];
1341
+ };
1342
+ }, {
1343
+ name: 'fundsWithdrawnEvent';
1344
+ docs: ['* @dev Emitted when a withdrawal is made.\n * @param amount The amount withdrawn.\n * @param recipient The address of the recipient.'];
1345
+ type: {
1346
+ kind: 'struct';
1347
+ fields: [{
1348
+ name: 'amount';
1349
+ type: 'u64';
1350
+ }, {
1351
+ name: 'recipient';
1352
+ type: 'pubkey';
1353
+ }];
1354
+ };
1355
+ }, {
1356
+ name: 'programState';
1357
+ type: {
1358
+ kind: 'struct';
1359
+ fields: [{
1360
+ name: 'admin';
1361
+ type: 'pubkey';
1362
+ }, {
1363
+ name: 'signatureDeposit';
1364
+ type: 'u64';
1365
+ }, {
1366
+ name: 'chainId';
1367
+ type: 'string';
1368
+ }];
1369
+ };
1370
+ }, {
1371
+ name: 'respondBidirectionalEvent';
1372
+ docs: ['* @dev Emitted when a read response is received.\n * @param request_id The ID of the request. Must be calculated off-chain.\n * @param responder The address of the responder.\n * @param serialized_output The serialized output.\n * @param signature The signature.'];
1373
+ type: {
1374
+ kind: 'struct';
1375
+ fields: [{
1376
+ name: 'requestId';
1377
+ type: {
1378
+ array: ['u8', 32];
1379
+ };
1380
+ }, {
1381
+ name: 'responder';
1382
+ type: 'pubkey';
1383
+ }, {
1384
+ name: 'serializedOutput';
1385
+ type: 'bytes';
1386
+ }, {
1387
+ name: 'signature';
1388
+ type: {
1389
+ defined: {
1390
+ name: 'signature';
1391
+ };
1392
+ };
1393
+ }];
1394
+ };
1395
+ }, {
1396
+ name: 'signBidirectionalEvent';
1397
+ docs: ['* @dev Emitted when a sign_bidirectional request is made.\n * @param sender The address of the sender.\n * @param serialized_transaction The serialized transaction to be signed.\n * @param caip2_id The SLIP-44 chain ID.\n * @param key_version The version of the key used for signing.\n * @param deposit The deposit amount.\n * @param path The derivation path for the user account.\n * @param algo The algorithm used for signing.\n * @param dest The response destination.\n * @param params Additional parameters.\n * @param program_id Program ID to callback after execution (not yet enabled).\n * @param output_deserialization_schema Schema for transaction output deserialization.\n * @param respond_serialization_schema Serialization schema for respond_bidirectional payload.'];
1398
+ type: {
1399
+ kind: 'struct';
1400
+ fields: [{
1401
+ name: 'sender';
1402
+ type: 'pubkey';
1403
+ }, {
1404
+ name: 'serializedTransaction';
1405
+ type: 'bytes';
1406
+ }, {
1407
+ name: 'caip2Id';
1408
+ type: 'string';
1409
+ }, {
1410
+ name: 'keyVersion';
1411
+ type: 'u32';
1412
+ }, {
1413
+ name: 'deposit';
1414
+ type: 'u64';
1415
+ }, {
1416
+ name: 'path';
1417
+ type: 'string';
1418
+ }, {
1419
+ name: 'algo';
1420
+ type: 'string';
1421
+ }, {
1422
+ name: 'dest';
1423
+ type: 'string';
1424
+ }, {
1425
+ name: 'params';
1426
+ type: 'string';
1427
+ }, {
1428
+ name: 'programId';
1429
+ type: 'pubkey';
1430
+ }, {
1431
+ name: 'outputDeserializationSchema';
1432
+ type: 'bytes';
1433
+ }, {
1434
+ name: 'respondSerializationSchema';
1435
+ type: 'bytes';
1436
+ }];
1437
+ };
1438
+ }, {
1439
+ name: 'signature';
1440
+ type: {
1441
+ kind: 'struct';
1442
+ fields: [{
1443
+ name: 'bigR';
1444
+ type: {
1445
+ defined: {
1446
+ name: 'affinePoint';
1447
+ };
1448
+ };
1449
+ }, {
1450
+ name: 's';
1451
+ type: {
1452
+ array: ['u8', 32];
1453
+ };
1454
+ }, {
1455
+ name: 'recoveryId';
1456
+ type: 'u8';
1457
+ }];
1458
+ };
1459
+ }, {
1460
+ name: 'signatureErrorEvent';
1461
+ docs: ['* @dev Emitted when a signature error is received.\n * @notice Any address can emit this event. Do not rely on it for business logic.\n * @param request_id The ID of the request. Must be calculated off-chain.\n * @param responder The address of the responder.\n * @param error The error message.'];
1462
+ type: {
1463
+ kind: 'struct';
1464
+ fields: [{
1465
+ name: 'requestId';
1466
+ type: {
1467
+ array: ['u8', 32];
1468
+ };
1469
+ }, {
1470
+ name: 'responder';
1471
+ type: 'pubkey';
1472
+ }, {
1473
+ name: 'error';
1474
+ type: 'string';
1475
+ }];
1476
+ };
1477
+ }, {
1478
+ name: 'signatureRequestedEvent';
1479
+ docs: ['* @dev Emitted when a signature is requested.\n * @param sender The address of the sender.\n * @param payload The payload to be signed.\n * @param key_version The version of the key used for signing.\n * @param deposit The deposit amount.\n * @param chain_id The CAIP-2 ID of the blockchain.\n * @param path The derivation path for the user account.\n * @param algo The algorithm used for signing.\n * @param dest The response destination.\n * @param params Additional parameters.\n * @param fee_payer Optional fee payer account.'];
1480
+ type: {
1481
+ kind: 'struct';
1482
+ fields: [{
1483
+ name: 'sender';
1484
+ type: 'pubkey';
1485
+ }, {
1486
+ name: 'payload';
1487
+ type: {
1488
+ array: ['u8', 32];
1489
+ };
1490
+ }, {
1491
+ name: 'keyVersion';
1492
+ type: 'u32';
1493
+ }, {
1494
+ name: 'deposit';
1495
+ type: 'u64';
1496
+ }, {
1497
+ name: 'chainId';
1498
+ type: 'string';
1499
+ }, {
1500
+ name: 'path';
1501
+ type: 'string';
1502
+ }, {
1503
+ name: 'algo';
1504
+ type: 'string';
1505
+ }, {
1506
+ name: 'dest';
1507
+ type: 'string';
1508
+ }, {
1509
+ name: 'params';
1510
+ type: 'string';
1511
+ }, {
1512
+ name: 'feePayer';
1513
+ type: {
1514
+ option: 'pubkey';
1515
+ };
1516
+ }];
1517
+ };
1518
+ }, {
1519
+ name: 'signatureRespondedEvent';
1520
+ docs: ['* @dev Emitted when a signature response is received.\n * @notice Any address can emit this event. Clients should always verify the validity of the signature.\n * @param request_id The ID of the request. Must be calculated off-chain.\n * @param responder The address of the responder.\n * @param signature The signature response.'];
1521
+ type: {
1522
+ kind: 'struct';
1523
+ fields: [{
1524
+ name: 'requestId';
1525
+ type: {
1526
+ array: ['u8', 32];
1527
+ };
1528
+ }, {
1529
+ name: 'responder';
1530
+ type: 'pubkey';
1531
+ }, {
1532
+ name: 'signature';
1533
+ type: {
1534
+ defined: {
1535
+ name: 'signature';
1536
+ };
1537
+ };
1538
+ }];
1539
+ };
1540
+ }];
1541
+ }
1542
+ //#endregion
1543
+ //#region src/contracts/solana/types/events.d.ts
1544
+ interface AffinePoint {
1545
+ x: number[];
1546
+ y: number[];
1547
+ }
1548
+ interface Signature {
1549
+ bigR: AffinePoint;
1550
+ s: number[];
1551
+ recoveryId: number;
1552
+ }
1553
+ interface SignatureRespondedEvent {
1554
+ requestId: number[];
1555
+ responder: PublicKey;
1556
+ signature: Signature;
1557
+ }
1558
+ interface SignatureErrorEvent {
1559
+ requestId: number[];
1560
+ responder: PublicKey;
1561
+ error: string;
1562
+ }
1563
+ //#endregion
1564
+ //#region src/contracts/solana/ChainSignaturesContract.d.ts
1565
+ declare class ChainSignatureContract$1 extends ChainSignatureContract {
1566
+ private readonly provider;
1567
+ private readonly program;
1568
+ private readonly programId;
1569
+ private readonly rootPublicKey;
1570
+ private readonly requesterAddress;
1571
+ /**
1572
+ * Creates a new instance of the ChainSignatureContract for Solana chains.
1573
+ *
1574
+ * @param args - Configuration options for the contract
1575
+ * @param args.provider - An Anchor Provider for interacting with Solana
1576
+ * @param args.programId - The program ID as a string or PublicKey
1577
+ * @param args.config - Optional configuration
1578
+ * @param args.config.rootPublicKey - Optional root public key. If not provided, it will be derived from the program ID
1579
+ * @param args.config.requesterAddress - Provider wallet address is always the fee payer but requester can be overridden
1580
+ * @param args.config.idl - Optional custom IDL. If not provided, the default ChainSignatures IDL will be used
1581
+ */
1582
+ constructor(args: {
1583
+ provider: AnchorProvider;
1584
+ programId: string | PublicKey;
1585
+ config?: {
1586
+ rootPublicKey?: NajPublicKey;
1587
+ requesterAddress?: string;
1588
+ idl?: ChainSignaturesProject & Idl;
1589
+ };
1590
+ });
1591
+ /**
1592
+ * Gets the connection from the provider
1593
+ */
1594
+ get connection(): Connection;
1595
+ getCurrentSignatureDeposit(): Promise<BN>;
1596
+ /**
1597
+ * Get the Program State PDA
1598
+ */
1599
+ getProgramStatePDA(): Promise<PublicKey>;
1600
+ getDerivedPublicKey(args: {
1601
+ path: string;
1602
+ predecessor: string;
1603
+ keyVersion: number;
1604
+ }): Promise<UncompressedPubKeySEC1>;
1605
+ getPublicKey(): Promise<UncompressedPubKeySEC1>;
1606
+ getSignRequestInstruction(args: SignArgs, options?: Pick<SignOptions, 'sign'> & {
1607
+ remainingAccounts?: AccountMeta[];
1608
+ }): Promise<TransactionInstruction>;
1609
+ /**
1610
+ * Sends a transaction to the program to request a signature, then
1611
+ * polls for the signature result. If the signature is not found within the retry
1612
+ * parameters, it will throw an error.
1613
+ */
1614
+ sign(args: SignArgs, options?: Partial<SignOptions> & {
1615
+ remainingAccounts?: AccountMeta[];
1616
+ remainingSigners?: Signer[];
1617
+ }): Promise<RSVSignature>;
1618
+ private sendAndConfirmWithoutWebSocket;
1619
+ /**
1620
+ * Polls for signature or error events matching the given requestId starting from the solana transaction with signature afterSignature.
1621
+ * Returns a signature, error data, or undefined if nothing is found.
1622
+ */
1623
+ pollForRequestId({
1624
+ requestId,
1625
+ payload: _payload,
1626
+ path: _path,
1627
+ afterSignature,
1628
+ options
1629
+ }: {
1630
+ requestId: string;
1631
+ payload: number[];
1632
+ path: string;
1633
+ afterSignature: string;
1634
+ options?: RetryOptions;
1635
+ }): Promise<RSVSignature | SignatureErrorData | undefined>;
1636
+ /**
1637
+ * Parses transaction logs for signature or error events.
1638
+ */
1639
+ private parseLogsForEvents;
1640
+ private mapEventToResult;
1641
+ /**
1642
+ * Generates the request ID for a signature request allowing to track the response.
1643
+ */
1644
+ getRequestId(args: SignArgs, options?: SignOptions['sign']): string;
1645
+ /**
1646
+ * Subscribes to program events using Anchor's EventParser for regular events,
1647
+ * and CPI parsing for emit_cpi!-emitted events. Returns an unsubscribe fn.
1648
+ */
1649
+ subscribeToEvents(handlers: {
1650
+ onSignatureResponded?: (event: SignatureRespondedEvent, slot: number) => Promise<void> | void;
1651
+ onSignatureError?: (event: SignatureErrorEvent, slot: number) => Promise<void> | void;
1652
+ }): Promise<() => Promise<void>>;
1653
+ }
1654
+ declare namespace index_d_exports$4 {
1655
+ export { ChainSignatureContract$1 as ChainSignatureContract, ChainSignaturesProject, utils };
1656
+ }
1657
+ declare const utils: {
1658
+ ChainSignaturesContractIdl: {
1659
+ address: string;
1660
+ metadata: {
1661
+ name: string;
1662
+ version: string;
1663
+ spec: string;
1664
+ description: string;
1665
+ repository: string;
1666
+ };
1667
+ instructions: ({
1668
+ name: string;
1669
+ docs: string[];
1670
+ discriminator: number[];
1671
+ accounts: {
1672
+ name: string;
1673
+ pda: {
1674
+ seeds: {
1675
+ kind: string;
1676
+ value: number[];
1677
+ }[];
1678
+ };
1679
+ }[];
1680
+ args: never[];
1681
+ returns: string;
1682
+ } | {
1683
+ name: string;
1684
+ docs: string[];
1685
+ discriminator: number[];
1686
+ accounts: ({
1687
+ name: string;
1688
+ signer: boolean;
1689
+ pda?: undefined;
1690
+ } | {
1691
+ name: string;
1692
+ pda: {
1693
+ seeds: {
1694
+ kind: string;
1695
+ value: number[];
1696
+ }[];
1697
+ };
1698
+ signer?: undefined;
1699
+ } | {
1700
+ name: string;
1701
+ signer?: undefined;
1702
+ pda?: undefined;
1703
+ })[];
1704
+ args: ({
1705
+ name: string;
1706
+ type: {
1707
+ vec: {
1708
+ array: (string | number)[];
1709
+ defined?: undefined;
1710
+ };
1711
+ };
1712
+ } | {
1713
+ name: string;
1714
+ type: {
1715
+ vec: {
1716
+ defined: {
1717
+ name: string;
1718
+ };
1719
+ array?: undefined;
1720
+ };
1721
+ };
1722
+ })[];
1723
+ returns?: undefined;
1724
+ } | {
1725
+ name: string;
1726
+ docs: string[];
1727
+ discriminator: number[];
1728
+ accounts: {
1729
+ name: string;
1730
+ signer: boolean;
1731
+ }[];
1732
+ args: ({
1733
+ name: string;
1734
+ type: {
1735
+ array: (string | number)[];
1736
+ defined?: undefined;
1737
+ };
1738
+ } | {
1739
+ name: string;
1740
+ type: string;
1741
+ } | {
1742
+ name: string;
1743
+ type: {
1744
+ defined: {
1745
+ name: string;
1746
+ };
1747
+ array?: undefined;
1748
+ };
1749
+ })[];
1750
+ returns?: undefined;
1751
+ } | {
1752
+ name: string;
1753
+ docs: string[];
1754
+ discriminator: number[];
1755
+ accounts: ({
1756
+ name: string;
1757
+ writable: boolean;
1758
+ pda: {
1759
+ seeds: {
1760
+ kind: string;
1761
+ value: number[];
1762
+ }[];
1763
+ };
1764
+ signer?: undefined;
1765
+ optional?: undefined;
1766
+ address?: undefined;
1767
+ } | {
1768
+ name: string;
1769
+ writable: boolean;
1770
+ signer: boolean;
1771
+ pda?: undefined;
1772
+ optional?: undefined;
1773
+ address?: undefined;
1774
+ } | {
1775
+ name: string;
1776
+ writable: boolean;
1777
+ signer: boolean;
1778
+ optional: boolean;
1779
+ pda?: undefined;
1780
+ address?: undefined;
1781
+ } | {
1782
+ name: string;
1783
+ address: string;
1784
+ writable?: undefined;
1785
+ pda?: undefined;
1786
+ signer?: undefined;
1787
+ optional?: undefined;
1788
+ } | {
1789
+ name: string;
1790
+ pda: {
1791
+ seeds: {
1792
+ kind: string;
1793
+ value: number[];
1794
+ }[];
1795
+ };
1796
+ writable?: undefined;
1797
+ signer?: undefined;
1798
+ optional?: undefined;
1799
+ address?: undefined;
1800
+ } | {
1801
+ name: string;
1802
+ writable?: undefined;
1803
+ pda?: undefined;
1804
+ signer?: undefined;
1805
+ optional?: undefined;
1806
+ address?: undefined;
1807
+ })[];
1808
+ args: ({
1809
+ name: string;
1810
+ type: {
1811
+ array: (string | number)[];
1812
+ };
1813
+ } | {
1814
+ name: string;
1815
+ type: string;
1816
+ })[];
1817
+ returns?: undefined;
1818
+ } | {
1819
+ name: string;
1820
+ docs: string[];
1821
+ discriminator: number[];
1822
+ accounts: ({
1823
+ name: string;
1824
+ writable: boolean;
1825
+ pda: {
1826
+ seeds: {
1827
+ kind: string;
1828
+ value: number[];
1829
+ }[];
1830
+ };
1831
+ signer?: undefined;
1832
+ optional?: undefined;
1833
+ address?: undefined;
1834
+ } | {
1835
+ name: string;
1836
+ writable: boolean;
1837
+ signer: boolean;
1838
+ pda?: undefined;
1839
+ optional?: undefined;
1840
+ address?: undefined;
1841
+ } | {
1842
+ name: string;
1843
+ writable: boolean;
1844
+ signer: boolean;
1845
+ optional: boolean;
1846
+ pda?: undefined;
1847
+ address?: undefined;
1848
+ } | {
1849
+ name: string;
1850
+ address: string;
1851
+ writable?: undefined;
1852
+ pda?: undefined;
1853
+ signer?: undefined;
1854
+ optional?: undefined;
1855
+ } | {
1856
+ name: string;
1857
+ optional: boolean;
1858
+ writable?: undefined;
1859
+ pda?: undefined;
1860
+ signer?: undefined;
1861
+ address?: undefined;
1862
+ } | {
1863
+ name: string;
1864
+ pda: {
1865
+ seeds: {
1866
+ kind: string;
1867
+ value: number[];
1868
+ }[];
1869
+ };
1870
+ writable?: undefined;
1871
+ signer?: undefined;
1872
+ optional?: undefined;
1873
+ address?: undefined;
1874
+ } | {
1875
+ name: string;
1876
+ writable?: undefined;
1877
+ pda?: undefined;
1878
+ signer?: undefined;
1879
+ optional?: undefined;
1880
+ address?: undefined;
1881
+ })[];
1882
+ args: {
1883
+ name: string;
1884
+ type: string;
1885
+ }[];
1886
+ returns?: undefined;
1887
+ } | {
1888
+ name: string;
1889
+ docs: string[];
1890
+ discriminator: number[];
1891
+ accounts: ({
1892
+ name: string;
1893
+ writable: boolean;
1894
+ pda: {
1895
+ seeds: {
1896
+ kind: string;
1897
+ value: number[];
1898
+ }[];
1899
+ };
1900
+ signer?: undefined;
1901
+ relations?: undefined;
1902
+ docs?: undefined;
1903
+ address?: undefined;
1904
+ } | {
1905
+ name: string;
1906
+ writable: boolean;
1907
+ signer: boolean;
1908
+ relations: string[];
1909
+ pda?: undefined;
1910
+ docs?: undefined;
1911
+ address?: undefined;
1912
+ } | {
1913
+ name: string;
1914
+ docs: string[];
1915
+ writable: boolean;
1916
+ pda?: undefined;
1917
+ signer?: undefined;
1918
+ relations?: undefined;
1919
+ address?: undefined;
1920
+ } | {
1921
+ name: string;
1922
+ address: string;
1923
+ writable?: undefined;
1924
+ pda?: undefined;
1925
+ signer?: undefined;
1926
+ relations?: undefined;
1927
+ docs?: undefined;
1928
+ })[];
1929
+ args: {
1930
+ name: string;
1931
+ type: string;
1932
+ }[];
1933
+ returns?: undefined;
1934
+ })[];
1935
+ accounts: {
1936
+ name: string;
1937
+ discriminator: number[];
1938
+ }[];
1939
+ events: {
1940
+ name: string;
1941
+ discriminator: number[];
1942
+ }[];
1943
+ errors: {
1944
+ code: number;
1945
+ name: string;
1946
+ msg: string;
1947
+ }[];
1948
+ types: ({
1949
+ name: string;
1950
+ docs: string[];
1951
+ type: {
1952
+ kind: string;
1953
+ fields: ({
1954
+ name: string;
1955
+ type: {
1956
+ array: (string | number)[];
1957
+ defined?: undefined;
1958
+ };
1959
+ } | {
1960
+ name: string;
1961
+ type: string;
1962
+ } | {
1963
+ name: string;
1964
+ type: {
1965
+ defined: {
1966
+ name: string;
1967
+ };
1968
+ array?: undefined;
1969
+ };
1970
+ })[];
1971
+ };
1972
+ } | {
1973
+ name: string;
1974
+ type: {
1975
+ kind: string;
1976
+ fields: ({
1977
+ name: string;
1978
+ type: {
1979
+ defined: {
1980
+ name: string;
1981
+ };
1982
+ array?: undefined;
1983
+ };
1984
+ } | {
1985
+ name: string;
1986
+ type: {
1987
+ array: (string | number)[];
1988
+ defined?: undefined;
1989
+ };
1990
+ } | {
1991
+ name: string;
1992
+ type: string;
1993
+ })[];
1994
+ };
1995
+ docs?: undefined;
1996
+ } | {
1997
+ name: string;
1998
+ docs: string[];
1999
+ type: {
2000
+ kind: string;
2001
+ fields: ({
2002
+ name: string;
2003
+ type: string;
2004
+ } | {
2005
+ name: string;
2006
+ type: {
2007
+ array: (string | number)[];
2008
+ option?: undefined;
2009
+ };
2010
+ } | {
2011
+ name: string;
2012
+ type: {
2013
+ option: string;
2014
+ array?: undefined;
2015
+ };
2016
+ })[];
2017
+ };
2018
+ })[];
2019
+ };
2020
+ errors: typeof errors_d_exports;
2021
+ };
2022
+ declare namespace index_d_exports$1 {
2023
+ export { ChainSignatureContract, SignArgs, index_d_exports$3 as evm, index_d_exports$4 as solana };
2024
+ }
2025
+ //#endregion
2026
+ export { CompressedPubKeySEC1, HashToSign, KeyDerivationPath, MPCSignature, NajPublicKey, RSVSignature, SigNetEvmMpcSignature, UncompressedPubKeySEC1, index_d_exports as chainAdapters, constants_d_exports as constants, index_d_exports$1 as contracts, index_d_exports$2 as utils };