{"id":22972834,"url":"https://github.com/bajetech/js-digitalbits-wallets","last_synced_at":"2025-04-02T06:44:50.211Z","repository":{"id":57100156,"uuid":"449190902","full_name":"bajetech/js-digitalbits-wallets","owner":"bajetech","description":"A library to make it easier to write wallets that interact with the DigitalBits blockchain.","archived":false,"fork":false,"pushed_at":"2022-02-09T03:48:10.000Z","size":670,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T20:23:12.877Z","etag":null,"topics":["blockchain","digitalbits","keystore","wallets"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@bajetech/digitalbits-wallet-sdk","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bajetech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-18T07:54:11.000Z","updated_at":"2022-01-28T20:09:25.000Z","dependencies_parsed_at":"2022-08-22T23:10:47.412Z","dependency_job_id":null,"html_url":"https://github.com/bajetech/js-digitalbits-wallets","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bajetech%2Fjs-digitalbits-wallets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bajetech%2Fjs-digitalbits-wallets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bajetech%2Fjs-digitalbits-wallets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bajetech%2Fjs-digitalbits-wallets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bajetech","download_url":"https://codeload.github.com/bajetech/js-digitalbits-wallets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246769981,"owners_count":20830769,"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":["blockchain","digitalbits","keystore","wallets"],"created_at":"2024-12-14T23:19:43.706Z","updated_at":"2025-04-02T06:44:50.186Z","avatar_url":"https://github.com/bajetech.png","language":"TypeScript","readme":"# js-digitalbits-wallets\n\n\u003e A library to make it easier to write wallets that interact with the DigitalBits blockchain.\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@bajetech/digitalbits-wallet-sdk\"\u003e\n    \u003cimg alt=\"npm (scoped)\" src=\"https://img.shields.io/npm/v/@bajetech/digitalbits-wallet-sdk?style=for-the-badge\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://nodejs.org\"\u003e\n    \u003cimg alt=\"Node.js\" src=\"https://img.shields.io/badge/node-\u003e=14-yellowgreen?style=for-the-badge\u0026labelColor=000000\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/bajetech/js-digitalbits-wallets/actions/workflows/pipeline.yml\"\u003e\n    \u003cimg alt=\"GitHub Workflow Status\" src=\"https://img.shields.io/github/workflow/status/bajetech/js-digitalbits-wallets/js-digitalbits-wallets%20CI?label=GitHub%20Actions\u0026logo=github\u0026style=for-the-badge\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```bash\nyarn add @bajetech/digitalbits-wallet-sdk  # or npm i @bajetech/digitalbits-wallet-sdk\n```\n\n## Usage\n\nThis library provides straightforward APIs for handling the following tasks:\n\n- Fetching and formatting data from the DigitalBits blockchain network\n- Encrypting and storing secret keys\n\nSome things the library will try to do well:\n\n- Useful type definitions\n- Consistent, descriptive names\n- Provide one obvious, streamlined way of accomplishing each task\n\nThis is not an attempt to replace `xdb-digitalbits-sdk`, it's meant to provide a better\nAPI in some areas (data-fetching) and new functionality in others\n(key management).\n\n## Fetching and formatting data\n\nOur library's goal is to provide typed, consistently-named DigitalBits data through\na consistent, predictable API.\n\nNote that our goal was to name data properties to be _internally consistent_ and\nintuitive, _not_ to be perfectly consistent with Frontier's responses. In some\ncases (particularly around offer / trade history), properties were renamed for\nclarity.\n\n```js\nimport { DataProvider } from \"@bajetech/digitalbits-wallet-sdk\";\nimport { Networks } from \"xdb-digitalbits-sdk\";\n\n// You'll use your DataProvider instance to ask for data from DigitalBits.\nconst dataProvider = new DataProvider({\n  serverUrl: \"https://frontier.livenet.digitalbits.io\",\n  accountOrKey: \"\u003c\u003cInsert public key\u003e\u003e\",\n  networkPassphrase: Networks.PUBLIC,\n});\n\n// Some class functions will fetch data directly.\nconst offers = await dataProvider.fetchOpenOffers({\n  limit: 20,\n  order: \"desc\",\n});\n\n// Others will watch the network for changes and invoke callback when it happens.\ndataProvider.watchAccountDetails({\n  onMessage: accountDetails =\u003e {\n    console.log(\"Latest account details: \", accountDetails);\n  },\n  onError: err =\u003e {\n    console.log(\"error: \", err);\n  },\n});\n```\n\n## Encrypting and storing secret keys\n\nOur KeyManager class allows you to securely encrypt keys client-side so you're\nnever sending sensitive information (the user's key or password) over the wire\nin a raw state.\n\n```js\nimport {\n  KeyManager,\n  KeyManagerPlugins,\n  KeyType,\n} from \"@bajetech/digitalbits-wallet-sdk\";\n\n// To instantiate a keyManager instance, pass it an object that conforms to\n// the KeyStore interface.\nconst keyManager = new KeyManager({\n  // The library comes with a sample KeyStore that stores keys in memory.\n  keyStore: new KeyManagerPlugins.MemoryKeyStore(),\n});\n\n// Then, you need to register an encrypter to handle encrypting / decrypting keys.\n// The library comes with two samples. (Don't use the Identity Encrypter in prod!)\nkeyManager.registerEncrypter(KeyManagerPlugins.ScryptEncrypter);\n\n// If you're writing a production wallet, you'll probably want to write your own\n// KeyStore and/or Encrypter. Make sure they conform to the `KeyStore` and\n// `Encrypter` interfaces defined in these docs. You can use the `PluginTesting`\n// functions to make sure that your plugins meet spec!\n\nthis.state.keyManager\n  .storeKey({\n    // The KeyManager takes keys that conform to our Key interface.\n    key: {\n      type: KeyType.plaintextKey,\n      publicKey: \"\u003c\u003cInsert public key\u003e\u003e\",\n      privateKey: \"\u003c\u003cInsert private key\u003e\u003e\",\n    },\n\n    password: \"hunter2\",\n    encrypterName: KeyManagerPlugins.ScryptEncrypter.name,\n  })\n  .then(keyMetadata =\u003e {\n    console.log(\"Successfully encrypted and stored key: \", keyMetadata);\n  })\n  .catch(e =\u003e {\n    console.log(\"Error saving key: \", e.toString());\n  });\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbajetech%2Fjs-digitalbits-wallets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbajetech%2Fjs-digitalbits-wallets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbajetech%2Fjs-digitalbits-wallets/lists"}