diff --git a/docs/README.md b/docs/README.md
index 6e4b153c..ffc7c144 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -88,7 +88,7 @@
Want to contribute? Then join the Imperium today!
- To help write content, make art, write code, share it, and or star this repo! All are welcome to the Nexus.
+To help write content, make art, write code, share it, and or star this repo! All are welcome to the Nexus.
COPYRIGHT © 2025 VIAT, UNIVERSAL WEB, THE NEXUS
diff --git a/docs/content.html b/docs/content.html
index 1c672a5c..e92e899c 100644
--- a/docs/content.html
+++ b/docs/content.html
@@ -88,7 +88,7 @@ BROAD CODE OBJECTIVES
Want to contribute? Then join the Imperium today!
- To help write content, make art, write code, share it, and or star this repo! All are welcome to the Nexus.
+To help write content, make art, write code, share it, and or star this repo! All are welcome to the Nexus.
COPYRIGHT © 2025 VIAT, UNIVERSAL WEB, THE NEXUS
diff --git a/docs/index.html b/docs/index.html
index dea938ca..48c96e60 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -102,7 +102,7 @@ BROAD CODE OBJECTIVES
Want to contribute? Then join the Imperium today!
- To help write content, make art, write code, share it, and or star this repo! All are welcome to the Nexus.
+To help write content, make art, write code, share it, and or star this repo! All are welcome to the Nexus.
COPYRIGHT © 2025 VIAT, UNIVERSAL WEB, THE NEXUS
diff --git a/examples/viat.js b/examples/viat.js
index 436f18a2..75b5e2e5 100644
--- a/examples/viat.js
+++ b/examples/viat.js
@@ -4,9 +4,15 @@
// Generate two wallets in the Viat network.
// Two wallets interact and send each other some amount of VIAT.
import { Wallet, wallet } from '#viat/index';
+import { toSmallestUnit } from '#viat/math/coin';
const amy = await wallet();
const mitzi = await wallet();
console.log('WALLET', amy, mitzi);
const mitziAddress = await mitzi.getAddress();
console.log('MITZI ADDRESS', mitziAddress);
-amy.send(1n, mitziAddress);
+// Amounts must be in the smallest unit (e.g., wei for Ethereum, satoshi for Bitcoin).
+const sendAmount = toSmallestUnit(1n);
+const manaAmount = 10000n;
+const txBlock = await amy.createTransaction(sendAmount, mitziAddress, manaAmount);
+console.log('TX BLOCK', txBlock.block);
+console.log('RECEIPT BLOCK', txBlock.receipt.block);
diff --git a/viat/blocks/receipt/block.js b/viat/blocks/receipt/block.js
index 28efcd30..bcd8add2 100644
--- a/viat/blocks/receipt/block.js
+++ b/viat/blocks/receipt/block.js
@@ -35,7 +35,7 @@ export class ReceiptBlock extends Block {
}
async configByTransactionBlock(blockObject, config) {
const txBlockData = blockObject.getData();
- const txHash = blockObject.getHash();
+ const txHash = blockObject.block.hash;
this.appendToCore(txBlockData.core, txHash);
}
appendToCore(coreData, txHash) {
diff --git a/viat/blocks/transaction/block.js b/viat/blocks/transaction/block.js
index e04082d1..683895e2 100644
--- a/viat/blocks/transaction/block.js
+++ b/viat/blocks/transaction/block.js
@@ -25,12 +25,12 @@ class TransactionBlock extends Block {
}
// Receipt Hash Link
// Block Hash (TX DATA || Receipt Meta?)
- async createReceipt(wallet) {
- this.receipt = await receiptBlock(this, wallet);
+ async createReceipt() {
+ this.receipt = await receiptBlock(this);
return this;
}
- getReceiptPath() {
- const filepath = getTransactionPathFromBlock(this);
+ async getReceiptPath() {
+ const filepath = await getTransactionPathFromBlock(this);
return filepath;
}
blockSchema = transactionBlockSchema;
diff --git a/viat/wallet/wallet.js b/viat/wallet/wallet.js
index 5a70e96b..3a18123c 100644
--- a/viat/wallet/wallet.js
+++ b/viat/wallet/wallet.js
@@ -12,15 +12,27 @@ export class Wallet extends CryptoID {
await this.initialize(config, optionalArg);
return this;
}
- async send(amount, receiver, mana = 1n) {
+ async createTransaction(amount, receiver, mana = 1n) {
const sender = await this.getAddress();
const txBlock = await transactionBlock({
- amount,
- receiver,
- sender,
- mana
+ core: {
+ amount,
+ receiver,
+ sender,
+ mana
+ }
});
+ await txBlock.finalize();
+ await txBlock.createReceipt();
+ await txBlock.receipt.finalize();
console.log('Transaction Block:', txBlock.block);
+ return txBlock;
+ }
+ async send(amount, receiver, mana = 1n) {
+ const txBlock = await this.createTransaction(amount, receiver, mana);
+ // Here you would typically send the transaction to the network
+ // This is a placeholder for the actual sending logic
+ console.log(`Sending transaction of ${amount} to ${receiver} with mana ${mana}`);
}
}
export function wallet(config) {