-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- ✨ Pack verifier for depositing - ✨ Pack verifier for withdrawing - ✨ Pack verifier for claiming - ✨ Reclaim CKB locked by dao verifier cells - 📝 Add placeholder for docs about packing verifier
- Loading branch information
Showing
32 changed files
with
709 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Packing Verifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use server"; | ||
|
||
import { cache } from "react"; | ||
import { getConfig, buildScript } from "@/lib/config"; | ||
import { addressToScript } from "@ckb-lumos/helpers"; | ||
import { Indexer } from "@ckb-lumos/ckb-indexer"; | ||
|
||
function buildVerifierScript(ckbChainConfig) { | ||
return buildScript(ckbChainConfig.SCRIPTS.DAO_ACTION_VERIFIER, "0x"); | ||
} | ||
|
||
export async function getVerifierCellsWithoutCache(lockAddress, config) { | ||
const { ckbRpcUrl, ckbChainConfig } = config ?? getConfig(); | ||
const indexer = new Indexer(ckbRpcUrl); | ||
|
||
const lock = addressToScript(lockAddress, { config: ckbChainConfig }); | ||
const collector = indexer.collector({ | ||
lock, | ||
argsLen: (lock.args.length - 2) / 2, | ||
type: buildVerifierScript(ckbChainConfig), | ||
}); | ||
const verifierCells = []; | ||
for await (const cell of collector.collect()) { | ||
verifierCells.push(cell); | ||
} | ||
return verifierCells; | ||
} | ||
|
||
export const getVerifierCellsWithCache = cache(getVerifierCellsWithoutCache); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use server"; | ||
|
||
import { reclaimDaoVerifiers } from "@/lib/cobuild/publishers"; | ||
import { getConfig } from "@/lib/config"; | ||
import { prepareLockActions } from "@/lib/cobuild/lock-actions"; | ||
import { payFee } from "@/lib/cobuild/fee-manager"; | ||
|
||
export default async function reclaim(from, config) { | ||
config = config ?? getConfig(); | ||
|
||
try { | ||
let buildingPacket = await reclaimDaoVerifiers(config)({ from }); | ||
buildingPacket = await payFee( | ||
buildingPacket, | ||
[{ address: from, feeRate: 1200 }], | ||
config, | ||
); | ||
buildingPacket = prepareLockActions(buildingPacket, config.ckbChainConfig); | ||
|
||
return { | ||
buildingPacket, | ||
}; | ||
} catch (err) { | ||
console.error(err.stack); | ||
return { | ||
error: err.toString(), | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.