@tonconnect/sdk 0.0.30 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +3 -2
  2. package/lib/errors/dapp/dapp-metadata.error.d.ts +3 -0
  3. package/lib/errors/dapp/dapp-metadata.error.js +3 -0
  4. package/lib/errors/protocol/events/connect/user-rejects.error.d.ts +3 -0
  5. package/lib/errors/protocol/events/connect/user-rejects.error.js +3 -0
  6. package/lib/errors/protocol/responses/bad-request.error.d.ts +3 -0
  7. package/lib/errors/protocol/responses/bad-request.error.js +3 -0
  8. package/lib/errors/protocol/responses/unknown-app.error.d.ts +3 -0
  9. package/lib/errors/protocol/responses/unknown-app.error.js +3 -0
  10. package/lib/errors/storage/localstorage-not-found.error.d.ts +3 -0
  11. package/lib/errors/storage/localstorage-not-found.error.js +3 -0
  12. package/lib/errors/ton-connect.error.d.ts +3 -0
  13. package/lib/errors/ton-connect.error.js +3 -0
  14. package/lib/errors/unknown.error.d.ts +3 -0
  15. package/lib/errors/unknown.error.js +3 -0
  16. package/lib/errors/wallet/wallet-already-connected.error.d.ts +3 -0
  17. package/lib/errors/wallet/wallet-already-connected.error.js +3 -0
  18. package/lib/errors/wallet/wallet-not-connected.error.d.ts +3 -0
  19. package/lib/errors/wallet/wallet-not-connected.error.js +3 -0
  20. package/lib/errors/wallet/wallet-not-injected.error.d.ts +3 -0
  21. package/lib/errors/wallet/wallet-not-injected.error.js +3 -0
  22. package/lib/errors/wallets-manager/fetch-wallets.error.d.ts +3 -0
  23. package/lib/errors/wallets-manager/fetch-wallets.error.js +3 -0
  24. package/lib/models/dapp/dapp-metadata.d.ts +13 -0
  25. package/lib/models/index.d.ts +1 -1
  26. package/lib/models/methods/connect/connect-additional-request.d.ts +3 -0
  27. package/lib/models/methods/send-transaction/send-transaction-request.d.ts +18 -0
  28. package/lib/models/methods/send-transaction/send-transaction-response.d.ts +3 -0
  29. package/lib/models/ton-connect-options.d.ts +16 -0
  30. package/lib/models/{dapp/dapp-settings.js → ton-connect-options.js} +0 -0
  31. package/lib/models/wallet/account.d.ts +6 -0
  32. package/lib/models/wallet/index.d.ts +1 -1
  33. package/lib/models/wallet/wallet-connection-source.d.ts +9 -0
  34. package/lib/models/wallet/wallet-info.d.ts +27 -0
  35. package/lib/models/wallet/wallet.d.ts +12 -0
  36. package/lib/provider/bridge/bridge-gateway.js +1 -2
  37. package/lib/storage/models/storage.interface.d.ts +16 -0
  38. package/lib/ton-connect.d.ts +3 -6
  39. package/lib/ton-connect.js +3 -3
  40. package/lib/utils/web-api.d.ts +0 -1
  41. package/lib/utils/web-api.js +1 -5
  42. package/package.json +5 -2
  43. package/lib/models/dapp/dapp-settings.d.ts +0 -6
