{"id":18355801,"url":"https://github.com/perlin-network/wavelet-client-js","last_synced_at":"2025-04-06T12:32:07.492Z","repository":{"id":35030278,"uuid":"194626121","full_name":"perlin-network/wavelet-client-js","owner":"perlin-network","description":"A stateless HTTP client for interacting with a Wavelet node. Written in JavaScript.","archived":false,"fork":false,"pushed_at":"2023-01-04T21:53:55.000Z","size":2134,"stargazers_count":15,"open_issues_count":20,"forks_count":4,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-05-30T02:02:08.815Z","etag":null,"topics":["blockchain","browser","http-client","javascript","nodejs","smart-contract-tools","smart-contracts","wallet"],"latest_commit_sha":null,"homepage":"","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/perlin-network.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":"2019-07-01T07:55:46.000Z","updated_at":"2023-02-03T09:06:04.000Z","dependencies_parsed_at":"2023-01-15T12:22:28.950Z","dependency_job_id":null,"html_url":"https://github.com/perlin-network/wavelet-client-js","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perlin-network%2Fwavelet-client-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perlin-network%2Fwavelet-client-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perlin-network%2Fwavelet-client-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perlin-network%2Fwavelet-client-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perlin-network","download_url":"https://codeload.github.com/perlin-network/wavelet-client-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247484419,"owners_count":20946385,"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","browser","http-client","javascript","nodejs","smart-contract-tools","smart-contracts","wallet"],"created_at":"2024-11-05T22:08:01.379Z","updated_at":"2025-04-06T12:32:06.875Z","avatar_url":"https://github.com/perlin-network.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `wavelet-client`\n\n[![crates.io](https://img.shields.io/npm/v/wavelet-client.svg)](https://www.npmjs.com/package/wavelet-client)\n[![Discord Chat](https://img.shields.io/discord/458332417909063682.svg)](https://discord.gg/dMYfDPM)\n\nA developer-friendly stateless HTTP client for interacting with a Wavelet node. Wrriten in JavaScript.\n\n\n### **Wavelet (Himitsu)**\nStarting from v2, **wavelet-client** will support the new version of Wavelet (Himitsu).\n\nFor support of older Wavelet please use v1.\n\nThe entire source code of this client was written to just fit within a single JavaScript file to make\nthe underlying code simple and easy to understand. The client has a _very_ minimal set of dependencies\nthat are well-audited.\n\nThe client has been tested to work on both NodeJS alongside on the browser. As a warning, the client uses\nsome newer language features such as big integers which may require a polyfill.\n\n## Setup\n\n```shell\nyarn add wavelet-client\n```\n\n## Usage\n\n```javascript\nconst {Wavelet, Contract, TAG_TRANSFER, JSBI} = require('wavelet-client');\n\nconst BigInt = JSBI.BigInt;\n\nconst client = new Wavelet(\"http://127.0.0.1:9000\");\n\n(async () =\u003e {\n    console.log(Wavelet.generateNewWallet());\n    console.log(await client.getNodeInfo());\n\n    console.log(await client.getAccount('400056ee68a7cc2695222df05ea76875bc27ec6e61e8e62317c336157019c405'));\n\n    const transfer = await client.getTransaction('805e4ff2a9955b804e32579166c8a54e07e3f1c161702254d8778e4805ea12fc');\n    console.log(Wavelet.parseTransaction(transfer.tag, transfer.payload));\n\n    const call = await client.getTransaction('9a8746b7bf7a84af7fbd41520a841e96907bee71a88560af7e6996cfb7682891');\n    console.log(Wavelet.parseTransaction(call.tag, call.payload));\n\n    const stake = await client.getTransaction('673ef140f8a47980d8684a47bf639624d7a4d8470ad30c1a66a4f417f69ab84a');\n    console.log(Wavelet.parseTransaction(stake.tag, stake.payload));\n\n    const wallet = Wavelet.loadWalletFromPrivateKey('87a6813c3b4cf534b6ae82db9b1409fa7dbd5c13dba5858970b56084c4a930eb400056ee68a7cc2695222df05ea76875bc27ec6e61e8e62317c336157019c405');\n    const account = await client.getAccount(Buffer.from(wallet.publicKey).toString(\"hex\"));\n\n    const contract = new Contract(client, '52bb52e0440ce0aa7a7d2018f5bac21d6abde64f5b9498615ce2bef332bd487a');\n    await contract.init();\n\n    console.log(contract.test(wallet, 'balance', BigInt(0),\n        {\n            type: 'raw',\n            value: '400056ee68a7cc2695222df05ea76875bc27ec6e61e8e62317c336157019c405'\n        },\n    ));\n\n    console.log(await contract.call(wallet, 'balance', BigInt(0), BigInt(0), JSBI.subtract(BigInt(account.balance), BigInt(1000000)),\n        {\n            type: 'raw',\n            value: '400056ee68a7cc2695222df05ea76875bc27ec6e61e8e62317c336157019c405'\n        },\n    ));\n\n    const consensusPoll = await client.pollConsensus({onRoundEnded: console.log});\n    const transactionsPoll = await client.pollTransactions({onTransactionApplied: console.log}, {tag: TAG_TRANSFER, creator: \"400056ee68a7cc2695222df05ea76875bc27ec6e61e8e62317c336157019c405\"});\n    const accountsPoll = await client.pollAccounts({onAccountUpdated: console.log}, {id: \"400056ee68a7cc2695222df05ea76875bc27ec6e61e8e62317c336157019c405\"});\n\n    for (let i = 0; i \u003c 100; i++) {\n        await client.transfer(wallet, 'e49e8be205a00edb45de8183a4374e362efc9a4da56dd7ba17e2dd780501e49f', BigInt(1000000));\n    }\n})();\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperlin-network%2Fwavelet-client-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperlin-network%2Fwavelet-client-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperlin-network%2Fwavelet-client-js/lists"}