Search code examples
nftxrp

XRPL - NFTokenCreateOffer fails unexpectedly with tecINSUFFICIENT_RESERVE


I have an account on testnet that has minted 1008 NFTs, currently has a balance of over 99XRP, here is the account_info object:

"account_data": {
      "Account": "rUi3ozsZcigj4xWNb2nzTRABunA6HtMpHp",
      "Balance": "99985852",
      "FirstNFTokenSequence": 1007152,
      "Flags": 0,
      "LedgerEntryType": "AccountRoot",
      "MintedNFTokens": 1008,
      "OwnerCount": 44,
      "PreviousTxnID": "0BF1274B7EF1D502D5ED80DC9285951722837F1342EE63B4D747FFAA813FA511",
      "PreviousTxnLgrSeq": 1141143,
      "Sequence": 1008331,
      "index": "4CA7A0E9DD8232B4CFD22DD637D46FFEDD14F8439BF223E6DE8090C5253F4006"
    }

I'm creating an NFTokenCreateOffer transaction for a single NFT in the collection, but receive this response:

  result: {
    Account: 'rUi3ozsZcigj4xWNb2nzTRABunA6HtMpHp',
    Amount: '0',
    Destination: 'rHs5NTQJizXA3kgcbsE1xDjpbsGJWxsDNN',
    Fee: '12',
    Flags: 1,
    LastLedgerSequence: 1141161,
    NFTokenID: '0009000081F44906C586B0C5998FAB1D079DA40D145F3388FBF5CA5C000F5EC2',
    Sequence: 1008330,
    SigningPubKey: 'EDCCB5B00D3A758A7ADB60988E7AAD0E8D543131B791C80E47E7A490DFE6171372',
    TransactionType: 'NFTokenCreateOffer',
    TxnSignature: 'F56F7781D6048C7E48AC454B3101AB115DF37AC23B87C09B04856C52839B1CE76C93EDA91797F3C96E535B5328DE771D0DF7DC7938A8BF53DE929C60900B4B03',
    hash: '0BF1274B7EF1D502D5ED80DC9285951722837F1342EE63B4D747FFAA813FA511',
    ctid: 'C011699700000001',
    meta: {
      AffectedNodes: [Array],
      TransactionIndex: 0,
      TransactionResult: 'tecINSUFFICIENT_RESERVE'
    },
    validated: true,
    date: 781045982,
    ledger_index: 1141143,
    inLedger: 1141143
  },
  id: 12,
  type: 'response',
  warnings: [
    {
      id: 2001,
      message: "This is a clio server. clio only serves validated data. If you want to talk to rippled, include 'ledger_index':'current' in your request"
    }
  ]
}

Here is how I'm calculating what the expected reserve should be:

Base Reserve: 10 XRP
Owner Reserved: 44 items * 2 XRP
Total Reserve: 98 XRP
Cost to create NFT sell offer: 12 drops
Current balance: 99.986 XRP
Balance after sell tx: 99.986 XRP

So there should be plenty in the account right? How can I determine the exact amount that is needed in reserve after creating the sell offer?


Solution

  • Thinking over it more I suspected creating the sell offer could increment the number of items to 45 which would increase the reserve requirement by another 2 XRP...

    I transferred a bit more XRP from another test account and was able to afford the transaction that previously failed due to an insufficient balance. Once successful I ran the account_info command again, turns out I was right, now there are 45 items!

          "Account": "rUi3ozsZcigj4xWNb2nzTRABunA6HtMpHp",
          "Balance": "124985840",
          "FirstNFTokenSequence": 1007152,
          "Flags": 0,
          "LedgerEntryType": "AccountRoot",
          "MintedNFTokens": 1008,
          "OwnerCount": 45,
          "PreviousTxnID": "3D4CAC1C28E278E35B6B5651C06764098C497BE3BDAC3C3C723C87CBF4A81BE3",
          "PreviousTxnLgrSeq": 1173710,
          "Sequence": 1008332,
          "index": "4CA7A0E9DD8232B4CFD22DD637D46FFEDD14F8439BF223E6DE8090C5253F4006"
        }