Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@aldea/wallet-lib
Advanced tools
These are the basics on how to use the wallet.
We have 2 types of storage at the moment: LowDB and memory. Low db allows you to use several supports:
import { Memory } from "lowdb"
import { JSONFile, TextFile } from "lowdb/node"
import { LowDbStorage, LowDbData } from "@aldea/wallet-lib"
// lowdb + memory
const storage = new LowDbStorage(new Memory<LowDbData>())
// lowdb + jsonfile
const storage = new LowDbStorage(new JSONFile<LowDbData>('path/to/my/json/file.json'))
// lowdb + textfile
const storage = new LowDbStorage(new JSONFile<LowDbData>('path/to/my/file.txt'))
And memory (transient storage):
import { LowDbStorage, MemoryStorage } from "@aldea/wallet-lib"
const storage = new MemoryStorage()
Again, 2 options: Single key wallet and HDWallet
import { SingleKeyWallet, HdWallet } from "@aldea/wallet-lib"
import { Aldea, HDPrivKey, PrivKey } from "@aldea/sdk"
const pk = PrivKey.fromRandom()
const aldea = new Aldea()
const wallet1 = new SingleKeyWallet(pk, aldea, storage)
const wallet2 = new HdWallet(storage, aldea, hdPriv)
const kyResponse = await aldea.api.post('mint', {
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
address: await wallet.getNextAddress().then(a => a.toString()),
amount: 500
})
})
const output = Output.fromJson(await kyResponse.json())
await wallet.addUtxo(output)
There is a wraper around aldea.createTx
that signs, fund and broadcast
const response = await wallet.fundSignAndBroadcastTx(async builder => {
const pkgIdx = builder.import('ea9225bcf8572c3a9fa75d186b62ab976d017d96b0614612f59d5fa5087b7fa3')
const nftIdx = builder.new(pkgIdx, 'NFT', ['name', 32, 'moreName'])
builder.lock(nftIdx, await wallet.getNextAddress())
})
Another option is doing this by hand:
const tx = aldea.createTx(async builder => {
const pkgIdx = builder.import('ea9225bcf8572c3a9fa75d186b62ab976d017d96b0614612f59d5fa5087b7fa3')
const nftIdx = builder.new(pkgIdx, 'NFT', ['name', 32, 'moreName'])
builder.lock(nftIdx, await wallet.getNextAddress())
await wallet.fundTx(builder)
await wallet.signTx(builder)
})
const commitResponse = await aldea.commitTX(tx)
await wallet.processTx(tx, commitResponse.output.map(Output.fromJson))
const utxos = wallet.getInventory()
const coins = utxos.filter(u => u.classPtr.id === new Array(32).fill(0).join(''))
FAQs
High level and versatile wallet tool for Aldea Blockchain
We found that @aldea/wallet-lib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.