Compare commits

..

27 Commits

Author SHA1 Message Date
Denis Angell
41d9a399d7 remove LastLedgerSequence 2025-02-28 10:19:47 +01:00
Ekiserrepé
4c6a0b5a40 Bugs and Discussions button was broken, new link! (#318) 2025-02-28 10:10:59 +01:00
Tristan
0616149b6c New xahau share image 2025-02-18 09:45:56 +01:00
tequ
ee86d657c9 bump next-auth, typescript (#314) 2025-02-13 14:43:21 +01:00
tequ
12ebd4c1bc Fixed to retrieve the template header file from gist (#316) 2025-02-13 14:32:17 +01:00
Wietse Wind
6ed0b54fc5 Merge pull request #310 from Ekiserrepe/main
Readme and xah value updated
2025-01-02 01:21:03 +01:00
Ekiserrepé
b7e1343055 Github link update 2025-01-01 23:29:04 +01:00
Ekiserrepé
a13dbaeb53 Merge branch 'Xahau:main' into main 2025-01-01 23:14:23 +01:00
Ekiserrepé
98a7a1ee72 Readme updated 2025-01-01 22:22:26 +01:00
Ekiserrepé
46c0ec9682 value xah updated 2025-01-01 22:20:33 +01:00
Wietse Wind
fbc27b58c3 Merge pull request #309 from Ekiserrepe/main
Xahau translation
2025-01-01 22:07:02 +01:00
Ekiserrepé
635e1e22aa Update XAH capitals 2025-01-01 21:29:35 +01:00
Ekiserrepé
62ca0603fc Xahau translation 2025-01-01 18:03:13 +01:00
Wietse Wind
3234ba851a Merge pull request #308 from XRPLF/hooks-xahau-endpoints
update explorer & wss network URLS @ env sample
2023-10-30 23:06:27 +01:00
Wietse Wind
26aeea5a0d update explorer & wss network URLS @ env sample 2023-10-30 23:04:53 +01:00
Wietse Wind
4a1bd98bd4 Merge pull request #306 from Transia-RnD/main
Fix Bad URIToken Amount
2023-08-01 05:32:33 +02:00
Denis Angell
4171e618a2 add uritoken flag 2023-08-01 05:31:02 +02:00
Denis Angell
1860b2d9ce fix bad amount 2023-08-01 05:23:25 +02:00
Denis Angell
488828f9d6 remove nft transactions 2023-08-01 05:23:09 +02:00
Wietse Wind
9f2105f6d3 Merge pull request #305 from Transia-RnD/main
Add URIToken features
2023-08-01 05:11:58 +02:00
Denis Angell
6beccaef68 update ripple-binary-codec 2023-06-19 16:55:25 +00:00
Denis Angell
215af7258c Merge branch 'main' into main 2023-06-15 07:04:13 +00:00
Denis Angell
ac3137088b remove default hookon 2023-06-15 07:01:15 +00:00
Denis Angell
1b8debda87 bump ripple-binary-codec & update hook on 2023-06-15 06:35:26 +00:00
Wietse Wind
c50c7a5860 Merge pull request #304 from Transia-RnD/main
Update readme link
2023-06-11 08:34:34 +02:00
Denis Angell
d21cda21d0 !fixup 2023-06-06 12:53:43 +00:00
Denis Angell
1cae0f161e change readme link 2023-06-06 12:28:19 +00:00
82 changed files with 1248 additions and 4746 deletions

View File

@@ -5,8 +5,8 @@ GITHUB_ID=""
NEXT_PUBLIC_COMPILE_API_ENDPOINT="http://localhost:9000/api/build"
NEXT_PUBLIC_COMPILE_API_BASE_URL="http://localhost:9000"
NEXT_PUBLIC_LANGUAGE_SERVER_API_ENDPOINT="ws://localhost:9000/language-server/c"
NEXT_PUBLIC_TESTNET_URL="hooks-testnet-v3.xrpl-labs.com"
NEXT_PUBLIC_DEBUG_STREAM_URL="hooks-testnet-v3-debugstream.xrpl-labs.com"
NEXT_PUBLIC_EXPLORER_URL="hooks-testnet-v3-explorer.xrpl-labs.com"
NEXT_PUBLIC_TESTNET_URL="xahau-test.net"
NEXT_PUBLIC_DEBUG_STREAM_URL="xahau-test.net/debugstream"
NEXT_PUBLIC_EXPLORER_URL="explorer.xahau-test.net"
NEXT_PUBLIC_NETWORK_ID="21338"
NEXT_PUBLIC_SITE_URL="http://localhost:3000"
NEXT_PUBLIC_SITE_URL="http://localhost:3000"

1
.gitignore vendored
View File

@@ -23,7 +23,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.yarn
# local env files
.env.local

View File

@@ -1,8 +1,8 @@
# XRPL Hooks Builder
# Xahau Hooks Builder
https://hooks-builder.xrpl.org/
https://builder.xahau.network/
This is the repository for XRPL Hooks Builder. This project is built with Next.JS
This is the repository for Xahau Hooks Builder. This project is built with Next.JS
## General

View File

@@ -200,7 +200,7 @@ export const AccountDialog = ({
.toUnit()
.toLocaleString(undefined, {
style: 'currency',
currency: 'XRP',
currency: 'XAH',
currencyDisplay: 'name'
})}
<Button
@@ -459,7 +459,7 @@ const Accounts: FC<AccountProps> = props => {
.toUnit()
.toLocaleString(undefined, {
style: 'currency',
currency: 'XRP',
currency: 'XAH',
currencyDisplay: 'name'
})})`
) : (

View File

@@ -94,7 +94,7 @@ const DeployEditor = () => {
}}
>
{`You haven't compiled any files yet, compile files on `}
<NextLink legacyBehavior shallow href={`/develop/${router.query.slug}`} passHref>
<NextLink shallow href={`/develop/${router.query.slug}`} passHref>
<Link as="a">develop view</Link>
</NextLink>
</Text>

View File

@@ -155,11 +155,9 @@ const EditorNavigation = ({ renderNav }: { renderNav?: () => ReactNode }) => {
>
<Image
src={session?.user?.image || ''}
width="30"
height="30"
style={{
objectFit: 'cover'
}}
width="30px"
height="30px"
objectFit="cover"
alt="User avatar"
/>
</Box>

View File

@@ -40,6 +40,7 @@ const EnrichLog: FC<EnrichLogProps> = ({ str }) => {
if (match.startsWith('HookSet')) {
const code = match.match(/^HookSet\((\d+)\)/)?.[1]
const val = hookSetCodes.find(v => code && v.code === +code)
console.log({ code, val })
if (!val) return match
const content = capitalize(val.description) || 'No hint available!'

View File

@@ -94,14 +94,6 @@ const setMarkers = (monacoE: typeof monaco) => {
})
}
const langWarnings: Record<string, { shown: boolean; message: string }> = {
ts: {
shown: false,
message:
'Typescript suppport for hooks is still in early planning stage, write actual hooks in C only for now!'
}
}
const HooksEditor = () => {
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>()
const monacoRef = useRef<typeof monaco>()
@@ -133,14 +125,6 @@ const HooksEditor = () => {
const file = snap.files[snap.active]
useEffect(() => {
let warning = langWarnings[file?.language || '']
if (warning && !warning.shown) {
alert(warning.message) // TODO Custom dialog.
warning.shown = true
}
}, [file])
const renderNav = () => (
<Tabs
label="File"
@@ -237,7 +221,7 @@ const HooksEditor = () => {
monaco.languages.register({
id: 'text',
extensions: ['.txt'],
mimetypes: ['text/plain']
mimetypes: ['text/plain'],
})
MonacoServices.install(monaco)
const webSocket = createWebSocket(
@@ -256,7 +240,7 @@ const HooksEditor = () => {
try {
disposable.dispose()
} catch (err) {
console.error('err', err)
console.log('err', err)
}
})
}

View File

@@ -160,7 +160,7 @@ export const Log: FC<ILog> = ({
)}
<Pre>{message}</Pre>
{link && (
<NextLink legacyBehavior href={link} shallow passHref>
<NextLink href={link} shallow passHref>
<Link as="a">{linkText}</Link>
</NextLink>
)}

View File

@@ -1,5 +1,5 @@
import React from 'react'
import NextLink from 'next/link'
import Link from 'next/link'
import { useSnapshot } from 'valtio'
import { useRouter } from 'next/router'
@@ -78,7 +78,7 @@ const Navigation = () => {
pr: '$4'
}}
>
<NextLink legacyBehavior href={gistId ? `/develop/${gistId}` : '/develop'} passHref>
<Link href={gistId ? `/develop/${gistId}` : '/develop'} passHref>
<Box
as="a"
css={{
@@ -89,7 +89,7 @@ const Navigation = () => {
>
<Logo width="32px" height="32px" />
</Box>
</NextLink>
</Link>
<Flex
css={{
ml: '$5',
@@ -101,12 +101,11 @@ const Navigation = () => {
<Spinner />
) : (
<>
<Heading css={{ lineHeight: 1 }}>{snap.gistName || 'XRPL Hooks'}</Heading>
<Heading css={{ lineHeight: 1 }}>{snap.gistName || 'Xahau Hooks'}</Heading>
<Text css={{ fontSize: '$xs', color: '$mauve10', lineHeight: 1 }}>
{snap.files.length > 0 ? 'Gist: ' : 'Builder'}
{snap.files.length > 0 && (
<NextLink
legacyBehavior
<Link
href={`https://gist.github.com/${snap.gistOwner || ''}/${snap.gistId || ''}`}
passHref
>
@@ -118,7 +117,7 @@ const Navigation = () => {
>
{`${snap.gistOwner || '-'}/${truncate(snap.gistId || '')}`}
</Text>
</NextLink>
</Link>
)}
</Text>
</>
@@ -181,7 +180,7 @@ const Navigation = () => {
fontWeight: '$bold'
}}
>
<Logo width="48px" height="48px" /> XRPL Hooks Builder
<Logo width="48px" height="48px" /> Xahau Hooks Builder
</DialogTitle>
<DialogDescription as="div">
<Text
@@ -192,7 +191,7 @@ const Navigation = () => {
mb: '$7'
}}
>
Hooks add smart contract functionality to the XRP Ledger.
Hooks add smart contract functionality to the Xahau Network.
</Text>
<Flex css={{ flexDirection: 'column', gap: '$2', mt: '$2' }}>
<Text
@@ -211,9 +210,9 @@ const Navigation = () => {
as="a"
rel="noreferrer noopener"
target="_blank"
href="https://github.com/XRPL-Labs/xrpld-hooks"
href="https://github.com/Xahau"
>
<ArrowUpRight size="15px" /> Hooks Github
<ArrowUpRight size="15px" /> Xahau Github
</Text>
<Text
@@ -232,7 +231,7 @@ const Navigation = () => {
as="a"
rel="noreferrer noopener"
target="_blank"
href="https://xrpl-hooks.readme.io/v2.0/docs"
href="https://docs.xahau.network/readme-1"
>
<ArrowUpRight size="15px" /> Hooks documentation
</Text>
@@ -337,39 +336,29 @@ const Navigation = () => {
}}
>
<ButtonGroup>
<NextLink
legacyBehavior
href={gistId ? `/develop/${gistId}` : '/develop'}
passHref
shallow
>
<Link href={gistId ? `/develop/${gistId}` : '/develop'} passHref shallow>
<Button as="a" outline={!router.pathname.includes('/develop')} uppercase>
Develop
</Button>
</NextLink>
<NextLink
legacyBehavior
href={gistId ? `/deploy/${gistId}` : '/deploy'}
passHref
shallow
>
</Link>
<Link href={gistId ? `/deploy/${gistId}` : '/deploy'} passHref shallow>
<Button as="a" outline={!router.pathname.includes('/deploy')} uppercase>
Deploy
</Button>
</NextLink>
<NextLink legacyBehavior href={gistId ? `/test/${gistId}` : '/test'} passHref shallow>
</Link>
<Link href={gistId ? `/test/${gistId}` : '/test'} passHref shallow>
<Button as="a" outline={!router.pathname.includes('/test')} uppercase>
Test
</Button>
</NextLink>
</Link>
</ButtonGroup>
<NextLink legacyBehavior href="https://xrpl-hooks.readme.io/v2.0" passHref>
<Link href="https://xrpl-hooks.readme.io/" passHref>
<a target="_blank" rel="noreferrer noopener">
<Button outline>
<BookOpen size="15px" />
</Button>
</a>
</NextLink>
</Link>
</Stack>
</Flex>
</Container>

View File

@@ -129,7 +129,7 @@ export const TxUI: FC<UIProps> = ({
const otherFields = Object.keys(txFields).filter(k => !richFields.includes(k)) as [keyof TxFields]
const amountOptions = [
{ label: 'XRP', value: 'xrp' },
{ label: 'XAH', value: 'xah' },
{ label: 'Token', value: 'token' }
] as const
@@ -296,7 +296,7 @@ export const TxUI: FC<UIProps> = ({
value={isXrpAmount ? amountOptions['0'] : amountOptions['1']}
onChange={(e: any) => {
const opt = e as typeof amountOptions[number]
if (opt.value === 'xrp') {
if (opt.value === 'xah') {
setRawField(field, 'amount.xrp', '0')
} else {
setRawField(field, 'amount.token', defaultTokenAmount)

View File

@@ -1,7 +1,7 @@
{
"uri": "file:///amount-schema.json",
"title": "Amount",
"description": "Specify xrp in drops and tokens as objects.",
"description": "Specify XAH in drops and tokens as objects.",
"schema": {
"anyOf": [
{
@@ -13,7 +13,7 @@
"type": "object",
"properties": {
"currency": {
"description": "Arbitrary currency code for the token. Cannot be XRP."
"description": "Arbitrary currency code for the token. Cannot be XAH."
},
"value": {
"type": ["string", "number"],
@@ -28,7 +28,7 @@
],
"defaultSnippets": [
{
"label": "Xrp",
"label": "XAH",
"body": "1000000"
},
{

View File

@@ -101,63 +101,11 @@
"Fulfillment": "A0028000",
"Fee": "10"
},
{
"TransactionType": "NFTokenMint",
"Account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"Fee": "10",
"NFTokenTaxon": 0,
"URI": "697066733A2F2F516D614374444B5A4656767666756676626479346573745A626851483744586831364354707631686F776D424779"
},
{
"TransactionType": "NFTokenBurn",
"Account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"Fee": "10",
"NFTokenID": "000B013A95F14B0044F78A264E41713C64B5F89242540EE208C3098E00000D65"
},
{
"TransactionType": "NFTokenAcceptOffer",
"Account": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"Fee": "10",
"NFTokenSellOffer": "A2FA1A9911FE2AEF83DAB05F437768E26A301EF899BD31EB85E704B3D528FF18",
"NFTokenBuyOffer": "4AAAEEA76E3C8148473CB3840CE637676E561FB02BD4CA22CA59729EA815B862",
"NFTokenBrokerFee": "10"
},
{
"TransactionType": "NFTokenCancelOffer",
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"Fee": "10",
"NFTokenOffers": {
"$type": "json",
"$value": [
"4AAAEEA76E3C8148473CB3840CE637676E561FB02BD4CA22CA59729EA815B862"
]
}
},
{
"TransactionType": "NFTokenCreateOffer",
"Account": "rs8jBmmfpwgmrSPgwMsh7CvKRmRt1JTVSX",
"NFTokenID": "000100001E962F495F07A990F4ED55ACCFEEF365DBAA76B6A048C0A200000007",
"Amount": {
"$value": "100",
"$type": "amount.xrp"
},
"Flags": "1",
"Destination": {
"$type": "account",
"$value": ""
},
"Owner": {
"$type": "account",
"$value": ""
},
"Fee": "10"
},
{
"TransactionType": "OfferCancel",
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"Fee": "12",
"Flags": "0",
"LastLedgerSequence": 7108629,
"OfferSequence": 6,
"Sequence": 7
},
@@ -166,7 +114,6 @@
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"Fee": "12",
"Flags": "0",
"LastLedgerSequence": 7108682,
"Sequence": 8,
"TakerGets": {
"$type": "amount.xrp",
@@ -175,8 +122,8 @@
"TakerPays": {
"$type": "amount.token",
"$value": {
"currency": "GKO",
"issuer": "ruazs5h1qEsqpke88pcqnaseXdm6od2xc",
"currency": "USD",
"issuer": "rhQEswwTsjMXk75QL9Dd9RWZAokNHTzJpr",
"value": "2"
}
}
@@ -274,12 +221,11 @@
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"Fee": "12",
"Flags": "262144",
"LastLedgerSequence": 8007750,
"LimitAmount": {
"$type": "amount.token",
"$value": {
"currency": "USD",
"issuer": "rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc",
"issuer": "rhQEswwTsjMXk75QL9Dd9RWZAokNHTzJpr",
"value": "100"
}
},
@@ -294,8 +240,47 @@
"Fee": "12"
},
{
"TransactionType": "UriToken",
"Fee": "12",
"URI": "697066733A2F2F516D614374444B5A4656767666756676626479346573745A626851483744586831364354707631686F776D424779"
"TransactionType": "URITokenMint",
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"URI": "697066733A2F2F434944",
"Fee": "10",
"Sequence": 1
},
{
"TransactionType": "URITokenBurn",
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"URITokenID": "B792B56B558C89C4E942E41B5DB66074E005CB198DB70C26C707AAC2FF5F74CB",
"Fee": "10",
"Sequence": 1
},
{
"TransactionType": "URITokenCreateSellOffer",
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"URITokenID": "B792B56B558C89C4E942E41B5DB66074E005CB198DB70C26C707AAC2FF5F74CB",
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Amount": {
"$value": "100",
"$type": "amount.xrp"
},
"Fee": "10",
"Sequence": 1
},
{
"TransactionType": "URITokenCancelSellOffer",
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"URITokenID": "B792B56B558C89C4E942E41B5DB66074E005CB198DB70C26C707AAC2FF5F74CB",
"Fee": "10",
"Sequence": 1
},
{
"TransactionType": "URITokenBuy",
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"URITokenID": "B792B56B558C89C4E942E41B5DB66074E005CB198DB70C26C707AAC2FF5F74CB",
"Amount": {
"$value": "100",
"$type": "amount.xrp"
},
"Fee": "10",
"Sequence": 1
}
]

View File

@@ -8,16 +8,8 @@ module.exports = {
config.resolve.alias['vscode'] = require.resolve(
'@codingame/monaco-languageclient/lib/vscode-compatibility'
)
config.experiments = {
topLevelAwait: true,
layers: true
}
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
module: false
}
config.resolve.fallback.fs = false
}
config.module.rules.push({
test: [/\.md$/, /hook-bundle\.js$/],

View File

@@ -14,7 +14,6 @@
"dependencies": {
"@codingame/monaco-jsonrpc": "^0.3.1",
"@codingame/monaco-languageclient": "^0.17.0",
"@eqlabs/assemblyscript": "^0.0.0-alpha.1680097351",
"@monaco-editor/react": "^4.4.5",
"@octokit/core": "^3.5.1",
"@radix-ui/colors": "^0.1.7",
@@ -38,8 +37,8 @@
"lodash.uniqby": "^4.7.0",
"lodash.xor": "^4.5.0",
"monaco-editor": "^0.33.0",
"next": "^13.1.1",
"next-auth": "^4.10.3",
"next": "^12.0.4",
"next-auth": "^4.24.11",
"next-plausible": "^3.2.0",
"next-themes": "^0.1.1",
"normalize-url": "^7.0.2",
@@ -50,8 +49,8 @@
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.7.1",
"re-resizable": "^6.9.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "^7.28.0",
"react-hot-keys": "^2.7.1",
"react-hot-toast": "^2.1.1",
@@ -66,7 +65,7 @@
"valtio": "^1.2.5",
"vscode-languageserver": "^7.0.0",
"vscode-uri": "^3.0.2",
"wabt": "^1.0.32",
"wabt": "^1.0.30",
"xrpl-accountlib": "^1.6.1",
"xrpl-client": "^2.0.2"
},
@@ -79,11 +78,14 @@
"@types/react": "17.0.31",
"browserify": "^17.0.0",
"eslint": "7.32.0",
"eslint-config-next": "^13.1.1",
"eslint-config-next": "11.1.2",
"raw-loader": "^4.0.2",
"typescript": "4.4.4"
"typescript": "^4.9.5"
},
"resolutions": {
"ripple-binary-codec": "=1.4.2"
"ripple-binary-codec": "=1.6.0"
},
"engines": {
"node": ">=22.0.0"
}
}

View File

@@ -24,7 +24,7 @@ import { ChatCircleText } from 'phosphor-react'
TimeAgo.setDefaultLocale(en.locale)
TimeAgo.addLocale(en)
function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps<{ session?: any }>) {
function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) {
const router = useRouter()
const slug = router.query?.slug
const gistId = (Array.isArray(slug) && slug[0]) ?? null
@@ -58,22 +58,22 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps<{ s
<meta name="format-detection" content="telephone=no" />
<meta property="og:url" content={`${origin}${router.asPath}`} />
<title>XRPL Hooks Builder</title>
<meta property="og:title" content="XRPL Hooks Builder" />
<meta name="twitter:title" content="XRPL Hooks Builder" />
<title>Xahau Hooks Builder</title>
<meta property="og:title" content="Xahau Hooks Builder" />
<meta name="twitter:title" content="Xahau Hooks Builder" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@XRPLF" />
<meta
name="description"
content="Hooks Builder, add smart contract functionality to the XRP Ledger."
content="Hooks Builder, add smart contract functionality to the Xahau Network."
/>
<meta
property="og:description"
content="Hooks Builder, add smart contract functionality to the XRP Ledger."
content="Hooks Builder, add smart contract functionality to the Xahau Network."
/>
<meta
name="twitter:description"
content="Hooks Builder, add smart contract functionality to the XRP Ledger."
content="Hooks Builder, add smart contract functionality to the Xahau Network."
/>
<meta property="og:image" content={`${origin}${shareImg}`} />
<meta property="og:image:width" content="1200" />
@@ -121,7 +121,7 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps<{ s
<Alert />
<Flex
as="a"
href="https://github.com/XRPLF/Hooks/discussions"
href="https://github.com/Xahau/xrpl-hooks-ide/issues"
target="_blank"
rel="noopener noreferrer"
css={{ position: 'fixed', right: '$4', bottom: '$4' }}

View File

@@ -1,7 +1,7 @@
import type { NextRequest } from 'next/server'
import type { NextRequest, NextFetchEvent } from 'next/server'
import { NextResponse as Response } from 'next/server'
export default function middleware(req: NextRequest) {
export default function middleware(req: NextRequest, ev: NextFetchEvent) {
if (req.nextUrl.pathname === '/') {
const url = req.nextUrl.clone()
url.pathname = '/develop'

View File

@@ -1,5 +1,11 @@
import NextAuth from 'next-auth'
declare module "next-auth" {
interface User {
username: string
}
}
export default NextAuth({
// Configure one or more authentication providers
providers: [

View File

@@ -40,7 +40,7 @@ export default async function handler(
}
return res.status(200).json(json)
} catch (err) {
console.error(err)
console.log(err)
return res.status(500).json({ error: 'Server error' })
}
return res.status(500).json({ error: 'Not able to create faucet, try again' })

View File

@@ -150,9 +150,7 @@ const Home: NextPage = () => {
const activeFile = snap.files[snap.active] as IFile | undefined
const activeFileExt = getFileExtention(activeFile?.name)
const canCompile = activeFileExt === 'c' || activeFileExt === 'wat' || activeFileExt === 'ts'
const isCompiling = snap.compiling.includes(snap.active);
const canCompile = activeFileExt === 'c' || activeFileExt === 'wat'
return (
<Split
direction="vertical"
@@ -168,9 +166,7 @@ const Home: NextPage = () => {
{canCompile && (
<Hotkeys
keyName="command+b,ctrl+b"
onKeyDown={() =>
snap.compiling === undefined && snap.files.length && compileCode(snap.active)
}
onKeyDown={() => !snap.compiling && snap.files.length && compileCode(snap.active)}
>
<Flex
css={{
@@ -187,7 +183,7 @@ const Home: NextPage = () => {
variant="primary"
uppercase
disabled={!snap.files.length}
isLoading={isCompiling}
isLoading={snap.compiling}
onClick={() => compileCode(snap.active)}
>
<Play weight="bold" size="16px" />
@@ -204,9 +200,7 @@ const Home: NextPage = () => {
{activeFileExt === 'js' && (
<Hotkeys
keyName="command+b,ctrl+b"
onKeyDown={() =>
!isCompiling && snap.files.length && compileCode(snap.active)
}
onKeyDown={() => !snap.compiling && snap.files.length && compileCode(snap.active)}
>
<Flex
css={{

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,346 @@
diff --git a/node_modules/ripple-binary-codec/dist/enums/definitions.json b/node_modules/ripple-binary-codec/dist/enums/definitions.json
index e623376..7e1e4d5 100644
--- a/node_modules/ripple-binary-codec/dist/enums/definitions.json
+++ b/node_modules/ripple-binary-codec/dist/enums/definitions.json
@@ -44,11 +44,16 @@
"NegativeUNL": 78,
"NFTokenPage": 80,
"NFTokenOffer": 55,
+ "URIToken": 85,
"Any": -3,
"Child": -2,
"Nickname": 110,
"Contract": 99,
- "GeneratorMap": 103
+ "GeneratorMap": 103,
+ "Hook": 72,
+ "HookState": 118,
+ "HookDefinition": 68,
+ "EmittedTxn": 69
},
"FIELDS": [
[
@@ -321,6 +326,16 @@
"type": "UInt16"
}
],
+ [
+ "NetworkID",
+ {
+ "nth": 1,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "UInt32"
+ }
+ ],
[
"Flags",
{
@@ -761,6 +776,36 @@
"type": "UInt32"
}
],
+ [
+ "LockCount",
+ {
+ "nth": 49,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "UInt32"
+ }
+ ],
+ [
+ "FirstNFTokenSequence",
+ {
+ "nth": 50,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "UInt32"
+ }
+ ],
+ [
+ "ImportSequence",
+ {
+ "nth": 97,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "UInt32"
+ }
+ ],
[
"IndexNext",
{
@@ -891,16 +936,6 @@
"type": "UInt64"
}
],
- [
- "HookOn",
- {
- "nth": 16,
- "isVLEncoded": false,
- "isSerialized": true,
- "isSigningField": true,
- "type": "UInt64"
- }
- ],
[
"HookInstructionCount",
{
@@ -1151,6 +1186,16 @@
"type": "Hash256"
}
],
+ [
+ "HookOn",
+ {
+ "nth": 20,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Hash256"
+ }
+ ],
[
"Digest",
{
@@ -1281,6 +1326,36 @@
"type": "Hash256"
}
],
+ [
+ "OfferID",
+ {
+ "nth": 34,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Hash256"
+ }
+ ],
+ [
+ "EscrowID",
+ {
+ "nth": 35,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Hash256"
+ }
+ ],
+ [
+ "URITokenID",
+ {
+ "nth": 36,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Hash256"
+ }
+ ],
[
"Amount",
{
@@ -1421,6 +1496,56 @@
"type": "Amount"
}
],
+ [
+ "HookCallbackFee",
+ {
+ "nth": 20,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Amount"
+ }
+ ],
+ [
+ "LockedBalance",
+ {
+ "nth": 21,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Amount"
+ }
+ ],
+ [
+ "BaseFeeDrops",
+ {
+ "nth": 22,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Amount"
+ }
+ ],
+ [
+ "ReserveBaseDrops",
+ {
+ "nth": 23,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Amount"
+ }
+ ],
+ [
+ "ReserveIncrementDrops",
+ {
+ "nth": 24,
+ "isVLEncoded": false,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Amount"
+ }
+ ],
[
"PublicKey",
{
@@ -1661,6 +1786,16 @@
"type": "Blob"
}
],
+ [
+ "Blob",
+ {
+ "nth": 26,
+ "isVLEncoded": true,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Blob"
+ }
+ ],
[
"Account",
{
@@ -1801,6 +1936,16 @@
"type": "Vector256"
}
],
+ [
+ "HookNamespaces",
+ {
+ "nth": 5,
+ "isVLEncoded": true,
+ "isSerialized": true,
+ "isSigningField": true,
+ "type": "Vector256"
+ }
+ ],
[
"Paths",
{
@@ -2176,6 +2321,12 @@
"telCAN_NOT_QUEUE_BLOCKED": -389,
"telCAN_NOT_QUEUE_FEE": -388,
"telCAN_NOT_QUEUE_FULL": -387,
+ "telWRONG_NETWORK": -386,
+ "telREQUIRES_NETWORK_ID": -385,
+ "telNETWORK_ID_MAKES_TX_NON_CANONICAL": -384,
+ "telNON_LOCAL_EMITTED_TXN": -383,
+ "telIMPORT_VL_KEY_NOT_RECOGNISED": -382,
+ "telCAN_NOT_QUEUE_IMPORT": -381,
"temMALFORMED": -299,
"temBAD_AMOUNT": -298,
"temBAD_CURRENCY": -297,
@@ -2214,6 +2365,16 @@
"temUNKNOWN": -264,
"temSEQ_AND_TICKET": -263,
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
+ "temAMM_BAD_TOKENS": -261,
+ "temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
+ "temXCHAIN_BAD_PROOF": -259,
+ "temXCHAIN_BRIDGE_BAD_ISSUES": -258,
+ "temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
+ "temXCHAIN_BRIDGE_BAD_MIN_ACCOUNT_CREATE_AMOUNT": -256,
+ "temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
+ "temXCHAIN_TOO_MANY_ATTESTATIONS": -254,
+ "temHOOK_DATA_TOO_LARGE": -253,
+ "temHOOK_REJECTED": -252,
"tefFAILURE": -199,
"tefALREADY": -198,
"tefBAD_ADD_AUTH": -197,
@@ -2235,6 +2396,7 @@
"tefTOO_BIG": -181,
"tefNO_TICKET": -180,
"tefNFTOKEN_IS_NOT_TRANSFERABLE": -179,
+ "tefPAST_IMPORT_SEQ": -178,
"terRETRY": -99,
"terFUNDS_SPENT": -98,
"terINSUF_FEE_B": -97,
@@ -2247,6 +2409,8 @@
"terNO_RIPPLE": -90,
"terQUEUED": -89,
"terPRE_TICKET": -88,
+ "terNO_AMM": -87,
+ "terNO_HOOK": -86,
"tesSUCCESS": 0,
"tecCLAIM": 100,
"tecPATH_PARTIAL": 101,
@@ -2286,6 +2450,7 @@
"tecKILLED": 150,
"tecHAS_OBLIGATIONS": 151,
"tecTOO_SOON": 152,
+ "tecHOOK_REJECTED": 153,
"tecMAX_SEQUENCE_REACHED": 154,
"tecNO_SUITABLE_NFTOKEN_PAGE": 155,
"tecNFTOKEN_BUY_SELL_MISMATCH": 156,
@@ -2293,7 +2458,33 @@
"tecCANT_ACCEPT_OWN_NFTOKEN_OFFER": 158,
"tecINSUFFICIENT_FUNDS": 159,
"tecOBJECT_NOT_FOUND": 160,
- "tecINSUFFICIENT_PAYMENT": 161
+ "tecINSUFFICIENT_PAYMENT": 161,
+ "tecAMM_UNFUNDED": 162,
+ "tecAMM_BALANCE": 163,
+ "tecAMM_FAILED_DEPOSIT": 164,
+ "tecAMM_FAILED_WITHDRAW": 165,
+ "tecAMM_INVALID_TOKENS": 166,
+ "tecAMM_FAILED_BID": 167,
+ "tecAMM_FAILED_VOTE": 168,
+ "tecREQUIRES_FLAG": 169,
+ "tecPRECISION_LOSS": 170,
+ "tecBAD_XCHAIN_TRANSFER_ISSUE": 171,
+ "tecXCHAIN_NO_CLAIM_ID": 172,
+ "tecXCHAIN_BAD_CLAIM_ID": 173,
+ "tecXCHAIN_CLAIM_NO_QUORUM": 174,
+ "tecXCHAIN_PROOF_UNKNOWN_KEY": 175,
+ "tecXCHAIN_CREATE_ACCOUNT_NONXRP_ISSUE": 176,
+ "tecXCHAIN_WRONG_CHAIN": 177,
+ "tecXCHAIN_REWARD_MISMATCH": 178,
+ "tecXCHAIN_NO_SIGNERS_LIST": 179,
+ "tecXCHAIN_SENDING_ACCOUNT_MISMATCH": 180,
+ "tecXCHAIN_INSUFF_CREATE_AMOUNT": 181,
+ "tecXCHAIN_ACCOUNT_CREATE_PAST": 182,
+ "tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 183,
+ "tecXCHAIN_PAYMENT_FAILED": 184,
+ "tecXCHAIN_SELF_COMMIT": 185,
+ "tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR": 186,
+ "tecLAST_POSSIBLE_ENTRY": 255
},
"TRANSACTION_TYPES": {
"Invalid": -1,
@@ -2325,8 +2516,16 @@
"NFTokenCreateOffer": 27,
"NFTokenCancelOffer": 28,
"NFTokenAcceptOffer": 29,
+ "URITokenMint": 45,
+ "URITokenBurn": 46,
+ "URITokenBuy": 47,
+ "URITokenCreateSellOffer": 48,
+ "URITokenCancelSellOffer": 49,
+ "Import": 97,
+ "Invoke": 99,
"EnableAmendment": 100,
"SetFee": 101,
- "UNLModify": 102
+ "UNLModify": 102,
+ "EmitFailure": 103
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 KiB

After

Width:  |  Height:  |  Size: 352 KiB

View File

@@ -77,7 +77,7 @@ export const addFunds = async (address: string) => {
if ('error' in json) {
return toast.error(json.error, { id: toastId })
} else {
toast.success(`Funds added (${json.xrp} XRP)`, { id: toastId })
toast.success(`Funds added (${json.xrp} XAH)`, { id: toastId })
const currAccount = state.accounts.find(acc => acc.address === address)
if (currAccount) {
currAccount.xrp = (Number(currAccount.xrp) + json.xrp * 1000000).toString()

View File

@@ -1,49 +1,97 @@
import toast from 'react-hot-toast'
import Router from 'next/router'
import state, { IFile } from '../index'
import state from '../index'
import { saveFile } from './saveFile'
import { decodeBinary } from '../../utils/decodeBinary'
import { ref } from 'valtio'
import asc from "@eqlabs/assemblyscript/dist/asc"
import { getFileExtention } from '../../utils/helpers'
type CompilationResult = Pick<IFile, "compiledContent" | "compiledWatContent">
/* compileCode sends the code of the active file to compile endpoint
* If all goes well you will get base64 encoded wasm file back with
* some extra logging information if we can provide it. This function
* also decodes the returned wasm and creates human readable WAT file
* out of it and store both in global state.
*/
export const compileCode = async (activeId: number) => {
// Save the file to global state
saveFile(false, activeId)
const file = state.files[activeId]
// Bail out if we're already compiling the file.
if (!file || state.compiling.includes(activeId)) {
return
if (file.name.endsWith('.wat')) {
return compileWat(activeId)
}
if (!process.env.NEXT_PUBLIC_COMPILE_API_ENDPOINT) {
throw Error('Missing env!')
}
// Bail out if we're already compiling
if (state.compiling) {
// if compiling is ongoing return // TODO Inform user about it.
return
}
// Set loading state to true
state.compiling = true
state.logs = []
try {
state.compiling.push(activeId)
state.logs = []
file.containsErrors = false
let res: Response
try {
res = await fetch(process.env.NEXT_PUBLIC_COMPILE_API_ENDPOINT, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
output: 'wasm',
compress: true,
strip: state.compileOptions.strip,
files: [
{
type: 'c',
options: state.compileOptions.optimizationLevel || '-O2',
name: file.name,
src: file.content
}
]
})
})
} catch (error) {
throw Error('Something went wrong, check your network connection and try again!')
}
const json = await res.json()
state.compiling = false
if (!json.success) {
const errors = [json.message]
if (json.tasks && json.tasks.length > 0) {
json.tasks.forEach((task: any) => {
if (!task.success) {
errors.push(task?.console)
}
})
}
throw errors
}
try {
// Decode base64 encoded wasm that is coming back from the endpoint
const bufferData = await decodeBinary(json.output)
let result: CompilationResult;
if (file.name.endsWith('.wat')) {
result = await compileWat(file);
}
else if (file.language === "ts") {
result = await compileTs(file);
}
else if (navigator?.onLine === false) {
throw Error('You seem offline, check you internet connection and try again!')
}
else if (file.language === 'c') {
result = await compileC(file)
}
else throw Error("Unknown file type.")
// Import wabt from and create human readable version of wasm file and
// put it into state
const ww = await (await import('wabt')).default()
const myModule = ww.readWasm(new Uint8Array(bufferData), {
readDebugNames: true
})
myModule.applyNames()
const wast = myModule.toText({ foldExprs: false, inlineExport: false })
file.compiledContent = ref(bufferData)
file.lastCompiled = new Date()
file.compiledValueSnapshot = file.content
file.compiledWatContent = wast
} catch (error) {
throw Error('Invalid compilation result produced, check your code for errors and try again!')
}
file.lastCompiled = new Date();
file.compiledValueSnapshot = file.content;
file.compiledContent = result.compiledContent;
file.compiledWatContent = result.compiledWatContent;
toast.success('Compiled successfully!', { position: 'bottom-center' })
state.logs.push({
type: 'success',
@@ -52,8 +100,7 @@ export const compileCode = async (activeId: number) => {
linkText: 'Go to deploy'
})
} catch (err) {
console.error(err)
let message: string;
console.log(err)
if (err instanceof Array && typeof err[0] === 'string') {
err.forEach(message => {
@@ -62,157 +109,63 @@ export const compileCode = async (activeId: number) => {
message
})
})
message = "Compilation errors occurred, see logs for more info."
} else if (err instanceof Error) {
message = err.message
state.logs.push({
type: 'error',
message: err.message
})
} else {
message = 'Something went wrong, try again later!'
state.logs.push({
type: 'error',
message: 'Something went wrong, come back later!'
})
}
toast.error(message, { position: 'bottom-center' })
state.compiling = false
toast.error(`Error occurred while compiling!`, { position: 'bottom-center' })
file.containsErrors = true
}
state.compiling = state.compiling.filter(id => id !== activeId);
}
/* compileC sends the code of the active file to compile endpoint
* If all goes well you will get base64 encoded wasm file back with
* some extra logging information if we can provide it. This function
* also decodes the returned wasm and creates human readable WAT file
* out of it and store both in global state.
*/
export const compileC = async (file: IFile): Promise<CompilationResult> => {
if (!process.env.NEXT_PUBLIC_COMPILE_API_ENDPOINT) {
throw Error('Missing C compile endpoint!')
}
let res: Response
res = await fetch(process.env.NEXT_PUBLIC_COMPILE_API_ENDPOINT, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
output: 'wasm',
compress: true,
strip: state.compileOptions.strip,
files: [
{
type: 'c',
options: state.compileOptions.optimizationLevel || '-O2',
name: file.name,
src: file.content
}
]
})
})
const json = await res.json()
if (!json.success) {
const errors = [json.message]
if (json.tasks && json.tasks.length > 0) {
json.tasks.forEach((task: any) => {
if (!task.success) {
errors.push(task?.console)
}
})
}
throw errors
}
export const compileWat = async (activeId: number) => {
if (state.compiling) return;
const file = state.files[activeId]
state.compiling = true
state.logs = []
try {
// Decode base64 encoded wasm that is coming back from the endpoint
const bufferData = await decodeBinary(json.output)
// Import wabt from and create human readable version of wasm file and
// put it into state
const ww = await (await import('wabt')).default()
const myModule = ww.readWasm(new Uint8Array(bufferData), {
readDebugNames: true
})
myModule.applyNames()
const wast = myModule.toText({ foldExprs: false, inlineExport: false })
return {
compiledContent: ref(bufferData),
compiledWatContent: wast
}
} catch (error) {
throw Error('Invalid compilation result produced, check your code for errors and try again!')
}
}
export const compileWat = async (file: IFile): Promise<CompilationResult> => {
const wabt = await (await import('wabt')).default()
const mod = wabt.parseWat(file.name, file.content);
mod.resolveNames();
mod.validate();
const { buffer } = mod.toBinary({
log: false,
write_debug_names: true,
});
return {
compiledContent: ref(buffer),
compiledWatContent: file.content,
}
}
export const compileTs = async (file: IFile): Promise<CompilationResult> => {
return new Promise(async (resolve, reject) => {
let result: Partial<CompilationResult> = {}
const { error, stdout, stderr } = await asc.main([
// Command line options
file.name,
"--outFile", `${file.name}.wasm`,
"--textFile", `${file.name}.wat`,
"--runtime", "stub",
"--initialMemory", "1",
"--maximumMemory", "1",
"--noExportMemory",
"--optimize",
"--topLevelToHook"
], {
readFile: (name, baseDir) => {
const file = state.files.find(file => file.name === name)
if (file) {
return file.content
}
return null
},
writeFile: async (name, data: ArrayBuffer | string, baseDir) => {
const ext = getFileExtention(name);
if (ext === 'wasm') {
result.compiledContent = data as ArrayBuffer;
}
else if (ext === 'wat') {
result.compiledWatContent = data as string;
}
if (result.compiledContent && result.compiledWatContent) {
resolve({ ...result });
}
},
listFiles: (dirname, baseDir) => {
return state.files.map(file => file.name)
},
// reportDiagnostic?: ...,
const wabt = await (await import('wabt')).default()
const module = wabt.parseWat(file.name, file.content);
module.resolveNames();
module.validate();
const { buffer } = module.toBinary({
log: false,
write_debug_names: true,
});
let logMsg = stdout.toString()
let errMsg = stderr.toString()
if (logMsg) {
state.logs.push({
type: "log",
message: logMsg
})
}
if (errMsg) {
state.logs.push({
type: "error",
message: errMsg
})
}
file.compiledContent = ref(buffer)
file.lastCompiled = new Date()
file.compiledValueSnapshot = file.content
file.compiledWatContent = file.content
if (error) return reject(error)
})
toast.success('Compiled successfully!', { position: 'bottom-center' })
state.logs.push({
type: 'success',
message: `File ${state.files?.[activeId]?.name} compiled successfully. Ready to deploy.`,
link: Router.asPath.replace('develop', 'deploy'),
linkText: 'Go to deploy'
})
} catch (err) {
console.log(err)
let message = "Error compiling WAT file!"
if (err instanceof Error) {
message = err.message
}
state.logs.push({
type: 'error',
message
})
toast.error(`Error occurred while compiling!`, { position: 'bottom-center' })
file.containsErrors = true
}
state.compiling = false
}

View File

@@ -1,8 +1,8 @@
import { getFileExtention } from '../../utils/helpers'
import state, { IFile, ILang } from '../index'
import state, { IFile } from '../index'
const languageMapping: Record<string, ILang | undefined> = {
ts: 'ts',
const languageMapping: Record<string, string | undefined> = {
ts: 'typescript',
js: 'javascript',
md: 'markdown',
c: 'c',

View File

@@ -247,7 +247,7 @@ export const deleteHook = async (account: IAccount & { name?: string }) => {
})
}
} catch (err) {
console.error(err)
console.log(err)
toast.error('Error occurred while deleting hook', { id: toastId })
state.deployLogs.push({
type: 'error',

View File

@@ -1,5 +1,5 @@
import { Octokit } from '@octokit/core'
import state, { IFile, ILang } from '../index'
import state, { IFile } from '../index'
import { templateFileIds } from '../constants'
const octokit = new Octokit()
@@ -24,19 +24,28 @@ export const fetchFiles = async (gistId: string) => {
.includes(id)
if (isTemplate(gistId)) {
// fetch headers
const headerRes = await fetch(
`${process.env.NEXT_PUBLIC_COMPILE_API_BASE_URL}/api/header-files`
)
if (!headerRes.ok) throw Error('Failed to fetch headers')
const headerJson = await headerRes.json()
const headerFiles: Record<string, { filename: string; content: string; language: string }> =
const template = Object.values(templateFileIds).find(tmp => tmp.id === gistId)
let headerFiles: Record<string, { filename: string; content: string; language: string }> =
{}
Object.entries(headerJson).forEach(([key, value]) => {
const fname = `${key}.h`
headerFiles[fname] = { filename: fname, content: value as string, language: 'C' }
})
if (template?.headerId) {
const resHeader = await octokit.request('GET /gists/{gist_id}', { gist_id: template.headerId })
if (!resHeader.data.files) throw new Error('No header files could be fetched from given gist id!')
headerFiles = resHeader.data.files as any
} else {
// fetch headers
const headerRes = await fetch(
`${process.env.NEXT_PUBLIC_COMPILE_API_BASE_URL}/api/header-files`
)
if (!headerRes.ok) throw Error('Failed to fetch headers')
const headerJson = await headerRes.json()
const headerFiles: Record<string, { filename: string; content: string; language: string }> =
{}
Object.entries(headerJson).forEach(([key, value]) => {
const fname = `${key}.h`
headerFiles[fname] = { filename: fname, content: value as string, language: 'C' }
})
}
const files = {
...res.data.files,
...headerFiles
@@ -48,7 +57,7 @@ export const fetchFiles = async (gistId: string) => {
const files: IFile[] = Object.keys(res.data.files).map(filename => ({
name: res.data.files?.[filename]?.filename || 'untitled.c',
language: res.data.files?.[filename]?.language?.toLowerCase() as ILang | undefined,
language: res.data.files?.[filename]?.language?.toLowerCase() || '',
content: res.data.files?.[filename]?.content || ''
}))

View File

@@ -55,7 +55,7 @@ export const syncToGist = async (session?: Session | null, createNewGist?: boole
return toast.success('Updated to gist successfully!', { id: toastId })
})
.catch(err => {
console.error(err)
console.log(err)
state.gistLoading = false
return toast.error(`Could not update Gist, try again later!`, {
id: toastId
@@ -85,7 +85,7 @@ export const syncToGist = async (session?: Session | null, createNewGist?: boole
return toast.success('Created new gist successfully!', { id: toastId })
})
.catch(err => {
console.error(err)
console.log(err)
state.gistLoading = false
return toast.error(`Could not create Gist, try again later!`, {
id: toastId

View File

@@ -47,6 +47,9 @@ export const transactionFlags: { [key: /* TransactionType */ string]: Flags } =
tfSetFreeze: '0x00100000',
tfClearFreeze: '0x00200000',
},
URITokenMint: {
tfBurnable: '0x00000001',
},
}
export const getFlags = (tt?: string) => {

View File

@@ -4,36 +4,49 @@ import Notary from '../../components/icons/Notary'
import Peggy from '../../components/icons/Peggy'
import Starter from '../../components/icons/Starter'
export const templateFileIds = {
type Template = {
id: string
name: string
description: string
headerId?: string
icon: () => JSX.Element
}
export const templateFileIds: Record<string, Template> = {
starter: {
id: '1f8109c80f504e6326db2735df2f0ad6', // Forked
name: 'Starter',
description:
'Just a basic starter with essential imports, just accepts any transaction coming through',
headerId: '028e8ce6d6d674776970caf8acc77ecc',
icon: Starter
},
firewall: {
id: '1cc30f39c8a0b9c55b88c312669ca45e', // Forked
name: 'Firewall',
description: 'This Hook essentially checks a blacklist of accounts',
headerId: '028e8ce6d6d674776970caf8acc77ecc',
icon: Firewall
},
notary: {
id: '87b6f5a8c2f5038fb0f20b8b510efa10', // Forked
name: 'Notary',
description: 'Collecting signatures for multi-sign transactions',
headerId: '028e8ce6d6d674776970caf8acc77ecc',
icon: Notary
},
carbon: {
id: '953662b22d065449f8ab6f69bc2afe41', // Forked
name: 'Carbon',
description: 'Send a percentage of sum to an address',
headerId: '028e8ce6d6d674776970caf8acc77ecc',
icon: Carbon
},
peggy: {
id: '049784a83fa068faf7912f663f7b6471', // Forked
name: 'Peggy',
description: 'An oracle based stable coin hook',
headerId: '028e8ce6d6d674776970caf8acc77ecc',
icon: Peggy
}
}

View File

@@ -9,10 +9,9 @@ declare module 'valtio' {
function snapshot<T extends object>(p: T): T
}
export type ILang = "ts" | "javascript" | "markdown" | "c" | "text"
export interface IFile {
name: string
language: ILang | undefined
language: string
content: string
compiledValueSnapshot?: string
compiledContent?: ArrayBuffer | null
@@ -67,7 +66,7 @@ export interface IState {
loading: boolean
gistLoading: boolean
zipLoading: boolean
compiling: /* file id */ number[]
compiling: boolean
logs: ILog[]
deployLogs: ILog[]
transactionLogs: ILog[]
@@ -99,7 +98,7 @@ let initialState: IState = {
// Active file index on the Deploy page editor
activeWat: 0,
loading: false,
compiling: [],
compiling: false,
logs: [],
deployLogs: [],
transactionLogs: [],
@@ -136,7 +135,7 @@ if (typeof window !== 'undefined') {
try {
localStorageAccounts = localStorage.getItem('hooksIdeAccounts')
} catch (err) {
console.error(`localStorage state broken`)
console.log(`localStorage state broken`)
localStorage.removeItem('hooksIdeAccounts')
}
if (localStorageAccounts) {

View File

@@ -20,12 +20,6 @@ export const getFileExtention = (filename?: string): string | undefined => {
return ext
}
export const getFileNamePart = (filename?: string): string | undefined => {
if (!filename) return
const name = (filename.includes('.') && filename.split('.').slice(0, -1).join(".")) || filename
return name
}
type Type = "array" | "undefined" | "object" | "string" | "number" | "bigint" | "boolean" | "symbol" | "function"
type obj = Record<string | number | symbol, unknown>
type arr = unknown[]
@@ -38,4 +32,4 @@ export const typeIs = <T extends Type>(arg: any, t: T | T[]): arg is unknown & (
export const typeOf = (arg: any): Type => {
const type = arg instanceof Array ? 'array' : arg === null ? 'undefined' : typeof arg
return type;
}
}

View File

@@ -8,6 +8,7 @@ export const tts = {
ttOFFER_CREATE: 7,
ttOFFER_CANCEL: 8,
ttTICKET_CREATE: 10,
ttTICKET_CANCEL: 11,
ttSIGNER_LIST_SET: 12,
ttPAYCHAN_CREATE: 13,
ttPAYCHAN_FUND: 14,
@@ -18,13 +19,14 @@ export const tts = {
ttDEPOSIT_PREAUTH: 19,
ttTRUST_SET: 20,
ttACCOUNT_DELETE: 21,
ttHOOK_SET: 22,
ttNFTOKEN_MINT: 25,
ttNFTOKEN_BURN: 26,
ttNFTOKEN_CREATE_OFFER: 27,
ttNFTOKEN_CANCEL_OFFER: 28,
ttNFTOKEN_ACCEPT_OFFER: 29,
ttINVOKE: 99,
ttSET_HOOK: 22,
ttURI_TOKEN_MINT: 45,
ttURI_TOKEN_BURN: 46,
ttURI_TOKEN_BUY: 47,
ttURI_TOKEN_CREATE_SELL_OFFER: 48,
ttURI_TOKEN_CANCEL_SELL_OFFER: 49,
ttIMPORT: 97,
ttINVOKE: 99
}
export type TTS = typeof tts

View File

@@ -72,13 +72,6 @@ export const getInvokeOptions = (content?: string) => {
label: opt,
value: opt
}))
// default
if (!invokeOptions.length) {
const payment = transactionOptions.find(tx => tx.value === 'ttPAYMENT')
if (payment) return [payment]
}
return invokeOptions
}

View File

@@ -1,5 +1,5 @@
# hooks-account-buf-len
Function [hook_account](https://xrpl-hooks.readme.io/v2.0/reference/hook_account) has fixed-size account ID output.
Function [hook_account](https://xrpl-hooks.readme.io/reference/hook_account) has fixed-size account ID output.
This check warns about too-small size of its output buffer (if it's specified by a constant - variable parameter is ignored).

View File

@@ -1,5 +1,5 @@
# hooks-account-conv-buf-len
Function [util_raddr](https://xrpl-hooks.readme.io/v2.0/reference/util_raddr) has fixed-size account ID input.
Function [util_raddr](https://xrpl-hooks.readme.io/reference/util_raddr) has fixed-size account ID input.
This check warns unless the correct size is passed in the input size parameter (if it's specified by a constant - variable parameter is ignored).

View File

@@ -1,5 +1,5 @@
# hooks-account-conv-pure
Hooks identify accounts by the 20 byte account ID, which can be converted to an raddr using the [util_raddr](https://xrpl-hooks.readme.io/v2.0/reference/util_raddr) function. If the account ID never changes, a more efficient way to do this is precompute the raddr from the account ID.
Hooks identify accounts by the 20 byte account ID, which can be converted to an raddr using the [util_raddr](https://xrpl-hooks.readme.io/reference/util_raddr) function. If the account ID never changes, a more efficient way to do this is precompute the raddr from the account ID.
This check warns about calls of `util_raddr` with constant input and proposes to add a tracing statement showing the computed value (so that the user can use it to replace the call).

View File

@@ -1,7 +1,7 @@
# hooks-array-buf-len
Hook API [sto_subarray](https://xrpl-hooks.readme.io/v2.0/reference/sto_subarray) requires non-empty input buffer and takes a parameter specifying the array index, whose value is limited - the sought object cannot be found if the limit is exceeded.
Hook API [sto_subarray](https://xrpl-hooks.readme.io/reference/sto_subarray) requires non-empty input buffer and takes a parameter specifying the array index, whose value is limited - the sought object cannot be found if the limit is exceeded.
This check warns about empty input as well as too-large values of the index specified in calls to `sto_subarray` (if they're specified by constants - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/serialized-objects)
[Read more](https://xrpl-hooks.readme.io/docs/serialized-objects)

View File

@@ -1,3 +1,3 @@
# hooks-burden-prereq
Hook API [etxn_burden](https://xrpl-hooks.readme.io/v2.0/reference/etxn_burden) computes transaction burden, based on (i.a.) the number of reserved transactions, so a call to it must be preceded by a call to [etxn_reserve](https://xrpl-hooks.readme.io/v2.0/reference/etxn_reserve).
Hook API [etxn_burden](https://xrpl-hooks.readme.io/reference/etxn_burden) computes transaction burden, based on (i.a.) the number of reserved transactions, so a call to it must be preceded by a call to [etxn_reserve](https://xrpl-hooks.readme.io/reference/etxn_reserve).

View File

@@ -1,5 +1,5 @@
# hooks-control-string-arg
Functions [accept](https://xrpl-hooks.readme.io/v2.0/reference/accept) and [rollback](https://xrpl-hooks.readme.io/v2.0/reference/rollback) take an optional string buffer stored outside the hook as its result message. This is useful for debugging but takes up space.
Functions [accept](https://xrpl-hooks.readme.io/reference/accept) and [rollback](https://xrpl-hooks.readme.io/reference/rollback) take an optional string buffer stored outside the hook as its result message. This is useful for debugging but takes up space.
For a release version, this check warns about constant strings passed to `accept` and `rollback`.

View File

@@ -1,7 +1,7 @@
# hooks-detail-buf-len
Function [etxn_details](https://xrpl-hooks.readme.io/v2.0/reference/etxn_details) has fixed-size sfEmitDetails output.
Function [etxn_details](https://xrpl-hooks.readme.io/reference/etxn_details) has fixed-size sfEmitDetails output.
This check warns about too-small size of its output buffer (if it's specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/emitted-transactions)
[Read more](https://xrpl-hooks.readme.io/docs/emitted-transactions)

View File

@@ -1,5 +1,5 @@
# hooks-detail-prereq
Hook API [etxn_details](https://xrpl-hooks.readme.io/v2.0/reference/etxn_details) serializes emit details, based on (i.a.) the number of reserved transactions, so a call to it must be preceded by a call to [etxn_reserve](https://xrpl-hooks.readme.io/v2.0/reference/etxn_reserve).
Hook API [etxn_details](https://xrpl-hooks.readme.io/reference/etxn_details) serializes emit details, based on (i.a.) the number of reserved transactions, so a call to it must be preceded by a call to [etxn_reserve](https://xrpl-hooks.readme.io/reference/etxn_reserve).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/emitted-transactions)
[Read more](https://xrpl-hooks.readme.io/docs/emitted-transactions)

View File

@@ -1,7 +1,7 @@
# hooks-emit-buf-len
Function [emit](https://xrpl-hooks.readme.io/v2.0/reference/emit) has fixed-size transaction hash output.
Function [emit](https://xrpl-hooks.readme.io/reference/emit) has fixed-size transaction hash output.
This check warns about too-small size of its output buffer (if it's specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/emitted-transactions)
[Read more](https://xrpl-hooks.readme.io/docs/emitted-transactions)

View File

@@ -1,5 +1,5 @@
# hooks-emit-prereq
Before emitting a transaction using [emit](https://xrpl-hooks.readme.io/v2.0/reference/emit) Hook API, a hook must set a maximal count of transactions it plans to emit, by calling [etxn_reserve](https://xrpl-hooks.readme.io/v2.0/reference/etxn_reserve).
Before emitting a transaction using [emit](https://xrpl-hooks.readme.io/reference/emit) Hook API, a hook must set a maximal count of transactions it plans to emit, by calling [etxn_reserve](https://xrpl-hooks.readme.io/reference/etxn_reserve).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/emitted-transactions)
[Read more](https://xrpl-hooks.readme.io/docs/emitted-transactions)

View File

@@ -2,4 +2,4 @@
Recursive calls are disallowed in the implementation of hook entry points.
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/loops-and-guarding#no-recursion)
[Read more](https://xrpl-hooks.readme.io/docs/loops-and-guarding#no-recursion)

View File

@@ -2,4 +2,4 @@
Shows error on function definitions with unexpected (that is, neither `hook` nor `cbak`) names.
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/compiling-hooks#constraints)
[Read more](https://xrpl-hooks.readme.io/docs/compiling-hooks#constraints)

View File

@@ -1,7 +1,7 @@
# hooks-entry-points
A Hook always implements and exports a [hook](https://xrpl-hooks.readme.io/v2.0/reference/hook) function.
A Hook always implements and exports a [hook](https://xrpl-hooks.readme.io/reference/hook) function.
This check shows error on translation units that do not have it.
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/compiling-hooks)
[Read more](https://xrpl-hooks.readme.io/docs/compiling-hooks)

View File

@@ -1,5 +1,5 @@
# hooks-fee-prereq
Hook API [etxn_fee_base](https://xrpl-hooks.readme.io/v2.0/reference/etxn_fee_base) estimates a transaction fee, based on (i.a.) the number of reserved transactions, so a call to it must be preceded by a call to [etxn_reserve](https://xrpl-hooks.readme.io/v2.0/reference/etxn_reserve).
Hook API [etxn_fee_base](https://xrpl-hooks.readme.io/reference/etxn_fee_base) estimates a transaction fee, based on (i.a.) the number of reserved transactions, so a call to it must be preceded by a call to [etxn_reserve](https://xrpl-hooks.readme.io/reference/etxn_reserve).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/hook-fees)
[Read more](https://xrpl-hooks.readme.io/docs/hook-fees)

View File

@@ -1,7 +1,7 @@
# hooks-field-add-buf-len
Emplacing a new field into STObject by calling [sto_emplace](https://xrpl-hooks.readme.io/v2.0/reference/sto_emplace) requires enough space to serialize the new STObject into; the API also limits sizes of the old object and field.
Emplacing a new field into STObject by calling [sto_emplace](https://xrpl-hooks.readme.io/reference/sto_emplace) requires enough space to serialize the new STObject into; the API also limits sizes of the old object and field.
This check warns about insufficient output buffer space as well as too-large values of the inputs in calls to `sto_emplace` (if they're specified by constants - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/serialized-objects)
[Read more](https://xrpl-hooks.readme.io/docs/serialized-objects)

View File

@@ -1,7 +1,7 @@
# hooks-field-buf-len
Hook API [sto_subfield](https://xrpl-hooks.readme.io/v2.0/reference/sto_subfield) requires non-empty input buffer.
Hook API [sto_subfield](https://xrpl-hooks.readme.io/reference/sto_subfield) requires non-empty input buffer.
This check warns about empty input in calls to `sto_subfield` (if it's specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/serialized-objects)
[Read more](https://xrpl-hooks.readme.io/docs/serialized-objects)

View File

@@ -1,7 +1,7 @@
# hooks-field-del-buf-len
Erasing a field from STObject by calling [sto_erase](https://xrpl-hooks.readme.io/v2.0/reference/sto_erase) requires enough space to serialize the new STObject into; the API also limits size of the old object.
Erasing a field from STObject by calling [sto_erase](https://xrpl-hooks.readme.io/reference/sto_erase) requires enough space to serialize the new STObject into; the API also limits size of the old object.
This check warns about insufficient output buffer space as well as too-large value of the input STObject in calls to `sto_erase` (if they're specified by constants - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/serialized-objects)
[Read more](https://xrpl-hooks.readme.io/docs/serialized-objects)

View File

@@ -1,8 +1,8 @@
# hooks-float-arith-pure
Hooks can compute floating-point values in XFL format by calling functions [float_multiply](https://xrpl-hooks.readme.io/v2.0/reference/float_multiply), [float_mulratio](https://xrpl-hooks.readme.io/v2.0/reference/float_mulratio), [float_negate](https://xrpl-hooks.readme.io/v2.0/reference/float_negate), [float_sum](https://xrpl-hooks.readme.io/v2.0/reference/float_sum), [float_invert](https://xrpl-hooks.readme.io/v2.0/reference/float_invert) and [float_divide](https://xrpl-hooks.readme.io/v2.0/reference/float_divide) and access their constituent parts by calling [float_exponent](https://xrpl-hooks.readme.io/v2.0/reference/float_exponent), [float_mantissa](https://xrpl-hooks.readme.io/v2.0/reference/float_mantissa) and [float_sign](https://xrpl-hooks.readme.io/v2.0/reference/float_sign). If the inputs of the computation never change, a more efficient way to do this is to precompute it.
Hooks can compute floating-point values in XFL format by calling functions [float_multiply](https://xrpl-hooks.readme.io/reference/float_multiply), [float_mulratio](https://xrpl-hooks.readme.io/reference/float_mulratio), [float_negate](https://xrpl-hooks.readme.io/reference/float_negate), [float_sum](https://xrpl-hooks.readme.io/reference/float_sum), [float_invert](https://xrpl-hooks.readme.io/reference/float_invert) and [float_divide](https://xrpl-hooks.readme.io/reference/float_divide) and access their constituent parts by calling [float_exponent](https://xrpl-hooks.readme.io/reference/float_exponent), [float_mantissa](https://xrpl-hooks.readme.io/reference/float_mantissa) and [float_sign](https://xrpl-hooks.readme.io/reference/float_sign). If the inputs of the computation never change, a more efficient way to do this is to precompute it.
This check warns about calls of the aforementioned functions with constant inputs and in simple cases proposes to add a tracing statement showing the computed value (so that the user can use it to replace the call). It also checks that the divisor passed to `float_divide`, `float_mulratio` and `float_invert` is not 0 (if it's specified by a constant - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/floating-point-numbers-xfl)
[Read more](https://xrpl-hooks.readme.io/docs/floating-point-numbers-xfl)

View File

@@ -1,7 +1,7 @@
# hooks-float-compare-pure
Hooks can compare floating-point values in XFL format by calling the [float_compare](https://xrpl-hooks.readme.io/v2.0/reference/float_compare) function. If the inputs of the comparison never change, its result is fixed and the function need not be called.
Hooks can compare floating-point values in XFL format by calling the [float_compare](https://xrpl-hooks.readme.io/reference/float_compare) function. If the inputs of the comparison never change, its result is fixed and the function need not be called.
This check warns about calls of `float_compare` with constant inputs as well as invalid values of the comparison mode parameter (if it's specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/floating-point-numbers-xfl)
[Read more](https://xrpl-hooks.readme.io/docs/floating-point-numbers-xfl)

View File

@@ -1,7 +1,7 @@
# hooks-float-int-pure
Hooks can convert floating-point values in XFL format to integers by calling the [float_int](https://xrpl-hooks.readme.io/v2.0/reference/float_int) function. If the inputs of this function never change, a more efficient way to do this is to precompute the integer value.
Hooks can convert floating-point values in XFL format to integers by calling the [float_int](https://xrpl-hooks.readme.io/reference/float_int) function. If the inputs of this function never change, a more efficient way to do this is to precompute the integer value.
This check warns about calls of `float_int` with constant inputs as well as invalid values of the decimal places parameter (if it's specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/floating-point-numbers-xfl)
[Read more](https://xrpl-hooks.readme.io/docs/floating-point-numbers-xfl)

View File

@@ -1,7 +1,7 @@
# hooks-float-manip-pure
Hooks can directly manipulate floating-point values in XFL format by calling functions [float_exponent_set](https://xrpl-hooks.readme.io/v2.0/reference/float_exponent_set), [float_mantissa_set](https://xrpl-hooks.readme.io/v2.0/reference/float_mantissa_set) and [float_sign_set](https://xrpl-hooks.readme.io/v2.0/reference/float_sign_set). If the inputs of the update never change, a more efficient way to do this is to precompute it.
Hooks can directly manipulate floating-point values in XFL format by calling functions [float_exponent_set](https://xrpl-hooks.readme.io/reference/float_exponent_set), [float_mantissa_set](https://xrpl-hooks.readme.io/reference/float_mantissa_set) and [float_sign_set](https://xrpl-hooks.readme.io/reference/float_sign_set). If the inputs of the update never change, a more efficient way to do this is to precompute it.
This check warns about calls of the aforementioned functions with constant inputs and in simple cases proposes to add a tracing statement showing the computed value (so that the user can use it to replace the call). It also checks documented bounds of the second parameter of these functions (if it's specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/floating-point-numbers-xfl)
[Read more](https://xrpl-hooks.readme.io/docs/floating-point-numbers-xfl)

View File

@@ -1,5 +1,5 @@
# hooks-float-one-pure
Hooks can obtain XFL enclosing number 1 by calling the [float_one](https://xrpl-hooks.readme.io/v2.0/reference/float_one) function. Since the number never changes, a more efficient way is to use its precomputed value.
Hooks can obtain XFL enclosing number 1 by calling the [float_one](https://xrpl-hooks.readme.io/reference/float_one) function. Since the number never changes, a more efficient way is to use its precomputed value.
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/floating-point-numbers-xfl)
[Read more](https://xrpl-hooks.readme.io/docs/floating-point-numbers-xfl)

View File

@@ -1,7 +1,7 @@
# hooks-float-pure
Hooks can use floating-point values in XFL format, creating them from mantissa and exponent by calling the [float_set](https://xrpl-hooks.readme.io/v2.0/reference/float_set) function. If the mantissa and exponent never change, a more efficient way to do this is to precompute the floating-point value.
Hooks can use floating-point values in XFL format, creating them from mantissa and exponent by calling the [float_set](https://xrpl-hooks.readme.io/reference/float_set) function. If the mantissa and exponent never change, a more efficient way to do this is to precompute the floating-point value.
This check warns about calls of `float_set` with constant inputs and proposes to add a tracing statement showing the computed value (so that the user can use it to replace the call). In the special case of 0 mantissa and 0 exponent ("canonical 0"), a replacement value of 0 is proposed directly, with no need to trace it.
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/floating-point-numbers-xfl)
[Read more](https://xrpl-hooks.readme.io/docs/floating-point-numbers-xfl)

View File

@@ -3,4 +3,4 @@
Only compile-time constants can be used as an argument in loop GUARD call. This check warns if a non compile-time constant is used.
It also checks whether a compile-time constant is used as a first argument of `_g()` call and whether it is a unique value. If not - it warns.
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/loops-and-guarding)
[Read more](https://xrpl-hooks.readme.io/docs/loops-and-guarding)

View File

@@ -1,5 +1,5 @@
# hooks-guard-called
Every hook needs to import the guard function [_g](https://xrpl-hooks.readme.io/v2.0/docs/loops-and-guarding#the-guard-function) and use it at least once.
Every hook needs to import the guard function [_g](https://xrpl-hooks.readme.io/docs/loops-and-guarding#the-guard-function) and use it at least once.
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/loops-and-guarding)
[Read more](https://xrpl-hooks.readme.io/docs/loops-and-guarding)

View File

@@ -32,4 +32,4 @@ for(int i = 0; GUARD(3), i < 3; ++i) {
This check will warn if the GUARD call is missing and also it will propose a GUARD value based on the for loop initial value,
the increment and loop condition.
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/loops-and-guarding)
[Read more](https://xrpl-hooks.readme.io/docs/loops-and-guarding)

View File

@@ -11,4 +11,4 @@ Like for loops, while loops must have a guard in their condition:
```
<BR/>
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/loops-and-guarding)
[Read more](https://xrpl-hooks.readme.io/docs/loops-and-guarding)

View File

@@ -1,5 +1,5 @@
# hooks-hash-buf-len
Functions [util_sha512h](https://xrpl-hooks.readme.io/v2.0/reference/util_sha512h), [hook_hash](https://xrpl-hooks.readme.io/v2.0/reference/hook_hash), [ledger_last_hash](https://xrpl-hooks.readme.io/v2.0/reference/ledger_last_hash), [etxn_nonce](https://xrpl-hooks.readme.io/v2.0/reference/etxn_nonce) and [ledger_nonce](https://xrpl-hooks.readme.io/v2.0/reference/ledger_nonce) have fixed-size hash output.
Functions [util_sha512h](https://xrpl-hooks.readme.io/reference/util_sha512h), [hook_hash](https://xrpl-hooks.readme.io/reference/hook_hash), [ledger_last_hash](https://xrpl-hooks.readme.io/reference/ledger_last_hash), [etxn_nonce](https://xrpl-hooks.readme.io/reference/etxn_nonce) and [ledger_nonce](https://xrpl-hooks.readme.io/reference/ledger_nonce) have fixed-size hash output.
This check warns about too-small size of their output buffer (if it's specified by a constant - variable parameter is ignored).

View File

@@ -1,7 +1,7 @@
# hooks-keylet-buf-len
Computing a ripple keylet by calling [util_keylet](https://xrpl-hooks.readme.io/v2.0/reference/util_keylet) requires valid parameters dependent on the keylet type.
Computing a ripple keylet by calling [util_keylet](https://xrpl-hooks.readme.io/reference/util_keylet) requires valid parameters dependent on the keylet type.
This check does not fully parse these parameters, but warns about invalid keylet type as well as buffer sizes that cannot be valid (if they're specified by constants - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/slots-and-keylets)
[Read more](https://xrpl-hooks.readme.io/docs/slots-and-keylets)

View File

@@ -1,7 +1,7 @@
# hooks-param-buf-len
Function [hook_param](https://xrpl-hooks.readme.io/v2.0/reference/hook_param) expects a limited-length name input and produces fixed-size value output.
Function [hook_param](https://xrpl-hooks.readme.io/reference/hook_param) expects a limited-length name input and produces fixed-size value output.
This check warns about invalid sizes of input and output buffers (if they're specified by constants - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/parameters)
[Read more](https://xrpl-hooks.readme.io/docs/parameters)

View File

@@ -1,7 +1,7 @@
# hooks-param-set-buf-len
Function [hook_param_set](https://xrpl-hooks.readme.io/v2.0/reference/hook_param_set) expects limited-length name, fixed-length hash and limited-length value inputs.
Function [hook_param_set](https://xrpl-hooks.readme.io/reference/hook_param_set) expects limited-length name, fixed-length hash and limited-length value inputs.
This check warns about invalid sizes of input buffers (if they're specified by constants - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/parameters)
[Read more](https://xrpl-hooks.readme.io/docs/parameters)

View File

@@ -1,5 +1,5 @@
# hooks-raddr-conv-buf-len
Hook API [util_accid](https://xrpl-hooks.readme.io/v2.0/reference/util_accid) has upper limit on the length of its input (because it expects it to be a raddr) and fixed-size account ID output.
Hook API [util_accid](https://xrpl-hooks.readme.io/reference/util_accid) has upper limit on the length of its input (because it expects it to be a raddr) and fixed-size account ID output.
This check warns about invalid sizes of input and output parameters (if they're specified by constants - variable parameters are ignored).

View File

@@ -1,5 +1,5 @@
# hooks-raddr-conv-pure
Hooks identify accounts by the 20 byte account ID, which can be converted from a raddr using the [util_accid](https://xrpl-hooks.readme.io/v2.0/reference/util_accid) function. If the raddr never changes, a more efficient way to do this is precompute the account-id from the raddr.
Hooks identify accounts by the 20 byte account ID, which can be converted from a raddr using the [util_accid](https://xrpl-hooks.readme.io/reference/util_accid) function. If the raddr never changes, a more efficient way to do this is precompute the account-id from the raddr.
This check warns about calls of `util_accid` with constant input and proposes to add a tracing statement showing the computed value (so that the user can use it to replace the call).

View File

@@ -1,7 +1,7 @@
# hooks-reserve-limit
Hook API [etxn_reserve](https://xrpl-hooks.readme.io/v2.0/reference/etxn_reserve) takes a parameter specifying the number of transactions intended to emit from the calling hook. Value of this parameter is limited, and the function fails if the limit is exceeded.
Hook API [etxn_reserve](https://xrpl-hooks.readme.io/reference/etxn_reserve) takes a parameter specifying the number of transactions intended to emit from the calling hook. Value of this parameter is limited, and the function fails if the limit is exceeded.
This check warns about too-large values of the number of reserved transactions (if they're specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/emitted-transactions)
[Read more](https://xrpl-hooks.readme.io/docs/emitted-transactions)

View File

@@ -1,5 +1,5 @@
# hooks-skip-hash-buf-len
Function [hook_skip](https://xrpl-hooks.readme.io/v2.0/reference/hook_skip) has fixed-size canonical hash input.
Function [hook_skip](https://xrpl-hooks.readme.io/reference/hook_skip) has fixed-size canonical hash input.
This check warns about invalid size of its input buffer (if it's specified by a constant - variable parameter is ignored).

View File

@@ -1,7 +1,7 @@
# hooks-slot-hash-buf-len
Function [slot_id](https://xrpl-hooks.readme.io/v2.0/reference/slot_id) has fixed-size canonical hash output.
Function [slot_id](https://xrpl-hooks.readme.io/reference/slot_id) has fixed-size canonical hash output.
This check warns about too-small size of its output buffer as well as invalid values of the slot number parameter (if they're specified by constants - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/slots-and-keylets)
[Read more](https://xrpl-hooks.readme.io/docs/slots-and-keylets)

View File

@@ -1,7 +1,7 @@
# hooks-slot-keylet-buf-len
Function [slot_set](https://xrpl-hooks.readme.io/v2.0/reference/slot_set) has structured keylet input.
Function [slot_set](https://xrpl-hooks.readme.io/reference/slot_set) has structured keylet input.
This check does not parse the input, but warns about its sizes that cannot be valid as well as invalid values of the slot number parameter (if they're specified by constants - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/slots-and-keylets)
[Read more](https://xrpl-hooks.readme.io/docs/slots-and-keylets)

View File

@@ -1,7 +1,7 @@
# hooks-slot-limit
Hook APIs [slot](https://xrpl-hooks.readme.io/v2.0/reference/slot), [slot_count](https://xrpl-hooks.readme.io/v2.0/reference/slot_count), [slot_clear](https://xrpl-hooks.readme.io/v2.0/reference/slot_clear), [slot_size](https://xrpl-hooks.readme.io/v2.0/reference/slot_size), [slot_float](https://xrpl-hooks.readme.io/v2.0/reference/slot_float) and [trace_slot](https://xrpl-hooks.readme.io/v2.0/reference/trace_slot) take a parameter specifying the accessed slot number. Value of this parameter is limited, and the functions fail if the limit is exceeded.
Hook APIs [slot](https://xrpl-hooks.readme.io/reference/slot), [slot_count](https://xrpl-hooks.readme.io/reference/slot_count), [slot_clear](https://xrpl-hooks.readme.io/reference/slot_clear), [slot_size](https://xrpl-hooks.readme.io/reference/slot_size), [slot_float](https://xrpl-hooks.readme.io/reference/slot_float) and [trace_slot](https://xrpl-hooks.readme.io/reference/trace_slot) take a parameter specifying the accessed slot number. Value of this parameter is limited, and the functions fail if the limit is exceeded.
This check warns about too-large values of the slot number (if it's specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/slots-and-keylets)
[Read more](https://xrpl-hooks.readme.io/docs/slots-and-keylets)

View File

@@ -1,7 +1,7 @@
# hooks-slot-sub-limit
Hook APIs [slot_subarray](https://xrpl-hooks.readme.io/v2.0/reference/slot_subarray) and [slot_subfield](https://xrpl-hooks.readme.io/v2.0/reference/slot_subfield) take parameters specifying parent and child slot numbers. Values of these parameters are limited, and the functions fail if the limit is exceeded.
Hook APIs [slot_subarray](https://xrpl-hooks.readme.io/reference/slot_subarray) and [slot_subfield](https://xrpl-hooks.readme.io/reference/slot_subfield) take parameters specifying parent and child slot numbers. Values of these parameters are limited, and the functions fail if the limit is exceeded.
This check warns about too-large values of the slot numbers (if they're specified by a constant - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/slots-and-keylets)
[Read more](https://xrpl-hooks.readme.io/docs/slots-and-keylets)

View File

@@ -1,7 +1,7 @@
# hooks-slot-type-limit
Hook API [slot_type](https://xrpl-hooks.readme.io/v2.0/reference/slot_type) takes a parameter specifying the accessed slot number. Value of this parameter is limited, and the function fails if the limit is exceeded.
Hook API [slot_type](https://xrpl-hooks.readme.io/reference/slot_type) takes a parameter specifying the accessed slot number. Value of this parameter is limited, and the function fails if the limit is exceeded.
This check warns about too-large values of the slot number as well as invalid values of the flags parameter (if they're specified by constants - variable parameters are ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/slots-and-keylets)
[Read more](https://xrpl-hooks.readme.io/docs/slots-and-keylets)

View File

@@ -1,7 +1,7 @@
# hooks-state-buf-len
Functions [state](https://xrpl-hooks.readme.io/v2.0/reference/state) and [state_set](https://xrpl-hooks.readme.io/v2.0/reference/state_set) accept fixed-size Hook State key.
Functions [state](https://xrpl-hooks.readme.io/reference/state) and [state_set](https://xrpl-hooks.readme.io/reference/state_set) accept fixed-size Hook State key.
This check warns about invalid size of its input buffer (if it's specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/state-management)
[Read more](https://xrpl-hooks.readme.io/docs/state-management)

View File

@@ -1,5 +1,5 @@
# hooks-transaction-hash-buf-len
Function [otxn_id](https://xrpl-hooks.readme.io/v2.0/reference/otxn_id) has fixed-size canonical hash output.
Function [otxn_id](https://xrpl-hooks.readme.io/reference/otxn_id) has fixed-size canonical hash output.
This check warns about too-small size of its output buffer (if it's specified by a constant - variable parameter is ignored).

View File

@@ -1,7 +1,7 @@
# hooks-transaction-slot-limit
Function [otxn_slot](https://xrpl-hooks.readme.io/v2.0/reference/otxn_slot) takes a parameter specifying the accessed slot number. Value of this parameter is limited, and the function fails if the limit is exceeded.
Function [otxn_slot](https://xrpl-hooks.readme.io/reference/otxn_slot) takes a parameter specifying the accessed slot number. Value of this parameter is limited, and the function fails if the limit is exceeded.
This check warns about too-large values of the slot number (if it's specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/slots-and-keylets)
[Read more](https://xrpl-hooks.readme.io/docs/slots-and-keylets)

View File

@@ -1,7 +1,7 @@
# hooks-trivial-cbak
A Hook may implement and export a [cbak](https://xrpl-hooks.readme.io/v2.0/reference/cbak) function.
A Hook may implement and export a [cbak](https://xrpl-hooks.readme.io/reference/cbak) function.
But the function is optional, and defining it so that it doesn't do anything besides returning a constant value is unnecessary (except for some debugging scenarios) and just increases the hook size. This check warns about such implementations.
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/compiling-hooks)
[Read more](https://xrpl-hooks.readme.io/docs/compiling-hooks)

View File

@@ -1,7 +1,7 @@
# hooks-validate-buf-len
Hook API [sto_validate](https://xrpl-hooks.readme.io/v2.0/reference/sto_validate) requires non-empty input buffer.
Hook API [sto_validate](https://xrpl-hooks.readme.io/reference/sto_validate) requires non-empty input buffer.
This check warns about empty input in calls to `sto_validate` (if it's specified by a constant - variable parameter is ignored).
[Read more](https://xrpl-hooks.readme.io/v2.0/docs/serialized-objects)
[Read more](https://xrpl-hooks.readme.io/docs/serialized-objects)

View File

@@ -1,5 +1,5 @@
# hooks-verify-buf-len
Verifying a cryptographic signature by calling [util_verify](https://xrpl-hooks.readme.io/v2.0/reference/util_verify) requires valid public key & data signature.
Verifying a cryptographic signature by calling [util_verify](https://xrpl-hooks.readme.io/reference/util_verify) requires valid public key & data signature.
This check does not fully parse these parameters, but warns about their sizes that cannot be valid (if they're specified by constants - variable parameters are ignored).

1498
yarn.lock

File diff suppressed because it is too large Load Diff