@tonconnect/sdk
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
@@ -205,3 +205,3 @@ export declare interface Account { | ||
/** | ||
* Thrown when `Storage` was not specified in the `DappMetadata` and default `localStorage` was not detected in the environment. | ||
* Thrown when `Storage` was not specified in the `DappMetadata` and default `localStorage` was not detected in the Node.js environment. | ||
*/ | ||
@@ -425,3 +425,3 @@ export declare class LocalstorageNotFoundError extends TonConnectError { | ||
/** | ||
* Converts raw TON address to bounceable user-friendly format. [See details]{@link https://ton.org/docs/learn/overviews/addresses#user-friendly-address} | ||
* Converts raw TON address to no-bounceable user-friendly format. [See details]{@link https://ton.org/docs/learn/overviews/addresses#user-friendly-address} | ||
* @param hexAddress raw TON address formatted as "0:<hex string without 0x>". | ||
@@ -428,0 +428,0 @@ * @param [testOnly=false] convert address to test-only form. [See details]{@link https://ton.org/docs/learn/overviews/addresses#user-friendly-address} |
{ | ||
"name": "@tonconnect/sdk", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"scripts": { | ||
@@ -27,5 +27,5 @@ "build": "npx rimraf types-dist && npx rimraf lib && npx rollup -c rollup.config.mjs && ttsc --project tsconfig.declarations.json && api-extractor run && npx rimraf types-dist && npx rimraf dist && npx webpack --config webpack.config.js", | ||
"dependencies": { | ||
"@tonconnect/isomorphic-eventsource": "^0.0.1", | ||
"@tonconnect/isomorphic-fetch": "^0.0.2", | ||
"@tonconnect/protocol": "^2.2.5" | ||
"@tonconnect/isomorphic-eventsource": "^0.0.2-beta.0", | ||
"@tonconnect/isomorphic-fetch": "^0.0.2-beta.0", | ||
"@tonconnect/protocol": "^2.2.6-beta.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "files": [ |
@@ -62,3 +62,5 @@ # TON Connect SDK | ||
```ts | ||
const connector = new TonConnect({ manifestUrl: 'https://myApp.com/assets/tonconnect-manifest.json' }); | ||
const connector = new TonConnect({ | ||
manifestUrl: 'https://myApp.com/assets/tonconnect-manifest.json' | ||
}); | ||
``` | ||
@@ -277,3 +279,6 @@ | ||
```ts | ||
connector.connect(walletConnectionSource, { tonProof: "<your-fetched-payload>" }); | ||
connector.connect( | ||
walletConnectionSource, | ||
{ tonProof: "<your-fetched-payload>" } | ||
); | ||
``` | ||
@@ -285,18 +290,18 @@ Note that you can use `tonProof` only with `connector.connect()` method. This feature is not available in `connector.restoreConnection()`. | ||
connector.onStatusChange(wallet => { | ||
if (!wallet) { | ||
return; | ||
} | ||
if (!wallet) { | ||
return; | ||
} | ||
const tonProof = wallet.connectItems?.tonProof; | ||
const tonProof = wallet.connectItems?.tonProof; | ||
if (tonProof) { | ||
if ('proof' in tonProof) { | ||
// send proof to your backend | ||
// e.g. myBackendCheckProof(tonProof.proof, wallet.account); | ||
return; | ||
} | ||
if (tonProof) { | ||
if ('proof' in tonProof) { | ||
// send proof to your backend | ||
// e.g. myBackendCheckProof(tonProof.proof, wallet.account); | ||
return; | ||
} | ||
console.error(tonProof.error); | ||
} | ||
}); | ||
console.error(tonProof.error); | ||
} | ||
}); | ||
``` | ||
@@ -357,1 +362,26 @@ 4. Send proof and user's account data to your backend. Backend should check the proof correctness and check that payload inside the proof was generated before. After all checks backend should return an auth token to the client. Notice that `Account` contains the `walletStateInit` property which can be helpful for your backend to get user's public key if user's wallet contract doesn't support corresponding get method. | ||
``` | ||
# Troubleshooting | ||
## Warning about 'encoding' module in Next.js | ||
If you are using Next.js and see a warning similar to the following: | ||
``` | ||
⚠ ./node_modules/node-fetch/lib/index.js | ||
Module not found: Can't resolve 'encoding' in '.../node_modules/node-fetch/lib' | ||
Import trace for requested module: | ||
./node_modules/node-fetch/lib/index.js | ||
./node_modules/@tonconnect/isomorphic-fetch/index.mjs | ||
./node_modules/@tonconnect/sdk/lib/esm/index.mjs | ||
``` | ||
Please note that this is just a warning and should not affect the functionality of your application. If you wish to suppress the warning, you have two options: | ||
1. (Recommended) Wait for us to remove the dependency on `@tonconnect/isomorphic-fetch` in future releases. This dependency will be removed when we drop support for Node.js versions below 18. | ||
2. (Optional) Install the `encoding` package, to resolve the warning: | ||
```shell | ||
npm install encoding | ||
``` |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
721055
4826
384
7
+ Added@tonconnect/isomorphic-eventsource@0.0.2(transitive)
- Removed@tonconnect/isomorphic-eventsource@0.0.1(transitive)