@ckb-ccc/okx 0.0.12-alpha.7 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +5 -5
- package/dist/advancedBarrel.d.ts +0 -1
- package/dist/advancedBarrel.d.ts.map +1 -1
- package/dist/btc/index.d.ts +11 -11
- package/dist/btc/index.d.ts.map +1 -1
- package/dist/btc/index.js +11 -11
- package/dist/nostr/index.d.ts +2 -3
- package/dist/nostr/index.d.ts.map +1 -1
- package/dist/nostr/index.js +2 -3
- package/dist/signersFactory.d.ts +4 -2
- package/dist/signersFactory.d.ts.map +1 -1
- package/dist/signersFactory.js +4 -2
- package/dist.commonjs/advanced.d.ts +1 -1
- package/dist.commonjs/advanced.js +19 -40
- package/dist.commonjs/advancedBarrel.d.ts +31 -37
- package/dist.commonjs/advancedBarrel.d.ts.map +1 -1
- package/dist.commonjs/barrel.d.ts +1 -1
- package/dist.commonjs/barrel.js +14 -30
- package/dist.commonjs/btc/index.d.ts +41 -45
- package/dist.commonjs/btc/index.d.ts.map +1 -1
- package/dist.commonjs/btc/index.js +132 -144
- package/dist.commonjs/index.d.ts +1 -1
- package/dist.commonjs/index.js +19 -40
- package/dist.commonjs/nostr/index.d.ts +11 -12
- package/dist.commonjs/nostr/index.d.ts.map +1 -1
- package/dist.commonjs/nostr/index.js +49 -50
- package/dist.commonjs/signersFactory.d.ts +6 -7
- package/dist.commonjs/signersFactory.d.ts.map +1 -1
- package/dist.commonjs/signersFactory.js +18 -20
- package/package.json +4 -4
- package/src/advancedBarrel.ts +0 -1
- package/src/btc/index.ts +11 -11
- package/src/nostr/index.ts +2 -3
- package/src/signersFactory.ts +4 -2
- package/typedoc.json +6 -0
package/src/btc/index.ts
CHANGED
|
@@ -2,17 +2,17 @@ import { ccc } from "@ckb-ccc/core";
|
|
|
2
2
|
import { BitcoinProvider } from "../advancedBarrel.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Class representing a Bitcoin signer that extends SignerBtc
|
|
6
|
-
* @
|
|
7
|
-
* @extends {ccc.SignerBtc}
|
|
5
|
+
* Class representing a Bitcoin signer that extends SignerBtc
|
|
6
|
+
* @public
|
|
8
7
|
*/
|
|
9
8
|
export class BitcoinSigner extends ccc.SignerBtc {
|
|
10
9
|
private network = "btcTestnet";
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Creates an instance of Signer.
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
13
|
+
* @param client - The client instance.
|
|
14
|
+
* @param providers - The providers instance.
|
|
15
|
+
* @param preferredNetworks - All preferred networks
|
|
16
16
|
*/
|
|
17
17
|
constructor(
|
|
18
18
|
client: ccc.Client,
|
|
@@ -61,7 +61,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
|
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Gets the Bitcoin account address.
|
|
64
|
-
* @returns
|
|
64
|
+
* @returns A promise that resolves to the Bitcoin account address.
|
|
65
65
|
*/
|
|
66
66
|
async getBtcAccount(): Promise<string> {
|
|
67
67
|
if (this.provider.getAccounts) {
|
|
@@ -85,7 +85,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
|
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Gets the Bitcoin public key.
|
|
88
|
-
* @returns
|
|
88
|
+
* @returns A promise that resolves to the Bitcoin public key.
|
|
89
89
|
*/
|
|
90
90
|
async getBtcPublicKey(): Promise<ccc.Hex> {
|
|
91
91
|
if (this.provider.getPublicKey) {
|
|
@@ -105,7 +105,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
|
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* Connects to the provider by requesting accounts.
|
|
108
|
-
* @returns
|
|
108
|
+
* @returns A promise that resolves when the connection is established.
|
|
109
109
|
*/
|
|
110
110
|
async connect(): Promise<void> {
|
|
111
111
|
if (this.provider.requestAccounts) {
|
|
@@ -138,7 +138,7 @@ export class BitcoinSigner extends ccc.SignerBtc {
|
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* Checks if the signer is connected.
|
|
141
|
-
* @returns
|
|
141
|
+
* @returns A promise that resolves to true if connected, false otherwise.
|
|
142
142
|
*/
|
|
143
143
|
async isConnected(): Promise<boolean> {
|
|
144
144
|
try {
|
|
@@ -163,8 +163,8 @@ export class BitcoinSigner extends ccc.SignerBtc {
|
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
165
|
* Signs a raw message with the Bitcoin account.
|
|
166
|
-
* @param
|
|
167
|
-
* @returns
|
|
166
|
+
* @param message - The message to sign.
|
|
167
|
+
* @returns A promise that resolves to the signed message.
|
|
168
168
|
*/
|
|
169
169
|
async signMessageRaw(message: string | ccc.BytesLike): Promise<string> {
|
|
170
170
|
const challenge =
|
package/src/nostr/index.ts
CHANGED
|
@@ -2,9 +2,8 @@ import { ccc } from "@ckb-ccc/core";
|
|
|
2
2
|
import { NostrProvider } from "../advancedBarrel.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Class representing a Bitcoin signer that extends SignerBtc
|
|
6
|
-
* @
|
|
7
|
-
* @extends {ccc.SignerBtc}
|
|
5
|
+
* Class representing a Bitcoin signer that extends SignerBtc
|
|
6
|
+
* @public
|
|
8
7
|
*/
|
|
9
8
|
export class NostrSigner extends ccc.SignerNostr {
|
|
10
9
|
private publicKeyCache?: Promise<string> = undefined;
|
package/src/signersFactory.ts
CHANGED
|
@@ -5,8 +5,10 @@ import { NostrSigner } from "./nostr/index.js";
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Retrieves the OKX Bitcoin signer if available.
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
8
|
+
* @public
|
|
9
|
+
*
|
|
10
|
+
* @param client - The client instance.
|
|
11
|
+
* @returns The BitcoinSigner instance if the OKX wallet is available, otherwise undefined.
|
|
10
12
|
*/
|
|
11
13
|
export function getOKXSigners(
|
|
12
14
|
client: ccc.Client,
|