@ickb/sdk 1000.0.82 → 9000.0.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/README.md +81 -32
- package/dist/constants.d.ts +13 -22
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +80 -76
- package/dist/constants.js.map +1 -1
- package/dist/conversion/estimate.d.ts +39 -0
- package/dist/conversion/estimate.d.ts.map +1 -0
- package/dist/conversion/estimate.js +117 -0
- package/dist/conversion/estimate.js.map +1 -0
- package/dist/conversion/maturity.d.ts +15 -0
- package/dist/conversion/maturity.d.ts.map +1 -0
- package/dist/conversion/maturity.js +112 -0
- package/dist/conversion/maturity.js.map +1 -0
- package/dist/conversion/plans.d.ts +20 -0
- package/dist/conversion/plans.d.ts.map +1 -0
- package/dist/conversion/plans.js +106 -0
- package/dist/conversion/plans.js.map +1 -0
- package/dist/conversion/projection.d.ts +22 -0
- package/dist/conversion/projection.d.ts.map +1 -0
- package/dist/conversion/projection.js +91 -0
- package/dist/conversion/projection.js.map +1 -0
- package/dist/conversion/types.d.ts +252 -0
- package/dist/conversion/types.d.ts.map +1 -0
- package/dist/conversion/types.js +2 -0
- package/dist/conversion/types.js.map +1 -0
- package/dist/conversion/withdrawal_ring.d.ts +36 -0
- package/dist/conversion/withdrawal_ring.d.ts.map +1 -0
- package/dist/conversion/withdrawal_ring.js +87 -0
- package/dist/conversion/withdrawal_ring.js.map +1 -0
- package/dist/dao.d.ts +86 -0
- package/dist/dao.d.ts.map +1 -0
- package/dist/dao.js +113 -0
- package/dist/dao.js.map +1 -0
- package/dist/index.d.ts +51 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/dist/logic.d.ts +85 -0
- package/dist/logic.d.ts.map +1 -0
- package/dist/logic.js +184 -0
- package/dist/logic.js.map +1 -0
- package/dist/order/cells.d.ts +207 -0
- package/dist/order/cells.d.ts.map +1 -0
- package/dist/order/cells.js +427 -0
- package/dist/order/cells.js.map +1 -0
- package/dist/order/conversion.d.ts +43 -0
- package/dist/order/conversion.d.ts.map +1 -0
- package/dist/order/conversion.js +123 -0
- package/dist/order/conversion.js.map +1 -0
- package/dist/order/fee.d.ts +9 -0
- package/dist/order/fee.d.ts.map +1 -0
- package/dist/order/fee.js +24 -0
- package/dist/order/fee.js.map +1 -0
- package/dist/order/fill.d.ts +36 -0
- package/dist/order/fill.d.ts.map +1 -0
- package/dist/order/fill.js +53 -0
- package/dist/order/fill.js.map +1 -0
- package/dist/order/info.d.ts +62 -0
- package/dist/order/info.d.ts.map +1 -0
- package/dist/order/info.js +99 -0
- package/dist/order/info.js.map +1 -0
- package/dist/order/master.d.ts +49 -0
- package/dist/order/master.d.ts.map +1 -0
- package/dist/order/master.js +27 -0
- package/dist/order/master.js.map +1 -0
- package/dist/order/matcher.d.ts +43 -0
- package/dist/order/matcher.d.ts.map +1 -0
- package/dist/order/matcher.js +123 -0
- package/dist/order/matcher.js.map +1 -0
- package/dist/order/order.d.ts +59 -0
- package/dist/order/order.d.ts.map +1 -0
- package/dist/order/order.js +239 -0
- package/dist/order/order.js.map +1 -0
- package/dist/order/order_data.d.ts +51 -0
- package/dist/order/order_data.d.ts.map +1 -0
- package/dist/order/order_data.js +64 -0
- package/dist/order/order_data.js.map +1 -0
- package/dist/order/ratio.d.ts +42 -0
- package/dist/order/ratio.d.ts.map +1 -0
- package/dist/order/ratio.js +82 -0
- package/dist/order/ratio.js.map +1 -0
- package/dist/order/relative.d.ts +43 -0
- package/dist/order/relative.d.ts.map +1 -0
- package/dist/order/relative.js +54 -0
- package/dist/order/relative.js.map +1 -0
- package/dist/owned_owner.d.ts +113 -0
- package/dist/owned_owner.d.ts.map +1 -0
- package/dist/owned_owner.js +280 -0
- package/dist/owned_owner.js.map +1 -0
- package/dist/sdk.d.ts +71 -42
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +388 -209
- package/dist/sdk.js.map +1 -1
- package/dist/send/sign_and_send_transaction.d.ts +46 -0
- package/dist/send/sign_and_send_transaction.d.ts.map +1 -0
- package/dist/send/sign_and_send_transaction.js +101 -0
- package/dist/send/sign_and_send_transaction.js.map +1 -0
- package/dist/send/wait_transaction.d.ts +41 -0
- package/dist/send/wait_transaction.d.ts.map +1 -0
- package/dist/send/wait_transaction.js +204 -0
- package/dist/send/wait_transaction.js.map +1 -0
- package/dist/udt.d.ts +123 -0
- package/dist/udt.d.ts.map +1 -0
- package/dist/udt.js +244 -0
- package/dist/udt.js.map +1 -0
- package/dist/utils/chain.d.ts +38 -0
- package/dist/utils/chain.d.ts.map +1 -0
- package/dist/utils/chain.js +20 -0
- package/dist/utils/chain.js.map +1 -0
- package/dist/utils/codec.d.ts +19 -0
- package/dist/utils/codec.d.ts.map +1 -0
- package/dist/utils/codec.js +66 -0
- package/dist/utils/codec.js.map +1 -0
- package/dist/utils/transaction_header.d.ts +17 -0
- package/dist/utils/transaction_header.d.ts.map +1 -0
- package/dist/utils/transaction_header.js +44 -0
- package/dist/utils/transaction_header.js.map +1 -0
- package/dist/utils/utils.d.ts +126 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +151 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +19 -26
- package/src/constants.ts +84 -181
- package/src/conversion/estimate.ts +157 -0
- package/src/conversion/maturity.ts +159 -0
- package/src/conversion/plans.ts +144 -0
- package/src/conversion/projection.ts +128 -0
- package/src/conversion/types.ts +287 -0
- package/src/conversion/withdrawal_ring.ts +126 -0
- package/src/dao.ts +172 -0
- package/src/index.ts +89 -3
- package/src/logic.ts +295 -0
- package/src/order/cells.ts +520 -0
- package/src/order/conversion.ts +173 -0
- package/src/order/fee.ts +30 -0
- package/src/order/fill.ts +83 -0
- package/src/order/info.ts +178 -0
- package/src/order/master.ts +42 -0
- package/src/order/matcher.ts +191 -0
- package/src/order/order.ts +302 -0
- package/src/order/order_data.ts +128 -0
- package/src/order/ratio.ts +144 -0
- package/src/order/relative.ts +106 -0
- package/src/owned_owner.ts +394 -0
- package/src/sdk.ts +555 -440
- package/src/send/sign_and_send_transaction.ts +120 -0
- package/src/send/wait_transaction.ts +271 -0
- package/src/udt.ts +317 -0
- package/src/utils/chain.ts +43 -0
- package/src/utils/codec.ts +74 -0
- package/src/utils/transaction_header.ts +66 -0
- package/src/utils/utils.ts +237 -0
- package/dist/codec.d.ts +0 -3
- package/dist/codec.d.ts.map +0 -1
- package/dist/codec.js +0 -58
- package/dist/codec.js.map +0 -1
- package/src/codec.ts +0 -138
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { ccc } from "@ckb-ccc/core";
|
|
2
|
+
import type { IckbDepositCell } from "./logic.js";
|
|
3
|
+
import type { ScriptDeps, TransactionHeader, ValueComponents } from "./utils/utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* A live Nervos DAO withdrawal request cell, valued at the two headers it spans.
|
|
6
|
+
*/
|
|
7
|
+
export interface DaoWithdrawalRequestCell {
|
|
8
|
+
/** The DAO withdrawal request cell. */
|
|
9
|
+
cell: ccc.Cell;
|
|
10
|
+
/** The deposit header and the request's own header. */
|
|
11
|
+
headers: [TransactionHeader, TransactionHeader];
|
|
12
|
+
/** The DAO interest accrued between the two headers. */
|
|
13
|
+
interests: ccc.Num;
|
|
14
|
+
/** The DAO claim epoch of the request. */
|
|
15
|
+
maturity: ccc.Epoch;
|
|
16
|
+
/** Whether the claim epoch is at or before the tip: the request can be withdrawn. */
|
|
17
|
+
isReady: boolean;
|
|
18
|
+
/** The capacity the withdrawal returns: the cell's plus the interest. */
|
|
19
|
+
ckbValue: ccc.FixedPoint;
|
|
20
|
+
}
|
|
21
|
+
/** The owner marker payload: where its owned cell sits in their shared transaction. */
|
|
22
|
+
export interface OwnerData {
|
|
23
|
+
/** Signed output-index distance from the owner marker to the owned cell. */
|
|
24
|
+
ownedDistance: ccc.Num;
|
|
25
|
+
}
|
|
26
|
+
/** Encodes an owner marker payload. */
|
|
27
|
+
export declare function encodeOwnerData(data: OwnerData): ccc.Bytes;
|
|
28
|
+
/**
|
|
29
|
+
* Decodes the fixed owner-data prefix and ignores trailing cell payload bytes.
|
|
30
|
+
*
|
|
31
|
+
* @remarks The owner data prefix is 4 bytes after the `0x` marker: a signed little-endian
|
|
32
|
+
* relative output-index distance to the owned cell. Later bytes belong to other protocol
|
|
33
|
+
* data and are intentionally tolerated here.
|
|
34
|
+
*/
|
|
35
|
+
export declare function decodeOwnerData(outputData: ccc.Hex): OwnerData;
|
|
36
|
+
/**
|
|
37
|
+
* Wraps an owner marker cell that references an owned withdrawal request.
|
|
38
|
+
*/
|
|
39
|
+
export declare class OwnerCell implements ValueComponents {
|
|
40
|
+
/** The live owner marker cell whose output data points to the owned request. */
|
|
41
|
+
cell: ccc.Cell;
|
|
42
|
+
/** Owner marker cells carry no UDT value. */
|
|
43
|
+
readonly udtValue = 0n;
|
|
44
|
+
/** Creates an owner marker wrapper for a live cell. */
|
|
45
|
+
constructor(cell: ccc.Cell);
|
|
46
|
+
/** Returns the CKB capacity held by the owner marker cell. */
|
|
47
|
+
get ckbValue(): ccc.FixedPoint;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the owned withdrawal request out point referenced by this owner marker.
|
|
50
|
+
*
|
|
51
|
+
* @remarks Owner data stores a signed output-index distance. The owned cell is resolved
|
|
52
|
+
* on the same transaction hash as the owner marker cell.
|
|
53
|
+
*/
|
|
54
|
+
getOwned(): ccc.OutPoint;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Pairs an owned DAO withdrawal request with the owner marker cell that points to it.
|
|
58
|
+
*/
|
|
59
|
+
export declare class WithdrawalGroup implements ValueComponents {
|
|
60
|
+
/** The decoded DAO withdrawal request controlled by this owner marker. */
|
|
61
|
+
owned: DaoWithdrawalRequestCell;
|
|
62
|
+
/** The owner marker cell that references the owned withdrawal request. */
|
|
63
|
+
owner: OwnerCell;
|
|
64
|
+
/** Creates a withdrawal group from a decoded request and its owner marker. */
|
|
65
|
+
constructor(owned: DaoWithdrawalRequestCell, owner: OwnerCell);
|
|
66
|
+
/** Returns the total CKB capacity in the owned withdrawal and owner marker cells. */
|
|
67
|
+
get ckbValue(): ccc.FixedPoint;
|
|
68
|
+
/** Returns the iCKB amount represented by the owned withdrawal request. */
|
|
69
|
+
get udtValue(): ccc.FixedPoint;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Builds and finds Owned Owner withdrawal groups for an iCKB deployment.
|
|
73
|
+
*/
|
|
74
|
+
export declare class OwnedOwnerManager implements ScriptDeps {
|
|
75
|
+
/** The Owned Owner script used as owner marker type and withdrawal request lock. */
|
|
76
|
+
readonly script: ccc.Script;
|
|
77
|
+
/** Cell dependencies required to execute the Owned Owner script. */
|
|
78
|
+
readonly cellDeps: ccc.CellDep[];
|
|
79
|
+
/** The Nervos DAO script the withdrawal requests carry, with its cell deps. */
|
|
80
|
+
readonly dao: ScriptDeps;
|
|
81
|
+
/** Creates the manager for one Owned Owner deployment over one DAO deployment. */
|
|
82
|
+
constructor(script: ccc.Script, cellDeps: ccc.CellDep[], dao: ScriptDeps);
|
|
83
|
+
/** Whether the cell is an owner marker for this manager's script. */
|
|
84
|
+
isOwner(cell: ccc.Cell): boolean;
|
|
85
|
+
/** Whether the cell is a DAO withdrawal request locked by this manager's script. */
|
|
86
|
+
isOwned(cell: ccc.Cell): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Spends the deposits into DAO withdrawal requests locked by the Owned Owner script,
|
|
89
|
+
* each followed by an owner marker locked by `lock` that points back at it.
|
|
90
|
+
*
|
|
91
|
+
* @remarks Caller must ensure UDT cellDeps are added to the transaction, for example
|
|
92
|
+
* via `ickbUdt.addCellDeps(tx)`.
|
|
93
|
+
*/
|
|
94
|
+
requestWithdrawal(txLike: ccc.TransactionLike, deposits: IckbDepositCell[], lock: ccc.Script): ccc.Transaction;
|
|
95
|
+
/**
|
|
96
|
+
* Spends the owned withdrawal requests and their owner markers, with the DAO header deps,
|
|
97
|
+
* since, and witness each request needs.
|
|
98
|
+
*
|
|
99
|
+
* @remarks The distinct deposit headers are moved to the front of the header deps and
|
|
100
|
+
* the withdrawal headers appended, so a deposit header's index is its rank among the
|
|
101
|
+
* collected withdrawals. Caller must ensure UDT cellDeps are added to the transaction.
|
|
102
|
+
*/
|
|
103
|
+
withdraw(txLike: ccc.TransactionLike, withdrawalGroups: WithdrawalGroup[]): ccc.Transaction;
|
|
104
|
+
/**
|
|
105
|
+
* The owner markers among `cells` paired with their owned withdrawal requests, which live
|
|
106
|
+
* in the marker's own transaction at the encoded distance. Markers whose target is not an
|
|
107
|
+
* owned withdrawal request are skipped. Each header is read once per batch.
|
|
108
|
+
*/
|
|
109
|
+
withdrawalGroupsFrom(client: ccc.Client, cells: readonly ccc.Cell[], tip: ccc.ClientBlockHeader): Promise<WithdrawalGroup[]>;
|
|
110
|
+
}
|
|
111
|
+
/** Values a DAO withdrawal request at its two headers and judges it claimable at the tip. */
|
|
112
|
+
export declare function withdrawalRequestCell(cell: ccc.Cell, depositHeader: ccc.ClientBlockHeader, requestHeader: TransactionHeader, tip: ccc.ClientBlockHeader): DaoWithdrawalRequestCell;
|
|
113
|
+
//# sourceMappingURL=owned_owner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owned_owner.d.ts","sourceRoot":"","sources":["../src/owned_owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAO,MAAM,eAAe,CAAC;AAQzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,uCAAuC;IACvC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;IACf,uDAAuD;IACvD,OAAO,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;IAChD,wDAAwD;IACxD,SAAS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";
|
|
2
|
+
import { assertDaoOutputLimit, DAO_HEADER_INDEX_LIMIT, DaoHeaderIndexError, isDaoWithdrawalRequest, pushHeaderDep, } from "./dao.js";
|
|
3
|
+
import { ickbValue } from "./udt.js";
|
|
4
|
+
import { CheckedInt32LE, CheckedUint64LE } from "./utils/codec.js";
|
|
5
|
+
import { headersByNumber, transactionHeaders } from "./utils/transaction_header.js";
|
|
6
|
+
const OwnerDataCodec = mol.struct({
|
|
7
|
+
ownedDistance: CheckedInt32LE,
|
|
8
|
+
});
|
|
9
|
+
// An owner marker's fixed prefix: a signed 32-bit distance.
|
|
10
|
+
const ownerDataBytes = 4;
|
|
11
|
+
/** Encodes an owner marker payload. */
|
|
12
|
+
export function encodeOwnerData(data) {
|
|
13
|
+
return OwnerDataCodec.encode(data);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Decodes the fixed owner-data prefix and ignores trailing cell payload bytes.
|
|
17
|
+
*
|
|
18
|
+
* @remarks The owner data prefix is 4 bytes after the `0x` marker: a signed little-endian
|
|
19
|
+
* relative output-index distance to the owned cell. Later bytes belong to other protocol
|
|
20
|
+
* data and are intentionally tolerated here.
|
|
21
|
+
*/
|
|
22
|
+
export function decodeOwnerData(outputData) {
|
|
23
|
+
const { ownedDistance } = OwnerDataCodec.decode(outputData.slice(0, 2 + 2 * ownerDataBytes));
|
|
24
|
+
return { ownedDistance: ccc.numFrom(ownedDistance) };
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Wraps an owner marker cell that references an owned withdrawal request.
|
|
28
|
+
*/
|
|
29
|
+
export class OwnerCell {
|
|
30
|
+
/** The live owner marker cell whose output data points to the owned request. */
|
|
31
|
+
cell;
|
|
32
|
+
/** Owner marker cells carry no UDT value. */
|
|
33
|
+
udtValue = 0n;
|
|
34
|
+
/** Creates an owner marker wrapper for a live cell. */
|
|
35
|
+
constructor(cell) {
|
|
36
|
+
this.cell = cell;
|
|
37
|
+
}
|
|
38
|
+
/** Returns the CKB capacity held by the owner marker cell. */
|
|
39
|
+
get ckbValue() {
|
|
40
|
+
return this.cell.cellOutput.capacity;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns the owned withdrawal request out point referenced by this owner marker.
|
|
44
|
+
*
|
|
45
|
+
* @remarks Owner data stores a signed output-index distance. The owned cell is resolved
|
|
46
|
+
* on the same transaction hash as the owner marker cell.
|
|
47
|
+
*/
|
|
48
|
+
getOwned() {
|
|
49
|
+
const { txHash, index } = this.cell.outPoint;
|
|
50
|
+
let ownedDistance;
|
|
51
|
+
try {
|
|
52
|
+
({ ownedDistance } = decodeOwnerData(this.cell.outputData));
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw new Error(`Invalid owner marker payload at ${this.cell.outPoint.toHex()}: ${this.cell.outputData}`, { cause: error });
|
|
56
|
+
}
|
|
57
|
+
const ownedIndex = index + ownedDistance;
|
|
58
|
+
if (ownedIndex < 0n) {
|
|
59
|
+
throw new Error(`Owner marker ${this.cell.outPoint.toHex()} points before output 0 with distance ${String(ownedDistance)}`);
|
|
60
|
+
}
|
|
61
|
+
return new ccc.OutPoint(txHash, ownedIndex);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Pairs an owned DAO withdrawal request with the owner marker cell that points to it.
|
|
66
|
+
*/
|
|
67
|
+
export class WithdrawalGroup {
|
|
68
|
+
/** The decoded DAO withdrawal request controlled by this owner marker. */
|
|
69
|
+
owned;
|
|
70
|
+
/** The owner marker cell that references the owned withdrawal request. */
|
|
71
|
+
owner;
|
|
72
|
+
/** Creates a withdrawal group from a decoded request and its owner marker. */
|
|
73
|
+
constructor(owned, owner) {
|
|
74
|
+
this.owned = owned;
|
|
75
|
+
this.owner = owner;
|
|
76
|
+
}
|
|
77
|
+
/** Returns the total CKB capacity in the owned withdrawal and owner marker cells. */
|
|
78
|
+
get ckbValue() {
|
|
79
|
+
return this.owned.ckbValue + this.owner.cell.cellOutput.capacity;
|
|
80
|
+
}
|
|
81
|
+
/** Returns the iCKB amount represented by the owned withdrawal request. */
|
|
82
|
+
get udtValue() {
|
|
83
|
+
return ickbValue(this.owned.cell.capacityFree, this.owned.headers[0].header);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Builds and finds Owned Owner withdrawal groups for an iCKB deployment.
|
|
88
|
+
*/
|
|
89
|
+
export class OwnedOwnerManager {
|
|
90
|
+
/** The Owned Owner script used as owner marker type and withdrawal request lock. */
|
|
91
|
+
script;
|
|
92
|
+
/** Cell dependencies required to execute the Owned Owner script. */
|
|
93
|
+
cellDeps;
|
|
94
|
+
/** The Nervos DAO script the withdrawal requests carry, with its cell deps. */
|
|
95
|
+
dao;
|
|
96
|
+
/** Creates the manager for one Owned Owner deployment over one DAO deployment. */
|
|
97
|
+
constructor(script, cellDeps, dao) {
|
|
98
|
+
this.script = script;
|
|
99
|
+
this.cellDeps = cellDeps;
|
|
100
|
+
this.dao = dao;
|
|
101
|
+
}
|
|
102
|
+
/** Whether the cell is an owner marker for this manager's script. */
|
|
103
|
+
isOwner(cell) {
|
|
104
|
+
if (cell.cellOutput.type?.eq(this.script) !== true || cell.outputData.length < 10) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
new OwnerCell(cell).getOwned();
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/** Whether the cell is a DAO withdrawal request locked by this manager's script. */
|
|
116
|
+
isOwned(cell) {
|
|
117
|
+
return (isDaoWithdrawalRequest(cell, this.dao.script) &&
|
|
118
|
+
cell.cellOutput.lock.eq(this.script));
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Spends the deposits into DAO withdrawal requests locked by the Owned Owner script,
|
|
122
|
+
* each followed by an owner marker locked by `lock` that points back at it.
|
|
123
|
+
*
|
|
124
|
+
* @remarks Caller must ensure UDT cellDeps are added to the transaction, for example
|
|
125
|
+
* via `ickbUdt.addCellDeps(tx)`.
|
|
126
|
+
*/
|
|
127
|
+
requestWithdrawal(txLike, deposits, lock) {
|
|
128
|
+
const tx = ccc.Transaction.from(txLike);
|
|
129
|
+
if (deposits.length === 0) {
|
|
130
|
+
return tx;
|
|
131
|
+
}
|
|
132
|
+
// The DAO script pairs each request output with the input at the same index.
|
|
133
|
+
if (tx.inputs.length !== tx.outputs.length ||
|
|
134
|
+
tx.outputs.length !== tx.outputsData.length) {
|
|
135
|
+
throw new Error("Transaction has different inputs and outputs lengths");
|
|
136
|
+
}
|
|
137
|
+
tx.addCellDeps(this.cellDeps);
|
|
138
|
+
tx.addCellDeps(this.dao.cellDeps);
|
|
139
|
+
const requestStart = tx.outputs.length;
|
|
140
|
+
for (const { cell, headers } of deposits) {
|
|
141
|
+
const depositHeader = headers[0];
|
|
142
|
+
if (depositHeader.txHash !== cell.outPoint.txHash) {
|
|
143
|
+
throw new Error(`DAO deposit ${cell.outPoint.toHex()} header txHash ${String(depositHeader.txHash)} does not match cell txHash ${cell.outPoint.txHash}`);
|
|
144
|
+
}
|
|
145
|
+
if (cell.cellOutput.lock.args.length !== this.script.args.length) {
|
|
146
|
+
throw new Error("Withdrawal request lock args has different size from deposit");
|
|
147
|
+
}
|
|
148
|
+
pushHeaderDep(tx, depositHeader.header.hash);
|
|
149
|
+
tx.addInput(cell);
|
|
150
|
+
tx.addOutput({ capacity: cell.cellOutput.capacity, lock: this.script, type: this.dao.script }, CheckedUint64LE.encode(depositHeader.header.number));
|
|
151
|
+
}
|
|
152
|
+
for (let index = 0; index < deposits.length; index += 1) {
|
|
153
|
+
tx.addOutput({ lock, type: this.script },
|
|
154
|
+
// Negative: owner markers are appended after their withdrawal outputs.
|
|
155
|
+
encodeOwnerData({
|
|
156
|
+
ownedDistance: BigInt(requestStart + index - tx.outputs.length),
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
assertDaoOutputLimit(tx, this.dao.script);
|
|
160
|
+
return tx;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Spends the owned withdrawal requests and their owner markers, with the DAO header deps,
|
|
164
|
+
* since, and witness each request needs.
|
|
165
|
+
*
|
|
166
|
+
* @remarks The distinct deposit headers are moved to the front of the header deps and
|
|
167
|
+
* the withdrawal headers appended, so a deposit header's index is its rank among the
|
|
168
|
+
* collected withdrawals. Caller must ensure UDT cellDeps are added to the transaction.
|
|
169
|
+
*/
|
|
170
|
+
withdraw(txLike, withdrawalGroups) {
|
|
171
|
+
const tx = ccc.Transaction.from(txLike);
|
|
172
|
+
if (withdrawalGroups.length === 0) {
|
|
173
|
+
return tx;
|
|
174
|
+
}
|
|
175
|
+
for (const group of withdrawalGroups) {
|
|
176
|
+
const ownedOutPoint = group.owned.cell.outPoint;
|
|
177
|
+
const linkedOutPoint = group.owner.getOwned();
|
|
178
|
+
if (!linkedOutPoint.eq(ownedOutPoint)) {
|
|
179
|
+
throw new Error(`Withdrawal owner ${group.owner.cell.outPoint.toHex()} points to ${linkedOutPoint.toHex()} but group owned cell is ${ownedOutPoint.toHex()}`);
|
|
180
|
+
}
|
|
181
|
+
const { cell, headers } = group.owned;
|
|
182
|
+
if (headers[1].txHash !== cell.outPoint.txHash) {
|
|
183
|
+
throw new Error(`DAO withdrawal request ${cell.outPoint.toHex()} header txHash ${String(headers[1].txHash)} does not match cell txHash ${cell.outPoint.txHash}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
tx.addCellDeps(this.cellDeps);
|
|
187
|
+
tx.addCellDeps(this.dao.cellDeps);
|
|
188
|
+
// Only this step names a header by index, and the deployed script reads that index as
|
|
189
|
+
// one byte, so the deposit headers go first, ahead of whatever the requests and receipts
|
|
190
|
+
// pushed: the limit then counts these alone. Safe because nothing else in the stack reads
|
|
191
|
+
// a header by position and every built transaction passes here once.
|
|
192
|
+
const depositHashes = [
|
|
193
|
+
...new Set(withdrawalGroups.map(({ owned }) => owned.headers[0].header.hash)),
|
|
194
|
+
];
|
|
195
|
+
tx.headerDeps = [
|
|
196
|
+
...depositHashes,
|
|
197
|
+
...tx.headerDeps.filter((hash) => !depositHashes.includes(hash)),
|
|
198
|
+
];
|
|
199
|
+
for (const { owned } of withdrawalGroups) {
|
|
200
|
+
pushHeaderDep(tx, owned.headers[1].header.hash);
|
|
201
|
+
}
|
|
202
|
+
for (const { owned } of withdrawalGroups) {
|
|
203
|
+
const headerIndex = tx.headerDeps.indexOf(owned.headers[0].header.hash);
|
|
204
|
+
// The deployed dao.c reads one byte of the u64 index field (RFC 0023 erratum,
|
|
205
|
+
// nervosnetwork/rfcs pull 456), so index 256 would be read as 0.
|
|
206
|
+
if (headerIndex >= DAO_HEADER_INDEX_LIMIT) {
|
|
207
|
+
throw new DaoHeaderIndexError(headerIndex);
|
|
208
|
+
}
|
|
209
|
+
const inputIndex = tx.addInput({
|
|
210
|
+
outPoint: owned.cell.outPoint,
|
|
211
|
+
cellOutput: owned.cell.cellOutput,
|
|
212
|
+
outputData: owned.cell.outputData,
|
|
213
|
+
since: { relative: "absolute", metric: "epoch", value: owned.maturity.toNum() },
|
|
214
|
+
}) - 1;
|
|
215
|
+
const witness = tx.getWitnessArgs(inputIndex) ?? ccc.WitnessArgs.from({});
|
|
216
|
+
if ((witness.inputType ?? "") !== "") {
|
|
217
|
+
throw new Error("Witnesses of withdrawal request already in use");
|
|
218
|
+
}
|
|
219
|
+
witness.inputType = ccc.hexFrom(CheckedUint64LE.encode(headerIndex));
|
|
220
|
+
tx.setWitnessArgs(inputIndex, witness);
|
|
221
|
+
}
|
|
222
|
+
for (const { owner } of withdrawalGroups) {
|
|
223
|
+
tx.addInput(owner.cell);
|
|
224
|
+
}
|
|
225
|
+
assertDaoOutputLimit(tx, this.dao.script);
|
|
226
|
+
return tx;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The owner markers among `cells` paired with their owned withdrawal requests, which live
|
|
230
|
+
* in the marker's own transaction at the encoded distance. Markers whose target is not an
|
|
231
|
+
* owned withdrawal request are skipped. Each header is read once per batch.
|
|
232
|
+
*/
|
|
233
|
+
async withdrawalGroupsFrom(client, cells, tip) {
|
|
234
|
+
const owners = cells
|
|
235
|
+
.filter((cell) => this.isOwner(cell))
|
|
236
|
+
.map((cell) => new OwnerCell(cell));
|
|
237
|
+
const ownedCells = await Promise.all(owners.map(async (owner) => client.getCell(owner.getOwned())));
|
|
238
|
+
const pairs = owners.flatMap((owner, index) => {
|
|
239
|
+
const owned = ownedCells[index];
|
|
240
|
+
return owned !== undefined && this.isOwned(owned)
|
|
241
|
+
? [{ owner, owned, depositBlockNumber: depositBlockNumberOf(owned) }]
|
|
242
|
+
: [];
|
|
243
|
+
});
|
|
244
|
+
const [depositHeaders, requestHeaders] = await Promise.all([
|
|
245
|
+
headersByNumber(client, pairs.map((pair) => pair.depositBlockNumber)),
|
|
246
|
+
transactionHeaders(client, pairs.map((pair) => pair.owned.outPoint.txHash)),
|
|
247
|
+
]);
|
|
248
|
+
return pairs.map(({ owner, owned, depositBlockNumber }) => {
|
|
249
|
+
const { txHash } = owned.outPoint;
|
|
250
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- both headers were read above.
|
|
251
|
+
const depositHeader = depositHeaders.get(depositBlockNumber);
|
|
252
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- both headers were read above.
|
|
253
|
+
const requestHeader = requestHeaders.get(txHash);
|
|
254
|
+
return new WithdrawalGroup(withdrawalRequestCell(owned, depositHeader, { header: requestHeader, txHash }, tip), owner);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/** Values a DAO withdrawal request at its two headers and judges it claimable at the tip. */
|
|
259
|
+
export function withdrawalRequestCell(cell, depositHeader, requestHeader, tip) {
|
|
260
|
+
const interests = ccc.calcDaoProfit(cell.capacityFree, depositHeader, requestHeader.header);
|
|
261
|
+
const maturity = ccc.calcDaoClaimEpoch(depositHeader, requestHeader.header);
|
|
262
|
+
return {
|
|
263
|
+
cell,
|
|
264
|
+
headers: [{ header: depositHeader }, requestHeader],
|
|
265
|
+
interests,
|
|
266
|
+
maturity,
|
|
267
|
+
isReady: maturity.compare(tip.epoch) <= 0,
|
|
268
|
+
ckbValue: cell.cellOutput.capacity + interests,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
/** The deposit block number a withdrawal request records in its data. */
|
|
272
|
+
function depositBlockNumberOf(cell) {
|
|
273
|
+
try {
|
|
274
|
+
return CheckedUint64LE.decode(cell.outputData);
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
throw new Error(`Invalid DAO withdrawal request payload at ${cell.outPoint.toHex()}: ${cell.outputData}`, { cause: error });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=owned_owner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owned_owner.js","sourceRoot":"","sources":["../src/owned_owner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,aAAa,GACd,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AA2BpF,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,CAAC;IAChC,aAAa,EAAE,cAAc;CAC9B,CAAC,CAAC;AACH,4DAA4D;AAC5D,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB,uCAAuC;AACvC,MAAM,UAAU,eAAe,CAAC,IAAe;IAC7C,OAAO,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACr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|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
feeBase?: ccc.Num;
|
|
17
|
-
}): {
|
|
18
|
-
convertedAmount: ccc.FixedPoint;
|
|
19
|
-
ckbFee: ccc.FixedPoint;
|
|
20
|
-
info: Info;
|
|
21
|
-
maturity: ccc.Num | undefined;
|
|
22
|
-
};
|
|
23
|
-
static maturity(o: OrderCell | {
|
|
24
|
-
info: Info;
|
|
25
|
-
amounts: ValueComponents;
|
|
26
|
-
}, system: SystemState): bigint | undefined;
|
|
27
|
-
request(tx: SmartTransaction, user: ccc.Signer | ccc.Script, info: Info, amounts: ValueComponents): Promise<void>;
|
|
28
|
-
collect(tx: SmartTransaction, groups: OrderGroup[], options?: {
|
|
29
|
-
isFulfilledOnly?: boolean;
|
|
30
|
-
}): void;
|
|
31
|
-
getL1State(client: ccc.Client, locks: ccc.Script[]): Promise<{
|
|
2
|
+
import type { AccountState, CompleteIckbTransactionOptions, ConversionTransactionContext, ConversionTransactionOptions, ConversionTransactionResult, SdkManagers, SystemState } from "./conversion/types.js";
|
|
3
|
+
import { type LockUpPolicy } from "./dao.js";
|
|
4
|
+
import type { IckbDepositCell } from "./logic.js";
|
|
5
|
+
import type { OrderGroup } from "./order/cells.js";
|
|
6
|
+
import type { SupportedChain } from "./utils/chain.js";
|
|
7
|
+
/**
|
|
8
|
+
* The whole SDK, which the Node actors drive by relative import; the package barrel
|
|
9
|
+
* exposes the two conversion-workflow methods, and its assignment checks they agree.
|
|
10
|
+
*/
|
|
11
|
+
export interface IckbSdk {
|
|
12
|
+
/** Builds and completes a conversion, or returns a typed planning failure. */
|
|
13
|
+
buildConversionTransaction(txLike: ccc.TransactionLike, options: ConversionTransactionOptions): Promise<ConversionTransactionResult>;
|
|
14
|
+
/** Reads system, user-order, and account state against one sampled tip, under one timing policy. */
|
|
15
|
+
getL1AccountState(client: ccc.Client, locks: ccc.Script[], lockUp: LockUpPolicy): Promise<{
|
|
32
16
|
system: SystemState;
|
|
33
17
|
user: {
|
|
34
18
|
orders: OrderGroup[];
|
|
35
19
|
};
|
|
20
|
+
account: AccountState;
|
|
36
21
|
}>;
|
|
37
|
-
|
|
22
|
+
/** Adds requested withdrawal, collection, receipt, and ready-withdrawal steps. */
|
|
23
|
+
buildBaseTransaction(txLike: ccc.TransactionLike, steps: CollectSteps, withdrawalRequest?: {
|
|
24
|
+
deposits: IckbDepositCell[];
|
|
25
|
+
lock: ccc.Script;
|
|
26
|
+
}): ccc.Transaction;
|
|
27
|
+
/** Completes iCKB inputs and fees without signing or sending the transaction. */
|
|
28
|
+
completeTransaction(txLike: ccc.TransactionLike, options: CompleteIckbTransactionOptions): Promise<ccc.Transaction>;
|
|
38
29
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Input count up to which one own transaction sweeps liquid cells.
|
|
32
|
+
*
|
|
33
|
+
* @remarks A compaction target, not a validity bound: required funding and the fee may go
|
|
34
|
+
* past it. Counted rather than measured in bytes because a same-lock input costs a fixed
|
|
35
|
+
* 44 bytes (52 with an extra witness slot), so 1,000 inputs stay near 50 KB, far under the
|
|
36
|
+
* node's 512,000-byte limit, and near the one measured point (1,000 inputs: 44 KB, about
|
|
37
|
+
* 180 ms of local completion). A miner paying the bot adds about forty cellbase cells per
|
|
38
|
+
* turn, which this outpaces; a larger backlog takes several transactions.
|
|
39
|
+
*/
|
|
40
|
+
export declare const SWEEP_INPUT_LIMIT = 1000;
|
|
41
|
+
/** What every own transaction collects along: the context's collectable positions. */
|
|
42
|
+
export type CollectSteps = Pick<ConversionTransactionContext, "availableOrders" | "receipts" | "readyWithdrawals">;
|
|
43
|
+
/** Concrete iCKB SDK constructor and static estimators. */
|
|
44
|
+
export declare const IckbSdk: {
|
|
45
|
+
new (managers: SdkManagers): IckbSdk;
|
|
46
|
+
fromChain: (chain: SupportedChain) => IckbSdk;
|
|
47
|
+
};
|
|
48
|
+
/** Whether the transaction already carries any input or output. */
|
|
49
|
+
export declare function hasTransactionActivity(tx: ccc.Transaction): boolean;
|
|
50
|
+
/** Stable machine-readable failures owned by the Phase-2 SDK. */
|
|
51
|
+
export type IckbErrorCode = "insufficient_capacity" | "insufficient_ickb";
|
|
52
|
+
/** Typed SDK failure with a stable machine-readable code. */
|
|
53
|
+
export declare class IckbError extends Error {
|
|
54
|
+
/** Stable failure code for callers and observability. */
|
|
55
|
+
readonly code: IckbErrorCode;
|
|
56
|
+
/** Creates a typed SDK failure while preserving its cause. */
|
|
57
|
+
constructor(message: string, options: ErrorOptions & {
|
|
58
|
+
code: IckbErrorCode;
|
|
59
|
+
});
|
|
50
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Completes the first candidate that the real completer can fund.
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* Only completion knows what a transaction costs once markers, remainder orders, change, and
|
|
66
|
+
* fee are in, so no count is computed up front: each candidate is built and completed in turn.
|
|
67
|
+
* Capacity, DAO output-limit and DAO header-index failures advance
|
|
68
|
+
* the walk; transport, scan, signer, and malformed-transaction errors propagate. Exhausting
|
|
69
|
+
* the candidates throws the last advancing failure.
|
|
70
|
+
*/
|
|
71
|
+
export declare function completeFirstFundable<T>(candidates: Iterable<T>, build: (candidate: T) => ccc.Transaction, complete: (tx: ccc.Transaction) => Promise<ccc.Transaction>): Promise<{
|
|
72
|
+
candidate: T;
|
|
73
|
+
tx: ccc.Transaction;
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* A failure the walk advances past: the candidate costs more than the account funds, or
|
|
77
|
+
* needs more DAO outputs or deposit-header slots than one transaction has.
|
|
78
|
+
*/
|
|
79
|
+
export declare function isFundabilityFailure(error: unknown): error is Error;
|
|
51
80
|
//# sourceMappingURL=sdk.d.ts.map
|
package/dist/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,KAAK,EACV,YAAY,EACZ,8BAA8B,EAC9B,4BAA4B,EAE5B,4BAA4B,EAC5B,2BAA2B,EAC3B,WAAW,EACX,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,8EAA8E;IAC9E,0BAA0B,CACxB,MAAM,EAAE,GAAG,CAAC,eAAe,EAC3B,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACxC,oGAAoG;IACpG,iBAAiB,CACf,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,EACnB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC;QACT,MAAM,EAAE,WAAW,CAAC;QACpB,IAAI,EAAE;YAAE,MAAM,EAAE,UAAU,EAAE,CAAA;SAAE,CAAC;QAC/B,OAAO,EAAE,YAAY,CAAC;KACvB,CAAC,CAAC;IACH,kFAAkF;IAClF,oBAAoB,CAClB,MAAM,EAAE,GAAG,CAAC,eAAe,EAC3B,KAAK,EAAE,YAAY,EACnB,iBAAiB,CAAC,EAAE;QAAE,QAAQ,EA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