Skip to content

Instantly share code, notes, and snippets.

@LTNMinh
Last active November 5, 2024 04:33
Show Gist options
  • Save LTNMinh/0bfc712d6276b79c13d06de45bf69712 to your computer and use it in GitHub Desktop.
Save LTNMinh/0bfc712d6276b79c13d06de45bf69712 to your computer and use it in GitHub Desktop.

Revisions

  1. LTNMinh revised this gist Nov 5, 2024. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions Note.MD
    Original file line number Diff line number Diff line change
    @@ -85,11 +85,14 @@ tsc
    ## 6. Try to debug with breakpoint.
    Add lauch.json in vscode
    ```
    [{
    {
    "version": "0.2.0",
    "configurations":[{
    "type": "node",
    "request": "launch",
    "name": "Launch Program",
    "program": "${workspaceFolder}/js/main.js",
    }]
    }]
    }
    ```
  2. LTNMinh revised this gist Nov 5, 2024. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion Note.MD
    Original file line number Diff line number Diff line change
    @@ -82,4 +82,14 @@ main()
    tsc
    ```

    ## 6. Try to debug with breakpoint.
    ## 6. Try to debug with breakpoint.
    Add lauch.json in vscode
    ```
    [{
    "type": "node",
    "request": "launch",
    "name": "Launch Program",
    "program": "${workspaceFolder}/js/main.js",
    }]
    ```
  3. LTNMinh created this gist Nov 5, 2024.
    85 changes: 85 additions & 0 deletions Note.MD
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,85 @@
    # How to debug cctx using Devcontainer
    ## 1. Create Devcontainer

    In your project.

    Create .devcontainer folder
    Create devcontainer.json inside .devcontainer folder

    ```
    {
    "name": "TypeScript Dev Container",
    "build": {
    "dockerfile": "../Dockerfile",
    "context": "../"
    },
    "customizations": {
    "vscode": {
    "settings": {
    "typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib" // Path to TypeScript SDK
    },
    "extensions": [
    "ms-vscode.vscode-typescript-tslint-plugin", // TypeScript/TSLint support
    "esbenp.prettier-vscode", // Prettier for code formatting
    "dbaeumer.vscode-eslint" // ESLint support
    ]
    }
    }
    }
    ```

    Use vscode or intelliji to open in dev container

    ## 2. Add you exchange file and build the project

    After add new exchange file, you should build the project.
    ```
    npm run build
    ```

    This will make exchange file compiles and usable in the next step.

    ## 3. Add new file main inside folder ts/

    ```
    // ts/main.js
    import ccxt from "./ccxt.js";
    async function main() {
    const keystore = {
    "uid": "REPLACE WITH YOUR APP ID",
    "login": "REPLACE WITH YOUR SESSION ID",
    "apiKey": "REPLACE WITH YOUR SERVER PUBLIC KEY",
    "password": "REPLACE WITH YOUR SESSION PRIVATE KEY",
    "privateKey": "REPLACE WITH YOUR SPEND PRIVATE KEY",
    "secret": "REPLACE WITH YOUR OAUTH SECRET"
    }
    const exchange = new ccxt.your_new_exchange_here(keystore);
    // You code go here
    }
    main()
    ```

    ## 4. Modify tsconfig.json

    ```
    {
    "compilerOptions": {
    ...
    "sourceMap": true, // Uncomment this line.
    ...
    }
    ....
    }
    ```

    ## 5. Build the ts file.

    ```
    tsc
    ```

    ## 6. Try to debug with breakpoint.