Compare commits
42 Commits
feat/amoun
...
optimize-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
447d42e53a | ||
|
|
6ed0b54fc5 | ||
|
|
b7e1343055 | ||
|
|
a13dbaeb53 | ||
|
|
98a7a1ee72 | ||
|
|
46c0ec9682 | ||
|
|
fbc27b58c3 | ||
|
|
635e1e22aa | ||
|
|
62ca0603fc | ||
|
|
3234ba851a | ||
|
|
26aeea5a0d | ||
|
|
4a1bd98bd4 | ||
|
|
4171e618a2 | ||
|
|
1860b2d9ce | ||
|
|
488828f9d6 | ||
|
|
9f2105f6d3 | ||
|
|
6beccaef68 | ||
|
|
215af7258c | ||
|
|
ac3137088b | ||
|
|
1b8debda87 | ||
|
|
c50c7a5860 | ||
|
|
d21cda21d0 | ||
|
|
1cae0f161e | ||
|
|
412e3f2bbf | ||
|
|
dc37b1911a | ||
|
|
c348868c89 | ||
|
|
2c3cfebe3a | ||
|
|
6265a9cdbf | ||
|
|
1321b498cf | ||
|
|
801d9778cb | ||
|
|
2cf18ef61c | ||
|
|
4d2dc16ce5 | ||
|
|
9ecf5478e6 | ||
|
|
6d1ef110b7 | ||
|
|
b9edfcd63b | ||
|
|
b653d9a9cb | ||
|
|
da28e0a7d1 | ||
|
|
8a5b83d57f | ||
|
|
025eff6cf2 | ||
|
|
62d521b2cc | ||
|
|
7aafca21df | ||
|
|
80f58e903c |
@@ -5,8 +5,8 @@ GITHUB_ID=""
|
|||||||
NEXT_PUBLIC_COMPILE_API_ENDPOINT="http://localhost:9000/api/build"
|
NEXT_PUBLIC_COMPILE_API_ENDPOINT="http://localhost:9000/api/build"
|
||||||
NEXT_PUBLIC_COMPILE_API_BASE_URL="http://localhost:9000"
|
NEXT_PUBLIC_COMPILE_API_BASE_URL="http://localhost:9000"
|
||||||
NEXT_PUBLIC_LANGUAGE_SERVER_API_ENDPOINT="ws://localhost:9000/language-server/c"
|
NEXT_PUBLIC_LANGUAGE_SERVER_API_ENDPOINT="ws://localhost:9000/language-server/c"
|
||||||
NEXT_PUBLIC_TESTNET_URL="hooks-testnet-v3.xrpl-labs.com"
|
NEXT_PUBLIC_TESTNET_URL="xahau-test.net"
|
||||||
NEXT_PUBLIC_DEBUG_STREAM_URL="hooks-testnet-v3-debugstream.xrpl-labs.com"
|
NEXT_PUBLIC_DEBUG_STREAM_URL="xahau-test.net/debugstream"
|
||||||
NEXT_PUBLIC_EXPLORER_URL="hooks-testnet-v3-explorer.xrpl-labs.com"
|
NEXT_PUBLIC_EXPLORER_URL="explorer.xahau-test.net"
|
||||||
NEXT_PUBLIC_NETWORK_ID="21338"
|
NEXT_PUBLIC_NETWORK_ID="21338"
|
||||||
NEXT_PUBLIC_SITE_URL="http://localhost:3000"
|
NEXT_PUBLIC_SITE_URL="http://localhost:3000"
|
||||||
|
|||||||
@@ -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
|
## General
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ export const AccountDialog = ({
|
|||||||
.toUnit()
|
.toUnit()
|
||||||
.toLocaleString(undefined, {
|
.toLocaleString(undefined, {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'XRP',
|
currency: 'XAH',
|
||||||
currencyDisplay: 'name'
|
currencyDisplay: 'name'
|
||||||
})}
|
})}
|
||||||
<Button
|
<Button
|
||||||
@@ -459,7 +459,7 @@ const Accounts: FC<AccountProps> = props => {
|
|||||||
.toUnit()
|
.toUnit()
|
||||||
.toLocaleString(undefined, {
|
.toLocaleString(undefined, {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'XRP',
|
currency: 'XAH',
|
||||||
currencyDisplay: 'name'
|
currencyDisplay: 'name'
|
||||||
})})`
|
})})`
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ const Navigation = () => {
|
|||||||
<Spinner />
|
<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 }}>
|
<Text css={{ fontSize: '$xs', color: '$mauve10', lineHeight: 1 }}>
|
||||||
{snap.files.length > 0 ? 'Gist: ' : 'Builder'}
|
{snap.files.length > 0 ? 'Gist: ' : 'Builder'}
|
||||||
{snap.files.length > 0 && (
|
{snap.files.length > 0 && (
|
||||||
@@ -180,7 +180,7 @@ const Navigation = () => {
|
|||||||
fontWeight: '$bold'
|
fontWeight: '$bold'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Logo width="48px" height="48px" /> XRPL Hooks Builder
|
<Logo width="48px" height="48px" /> Xahau Hooks Builder
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogDescription as="div">
|
<DialogDescription as="div">
|
||||||
<Text
|
<Text
|
||||||
@@ -191,7 +191,7 @@ const Navigation = () => {
|
|||||||
mb: '$7'
|
mb: '$7'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Hooks add smart contract functionality to the XRP Ledger.
|
Hooks add smart contract functionality to the Xahau Network.
|
||||||
</Text>
|
</Text>
|
||||||
<Flex css={{ flexDirection: 'column', gap: '$2', mt: '$2' }}>
|
<Flex css={{ flexDirection: 'column', gap: '$2', mt: '$2' }}>
|
||||||
<Text
|
<Text
|
||||||
@@ -210,9 +210,9 @@ const Navigation = () => {
|
|||||||
as="a"
|
as="a"
|
||||||
rel="noreferrer noopener"
|
rel="noreferrer noopener"
|
||||||
target="_blank"
|
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>
|
||||||
|
|
||||||
<Text
|
<Text
|
||||||
@@ -231,7 +231,7 @@ const Navigation = () => {
|
|||||||
as="a"
|
as="a"
|
||||||
rel="noreferrer noopener"
|
rel="noreferrer noopener"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://xrpl-hooks.readme.io/v2.0/docs"
|
href="https://docs.xahau.network/readme-1"
|
||||||
>
|
>
|
||||||
<ArrowUpRight size="15px" /> Hooks documentation
|
<ArrowUpRight size="15px" /> Hooks documentation
|
||||||
</Text>
|
</Text>
|
||||||
@@ -352,7 +352,7 @@ const Navigation = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
<Link href="https://xrpl-hooks.readme.io/v2.0" passHref>
|
<Link href="https://xrpl-hooks.readme.io/" passHref>
|
||||||
<a target="_blank" rel="noreferrer noopener">
|
<a target="_blank" rel="noreferrer noopener">
|
||||||
<Button outline>
|
<Button outline>
|
||||||
<BookOpen size="15px" />
|
<BookOpen size="15px" />
|
||||||
|
|||||||
@@ -3,13 +3,11 @@ import { mauve, mauveDark, purple, purpleDark } from '@radix-ui/colors'
|
|||||||
import { useTheme } from 'next-themes'
|
import { useTheme } from 'next-themes'
|
||||||
import { styled } from '../stitches.config'
|
import { styled } from '../stitches.config'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import type { Props } from 'react-select'
|
import type { Props, StylesConfig } from 'react-select'
|
||||||
const SelectInput = dynamic(() => import('react-select'), { ssr: false })
|
const SelectInput = dynamic(() => import('react-select'), { ssr: false })
|
||||||
|
const CreatableSelectInput = dynamic(() => import('react-select/creatable'), { ssr: false })
|
||||||
|
|
||||||
// eslint-disable-next-line react/display-name
|
const getColors = (isDark: boolean) => {
|
||||||
const Select = forwardRef<any, Props>((props, ref) => {
|
|
||||||
const { theme } = useTheme()
|
|
||||||
const isDark = theme === 'dark'
|
|
||||||
const colors: any = {
|
const colors: any = {
|
||||||
// primary: pink.pink9,
|
// primary: pink.pink9,
|
||||||
active: isDark ? purpleDark.purple9 : purple.purple9,
|
active: isDark ? purpleDark.purple9 : purple.purple9,
|
||||||
@@ -30,95 +28,136 @@ const Select = forwardRef<any, Props>((props, ref) => {
|
|||||||
}
|
}
|
||||||
colors.outline = colors.background
|
colors.outline = colors.background
|
||||||
colors.selected = colors.secondary
|
colors.selected = colors.secondary
|
||||||
|
return colors
|
||||||
|
}
|
||||||
|
|
||||||
|
const getStyles = (isDark: boolean) => {
|
||||||
|
const colors = getColors(isDark)
|
||||||
|
const styles: StylesConfig = {
|
||||||
|
container: provided => {
|
||||||
|
return {
|
||||||
|
...provided,
|
||||||
|
position: 'relative',
|
||||||
|
width: '100%'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
singleValue: provided => ({
|
||||||
|
...provided,
|
||||||
|
color: colors.mauve12
|
||||||
|
}),
|
||||||
|
menu: provided => ({
|
||||||
|
...provided,
|
||||||
|
backgroundColor: colors.dropDownBg
|
||||||
|
}),
|
||||||
|
control: (provided, state) => {
|
||||||
|
return {
|
||||||
|
...provided,
|
||||||
|
minHeight: 0,
|
||||||
|
border: '0px',
|
||||||
|
backgroundColor: colors.mauve4,
|
||||||
|
boxShadow: `0 0 0 1px ${state.isFocused ? colors.border : colors.secondary}`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
input: provided => {
|
||||||
|
return {
|
||||||
|
...provided,
|
||||||
|
color: '$text'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
multiValue: provided => {
|
||||||
|
return {
|
||||||
|
...provided,
|
||||||
|
backgroundColor: colors.mauve8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
multiValueLabel: provided => {
|
||||||
|
return {
|
||||||
|
...provided,
|
||||||
|
color: colors.mauve12
|
||||||
|
}
|
||||||
|
},
|
||||||
|
multiValueRemove: provided => {
|
||||||
|
return {
|
||||||
|
...provided,
|
||||||
|
':hover': {
|
||||||
|
background: colors.mauve9
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
option: (provided, state) => {
|
||||||
|
return {
|
||||||
|
...provided,
|
||||||
|
color: colors.searchText,
|
||||||
|
backgroundColor: state.isFocused ? colors.activeLight : colors.dropDownBg,
|
||||||
|
':hover': {
|
||||||
|
backgroundColor: colors.active,
|
||||||
|
color: '#ffffff'
|
||||||
|
},
|
||||||
|
':selected': {
|
||||||
|
backgroundColor: 'red'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
indicatorSeparator: provided => {
|
||||||
|
return {
|
||||||
|
...provided,
|
||||||
|
backgroundColor: colors.secondary
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dropdownIndicator: (provided, state) => {
|
||||||
|
return {
|
||||||
|
...provided,
|
||||||
|
padding: 6,
|
||||||
|
color: state.isFocused ? colors.border : colors.secondary,
|
||||||
|
':hover': {
|
||||||
|
color: colors.border
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clearIndicator: provided => {
|
||||||
|
return {
|
||||||
|
...provided,
|
||||||
|
padding: 6,
|
||||||
|
color: colors.secondary,
|
||||||
|
':hover': {
|
||||||
|
color: colors.border
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return styles
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react/display-name
|
||||||
|
const Select = forwardRef<any, Props>((props, ref) => {
|
||||||
|
const { theme } = useTheme()
|
||||||
|
const isDark = theme === 'dark'
|
||||||
|
const styles = getStyles(isDark)
|
||||||
return (
|
return (
|
||||||
<SelectInput
|
<SelectInput
|
||||||
ref={ref}
|
ref={ref}
|
||||||
menuPosition={props.menuPosition || 'fixed'}
|
menuPosition={props.menuPosition || 'fixed'}
|
||||||
styles={{
|
styles={styles}
|
||||||
container: provided => {
|
{...props}
|
||||||
return {
|
/>
|
||||||
...provided,
|
)
|
||||||
position: 'relative',
|
})
|
||||||
width: '100%',
|
|
||||||
}
|
// eslint-disable-next-line react/display-name
|
||||||
},
|
const Creatable = forwardRef<any, Props>((props, ref) => {
|
||||||
singleValue: provided => ({
|
const { theme } = useTheme()
|
||||||
...provided,
|
const isDark = theme === 'dark'
|
||||||
color: colors.mauve12
|
const styles = getStyles(isDark)
|
||||||
}),
|
return (
|
||||||
menu: provided => ({
|
<CreatableSelectInput
|
||||||
...provided,
|
ref={ref}
|
||||||
backgroundColor: colors.dropDownBg
|
formatCreateLabel={label => `Enter "${label}"`}
|
||||||
}),
|
menuPosition={props.menuPosition || 'fixed'}
|
||||||
control: (provided, state) => {
|
styles={styles}
|
||||||
return {
|
|
||||||
...provided,
|
|
||||||
minHeight: 0,
|
|
||||||
border: '0px',
|
|
||||||
backgroundColor: colors.mauve4,
|
|
||||||
boxShadow: `0 0 0 1px ${state.isFocused ? colors.border : colors.secondary}`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
input: provided => {
|
|
||||||
return {
|
|
||||||
...provided,
|
|
||||||
color: '$text'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
multiValue: provided => {
|
|
||||||
return {
|
|
||||||
...provided,
|
|
||||||
backgroundColor: colors.mauve8
|
|
||||||
}
|
|
||||||
},
|
|
||||||
multiValueLabel: provided => {
|
|
||||||
return {
|
|
||||||
...provided,
|
|
||||||
color: colors.mauve12
|
|
||||||
}
|
|
||||||
},
|
|
||||||
multiValueRemove: provided => {
|
|
||||||
return {
|
|
||||||
...provided,
|
|
||||||
':hover': {
|
|
||||||
background: colors.mauve9
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
option: (provided, state) => {
|
|
||||||
return {
|
|
||||||
...provided,
|
|
||||||
color: colors.searchText,
|
|
||||||
backgroundColor: state.isFocused ? colors.activeLight : colors.dropDownBg,
|
|
||||||
':hover': {
|
|
||||||
backgroundColor: colors.active,
|
|
||||||
color: '#ffffff'
|
|
||||||
},
|
|
||||||
':selected': {
|
|
||||||
backgroundColor: 'red'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
indicatorSeparator: provided => {
|
|
||||||
return {
|
|
||||||
...provided,
|
|
||||||
backgroundColor: colors.secondary
|
|
||||||
}
|
|
||||||
},
|
|
||||||
dropdownIndicator: (provided, state) => {
|
|
||||||
return {
|
|
||||||
...provided,
|
|
||||||
padding: 6,
|
|
||||||
color: state.isFocused ? colors.border : colors.secondary,
|
|
||||||
':hover': {
|
|
||||||
color: colors.border,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export default styled(Select, {})
|
export default styled(Select, {})
|
||||||
|
export const CreatableSelect = styled(Creatable, {})
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ const Transaction: FC<TransactionProps> = ({ header, state: txState, ...props })
|
|||||||
(state: Partial<TransactionState> = txState) => {
|
(state: Partial<TransactionState> = txState) => {
|
||||||
const {
|
const {
|
||||||
selectedTransaction,
|
selectedTransaction,
|
||||||
selectedDestAccount,
|
|
||||||
selectedAccount,
|
selectedAccount,
|
||||||
txFields,
|
txFields,
|
||||||
selectedFlags,
|
selectedFlags,
|
||||||
@@ -52,20 +51,19 @@ const Transaction: FC<TransactionProps> = ({ header, state: txState, ...props })
|
|||||||
} = state
|
} = state
|
||||||
|
|
||||||
const TransactionType = selectedTransaction?.value || null
|
const TransactionType = selectedTransaction?.value || null
|
||||||
const Destination = selectedDestAccount?.value || txFields?.Destination
|
|
||||||
const Account = selectedAccount?.value || null
|
const Account = selectedAccount?.value || null
|
||||||
const Flags = combineFlags(selectedFlags?.map(flag => flag.value)) || txFields?.Flags
|
const Flags = combineFlags(selectedFlags?.map(flag => flag.value)) || txFields?.Flags
|
||||||
const HookParameters = Object.entries(hookParameters || {}).reduce<
|
const HookParameters = Object.entries(hookParameters || {}).reduce<
|
||||||
SetHookData['HookParameters']
|
SetHookData['HookParameters']
|
||||||
>((acc, [_, { label, value }]) => {
|
>((acc, [_, { label, value }]) => {
|
||||||
return acc.concat({
|
return acc.concat({
|
||||||
HookParameter: { HookParameterName: toHex(label), HookParameterValue: toHex(value) }
|
HookParameter: { HookParameterName: toHex(label), HookParameterValue: value }
|
||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
const Memos = memos
|
const Memos = memos
|
||||||
? Object.entries(memos).reduce<SetHookData['Memos']>((acc, [_, { format, data, type }]) => {
|
? Object.entries(memos).reduce<SetHookData['Memos']>((acc, [_, { format, data, type }]) => {
|
||||||
return acc?.concat({
|
return acc?.concat({
|
||||||
Memo: { MemoData: toHex(data), MemoFormat: toHex(format), MemoType: toHex(type) }
|
Memo: { MemoData: data, MemoFormat: toHex(format), MemoType: toHex(type) }
|
||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
: undefined
|
: undefined
|
||||||
@@ -75,7 +73,6 @@ const Transaction: FC<TransactionProps> = ({ header, state: txState, ...props })
|
|||||||
HookParameters,
|
HookParameters,
|
||||||
Flags,
|
Flags,
|
||||||
TransactionType,
|
TransactionType,
|
||||||
Destination,
|
|
||||||
Account,
|
Account,
|
||||||
Memos
|
Memos
|
||||||
})
|
})
|
||||||
@@ -128,11 +125,12 @@ const Transaction: FC<TransactionProps> = ({ header, state: txState, ...props })
|
|||||||
throw Error('Account must be selected from imported accounts!')
|
throw Error('Account must be selected from imported accounts!')
|
||||||
}
|
}
|
||||||
const options = prepareOptions(st)
|
const options = prepareOptions(st)
|
||||||
|
// delete unnecessary fields
|
||||||
const fields = getTxFields(options.TransactionType)
|
Object.keys(options).forEach(field => {
|
||||||
if (fields.Destination && !options.Destination) {
|
if (!options[field]) {
|
||||||
throw Error('Destination account is required!')
|
delete options[field]
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
await sendTransaction(account, options, { logPrefix })
|
await sendTransaction(account, options, { logPrefix })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -167,13 +165,6 @@ const Transaction: FC<TransactionProps> = ({ header, state: txState, ...props })
|
|||||||
selectedTransaction: transactionType
|
selectedTransaction: transactionType
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fields.Destination !== undefined) {
|
|
||||||
nwState.selectedDestAccount = null
|
|
||||||
fields.Destination = ''
|
|
||||||
} else {
|
|
||||||
fields.Destination = undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transactionType?.value && transactionFlags[transactionType?.value] && fields.Flags) {
|
if (transactionType?.value && transactionFlags[transactionType?.value] && fields.Flags) {
|
||||||
nwState.selectedFlags = extractFlags(transactionType.value, fields.Flags)
|
nwState.selectedFlags = extractFlags(transactionType.value, fields.Flags)
|
||||||
fields.Flags = undefined
|
fields.Flags = undefined
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
import { FC, ReactNode, useCallback, useEffect, useMemo, useState } from 'react'
|
import { FC, ReactNode, useCallback, useEffect, useState } from 'react'
|
||||||
import Container from '../Container'
|
import Container from '../Container'
|
||||||
import Flex from '../Flex'
|
import Flex from '../Flex'
|
||||||
import Input from '../Input'
|
import Input from '../Input'
|
||||||
import Select from '../Select'
|
import Select, { CreatableSelect } from '../Select'
|
||||||
import Text from '../Text'
|
import Text from '../Text'
|
||||||
import {
|
import {
|
||||||
SelectOption,
|
SelectOption,
|
||||||
TransactionState,
|
TransactionState,
|
||||||
transactionsOptions,
|
transactionsOptions,
|
||||||
TxFields,
|
TxFields,
|
||||||
getTxFields,
|
|
||||||
defaultTransactionType
|
defaultTransactionType
|
||||||
} from '../../state/transactions'
|
} from '../../state/transactions'
|
||||||
import { useSnapshot } from 'valtio'
|
import { useSnapshot } from 'valtio'
|
||||||
@@ -20,7 +19,7 @@ import Textarea from '../Textarea'
|
|||||||
import { getFlags } from '../../state/constants/flags'
|
import { getFlags } from '../../state/constants/flags'
|
||||||
import { Plus, Trash } from 'phosphor-react'
|
import { Plus, Trash } from 'phosphor-react'
|
||||||
import AccountSequence from '../Sequence'
|
import AccountSequence from '../Sequence'
|
||||||
import { typeIs } from '../../utils/helpers'
|
import { capitalize, typeIs } from '../../utils/helpers'
|
||||||
|
|
||||||
interface UIProps {
|
interface UIProps {
|
||||||
setState: (pTx?: Partial<TransactionState> | undefined) => TransactionState | undefined
|
setState: (pTx?: Partial<TransactionState> | undefined) => TransactionState | undefined
|
||||||
@@ -38,28 +37,14 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
switchToJson
|
switchToJson
|
||||||
}) => {
|
}) => {
|
||||||
const { accounts } = useSnapshot(state)
|
const { accounts } = useSnapshot(state)
|
||||||
const {
|
const { selectedAccount, selectedTransaction, txFields, selectedFlags, hookParameters, memos } =
|
||||||
selectedAccount,
|
txState
|
||||||
selectedDestAccount,
|
|
||||||
selectedTransaction,
|
|
||||||
txFields,
|
|
||||||
selectedFlags,
|
|
||||||
hookParameters,
|
|
||||||
memos
|
|
||||||
} = txState
|
|
||||||
|
|
||||||
const accountOptions: SelectOption[] = accounts.map(acc => ({
|
const accountOptions: SelectOption[] = accounts.map(acc => ({
|
||||||
label: acc.name,
|
label: acc.name,
|
||||||
value: acc.address
|
value: acc.address
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const destAccountOptions: SelectOption[] = accounts
|
|
||||||
.map(acc => ({
|
|
||||||
label: acc.name,
|
|
||||||
value: acc.address
|
|
||||||
}))
|
|
||||||
.filter(acc => acc.value !== selectedAccount?.value)
|
|
||||||
|
|
||||||
const flagsOptions: SelectOption[] = Object.entries(
|
const flagsOptions: SelectOption[] = Object.entries(
|
||||||
getFlags(selectedTransaction?.value) || {}
|
getFlags(selectedTransaction?.value) || {}
|
||||||
).map(([label, value]) => ({
|
).map(([label, value]) => ({
|
||||||
@@ -136,15 +121,7 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
}
|
}
|
||||||
}, [handleChangeTxType, selectedTransaction?.value])
|
}, [handleChangeTxType, selectedTransaction?.value])
|
||||||
|
|
||||||
const fields = useMemo(
|
|
||||||
() => getTxFields(selectedTransaction?.value),
|
|
||||||
[selectedTransaction?.value]
|
|
||||||
)
|
|
||||||
|
|
||||||
const richFields = ['TransactionType', 'Account', 'HookParameters', 'Memos']
|
const richFields = ['TransactionType', 'Account', 'HookParameters', 'Memos']
|
||||||
if (fields.Destination !== undefined) {
|
|
||||||
richFields.push('Destination')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flagsOptions.length) {
|
if (flagsOptions.length) {
|
||||||
richFields.push('Flags')
|
richFields.push('Flags')
|
||||||
@@ -152,7 +129,7 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
|
|
||||||
const otherFields = Object.keys(txFields).filter(k => !richFields.includes(k)) as [keyof TxFields]
|
const otherFields = Object.keys(txFields).filter(k => !richFields.includes(k)) as [keyof TxFields]
|
||||||
const amountOptions = [
|
const amountOptions = [
|
||||||
{ label: 'XRP', value: 'xrp' },
|
{ label: 'XAH', value: 'xah' },
|
||||||
{ label: 'Token', value: 'token' }
|
{ label: 'Token', value: 'token' }
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
@@ -192,18 +169,6 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
<TxField label="Sequence">
|
<TxField label="Sequence">
|
||||||
<AccountSequence address={selectedAccount?.value} />
|
<AccountSequence address={selectedAccount?.value} />
|
||||||
</TxField>
|
</TxField>
|
||||||
{richFields.includes('Destination') && (
|
|
||||||
<TxField label="Destination account">
|
|
||||||
<Select
|
|
||||||
instanceId="to-account"
|
|
||||||
placeholder="Select the destination account"
|
|
||||||
options={destAccountOptions}
|
|
||||||
value={selectedDestAccount}
|
|
||||||
isClearable
|
|
||||||
onChange={(acc: any) => setState({ selectedDestAccount: acc })}
|
|
||||||
/>
|
|
||||||
</TxField>
|
|
||||||
)}
|
|
||||||
{richFields.includes('Flags') && (
|
{richFields.includes('Flags') && (
|
||||||
<TxField label="Flags">
|
<TxField label="Flags">
|
||||||
<Select
|
<Select
|
||||||
@@ -235,6 +200,7 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
value = _value?.toString()
|
value = _value?.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isAccount = typeIs(_value, 'object') && _value.$type === 'account'
|
||||||
const isXrpAmount = typeIs(_value, 'object') && _value.$type === 'amount.xrp'
|
const isXrpAmount = typeIs(_value, 'object') && _value.$type === 'amount.xrp'
|
||||||
const isTokenAmount = typeIs(_value, 'object') && _value.$type === 'amount.token'
|
const isTokenAmount = typeIs(_value, 'object') && _value.$type === 'amount.token'
|
||||||
const isJson = typeof _value === 'object' && _value.$type === 'json'
|
const isJson = typeof _value === 'object' && _value.$type === 'json'
|
||||||
@@ -255,8 +221,14 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
<TxField key={field} label={field}>
|
<TxField key={field} label={field}>
|
||||||
<Flex fluid css={{ alignItems: 'center' }}>
|
<Flex fluid css={{ alignItems: 'center' }}>
|
||||||
{isTokenAmount ? (
|
{isTokenAmount ? (
|
||||||
<Flex fluid row align="center" justify="space-between">
|
<Flex
|
||||||
<Input
|
fluid
|
||||||
|
row
|
||||||
|
align="center"
|
||||||
|
justify="space-between"
|
||||||
|
css={{ position: 'relative' }}
|
||||||
|
>
|
||||||
|
{/* <Input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Issuer"
|
placeholder="Issuer"
|
||||||
value={tokenAmount.issuer}
|
value={tokenAmount.issuer}
|
||||||
@@ -266,9 +238,8 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
issuer: e.target.value
|
issuer: e.target.value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/>
|
/> */}
|
||||||
<Input
|
<Input
|
||||||
css={{ mx: '$1' }}
|
|
||||||
type="text"
|
type="text"
|
||||||
value={tokenAmount.currency}
|
value={tokenAmount.currency}
|
||||||
placeholder="Currency"
|
placeholder="Currency"
|
||||||
@@ -280,6 +251,7 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
|
css={{ mx: '$1' }}
|
||||||
type="number"
|
type="number"
|
||||||
value={tokenAmount.value}
|
value={tokenAmount.value}
|
||||||
placeholder="Value"
|
placeholder="Value"
|
||||||
@@ -290,6 +262,19 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Box css={{ width: '50%' }}>
|
||||||
|
<CreatableAccount
|
||||||
|
value={tokenAmount.issuer}
|
||||||
|
field={'Issuer' as any}
|
||||||
|
placeholder="Issuer"
|
||||||
|
setField={(_, value = '') => {
|
||||||
|
setRawField(field, 'amount.token', {
|
||||||
|
...tokenAmount,
|
||||||
|
issuer: value
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
) : (
|
) : (
|
||||||
<Input
|
<Input
|
||||||
@@ -311,7 +296,7 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
value={isXrpAmount ? amountOptions['0'] : amountOptions['1']}
|
value={isXrpAmount ? amountOptions['0'] : amountOptions['1']}
|
||||||
onChange={(e: any) => {
|
onChange={(e: any) => {
|
||||||
const opt = e as typeof amountOptions[number]
|
const opt = e as typeof amountOptions[number]
|
||||||
if (opt.value === 'xrp') {
|
if (opt.value === 'xah') {
|
||||||
setRawField(field, 'amount.xrp', '0')
|
setRawField(field, 'amount.xrp', '0')
|
||||||
} else {
|
} else {
|
||||||
setRawField(field, 'amount.token', defaultTokenAmount)
|
setRawField(field, 'amount.token', defaultTokenAmount)
|
||||||
@@ -323,6 +308,13 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
</TxField>
|
</TxField>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
if (isAccount) {
|
||||||
|
return (
|
||||||
|
<TxField key={field} label={field}>
|
||||||
|
<CreatableAccount value={value} field={field} setField={handleSetField} />
|
||||||
|
</TxField>
|
||||||
|
)
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<TxField key={field} label={field}>
|
<TxField key={field} label={field}>
|
||||||
{isJson ? (
|
{isJson ? (
|
||||||
@@ -414,7 +406,7 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
css={{ mx: '$2' }}
|
css={{ mx: '$2' }}
|
||||||
placeholder="Value"
|
placeholder="Value (hex-quoted)"
|
||||||
value={value}
|
value={value}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
setState({
|
setState({
|
||||||
@@ -477,7 +469,7 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
placeholder="Data"
|
placeholder="Data (hex-quoted)"
|
||||||
css={{ mx: '$2' }}
|
css={{ mx: '$2' }}
|
||||||
value={memo.data}
|
value={memo.data}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
@@ -535,6 +527,35 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const CreatableAccount: FC<{
|
||||||
|
value: string | undefined
|
||||||
|
field: keyof TxFields
|
||||||
|
placeholder?: string
|
||||||
|
setField: (field: keyof TxFields, value: string, opFields?: TxFields) => void
|
||||||
|
}> = ({ value, field, setField, placeholder }) => {
|
||||||
|
const { accounts } = useSnapshot(state)
|
||||||
|
const accountOptions: SelectOption[] = accounts.map(acc => ({
|
||||||
|
label: acc.name,
|
||||||
|
value: acc.address
|
||||||
|
}))
|
||||||
|
const label = accountOptions.find(a => a.value === value)?.label || value
|
||||||
|
const val = {
|
||||||
|
value,
|
||||||
|
label
|
||||||
|
}
|
||||||
|
placeholder = placeholder || `${capitalize(field)} account`
|
||||||
|
return (
|
||||||
|
<CreatableSelect
|
||||||
|
isClearable
|
||||||
|
instanceId={field}
|
||||||
|
placeholder={placeholder}
|
||||||
|
options={accountOptions}
|
||||||
|
value={value ? val : undefined}
|
||||||
|
onChange={(acc: any) => setField(field, acc?.value)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export const TxField: FC<{ label: string; children: ReactNode; multiLine?: boolean }> = ({
|
export const TxField: FC<{ label: string; children: ReactNode; multiLine?: boolean }> = ({
|
||||||
label,
|
label,
|
||||||
children,
|
children,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"uri": "file:///amount-schema.json",
|
"uri": "file:///amount-schema.json",
|
||||||
"title": "Amount",
|
"title": "Amount",
|
||||||
"description": "Specify xrp in drops and tokens as objects.",
|
"description": "Specify XAH in drops and tokens as objects.",
|
||||||
"schema": {
|
"schema": {
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
{
|
{
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"currency": {
|
"currency": {
|
||||||
"description": "Arbitrary currency code for the token. Cannot be XRP."
|
"description": "Arbitrary currency code for the token. Cannot be XAH."
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"type": ["string", "number"],
|
"type": ["string", "number"],
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
],
|
],
|
||||||
"defaultSnippets": [
|
"defaultSnippets": [
|
||||||
{
|
{
|
||||||
"label": "Xrp",
|
"label": "XAH",
|
||||||
"body": "1000000"
|
"body": "1000000"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
{
|
{
|
||||||
"TransactionType": "AccountDelete",
|
"TransactionType": "AccountDelete",
|
||||||
"Account": "rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm",
|
"Account": "rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm",
|
||||||
"Destination": "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
|
"Destination": {
|
||||||
|
"$type": "account",
|
||||||
|
"$value": ""
|
||||||
|
},
|
||||||
"DestinationTag": 13,
|
"DestinationTag": 13,
|
||||||
"Fee": "2000000",
|
"Fee": "2000000",
|
||||||
"Sequence": 2470665,
|
"Sequence": 2470665,
|
||||||
@@ -40,7 +43,10 @@
|
|||||||
{
|
{
|
||||||
"TransactionType": "CheckCreate",
|
"TransactionType": "CheckCreate",
|
||||||
"Account": "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
"Account": "rUn84CUYbNjRoTQ6mSW7BVJPSVJNLb1QLo",
|
||||||
"Destination": "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
|
"Destination": {
|
||||||
|
"$type": "account",
|
||||||
|
"$value": ""
|
||||||
|
},
|
||||||
"SendMax": "100000000",
|
"SendMax": "100000000",
|
||||||
"Expiration": 570113521,
|
"Expiration": 570113521,
|
||||||
"InvoiceID": "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
"InvoiceID": "6F1DFD1D0FE8A32E40E1F2C05CF1C15545BAB56B617F9C6C2D63A6B704BEF59B",
|
||||||
@@ -58,7 +64,10 @@
|
|||||||
{
|
{
|
||||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
"TransactionType": "EscrowCancel",
|
"TransactionType": "EscrowCancel",
|
||||||
"Owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
"Owner": {
|
||||||
|
"$type": "account",
|
||||||
|
"$value": ""
|
||||||
|
},
|
||||||
"OfferSequence": 7,
|
"OfferSequence": 7,
|
||||||
"Fee": "10"
|
"Fee": "10"
|
||||||
},
|
},
|
||||||
@@ -69,7 +78,10 @@
|
|||||||
"$value": "100",
|
"$value": "100",
|
||||||
"$type": "amount.xrp"
|
"$type": "amount.xrp"
|
||||||
},
|
},
|
||||||
"Destination": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
"Destination": {
|
||||||
|
"$type": "account",
|
||||||
|
"$value": ""
|
||||||
|
},
|
||||||
"CancelAfter": 533257958,
|
"CancelAfter": 533257958,
|
||||||
"FinishAfter": 533171558,
|
"FinishAfter": 533171558,
|
||||||
"Condition": "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100",
|
"Condition": "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100",
|
||||||
@@ -80,56 +92,15 @@
|
|||||||
{
|
{
|
||||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
"TransactionType": "EscrowFinish",
|
"TransactionType": "EscrowFinish",
|
||||||
"Owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
"Owner": {
|
||||||
|
"$type": "account",
|
||||||
|
"$value": ""
|
||||||
|
},
|
||||||
"OfferSequence": 7,
|
"OfferSequence": 7,
|
||||||
"Condition": "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100",
|
"Condition": "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100",
|
||||||
"Fulfillment": "A0028000",
|
"Fulfillment": "A0028000",
|
||||||
"Fee": "10"
|
"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": "",
|
|
||||||
"Fee": "10"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"TransactionType": "OfferCancel",
|
"TransactionType": "OfferCancel",
|
||||||
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
@@ -162,7 +133,10 @@
|
|||||||
{
|
{
|
||||||
"TransactionType": "Payment",
|
"TransactionType": "Payment",
|
||||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||||
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
"Destination": {
|
||||||
|
"$type": "account",
|
||||||
|
"$value": ""
|
||||||
|
},
|
||||||
"Amount": {
|
"Amount": {
|
||||||
"$value": "100",
|
"$value": "100",
|
||||||
"$type": "amount.xrp"
|
"$type": "amount.xrp"
|
||||||
@@ -178,7 +152,10 @@
|
|||||||
"$value": "100",
|
"$value": "100",
|
||||||
"$type": "amount.xrp"
|
"$type": "amount.xrp"
|
||||||
},
|
},
|
||||||
"Destination": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
"Destination": {
|
||||||
|
"$type": "account",
|
||||||
|
"$value": ""
|
||||||
|
},
|
||||||
"SettleDelay": 86400,
|
"SettleDelay": 86400,
|
||||||
"PublicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A",
|
"PublicKey": "32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A",
|
||||||
"CancelAfter": 533171558,
|
"CancelAfter": 533171558,
|
||||||
@@ -259,11 +236,54 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"TransactionType": "Invoke",
|
"TransactionType": "Invoke",
|
||||||
|
"Destination": {
|
||||||
|
"$type": "account",
|
||||||
|
"$value": ""
|
||||||
|
},
|
||||||
"Fee": "12"
|
"Fee": "12"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"TransactionType": "UriToken",
|
"TransactionType": "URITokenMint",
|
||||||
"Fee": "12",
|
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||||
"URI": "697066733A2F2F516D614374444B5A4656767666756676626479346573745A626851483744586831364354707631686F776D424779"
|
"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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -83,6 +83,6 @@
|
|||||||
"typescript": "4.4.4"
|
"typescript": "4.4.4"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"ripple-binary-codec": "=1.4.2"
|
"ripple-binary-codec": "=1.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,22 +58,22 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) {
|
|||||||
<meta name="format-detection" content="telephone=no" />
|
<meta name="format-detection" content="telephone=no" />
|
||||||
<meta property="og:url" content={`${origin}${router.asPath}`} />
|
<meta property="og:url" content={`${origin}${router.asPath}`} />
|
||||||
|
|
||||||
<title>XRPL Hooks Builder</title>
|
<title>Xahau Hooks Builder</title>
|
||||||
<meta property="og:title" content="XRPL Hooks Builder" />
|
<meta property="og:title" content="Xahau Hooks Builder" />
|
||||||
<meta name="twitter:title" content="XRPL Hooks Builder" />
|
<meta name="twitter:title" content="Xahau Hooks Builder" />
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
<meta name="twitter:site" content="@XRPLF" />
|
<meta name="twitter:site" content="@XRPLF" />
|
||||||
<meta
|
<meta
|
||||||
name="description"
|
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
|
<meta
|
||||||
property="og:description"
|
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
|
<meta
|
||||||
name="twitter:description"
|
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" content={`${origin}${shareImg}`} />
|
||||||
<meta property="og:image:width" content="1200" />
|
<meta property="og:image:width" content="1200" />
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
346
patches/ripple-binary-codec+1.6.0.patch
Normal file
346
patches/ripple-binary-codec+1.6.0.patch
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -77,7 +77,7 @@ export const addFunds = async (address: string) => {
|
|||||||
if ('error' in json) {
|
if ('error' in json) {
|
||||||
return toast.error(json.error, { id: toastId })
|
return toast.error(json.error, { id: toastId })
|
||||||
} else {
|
} 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)
|
const currAccount = state.accounts.find(acc => acc.address === address)
|
||||||
if (currAccount) {
|
if (currAccount) {
|
||||||
currAccount.xrp = (Number(currAccount.xrp) + json.xrp * 1000000).toString()
|
currAccount.xrp = (Number(currAccount.xrp) + json.xrp * 1000000).toString()
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export const compileCode = async (activeId: number) => {
|
|||||||
output: 'wasm',
|
output: 'wasm',
|
||||||
compress: true,
|
compress: true,
|
||||||
strip: state.compileOptions.strip,
|
strip: state.compileOptions.strip,
|
||||||
|
optimize: false,
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
type: 'c',
|
type: 'c',
|
||||||
|
|||||||
@@ -14,11 +14,4 @@ export const deleteAccount = (addr?: string) => {
|
|||||||
if (!acc) return
|
if (!acc) return
|
||||||
acc.label = acc.value
|
acc.label = acc.value
|
||||||
})
|
})
|
||||||
transactionsState.transactions
|
|
||||||
.filter(t => t.state.selectedDestAccount?.value === addr)
|
|
||||||
.forEach(t => {
|
|
||||||
const acc = t.state.selectedDestAccount
|
|
||||||
if (!acc) return
|
|
||||||
acc.label = acc.value
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ interface TransactionOptions {
|
|||||||
TransactionType: string
|
TransactionType: string
|
||||||
Account?: string
|
Account?: string
|
||||||
Fee?: string
|
Fee?: string
|
||||||
Destination?: string
|
|
||||||
[index: string]: any
|
[index: string]: any
|
||||||
}
|
}
|
||||||
interface OtherOptions {
|
interface OtherOptions {
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ export const transactionFlags: { [key: /* TransactionType */ string]: Flags } =
|
|||||||
tfSetFreeze: '0x00100000',
|
tfSetFreeze: '0x00100000',
|
||||||
tfClearFreeze: '0x00200000',
|
tfClearFreeze: '0x00200000',
|
||||||
},
|
},
|
||||||
|
URITokenMint: {
|
||||||
|
tfBurnable: '0x00000001',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getFlags = (tt?: string) => {
|
export const getFlags = (tt?: string) => {
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ export type Memos = {
|
|||||||
export interface TransactionState {
|
export interface TransactionState {
|
||||||
selectedTransaction: SelectOption | null
|
selectedTransaction: SelectOption | null
|
||||||
selectedAccount: SelectOption | null
|
selectedAccount: SelectOption | null
|
||||||
selectedDestAccount: SelectOption | null
|
|
||||||
selectedFlags: SelectOption[] | null
|
selectedFlags: SelectOption[] | null
|
||||||
hookParameters: HookParameters
|
hookParameters: HookParameters
|
||||||
memos: Memos
|
memos: Memos
|
||||||
@@ -51,7 +50,6 @@ export type TxFields = Omit<
|
|||||||
export const defaultTransaction: TransactionState = {
|
export const defaultTransaction: TransactionState = {
|
||||||
selectedTransaction: null,
|
selectedTransaction: null,
|
||||||
selectedAccount: null,
|
selectedAccount: null,
|
||||||
selectedDestAccount: null,
|
|
||||||
selectedFlags: null,
|
selectedFlags: null,
|
||||||
hookParameters: {},
|
hookParameters: {},
|
||||||
memos: {},
|
memos: {},
|
||||||
@@ -131,7 +129,6 @@ export const modifyTxState = (
|
|||||||
return tx.state
|
return tx.state
|
||||||
}
|
}
|
||||||
|
|
||||||
// state to tx options
|
|
||||||
export const prepareTransaction = (data: any) => {
|
export const prepareTransaction = (data: any) => {
|
||||||
let options = { ...data }
|
let options = { ...data }
|
||||||
|
|
||||||
@@ -143,10 +140,9 @@ export const prepareTransaction = (data: any) => {
|
|||||||
if (_value.$value) {
|
if (_value.$value) {
|
||||||
options[field] = (+(_value as any).$value * 1000000 + '')
|
options[field] = (+(_value as any).$value * 1000000 + '')
|
||||||
} else {
|
} else {
|
||||||
options[field] = undefined
|
options[field] = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// amount.token
|
// amount.token
|
||||||
if (_value.$type === 'amount.token') {
|
if (_value.$type === 'amount.token') {
|
||||||
if (typeIs(_value.$value, 'string')) {
|
if (typeIs(_value.$value, 'string')) {
|
||||||
@@ -157,7 +153,10 @@ export const prepareTransaction = (data: any) => {
|
|||||||
options[field] = undefined
|
options[field] = undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// account
|
||||||
|
if (_value.$type === 'account') {
|
||||||
|
options[field] = (_value.$value as any)?.toString() || ""
|
||||||
|
}
|
||||||
// json
|
// json
|
||||||
if (_value.$type === 'json') {
|
if (_value.$type === 'json') {
|
||||||
const val = _value.$value;
|
const val = _value.$value;
|
||||||
@@ -172,17 +171,9 @@ export const prepareTransaction = (data: any) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// delete unnecessary fields
|
|
||||||
Object.keys(options).forEach(field => {
|
|
||||||
if (!options[field]) {
|
|
||||||
delete options[field]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
// editor value to state
|
|
||||||
export const prepareState = (value: string, transactionType?: string) => {
|
export const prepareState = (value: string, transactionType?: string) => {
|
||||||
const options = parseJSON(value)
|
const options = parseJSON(value)
|
||||||
if (!options) {
|
if (!options) {
|
||||||
@@ -192,7 +183,7 @@ export const prepareState = (value: string, transactionType?: string) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const { Account, TransactionType, Destination, HookParameters, Memos, ...rest } = options
|
const { Account, TransactionType, HookParameters, Memos, ...rest } = options
|
||||||
let tx: Partial<TransactionState> = {}
|
let tx: Partial<TransactionState> = {}
|
||||||
const schema = getTxFields(transactionType)
|
const schema = getTxFields(transactionType)
|
||||||
|
|
||||||
@@ -224,7 +215,7 @@ export const prepareState = (value: string, transactionType?: string) => {
|
|||||||
|
|
||||||
if (HookParameters && HookParameters instanceof Array) {
|
if (HookParameters && HookParameters instanceof Array) {
|
||||||
tx.hookParameters = HookParameters.reduce<TransactionState["hookParameters"]>((acc, cur, idx) => {
|
tx.hookParameters = HookParameters.reduce<TransactionState["hookParameters"]>((acc, cur, idx) => {
|
||||||
const param = { label: fromHex(cur.HookParameter?.HookParameterName || ""), value: fromHex(cur.HookParameter?.HookParameterValue || "") }
|
const param = { label: fromHex(cur.HookParameter?.HookParameterName || ""), value: cur.HookParameter?.HookParameterValue || "" }
|
||||||
acc[idx] = param;
|
acc[idx] = param;
|
||||||
return acc;
|
return acc;
|
||||||
}, {})
|
}, {})
|
||||||
@@ -232,30 +223,12 @@ export const prepareState = (value: string, transactionType?: string) => {
|
|||||||
|
|
||||||
if (Memos && Memos instanceof Array) {
|
if (Memos && Memos instanceof Array) {
|
||||||
tx.memos = Memos.reduce<TransactionState["memos"]>((acc, cur, idx) => {
|
tx.memos = Memos.reduce<TransactionState["memos"]>((acc, cur, idx) => {
|
||||||
const memo = { data: fromHex(cur.Memo?.MemoData || ""), type: fromHex(cur.Memo?.MemoType || ""), format: fromHex(cur.Memo?.MemoFormat || "") }
|
const memo = { data: cur.Memo?.MemoData || "", type: fromHex(cur.Memo?.MemoType || ""), format: fromHex(cur.Memo?.MemoFormat || "") }
|
||||||
acc[idx] = memo;
|
acc[idx] = memo;
|
||||||
return acc;
|
return acc;
|
||||||
}, {})
|
}, {})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (schema.Destination !== undefined) {
|
|
||||||
const dest = state.accounts.find(acc => acc.address === Destination)
|
|
||||||
if (dest) {
|
|
||||||
tx.selectedDestAccount = {
|
|
||||||
label: dest.name,
|
|
||||||
value: dest.address
|
|
||||||
}
|
|
||||||
} else if (Destination) {
|
|
||||||
tx.selectedDestAccount = {
|
|
||||||
label: Destination,
|
|
||||||
value: Destination
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tx.selectedDestAccount = null
|
|
||||||
}
|
|
||||||
} else if (Destination) {
|
|
||||||
rest.Destination = Destination
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getFlags(TransactionType) && rest.Flags) {
|
if (getFlags(TransactionType) && rest.Flags) {
|
||||||
const flags = extractFlags(TransactionType, rest.Flags)
|
const flags = extractFlags(TransactionType, rest.Flags)
|
||||||
@@ -271,19 +244,27 @@ export const prepareState = (value: string, transactionType?: string) => {
|
|||||||
const isAmount = schemaVal &&
|
const isAmount = schemaVal &&
|
||||||
typeIs(schemaVal, "object") &&
|
typeIs(schemaVal, "object") &&
|
||||||
schemaVal.$type.startsWith('amount.');
|
schemaVal.$type.startsWith('amount.');
|
||||||
|
const isAccount = schemaVal &&
|
||||||
|
typeIs(schemaVal, "object") &&
|
||||||
|
schemaVal.$type.startsWith("account");
|
||||||
|
|
||||||
if (isAmount && ["number", "string"].includes(typeof value)) {
|
if (isAmount && ["number", "string"].includes(typeof value)) {
|
||||||
rest[field] = {
|
rest[field] = {
|
||||||
$type: 'amount.xrp', // Maybe have $type map or something
|
$type: 'amount.xrp', // TODO narrow typed $type.
|
||||||
$value: +value / 1000000 // ! maybe use bigint?
|
$value: +value / 1000000 // ! maybe use bigint?
|
||||||
}
|
}
|
||||||
}
|
} else if (isAmount && typeof value === 'object') {
|
||||||
else if (isAmount && typeof value === 'object') {
|
|
||||||
rest[field] = {
|
rest[field] = {
|
||||||
$type: 'amount.token',
|
$type: 'amount.token',
|
||||||
$value: value
|
$value: value
|
||||||
}
|
}
|
||||||
} else if (typeof value === 'object') {
|
} else if (isAccount) {
|
||||||
|
rest[field] = {
|
||||||
|
$type: "account",
|
||||||
|
$value: value?.toString() || ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (typeof value === 'object') {
|
||||||
rest[field] = {
|
rest[field] = {
|
||||||
$type: 'json',
|
$type: 'json',
|
||||||
$value: value
|
$value: value
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export const tts = {
|
|||||||
ttOFFER_CREATE: 7,
|
ttOFFER_CREATE: 7,
|
||||||
ttOFFER_CANCEL: 8,
|
ttOFFER_CANCEL: 8,
|
||||||
ttTICKET_CREATE: 10,
|
ttTICKET_CREATE: 10,
|
||||||
|
ttTICKET_CANCEL: 11,
|
||||||
ttSIGNER_LIST_SET: 12,
|
ttSIGNER_LIST_SET: 12,
|
||||||
ttPAYCHAN_CREATE: 13,
|
ttPAYCHAN_CREATE: 13,
|
||||||
ttPAYCHAN_FUND: 14,
|
ttPAYCHAN_FUND: 14,
|
||||||
@@ -18,19 +19,20 @@ export const tts = {
|
|||||||
ttDEPOSIT_PREAUTH: 19,
|
ttDEPOSIT_PREAUTH: 19,
|
||||||
ttTRUST_SET: 20,
|
ttTRUST_SET: 20,
|
||||||
ttACCOUNT_DELETE: 21,
|
ttACCOUNT_DELETE: 21,
|
||||||
ttHOOK_SET: 22,
|
ttSET_HOOK: 22,
|
||||||
ttNFTOKEN_MINT: 25,
|
ttURI_TOKEN_MINT: 45,
|
||||||
ttNFTOKEN_BURN: 26,
|
ttURI_TOKEN_BURN: 46,
|
||||||
ttNFTOKEN_CREATE_OFFER: 27,
|
ttURI_TOKEN_BUY: 47,
|
||||||
ttNFTOKEN_CANCEL_OFFER: 28,
|
ttURI_TOKEN_CREATE_SELL_OFFER: 48,
|
||||||
ttNFTOKEN_ACCEPT_OFFER: 29,
|
ttURI_TOKEN_CANCEL_SELL_OFFER: 49,
|
||||||
ttINVOKE: 99,
|
ttIMPORT: 97,
|
||||||
|
ttINVOKE: 99
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TTS = typeof tts
|
export type TTS = typeof tts
|
||||||
|
|
||||||
const calculateHookOn = (arr: (keyof TTS)[]) => {
|
const calculateHookOn = (arr: (keyof TTS)[]) => {
|
||||||
let s = '0x3e3ff5bf'
|
let s = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff'
|
||||||
arr.forEach(n => {
|
arr.forEach(n => {
|
||||||
let v = BigInt(s)
|
let v = BigInt(s)
|
||||||
v ^= BigInt(1) << BigInt(tts[n])
|
v ^= BigInt(1) << BigInt(tts[n])
|
||||||
|
|||||||
@@ -72,20 +72,14 @@ export const getInvokeOptions = (content?: string) => {
|
|||||||
label: opt,
|
label: opt,
|
||||||
value: opt
|
value: opt
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// default
|
|
||||||
if (!invokeOptions.length) {
|
|
||||||
const payment = transactionOptions.find(tx => tx.value === 'ttPAYMENT')
|
|
||||||
if (payment) return [payment]
|
|
||||||
}
|
|
||||||
|
|
||||||
return invokeOptions
|
return invokeOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toHex(str: string) {
|
export function toHex(str: string) {
|
||||||
var result = ''
|
var result = ''
|
||||||
for (var i = 0; i < str.length; i++) {
|
for (var i = 0; i < str.length; i++) {
|
||||||
result += str.charCodeAt(i).toString(16)
|
const hex = str.charCodeAt(i).toString(16)
|
||||||
|
result += hex.padStart(2, '0')
|
||||||
}
|
}
|
||||||
return result.toUpperCase()
|
return result.toUpperCase()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-account-buf-len
|
# 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).
|
This check warns about too-small size of its output buffer (if it's specified by a constant - variable parameter is ignored).
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-account-conv-buf-len
|
# 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).
|
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).
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-account-conv-pure
|
# 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).
|
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).
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-array-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# hooks-burden-prereq
|
# 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).
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-control-string-arg
|
# 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`.
|
For a release version, this check warns about constant strings passed to `accept` and `rollback`.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-detail-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-detail-prereq
|
# 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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-emit-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-emit-prereq
|
# 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)
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
Recursive calls are disallowed in the implementation of hook entry points.
|
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)
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
Shows error on function definitions with unexpected (that is, neither `hook` nor `cbak`) names.
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-entry-points
|
# 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.
|
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)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-fee-prereq
|
# 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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-field-add-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-field-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-field-del-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# hooks-float-arith-pure
|
# 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).
|
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)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-float-compare-pure
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-float-int-pure
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-float-manip-pure
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-float-one-pure
|
# 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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-float-pure
|
# 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.
|
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)
|
||||||
|
|||||||
@@ -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.
|
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.
|
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)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-guard-called
|
# 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)
|
||||||
|
|||||||
@@ -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,
|
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.
|
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)
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ Like for loops, while loops must have a guard in their condition:
|
|||||||
```
|
```
|
||||||
|
|
||||||
<BR/>
|
<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)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-hash-buf-len
|
# 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).
|
This check warns about too-small size of their output buffer (if it's specified by a constant - variable parameter is ignored).
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-keylet-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-param-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-param-set-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-raddr-conv-buf-len
|
# 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).
|
This check warns about invalid sizes of input and output parameters (if they're specified by constants - variable parameters are ignored).
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-raddr-conv-pure
|
# 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).
|
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).
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-reserve-limit
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-skip-hash-buf-len
|
# 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).
|
This check warns about invalid size of its input buffer (if it's specified by a constant - variable parameter is ignored).
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-slot-hash-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-slot-keylet-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-slot-limit
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-slot-sub-limit
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-slot-type-limit
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-state-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-transaction-hash-buf-len
|
# 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).
|
This check warns about too-small size of its output buffer (if it's specified by a constant - variable parameter is ignored).
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-transaction-slot-limit
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-trivial-cbak
|
# 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.
|
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)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# hooks-validate-buf-len
|
# 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).
|
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)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# hooks-verify-buf-len
|
# 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).
|
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).
|
||||||
|
|||||||
44
yarn.lock
44
yarn.lock
@@ -1383,16 +1383,16 @@ balanced-match@^1.0.0:
|
|||||||
resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
|
resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
|
||||||
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
|
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
|
||||||
|
|
||||||
base-x@3.0.9, base-x@^3.0.2, base-x@^3.0.3:
|
base-x@3.0.9, base-x@^3.0.2, base-x@^3.0.3, base-x@^3.0.9:
|
||||||
version "3.0.9"
|
version "3.0.9"
|
||||||
resolved "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz"
|
resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320"
|
||||||
integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==
|
integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
safe-buffer "^5.0.1"
|
safe-buffer "^5.0.1"
|
||||||
|
|
||||||
base64-js@^1.0.2, base64-js@^1.5.1:
|
base64-js@^1.0.2, base64-js@^1.3.1, base64-js@^1.5.1:
|
||||||
version "1.5.1"
|
version "1.5.1"
|
||||||
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
|
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
|
||||||
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
|
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
|
||||||
|
|
||||||
before-after-hook@^2.2.0:
|
before-after-hook@^2.2.0:
|
||||||
@@ -1660,13 +1660,13 @@ buffer-xor@^1.0.3:
|
|||||||
resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9"
|
resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9"
|
||||||
integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==
|
integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==
|
||||||
|
|
||||||
buffer@5.6.0:
|
buffer@6.0.3:
|
||||||
version "5.6.0"
|
version "6.0.3"
|
||||||
resolved "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz"
|
resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
|
||||||
integrity sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==
|
integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
|
||||||
dependencies:
|
dependencies:
|
||||||
base64-js "^1.0.2"
|
base64-js "^1.3.1"
|
||||||
ieee754 "^1.1.4"
|
ieee754 "^1.2.1"
|
||||||
|
|
||||||
buffer@~5.2.1:
|
buffer@~5.2.1:
|
||||||
version "5.2.1"
|
version "5.2.1"
|
||||||
@@ -2813,9 +2813,9 @@ https-proxy-agent@^5.0.0:
|
|||||||
agent-base "6"
|
agent-base "6"
|
||||||
debug "4"
|
debug "4"
|
||||||
|
|
||||||
ieee754@^1.1.4:
|
ieee754@^1.1.4, ieee754@^1.2.1:
|
||||||
version "1.2.1"
|
version "1.2.1"
|
||||||
resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz"
|
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
|
||||||
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
|
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
|
||||||
|
|
||||||
ignore@^4.0.6:
|
ignore@^4.0.6:
|
||||||
@@ -4610,17 +4610,25 @@ ripple-address-codec@^4.2.4:
|
|||||||
base-x "3.0.9"
|
base-x "3.0.9"
|
||||||
create-hash "^1.1.2"
|
create-hash "^1.1.2"
|
||||||
|
|
||||||
ripple-binary-codec@=1.4.2, ripple-binary-codec@^1.1.3, ripple-binary-codec@^1.4.2, ripple-binary-codec@^1.5.0-beta.2:
|
ripple-address-codec@^4.3.0:
|
||||||
version "1.4.2"
|
version "4.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/ripple-binary-codec/-/ripple-binary-codec-1.4.2.tgz#cdc35353e4bc7c3a704719247c82b4c4d0b57dd3"
|
resolved "https://registry.yarnpkg.com/ripple-address-codec/-/ripple-address-codec-4.3.0.tgz#45edeb0312b4fe4607b37b7c4cff467802ad571d"
|
||||||
integrity sha512-EDKIyZMa/6Ay/oNgCwjD9b9CJv0zmBreeHVQeG4BYwy+9GPnIQjNeT5e/aB6OjAnhcmpgbPeBmzwmNVwzxlt0w==
|
integrity sha512-Tvd81i7hpDmNqHvkj6iYlj8Tv3I1Romw5gfjni9eacewJvGV2xe+p2y0FAw39z72qfciRMhQyHvpnviBcWVBNw==
|
||||||
|
dependencies:
|
||||||
|
base-x "^3.0.9"
|
||||||
|
create-hash "^1.1.2"
|
||||||
|
|
||||||
|
ripple-binary-codec@=1.6.0, ripple-binary-codec@^1.1.3, ripple-binary-codec@^1.4.2, ripple-binary-codec@^1.5.0-beta.2:
|
||||||
|
version "1.6.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ripple-binary-codec/-/ripple-binary-codec-1.6.0.tgz#848f93a10363a521f2a158751a873a9e89c25d15"
|
||||||
|
integrity sha512-fa0aMSbh1VOGEHIWCF/VuIvoMoQ/1HLJoBxm+oPNPIDyZJG1uRpLYph1pcvAlDuMutHM3ZHMzWjJpe3AaiMIUA==
|
||||||
dependencies:
|
dependencies:
|
||||||
assert "^2.0.0"
|
assert "^2.0.0"
|
||||||
big-integer "^1.6.48"
|
big-integer "^1.6.48"
|
||||||
buffer "5.6.0"
|
buffer "6.0.3"
|
||||||
create-hash "^1.2.0"
|
create-hash "^1.2.0"
|
||||||
decimal.js "^10.2.0"
|
decimal.js "^10.2.0"
|
||||||
ripple-address-codec "^4.2.4"
|
ripple-address-codec "^4.3.0"
|
||||||
|
|
||||||
ripple-keypairs@^1.0.3:
|
ripple-keypairs@^1.0.3:
|
||||||
version "1.1.3"
|
version "1.1.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user