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