Optionalconfigs: { Â Â Â Â signerFilter?: ((signerInfo: SignerInfo, wallet: Wallet) => Promise<boolean>); Â Â Â Â preferredNetworks?: NetworkPreference[]; Â Â Â Â name?: string; Â Â Â Â icon?: string; }
Invoked when the component is added to the document's DOM.
+
In connectedCallback() you should setup tasks that should only occur when
+the element is connected to the document. The most common of these is
+adding event listeners to nodes external to the element, like a keydown
+event handler added to the window.
Typically, anything done in connectedCallback() should be undone when the
+element is disconnected, in disconnectedCallback().
+
Returns void
rendering
render
render(): TemplateResult<1>
Invoked on each update to perform rendering tasks. This method may return
+any value renderable by lit-html's ChildPart - typically a
+TemplateResult. Setting properties inside this method will not trigger
+the element to update.
+
Returns TemplateResult<1>
styles
Staticstyles
styles:CSSResult = ...
Array of styles to apply to the element. The styles should be defined
+using the css tag function, via constructible stylesheets, or
+imported from native CSS module scripts.
+
Note on Content Security Policy:
+
Element styles are implemented with <style> tags when the browser doesn't
+support adopted StyleSheets. To use such <style> tags with the style-src
+CSP directive, the style-src value must either include 'unsafe-inline' or
+nonce-<base64-value> with <base64-value> replaced be a server-generated
+nonce.
+
To provide a nonce to use on generated <style> elements, set
+window.litNonce to a server-generated nonce in your page's HTML, before
+loading application code:
+
<script> // Generated and unique per request: window.litNonce='a1b2c3d4'; </script>
+
+
+
Nocollapse
updates
willUpdate
willUpdate(changedProperties): void
Invoked before update() to compute values needed during the update.
+
Implement willUpdate to compute property values that depend on other
+properties and are used in the rest of the update process.
+
willUpdate(changedProperties) { // only need to check changed properties for an expensive computation. if (changedProperties.has('firstName') || changedProperties.has('lastName')) { this.sha = computeSHA(`${this.firstName}${this.lastName}`); } }
__namedParameters: { Â Â Â Â last_cursor: string; Â Â Â Â objects: { Â Â Â Â Â Â Â Â out_point: JsonRpcOutPoint; Â Â Â Â Â Â Â Â output: JsonRpcCellOutput; Â Â Â Â Â Â Â Â output_data?: `0x${string}`; Â Â Â Â }[]; }
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByLock
findTransactionsByLock(lock, type, groupByTransaction, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByLock(lock, type?, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactionsByLock(lock, type?, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByType
findTransactionsByType(type, groupByTransaction, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByType(type, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactionsByType(type, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
An abstract class implementing JSON-RPC client functionality for a specific URL and timeout.
+Provides methods for sending transactions and building JSON-RPC payloads.
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByLock
findTransactionsByLock(lock, type, groupByTransaction, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByLock(lock, type?, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactionsByLock(lock, type?, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByType
findTransactionsByType(type, groupByTransaction, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByType(type, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactionsByType(type, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
An abstract class implementing JSON-RPC client functionality for a specific URL and timeout.
+Provides methods for sending transactions and building JSON-RPC payloads.
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByLock
findTransactionsByLock(lock, type, groupByTransaction, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByLock(lock, type?, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactionsByLock(lock, type?, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByType
findTransactionsByType(type, groupByTransaction, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByType(type, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactionsByType(type, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
An abstract class implementing JSON-RPC client functionality for a specific URL and timeout.
+Provides methods for sending transactions and building JSON-RPC payloads.
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactions(key, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByLock
findTransactionsByLock(lock, type, groupByTransaction, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByLock(lock, type?, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactionsByLock(lock, type?, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByType
findTransactionsByType(type, groupByTransaction, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
findTransactionsByType(type, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; }, any, unknown>
findTransactionsByType(type, groupByTransaction?, order?, limit?): AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
Returns AsyncGenerator<{ Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â isInput: boolean; Â Â Â Â cellIndex: bigint; } | { Â Â Â Â txHash: `0x${string}`; Â Â Â Â blockNumber: bigint; Â Â Â Â txIndex: bigint; Â Â Â Â cells: { Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: bigint; Â Â Â Â }[]; }, any, unknown>
An abstract class extending the Signer class for Bitcoin-like signing operations.
+This class provides methods to get Bitcoin account, public key, and internal address,
+as well as signing transactions.
An abstract class extending Signer for Ethereum Virtual Machine (EVM) based signing operations.
+This class provides methods to get EVM account, internal address, and signing transactions.
_signPersonalEvmForTransaction(tx, script, messageTransformer, hasher?): Promise<undefined | { Â Â Â Â signature: Uint8Array; Â Â Â Â position: number; }>
_signPersonalEvmForTransaction(tx, script, messageTransformer, hasher?): Promise<undefined | { Â Â Â Â signature: Uint8Array; Â Â Â Â position: number; }>
CKB_UNLOCK_EVENT_CONTENT:string = "Signing a CKB transaction\n\nIMPORTANT: Please verify the integrity and authenticity of connected Nostr client before signing this message\n"
An abstract class extending the Signer class for Bitcoin-like signing operations.
+This class provides methods to get Bitcoin account, public key, and internal address,
+as well as signing transactions.
props: Omit<HTMLAttributes<WebComponentConnector>, Â Â Â Â | "onWillUpdate" Â Â Â Â | "onClose" Â Â Â Â | "willUpdate" Â Â Â Â | "name" Â Â Â Â | "icon" Â Â Â Â | "signerFilter" Â Â Â Â | "preferredNetworks" Â Â Â Â | "client" Â Â Â Â | "requestUpdate" Â Â Â Â | "disconnect" Â Â Â Â | "setClient" Â Â Â Â | "wallet" Â Â Â Â | "signer" Â Â Â Â | "connectedCallback" Â Â Â Â | "refreshSigner" Â Â Â Â | "updateSigner" Â Â Â Â | "render" Â Â Â Â | "updated" Â Â Â Â | "renderOptions" Â Â Â Â | "disconnectedCallback" Â Â Â Â | "renderRoot" Â Â Â Â | "isUpdatePending" Â Â Â Â | "hasUpdated" Â Â Â Â | "addController" Â Â Â Â | "removeController" Â Â Â Â | "attributeChangedCallback" Â Â Â Â | "updateComplete"> & EventListeners<{ Â Â Â Â onWillUpdate: string; Â Â Â Â onClose: string; }> & Partial<Omit<WebComponentConnector, keyof HTMLElement>> & RefAttributes<WebComponentConnector>
__namedParameters: { Â Â Â Â children: ReactNode; Â Â Â Â connectorProps?: HTMLAttributes<{}>; Â Â Â Â name?: string; Â Â Â Â icon?: string; Â Â Â Â signerFilter?: ((signerInfo: SignerInfo, wallet: Wallet) => Promise<boolean>); Â Â Â Â defaultClient?: Client; Â Â Â Â preferredNetworks?: NetworkPreference[]; }
useCcc(): { Â Â Â Â open: (() => unknown); Â Â Â Â disconnect: (() => unknown); Â Â Â Â setClient: ((client: Client) => unknown); Â Â Â Â client: Client; Â Â Â Â wallet?: Wallet; Â Â Â Â signerInfo?: SignerInfo; }
Returns { Â Â Â Â open: (() => unknown); Â Â Â Â disconnect: (() => unknown); Â Â Â Â setClient: ((client: Client) => unknown); Â Â Â Â client: Client; Â Â Â Â wallet?: Wallet; Â Â Â Â signerInfo?: SignerInfo; }
keystoreEncrypt(privateKeyLike, chainCodeLike, password): Promise<{ Â Â Â Â id: string; Â Â Â Â crypto: { Â Â Â Â Â Â Â Â ciphertext: string; Â Â Â Â Â Â Â Â cipherparams: { Â Â Â Â Â Â Â Â Â Â Â Â iv: string; Â Â Â Â Â Â Â Â }; Â Â Â Â Â Â Â Â cipher: string; Â Â Â Â Â Â Â Â kdf: string; Â Â Â Â Â Â Â Â kdfparams: { Â Â Â Â Â Â Â Â Â Â Â Â n: number; Â Â Â Â Â Â Â Â Â Â Â Â r: number; Â Â Â Â Â Â Â Â Â Â Â Â p: number; Â Â Â Â Â Â Â Â Â Â Â Â dklen: number; Â Â Â Â Â Â Â Â Â Â Â Â salt: string; Â Â Â Â Â Â Â Â }; Â Â Â Â Â Â Â Â mac: string; Â Â Â Â }; }>
Returns Promise<{ Â Â Â Â id: string; Â Â Â Â crypto: { Â Â Â Â Â Â Â Â ciphertext: string; Â Â Â Â Â Â Â Â cipherparams: { Â Â Â Â Â Â Â Â Â Â Â Â iv: string; Â Â Â Â Â Â Â Â }; Â Â Â Â Â Â Â Â cipher: string; Â Â Â Â Â Â Â Â kdf: string; Â Â Â Â Â Â Â Â kdfparams: { Â Â Â Â Â Â Â Â Â Â Â Â n: number; Â Â Â Â Â Â Â Â Â Â Â Â r: number; Â Â Â Â Â Â Â Â Â Â Â Â p: number; Â Â Â Â Â Â Â Â Â Â Â Â dklen: number; Â Â Â Â Â Â Â Â Â Â Â Â salt: string; Â Â Â Â Â Â Â Â }; Â Â Â Â Â Â Â Â mac: string; Â Â Â Â }; }>
accumulator: ((a: T, b: T) =>     | undefined     | null     | void     | T     | Promise<         | undefined         | null         | void         | T>)
A callback to be called for each value. If it returns null, the previous result will be kept.
+
(a, b):     | undefined     | null     | void     | T     | Promise<         | undefined         | null         | void         | T>
Returns     | undefined     | null     | void     | T     | Promise<         | undefined         | null         | void         | T>
accumulator: ((a: T, b: V, i: number, values: V[]) =>     | undefined     | null     | void     | T     | Promise<         | undefined         | null         | void         | T>)
A callback to be called for each value. If it returns null, the previous result will be kept.
+
(a, b, i, values):     | undefined     | null     | void     | T     | Promise<         | undefined         | null         | void         | T>
Returns     | undefined     | null     | void     | T     | Promise<         | undefined         | null         | void         | T>
Gets the JoyID signers based on the client, name, and icon.
+If the browser is standalone or a webview, returns SignerAlwaysError instances.
+Otherwise, returns instances of CkbSigner, BitcoinSigner, and EvmSigner.
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
# Navigate to the project directory and run the following commands to install all necessary packages and build the project: pnpminstall pnpmbuild
+
+
+
+
Run the demo in development mode
+
+
# Go to the demo directory and start the development server: cdpackages/demo pnpmrundev
+
+
+
Who uses CCC?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
FAQs
Property '*' does not exist on type 'typeof import("*/@ckb-ccc/connector-react/dist/barrel")'.ts(2339)
CCC uses JS's Package Entry Points feature to help tree shaking while exporting everything on the ccc object. Ensure in your tsconfig.json, moduleResolution is set to node16, nodenext, or bundler, and resolvePackageJsonExports is not disabled.
interface NostrEvent{ Â Â Â Â id?: string; Â Â Â Â pubkey?: string; Â Â Â Â sig?: string; Â Â Â Â created_at: number; Â Â Â Â kind: number; Â Â Â Â tags: string[][]; Â Â Â Â content: string; }
interface BitcoinProvider{ Â Â Â Â connect?(): Promise<{ Â Â Â Â Â Â Â Â address: string; Â Â Â Â Â Â Â Â publicKey: string; Â Â Â Â Â Â Â Â compressedPublicKey: string; Â Â Â Â }>; Â Â Â Â getSelectedAccount?(): Promise<null | { Â Â Â Â Â Â Â Â address: string; Â Â Â Â Â Â Â Â publicKey: string; Â Â Â Â Â Â Â Â compressedPublicKey: string; Â Â Â Â }>; }
Interface representing a provider for interacting with accounts and signing messages.
+
interface Provider{ Â Â Â Â requestAccounts(): Promise<string[]>; Â Â Â Â getNetwork(): Promise<"livenet" | "testnet">; Â Â Â Â switchNetwork(chain: "livenet" | "testnet"): Promise<void>; Â Â Â Â getChain?(): Promise<{ Â Â Â Â Â Â Â Â enum: string; Â Â Â Â Â Â Â Â name: string; Â Â Â Â Â Â Â Â network: string; Â Â Â Â }>; Â Â Â Â switchChain?(chain: string): Promise<{ Â Â Â Â Â Â Â Â enum: string; Â Â Â Â Â Â Â Â name: string; Â Â Â Â Â Â Â Â network: string; Â Â Â Â }>; Â Â Â Â getAccounts(): Promise<string[]>; Â Â Â Â getPublicKey(): Promise<string>; Â Â Â Â signMessage(msg: string, type: "ecdsa" | "bip322-simple"): Promise<string>; Â Â Â Â on: UniSatA.OnMethod; Â Â Â Â removeListener(eventName: string, listener: ((...args: unknown[]) => unknown)): UniSatA.Provider; }
interface Provider{ Â Â Â Â requestAccounts(): Promise<string[]>; Â Â Â Â getAccount(): Promise<string[]>; Â Â Â Â getPublicKey(): Promise<{ Â Â Â Â Â Â Â Â address: string; Â Â Â Â Â Â Â Â publicKey: string; Â Â Â Â }[]>; Â Â Â Â connect(): Promise<void>; Â Â Â Â isConnected(): Promise<boolean>; Â Â Â Â signMessage(msg: string, address: string): Promise<string>; Â Â Â Â createTx(tx: any): Promise<string>; Â Â Â Â signTransaction(tx: any): Promise<any>; Â Â Â Â on: UtxoGlobalA.OnMethod; Â Â Â Â removeListener(eventName: string, listener: ((...args: unknown[]) => unknown)): UtxoGlobalA.Provider; }
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
This project is still under active development, and we are looking forward to your feedback. Try its demo now here. It showcases how to use CCC for some basic scenarios in CKB.
+ UTXO Global Wallet for Nervos - A New Horizon for Your Crypto Adventures!
+
+
+
+
+
+
+
+
+
+ "CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
+
+ Empower yourself with CCC to discover the unlimited potential of CKB.
+
+ Interoperate with wallets from different chain ecosystems.
+
+ Fully enabling CKB's Turing completeness and cryptographic freedom power.
+
BytesFromEncoding: Â Â Â Â | "utf8" Â Â Â Â | "utf16le" Â Â Â Â | "latin1" Â Â Â Â | "base64" Â Â Â Â | "base64url" Â Â Â Â | "hex" Â Â Â Â | "ascii" Â Â Â Â | "binary" Â Â Â Â | "ucs2"
Represents the possible encoding formats for converting bytes.
ClientCollectableSearchKeyFilterLike:{ Â Â Â Â script?: ScriptLike | null; Â Â Â Â scriptLenRange?: [NumLike, NumLike] | null; Â Â Â Â outputData?: HexLike | null; Â Â Â Â outputDataSearchMode?: Â Â Â Â Â Â Â Â | "prefix" Â Â Â Â Â Â Â Â | "exact" Â Â Â Â Â Â Â Â | "partial" Â Â Â Â Â Â Â Â | null; Â Â Â Â outputDataLenRange?: [NumLike, NumLike] | null; Â Â Â Â outputCapacityRange?: [NumLike, NumLike] | null; }
ClientCollectableSearchKeyLike:{ Â Â Â Â script: ScriptLike; Â Â Â Â scriptType: "lock" | "type"; Â Â Â Â scriptSearchMode: "prefix" | "exact" | "partial"; Â Â Â Â filter?: ClientCollectableSearchKeyFilterLike | null; Â Â Â Â withData?: boolean | null; }
JsonRpcBlockHeader:{ Â Â Â Â compact_target: Hex; Â Â Â Â dao: Hex; Â Â Â Â epoch: Hex; Â Â Â Â extra_hash: Hex; Â Â Â Â hash: Hex; Â Â Â Â nonce: Hex; Â Â Â Â number: Hex; Â Â Â Â parent_hash: Hex; Â Â Â Â proposals_hash: Hex; Â Â Â Â timestamp: Hex; Â Â Â Â transactions_root: Hex; Â Â Â Â version: Hex; }
Type Alias JsonRpcIndexerFindTransactionsGroupedResponse
JsonRpcIndexerFindTransactionsGroupedResponse:{ Â Â Â Â last_cursor: string; Â Â Â Â objects: { Â Â Â Â Â Â Â Â tx_hash: Hex; Â Â Â Â Â Â Â Â block_number: Hex; Â Â Â Â Â Â Â Â tx_index: Hex; Â Â Â Â Â Â Â Â cells: ["input" | "output", Hex][]; Â Â Â Â }[]; }
JsonRpcIndexerFindTransactionsResponse:{ Â Â Â Â last_cursor: string; Â Â Â Â objects: { Â Â Â Â Â Â Â Â tx_hash: Hex; Â Â Â Â Â Â Â Â block_number: Hex; Â Â Â Â Â Â Â Â tx_index: Hex; Â Â Â Â Â Â Â Â io_type: "input" | "output"; Â Â Â Â Â Â Â Â io_index: Hex; Â Â Â Â }[]; }
JsonRpcIndexerSearchKey:{ Â Â Â Â script: JsonRpcScript; Â Â Â Â script_type: "lock" | "type"; Â Â Â Â script_search_mode?: "prefix" | "exact" | "partial"; Â Â Â Â filter?: JsonRpcIndexerSearchKeyFilter; Â Â Â Â with_data?: boolean; }
JsonRpcIndexerSearchKeyFilter:{ Â Â Â Â script?: JsonRpcScript; Â Â Â Â script_len_range?: [Hex, Hex]; Â Â Â Â output_data?: Hex; Â Â Â Â output_data_filter_mode?: "prefix" | "exact" | "partial"; Â Â Â Â output_data_len_range?: [Hex, Hex]; Â Â Â Â output_capacity_range?: [Hex, Hex]; Â Â Â Â block_range?: [Hex, Hex]; }
JsonRpcIndexerSearchKeyTransaction:{ Â Â Â Â script: JsonRpcScript; Â Â Â Â script_type: "lock" | "type"; Â Â Â Â script_search_mode?: "prefix" | "exact" | "partial"; Â Â Â Â filter?: JsonRpcIndexerSearchKeyFilter; Â Â Â Â group_by_transaction?: boolean; }
JsonRpcTransaction:{ Â Â Â Â version: Hex; Â Â Â Â cell_deps: JsonRpcCellDep[]; Â Â Â Â header_deps: Hex[]; Â Â Â Â inputs: JsonRpcCellInput[]; Â Â Â Â outputs: JsonRpcCellOutput[]; Â Â Â Â outputs_data: Hex[]; Â Â Â Â witnesses: Hex[]; }
CellInputLike:{ Â Â Â Â previousOutput: OutPointLike; Â Â Â Â since?: NumLike | null; Â Â Â Â cellOutput?: CellOutputLike | null; Â Â Â Â outputData?: HexLike | null; }
ClientBlockHeader:{ Â Â Â Â compactTarget: Num; Â Â Â Â dao: Hex; Â Â Â Â epoch: Num; Â Â Â Â extraHash: Hex; Â Â Â Â hash: Hex; Â Â Â Â nonce: Num; Â Â Â Â number: Num; Â Â Â Â parentHash: Hex; Â Â Â Â proposalsHash: Hex; Â Â Â Â timestamp: Num; Â Â Â Â transactionsRoot: Hex; Â Â Â Â version: Num; }
ClientFindTransactionsGroupedResponse:{ Â Â Â Â lastCursor: string; Â Â Â Â transactions: { Â Â Â Â Â Â Â Â txHash: Hex; Â Â Â Â Â Â Â Â blockNumber: Num; Â Â Â Â Â Â Â Â txIndex: Num; Â Â Â Â Â Â Â Â cells: { Â Â Â Â Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â Â Â Â Â cellIndex: Num; Â Â Â Â Â Â Â Â }[]; Â Â Â Â }[]; }
ClientFindTransactionsResponse:{ Â Â Â Â lastCursor: string; Â Â Â Â transactions: { Â Â Â Â Â Â Â Â txHash: Hex; Â Â Â Â Â Â Â Â blockNumber: Num; Â Â Â Â Â Â Â Â txIndex: Num; Â Â Â Â Â Â Â Â isInput: boolean; Â Â Â Â Â Â Â Â cellIndex: Num; Â Â Â Â }[]; }
Wallet signers should check if the wallet is using preferred networks.
+If not, try to switch to the first preferred network.
+If non preferred, let users choose what they want.
+BTC: // They made a mess...
+btc
+btcTestnet
+btcSignet // OKX
+fractalBtc // UniSat
TransactionLike:{ Â Â Â Â version?: NumLike | null; Â Â Â Â cellDeps?: CellDepLike[] | null; Â Â Â Â headerDeps?: HexLike[] | null; Â Â Â Â inputs?: CellInputLike[] | null; Â Â Â Â outputs?: (Omit<CellOutputLike, "capacity"> & Partial<Pick<CellOutputLike, "capacity">>)[] | null; Â Â Â Â outputsData?: HexLike[] | null; Â Â Â Â witnesses?: HexLike[] | null; }
Represents the fixed point value of zero as a bigint.
+
Settings
Member Visibility
diff --git a/package.json b/package.json
index 54559672..59fa6af7 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,8 @@
"sync:config": "pnpm -r --filter !./packages/demo --filter !./packages/faucet -c exec \"cp ../../config/* . && cp ../../config/.* .\"",
"change": "pnpm changeset",
"version": "pnpm changeset version",
- "publish": "pnpm publish -r"
+ "publish": "pnpm publish -r",
+ "docs": "typedoc"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
@@ -20,6 +21,9 @@
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"ts-jest": "^29.1.4",
+ "typedoc": "^0.26.6",
+ "typedoc-material-theme": "^1.1.0",
+ "typedoc-plugin-extras": "^3.1.0",
"typescript": "^5.4.5"
}
}
diff --git a/packages/ccc/src/signersController.ts b/packages/ccc/src/signersController.ts
index 32d23759..a2031be5 100644
--- a/packages/ccc/src/signersController.ts
+++ b/packages/ccc/src/signersController.ts
@@ -13,10 +13,16 @@ import { OKX_SVG } from "./assets/okx.svg.js";
import { UNI_SAT_SVG } from "./assets/uni-sat.svg.js";
import { UTXO_GLOBAL_SVG } from "./assets/utxo-global.svg.js";
+/**
+ * @public
+ */
export type WalletWithSigners = ccc.Wallet & {
signers: ccc.SignerInfo[];
};
+/**
+ * @public
+ */
export class SignersController {
private resetListeners: (() => void)[] = [];
diff --git a/packages/ccc/typedoc.json b/packages/ccc/typedoc.json
new file mode 100644
index 00000000..48c52f25
--- /dev/null
+++ b/packages/ccc/typedoc.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": [
+ "./src/index.ts",
+ "./src/advanced.ts"
+ ],
+ "extends": [
+ "../../typedoc.base.json"
+ ],
+ "name": "@ckb-ccc ccc"
+}
\ No newline at end of file
diff --git a/packages/connector-react/typedoc.json b/packages/connector-react/typedoc.json
new file mode 100644
index 00000000..648b7e0f
--- /dev/null
+++ b/packages/connector-react/typedoc.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": [
+ "./src/index.ts",
+ "./src/advanced.ts"
+ ],
+ "extends": [
+ "../../typedoc.base.json"
+ ],
+ "name": "@ckb-ccc connector-react"
+}
\ No newline at end of file
diff --git a/packages/connector/typedoc.json b/packages/connector/typedoc.json
new file mode 100644
index 00000000..42b87888
--- /dev/null
+++ b/packages/connector/typedoc.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": [
+ "./src/index.ts",
+ "./src/advanced.ts"
+ ],
+ "extends": [
+ "../../typedoc.base.json"
+ ],
+ "name": "@ckb-ccc connector"
+}
\ No newline at end of file
diff --git a/packages/core/src/address/index.ts b/packages/core/src/address/index.ts
index 8ebbceaa..c307a4bd 100644
--- a/packages/core/src/address/index.ts
+++ b/packages/core/src/address/index.ts
@@ -10,6 +10,9 @@ import {
addressPayloadFromString,
} from "./address.advanced.js";
+/**
+ * @public
+ */
export type AddressLike = {
script: ScriptLike;
prefix: string;
@@ -17,8 +20,8 @@ export type AddressLike = {
/**
* Represents a ckb address with associated script and prefix.
+ * @public
*/
-
export class Address {
/**
* Creates an instance of Address.
diff --git a/packages/core/src/advancedBarrel.ts b/packages/core/src/advancedBarrel.ts
index a59575aa..06aa060a 100644
--- a/packages/core/src/advancedBarrel.ts
+++ b/packages/core/src/advancedBarrel.ts
@@ -1,4 +1,5 @@
export * from "./address/advanced.js";
+export * from "./bytes/advanced.js";
export * from "./ckb/advanced.js";
export * from "./client/advanced.js";
export * from "./hasher/advanced.js";
diff --git a/packages/core/src/bytes/advanced.ts b/packages/core/src/bytes/advanced.ts
index e5eb3e98..e5914031 100644
--- a/packages/core/src/bytes/advanced.ts
+++ b/packages/core/src/bytes/advanced.ts
@@ -1,5 +1,6 @@
/**
* Represents the possible encoding formats for converting bytes.
+ * @public
*/
export type BytesFromEncoding =
| "utf8" // UTF-8 encoding
diff --git a/packages/core/src/bytes/index.ts b/packages/core/src/bytes/index.ts
index b94a9931..739a5144 100644
--- a/packages/core/src/bytes/index.ts
+++ b/packages/core/src/bytes/index.ts
@@ -1,11 +1,18 @@
import { Buffer } from "buffer/index.js";
import { BytesFromEncoding } from "./advanced.js";
+/**
+ * @public
+ */
export type Bytes = Uint8Array;
+/**
+ * @public
+ */
export type BytesLike = string | Uint8Array | ArrayBuffer | number[];
/**
* Concatenates multiple byte-like arrays into a single byte array.
+ * @public
*
* @param args - The byte-like arrays to concatenate.
* @returns A Uint8Array containing the concatenated bytes.
@@ -33,6 +40,7 @@ export function bytesConcat(...args: BytesLike[]): Bytes {
/**
* Converts a byte-like value to a string using the specified encoding.
+ * @public
*
* @param val - The byte-like value to convert.
* @param encoding - The encoding to use for the conversion, as defined by the BytesFromEncoding type.
@@ -54,6 +62,7 @@ export function bytesTo(val: BytesLike, encoding: BytesFromEncoding): string {
/**
* Converts various types of byte-like values to a Uint8Array.
+ * @public
*
* @param bytes - The byte-like value to convert. It can be a string, Uint8Array, ArrayBuffer, or number array.
* @param encoding - Optional encoding to use if the input is a string. Defaults to hexadecimal if not specified.
diff --git a/packages/core/src/ckb/script.ts b/packages/core/src/ckb/script.ts
index 2a94972f..d58381b0 100644
--- a/packages/core/src/ckb/script.ts
+++ b/packages/core/src/ckb/script.ts
@@ -9,11 +9,18 @@ import {
NUM_TO_HASH_TYPE,
} from "./script.advanced.js";
+/**
+ * @public
+ */
export type HashTypeLike = string | number | bigint;
+/**
+ * @public
+ */
export type HashType = "type" | "data" | "data1" | "data2";
/**
* Converts a HashTypeLike value to a HashType.
+ * @public
*
* @param val - The value to convert, which can be a string, number, or bigint.
* @returns The corresponding HashType.
@@ -50,6 +57,7 @@ export function hashTypeFrom(val: HashTypeLike): HashType {
/**
* Converts a HashTypeLike value to its corresponding byte representation.
+ * @public
*
* @param hashType - The hash type value to convert.
* @returns A Uint8Array containing the byte representation of the hash type.
@@ -66,6 +74,7 @@ export function hashTypeToBytes(hashType: HashTypeLike): Bytes {
/**
* Converts a byte-like value to a HashType.
+ * @public
*
* @param bytes - The byte-like value to convert.
* @returns The corresponding HashType.
@@ -82,11 +91,17 @@ export function hashTypeFromBytes(bytes: BytesLike): HashType {
return NUM_TO_HASH_TYPE[bytesFrom(bytes)[0]];
}
+/**
+ * @public
+ */
export type ScriptLike = {
codeHash: BytesLike;
hashType: HashTypeLike;
args: BytesLike;
};
+/**
+ * @public
+ */
export class Script {
/**
* Creates an instance of Script.
diff --git a/packages/core/src/ckb/transaction.ts b/packages/core/src/ckb/transaction.ts
index f9f325a7..362f6c89 100644
--- a/packages/core/src/ckb/transaction.ts
+++ b/packages/core/src/ckb/transaction.ts
@@ -23,12 +23,19 @@ import * as mol from "./molecule.advanced/index.js";
import { Script, ScriptLike } from "./script.js";
import { DEP_TYPE_TO_NUM, NUM_TO_DEP_TYPE } from "./transaction.advanced.js";
+/**
+ * @public
+ */
export type DepTypeLike = string | number | bigint;
+/**
+ * @public
+ */
export type DepType = "depGroup" | "code";
/**
* Converts a DepTypeLike value to a DepType.
- *
+ * @public
+ *
* @param val - The value to convert, which can be a string, number, or bigint.
* @returns The corresponding DepType.
*
@@ -61,6 +68,7 @@ export function depTypeFrom(val: DepTypeLike): DepType {
/**
* Converts a DepTypeLike value to its corresponding byte representation.
+ * @public
*
* @param depType - The dep type value to convert.
* @returns A Uint8Array containing the byte representation of the dep type.
@@ -77,6 +85,7 @@ export function depTypeToBytes(depType: DepTypeLike): Bytes {
/**
* Converts a byte-like value to a DepType.
+ * @public
*
* @param bytes - The byte-like value to convert.
* @returns The corresponding DepType.
@@ -93,10 +102,16 @@ export function depTypeFromBytes(bytes: BytesLike): DepType {
return NUM_TO_DEP_TYPE[bytesFrom(bytes)[0]];
}
+/**
+ * @public
+ */
export type OutPointLike = {
txHash: HexLike;
index: NumLike;
};
+/**
+ * @public
+ */
export class OutPoint {
/**
* Creates an instance of OutPoint.
@@ -211,11 +226,17 @@ export class OutPoint {
}
}
+/**
+ * @public
+ */
export type CellOutputLike = {
capacity: NumLike;
lock: ScriptLike;
type?: ScriptLike | null;
};
+/**
+ * @public
+ */
export class CellOutput {
/**
* Creates an instance of CellOutput.
@@ -331,11 +352,17 @@ export class CellOutput {
}
}
+/**
+ * @public
+ */
export type CellLike = {
outPoint: OutPointLike;
cellOutput: CellOutputLike;
outputData: HexLike;
};
+/**
+ * @public
+ */
export class Cell {
/**
* Creates an instance of Cell.
@@ -389,12 +416,18 @@ export class Cell {
}
}
+/**
+ * @public
+ */
export type CellInputLike = {
previousOutput: OutPointLike;
since?: NumLike | null;
cellOutput?: CellOutputLike | null;
outputData?: HexLike | null;
};
+/**
+ * @public
+ */
export class CellInput {
/**
* Creates an instance of CellInput.
@@ -535,10 +568,16 @@ export class CellInput {
}
}
+/**
+ * @public
+ */
export type CellDepLike = {
outPoint: OutPointLike;
depType: DepTypeLike;
};
+/**
+ * @public
+ */
export class CellDep {
/**
* Creates an instance of CellDep.
@@ -662,11 +701,17 @@ export class CellDep {
}
}
+/**
+ * @public
+ */
export type WitnessArgsLike = {
lock?: HexLike | null;
inputType?: HexLike | null;
outputType?: HexLike | null;
};
+/**
+ * @public
+ */
export class WitnessArgs {
/**
* Creates an instance of WitnessArgs.
@@ -765,6 +810,9 @@ export class WitnessArgs {
}
}
+/**
+ * @public
+ */
export function udtBalanceFrom(dataLike: BytesLike): Num {
const data = bytesFrom(dataLike).slice(0, 16);
if (data.length !== 16) {
@@ -774,6 +822,9 @@ export function udtBalanceFrom(dataLike: BytesLike): Num {
return numFromBytes(data);
}
+/**
+ * @public
+ */
export type TransactionLike = {
version?: NumLike | null;
cellDeps?: CellDepLike[] | null;
@@ -786,6 +837,9 @@ export type TransactionLike = {
outputsData?: HexLike[] | null;
witnesses?: HexLike[] | null;
};
+/**
+ * @public
+ */
export class Transaction {
/**
* Creates an instance of Transaction.
@@ -1124,10 +1178,10 @@ export class Transaction {
* ```
*/
async findInputIndexByLockId(
- scriptLike: Pick,
+ scriptIdLike: Pick,
client: Client,
): Promise {
- const script = Script.from({ ...scriptLike, args: "0x" });
+ const script = Script.from({ ...scriptIdLike, args: "0x" });
for (let i = 0; i < this.inputs.length; i += 1) {
const input = this.inputs[i];
@@ -1217,8 +1271,8 @@ export class Transaction {
* tx.addCellDeps(cellDep);
* ```
*/
- addCellDeps(...cellDepsLike: (CellDepLike | CellDepLike[])[]): void {
- cellDepsLike.flat().forEach((cellDepLike) => {
+ addCellDeps(...cellDepLikes: (CellDepLike | CellDepLike[])[]): void {
+ cellDepLikes.flat().forEach((cellDepLike) => {
const cellDep = CellDep.from(cellDepLike);
if (this.cellDeps.some((c) => c.eq(cellDep))) {
return;
@@ -1238,8 +1292,8 @@ export class Transaction {
* tx.addCellDepsAtBegin(cellDep);
* ```
*/
- addCellDepsAtStart(...cellDepsLike: (CellDepLike | CellDepLike[])[]): void {
- cellDepsLike.flat().forEach((cellDepLike) => {
+ addCellDepsAtStart(...cellDepLikes: (CellDepLike | CellDepLike[])[]): void {
+ cellDepLikes.flat().forEach((cellDepLike) => {
const cellDep = CellDep.from(cellDepLike);
if (this.cellDeps.some((c) => c.eq(cellDep))) {
return;
@@ -1253,7 +1307,7 @@ export class Transaction {
* Add cell dep from infos if they are not existed
*
* @param client - A client for searching cell deps
- * @param cellDepLikes - The cell dep infos to add
+ * @param cellDepInfoLikes - The cell dep infos to add
*
* @example
* ```typescript
@@ -1262,9 +1316,9 @@ export class Transaction {
*/
async addCellDepInfos(
client: Client,
- ...cellDepInfosLike: (CellDepInfoLike | CellDepInfoLike[])[]
+ ...cellDepInfoLikes: (CellDepInfoLike | CellDepInfoLike[])[]
): Promise {
- this.addCellDeps(await client.getCellDeps(...cellDepInfosLike));
+ this.addCellDeps(await client.getCellDeps(...cellDepInfoLikes));
}
/**
@@ -1302,10 +1356,10 @@ export class Transaction {
*
* @example
* ```typescript
- * await tx.setOutputData(0, "0x00");
+ * await tx.setOutputDataAt(0, "0x00");
* ```
*/
- setOutputDataAt(index: number, data: HexLike): void {
+ setOutputDataAt(index: number, witness: HexLike): void {
if (this.outputsData.length < index) {
this.outputsData.push(
...Array.from(
@@ -1315,14 +1369,14 @@ export class Transaction {
);
}
- this.outputsData[index] = hexFrom(data);
+ this.outputsData[index] = hexFrom(witness);
}
/**
* Add output
*
- * @param output - The cell output to add
- * @param data - optional output data
+ * @param outputLike - The cell output to add
+ * @param outputData - optional output data
*
* @example
* ```typescript
diff --git a/packages/core/src/client/client.ts b/packages/core/src/client/client.ts
index 398a9133..1b1a254a 100644
--- a/packages/core/src/client/client.ts
+++ b/packages/core/src/client/client.ts
@@ -28,6 +28,9 @@ import {
OutputsValidator,
} from "./clientTypes.js";
+/**
+ * @public
+ */
export enum KnownScript {
Secp256k1Blake160 = "Secp256k1Blake160",
Secp256k1Multisig = "Secp256k1Multisig",
@@ -44,11 +47,17 @@ export enum KnownScript {
OutputTypeProxyLock = "OutputTypeProxyLock",
}
+/**
+ * @public
+ */
export type CellDepInfoLike = {
cellDep: CellDepLike;
type?: ScriptLike | null;
};
+/**
+ * @public
+ */
export class CellDepInfo {
constructor(
public cellDep: CellDep,
@@ -63,6 +72,9 @@ export class CellDepInfo {
}
}
+/**
+ * @public
+ */
export abstract class Client {
private readonly cachedTransactions: Transaction[] = [];
private readonly unusableOutPoints: OutPoint[] = [];
@@ -190,7 +202,7 @@ export abstract class Client {
/**
* Find cells by search key designed for collectable cells.
*
- * @param key - The search key.
+ * @param keyLike - The search key.
* @returns A async generator for yielding cells.
*/
async *findCellsByCollectableSearchKey(
diff --git a/packages/core/src/client/clientPublicMainnet.ts b/packages/core/src/client/clientPublicMainnet.ts
index 51018fe1..b4c4e85c 100644
--- a/packages/core/src/client/clientPublicMainnet.ts
+++ b/packages/core/src/client/clientPublicMainnet.ts
@@ -3,6 +3,9 @@ import { CellDepInfo, KnownScript } from "./client.js";
import { MAINNET_SCRIPTS } from "./clientPublicMainnet.advanced.js";
import { ClientJsonRpc } from "./jsonRpc/index.js";
+/**
+ * @public
+ */
export class ClientPublicMainnet extends ClientJsonRpc {
constructor(
url = "https://mainnet.ckb.dev/",
diff --git a/packages/core/src/client/clientPublicTestnet.ts b/packages/core/src/client/clientPublicTestnet.ts
index d7c57f5d..fae66a40 100644
--- a/packages/core/src/client/clientPublicTestnet.ts
+++ b/packages/core/src/client/clientPublicTestnet.ts
@@ -3,6 +3,9 @@ import { CellDepInfo, KnownScript } from "./client.js";
import { TESTNET_SCRIPTS } from "./clientPublicTestnet.advanced.js";
import { ClientJsonRpc } from "./jsonRpc/index.js";
+/**
+ * @public
+ */
export class ClientPublicTestnet extends ClientJsonRpc {
constructor(
url = "https://testnet.ckb.dev/",
diff --git a/packages/core/src/client/clientTypes.ts b/packages/core/src/client/clientTypes.ts
index b44afc0f..ed84777b 100644
--- a/packages/core/src/client/clientTypes.ts
+++ b/packages/core/src/client/clientTypes.ts
@@ -8,23 +8,38 @@ import {
clientSearchKeyRangeFrom,
} from "./clientTypes.advanced.js";
+/**
+ * @public
+ */
export type OutputsValidator = "passthrough" | "well_known_scripts_only";
+/**
+ * @public
+ */
export type TransactionStatus =
| "pending"
| "proposed"
| "committed"
| "unknown"
| "rejected";
+/**
+ * @public
+ */
export type ClientTransactionResponse = {
transaction: Transaction;
status: TransactionStatus;
};
+/**
+ * @public
+ */
export type ClientIndexerSearchKeyFilterLike =
ClientCollectableSearchKeyFilterLike & {
blockRange?: [NumLike, NumLike] | null;
};
+/**
+ * @public
+ */
export class ClientIndexerSearchKeyFilter {
constructor(
public script: Script | undefined,
@@ -51,10 +66,16 @@ export class ClientIndexerSearchKeyFilter {
}
}
+/**
+ * @public
+ */
export type ClientIndexerSearchKeyLike = ClientCollectableSearchKeyLike & {
filter?: ClientIndexerSearchKeyFilterLike | null;
};
+/**
+ * @public
+ */
export class ClientIndexerSearchKey {
constructor(
public script: Script,
@@ -75,11 +96,17 @@ export class ClientIndexerSearchKey {
}
}
+/**
+ * @public
+ */
export type ClientFindCellsResponse = {
lastCursor: string;
cells: Cell[];
};
+/**
+ * @public
+ */
export type ClientIndexerSearchKeyTransactionLike = Omit<
ClientCollectableSearchKeyLike,
"withData"
@@ -88,6 +115,9 @@ export type ClientIndexerSearchKeyTransactionLike = Omit<
groupByTransaction?: boolean | null;
};
+/**
+ * @public
+ */
export class ClientIndexerSearchKeyTransaction {
constructor(
public script: Script,
@@ -110,6 +140,9 @@ export class ClientIndexerSearchKeyTransaction {
}
}
+/**
+ * @public
+ */
export type ClientFindTransactionsResponse = {
lastCursor: string;
transactions: {
@@ -121,6 +154,9 @@ export type ClientFindTransactionsResponse = {
}[];
};
+/**
+ * @public
+ */
export type ClientFindTransactionsGroupedResponse = {
lastCursor: string;
transactions: {
@@ -134,6 +170,9 @@ export type ClientFindTransactionsGroupedResponse = {
}[];
};
+/**
+ * @public
+ */
export type ClientBlockHeader = {
compactTarget: Num;
dao: Hex;
@@ -149,11 +188,17 @@ export type ClientBlockHeader = {
version: Num;
};
+/**
+ * @public
+ */
export type ClientBlockUncle = {
header: ClientBlockHeader;
proposals: Hex[];
};
+/**
+ * @public
+ */
export type ClientBlock = {
header: ClientBlockHeader;
proposals: Hex[];
diff --git a/packages/core/src/client/jsonRpc/index.ts b/packages/core/src/client/jsonRpc/index.ts
index 612fd6cf..78735444 100644
--- a/packages/core/src/client/jsonRpc/index.ts
+++ b/packages/core/src/client/jsonRpc/index.ts
@@ -46,7 +46,7 @@ export abstract class ClientJsonRpc extends Client {
/**
* Creates an instance of ClientJsonRpc.
*
- * @param url - The URL of the JSON-RPC server.
+ * @param url_ - The URL of the JSON-RPC server.
* @param timeout - The timeout for requests in milliseconds, default is 30000.
*/
@@ -84,26 +84,26 @@ export abstract class ClientJsonRpc extends Client {
*
* @param blockNumber - The block number.
* @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
- * @param with_cycles - whether the return cycles of block transactions. (Optional, default false.)
+ * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
* @returns Block
*/
getBlockByNumber = this.buildSender(
"get_block_by_number",
[(v: NumLike) => numToHex(numFrom(v))],
(b) => apply(JsonRpcTransformers.blockTo, b),
- ) as () => Promise;
+ ) as Client["getBlockByNumber"];
/**
* Get block by block hash
*
* @param blockHash - The block hash.
* @param verbosity - result format which allows 0 and 2. (Optional, the default is 2.)
- * @param with_cycles - whether the return cycles of block transactions. (Optional, default false.)
+ * @param withCycles - whether the return cycles of block transactions. (Optional, default false.)
* @returns Block
*/
getBlockByHash = this.buildSender("get_block", [hexFrom], (b) =>
apply(JsonRpcTransformers.blockTo, b),
- ) as () => Promise;
+ ) as Client["getBlockByHash"];
/**
* Send a transaction to node.
diff --git a/packages/core/src/fixedPoint/index.ts b/packages/core/src/fixedPoint/index.ts
index 4366b6e7..3278422c 100644
--- a/packages/core/src/fixedPoint/index.ts
+++ b/packages/core/src/fixedPoint/index.ts
@@ -1,5 +1,6 @@
/**
* Represents a fixed point value as a bigint.
+ * @public
*/
export type FixedPoint = bigint;
@@ -7,12 +8,14 @@ export type FixedPoint = bigint;
/**
* Represents a value that can be converted to a fixed point value.
* It can be a bigint, string, or number.
+ * @public
*/
export type FixedPointLike = bigint | string | number;
/**
* Converts a FixedPointLike value to its string representation with fixed-point decimals.
+ * @public
*
* @param val - The value to convert, which can be a bigint, string, or number.
* @param decimals - The number of decimal places for the fixed-point representation. Default is 8.
@@ -43,6 +46,7 @@ export function fixedPointToString(val: FixedPointLike, decimals = 8): string {
/**
* Converts a FixedPointLike value to a FixedPoint (bigint) with fixed-point decimals.
+ * @public
*
* @param val - The value to convert, which can be a bigint, string, or number.
* @param decimals - The number of decimal places for the fixed-point representation. Default is 8.
@@ -74,6 +78,7 @@ export function fixedPointFrom(val: FixedPointLike, decimals = 8): FixedPoint {
/**
* Represents the fixed point value of zero as a bigint.
+ * @public
*/
export const Zero: FixedPoint = 0n;
@@ -81,6 +86,7 @@ export const Zero: FixedPoint = 0n;
/**
* Represents the fixed point value of one as a FixedPoint (bigint).
* Equivalent to 1 in fixed-point representation with default decimals (8).
+ * @public
*/
export const One: FixedPoint = fixedPointFrom("1");
diff --git a/packages/core/src/hasher/hasher.ts b/packages/core/src/hasher/hasher.ts
index 3b0306ae..1d4823f9 100644
--- a/packages/core/src/hasher/hasher.ts
+++ b/packages/core/src/hasher/hasher.ts
@@ -1,6 +1,9 @@
import { BytesLike } from "../bytes/index.js";
import { Hex } from "../hex/index.js";
+/**
+ * @public
+ */
export interface Hasher {
/**
* Updates the hash with the given data.
diff --git a/packages/core/src/hasher/hasherCkb.ts b/packages/core/src/hasher/hasherCkb.ts
index 0dba99ba..c23f83d1 100644
--- a/packages/core/src/hasher/hasherCkb.ts
+++ b/packages/core/src/hasher/hasherCkb.ts
@@ -6,6 +6,9 @@ import { NumLike, numLeToBytes } from "../num/index.js";
import { CKB_BLAKE2B_PERSONAL } from "./advanced.js";
import { Hasher } from "./hasher.js";
+/**
+ * @public
+ */
export class HasherCkb implements Hasher {
private readonly hasher: ReturnType<(typeof blake2b)["create"]>;
@@ -62,6 +65,7 @@ export class HasherCkb implements Hasher {
/**
* Computes the CKB hash of the given data using the Blake2b algorithm.
+ * @public
*
* @param data - The data to hash.
* @returns The hexadecimal string representation of the hash.
@@ -80,8 +84,9 @@ export function hashCkb(...data: BytesLike[]): Hex {
/**
* Computes the Type ID hash of the given data.
+ * @public
*
- * @param cellInput - The first cell input of the transaction.
+ * @param cellInputLike - The first cell input of the transaction.
* @param outputIndex - The output index of the Type ID cell.
* @returns The hexadecimal string representation of the hash.
*
diff --git a/packages/core/src/hasher/hasherKeecak256.ts b/packages/core/src/hasher/hasherKeecak256.ts
index ec0b6c38..88beef6e 100644
--- a/packages/core/src/hasher/hasherKeecak256.ts
+++ b/packages/core/src/hasher/hasherKeecak256.ts
@@ -3,6 +3,9 @@ import { BytesLike, bytesFrom } from "../bytes/index.js";
import { Hex, hexFrom } from "../hex/index.js";
import { Hasher } from "./hasher.js";
+/**
+ * @public
+ */
export class HasherKeecak256 implements Hasher {
private readonly hasher: ReturnType<(typeof keccak_256)["create"]>;
diff --git a/packages/core/src/hex/index.ts b/packages/core/src/hex/index.ts
index 9a591188..41df43d7 100644
--- a/packages/core/src/hex/index.ts
+++ b/packages/core/src/hex/index.ts
@@ -2,16 +2,19 @@ import { bytesFrom, BytesLike, bytesTo } from "../bytes/index.js";
/**
* Represents a hexadecimal string prefixed with "0x".
+ * @public
*/
export type Hex = `0x${string}`;
/**
* Represents a value that can be converted to a hexadecimal string.
* It extends the BytesLike type.
+ * @public
*/
export type HexLike = BytesLike;
/**
* Converts a HexLike value to a Hex string.
+ * @public
*
* @param hex - The value to convert, which can be a string, Uint8Array, ArrayBuffer, or number array.
* @returns A Hex string representing the value.
diff --git a/packages/core/src/keystore/index.ts b/packages/core/src/keystore/index.ts
index 88d6b4d1..bd963af3 100644
--- a/packages/core/src/keystore/index.ts
+++ b/packages/core/src/keystore/index.ts
@@ -18,6 +18,9 @@ function mac(derivedKey: Bytes, cipherText: Bytes) {
).slice(2);
}
+/**
+ * @public
+ */
export async function keystoreEncrypt(
privateKeyLike: BytesLike,
chainCodeLike: BytesLike,
@@ -79,6 +82,9 @@ export async function keystoreEncrypt(
};
}
+/**
+ * @public
+ */
export async function keystoreDecrypt(
keystore: unknown,
password: string,
diff --git a/packages/core/src/num/index.ts b/packages/core/src/num/index.ts
index a635686b..ab76de50 100644
--- a/packages/core/src/num/index.ts
+++ b/packages/core/src/num/index.ts
@@ -3,17 +3,20 @@ import { Hex, HexLike, hexFrom } from "../hex/index.js";
/**
* Represents a numeric value as a bigint.
+ * @public
*/
export type Num = bigint;
/**
* Represents a value that can be converted to a numeric value.
* It can be a string, number, bigint, or HexLike.
+ * @public
*/
export type NumLike = string | number | bigint | HexLike;
/**
* Get the max among all numbers.
+ * @public
*
* @param numbers - numbers.
* @returns The max numbers among them.
@@ -36,6 +39,7 @@ export function numMax(a: NumLike, ...numbers: NumLike[]): Num {
/**
* Converts a NumLike value to a Num (bigint).
+ * @public
*
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
* @returns A Num (bigint) representing the value.
@@ -60,6 +64,7 @@ export function numFrom(val: NumLike): Num {
/**
* Converts a NumLike value to a hexadecimal string.
+ * @public
*
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
* @returns A Hex string representing the numeric value.
@@ -75,6 +80,7 @@ export function numToHex(val: NumLike): Hex {
/**
* Converts a NumLike value to a byte array in little-endian order.
+ * @public
*
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
@@ -92,6 +98,7 @@ export function numToBytes(val: NumLike, bytes?: number): Bytes {
/**
* Converts a NumLike value to a byte array in little-endian order.
+ * @public
*
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
@@ -108,6 +115,7 @@ export function numLeToBytes(val: NumLike, bytes?: number): Bytes {
/**
* Converts a NumLike value to a byte array in big-endian order.
+ * @public
*
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
* @param bytes - The number of bytes to use for the representation. If not provided, the exact number of bytes needed is used.
@@ -132,6 +140,7 @@ export function numBeToBytes(val: NumLike, bytes?: number): Bytes {
/**
* Converts a byte array to a Num (bigint) assuming little-endian order.
+ * @public
*
* @param val - The byte array to convert.
* @returns A Num (bigint) representing the numeric value.
@@ -147,6 +156,7 @@ export function numFromBytes(val: BytesLike): Num {
/**
* Converts a byte array to a Num (bigint) assuming little-endian order.
+ * @public
*
* @param val - The byte array to convert.
* @returns A Num (bigint) representing the numeric value.
@@ -162,6 +172,7 @@ export function numLeFromBytes(val: BytesLike): Num {
/**
* Converts a byte array to a Num (bigint) assuming big-endian order.
+ * @public
*
* @param val - The byte array to convert.
* @returns A Num (bigint) representing the numeric value.
diff --git a/packages/core/src/signer/btc/signerBtc.ts b/packages/core/src/signer/btc/signerBtc.ts
index 3cf20f36..bc33a822 100644
--- a/packages/core/src/signer/btc/signerBtc.ts
+++ b/packages/core/src/signer/btc/signerBtc.ts
@@ -12,6 +12,7 @@ import { Signer, SignerSignType, SignerType } from "../signer/index.js";
* An abstract class extending the Signer class for Bitcoin-like signing operations.
* This class provides methods to get Bitcoin account, public key, and internal address,
* as well as signing transactions.
+ * @public
*/
export abstract class SignerBtc extends Signer {
get type(): SignerType {
diff --git a/packages/core/src/signer/btc/signerBtcPublicKeyReadonly.ts b/packages/core/src/signer/btc/signerBtcPublicKeyReadonly.ts
index 6b692414..50096db7 100644
--- a/packages/core/src/signer/btc/signerBtcPublicKeyReadonly.ts
+++ b/packages/core/src/signer/btc/signerBtcPublicKeyReadonly.ts
@@ -5,6 +5,7 @@ import { SignerBtc } from "./signerBtc.js";
/**
* A class extending SignerBtc that provides read-only access to a Bitcoin public key and account.
* This class does not support signing operations.
+ * @public
*/
export class SignerBtcPublicKeyReadonly extends SignerBtc {
private readonly publicKey: Hex;
diff --git a/packages/core/src/signer/btc/verify.ts b/packages/core/src/signer/btc/verify.ts
index 4dace345..2fce769e 100644
--- a/packages/core/src/signer/btc/verify.ts
+++ b/packages/core/src/signer/btc/verify.ts
@@ -3,6 +3,9 @@ import { magicHash } from "bitcoinjs-message";
import { BytesLike, bytesFrom } from "../../bytes/index.js";
import { hexFrom } from "../../hex/index.js";
+/**
+ * @public
+ */
export function verifyMessageBtcEcdsa(
message: string | BytesLike,
signature: string,
diff --git a/packages/core/src/signer/ckb/signerCkbPrivateKey.ts b/packages/core/src/signer/ckb/signerCkbPrivateKey.ts
index bd8489fb..ba652fbf 100644
--- a/packages/core/src/signer/ckb/signerCkbPrivateKey.ts
+++ b/packages/core/src/signer/ckb/signerCkbPrivateKey.ts
@@ -7,6 +7,9 @@ import { numBeToBytes } from "../../num/index.js";
import { SignerCkbPublicKey } from "./signerCkbPublicKey.js";
import { messageHashCkbSecp256k1 } from "./verifyCkbSecp256k1.js";
+/**
+ * @public
+ */
export class SignerCkbPrivateKey extends SignerCkbPublicKey {
public readonly privateKey: Hex;
diff --git a/packages/core/src/signer/ckb/signerCkbPublicKey.ts b/packages/core/src/signer/ckb/signerCkbPublicKey.ts
index 5cf8b8a0..fbef7fa6 100644
--- a/packages/core/src/signer/ckb/signerCkbPublicKey.ts
+++ b/packages/core/src/signer/ckb/signerCkbPublicKey.ts
@@ -6,6 +6,9 @@ import { hashCkb } from "../../hasher/index.js";
import { Hex, HexLike, hexFrom } from "../../hex/index.js";
import { Signer, SignerSignType, SignerType } from "../signer/index.js";
+/**
+ * @public
+ */
export class SignerCkbPublicKey extends Signer {
get type(): SignerType {
return SignerType.CKB;
diff --git a/packages/core/src/signer/ckb/signerCkbScriptReadonly.ts b/packages/core/src/signer/ckb/signerCkbScriptReadonly.ts
index 4803f292..fa9df8b1 100644
--- a/packages/core/src/signer/ckb/signerCkbScriptReadonly.ts
+++ b/packages/core/src/signer/ckb/signerCkbScriptReadonly.ts
@@ -6,6 +6,7 @@ import { Signer, SignerSignType, SignerType } from "../signer/index.js";
/**
* A class extending Signer that provides read-only access to a CKB script.
* This class does not support signing operations.
+ * @public
*/
export class SignerCkbScriptReadonly extends Signer {
get type(): SignerType {
diff --git a/packages/core/src/signer/ckb/verifyCkbSecp256k1.ts b/packages/core/src/signer/ckb/verifyCkbSecp256k1.ts
index c958c34e..bf322dea 100644
--- a/packages/core/src/signer/ckb/verifyCkbSecp256k1.ts
+++ b/packages/core/src/signer/ckb/verifyCkbSecp256k1.ts
@@ -4,12 +4,18 @@ import { hashCkb } from "../../hasher/index.js";
import { Hex, hexFrom } from "../../hex/index.js";
import { numFrom } from "../../num/index.js";
+/**
+ * @public
+ */
export function messageHashCkbSecp256k1(message: string | BytesLike): Hex {
const msg = typeof message === "string" ? message : hexFrom(message);
const buffer = bytesFrom(`Nervos Message:${msg}`, "utf8");
return hashCkb(buffer);
}
+/**
+ * @public
+ */
export function verifyMessageCkbSecp256k1(
message: string | BytesLike,
signature: string,
diff --git a/packages/core/src/signer/ckb/verifyJoyId.ts b/packages/core/src/signer/ckb/verifyJoyId.ts
index 649c6868..b091112d 100644
--- a/packages/core/src/signer/ckb/verifyJoyId.ts
+++ b/packages/core/src/signer/ckb/verifyJoyId.ts
@@ -2,6 +2,9 @@ import { verifySignature } from "@joyid/ckb";
import { BytesLike } from "../../bytes/index.js";
import { hexFrom } from "../../hex/index.js";
+/**
+ * @public
+ */
export function verifyMessageJoyId(
message: string | BytesLike,
signature: string,
diff --git a/packages/core/src/signer/dummy/alwaysError.ts b/packages/core/src/signer/dummy/alwaysError.ts
index 5b9ca63c..d6a68e47 100644
--- a/packages/core/src/signer/dummy/alwaysError.ts
+++ b/packages/core/src/signer/dummy/alwaysError.ts
@@ -2,6 +2,9 @@ import { Client } from "../../client/index.js";
import { SignerType } from "../signer/index.js";
import { SignerDummy } from "./dummy.js";
+/**
+ * @public
+ */
export class SignerAlwaysError extends SignerDummy {
constructor(
client: Client,
diff --git a/packages/core/src/signer/dummy/dummy.ts b/packages/core/src/signer/dummy/dummy.ts
index 172a3b2b..3d2ad357 100644
--- a/packages/core/src/signer/dummy/dummy.ts
+++ b/packages/core/src/signer/dummy/dummy.ts
@@ -2,6 +2,9 @@ import { Address } from "../../address/index.js";
import { Client } from "../../client/index.js";
import { Signer, SignerSignType, SignerType } from "../signer/index.js";
+/**
+ * @public
+ */
export abstract class SignerDummy extends Signer {
get signType(): SignerSignType {
return SignerSignType.Unknown;
diff --git a/packages/core/src/signer/dummy/openLink.ts b/packages/core/src/signer/dummy/openLink.ts
index fef7b127..382b335a 100644
--- a/packages/core/src/signer/dummy/openLink.ts
+++ b/packages/core/src/signer/dummy/openLink.ts
@@ -2,6 +2,9 @@ import { Client } from "../../client/index.js";
import { SignerType } from "../signer/index.js";
import { SignerDummy } from "./dummy.js";
+/**
+ * @public
+ */
export class SignerOpenLink extends SignerDummy {
constructor(
client: Client,
diff --git a/packages/core/src/signer/evm/signerEvm.ts b/packages/core/src/signer/evm/signerEvm.ts
index 8d5f4311..8e31a3f8 100644
--- a/packages/core/src/signer/evm/signerEvm.ts
+++ b/packages/core/src/signer/evm/signerEvm.ts
@@ -16,6 +16,7 @@ import { Signer, SignerSignType, SignerType } from "../signer/index.js";
/**
* An abstract class extending Signer for Ethereum Virtual Machine (EVM) based signing operations.
* This class provides methods to get EVM account, internal address, and signing transactions.
+ * @public
*/
export abstract class SignerEvm extends Signer {
get type(): SignerType {
diff --git a/packages/core/src/signer/evm/signerEvmAddressReadonly.ts b/packages/core/src/signer/evm/signerEvmAddressReadonly.ts
index 8c44ed11..133821d0 100644
--- a/packages/core/src/signer/evm/signerEvmAddressReadonly.ts
+++ b/packages/core/src/signer/evm/signerEvmAddressReadonly.ts
@@ -5,6 +5,7 @@ import { SignerEvm } from "./signerEvm.js";
/**
* A class extending SignerEvm that provides read-only access to an EVM address.
* This class does not support signing operations.
+ * @public
*/
export class SignerEvmAddressReadonly extends SignerEvm {
private readonly address: Hex;
diff --git a/packages/core/src/signer/evm/verify.ts b/packages/core/src/signer/evm/verify.ts
index 81c4ab19..8c23ef10 100644
--- a/packages/core/src/signer/evm/verify.ts
+++ b/packages/core/src/signer/evm/verify.ts
@@ -1,6 +1,9 @@
import { verifyMessage } from "ethers";
import { BytesLike, bytesFrom } from "../../bytes/index.js";
+/**
+ * @public
+ */
export function verifyMessageEvmPersonal(
message: string | BytesLike,
signature: string,
diff --git a/packages/core/src/signer/nostr/signerNostr.ts b/packages/core/src/signer/nostr/signerNostr.ts
index ff689833..98423211 100644
--- a/packages/core/src/signer/nostr/signerNostr.ts
+++ b/packages/core/src/signer/nostr/signerNostr.ts
@@ -8,6 +8,9 @@ import { Hex, hexFrom } from "../../hex/index.js";
import { Signer, SignerSignType, SignerType } from "../signer/index.js";
import { buildNostrEventFromMessage } from "./verify.js";
+/**
+ * @public
+ */
export interface NostrEvent {
id?: string;
pubkey?: string;
@@ -18,6 +21,9 @@ export interface NostrEvent {
content: string;
}
+/**
+ * @public
+ */
export abstract class SignerNostr extends Signer {
static CKB_SIG_HASH_ALL_TAG = "ckb_sighash_all";
static CKB_UNLOCK_EVENT_KIND = 23334;
diff --git a/packages/core/src/signer/nostr/verify.ts b/packages/core/src/signer/nostr/verify.ts
index 7433b4a4..8dbb2b11 100644
--- a/packages/core/src/signer/nostr/verify.ts
+++ b/packages/core/src/signer/nostr/verify.ts
@@ -5,6 +5,9 @@ import { BytesLike, bytesFrom } from "../../bytes/index.js";
import { hexFrom } from "../../hex/index.js";
import { NostrEvent } from "./signerNostr.js";
+/**
+ * @public
+ */
export function buildNostrEventFromMessage(
message: string | BytesLike,
): NostrEvent {
diff --git a/packages/core/src/signer/signer/index.ts b/packages/core/src/signer/signer/index.ts
index 398a5cf2..f2f9369e 100644
--- a/packages/core/src/signer/signer/index.ts
+++ b/packages/core/src/signer/signer/index.ts
@@ -10,6 +10,9 @@ import { verifyMessageJoyId } from "../ckb/verifyJoyId.js";
import { verifyMessageEvmPersonal } from "../evm/verify.js";
import { verifyMessageNostrEvent } from "../nostr/verify.js";
+/**
+ * @public
+ */
export enum SignerSignType {
Unknown = "Unknown",
BtcEcdsa = "BtcEcdsa",
@@ -21,6 +24,7 @@ export enum SignerSignType {
/**
* An enumeration of signer display types in wallet.
+ * @public
*/
export enum SignerType {
EVM = "EVM",
@@ -29,23 +33,28 @@ export enum SignerType {
Nostr = "Nostr",
}
+/**
+ * @public
+ */
export type NetworkPreference = {
addressPrefix: string;
signerType: SignerType;
+ /**
+ * Wallet signers should check if the wallet is using preferred networks.
+ * If not, try to switch to the first preferred network.
+ * If non preferred, let users choose what they want.
+ * BTC: // They made a mess...
+ * btc
+ * btcTestnet
+ * btcSignet // OKX
+ * fractalBtc // UniSat
+ */
network: string;
- /*
- Wallet signers should check if the wallet is using preferred networks.
- If not, try to switch to the first preferred network.
- If non preferred, let users choose what they want.
-
- BTC: // They made a mess...
- btc
- btcTestnet
- btcSignet // OKX
- fractalBtc // UniSat
- */
};
+/**
+ * @public
+ */
export class Signature {
constructor(
public signature: string,
@@ -57,6 +66,7 @@ export class Signature {
/**
* An abstract class representing a generic signer.
* This class provides methods to connect, get addresses, and sign transactions.
+ * @public
*/
export abstract class Signer {
constructor(protected client_: Client) {}
@@ -227,7 +237,7 @@ export abstract class Signer {
/**
* Signs a message.
*
- * @param _ - The message to sign, as a string or BytesLike object.
+ * @param message - The message to sign, as a string or BytesLike object.
* @returns A promise that resolves to the signature info.
* @throws Will throw an error if not implemented.
*/
@@ -253,8 +263,8 @@ export abstract class Signer {
/**
* Verify a signature.
*
- * @param _ - The original message.
- * @param _ - The signature to verify.
+ * @param message - The original message.
+ * @param signature - The signature to verify.
* @returns A promise that resolves to the verification result.
* @throws Will throw an error if not implemented.
*/
@@ -326,6 +336,7 @@ export abstract class Signer {
/**
* A class representing information about a signer, including its type and the signer instance.
+ * @public
*/
export class SignerInfo {
constructor(
@@ -336,6 +347,7 @@ export class SignerInfo {
/**
* Represents a wallet with a name, icon, and an array of signer information.
+ * @public
*/
export type Wallet = {
name: string;
diff --git a/packages/core/src/utils/index.ts b/packages/core/src/utils/index.ts
index a8078ff8..093a522a 100644
--- a/packages/core/src/utils/index.ts
+++ b/packages/core/src/utils/index.ts
@@ -1,5 +1,6 @@
/**
* A type safe way to apply a transformer on a value if it's not empty.
+ * @public
*
* @param transformer - The transformer.
* @param value - The value to be transformed.
@@ -11,6 +12,7 @@ export function apply(
): undefined;
/**
* A type safe way to apply a transformer on a value if it's not empty.
+ * @public
*
* @param transformer - The transformer.
* @param value - The value to be transformed.
@@ -19,6 +21,7 @@ export function apply(
export function apply(transformer: (val: T) => R, value: null): undefined;
/**
* A type safe way to apply a transformer on a value if it's not empty.
+ * @public
*
* @param transformer - The transformer.
* @param value - The value to be transformed.
@@ -27,6 +30,7 @@ export function apply(transformer: (val: T) => R, value: null): undefined;
export function apply(transformer: (val: T) => R, value: T): R;
/**
* A type safe way to apply a transformer on a value if it's not empty.
+ * @public
*
* @param transformer - The transformer.
* @param value - The value to be transformed.
@@ -38,6 +42,7 @@ export function apply(
): R | undefined;
/**
* A type safe way to apply a transformer on a value if it's not empty.
+ * @public
*
* @param transformer - The transformer.
* @param value - The value to be transformed.
@@ -49,6 +54,7 @@ export function apply(
): R | undefined;
/**
* A type safe way to apply a transformer on a value if it's not empty.
+ * @public
*
* @param transformer - The transformer.
* @param value - The value to be transformed.
@@ -61,6 +67,7 @@ export function apply(
/**
/**
* A type safe way to apply a transformer on a value if it's not empty.
+ * @public
*
* @param transformer - The transformer.
* @param value - The value to be transformed.
@@ -72,6 +79,7 @@ export function apply(
): R | undefined;
/**
* A type safe way to apply a transformer on a value if it's not empty.
+ * @public
*
* @param transformer - The transformer.
* @param value - The value to be transformed.
@@ -90,6 +98,7 @@ export function apply(
/**
* Similar to Array.reduce, but the accumulator can returns Promise.
+ * @public
*
* @param values - The array to be reduced.
* @param accumulator - A callback to be called for each value. If it returns null, the previous result will be kept.
@@ -104,6 +113,7 @@ export async function reduceAsync(
): Promise;
/**
* Similar to Array.reduce, but the accumulator can returns Promise.
+ * @public
*
* @param values - The array to be reduced.
* @param accumulator - A callback to be called for each value. If it returns null, the previous result will be kept.
@@ -120,6 +130,15 @@ export async function reduceAsync(
) => Promise | T | undefined | null | void,
init: T | Promise,
): Promise;
+/**
+ * Similar to Array.reduce, but the accumulator can returns Promise.
+ * @public
+ *
+ * @param values - The array to be reduced.
+ * @param accumulator - A callback to be called for each value. If it returns null, the previous result will be kept.
+ * @param init - The initial value.
+ * @returns The accumulated result.
+ */
export async function reduceAsync(
values: (V | T)[],
accumulator: (
@@ -147,6 +166,9 @@ export async function reduceAsync(
);
}
+/**
+ * @public
+ */
export function isWebview(userAgent: string): boolean {
return /webview|wv|ip((?!.*Safari)|(?=.*like Safari))/i.test(userAgent);
}
diff --git a/packages/core/typedoc.json b/packages/core/typedoc.json
new file mode 100644
index 00000000..92728b8b
--- /dev/null
+++ b/packages/core/typedoc.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": [
+ "./src/index.ts",
+ "./src/advanced.ts"
+ ],
+ "extends": [
+ "../../typedoc.base.json"
+ ],
+ "name": "@ckb-ccc core"
+}
\ No newline at end of file
diff --git a/packages/eip6963/src/eip1193.advanced.ts b/packages/eip6963/src/eip1193.advanced.ts
index cba508a7..31e94c49 100644
--- a/packages/eip6963/src/eip1193.advanced.ts
+++ b/packages/eip6963/src/eip1193.advanced.ts
@@ -2,26 +2,23 @@ import { Hex } from "@ckb-ccc/core";
/**
* Interface representing a provider for interacting with Ethereum-compatible wallets.
- * @interface
*/
export interface Provider {
/**
* Sends a request to the provider.
- * @type {RequestMethod}
*/
request: RequestMethod;
/**
* Adds an event listener to the provider.
- * @type {OnMethod}
*/
on: OnMethod;
/**
* Removes an event listener from the provider.
- * @param {string} eventName - The name of the event to remove the listener from.
- * @param {(...args: unknown[]) => unknown} listener - The listener function to remove.
- * @returns {Provider} The provider instance.
+ * @param eventName - The name of the event to remove the listener from.
+ * @param listener - The listener function to remove.
+ * @returns The provider instance.
*/
removeListener(
eventName: string,
@@ -31,14 +28,11 @@ export interface Provider {
/**
* Interface representing a method to send requests to the provider.
- * @interface
*/
export interface RequestMethod {
/**
* Signs a message with the personal account.
* @param request - The request object.
- * @param request.method - The method name.
- * @param request.params - The method parameters.
* @returns A promise that resolves to the signed message.
*/
(request: { method: "personal_sign"; params: [string, Hex] }): Promise;
@@ -46,8 +40,6 @@ export interface RequestMethod {
/**
* Requests the accounts from the provider.
* @param request - The request object.
- * @param request.method - The method name.
- * @param request.params - The optional method parameters.
* @returns A promise that resolves to an array of account addresses.
*/
(request: {
@@ -58,8 +50,6 @@ export interface RequestMethod {
/**
* Gets the accounts from the provider.
* @param request - The request object.
- * @param request.method - The method name.
- * @param request.params - The optional method parameters.
* @returns A promise that resolves to an array of account addresses.
*/
(request: { method: "eth_accounts"; params?: undefined }): Promise;
@@ -67,8 +57,6 @@ export interface RequestMethod {
/**
* Sends a generic request to the provider.
* @param request - The request object.
- * @param request.method - The method name.
- * @param request.params - The optional method parameters.
* @returns A promise that resolves to the response from the provider.
*/
(request: {
@@ -79,7 +67,6 @@ export interface RequestMethod {
/**
* Interface representing a method to add event listeners to the provider.
- * @interface
*/
export interface OnMethod {
/**
diff --git a/packages/eip6963/src/eip6963.advanced.ts b/packages/eip6963/src/eip6963.advanced.ts
index 3030fd8d..fdbb3191 100644
--- a/packages/eip6963/src/eip6963.advanced.ts
+++ b/packages/eip6963/src/eip6963.advanced.ts
@@ -2,60 +2,50 @@ import { Provider as EIP1193Provider } from "./eip1193.advanced.js";
/**
* Interface representing an event announcing a provider.
- * @interface
*/
export interface AnnounceProviderEvent {
/**
* The detail of the provider.
- * @type {ProviderDetail}
*/
detail: ProviderDetail;
}
/**
* Interface representing the details of a provider.
- * @interface
*/
export interface ProviderDetail {
/**
* The information about the provider.
- * @type {ProviderInfo}
*/
info: ProviderInfo;
/**
* The provider instance compliant with EIP-1193.
- * @type {EIP1193Provider}
*/
provider: EIP1193Provider;
}
/**
* Interface representing information about a provider.
- * @interface
*/
export interface ProviderInfo {
/**
* The reverse DNS name of the provider.
- * @type {string}
*/
rdns: string;
/**
* The UUID of the provider.
- * @type {string}
*/
uuid: string;
/**
* The name of the provider.
- * @type {string}
*/
name: string;
/**
* The icon URL of the provider.
- * @type {string}
*/
icon: string;
}
diff --git a/packages/eip6963/src/signer.ts b/packages/eip6963/src/signer.ts
index 284b3b75..1a86e237 100644
--- a/packages/eip6963/src/signer.ts
+++ b/packages/eip6963/src/signer.ts
@@ -2,17 +2,16 @@ import { ccc } from "@ckb-ccc/core";
import { Provider } from "./eip1193.advanced.js";
/**
- * Class representing an EVM signer that extends SignerEvm from @ckb-ccc/core.
- * @class
- * @extends {ccc.SignerEvm}
+ * Class representing an EVM signer that extends SignerEvm
+ * @public
*/
export class Signer extends ccc.SignerEvm {
private accountCache?: ccc.Hex = undefined;
/**
* Creates an instance of Signer.
- * @param {ccc.Client} client - The client instance.
- * @param {Provider} provider - The provider.
+ * @param client - The client instance.
+ * @param provider - The provider.
*/
constructor(
client: ccc.Client,
@@ -34,7 +33,7 @@ export class Signer extends ccc.SignerEvm {
/**
* Connects to the provider by requesting accounts.
- * @returns {Promise} A promise that resolves when the connection is established.
+ * @returns A promise that resolves when the connection is established.
*/
async connect(): Promise {
await this.provider.request({ method: "eth_requestAccounts" });
@@ -59,7 +58,7 @@ export class Signer extends ccc.SignerEvm {
/**
* Checks if the provider is connected.
- * @returns {Promise} A promise that resolves to true if connected, false otherwise.
+ * @returns A promise that resolves to true if connected, false otherwise.
*/
async isConnected(): Promise {
return (
@@ -69,8 +68,8 @@ export class Signer extends ccc.SignerEvm {
/**
* Signs a raw message with the personal account.
- * @param {string | ccc.BytesLike} message - The message to sign.
- * @returns {Promise} A promise that resolves to the signed message.
+ * @param message - The message to sign.
+ * @returns A promise that resolves to the signed message.
*/
async signMessageRaw(message: string | ccc.BytesLike): Promise {
const challenge =
diff --git a/packages/eip6963/src/signersFactory.ts b/packages/eip6963/src/signersFactory.ts
index b4e58127..95e065e4 100644
--- a/packages/eip6963/src/signersFactory.ts
+++ b/packages/eip6963/src/signersFactory.ts
@@ -8,14 +8,14 @@ import { Signer } from "./signer.js";
/**
* Class representing a factory for creating and managing Signer instances.
- * @class
+ * @public
*/
export class SignerFactory {
private readonly existedUuids: string[] = [];
/**
* Creates an instance of SignerFactory.
- * @param {ccc.Client} client - The client instance.
+ * @param client - The client instance.
*/
constructor(private readonly client: ccc.Client) {}
diff --git a/packages/eip6963/typedoc.json b/packages/eip6963/typedoc.json
new file mode 100644
index 00000000..d995d042
--- /dev/null
+++ b/packages/eip6963/typedoc.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": [
+ "./src/index.ts",
+ "./src/advanced.ts"
+ ],
+ "extends": [
+ "../../typedoc.base.json"
+ ],
+ "name": "@ckb-ccc eip6963"
+}
\ No newline at end of file
diff --git a/packages/joy-id/src/btc/index.ts b/packages/joy-id/src/btc/index.ts
index 032dcc61..a258870a 100644
--- a/packages/joy-id/src/btc/index.ts
+++ b/packages/joy-id/src/btc/index.ts
@@ -8,9 +8,8 @@ import {
} from "../connectionsStorage/index.js";
/**
- * Class representing a Bitcoin signer that extends SignerBtc from @ckb-ccc/core.
- * @class
- * @extends {ccc.SignerBtc}
+ * Class representing a Bitcoin signer that extends SignerBtc
+ * @public
*/
export class BitcoinSigner extends ccc.SignerBtc {
private connection?: Connection;
@@ -18,9 +17,8 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Ensures that the signer is connected and returns the connection.
- * @private
* @throws Will throw an error if not connected.
- * @returns {Connection} The current connection.
+ * @returns The current connection.
*/
private assertConnection(): Connection {
if (!this.isConnected() || !this.connection) {
@@ -64,7 +62,6 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Gets the configuration for JoyID.
- * @private
* @returns The configuration object.
*/
private getConfig() {
@@ -107,7 +104,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Gets the Bitcoin account address.
- * @returns {Promise} A promise that resolves to the Bitcoin account address.
+ * @returns A promise that resolves to the Bitcoin account address.
*/
async getBtcAccount(): Promise {
const { address } = this.assertConnection();
@@ -116,7 +113,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Gets the Bitcoin public key.
- * @returns {Promise} A promise that resolves to the Bitcoin public key.
+ * @returns A promise that resolves to the Bitcoin public key.
*/
async getBtcPublicKey(): Promise {
const { publicKey } = this.assertConnection();
@@ -125,7 +122,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Connects to the provider by requesting authentication.
- * @returns {Promise} A promise that resolves when the connection is established.
+ * @returns A promise that resolves when the connection is established.
*/
async connect(): Promise {
const config = this.getConfig();
@@ -160,7 +157,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Checks if the signer is connected.
- * @returns {Promise} A promise that resolves to true if connected, false otherwise.
+ * @returns A promise that resolves to true if connected, false otherwise.
*/
async isConnected(): Promise {
if (this.connection) {
@@ -176,8 +173,8 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Signs a raw message with the Bitcoin account.
- * @param {string | ccc.BytesLike} message - The message to sign.
- * @returns {Promise} A promise that resolves to the signed message.
+ * @param message - The message to sign.
+ * @returns A promise that resolves to the signed message.
*/
async signMessageRaw(message: string | ccc.BytesLike): Promise {
const { address } = this.assertConnection();
diff --git a/packages/joy-id/src/ckb/index.ts b/packages/joy-id/src/ckb/index.ts
index 132f242b..4ea5cf05 100644
--- a/packages/joy-id/src/ckb/index.ts
+++ b/packages/joy-id/src/ckb/index.ts
@@ -9,14 +9,13 @@ import {
} from "../connectionsStorage/index.js";
/**
- * Class representing a CKB signer that extends Signer from @ckb-ccc/core.
- * @class
- * @extends {ccc.Signer}
+ * Class representing a CKB signer that extends Signer
+ * @public
*/
export class CkbSigner extends ccc.Signer {
/**
* Gets the signer type.
- * @returns {ccc.SignerType} The type of the signer.
+ * @returns The type of the signer.
*/
get type(): ccc.SignerType {
return ccc.SignerType.CKB;
@@ -24,7 +23,7 @@ export class CkbSigner extends ccc.Signer {
/**
* Gets the sign type.
- * @returns {ccc.SignerSignType} The sign type.
+ * @returns The sign type.
*/
get signType(): ccc.SignerSignType {
return ccc.SignerSignType.JoyId;
@@ -34,9 +33,8 @@ export class CkbSigner extends ccc.Signer {
/**
* Ensures that the signer is connected and returns the connection.
- * @private
* @throws Will throw an error if not connected.
- * @returns {Promise} A promise that resolves to the current connection.
+ * @returns A promise that resolves to the current connection.
*/
private async assertConnection(): Promise {
if (!(await this.isConnected()) || !this.connection) {
@@ -48,12 +46,12 @@ export class CkbSigner extends ccc.Signer {
/**
* Creates an instance of CkbSigner.
- * @param {ccc.Client} client - The client instance.
- * @param {string} name - The name of the signer.
- * @param {string} icon - The icon URL of the signer.
- * @param {string} [_appUri] - The application URI.
- * @param {string} [_aggregatorUri] - The aggregator URI.
- * @param {ConnectionsRepo} [connectionsRepo=new ConnectionsRepoLocalStorage()] - The connections repository.
+ * @param client - The client instance.
+ * @param name - The name of the signer.
+ * @param icon - The icon URL of the signer.
+ * @param _appUri - The application URI.
+ * @param _aggregatorUri - The aggregator URI.
+ * @param connectionsRepo - The connections repository.
*/
constructor(
client: ccc.Client,
@@ -68,7 +66,6 @@ export class CkbSigner extends ccc.Signer {
/**
* Gets the configuration for JoyID.
- * @private
* @returns The configuration object.
*/
private getConfig() {
@@ -85,8 +82,7 @@ export class CkbSigner extends ccc.Signer {
/**
* Gets the aggregator URI.
- * @private
- * @returns {string} The aggregator URI.
+ * @returns The aggregator URI.
*/
private getAggregatorUri(): string {
if (this._aggregatorUri) {
@@ -100,7 +96,7 @@ export class CkbSigner extends ccc.Signer {
/**
* Connects to the provider by requesting authentication.
- * @returns {Promise} A promise that resolves when the connection is established.
+ * @returns A promise that resolves when the connection is established.
*/
async connect(): Promise {
const config = this.getConfig();
@@ -127,7 +123,7 @@ export class CkbSigner extends ccc.Signer {
/**
* Checks if the signer is connected.
- * @returns {Promise} A promise that resolves to true if connected, false otherwise.
+ * @returns A promise that resolves to true if connected, false otherwise.
*/
async isConnected(): Promise {
if (this.connection) {
@@ -139,7 +135,7 @@ export class CkbSigner extends ccc.Signer {
/**
* Gets the internal address.
- * @returns {Promise} A promise that resolves to the internal address.
+ * @returns A promise that resolves to the internal address.
*/
async getInternalAddress(): Promise {
return (await this.assertConnection()).address;
@@ -147,7 +143,7 @@ export class CkbSigner extends ccc.Signer {
/**
* Gets the identity of the signer.
- * @returns {Promise} A promise that resolves to the identity.
+ * @returns A promise that resolves to the identity.
*/
async getIdentity(): Promise {
const connection = await this.assertConnection();
@@ -159,7 +155,7 @@ export class CkbSigner extends ccc.Signer {
/**
* Gets the address object.
- * @returns {Promise} A promise that resolves to the address object.
+ * @returns A promise that resolves to the address object.
*/
async getAddressObj(): Promise {
return await ccc.Address.fromString(
@@ -170,7 +166,7 @@ export class CkbSigner extends ccc.Signer {
/**
* Gets the address objects.
- * @returns {Promise} A promise that resolves to an array of address objects.
+ * @returns A promise that resolves to an array of address objects.
*/
async getAddressObjs(): Promise {
return [await this.getAddressObj()];
@@ -178,8 +174,8 @@ export class CkbSigner extends ccc.Signer {
/**
* Prepares a transaction.
- * @param {ccc.TransactionLike} txLike - The transaction-like object.
- * @returns {Promise} A promise that resolves to the prepared transaction.
+ * @param txLike - The transaction-like object.
+ * @returns A promise that resolves to the prepared transaction.
*/
async prepareTransaction(
txLike: ccc.TransactionLike,
@@ -204,7 +200,6 @@ export class CkbSigner extends ccc.Signer {
/**
* Prepares a transaction for a sub key.
- * @private
* @param tx - The transaction object.
* @param witness - The witness arguments.
* @throws Will throw an error if no COTA cells are found for the sub key wallet.
@@ -253,8 +248,8 @@ export class CkbSigner extends ccc.Signer {
/**
* Signs a transaction.
- * @param {ccc.TransactionLike} txLike - The transaction-like object.
- * @returns {Promise} A promise that resolves to the signed transaction.
+ * @param txLike - The transaction-like object.
+ * @returns A promise that resolves to the signed transaction.
*/
async signOnlyTransaction(
txLike: ccc.TransactionLike,
@@ -306,8 +301,8 @@ export class CkbSigner extends ccc.Signer {
/**
* Signs a raw message with the account.
- * @param {string | ccc.BytesLike} message - The message to sign.
- * @returns {Promise} A promise that resolves to the signed message.
+ * @param message - The message to sign.
+ * @returns A promise that resolves to the signed message.
*/
async signMessageRaw(message: string | ccc.BytesLike): Promise {
const { address } = await this.assertConnection();
@@ -338,8 +333,7 @@ export class CkbSigner extends ccc.Signer {
/**
* Saves the current connection.
- * @private
- * @returns {Promise}
+ * @returns
*/
private async saveConnection(): Promise {
return this.connectionsRepo.set(
@@ -353,8 +347,7 @@ export class CkbSigner extends ccc.Signer {
/**
* Restores the previous connection.
- * @private
- * @returns {Promise}
+ * @returns
*/
private async restoreConnection(): Promise {
this.connection = await this.connectionsRepo.get({
diff --git a/packages/joy-id/src/common/index.ts b/packages/joy-id/src/common/index.ts
index 15657902..9d0fe224 100644
--- a/packages/joy-id/src/common/index.ts
+++ b/packages/joy-id/src/common/index.ts
@@ -18,7 +18,6 @@ import {
/**
* Interface representing the return type for various Dapp request types.
- * @interface
*/
export interface PopupReturnType {
[DappRequestType.Auth]: AuthResponseData;
@@ -42,9 +41,9 @@ export interface PopupReturnType {
/**
* Creates a popup window for JoyID Dapp requests.
- * @param {string} url - The URL to open in the popup.
- * @param {PopupConfigOptions & { joyidAppURL: string }} config - The popup configuration options.
- * @returns {Promise} A promise that resolves to the response data of the requested type.
+ * @param url - The URL to open in the popup.
+ * @param config - The popup configuration options.
+ * @returns A promise that resolves to the response data of the requested type.
* @throws {PopupNotSupportedError} If popups are not supported in the current browser.
* @throws {PopupCancelledError} If the popup is closed by the user.
* @throws {PopupTimeoutError} If the popup operation times out.
diff --git a/packages/joy-id/src/connectionsStorage/index.ts b/packages/joy-id/src/connectionsStorage/index.ts
index fa40079b..d4a96a73 100644
--- a/packages/joy-id/src/connectionsStorage/index.ts
+++ b/packages/joy-id/src/connectionsStorage/index.ts
@@ -2,20 +2,23 @@ import { ccc } from "@ckb-ccc/core";
/**
* Type representing an account selector with a URI and address type.
- * @typedef {Object} AccountSelector
- * @property {string} uri - The URI of the account.
- * @property {string} addressType - The address type of the account.
*/
export type AccountSelector = {
+ /**
+ * The URI of the account.
+ */
uri: string;
+ /**
+ * The address type of the account.
+ */
addressType: string;
};
/**
- * Checks if two AccountSelectors are equal.
- * @param {AccountSelector} a - The first account selector.
- * @param {AccountSelector} b - The second account selector.
- * @returns {boolean} True if the selectors are equal, false otherwise.
+ * Checks if a AccountSelector matches the filter
+ * @param a - The first account selector.
+ * @param filter - The account selector filter.
+ * @returns True if the selector matches the filter
*/
export function isSelectorMatch(
a: AccountSelector,
@@ -26,34 +29,38 @@ export function isSelectorMatch(
/**
* Type representing a connection with an address, public key, and key type.
- * @typedef {Object} Connection
- * @property {string} address - The address of the connection.
- * @property {ccc.Hex} publicKey - The public key of the connection.
- * @property {string} keyType - The key type of the connection.
*/
export type Connection = {
+ /**
+ * The address of the connection.
+ */
readonly address: string;
+ /**
+ * The public key of the connection.
+ */
readonly publicKey: ccc.Hex;
+ /**
+ * The key type of the connection.
+ */
readonly keyType: string;
};
/**
* Interface representing a repository for managing connections.
- * @interface
*/
export interface ConnectionsRepo {
/**
* Gets a connection for the given selector.
- * @param {AccountSelector} selector - The account selector.
- * @returns {Promise} A promise that resolves to the connection, if found.
+ * @param selector - The account selector.
+ * @returns A promise that resolves to the connection, if found.
*/
get(selector: AccountSelector): Promise;
/**
* Sets a connection for the given selector.
- * @param {AccountSelector} selector - The account selector.
- * @param {Connection | undefined} connection - The connection to set.
- * @returns {Promise} A promise that resolves when the connection is set.
+ * @param selector - The account selector.
+ * @param connection - The connection to set.
+ * @returns A promise that resolves when the connection is set.
*/
set(
selector: AccountSelector,
@@ -63,19 +70,17 @@ export interface ConnectionsRepo {
/**
* Class representing a local storage-based repository for managing connections.
- * @class
- * @implements {ConnectionsRepo}
*/
export class ConnectionsRepoLocalStorage implements ConnectionsRepo {
/**
* Creates an instance of ConnectionsRepoLocalStorage.
- * @param {string} [storageKey="ccc-joy-id-signer"] - The local storage key.
+ * @param [storageKey="ccc-joy-id-signer"] - The local storage key.
*/
constructor(private readonly storageKey = "ccc-joy-id-signer") {}
/**
* Reads all connections from local storage.
- * @returns {Promise<[AccountSelector, Connection][]>} A promise that resolves to an array of selectors and connections.
+ * @returns A promise that resolves to an array of selectors and connections.
*/
async readConnections(): Promise<[AccountSelector, Connection][]> {
return JSON.parse(window.localStorage.getItem(this.storageKey) ?? "[]");
@@ -83,8 +88,8 @@ export class ConnectionsRepoLocalStorage implements ConnectionsRepo {
/**
* Gets a connection for the given selector.
- * @param {AccountSelector} selector - The account selector.
- * @returns {Promise} A promise that resolves to the connection, if found.
+ * @param selector - The account selector.
+ * @returns A promise that resolves to the connection, if found.
*/
async get(selector: AccountSelector): Promise {
return (await this.readConnections()).find(([s]) =>
@@ -94,9 +99,9 @@ export class ConnectionsRepoLocalStorage implements ConnectionsRepo {
/**
* Sets a connection for the given selector.
- * @param {AccountSelector} selector - The account selector.
- * @param {Connection | undefined} connection - The connection to set.
- * @returns {Promise}
+ * @param selector - The account selector.
+ * @param connection - The connection to set.
+ * @returns
*/
async set(
selector: AccountSelector,
diff --git a/packages/joy-id/src/evm/index.ts b/packages/joy-id/src/evm/index.ts
index 57d901a2..f6dc47e9 100644
--- a/packages/joy-id/src/evm/index.ts
+++ b/packages/joy-id/src/evm/index.ts
@@ -8,18 +8,16 @@ import {
} from "../connectionsStorage/index.js";
/**
- * Class representing an EVM signer that extends SignerEvm from @ckb-ccc/core.
- * @class
- * @extends {ccc.SignerEvm}
+ * Class representing an EVM signer that extends SignerEvm
+ * @public
*/
export class EvmSigner extends ccc.SignerEvm {
private connection?: Connection;
/**
* Ensures that the signer is connected and returns the connection.
- * @private
* @throws Will throw an error if not connected.
- * @returns {Connection} The current connection.
+ * @returns The current connection.
*/
private assertConnection(): Connection {
if (!this.isConnected() || !this.connection) {
@@ -34,7 +32,7 @@ export class EvmSigner extends ccc.SignerEvm {
* @param client - The client instance.
* @param name - The name of the signer.
* @param icon - The icon URL of the signer.
- * @param appUri - The application URI.
+ * @param _appUri - The application URI.
* @param connectionsRepo - The connections repository.
*/
constructor(
@@ -49,8 +47,7 @@ export class EvmSigner extends ccc.SignerEvm {
/**
* Gets the configuration for JoyID.
- * @private
- * @returns {object} The configuration object.
+ * @returns The configuration object.
*/
private getConfig() {
return {
@@ -75,7 +72,7 @@ export class EvmSigner extends ccc.SignerEvm {
/**
* Connects to the provider by requesting authentication.
- * @returns {Promise} A promise that resolves when the connection is established.
+ * @returns A promise that resolves when the connection is established.
*/
async connect(): Promise {
const config = this.getConfig();
@@ -102,7 +99,7 @@ export class EvmSigner extends ccc.SignerEvm {
/**
* Checks if the signer is connected.
- * @returns {Promise} A promise that resolves to true if connected, false otherwise.
+ * @returns A promise that resolves to true if connected, false otherwise.
*/
async isConnected(): Promise {
if (this.connection) {
@@ -114,8 +111,8 @@ export class EvmSigner extends ccc.SignerEvm {
/**
* Signs a raw message with the EVM account.
- * @param {string | ccc.BytesLike} message - The message to sign.
- * @returns {Promise} A promise that resolves to the signed message.
+ * @param message - The message to sign.
+ * @returns A promise that resolves to the signed message.
*/
async signMessageRaw(message: string | ccc.BytesLike): Promise {
const { address } = this.assertConnection();
@@ -142,8 +139,7 @@ export class EvmSigner extends ccc.SignerEvm {
/**
* Saves the current connection.
- * @private
- * @returns {Promise}
+ * @returns
*/
private async saveConnection(): Promise {
return this.connectionsRepo.set(
@@ -157,8 +153,7 @@ export class EvmSigner extends ccc.SignerEvm {
/**
* Restores the previous connection.
- * @private
- * @returns {Promise}
+ * @returns
*/
private async restoreConnection(): Promise {
this.connection = await this.connectionsRepo.get({
diff --git a/packages/joy-id/src/nostr/index.ts b/packages/joy-id/src/nostr/index.ts
index 1a21a5a2..c3b54af0 100644
--- a/packages/joy-id/src/nostr/index.ts
+++ b/packages/joy-id/src/nostr/index.ts
@@ -8,18 +8,16 @@ import {
} from "../connectionsStorage/index.js";
/**
- * Class representing a Nostr signer that extends SignerNostr from @ckb-ccc/core.
- * @class
- * @extends {ccc.SignerNostr}
+ * Class representing a Nostr signer that extends SignerNostr
+ * @public
*/
export class NostrSigner extends ccc.SignerNostr {
private connection?: Connection;
/**
* Ensures that the signer is connected and returns the connection.
- * @private
* @throws Will throw an error if not connected.
- * @returns {Connection} The current connection.
+ * @returns The current connection.
*/
private assertConnection(): Connection {
if (!this.isConnected() || !this.connection) {
@@ -34,7 +32,7 @@ export class NostrSigner extends ccc.SignerNostr {
* @param client - The client instance.
* @param name - The name of the signer.
* @param icon - The icon URL of the signer.
- * @param appUri - The application URI.
+ * @param _appUri - The application URI.
* @param connectionsRepo - The connections repository.
*/
constructor(
@@ -49,8 +47,7 @@ export class NostrSigner extends ccc.SignerNostr {
/**
* Gets the configuration for JoyID.
- * @private
- * @returns {object} The configuration object.
+ * @returns The configuration object.
*/
private getConfig() {
return {
@@ -67,7 +64,7 @@ export class NostrSigner extends ccc.SignerNostr {
/**
* Connects to the provider by requesting authentication.
- * @returns {Promise} A promise that resolves when the connection is established.
+ * @returns A promise that resolves when the connection is established.
*/
async connect(): Promise {
const config = this.getConfig();
@@ -93,7 +90,7 @@ export class NostrSigner extends ccc.SignerNostr {
/**
* Checks if the signer is connected.
- * @returns {Promise} A promise that resolves to true if connected, false otherwise.
+ * @returns A promise that resolves to true if connected, false otherwise.
*/
async isConnected(): Promise {
if (this.connection) {
@@ -124,8 +121,7 @@ export class NostrSigner extends ccc.SignerNostr {
/**
* Saves the current connection.
- * @private
- * @returns {Promise}
+ * @returns
*/
private async saveConnection(): Promise {
return this.connectionsRepo.set(
@@ -139,8 +135,7 @@ export class NostrSigner extends ccc.SignerNostr {
/**
* Restores the previous connection.
- * @private
- * @returns {Promise}
+ * @returns
*/
private async restoreConnection(): Promise {
this.connection = await this.connectionsRepo.get({
diff --git a/packages/joy-id/src/signerFactory/index.ts b/packages/joy-id/src/signerFactory/index.ts
index 89a8314e..e6a2221f 100644
--- a/packages/joy-id/src/signerFactory/index.ts
+++ b/packages/joy-id/src/signerFactory/index.ts
@@ -9,10 +9,12 @@ import { NostrSigner } from "../nostr/index.js";
* Gets the JoyID signers based on the client, name, and icon.
* If the browser is standalone or a webview, returns SignerAlwaysError instances.
* Otherwise, returns instances of CkbSigner, BitcoinSigner, and EvmSigner.
- * @param {ccc.Client} client - The client instance.
- * @param {string} name - The name of the signer.
- * @param {string} icon - The icon URL of the signer.
- * @returns {ccc.SignerInfo[]} An array of signer information objects.
+ * @public
+ *
+ * @param client - The client instance.
+ * @param name - The name of the signer.
+ * @param icon - The icon URL of the signer.
+ * @returns An array of signer information objects.
*/
export function getJoyIdSigners(
client: ccc.Client,
diff --git a/packages/joy-id/typedoc.json b/packages/joy-id/typedoc.json
new file mode 100644
index 00000000..48a5f6cb
--- /dev/null
+++ b/packages/joy-id/typedoc.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": [
+ "./src/index.ts",
+ "./src/advanced.ts"
+ ],
+ "extends": [
+ "../../typedoc.base.json"
+ ],
+ "name": "@ckb-ccc joy-id"
+}
\ No newline at end of file
diff --git a/packages/lumos-patches/src/default.ts b/packages/lumos-patches/src/default.ts
index a28873bd..b4485f1f 100644
--- a/packages/lumos-patches/src/default.ts
+++ b/packages/lumos-patches/src/default.ts
@@ -45,13 +45,12 @@ function addCellDep(
/**
* Generates a class for collecting custom script cells.
- * @param {string} codeHash - The code hash of the custom script.
- * @returns {typeof JoyIDCellCollector} The CustomCellCollector class.
+ * @param codeHash - The code hash of the custom script.
+ * @returns The CustomCellCollector class.
*/
function generateCollectorClass(codeHash: string) {
/**
* Class representing a collector for custom script cells.
- * @class
*/
return class CustomCellCollector {
readonly fromScript: Script;
@@ -59,11 +58,11 @@ function generateCollectorClass(codeHash: string) {
/**
* Creates an instance of CustomCollector.
- * @param {FromInfo} fromInfo - The information about the address to collect cells from.
- * @param {CellProvider} cellProvider - The provider to collect cells from.
- * @param {Object} options - The options for the collector.
- * @param {QueryOptions} [options.queryOptions={}] - The query options for collecting cells.
- * @param {Config} [options.config=getConfig()] - The Lumos configuration.
+ * @param fromInfo - The information about the address to collect cells from.
+ * @param cellProvider - The provider to collect cells from.
+ * @param options - The options for the collector.
+ * @param] - The query options for collecting cells.
+ * @param [options.config=getConfig()] - The Lumos configuration.
* @throws {Error} If cellProvider is not provided or fromInfo is not a string.
*/
constructor(
@@ -116,9 +115,11 @@ function generateCollectorClass(codeHash: string) {
/**
* Generates custom lock script information.
- * @param {string} codeHash - The code hash of the custom script.
- * @param {CellDep[]} cellDeps - The cell dependencies for the custom script.
- * @returns {LockScriptInfo} The lock script information.
+ * @public
+ *
+ * @param codeHash - The code hash of the custom script.
+ * @param cellDeps - The cell dependencies for the custom script.
+ * @returns The lock script information.
*/
export function generateScriptInfo(
codeHash: string,
@@ -227,7 +228,7 @@ export function generateScriptInfo(
/**
* Generates default script information for CCC.
- * @returns {LockScriptInfo[]} An array of lock script information.
+ * @returns An array of lock script information.
*/
export function generateDefaultScriptInfos(): LockScriptInfo[] {
const mainnet = cccA.MAINNET_SCRIPTS;
diff --git a/packages/lumos-patches/src/utils.ts b/packages/lumos-patches/src/utils.ts
index 5aa00ea8..b55b9f9b 100644
--- a/packages/lumos-patches/src/utils.ts
+++ b/packages/lumos-patches/src/utils.ts
@@ -1,7 +1,9 @@
/**
* Asserts that a condition is true, throwing an error if it is not.
- * @param {unknown} condition - The condition to assert.
- * @param {string} [message="Assert failed"] - The error message to throw if the condition is false.
+ * @public
+ *
+ * @param condition - The condition to assert.
+ * @param [message="Assert failed"] - The error message to throw if the condition is false.
* @throws {Error} If the condition is false.
*/
export function asserts(
diff --git a/packages/lumos-patches/typedoc.json b/packages/lumos-patches/typedoc.json
new file mode 100644
index 00000000..88b77bd8
--- /dev/null
+++ b/packages/lumos-patches/typedoc.json
@@ -0,0 +1,10 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": [
+ "./src/index.ts"
+ ],
+ "extends": [
+ "../../typedoc.base.json"
+ ],
+ "name": "@ckb-ccc lumos-patches"
+}
\ No newline at end of file
diff --git a/packages/nip07/src/signer.ts b/packages/nip07/src/signer.ts
index 11f39b8f..ef9b5a21 100644
--- a/packages/nip07/src/signer.ts
+++ b/packages/nip07/src/signer.ts
@@ -1,6 +1,9 @@
import { ccc } from "@ckb-ccc/core";
import { Provider } from "./nip07.advanced.js";
+/**
+ * @public
+ */
export class Signer extends ccc.SignerNostr {
private publicKeyCache?: Promise = undefined;
diff --git a/packages/nip07/src/signersFactory.ts b/packages/nip07/src/signersFactory.ts
index fe004c29..2c743b6c 100644
--- a/packages/nip07/src/signersFactory.ts
+++ b/packages/nip07/src/signersFactory.ts
@@ -2,6 +2,9 @@ import { ccc } from "@ckb-ccc/core";
import { Provider } from "./nip07.advanced.js";
import { Signer } from "./signer.js";
+/**
+ * @public
+ */
export function getNip07Signer(client: ccc.Client): Signer | undefined {
const windowRef = window as { nostr?: Provider };
diff --git a/packages/nip07/typedoc.json b/packages/nip07/typedoc.json
new file mode 100644
index 00000000..754f9e7b
--- /dev/null
+++ b/packages/nip07/typedoc.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": [
+ "./src/index.ts",
+ "./src/advanced.ts"
+ ],
+ "extends": [
+ "../../typedoc.base.json"
+ ],
+ "name": "@ckb-ccc nip07"
+}
\ No newline at end of file
diff --git a/packages/okx/src/advancedBarrel.ts b/packages/okx/src/advancedBarrel.ts
index 4fd913cf..331d9dbb 100644
--- a/packages/okx/src/advancedBarrel.ts
+++ b/packages/okx/src/advancedBarrel.ts
@@ -39,7 +39,6 @@ export interface NostrProvider extends Nip07A.Provider {
/**
* Interface representing a method to add event listeners to the provider.
- * @interface
*/
export interface NostrOnMethod {
/**
diff --git a/packages/okx/src/btc/index.ts b/packages/okx/src/btc/index.ts
index 7c85f5ef..e47611e6 100644
--- a/packages/okx/src/btc/index.ts
+++ b/packages/okx/src/btc/index.ts
@@ -2,17 +2,17 @@ import { ccc } from "@ckb-ccc/core";
import { BitcoinProvider } from "../advancedBarrel.js";
/**
- * Class representing a Bitcoin signer that extends SignerBtc from @ckb-ccc/core.
- * @class
- * @extends {ccc.SignerBtc}
+ * Class representing a Bitcoin signer that extends SignerBtc
+ * @public
*/
export class BitcoinSigner extends ccc.SignerBtc {
private network = "btcTestnet";
/**
* Creates an instance of Signer.
- * @param {ccc.Client} client - The client instance.
- * @param {Provider} provider - The provider instance.
+ * @param client - The client instance.
+ * @param providers - The providers instance.
+ * @param preferredNetworks - All preferred networks
*/
constructor(
client: ccc.Client,
@@ -61,7 +61,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Gets the Bitcoin account address.
- * @returns {Promise} A promise that resolves to the Bitcoin account address.
+ * @returns A promise that resolves to the Bitcoin account address.
*/
async getBtcAccount(): Promise {
if (this.provider.getAccounts) {
@@ -85,7 +85,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Gets the Bitcoin public key.
- * @returns {Promise} A promise that resolves to the Bitcoin public key.
+ * @returns A promise that resolves to the Bitcoin public key.
*/
async getBtcPublicKey(): Promise {
if (this.provider.getPublicKey) {
@@ -105,7 +105,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Connects to the provider by requesting accounts.
- * @returns {Promise} A promise that resolves when the connection is established.
+ * @returns A promise that resolves when the connection is established.
*/
async connect(): Promise {
if (this.provider.requestAccounts) {
@@ -138,7 +138,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Checks if the signer is connected.
- * @returns {Promise} A promise that resolves to true if connected, false otherwise.
+ * @returns A promise that resolves to true if connected, false otherwise.
*/
async isConnected(): Promise {
try {
@@ -163,8 +163,8 @@ export class BitcoinSigner extends ccc.SignerBtc {
/**
* Signs a raw message with the Bitcoin account.
- * @param {string | ccc.BytesLike} message - The message to sign.
- * @returns {Promise} A promise that resolves to the signed message.
+ * @param message - The message to sign.
+ * @returns A promise that resolves to the signed message.
*/
async signMessageRaw(message: string | ccc.BytesLike): Promise {
const challenge =
diff --git a/packages/okx/src/nostr/index.ts b/packages/okx/src/nostr/index.ts
index f3496997..09acf9f6 100644
--- a/packages/okx/src/nostr/index.ts
+++ b/packages/okx/src/nostr/index.ts
@@ -2,9 +2,8 @@ import { ccc } from "@ckb-ccc/core";
import { NostrProvider } from "../advancedBarrel.js";
/**
- * Class representing a Bitcoin signer that extends SignerBtc from @ckb-ccc/core.
- * @class
- * @extends {ccc.SignerBtc}
+ * Class representing a Bitcoin signer that extends SignerBtc
+ * @public
*/
export class NostrSigner extends ccc.SignerNostr {
private publicKeyCache?: Promise = undefined;
diff --git a/packages/okx/src/signersFactory.ts b/packages/okx/src/signersFactory.ts
index 3553c0fc..3762f6a8 100644
--- a/packages/okx/src/signersFactory.ts
+++ b/packages/okx/src/signersFactory.ts
@@ -5,8 +5,10 @@ import { NostrSigner } from "./nostr/index.js";
/**
* Retrieves the OKX Bitcoin signer if available.
- * @param {ccc.Client} client - The client instance.
- * @returns {BitcoinSigner | undefined} The BitcoinSigner instance if the OKX wallet is available, otherwise undefined.
+ * @public
+ *
+ * @param client - The client instance.
+ * @returns The BitcoinSigner instance if the OKX wallet is available, otherwise undefined.
*/
export function getOKXSigners(
client: ccc.Client,
diff --git a/packages/okx/typedoc.json b/packages/okx/typedoc.json
new file mode 100644
index 00000000..3b2a38e6
--- /dev/null
+++ b/packages/okx/typedoc.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": [
+ "./src/index.ts",
+ "./src/advanced.ts"
+ ],
+ "extends": [
+ "../../typedoc.base.json"
+ ],
+ "name": "@ckb-ccc okx"
+}
\ No newline at end of file
diff --git a/packages/uni-sat/src/advancedBarrel.ts b/packages/uni-sat/src/advancedBarrel.ts
index 9a6f5fe5..e6ae56b5 100644
--- a/packages/uni-sat/src/advancedBarrel.ts
+++ b/packages/uni-sat/src/advancedBarrel.ts
@@ -1,11 +1,10 @@
/**
* Interface representing a provider for interacting with accounts and signing messages.
- * @interface
*/
export interface Provider {
/**
* Requests user accounts.
- * @returns {Promise} A promise that resolves to an array of account addresses.
+ * @returns A promise that resolves to an array of account addresses.
*/
requestAccounts(): Promise;
@@ -35,35 +34,34 @@ export interface Provider {
/**
* Gets the current accounts.
- * @returns {Promise} A promise that resolves to an array of account addresses.
+ * @returns A promise that resolves to an array of account addresses.
*/
getAccounts(): Promise;
/**
* Gets the public key of the account.
- * @returns {Promise} A promise that resolves to the public key.
+ * @returns A promise that resolves to the public key.
*/
getPublicKey(): Promise;
/**
* Signs a message with the specified type.
- * @param {string} msg - The message to sign.
- * @param {"ecdsa" | "bip322-simple"} type - The type of signature.
- * @returns {Promise} A promise that resolves to the signed message.
+ * @param msg - The message to sign.
+ * @param type - The type of signature.
+ * @returns A promise that resolves to the signed message.
*/
signMessage(msg: string, type: "ecdsa" | "bip322-simple"): Promise;
/**
* Adds an event listener to the provider.
- * @type {OnMethod}
*/
on: OnMethod;
/**
* Removes an event listener from the provider.
- * @param {string} eventName - The name of the event to remove the listener from.
- * @param {(...args: unknown[]) => unknown} listener - The listener function to remove.
- * @returns {Provider} The provider instance.
+ * @param eventName - The name of the event to remove the listener from.
+ * @param listener - The listener function to remove.
+ * @returns The provider instance.
*/
removeListener(
eventName: string,
@@ -73,14 +71,13 @@ export interface Provider {
/**
* Interface representing a method to add event listeners to the provider.
- * @interface
*/
export interface OnMethod {
/**
* Adds an event listener to the provider.
- * @param {string} eventName - The name of the event.
- * @param {(...args: unknown[]) => unknown} listener - The listener function.
- * @returns {Provider} The provider instance.
+ * @param eventName - The name of the event.
+ * @param listener - The listener function.
+ * @returns The provider instance.
*/
(eventName: string, listener: (...args: unknown[]) => unknown): Provider;
}
diff --git a/packages/uni-sat/src/signer.ts b/packages/uni-sat/src/signer.ts
index 142f10cd..653bba8e 100644
--- a/packages/uni-sat/src/signer.ts
+++ b/packages/uni-sat/src/signer.ts
@@ -2,15 +2,14 @@ import { ccc } from "@ckb-ccc/core";
import { Provider } from "./advancedBarrel.js";
/**
- * Class representing a Bitcoin signer that extends SignerBtc from @ckb-ccc/core.
- * @class
- * @extends {ccc.SignerBtc}
+ * Class representing a Bitcoin signer that extends SignerBtc
+ * @public
*/
export class Signer extends ccc.SignerBtc {
/**
* Creates an instance of Signer.
- * @param {ccc.Client} client - The client instance.
- * @param {Provider} provider - The provider instance.
+ * @param client - The client instance.
+ * @param provider - The provider instance.
*/
constructor(
client: ccc.Client,
@@ -89,7 +88,7 @@ export class Signer extends ccc.SignerBtc {
/**
* Gets the Bitcoin account address.
- * @returns {Promise} A promise that resolves to the Bitcoin account address.
+ * @returns A promise that resolves to the Bitcoin account address.
*/
async getBtcAccount(): Promise {
return (await this.provider.getAccounts())[0];
@@ -97,7 +96,7 @@ export class Signer extends ccc.SignerBtc {
/**
* Gets the Bitcoin public key.
- * @returns {Promise} A promise that resolves to the Bitcoin public key.
+ * @returns A promise that resolves to the Bitcoin public key.
*/
async getBtcPublicKey(): Promise {
return ccc.hexFrom(await this.provider.getPublicKey());
@@ -105,7 +104,7 @@ export class Signer extends ccc.SignerBtc {
/**
* Connects to the provider by requesting accounts.
- * @returns {Promise} A promise that resolves when the connection is established.
+ * @returns A promise that resolves when the connection is established.
*/
async connect(): Promise {
await this.provider.requestAccounts();
@@ -131,7 +130,7 @@ export class Signer extends ccc.SignerBtc {
/**
* Checks if the signer is connected.
- * @returns {Promise} A promise that resolves to true if connected, false otherwise.
+ * @returns A promise that resolves to true if connected, false otherwise.
*/
async isConnected(): Promise {
if (await this._getNetworkToChange()) {
@@ -142,8 +141,8 @@ export class Signer extends ccc.SignerBtc {
/**
* Signs a raw message with the Bitcoin account.
- * @param {string | ccc.BytesLike} message - The message to sign.
- * @returns {Promise} A promise that resolves to the signed message.
+ * @param message - The message to sign.
+ * @returns A promise that resolves to the signed message.
*/
async signMessageRaw(message: string | ccc.BytesLike): Promise {
const challenge =
diff --git a/packages/uni-sat/src/signersFactory.ts b/packages/uni-sat/src/signersFactory.ts
index 934ccbd6..f3c0f7d3 100644
--- a/packages/uni-sat/src/signersFactory.ts
+++ b/packages/uni-sat/src/signersFactory.ts
@@ -4,8 +4,10 @@ import { Signer } from "./signer.js";
/**
* Retrieves the UniSat signer if available.
- * @param {ccc.Client} client - The client instance.
- * @returns {Signer | undefined} The Signer instance if the UniSat provider is available, otherwise undefined.
+ * @public
+ *
+ * @param client - The client instance.
+ * @returns The Signer instance if the UniSat provider is available, otherwise undefined.
*/
export function getUniSatSigners(
client: ccc.Client,
diff --git a/packages/uni-sat/typedoc.json b/packages/uni-sat/typedoc.json
new file mode 100644
index 00000000..9103aff5
--- /dev/null
+++ b/packages/uni-sat/typedoc.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": [
+ "./src/index.ts",
+ "./src/advanced.ts"
+ ],
+ "extends": [
+ "../../typedoc.base.json"
+ ],
+ "name": "@ckb-ccc uni-sat"
+}
\ No newline at end of file
diff --git a/packages/utxo-global/README.md b/packages/utxo-global/README.md
index 6dfa58c6..e05b7e6f 100644
--- a/packages/utxo-global/README.md
+++ b/packages/utxo-global/README.md
@@ -4,7 +4,7 @@
-
+
UTXO Global Wallet for Nervos - A New Horizon for Your Crypto Adventures!
Invoked when the component is added to the document's DOM.
+In
+ + +connectedCallback()
you should setup tasks that should only occur when +the element is connected to the document. The most common of these is +adding event listeners to nodes external to the element, like a keydown +event handler added to the window.Typically, anything done in
+connectedCallback()
should be undone when the +element is disconnected, indisconnectedCallback()
.