Skip to content

CreateTransactionFromDTO is not a function #824

Description

@keiyow
  1. Expected behavior and actual behavior.

  2. Steps to reproduce the problem.

When I use symbol-sdk in Vue3 + vite, I get an error and it does not work properly.
If you use getTransactionsById getTransaction after build, i will get an error.

Uncaught (in promise) TypeError: transaction_2.CreateTransactionFromDTO is not a function
    getTransaction(transactionId, transactionGroup) {
        return this.call(this.getTransactionByGroup(transactionId, transactionGroup), (body) => transaction_2.CreateTransactionFromDTO(body));
    }
    /**
     * Gets an array of transactions for different transaction ids
     * @param transactionIds - Array of transactions id and/or hash.
     * @param transactionGroup - Transaction group.
     * @returns Observable<Transaction[]>
     */
    getTransactionsById(transactionIds, transactionGroup) {
        const transactionIdsBody = {
            transactionIds,
        };
        switch (transactionGroup) {
            case TransactionGroup_1.TransactionGroup.Confirmed:
                return this.call(this.transactionRoutesApi.getConfirmedTransactions(transactionIdsBody), (body) => body.map((transactionDTO) => {
                    return transaction_2.CreateTransactionFromDTO(transactionDTO);
                }));
            case TransactionGroup_1.TransactionGroup.Unconfirmed:
                return this.call(this.transactionRoutesApi.getUnconfirmedTransactions(transactionIdsBody), (body) => body.map((transactionDTO) => {
                    return transaction_2.CreateTransactionFromDTO(transactionDTO);
                }));
            case TransactionGroup_1.TransactionGroup.Partial:
                return this.call(this.transactionRoutesApi.getPartialTransactions(transactionIdsBody), (body) => body.map((transactionDTO) => {
                    return transaction_2.CreateTransactionFromDTO(transactionDTO);
                }));
        }
    }

tsconfig

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "strict": true,
    "jsx": "preserve",
    "sourceMap": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "lib": ["esnext", "dom"],
    "baseUrl": "./",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}

vite.config.js

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  server: {
    host: '0.0.0.0',
    port: 80,
    strictPort: true,
  },
  plugins: [vue()],
  resolve: {
    mainFields: ['browser', 'module', 'jsnext:main', 'jsnext'],
    alias: [{
      find: '@/',
      replacement: '/src/',
    }],
  },
  build: {
    target: "es2020",
  },
})
  1. Specifications like the version of the project, operating system, or hardware.
    "buffer": "^6.0.3",
    "events": "^3.3.0",
    "pug": "^3.0.2",
    "rxjs": "^7.1.0",
    "symbol-sdk": "^1.0.3",
    "vue": "^3.2.6",
    "vue-loading-overlay": "^4.0",
    "vue-router": "^4.0.11"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions