Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateTransactionFromDTO is not a function #824

Open
keiyow opened this issue Nov 18, 2021 · 0 comments
Open

CreateTransactionFromDTO is not a function #824

keiyow opened this issue Nov 18, 2021 · 0 comments

Comments

@keiyow
Copy link

keiyow commented Nov 18, 2021

  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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant