This file contains hidden or 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
| import { address as decodeAddress, concat, stringToBytes, verifySignature } from '@waves/ts-lib-crypto'; | |
| import { verifyCustomData } from '@waves/waves-transactions'; | |
| export function verifyAuthentication(signature: string, publicKey: string, address: string): string | null { | |
| const signedByAddress = decodeAddress({ publicKey }); | |
| const messageBytes = stringToBytes(address); | |
| const authDataString = concat([255, 255, 255, 1], messageBytes); | |
| if ( | |
| verifyCustomData({ |
This file contains hidden or 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 allTransactions: Array<any> = []; | |
| let response: any; | |
| let after: null | string = null; | |
| do { | |
| let url = `https://api.wavesplatform.com/v0/transactions/invoke-script?timeStart=2021-10-20T12%3A00%3A00.000Z&dapp=3PAETTtuW7aSiyKtn9GuML3RgtV1xdq1mQW&function=buyPerch&sort=desc&limit=100`; | |
| if (after) { | |
| url += `&after=${after}` | |
| } | |
| response = (await axios.get(url)).data; |
This file contains hidden or 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 findString(a: Any) = { | |
| match a { | |
| case a: String => a | |
| case a: List[Any] => | |
| match a[0] { | |
| case b: String => b | |
| case _ => throw("Data is not a string") | |
| } | |
| case _ => throw("Data is not a string") | |
| } |
This file contains hidden or 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
| ( | |
| [ | |
| ScriptTransfer(i.caller,100,unit) | |
| ], | |
| 42 | |
| ) |
This file contains hidden or 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[Boolean|ByteVector|Int|String|List[Boolean|ByteVector|Int|String]], payments: List[AttachedPayments]): T|Unit |
This file contains hidden or 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
| Language | Pros | Cons | |
|---|---|---|---|
| Solidity | Blockchain-specific | Many ways “to shoot himself in the leg” | |
| Turing-complete (flexibility) | Difficult to write production-ready code | ||
| Good developer tools and libraries |