@leofcoin/chain 1.4.91 → 1.4.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2242,6 +2242,7 @@ class State extends Contract {
2242
2242
  if (lastTransactions.includes(hash)) {
2243
2243
  console.log('removing invalid block');
2244
2244
  await globalThis.blockStore.delete(await (await new BlockMessage(block)).hash());
2245
+ blocks.splice(block.index - 1);
2245
2246
  return this.#loadBlocks(blocks);
2246
2247
  }
2247
2248
  try {
package/exports/chain.js CHANGED
@@ -862,6 +862,7 @@ class State extends Contract {
862
862
  if (lastTransactions.includes(hash)) {
863
863
  console.log('removing invalid block');
864
864
  await globalThis.blockStore.delete(await (await new BlockMessage(block)).hash());
865
+ blocks.splice(block.index - 1);
865
866
  return this.#loadBlocks(blocks);
866
867
  }
867
868
  try {
@@ -1,2 +1,22 @@
1
1
  export type Address = base58String;
2
2
  export type BlockHash = base58String;
3
+ interface Transaction {
4
+ to: Address;
5
+ from: Address;
6
+ method: String;
7
+ params: string[];
8
+ nonce: Number;
9
+ }
10
+ interface RawTransaction extends Transaction {
11
+ timestamp: Number;
12
+ }
13
+ export declare type BlockInMemory = {
14
+ index: number;
15
+ transactions: RawTransaction[];
16
+ loaded?: Boolean;
17
+ };
18
+ export declare type RawBlock = {
19
+ index: number;
20
+ transactions: RawTransaction[];
21
+ };
22
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.4.91",
3
+ "version": "1.4.92",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": "./exports/node.js",