Skip to content
Merged

Beta #98

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions viat/blocks/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class Block {
this.setMeta('nonce', this.cipherSuite.createBlockNonce(this.nonceSize));
}
async createSignature(wallet) {
const binary = await this.exportDataBinary();
const binary = this.block.hash;
const signature = await wallet.signPartial(binary);
return signature;
}
Expand Down Expand Up @@ -193,9 +193,6 @@ export class Block {
}
setCore(primaryArg, value) {
if (isPlainObject(primaryArg)) {
if (primaryArg.amount) {
primaryArg.amount = toSmallestUnit(primaryArg.amount, 'mana');
}
assign(this.block.data.core, primaryArg);
return this;
}
Expand Down
4 changes: 1 addition & 3 deletions viat/math/coin.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ export function toSmallestUnit(value) {
return parseStringUnits(value);
} else if (isBigInt(value)) {
const strValue = value.toString();
if (isBigIntBelowMaxSupply(value) && strValue.length <= coinMaxSupplyLength) {
return value;
}
return parseStringUnits(strValue);
}
return;
}
Expand Down
2 changes: 2 additions & 0 deletions viat/wallet/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export class Wallet extends CryptoID {
}
});
await txBlock.finalize();
await txBlock.sign(this);
await txBlock.createReceipt();
await txBlock.receipt.finalize();
await txBlock.receipt.sign(this);
console.log('Transaction Block:', txBlock.block);
return txBlock;
}
Expand Down
Loading