监控 UTXO
UTXO可以通过该方法获得,也可以通过通知注册和监听UTXO更新来获得。getUtxosByAddresses
按地址获取 UTXO
let addresses = [ new Address("kaspatest:qz7ulu4c25dh7fzec9zjyrmlhnkzrg4wmf89q7gzr3gfrsj3uz6xjceef60sd"), new Address("kaspatest:qzn3qjzf2nzyd3zj303nk4sgv0aae42v3ufutk5xsxckfels57dxjnltw0jwz",), ]; let utxos = await rpc.getUtxosByAddresses({ addresses }); utxos.forEach((utxo) => { console.log(utx.address); console.log(utx.outpoint); console.log(utx.utxoEntry); })
注册UTXO通知 - TODO
let addresses = [ new Address("kaspatest:qz7ulu4c25dh7fzec9zjyrmlhnkzrg4wmf89q7gzr3gfrsj3uz6xjceef60sd"), new Address("kaspatest:qzn3qjzf2nzyd3zj303nk4sgv0aae42v3ufutk5xsxckfels57dxjnltw0jwz",), ]; // register notification handler await rpc.notify(async (op, payload) => { // TODO test if op == "NotifyUtxosChanged" { // TODO - new UTXO entry ... } }); // subscribe addresses for notifications await rpc.subscribeUtxosChanged(addresses); // ... // unsubscribe addresses await rpc.unsubscribeUtxosChanged(addresses); // reset notification handler await rpc.notify(null);
感动 | 同情 | 无聊 | 愤怒 | 搞笑 | 难过 | 高兴 | 路过 |
- 上一篇:创建kaspa交易
- 下一篇:Kaspa集成基础知识
相关文章
-
没有相关内容