fix: it's more consistent to have snakecase builtins

This commit is contained in:
rvcas
2022-11-24 18:35:19 -05:00
committed by Lucas
parent 67d160230b
commit d5087dbcc7
5 changed files with 78 additions and 18 deletions

View File

@@ -1,11 +1,11 @@
use aiken/builtin
pub fn slice(bytes: ByteArray, start: Int, end: Int) -> ByteArray {
builtin.sliceByteArray(start, end, bytes)
builtin.slice_bytearray(start, end, bytes)
}
pub fn length(bytes: ByteArray) -> Int {
builtin.lengthOfByteArray(bytes)
builtin.length_of_bytearray(bytes)
}
pub fn is_empty(bytes: ByteArray) -> Bool {
@@ -13,9 +13,9 @@ pub fn is_empty(bytes: ByteArray) -> Bool {
}
pub fn concat(left front: ByteArray, right back: ByteArray) -> ByteArray {
builtin.appendByteArray(front, back)
builtin.append_bytearray(front, back)
}
pub fn prepend(rest: ByteArray, byte: Int) -> ByteArray {
builtin.consByteArray(byte, rest)
builtin.cons_bytearray(byte, rest)
}

View File

@@ -13,7 +13,7 @@ pub type ScriptPurpose {
Certify(Certificate)
}
pub type Redeemer =
pub type Redeemer =
Data
pub type BoundValue(value) {
@@ -47,8 +47,8 @@ pub type Transaction {
id: TransactionId,
}
pub type TransactionId = {
hash: Hash(Transaction)
pub type TransactionId {
hash: Hash(Transaction),
}
pub type Input {
@@ -64,12 +64,12 @@ pub type OutputReference {
pub type PolicyId =
ByteArray
pub type StakeCredential = {
pub type StakeCredential {
StakeHash(Credential)
StakePointer(Int, Int, Int)
}
pub type Credential = {
pub type Credential {
PublicKeyCredential(PublicKeyHash)
ScriptCredential(ScriptHash)
}
@@ -86,19 +86,19 @@ pub type PublicKeyHash =
pub type PoolId =
Hash(VerificationKey)
pub type Output = {
pub type Output {
address: Address,
value: Value,
datum: DatumOption,
reference_script: Option(ScriptHash),
}
pub type Address = {
pub type Address {
payment_credential: Credential,
stake_credential: Option(StakeCredential),
}
pub type DatumOption = {
pub type DatumOption {
NoDatum
DatumHash(Hash(Data))
Datum(Data)

View File

@@ -63,7 +63,7 @@ pub fn range(from: Int, to: Int) -> List(Int) {
pub fn head(xs: List(a)) -> Option(a) {
when xs is {
[] -> None
_ -> Some(builtin.headList(xs))
_ -> Some(builtin.head_list(xs))
}
}