Compare commits

...

6 Commits

Author SHA1 Message Date
muzam1l
dc37b1911a Take tx memo data and parameter value as hex. 2023-03-29 15:04:14 +05:30
muzamil
c348868c89 Merge pull request #302 from XRPLF/fix/hook-on
Fix HookOn initial value.
2023-03-28 16:28:35 +05:30
muzam1l
2c3cfebe3a Fix HookOn initial value. 2023-03-28 15:14:43 +05:30
muzamil
6265a9cdbf Merge pull request #300 from XRPLF/fix/to-hex
Fix hex logic.
2023-03-27 21:20:08 +05:30
muzamil
1321b498cf Merge pull request #299 from XRPLF/fix/invoke-tx
Add `Destination` field to Invoke transaction.
2023-03-27 21:18:35 +05:30
muzam1l
2cf18ef61c Add Destination field to Invoke transaction. 2023-03-27 15:32:25 +05:30
5 changed files with 11 additions and 7 deletions

View File

@@ -57,13 +57,13 @@ const Transaction: FC<TransactionProps> = ({ header, state: txState, ...props })
SetHookData['HookParameters']
>((acc, [_, { label, value }]) => {
return acc.concat({
HookParameter: { HookParameterName: toHex(label), HookParameterValue: toHex(value) }
HookParameter: { HookParameterName: toHex(label), HookParameterValue: value }
})
}, [])
const Memos = memos
? Object.entries(memos).reduce<SetHookData['Memos']>((acc, [_, { format, data, type }]) => {
return acc?.concat({
Memo: { MemoData: toHex(data), MemoFormat: toHex(format), MemoType: toHex(type) }
Memo: { MemoData: data, MemoFormat: toHex(format), MemoType: toHex(type) }
})
}, [])
: undefined

View File

@@ -406,7 +406,7 @@ export const TxUI: FC<UIProps> = ({
/>
<Input
css={{ mx: '$2' }}
placeholder="Value"
placeholder="Value (hex-quoted)"
value={value}
onChange={e => {
setState({
@@ -469,7 +469,7 @@ export const TxUI: FC<UIProps> = ({
}}
/>
<Input
placeholder="Data"
placeholder="Data (hex-quoted)"
css={{ mx: '$2' }}
value={memo.data}
onChange={e => {

View File

@@ -287,6 +287,10 @@
},
{
"TransactionType": "Invoke",
"Destination": {
"$type": "account",
"$value": ""
},
"Fee": "12"
},
{

View File

@@ -215,7 +215,7 @@ export const prepareState = (value: string, transactionType?: string) => {
if (HookParameters && HookParameters instanceof Array) {
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;
return acc;
}, {})
@@ -223,7 +223,7 @@ export const prepareState = (value: string, transactionType?: string) => {
if (Memos && Memos instanceof Array) {
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;
return acc;
}, {})

View File

@@ -30,7 +30,7 @@ export const tts = {
export type TTS = typeof tts
const calculateHookOn = (arr: (keyof TTS)[]) => {
let s = '0x3e3ff5bf'
let s = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff'
arr.forEach(n => {
let v = BigInt(s)
v ^= BigInt(1) << BigInt(tts[n])