-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db0475c
commit cc245c6
Showing
8 changed files
with
49 additions
and
41 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
File renamed without changes.
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,30 @@ | ||
import { ethers } from 'ethers' | ||
import { IL2DataRequestFulfilled } from '../types' | ||
|
||
export const UINT128 = ethers.utils.id('uint128') | ||
export const INT256 = ethers.utils.id('uint128') | ||
export const BOOL = ethers.utils.id('bool') | ||
export const STRING = ethers.utils.id('string') | ||
export const BYTES32 = ethers.utils.id('bytes32') | ||
export const BYTES = ethers.utils.id('bytes') | ||
|
||
export const parseResponse = { | ||
[UINT128]: function (x: IL2DataRequestFulfilled) { | ||
return Number(x.responseUint128) | ||
}, | ||
[INT256]: function (x: IL2DataRequestFulfilled) { | ||
return Number(x.responseInt256) | ||
}, | ||
[BOOL]: function (x: IL2DataRequestFulfilled) { | ||
return x.responseBool | ||
}, | ||
[STRING]: function (x: IL2DataRequestFulfilled) { | ||
return x.responseString | ||
}, | ||
[BYTES32]: function (x: IL2DataRequestFulfilled) { | ||
return x.responseBytes32 | ||
}, | ||
[BYTES]: function (x: IL2DataRequestFulfilled) { | ||
return x.responseBytes | ||
} | ||
} satisfies Record<string, (x: IL2DataRequestFulfilled) => number | string | boolean> |
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