@ckb-ccc/core 0.0.6-alpha.0 → 0.0.7-alpha.1
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/address/address.advanced.d.ts.map +1 -1
- package/dist/address/address.advanced.js +2 -5
- package/dist/address/index.d.ts +1 -1
- package/dist/address/index.d.ts.map +1 -1
- package/dist/address/index.js +2 -5
- package/dist/ckb/script.d.ts +43 -1
- package/dist/ckb/script.d.ts.map +1 -1
- package/dist/ckb/script.js +51 -0
- package/dist/ckb/transaction.d.ts +198 -21
- package/dist/ckb/transaction.d.ts.map +1 -1
- package/dist/ckb/transaction.js +440 -21
- package/dist/client/advanced.d.ts +2 -0
- package/dist/client/advanced.d.ts.map +1 -1
- package/dist/client/advanced.js +2 -0
- package/dist/client/client.advanced.d.ts +10 -0
- package/dist/client/client.advanced.d.ts.map +1 -0
- package/dist/client/client.advanced.js +80 -0
- package/dist/client/client.d.ts +44 -8
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +137 -9
- package/dist/client/clientPublicMainnet.advanced.d.ts +4 -2
- package/dist/client/clientPublicMainnet.advanced.d.ts.map +1 -1
- package/dist/client/clientPublicMainnet.advanced.js +102 -0
- package/dist/client/clientPublicMainnet.d.ts +4 -2
- package/dist/client/clientPublicMainnet.d.ts.map +1 -1
- package/dist/client/clientPublicMainnet.js +5 -1
- package/dist/client/clientPublicTestnet.advanced.d.ts +4 -2
- package/dist/client/clientPublicTestnet.advanced.d.ts.map +1 -1
- package/dist/client/clientPublicTestnet.advanced.js +151 -0
- package/dist/client/clientPublicTestnet.d.ts +4 -2
- package/dist/client/clientPublicTestnet.d.ts.map +1 -1
- package/dist/client/clientPublicTestnet.js +6 -1
- package/dist/client/clientTypes.advanced.d.ts +23 -0
- package/dist/client/clientTypes.advanced.d.ts.map +1 -0
- package/dist/client/clientTypes.advanced.js +4 -0
- package/dist/client/clientTypes.d.ts +22 -36
- package/dist/client/clientTypes.d.ts.map +1 -1
- package/dist/client/clientTypes.js +15 -12
- package/dist/client/jsonRpc/index.d.ts +3 -3
- package/dist/client/jsonRpc/index.d.ts.map +1 -1
- package/dist/client/jsonRpc/index.js +3 -3
- package/dist/client/jsonRpc/transformers.d.ts +5 -7
- package/dist/client/jsonRpc/transformers.d.ts.map +1 -1
- package/dist/client/jsonRpc/transformers.js +8 -6
- package/dist/hasher/index.d.ts +1 -1
- package/dist/hasher/index.d.ts.map +1 -1
- package/dist/hasher/index.js +4 -2
- package/dist/num/index.d.ts +12 -0
- package/dist/num/index.d.ts.map +1 -1
- package/dist/num/index.js +21 -0
- package/dist/signer/btc/signerBtc.d.ts.map +1 -1
- package/dist/signer/btc/signerBtc.js +2 -1
- package/dist/signer/evm/signerEvm.d.ts.map +1 -1
- package/dist/signer/evm/signerEvm.js +5 -3
- package/dist/signer/nostr/signerNostr.d.ts.map +1 -1
- package/dist/signer/nostr/signerNostr.js +2 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist.commonjs/address/address.advanced.d.ts +29 -24
- package/dist.commonjs/address/address.advanced.d.ts.map +1 -1
- package/dist.commonjs/address/address.advanced.js +115 -92
- package/dist.commonjs/address/advanced.d.ts +1 -1
- package/dist.commonjs/address/advanced.js +30 -14
- package/dist.commonjs/address/index.d.ts +51 -44
- package/dist.commonjs/address/index.d.ts.map +1 -1
- package/dist.commonjs/address/index.js +84 -68
- package/dist.commonjs/advanced.d.ts +1 -1
- package/dist.commonjs/advanced.js +47 -22
- package/dist.commonjs/advancedBarrel.d.ts +1 -1
- package/dist.commonjs/advancedBarrel.js +30 -14
- package/dist.commonjs/barrel.d.ts +1 -1
- package/dist.commonjs/barrel.js +30 -14
- package/dist.commonjs/bytes/advanced.d.ts +11 -2
- package/dist.commonjs/bytes/index.d.ts +9 -3
- package/dist.commonjs/bytes/index.js +28 -26
- package/dist.commonjs/ckb/advanced.d.ts +1 -1
- package/dist.commonjs/ckb/advanced.js +47 -22
- package/dist.commonjs/ckb/index.d.ts +1 -1
- package/dist.commonjs/ckb/index.js +30 -14
- package/dist.commonjs/ckb/molecule.advanced/generated.d.ts +420 -260
- package/dist.commonjs/ckb/molecule.advanced/generated.js +1536 -1332
- package/dist.commonjs/ckb/molecule.advanced/index.d.ts +3 -3
- package/dist.commonjs/ckb/molecule.advanced/index.js +34 -18
- package/dist.commonjs/ckb/script.advanced.d.ts +1 -1
- package/dist.commonjs/ckb/script.advanced.js +12 -9
- package/dist.commonjs/ckb/script.d.ts +123 -77
- package/dist.commonjs/ckb/script.d.ts.map +1 -1
- package/dist.commonjs/ckb/script.js +221 -126
- package/dist.commonjs/ckb/transaction.advanced.d.ts +1 -1
- package/dist.commonjs/ckb/transaction.advanced.js +4 -4
- package/dist.commonjs/ckb/transaction.d.ts +796 -544
- package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
- package/dist.commonjs/ckb/transaction.js +1373 -725
- package/dist.commonjs/client/advanced.d.ts +3 -1
- package/dist.commonjs/client/advanced.d.ts.map +1 -1
- package/dist.commonjs/client/advanced.js +32 -14
- package/dist.commonjs/client/client.advanced.d.ts +27 -0
- package/dist.commonjs/client/client.advanced.d.ts.map +1 -0
- package/dist.commonjs/client/client.advanced.js +116 -0
- package/dist.commonjs/client/client.d.ts +118 -22
- package/dist.commonjs/client/client.d.ts.map +1 -1
- package/dist.commonjs/client/client.js +218 -56
- package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts +9 -3
- package/dist.commonjs/client/clientPublicMainnet.advanced.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicMainnet.advanced.js +144 -25
- package/dist.commonjs/client/clientPublicMainnet.d.ts +9 -5
- package/dist.commonjs/client/clientPublicMainnet.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicMainnet.js +18 -12
- package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts +8 -3
- package/dist.commonjs/client/clientPublicTestnet.advanced.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicTestnet.advanced.js +204 -28
- package/dist.commonjs/client/clientPublicTestnet.d.ts +9 -5
- package/dist.commonjs/client/clientPublicTestnet.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicTestnet.js +14 -9
- package/dist.commonjs/client/clientTypes.advanced.d.ts +23 -0
- package/dist.commonjs/client/clientTypes.advanced.d.ts.map +1 -0
- package/dist.commonjs/client/clientTypes.advanced.js +8 -0
- package/dist.commonjs/client/clientTypes.d.ts +57 -46
- package/dist.commonjs/client/clientTypes.d.ts.map +1 -1
- package/dist.commonjs/client/clientTypes.js +60 -22
- package/dist.commonjs/client/index.d.ts +1 -1
- package/dist.commonjs/client/index.js +30 -14
- package/dist.commonjs/client/jsonRpc/advanced.d.ts +1 -1
- package/dist.commonjs/client/jsonRpc/advanced.js +30 -14
- package/dist.commonjs/client/jsonRpc/index.d.ts +94 -75
- package/dist.commonjs/client/jsonRpc/index.d.ts.map +1 -1
- package/dist.commonjs/client/jsonRpc/index.js +135 -108
- package/dist.commonjs/client/jsonRpc/transformers.d.ts +76 -38
- package/dist.commonjs/client/jsonRpc/transformers.d.ts.map +1 -1
- package/dist.commonjs/client/jsonRpc/transformers.js +174 -150
- package/dist.commonjs/client/jsonRpc/types.d.ts +38 -38
- package/dist.commonjs/fixedPoint/index.d.ts +9 -3
- package/dist.commonjs/fixedPoint/index.js +26 -20
- package/dist.commonjs/fixedPoint/index.test.d.ts +1 -1
- package/dist.commonjs/fixedPoint/index.test.js +42 -36
- package/dist.commonjs/hasher/advanced.d.ts +1 -1
- package/dist.commonjs/hasher/index.d.ts +37 -37
- package/dist.commonjs/hasher/index.d.ts.map +1 -1
- package/dist.commonjs/hasher/index.js +55 -46
- package/dist.commonjs/hex/index.d.ts +1 -1
- package/dist.commonjs/hex/index.js +1 -1
- package/dist.commonjs/index.d.ts +1 -1
- package/dist.commonjs/index.js +47 -22
- package/dist.commonjs/num/index.d.ts +13 -1
- package/dist.commonjs/num/index.d.ts.map +1 -1
- package/dist.commonjs/num/index.js +53 -19
- package/dist.commonjs/signer/btc/index.d.ts +1 -1
- package/dist.commonjs/signer/btc/index.js +30 -14
- package/dist.commonjs/signer/btc/signerBtc.d.ts +47 -47
- package/dist.commonjs/signer/btc/signerBtc.d.ts.map +1 -1
- package/dist.commonjs/signer/btc/signerBtc.js +89 -65
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +45 -45
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +52 -52
- package/dist.commonjs/signer/btc/verify.d.ts +6 -2
- package/dist.commonjs/signer/btc/verify.js +10 -3
- package/dist.commonjs/signer/ckb/index.d.ts +1 -1
- package/dist.commonjs/signer/ckb/index.js +30 -14
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +45 -45
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +56 -56
- package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +6 -2
- package/dist.commonjs/signer/ckb/verifyJoyId.js +11 -8
- package/dist.commonjs/signer/dummy/alwaysError.d.ts +4 -4
- package/dist.commonjs/signer/dummy/alwaysError.js +7 -7
- package/dist.commonjs/signer/dummy/dummy.d.ts +7 -7
- package/dist.commonjs/signer/dummy/dummy.js +16 -16
- package/dist.commonjs/signer/dummy/index.d.ts +1 -1
- package/dist.commonjs/signer/dummy/index.js +30 -14
- package/dist.commonjs/signer/dummy/openLink.d.ts +4 -4
- package/dist.commonjs/signer/dummy/openLink.js +7 -7
- package/dist.commonjs/signer/evm/index.d.ts +1 -1
- package/dist.commonjs/signer/evm/index.js +30 -14
- package/dist.commonjs/signer/evm/signerEvm.d.ts +42 -38
- package/dist.commonjs/signer/evm/signerEvm.d.ts.map +1 -1
- package/dist.commonjs/signer/evm/signerEvm.js +105 -68
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +37 -37
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +42 -42
- package/dist.commonjs/signer/evm/verify.d.ts +6 -2
- package/dist.commonjs/signer/evm/verify.js +7 -2
- package/dist.commonjs/signer/index.d.ts +1 -1
- package/dist.commonjs/signer/index.js +30 -14
- package/dist.commonjs/signer/nostr/index.d.ts +1 -1
- package/dist.commonjs/signer/nostr/index.js +30 -14
- package/dist.commonjs/signer/nostr/signerNostr.d.ts +57 -57
- package/dist.commonjs/signer/nostr/signerNostr.d.ts.map +1 -1
- package/dist.commonjs/signer/nostr/signerNostr.js +100 -70
- package/dist.commonjs/signer/nostr/verify.d.ts +9 -3
- package/dist.commonjs/signer/nostr/verify.js +50 -39
- package/dist.commonjs/signer/signer/index.d.ts +156 -150
- package/dist.commonjs/signer/signer/index.js +208 -181
- package/dist.commonjs/utils/index.d.ts +38 -8
- package/dist.commonjs/utils/index.d.ts.map +1 -1
- package/dist.commonjs/utils/index.js +18 -12
- package/package.json +2 -2
- package/src/address/address.advanced.ts +2 -5
- package/src/address/index.ts +2 -5
- package/src/ckb/script.ts +62 -2
- package/src/ckb/transaction.ts +637 -46
- package/src/client/advanced.ts +2 -0
- package/src/client/client.advanced.ts +134 -0
- package/src/client/client.ts +225 -16
- package/src/client/clientPublicMainnet.advanced.ts +116 -2
- package/src/client/clientPublicMainnet.ts +8 -3
- package/src/client/clientPublicTestnet.advanced.ts +171 -2
- package/src/client/clientPublicTestnet.ts +9 -3
- package/src/client/clientTypes.advanced.ts +26 -0
- package/src/client/clientTypes.ts +41 -43
- package/src/client/jsonRpc/index.ts +4 -4
- package/src/client/jsonRpc/transformers.ts +13 -11
- package/src/hasher/index.ts +4 -2
- package/src/num/index.ts +22 -0
- package/src/signer/btc/signerBtc.ts +2 -1
- package/src/signer/evm/signerEvm.ts +5 -3
- package/src/signer/nostr/signerNostr.ts +2 -1
- package/src/utils/index.ts +6 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { TransactionSkeletonType } from "@ckb-lumos/helpers";
|
|
2
|
+
import { ClientCollectableSearchKeyFilterLike } from "../advancedBarrel";
|
|
2
3
|
import { Bytes, BytesLike } from "../bytes";
|
|
3
|
-
import { Client } from "../client";
|
|
4
|
+
import { CellDepInfoLike, Client, KnownScript } from "../client";
|
|
4
5
|
import { Hasher } from "../hasher";
|
|
5
6
|
import { Hex, HexLike } from "../hex";
|
|
6
7
|
import { Num, NumLike } from "../num";
|
|
8
|
+
import { Signer } from "../signer";
|
|
7
9
|
import * as mol from "./molecule.advanced";
|
|
8
10
|
import { Script, ScriptLike } from "./script";
|
|
9
11
|
export type DepTypeLike = string | number | bigint;
|
|
@@ -50,578 +52,828 @@ export declare function depTypeToBytes(depType: DepTypeLike): Bytes;
|
|
|
50
52
|
*/
|
|
51
53
|
export declare function depTypeFromBytes(bytes: BytesLike): DepType;
|
|
52
54
|
export type OutPointLike = {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
txHash: HexLike;
|
|
56
|
+
index: NumLike;
|
|
55
57
|
};
|
|
56
58
|
export declare class OutPoint {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
59
|
+
txHash: Hex;
|
|
60
|
+
index: Num;
|
|
61
|
+
/**
|
|
62
|
+
* Creates an instance of OutPoint.
|
|
63
|
+
*
|
|
64
|
+
* @param txHash - The transaction hash.
|
|
65
|
+
* @param index - The index of the output in the transaction.
|
|
66
|
+
*/
|
|
67
|
+
constructor(txHash: Hex, index: Num);
|
|
68
|
+
/**
|
|
69
|
+
* Clone an OutPoint.
|
|
70
|
+
*
|
|
71
|
+
* @returns A cloned OutPoint instance.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const outPoint1 = outPoint0.clone();
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
clone(): OutPoint;
|
|
79
|
+
/**
|
|
80
|
+
* Creates an OutPoint instance from an OutPointLike object.
|
|
81
|
+
*
|
|
82
|
+
* @param outPoint - An OutPointLike object or an instance of OutPoint.
|
|
83
|
+
* @returns An OutPoint instance.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const outPoint = OutPoint.from({ txHash: "0x...", index: 0 });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
static from(outPoint: OutPointLike): OutPoint;
|
|
91
|
+
/**
|
|
92
|
+
* Converts the OutPoint instance to molecule data format.
|
|
93
|
+
*
|
|
94
|
+
* @returns An object representing the outpoint in molecule data format.
|
|
95
|
+
*/
|
|
96
|
+
_toMolData(): {
|
|
97
|
+
txHash: Uint8Array;
|
|
98
|
+
index: Uint8Array;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Converts the OutPoint instance to bytes.
|
|
102
|
+
*
|
|
103
|
+
* @returns A Uint8Array containing the outpoint bytes.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const outPointBytes = outPoint.toBytes();
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
toBytes(): Bytes;
|
|
111
|
+
/**
|
|
112
|
+
* Creates an OutPoint instance from a byte-like value or molecule OutPoint.
|
|
113
|
+
*
|
|
114
|
+
* @param bytes - The byte-like value or molecule OutPoint to convert.
|
|
115
|
+
* @returns An OutPoint instance.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const outPoint = OutPoint.fromBytes(new Uint8Array([/* outpoint bytes *\/]));
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
static fromBytes(bytes: BytesLike | mol.OutPoint): OutPoint;
|
|
123
|
+
/**
|
|
124
|
+
* Compares the current OutPoint instance with another OutPointLike object for equality.
|
|
125
|
+
*
|
|
126
|
+
* @param val - The OutPointLike object to compare with.
|
|
127
|
+
* @returns True if the out points are equal, otherwise false.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* const isEqual = outPoint.eq(anotherOutPoint);
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
eq(val: OutPointLike): boolean;
|
|
110
135
|
}
|
|
111
136
|
export type CellOutputLike = {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
137
|
+
capacity: NumLike;
|
|
138
|
+
lock: ScriptLike;
|
|
139
|
+
type?: ScriptLike;
|
|
115
140
|
};
|
|
116
141
|
export declare class CellOutput {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
142
|
+
capacity: Num;
|
|
143
|
+
lock: Script;
|
|
144
|
+
type?: Script | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Creates an instance of CellOutput.
|
|
147
|
+
*
|
|
148
|
+
* @param capacity - The capacity of the cell.
|
|
149
|
+
* @param lock - The lock script of the cell.
|
|
150
|
+
* @param type - The optional type script of the cell.
|
|
151
|
+
*/
|
|
152
|
+
constructor(capacity: Num, lock: Script, type?: Script | undefined);
|
|
153
|
+
get occupiedSize(): number;
|
|
154
|
+
/**
|
|
155
|
+
* Clone a CellOutput.
|
|
156
|
+
*
|
|
157
|
+
* @returns A cloned CellOutput instance.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const cellOutput1 = cellOutput0.clone();
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
clone(): CellOutput;
|
|
165
|
+
/**
|
|
166
|
+
* Creates a CellOutput instance from a CellOutputLike object.
|
|
167
|
+
*
|
|
168
|
+
* @param cellOutput - A CellOutputLike object or an instance of CellOutput.
|
|
169
|
+
* @returns A CellOutput instance.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* const cellOutput = CellOutput.from({
|
|
174
|
+
* capacity: 1000n,
|
|
175
|
+
* lock: { codeHash: "0x...", hashType: "type", args: "0x..." },
|
|
176
|
+
* type: { codeHash: "0x...", hashType: "type", args: "0x..." }
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
static from(cellOutput: CellOutputLike): CellOutput;
|
|
181
|
+
/**
|
|
182
|
+
* Converts the CellOutput instance to molecule data format.
|
|
183
|
+
*
|
|
184
|
+
* @returns An object representing the cell output in molecule data format.
|
|
185
|
+
*/
|
|
186
|
+
_toMolData(): {
|
|
187
|
+
capacity: Uint8Array;
|
|
188
|
+
lock: {
|
|
189
|
+
codeHash: Uint8Array;
|
|
190
|
+
hashType: Uint8Array;
|
|
191
|
+
args: Uint8Array;
|
|
161
192
|
};
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
193
|
+
type:
|
|
194
|
+
| {
|
|
195
|
+
codeHash: Uint8Array;
|
|
196
|
+
hashType: Uint8Array;
|
|
197
|
+
args: Uint8Array;
|
|
198
|
+
}
|
|
199
|
+
| undefined;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Converts the CellOutput instance to bytes.
|
|
203
|
+
*
|
|
204
|
+
* @returns A Uint8Array containing the cell output bytes.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* const cellOutputBytes = cellOutput.toBytes();
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
toBytes(): Bytes;
|
|
212
|
+
/**
|
|
213
|
+
* Creates a CellOutput instance from a byte-like value or molecule CellOutput.
|
|
214
|
+
*
|
|
215
|
+
* @param bytes - The byte-like value or molecule CellOutput to convert.
|
|
216
|
+
* @returns A CellOutput instance.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* const cellOutput = CellOutput.fromBytes(new Uint8Array([/* cell output bytes *\/]));
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
static fromBytes(bytes: BytesLike | mol.CellOutput): CellOutput;
|
|
185
224
|
}
|
|
186
225
|
export type CellLike = {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
blockNumber: NumLike;
|
|
226
|
+
outPoint: OutPointLike;
|
|
227
|
+
cellOutput: CellOutputLike;
|
|
228
|
+
outputData: HexLike;
|
|
191
229
|
};
|
|
192
230
|
export declare class Cell {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
231
|
+
outPoint: OutPoint;
|
|
232
|
+
cellOutput: CellOutput;
|
|
233
|
+
outputData: Hex;
|
|
234
|
+
/**
|
|
235
|
+
* Creates an instance of Cell.
|
|
236
|
+
*
|
|
237
|
+
* @param outPoint - The output point of the cell.
|
|
238
|
+
* @param cellOutput - The cell output of the cell.
|
|
239
|
+
* @param outputData - The output data of the cell.
|
|
240
|
+
*/
|
|
241
|
+
constructor(outPoint: OutPoint, cellOutput: CellOutput, outputData: Hex);
|
|
242
|
+
/**
|
|
243
|
+
* Creates a Cell instance from a CellLike object.
|
|
244
|
+
*
|
|
245
|
+
* @param cell - A CellLike object or an instance of Cell.
|
|
246
|
+
* @returns A Cell instance.
|
|
247
|
+
*/
|
|
248
|
+
static from(cell: CellLike): Cell;
|
|
249
|
+
/**
|
|
250
|
+
* Clone a Cell
|
|
251
|
+
*
|
|
252
|
+
* @returns A cloned Cell instance.
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```typescript
|
|
256
|
+
* const cell1 = cell0.clone();
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
clone(): Cell;
|
|
213
260
|
}
|
|
214
261
|
export type CellInputLike = {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
blockNumber?: NumLike;
|
|
262
|
+
previousOutput: OutPointLike;
|
|
263
|
+
since?: NumLike;
|
|
264
|
+
cellOutput?: CellOutputLike;
|
|
265
|
+
outputData?: HexLike;
|
|
220
266
|
};
|
|
221
267
|
export declare class CellInput {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
268
|
+
previousOutput: OutPoint;
|
|
269
|
+
since: Num;
|
|
270
|
+
cellOutput?: CellOutput | undefined;
|
|
271
|
+
outputData?: `0x${string}` | undefined;
|
|
272
|
+
/**
|
|
273
|
+
* Creates an instance of CellInput.
|
|
274
|
+
*
|
|
275
|
+
* @param previousOutput - The previous outpoint of the cell.
|
|
276
|
+
* @param since - The since value of the cell input.
|
|
277
|
+
* @param cellOutput - The optional cell output associated with the cell input.
|
|
278
|
+
* @param outputData - The optional output data associated with the cell input.
|
|
279
|
+
*/
|
|
280
|
+
constructor(
|
|
281
|
+
previousOutput: OutPoint,
|
|
282
|
+
since: Num,
|
|
283
|
+
cellOutput?: CellOutput | undefined,
|
|
284
|
+
outputData?: `0x${string}` | undefined,
|
|
285
|
+
);
|
|
286
|
+
/**
|
|
287
|
+
* Clone a CellInput.
|
|
288
|
+
*
|
|
289
|
+
* @returns A cloned CellInput instance.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```typescript
|
|
293
|
+
* const cellInput1 = cellInput0.clone();
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
clone(): CellInput;
|
|
297
|
+
/**
|
|
298
|
+
* Creates a CellInput instance from a CellInputLike object.
|
|
299
|
+
*
|
|
300
|
+
* @param cellInput - A CellInputLike object or an instance of CellInput.
|
|
301
|
+
* @returns A CellInput instance.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```typescript
|
|
305
|
+
* const cellInput = CellInput.from({
|
|
306
|
+
* previousOutput: { txHash: "0x...", index: 0 },
|
|
307
|
+
* since: 0n
|
|
308
|
+
* });
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
static from(cellInput: CellInputLike): CellInput;
|
|
312
|
+
/**
|
|
313
|
+
* Complete extra infos in the input. Like the output of the out point.
|
|
314
|
+
* The instance will be modified.
|
|
315
|
+
*
|
|
316
|
+
* @returns true if succeed.
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* await cellInput.completeExtraInfos();
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
completeExtraInfos(client: Client): Promise<void>;
|
|
323
|
+
/**
|
|
324
|
+
* Converts the CellInput instance to molecule data format.
|
|
325
|
+
*
|
|
326
|
+
* @returns An object representing the cell input in molecule data format.
|
|
327
|
+
*/
|
|
328
|
+
_toMolData(): {
|
|
329
|
+
previousOutput: {
|
|
330
|
+
txHash: Uint8Array;
|
|
331
|
+
index: Uint8Array;
|
|
274
332
|
};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
333
|
+
since: Uint8Array;
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* Converts the CellInput instance to bytes.
|
|
337
|
+
*
|
|
338
|
+
* @returns A Uint8Array containing the cell input bytes.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```typescript
|
|
342
|
+
* const cellInputBytes = cellInput.toBytes();
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
345
|
+
toBytes(): Bytes;
|
|
346
|
+
/**
|
|
347
|
+
* Creates a CellInput instance from a byte-like value or molecule CellInput.
|
|
348
|
+
*
|
|
349
|
+
* @param bytes - The byte-like value or molecule CellInput to convert.
|
|
350
|
+
* @returns A CellInput instance.
|
|
351
|
+
*
|
|
352
|
+
* @example
|
|
353
|
+
* ```typescript
|
|
354
|
+
* const cellInput = CellInput.fromBytes(new Uint8Array([/* cell input bytes *\/]));
|
|
355
|
+
* ```
|
|
356
|
+
*/
|
|
357
|
+
static fromBytes(bytes: BytesLike | mol.CellInput): CellInput;
|
|
298
358
|
}
|
|
299
359
|
export type CellDepLike = {
|
|
300
|
-
|
|
301
|
-
|
|
360
|
+
outPoint: OutPointLike;
|
|
361
|
+
depType: DepTypeLike;
|
|
302
362
|
};
|
|
303
363
|
export declare class CellDep {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
364
|
+
outPoint: OutPoint;
|
|
365
|
+
depType: DepType;
|
|
366
|
+
/**
|
|
367
|
+
* Creates an instance of CellDep.
|
|
368
|
+
*
|
|
369
|
+
* @param outPoint - The outpoint of the cell dependency.
|
|
370
|
+
* @param depType - The dependency type.
|
|
371
|
+
*/
|
|
372
|
+
constructor(outPoint: OutPoint, depType: DepType);
|
|
373
|
+
/**
|
|
374
|
+
* Clone a CellDep.
|
|
375
|
+
*
|
|
376
|
+
* @returns A cloned CellDep instance.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```typescript
|
|
380
|
+
* const cellDep1 = cellDep0.clone();
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
clone(): CellDep;
|
|
384
|
+
/**
|
|
385
|
+
* Creates a CellDep instance from a CellDepLike object.
|
|
386
|
+
*
|
|
387
|
+
* @param cellDep - A CellDepLike object or an instance of CellDep.
|
|
388
|
+
* @returns A CellDep instance.
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```typescript
|
|
392
|
+
* const cellDep = CellDep.from({
|
|
393
|
+
* outPoint: { txHash: "0x...", index: 0 },
|
|
394
|
+
* depType: "depGroup"
|
|
395
|
+
* });
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
static from(cellDep: CellDepLike): CellDep;
|
|
399
|
+
/**
|
|
400
|
+
* Converts the CellDep instance to molecule data format.
|
|
401
|
+
*
|
|
402
|
+
* @returns An object representing the cell dependency in molecule data format.
|
|
403
|
+
*/
|
|
404
|
+
_toMolData(): {
|
|
405
|
+
outPoint: {
|
|
406
|
+
txHash: Uint8Array;
|
|
407
|
+
index: Uint8Array;
|
|
339
408
|
};
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
409
|
+
depType: Uint8Array;
|
|
410
|
+
};
|
|
411
|
+
/**
|
|
412
|
+
* Converts the CellDep instance to bytes.
|
|
413
|
+
*
|
|
414
|
+
* @returns A Uint8Array containing the cell dependency bytes.
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* const cellDepBytes = cellDep.toBytes();
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
toBytes(): Bytes;
|
|
422
|
+
/**
|
|
423
|
+
* Creates a CellDep instance from a byte-like value or molecule CellDep.
|
|
424
|
+
*
|
|
425
|
+
* @param bytes - The byte-like value or molecule CellDep to convert.
|
|
426
|
+
* @returns A CellDep instance.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```typescript
|
|
430
|
+
* const cellDep = CellDep.fromBytes(new Uint8Array([/* cell dep bytes *\/]));
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
|
+
fromBytes(bytes: BytesLike | mol.CellDep): CellDep;
|
|
434
|
+
/**
|
|
435
|
+
* Compares the current CellDep instance with another CellDepLike object for equality.
|
|
436
|
+
*
|
|
437
|
+
* @param val - The CellDepLike object to compare with.
|
|
438
|
+
* @returns True if the cell deps are equal, otherwise false.
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
* ```typescript
|
|
442
|
+
* const isEqual = cellDep.eq(anotherCellDep);
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
eq(val: CellDepLike): boolean;
|
|
363
446
|
}
|
|
364
447
|
export type WitnessArgsLike = {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
448
|
+
lock?: HexLike;
|
|
449
|
+
inputType?: HexLike;
|
|
450
|
+
outputType?: HexLike;
|
|
368
451
|
};
|
|
369
452
|
export declare class WitnessArgs {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
453
|
+
lock?: `0x${string}` | undefined;
|
|
454
|
+
inputType?: `0x${string}` | undefined;
|
|
455
|
+
outputType?: `0x${string}` | undefined;
|
|
456
|
+
/**
|
|
457
|
+
* Creates an instance of WitnessArgs.
|
|
458
|
+
*
|
|
459
|
+
* @param lock - The optional lock field of the witness.
|
|
460
|
+
* @param inputType - The optional input type field of the witness.
|
|
461
|
+
* @param outputType - The optional output type field of the witness.
|
|
462
|
+
*/
|
|
463
|
+
constructor(
|
|
464
|
+
lock?: `0x${string}` | undefined,
|
|
465
|
+
inputType?: `0x${string}` | undefined,
|
|
466
|
+
outputType?: `0x${string}` | undefined,
|
|
467
|
+
);
|
|
468
|
+
/**
|
|
469
|
+
* Creates a WitnessArgs instance from a WitnessArgsLike object.
|
|
470
|
+
*
|
|
471
|
+
* @param witnessArgs - A WitnessArgsLike object or an instance of WitnessArgs.
|
|
472
|
+
* @returns A WitnessArgs instance.
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```typescript
|
|
476
|
+
* const witnessArgs = WitnessArgs.from({
|
|
477
|
+
* lock: "0x...",
|
|
478
|
+
* inputType: "0x...",
|
|
479
|
+
* outputType: "0x..."
|
|
480
|
+
* });
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
static from(witnessArgs: WitnessArgsLike): WitnessArgs;
|
|
484
|
+
/**
|
|
485
|
+
* Converts the WitnessArgs instance to molecule data format.
|
|
486
|
+
*
|
|
487
|
+
* @returns An object representing the witness arguments in molecule data format.
|
|
488
|
+
*/
|
|
489
|
+
_toMolData(): {
|
|
490
|
+
lock: Uint8Array | undefined;
|
|
491
|
+
inputType: Uint8Array | undefined;
|
|
492
|
+
outputType: Uint8Array | undefined;
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* Converts the WitnessArgs instance to bytes.
|
|
496
|
+
*
|
|
497
|
+
* @returns A Uint8Array containing the witness arguments bytes.
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* ```typescript
|
|
501
|
+
* const witnessArgsBytes = witnessArgs.toBytes();
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
toBytes(): Bytes;
|
|
505
|
+
/**
|
|
506
|
+
* Creates a WitnessArgs instance from a byte-like value or molecule WitnessArgs.
|
|
507
|
+
*
|
|
508
|
+
* @param bytes - The byte-like value or molecule WitnessArgs to convert.
|
|
509
|
+
* @returns A WitnessArgs instance.
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
* ```typescript
|
|
513
|
+
* const witnessArgs = WitnessArgs.fromBytes(new Uint8Array([/* witness args bytes *\/]));
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
static fromBytes(bytes: BytesLike | mol.WitnessArgs): WitnessArgs;
|
|
430
517
|
}
|
|
518
|
+
export declare function udtBalanceFrom(dataLike: BytesLike): bigint;
|
|
431
519
|
export type TransactionLike = {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
520
|
+
version?: NumLike;
|
|
521
|
+
cellDeps?: CellDepLike[];
|
|
522
|
+
headerDeps?: HexLike[];
|
|
523
|
+
inputs?: CellInputLike[];
|
|
524
|
+
outputs?: (Omit<CellOutputLike, "capacity"> &
|
|
525
|
+
Partial<Pick<CellOutputLike, "capacity">>)[];
|
|
526
|
+
outputsData?: HexLike[];
|
|
527
|
+
witnesses?: HexLike[];
|
|
439
528
|
};
|
|
440
529
|
export declare class Transaction {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
530
|
+
version: Num;
|
|
531
|
+
cellDeps: CellDep[];
|
|
532
|
+
headerDeps: Hex[];
|
|
533
|
+
inputs: CellInput[];
|
|
534
|
+
outputs: CellOutput[];
|
|
535
|
+
outputsData: Hex[];
|
|
536
|
+
witnesses: Hex[];
|
|
537
|
+
/**
|
|
538
|
+
* Creates an instance of Transaction.
|
|
539
|
+
*
|
|
540
|
+
* @param version - The version of the transaction.
|
|
541
|
+
* @param cellDeps - The cell dependencies of the transaction.
|
|
542
|
+
* @param headerDeps - The header dependencies of the transaction.
|
|
543
|
+
* @param inputs - The inputs of the transaction.
|
|
544
|
+
* @param outputs - The outputs of the transaction.
|
|
545
|
+
* @param outputsData - The data associated with the outputs.
|
|
546
|
+
* @param witnesses - The witnesses of the transaction.
|
|
547
|
+
*/
|
|
548
|
+
constructor(
|
|
549
|
+
version: Num,
|
|
550
|
+
cellDeps: CellDep[],
|
|
551
|
+
headerDeps: Hex[],
|
|
552
|
+
inputs: CellInput[],
|
|
553
|
+
outputs: CellOutput[],
|
|
554
|
+
outputsData: Hex[],
|
|
555
|
+
witnesses: Hex[],
|
|
556
|
+
);
|
|
557
|
+
/**
|
|
558
|
+
* Creates a default Transaction instance with empty fields.
|
|
559
|
+
*
|
|
560
|
+
* @returns A default Transaction instance.
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* ```typescript
|
|
564
|
+
* const defaultTx = Transaction.default();
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
static default(): Transaction;
|
|
568
|
+
/**
|
|
569
|
+
* Copy every properties from another transaction.
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* ```typescript
|
|
573
|
+
* this.copy(Transaction.default());
|
|
574
|
+
* ```
|
|
575
|
+
*/
|
|
576
|
+
copy(txLike: TransactionLike): void;
|
|
577
|
+
/**
|
|
578
|
+
* Clone a Transaction.
|
|
579
|
+
*
|
|
580
|
+
* @returns A cloned instance
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* ```typescript
|
|
584
|
+
* const tx1 = tx0.clone();
|
|
585
|
+
* ```
|
|
586
|
+
*/
|
|
587
|
+
clone(): Transaction;
|
|
588
|
+
/**
|
|
589
|
+
* Creates a Transaction instance from a TransactionLike object.
|
|
590
|
+
*
|
|
591
|
+
* @param tx - A TransactionLike object or an instance of Transaction.
|
|
592
|
+
* @returns A Transaction instance.
|
|
593
|
+
*
|
|
594
|
+
* @example
|
|
595
|
+
* ```typescript
|
|
596
|
+
* const transaction = Transaction.from({
|
|
597
|
+
* version: 0,
|
|
598
|
+
* cellDeps: [],
|
|
599
|
+
* headerDeps: [],
|
|
600
|
+
* inputs: [],
|
|
601
|
+
* outputs: [],
|
|
602
|
+
* outputsData: [],
|
|
603
|
+
* witnesses: []
|
|
604
|
+
* });
|
|
605
|
+
* ```
|
|
606
|
+
*/
|
|
607
|
+
static from(tx: TransactionLike): Transaction;
|
|
608
|
+
/**
|
|
609
|
+
* Creates a Transaction instance from a Lumos skeleton.
|
|
610
|
+
*
|
|
611
|
+
* @param skeleton - The Lumos transaction skeleton.
|
|
612
|
+
* @returns A Transaction instance.
|
|
613
|
+
*
|
|
614
|
+
* @throws Will throw an error if an input's outPoint is missing.
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```typescript
|
|
618
|
+
* const transaction = Transaction.fromLumosSkeleton(skeleton);
|
|
619
|
+
* ```
|
|
620
|
+
*/
|
|
621
|
+
static fromLumosSkeleton(skeleton: TransactionSkeletonType): Transaction;
|
|
622
|
+
stringify(): string;
|
|
623
|
+
/**
|
|
624
|
+
* Converts the raw transaction data to bytes.
|
|
625
|
+
*
|
|
626
|
+
* @returns A Uint8Array containing the raw transaction bytes.
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* ```typescript
|
|
630
|
+
* const rawTxBytes = transaction.rawToBytes();
|
|
631
|
+
* ```
|
|
632
|
+
*/
|
|
633
|
+
rawToBytes(): Bytes;
|
|
634
|
+
/**
|
|
635
|
+
* Converts the whole transaction data to bytes.
|
|
636
|
+
*
|
|
637
|
+
* @returns A Uint8Array containing the full transaction bytes.
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```typescript
|
|
641
|
+
* const txBytes = transaction.toBytes();
|
|
642
|
+
* ```
|
|
643
|
+
*/
|
|
644
|
+
toBytes(): Bytes;
|
|
645
|
+
/**
|
|
646
|
+
* Calculates the hash of the transaction.
|
|
647
|
+
*
|
|
648
|
+
* @returns The hash of the transaction.
|
|
649
|
+
*
|
|
650
|
+
* @example
|
|
651
|
+
* ```typescript
|
|
652
|
+
* const txHash = transaction.hash();
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
655
|
+
hash(): `0x${string}`;
|
|
656
|
+
/**
|
|
657
|
+
* Hashes a witness and updates the hasher.
|
|
658
|
+
*
|
|
659
|
+
* @param witness - The witness to hash.
|
|
660
|
+
* @param hasher - The hasher instance to update.
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* ```typescript
|
|
664
|
+
* Transaction.hashWitnessToHasher("0x...", hasher);
|
|
665
|
+
* ```
|
|
666
|
+
*/
|
|
667
|
+
static hashWitnessToHasher(witness: HexLike, hasher: Hasher): void;
|
|
668
|
+
/**
|
|
669
|
+
* Computes the signing hash information for a given script.
|
|
670
|
+
*
|
|
671
|
+
* @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
|
|
672
|
+
* @param client - The client for complete extra infos in the transaction.
|
|
673
|
+
* @returns A promise that resolves to an object containing the signing message and the witness position,
|
|
674
|
+
* or undefined if no matching input is found.
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```typescript
|
|
678
|
+
* const signHashInfo = await tx.getSignHashInfo(scriptLike, client);
|
|
679
|
+
* if (signHashInfo) {
|
|
680
|
+
* console.log(signHashInfo.message); // Outputs the signing message
|
|
681
|
+
* console.log(signHashInfo.position); // Outputs the witness position
|
|
682
|
+
* }
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
685
|
+
getSignHashInfo(
|
|
686
|
+
scriptLike: ScriptLike,
|
|
687
|
+
client: Client,
|
|
688
|
+
): Promise<
|
|
689
|
+
| {
|
|
558
690
|
message: Hex;
|
|
559
691
|
position: number;
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
692
|
+
}
|
|
693
|
+
| undefined
|
|
694
|
+
>;
|
|
695
|
+
/**
|
|
696
|
+
* Find the first occurrence of a input with the specified lock
|
|
697
|
+
*
|
|
698
|
+
* @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
|
|
699
|
+
* @param client - The client for complete extra infos in the transaction.
|
|
700
|
+
* @returns A promise that resolves to the prepared transaction
|
|
701
|
+
*
|
|
702
|
+
* @example
|
|
703
|
+
* ```typescript
|
|
704
|
+
* const index = await tx.findInputIndexByLock(scriptLike, client);
|
|
705
|
+
* ```
|
|
706
|
+
*/
|
|
707
|
+
findInputIndexByLock(
|
|
708
|
+
scriptLike: ScriptLike,
|
|
709
|
+
client: Client,
|
|
710
|
+
): Promise<number | undefined>;
|
|
711
|
+
/**
|
|
712
|
+
* Find the last occurrence of a input with the specified lock
|
|
713
|
+
*
|
|
714
|
+
* @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
|
|
715
|
+
* @param client - The client for complete extra infos in the transaction.
|
|
716
|
+
* @returns A promise that resolves to the prepared transaction
|
|
717
|
+
*
|
|
718
|
+
* @example
|
|
719
|
+
* ```typescript
|
|
720
|
+
* const index = await tx.findLastInputIndexByLock(scriptLike, client);
|
|
721
|
+
* ```
|
|
722
|
+
*/
|
|
723
|
+
findLastInputIndexByLock(
|
|
724
|
+
scriptLike: ScriptLike,
|
|
725
|
+
client: Client,
|
|
726
|
+
): Promise<number | undefined>;
|
|
727
|
+
/**
|
|
728
|
+
* Add cell deps if they are not existed
|
|
729
|
+
*
|
|
730
|
+
* @param cellDepLikes - The cell deps to add
|
|
731
|
+
*
|
|
732
|
+
* @example
|
|
733
|
+
* ```typescript
|
|
734
|
+
* tx.addCellDeps(cellDep);
|
|
735
|
+
* ```
|
|
736
|
+
*/
|
|
737
|
+
addCellDeps(...cellDepsLike: (CellDepLike | CellDepLike[])[]): void;
|
|
738
|
+
/**
|
|
739
|
+
* Add cell dep from infos if they are not existed
|
|
740
|
+
*
|
|
741
|
+
* @param client - A client for searching cell deps
|
|
742
|
+
* @param cellDepLikes - The cell dep infos to add
|
|
743
|
+
*
|
|
744
|
+
* @example
|
|
745
|
+
* ```typescript
|
|
746
|
+
* tx.addCellDepInfos(client, cellDepInfos);
|
|
747
|
+
* ```
|
|
748
|
+
*/
|
|
749
|
+
addCellDepInfos(
|
|
750
|
+
client: Client,
|
|
751
|
+
...cellDepInfosLike: (CellDepInfoLike | CellDepInfoLike[])[]
|
|
752
|
+
): Promise<void>;
|
|
753
|
+
/**
|
|
754
|
+
* Add cell deps from known script
|
|
755
|
+
*
|
|
756
|
+
* @param client - The client for searching known script and cell deps
|
|
757
|
+
* @param scripts - The known scripts to add
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```typescript
|
|
761
|
+
* tx.addCellDepsOfKnownScripts(client, KnownScript.OmniLock);
|
|
762
|
+
* ```
|
|
763
|
+
*/
|
|
764
|
+
addCellDepsOfKnownScripts(
|
|
765
|
+
client: Client,
|
|
766
|
+
...scripts: (KnownScript | KnownScript[])[]
|
|
767
|
+
): Promise<void>;
|
|
768
|
+
/**
|
|
769
|
+
* Set output data at index.
|
|
770
|
+
*
|
|
771
|
+
* @param index - The index of the output data.
|
|
772
|
+
* @param witness - The data to set.
|
|
773
|
+
*
|
|
774
|
+
* @example
|
|
775
|
+
* ```typescript
|
|
776
|
+
* await tx.setOutputData(0, "0x00");
|
|
777
|
+
* ```
|
|
778
|
+
*/
|
|
779
|
+
setOutputDataAt(index: number, data: HexLike): void;
|
|
780
|
+
/**
|
|
781
|
+
* Add output
|
|
782
|
+
*
|
|
783
|
+
* @param output - The cell output to add
|
|
784
|
+
* @param data - optional output data
|
|
785
|
+
*
|
|
786
|
+
* @example
|
|
787
|
+
* ```typescript
|
|
788
|
+
* await tx.addOutput(cellOutput, "0xabcd");
|
|
789
|
+
* ```
|
|
790
|
+
*/
|
|
791
|
+
addOutput(
|
|
792
|
+
outputLike: Omit<CellOutputLike, "capacity"> &
|
|
793
|
+
Partial<Pick<CellOutputLike, "capacity">>,
|
|
794
|
+
outputData?: HexLike,
|
|
795
|
+
): void;
|
|
796
|
+
/**
|
|
797
|
+
* Get witness at index as WitnessArgs
|
|
798
|
+
*
|
|
799
|
+
* @param index - The index of the witness.
|
|
800
|
+
* @returns The witness parsed as WitnessArgs.
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* ```typescript
|
|
804
|
+
* const witnessArgs = await tx.getWitnessArgsAt(0);
|
|
805
|
+
* ```
|
|
806
|
+
*/
|
|
807
|
+
getWitnessArgsAt(index: number): WitnessArgs | undefined;
|
|
808
|
+
/**
|
|
809
|
+
* Set witness at index by WitnessArgs
|
|
810
|
+
*
|
|
811
|
+
* @param index - The index of the witness.
|
|
812
|
+
* @param witness - The WitnessArgs to set.
|
|
813
|
+
*
|
|
814
|
+
* @example
|
|
815
|
+
* ```typescript
|
|
816
|
+
* await tx.setWitnessArgsAt(0, witnessArgs);
|
|
817
|
+
* ```
|
|
818
|
+
*/
|
|
819
|
+
setWitnessArgsAt(index: number, witness: WitnessArgs): void;
|
|
820
|
+
/**
|
|
821
|
+
* Prepare dummy witness for sighash all method
|
|
822
|
+
*
|
|
823
|
+
* @param scriptLike - The script associated with the transaction, represented as a ScriptLike object.
|
|
824
|
+
* @param lockLen - The length of dummy lock bytes.
|
|
825
|
+
* @param client - The client for complete extra infos in the transaction.
|
|
826
|
+
* @returns A promise that resolves to the prepared transaction
|
|
827
|
+
*
|
|
828
|
+
* @example
|
|
829
|
+
* ```typescript
|
|
830
|
+
* await tx.prepareSighashAllWitness(scriptLike, 85, client);
|
|
831
|
+
* ```
|
|
832
|
+
*/
|
|
833
|
+
prepareSighashAllWitness(
|
|
834
|
+
scriptLike: ScriptLike,
|
|
835
|
+
lockLen: number,
|
|
836
|
+
client: Client,
|
|
837
|
+
): Promise<void>;
|
|
838
|
+
getInputsCapacity(client: Client): Promise<Num>;
|
|
839
|
+
getOutputsCapacity(): Num;
|
|
840
|
+
getInputsUdtBalance(client: Client, type: ScriptLike): Promise<Num>;
|
|
841
|
+
getOutputsUdtBalance(type: ScriptLike): Num;
|
|
842
|
+
completeInputs<T>(
|
|
843
|
+
from: Signer,
|
|
844
|
+
filter: ClientCollectableSearchKeyFilterLike,
|
|
845
|
+
accumulator: (
|
|
846
|
+
acc: T,
|
|
847
|
+
v: Cell,
|
|
848
|
+
i: number,
|
|
849
|
+
array: Cell[],
|
|
850
|
+
) => Promise<T | undefined> | T | undefined,
|
|
851
|
+
init: T,
|
|
852
|
+
): Promise<number>;
|
|
853
|
+
completeInputsByCapacity(
|
|
854
|
+
from: Signer,
|
|
855
|
+
capacityTweak?: NumLike,
|
|
856
|
+
filter?: ClientCollectableSearchKeyFilterLike,
|
|
857
|
+
): Promise<number>;
|
|
858
|
+
completeInputsByUdt(from: Signer, type: ScriptLike): Promise<number>;
|
|
859
|
+
estimateFee(feeRate: NumLike): Num;
|
|
860
|
+
completeFee(
|
|
861
|
+
from: Signer,
|
|
862
|
+
change: (tx: Transaction, capacity: Num) => Promise<NumLike> | NumLike,
|
|
863
|
+
feeRate: NumLike,
|
|
864
|
+
filter?: ClientCollectableSearchKeyFilterLike,
|
|
865
|
+
): Promise<[number, boolean]>;
|
|
866
|
+
completeFeeChangeToLock(
|
|
867
|
+
from: Signer,
|
|
868
|
+
change: ScriptLike,
|
|
869
|
+
feeRate: NumLike,
|
|
870
|
+
filter?: ClientCollectableSearchKeyFilterLike,
|
|
871
|
+
): Promise<[number, boolean]>;
|
|
872
|
+
completeFeeChangeToOutput(
|
|
873
|
+
from: Signer,
|
|
874
|
+
index: NumLike,
|
|
875
|
+
feeRate: NumLike,
|
|
876
|
+
filter?: ClientCollectableSearchKeyFilterLike,
|
|
877
|
+
): Promise<[number, boolean]>;
|
|
626
878
|
}
|
|
627
|
-
//# sourceMappingURL=transaction.d.ts.map
|
|
879
|
+
//# sourceMappingURL=transaction.d.ts.map
|