Developer Questions

Ask a Question
Back to All

Send a transaction to my smart contract deployed on xaha network ...

So i have my smart contract deployed ....

..... with its mirrored xrpl account ....

.... as you will see i sent a test transaction , which showed up on the xrpl account but not on the smart contract account.

I am using xumm to send the transaction ie ...

  const payload: any = {
    txjson: {
      TransactionType: 'Payment' as const,
      Amount: String(amount),
      Destination: destination,
      Memos: [
        {
          Memo: {
            MemoData: memoField,
            MemoFormat: "33363331333733303337333033363633333633393336333333363331333733343336333933363636333636353332363633363631333733333336363633363635",
          }
        }
      ]
    },
  }

  console.log()

  if (xummUserToken) {
    payload.user_token = xummUserToken
  }

  try {
    const subscription = await xummClient.payload.createAndSubscribe(
      payload,
      (event) => {
        console.log('New payload event:', event.data)
        if (Object.keys(event.data).indexOf('signed') > -1) {
          return event.data
        }
      }
    )

    const resolvedEvent = await subscription.resolved
    return resolvedEvent
  } catch (error) {
    console.error('Error fetching XUMM payment URL:', error)
    throw new Error('Failed to fetch XUMM payment URL')
  }