@notifi-network/notifi-frontend-client
Advanced tools
Comparing version 0.35.1-alpha.3 to 0.36.0
@@ -8,6 +8,2 @@ import { Types, Operations, NotifiService } from '@notifi-network/notifi-graphql'; | ||
}>; | ||
declare type NotifiSolanaConfiguration = Readonly<{ | ||
walletBlockchain: 'SOLANA'; | ||
walletPublicKey: string; | ||
}> & NotifiEnvironmentConfiguration; | ||
declare type NotifiAptosConfiguration = Readonly<{ | ||
@@ -23,2 +19,7 @@ walletBlockchain: 'APTOS'; | ||
}>, tenantId: string, env?: NotifiEnvironment | undefined) => NotifiAptosConfiguration; | ||
declare type NotifiSolanaConfiguration = Readonly<{ | ||
walletBlockchain: 'SOLANA'; | ||
walletPublicKey: string; | ||
}> & NotifiEnvironmentConfiguration; | ||
declare const newSolanaConfig: (walletPublicKey: string, tenantId: string, env?: NotifiEnvironment | undefined) => NotifiSolanaConfiguration; | ||
declare const envUrl: (env: NotifiEnvironment) => string; | ||
@@ -231,3 +232,4 @@ | ||
declare const newAptosClient: (config: NotifiAptosConfiguration) => NotifiFrontendClient; | ||
declare const newSolanaClient: (config: NotifiSolanaConfiguration) => NotifiFrontendClient; | ||
export { AptosSignMessageFunction, Authorization, AuthorizationStorage, CreateFunc, EnsureSourceParams, EnsureWebhookParams$1 as EnsureWebhookParams, FetchFunc, GetStorageType, HasStorageType, IdentifyFunc, NotifiAptosConfiguration, NotifiEnvironment, NotifiEnvironmentConfiguration, NotifiFrontendClient, NotifiFrontendConfiguration, NotifiFrontendStorage, NotifiSolanaConfiguration, NotifiStorage, Roles, RolesStorage, SIGNING_MESSAGE, SetStorageType, SignMessageParams, SolanaSignMessageFunction, StorageDriver, StorageType, ValueTransformFunc, createInMemoryStorageDriver, createLocalForageStorageDriver, ensureBonfidaAuctionSource, ensureEmail, ensureMetaplexAuctionSource, ensureSms, ensureSource, ensureSourceGroup, ensureSourceRaw, ensureTelegram, ensureWebhook, envUrl, newAptosClient, newAptosConfig, newNotifiService, newNotifiStorage, notNullOrEmpty, packFilterOptions }; | ||
export { AptosSignMessageFunction, Authorization, AuthorizationStorage, CreateFunc, EnsureSourceParams, EnsureWebhookParams$1 as EnsureWebhookParams, FetchFunc, GetStorageType, HasStorageType, IdentifyFunc, NotifiAptosConfiguration, NotifiEnvironment, NotifiEnvironmentConfiguration, NotifiFrontendClient, NotifiFrontendConfiguration, NotifiFrontendStorage, NotifiSolanaConfiguration, NotifiStorage, Roles, RolesStorage, SIGNING_MESSAGE, SetStorageType, SignMessageParams, SolanaSignMessageFunction, StorageDriver, StorageType, ValueTransformFunc, createInMemoryStorageDriver, createLocalForageStorageDriver, ensureBonfidaAuctionSource, ensureEmail, ensureMetaplexAuctionSource, ensureSms, ensureSource, ensureSourceGroup, ensureSourceRaw, ensureTelegram, ensureWebhook, envUrl, newAptosClient, newAptosConfig, newNotifiService, newNotifiStorage, newSolanaClient, newSolanaConfig, notNullOrEmpty, packFilterOptions }; |
@@ -48,2 +48,4 @@ "use strict"; | ||
newNotifiStorage: () => newNotifiStorage, | ||
newSolanaClient: () => newSolanaClient, | ||
newSolanaConfig: () => newSolanaConfig, | ||
notNullOrEmpty: () => notNullOrEmpty, | ||
@@ -64,2 +66,10 @@ packFilterOptions: () => packFilterOptions | ||
}; | ||
var newSolanaConfig = (walletPublicKey, tenantId, env = "Development") => { | ||
return { | ||
tenantId, | ||
env, | ||
walletBlockchain: "SOLANA", | ||
walletPublicKey | ||
}; | ||
}; | ||
var envUrl = (env) => { | ||
@@ -733,2 +743,7 @@ switch (env) { | ||
}; | ||
var newSolanaClient = (config) => { | ||
const service = newNotifiService(config); | ||
const storage = newNotifiStorage(config); | ||
return new NotifiFrontendClient(config, service, storage); | ||
}; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -755,4 +770,6 @@ 0 && (module.exports = { | ||
newNotifiStorage, | ||
newSolanaClient, | ||
newSolanaConfig, | ||
notNullOrEmpty, | ||
packFilterOptions | ||
}); |
@@ -7,2 +7,3 @@ import { NotifiService } from '@notifi-network/notifi-graphql'; | ||
NotifiFrontendConfiguration, | ||
NotifiSolanaConfiguration, | ||
envUrl, | ||
@@ -29,1 +30,7 @@ } from '../configuration'; | ||
}; | ||
export const newSolanaClient = (config: NotifiSolanaConfiguration) => { | ||
const service = newNotifiService(config); | ||
const storage = newNotifiStorage(config); | ||
return new NotifiFrontendClient(config, service, storage); | ||
}; |
@@ -12,8 +12,2 @@ export type NotifiEnvironment = | ||
export type NotifiSolanaConfiguration = Readonly<{ | ||
walletBlockchain: 'SOLANA'; | ||
walletPublicKey: string; | ||
}> & | ||
NotifiEnvironmentConfiguration; | ||
export type NotifiAptosConfiguration = Readonly<{ | ||
@@ -47,2 +41,21 @@ walletBlockchain: 'APTOS'; | ||
export type NotifiSolanaConfiguration = Readonly<{ | ||
walletBlockchain: 'SOLANA'; | ||
walletPublicKey: string; | ||
}> & | ||
NotifiEnvironmentConfiguration; | ||
export const newSolanaConfig = ( | ||
walletPublicKey: string, | ||
tenantId: string, | ||
env: NotifiEnvironment | undefined = 'Development', | ||
): NotifiSolanaConfiguration => { | ||
return { | ||
tenantId, | ||
env, | ||
walletBlockchain: 'SOLANA', | ||
walletPublicKey: walletPublicKey, | ||
}; | ||
}; | ||
export const envUrl = (env: NotifiEnvironment): string => { | ||
@@ -49,0 +62,0 @@ switch (env) { |
{ | ||
"name": "@notifi-network/notifi-frontend-client", | ||
"version": "0.35.1-alpha.3+881db24", | ||
"version": "0.36.0", | ||
"description": "The frontend client for Notifi", | ||
@@ -36,7 +36,7 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"@notifi-network/notifi-graphql": "^0.35.1-alpha.3+881db24", | ||
"@notifi-network/notifi-graphql": "^0.36.0", | ||
"graphql-request": "^5.0.0", | ||
"localforage": "^1.10.0" | ||
}, | ||
"gitHead": "881db24e8ee393d22ca43563abeab49189462ccf" | ||
"gitHead": "d7f1a7ce0ff4b7d9f12553d882f9e0551c9b4ca3" | ||
} |
@@ -5,3 +5,3 @@ # `@notifi/notifi-frontend-client` | ||
In this README, we'll cover the simple use case of one user authenticating through a Martian wallet and creating an alert. | ||
In this README, we'll cover the simple use case of one user authenticating through an Aptos wallet and creating an alert. | ||
@@ -14,3 +14,3 @@ ## 📥 Installation | ||
## 🪝 Hook up the SDK | ||
## 🪝 Hook up the SDK | ||
@@ -26,7 +26,11 @@ Load the Notifi Frontend Client SDK into your component. | ||
``` | ||
const accountAddress = <The wallet's public account address>; | ||
const walletPublicKey = <The wallet's public key>; | ||
const tenantId = <Tenant ID received through the Notifi Config Tool>; | ||
const account = await martian.account(); | ||
const blockchainEnv = "Development"; | ||
const config = newAptosConfig(account, tenantId, blockchainEnv); | ||
const config = newAptosConfig({ | ||
address: accountAddress, // string | ||
publicKey: walletPublicKey, // string | ||
}, tenantId, blockchainEnv); | ||
const client = newAptosClient(config); | ||
@@ -43,15 +47,13 @@ | ||
``` | ||
const martianLogIn = async () => { | ||
const logIn = async () => { | ||
const loginResult = await client.logIn({ | ||
walletBlockchain: 'APTOS', | ||
signMessage: async (message, timestamp) => { | ||
const signedMessage = await wallet.signMessage({ | ||
address: true, | ||
application: false, | ||
chainId: false, | ||
message, | ||
nonce: timestamp, | ||
const { result } = await signMessage({ | ||
address: true, | ||
message, | ||
nonce: `${timestamp}`, | ||
}); | ||
console.log('signedMessage', signedMessage); | ||
return signedMessage.signature; | ||
console.log('signedMessage', result); | ||
return result.signature; | ||
}, | ||
@@ -72,3 +74,3 @@ }); | ||
In order to create a source group, `ensureSourceGroup()` must pass in metadata of the alert options returned in the Rendering Alert Options section. | ||
In order to create a source group, `ensureSourceGroup()` must pass in metadata of the alert options returned in the Rendering Alert Options section. | ||
@@ -91,3 +93,3 @@ After creating a target group and source group, use the `ensureAlert()` to create the first alert. | ||
}); | ||
const source = sourceGroup.sources?.find(it => it?.blockchainAddress === 'notifi__newFeature'); | ||
@@ -126,3 +128,3 @@ const filter = source?.applicableFilters?.find(it => it?.filterType === 'BROADCAST_MESSAGES'); | ||
You'll want to pass in the `name` of the existing alert to make the update to that alert entity. You can use `getAlerts()` to find the alert entity. | ||
You'll want to pass in the `name` of the existing alert to make the update to that alert entity. You can use `getAlerts()` to find the alert entity. | ||
@@ -175,3 +177,3 @@ ``` | ||
To get notification history, use the getNotificationHistory() | ||
To get notification history, use the getNotificationHistory() | ||
@@ -178,0 +180,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
99380
2648
194
2
+ Added@notifi-network/notifi-graphql@0.36.0(transitive)
- Removed@notifi-network/notifi-graphql@0.35.1-alpha.3(transitive)