Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

354
Visualizações
TrustSet - Error: Invalid type to construct an Amount

I would like to set up a trust line to buy XRPL3DAPES, but I get the error "Error: Invalid type to construct an Amount".

I don't understand why this error is displayed.

I looked at the doc many times, but each time I have a different error.

This is my code:

const xrpl = require("xrpl")
const SERVER = "wss://xrplcluster.com/"

const WebSocket = require("ws")
const ws = new WebSocket(SERVER)


ws.on("close", (code, reason) => {
    console.log("Disconnected. \nCode :", code, "\nReason: ", reason)
})


async function main() {

    const xrpl3dapes = {
        addressIssuerWallet: "rLBW9d9cfEY4ZFPbgqKzEpoEHjKeLrotWZ",
        currency: "5852504C33444150455300000000000000000000"
    }

    let response;

    const client = new xrpl.Client(SERVER)
    await client.connect()

    seed = "sXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    const wallet = xrpl.Wallet.fromSeed(seed)

    try{
        response = await client.submitAndWait(wallet.sign(
                    {
                            "TransactionType": "TrustSet",
                            "Account": wallet.address,
                            "Fee": base_fee,
                            "LimitAmount":
                            {
                              "currency": xrpl3dapes.currency,
                              "issuer": xrpl3dapes.addressIssuerWallet,
                              "value": "10000"
                            },
                            "sequence": 1
                    }).tx_blob)
    }
    catch (error){
        console.log(error)
    }

    client.disconnect()
    process.exit(1)
}

main()

Thanks for your help !

EDIT: Base_fee must be a string. Else, we get this error.

tx_json = await client.autofill({
            "TransactionType": "OfferCreate",
            "Account": wallet.address,
            "Fee": base_fee,
            "Flags": 262144,
            "TakerGets": takerGets,
            "TakerPays": takerPays
        })

    response = await client.submitAndWait(wallet.sign(tx_json).tx_blob)
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Your payload seems correct. Can you post couple of other error messages you are getting?

The variable/constant seed isn't declared in above code. But I'm sure it's not the issue, as you might have already fixed it after seeing the error message in the console. If you can post other error messages you are getting, maybe it can help me understand more.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda