AMOUNT/amounts/native

Native Amounts

From Parameter

AMOUNT
/amounts/native/params
const hookWallet = testContext.hook1
const param1 = new iHookParamEntry(
  new iHookParamName('AMT'),
  new iHookParamValue(floatToLEXfl('1'), true)
)
const builtTx: Invoke = {
  TransactionType: 'Invoke',
  Account: hookWallet.classicAddress,
  HookParameters: [param1.toXrpl()],
}

From Txn

AMOUNT
/amounts/native/txn
const aliceWallet = testContext.alice
const hookWallet = testContext.hook1
const builtTx: Payment = {
  TransactionType: 'Payment',
  Account: aliceWallet.classicAddress,
  Destination: hookWallet.classicAddress,
  Amount: xrpToDrops(1)
}

AMOUNT/amounts/token

Token Amounts

From Parameter

AMOUNT
/amounts/token/params
const hookWallet = testContext.hook1
const issuerWallet = testContext.gw
const assetModel = new AssetModel(10, 'USD', issuerWallet.classicAddress)
const param1 = new iHookParamEntry(
  new iHookParamName('AMT'),
  new iHookParamValue(assetModel.encode(), true)
)
const builtTx: Invoke = {
  TransactionType: 'Invoke',
  Account: hookWallet.classicAddress,
  HookParameters: [param1.toXrpl()],
}

From Txn

AMOUNT
/amounts/token/txn
const hookWallet = testContext.hook1
const amount: IssuedCurrencyAmount = {
  value: '1',
  currency: testContext.ic.currency,
  issuer: testContext.ic.issuer,
}
const builtTx: Payment = {
  TransactionType: 'Payment',
  Account: aliceWallet.classicAddress,
  Destination: hookWallet.classicAddress,
  Amount: amount
}

Was this page helpful?