-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ogmios): complete Ogmios tx to core mapping
- Loading branch information
Ivaylo Andonov
committed
Dec 5, 2022
1 parent
fa1c487
commit bcac56b
Showing
8 changed files
with
1,149 additions
and
249 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { BlockKind } from './types'; | ||
import { Schema } from '@cardano-ogmios/client'; | ||
|
||
export const BYRON_TX_FEE_COEFFICIENT = 43_946_000_000; | ||
export const BYRON_TX_FEE_CONSTANT = 155_381_000_000_000; | ||
|
||
export const isNativeScript = (script: Schema.Script): script is Schema.Native => 'native' in script; | ||
|
||
export const isPlutusV1Script = (script: Schema.Script): script is Schema.PlutusV1 => 'plutus:v1' in script; | ||
|
||
export const isPlutusV2Script = (script: Schema.Script): script is Schema.PlutusV2 => 'plutus:v2' in script; | ||
|
||
export const isRequireAllOf = (nativeScript: Schema.ScriptNative): nativeScript is Schema.All => | ||
typeof nativeScript === 'object' && 'all' in nativeScript; | ||
|
||
export const isRequireAnyOf = (nativeScript: Schema.ScriptNative): nativeScript is Schema.Any => | ||
typeof nativeScript === 'object' && 'any' in nativeScript; | ||
|
||
export const isExpiresAt = (nativeScript: Schema.ScriptNative): nativeScript is Schema.ExpiresAt => | ||
typeof nativeScript === 'object' && 'expiresAt' in nativeScript; | ||
|
||
export const isStartsAt = (nativeScript: Schema.ScriptNative): nativeScript is Schema.StartsAt => | ||
typeof nativeScript === 'object' && 'startsAt' in nativeScript; | ||
|
||
export const isRequireNOf = (nativeScript: Schema.ScriptNative): nativeScript is Schema.NOf => | ||
typeof nativeScript === 'object' && !Number.isNaN(Number(Object.keys(nativeScript)[0])); | ||
|
||
export const isAlonzoOrAbove = (kind: BlockKind) => kind === 'babbage' || kind === 'alonzo'; | ||
|
||
export const isMaryOrAbove = (kind: BlockKind) => isAlonzoOrAbove(kind) || kind === 'mary'; | ||
|
||
export const isShelleyTx = (kind: BlockKind) => kind === 'shelley'; |
Oops, something went wrong.