Skip to content

Commit

Permalink
chore: Update TypeScript dependency to version 5.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
andredezzy committed Aug 4, 2024
1 parent 1f08160 commit 2fe754b
Show file tree
Hide file tree
Showing 11 changed files with 1,950 additions and 1,499 deletions.
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.validate.enable": true,

"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,

"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"package.json": ".eslint*, prettier*, .prettier*, tsconfig*, vite*, pnpm-lock*, bun.lockb, nest*",
"tailwind.config.*": "tailwind.config*, postcss.config*",
".env.local": ".env*",
".env": ".env*"
},
}
49 changes: 0 additions & 49 deletions README.md

This file was deleted.

30 changes: 23 additions & 7 deletions examples/iqoption/typescript/getProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,32 @@ import { Hemes } from '@hemes/core'
import { IQOptionProvider, BaseIQOptionProvider } from '@hemes/iqoption'

async function run() {
const hemes = new Hemes(IQOptionProvider).getProvider<BaseIQOptionProvider>()
try {
const hemes = new Hemes(IQOptionProvider).getProvider<BaseIQOptionProvider>()

const account = await hemes.logIn({
email: String(process.env.TEST_IQOPTION_ACCOUNT_EMAIL),
password: String(process.env.TEST_IQOPTION_ACCOUNT_PASSWORD),
})
const account = await hemes.logIn({
email: String(process.env.TEST_IQOPTION_ACCOUNT_EMAIL),
password: String(process.env.TEST_IQOPTION_ACCOUNT_PASSWORD),
})

const profile = await account.getProfile()
console.time('getProfile')

console.log('\n', 'Has received profile:', !!profile, '\n')
const profile = await account.getProfile()

console.log()
console.log('👤 Profile:', JSON.stringify(profile))
console.log()
console.log('🏦 Balances:', JSON.stringify(profile.balances.map(balance => ({
type: balance.type,
currency: balance.currency,
amount: balance.amount,
}))));
console.log()
console.timeEnd('getProfile')
console.log()
} catch (error) {
console.error(error)
}
}

run()
14 changes: 9 additions & 5 deletions examples/iqoption/typescript/logIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ import { Hemes } from '@hemes/core'
import { BaseIQOptionProvider, IQOptionProvider } from '@hemes/iqoption'

async function run() {
const hemes = new Hemes(IQOptionProvider).getProvider<BaseIQOptionProvider>()
try {
const hemes = new Hemes(IQOptionProvider).getProvider<BaseIQOptionProvider>()

await hemes.logIn({
email: String(process.env.TEST_IQOPTION_ACCOUNT_EMAIL),
password: String(process.env.TEST_IQOPTION_ACCOUNT_PASSWORD),
})
await hemes.logIn({
email: String(process.env.TEST_IQOPTION_ACCOUNT_EMAIL),
password: String(process.env.TEST_IQOPTION_ACCOUNT_PASSWORD),
})
} catch (error) {
console.error(error)
}
}

run()
2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
},
"devDependencies": {
"ts-node": "^9.1.1",
"typescript": "^4.2.3"
"typescript": "^5.5.4"
}
}
76 changes: 42 additions & 34 deletions examples/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,44 @@
# yarn lockfile v1


"@babel/runtime@^7.21.0":
version "7.25.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.25.0.tgz#3af9a91c1b739c569d5d80cc917280919c544ecb"
integrity sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==
dependencies:
regenerator-runtime "^0.14.0"

"@base-sdk/core@^0.1.0-1":
version "0.1.0-1"
resolved "https://registry.yarnpkg.com/@base-sdk/core/-/core-0.1.0-1.tgz#0cc7102a658caa2e783586f7fb705574711f0072"
integrity sha512-FRI5tUq4fr3TU5b077O9gGXrZgAll71wtc+mBPN644xVsntnluMvrbLoCRJd8z5Zp98avkbxkulX8QVoiYFn4g==
version "0.1.5"
resolved "https://registry.yarnpkg.com/@base-sdk/core/-/core-0.1.5.tgz#f0f9bceb46ffa00c50e56f58cb51d36770cad9a5"
integrity sha512-jnP0HvwwWF+dP17rvp/Yafp0qMsfwtj1sVwAySLXim/KXgulWmoeX04ToD79YgZR82e8TVXjNb1Z80mMCea/Gg==
dependencies:
"@reflect-ui/core" "0.0.2-rc.7"
axios "^0.21.0"

"@hemes/core@../packages/core", "@hemes/[email protected].3":
version "0.0.1-next.3"
"@hemes/core@../packages/core", "@hemes/[email protected].4":
version "0.0.1-next.4"

"@hemes/iqoption@../packages/iqoption":
version "0.0.1-next.3"
version "0.0.1-next.4"
dependencies:
"@base-sdk/core" "^0.1.0-1"
"@hemes/core" "0.0.1-next.3"
"@hemes/core" "0.0.1-next.4"
axios "^0.21.1"
date-fns "^2.21.1"
date-fns-timezone "^0.1.4"
md5 "2.3.0"

