@exodus/个人笔记
该模块允许用户为交易安全创建、管理和存储个人笔记
如何运作
- 个人笔记原子
模块的核心功能由 personalNotesAtom,用于存储用户生成的注释.
每个音符都有uniq id并被绑定为txId.
使用存储的个人笔记 PersonalNoteSet 财务报告和审定财务报表 PersonalNote 模型
const personalNotes = PersonalNoteSet.fromArray([
{ txId: 'bitcoin-tx-1', message: 'gift for friend' },
{ txId: 'ethereum-tx-1', message: 'gift from friend' },
])
personalNotesAtom.set(personalNotes)
const bitcoinTxPersonalNote = personalNotes.get('bitcoin-tx-1')
- 模块
这个模块有两件事:
- 将个人笔记同步到
fusion - 提供
upsert添加个人笔记的方法 仅允许以下道具:
exodus.personalNotes.upsert({
txId, // required
message, // string
// specific fields used by platforms features
username,
address,
dapp,
providerData,
walletConnect,
xmrInputs,
})
- 插件
插件订阅到 personalNotesAtom 并释放其价值 port
- Redux 模块
提供选择者获取个人笔记
使用量
此特性设计为与 @exodus/headless。见 使用 sdk。 。 。 .
来玩吧
- 打开游乐场 https://exodus-hydra.pages.dev/ 页面存档备份,存于互联网档案馆
- 运行
exodus.personalNotes.upsert({txId: 'e7b8f55e3173aed308b8fbff11ee1fb96183e51f111ac415da9ae057c72ac8ca', message: 'my note'})在 Dev 工具控制台中. - 运行
selectors.personalNotes.data(store.getState())在 Dev 工具控制台中。 你应该看看存有的个人笔记 - 运行
selectors.personalNotes.get(store.getState())('e7b8f55e3173aed308b8fbff11ee1fb96183e51f111ac415da9ae057c72ac8ca')在 Dev 工具控制台中。 你应该看看具体的个人说明
API 边
见 使用 sdk 更多关于特性插入 SDK 的细节
exodus.personalNotes.upsert(<Event>{
txId: 'bitcoin-tx-id',
message: 'tx for friend',
})
UI 侧
见 使用 sdk 关于基本UI侧设置的更多细节.
import { selectors } from '~/ui/flux'
const usePersonalNote = (txId) => {
const getPersonalNote = useSelector(selectors.personalNotes.get)
const personalNote = getPersonalNote(txId)
return personalNote
}