package/README.md CHANGED
@@ -6,7 +6,8 @@ Use it to connect your app to TON wallets via TonConnect protocol.
6
6
  You can find more details and the protocol specification in the [docs](https://github.com/ton-connect/docs).
7
7
  See the example of sdk usage [here](https://github.com/ton-connect/demo-dapp).
8
8
 
9
- ## Get started
9
+ # Get started
10
+ ## Install package
10
11
  `npm i @tonconnect/sdk`
11
12
 
12
13
  ## Init connector and call autoConnect. If user connected his wallet before, connector will restore the connection
@@ -45,7 +46,7 @@ const walletsList = await connector.getWallets();
45
46
  bridgeUrl?: string;
46
47
  jsBridgeKey?: string;
47
48
  injected?: boolean; // true if this wallet is injected to the webpage
48
- embedded?: boolean; // true if dapp is opened inside this wallet's browser
49
+ embedded?: boolean; // true if the dapp is opened inside this wallet's browser
49
50
  }[]
50
51
  */
51
52
  ```
@@ -1,4 +1,7 @@
1
1
  import { TonConnectError } from "../ton-connect.error";
2
+ /**
3
+ * Thrown when passed DappMetadata is in incorrect format.
4
+ */
2
5
  export declare class DappMetadataError extends TonConnectError {
3
6
  constructor(...args: ConstructorParameters<typeof TonConnectError>);
4
7
  }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DappMetadataError = void 0;
4
4
  const ton_connect_error_1 = require("../ton-connect.error");
5
+ /**
6
+ * Thrown when passed DappMetadata is in incorrect format.
7
+ */
5
8
  class DappMetadataError extends ton_connect_error_1.TonConnectError {
6
9
  constructor(...args) {
7
10
  super(...args);
@@ -1,4 +1,7 @@
1
1
  import { TonConnectError } from "../../../ton-connect.error";
2
+ /**
3
+ * Thrown when user rejects the action in the wallet.
4
+ */
2
5
  export declare class UserRejectsError extends TonConnectError {
3
6
  constructor(...args: ConstructorParameters<typeof TonConnectError>);
4
7
  }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UserRejectsError = void 0;
4
4
  const ton_connect_error_1 = require("../../../ton-connect.error");
5
+ /**
6
+ * Thrown when user rejects the action in the wallet.
7
+ */
5
8
  class UserRejectsError extends ton_connect_error_1.TonConnectError {
6
9
  constructor(...args) {
7
10
  super(...args);
@@ -1,4 +1,7 @@
1
1
  import { TonConnectError } from "../../ton-connect.error";
2
+ /**
3
+ * Thrown when request to the wallet contains errors.
4
+ */
2
5
  export declare class BadRequestError extends TonConnectError {
3
6
  constructor(...args: ConstructorParameters<typeof TonConnectError>);
4
7
  }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BadRequestError = void 0;
4
4
  const ton_connect_error_1 = require("../../ton-connect.error");
5
+ /**
6
+ * Thrown when request to the wallet contains errors.
7
+ */
5
8
  class BadRequestError extends ton_connect_error_1.TonConnectError {
6
9
  constructor(...args) {
7
10
  super(...args);
@@ -1,4 +1,7 @@
1
1
  import { TonConnectError } from "../../ton-connect.error";
2
+ /**
3
+ * Thrown when app tries to send rpc request to the injected wallet while not connected.
4
+ */
2
5
  export declare class UnknownAppError extends TonConnectError {
3
6
  constructor(...args: ConstructorParameters<typeof TonConnectError>);
4
7
  }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UnknownAppError = void 0;
4
4
  const ton_connect_error_1 = require("../../ton-connect.error");
5
+ /**
6
+ * Thrown when app tries to send rpc request to the injected wallet while not connected.
7
+ */
5
8
  class UnknownAppError extends ton_connect_error_1.TonConnectError {
6
9
  constructor(...args) {
7
10
  super(...args);
@@ -1,4 +1,7 @@
1
1
  import { TonConnectError } from "../ton-connect.error";
2
+ /**
3
+ * Thrown when `Storage` was not specified in the `DappMetadata` and default `localStorage` was not detected in the environment.
4
+ */
2
5
  export declare class LocalstorageNotFoundError extends TonConnectError {
3
6
  constructor(...args: ConstructorParameters<typeof TonConnectError>);
4
7
  }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LocalstorageNotFoundError = void 0;
4
4
  const ton_connect_error_1 = require("../ton-connect.error");
5
+ /**
6
+ * Thrown when `Storage` was not specified in the `DappMetadata` and default `localStorage` was not detected in the environment.
7
+ */
5
8
  class LocalstorageNotFoundError extends ton_connect_error_1.TonConnectError {
6
9
  constructor(...args) {
7
10
  super(...args);
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Base class for TonConnect errors. You can check if the error was triggered by the @tonconnect/sdk using `err instanceof TonConnectError`.
3
+ */
1
4
  export declare class TonConnectError extends Error {
2
5
  constructor(...args: ConstructorParameters<typeof Error>);
3
6
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TonConnectError = void 0;
4
+ /**
5
+ * Base class for TonConnect errors. You can check if the error was triggered by the @tonconnect/sdk using `err instanceof TonConnectError`.
6
+ */
4
7
  class TonConnectError extends Error {
5
8
  constructor(...args) {
6
9
  super(...args);
@@ -1,4 +1,7 @@
1
1
  import { TonConnectError } from "./ton-connect.error";
2
+ /**
3
+ * Unhanded unknown error.
4
+ */
2
5
  export declare class UnknownError extends TonConnectError {
3
6
  constructor(...args: ConstructorParameters<typeof TonConnectError>);
4
7
  }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UnknownError = void 0;
4
4
  const ton_connect_error_1 = require("./ton-connect.error");
5
+ /**
6
+ * Unhanded unknown error.
7
+ */
5
8
  class UnknownError extends ton_connect_error_1.TonConnectError {
6
9
  constructor(...args) {
7
10
  super(...args);
@@ -1,4 +1,7 @@
1
1
  import { TonConnectError } from "../ton-connect.error";
2
+ /**
3
+ * Thrown when wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection.
4
+ */
2
5
  export declare class WalletAlreadyConnectedError extends TonConnectError {
3
6
  constructor(...args: ConstructorParameters<typeof TonConnectError>);
4
7
  }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WalletAlreadyConnectedError = void 0;
4
4
  const ton_connect_error_1 = require("../ton-connect.error");
5
+ /**
6
+ * Thrown when wallet connection called but wallet already connected. To avoid the error, disconnect the wallet before doing a new connection.
7
+ */
5
8
  class WalletAlreadyConnectedError extends ton_connect_error_1.TonConnectError {
6
9
  constructor(...args) {
7
10
  super(...args);
@@ -1,4 +1,7 @@
1
1
  import { TonConnectError } from "../ton-connect.error";
2
+ /**
3
+ * Thrown when send transaction or other protocol methods called while wallet is not connected.
4
+ */
2
5
  export declare class WalletNotConnectedError extends TonConnectError {
3
6
  constructor(...args: ConstructorParameters<typeof TonConnectError>);
4
7
  }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WalletNotConnectedError = void 0;
4
4
  const ton_connect_error_1 = require("../ton-connect.error");
5
+ /**
6
+ * Thrown when send transaction or other protocol methods called while wallet is not connected.
7
+ */
5
8
  class WalletNotConnectedError extends ton_connect_error_1.TonConnectError {
6
9
  constructor(...args) {
7
10
  super(...args);
@@ -1,4 +1,7 @@
1
1
  import { TonConnectError } from "../ton-connect.error";
2
+ /**
3
+ * Thrown when there is an attempt to connect to the injected wallet while it is not exists in the webpage.
4
+ */
2
5
  export declare class WalletNotInjectedError extends TonConnectError {
3
6
  constructor(...args: ConstructorParameters<typeof TonConnectError>);
4
7
  }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WalletNotInjectedError = void 0;
4
4
  const ton_connect_error_1 = require("../ton-connect.error");
5
+ /**
6
+ * Thrown when there is an attempt to connect to the injected wallet while it is not exists in the webpage.
7
+ */
5
8
  class WalletNotInjectedError extends ton_connect_error_1.TonConnectError {
6
9
  constructor(...args) {
7
10
  super(...args);
@@ -1,4 +1,7 @@
1
1
  import { TonConnectError } from "../ton-connect.error";
2
+ /**
3
+ * Thrown when an error occurred while fetching the wallets list.
4
+ */
2
5
  export declare class FetchWalletsError extends TonConnectError {
3
6
  constructor(...args: ConstructorParameters<typeof TonConnectError>);
4
7
  }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FetchWalletsError = void 0;
4
4
  const ton_connect_error_1 = require("../ton-connect.error");
5
+ /**
6
+ * Thrown when an error occurred while fetching the wallets list.
7
+ */
5
8
  class FetchWalletsError extends ton_connect_error_1.TonConnectError {
6
9
  constructor(...args) {
7
10
  super(...args);
@@ -1,5 +1,18 @@
1
1
  export interface DappMetadata {
2
+ /**
3
+ * Dapp name. Might be simple, will not be used as identifier.
4
+ * @default `document.title` if exists, 'Unknown dapp' overwise
5
+ */
2
6
  name: string;
7
+ /**
8
+ * URL to the dapp icon. Must be PNG, ICO, ... . SVG icons are not supported.
9
+ * @default best quality favicon declared via <link> in the document or '' if there are no any icons in the document.
10
+ */
3
11
  icon: string;
12
+ /**
13
+ * Dapp URL. Will be used as the dapp identifier. Will be used to open the dapp after click to its icon in the wallet.
14
+ * It is recommended to pass url without closing slash, e.g. 'https://mydapp.com' instead of 'https://mydapp.com/'.
15
+ * @default `window.location.origin` if exists, otherwise (if not explicitly specified) an error will be thrown.
16
+ */
4
17
  url: string;
5
18
  }
@@ -1,4 +1,4 @@
1
1
  export * from './wallet';
2
2
  export * from './methods';
3
3
  export { DappMetadata } from './dapp/dapp-metadata';
4
- export { DappSettings } from './dapp/dapp-settings';
4
+ export { TonConnectOptions } from './ton-connect-options';
@@ -1,3 +1,6 @@
1
1
  export interface ConnectAdditionalRequest {
2
+ /**
3
+ * Payload for ton_proof
4
+ */
2
5
  tonProof: string;
3
6
  }
@@ -1,9 +1,27 @@
1
1
  export interface SendTransactionRequest {
2
+ /**
3
+ * Sending transaction deadline in unix epoch seconds.
4
+ */
2
5
  valid_until: number;
6
+ /**
7
+ * Messages to send: min is 1, max is 4.
8
+ */
3
9
  messages: {
10
+ /**
11
+ * Receiver's address.
12
+ */
4
13
  address: string;
14
+ /**
15
+ * Amount to send in nanoTon.
16
+ */
5
17
  amount: string;
18
+ /**
19
+ * Contract specific data to add to the transaction.
20
+ */
6
21
  initState?: string;
22
+ /**
23
+ * Contract specific data to add to the transaction.
24
+ */
7
25
  payload?: string;
8
26
  }[];
9
27
  }
@@ -1,3 +1,6 @@
1
1
  export interface SendTransactionResponse {
2
+ /**
3
+ * Signed boc
4
+ */
2
5
  boc: string;
3
6
  }
@@ -0,0 +1,16 @@
1
+ import { DappMetadata } from "./dapp/dapp-metadata";
2
+ import { IStorage } from "../storage/models/storage.interface";
3
+ /**
4
+ * TonConnect constructor options
5
+ */
6
+ export interface TonConnectOptions {
7
+ /**
8
+ * Dapp metadata that will be displayed in the user's wallet.
9
+ * Options will be merged with the [defaults]{@link ./dapp/dappMetedata.ts} if there are some empty fields.
10
+ */
11
+ dappMetedata?: Partial<DappMetadata>;
12
+ /**
13
+ * Storage to save protocol data. For browser default is `localStorage`. If you use SDK with nodeJS, you have to specify this field.
14
+ */
15
+ storage?: IStorage;
16
+ }
@@ -1,5 +1,11 @@
1
1
  import { CHAIN } from '@tonconnect/protocol';
2
2
  export interface Account {
3
+ /**
4
+ * User's address in "hex" format: "<wc>:<hex>".
5
+ */
3
6
  address: string;
7
+ /**
8
+ * User's selected chain.
9
+ */
4
10
  chain: CHAIN;
5
11
  }
@@ -1,4 +1,4 @@
1
1
  export type { Account } from './account';
2
2
  export type { Wallet } from './wallet';
3
- export type { WalletConnectionSource } from './wallet-connection-source';
3
+ export type { WalletConnectionSource, WalletConnectionSourceHTTP, WalletConnectionSourceJS } from './wallet-connection-source';
4
4
  export { WalletInfo, WalletInfoInjected, WalletInfoRemote, isWalletInfoInjected } from './wallet-info';
@@ -1,9 +1,18 @@
1
1
  export declare type WalletConnectionSource = WalletConnectionSourceHTTP | WalletConnectionSourceJS;
2
2
  export interface WalletConnectionSourceHTTP {
3
+ /**
4
+ * Base part of the wallet universal url. The link should support [Ton Connect parameters]{@link https://github.com/ton-connect/docs/blob/main/bridge.md#universal-link}.
5
+ */
3
6
  universalLink: string;
7
+ /**
8
+ * Url of the wallet's implementation of the [HTTP bridge]{@link https://github.com/ton-connect/docs/blob/main/bridge.md#http-bridge}.
9
+ */
4
10
  bridgeUrl: string;
5
11
  }
6
12
  export interface WalletConnectionSourceJS {
13
+ /**
14
+ * If the wallet handles JS Bridge connection, specifies the binding for the bridge object accessible through window. Example: the key "tonkeeper" means the bridge can be accessed as window.tonkeeper.
15
+ */
7
16
  jsBridgeKey: string;
8
17
  }
9
18
  export declare function isWalletConnectionSourceJS(value: WalletConnectionSource): value is WalletConnectionSourceJS;
@@ -1,16 +1,43 @@
1
1
  export interface WalletInfoBase {
2
+ /**
3
+ * Name of the wallet.
4
+ */
2
5
  name: string;
6
+ /**
7
+ * Url to the icon of the wallet. Resolution 288×288px. On non-transparent background, without rounded corners. PNG format.
8
+ */
3
9
  imageUrl: string;
10
+ /**
11
+ * Will be used in the protocol later.
12
+ */
4
13
  tondns?: string;
14
+ /**
15
+ * Info or landing page of your wallet. May be useful for TON newcomers.
16
+ */
5
17
  aboutUrl: string;
6
18
  }
7
19
  export interface WalletInfoRemote extends WalletInfoBase {
20
+ /**
21
+ * Base part of the wallet universal url. The link should support [Ton Connect parameters]{@link https://github.com/ton-connect/docs/blob/main/bridge.md#universal-link}.
22
+ */
8
23
  universalLink: string;
24
+ /**
25
+ * Url of the wallet's implementation of the [HTTP bridge]{@link https://github.com/ton-connect/docs/blob/main/bridge.md#http-bridge}.
26
+ */
9
27
  bridgeUrl: string;
10
28
  }
11
29
  export interface WalletInfoInjected extends WalletInfoBase {
30
+ /**
31
+ * If the wallet handles JS Bridge connection, specifies the binding for the bridge object accessible through window. Example: the key "tonkeeper" means the bridge can be accessed as window.tonkeeper.
32
+ */
12
33
  jsBridgeKey: string;
34
+ /**
35
+ * Indicates if the wallet currently is injected to the webpage.
36
+ */
13
37
  injected: boolean;
38
+ /**
39
+ * Indicates if the dapp is opened inside this wallet's browser.
40
+ */
14
41
  embedded: boolean;
15
42
  }
16
43
  export declare type WalletInfo = WalletInfoRemote | WalletInfoInjected | (WalletInfoRemote & WalletInfoInjected);
@@ -1,9 +1,21 @@
1
1
  import { DeviceInfo, TonProofItemReply } from '@tonconnect/protocol';
2
2
  import { Account } from "..";
3
3
  export interface Wallet {
4
+ /**
5
+ * Information about user's wallet's device.
6
+ */
4
7
  device: DeviceInfo;
8
+ /**
9
+ * Provider type: http bridge or injected js.
10
+ */
5
11
  provider: 'http' | 'injected';
12
+ /**
13
+ * Selected account.
14
+ */
6
15
  account: Account;
16
+ /**
17
+ * Response for connect items request.
18
+ */
7
19
  connectItems?: {
8
20
  tonProof?: TonProofItemReply;
9
21
  };
@@ -14,8 +14,7 @@ const protocol_1 = require("@tonconnect/protocol");
14
14
  const errors_1 = require("../../errors");
15
15
  const http_bridge_gateway_storage_1 = require("../../storage/http-bridge-gateway-storage");
16
16
  const url_1 = require("../../utils/url");
17
- const web_api_1 = require("../../utils/web-api");
18
- if ((0, web_api_1.isNode)()) {
17
+ if ((0, protocol_1.isNode)()) {
19
18
  try {
20
19
  eval("global.EventSource = require('eventsource')");
21
20
  eval("global.fetch = require('node-fetch')");
@@ -1,5 +1,21 @@
1
+ /**
2
+ * Imitation of the localStorage.
3
+ */
1
4
  export interface IStorage {
5
+ /**
6
+ * Saves the `value` to the storage. Value can be accessed later by the `key`. Implementation may use backend as a storage due to the fact that the function returns a promise.
7
+ * @param key key to access to the value later.
8
+ * @param value value to save.
9
+ */
2
10
  setItem(key: string, value: string): Promise<void>;
11
+ /**
12
+ * Reads the `value` from the storage. Implementation may use backend as a storage due to the fact that the function returns a promise.
13
+ * @param key key to access the value.
14
+ */
3
15
  getItem(key: string): Promise<string | null>;
16
+ /**
17
+ * Removes the `value` from the storage. Implementation may use backend as a storage due to the fact that the function returns a promise.
18
+ * @param key key to access the value.
19
+ */
4
20
  removeItem(key: string): Promise<void>;
5
21
  }
@@ -1,9 +1,9 @@
1
1
  import { TonConnectError } from "./errors/ton-connect.error";
2
- import { Account, DappMetadata, Wallet, WalletConnectionSource, WalletInfo } from "./models";
2
+ import { Account, Wallet, WalletConnectionSource, WalletInfo } from "./models";
3
3
  import { SendTransactionRequest, SendTransactionResponse } from "./models/methods";
4
4
  import { ConnectAdditionalRequest } from "./models/methods/connect/connect-additional-request";
5
+ import { TonConnectOptions } from "./models/ton-connect-options";
5
6
  import { WalletConnectionSourceJS } from "./models/wallet/wallet-connection-source";
6
- import { IStorage } from "./storage/models/storage.interface";
7
7
  import { ITonConnect } from "./ton-connect.interface";
8
8
  export declare class TonConnect implements ITonConnect {
9
9
  private readonly walletsList;
@@ -26,10 +26,7 @@ export declare class TonConnect implements ITonConnect {
26
26
  */
27
27
  get wallet(): Wallet | null;
28
28
  private set wallet(value);
29
- constructor(options?: {
30
- dappMetedata?: Partial<DappMetadata>;
31
- storage?: IStorage;
32
- });
29
+ constructor(options?: TonConnectOptions);
33
30
  /**
34
31
  * Returns available wallets list.
35
32
  */
@@ -32,10 +32,10 @@ class TonConnect {
32
32
  this.statusChangeSubscriptions = [];
33
33
  this.statusChangeErrorSubscriptions = [];
34
34
  this.dappSettings = {
35
- metadata: (0, options_1.mergeOptions)(options === null || options === void 0 ? void 0 : options.dappMetedata, (0, web_api_1.getWebPageMetadata)()),
35
+ dappMetedata: (0, options_1.mergeOptions)(options === null || options === void 0 ? void 0 : options.dappMetedata, (0, web_api_1.getWebPageMetadata)()),
36
36
  storage: (options === null || options === void 0 ? void 0 : options.storage) || new default_storage_1.DefaultStorage()
37
37
  };
38
- if (!this.dappSettings.metadata.url) {
38
+ if (!this.dappSettings.dappMetedata.url) {
39
39
  throw new dapp_metadata_error_1.DappMetadataError('Dapp url must be specified if window.location.origin is undefined.');
40
40
  }
41
41
  this.bridgeConnectionStorage = new bridge_connection_storage_1.BridgeConnectionStorage(this.dappSettings.storage);
@@ -210,7 +210,7 @@ class TonConnect {
210
210
  }
211
211
  createConnectRequest(request) {
212
212
  const webPageMetadata = (0, web_api_1.getWebPageMetadata)();
213
- const metadata = (0, options_1.mergeOptions)(this.dappSettings.metadata, webPageMetadata);
213
+ const metadata = (0, options_1.mergeOptions)(this.dappSettings.dappMetedata, webPageMetadata);
214
214
  const items = [
215
215
  {
216
216
  name: 'ton_addr'
@@ -1,5 +1,4 @@
1
1
  import { DappMetadata } from "../models";
2
2
  export declare function getWindow(): Window | undefined;
3
3
  export declare function getDocument(): Document | undefined;
4
- export declare function isNode(): boolean;
5
4
  export declare function getWebPageMetadata(): DappMetadata;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getWebPageMetadata = exports.isNode = exports.getDocument = exports.getWindow = void 0;
3
+ exports.getWebPageMetadata = exports.getDocument = exports.getWindow = void 0;
4
4
  function getWindow() {
5
5
  if (typeof window === 'undefined') {
6
6
  return undefined;
@@ -15,10 +15,6 @@ function getDocument() {
15
15
  return document;
16
16
  }
17
17
  exports.getDocument = getDocument;
18
- function isNode() {
19
- return typeof require === 'function' && typeof global === 'object';
20
- }
21
- exports.isNode = isNode;
22
18
  function getWebPageMetadata() {
23
19
  var _a, _b;
24
20
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonconnect/sdk",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "scripts": {
5
5
  "build": "npx rimraf lib && ttsc",
6
6
  "build:production": "npx rimraf lib && ttsc --sourceMap false"
@@ -28,7 +28,7 @@
28
28
  "tweetnacl": "^1.0.3",
29
29
  "eventsource": "^2.0.2",
30
30
  "node-fetch": "^2.6.7",
31
- "@tonconnect/protocol": "^0.0.17"
31
+ "@tonconnect/protocol": "^0.0.19"
32
32
  },
33
33
  "files": [
34
34
  "lib"
@@ -42,5 +42,8 @@
42
42
  "ts-loader": "^9.4.1",
43
43
  "ttypescript": "^1.5.13",
44
44
  "typescript-transform-paths": "^3.3.1"
45
+ },
46
+ "typedoc": {
47
+ "entryPoint": "./src/index.ts"
45
48
  }
46
49
  }
@@ -1,6 +0,0 @@
1
- import { DappMetadata } from "..";
2
- import { IStorage } from "../../storage/models/storage.interface";
3
- export interface DappSettings {
4
- metadata: DappMetadata;
5
- storage: IStorage;
6
- }