Skip to content

Commit

Permalink
Passing user agent header (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
sleyter93 authored Sep 22, 2023
1 parent 71f48a1 commit 363cadb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@rsksmart/rif-wallet-bitcoin": "^1.2.0",
"@rsksmart/rif-wallet-core": "^1.0.2",
"@rsksmart/rif-wallet-eip681": "1.0.1",
"@rsksmart/rif-wallet-services": "^1.0.5",
"@rsksmart/rif-wallet-services": "^1.0.7",
"@rsksmart/rif-wallet-token": "^1.0.1",
"@rsksmart/rlogin-dpath": "^1.0.1",
"@rsksmart/rns-resolver.js": "^1.0.1",
Expand Down
17 changes: 10 additions & 7 deletions src/subscriptions/rifSockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
RifWalletServicesSocket,
} from '@rsksmart/rif-wallet-services'
import { Options, setInternetCredentials } from 'react-native-keychain'
import DeviceInfo from 'react-native-device-info'

import { resetSocketState } from 'store/shared/actions/resetSocketState'
import { AppDispatch } from 'store/index'
Expand Down Expand Up @@ -110,13 +111,15 @@ export const rifSockets = ({
onSocketInit(payload, onChange),
)
rifWalletServicesSocket.on('change', onChange)
rifWalletServicesSocket.connect(wallet, fetcher).catch(err => {
if (err instanceof Error) {
setGlobalError(err.message)
} else {
setGlobalError('Error connecting to socket')
}
})
rifWalletServicesSocket
.connect(wallet, fetcher, { 'User-Agent': DeviceInfo.getUserAgentSync() })
.catch(err => {
if (err instanceof Error) {
setGlobalError(err.message)
} else {
setGlobalError('Error connecting to socket')
}
})
}

const disconnectSocket = rifWalletServicesSocket.disconnect
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2116,10 +2116,10 @@
dependencies:
"@rsksmart/rsk-utils" "^1.1.0"

"@rsksmart/rif-wallet-services@^1.0.5":
version "1.0.5"
resolved "https://npm.pkg.github.com/download/@rsksmart/rif-wallet-services/1.0.5/dd97e829db5229df0b7c632e9b9e37c4c0118d96#dd97e829db5229df0b7c632e9b9e37c4c0118d96"
integrity sha512-RjCbqU4aj3Q2Hn5XhhxBqcQnKNgJY/dgGLton4d8k5B5xPDqCxOCvH6W3zyGRQXhqQz+Ax2pPl16L8GqsZwjUA==
"@rsksmart/rif-wallet-services@^1.0.7":
version "1.0.7"
resolved "https://npm.pkg.github.com/download/@rsksmart/rif-wallet-services/1.0.7/097cc0812e126bed6649c0f00ed6cec4606e1860#097cc0812e126bed6649c0f00ed6cec4606e1860"
integrity sha512-2d+lh66VhWXfzM6atUF1vGmo32qIQirN3COQdAsiP4Jgt9OjTtfYR9SOqUfVAxPA+qp/YwLcCk0v6D4sl/YqrA==
dependencies:
"@ethersproject/contracts" "^5.7.0"
"@rsksmart/rif-wallet-abi-enhancer" "*"
Expand Down

0 comments on commit 363cadb

Please sign in to comment.