@sig-net/signet.js 0.5.0-rc1

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