wen-moon-ser / moonshot-sdk

NPM package and code examples for creating buy/sell and mint transactions, and calculating the price of any moonshot token on Solana.
https://moonshot.cc
39 stars 9 forks source link

createMint submit interface response Internal server error #22

Open oursy opened 1 day ago

oursy commented 1 day ago

Use createMint.ts An error occurred when using sdk create mint. The following is the error message, sensitive information has been processed


  response: {
    status: 500,
    statusText: 'Internal Server Error',
    headers: Object [AxiosHeaders] {
      date: 'Tue, 26 Nov 2024 14:47:56 GMT',
      'content-type': 'application/json; charset=utf-8',
      'content-length': '57',
      connection: 'keep-alive',
      'x-powered-by': 'Express',
      'access-control-allow-origin': '*',
      'access-control-allow-credentials': 'true',
      etag: 'W/"39-+eULyqAKkSOhQlg5XfAsDbbPpos"',
      vary: 'Accept-Encoding',
      'cf-cache-status': 'DYNAMIC',
      'set-cookie': [Array],
      server: 'cloudflare',
      'cf-ray': '8e8aad26ff298f1f-TPE'
    },
    config: {
      transitional: [Object],
      adapter: [Array],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      env: [Object],
      validateStatus: [Function: validateStatus],
      headers: [Object [AxiosHeaders]],
      method: 'post',
      data: '{"tokenId":"***","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYWlySWQiOiI2NzQ1ZGY5YTY5OGIxOGViYzVmMTlhZDUiLCJ0eEhhc2giOiJZQUI1Q3htV29FS2ZuOG10a1pmVStLUGw4MWc9Iiwic2Vzc2lvbkhhc2giOiIxX2FpcDBQVmJfeGNUQzVPSmxfUUwiLCJ0eElkIjoiNjc0NWRmOWEzNDJlY2FjNjRhNDBlN2NjIiwidHhUeXBlIjoiTUlOVF9CVVkiLCJpbmZyYSI6IlJFVEFJTCIsInVuaXhUaW1lc3RhbXAiOjE3MzI2MzI0NzQ0NDYsImlhdCI6MTczMjYzMjQ3NCwiZXhwIjoxNzMyNjMyNjU0fQ.qV6iJYFX1mTorfY6QVJDWp1qmdpymUdKwLM42hUTuug","signedTransaction":"***"}',
      url: 'https://api.moonshot.cc/tokens/v1/***/submit'
    },
    request: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: true,
      _last: false,
      chunkedEncoding: false,
      shouldKeepAlive: true,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: '1739',
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: true,
      _header: 'POST /tokens/v1/**/submit HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Content-Type: application/json\r\n' +
        'User-Agent: axios/1.7.2\r\n' +
        'Content-Length: 1739\r\n' +
        'Accept-Encoding: gzip, compress, deflate, br\r\n' +
        'Host: api.moonshot.cc\r\n' +
        'Connection: keep-alive\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/tokens/v1/**/submit',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: true,
      host: 'api.moonshot.cc',
      protocol: 'https:',
      _redirectable: [Writable],
      [Symbol(shapeMode)]: false,
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kChunkedBuffer)]: [],
      [Symbol(kChunkedLength)]: 0,
      [Symbol(kSocket)]: [TLSSocket],
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 65536,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    data: { error: 'Internal server error (-zdO9MFv6uP7RHC40h3mZ)' }
  }
}
mavagio commented 1 day ago

hey @oursy, I checked your specific transaction and you got the following error:

Error Code: TradeAmountTooLow. Error Number: 6014. Error Message: Trade amount too low, resulting in 0 costs.

I assume you are trying to Mint and Buy initial supply and with your wallet you are trying to buy more than you have SOL for, can you try with lower amount. Please use the following project and code example here: https://github.com/wen-moon-ser/moonshot-bot-examples/blob/main/src/create-mint/createMint.ts