@dfinity/agent
Advanced tools
Comparing version 0.19.0 to 0.19.1
@@ -157,3 +157,12 @@ "use strict"; | ||
} | ||
this._host = new URL(location + ''); | ||
// Mainnet and local will have the api route available | ||
const knownHosts = ['ic0.app', 'icp0.io', 'localhost', '127.0.0.1']; | ||
if (location && knownHosts.includes(location.hostname)) { | ||
// If the user is on a boundary-node provided host, we can use the same host for the agent | ||
this._host = new URL(location + ''); | ||
} | ||
else { | ||
this._host = new URL('https://icp-api.io'); | ||
console.warn('Could not infer host from window.location, defaulting to mainnet gateway of https://icp-api.io. Please provide a host to the HttpAgent constructor to avoid this warning.'); | ||
} | ||
} | ||
@@ -160,0 +169,0 @@ // Default is 3, only set from option if greater or equal to 0 |
@@ -126,3 +126,12 @@ import { Principal } from '@dfinity/principal'; | ||
} | ||
this._host = new URL(location + ''); | ||
// Mainnet and local will have the api route available | ||
const knownHosts = ['ic0.app', 'icp0.io', 'localhost', '127.0.0.1']; | ||
if (location && knownHosts.includes(location.hostname)) { | ||
// If the user is on a boundary-node provided host, we can use the same host for the agent | ||
this._host = new URL(location + ''); | ||
} | ||
else { | ||
this._host = new URL('https://icp-api.io'); | ||
console.warn('Could not infer host from window.location, defaulting to mainnet gateway of https://icp-api.io. Please provide a host to the HttpAgent constructor to avoid this warning.'); | ||
} | ||
} | ||
@@ -129,0 +138,0 @@ // Default is 3, only set from option if greater or equal to 0 |
{ | ||
"name": "@dfinity/agent", | ||
"version": "0.19.0", | ||
"version": "0.19.1", | ||
"author": "DFINITY Stiftung <sdk@dfinity.org>", | ||
@@ -53,4 +53,4 @@ "license": "Apache-2.0", | ||
"peerDependencies": { | ||
"@dfinity/candid": "^0.19.0", | ||
"@dfinity/principal": "^0.19.0" | ||
"@dfinity/candid": "^0.19.1", | ||
"@dfinity/principal": "^0.19.1" | ||
}, | ||
@@ -57,0 +57,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1080752
8008