xrpl.js icon indicating copy to clipboard operation
xrpl.js copied to clipboard

_TypeError: wallet.sign is not a function_ on trustline freeze

Open stingr4y78 opened this issue 2 years ago • 1 comments

TypeError: wallet.sign is not a function

Getting this error from code on mainnet when I'm trying to freeze a trustline, code below minus addresses. any ideas?

if (typeof module !== "undefined") {
  // Use var here because const/let are block-scoped to the if statement.
  var xrpl = require('xrpl')
}

async function main() {
  const PUBLIC_SERVER = "wss://xrplcluster.com/"
  const client = new xrpl.Client(PUBLIC_SERVER)
  const ISSUER = xrpl.Wallet.fromSeed("")
  await client.connect()

  //const peer = xrpl.Wallet.fromSeed(")
  const Wallet = ''

  // Look up current trust lines -----------------------------------------------
  const issuing_address = ''
  const address_to_freeze = ''
  const currency_to_freeze = ''


  console.log('Looking up', currency_to_freeze, 'trust line from',
      issuing_address, 'to', address_to_freeze)
  const account_lines = await client.request({
      "command": "account_lines",
      "account": '',
      "peer": '', // this is the issuer account - Trusts are created from the user wallet
      "ledger_index": "validated"
  }  )
  const trustlines = account_lines.result.lines


  console.log("Found lines:", trustlines)

  // Construct a TrustSet, preserving our existing limit value
  const trust_set = {
      "TransactionType": 'TrustSet',
      "Account": issuing_address,
      "LimitAmount": {
          "value": "100000000000",
          "currency": '',
          "issuer": ''
      },
      "Flags": xrpl.TrustSetFlags.tfSetFreeze
  }

  // Best practice for JavaScript users: use validate(tx_json) to confirm
  // that a transaction is well-formed or throw ValidationError if it isn't.
  xrpl.validate(trust_set)

  console.log('Submitting TrustSet tx:', trust_set)
  const result = await client.submitAndWait(trust_set, { wallet: '' })
  console.log("Transaction result:", result)


  client.disconnect()
}
main().catch(console.error)

stingr4y78 avatar Jun 08 '22 08:06 stingr4y78

My guess would be that it's the line const result = await client.submitAndWait(trust_set { wallet:'' }) - It looks like you're passing in a string when you need to pass in a Wallet object.

JST5000 avatar Jun 08 '22 15:06 JST5000

Closing as inactive, feel free to reopen if the issue is persisting.

JST5000 avatar Dec 14 '22 20:12 JST5000