{"id":14980228,"url":"https://github.com/melis-wallet/melis-api-js","last_synced_at":"2025-06-30T12:35:42.093Z","repository":{"id":57294309,"uuid":"75060255","full_name":"melis-wallet/melis-api-js","owner":"melis-wallet","description":"JavaScript bindings for Melis API","archived":false,"fork":false,"pushed_at":"2021-09-21T07:51:44.000Z","size":355,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T13:07:34.277Z","etag":null,"topics":["bitcoin","bitcoin-wallet","javascript-bindings","melis","melis-api","multi-user","multisig","wallet"],"latest_commit_sha":null,"homepage":"https://melis.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/melis-wallet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-29T08:33:55.000Z","updated_at":"2024-04-15T06:36:39.000Z","dependencies_parsed_at":"2022-08-29T08:01:40.933Z","dependency_job_id":null,"html_url":"https://github.com/melis-wallet/melis-api-js","commit_stats":null,"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"purl":"pkg:github/melis-wallet/melis-api-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melis-wallet%2Fmelis-api-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melis-wallet%2Fmelis-api-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melis-wallet%2Fmelis-api-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melis-wallet%2Fmelis-api-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melis-wallet","download_url":"https://codeload.github.com/melis-wallet/melis-api-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melis-wallet%2Fmelis-api-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260458880,"owners_count":23012505,"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":["bitcoin","bitcoin-wallet","javascript-bindings","melis","melis-api","multi-user","multisig","wallet"],"created_at":"2024-09-24T14:01:28.992Z","updated_at":"2025-06-30T12:35:42.066Z","avatar_url":"https://github.com/melis-wallet.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript bindings for the Melis bitcoin service\n\n## Overview\n\nThis library provides a JavaScript API to access the remote Melis STOMP APIs\nand easily access the advanced multisig and realtime notification features\nof a Bitcoin Melis wallet.\n\n## Examples usage\n\n### Receive funds\nThis simple code will:\n* Open an existing wallet with at least an account\n* ask for an unused address\n* wait for an incoming (unconfirmed) transaction on the account\n* report if the transaction has been confirmed\n\n```javascript\nvar CM = require('../src/cm')\nvar C = CM.C\nvar cm = new CM({apiDiscoveryUrl: C.MELIS_TEST_DISCOVER})\nvar seed = \"58e5e9e58956d9db4aeff9875994dcf253186d26884ddc25031fab98eff6ea34\" // an existing wallet used for testing purposes\n\nvar myWallet, myAccount, myAddress\n\n// Register an handler that will be notified of new incoming or outcoming transactions\ncm.on(C.EVENT_TX_INFO_NEW, res =\u003e {\n  console.log(\"New transaction received!\\n\", res.txInfo)\n})\n\n// Register an handler to be notified by transactions changing state\n// for example because they have been confirmed\ncm.on(C.EVENT_TX_INFO_UPDATED, res =\u003e {\n  if (res.txInfo.blockMature \u003e 0)\n    console.log(\"TX has been confirmed!\")\n})\n\n// Disable logs, very noisy\ncm.log = function () {}\n\ncm.connect().then((config) =\u003e {\n  console.log(\"Connected to server. Blockchain height: \" + config.topBlock.height)\n  return cm.walletOpen(seed)\n}).then(wallet =\u003e {\n  console.log(\"Wallet opened with seed: \" + seed)\n  myWallet = wallet\n  myAccount = wallet.accounts[Object.keys(wallet.accounts)[0]]\n  console.log(\"Using account \" + myAccount.num + \" with pubId: \" + myAccount.pubId)\n  return cm.getUnusedAddress(myAccount)\n}).then(res =\u003e {\n  myAddress = res.address\n  console.log(\"Waiting for TEST coins to \" + myAddress + \" -- Press ctrl-c to exit\")\n}).catch(error =\u003e {\n  console.log(\"Unexpected exception: \", error)\n})\n```\n\n### Multiuser account\nFirst user runs this script that:\n* registers a new wallet\n* create a 1of2 account and a join code for the second user\n* waits for the second user to join the account (thus rendering the account functional)\n\n```javascript\nvar CM = require('../src/cm')\nvar C = CM.C\nvar cm = new CM({apiDiscoveryUrl: C.MELIS_TEST_DISCOVER})\nvar seed = cm.random32HexBytes()\n\ncm.on(C.EVENT_JOINED, res =\u003e {\n  console.log(\"Cosigner joined: \" + res.activationCode.pubId + \", the account is ready!\")\n  cm.disconnect()\n})\n\ncm.log = function () {} // Disable logs\n\ncm.connect().then((config) =\u003e {\n  console.log(\"Connected to server. Blockchain height: \" + config.topBlock.height)\n  return cm.walletRegister(seed)\n}).then(wallet =\u003e {\n  console.log(\"Wallet opened with seed: \" + seed)\n  return cm.accountCreate({\n    type: C.TYPE_MULTISIG_MANDATORY_SERVER,\n    cosigners: [{name: 'Frank'}],\n    minSignatures: 1}\n  )\n}).then(res =\u003e {\n  var cosigners = res.accountInfo.cosigners\n  let joinCode\n  cosigners.forEach(info =\u003e {\n    if (info.name === 'Frank')\n      joinCode = info.code\n  })\n  console.log(\"Waiting for cosigner with join code \" + joinCode + \" to join my account -- Press ctrl-c to exit\")\n}).catch(error =\u003e {\n  console.log(\"Unexpected exception: \", error)\n})\n```\n\nThe second user runs this script with the joinCode got from the first script and join the multiuser/multisig account:\n\n\u003e node script \"joincode\"\n\n```javascript\nvar CM = require('../src/cm')\nvar C = CM.C\nvar cm = new CM({apiDiscoveryUrl: C.MELIS_TEST_DISCOVER})\nvar seed = cm.random32HexBytes()\n\nif (process.argv.length \u003c 3) {\n  console.log(\"Please pass joinCode as first argument\")\n  process.exit(1)\n}\nvar joinCode = process.argv[2]\n\ncm.log = function () {} // Disable logs\ncm.connect().then((config) =\u003e {\n  console.log(\"Connected to server. Blockchain height: \" + config.topBlock.height + \" joinCode: \" + joinCode)\n  return cm.walletRegister(seed)\n}).then(wallet =\u003e {\n  console.log(\"Wallet opened with seed: \" + seed)\n  return cm.accountJoin({code: joinCode})\n}).then(res =\u003e {\n  console.log(\"Multisig account joined with joinCode: \" + joinCode)\n  return cm.disconnect()\n}).catch(error =\u003e {\n  console.log(\"Unexpected exception: \", error)\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelis-wallet%2Fmelis-api-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelis-wallet%2Fmelis-api-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelis-wallet%2Fmelis-api-js/lists"}