@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,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tokens Module
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Skills for managing BSV21 tokens.
|
|
5
5
|
*/
|
|
6
|
-
import { type
|
|
7
|
-
import type {
|
|
6
|
+
import { type WalletOutput } from "@bsv/sdk";
|
|
7
|
+
import type { Skill } from "../skills/types";
|
|
8
|
+
type PubKeyHex = string;
|
|
8
9
|
export interface Bsv21Balance {
|
|
9
10
|
/** Token protocol (bsv-20) */
|
|
10
11
|
p: string;
|
|
@@ -32,57 +33,55 @@ export interface Bsv21Balance {
|
|
|
32
33
|
export interface SendBsv21Request {
|
|
33
34
|
/** Token ID (txid_vout format) */
|
|
34
35
|
tokenId: string;
|
|
35
|
-
/** Destination address */
|
|
36
|
-
address: string;
|
|
37
36
|
/** Amount to send (as bigint or string) */
|
|
38
37
|
amount: bigint | string;
|
|
38
|
+
/** Recipient's identity public key (preferred) */
|
|
39
|
+
counterparty?: PubKeyHex;
|
|
40
|
+
/** Legacy: raw P2PKH address */
|
|
41
|
+
address?: string;
|
|
42
|
+
/** Paymail address */
|
|
43
|
+
paymail?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface PurchaseBsv21Request {
|
|
46
|
+
/** Token ID (txid_vout format of the deploy transaction) */
|
|
47
|
+
tokenId: string;
|
|
48
|
+
/** Outpoint of listed token UTXO (OrdLock containing BSV21) */
|
|
49
|
+
outpoint: string;
|
|
50
|
+
/** Amount of tokens in the listing */
|
|
51
|
+
amount: bigint | string;
|
|
52
|
+
/** Optional marketplace fee address */
|
|
53
|
+
marketplaceAddress?: string;
|
|
54
|
+
/** Optional marketplace fee rate (0-1) */
|
|
55
|
+
marketplaceRate?: number;
|
|
39
56
|
}
|
|
40
57
|
export interface TokenOperationResponse {
|
|
41
58
|
txid?: string;
|
|
42
59
|
rawtx?: string;
|
|
43
60
|
error?: string;
|
|
44
61
|
}
|
|
62
|
+
/** Input for listTokens skill */
|
|
63
|
+
export interface ListTokensInput {
|
|
64
|
+
/** Max number of tokens to return */
|
|
65
|
+
limit?: number;
|
|
66
|
+
}
|
|
45
67
|
/**
|
|
46
|
-
* List BSV21 token outputs from the
|
|
47
|
-
* Returns WalletOutput[] directly - use tags for metadata.
|
|
68
|
+
* List BSV21 token outputs from the wallet.
|
|
48
69
|
*/
|
|
49
|
-
export declare
|
|
70
|
+
export declare const listTokens: Skill<ListTokensInput, WalletOutput[]>;
|
|
71
|
+
/** Input for getBsv21Balances skill (no required params) */
|
|
72
|
+
export type GetBsv21BalancesInput = Record<string, never>;
|
|
50
73
|
/**
|
|
51
74
|
* Get aggregated BSV21 token balances.
|
|
52
|
-
* Groups outputs by token ID and sums amounts.
|
|
53
75
|
*/
|
|
54
|
-
export declare
|
|
76
|
+
export declare const getBsv21Balances: Skill<GetBsv21BalancesInput, Bsv21Balance[]>;
|
|
55
77
|
/**
|
|
56
78
|
* Send BSV21 tokens to an address.
|
|
57
|
-
*
|
|
58
|
-
* Flow:
|
|
59
|
-
* 1. Get token UTXOs from basket
|
|
60
|
-
* 2. Validate each with BSV21 service
|
|
61
|
-
* 3. Select UTXOs until we have enough tokens
|
|
62
|
-
* 4. Build transfer inscription outputs
|
|
63
|
-
* 5. Create and sign transaction
|
|
64
79
|
*/
|
|
65
|
-
export declare
|
|
66
|
-
export interface PurchaseBsv21Request {
|
|
67
|
-
/** Token ID (txid_vout format of the deploy transaction) */
|
|
68
|
-
tokenId: string;
|
|
69
|
-
/** Outpoint of listed token UTXO (OrdLock containing BSV21) */
|
|
70
|
-
outpoint: string;
|
|
71
|
-
/** Amount of tokens in the listing */
|
|
72
|
-
amount: bigint | string;
|
|
73
|
-
/** Optional marketplace fee address */
|
|
74
|
-
marketplaceAddress?: string;
|
|
75
|
-
/** Optional marketplace fee rate (0-1) */
|
|
76
|
-
marketplaceRate?: number;
|
|
77
|
-
}
|
|
80
|
+
export declare const sendBsv21: Skill<SendBsv21Request, TokenOperationResponse>;
|
|
78
81
|
/**
|
|
79
82
|
* Purchase BSV21 tokens from marketplace.
|
|
80
|
-
*
|
|
81
|
-
* Flow:
|
|
82
|
-
* 1. Fetch listing BEEF to get the locking script
|
|
83
|
-
* 2. Decode OrdLock to get price and payout
|
|
84
|
-
* 3. Build BSV21 transfer output for buyer
|
|
85
|
-
* 4. Build payment output for seller
|
|
86
|
-
* 5. Build custom OrdLock purchase unlock (preimage only, no signature)
|
|
87
83
|
*/
|
|
88
|
-
export declare
|
|
84
|
+
export declare const purchaseBsv21: Skill<PurchaseBsv21Request, TokenOperationResponse>;
|
|
85
|
+
/** All token skills for registry */
|
|
86
|
+
export declare const tokensSkills: (Skill<ListTokensInput, WalletOutput[]> | Skill<GetBsv21BalancesInput, Bsv21Balance[]> | Skill<SendBsv21Request, TokenOperationResponse> | Skill<PurchaseBsv21Request, TokenOperationResponse>)[];
|
|
87
|
+
export {};
|