@notifi-network/notifi-frontend-client
Advanced tools
Comparing version 0.90.9-alpha.15 to 0.90.9-alpha.16
@@ -11,5 +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' | 'BLAST' | 'CELO' | 'MANTLE' | 'LINEA' | 'SCROLL' | 'MANTA' | 'MONAD'>; | ||
declare type WalletBlockchainWithPublicKey = Extract<Types.WalletBlockchain, 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'OPTIMISM' | 'SOLANA' | 'ZKSYNC' | 'BASE' | 'BLAST' | 'CELO' | 'MANTLE' | 'LINEA' | 'SCROLL' | 'MANTA' | 'MONAD' | 'BERACHAIN' | 'EVMOS'>; | ||
declare type WalletBlockchainWithDelegate = 'XION'; | ||
declare type WalletBlockchainWithPublicKeyAndAddress = Exclude<Types.WalletBlockchain, WalletBlockchainWithPublicKey | 'OFF_CHAIN' | 'EVMOS'>; | ||
declare type WalletBlockchainWithPublicKeyAndAddress = Exclude<Types.WalletBlockchain, WalletBlockchainWithPublicKey | 'OFF_CHAIN' | WalletBlockchainWithDelegate>; | ||
declare type NotifiConfigWithPublicKey = Readonly<{ | ||
@@ -42,3 +42,3 @@ walletBlockchain: WalletBlockchainWithPublicKey; | ||
env?: NotifiEnvironment; | ||
walletBlockchain: NotifiConfigWithPublicKeyAndAddress['walletBlockchain']; | ||
walletBlockchain: WalletBlockchainWithDelegate; | ||
storageOption?: NotifiEnvironmentConfiguration['storageOption']; | ||
@@ -65,3 +65,3 @@ }; | ||
}; | ||
declare type FrontendClientConfigFactory<T extends NotifiFrontendConfiguration> = (args: T extends NotifiConfigWithPublicKeyAndAddress ? ConfigFactoryInputPublicKeyAndAddress : ConfigFactoryInputPublicKey) => NotifiFrontendConfiguration; | ||
declare type FrontendClientConfigFactory<T extends NotifiFrontendConfiguration> = (args: T extends NotifiConfigWithPublicKeyAndAddress ? ConfigFactoryInputPublicKeyAndAddress : T extends NotifiConfigWithDelegate ? ConfigFactoryInputDelegated : ConfigFactoryInputPublicKey) => NotifiFrontendConfiguration; | ||
declare const newFrontendConfig: (config: ConfigFactoryInput) => NotifiFrontendConfiguration; | ||
@@ -94,57 +94,2 @@ declare const envUrl: (env?: NotifiEnvironment, endpointType?: 'websocket' | 'http') => string; | ||
declare type FusionEventMetadata = { | ||
uiConfigOverride?: { | ||
topicDisplayName?: string; | ||
historyDisplayName?: string; | ||
icon?: Types.GenericEventIconHint; | ||
customIconUrl?: string; | ||
isSubscriptionValueInputable?: boolean; | ||
}; | ||
filters: Array<Filter>; | ||
}; | ||
/** | ||
* @param name - `string` unique name | ||
*/ | ||
declare type Filter = AlertFilter | FrequencyFilter; | ||
declare type FilterBase = { | ||
name: string; | ||
executionPriority: number; | ||
}; | ||
declare type FrequencyFilter = FilterBase & { | ||
minimumDurationBetweenTriggersInMinutes: number; | ||
}; | ||
declare type AlertFilter = FilterBase & { | ||
userInputParams: UserInputParam<UiType>[]; | ||
type: FilterType; | ||
staticFilterParams?: Record<string, object | string | number>; | ||
requiredParserVariables: Array<RequiredParserVariable>; | ||
description: string; | ||
}; | ||
declare type RequiredParserVariable = { | ||
variableName: string; | ||
variableType: ValueType; | ||
variableDescription: string; | ||
}; | ||
declare type ValueType = 'integer' | 'price' | 'percentage' | 'string'; | ||
/** | ||
* @param UiType - `radio` or `button` (scalable). Define what component should be rendered in Card topic subscription view. | ||
* @param defaultValue - The value for default alert subscription | ||
*/ | ||
declare type UserInputParam<T extends UiType> = { | ||
name: string; | ||
kind: ValueType; | ||
uiType: T; | ||
description: string; | ||
options: (string | number)[]; | ||
defaultValue: string | number; | ||
allowCustomInput?: boolean; | ||
}; | ||
declare type UiType = 'radio' | 'button'; | ||
declare type FilterType = 'AlertFilter'; | ||
declare type FusionFilterOptions = { | ||
version: 1; | ||
input: Record<Filter['name'], UserInputOptions>; | ||
}; | ||
declare type UserInputOptions = Record<UserInputParam<UiType>['name'], UserInputParam<UiType>['options'][number]>; | ||
declare const normalizeHexString: (input: string) => string; | ||
@@ -276,3 +221,3 @@ declare type TradingPairInputs = { | ||
}> | Readonly<{ | ||
walletBlockchain: 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'OSMOSIS' | 'NIBIRU' | 'OPTIMISM' | 'ZKSYNC' | 'INJECTIVE' | 'BASE' | 'BLAST' | 'CELO' | 'MANTLE' | 'LINEA' | 'SCROLL' | 'MANTA' | 'MONAD'; | ||
walletBlockchain: 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'OSMOSIS' | 'ELYS' | 'NEUTRON' | 'ARCHWAY' | 'AXELAR' | 'BERACHAIN' | 'NIBIRU' | 'OPTIMISM' | 'ZKSYNC' | 'INJECTIVE' | 'BASE' | 'BLAST' | 'CELO' | 'MANTLE' | 'LINEA' | 'SCROLL' | 'MANTA' | 'EVMOS' | 'MONAD'; | ||
signMessage: Uint8SignMessageFunction; | ||
@@ -304,3 +249,3 @@ }> | Readonly<{ | ||
}> | Readonly<{ | ||
walletBlockchain: 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'OPTIMISM' | 'ZKSYNC' | 'BASE' | 'BLAST' | 'CELO' | 'MANTLE' | 'LINEA' | 'SCROLL' | 'MANTA' | 'MONAD'; | ||
walletBlockchain: 'ETHEREUM' | 'POLYGON' | 'ARBITRUM' | 'AVALANCHE' | 'BINANCE' | 'OPTIMISM' | 'ZKSYNC' | 'BASE' | 'BLAST' | 'CELO' | 'MANTLE' | 'LINEA' | 'SCROLL' | 'MANTA' | 'MONAD' | 'EVMOS' | 'BERACHAIN'; | ||
walletPublicKey: string; | ||
@@ -340,2 +285,22 @@ signMessage: Uint8SignMessageFunction; | ||
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; | ||
}>; | ||
@@ -674,2 +639,62 @@ declare type ConnectWalletParams = Readonly<{ | ||
declare type FusionEventMetadata = { | ||
uiConfigOverride?: { | ||
topicDisplayName?: string; | ||
historyDisplayName?: string; | ||
icon?: Types.GenericEventIconHint; | ||
customIconUrl?: string; | ||
isSubscriptionValueInputable?: boolean; | ||
subscriptionValueOrRef?: ValueOrRef<InputObject[]>; | ||
}; | ||
filters: Array<Filter>; | ||
}; | ||
declare type InputObject = { | ||
label: string; | ||
value: string; | ||
}; | ||
/** | ||
* @param name - `string` unique name | ||
*/ | ||
declare type Filter = AlertFilter | FrequencyFilter; | ||
declare type FilterBase = { | ||
name: string; | ||
executionPriority: number; | ||
}; | ||
declare type FrequencyFilter = FilterBase & { | ||
minimumDurationBetweenTriggersInMinutes: number; | ||
}; | ||
declare type AlertFilter = FilterBase & { | ||
userInputParams: UserInputParam<UiType>[]; | ||
type: FilterType; | ||
staticFilterParams?: Record<string, object | string | number>; | ||
requiredParserVariables: Array<RequiredParserVariable>; | ||
description: string; | ||
}; | ||
declare type RequiredParserVariable = { | ||
variableName: string; | ||
variableType: ValueType; | ||
variableDescription: string; | ||
}; | ||
declare type ValueType = 'integer' | 'price' | 'percentage' | 'string'; | ||
/** | ||
* @param UiType - `radio` or `button` (scalable). Define what component should be rendered in Card topic subscription view. | ||
* @param defaultValue - The value for default alert subscription | ||
*/ | ||
declare type UserInputParam<T extends UiType> = { | ||
name: string; | ||
kind: ValueType; | ||
uiType: T; | ||
description: string; | ||
options: (string | number)[]; | ||
defaultValue: string | number; | ||
allowCustomInput?: boolean; | ||
}; | ||
declare type UiType = 'radio' | 'button'; | ||
declare type FilterType = 'AlertFilter'; | ||
declare type FusionFilterOptions = { | ||
version: 1; | ||
input: Record<Filter['name'], UserInputOptions>; | ||
}; | ||
declare type UserInputOptions = Record<UserInputParam<UiType>['name'], UserInputParam<UiType>['options'][number]>; | ||
declare const packFilterOptions: (clientOptions: Readonly<FilterOptions> | null) => string; | ||
@@ -682,2 +707,3 @@ | ||
declare const resolveCheckRatioArrayRef: ResolveFunc<readonly CheckRatio[]>; | ||
declare const resolveObjectArrayRef: ResolveFunc<readonly InputObject[]>; | ||
@@ -692,2 +718,2 @@ /** | ||
export { AcalaSignMessageFunction, AlertFilter, AlertFrequency, AptosSignMessageFunction, Authorization, AuthorizationStorage, BroadcastEventTypeItem, CardConfigItemV1, CardConfigType, CheckRatio, ConfigFactoryInput, ConfigFactoryInputDelegated, ConfigFactoryInputPublicKey, ConfigFactoryInputPublicKeyAndAddress, ConnectWalletParams, ContactInfo, ContactInfoConfig, CountryCode, CreateFunc, CustomHealthCheckItem, CustomToggleTypeItem, CustomTopicTypeItem, CustomTypeBase, DirectPushEventTypeItem, DiscordContactInfo, EmailContactInfo, EnsureWebhookParams$1 as EnsureWebhookParams, EventTypeConfig, EventTypeItem, FetchFunc, Filter, FilterBase, FilterOptions, FilterType, FrequencyFilter, FrontendClientConfigFactory, FusionEventMetadata, FusionEventTopic, FusionEventTypeItem, FusionFilterOptions, FusionHealthCheckEventTypeItem, FusionMultiThreshholdEventTypeItem, FusionToggleEventTypeItem, FusionTypeBase, GetStorageType, HasStorageType, HealthCheckEventInputsWithCustomPercentage, HealthCheckEventInputsWithIndex, HealthCheckEventTypeItem, HealthCheckInputs, IdentifyFunc, InputItem, InputType, InputsConfig, LabelEventTypeItem, NotifiConfigWithDelegate, NotifiConfigWithPublicKey, NotifiConfigWithPublicKeyAndAddress, NotifiEnvironment, NotifiEnvironmentConfiguration, NotifiFrontendClient, NotifiFrontendConfiguration, NotifiFrontendStorage, NotifiStorage, NumberTypeSelect, PriceChangeDataSource, PriceChangeEventTypeItem, RequiredParserVariable, Roles, RolesStorage, SIGNING_MESSAGE, SetStorageType, SignMessageParams, SmsContactInfo, StorageDriver, StorageType, SupportedCardConfigType, TelegramContactInfo, TenantConfig, ThresholdDirection, TitleSubtitleConfig, TitleSubtitleConfigActive, TitleSubtitleConfigInactive, TradingPairEventTypeItem, TradingPairInputs, UiType, Uint8SignMessageFunction, UserInputOptions, UserInputParam, UserState, ValidInputRange, ValueItemConfig, ValueOrRef, ValueTransformFunc, ValueType, WalletBalanceEventTypeItem, WalletWithSignMessage, WalletWithSignParams, WebhookContactInfo, WebhookHeaders, XMTPTopicTypeItem, XionSignMessageFunction, checkIsConfigWithDelegate, checkIsConfigWithPublicKeyAndAddress, createInMemoryStorageDriver, createLocalForageStorageDriver, ensureDiscord, ensureEmail, ensureSlack, ensureSms, ensureSourceAndFilters, ensureTarget, ensureTelegram, ensureWebhook, envUrl, newFrontendClient, newFrontendConfig, newNotifiService, newNotifiStorage, normalizeHexString, notNullOrEmpty, objectKeys, packFilterOptions, resolveCheckRatioArrayRef, resolveNumberRef, resolveStringArrayRef, resolveStringRef }; | ||
export { AcalaSignMessageFunction, AlertFilter, AlertFrequency, AptosSignMessageFunction, Authorization, AuthorizationStorage, BroadcastEventTypeItem, CardConfigItemV1, CardConfigType, CheckRatio, ConfigFactoryInput, ConfigFactoryInputDelegated, ConfigFactoryInputPublicKey, ConfigFactoryInputPublicKeyAndAddress, ConnectWalletParams, ContactInfo, ContactInfoConfig, CountryCode, CreateFunc, CustomHealthCheckItem, CustomToggleTypeItem, CustomTopicTypeItem, CustomTypeBase, DirectPushEventTypeItem, DiscordContactInfo, EmailContactInfo, EnsureWebhookParams$1 as EnsureWebhookParams, EventTypeConfig, EventTypeItem, FetchFunc, Filter, FilterBase, FilterOptions, FilterType, FrequencyFilter, FrontendClientConfigFactory, FusionEventMetadata, FusionEventTopic, FusionEventTypeItem, FusionFilterOptions, FusionHealthCheckEventTypeItem, FusionMultiThreshholdEventTypeItem, FusionToggleEventTypeItem, FusionTypeBase, GetStorageType, HasStorageType, HealthCheckEventInputsWithCustomPercentage, HealthCheckEventInputsWithIndex, HealthCheckEventTypeItem, HealthCheckInputs, IdentifyFunc, InputItem, InputObject, InputType, InputsConfig, LabelEventTypeItem, NotifiConfigWithDelegate, NotifiConfigWithPublicKey, NotifiConfigWithPublicKeyAndAddress, NotifiEnvironment, NotifiEnvironmentConfiguration, NotifiFrontendClient, NotifiFrontendConfiguration, NotifiFrontendStorage, NotifiStorage, NumberTypeSelect, PriceChangeDataSource, PriceChangeEventTypeItem, RequiredParserVariable, Roles, RolesStorage, SIGNING_MESSAGE, SetStorageType, SignMessageParams, SmsContactInfo, StorageDriver, StorageType, SupportedCardConfigType, TelegramContactInfo, TenantConfig, ThresholdDirection, TitleSubtitleConfig, TitleSubtitleConfigActive, TitleSubtitleConfigInactive, TradingPairEventTypeItem, TradingPairInputs, UiType, Uint8SignMessageFunction, UserInputOptions, UserInputParam, UserState, ValidInputRange, ValueItemConfig, ValueOrRef, ValueTransformFunc, ValueType, WalletBalanceEventTypeItem, WalletWithSignMessage, WalletWithSignParams, WebhookContactInfo, WebhookHeaders, XMTPTopicTypeItem, XionSignMessageFunction, checkIsConfigWithDelegate, checkIsConfigWithPublicKeyAndAddress, createInMemoryStorageDriver, createLocalForageStorageDriver, ensureDiscord, ensureEmail, ensureSlack, ensureSms, ensureSourceAndFilters, ensureTarget, ensureTelegram, ensureWebhook, envUrl, newFrontendClient, newFrontendConfig, newNotifiService, newNotifiStorage, normalizeHexString, notNullOrEmpty, objectKeys, packFilterOptions, resolveCheckRatioArrayRef, resolveNumberRef, resolveObjectArrayRef, resolveStringArrayRef, resolveStringRef }; |
@@ -236,2 +236,14 @@ import type { Operations, Types } from '@notifi-network/notifi-graphql'; | ||
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: | ||
@@ -238,0 +250,0 @@ throw new Error('Unsupported walletType'); |
@@ -49,2 +49,7 @@ import { Types } from '@notifi-network/notifi-graphql'; | ||
| 'OSMOSIS' | ||
| 'ELYS' | ||
| 'NEUTRON' | ||
| 'ARCHWAY' | ||
| 'AXELAR' | ||
| 'BERACHAIN' | ||
| 'NIBIRU' | ||
@@ -61,2 +66,3 @@ | 'OPTIMISM' | ||
| 'MANTA' | ||
| 'EVMOS' | ||
| 'MONAD'; | ||
@@ -114,3 +120,5 @@ signMessage: Uint8SignMessageFunction; | ||
| 'MANTA' | ||
| 'MONAD'; | ||
| 'MONAD' | ||
| 'EVMOS' | ||
| 'BERACHAIN'; | ||
walletPublicKey: string; | ||
@@ -156,2 +164,26 @@ signMessage: Uint8SignMessageFunction; | ||
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; | ||
}>; | ||
@@ -399,2 +431,3 @@ | ||
case 'BLAST': | ||
case 'BERACHAIN': | ||
case 'CELO': | ||
@@ -414,2 +447,3 @@ case 'MANTLE': | ||
case 'ZKSYNC': | ||
case 'EVMOS': | ||
case 'SOLANA': { | ||
@@ -431,2 +465,6 @@ const result = await this._service.logInFromDapp({ | ||
case 'OSMOSIS': | ||
case 'ELYS': | ||
case 'ARCHWAY': | ||
case 'AXELAR': | ||
case 'NEUTRON': | ||
case 'NIBIRU': | ||
@@ -472,2 +510,3 @@ case 'APTOS': { | ||
case 'ETHEREUM': | ||
case 'BERACHAIN': | ||
case 'POLYGON': | ||
@@ -485,2 +524,3 @@ case 'ARBITRUM': | ||
case 'MONAD': | ||
case 'EVMOS': | ||
case 'OPTIMISM': { | ||
@@ -502,2 +542,7 @@ const { walletPublicKey, tenantId } = this | ||
case 'ZKSYNC': | ||
case 'ELYS': | ||
case 'NEUTRON': | ||
case 'NIBIRU': | ||
case 'ARCHWAY': | ||
case 'AXELAR': | ||
case 'INJECTIVE': { | ||
@@ -504,0 +549,0 @@ const { authenticationKey, tenantId } = this |
@@ -35,2 +35,6 @@ import { Types } from '@notifi-network/notifi-graphql'; | ||
| 'MONAD' | ||
| 'BERACHAIN' | ||
| 'EVMOS' | ||
>; | ||
@@ -42,3 +46,5 @@ | ||
Types.WalletBlockchain, | ||
WalletBlockchainWithPublicKey | 'OFF_CHAIN' | 'EVMOS' | ||
| WalletBlockchainWithPublicKey | ||
| 'OFF_CHAIN' | ||
| WalletBlockchainWithDelegate | ||
>; | ||
@@ -87,3 +93,3 @@ | ||
return 'delegatedAddress' in config; | ||
} | ||
}; | ||
@@ -98,3 +104,3 @@ export type ConfigFactoryInputDelegated = { | ||
env?: NotifiEnvironment; | ||
walletBlockchain: NotifiConfigWithPublicKeyAndAddress['walletBlockchain']; | ||
walletBlockchain: WalletBlockchainWithDelegate; | ||
storageOption?: NotifiEnvironmentConfiguration['storageOption']; | ||
@@ -128,3 +134,3 @@ }; | ||
? ConfigFactoryInputPublicKeyAndAddress | ||
: ConfigFactoryInputPublicKey, | ||
: T extends NotifiConfigWithDelegate ? ConfigFactoryInputDelegated : ConfigFactoryInputPublicKey, | ||
) => NotifiFrontendConfiguration; | ||
@@ -148,2 +154,3 @@ | ||
'ZKSYNC', | ||
'BERACHAIN', | ||
] as const; | ||
@@ -186,3 +193,17 @@ | ||
const validateConfigInput = ( | ||
const configFactoryDelegated: FrontendClientConfigFactory< | ||
NotifiConfigWithDelegate | ||
> = (args) => { | ||
return { | ||
tenantId: args.tenantId, | ||
env: args.env, | ||
walletBlockchain: args.walletBlockchain, | ||
delegatedAddress: args.account.address, | ||
delegatedPublicKey: args.account.publicKey, | ||
delegatorAddress: args.account.delegatorAddress, | ||
storageOption: args.storageOption, | ||
}; | ||
} | ||
const isWithPubkeyAndAddress = ( | ||
config: ConfigFactoryInput, | ||
@@ -193,8 +214,18 @@ ): config is ConfigFactoryInputPublicKeyAndAddress => { | ||
const isWithDelegate = ( | ||
config: ConfigFactoryInput, | ||
): config is ConfigFactoryInputDelegated => { | ||
return 'delegatorAddress' in config.account; | ||
} | ||
export const newFrontendConfig = ( | ||
config: ConfigFactoryInput, | ||
): NotifiFrontendConfiguration => { | ||
return validateConfigInput(config) | ||
? configFactoryPublicKeyAndAddress(config) | ||
: configFactoryPublicKey(config); | ||
if (isWithPubkeyAndAddress(config)) { | ||
return configFactoryPublicKeyAndAddress(config); | ||
} else if (isWithDelegate(config)) { | ||
return configFactoryDelegated(config); | ||
} else { | ||
return configFactoryPublicKey(config); | ||
} | ||
}; | ||
@@ -221,2 +252,2 @@ | ||
return `${endpointType === 'websocket' ? 'wss' : 'https'}${url}`; | ||
}; | ||
}; |
import { Types } from '@notifi-network/notifi-graphql'; | ||
import { ValueOrRef } from './SubscriptionCardConfig'; | ||
export type FusionEventMetadata = { | ||
@@ -10,2 +12,10 @@ uiConfigOverride?: { | ||
isSubscriptionValueInputable?: boolean; | ||
subscriptionValueOrRef?: ValueOrRef<InputObject[]>; | ||
/* NOTE: the generic type | ||
* 1. if it is a value type, it will be any array with only one element. And the string must be '*'. This case, isSubscriptionValueInputable must be false or undefined. | ||
- {type: 'value', value: [{label: '', value: '*'}]}: In this case, we do not care the label because we will not render any options. we only subscribe the value '*' | ||
* 2. if it is a ref type, it will be an array of InputObject . see example below. This case, isSubscriptionValueInputable could be true or false. | ||
- Example#1: isSubscriptionValueInputable is (false or undefined) & subscriptionValueOrRef is {type: 'ref', ref: 'walletAddress'}. This case, we use the resolveObjectArrayRef to get the subscriptionValue from inputs and use its value of first InputObject element. So the inputs will be {walletAddress: [{label: 'ETH', value: '<user-wallet-address>'}]} | ||
- Example#2: isSubscriptionValueInputable is (true) & subscriptionValueOrRef is {type: 'ref', ref: 'pricePairs'}: In this case, we will render the options from the ref 'pricePairs' using the resolveObjectArrayRef function | ||
*/ | ||
}; | ||
@@ -15,2 +25,7 @@ filters: Array<Filter>; | ||
export type InputObject = { | ||
label: string; | ||
value: string; | ||
}; | ||
/** | ||
@@ -17,0 +32,0 @@ * @param name - `string` unique name |
@@ -1,2 +0,2 @@ | ||
import { CheckRatio, ValueOrRef } from '../models'; | ||
import { CheckRatio, InputObject, ValueOrRef } from '../models'; | ||
@@ -68,1 +68,18 @@ type Validator<T> = (item: unknown) => item is T; | ||
); | ||
export const resolveObjectArrayRef = createRefResolver( | ||
(item: unknown): item is ReadonlyArray<InputObject> => { | ||
return ( | ||
Array.isArray(item) && | ||
item.every((element) => typeof element === 'object') && | ||
item.every((element) => { | ||
return ( | ||
'label' in element && | ||
typeof element.label === 'string' && | ||
'value' in element && | ||
typeof element.value === 'string' | ||
); | ||
}) | ||
); | ||
}, | ||
); |
{ | ||
"name": "@notifi-network/notifi-frontend-client", | ||
"version": "0.90.9-alpha.15+80ab6a71", | ||
"version": "0.90.9-alpha.16+8c71e31f", | ||
"description": "The frontend client for Notifi", | ||
@@ -35,7 +35,7 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"@notifi-network/notifi-graphql": "^0.90.9-alpha.15+80ab6a71", | ||
"@notifi-network/notifi-graphql": "^0.90.9-alpha.16+8c71e31f", | ||
"graphql-request": "^6.0.0", | ||
"localforage": "^1.10.0" | ||
}, | ||
"gitHead": "80ab6a71b8033589540663645336169bdb9e69d7" | ||
"gitHead": "8c71e31f972bc950f74d643918684e8ab78dcc62" | ||
} |
Sorry, the diff of this file is too big to display
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
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
316786
9273