@1sat/wallet-toolbox 0.0.9 → 0.0.10
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/dist/api/balance/index.d.ts +20 -8
- package/dist/api/balance/index.js +104 -51
- package/dist/api/broadcast/index.d.ts +5 -3
- package/dist/api/broadcast/index.js +65 -37
- package/dist/api/index.d.ts +15 -15
- package/dist/api/index.js +38 -17
- package/dist/api/inscriptions/index.d.ts +9 -9
- package/dist/api/inscriptions/index.js +79 -31
- package/dist/api/locks/index.d.ts +15 -12
- package/dist/api/locks/index.js +252 -194
- package/dist/api/ordinals/index.d.ts +50 -35
- package/dist/api/ordinals/index.js +469 -349
- package/dist/api/payments/index.d.ts +15 -4
- package/dist/api/payments/index.js +147 -92
- package/dist/api/signing/index.d.ts +8 -5
- package/dist/api/signing/index.js +70 -33
- package/dist/api/skills/registry.d.ts +61 -0
- package/dist/api/skills/registry.js +74 -0
- package/dist/api/skills/types.d.ts +71 -0
- package/dist/api/skills/types.js +14 -0
- package/dist/api/tokens/index.d.ts +37 -38
- package/dist/api/tokens/index.js +398 -341
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/wallet/factory.d.ts +64 -0
- package/dist/wallet/factory.js +129 -0
- package/dist/wallet/index.d.ts +1 -0
- package/dist/wallet/index.js +1 -0
- package/package.json +10 -1
- package/dist/OneSatWallet.d.ts +0 -316
- package/dist/OneSatWallet.js +0 -956
- package/dist/api/OneSatApi.d.ts +0 -100
- package/dist/api/OneSatApi.js +0 -156
- package/dist/indexers/TransactionParser.d.ts +0 -53
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Ordinals Module
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Skills for managing ordinals/inscriptions.
|
|
5
5
|
* Returns WalletOutput[] directly from the SDK - no custom mapping needed.
|
|
6
6
|
*/
|
|
7
|
-
import { type
|
|
8
|
-
import type {
|
|
7
|
+
import { type WalletOutput, type CreateActionArgs } from "@bsv/sdk";
|
|
8
|
+
import type { Skill, OneSatContext } from "../skills/types";
|
|
9
|
+
type PubKeyHex = string;
|
|
9
10
|
export interface TransferOrdinalRequest {
|
|
10
|
-
/** Outpoint of the ordinal to transfer (txid_vout
|
|
11
|
+
/** Outpoint of the ordinal to transfer (txid_vout format) */
|
|
11
12
|
outpoint: string;
|
|
12
|
-
/**
|
|
13
|
-
|
|
13
|
+
/** Recipient's identity public key (preferred) */
|
|
14
|
+
counterparty?: PubKeyHex;
|
|
15
|
+
/** Legacy: raw P2PKH address */
|
|
16
|
+
address?: string;
|
|
17
|
+
/** Paymail address */
|
|
18
|
+
paymail?: string;
|
|
14
19
|
}
|
|
15
20
|
export interface ListOrdinalRequest {
|
|
16
21
|
/** Outpoint of ordinal to list */
|
|
@@ -19,8 +24,6 @@ export interface ListOrdinalRequest {
|
|
|
19
24
|
price: number;
|
|
20
25
|
/** Address that receives payment on purchase (BRC-29 receive address) */
|
|
21
26
|
payAddress: string;
|
|
22
|
-
/** Address that can cancel the listing (optional - derived from CWI if not provided) */
|
|
23
|
-
cancelAddress?: string;
|
|
24
27
|
}
|
|
25
28
|
export interface PurchaseOrdinalRequest {
|
|
26
29
|
/** Outpoint of listing to purchase */
|
|
@@ -29,59 +32,71 @@ export interface PurchaseOrdinalRequest {
|
|
|
29
32
|
marketplaceAddress?: string;
|
|
30
33
|
/** Marketplace fee rate (0-1) */
|
|
31
34
|
marketplaceRate?: number;
|
|
35
|
+
/** Optional content type - looked up from ordfs API if not provided */
|
|
36
|
+
contentType?: string;
|
|
37
|
+
/** Optional origin outpoint - looked up from ordfs API if not provided */
|
|
38
|
+
origin?: string;
|
|
32
39
|
}
|
|
33
40
|
export interface OrdinalOperationResponse {
|
|
34
41
|
txid?: string;
|
|
35
42
|
rawtx?: string;
|
|
36
43
|
error?: string;
|
|
37
44
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Derive a cancel address for an ordinal listing.
|
|
40
|
-
* Uses the outpoint as keyID with security level 1 (self-only).
|
|
41
|
-
*/
|
|
42
|
-
export declare function deriveCancelAddress(cwi: WalletInterface, outpoint: string): Promise<string>;
|
|
43
|
-
/**
|
|
44
|
-
* List ordinals from the 1sat basket.
|
|
45
|
-
* Returns WalletOutput[] directly - use tags for metadata (origin:, type:, name:, own:, list:).
|
|
46
|
-
*/
|
|
47
|
-
export declare function listOrdinals(cwi: WalletInterface, options?: Partial<ListOutputsArgs>): Promise<WalletOutput[]>;
|
|
48
45
|
/**
|
|
49
46
|
* Build CreateActionArgs for transferring an ordinal.
|
|
50
47
|
* Does NOT execute - returns params for createAction.
|
|
51
48
|
*/
|
|
52
|
-
export declare function buildTransferOrdinal(
|
|
49
|
+
export declare function buildTransferOrdinal(ctx: OneSatContext, request: TransferOrdinalRequest): Promise<CreateActionArgs | {
|
|
53
50
|
error: string;
|
|
54
51
|
}>;
|
|
55
52
|
/**
|
|
56
53
|
* Build CreateActionArgs for listing an ordinal for sale.
|
|
57
54
|
* Does NOT execute - returns params for createAction.
|
|
58
|
-
* If cancelAddress is not provided, it will be derived from the CWI.
|
|
59
55
|
*/
|
|
60
|
-
export declare function buildListOrdinal(
|
|
56
|
+
export declare function buildListOrdinal(ctx: OneSatContext, request: ListOrdinalRequest): Promise<CreateActionArgs | {
|
|
61
57
|
error: string;
|
|
62
58
|
}>;
|
|
59
|
+
/** Input for listOrdinals skill */
|
|
60
|
+
export interface ListOrdinalsInput {
|
|
61
|
+
/** Max number of ordinals to return */
|
|
62
|
+
limit?: number;
|
|
63
|
+
/** Offset for pagination */
|
|
64
|
+
offset?: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* List ordinals from the wallet.
|
|
68
|
+
*/
|
|
69
|
+
export declare const listOrdinals: Skill<ListOrdinalsInput, WalletOutput[]>;
|
|
70
|
+
/** Input for deriveCancelAddress skill */
|
|
71
|
+
export interface DeriveCancelAddressInput {
|
|
72
|
+
/** Outpoint of the ordinal listing */
|
|
73
|
+
outpoint: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Derive a cancel address for an ordinal listing.
|
|
77
|
+
*/
|
|
78
|
+
export declare const deriveCancelAddress: Skill<DeriveCancelAddressInput, string>;
|
|
63
79
|
/**
|
|
64
|
-
* Transfer an ordinal to a new
|
|
80
|
+
* Transfer an ordinal to a new owner.
|
|
65
81
|
*/
|
|
66
|
-
export declare
|
|
82
|
+
export declare const transferOrdinal: Skill<TransferOrdinalRequest, OrdinalOperationResponse>;
|
|
67
83
|
/**
|
|
68
84
|
* List an ordinal for sale on the global orderbook.
|
|
69
85
|
*/
|
|
70
|
-
export declare
|
|
86
|
+
export declare const listOrdinal: Skill<ListOrdinalRequest, OrdinalOperationResponse>;
|
|
87
|
+
/** Input for cancelListing skill */
|
|
88
|
+
export interface CancelListingInput {
|
|
89
|
+
/** Outpoint of the listing to cancel */
|
|
90
|
+
outpoint: string;
|
|
91
|
+
}
|
|
71
92
|
/**
|
|
72
93
|
* Cancel an ordinal listing.
|
|
73
|
-
* Uses the origin tag to recover the keyID for signing.
|
|
74
|
-
* Cancel unlock script: <sig> <pubkey> OP_1
|
|
75
94
|
*/
|
|
76
|
-
export declare
|
|
95
|
+
export declare const cancelListing: Skill<CancelListingInput, OrdinalOperationResponse>;
|
|
77
96
|
/**
|
|
78
97
|
* Purchase an ordinal from the global orderbook.
|
|
79
|
-
*
|
|
80
|
-
* Flow:
|
|
81
|
-
* 1. Fetch listing BEEF to get the locking script
|
|
82
|
-
* 2. Decode OrdLock to get price and payout
|
|
83
|
-
* 3. Build P2PKH output for buyer
|
|
84
|
-
* 4. Build payment output for seller
|
|
85
|
-
* 5. Build custom OrdLock purchase unlock (preimage only, no signature)
|
|
86
98
|
*/
|
|
87
|
-
export declare
|
|
99
|
+
export declare const purchaseOrdinal: Skill<PurchaseOrdinalRequest, OrdinalOperationResponse>;
|
|
100
|
+
/** All ordinals skills for registry */
|
|
101
|
+
export declare const ordinalsSkills: (Skill<ListOrdinalsInput, WalletOutput[]> | Skill<DeriveCancelAddressInput, string> | Skill<TransferOrdinalRequest, OrdinalOperationResponse> | Skill<ListOrdinalRequest, OrdinalOperationResponse> | Skill<PurchaseOrdinalRequest, OrdinalOperationResponse>)[];
|
|
102
|
+
export {};
|