@cometh/connect-hosted-sdk
Advanced tools
Comparing version 0.1.0-dev.10 to 0.1.0-dev.11
@@ -33,6 +33,10 @@ import { Bytes } from '@ethersproject/bytes'; | ||
interface Configuration { | ||
oidcUrl: string; | ||
connectUrl: string; | ||
interface AuthConfiguration { | ||
oidcApiURI?: string; | ||
oidcAppURI?: string; | ||
} | ||
interface WalletConfiguration { | ||
oidcAppURI?: string; | ||
connectApiURI?: string; | ||
} | ||
@@ -47,4 +51,5 @@ declare class ComethAuth { | ||
private readonly _oidcApi; | ||
private readonly _oidcUrl; | ||
constructor(_apiKey: string, _configuration: Configuration); | ||
private readonly _oidcApiURI; | ||
private readonly _oidcAppURI; | ||
constructor(_apiKey: string, _configuration: AuthConfiguration); | ||
private _createModal; | ||
@@ -111,5 +116,5 @@ private _hideModal; | ||
private readonly _oidcUrl; | ||
private readonly _connectUrl; | ||
private readonly _connectApiURI; | ||
private readonly _connectApi; | ||
constructor(_apiKey: string, _configuration: Configuration); | ||
constructor(_apiKey: string, _configuration: WalletConfiguration); | ||
private _initializeIframe; | ||
@@ -116,0 +121,0 @@ private _sendMessage; |
@@ -142,2 +142,96 @@ var __defProp = Object.defineProperty; | ||
// src/constants.ts | ||
var DEFAULT_CONFIRMATION_TIME = 60 * 1e3; | ||
var OIDC_API_URI = "https://api.hosted.cometh.io"; | ||
var OIDC_APP_URI = "https://hosted.cometh.io"; | ||
var CONNECT_API_URI = "https://api.connect.cometh.io"; | ||
var networks = { | ||
// Default network: Polygon | ||
137: { | ||
RPCUrl: "https://polygon-rpc.com", | ||
networkName: "Polygon", | ||
currency: "MATIC" | ||
}, | ||
80001: { | ||
RPCUrl: "https://rpc-mumbai.maticvigil.com", | ||
networkName: "Mumbai", | ||
currency: "MATIC" | ||
}, | ||
80002: { | ||
RPCUrl: "https://rpc-amoy.polygon.technology", | ||
networkName: "Amoy", | ||
currency: "MATIC" | ||
}, | ||
43114: { | ||
RPCUrl: "https://avalanche.drpc.org", | ||
networkName: "Avalanche", | ||
currency: "AVAX" | ||
}, | ||
43113: { | ||
RPCUrl: "https://avalanche-fuji-c-chain-rpc.publicnode.com", | ||
networkName: "Fuji", | ||
currency: "AVAX" | ||
}, | ||
3084: { | ||
RPCUrl: "", | ||
networkName: "XL network", | ||
currency: "XL" | ||
}, | ||
100: { | ||
RPCUrl: "https://rpc.gnosischain.com", | ||
networkName: "Gnosis Chain", | ||
currency: "xDai" | ||
}, | ||
10200: { | ||
RPCUrl: "https://nd-244-554-535.p2pify.com/3e6f7fedad74cbc0637859cf91e7d676", | ||
networkName: "Chiado Chain", | ||
currency: "xDai" | ||
}, | ||
4078: { | ||
RPCUrl: "https://muster.alt.technology/", | ||
networkName: "Muster", | ||
currency: "ETH" | ||
}, | ||
2121337: { | ||
RPCUrl: "https://muster-anytrust.alt.technology", | ||
networkName: "Muster Testnet", | ||
currency: "ETH" | ||
}, | ||
17001: { | ||
RPCUrl: "https://rpc.holesky.redstone.xyz", | ||
networkName: "Redstone Holesky", | ||
currency: "ETH" | ||
}, | ||
10: { | ||
RPCUrl: "https://mainnet.optimism.io", | ||
networkName: "Optimism", | ||
currency: "ETH" | ||
}, | ||
11155420: { | ||
RPCUrl: "https://sepolia.optimism.io/", | ||
networkName: "Optimism sepolia", | ||
currency: "ETH" | ||
}, | ||
42161: { | ||
RPCUrl: "https://arb1.arbitrum.io/rpc", | ||
networkName: "Arbitrum One", | ||
currency: "ETH" | ||
}, | ||
421614: { | ||
RPCUrl: "https://sepolia-rollup.arbitrum.io/rpc", | ||
networkName: "Arbitrum sepolia", | ||
currency: "ETH" | ||
}, | ||
8453: { | ||
RPCUrl: "https://mainnet.base.org", | ||
networkName: "Base", | ||
currency: "ETH" | ||
}, | ||
84532: { | ||
RPCUrl: "https://sepolia.base.org", | ||
networkName: "Base sepolia", | ||
currency: "ETH" | ||
} | ||
}; | ||
// src/core/ComethAuth.ts | ||
@@ -153,5 +247,7 @@ var ComethAuth = class { | ||
__publicField(this, "_oidcApi"); | ||
__publicField(this, "_oidcUrl"); | ||
this._oidcUrl = _configuration.oidcUrl; | ||
this._oidcApi = oidcApi(this._oidcUrl, _apiKey); | ||
__publicField(this, "_oidcApiURI"); | ||
__publicField(this, "_oidcAppURI"); | ||
this._oidcApiURI = _configuration.oidcApiURI || OIDC_API_URI; | ||
this._oidcAppURI = _configuration.oidcApiURI || OIDC_APP_URI; | ||
this._oidcApi = oidcApi(this._oidcApiURI, _apiKey); | ||
this._createModal(); | ||
@@ -204,7 +300,7 @@ this._createIframe(); | ||
params.append("client_id", this._apiKey); | ||
params.append("redirect_uri", safeURL(this._oidcUrl, "/iframe/auth/callback")); | ||
params.append("redirect_uri", safeURL(this._oidcAppURI, "/iframe/auth/callback")); | ||
params.append("scope", "openid wallet email profile"); | ||
params.append("code_challenge", pkce.code_challenge); | ||
params.append("code_challenge_method", pkce.method); | ||
this._iframe.src = safeURL(this._oidcUrl, `/auth?${params.toString()}`); | ||
this._iframe.src = safeURL(this._oidcApiURI, `/auth?${params.toString()}`); | ||
} | ||
@@ -217,6 +313,6 @@ _redirectToLogout() { | ||
params.append("client_id", this._apiKey); | ||
this._iframe.src = safeURL(this._oidcUrl, `/auth/logout?${params.toString()}`); | ||
this._iframe.src = safeURL(this._oidcAppURI, `/auth/logout?${params.toString()}`); | ||
} | ||
async _waitMessage(type) { | ||
return communicator_default.waitMessage(type, this._oidcUrl); | ||
return communicator_default.waitMessage(type, this._oidcAppURI); | ||
} | ||
@@ -293,7 +389,7 @@ async _exchangeCodeForToken(result, pkce) { | ||
__publicField(this, "_oidcUrl"); | ||
__publicField(this, "_connectUrl"); | ||
__publicField(this, "_connectApiURI"); | ||
__publicField(this, "_connectApi"); | ||
this._oidcUrl = _configuration.oidcUrl; | ||
this._connectUrl = _configuration.connectUrl; | ||
this._connectApi = new ConnectAPI(this._connectUrl, this._apiKey); | ||
this._oidcUrl = _configuration.oidcAppURI || OIDC_API_URI; | ||
this._connectApiURI = _configuration.connectApiURI || CONNECT_API_URI; | ||
this._connectApi = new ConnectAPI(this._connectApiURI, this._apiKey); | ||
} | ||
@@ -741,95 +837,2 @@ _initializeIframe() { | ||
import { BigNumber } from "@ethersproject/bignumber"; | ||
// src/constants.ts | ||
var DEFAULT_CONFIRMATION_TIME = 60 * 1e3; | ||
var networks = { | ||
// Default network: Polygon | ||
137: { | ||
RPCUrl: "https://polygon-rpc.com", | ||
networkName: "Polygon", | ||
currency: "MATIC" | ||
}, | ||
80001: { | ||
RPCUrl: "https://rpc-mumbai.maticvigil.com", | ||
networkName: "Mumbai", | ||
currency: "MATIC" | ||
}, | ||
80002: { | ||
RPCUrl: "https://rpc-amoy.polygon.technology", | ||
networkName: "Amoy", | ||
currency: "MATIC" | ||
}, | ||
43114: { | ||
RPCUrl: "https://avalanche.drpc.org", | ||
networkName: "Avalanche", | ||
currency: "AVAX" | ||
}, | ||
43113: { | ||
RPCUrl: "https://avalanche-fuji-c-chain-rpc.publicnode.com", | ||
networkName: "Fuji", | ||
currency: "AVAX" | ||
}, | ||
3084: { | ||
RPCUrl: "", | ||
networkName: "XL network", | ||
currency: "XL" | ||
}, | ||
100: { | ||
RPCUrl: "https://rpc.gnosischain.com", | ||
networkName: "Gnosis Chain", | ||
currency: "xDai" | ||
}, | ||
10200: { | ||
RPCUrl: "https://nd-244-554-535.p2pify.com/3e6f7fedad74cbc0637859cf91e7d676", | ||
networkName: "Chiado Chain", | ||
currency: "xDai" | ||
}, | ||
4078: { | ||
RPCUrl: "https://muster.alt.technology/", | ||
networkName: "Muster", | ||
currency: "ETH" | ||
}, | ||
2121337: { | ||
RPCUrl: "https://muster-anytrust.alt.technology", | ||
networkName: "Muster Testnet", | ||
currency: "ETH" | ||
}, | ||
17001: { | ||
RPCUrl: "https://rpc.holesky.redstone.xyz", | ||
networkName: "Redstone Holesky", | ||
currency: "ETH" | ||
}, | ||
10: { | ||
RPCUrl: "https://mainnet.optimism.io", | ||
networkName: "Optimism", | ||
currency: "ETH" | ||
}, | ||
11155420: { | ||
RPCUrl: "https://sepolia.optimism.io/", | ||
networkName: "Optimism sepolia", | ||
currency: "ETH" | ||
}, | ||
42161: { | ||
RPCUrl: "https://arb1.arbitrum.io/rpc", | ||
networkName: "Arbitrum One", | ||
currency: "ETH" | ||
}, | ||
421614: { | ||
RPCUrl: "https://sepolia-rollup.arbitrum.io/rpc", | ||
networkName: "Arbitrum sepolia", | ||
currency: "ETH" | ||
}, | ||
8453: { | ||
RPCUrl: "https://mainnet.base.org", | ||
networkName: "Base", | ||
currency: "ETH" | ||
}, | ||
84532: { | ||
RPCUrl: "https://sepolia.base.org", | ||
networkName: "Base sepolia", | ||
currency: "ETH" | ||
} | ||
}; | ||
// src/utils/RelayTransactionResponse.ts | ||
var RelayTransactionResponse = class { | ||
@@ -836,0 +839,0 @@ constructor(safeTxHash, wallet) { |
{ | ||
"name": "@cometh/connect-hosted-sdk", | ||
"version": "0.1.0-dev.10", | ||
"version": "0.1.0-dev.11", | ||
"author": "Cometh", | ||
@@ -5,0 +5,0 @@ "description": "SDK Cometh Hosted-Connect", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
72733
2040