diff --git a/etc/sdk-evm.api.md b/etc/sdk-evm.api.md index 97d15ce..77ba5b3 100644 --- a/etc/sdk-evm.api.md +++ b/etc/sdk-evm.api.md @@ -1,560 +1,560 @@ -## API Report File for "@wraith-protocol/sdk" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -// @public -export interface Announcement { - // (undocumented) - caller: HexString; - // (undocumented) - ephemeralPubKey: HexString; - // (undocumented) - metadata: HexString; - // (undocumented) - schemeId: bigint; - // (undocumented) - stealthAddress: HexString; -} - -// @public (undocumented) -export const ANNOUNCER_ABI: readonly [{ - readonly type: "function"; - readonly name: "announce"; - readonly inputs: readonly [{ - readonly name: "schemeId"; - readonly type: "uint256"; - }, { - readonly name: "stealthAddress"; - readonly type: "address"; - }, { - readonly name: "ephemeralPubKey"; - readonly type: "bytes"; - }, { - readonly name: "metadata"; - readonly type: "bytes"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "event"; - readonly name: "Announcement"; - readonly inputs: readonly [{ - readonly name: "schemeId"; - readonly type: "uint256"; - readonly indexed: true; - }, { - readonly name: "stealthAddress"; - readonly type: "address"; - readonly indexed: true; - }, { - readonly name: "caller"; - readonly type: "address"; - readonly indexed: true; - }, { - readonly name: "ephemeralPubKey"; - readonly type: "bytes"; - readonly indexed: false; - }, { - readonly name: "metadata"; - readonly type: "bytes"; - readonly indexed: false; - }]; -}]; - -// @public -export function buildAnnounce(params: { - stealthAddress: HexString; - ephemeralPubKey: HexString; - viewTag: number; - chain: string; -}): TransactionData; - -// @public -export function buildRegisterMetaAddress(params: { - metaAddress: string; - chain: string; -}): TransactionData; - -// @public -export function buildRegisterName(params: { - name: string; - stealthKeys: StealthKeys; - chain: string; -}): TransactionData; - -// @public -export function buildReleaseName(params: { - name: string; - spendingKey: HexString; - chain: string; -}): TransactionData; - -// @public -export function buildResolveName(params: { - name: string; - chain: string; -}): TransactionData; - -// @public -export function buildSendERC20(params: { - recipientMetaAddress: string; - token: HexString; - amount: bigint; - chain: string; - gasTip?: string; -}): BuildSendStealthResult; - -// @public -export function buildSendStealth(params: { - recipientMetaAddress: string; - amount: string; - chain: string; -}): BuildSendStealthResult; - -// @public (undocumented) -export interface BuildSendStealthResult { - // (undocumented) - ephemeralPubKey: HexString; - // (undocumented) - stealthAddress: HexString; - // (undocumented) - transaction: TransactionData; - // (undocumented) - viewTag: number; -} - -// @public -export function buildUpdateName(params: { - name: string; - newStealthKeys: StealthKeys; - currentSpendingKey: HexString; - chain: string; -}): TransactionData; - -// @public -export function checkStealthAddress(ephemeralPubKey: HexString, viewingKey: HexString, spendingPubKey: HexString, viewTag: number): { - isMatch: boolean; - stealthAddress: HexString | null; -}; - -// @public -export function decodeStealthMetaAddress(metaAddress: string): StealthMetaAddress; - -// @public (undocumented) -export const DEPLOYMENTS: Record; - -// @public -export function deriveStealthKeys(signature: HexString): StealthKeys; - -// @public -export function deriveStealthPrivateKey(spendingKey: HexString, ephemeralPubKey: HexString, viewingKey: HexString): HexString; - -// @public -export function encodeStealthMetaAddress(spendingPubKey: HexString, viewingPubKey: HexString): string; - -// @public (undocumented) -export interface EVMChainDeployment { - // (undocumented) - chainId: number; - // (undocumented) - contracts: { - announcer: HexString; - registry: HexString; - sender: HexString; - names: HexString; - }; - // (undocumented) - explorerUrl: string; - // (undocumented) - name: string; - // (undocumented) - rpcUrl: string; - // (undocumented) - subgraphUrl: string; -} - -// @public -export function fetchAnnouncements(chain: string, subgraphUrl?: string): Promise; - -// @public -export interface GeneratedStealthAddress { - ephemeralPubKey: HexString; - stealthAddress: HexString; - viewTag: number; -} - -// @public -export function generateStealthAddress(spendingPubKey: HexString, viewingPubKey: HexString, ephemeralPrivateKey?: HexString): GeneratedStealthAddress; - -// @public (undocumented) -export function getDeployment(chain: string): EVMChainDeployment; - -// @public (undocumented) -export type HexString = `0x${string}`; - -// @public -export interface MatchedAnnouncement extends Announcement { - // (undocumented) - stealthPrivateKey: HexString; -} - -// @public -export const META_ADDRESS_PREFIX = "st:eth:0x"; - -// @public -export function metaAddressToBytes(metaAddress: string): HexString; - -// @public (undocumented) -export const NAMES_ABI: readonly [{ - readonly type: "function"; - readonly name: "register"; - readonly inputs: readonly [{ - readonly name: "name"; - readonly type: "string"; - }, { - readonly name: "stealthMetaAddress"; - readonly type: "bytes"; - }, { - readonly name: "signature"; - readonly type: "bytes"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "function"; - readonly name: "registerOnBehalf"; - readonly inputs: readonly [{ - readonly name: "name"; - readonly type: "string"; - }, { - readonly name: "stealthMetaAddress"; - readonly type: "bytes"; - }, { - readonly name: "signature"; - readonly type: "bytes"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "function"; - readonly name: "update"; - readonly inputs: readonly [{ - readonly name: "name"; - readonly type: "string"; - }, { - readonly name: "newMetaAddress"; - readonly type: "bytes"; - }, { - readonly name: "signature"; - readonly type: "bytes"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "function"; - readonly name: "release"; - readonly inputs: readonly [{ - readonly name: "name"; - readonly type: "string"; - }, { - readonly name: "signature"; - readonly type: "bytes"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "function"; - readonly name: "resolve"; - readonly inputs: readonly [{ - readonly name: "name"; - readonly type: "string"; - }]; - readonly outputs: readonly [{ - readonly name: ""; - readonly type: "bytes"; - }]; - readonly stateMutability: "view"; -}, { - readonly type: "function"; - readonly name: "nameOf"; - readonly inputs: readonly [{ - readonly name: "stealthMetaAddress"; - readonly type: "bytes"; - }]; - readonly outputs: readonly [{ - readonly name: ""; - readonly type: "string"; - }]; - readonly stateMutability: "view"; -}]; - -// @public (undocumented) -export const REGISTRY_ABI: readonly [{ - readonly type: "function"; - readonly name: "registerKeys"; - readonly inputs: readonly [{ - readonly name: "schemeId"; - readonly type: "uint256"; - }, { - readonly name: "stealthMetaAddress"; - readonly type: "bytes"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "function"; - readonly name: "registerKeysOnBehalf"; - readonly inputs: readonly [{ - readonly name: "registrant"; - readonly type: "address"; - }, { - readonly name: "schemeId"; - readonly type: "uint256"; - }, { - readonly name: "signature"; - readonly type: "bytes"; - }, { - readonly name: "stealthMetaAddress"; - readonly type: "bytes"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "function"; - readonly name: "stealthMetaAddressOf"; - readonly inputs: readonly [{ - readonly name: "registrant"; - readonly type: "address"; - }, { - readonly name: "schemeId"; - readonly type: "uint256"; - }]; - readonly outputs: readonly [{ - readonly name: ""; - readonly type: "bytes"; - }]; - readonly stateMutability: "view"; -}, { - readonly type: "function"; - readonly name: "incrementNonce"; - readonly inputs: readonly []; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "function"; - readonly name: "nonceOf"; - readonly inputs: readonly [{ - readonly name: "registrant"; - readonly type: "address"; - }]; - readonly outputs: readonly [{ - readonly name: ""; - readonly type: "uint256"; - }]; - readonly stateMutability: "view"; -}, { - readonly type: "function"; - readonly name: "DOMAIN_SEPARATOR"; - readonly inputs: readonly []; - readonly outputs: readonly [{ - readonly name: ""; - readonly type: "bytes32"; - }]; - readonly stateMutability: "view"; -}]; - -// @public -export function scanAnnouncements(announcements: Announcement[], viewingKey: HexString, spendingPubKey: HexString, spendingKey: HexString): MatchedAnnouncement[]; - -// @public -export const SCHEME_ID = 1n; - -// @public (undocumented) -export const SENDER_ABI: readonly [{ - readonly type: "function"; - readonly name: "sendETH"; - readonly inputs: readonly [{ - readonly name: "schemeId"; - readonly type: "uint256"; - }, { - readonly name: "stealthAddress"; - readonly type: "address"; - }, { - readonly name: "ephemeralPubKey"; - readonly type: "bytes"; - }, { - readonly name: "metadata"; - readonly type: "bytes"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "payable"; -}, { - readonly type: "function"; - readonly name: "sendERC20"; - readonly inputs: readonly [{ - readonly name: "token"; - readonly type: "address"; - }, { - readonly name: "amount"; - readonly type: "uint256"; - }, { - readonly name: "schemeId"; - readonly type: "uint256"; - }, { - readonly name: "stealthAddress"; - readonly type: "address"; - }, { - readonly name: "ephemeralPubKey"; - readonly type: "bytes"; - }, { - readonly name: "metadata"; - readonly type: "bytes"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "payable"; -}, { - readonly type: "function"; - readonly name: "batchSendETH"; - readonly inputs: readonly [{ - readonly name: "schemeId"; - readonly type: "uint256"; - }, { - readonly name: "stealthAddresses"; - readonly type: "address[]"; - }, { - readonly name: "ephemeralPubKeys"; - readonly type: "bytes[]"; - }, { - readonly name: "metadatas"; - readonly type: "bytes[]"; - }, { - readonly name: "amounts"; - readonly type: "uint256[]"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "payable"; -}, { - readonly type: "function"; - readonly name: "batchSendERC20"; - readonly inputs: readonly [{ - readonly name: "token"; - readonly type: "address"; - }, { - readonly name: "schemeId"; - readonly type: "uint256"; - }, { - readonly name: "stealthAddresses"; - readonly type: "address[]"; - }, { - readonly name: "ephemeralPubKeys"; - readonly type: "bytes[]"; - }, { - readonly name: "metadatas"; - readonly type: "bytes[]"; - }, { - readonly name: "amounts"; - readonly type: "uint256[]"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "payable"; -}]; - -// @public -export function signNameRegistration(name: string, metaAddressBytes: HexString, spendingKey: HexString): HexString; - -// @public -export function signNameRegistrationOnBehalf(name: string, metaAddressBytes: HexString, spendingKey: HexString, nonce: bigint): HexString; - -// @public -export function signNameRelease(name: string, spendingKey: HexString): HexString; - -// @public -export function signNameUpdate(name: string, newMetaAddressBytes: HexString, spendingKey: HexString): HexString; - -// @public -export const STEALTH_SIGNING_MESSAGE = "Sign this message to generate your Wraith stealth keys.\n\nChain: Horizen\nNote: This signature is used for key derivation only. It does not authorize any transaction."; - -// @public -export interface StealthKeys { - spendingKey: HexString; - spendingPubKey: HexString; - viewingKey: HexString; - viewingPubKey: HexString; -} - -// @public -export interface StealthMetaAddress { - // (undocumented) - prefix: string; - // (undocumented) - spendingPubKey: HexString; - // (undocumented) - viewingPubKey: HexString; -} - -// @public (undocumented) -export interface TransactionData { - // (undocumented) - data: HexString; - // (undocumented) - to: HexString; - // (undocumented) - value?: bigint; -} - -// @public (undocumented) -export const WITHDRAWER_ABI: readonly [{ - readonly type: "function"; - readonly name: "withdrawETH"; - readonly inputs: readonly [{ - readonly name: "destination"; - readonly type: "address"; - }, { - readonly name: "sponsorFee"; - readonly type: "uint256"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "function"; - readonly name: "withdrawERC20"; - readonly inputs: readonly [{ - readonly name: "token"; - readonly type: "address"; - }, { - readonly name: "destination"; - readonly type: "address"; - }, { - readonly name: "sponsorFee"; - readonly type: "uint256"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "function"; - readonly name: "withdrawETHDirect"; - readonly inputs: readonly [{ - readonly name: "destination"; - readonly type: "address"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}, { - readonly type: "function"; - readonly name: "withdrawERC20Direct"; - readonly inputs: readonly [{ - readonly name: "token"; - readonly type: "address"; - }, { - readonly name: "destination"; - readonly type: "address"; - }]; - readonly outputs: readonly []; - readonly stateMutability: "nonpayable"; -}]; - -// (No @packageDocumentation comment for this package) - -``` +## API Report File for "@wraith-protocol/sdk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public +export interface Announcement { + // (undocumented) + caller: HexString; + // (undocumented) + ephemeralPubKey: HexString; + // (undocumented) + metadata: HexString; + // (undocumented) + schemeId: bigint; + // (undocumented) + stealthAddress: HexString; +} + +// @public (undocumented) +export const ANNOUNCER_ABI: readonly [{ + readonly type: "function"; + readonly name: "announce"; + readonly inputs: readonly [{ + readonly name: "schemeId"; + readonly type: "uint256"; + }, { + readonly name: "stealthAddress"; + readonly type: "address"; + }, { + readonly name: "ephemeralPubKey"; + readonly type: "bytes"; + }, { + readonly name: "metadata"; + readonly type: "bytes"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "event"; + readonly name: "Announcement"; + readonly inputs: readonly [{ + readonly name: "schemeId"; + readonly type: "uint256"; + readonly indexed: true; + }, { + readonly name: "stealthAddress"; + readonly type: "address"; + readonly indexed: true; + }, { + readonly name: "caller"; + readonly type: "address"; + readonly indexed: true; + }, { + readonly name: "ephemeralPubKey"; + readonly type: "bytes"; + readonly indexed: false; + }, { + readonly name: "metadata"; + readonly type: "bytes"; + readonly indexed: false; + }]; +}]; + +// @public +export function buildAnnounce(params: { + stealthAddress: HexString; + ephemeralPubKey: HexString; + viewTag: number; + chain: string; +}): TransactionData; + +// @public +export function buildRegisterMetaAddress(params: { + metaAddress: string; + chain: string; +}): TransactionData; + +// @public +export function buildRegisterName(params: { + name: string; + stealthKeys: StealthKeys; + chain: string; +}): TransactionData; + +// @public +export function buildReleaseName(params: { + name: string; + spendingKey: HexString; + chain: string; +}): TransactionData; + +// @public +export function buildResolveName(params: { + name: string; + chain: string; +}): TransactionData; + +// @public +export function buildSendERC20(params: { + recipientMetaAddress: string; + token: HexString; + amount: bigint; + chain: string; + gasTip?: string; +}): BuildSendStealthResult; + +// @public +export function buildSendStealth(params: { + recipientMetaAddress: string; + amount: string; + chain: string; +}): BuildSendStealthResult; + +// @public (undocumented) +export interface BuildSendStealthResult { + // (undocumented) + ephemeralPubKey: HexString; + // (undocumented) + stealthAddress: HexString; + // (undocumented) + transaction: TransactionData; + // (undocumented) + viewTag: number; +} + +// @public +export function buildUpdateName(params: { + name: string; + newStealthKeys: StealthKeys; + currentSpendingKey: HexString; + chain: string; +}): TransactionData; + +// @public +export function checkStealthAddress(ephemeralPubKey: HexString, viewingKey: HexString, spendingPubKey: HexString, viewTag: number): { + isMatch: boolean; + stealthAddress: HexString | null; +}; + +// @public +export function decodeStealthMetaAddress(metaAddress: string): StealthMetaAddress; + +// @public (undocumented) +export const DEPLOYMENTS: Record; + +// @public +export function deriveStealthKeys(signature: HexString): StealthKeys; + +// @public +export function deriveStealthPrivateKey(spendingKey: HexString, ephemeralPubKey: HexString, viewingKey: HexString): HexString; + +// @public +export function encodeStealthMetaAddress(spendingPubKey: HexString, viewingPubKey: HexString): string; + +// @public (undocumented) +export interface EVMChainDeployment { + // (undocumented) + chainId: number; + // (undocumented) + contracts: { + announcer: HexString; + registry: HexString; + sender: HexString; + names: HexString; + }; + // (undocumented) + explorerUrl: string; + // (undocumented) + name: string; + // (undocumented) + rpcUrl: string; + // (undocumented) + subgraphUrl: string; +} + +// @public +export function fetchAnnouncements(chain: string, subgraphUrl?: string): Promise; + +// @public +export interface GeneratedStealthAddress { + ephemeralPubKey: HexString; + stealthAddress: HexString; + viewTag: number; +} + +// @public +export function generateStealthAddress(spendingPubKey: HexString, viewingPubKey: HexString, ephemeralPrivateKey?: HexString): GeneratedStealthAddress; + +// @public (undocumented) +export function getDeployment(chain: string): EVMChainDeployment; + +// @public (undocumented) +export type HexString = `0x${string}`; + +// @public +export interface MatchedAnnouncement extends Announcement { + // (undocumented) + stealthPrivateKey: HexString; +} + +// @public +export const META_ADDRESS_PREFIX = "st:eth:0x"; + +// @public +export function metaAddressToBytes(metaAddress: string): HexString; + +// @public (undocumented) +export const NAMES_ABI: readonly [{ + readonly type: "function"; + readonly name: "register"; + readonly inputs: readonly [{ + readonly name: "name"; + readonly type: "string"; + }, { + readonly name: "stealthMetaAddress"; + readonly type: "bytes"; + }, { + readonly name: "signature"; + readonly type: "bytes"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "function"; + readonly name: "registerOnBehalf"; + readonly inputs: readonly [{ + readonly name: "name"; + readonly type: "string"; + }, { + readonly name: "stealthMetaAddress"; + readonly type: "bytes"; + }, { + readonly name: "signature"; + readonly type: "bytes"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "function"; + readonly name: "update"; + readonly inputs: readonly [{ + readonly name: "name"; + readonly type: "string"; + }, { + readonly name: "newMetaAddress"; + readonly type: "bytes"; + }, { + readonly name: "signature"; + readonly type: "bytes"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "function"; + readonly name: "release"; + readonly inputs: readonly [{ + readonly name: "name"; + readonly type: "string"; + }, { + readonly name: "signature"; + readonly type: "bytes"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "function"; + readonly name: "resolve"; + readonly inputs: readonly [{ + readonly name: "name"; + readonly type: "string"; + }]; + readonly outputs: readonly [{ + readonly name: ""; + readonly type: "bytes"; + }]; + readonly stateMutability: "view"; +}, { + readonly type: "function"; + readonly name: "nameOf"; + readonly inputs: readonly [{ + readonly name: "stealthMetaAddress"; + readonly type: "bytes"; + }]; + readonly outputs: readonly [{ + readonly name: ""; + readonly type: "string"; + }]; + readonly stateMutability: "view"; +}]; + +// @public (undocumented) +export const REGISTRY_ABI: readonly [{ + readonly type: "function"; + readonly name: "registerKeys"; + readonly inputs: readonly [{ + readonly name: "schemeId"; + readonly type: "uint256"; + }, { + readonly name: "stealthMetaAddress"; + readonly type: "bytes"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "function"; + readonly name: "registerKeysOnBehalf"; + readonly inputs: readonly [{ + readonly name: "registrant"; + readonly type: "address"; + }, { + readonly name: "schemeId"; + readonly type: "uint256"; + }, { + readonly name: "signature"; + readonly type: "bytes"; + }, { + readonly name: "stealthMetaAddress"; + readonly type: "bytes"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "function"; + readonly name: "stealthMetaAddressOf"; + readonly inputs: readonly [{ + readonly name: "registrant"; + readonly type: "address"; + }, { + readonly name: "schemeId"; + readonly type: "uint256"; + }]; + readonly outputs: readonly [{ + readonly name: ""; + readonly type: "bytes"; + }]; + readonly stateMutability: "view"; +}, { + readonly type: "function"; + readonly name: "incrementNonce"; + readonly inputs: readonly []; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "function"; + readonly name: "nonceOf"; + readonly inputs: readonly [{ + readonly name: "registrant"; + readonly type: "address"; + }]; + readonly outputs: readonly [{ + readonly name: ""; + readonly type: "uint256"; + }]; + readonly stateMutability: "view"; +}, { + readonly type: "function"; + readonly name: "DOMAIN_SEPARATOR"; + readonly inputs: readonly []; + readonly outputs: readonly [{ + readonly name: ""; + readonly type: "bytes32"; + }]; + readonly stateMutability: "view"; +}]; + +// @public +export function scanAnnouncements(announcements: Announcement[], viewingKey: HexString, spendingPubKey: HexString, spendingKey: HexString): MatchedAnnouncement[]; + +// @public +export const SCHEME_ID = 1n; + +// @public (undocumented) +export const SENDER_ABI: readonly [{ + readonly type: "function"; + readonly name: "sendETH"; + readonly inputs: readonly [{ + readonly name: "schemeId"; + readonly type: "uint256"; + }, { + readonly name: "stealthAddress"; + readonly type: "address"; + }, { + readonly name: "ephemeralPubKey"; + readonly type: "bytes"; + }, { + readonly name: "metadata"; + readonly type: "bytes"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "payable"; +}, { + readonly type: "function"; + readonly name: "sendERC20"; + readonly inputs: readonly [{ + readonly name: "token"; + readonly type: "address"; + }, { + readonly name: "amount"; + readonly type: "uint256"; + }, { + readonly name: "schemeId"; + readonly type: "uint256"; + }, { + readonly name: "stealthAddress"; + readonly type: "address"; + }, { + readonly name: "ephemeralPubKey"; + readonly type: "bytes"; + }, { + readonly name: "metadata"; + readonly type: "bytes"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "payable"; +}, { + readonly type: "function"; + readonly name: "batchSendETH"; + readonly inputs: readonly [{ + readonly name: "schemeId"; + readonly type: "uint256"; + }, { + readonly name: "stealthAddresses"; + readonly type: "address[]"; + }, { + readonly name: "ephemeralPubKeys"; + readonly type: "bytes[]"; + }, { + readonly name: "metadatas"; + readonly type: "bytes[]"; + }, { + readonly name: "amounts"; + readonly type: "uint256[]"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "payable"; +}, { + readonly type: "function"; + readonly name: "batchSendERC20"; + readonly inputs: readonly [{ + readonly name: "token"; + readonly type: "address"; + }, { + readonly name: "schemeId"; + readonly type: "uint256"; + }, { + readonly name: "stealthAddresses"; + readonly type: "address[]"; + }, { + readonly name: "ephemeralPubKeys"; + readonly type: "bytes[]"; + }, { + readonly name: "metadatas"; + readonly type: "bytes[]"; + }, { + readonly name: "amounts"; + readonly type: "uint256[]"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "payable"; +}]; + +// @public +export function signNameRegistration(name: string, metaAddressBytes: HexString, spendingKey: HexString): HexString; + +// @public +export function signNameRegistrationOnBehalf(name: string, metaAddressBytes: HexString, spendingKey: HexString, nonce: bigint): HexString; + +// @public +export function signNameRelease(name: string, spendingKey: HexString): HexString; + +// @public +export function signNameUpdate(name: string, newMetaAddressBytes: HexString, spendingKey: HexString): HexString; + +// @public +export const STEALTH_SIGNING_MESSAGE = "Sign this message to generate your Wraith stealth keys.\n\nChain: Horizen\nNote: This signature is used for key derivation only. It does not authorize any transaction."; + +// @public +export interface StealthKeys { + spendingKey: HexString; + spendingPubKey: HexString; + viewingKey: HexString; + viewingPubKey: HexString; +} + +// @public +export interface StealthMetaAddress { + // (undocumented) + prefix: string; + // (undocumented) + spendingPubKey: HexString; + // (undocumented) + viewingPubKey: HexString; +} + +// @public (undocumented) +export interface TransactionData { + // (undocumented) + data: HexString; + // (undocumented) + to: HexString; + // (undocumented) + value?: bigint; +} + +// @public (undocumented) +export const WITHDRAWER_ABI: readonly [{ + readonly type: "function"; + readonly name: "withdrawETH"; + readonly inputs: readonly [{ + readonly name: "destination"; + readonly type: "address"; + }, { + readonly name: "sponsorFee"; + readonly type: "uint256"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "function"; + readonly name: "withdrawERC20"; + readonly inputs: readonly [{ + readonly name: "token"; + readonly type: "address"; + }, { + readonly name: "destination"; + readonly type: "address"; + }, { + readonly name: "sponsorFee"; + readonly type: "uint256"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "function"; + readonly name: "withdrawETHDirect"; + readonly inputs: readonly [{ + readonly name: "destination"; + readonly type: "address"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}, { + readonly type: "function"; + readonly name: "withdrawERC20Direct"; + readonly inputs: readonly [{ + readonly name: "token"; + readonly type: "address"; + }, { + readonly name: "destination"; + readonly type: "address"; + }]; + readonly outputs: readonly []; + readonly stateMutability: "nonpayable"; +}]; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/etc/sdk-solana.api.md b/etc/sdk-solana.api.md index c5c6f16..2715fe4 100644 --- a/etc/sdk-solana.api.md +++ b/etc/sdk-solana.api.md @@ -1,257 +1,259 @@ -## API Report File for "@wraith-protocol/sdk" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -// @public -export interface Announcement { - caller: string; - ephemeralPubKey: string; - metadata: string; - schemeId: number; - stealthAddress: string; -} - -// @public -export function buildAnnounce(params: { - stealthAddress: string; - ephemeralPubKey: Uint8Array; - viewTag: number; - callerPubkey: string; - chain?: string; -}): BuildAnnounceResult; - -// @public (undocumented) -export interface BuildAnnounceResult { - // (undocumented) - instruction: SolanaInstruction; -} - -// @public -export function buildRegisterName(params: { - name: string; - metaAddress: Uint8Array; - ownerPubkey: string; - chain?: string; -}): BuildRegisterNameResult; - -// @public (undocumented) -export interface BuildRegisterNameResult { - // (undocumented) - instruction: SolanaInstruction; - // (undocumented) - nameRecordPDA: string; -} - -// @public -export function buildReleaseName(params: { - name: string; - ownerPubkey: string; - chain?: string; -}): BuildReleaseNameResult; - -// @public (undocumented) -export interface BuildReleaseNameResult { - // (undocumented) - instruction: SolanaInstruction; - // (undocumented) - nameRecordPDA: string; -} - -// @public -export function buildResolveName(params: { - name: string; - chain?: string; -}): BuildResolveNameResult; - -// @public (undocumented) -export interface BuildResolveNameResult { - // (undocumented) - instruction: SolanaInstruction; - // (undocumented) - nameRecordPDA: string; -} - -// @public -export function buildSendSol(params: { - recipientMetaAddress: string; - amount: bigint; - senderPubkey: string; - chain?: string; -}): BuildSendSolResult; - -// @public (undocumented) -export interface BuildSendSolResult { - // (undocumented) - ephemeralPubKey: Uint8Array; - // (undocumented) - instruction: SolanaInstruction; - // (undocumented) - stealthAddress: string; - // (undocumented) - viewTag: number; -} - -// @public -export function buildUpdateName(params: { - name: string; - newMetaAddress: Uint8Array; - ownerPubkey: string; - chain?: string; -}): BuildUpdateNameResult; - -// @public (undocumented) -export interface BuildUpdateNameResult { - // (undocumented) - instruction: SolanaInstruction; - // (undocumented) - nameRecordPDA: string; -} - -// @public -export function bytesToHex(bytes: Uint8Array): string; - -// @public -export function checkStealthAddress(ephemeralPubKey: Uint8Array, viewingKey: Uint8Array, spendingPubKey: Uint8Array, viewTag: number): { - isMatch: boolean; - stealthAddress: string | null; - hashScalar: bigint | null; - stealthPubKeyBytes: Uint8Array | null; -}; - -// @public -export function computeSharedSecret(privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array; - -// @public @deprecated -export function computeViewTag(sharedSecret: Uint8Array): number; - -// @public -export function decodeStealthMetaAddress(metaAddress: string): StealthMetaAddress; - -// @public (undocumented) -export const DEPLOYMENTS: Record; - -// Warning: (ae-forgotten-export) The symbol "StealthKeys_2" needs to be exported by the entry point index.d.ts -// -// @public -export function deriveStealthKeys(signature: Uint8Array): StealthKeys_2; - -// @public -export function deriveStealthPrivateScalar(spendingScalar: bigint, viewingKey: Uint8Array, ephemeralPubKey: Uint8Array): bigint; - -// @public -export function deriveStealthPubKey(spendingPubKey: Uint8Array, hashScalar: bigint): Uint8Array; - -// @public -export function encodeStealthMetaAddress(spendingPubKey: Uint8Array, viewingPubKey: Uint8Array): string; - -// @public -export function fetchAnnouncements(chain?: string, rpcUrl?: string): Promise; - -// @public -export interface GeneratedStealthAddress { - ephemeralPubKey: Uint8Array; - stealthAddress: string; - viewTag: number; -} - -// @public -export function generateStealthAddress(spendingPubKey: Uint8Array, viewingPubKey: Uint8Array, ephemeralSeed?: Uint8Array): GeneratedStealthAddress; - -// @public (undocumented) -export function getDeployment(chain: string): SolanaChainDeployment; - -// @public -export function hashToScalar(sharedSecret: Uint8Array): bigint; - -// @public -export type HexString = `0x${string}`; - -// @public -export function hexToBytes(hex: string): Uint8Array; - -// @public -export const L: bigint; - -// @public -export interface MatchedAnnouncement extends Announcement { - stealthPrivateScalar: bigint; - stealthPubKeyBytes: Uint8Array; -} - -// @public -export const META_ADDRESS_PREFIX = "st:sol:"; - -// @public -export function pubKeyToSolanaAddress(pubKeyBytes: Uint8Array): string; - -// @public -export function scanAnnouncements(announcements: Announcement[], viewingKey: Uint8Array, spendingPubKey: Uint8Array, spendingScalar: bigint): MatchedAnnouncement[]; - -// @public -export const SCHEME_ID = 1; - -// @public -export function seedToScalar(seed: Uint8Array): bigint; - -// @public -export function signSolanaTransaction(transactionHash: Uint8Array, stealthScalar: bigint, stealthPubKey: Uint8Array): Uint8Array; - -// @public -export function signWithScalar(message: Uint8Array, scalar: bigint, publicKey: Uint8Array): Uint8Array; - -// @public (undocumented) -export interface SolanaChainDeployment { - // (undocumented) - cluster: string; - // (undocumented) - contracts: { - announcer: string; - sender: string; - names: string; - }; - // (undocumented) - explorerUrl: string; - // (undocumented) - rpcUrl: string; -} - -// @public -export interface SolanaInstruction { - // (undocumented) - data: Uint8Array; - // (undocumented) - keys: { - pubkey: string; - isSigner: boolean; - isWritable: boolean; - }[]; - // (undocumented) - programId: string; -} - -// @public -export const STEALTH_SIGNING_MESSAGE = "Sign this message to generate your Wraith stealth keys.\n\nChain: Solana\nNote: This signature is used for key derivation only and does not authorize any transaction."; - -// @public -export interface StealthKeys { - spendingKey: Uint8Array; - spendingPubKey: Uint8Array; - spendingScalar: bigint; - viewingKey: Uint8Array; - viewingPubKey: Uint8Array; - viewingScalar: bigint; -} - -// @public -export interface StealthMetaAddress { - // (undocumented) - prefix: string; - spendingPubKey: Uint8Array; - viewingPubKey: Uint8Array; -} - -// (No @packageDocumentation comment for this package) - -``` +## API Report File for "@wraith-protocol/sdk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { ExtPointType } from '@noble/curves/abstract/edwards'; + +// @public +export interface Announcement { + caller: string; + ephemeralPubKey: string; + metadata: string; + schemeId: number; + stealthAddress: string; +} + +// @public +export function buildAnnounce(params: { + stealthAddress: string; + ephemeralPubKey: Uint8Array; + viewTag: number; + callerPubkey: string; + chain?: string; +}): BuildAnnounceResult; + +// @public (undocumented) +export interface BuildAnnounceResult { + // (undocumented) + instruction: SolanaInstruction; +} + +// @public +export function buildRegisterName(params: { + name: string; + metaAddress: Uint8Array; + ownerPubkey: string; + chain?: string; +}): BuildRegisterNameResult; + +// @public (undocumented) +export interface BuildRegisterNameResult { + // (undocumented) + instruction: SolanaInstruction; + // (undocumented) + nameRecordPDA: string; +} + +// @public +export function buildReleaseName(params: { + name: string; + ownerPubkey: string; + chain?: string; +}): BuildReleaseNameResult; + +// @public (undocumented) +export interface BuildReleaseNameResult { + // (undocumented) + instruction: SolanaInstruction; + // (undocumented) + nameRecordPDA: string; +} + +// @public +export function buildResolveName(params: { + name: string; + chain?: string; +}): BuildResolveNameResult; + +// @public (undocumented) +export interface BuildResolveNameResult { + // (undocumented) + instruction: SolanaInstruction; + // (undocumented) + nameRecordPDA: string; +} + +// @public +export function buildSendSol(params: { + recipientMetaAddress: string; + amount: bigint; + senderPubkey: string; + chain?: string; +}): BuildSendSolResult; + +// @public (undocumented) +export interface BuildSendSolResult { + // (undocumented) + ephemeralPubKey: Uint8Array; + // (undocumented) + instruction: SolanaInstruction; + // (undocumented) + stealthAddress: string; + // (undocumented) + viewTag: number; +} + +// @public +export function buildUpdateName(params: { + name: string; + newMetaAddress: Uint8Array; + ownerPubkey: string; + chain?: string; +}): BuildUpdateNameResult; + +// @public (undocumented) +export interface BuildUpdateNameResult { + // (undocumented) + instruction: SolanaInstruction; + // (undocumented) + nameRecordPDA: string; +} + +// @public +export function bytesToHex(bytes: Uint8Array): string; + +// @public +export function checkStealthAddress(ephemeralPubKey: Uint8Array, viewingKey: Uint8Array, spendingPubKey: Uint8Array, viewTag: number): { + isMatch: boolean; + stealthAddress: string | null; + hashScalar: bigint | null; + stealthPubKeyBytes: Uint8Array | null; +}; + +// @public +export function computeSharedSecret(privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array; + +// @public @deprecated +export function computeViewTag(sharedSecret: Uint8Array): number; + +// @public +export function decodeStealthMetaAddress(metaAddress: string): StealthMetaAddress; + +// @public (undocumented) +export const DEPLOYMENTS: Record; + +// Warning: (ae-forgotten-export) The symbol "StealthKeys_2" needs to be exported by the entry point index.d.ts +// +// @public +export function deriveStealthKeys(signature: Uint8Array): StealthKeys_2; + +// @public +export function deriveStealthPrivateScalar(spendingScalar: bigint, viewingKey: Uint8Array, ephemeralPubKey: Uint8Array): bigint; + +// @public +export function deriveStealthPubKey(spendingPubKey: Uint8Array, hashScalar: bigint, spendingPoint?: ExtPointType): Uint8Array; + +// @public +export function encodeStealthMetaAddress(spendingPubKey: Uint8Array, viewingPubKey: Uint8Array): string; + +// @public +export function fetchAnnouncements(chain?: string, rpcUrl?: string): Promise; + +// @public +export interface GeneratedStealthAddress { + ephemeralPubKey: Uint8Array; + stealthAddress: string; + viewTag: number; +} + +// @public +export function generateStealthAddress(spendingPubKey: Uint8Array, viewingPubKey: Uint8Array, ephemeralSeed?: Uint8Array): GeneratedStealthAddress; + +// @public (undocumented) +export function getDeployment(chain: string): SolanaChainDeployment; + +// @public +export function hashToScalar(sharedSecret: Uint8Array): bigint; + +// @public +export type HexString = `0x${string}`; + +// @public +export function hexToBytes(hex: string): Uint8Array; + +// @public +export const L: bigint; + +// @public +export interface MatchedAnnouncement extends Announcement { + stealthPrivateScalar: bigint; + stealthPubKeyBytes: Uint8Array; +} + +// @public +export const META_ADDRESS_PREFIX = "st:sol:"; + +// @public +export function pubKeyToSolanaAddress(pubKeyBytes: Uint8Array): string; + +// @public +export function scanAnnouncements(announcements: Announcement[], viewingKey: Uint8Array, spendingPubKey: Uint8Array, spendingScalar: bigint): MatchedAnnouncement[]; + +// @public +export const SCHEME_ID = 1; + +// @public +export function seedToScalar(seed: Uint8Array): bigint; + +// @public +export function signSolanaTransaction(transactionHash: Uint8Array, stealthScalar: bigint, stealthPubKey: Uint8Array): Uint8Array; + +// @public +export function signWithScalar(message: Uint8Array, scalar: bigint, publicKey: Uint8Array): Uint8Array; + +// @public (undocumented) +export interface SolanaChainDeployment { + // (undocumented) + cluster: string; + // (undocumented) + contracts: { + announcer: string; + sender: string; + names: string; + }; + // (undocumented) + explorerUrl: string; + // (undocumented) + rpcUrl: string; +} + +// @public +export interface SolanaInstruction { + // (undocumented) + data: Uint8Array; + // (undocumented) + keys: { + pubkey: string; + isSigner: boolean; + isWritable: boolean; + }[]; + // (undocumented) + programId: string; +} + +// @public +export const STEALTH_SIGNING_MESSAGE = "Sign this message to generate your Wraith stealth keys.\n\nChain: Solana\nNote: This signature is used for key derivation only and does not authorize any transaction."; + +// @public +export interface StealthKeys { + spendingKey: Uint8Array; + spendingPubKey: Uint8Array; + spendingScalar: bigint; + viewingKey: Uint8Array; + viewingPubKey: Uint8Array; + viewingScalar: bigint; +} + +// @public +export interface StealthMetaAddress { + // (undocumented) + prefix: string; + spendingPubKey: Uint8Array; + viewingPubKey: Uint8Array; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/etc/sdk-stellar.api.md b/etc/sdk-stellar.api.md index f51a2dd..52e8129 100644 --- a/etc/sdk-stellar.api.md +++ b/etc/sdk-stellar.api.md @@ -1,688 +1,689 @@ -## API Report File for "@wraith-protocol/sdk" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { Asset } from '@stellar/stellar-sdk'; -import { Horizon } from '@stellar/stellar-sdk'; -import { Keypair } from '@stellar/stellar-sdk'; -import { Memo } from '@stellar/stellar-sdk'; -import { Operation } from '@stellar/stellar-sdk'; -import * as _stellar_stellar_sdk from '@stellar/stellar-sdk'; -import { Transaction } from '@stellar/stellar-sdk'; -import { TransactionBuilder } from '@stellar/stellar-sdk'; -import { xdr } from '@stellar/stellar-sdk'; - -// @public -export function addStealthMultisigSigner(tx: Transaction, signerKey: Keypair | string): Transaction; - -// @public -export const ANNOUNCE_EVENT_SYMBOL = "announce"; - -// @public -export interface Announcement { - caller: string; - ephemeralPubKey: string; - ledger?: number; - // Warning: (ae-forgotten-export) The symbol "StellarMemo" needs to be exported by the entry point index.d.ts - memo?: StellarMemo; - metadata: string; - schemeId: number; - stealthAddress: string; - viewTagBucket?: number; -} - -// @public (undocumented) -export interface AnnouncementCache { - clear(network: Network): Promise; - get(network: Network, fromLedger: number, toLedger: number): Promise; - getLastSeen(network: Network): Promise<{ - ledger: number; - cursor: string; - } | null>; - put(network: Network, announcements: Announcement[]): Promise; - setLastSeen(network: Network, ledger: number, cursor: string): Promise; -} - -// @public -export function assertViewTagBucket(bucket: number): void; - -// @public -export interface AssetMetadata { - decimals: number; - name: string; - symbol: string; -} - -// @public -export interface AssetReceivabilityResult { - hasTrustline: boolean; - issuerAuthRequired: boolean; - ops: ReturnType[]; -} - -// @public -export function autoSelectCache(): AnnouncementCache; - -// @public (undocumented) -export interface BatchConfig { - feePerOp?: number; - networkPassphrase: string; - sequence: string; - source: string; - timeout?: number; -} - -// @public -export function buildAnnouncementData(stealthAddresses: GeneratedStealthAddress[], caller: string): Array<{ - schemeId: number; - stealthAddress: string; - caller: string; - ephemeralPubKey: string; - metadata: string; -}>; - -// @public -export interface BuildAnnouncementOptions { - announcerContract: string; - fee?: string; - networkPassphrase: string; - sender: string; - sequence: string; - stealthResult: GeneratedStealthAddress; -} - -// @public -export function buildBatchSendTx(params: BuildBatchSendTxParams): BuildBatchSendTxResult; - -// @public -export interface BuildBatchSendTxParams { - baseFee?: number; - batchSenderContract?: string; - batchSenderThreshold?: number; - maxOperations?: number; - memo?: string; - networkPassphrase: string; - payments: StealthPayment[]; - sourceAccount: any; -} - -// @public -export interface BuildBatchSendTxResult { - stealthAddresses: GeneratedStealthAddress[]; - totalFee: number; - transaction: any; - usedBatchSender: boolean; -} - -// @public -export function buildMultisigStealthWithdraw(options: BuildMultisigStealthWithdrawOptions): Promise; - -// @public (undocumented) -export interface BuildMultisigStealthWithdrawOptions { - account?: Pick; - destination: string; - fee?: string; - horizonUrl?: string; - networkPassphrase: string; - requiredWeight?: number; - sequence?: string; - // Warning: (ae-forgotten-export) The symbol "WeightedSigner" needs to be exported by the entry point index.d.ts - signers: Array; - stealthAddress: string; - timeout?: number; -} - -// @public -export function buildPathStealthPayment(options: BuildPathStealthPaymentOptions): PathStealthPaymentResult; - -// @public -export interface BuildPathStealthPaymentOptions { - announcerContract: string; - destAmount: string; - _ephemeralSeed?: Uint8Array; - fee?: string; - networkPassphrase: string; - path?: Asset[]; - receiveAsset: Asset; - recipientMeta: string; - sendAsset: Asset; - sender: string; - sendMax: string; - sequence: string; -} - -// @public (undocumented) -export interface BuildResult { - paymentCount: number; - totalFee: number; - transactions: string[]; - txCount: number; -} - -// @public -export function buildStealthAnnouncement(options: BuildAnnouncementOptions): _stellar_stellar_sdk.Transaction<_stellar_stellar_sdk.Memo<_stellar_stellar_sdk.MemoType>, Operation[]>; - -// @public -export function buildStealthPayment(options: BuildStealthPaymentOptions): _stellar_stellar_sdk.Transaction<_stellar_stellar_sdk.Memo<_stellar_stellar_sdk.MemoType>, Operation[]>; - -// @public -export interface BuildStealthPaymentOptions { - amount: string; - asset?: Asset; - fee?: string; - networkPassphrase: string; - sender: string; - sequence: string; - stealthExists?: boolean; - stealthResult: GeneratedStealthAddress; -} - -// @public -export function buildStellarSwapAndStealth(options: BuildStellarSwapAndStealthOptions): SwapAndStealthResult; - -// @public -export interface BuildStellarSwapAndStealthOptions { - announcerContract: string; - destAmount: string; - _ephemeralSeed?: Uint8Array; - fee?: string; - fromAsset: Asset; - networkPassphrase: string; - path?: Asset[]; - recipientMeta: string; - sender: string; - sendMax: string; - sequence: string; - toAsset: Asset; -} - -// @public -export function buildV1AnnouncerEventFilter(contractId: string): SorobanEventFilter; - -// @public -export function buildV2AllBucketsEventFilter(contractId: string): SorobanEventFilter; - -// @public -export function buildV2BucketEventFilter(contractId: string, viewTagBucket: number): SorobanEventFilter; - -// @public -export function buildV2BucketEventFilterBatches(contractId: string, viewTagBuckets: number[]): SorobanEventFilter[][]; - -// @public -export function buildWithdrawCustomAsset(options: BuildWithdrawCustomAssetOptions): _stellar_stellar_sdk.Transaction<_stellar_stellar_sdk.Memo<_stellar_stellar_sdk.MemoType>, Operation[]>; - -// @public -export interface BuildWithdrawCustomAssetOptions { - asset: Asset; - balanceId: string; - fee?: string; - needsTrustline?: boolean; - networkPassphrase: string; - sequence: string; - stealthAddress: string; -} - -// @public -export function bytesToHex(bytes: Uint8Array): string; - -// @public -export function checkStealthAddress(ephemeralPubKey: Uint8Array, viewingKey: Uint8Array, spendingPubKey: Uint8Array, viewTag: number): { - isMatch: boolean; - stealthAddress: string | null; - hashScalar: bigint | null; - stealthPubKeyBytes: Uint8Array | null; -}; - -// @public -export function clearAssetMetadataCache(): void; - -// @public -export function computeAnnouncementViewTag(ephemeralPubKey: Uint8Array, viewingPubKey: Uint8Array): number; - -// @public -export function computeSharedSecret(privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array; - -// @public @deprecated -export function computeViewTag(sharedSecret: Uint8Array): number; - -// @public (undocumented) -export function createHorizonClient(config: HorizonClientConfig): HorizonClient; - -// @public -export function decodeAnnouncementData(data: Uint8Array): { - schemeId: number; - ephemeralPubKey: Uint8Array; - viewTag: number; -}; - -// @public -export function decodeMemo(memo: Memo | xdr.Memo): TypedMemo; - -// @public -export function decodeStealthMetaAddress(metaAddress: string): StealthMetaAddress; - -// @public -export const DEFAULT_BASE_FEE = 100; - -// @public -export const DEFAULT_BATCH_SENDER_THRESHOLD = 10; - -// @public -export const DEPLOYMENTS: Record; - -// @public -export function deriveStealthKeys(signature: Uint8Array): StealthKeys; - -// @public -export function deriveStealthKeysFromSigner(signer: StellarStealthSigner): Promise; - -// @public -export function deriveStealthPrivateScalar(spendingScalar: bigint, viewingKey: Uint8Array, ephemeralPubKey: Uint8Array): bigint; - -// @public -export function deriveStealthPubKey(spendingPubKey: Uint8Array, hashScalar: bigint): Uint8Array; - -// @public -export function encodeAnnouncementData(ephemeralPubKey: Uint8Array, viewTag: number): Uint8Array; - -// @public -export function encodeMemo(memo: TypedMemo): Memo; - -// @public -export function encodeStealthMetaAddress(spendingPubKey: Uint8Array, viewingPubKey: Uint8Array): string; - -// @public -export function encodeSymbolTopic(symbol: string): string; - -// @public -export function encodeU32Topic(value: number): string; - -// @public -export function extractMemoFromTransaction(tx: { - memo: Memo | xdr.Memo; -}): TypedMemo; - -// @public (undocumented) -export interface FetchAnnouncementsOptions { - cursor?: string; - fromLedger?: number; - fromTimestamp?: Date; - includeV1?: boolean; - includeV2?: boolean; - sorobanUrl?: string; - toLedger?: number; - toTimestamp?: Date; - viewTagBuckets?: number[]; -} - -// @public -export function fetchAnnouncementsStream(chain?: string, sorobanUrlOrOpts?: string | FetchAnnouncementsOptions, maybeOpts?: FetchAnnouncementsOptions): AsyncGenerator; - -// @public -export function findStrictReceivePath(options: FindStrictReceivePathOptions): Promise; - -// @public -export interface FindStrictReceivePathOptions { - chain?: string; - destAmount: string; - horizonUrl?: string; - receiveAsset: Asset; - sendAsset: Asset; -} - -// @public -export interface FreighterLikeWallet { - // (undocumented) - signMessage(message: string): Promise<{ - signedMessage: Uint8Array | string; - }>; -} - -// @public -export class FreighterStealthSigner implements StellarStealthSigner { - constructor(wallet: FreighterLikeWallet); - // (undocumented) - signMessage(message: Uint8Array): Promise; -} - -// @public -export interface GeneratedStealthAddress { - ephemeralPubKey: Uint8Array; - stealthAddress: string; - viewTag: number; -} - -// @public -export function generateStealthAddress(spendingPubKey: Uint8Array, viewingPubKey: Uint8Array, ephemeralSeed?: Uint8Array): GeneratedStealthAddress; - -// @public -export function getAssetBalance(contractId: string, address: string, network?: Network, opts?: GetAssetBalanceOptions): Promise; - -// @public -export interface GetAssetBalanceOptions { - rpcUrl?: string; -} - -// @public -export function getAssetMetadata(contractId: string, network?: Network, opts?: GetAssetMetadataOptions): Promise; - -// @public -export interface GetAssetMetadataOptions { - bypassCache?: boolean; - rpcUrl?: string; -} - -// @public -export function getDeployment(chain: string): StellarChainDeployment; - -// @public -export const HASH_MEMO_BYTES = 32; - -// @public -export function hashToScalar(sharedSecret: Uint8Array): bigint; - -// @public -export type HexString = `0x${string}`; - -// @public -export function hexToBytes(hex: string): Uint8Array; - -// @public (undocumented) -export interface HorizonClient { - get(path: string, overrides?: { - retry?: Partial; - }): Promise; - post(path: string, body: URLSearchParams | string, overrides?: { - retry?: Partial; - }): Promise; -} - -// @public (undocumented) -export interface HorizonClientConfig { - fetchImpl?: typeof fetch; - horizonUrl: string; - retry?: Partial; -} - -// @public -export const ID_MEMO_MAX: bigint; - -// @public -export class IndexedDBCache implements AnnouncementCache { - constructor(maxBytes?: number); - // (undocumented) - clear(network: Network): Promise; - // (undocumented) - get(network: Network, fromLedger: number, toLedger: number): Promise; - // (undocumented) - getLastSeen(network: Network): Promise<{ - ledger: number; - cursor: string; - } | null>; - // (undocumented) - put(network: Network, announcements: Announcement[]): Promise; - // (undocumented) - setLastSeen(network: Network, ledger: number, cursor: string): Promise; -} - -// @public -export function isStealthMultisigReady(tx: Transaction): boolean; - -// @public -export const L: bigint; - -// @public -export interface MatchedAnnouncement extends Announcement { - stealthPrivateScalar: bigint; - stealthPubKeyBytes: Uint8Array; -} - -// @public -export const MAX_RPC_EVENT_FILTERS = 5; - -// @public -export class MemoryCache implements AnnouncementCache { - constructor(maxBytes?: number); - // (undocumented) - clear(network: Network): Promise; - // (undocumented) - get(network: Network, fromLedger: number, toLedger: number): Promise; - // (undocumented) - getLastSeen(network: Network): Promise<{ - ledger: number; - cursor: string; - } | null>; - // (undocumented) - put(network: Network, announcements: Announcement[]): Promise; - // (undocumented) - setLastSeen(network: Network, ledger: number, cursor: string): Promise; -} - -// @public -export type MemoType = 'none' | 'id' | 'text' | 'hash' | 'return'; - -// @public -export class MemoValidationError extends Error { - constructor(message: string); -} - -// @public -export type MemoValue = string | Uint8Array | null; - -// @public -export const META_ADDRESS_PREFIX = "st:xlm:"; - -// @public -export type Network = 'testnet' | 'mainnet'; - -// Warning: (ae-internal-missing-underscore) The name "parseAnnouncementEvent" should be prefixed with an underscore because the declaration is marked as @internal -// -// @internal -export function parseAnnouncementEvent(event: Record): Announcement | null; - -// @public -export interface PathStealthPaymentResult { - stealthResult: GeneratedStealthAddress; - transaction: ReturnType; -} - -// @public -export function prepareStealthAccountForAsset(accountBalances: Array<{ - asset_code?: string; - asset_issuer?: string; - asset_type: string; -}>, issuerFlags: { - auth_required?: boolean; -}, asset: Asset): AssetReceivabilityResult; - -// @public -export function pubKeyToStellarAddress(pubKeyBytes: Uint8Array): string; - -// @public (undocumented) -export class RetentionExceededError extends Error { - constructor(requestedLedger: number, oldestAvailableLedger: number); - // (undocumented) - readonly oldestAvailableLedger: number; - // (undocumented) - readonly requestedLedger: number; -} - -// @public (undocumented) -export interface RetryPolicy { - baseDelayMs: number; - maxDelayMs: number; - maxRetries: number; - retryableStatuses: number[]; -} - -// @public @deprecated -export function scanAnnouncements(announcements: Announcement[], viewingKey: Uint8Array, spendingPubKey: Uint8Array, spendingScalar: bigint): MatchedAnnouncement[]; - -// @public -export function scanAnnouncementsLegacySharedSecretTag(announcements: Announcement[], viewingKey: Uint8Array, spendingPubKey: Uint8Array, spendingScalar: bigint): MatchedAnnouncement[]; - -// @public -export const SCHEME_ID = 1; - -// @public -export const SCHEME_ID_V1 = 1; - -// @public -export const SCHEME_ID_V2 = 2; - -// @public -export function seedToScalar(seed: Uint8Array): bigint; - -// @public -export function signStellarTransaction(transactionHash: Uint8Array, stealthScalar: bigint, stealthPubKey: Uint8Array): Uint8Array; - -// @public -export function signWithScalar(message: Uint8Array, scalar: bigint, publicKey: Uint8Array): Uint8Array; - -// @public -export interface SorobanEventFilter { - // (undocumented) - contractIds: string[]; - // (undocumented) - topics?: SorobanTopicMatcher[]; - // (undocumented) - type: 'contract'; -} - -// @public -export type SorobanTopicMatcher = string[]; - -// @public -export const STEALTH_SIGNING_MESSAGE = "Sign this message to generate your Wraith stealth keys.\n\nChain: Stellar\nNote: This signature is used for key derivation only and does not authorize any transaction."; - -// @public -export interface StealthKeys { - spendingKey: Uint8Array; - spendingPubKey: Uint8Array; - spendingScalar: bigint; - viewingKey: Uint8Array; - viewingPubKey: Uint8Array; - viewingScalar: bigint; -} - -// @public -export interface StealthMetaAddress { - prefix: string; - spendingPubKey: Uint8Array; - viewingPubKey: Uint8Array; -} - -// @public -export interface StealthPayment { - amount: string; - metaAddress: string; -} - -// @public (undocumented) -export interface StealthPaymentConfig { - amount: string; - asset?: string; - assetIssuer?: string; - caller?: string; - destination: string; - ephemeralPubKey: string; - viewTag: number; -} - -// @public -export const STELLAR_MAX_OPERATIONS = 100; - -// @public -export class StellarBatchBuilder { - constructor(config: BatchConfig); - addPayment(payment: StealthPaymentConfig): this; - build(): BuildResult; - get expectedTransactionCount(): number; - get operationCount(): number; - get paymentCount(): number; - validateBalance(balanceXlm: string): void; -} - -// @public (undocumented) -export interface StellarChainDeployment { - contracts: { - announcer: string; - announcerV2?: string; - names: string; - }; - horizonUrl: string; - network: string; - networkPassphrase: string; - sorobanUrl: string; -} - -// @public -export interface StellarStealthSigner { - signMessage(message: Uint8Array): Promise; -} - -// @public -export interface StrictReceivePathResult { - path: Asset[]; - sourceAmount: string; -} - -// @public -export interface SwapAndStealthResult { - stealthResult: GeneratedStealthAddress; - transaction: ReturnType; -} - -// @public -export const TEXT_MEMO_MAX_BYTES = 28; - -// @public -export interface TypedMemo { - type: MemoType; - value: MemoValue; -} - -// @public -export const VIEW_TAG_BUCKET_COUNT = 256; - -// @public -export function viewTagToBucket(viewTag: number): number; - -// @public -export interface WebAuthnCredentialsContainer { - // (undocumented) - get(options: Record): Promise; -} - -// @public -export class WebAuthnPasskeyStealthSigner implements StellarStealthSigner { - constructor(options: WebAuthnPasskeyStealthSignerOptions); - // (undocumented) - signMessage(message: Uint8Array): Promise; -} - -// @public -export interface WebAuthnPasskeyStealthSignerOptions { - credentialId: Uint8Array; - credentials?: WebAuthnCredentialsContainer; - rpId?: string; -} - -// @public -export interface WebAuthnPRFAssertion { - // (undocumented) - getClientExtensionResults(): { - prf?: { - results?: { - first?: ArrayBuffer; - second?: ArrayBuffer; - }; - }; - }; -} - -// (No @packageDocumentation comment for this package) - -``` +## API Report File for "@wraith-protocol/sdk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { Asset } from '@stellar/stellar-sdk'; +import { ExtPointType } from '@noble/curves/abstract/edwards'; +import { Horizon } from '@stellar/stellar-sdk'; +import { Keypair } from '@stellar/stellar-sdk'; +import { Memo } from '@stellar/stellar-sdk'; +import { Operation } from '@stellar/stellar-sdk'; +import * as _stellar_stellar_sdk from '@stellar/stellar-sdk'; +import { Transaction } from '@stellar/stellar-sdk'; +import { TransactionBuilder } from '@stellar/stellar-sdk'; +import { xdr } from '@stellar/stellar-sdk'; + +// @public +export function addStealthMultisigSigner(tx: Transaction, signerKey: Keypair | string): Transaction; + +// @public +export const ANNOUNCE_EVENT_SYMBOL = "announce"; + +// @public +export interface Announcement { + caller: string; + ephemeralPubKey: string; + ledger?: number; + // Warning: (ae-forgotten-export) The symbol "StellarMemo" needs to be exported by the entry point index.d.ts + memo?: StellarMemo; + metadata: string; + schemeId: number; + stealthAddress: string; + viewTagBucket?: number; +} + +// @public (undocumented) +export interface AnnouncementCache { + clear(network: Network): Promise; + get(network: Network, fromLedger: number, toLedger: number): Promise; + getLastSeen(network: Network): Promise<{ + ledger: number; + cursor: string; + } | null>; + put(network: Network, announcements: Announcement[]): Promise; + setLastSeen(network: Network, ledger: number, cursor: string): Promise; +} + +// @public +export function assertViewTagBucket(bucket: number): void; + +// @public +export interface AssetMetadata { + decimals: number; + name: string; + symbol: string; +} + +// @public +export interface AssetReceivabilityResult { + hasTrustline: boolean; + issuerAuthRequired: boolean; + ops: ReturnType[]; +} + +// @public +export function autoSelectCache(): AnnouncementCache; + +// @public (undocumented) +export interface BatchConfig { + feePerOp?: number; + networkPassphrase: string; + sequence: string; + source: string; + timeout?: number; +} + +// @public +export function buildAnnouncementData(stealthAddresses: GeneratedStealthAddress[], caller: string): Array<{ + schemeId: number; + stealthAddress: string; + caller: string; + ephemeralPubKey: string; + metadata: string; +}>; + +// @public +export interface BuildAnnouncementOptions { + announcerContract: string; + fee?: string; + networkPassphrase: string; + sender: string; + sequence: string; + stealthResult: GeneratedStealthAddress; +} + +// @public +export function buildBatchSendTx(params: BuildBatchSendTxParams): BuildBatchSendTxResult; + +// @public +export interface BuildBatchSendTxParams { + baseFee?: number; + batchSenderContract?: string; + batchSenderThreshold?: number; + maxOperations?: number; + memo?: string; + networkPassphrase: string; + payments: StealthPayment[]; + sourceAccount: any; +} + +// @public +export interface BuildBatchSendTxResult { + stealthAddresses: GeneratedStealthAddress[]; + totalFee: number; + transaction: any; + usedBatchSender: boolean; +} + +// @public +export function buildMultisigStealthWithdraw(options: BuildMultisigStealthWithdrawOptions): Promise; + +// @public (undocumented) +export interface BuildMultisigStealthWithdrawOptions { + account?: Pick; + destination: string; + fee?: string; + horizonUrl?: string; + networkPassphrase: string; + requiredWeight?: number; + sequence?: string; + // Warning: (ae-forgotten-export) The symbol "WeightedSigner" needs to be exported by the entry point index.d.ts + signers: Array; + stealthAddress: string; + timeout?: number; +} + +// @public +export function buildPathStealthPayment(options: BuildPathStealthPaymentOptions): PathStealthPaymentResult; + +// @public +export interface BuildPathStealthPaymentOptions { + announcerContract: string; + destAmount: string; + _ephemeralSeed?: Uint8Array; + fee?: string; + networkPassphrase: string; + path?: Asset[]; + receiveAsset: Asset; + recipientMeta: string; + sendAsset: Asset; + sender: string; + sendMax: string; + sequence: string; +} + +// @public (undocumented) +export interface BuildResult { + paymentCount: number; + totalFee: number; + transactions: string[]; + txCount: number; +} + +// @public +export function buildStealthAnnouncement(options: BuildAnnouncementOptions): _stellar_stellar_sdk.Transaction<_stellar_stellar_sdk.Memo<_stellar_stellar_sdk.MemoType>, Operation[]>; + +// @public +export function buildStealthPayment(options: BuildStealthPaymentOptions): _stellar_stellar_sdk.Transaction<_stellar_stellar_sdk.Memo<_stellar_stellar_sdk.MemoType>, Operation[]>; + +// @public +export interface BuildStealthPaymentOptions { + amount: string; + asset?: Asset; + fee?: string; + networkPassphrase: string; + sender: string; + sequence: string; + stealthExists?: boolean; + stealthResult: GeneratedStealthAddress; +} + +// @public +export function buildStellarSwapAndStealth(options: BuildStellarSwapAndStealthOptions): SwapAndStealthResult; + +// @public +export interface BuildStellarSwapAndStealthOptions { + announcerContract: string; + destAmount: string; + _ephemeralSeed?: Uint8Array; + fee?: string; + fromAsset: Asset; + networkPassphrase: string; + path?: Asset[]; + recipientMeta: string; + sender: string; + sendMax: string; + sequence: string; + toAsset: Asset; +} + +// @public +export function buildV1AnnouncerEventFilter(contractId: string): SorobanEventFilter; + +// @public +export function buildV2AllBucketsEventFilter(contractId: string): SorobanEventFilter; + +// @public +export function buildV2BucketEventFilter(contractId: string, viewTagBucket: number): SorobanEventFilter; + +// @public +export function buildV2BucketEventFilterBatches(contractId: string, viewTagBuckets: number[]): SorobanEventFilter[][]; + +// @public +export function buildWithdrawCustomAsset(options: BuildWithdrawCustomAssetOptions): _stellar_stellar_sdk.Transaction<_stellar_stellar_sdk.Memo<_stellar_stellar_sdk.MemoType>, Operation[]>; + +// @public +export interface BuildWithdrawCustomAssetOptions { + asset: Asset; + balanceId: string; + fee?: string; + needsTrustline?: boolean; + networkPassphrase: string; + sequence: string; + stealthAddress: string; +} + +// @public +export function bytesToHex(bytes: Uint8Array): string; + +// @public +export function checkStealthAddress(ephemeralPubKey: Uint8Array, viewingKey: Uint8Array, spendingPubKey: Uint8Array, viewTag: number): { + isMatch: boolean; + stealthAddress: string | null; + hashScalar: bigint | null; + stealthPubKeyBytes: Uint8Array | null; +}; + +// @public +export function clearAssetMetadataCache(): void; + +// @public +export function computeAnnouncementViewTag(ephemeralPubKey: Uint8Array, viewingPubKey: Uint8Array): number; + +// @public +export function computeSharedSecret(privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array; + +// @public @deprecated +export function computeViewTag(sharedSecret: Uint8Array): number; + +// @public (undocumented) +export function createHorizonClient(config: HorizonClientConfig): HorizonClient; + +// @public +export function decodeAnnouncementData(data: Uint8Array): { + schemeId: number; + ephemeralPubKey: Uint8Array; + viewTag: number; +}; + +// @public +export function decodeMemo(memo: Memo | xdr.Memo): TypedMemo; + +// @public +export function decodeStealthMetaAddress(metaAddress: string): StealthMetaAddress; + +// @public +export const DEFAULT_BASE_FEE = 100; + +// @public +export const DEFAULT_BATCH_SENDER_THRESHOLD = 10; + +// @public +export const DEPLOYMENTS: Record; + +// @public +export function deriveStealthKeys(signature: Uint8Array): StealthKeys; + +// @public +export function deriveStealthKeysFromSigner(signer: StellarStealthSigner): Promise; + +// @public +export function deriveStealthPrivateScalar(spendingScalar: bigint, viewingKey: Uint8Array, ephemeralPubKey: Uint8Array): bigint; + +// @public +export function deriveStealthPubKey(spendingPubKey: Uint8Array, hashScalar: bigint, spendingPoint?: ExtPointType): Uint8Array; + +// @public +export function encodeAnnouncementData(ephemeralPubKey: Uint8Array, viewTag: number): Uint8Array; + +// @public +export function encodeMemo(memo: TypedMemo): Memo; + +// @public +export function encodeStealthMetaAddress(spendingPubKey: Uint8Array, viewingPubKey: Uint8Array): string; + +// @public +export function encodeSymbolTopic(symbol: string): string; + +// @public +export function encodeU32Topic(value: number): string; + +// @public +export function extractMemoFromTransaction(tx: { + memo: Memo | xdr.Memo; +}): TypedMemo; + +// @public (undocumented) +export interface FetchAnnouncementsOptions { + cursor?: string; + fromLedger?: number; + fromTimestamp?: Date; + includeV1?: boolean; + includeV2?: boolean; + sorobanUrl?: string; + toLedger?: number; + toTimestamp?: Date; + viewTagBuckets?: number[]; +} + +// @public +export function fetchAnnouncementsStream(chain?: string, sorobanUrlOrOpts?: string | FetchAnnouncementsOptions, maybeOpts?: FetchAnnouncementsOptions): AsyncGenerator; + +// @public +export function findStrictReceivePath(options: FindStrictReceivePathOptions): Promise; + +// @public +export interface FindStrictReceivePathOptions { + chain?: string; + destAmount: string; + horizonUrl?: string; + receiveAsset: Asset; + sendAsset: Asset; +} + +// @public +export interface FreighterLikeWallet { + // (undocumented) + signMessage(message: string): Promise<{ + signedMessage: Uint8Array | string; + }>; +} + +// @public +export class FreighterStealthSigner implements StellarStealthSigner { + constructor(wallet: FreighterLikeWallet); + // (undocumented) + signMessage(message: Uint8Array): Promise; +} + +// @public +export interface GeneratedStealthAddress { + ephemeralPubKey: Uint8Array; + stealthAddress: string; + viewTag: number; +} + +// @public +export function generateStealthAddress(spendingPubKey: Uint8Array, viewingPubKey: Uint8Array, ephemeralSeed?: Uint8Array): GeneratedStealthAddress; + +// @public +export function getAssetBalance(contractId: string, address: string, network?: Network, opts?: GetAssetBalanceOptions): Promise; + +// @public +export interface GetAssetBalanceOptions { + rpcUrl?: string; +} + +// @public +export function getAssetMetadata(contractId: string, network?: Network, opts?: GetAssetMetadataOptions): Promise; + +// @public +export interface GetAssetMetadataOptions { + bypassCache?: boolean; + rpcUrl?: string; +} + +// @public +export function getDeployment(chain: string): StellarChainDeployment; + +// @public +export const HASH_MEMO_BYTES = 32; + +// @public +export function hashToScalar(sharedSecret: Uint8Array): bigint; + +// @public +export type HexString = `0x${string}`; + +// @public +export function hexToBytes(hex: string): Uint8Array; + +// @public (undocumented) +export interface HorizonClient { + get(path: string, overrides?: { + retry?: Partial; + }): Promise; + post(path: string, body: URLSearchParams | string, overrides?: { + retry?: Partial; + }): Promise; +} + +// @public (undocumented) +export interface HorizonClientConfig { + fetchImpl?: typeof fetch; + horizonUrl: string; + retry?: Partial; +} + +// @public +export const ID_MEMO_MAX: bigint; + +// @public +export class IndexedDBCache implements AnnouncementCache { + constructor(maxBytes?: number); + // (undocumented) + clear(network: Network): Promise; + // (undocumented) + get(network: Network, fromLedger: number, toLedger: number): Promise; + // (undocumented) + getLastSeen(network: Network): Promise<{ + ledger: number; + cursor: string; + } | null>; + // (undocumented) + put(network: Network, announcements: Announcement[]): Promise; + // (undocumented) + setLastSeen(network: Network, ledger: number, cursor: string): Promise; +} + +// @public +export function isStealthMultisigReady(tx: Transaction): boolean; + +// @public +export const L: bigint; + +// @public +export interface MatchedAnnouncement extends Announcement { + stealthPrivateScalar: bigint; + stealthPubKeyBytes: Uint8Array; +} + +// @public +export const MAX_RPC_EVENT_FILTERS = 5; + +// @public +export class MemoryCache implements AnnouncementCache { + constructor(maxBytes?: number); + // (undocumented) + clear(network: Network): Promise; + // (undocumented) + get(network: Network, fromLedger: number, toLedger: number): Promise; + // (undocumented) + getLastSeen(network: Network): Promise<{ + ledger: number; + cursor: string; + } | null>; + // (undocumented) + put(network: Network, announcements: Announcement[]): Promise; + // (undocumented) + setLastSeen(network: Network, ledger: number, cursor: string): Promise; +} + +// @public +export type MemoType = 'none' | 'id' | 'text' | 'hash' | 'return'; + +// @public +export class MemoValidationError extends Error { + constructor(message: string); +} + +// @public +export type MemoValue = string | Uint8Array | null; + +// @public +export const META_ADDRESS_PREFIX = "st:xlm:"; + +// @public +export type Network = 'testnet' | 'mainnet'; + +// Warning: (ae-internal-missing-underscore) The name "parseAnnouncementEvent" should be prefixed with an underscore because the declaration is marked as @internal +// +// @internal +export function parseAnnouncementEvent(event: Record): Announcement | null; + +// @public +export interface PathStealthPaymentResult { + stealthResult: GeneratedStealthAddress; + transaction: ReturnType; +} + +// @public +export function prepareStealthAccountForAsset(accountBalances: Array<{ + asset_code?: string; + asset_issuer?: string; + asset_type: string; +}>, issuerFlags: { + auth_required?: boolean; +}, asset: Asset): AssetReceivabilityResult; + +// @public +export function pubKeyToStellarAddress(pubKeyBytes: Uint8Array): string; + +// @public (undocumented) +export class RetentionExceededError extends Error { + constructor(requestedLedger: number, oldestAvailableLedger: number); + // (undocumented) + readonly oldestAvailableLedger: number; + // (undocumented) + readonly requestedLedger: number; +} + +// @public (undocumented) +export interface RetryPolicy { + baseDelayMs: number; + maxDelayMs: number; + maxRetries: number; + retryableStatuses: number[]; +} + +// @public @deprecated +export function scanAnnouncements(announcements: Announcement[], viewingKey: Uint8Array, spendingPubKey: Uint8Array, spendingScalar: bigint): MatchedAnnouncement[]; + +// @public +export function scanAnnouncementsLegacySharedSecretTag(announcements: Announcement[], viewingKey: Uint8Array, spendingPubKey: Uint8Array, spendingScalar: bigint): MatchedAnnouncement[]; + +// @public +export const SCHEME_ID = 1; + +// @public +export const SCHEME_ID_V1 = 1; + +// @public +export const SCHEME_ID_V2 = 2; + +// @public +export function seedToScalar(seed: Uint8Array): bigint; + +// @public +export function signStellarTransaction(transactionHash: Uint8Array, stealthScalar: bigint, stealthPubKey: Uint8Array): Uint8Array; + +// @public +export function signWithScalar(message: Uint8Array, scalar: bigint, publicKey: Uint8Array): Uint8Array; + +// @public +export interface SorobanEventFilter { + // (undocumented) + contractIds: string[]; + // (undocumented) + topics?: SorobanTopicMatcher[]; + // (undocumented) + type: 'contract'; +} + +// @public +export type SorobanTopicMatcher = string[]; + +// @public +export const STEALTH_SIGNING_MESSAGE = "Sign this message to generate your Wraith stealth keys.\n\nChain: Stellar\nNote: This signature is used for key derivation only and does not authorize any transaction."; + +// @public +export interface StealthKeys { + spendingKey: Uint8Array; + spendingPubKey: Uint8Array; + spendingScalar: bigint; + viewingKey: Uint8Array; + viewingPubKey: Uint8Array; + viewingScalar: bigint; +} + +// @public +export interface StealthMetaAddress { + prefix: string; + spendingPubKey: Uint8Array; + viewingPubKey: Uint8Array; +} + +// @public +export interface StealthPayment { + amount: string; + metaAddress: string; +} + +// @public (undocumented) +export interface StealthPaymentConfig { + amount: string; + asset?: string; + assetIssuer?: string; + caller?: string; + destination: string; + ephemeralPubKey: string; + viewTag: number; +} + +// @public +export const STELLAR_MAX_OPERATIONS = 100; + +// @public +export class StellarBatchBuilder { + constructor(config: BatchConfig); + addPayment(payment: StealthPaymentConfig): this; + build(): BuildResult; + get expectedTransactionCount(): number; + get operationCount(): number; + get paymentCount(): number; + validateBalance(balanceXlm: string): void; +} + +// @public (undocumented) +export interface StellarChainDeployment { + contracts: { + announcer: string; + announcerV2?: string; + names: string; + }; + horizonUrl: string; + network: string; + networkPassphrase: string; + sorobanUrl: string; +} + +// @public +export interface StellarStealthSigner { + signMessage(message: Uint8Array): Promise; +} + +// @public +export interface StrictReceivePathResult { + path: Asset[]; + sourceAmount: string; +} + +// @public +export interface SwapAndStealthResult { + stealthResult: GeneratedStealthAddress; + transaction: ReturnType; +} + +// @public +export const TEXT_MEMO_MAX_BYTES = 28; + +// @public +export interface TypedMemo { + type: MemoType; + value: MemoValue; +} + +// @public +export const VIEW_TAG_BUCKET_COUNT = 256; + +// @public +export function viewTagToBucket(viewTag: number): number; + +// @public +export interface WebAuthnCredentialsContainer { + // (undocumented) + get(options: Record): Promise; +} + +// @public +export class WebAuthnPasskeyStealthSigner implements StellarStealthSigner { + constructor(options: WebAuthnPasskeyStealthSignerOptions); + // (undocumented) + signMessage(message: Uint8Array): Promise; +} + +// @public +export interface WebAuthnPasskeyStealthSignerOptions { + credentialId: Uint8Array; + credentials?: WebAuthnCredentialsContainer; + rpId?: string; +} + +// @public +export interface WebAuthnPRFAssertion { + // (undocumented) + getClientExtensionResults(): { + prf?: { + results?: { + first?: ArrayBuffer; + second?: ArrayBuffer; + }; + }; + }; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/etc/sdk.api.md b/etc/sdk.api.md index 5d07bc0..706a09d 100644 --- a/etc/sdk.api.md +++ b/etc/sdk.api.md @@ -1,513 +1,513 @@ -## API Report File for "@wraith-protocol/sdk" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -// @public (undocumented) -export interface AgentConfig { - // (undocumented) - chain: Chain | Chain[]; - // (undocumented) - message?: string; - // (undocumented) - name: string; - // (undocumented) - signature: string; - // (undocumented) - wallet: string; -} - -// @public (undocumented) -export interface AgentInfo { - // (undocumented) - addresses: Record; - // (undocumented) - chains: Chain[]; - // (undocumented) - id: string; - // (undocumented) - metaAddresses: Record; - // (undocumented) - name: string; -} - -// @public (undocumented) -export interface Balance { - // (undocumented) - native: string; - // (undocumented) - tokens: Record; -} - -// @public (undocumented) -export enum Chain { - // (undocumented) - All = "all", - // (undocumented) - Base = "base", - // (undocumented) - Ethereum = "ethereum", - // (undocumented) - Horizen = "horizen", - // (undocumented) - Polygon = "polygon", - // (undocumented) - Solana = "solana", - // (undocumented) - Stellar = "stellar" -} - -// @public (undocumented) -export interface ChatResponse { - // (undocumented) - conversationId: string; - // (undocumented) - response: string; - // (undocumented) - toolCalls?: ToolCall[]; -} - -// @public (undocumented) -export interface CkbChainInput { - // Warning: (ae-forgotten-export) The symbol "StealthCell" needs to be exported by the entry point index.d.ts - // - // (undocumented) - source: AsyncIterable; - // (undocumented) - spendingKey: HexString; - // (undocumented) - spendingPubKey: HexString; - // Warning: (ae-forgotten-export) The symbol "HexString" needs to be exported by the entry point index.d.ts - // - // (undocumented) - viewingKey: HexString; -} - -// @public (undocumented) -export class ContractRevertError extends WraithContractError { - constructor(reason: string, txHash?: string); - // (undocumented) - readonly code = "WRAITH/CONTRACT/CONTRACT_REVERT"; - // (undocumented) - readonly reason: string; -} - -// @public (undocumented) -export interface Conversation { - // (undocumented) - createdAt: string; - // (undocumented) - id: string; - // (undocumented) - title: string; - // (undocumented) - updatedAt: string; -} - -// @public (undocumented) -export class ECDHFailedError extends WraithCryptoError { - constructor(reason: string); - // (undocumented) - readonly code = "WRAITH/CRYPTO/ECDH_FAILED"; -} - -// @public (undocumented) -export interface EvmChainInput { - // Warning: (ae-forgotten-export) The symbol "Announcement" needs to be exported by the entry point index.d.ts - // - // (undocumented) - source: AsyncIterable; - // (undocumented) - spendingKey: HexString_2; - // (undocumented) - spendingPubKey: HexString_2; - // Warning: (ae-forgotten-export) The symbol "HexString_2" needs to be exported by the entry point index.d.ts - // - // (undocumented) - viewingKey: HexString_2; -} - -// @public (undocumented) -export function installReactNativePolyfills(): void; - -// @public (undocumented) -export class InsufficientAuthError extends WraithContractError { - constructor(required?: string, actual?: string); - // (undocumented) - readonly code = "WRAITH/CONTRACT/INSUFFICIENT_AUTH"; -} - -// @public (undocumented) -export class InsufficientBalanceError extends WraithBuilderError { - constructor(required: string | bigint, actual: string | bigint, asset?: string); - // (undocumented) - readonly code = "WRAITH/BUILDER/INSUFFICIENT_BALANCE"; -} - -// @public (undocumented) -export class InvalidMetaAddressError extends WraithInputError { - constructor(metaAddress: string, reason?: string); - // (undocumented) - readonly code = "WRAITH/INPUT/INVALID_META_ADDRESS"; -} - -// @public (undocumented) -export class InvalidNameError extends WraithInputError { - constructor(name: string, reason?: string); - // (undocumented) - readonly code = "WRAITH/INPUT/INVALID_NAME"; -} - -// @public (undocumented) -export class InvalidScalarError extends WraithInputError { - constructor(scalar: string | bigint, reason?: string); - // (undocumented) - readonly code = "WRAITH/INPUT/INVALID_SCALAR"; -} - -// @public (undocumented) -export class InvalidSignatureError extends WraithInputError { - constructor(signature: string | Uint8Array, expectedLength?: number, actualLength?: number); - // (undocumented) - readonly code = "WRAITH/INPUT/INVALID_SIGNATURE"; -} - -// @public (undocumented) -export interface Invoice { - // (undocumented) - agentName: string; - // (undocumented) - amount: string; - // (undocumented) - asset: string; - // (undocumented) - createdAt: string; - // (undocumented) - id: string; - // (undocumented) - memo: string; - // (undocumented) - paymentLink: string; - // (undocumented) - status: 'pending' | 'paid'; - // (undocumented) - txHash: string | null; -} - -// @public (undocumented) -export class KeyDerivationFailedError extends WraithCryptoError { - constructor(reason: string); - // (undocumented) - readonly code = "WRAITH/CRYPTO/KEY_DERIVATION_FAILED"; -} - -// @public (undocumented) -export type MatchedAnnouncement = { - chain: 'evm'; - timestamp: number; - seq: number; - announcement: MatchedAnnouncement_2; -} | { - chain: 'stellar'; - timestamp: number; - seq: number; - announcement: MatchedAnnouncement_3; -} | { - chain: 'solana'; - timestamp: number; - seq: number; - announcement: MatchedAnnouncement_4; -} | { - chain: 'ckb'; - timestamp: number; - seq: number; - announcement: MatchedStealthCell; -}; - -// @public (undocumented) -export class NameAlreadyRegisteredError extends WraithContractError { - constructor(name: string, owner?: string); - // (undocumented) - readonly code = "WRAITH/CONTRACT/NAME_ALREADY_REGISTERED"; -} - -// @public (undocumented) -export class NameNotFoundError extends WraithContractError { - constructor(name: string); - // (undocumented) - readonly code = "WRAITH/CONTRACT/NAME_NOT_FOUND"; -} - -// @public (undocumented) -interface Notification_2 { - // (undocumented) - body: string; - // (undocumented) - createdAt: string; - // (undocumented) - id: number; - // (undocumented) - read: boolean; - // (undocumented) - title: string; - // (undocumented) - type: string; -} -export { Notification_2 as Notification } - -// @public (undocumented) -export interface Payment { - // (undocumented) - balance: string; - // (undocumented) - ephemeralPubKey: string; - // (undocumented) - stealthAddress: string; -} - -// @public (undocumented) -export interface PrivacyReport { - // (undocumented) - bestPractices: string[]; - // (undocumented) - issues: Array<{ - severity: 'info' | 'low' | 'medium' | 'high' | 'critical'; - issue: string; - recommendation: string; - }>; - // (undocumented) - score: number; -} - -// @public (undocumented) -export class RetentionExceededError extends WraithNetworkError { - constructor(limit: number, actual: number); - // (undocumented) - readonly code = "WRAITH/NETWORK/RETENTION_EXCEEDED"; -} - -// @public (undocumented) -export class RPCRequestError extends WraithNetworkError { - constructor(url: string, statusCode: number, responseText?: string); - // (undocumented) - readonly code = "WRAITH/NETWORK/RPC_REQUEST"; - // (undocumented) - readonly statusCode: number; -} - -// @public (undocumented) -export class RPCRetryExhaustedError extends WraithNetworkError { - constructor(url: string, attempts: number, lastError?: string); - // (undocumented) - readonly code = "WRAITH/NETWORK/RPC_RETRY_EXHAUSTED"; -} - -// @public (undocumented) -export function scanAll(input: ScanAllInput): AsyncGenerator; - -// @public (undocumented) -export interface ScanAllInput { - // (undocumented) - ckb?: CkbChainInput; - // (undocumented) - evm?: EvmChainInput; - // (undocumented) - solana?: SolanaChainInput; - // (undocumented) - stellar?: StellarChainInput; -} - -// @public (undocumented) -export interface Schedule { - // (undocumented) - amount: string; - // (undocumented) - asset: string; - // (undocumented) - id: string; - // (undocumented) - interval: 'daily' | 'weekly' | 'monthly'; - // (undocumented) - nextRun: string; - // (undocumented) - recipient: string; - // (undocumented) - status: 'active' | 'paused' | 'cancelled'; -} - -// @public (undocumented) -export interface SolanaChainInput { - // Warning: (ae-forgotten-export) The symbol "Announcement_3" needs to be exported by the entry point index.d.ts - // - // (undocumented) - source: AsyncIterable; - // (undocumented) - spendingPubKey: Uint8Array; - // (undocumented) - spendingScalar: bigint; - // (undocumented) - viewingKey: Uint8Array; -} - -// @public (undocumented) -export interface StellarChainInput { - // Warning: (ae-forgotten-export) The symbol "Announcement_2" needs to be exported by the entry point index.d.ts - // - // (undocumented) - source: AsyncIterable; - // (undocumented) - spendingPubKey: Uint8Array; - // (undocumented) - spendingScalar: bigint; - // (undocumented) - viewingKey: Uint8Array; -} - -// @public (undocumented) -export type SupportedChain = 'evm' | 'stellar' | 'solana' | 'ckb'; - -// @public (undocumented) -export interface ToolCall { - // (undocumented) - detail?: string; - // (undocumented) - name: string; - // (undocumented) - status: string; -} - -// @public (undocumented) -export interface TxResult { - // (undocumented) - txHash: string; - // (undocumented) - txLink: string; -} - -// @public (undocumented) -export class UnsupportedAssetError extends WraithBuilderError { - constructor(asset: string, chain?: string); - // (undocumented) - readonly code = "WRAITH/BUILDER/UNSUPPORTED_ASSET"; -} - -// @public (undocumented) -export class ViewTagMismatchError extends WraithCryptoError { - constructor(expectedTag: number, actualTag: number); - // (undocumented) - readonly code = "WRAITH/CRYPTO/VIEW_TAG_MISMATCH"; -} - -// @public (undocumented) -export class Wraith { - constructor(config: WraithConfig); - // (undocumented) - agent(agentId: string): WraithAgent; - createAgent(config: AgentConfig): Promise; - getAgentByName(name: string): Promise; - getAgentByWallet(walletAddress: string): Promise; - listAgents(): Promise; - // @internal - _request(method: string, path: string, body?: unknown): Promise; -} - -// @public (undocumented) -export class WraithAgent { - constructor(wraith: Wraith, info: AgentInfo); - // (undocumented) - chat(message: string, conversationId?: string): Promise; - // (undocumented) - clearNotifications(): Promise; - // (undocumented) - deleteConversation(conversationId: string): Promise; - // (undocumented) - exportKey(signature: string, message: string): Promise<{ - secret: string; - }>; - // (undocumented) - getBalance(): Promise; - // (undocumented) - getConversations(): Promise; - // (undocumented) - getMessages(conversationId: string): Promise>; - // (undocumented) - getNotifications(): Promise<{ - notifications: Notification_2[]; - unreadCount: number; - }>; - // (undocumented) - getStatus(): Promise; - // (undocumented) - readonly info: AgentInfo; - // (undocumented) - markNotificationsRead(): Promise; - // (undocumented) - scanPayments(): Promise; -} - -// @public (undocumented) -export abstract class WraithBuilderError extends WraithError { -} - -// @public (undocumented) -export interface WraithConfig { - // (undocumented) - ai?: { - provider: 'gemini' | 'openai' | 'claude'; - apiKey: string; - }; - // (undocumented) - apiKey: string; - // (undocumented) - baseUrl?: string; -} - -// @public (undocumented) -export abstract class WraithContractError extends WraithError { -} - -// @public (undocumented) -export abstract class WraithCryptoError extends WraithError { -} - -// @public (undocumented) -export abstract class WraithError extends Error { - constructor(message: string, context?: Record | undefined); - // (undocumented) - abstract readonly code: string; - // (undocumented) - readonly context?: Record | undefined; - // (undocumented) - readonly docsLink: string; - // (undocumented) - toJSON(): { - name: string; - message: string; - code: string; - docsLink: string; - context: Record | undefined; - }; -} - -// @public (undocumented) -export abstract class WraithInputError extends WraithError { -} - -// @public (undocumented) -export abstract class WraithNetworkError extends WraithError { -} - -// Warnings were encountered during analysis: -// -// dist/index.d.ts:207:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement_2" needs to be exported by the entry point index.d.ts -// dist/index.d.ts:212:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement_3" needs to be exported by the entry point index.d.ts -// dist/index.d.ts:217:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement_4" needs to be exported by the entry point index.d.ts -// dist/index.d.ts:222:5 - (ae-forgotten-export) The symbol "MatchedStealthCell" needs to be exported by the entry point index.d.ts - -// (No @packageDocumentation comment for this package) - -``` +## API Report File for "@wraith-protocol/sdk" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public (undocumented) +export interface AgentConfig { + // (undocumented) + chain: Chain | Chain[]; + // (undocumented) + message?: string; + // (undocumented) + name: string; + // (undocumented) + signature: string; + // (undocumented) + wallet: string; +} + +// @public (undocumented) +export interface AgentInfo { + // (undocumented) + addresses: Record; + // (undocumented) + chains: Chain[]; + // (undocumented) + id: string; + // (undocumented) + metaAddresses: Record; + // (undocumented) + name: string; +} + +// @public (undocumented) +export interface Balance { + // (undocumented) + native: string; + // (undocumented) + tokens: Record; +} + +// @public (undocumented) +export enum Chain { + // (undocumented) + All = "all", + // (undocumented) + Base = "base", + // (undocumented) + Ethereum = "ethereum", + // (undocumented) + Horizen = "horizen", + // (undocumented) + Polygon = "polygon", + // (undocumented) + Solana = "solana", + // (undocumented) + Stellar = "stellar" +} + +// @public (undocumented) +export interface ChatResponse { + // (undocumented) + conversationId: string; + // (undocumented) + response: string; + // (undocumented) + toolCalls?: ToolCall[]; +} + +// @public (undocumented) +export interface CkbChainInput { + // Warning: (ae-forgotten-export) The symbol "StealthCell" needs to be exported by the entry point index.d.ts + // + // (undocumented) + source: AsyncIterable; + // (undocumented) + spendingKey: HexString; + // (undocumented) + spendingPubKey: HexString; + // Warning: (ae-forgotten-export) The symbol "HexString" needs to be exported by the entry point index.d.ts + // + // (undocumented) + viewingKey: HexString; +} + +// @public (undocumented) +export class ContractRevertError extends WraithContractError { + constructor(reason: string, txHash?: string); + // (undocumented) + readonly code = "WRAITH/CONTRACT/CONTRACT_REVERT"; + // (undocumented) + readonly reason: string; +} + +// @public (undocumented) +export interface Conversation { + // (undocumented) + createdAt: string; + // (undocumented) + id: string; + // (undocumented) + title: string; + // (undocumented) + updatedAt: string; +} + +// @public (undocumented) +export class ECDHFailedError extends WraithCryptoError { + constructor(reason: string); + // (undocumented) + readonly code = "WRAITH/CRYPTO/ECDH_FAILED"; +} + +// @public (undocumented) +export interface EvmChainInput { + // Warning: (ae-forgotten-export) The symbol "Announcement" needs to be exported by the entry point index.d.ts + // + // (undocumented) + source: AsyncIterable; + // (undocumented) + spendingKey: HexString_2; + // (undocumented) + spendingPubKey: HexString_2; + // Warning: (ae-forgotten-export) The symbol "HexString_2" needs to be exported by the entry point index.d.ts + // + // (undocumented) + viewingKey: HexString_2; +} + +// @public (undocumented) +export function installReactNativePolyfills(): void; + +// @public (undocumented) +export class InsufficientAuthError extends WraithContractError { + constructor(required?: string, actual?: string); + // (undocumented) + readonly code = "WRAITH/CONTRACT/INSUFFICIENT_AUTH"; +} + +// @public (undocumented) +export class InsufficientBalanceError extends WraithBuilderError { + constructor(required: string | bigint, actual: string | bigint, asset?: string); + // (undocumented) + readonly code = "WRAITH/BUILDER/INSUFFICIENT_BALANCE"; +} + +// @public (undocumented) +export class InvalidMetaAddressError extends WraithInputError { + constructor(metaAddress: string, reason?: string); + // (undocumented) + readonly code = "WRAITH/INPUT/INVALID_META_ADDRESS"; +} + +// @public (undocumented) +export class InvalidNameError extends WraithInputError { + constructor(name: string, reason?: string); + // (undocumented) + readonly code = "WRAITH/INPUT/INVALID_NAME"; +} + +// @public (undocumented) +export class InvalidScalarError extends WraithInputError { + constructor(scalar: string | bigint, reason?: string); + // (undocumented) + readonly code = "WRAITH/INPUT/INVALID_SCALAR"; +} + +// @public (undocumented) +export class InvalidSignatureError extends WraithInputError { + constructor(signature: string | Uint8Array, expectedLength?: number, actualLength?: number); + // (undocumented) + readonly code = "WRAITH/INPUT/INVALID_SIGNATURE"; +} + +// @public (undocumented) +export interface Invoice { + // (undocumented) + agentName: string; + // (undocumented) + amount: string; + // (undocumented) + asset: string; + // (undocumented) + createdAt: string; + // (undocumented) + id: string; + // (undocumented) + memo: string; + // (undocumented) + paymentLink: string; + // (undocumented) + status: 'pending' | 'paid'; + // (undocumented) + txHash: string | null; +} + +// @public (undocumented) +export class KeyDerivationFailedError extends WraithCryptoError { + constructor(reason: string); + // (undocumented) + readonly code = "WRAITH/CRYPTO/KEY_DERIVATION_FAILED"; +} + +// @public (undocumented) +export type MatchedAnnouncement = { + chain: 'evm'; + timestamp: number; + seq: number; + announcement: MatchedAnnouncement_2; +} | { + chain: 'stellar'; + timestamp: number; + seq: number; + announcement: MatchedAnnouncement_3; +} | { + chain: 'solana'; + timestamp: number; + seq: number; + announcement: MatchedAnnouncement_4; +} | { + chain: 'ckb'; + timestamp: number; + seq: number; + announcement: MatchedStealthCell; +}; + +// @public (undocumented) +export class NameAlreadyRegisteredError extends WraithContractError { + constructor(name: string, owner?: string); + // (undocumented) + readonly code = "WRAITH/CONTRACT/NAME_ALREADY_REGISTERED"; +} + +// @public (undocumented) +export class NameNotFoundError extends WraithContractError { + constructor(name: string); + // (undocumented) + readonly code = "WRAITH/CONTRACT/NAME_NOT_FOUND"; +} + +// @public (undocumented) +interface Notification_2 { + // (undocumented) + body: string; + // (undocumented) + createdAt: string; + // (undocumented) + id: number; + // (undocumented) + read: boolean; + // (undocumented) + title: string; + // (undocumented) + type: string; +} +export { Notification_2 as Notification } + +// @public (undocumented) +export interface Payment { + // (undocumented) + balance: string; + // (undocumented) + ephemeralPubKey: string; + // (undocumented) + stealthAddress: string; +} + +// @public (undocumented) +export interface PrivacyReport { + // (undocumented) + bestPractices: string[]; + // (undocumented) + issues: Array<{ + severity: 'info' | 'low' | 'medium' | 'high' | 'critical'; + issue: string; + recommendation: string; + }>; + // (undocumented) + score: number; +} + +// @public (undocumented) +export class RetentionExceededError extends WraithNetworkError { + constructor(limit: number, actual: number); + // (undocumented) + readonly code = "WRAITH/NETWORK/RETENTION_EXCEEDED"; +} + +// @public (undocumented) +export class RPCRequestError extends WraithNetworkError { + constructor(url: string, statusCode: number, responseText?: string); + // (undocumented) + readonly code = "WRAITH/NETWORK/RPC_REQUEST"; + // (undocumented) + readonly statusCode: number; +} + +// @public (undocumented) +export class RPCRetryExhaustedError extends WraithNetworkError { + constructor(url: string, attempts: number, lastError?: string); + // (undocumented) + readonly code = "WRAITH/NETWORK/RPC_RETRY_EXHAUSTED"; +} + +// @public (undocumented) +export function scanAll(input: ScanAllInput): AsyncGenerator; + +// @public (undocumented) +export interface ScanAllInput { + // (undocumented) + ckb?: CkbChainInput; + // (undocumented) + evm?: EvmChainInput; + // (undocumented) + solana?: SolanaChainInput; + // (undocumented) + stellar?: StellarChainInput; +} + +// @public (undocumented) +export interface Schedule { + // (undocumented) + amount: string; + // (undocumented) + asset: string; + // (undocumented) + id: string; + // (undocumented) + interval: 'daily' | 'weekly' | 'monthly'; + // (undocumented) + nextRun: string; + // (undocumented) + recipient: string; + // (undocumented) + status: 'active' | 'paused' | 'cancelled'; +} + +// @public (undocumented) +export interface SolanaChainInput { + // Warning: (ae-forgotten-export) The symbol "Announcement_3" needs to be exported by the entry point index.d.ts + // + // (undocumented) + source: AsyncIterable; + // (undocumented) + spendingPubKey: Uint8Array; + // (undocumented) + spendingScalar: bigint; + // (undocumented) + viewingKey: Uint8Array; +} + +// @public (undocumented) +export interface StellarChainInput { + // Warning: (ae-forgotten-export) The symbol "Announcement_2" needs to be exported by the entry point index.d.ts + // + // (undocumented) + source: AsyncIterable; + // (undocumented) + spendingPubKey: Uint8Array; + // (undocumented) + spendingScalar: bigint; + // (undocumented) + viewingKey: Uint8Array; +} + +// @public (undocumented) +export type SupportedChain = 'evm' | 'stellar' | 'solana' | 'ckb'; + +// @public (undocumented) +export interface ToolCall { + // (undocumented) + detail?: string; + // (undocumented) + name: string; + // (undocumented) + status: string; +} + +// @public (undocumented) +export interface TxResult { + // (undocumented) + txHash: string; + // (undocumented) + txLink: string; +} + +// @public (undocumented) +export class UnsupportedAssetError extends WraithBuilderError { + constructor(asset: string, chain?: string); + // (undocumented) + readonly code = "WRAITH/BUILDER/UNSUPPORTED_ASSET"; +} + +// @public (undocumented) +export class ViewTagMismatchError extends WraithCryptoError { + constructor(expectedTag: number, actualTag: number); + // (undocumented) + readonly code = "WRAITH/CRYPTO/VIEW_TAG_MISMATCH"; +} + +// @public (undocumented) +export class Wraith { + constructor(config: WraithConfig); + // (undocumented) + agent(agentId: string): WraithAgent; + createAgent(config: AgentConfig): Promise; + getAgentByName(name: string): Promise; + getAgentByWallet(walletAddress: string): Promise; + listAgents(): Promise; + // @internal + _request(method: string, path: string, body?: unknown): Promise; +} + +// @public (undocumented) +export class WraithAgent { + constructor(wraith: Wraith, info: AgentInfo); + // (undocumented) + chat(message: string, conversationId?: string): Promise; + // (undocumented) + clearNotifications(): Promise; + // (undocumented) + deleteConversation(conversationId: string): Promise; + // (undocumented) + exportKey(signature: string, message: string): Promise<{ + secret: string; + }>; + // (undocumented) + getBalance(): Promise; + // (undocumented) + getConversations(): Promise; + // (undocumented) + getMessages(conversationId: string): Promise>; + // (undocumented) + getNotifications(): Promise<{ + notifications: Notification_2[]; + unreadCount: number; + }>; + // (undocumented) + getStatus(): Promise; + // (undocumented) + readonly info: AgentInfo; + // (undocumented) + markNotificationsRead(): Promise; + // (undocumented) + scanPayments(): Promise; +} + +// @public (undocumented) +export abstract class WraithBuilderError extends WraithError { +} + +// @public (undocumented) +export interface WraithConfig { + // (undocumented) + ai?: { + provider: 'gemini' | 'openai' | 'claude'; + apiKey: string; + }; + // (undocumented) + apiKey: string; + // (undocumented) + baseUrl?: string; +} + +// @public (undocumented) +export abstract class WraithContractError extends WraithError { +} + +// @public (undocumented) +export abstract class WraithCryptoError extends WraithError { +} + +// @public (undocumented) +export abstract class WraithError extends Error { + constructor(message: string, context?: Record | undefined); + // (undocumented) + abstract readonly code: string; + // (undocumented) + readonly context?: Record | undefined; + // (undocumented) + readonly docsLink: string; + // (undocumented) + toJSON(): { + name: string; + message: string; + code: string; + docsLink: string; + context: Record | undefined; + }; +} + +// @public (undocumented) +export abstract class WraithInputError extends WraithError { +} + +// @public (undocumented) +export abstract class WraithNetworkError extends WraithError { +} + +// Warnings were encountered during analysis: +// +// dist/index.d.ts:207:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement_2" needs to be exported by the entry point index.d.ts +// dist/index.d.ts:212:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement_3" needs to be exported by the entry point index.d.ts +// dist/index.d.ts:217:5 - (ae-forgotten-export) The symbol "MatchedAnnouncement_4" needs to be exported by the entry point index.d.ts +// dist/index.d.ts:222:5 - (ae-forgotten-export) The symbol "MatchedStealthCell" needs to be exported by the entry point index.d.ts + +// (No @packageDocumentation comment for this package) + +``` diff --git a/src/chains/stellar/scalar.ts b/src/chains/stellar/scalar.ts index 8976a02..752c4ec 100644 --- a/src/chains/stellar/scalar.ts +++ b/src/chains/stellar/scalar.ts @@ -1,4 +1,5 @@ import { ed25519 } from '@noble/curves/ed25519'; +import type { ExtPointType } from '@noble/curves/abstract/edwards'; import { sha512 } from '@noble/hashes/sha512'; import { sha256 } from '@noble/hashes/sha256'; @@ -120,8 +121,12 @@ export function scalarToBytes(scalar: bigint): Uint8Array { * * @see {@link pubKeyToStellarAddress} */ -export function deriveStealthPubKey(spendingPubKey: Uint8Array, hashScalar: bigint): Uint8Array { - const K_spend = ed25519.ExtendedPoint.fromHex(spendingPubKey); +export function deriveStealthPubKey( + spendingPubKey: Uint8Array, + hashScalar: bigint, + spendingPoint?: ExtPointType, +): Uint8Array { + const K_spend = spendingPoint ?? ed25519.ExtendedPoint.fromHex(spendingPubKey); const hashPoint = ed25519.ExtendedPoint.BASE.multiply(hashScalar); const stealthPoint = K_spend.add(hashPoint); return stealthPoint.toRawBytes(); diff --git a/src/chains/stellar/scan.ts b/src/chains/stellar/scan.ts index 53df21b..4712bff 100644 --- a/src/chains/stellar/scan.ts +++ b/src/chains/stellar/scan.ts @@ -1,4 +1,5 @@ import { ed25519 } from '@noble/curves/ed25519'; +import type { ExtPointType } from '@noble/curves/abstract/edwards'; import { computeAnnouncementViewTag, computeSharedSecret, computeViewTag } from './stealth'; import { hashToScalar, deriveStealthPubKey, pubKeyToStellarAddress, L } from './scalar'; import { SCHEME_ID, SCHEME_ID_V2 } from './constants'; @@ -6,6 +7,46 @@ import type { Announcement, MatchedAnnouncement } from './types'; import { hexToBytes } from './utils'; import { pipeline } from './scanner/pipeline'; +const HEX_TO_BYTE = (() => { + const table = new Uint8Array(256).fill(255); + const lower = '0123456789abcdef'; + const upper = '0123456789ABCDEF'; + for (let i = 0; i < 16; i++) { + table[lower.charCodeAt(i)] = i; + table[upper.charCodeAt(i)] = i; + } + return table; +})(); + +function readViewTag(metadata: string): number | null { + const clean = metadata.startsWith('0x') ? metadata.slice(2) : metadata; + if (clean.length < 2) return null; + + const hi = HEX_TO_BYTE[clean.charCodeAt(0)]; + const lo = HEX_TO_BYTE[clean.charCodeAt(1)]; + if (hi === 255 || lo === 255) return null; + + return (hi << 4) | lo; +} + +function decodeHexToBuffer(hex: string, output: Uint8Array): Uint8Array | null { + const clean = hex.startsWith('0x') ? hex.slice(2) : hex; + if ((clean.length & 1) !== 0) return null; + + const byteCount = clean.length / 2; + if (byteCount > output.length) return null; + + let outOffset = 0; + for (let i = 0; i < clean.length; i += 2) { + const hi = HEX_TO_BYTE[clean.charCodeAt(i)]; + const lo = HEX_TO_BYTE[clean.charCodeAt(i + 1)]; + if (hi === 255 || lo === 255) return null; + output[outOffset++] = (hi << 4) | lo; + } + + return output.subarray(0, outOffset); +} + /** * Streaming announcement scanner. Pipelines `source` through a bounded queue * of size `opts.window` (default 64) so fetching stays ahead of decryption, @@ -105,8 +146,16 @@ export async function* scanAnnouncementsStreamSequential( const windowSize = Math.max(1, opts.window ?? 64); const viewingPubKey = ed25519.getPublicKey(viewingKey); const iter = source[Symbol.asyncIterator](); + const ephemeralBuffer = new Uint8Array(32); + let spendingPoint: ExtPointType | undefined; try { + try { + spendingPoint = ed25519.ExtendedPoint.fromHex(spendingPubKey); + } catch { + spendingPoint = undefined; + } + while (true) { const batch: Announcement[] = []; for (let i = 0; i < windowSize; i++) { @@ -120,12 +169,11 @@ export async function* scanAnnouncementsStreamSequential( for (const ann of batch) { if (ann.schemeId !== SCHEME_ID && ann.schemeId !== SCHEME_ID_V2) continue; - const metadataBytes = hexToBytes(ann.metadata); - if (metadataBytes.length === 0) continue; - const viewTag = metadataBytes[0]; + const viewTag = readViewTag(ann.metadata); + if (viewTag === null) continue; - const ephPubKey = hexToBytes(ann.ephemeralPubKey); - if (ephPubKey.length !== 32) continue; + const ephPubKey = decodeHexToBuffer(ann.ephemeralPubKey, ephemeralBuffer); + if (!ephPubKey || ephPubKey.length !== 32 || !spendingPoint) continue; const result = checkStealthAddressWithViewingPubKey( ephPubKey, @@ -197,12 +245,14 @@ export function checkStealthAddress( stealthPubKeyBytes: Uint8Array | null; } { const viewingPubKey = ed25519.getPublicKey(viewingKey); + const spendingPoint = ed25519.ExtendedPoint.fromHex(spendingPubKey); return checkStealthAddressWithViewingPubKey( ephemeralPubKey, viewingKey, viewingPubKey, spendingPubKey, viewTag, + spendingPoint, ); } @@ -212,6 +262,7 @@ function checkStealthAddressWithViewingPubKey( viewingPubKey: Uint8Array, spendingPubKey: Uint8Array, viewTag: number, + spendingPoint?: ExtPointType, ): { isMatch: boolean; stealthAddress: string | null; @@ -224,7 +275,12 @@ function checkStealthAddressWithViewingPubKey( } try { - return deriveStealthAddressFromAnnouncement(ephemeralPubKey, viewingKey, spendingPubKey); + return deriveStealthAddressFromAnnouncement( + ephemeralPubKey, + viewingKey, + spendingPubKey, + spendingPoint, + ); } catch { return { isMatch: false, stealthAddress: null, hashScalar: null, stealthPubKeyBytes: null }; } @@ -234,6 +290,7 @@ function deriveStealthAddressFromAnnouncement( ephemeralPubKey: Uint8Array, viewingKey: Uint8Array, spendingPubKey: Uint8Array, + spendingPoint?: ExtPointType, ): { isMatch: boolean; stealthAddress: string | null; @@ -243,7 +300,7 @@ function deriveStealthAddressFromAnnouncement( const sharedSecret = computeSharedSecret(viewingKey, ephemeralPubKey); const hScalar = hashToScalar(sharedSecret); - const stealthPubKeyBytes = deriveStealthPubKey(spendingPubKey, hScalar); + const stealthPubKeyBytes = deriveStealthPubKey(spendingPubKey, hScalar, spendingPoint); const stealthAddress = pubKeyToStellarAddress(stealthPubKeyBytes); return { isMatch: true, stealthAddress, hashScalar: hScalar, stealthPubKeyBytes }; @@ -290,16 +347,24 @@ export function scanAnnouncements( ): MatchedAnnouncement[] { const matched: MatchedAnnouncement[] = []; const viewingPubKey = ed25519.getPublicKey(viewingKey); + const ephemeralBuffer = new Uint8Array(32); + let spendingPoint: ExtPointType | undefined; - for (const ann of announcements) { + try { + spendingPoint = ed25519.ExtendedPoint.fromHex(spendingPubKey); + } catch { + spendingPoint = undefined; + } + + for (let i = 0, len = announcements.length; i < len; i++) { + const ann = announcements[i]; if (ann.schemeId !== SCHEME_ID && ann.schemeId !== SCHEME_ID_V2) continue; - const metadataBytes = hexToBytes(ann.metadata); - if (metadataBytes.length === 0) continue; - const viewTag = metadataBytes[0]; + const viewTag = readViewTag(ann.metadata); + if (viewTag === null) continue; - const ephPubKey = hexToBytes(ann.ephemeralPubKey); - if (ephPubKey.length !== 32) continue; + const ephPubKey = decodeHexToBuffer(ann.ephemeralPubKey, ephemeralBuffer); + if (!ephPubKey || ephPubKey.length !== 32 || !spendingPoint) continue; const result = checkStealthAddressWithViewingPubKey( ephPubKey, @@ -307,6 +372,7 @@ export function scanAnnouncements( viewingPubKey, spendingPubKey, viewTag, + spendingPoint, ); if ( diff --git a/test/chains/stellar/bench/scan.bench.ts b/test/chains/stellar/bench/scan.bench.ts index af93c72..5b379d2 100644 --- a/test/chains/stellar/bench/scan.bench.ts +++ b/test/chains/stellar/bench/scan.bench.ts @@ -18,7 +18,7 @@ import type { Announcement, StealthKeys } from '../../../../src/chains/stellar/t const MATCH_INDEX = 997; const POOL_SIZE = 512; -const DEFAULT_DATASET_SIZES = [10_000, 100_000, 1_000_000] as const; +const DEFAULT_DATASET_SIZES = [10_000, 100_000] as const; const DATASET_SIZES = ( process.env.STELLAR_SCAN_BENCH_SIZES?.split(',').map(Number) ?? [...DEFAULT_DATASET_SIZES] ).filter((size) => Number.isFinite(size) && size > 0);