-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into show-gas-fields-on-ui
- Loading branch information
Showing
48 changed files
with
808 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/api/src/block/blockDetail.dto.ts → packages/api/src/block/blockDetails.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/api/src/common/transformers/hexToDecimalNumber.transformer.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { hexToDecimalNumberTransformer } from "./hexToDecimalNumber.transformer"; | ||
|
||
describe("hexToDecimalNumberTransformer", () => { | ||
describe("to", () => { | ||
it("returns null for null input", () => { | ||
const result = hexToDecimalNumberTransformer.to(null); | ||
expect(result).toBeNull(); | ||
}); | ||
|
||
it("returns hex representation of the decimal number string", () => { | ||
const result = hexToDecimalNumberTransformer.to("800"); | ||
expect(result).toBe("0x0320"); | ||
}); | ||
}); | ||
|
||
describe("from", () => { | ||
it("returns null for null input", () => { | ||
const result = hexToDecimalNumberTransformer.from(null); | ||
expect(result).toBeNull(); | ||
}); | ||
|
||
it("returns decimal representation of the hex number string", () => { | ||
const result = hexToDecimalNumberTransformer.from("0x320"); | ||
expect(result).toBe("800"); | ||
}); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
packages/api/src/common/transformers/hexToDecimalNumber.transformer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { BigNumber } from "ethers"; | ||
import { ValueTransformer } from "typeorm"; | ||
|
||
export const hexToDecimalNumberTransformer: ValueTransformer = { | ||
to(decimalNumberStr: string | null): string | null { | ||
if (!decimalNumberStr) { | ||
return null; | ||
} | ||
return BigNumber.from(decimalNumberStr).toHexString(); | ||
}, | ||
from(hexNumberStr: string | null): string | null { | ||
if (!hexNumberStr) { | ||
return null; | ||
} | ||
return BigNumber.from(hexNumberStr).toString(); | ||
}, | ||
}; |
Oops, something went wrong.