{"id":13772619,"url":"https://github.com/wavesplatform/signer","last_synced_at":"2025-08-20T18:34:59.156Z","repository":{"id":40680392,"uuid":"229743250","full_name":"wavesplatform/signer","owner":"wavesplatform","description":"TypeScript/JavaScript library for your web app for interacting with the Waves blockchain. Using Signer you can easily create and sign transactions.","archived":false,"fork":false,"pushed_at":"2023-03-01T03:25:22.000Z","size":853,"stargazers_count":25,"open_issues_count":40,"forks_count":27,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-12-12T03:33:22.839Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wavesplatform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-23T11:56:32.000Z","updated_at":"2024-11-24T14:46:21.000Z","dependencies_parsed_at":"2024-01-13T04:11:35.432Z","dependency_job_id":"3a41fe17-258f-4504-ad94-6c6ea6637b5e","html_url":"https://github.com/wavesplatform/signer","commit_stats":null,"previous_names":["wavesplatform/waves-js"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesplatform%2Fsigner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesplatform%2Fsigner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesplatform%2Fsigner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesplatform%2Fsigner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wavesplatform","download_url":"https://codeload.github.com/wavesplatform/signer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230445917,"owners_count":18227060,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:06.298Z","updated_at":"2024-12-19T14:15:02.885Z","avatar_url":"https://github.com/wavesplatform.png","language":"TypeScript","readme":"# Signer\n\n* [Overview](#overview)\n* [Restrictions](#restrictions)\n* [Getting Started](#getting-started)\n* [Constructor](#constructor)\n* [Methods](#methods)\n* [Provider Interface](#provider-interface)\n* [Error Codes](#error-codes)\n\n\u003ca id=\"overview\"\u003e\u003c/a\u003e\n## Overview\n\nWaves Signer is a TypeScript/JavaScript library that features signing and broadcasting transactions on behalf of users without asking them for their seed phrases or private keys.\n\n### Provider\n\nIn order to work with Signer, you need to link an external Provider library. Provider securely stores user's private data. Your web app and Signer itself do not have access to user's private key and seed phrase.\n\nThe Provider authenticates user and generates a digital signature.\n\nSigner implements developer-friendly protocol for interacting with Provider as well as broadcasts transactions to the blockchain.\n![](./_assets/signer.png)\n\nFor now, you can use one of the following Providers:\n\n* [ProviderSeed](https://github.com/wavesplatform/provider-seed) developed by Waves team creates user account from SEED. ProviderSeed can be used at the app debugging stage.\n* [ProviderWeb](https://github.com/waves-exchange/provider-web) developed by Waves.Exchange team uses an account created or imported into the Waves.Exchange web app via user's private key or seed phrase.\n* [ProviderCloud](https://github.com/waves-exchange/provider-cloud) developed by Waves.Exchange team uses an email-based Waves.Exchange.\n\nYou can also develop your own Provider, see the [Provider Interface](#provider-interface) section below.\n\n### Signer + ProviderWeb: How It Works\n\nWhen Signer requests to sign a transaction, ProviderWeb opens an [iframe](https://html.spec.whatwg.org/multipage/iframe-embed-object.html), where the user can review transaction details and confirm or reject it. Upon confirmation, ProviderWeb generates a digital signature.\n\n\u003ca id=\"restrictions\"\u003e\u003c/a\u003e\n## Restrictions\n\nSigner supports all types of transactions except Exchange transaction and Update Asset Info transaction.\n\nSigner supports all browsers except Brave.\n\n\u003ca id=\"getting-started\"\u003e\u003c/a\u003e\n## Getting Started\n\n### 1. Signer and Provider library installation\n\n* To install Signer library use\n\n   ```bash\n   npm i @waves/signer\n   ```\n\n* To install ProviderSeed developed by Waves team, use\n\n   ```bash\n   npm i @waves/provider-seed @waves/waves-transactions\n   ```\n\n* To install ProviderWeb developed by Waves.Exchange, use\n\n   ```bash\n   npm i @waves.exchange/provider-web\n   ```\n\n   For Windows, use the following format:\n\n   ```bash\n   npm i '@waves.exchange/provider-web'\n   ```\n\n* To install ProviderCloud developed by Waves.Exchange, use\n\n   ```bash\n   npm i @waves.exchange/provider-cloud\n   ```\n\n   For Windows, use the following format:\n\n   ```bash\n   npm i '@waves.exchange/provider-cloud'\n   ```\n\n### 2. Library initialization\n\nAdd library initialization to your app.\n\n* For Testnet \u0026 ProviderSeed:\n\n   ```js\n   import { Signer } from '@waves/signer';\n   import { ProviderSeed } from '@waves/provider-seed';\n   import { libs } from '@waves/waves-transactions';\n\n   const seed = libs.crypto.randomSeed(15);\n   const signer = new Signer({\n     // Specify URL of the node on Testnet\n     NODE_URL: 'https://nodes-testnet.wavesnodes.com'\n   });\n   signer.setProvider(new ProviderSeed(seed));\n   ```\n\n* For Testnet \u0026 Waves.Exchange ProviderWeb:\n\n   ```js\n   import { Signer } from '@waves/signer';\n   import { ProviderWeb } from '@waves.exchange/provider-web';\n   \n   const signer = new Signer({\n     // Specify URL of the node on Testnet\n     NODE_URL: 'https://nodes-testnet.wavesnodes.com'\n   });\n   signer.setProvider(new ProviderWeb('https://testnet.waves.exchange/signer/'))\n   ```\n\n* For Testnet \u0026 Waves.Exchange ProviderCloud:\n\n   ```js\n   import { Signer } from '@waves/signer';\n   import { ProviderCloud } from '@waves.exchange/provider-cloud';\n   \n   const signer = new Signer({\n     // Specify URL of the node on Testnet\n     NODE_URL: 'https://nodes-testnet.wavesnodes.com'\n   });\n   signer.setProvider(new ProviderCloud('https://testnet.waves.exchange/signer/'))\n   ```\n\n* For Mainnet \u0026 Waves.Exchange ProviderWeb:\n\n   ```js\n   import { Signer } from '@waves/signer';\n   import { ProviderWeb } from '@waves.exchange/provider-web';\n   \n   const signer = new Signer();\n   signer.setProvider(new ProviderWeb());\n   ```\n\n* For Mainnet \u0026 Waves.Exchange ProviderCloud:\n\n   ```js\n   import { Signer } from '@waves/signer';\n   import { ProviderCloud } from '@waves.exchange/provider-cloud';\n   \n   const signer = new Signer();\n   signer.setProvider(new ProviderCloud());\n   ```\n\nAfter that you will be able to use Signer features in the app.\n\n### 3. Basic example\n\nNow your application is ready to work with Waves blockchain. Let's test it by implementing basic functionality. For example, we could try to authenticate user, get his/her balances and transfer funds.\n\n```js\nconst user = await signer.login();\nconst balances = await signer.getBalance();\nconst [broadcastedTransfer] = await signer\n  .transfer({amount: 100000000, recipient: 'alias:T:merry'}) // Transfer 1 WAVES to alias merry\n  .broadcast(); // Promise will resolved after user sign and node response\n\nconst [signedTransfer] = await signer\n  .transfer({amount: 100000000, recipient: 'alias:T:merry'}) // Transfer 1 WAVES to alias merry\n  .sign(); // Promise will resolved after user sign\n```\n\n\u003ca id=\"more-examples\"\u003e\u003c/a\u003e\n### More examples\n\nSee example of an app that implements the donate button: \u003chttps://github.com/vlzhr/crypto-donate\u003e.\n\n\u003ca id=\"constructor\"\u003e\u003c/a\u003e\n## Constructor\n\n```js\nnew Signer({\n  NODE_URL: 'string',\n})\n```\n\nCreates an object that features the following [methods](#methods).\n\nParameters:\n\n| Parameter | Default value | Description |\n| :--- | :--- | :--- |\n| NODE_URL | https://nodes.wavesnodes.com | Node that is used to access a blockchain |\n\n\u003c!-- | MATCHER_URL | https://matcher.waves.exchange/ | Matcher that is used to serve orders | --\u003e\n\n\u003ca id=\"methods\"\u003e\u003c/a\u003e\n## Methods\n\n* [User Info](#user-info)\n\n   * [login](#login)\n   * [logout](#logout)\n   * [getBalance](#getbalance)\n   * [getSponsoredBalances](#getsponsoredbalances)\n\n* [Сreate Transactions](#create-transactions)\n\n   * [Common fields](#common-fields)\n   * [How to sign and broadcast transactions](#how-to-sign-and-broadcast-transactions)\n   * [alias](#alias)\n   * [burn](#burn)\n   * [cancelLease](#cancellease)\n   * [data](#data)\n   * [invoke](#invoke)\n   * [issue](#issue)\n   * [lease](#lease)\n   * [massTransfer](#masstransfer)\n   * [reissue](#reissue)\n   * [setAssetScript](#setassetscript)\n   * [setScript](#setscript)\n   * [sponsorship](#sponsorship)\n   * [transfer](#transfer)\n   * [batch](#batch)\n\n* [Others](#others)\n\n   * [broadcast](#broadcast)\n   * [getNetworkByte](#getnetworkbyte)\n   * [setProvider](#setprovider)\n   * [waitTxConfirm](#waittxconfirm)\n\nIn code you can use [TypeScript types](https://github.com/wavesplatform/ts-types/blob/master/transactions/index.ts).\n\n\u003ca id=\"user-info\"\u003e\u003c/a\u003e\n### User Info\n\n\u003ca id=\"login\"\u003e\u003c/a\u003e\n#### login\n\nAuthenticates user with his/her account; creates account if it don't exist.\n\n```js\nlogin();\n```\n\n**Returns:**\nPromise of user data: address and public key.\n\n\n**Usage:**\n```ts\nconst {address, publicKey} = await signer.login();\n```\n\n**Output example:**\n\n```js\n{\n  address: '3P8pGyzZL9AUuFs9YRYPDV3vm73T48ptZxs',\n  publicKey: 'FuChbN7t3gvW5esgARFytKNVuHSCZpXSYf1y3eDSruEN',\n}\n```\n\n\u003ca id=\"logout\"\u003e\u003c/a\u003e\n#### logout\n\nLogs user out.\n\n```js\nlogout();\n```\n\n**Returns:** Promise\\\u003cvoid\\\u003e.\n\n**Usage:**\n```ts\nawait signer.logout();\n```\n\n\u003ca id=\"getbalance\"\u003e\u003c/a\u003e\n#### getBalance\n\nIf user logged in, provides balances of assets in user's portfolio.\n\n```js\ngetBalance();\n```\n\n**Returns:** Promise of list of balances.\n\n**Usage:**\n\n```ts\nconst balances = await signer.getBalance();\n```\n\n**Output example:**\n\n```js\n[{\n  assetId: 'WAVES',\n  assetName: 'Waves',\n  decimals: 8,\n  amount: 100000000,\n  isMyAsset: false,\n  tokens: 1,\n  sponsorship: null,\n  isSmart: false\n},\n{\n  assetId: 'AcrRM9STdBu5PNiFveTCbRFTS8tADhKcsbC2KBp8A4tx',\n  assetName: 'CoffeeCoin',\n  decimals: 3,\n  amount: 1500,\n  isMyAsset: false,\n  tokens: 1.5,\n  isSmart: false,\n  sponsorship: 500\n}]\n```\n\n**Output fields:**\n\n| Field name | Description |\n| :--- | :--- |\n| assetId | Base58 encoded ID of the asset |\n| assetName | Name of the asset |\n| decimals | Number of decimal places in the asset amount |\n| amount | Amount of asset multiplied by 10^`decimals`. For example, `decimals` of WAVES is 8, so the real amount is multipied by 10^8. `{ \"WAVES\": 677728840 }` means 6.77728840 |\n| isMyAsset | `true` if current user is an asset issuer |\n| tokens | Amount of asset to display in app interface |\n| sponsorship | Amount of sponsored asset to be charged to users (per 0.001 WAVES) multiplied by 10^`decimals`\u003cbr\u003e`null` if the asset is not sponsored |\n| isSmart | `true` for [smart assets](https://docs.waves.tech/en/building-apps/smart-contracts/what-is-smart-asset) |\n\n\u003ca id=\"getsponsoredbalances\"\u003e\u003c/a\u003e\n#### getSponsoredBalances\n\nIf user logged in, provides balances of sponsored assets in user's portfolio. See [Sponsored Fee](https://docs.waves.tech/en/blockchain/waves-protocol/sponsored-fee).\n\n```js\ngetSponsoredBalances();\n```\n\n**Returns:** Promise of list of balances.\n\n**Usage:**\n\n```ts\nconst sponsoredBalances = await signer.getSponsoredBalances();\n```\n\n**Output example:**\n\n```js\n[{\n  assetId: 'AcrRM9STdBu5PNiFveTCbRFTS8tADhKcsbC2KBp8A4tx',\n  assetName: 'CoffeeCoin',\n  decimals: 3,\n  amount: 1500,\n  isMyAsset: false,\n  tokens: 1.5,\n  isSmart: false,\n  sponsorship: 500\n}]\n```\n\n**Output fields** are the same as in [getBalance](#getbalance) method.\n\n\u003ca id=\"create-transactions\"\u003e\u003c/a\u003e\n### Create transactions\n\nThe following methods create transactions (but do not sign or broadcast them):\n\n* [alias](#alias)\n* [burn](#burn)\n* [cancelLease](#cancellease)\n* [data](#data)\n* [invoke](#invoke)\n* [issue](#issue)\n* [lease](#lease)\n* [massTransfer](#masstransfer)\n* [reissue](#reissue)\n* [setAssetScript](#setassetscript)\n* [setScript](#setscript)\n* [sponsorship](#sponsorship)\n* [transfer](#transfer)\n\n\u003e Check which of these transactions are supported by your Provider.\n\n\u003ca id=\"common-fields\"\u003e\u003c/a\u003e\n#### Common fields\n\nEach create transaction method has optional fields that you don't specify manually in most cases:\n\n| Field name | Description | Default value |\n| :--- | :--- | :--- |\n| chainId | 'W'.charCodeAt(0) or 87 means Mainnet\u003cbr/\u003e'T'.charCodeAt(0) or 84 means Testnet | Defined by configuration of Waves node that is set in [Constructor](#constructor) |\n| fee | Transaction fee | Calculated automatically as described in [Transaction fee](https://docs.waves.tech/en/blockchain/transaction/transaction-fee) section |\n| proofs | Array of transaction signatures | Added by `sign` or `broadcast` method (see [How to Sign and Broadcast Transactions](#how-to-sign-and-broadcast-transactions)). If you specify a proof manually, it is also added to the array |\n| senderPublicKey | Base58 encoded public key of transaction sender | Returned by [login](#login) method |\n\n\u003ca id=\"how-to-sign-and-broadcast-transactions\"\u003e\u003c/a\u003e\n#### How to Sign and Broadcast Transactions\n\nEach create transaction method returns object that features the `sign` and `broadcast` methods.\n\nTo sign transaction use `sign` method. For example:\n\n```js\nsigner.invoke({\n   dApp: address,\n   call: { function: name, args: convertedArgs },\n}).sign();\n```\n\nTo sign transaction and immediately send it to blockchain use `broadcast` method. For example:\n\n```js\nsigner.invoke({\n   dApp: address,\n   call: { function: name, args: convertedArgs },\n}).broadcast();\n```\n\nNote: this `broadcast` method has the same options as the [signer.broadcast](#broadcast) method that is described below.\n\nYou can sign or broadcast several transactions at once. For example:\n\n```js\nsigner.alias({ 'new_alias', })\n  .data([{ key: 'value', type: 'integer', value: 1 ])\n  .transfer({ recipient: '3P8pGyzZL9AUuFs9YRYPDV3vm73T48ptZxs', amount: 10000 })\n}).broadcast();\n```\n\n\u003ca id=\"alias\"\u003e\u003c/a\u003e\n#### alias\n\nCreates [Create Alias transaction](https://docs.waves.tech/en/blockchain/transaction-type/create-alias-transaction).\n\n```js\nalias(data: {\n  alias: 'string'\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| alias* | | Short and easy to remember name of address. See [Alias](https://docs.waves.tech/en/blockchain/account/alias) for more information |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst data = {\n  alias: 'new_alias',\n}\n\nconst [tx] = await signer\n  .alias(data)\n  .broadcast();\n```\n\n\u003ca id=\"burn\"\u003e\u003c/a\u003e\n#### burn\n\nCreates [Burn transaction](https://docs.waves.tech/en/blockchain/transaction-type/burn-transaction).\n\n```js\nburn(data: {\n    assetId*: 'string',\n    quantity*: LONG,\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| assetId* | | Base58 encoded ID of the asset to burn |\n| quantity* | | Amount of asset multiplied by 10^`decimals`. For example, `decimals` of WAVES is 8, so the real amount is multipied by 10^8. `{ \"WAVES\": 677728840 }` means 6.77728840 |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst data = {\n  assetId: '4uK8i4ThRGbehENwa6MxyLtxAjAo1Rj9fduborGExarC',\n  quantity: 100,\n}\n\nconst [tx] = await signer\n  .burn(data)\n  .broadcast();\n```\n\n\u003ca id=\"cancellease\"\u003e\u003c/a\u003e\n#### cancelLease\n\nCreates [Lease Cancel transaction](https://docs.waves.tech/en/blockchain/transaction-type/lease-cancel-transaction).\n\n```js\ncancelLease(data: {\n    leaseId: 'string',\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| leasetId* | | Base58 encoded ID of the Lease transaction |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst data = {\n  leaseId: '69HK14PEHq2UGRfRYghVW8Kc3487uJaoUmk2ntT4kw7X',\n}\n\nconst [tx] = await signer\n  .cancelLease(data)\n  .broadcast();\n```\n\n\u003ca id=\"data\"\u003e\u003c/a\u003e\n#### data\n\nCreates [Data transaction](https://docs.waves.tech/en/blockchain/transaction-type/data-transaction).\n\n```js\ndata(data: [{\n  key: 'string',\n  type: 'string' | 'integer' | 'binary' | 'boolean',\n  value: 'string' | number | boolean,\n])\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| key* | | Key of a record. Maximum of 100 characters |\n| type | | Type of a record |\n| value* | | Value of a record. Maximum of 5 Kbytes |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst records = [\n  { key: 'name', type: 'string', value: 'Lorem ipsum dolor sit amet' },\n  { key: 'value', type: 'integer', value: 1234567 },\n  { key: 'flag', type: 'boolean', value: true }\n]\n\nconst [tx] = await signer\n  .data({ data: records })\n  .broadcast();\n```\n\n\u003c!-- \u003ca id=\"exchange\"\u003e\u003c/a\u003e\n#### exchange\n\nCreates [exchange](https://docs.waves.tech/en/blockchain/transaction-type/exchange-transaction) transaction.\n\n```js\nexchange(data: {\n  buyOrder: IExchangeTransactionOrder\u003cLONG\u003e \u0026 IWithProofs (??),\n  sellOrder: IExchangeTransactionOrder\u003cLONG\u003e \u0026 IWithProofs,\n  price: LONG,\n  amount: LONG,\n  buyMatcherFee: LONG,\n  sellMatcherFee: LONG,\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| buyOrder* | | Key of a record. Maximum of 100 characters |\n| sellOrder* | | Type of a record |\n| price* | | Value of a record. Maximum of 5 Kbytes |\n| amount* | | Value of a record. Maximum of 5 Kbytes |\n| buyMatcherFee* | | Value of a record. Maximum of 5 Kbytes |\n| sellMatcher* | | Value of a record. Maximum of 5 Kbytes |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Returns:** Promise of ???\n\n**Usage:**\n\n```js\nconst data = {}\n\nconst [tx] = await signer\n  .exchange(data)\n  .broadcast();\n```--\u003e\n\n\u003ca id=\"invoke\"\u003e\u003c/a\u003e\n#### invoke\n\nCreates [Invoke Scipt transaction](https://docs.waves.tech/en/blockchain/transaction-type/invoke-script-transaction).\n\n```js\ninvoke(data: {\n  dApp: 'string',\n  fee: LONG,\n  payment: [{\n    assetId: 'string',\n    amount: LONG,\n  }],\n  call: {\n    function: 'string',\n    args: [{\n      type: 'integer' | 'string' | 'binary',\n      value: number | 'string',\n    }],\n  },\n  feeAssetId: 'string',\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| dApp* | | Base58 encoded address or alias (with `alias:T:` prefix) of the dApp whose script should be invoked |\n| fee | | We recommend to specify fee depending on number of action performed by called function (see [Transaction Fee](https://docs.waves.tech/en/blockchain/transaction/transaction-fee)) |\n| payment | | Payments attached to the transaction. Maximum of two payments |\n| payment.assetId* | | Base58 encoded ID of the asset to pay. `WAVES` or `null` means WAVES |\n| payment.amount* | | Amount of asset multiplied by 10^`decimals`. For example, `decimals` of WAVES is 8, so the real amount is multipied by 10^8. `{ \"WAVES\": 677728840 }` means 6.77728840 |\n| call | Default function should be invoked in the dApp | Parameters for called function |\n| call.function* | | Name of the function that is called |\n| call.args* | | Arguments for the function  that is called |\n| call.args.type* | | Type of argument |\n| call.args.value* | | Value of argument |\n| feeAssetId | WAVES | Base58 encoded ID of the sponsored asset to pay the fee. See the [Sponsored Fee](https://docs.waves.tech/en/blockchain/waves-protocol/sponsored-fee) article for more information. `null` or omitted field means WAVES |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n```ts\nconst data = {\n  dApp: '3Fb641A9hWy63K18KsBJwns64McmdEATgJd',\n  fee: 1000000,\n  payment: [{\n    assetId: '73pu8pHFNpj9tmWuYjqnZ962tXzJvLGX86dxjZxGYhoK',\n    amount: 7,\n  }],\n  call: {\n    function: 'foo',\n    args: [\n      { type: 'integer', value: 1 },\n      { type: 'binary', value: 'base64:AAA=' },\n      { type: 'string', value: 'foo' }\n    ],\n  },\n}\n\nconst [tx] = await signer\n  .invoke(data)\n  .broadcast();\n```\n\n\u003ca id=\"issue\"\u003e\u003c/a\u003e\n#### issue\n\nCreates [Issue transaction](https://docs.waves.tech/en/blockchain/transaction-type/issue-transaction).\n\n```js\nissue(data: {\n  name: 'string',\n  decimals: number,\n  quantity: LONG,\n  reissuable: boolean,\n  description: 'string',\n  script: 'string',\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| name* | | Asset name |\n| decimals* | | Number of digits in decimal part |\n| quantity* | | Amount of asset multiplied by 10^`decimals` |\n| reissuable* | | `true` – asset reissue is possible.\u003cbr\u003e`false` — asset reissue is not possible |\n| description* | | Asset description |\n| script | | Base64 encoded script (with `base64:` prefix) to be attached to to asset |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst data = {\n  name: 'MyToken',\n  decimals: 8,\n  quantity: 100000000000,\n  reissuable: true,\n  description: 'It is a gaming token',\n}\n\nconst [tx] = await signer\n  .issue(data)\n  .broadcast();\n```\n\n\u003ca id=\"lease\"\u003e\u003c/a\u003e\n#### lease\n\nCreates [Lease transaction](https://docs.waves.tech/en/blockchain/transaction-type/lease-transaction).\n\n```js\nlease(data: {\n    amount: LONG,\n    recipient: 'string',\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| amount* | | Amount of WAVES multiplied by 10^8. For example, `{ \"WAVES\": 677728840 }` means 6.77728840 |\n| recipient* | | Base58 encoded [address](https://docs.waves.tech/en/blockchain/account/address) or alias (with `alias:T:` prefix) of the recipient |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst data = {\n    amount: 10000,\n    recipient: 'alias:T:merry',\n}\n\nconst [tx] = await signer\n  .lease(data)\n  .broadcast();\n```\n\n\u003ca id=\"masstransfer\"\u003e\u003c/a\u003e\n#### massTransfer\n\nCreates [Mass Transfer transaction](https://docs.waves.tech/en/blockchain/transaction-type/mass-transfer-transaction).\n\n```js\nmassTransfer(data: {\n  assetId: 'string',\n  transfers: [{\n    amount: LONG,\n    recipient: 'string',\n  }],\n  attachment: 'string',\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| assetId | WAVES | Base58 encoded ID of the asset to transfer |\n| transfers* | | List of transfers |\n| transfers.amount* | | Amount of asset multiplied by 10^`decimals`. For example, `decimals` of WAVES is 8, so the real amount is multipied by 10^8. `{ \"WAVES\": 677728840 }` means 6.77728840 |\n| transfers.recipient* | | Base58 encoded [address](https://docs.waves.tech/en/blockchain/account/address) or alias (with `alias:T:` prefix) of the recipient |\n| attachment | | Optional binary data base58 encoded. This field is often used to attach a comment to the transaction. The maximum data size is 140 bytes |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst crypto = require('@waves/ts-lib-crypto')\n\nconst data = {\n    transfers: [\n    {\n      amount: 100,\n      recipient: '3P23fi1qfVw6RVDn4CH2a5nNouEtWNQ4THs',\n    },\n    {\n      amount: 200,\n      recipient: 'alias:T:merry',\n    }],\n    attachment: crypto.base58Encode(crypto.stringToBytes('sample message for recipient'))\n]\n\nconst [tx] = await signer\n  .massTransfer(data)\n  .broadcast();\n```\n\n\u003ca id=\"reissue\"\u003e\u003c/a\u003e\n#### reissue\n\nCreates [Reissue transaction](https://docs.waves.tech/en/blockchain/transaction-type/reissue-transaction).\n\n```js\nreissue(data: {\n  assetId: 'string',\n  quantity: LONG,\n  reissuable: boolean,\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| assetId* | | Base58 encoded ID of the asset to reissue |\n| quantity* | | Amount of asset multiplied by 10^`decimals` to reissue |\n| reissuable* | | `true` – asset reissue is possible.\u003cbr\u003e`false` — asset reissue is not possible |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst data = {\n  assetId: 'AcrRM9STdBu5PNiFveTCbRFTS8tADhKcsbC2KBp8A4tx'\n  quantity: 100000000000,\n  reissuable: true,\n}\n\nconst [tx] = await signer\n  .reissue(data)\n  .broadcast();\n```\n\n\u003ca id=\"setassetscript\"\u003e\u003c/a\u003e\n#### setAssetScript\n\nCreates [Set Asset Script transaction](https://docs.waves.tech/en/blockchain/transaction-type/set-asset-script-transaction).\n\n```js\nsetAssetScript(data: {\n  assetId: 'string',\n  script: 'string',\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| assetId* | | Base58 encoded ID of the asset |\n| script | | Base64 encoded script (with `base64:` prefix) to be attached to the asset |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst data = {\n  assetId: 'AcrRM9STdBu5PNiFveTCbRFTS8tADhKcsbC2KBp8A4tx',\n  script: 'base64:AwZd0cYf',\n}\n\nconst [tx] = await signer\n  .setAssetScript(data)\n  .broadcast();\n```\n\n\u003ca id=\"setscript\"\u003e\u003c/a\u003e\n#### setScript\n\nCreates [Set Script transaction](https://docs.waves.tech/en/blockchain/transaction-type/set-script-transaction).\n\n```js\nsetScript(data: {\n  script: 'string',\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| script | | Base64 encoded [account script](https:/docs.waves.tech/en/ride/script/script-types/account-script) or [dApp script](https://docs.waves.tech/en/ride/script/script-types/dapp-script) (with `base64:` prefix) to be attached to the user account. `null` means cancelling the script |\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst data = {\n  script: 'base64:AAIDAAAAAAAAAAQIARIAAAAAAAAAAA...',\n}\n\nconst [tx] = await signer\n  .setScript(data)\n  .broadcast();\n```\n\n\u003ca id=\"sponsorship\"\u003e\u003c/a\u003e\n#### sponsorship\n\nCreates [Sponsor Fee transaction](https:/docs.waves.tech/en/blockchain/waves-protocol/sponsored-fee).\n\n```js\nsponsorship(data: {\n    assetId: 'string',\n    minSponsoredAssetFee: LONG,\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| assetId* | | Base58 encoded ID of the asset |\n| minSponsoredAssetFee | | Required amount of sponsored token to be charged to users (per 0.001 WAVES) multiplied by 10^`decimals` |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst data = {\n  assetId: 'AcrRM9STdBu5PNiFveTCbRFTS8tADhKcsbC2KBp8A4tx',\n  minSponsoredAssetFee: 314,\n}\n\nconst [tx] = await signer\n  .sponsorship(data)\n  .broadcast();\n```\n\n\u003ca id=\"transfer\"\u003e\u003c/a\u003e\n#### transfer\n\nCreates [Transfer transaction](https://docs.waves.tech/en/blockchain/transaction-type/transfer-transaction).\n\n```js\ntransfer(data: {\n  recipient: 'string',\n  amount: LONG,\n  assetId: 'string',\n  attachment: 'string',\n  feeAssetId: 'string',\n})\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| recipient* | | Base58 encoded [address](https://docs.waves.tech/en/blockchain/account/address) or alias (with `alias:T:` prefix) of the recipient |\n| amount* | | Amount of asset multiplied by 10^`decimals`. For example, `decimals` of WAVES is 8, so the real amount is multipied by 10^8. `{ \"WAVES\": 677728840 }` means 6.77728840 |\n| assetId | WAVES | Base58 encoded ID of the asset to transfer. `null` or omitted field means WAVES |\n| attachment | | Optional binary data base58 encoded. This field is often used to attach a comment to the transaction. The maximum data size is 140 bytes |\n| feeAssetId | WAVES | Base58 encoded ID of the sponsored asset to pay the fee. See the [Sponsored Fee](https://docs.waves.tech/en/blockchain/waves-protocol/sponsored-fee) article for more information. `null` or omitted field means WAVES |\n\n\\* Required parameter.\n\nSee [Common fields](#common-fields) for other fields description.\n\n**Usage:**\n\n```js\nconst crypto = require('@waves/ts-lib-crypto')\n\nconst data = {\n  recipient: '3P8pGyzZL9AUuFs9YRYPDV3vm73T48ptZxs',\n  amount: 10000,\n  attachment: crypto.base58Encode(crypto.stringToBytes('sample message for recipient'))\n}\n\nconst [tx] = await signer\n  .transfer(data)\n  .broadcast();\n```\n\n\u003ca id=\"batch\"\u003e\u003c/a\u003e\n#### batch\n\nCreates list of transactions.\n\n```js\nbatch([{\n  type: number,\n  ... // fields depending on the transaction type\n}])\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| type* | | [Transaction type ID](https://docs.waves.tech/en/blockchain/transaction-type/) |\n\n\\* Required parameter.\n\n**Usage:**\n\n```js\nconst [transfer, alias, issue] = await signer.batch([\n  {\n    type: 4,\n    recipient: 'alias:T:merry',\n    amount: 100000000\n  },\n  {\n    type: 10,\n    alias: 'send33'\n  },\n  {\n    type: 3,\n    name: 'SomeTokenName',\n    description: 'Some Token Description',\n    reissuable: false,\n    quantity: 100,\n    decimals: 1\n  }\n]).sign(); // Or broadcast\n```\n\nIn this example, `sign` method returns array of signed transactions in the same order as they are defined in `batch`.\n\n### Others\n\n\u003ca id=\"broadcast\"\u003e\u003c/a\u003e\n#### broadcast\n\nSends transactions that are already signed to the blockchain.\n\n```js\nbroadcast(tx,[options])\n```\n\n**Returns:** Promise of node response. See the [POST /transactions/broadcast](https://docs.waves.tech/en/waves-node/node-api/transactions) method description of Node API.\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| tx* | | Signed transaction or array of signed transactions |\n| options.chain | false | [Type: boolean] Send the next transaction only after the previous transaction is put in the blockchain and confirmed |\n| options.confirmations | -1 | Number of confirmations after that the Promise is resolved:\u003cbr\u003eless than 0 – Promise is resolved when the transaction is put in UTX pool\u003cbr\u003e0 – Promise is resolved when the block that contains the transaction is added to the blockchain\u003cbr\u003e1 – Promise is resolved when the next block is added to the blockchain and so on |\n\n\\* Required parameter.\n\n**Usage:**\n\n```js\nconst [transfer1] = await signer.transfer({amount: 1, recipient: 'alias:T:merry'}).sign();\nconst [transfer2] = await signer.transfer({amount: 1, recipient: 'alias:T:merry'}).sign();\n\nawait signer.broadcast([transfer1, transfer2], {chain: true, confirmations: 2});\n```\n\nIn this example:\n\n* `transfer1` transaction is sent to the node and put in UTX pool.\n* Block with `transfer1` and two more blocks are added to the blockchain.\n* `transfer2` transaction is sent to the node and put in UTX pool.\n* Block with `transfer2` and two more blocks are added to the blockchain.\n* Promise is resolved and you can notify user that his/her transactions are confirmed.\n\n\u003ca id=\"getnetworkbyte\"\u003e\u003c/a\u003e\n#### getNetworkByte\n\nObtains [chain ID](https://docs.waves.tech/en/blockchain/blockchain-network/#chain-id).\n\n```js\ngetNetworkByte();\n```\n\n**Returns:** Promise of chain ID.\n\n**Usage:**\n\n```js\nconst chainId = signer.getNetworkByte();\n```\n\n\u003ca id=\"setprovider\"\u003e\u003c/a\u003e\n#### setProvider\n\nSpecifies a Provider that is used to sign transactions. See [Provider Interface](#provider-interface) to find out the provider requirements.\n\n```js\nsetProvider(provider);\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| provider* | | Object that features Provider interface |\n\n\\* Required parameter.\n\n**Usage:**\n```js\nsigner.setProvider(new Provider());\n```\n\n\u003ca id=\"waittxconfirm\"\u003e\u003c/a\u003e\n#### waitTxConfirm\n\nWaits for the transaction to appear in the blockchain.\n\n```js\nwaitTxConfirm(tx, confirmations)\n```\n\n**Parameters:**\n\n| Parameter name | Default value | Description |\n| :--- | :--- | :--- |\n| tx* | | Transaction or array transactions that are sent to the blockchain |\n| confirmations* | | Number of blocks added to the blockchain after the block that contains the transaction |\n\n\\* Required parameter.\n\n**Usage:**\n```ts\nconst [tx] = await signer\n  .transfer({amount: 10000000, recipient: 'alias:T:merry'})\n  .broadcast();\n\nsigner.waitTxConfirm(tx, 1).then((tx) =\u003e {\n  // Tx have one confirmation\n}});\n```\n\n\u003ca id=\"provider-interface\"\u003e\u003c/a\u003e\n## Provider Interface \n\n\u003e :warning: To ensure the security of user data, Provider should be based on `iframe`.\n\nProvider should feature the following interface:\n\n```js\ninterface Provider {\n\n    /**\n     * Signer subscribes to login events in the Provider\n     * When triggered, the Provider passes user data: address and public key \n     * For further unsubscribe Signer calls `off`\n     */\n    on(\n        event: 'login',\n        handler:({ address: string; publicKey: string }) =\u003e any \n    ) =\u003e Provider;\n\n    /**\n     * Signer subscribes to logout events in the Provider\n     * For further unsubscribe Signer calls `off`\n     */\n    on( event: 'logout', handler:() =\u003e any) =\u003e Provider;\n\n    /**\n     * Signer subscribes to the first login event in the Provider\n     * When triggered, the Provider passes user data: address and public key,\n     *   then cancels the subscription\n     */\n    once(\n        event: 'login',\n        handler:({ address: string; publicKey: string }) =\u003e any \n    ) =\u003e Provider;\n\n    /**\n     * Signer subscribes to the first logout event in the Provider\n     * When triggered, the Provider cancels the subscription\n     */\n    once( event: 'logout', handler:() =\u003e any) =\u003e Provider;\n\n    /**\n     * Signer unsubscribes from events previously subscribed to\n     */\n    off(\n        event: 'login',\n        handler:({ address: string; publicKey: string }) =\u003e any \n    ) =\u003e Provider;\n    off( event: 'logout', handler:() =\u003e any) =\u003e Provider;\n\n    /**\n     * Sets connection to Waves node\n     * @param options\n     */\n    connect(options: {NODE_URL: string, NETWORK_BYTE: number}): Promise\u003cvoid\u003e;\n\n    /**\n     * Authenticates user with their account\n     */\n    login(): Promise\u003c{address: string, publicKey: string}\u003e;\n\n    /**\n     * Logs user out\n     */\n    logout(): Promise\u003cvoid\u003e;\n\n    /**\n     * Signs custom message\n     * @param data\n     */\n    signMessage(data: string | number): Promise\u003cstring\u003e;\n\n    /**\n     * Signs typed data\n     * @param data\n     */\n    signTypedData(data: Array\u003cTypedData\u003e): Promise\u003cstring\u003e;\n\n    /**\n     * Signs transactions in array\n     * Here SignedTx\u003cT\u003e is any transaction, T[] is an array of any transactions\n     * @param list\n     */\n    sign\u003cT extends SignerTx\u003e(toSign: T[]): Promise\u003cSignedTx\u003cT\u003e\u003e;\n    sign\u003cT extends Array\u003cSignerTx\u003e\u003e(toSign: T): Promise\u003cSignedTx\u003cT\u003e\u003e;\n}\n```\n\n## Error Codes\n\n| Error's class                  | Code | Type           | Example |\n|:------------------------------|:-----|:---------------|:--------|\n| SignerOptionsError            | 1000 | validation     | Invalid signer options: NODE_URL, debug |\n| SignerNetworkByteError        | 1001 | network        | Could not fetch network from {NODE_URL}: Failed to fetch |\n| SignerAuthError               | 1002 | authorization  | Can't use method: getBalance. User must be logged in |\n| SignerProviderConnectError    | 1003 | network        | Could not connect the Provider |\n| SignerEnsureProviderError     | 1004 | provider       | Can't use method: login. Provider instance is missing\u003cbr/\u003e🛈 Possible reasons: the user is in Incognito mode or has disabled cookies |\n| SignerProviderInterfaceError  | 1005 | validation     | Invalid provider properties: connect |\n| SignerProviderInternalError   | 1006 | provider       | Provider internal error: {...}. This is not error of signer. |\n| SignerApiArgumentsError       | 1007 | validation     | Validation error for invoke transaction: {...}. Invalid arguments: senderPublicKey |\n| SignerNetworkError            | 1008 | network        | Network Error |\n","funding_links":[],"categories":["Frameworks and tools"],"sub_categories":["Client libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavesplatform%2Fsigner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwavesplatform%2Fsigner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavesplatform%2Fsigner/lists"}