Skip to content

Commit

Permalink
block: add feeAmount
Browse files Browse the repository at this point in the history
  • Loading branch information
tammo committed Nov 13, 2020
1 parent ed74157 commit 95ac166
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type SignatureData = {
refAddress: SigPublicKey | undefined;
claimSignature: string | undefined;
payload: string | undefined;
feeAmount: string | undefined;
};

export enum BlockType {
Expand All @@ -27,9 +28,12 @@ export enum BlockType {
}

export class Block {
// ledger level
id: StorageId;
chainId: StorageId;
txId: string;

// common fields
signature: Signature;
type: BlockType;
symbol: AssetSymbol | undefined;
Expand All @@ -42,9 +46,11 @@ export class Block {
createdAt: number;
senderBalance: string;
senderAmount: string;
feeAmount: string | undefined;

nonce?: number[];
state?: string;
// used mostly on wallet level
nonce: number[] | undefined;
state: string | undefined;

getDataForSignature(): SignatureData {
const {
Expand All @@ -58,6 +64,7 @@ export class Block {
refAddress,
claimSignature,
payload,
feeAmount,
} = this;

return {
Expand All @@ -71,6 +78,7 @@ export class Block {
refAddress,
claimSignature,
payload,
feeAmount,
};
}

Expand Down Expand Up @@ -120,6 +128,8 @@ export function fromBlockObject(obj: any) {
block.senderAmount = obj.senderAmount;
block.state = obj.state;
block.payload = obj.payload;
block.nonce = obj.nonce;
block.feeAmount = obj.feeAmount;

return block;
}
Expand Down

0 comments on commit 95ac166

Please sign in to comment.