feat: bring over the formatter from gleam

This commit is contained in:
rvcas
2022-11-01 19:53:19 -04:00
parent 91a131d520
commit cba7a6f46e
32 changed files with 2270 additions and 480 deletions

View File

@@ -1,3 +1,5 @@
pub type ScriptContext {
thing: String
}
pub type ScriptContext { thing: String }

View File

@@ -1,8 +1,7 @@
pub type ScriptContext(purpose) {
tx_info: TxInfo,
script_purpose: purpose
}
pub type TxInfo {
idk: Int
}
pub type ScriptContext(purpose) { tx_info: TxInfo, script_purpose: purpose }
pub type TxInfo { idk: Int }

View File

@@ -1,7 +1,10 @@
use sample/context
pub type Mint {
currency_symbol: ByteArray
}
pub type ScriptContext = context.ScriptContext(Mint)
pub type Mint { currency_symbol: ByteArray }
pub type ScriptContext =
context.ScriptContext(Mint)

View File

@@ -1,7 +1,10 @@
use sample/context
pub type Spend {
idk: Int
}
pub type ScriptContext = context.ScriptContext(Spend)
pub type Spend { idk: Int }
pub type ScriptContext =
context.ScriptContext(Spend)

View File

@@ -1,9 +1,11 @@
use sample/mint
use sample/spend
pub type Datum {
something: String,
}
pub type Datum { something: String }
pub type Redeemer {
Buy
@@ -11,8 +13,8 @@ pub type Redeemer {
}
pub fn spend(datum: Datum, rdmr: Redeemer, ctx: spend.ScriptContext) -> Bool {
when rdmr is {
when rdmr is {
Buy -> True
Sell -> datum.something == "Aiken"
}
}
}