0.1.10 • Published 7 months ago
@ckb-ccc/udt v0.1.10
Quick Start
- At the moment,
UDTandUDTPausablefrom@ckb-ccc/udtare fully supported through SSRI. In the future, there will be built in TypeScript generation directly based on the Rust source code on compilation. - To instantiate a
UDTscript compliant with SSRI, you can provide the SSRI server url and also specify the OutPoint of the script code. - You can also instantiate a
UDTPausablescript or other scripts that extends fromUDT.
import { Server } from "@ckb-ccc/ssri";
import { Udt, UdtPausable } from "@ckb-ccc/udt";
const { signer } = useApp();
const server = new Server("https://localhost:9090");
const udt = new Udt(
server,
{
txHash: "0x...",
index: 0,
},
{
codeHash: "0x...",
hashType: "type",
args: "0x...",
},
);
const udtPausable = new UdtPausable(
server,
{
txHash: "0x...",
index: 0,
},
{
codeHash: "0x...",
hashType: "type",
args: "0x...",
},
);You can directly call the methods in the script:
const { res: udtSymbol } = await udt.symbol();
const { res: pauseList } = await udtPausable.enumeratePaused();Some of the methods can return a ccc.Transaction. For example, you can call transfer with the following params:
const { script: to } = await signer.getRecommendedAddressObj();
const { res: transferTx } = await udt.transfer(signer, [{ to, amount: 100 }]);
const completedTx = await udt.completeUdtBy(transferTx, signer);
await completedTx.completeInputsByCapacity(signer);
await completedTx.completeFeeBy(signer);
const transferTxHash = await signer.sendTransaction(completedTx);0.1.10
7 months ago
0.1.9
8 months ago
0.0.0-canary-20250515182009
8 months ago
0.1.8
10 months ago
0.1.7
10 months ago
0.1.6
11 months ago
0.1.5
11 months ago
0.0.0-canary-20250214032328
11 months ago
0.0.0-canary-20250214032000
11 months ago
0.1.4
11 months ago
0.1.3
12 months ago
0.1.2
1 year ago
0.1.1
1 year ago
0.1.0
1 year ago