@notifi-network/notifi-frontend-client
Advanced tools
Comparing version 0.90.8 to 0.90.9-alpha.5
@@ -11,4 +11,5 @@ import { Types, Operations, NotifiService } from '@notifi-network/notifi-graphql'; | ||
}>; | ||
declare type WalletBlockchainWithPublicKey = Extract<Types.WalletBlockchain, 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'OPTIMISM' | 'SOLANA' | 'ZKSYNC' | 'BASE'>; | ||
declare type WalletBlockchainWithPublicKeyAndAddress = Exclude<Types.WalletBlockchain, WalletBlockchainWithPublicKey | 'OFF_CHAIN' | 'EVMOS'>; | ||
declare type WalletBlockchainWithPublicKey = Extract<Types.WalletBlockchain, 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'OPTIMISM' | 'SOLANA' | 'ZKSYNC' | 'BASE' | 'BLAST' | 'CELO' | 'MANTLE' | 'LINEA' | 'SCROLL' | 'MANTA' | 'MONAD' | 'BERACHAIN'>; | ||
declare type WalletBlockchainWithDelegate = 'XION'; | ||
declare type WalletBlockchainWithPublicKeyAndAddress = Exclude<Types.WalletBlockchain, WalletBlockchainWithPublicKey | 'OFF_CHAIN' | 'EVMOS' | WalletBlockchainWithDelegate>; | ||
declare type NotifiConfigWithPublicKey = Readonly<{ | ||
@@ -23,5 +24,23 @@ walletBlockchain: WalletBlockchainWithPublicKey; | ||
}> & NotifiEnvironmentConfiguration; | ||
declare type NotifiFrontendConfiguration = NotifiConfigWithPublicKey | NotifiConfigWithPublicKeyAndAddress; | ||
declare type ConfigFactoryInput = ConfigFactoryInputPublicKeyAndAddress | ConfigFactoryInputPublicKey; | ||
declare type NotifiConfigWithDelegate = Readonly<{ | ||
walletBlockchain: WalletBlockchainWithDelegate; | ||
delegatedAddress: string; | ||
delegatedPublicKey: string; | ||
delegatorAddress: string; | ||
}> & NotifiEnvironmentConfiguration; | ||
declare type NotifiFrontendConfiguration = NotifiConfigWithPublicKey | NotifiConfigWithPublicKeyAndAddress | NotifiConfigWithDelegate; | ||
declare type ConfigFactoryInput = ConfigFactoryInputPublicKeyAndAddress | ConfigFactoryInputPublicKey | ConfigFactoryInputDelegated; | ||
declare const checkIsConfigWithPublicKeyAndAddress: (config: NotifiFrontendConfiguration) => config is NotifiConfigWithPublicKeyAndAddress; | ||
declare const checkIsConfigWithDelegate: (config: NotifiFrontendConfiguration) => config is NotifiConfigWithDelegate; | ||
declare type ConfigFactoryInputDelegated = { | ||
account: Readonly<{ | ||
address: string; | ||
publicKey: string; | ||
delegatorAddress: string; | ||
}>; | ||
tenantId: string; | ||
env: NotifiEnvironment; | ||
walletBlockchain: NotifiConfigWithPublicKeyAndAddress['walletBlockchain']; | ||
storageOption?: NotifiEnvironmentConfiguration['storageOption']; | ||
}; | ||
declare type ConfigFactoryInputPublicKeyAndAddress = { | ||
@@ -403,3 +422,3 @@ account: Readonly<{ | ||
}> | Readonly<{ | ||
walletBlockchain: 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'INJECTIVE' | 'OSMOSIS' | 'NIBIRU' | 'OPTIMISM' | 'ZKSYNC' | 'BASE'; | ||
walletBlockchain: 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'OSMOSIS' | 'ELYS' | 'NEUTRON' | 'ARCHWAY' | 'AXELAR' | 'BERACHAIN' | 'NIBIRU' | 'OPTIMISM' | 'ZKSYNC' | 'INJECTIVE' | 'BASE' | 'BLAST' | 'CELO' | 'MANTLE' | 'LINEA' | 'SCROLL' | 'MANTA' | 'MONAD'; | ||
signMessage: Uint8SignMessageFunction; | ||
@@ -410,2 +429,6 @@ }> | Readonly<{ | ||
}> | Readonly<{ | ||
walletBlockchain: 'XION'; | ||
message: string; | ||
signMessage: XionSignMessageFunction; | ||
}> | Readonly<{ | ||
walletBlockchain: 'ACALA'; | ||
@@ -428,3 +451,3 @@ signMessage: AcalaSignMessageFunction; | ||
}> | Readonly<{ | ||
walletBlockchain: 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'OPTIMISM' | 'ZKSYNC' | 'BASE'; | ||
walletBlockchain: 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'OPTIMISM' | 'ZKSYNC' | 'BASE' | 'BLAST' | 'CELO' | 'MANTLE' | 'LINEA' | 'SCROLL' | 'MANTA' | 'MONAD' | 'BERACHAIN'; | ||
walletPublicKey: string; | ||
@@ -438,2 +461,9 @@ signMessage: Uint8SignMessageFunction; | ||
}> | Readonly<{ | ||
walletBlockchain: 'XION'; | ||
walletPublicKey: string; | ||
signingAddress: string; | ||
signingPubkey: string; | ||
message: string; | ||
signMessage: XionSignMessageFunction; | ||
}> | Readonly<{ | ||
walletBlockchain: 'ACALA'; | ||
@@ -453,2 +483,27 @@ accountAddress: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | Readonly<{ | ||
walletBlockchain: 'INJECTIVE'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | Readonly<{ | ||
walletBlockchain: 'ELYS'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | Readonly<{ | ||
walletBlockchain: 'NEUTRON'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | Readonly<{ | ||
walletBlockchain: 'ARCHWAY'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | Readonly<{ | ||
walletBlockchain: 'AXELAR'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}>; | ||
@@ -459,2 +514,3 @@ declare type ConnectWalletParams = Readonly<{ | ||
}>; | ||
declare type XionSignMessageFunction = (message: Uint8Array) => Promise<string>; | ||
declare type Uint8SignMessageFunction = (message: Uint8Array) => Promise<Uint8Array>; | ||
@@ -466,3 +522,5 @@ declare type AptosSignMessageFunction = (message: string, nonce: number) => Promise<string>; | ||
declare type BeginLoginProps = Omit<Types.BeginLogInByTransactionInput, 'dappAddress'>; | ||
declare type BeginLoginWithWeb3Props = Omit<Types.BeginLogInWithWeb3Input, 'dappAddress' | 'blockchainType'>; | ||
declare type CompleteLoginProps = Omit<Types.CompleteLogInByTransactionInput, 'dappAddress' | 'randomUuid'>; | ||
declare type CompleteLoginWithWeb3Props = Types.CompleteLogInWithWeb3Input; | ||
declare type EnsureWebhookParams = Omit<Types.CreateWebhookTargetMutationVariables, 'name'>; | ||
@@ -492,2 +550,3 @@ declare type FindSubscriptionCardParams = Omit<Types.FindTenantConfigInput, 'tenant'>; | ||
logOut(): Promise<UserState>; | ||
private logInWithWeb3; | ||
logIn(signMessageParams: SignMessageParams): Promise<Types.UserFragmentFragment>; | ||
@@ -499,2 +558,4 @@ private _signMessage; | ||
completeLoginViaTransaction({ walletBlockchain, walletAddress, transactionSignature, }: CompleteLoginProps): Promise<Types.CompleteLogInByTransactionMutation>; | ||
beginLogInWithWeb3({ authType, authAddress, walletPubkey }: BeginLoginWithWeb3Props): Promise<Types.BeginLogInWithWeb3Response>; | ||
completeLogInWithWeb3(input: CompleteLoginWithWeb3Props): Promise<Types.CompleteLogInWithWeb3Mutation>; | ||
getTargetGroups(): Promise<ReadonlyArray<Types.TargetGroupFragmentFragment>>; | ||
@@ -585,2 +646,2 @@ ensureTargetGroup({ name, emailAddress, phoneNumber, telegramId, webhook, discordId, }: Readonly<{ | ||
export { AcalaSignMessageFunction, AlertFrequency, AptosSignMessageFunction, Authorization, AuthorizationStorage, BroadcastEventTypeItem, CardConfigItemV1, CardConfigType, CheckRatio, ConfigFactoryInput, ConfigFactoryInputPublicKey, ConfigFactoryInputPublicKeyAndAddress, ConnectWalletParams, ContactInfo, ContactInfoConfig, CountryCode, CreateFunc, CreateSupportConversationEventTypeItem, CustomHealthCheckItem, CustomToggleTypeItem, CustomTopicTypeItem, CustomTypeBase, DirectPushEventTypeItem, DiscordContactInfo, EmailContactInfo, EnsureWebhookParams$1 as EnsureWebhookParams, EventTypeConfig, EventTypeItem, FetchFunc, FilterOptions, FrontendClientConfigFactory, FusionEventTypeItem, FusionHealthCheckEventTypeItem, FusionMultiThreshholdEventTypeItem, FusionToggleEventTypeItem, FusionTypeBase, GetStorageType, HasStorageType, HealthCheckEventInputsWithCustomPercentage, HealthCheckEventInputsWithIndex, HealthCheckEventTypeItem, HealthCheckInputs, IdentifyFunc, InputItem, InputType, InputsConfig, IntercomCardConfigItemV1, LABEL_TYPE_MENU_LABELS, LabelEventTypeItem, LabelItem, LabelType, LabelsConfig, NotifiConfigWithPublicKey, NotifiConfigWithPublicKeyAndAddress, NotifiEnvironment, NotifiEnvironmentConfiguration, NotifiFrontendClient, NotifiFrontendConfiguration, NotifiFrontendStorage, NotifiStorage, NumberTypeSelect, PriceChangeDataSource, PriceChangeEventTypeItem, Roles, RolesStorage, SIGNING_MESSAGE, SetStorageType, SignMessageParams, SmsContactInfo, StorageDriver, StorageType, SupportedCardConfigType, TelegramContactInfo, ThresholdDirection, TitleSubtitleConfig, TitleSubtitleConfigActive, TitleSubtitleConfigInactive, TradingPairEventTypeItem, TradingPairInputs, Uint8SignMessageFunction, UserState, ValidInputRange, ValueItemConfig, ValueOrRef, ValueTransformFunc, WalletBalanceEventTypeItem, WalletWithSignMessage, WalletWithSignParams, WebhookContactInfo, WebhookHeaders, XMTPTopicTypeItem, checkIsConfigWithPublicKeyAndAddress, createInMemoryStorageDriver, createLocalForageStorageDriver, ensureDiscord, ensureEmail, ensureSms, ensureSourceAndFilters, ensureTarget, ensureTelegram, ensureWebhook, envUrl, newFrontendClient, newFrontendConfig, newNotifiService, newNotifiStorage, normalizeHexString, notNullOrEmpty, packFilterOptions }; | ||
export { AcalaSignMessageFunction, AlertFrequency, AptosSignMessageFunction, Authorization, AuthorizationStorage, BroadcastEventTypeItem, CardConfigItemV1, CardConfigType, CheckRatio, ConfigFactoryInput, ConfigFactoryInputDelegated, ConfigFactoryInputPublicKey, ConfigFactoryInputPublicKeyAndAddress, ConnectWalletParams, ContactInfo, ContactInfoConfig, CountryCode, CreateFunc, CreateSupportConversationEventTypeItem, CustomHealthCheckItem, CustomToggleTypeItem, CustomTopicTypeItem, CustomTypeBase, DirectPushEventTypeItem, DiscordContactInfo, EmailContactInfo, EnsureWebhookParams$1 as EnsureWebhookParams, EventTypeConfig, EventTypeItem, FetchFunc, FilterOptions, FrontendClientConfigFactory, FusionEventTypeItem, FusionHealthCheckEventTypeItem, FusionMultiThreshholdEventTypeItem, FusionToggleEventTypeItem, FusionTypeBase, GetStorageType, HasStorageType, HealthCheckEventInputsWithCustomPercentage, HealthCheckEventInputsWithIndex, HealthCheckEventTypeItem, HealthCheckInputs, IdentifyFunc, InputItem, InputType, InputsConfig, IntercomCardConfigItemV1, LABEL_TYPE_MENU_LABELS, LabelEventTypeItem, LabelItem, LabelType, LabelsConfig, NotifiConfigWithDelegate, NotifiConfigWithPublicKey, NotifiConfigWithPublicKeyAndAddress, NotifiEnvironment, NotifiEnvironmentConfiguration, NotifiFrontendClient, NotifiFrontendConfiguration, NotifiFrontendStorage, NotifiStorage, NumberTypeSelect, PriceChangeDataSource, PriceChangeEventTypeItem, Roles, RolesStorage, SIGNING_MESSAGE, SetStorageType, SignMessageParams, SmsContactInfo, StorageDriver, StorageType, SupportedCardConfigType, TelegramContactInfo, ThresholdDirection, TitleSubtitleConfig, TitleSubtitleConfigActive, TitleSubtitleConfigInactive, TradingPairEventTypeItem, TradingPairInputs, Uint8SignMessageFunction, UserState, ValidInputRange, ValueItemConfig, ValueOrRef, ValueTransformFunc, WalletBalanceEventTypeItem, WalletWithSignMessage, WalletWithSignParams, WebhookContactInfo, WebhookHeaders, XMTPTopicTypeItem, XionSignMessageFunction, checkIsConfigWithDelegate, checkIsConfigWithPublicKeyAndAddress, createInMemoryStorageDriver, createLocalForageStorageDriver, ensureDiscord, ensureEmail, ensureSms, ensureSourceAndFilters, ensureTarget, ensureTelegram, ensureWebhook, envUrl, newFrontendClient, newFrontendConfig, newNotifiService, newNotifiStorage, normalizeHexString, notNullOrEmpty, packFilterOptions }; |
@@ -54,2 +54,3 @@ "use strict"; | ||
SIGNING_MESSAGE: () => SIGNING_MESSAGE, | ||
checkIsConfigWithDelegate: () => checkIsConfigWithDelegate, | ||
checkIsConfigWithPublicKeyAndAddress: () => checkIsConfigWithPublicKeyAndAddress, | ||
@@ -80,2 +81,5 @@ createInMemoryStorageDriver: () => createInMemoryStorageDriver, | ||
}; | ||
var checkIsConfigWithDelegate = (config) => { | ||
return "delegatedAddress" in config; | ||
}; | ||
var evmChains = [ | ||
@@ -89,3 +93,11 @@ "ETHEREUM", | ||
"BASE", | ||
"ZKSYNC" | ||
"BLAST", | ||
"CELO", | ||
"MANTLE", | ||
"LINEA", | ||
"SCROLL", | ||
"MANTA", | ||
"MONAD", | ||
"ZKSYNC", | ||
"BERACHAIN" | ||
]; | ||
@@ -331,2 +343,16 @@ var isEvmChain = (chain) => { | ||
return "ETHEREUM_WALLET"; | ||
case "BLAST": | ||
return "BLAST_WALLET"; | ||
case "CELO": | ||
return "CELO_WALLET"; | ||
case "MANTLE": | ||
return "MANTLE_WALLET"; | ||
case "LINEA": | ||
return "LINEA_WALLET"; | ||
case "MONAD": | ||
return "MONAD_WALLET"; | ||
case "MANTA": | ||
return "MANTA_WALLET"; | ||
case "SCROLL": | ||
return "SCROLL_WALLET"; | ||
case "POLYGON": | ||
@@ -342,2 +368,14 @@ return "POLYGON_WALLET"; | ||
return "ZKSYNC_WALLET"; | ||
case "ARCHWAY": | ||
return "ARCHWAY_WALLET"; | ||
case "ELYS": | ||
return "ELYS_WALLET"; | ||
case "AXELAR": | ||
return "AXELAR_WALLET"; | ||
case "NEUTRON": | ||
return "NEUTRON_WALLET"; | ||
case "BERACHAIN": | ||
return "BERACHAIN_WALLET"; | ||
case "XION": | ||
return "XION_WALLET"; | ||
default: | ||
@@ -1113,2 +1151,4 @@ throw new Error("Unsupported walletType"); | ||
keyPrefix += `:${config.accountAddress}:${config.authenticationKey}`; | ||
} else if (checkIsConfigWithDelegate(config)) { | ||
keyPrefix += `:${config.delegatorAddress}`; | ||
} else { | ||
@@ -1193,2 +1233,4 @@ keyPrefix += `:${config.walletPublicKey}`; | ||
keyPrefix += `:${config.accountAddress}:${config.authenticationKey}`; | ||
} else if (checkIsConfigWithDelegate(config)) { | ||
keyPrefix += `:${config.delegatorAddress}`; | ||
} else { | ||
@@ -1294,2 +1336,54 @@ keyPrefix += `:${config.walletPublicKey}`; | ||
} | ||
async logInWithWeb3(signMessageParams) { | ||
let user = void 0; | ||
if (this._configuration.walletBlockchain !== "XION" || signMessageParams.walletBlockchain !== "XION") { | ||
throw new Error("Wallet blockchain must be XION for loginWithWeb3"); | ||
} | ||
if (checkIsConfigWithDelegate(this._configuration)) { | ||
const { delegatedAddress, delegatedPublicKey, delegatorAddress } = this._configuration; | ||
const { nonce } = await this.beginLogInWithWeb3({ | ||
authAddress: delegatorAddress, | ||
authType: "COSMOS_AUTHZ_GRANT" | ||
}); | ||
const message = `${SIGNING_MESSAGE}${nonce}}`; | ||
const params = { walletBlockchain: "XION", message, signMessage: signMessageParams.signMessage }; | ||
const signature = await this._signMessage({ | ||
signMessageParams: params, | ||
timestamp: Math.round(Date.now() / 1e3) | ||
}); | ||
const { completeLogInWithWeb3 } = await this.completeLogInWithWeb3({ | ||
nonce, | ||
signature, | ||
signedMessage: message, | ||
signingAddress: delegatedAddress, | ||
signingPubkey: delegatedPublicKey | ||
}); | ||
user = completeLogInWithWeb3.user; | ||
} else if (checkIsConfigWithPublicKeyAndAddress(this._configuration)) { | ||
const { authenticationKey, accountAddress } = this._configuration; | ||
const { nonce } = await this.beginLogInWithWeb3({ | ||
authAddress: accountAddress, | ||
authType: "COSMOS_ADR36" | ||
}); | ||
const message = `${SIGNING_MESSAGE}${nonce}}`; | ||
const params = { walletBlockchain: "XION", message, signMessage: signMessageParams.signMessage }; | ||
const signature = await this._signMessage({ | ||
signMessageParams: params, | ||
timestamp: Math.round(Date.now() / 1e3) | ||
}); | ||
const { completeLogInWithWeb3 } = await this.completeLogInWithWeb3({ | ||
nonce, | ||
signature, | ||
signedMessage: message, | ||
signingAddress: accountAddress, | ||
signingPubkey: authenticationKey | ||
}); | ||
user = completeLogInWithWeb3.user; | ||
} | ||
if (user === void 0) { | ||
return Promise.reject("Failed to login"); | ||
} | ||
await this._handleLogInResult(user); | ||
return user; | ||
} | ||
async logIn(signMessageParams) { | ||
@@ -1302,4 +1396,15 @@ const timestamp = Math.round(Date.now() / 1e3); | ||
const { tenantId, walletBlockchain } = this._configuration; | ||
if (walletBlockchain === "XION" && signMessageParams.walletBlockchain === "XION") { | ||
return this.logInWithWeb3(signMessageParams); | ||
} | ||
let loginResult = void 0; | ||
switch (walletBlockchain) { | ||
case "BLAST": | ||
case "BERACHAIN": | ||
case "CELO": | ||
case "MANTLE": | ||
case "LINEA": | ||
case "SCROLL": | ||
case "MANTA": | ||
case "MONAD": | ||
case "BASE": | ||
@@ -1329,2 +1434,6 @@ case "ETHEREUM": | ||
case "OSMOSIS": | ||
case "ELYS": | ||
case "ARCHWAY": | ||
case "AXELAR": | ||
case "NEUTRON": | ||
case "NIBIRU": | ||
@@ -1361,2 +1470,3 @@ case "APTOS": { | ||
case "ETHEREUM": | ||
case "BERACHAIN": | ||
case "POLYGON": | ||
@@ -1366,2 +1476,10 @@ case "ARBITRUM": | ||
case "BINANCE": | ||
case "BASE": | ||
case "BLAST": | ||
case "CELO": | ||
case "MANTLE": | ||
case "LINEA": | ||
case "SCROLL": | ||
case "MANTA": | ||
case "MONAD": | ||
case "OPTIMISM": { | ||
@@ -1380,2 +1498,7 @@ const { walletPublicKey, tenantId } = this._configuration; | ||
case "ZKSYNC": | ||
case "ELYS": | ||
case "NEUTRON": | ||
case "NIBIRU": | ||
case "ARCHWAY": | ||
case "AXELAR": | ||
case "INJECTIVE": { | ||
@@ -1399,2 +1522,11 @@ const { authenticationKey, tenantId } = this._configuration; | ||
} | ||
case "XION": { | ||
const { message } = signMessageParams; | ||
const messageBuffer = new TextEncoder().encode( | ||
message | ||
); | ||
const signedBuffer = await signMessageParams.signMessage(messageBuffer); | ||
const signature = Buffer.from(signedBuffer).toString("base64"); | ||
return signature; | ||
} | ||
case "ACALA": { | ||
@@ -1506,2 +1638,26 @@ const { accountAddress, tenantId } = this._configuration; | ||
} | ||
async beginLogInWithWeb3({ | ||
authType, | ||
authAddress, | ||
walletPubkey | ||
}) { | ||
const { tenantId } = this._configuration; | ||
const result = await this._service.beginLogInWithWeb3({ | ||
dappAddress: tenantId, | ||
authAddress, | ||
blockchainType: this._configuration.walletBlockchain, | ||
authType, | ||
walletPubkey | ||
}); | ||
if (!result.beginLogInWithWeb3.beginLogInWithWeb3Response) { | ||
throw new Error("Failed to begin login process"); | ||
} | ||
return result.beginLogInWithWeb3.beginLogInWithWeb3Response; | ||
} | ||
async completeLogInWithWeb3(input) { | ||
const result = await this._service.completeLogInWithWeb3(__spreadValues({ | ||
signingPubkey: "" | ||
}, input)); | ||
return result; | ||
} | ||
async getTargetGroups() { | ||
@@ -1856,2 +2012,3 @@ var _a, _b; | ||
SIGNING_MESSAGE, | ||
checkIsConfigWithDelegate, | ||
checkIsConfigWithPublicKeyAndAddress, | ||
@@ -1858,0 +2015,0 @@ createInMemoryStorageDriver, |
@@ -213,2 +213,16 @@ import type { Operations, Types } from '@notifi-network/notifi-graphql'; | ||
return 'ETHEREUM_WALLET'; | ||
case 'BLAST': | ||
return 'BLAST_WALLET'; | ||
case 'CELO': | ||
return 'CELO_WALLET'; | ||
case 'MANTLE': | ||
return 'MANTLE_WALLET'; | ||
case 'LINEA': | ||
return 'LINEA_WALLET'; | ||
case 'MONAD': | ||
return 'MONAD_WALLET'; | ||
case 'MANTA': | ||
return 'MANTA_WALLET'; | ||
case 'SCROLL': | ||
return 'SCROLL_WALLET'; | ||
case 'POLYGON': | ||
@@ -224,2 +238,14 @@ return 'POLYGON_WALLET'; | ||
return 'ZKSYNC_WALLET'; | ||
case 'ARCHWAY': | ||
return 'ARCHWAY_WALLET'; | ||
case 'ELYS': | ||
return 'ELYS_WALLET'; | ||
case 'AXELAR': | ||
return 'AXELAR_WALLET'; | ||
case 'NEUTRON': | ||
return 'NEUTRON_WALLET'; | ||
case 'BERACHAIN': | ||
return 'BERACHAIN_WALLET'; | ||
case 'XION': | ||
return 'XION_WALLET'; | ||
default: | ||
@@ -226,0 +252,0 @@ throw new Error('Unsupported walletType'); |
import { Types } from '@notifi-network/notifi-graphql'; | ||
import { NotifiService } from '@notifi-network/notifi-graphql'; | ||
import type { | ||
NotifiConfigWithPublicKey, | ||
NotifiConfigWithPublicKeyAndAddress, | ||
NotifiFrontendConfiguration, | ||
import { | ||
checkIsConfigWithDelegate, | ||
checkIsConfigWithPublicKeyAndAddress, | ||
type NotifiConfigWithPublicKey, | ||
type NotifiConfigWithPublicKeyAndAddress, | ||
type NotifiFrontendConfiguration, | ||
} from '../configuration'; | ||
@@ -34,36 +36,53 @@ import type { | ||
| Readonly<{ | ||
walletBlockchain: 'SOLANA'; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
walletBlockchain: 'SOLANA'; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: | ||
| 'ETHEREUM' | ||
| 'POLYGON' | ||
| 'ARBITRUM' | ||
| 'AVALANCHE' | ||
| 'BINANCE' | ||
| 'INJECTIVE' | ||
| 'OSMOSIS' | ||
| 'NIBIRU' | ||
| 'OPTIMISM' | ||
| 'ZKSYNC' | ||
| 'BASE'; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
walletBlockchain: | ||
| 'ETHEREUM' | ||
| 'POLYGON' | ||
| 'ARBITRUM' | ||
| 'AVALANCHE' | ||
| 'BINANCE' | ||
| 'OSMOSIS' | ||
| 'ELYS' | ||
| 'NEUTRON' | ||
| 'ARCHWAY' | ||
| 'AXELAR' | ||
| 'BERACHAIN' | ||
| 'NIBIRU' | ||
| 'OPTIMISM' | ||
| 'ZKSYNC' | ||
| 'INJECTIVE' | ||
| 'BASE' | ||
| 'BLAST' | ||
| 'CELO' | ||
| 'MANTLE' | ||
| 'LINEA' | ||
| 'SCROLL' | ||
| 'MANTA' | ||
| 'MONAD'; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'APTOS'; | ||
signMessage: AptosSignMessageFunction; | ||
}> | ||
walletBlockchain: 'APTOS'; | ||
signMessage: AptosSignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'ACALA'; | ||
signMessage: AcalaSignMessageFunction; | ||
}> | ||
walletBlockchain: 'XION'; | ||
message: string; | ||
signMessage: XionSignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'NEAR'; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
walletBlockchain: 'ACALA'; | ||
signMessage: AcalaSignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'SUI'; | ||
signMessage: Uint8SignMessageFunction; | ||
}>; | ||
walletBlockchain: 'NEAR'; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'SUI'; | ||
signMessage: Uint8SignMessageFunction; | ||
}>; | ||
@@ -77,44 +96,89 @@ export type WalletWithSignParams = Readonly<{ | ||
| Readonly<{ | ||
walletBlockchain: 'SOLANA'; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
walletBlockchain: 'SOLANA'; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: | ||
| 'ETHEREUM' | ||
| 'POLYGON' | ||
| 'ARBITRUM' | ||
| 'AVALANCHE' | ||
| 'BINANCE' | ||
| 'OPTIMISM' | ||
| 'ZKSYNC' | ||
| 'BASE'; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
walletBlockchain: | ||
| 'ETHEREUM' | ||
| 'POLYGON' | ||
| 'ARBITRUM' | ||
| 'AVALANCHE' | ||
| 'BINANCE' | ||
| 'OPTIMISM' | ||
| 'ZKSYNC' | ||
| 'BASE' | ||
| 'BLAST' | ||
| 'CELO' | ||
| 'MANTLE' | ||
| 'LINEA' | ||
| 'SCROLL' | ||
| 'MANTA' | ||
| 'MONAD' | ||
| 'BERACHAIN' | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'APTOS'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: AptosSignMessageFunction; | ||
}> | ||
walletBlockchain: 'APTOS'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: AptosSignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'ACALA'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: AcalaSignMessageFunction; | ||
}> | ||
walletBlockchain: 'XION'; | ||
walletPublicKey: string; | ||
signingAddress: string; | ||
signingPubkey: string; | ||
message: string; | ||
signMessage: XionSignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'NEAR'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
walletBlockchain: 'ACALA'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: AcalaSignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'SUI'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}>; | ||
walletBlockchain: 'NEAR'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'SUI'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'INJECTIVE'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'ELYS'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'NEUTRON'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'ARCHWAY'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
| Readonly<{ | ||
walletBlockchain: 'AXELAR'; | ||
accountAddress: string; | ||
walletPublicKey: string; | ||
signMessage: Uint8SignMessageFunction; | ||
}> | ||
@@ -127,2 +191,6 @@ export type ConnectWalletParams = Readonly<{ | ||
// TODO: Clean up blockchain-specific dependencies out of this package | ||
export type XionSignMessageFunction = ( | ||
message: Uint8Array, | ||
) => Promise<string>; | ||
export type Uint8SignMessageFunction = ( | ||
@@ -145,2 +213,4 @@ message: Uint8Array, | ||
type BeginLoginWithWeb3Props = Omit<Types.BeginLogInWithWeb3Input, 'dappAddress' | 'blockchainType'>; | ||
type CompleteLoginProps = Omit< | ||
@@ -151,2 +221,4 @@ Types.CompleteLogInByTransactionInput, | ||
type CompleteLoginWithWeb3Props = Types.CompleteLogInWithWeb3Input | ||
type EnsureWebhookParams = Omit< | ||
@@ -167,13 +239,13 @@ Types.CreateWebhookTargetMutationVariables, | ||
| { | ||
status: 'loggedOut'; | ||
} | ||
status: 'loggedOut'; | ||
} | ||
| { | ||
status: 'authenticated'; | ||
authorization: Authorization; | ||
roles: Roles; | ||
} | ||
status: 'authenticated'; | ||
authorization: Authorization; | ||
roles: Roles; | ||
} | ||
| { | ||
status: 'expired'; | ||
authorization: Authorization; | ||
} | ||
status: 'expired'; | ||
authorization: Authorization; | ||
} | ||
>; | ||
@@ -186,3 +258,3 @@ | ||
private _storage: NotifiStorage, | ||
) {} | ||
) { } | ||
@@ -261,2 +333,70 @@ private _clientRandomUuid: string | null = null; | ||
private async logInWithWeb3( | ||
signMessageParams: { | ||
walletBlockchain: 'XION'; | ||
signMessage: XionSignMessageFunction; | ||
}, | ||
): Promise<Types.UserFragmentFragment> { | ||
let user: Types.UserFragmentFragment | undefined = undefined; | ||
if (this._configuration.walletBlockchain !== 'XION' || signMessageParams.walletBlockchain !== 'XION') { | ||
throw new Error('Wallet blockchain must be XION for loginWithWeb3') | ||
} | ||
if (checkIsConfigWithDelegate(this._configuration)) { | ||
const { delegatedAddress, delegatedPublicKey, delegatorAddress } = this._configuration; | ||
const { nonce } = await this.beginLogInWithWeb3({ | ||
authAddress: delegatorAddress, | ||
authType: 'COSMOS_AUTHZ_GRANT', | ||
}) | ||
const message = `${SIGNING_MESSAGE}${nonce}}`; | ||
const params = { walletBlockchain: 'XION', message, signMessage: signMessageParams.signMessage } as const | ||
const signature = await this._signMessage({ | ||
signMessageParams: params, | ||
timestamp: Math.round(Date.now() / 1000), | ||
}); | ||
const { completeLogInWithWeb3 } = await this.completeLogInWithWeb3({ | ||
nonce, | ||
signature, | ||
signedMessage: message, | ||
signingAddress: delegatedAddress, | ||
signingPubkey: delegatedPublicKey | ||
}) | ||
user = completeLogInWithWeb3.user | ||
} | ||
else if (checkIsConfigWithPublicKeyAndAddress(this._configuration)) { | ||
const { authenticationKey, accountAddress } = this._configuration; | ||
const { nonce } = await this.beginLogInWithWeb3({ | ||
authAddress: accountAddress, | ||
authType: 'COSMOS_ADR36', | ||
}) | ||
const message = `${SIGNING_MESSAGE}${nonce}}`; | ||
const params = { walletBlockchain: 'XION', message, signMessage: signMessageParams.signMessage } as const | ||
const signature = await this._signMessage({ | ||
signMessageParams: params, | ||
timestamp: Math.round(Date.now() / 1000), | ||
}); | ||
const { completeLogInWithWeb3 } = await this.completeLogInWithWeb3({ | ||
nonce, | ||
signature, | ||
signedMessage: message, | ||
signingAddress: accountAddress, | ||
signingPubkey: authenticationKey | ||
}) | ||
user = completeLogInWithWeb3.user | ||
} | ||
if (user === undefined) { | ||
return Promise.reject('Failed to login'); | ||
} | ||
await this._handleLogInResult(user) | ||
return user | ||
} | ||
async logIn( | ||
@@ -273,4 +413,16 @@ signMessageParams: SignMessageParams, | ||
if (walletBlockchain === 'XION' && signMessageParams.walletBlockchain === 'XION') { | ||
return this.logInWithWeb3(signMessageParams) | ||
} | ||
let loginResult: Types.UserFragmentFragment | undefined = undefined; | ||
switch (walletBlockchain) { | ||
case 'BLAST': | ||
case 'BERACHAIN': | ||
case 'CELO': | ||
case 'MANTLE': | ||
case 'LINEA': | ||
case 'SCROLL': | ||
case 'MANTA': | ||
case 'MONAD': | ||
case 'BASE': | ||
@@ -300,2 +452,6 @@ case 'ETHEREUM': | ||
case 'OSMOSIS': | ||
case 'ELYS': | ||
case 'ARCHWAY': | ||
case 'AXELAR': | ||
case 'NEUTRON': | ||
case 'NIBIRU': | ||
@@ -341,2 +497,3 @@ case 'APTOS': { | ||
case 'ETHEREUM': | ||
case 'BERACHAIN': | ||
case 'POLYGON': | ||
@@ -346,2 +503,10 @@ case 'ARBITRUM': | ||
case 'BINANCE': | ||
case 'BASE': | ||
case 'BLAST': | ||
case 'CELO': | ||
case 'MANTLE': | ||
case 'LINEA': | ||
case 'SCROLL': | ||
case 'MANTA': | ||
case 'MONAD': | ||
case 'OPTIMISM': { | ||
@@ -358,2 +523,3 @@ const { walletPublicKey, tenantId } = this | ||
); | ||
return signature; | ||
@@ -363,7 +529,25 @@ } | ||
case 'ZKSYNC': | ||
case 'INJECTIVE': { | ||
const { authenticationKey, tenantId } = this | ||
._configuration as NotifiConfigWithPublicKeyAndAddress; | ||
case 'ELYS': | ||
case 'NEUTRON': | ||
case 'NIBIRU': | ||
case 'ARCHWAY': | ||
case 'AXELAR': | ||
case 'INJECTIVE': | ||
{ | ||
const { authenticationKey, tenantId } = this | ||
._configuration as NotifiConfigWithPublicKeyAndAddress; | ||
const messageBuffer = new TextEncoder().encode( | ||
`${SIGNING_MESSAGE}${authenticationKey}${tenantId}${timestamp.toString()}`, | ||
); | ||
const signedBuffer = await signMessageParams.signMessage(messageBuffer); | ||
const signature = Buffer.from(signedBuffer).toString('base64'); | ||
return signature; | ||
} | ||
case 'SOLANA': { | ||
const { walletPublicKey, tenantId } = this | ||
._configuration as NotifiConfigWithPublicKey; | ||
const messageBuffer = new TextEncoder().encode( | ||
`${SIGNING_MESSAGE}${authenticationKey}${tenantId}${timestamp.toString()}`, | ||
`${SIGNING_MESSAGE}${walletPublicKey}${tenantId}${timestamp.toString()}`, | ||
); | ||
@@ -375,7 +559,6 @@ | ||
} | ||
case 'SOLANA': { | ||
const { walletPublicKey, tenantId } = this | ||
._configuration as NotifiConfigWithPublicKey; | ||
case 'XION': { | ||
const { message } = signMessageParams | ||
const messageBuffer = new TextEncoder().encode( | ||
`${SIGNING_MESSAGE}${walletPublicKey}${tenantId}${timestamp.toString()}`, | ||
message | ||
); | ||
@@ -385,3 +568,3 @@ | ||
const signature = Buffer.from(signedBuffer).toString('base64'); | ||
return signature; | ||
return signature | ||
} | ||
@@ -420,5 +603,4 @@ case 'ACALA': { | ||
const message = `${ | ||
`ed25519:` + authenticationKey | ||
}${tenantId}${accountAddress}${timestamp.toString()}`; | ||
const message = `${`ed25519:` + authenticationKey | ||
}${tenantId}${accountAddress}${timestamp.toString()}`; | ||
const textAsBuffer = new TextEncoder().encode(message); | ||
@@ -533,2 +715,33 @@ const hashBuffer = await window.crypto.subtle.digest( | ||
async beginLogInWithWeb3({ | ||
authType, | ||
authAddress, | ||
walletPubkey | ||
}: BeginLoginWithWeb3Props): Promise<Types.BeginLogInWithWeb3Response> { | ||
const { tenantId } = this._configuration; | ||
const result = await this._service.beginLogInWithWeb3({ | ||
dappAddress: tenantId, | ||
authAddress, | ||
blockchainType: this._configuration.walletBlockchain, | ||
authType, | ||
walletPubkey | ||
}); | ||
if (!result.beginLogInWithWeb3.beginLogInWithWeb3Response) { | ||
throw new Error('Failed to begin login process'); | ||
} | ||
return result.beginLogInWithWeb3.beginLogInWithWeb3Response | ||
} | ||
async completeLogInWithWeb3(input: CompleteLoginWithWeb3Props): Promise<Types.CompleteLogInWithWeb3Mutation> { | ||
const result = await this._service.completeLogInWithWeb3({ | ||
signingPubkey: '', | ||
...input, | ||
}); | ||
return result; | ||
} | ||
async getTargetGroups(): Promise< | ||
@@ -905,5 +1118,5 @@ ReadonlyArray<Types.TargetGroupFragmentFragment> | ||
walletBlockchain === 'APTOS' || | ||
walletBlockchain === 'ACALA' || | ||
walletBlockchain === 'NEAR' || | ||
walletBlockchain === 'SUI' | ||
walletBlockchain === 'ACALA' || | ||
walletBlockchain === 'NEAR' || | ||
walletBlockchain === 'SUI' | ||
? params.walletParams.accountAddress | ||
@@ -910,0 +1123,0 @@ : undefined, |
@@ -28,7 +28,17 @@ import { Types } from '@notifi-network/notifi-graphql'; | ||
| 'BASE' | ||
| 'BLAST' | ||
| 'CELO' | ||
| 'MANTLE' | ||
| 'LINEA' | ||
| 'SCROLL' | ||
| 'MANTA' | ||
| 'MONAD' | ||
| 'BERACHAIN' | ||
>; | ||
type WalletBlockchainWithDelegate = 'XION' | ||
type WalletBlockchainWithPublicKeyAndAddress = Exclude< | ||
Types.WalletBlockchain, | ||
WalletBlockchainWithPublicKey | 'OFF_CHAIN' | 'EVMOS' | ||
WalletBlockchainWithPublicKey | 'OFF_CHAIN' | 'EVMOS' | WalletBlockchainWithDelegate | ||
>; | ||
@@ -49,9 +59,19 @@ | ||
export type NotifiConfigWithDelegate = Readonly<{ | ||
walletBlockchain: WalletBlockchainWithDelegate; | ||
delegatedAddress: string; | ||
delegatedPublicKey: string; | ||
delegatorAddress: string; | ||
}> & | ||
NotifiEnvironmentConfiguration; | ||
export type NotifiFrontendConfiguration = | ||
| NotifiConfigWithPublicKey | ||
| NotifiConfigWithPublicKeyAndAddress; | ||
| NotifiConfigWithPublicKeyAndAddress | ||
| NotifiConfigWithDelegate; | ||
export type ConfigFactoryInput = | ||
| ConfigFactoryInputPublicKeyAndAddress | ||
| ConfigFactoryInputPublicKey; | ||
| ConfigFactoryInputPublicKey | ||
| ConfigFactoryInputDelegated; | ||
@@ -64,2 +84,20 @@ export const checkIsConfigWithPublicKeyAndAddress = ( | ||
export const checkIsConfigWithDelegate = ( | ||
config: NotifiFrontendConfiguration, | ||
): config is NotifiConfigWithDelegate => { | ||
return 'delegatedAddress' in config; | ||
} | ||
export type ConfigFactoryInputDelegated = { | ||
account: Readonly<{ | ||
address: string; | ||
publicKey: string; | ||
delegatorAddress: string; | ||
}>; | ||
tenantId: string; | ||
env: NotifiEnvironment; | ||
walletBlockchain: NotifiConfigWithPublicKeyAndAddress['walletBlockchain']; | ||
storageOption?: NotifiEnvironmentConfiguration['storageOption']; | ||
}; | ||
export type ConfigFactoryInputPublicKeyAndAddress = { | ||
@@ -101,3 +139,11 @@ account: Readonly<{ | ||
'BASE', | ||
'BLAST', | ||
'CELO', | ||
'MANTLE', | ||
'LINEA', | ||
'SCROLL', | ||
'MANTA', | ||
'MONAD', | ||
'ZKSYNC', | ||
'BERACHAIN', | ||
] as const; | ||
@@ -104,0 +150,0 @@ |
import { | ||
NotifiEnvironment, | ||
NotifiFrontendConfiguration, | ||
checkIsConfigWithDelegate, | ||
checkIsConfigWithPublicKeyAndAddress, | ||
@@ -24,8 +25,9 @@ } from '../configuration/NotifiFrontendConfiguration'; | ||
): StorageDriver => { | ||
let keyPrefix = `${getEnvPrefix(config.env)}:${config.tenantId}:${ | ||
config.walletBlockchain | ||
}`; | ||
let keyPrefix = `${getEnvPrefix(config.env)}:${config.tenantId}:${config.walletBlockchain | ||
}`; | ||
if (checkIsConfigWithPublicKeyAndAddress(config)) { | ||
keyPrefix += `:${config.accountAddress}:${config.authenticationKey}`; | ||
} else if (checkIsConfigWithDelegate(config)) { | ||
keyPrefix += `:${config.delegatorAddress}`; | ||
} else { | ||
@@ -32,0 +34,0 @@ keyPrefix += `:${config.walletPublicKey}`; |
@@ -6,2 +6,3 @@ import localforage from 'localforage'; | ||
NotifiFrontendConfiguration, | ||
checkIsConfigWithDelegate, | ||
checkIsConfigWithPublicKeyAndAddress, | ||
@@ -31,8 +32,9 @@ } from '../configuration/NotifiFrontendConfiguration'; | ||
): StorageDriver => { | ||
let keyPrefix = `${getEnvPrefix(config.env)}:${config.tenantId}:${ | ||
config.walletBlockchain | ||
}`; | ||
let keyPrefix = `${getEnvPrefix(config.env)}:${config.tenantId}:${config.walletBlockchain | ||
}`; | ||
if (checkIsConfigWithPublicKeyAndAddress(config)) { | ||
keyPrefix += `:${config.accountAddress}:${config.authenticationKey}`; | ||
} else if (checkIsConfigWithDelegate(config)) { | ||
keyPrefix += `:${config.delegatorAddress}`; | ||
} else { | ||
@@ -39,0 +41,0 @@ keyPrefix += `:${config.walletPublicKey}`; |
{ | ||
"name": "@notifi-network/notifi-frontend-client", | ||
"version": "0.90.8", | ||
"version": "0.90.9-alpha.5+a936d88f", | ||
"description": "The frontend client for Notifi", | ||
@@ -35,7 +35,7 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"@notifi-network/notifi-graphql": "^0.90.8", | ||
"@notifi-network/notifi-graphql": "^0.90.9-alpha.5+a936d88f", | ||
"graphql-request": "^6.0.0", | ||
"localforage": "^1.10.0" | ||
}, | ||
"gitHead": "284bc26cd4f16995fafc7c59ce04601c4d2b5841" | ||
"gitHead": "a936d88fa536f87ccb3672c33b3245c583080371" | ||
} |
@@ -92,3 +92,3 @@ # `@notifi/notifi-frontend-client` | ||
This example shows how to create (user subscribe) a Broadcast message alert. | ||
**Scenario#1**: This example shows how to create (user subscribe) a Broadcast message alert. | ||
@@ -111,2 +111,23 @@ ```ts | ||
The `inputs` object is not required for a broadcast message alert, but it might be required for some cases if the topic requires some additional information. | ||
**Scenario#2**: The following example shows how to subscribe a fusion health check alert with additional information (`inputs`). | ||
```ts | ||
const name = `Health check Alerts: ${thresholdDirection} ${threshold}`; | ||
const eventType = { | ||
... | ||
name, | ||
... | ||
}; | ||
const result = client.ensureAlert({ | ||
eventType, | ||
inputs: { | ||
... | ||
[`${name}__healthRatio`]: healthRatio, | ||
[`${name}__healthThresholdDirection`]: thresholdDirection, | ||
}, | ||
}); | ||
``` | ||
## 🔃 Updating the Alert | ||
@@ -113,0 +134,0 @@ |
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
252677
7503
191
3
+ Added@notifi-network/notifi-graphql@0.90.9-alpha.29(transitive)
+ Addedgraphql-ws@5.16.2(transitive)
- Removed@notifi-network/notifi-graphql@0.90.8(transitive)
Updated@notifi-network/notifi-graphql@^0.90.9-alpha.5+a936d88f