deso-protocol
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0-beta.2
{ | ||
"name": "deso-protocol", | ||
"version": "2.0.0-beta.1", | ||
"version": "2.0.0-beta.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Client side typescript/javascript SDK for building web3 applications for the DeSo blockchain.", |
@@ -60,5 +60,5 @@ # deso-protocol | ||
/** | ||
* An optional storage provider. If not provided, we will assume localStorage | ||
* is available. In react native this will typically be an async storage | ||
* class. | ||
* An optional storage provider. If not provided, we will assume we're running | ||
* in a browser context and localStorage is available. In react native you must | ||
* set a storage provider which is likely an async storage instance. | ||
*/ | ||
@@ -68,4 +68,3 @@ storageProvider?: Storage | AsyncStorage; | ||
/** | ||
* An optional function that is provided the identity url that needs to be | ||
* opened. This can be used to customize how the identity url is opened. For | ||
* An optional function that can be used to customize how the identity url is opened. For | ||
* example, if you are using react native, you might want to use the WebBrowser | ||
@@ -126,3 +125,3 @@ * API to open the url in a system browser window. | ||
// NOTE: The publicKey here must be a user that has previously logged in. | ||
identity.setActiveUser(publicKey); | ||
await identity.setActiveUser(publicKey); | ||
@@ -152,4 +151,5 @@ // Generate a jwt for making authenticated requests via `Authorization` http | ||
// of available transaction types here: https://github.com/deso-protocol/core/blob/a836e4d2e92f59f7570c7a00f82a3107ec80dd02/lib/network.go#L244 | ||
// This returns a boolean value synchronously. | ||
const hasPermission = identity.hasPermissions({ | ||
// This returns a boolean value synchronously and should be used in a browser context to prevent issues with | ||
// popup blockers. | ||
const hasPermission = identity.hasPermissionsSync({ | ||
TransactionCountLimitMap: { | ||
@@ -160,2 +160,10 @@ SUBMIT_POST: 1, | ||
// The same as `hasPermissionsSync` but async because the storage provider might be AsyncStorage | ||
// This would typically be used in a native mobile (react native) context. | ||
const hasPermission = await identity.hasPermissionsAsync({ | ||
TransactionCountLimitMap: { | ||
SUBMIT_POST: 1, | ||
}, | ||
}); | ||
// Here we request approval for permissions from a user. This will present the | ||
@@ -219,3 +227,3 @@ // user with the deso identity approve derived key UI. | ||
const txInfo = submitPost({ | ||
const txInfo = await submitPost({ | ||
UpdaterPublicKeyBase58Check: currentUser.publicKey, | ||
@@ -235,3 +243,3 @@ BodyObj: { | ||
React native support is a work in progress, but there is a beta version | ||
[React native](https://reactnative.dev) support is a work in progress, but there is a beta version | ||
available if you'd like to test to it out. You will need to run react native | ||
@@ -246,3 +254,3 @@ version `0.71.7` or later to ensure `BigInt` support is available. | ||
There a few peer dependencies that are required for everything to work smoothly. | ||
There are a few peer dependencies that are required for everything to work smoothly. | ||
@@ -282,3 +290,3 @@ ```sh | ||
`deso-protocol` requires the web crypto APIs, which are provided via | ||
`deso-protocol` requires the [web crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Crypto), which is provided via | ||
the | ||
@@ -294,2 +302,3 @@ [react-native-webview-crypto](https://github.com/webview-crypto/react-native-webview-crypto) | ||
```ts | ||
// App.tsx | ||
import { configure } from 'deso-protocol'; | ||
@@ -296,0 +305,0 @@ import AsyncStorage from '@react-native-async-storage/async-storage'; |
Sorry, the diff of this file is too big to display
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
1502320
356