import { type ServerKeyShare, DynamicWalletClient, type Ed25519KeygenResult, type ThresholdSignatureScheme, type TraceContext, type DynamicWalletClientProps, type WalletMetadata, type WalletApiKeyCreationResult, type RawSignPreImage, type SignMessageContext, type ConfidentialAccountState, type ConfidentialTransferOperation } from '@dynamic-labs-wallet/node'; import { type SendOptions, type Transaction, VersionedTransaction } from '@solana/web3.js'; import type { ClaimEarnRewardsParams, DepositToEarnVaultParams, EarnTransactionResult, ExecuteEarnTransactionParams, WithdrawFromEarnVaultParams } from './earn.types.js'; type SvmSignableTransaction = VersionedTransaction | Transaction | string; type SignTransactionResult = string | { signature: string; transaction: Transaction | VersionedTransaction; }; export declare const ERROR_SIGN_TRANSACTION_CONTEXT_REQUIRED = "SVM transaction signing requires a chainId or an explicit context.svmTransaction."; export declare const ERROR_SIGN_TRANSACTION_RAW_HEX_CONTEXT_REQUIRED = "SVM transaction signing requires an explicit context.svmTransaction when transaction is a raw hex string."; export declare class DynamicSvmWalletClient extends DynamicWalletClient { readonly chainName = "SVM"; readonly accountAddress?: string; constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, enableMPCAccelerator, logger, debug, }: DynamicWalletClientProps); /** * Creates a wallet account on the Solana chain * * @param thresholdSignatureScheme The threshold signature scheme to use * @returns The walletMetadata, raw public key, and client key shares */ createWalletAccount({ thresholdSignatureScheme, password, onError, backUpToDynamic, }: { thresholdSignatureScheme: ThresholdSignatureScheme; password?: string; onError?: (error: Error) => void; backUpToDynamic?: boolean; }): Promise<{ walletMetadata: WalletMetadata; rawPublicKey: Uint8Array | string; externalServerKeyShares: ServerKeyShare[]; externalKeySharesWithBackupStatus: Array<{ share: ServerKeyShare; backedUpToClientKeyShareService: boolean; }>; } & WalletApiKeyCreationResult>; deriveAccountAddress(rawPublicKey: string | Uint8Array): Promise<{ accountAddress: string; }>; /** * This function takes a message and returns it after being signed with MPC * * @param message The message to sign (Uint8Array) * @param walletMetadata Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare) * @param password The password for encrypted backup shares */ signMessage({ message, walletMetadata, password, externalServerKeyShares, context, }: { message: string | Uint8Array; walletMetadata: WalletMetadata; password?: string; externalServerKeyShares?: ServerKeyShare[]; context?: SignMessageContext; }): Promise; /** * Signs a pre-formatted (raw) message without additional encoding. * The message must be a hex string representing already-hashed data. * * @param message The pre-formatted hex message to sign * @param walletMetadata Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare) * @param password The password for encrypted backup shares * @param rawSign Pre-image the digest is derived from, used to build the policy context * @param context Explicit policy context, when the caller builds one itself */ signRawMessage({ message, walletMetadata, password, externalServerKeyShares, context, rawSign, }: { message: string; walletMetadata: WalletMetadata; password?: string; externalServerKeyShares?: ServerKeyShare[]; context?: SignMessageContext; rawSign?: RawSignPreImage; }): Promise; signTransaction({ walletMetadata, transaction, password, externalServerKeyShares, sponsor, chainId, context, }: { walletMetadata: WalletMetadata; transaction: SvmSignableTransaction; password?: string; externalServerKeyShares?: ServerKeyShare[]; /** If true, requests gas sponsorship from Dynamic before signing. */ sponsor?: boolean; chainId?: string; context?: SignMessageContext; }): Promise; /** * Exports the private key for a given wallet * * @param walletMetadata Wallet metadata (the full object returned by createWalletAccount/importPrivateKey, with backupInfo merged from any subsequent updatePassword/refresh/reshare) * @param password The password for encrypted backup shares * @returns The private key */ exportPrivateKey({ walletMetadata, password, externalServerKeyShares, }: { walletMetadata: WalletMetadata; password?: string; externalServerKeyShares?: ServerKeyShare[]; }): Promise; /** * Exports the private key for a given account address * * @param keyShares The key shares to export the private key for * @returns The private key * * `derivationPath` is the JSON-serialized index map that * `walletMetadata.derivationPath` carries (e.g. `'{"0":44,"1":60,"2":0,"3":0,"4":0}'` * or `'[44,60,0,0,0]'`). BIP-32 strings such as `"m/44'/60'/0'/0/0"` are rejected. * Omit it to export without path derivation. */ offlineExportPrivateKey({ keyShares, derivationPath, }: { keyShares: Ed25519KeygenResult[]; derivationPath?: string; }): Promise<{ derivedPrivateKey: string; }>; /** * Converts the private key to a hex string * * @param privateKey The private key to convert * @returns The hex string */ decodePrivateKeyForSolana(privateKey: string): string; getPublicKeyFromPrivateKey(privateKey: string): string; encodePublicKey(publicKey: Uint8Array): string; /** * Imports the private key for a given account address * * @param privateKey The private key to import * @param chainName The chain name to import the private key for * @param thresholdSignatureScheme The threshold signature scheme to use * @param password The password for encrypted backup shares * @returns The walletMetadata, raw public key, and client key shares */ importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, onError, backUpToDynamic, }: { privateKey: string; chainName: string; thresholdSignatureScheme: ThresholdSignatureScheme; password?: string; onError?: (error: Error) => void; backUpToDynamic?: boolean; }): Promise<{ walletMetadata: WalletMetadata; rawPublicKey: Uint8Array | string | undefined; externalServerKeyShares: ServerKeyShare[]; externalKeySharesWithBackupStatus: Array<{ share: ServerKeyShare; backedUpToClientKeyShareService: boolean; }>; }>; /** * Sponsors a Solana transaction via the Dynamic gas sponsorship API. * * Sends the unsigned transaction to Dynamic's sponsorTransaction endpoint, * which replaces the fee payer with the sponsor's address. The endpoint * always returns a v0 versioned transaction, which is deserialized and * returned. It should be passed to {@link signTransaction} instead of the * original transaction. * * Gas sponsorship must be enabled for your environment in the Dynamic * dashboard before calling this method. * * @param transaction - Unsigned Solana transaction (legacy or versioned). * @param userId - End user the transaction is for. Required when the signer is * that user's wallet rather than one of the caller's own server wallets. * @returns The sponsored v0 transaction with the gas sponsor as fee payer. */ sponsorTransaction({ transaction, userId, traceContext, }: { transaction: VersionedTransaction | Transaction; userId?: string; traceContext?: TraceContext; }): Promise; /** * Reads the address that signs as fee payer for sponsored transactions in * this environment. Build transactions that name it as fee payer (for example * LI.FI `svmSponsor`) before passing them to {@link sponsorTransaction}. * * Gas sponsorship must be enabled for your environment in the Dynamic * dashboard. */ getSponsorAddress({ traceContext }?: { traceContext?: TraceContext; }): Promise; private readonly svmAccountState; private readonly confidentialBlockhash; private readonly broadcastConfidentialTransactions; /** * Generates a Token-2022 confidential-transfer seed inside the enclave and * stores the sealed result in CKS. Returns the ElGamal public key and the * derivation version — persist it for later confidential operations. */ createConfidentialSeed({ walletId, solanaAddress, derivationVersion, traceContext, }: { walletId: string; solanaAddress: string; derivationVersion?: number; traceContext?: TraceContext; }): Promise; /** * Decrypts a confidential token account's available and pending balances * inside the enclave. Reads the account from `rpcUrl` unless `accountState` * is supplied. Balances are decimal strings in base units. */ getConfidentialBalance({ walletId, solanaAddress, mint, tokenAccount, accountState, derivationVersion, rpcUrl, traceContext, }: { walletId: string; solanaAddress: string; mint: string; tokenAccount: string; accountState?: ConfidentialAccountState; derivationVersion?: number; rpcUrl?: string; traceContext?: TraceContext; }): Promise; /** * Builds and signs Token-2022 confidential-transfer transactions. * * The enclave is offline, so any missing `accountState` / * `destinationAccountState` and the latest blockhash are fetched from * `rpcUrl` on the caller's behalf. The enclave builds one unsigned v1 * transaction bound by a `transactionsTag`; `signConfidentialTransactions` * provisions one MPC room for the operation and the client share joins it * like an ordinary `signTransaction` ceremony. Pass `broadcast: true` to * also submit the signed transaction to the cluster. * * @returns The signed transactions (base64, broadcast order), their * signatures, and — when broadcast — the submitted transaction ids. */ signConfidentialTransfer({ walletId, walletMetadata, operation, solanaAddress, mint, tokenAccount, destinationTokenAccount, amount, decimals, accountState, destinationAccountState, auditorElgamalPubkey, feePayer, derivationVersion, chainId, lamportsPerByte, recentBlockhash, lastValidBlockHeight, rpcUrl, broadcast, broadcastOptions, password, externalServerKeyShares, traceContext, }: { walletId: string; walletMetadata: WalletMetadata; operation: ConfidentialTransferOperation; solanaAddress: string; mint: string; tokenAccount: string; destinationTokenAccount?: string; amount?: string; decimals?: number; accountState?: ConfidentialAccountState; destinationAccountState?: ConfidentialAccountState; auditorElgamalPubkey?: string; feePayer?: string; derivationVersion?: number; chainId?: string; lamportsPerByte?: string; /** Fetched from `rpcUrl` when omitted. */ recentBlockhash?: string; lastValidBlockHeight?: string; /** Solana JSON-RPC endpoint, required to fetch account state / blockhash or to broadcast. */ rpcUrl?: string; broadcast?: boolean; broadcastOptions?: SendOptions; password?: string; externalServerKeyShares?: ServerKeyShare[]; traceContext?: TraceContext; }): Promise<{ serializedTransactions: string[]; signatures: string[]; transactionIds: string[] | undefined; }>; /** * Validates `rpcUrl`, fetches missing account states and the latest * blockhash, and returns the inputs the enclave request needs. */ private readonly resolveConfidentialInputs; private readonly assertConfidentialRpcUrl; /** @deprecated Use getWalletByAddress instead for better performance */ getSvmWallets(): Promise<{ walletId: string; chainName: string; accountAddress: string; externalServerKeySharesBackupInfo: import("packages/core/src/types.js").KeyShareBackupInfo; externalServerKeyShares: never[]; derivationPath: string | undefined; thresholdSignatureScheme: ThresholdSignatureScheme; }[]>; private get svmEarn(); /** * Executes an Earn signing payload returned by the prepare* methods, signing and * sending its ordered Solana transaction sequence one transaction at a time. */ executeEarnTransaction(params: ExecuteEarnTransactionParams): Promise; /** Prepares and executes a deposit into an Earn vault. */ depositToEarnVault(params: DepositToEarnVaultParams): Promise; /** Prepares and executes a withdrawal from an Earn vault. */ withdrawFromEarnVault(params: WithdrawFromEarnVaultParams): Promise; /** Prepares and executes a claim of accrued Earn vault rewards. */ claimEarnRewards(params: ClaimEarnRewardsParams): Promise; } export {}; //# sourceMappingURL=client.d.ts.map