Skip to content

Commit

Permalink
Fix newKit bug websocket providers in prep for AS v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eelanagaraj authored and martinvol committed May 13, 2022
1 parent f1f02bf commit 3cd772b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/attestation-service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/attestation-service/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@celo/attestation-service",
"version": "1.6.0-dev",
"version": "1.5.0",
"description": "Issues attestation messages for Celo's identity protocol",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down
11 changes: 8 additions & 3 deletions packages/sdk/contractkit/src/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ export const API_KEY_HEADER_KEY = 'apiKey'
* @optional options to pass to the Web3 HttpProvider constructor
*/
export function newKit(url: string, wallet?: ReadOnlyWallet, options?: HttpProviderOptions) {
const web3 = url.endsWith('.ipc')
? new Web3(new Web3.providers.IpcProvider(url, net))
: new Web3(new Web3.providers.HttpProvider(url, options))
let web3: Web3
if (url.endsWith('.ipc')) {
web3 = new Web3(new Web3.providers.IpcProvider(url, net))
} else if (url.toLowerCase().startsWith('http')) {
web3 = new Web3(new Web3.providers.HttpProvider(url, options))
} else {
web3 = new Web3(url)
}
return newKitFromWeb3(web3, wallet)
}

Expand Down

0 comments on commit 3cd772b

Please sign in to comment.