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
{-# STDLIB_VERSION 3 #-} | |
{-# SCRIPT_TYPE ACCOUNT #-} | |
{-# CONTENT_TYPE DAPP #-} | |
@Callable(i) | |
func request (name: String) = { | |
# verify the certificate is not in data state yet | |
let wasRequested = match getInteger(this, name) { | |
case a: Int => true | |
case _ => false |
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
["a","b","c","d"].indexOf("a") | |
# >> 0 | |
["a","b","c","d"].contains("a") | |
# >> true | |
[1, 2, 3, 4].min() | |
# >> 1 | |
[1, 2, 3, 4].max() |
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
let bitcoinId = base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS' | |
let x = match assetInfo(bitcoinId) { | |
case asset:Asset => | |
asset.name # bitcoin | |
case _ => throw("Can't find asset") | |
} |
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
dApp.widget.initWidget("<recipient>", "WAVES"); | |
dApp.widget.initPurchase(TOTALAMOUNT); |
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
document.addEventListener("DOMContentLoaded", function() { | |
document.querySelector(".data").value = location.href.split("?")[1] | |
.replace("%20", " ") | |
.replace("%20", " "); | |
}); |
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
strict z = invoke(dapp, func, args,[AttachedPayment(unit,100000000)]) | |
// invoke(dApp: Address|Alias, function: String, arguments: List[Any], payments: List[AttachedPayments]): Any |
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
func foo() = { | |
... | |
strict balanceBefore = wavesBalance(this).regular | |
strict z = invoke(dapp2,bar,args,[AttachedPayment(unit,100000000)]) | |
strict balanceAfter = wavesBalance(this).regular | |
if(balanceAfter < balanceBefore) then ... else... | |
} |
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
function sendData() { | |
const text = document.querySelector(".data").value; | |
let data = text.split("\n"); | |
data = data.map(function(x) { return {"key": x.split(" ")[0], "value": x, "type": "string"}} ); | |
const tx = { | |
type: 12, // data transaction | |
data: { | |
data: data, | |
fee: { | |
"tokens": "0.001", |
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
# use this JSON to swap EGGs with ledger | |
# replace "amount": 100, with your amount of EGGlets (1 EGG = 100, 1.01 EGG = 101) | |
{ | |
"type": 16, | |
"version": 2, | |
"dApp": "3PJQUUiJdvz9etUKED9ju7o7VrcNMtnkXBU", | |
"call": { | |
"args": [], | |
"function": "swapEgg" |
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
// to invoke puzzle swap you will need to broadcast this transaction | |
// TODO: replace poolAddress (for example "3PPRHHF9JKvDLkAc3aHD3Kd5tRZp1CoqAJa") | |
// TODO: replace assetInId and assetOutId (for example "4kwKSf4Bx2Wq8YxKnVZBhcEHyXzEtJ2pw7ixfJgirwf2" and "54UszKAj3MtYmkdRCqSXAcaQLaVALBy7CCrVkfmfzhxR") | |
// TODO: set minToReceive if you want to avoid slippage risk | |
.invoke({ | |
dApp: "poolAddress", | |
fee: 500000, | |
payment: { | |
assetId: "assetInId", |