create accounts/subaddresses, chunked address style, fix canSend for subaddresses
This commit is contained in:
@@ -180,6 +180,8 @@ export type MoneroRpcRequests = {
|
||||
moneroListWallets: { params: {}; response: string[] }
|
||||
moneroTransfer: { params: { address: string; amount: string; priority?: number; accountIndex?: number }; response: MoneroSendResult }
|
||||
moneroSweepAll: { params: { address: string; priority?: number; accountIndex?: number }; response: MoneroSendResult }
|
||||
moneroCreateAccount: { params: { label?: string }; response: { index: number; address: string } }
|
||||
moneroCreateSubaddress: { params: { accountIndex: number; label?: string }; response: { index: number; address: string } }
|
||||
moneroGetTransferDetails: { params: { txid: string }; response: MoneroTransferDetails | null }
|
||||
moneroGetFeeEstimate: { params: {}; response: MoneroFeeEstimate | null }
|
||||
}
|
||||
|
||||
@@ -308,6 +308,23 @@ export const MoneroWallet = () => {
|
||||
return result
|
||||
}
|
||||
|
||||
const createAccount = async (label?: string) => {
|
||||
if (!electrobun.rpc) throw new Error('RPC not available')
|
||||
const result = await electrobun.rpc.request.moneroCreateAccount({ label })
|
||||
await refresh()
|
||||
return result
|
||||
}
|
||||
|
||||
const createSubaddress = async (accountIndex: number, label?: string) => {
|
||||
if (!electrobun.rpc) throw new Error('RPC not available')
|
||||
const result = await electrobun.rpc.request.moneroCreateSubaddress({
|
||||
accountIndex,
|
||||
label,
|
||||
})
|
||||
await refresh()
|
||||
return result
|
||||
}
|
||||
|
||||
return {
|
||||
get accountType() {
|
||||
return accountType
|
||||
@@ -412,6 +429,8 @@ export const MoneroWallet = () => {
|
||||
refresh,
|
||||
send,
|
||||
sendAll,
|
||||
createAccount,
|
||||
createSubaddress,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user