"@reflect-ui/[email protected]":
version "0.0.2-rc.7"
resolved "https://registry.yarnpkg.com/@reflect-ui/core/-/core-0.0.2-rc.7.tgz#9d531f5a0b9caab31e7563020044b753700e2bbc"
integrity sha512-EqF4SRU57bfa5DOPET1rv5lROFyMVHLv1xTEIlN6N2gDpXt71QceImWfQp3z3Khqnb4R/p9OhNK6DXGUpozWKw==

arg@^4.1.0:
version "4.1.3"
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==

axios@^0.21.0, axios@^0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
version "0.21.4"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575"
integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==
dependencies:
follow-redirects "^1.10.0"
follow-redirects "^1.14.0"

buffer-from@^1.0.0:
version "1.1.2"
Expand All @@ -48,7 +49,7 @@ buffer-from@^1.0.0:
[email protected]:
version "0.0.2"
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=
integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==

[email protected]:
version "2.19.0"
Expand All @@ -63,7 +64,7 @@ create-require@^1.1.0:
[email protected]:
version "0.0.2"
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=
integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==

date-fns-timezone@^0.1.4:
version "0.1.4"
Expand All @@ -79,9 +80,11 @@ date-fns@^1.29.0:
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==

date-fns@^2.21.1:
version "2.23.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.23.0.tgz#4e886c941659af0cf7b30fafdd1eaa37e88788a9"
integrity sha512-5ycpauovVyAk0kXNZz6ZoB9AYMZB4DObse7P3BPWmyEjXNORTI8EJ6X0uaSAq4sCHzM1uajzrkr6HnsLQpxGXA==
version "2.30.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0"
integrity sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==
dependencies:
"@babel/runtime" "^7.21.0"

diff@^4.0.1:
version "4.0.2"
Expand All @@ -93,15 +96,15 @@ dotenv@^8.2.0:
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b"
integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==

follow-redirects@^1.10.0:
version "1.14.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.2.tgz#cecb825047c00f5e66b142f90fed4f515dec789b"
integrity sha512-yLR6WaE2lbF0x4K2qE2p9PEXKLDjUjnR/xmjS3wHAYxtlsI9MLLBJUZirAHKzUZDGLxje7w/cXR49WOUo4rbsA==
follow-redirects@^1.14.0:
version "1.15.6"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==

fs@^0.0.1-security:
version "0.0.1-security"
resolved "https://registry.yarnpkg.com/fs/-/fs-0.0.1-security.tgz#8a7bd37186b6dddf3813f23858b57ecaaf5e41d4"
integrity sha1-invTcYa23d84E/I4WLV+yq9eQdQ=
integrity sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==

is-buffer@~1.1.6:
version "1.1.6"
Expand All @@ -122,10 +125,15 @@ [email protected]:
crypt "0.0.2"
is-buffer "~1.1.6"

regenerator-runtime@^0.14.0:
version "0.14.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f"
integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==

source-map-support@^0.5.17:
version "0.5.19"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
version "0.5.21"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"
Expand Down Expand Up @@ -154,10 +162,10 @@ ts-node@^9.1.1:
source-map-support "^0.5.17"
yn "3.1.1"

typescript@^4.2.3:
version "4.3.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
typescript@^5.5.4:
version "5.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba"
integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==

[email protected]:
version "3.1.1"
Expand Down
2 changes: 2 additions & 0 deletions packages/iqoption/lib/IQOptionAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export class IQOptionAccount implements BaseIQOptionAccount {
}

public async getProfile(): Promise<Profile> {
console.log('Getting profile...')

const profileRequest = await this.webSocket.send(GetProfileRequest)

const balancesRequest = await this.webSocket.send(GetBalancesRequest)
Expand Down
10 changes: 7 additions & 3 deletions packages/iqoption/lib/IQOptionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class IQOptionProvider implements BaseIQOptionProvider {

constructor() {
this.api = axios.create({
baseURL: 'https://iqoption.com/api',
baseURL: 'https://trade.avalonbroker.io/api',
})

this.webSocket = new WebSocketClient()
Expand All @@ -41,10 +41,12 @@ export class IQOptionProvider implements BaseIQOptionProvider {
email,
password,
}: LogInCredentials): Promise<BaseIQOptionAccount> {
this.webSocket.subscribe()
console.log('Logging in...')

await this.webSocket.subscribe()

const authApi = axios.create({
baseURL: 'https://auth.iqoption.com/api/v2',
baseURL: 'https://api.trade.avalonbroker.io/v2/',
})

if (this.isCorsBypassEnabled) {
Expand All @@ -56,6 +58,8 @@ export class IQOptionProvider implements BaseIQOptionProvider {
password,
})

console.log('Logged in')

this.api.defaults.headers.Authorization = `SSID ${response.data.ssid}`

if (response.data.code !== 'success') {
Expand Down
2 changes: 1 addition & 1 deletion packages/iqoption/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export interface WaitForOptions<Message> {
export interface BaseWebSocketClient {
history: WebSocketEventHistory[]

subscribe(): void
subscribe(): Promise<void>

send<Message, Args = undefined>(
Request: EventRequestConstructor<Message, Args>,
Expand Down
Loading

0 comments on commit 2fe754b

Please sign in to comment.