{"id":18755492,"url":"https://github.com/synthetixio/synthetix-js","last_synced_at":"2025-10-08T15:34:13.641Z","repository":{"id":43466252,"uuid":"146377170","full_name":"Synthetixio/synthetix-js","owner":"Synthetixio","description":"[deprecated] Please use https://github.com/Synthetixio/js-monorepo/tree/master/packages/contracts-interface","archived":false,"fork":false,"pushed_at":"2025-03-21T17:11:48.000Z","size":44191,"stargazers_count":63,"open_issues_count":7,"forks_count":42,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-03-31T12:04:08.659Z","etag":null,"topics":["blockchain","dapp","defi","ethereum","synthetix"],"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/Synthetixio.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-28T01:53:41.000Z","updated_at":"2025-03-21T17:11:55.000Z","dependencies_parsed_at":"2024-03-20T16:58:14.968Z","dependency_job_id":"97191c41-97e7-4718-897e-b1d0e53af2b9","html_url":"https://github.com/Synthetixio/synthetix-js","commit_stats":null,"previous_names":["havven/havven-js"],"tags_count":395,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synthetixio%2Fsynthetix-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synthetixio%2Fsynthetix-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synthetixio%2Fsynthetix-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Synthetixio%2Fsynthetix-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Synthetixio","download_url":"https://codeload.github.com/Synthetixio/synthetix-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657275,"owners_count":20974344,"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","dapp","defi","ethereum","synthetix"],"created_at":"2024-11-07T17:33:00.336Z","updated_at":"2025-10-08T15:34:08.588Z","avatar_url":"https://github.com/Synthetixio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"**This library is now deprecated.** Please use https://github.com/Synthetixio/js-monorepo/tree/master/packages/contracts-interface from our new monorepo.\n\n# SynthetixJs library\n\n[![CircleCI](https://circleci.com/gh/Synthetixio/synthetix-js.svg?style=svg)](https://circleci.com/gh/Synthetixio/synthetix-js) [![npm version](https://badge.fury.io/js/synthetix-js.svg)](https://badge.fury.io/js/synthetix-js)\n[![Discord](https://img.shields.io/discord/413890591840272394.svg?color=768AD4\u0026label=discord\u0026logo=https%3A%2F%2Fdiscordapp.com%2Fassets%2F8c9701b98ad4372b58f13fd9f65f966e.svg)](https://discordapp.com/channels/413890591840272394/)\n[![Twitter Follow](https://img.shields.io/twitter/follow/synthetix_io.svg?label=synthetix_io\u0026style=social)](https://twitter.com/synthetix_io)\n\nThe Synthetix-JS Library provides a simple pre-packaged API to communicate with [Synthetix](https://synthetix.io) on ethereum. You can use it to contribute to DeFi's growing synthetic asset ecosystem.\n\nThis is particularly useful for hackathon teams to quickly `npm install synthetix-js` and start building in just a few minutes.\n\nUnder the hood, SynthetixJs uses [ethers.js](https://github.com/ethers-io/ethers.js/) library and its concept of [providers](https://docs.ethers.io/ethers.js/html/api-providers.html) and [transaction signers](https://docs.ethers.io/ethers.js/html/api-contract.html#custom-signer).\n\n## Install via npm\n\n`npm install synthetix-js`\n\n## Developer Docs\n\n[developer.synthetix.io](https://developer.synthetix.io)\n\n## Example for getting the total sUSD stablecoin in circulation\n\n```javascript\nconst { SynthetixJs } = require('synthetix-js');\nconst snxjs = new SynthetixJs(); //uses default ContractSettings - ethers.js default provider, mainnet\n(async function() {\n  const totalSUSD = await snxjs.sUSD.totalSupply();\n  const totalSUSDSupply = snxjs.utils.formatEther(totalSUSD);\n  console.log('sUSDTotalSupply', totalSUSDSupply);\n})();\n```\n\nDefault settings don't use any signer. That means that constants can be viewed from the contract but executing a transaction will fail.\nTo execute transactions, set up signer.\n\n4 signers are included in the library - Metamask (compatible with Dapp browsers), Trezor, Ledger and PrivateKey.\nCustom ethers.js compatible signers can be used too.\n\n## Example using a metamask signer\n\n```javascript\nconst { SynthetixJs } = require('synthetix-js');\nconst metaMaskSigner = new SynthetixJs.signers.Metamask();\nconst snxjs = new SynthetixJs({ signer: metaMaskSigner }); //uses Metamask signer and default infura.io provider on mainnet\n```\n\n## Example of minting stablecoin(sUSD) with private key signer\n\n```javascript\nconst { SynthetixJs } = require('synthetix-js');\n//parameters: default provider, default networkId, private key as a string\nconst signer = new SynthetixJs.signers.PrivateKey(\n  null,\n  0,\n  '0x0123456789012345678901234567890123456789012345678901234567890123'\n);\nconst snxjs = new SynthetixJs({ signer });\n\nasync function run() {\n  const totalSupply = await snxjs.Synthetix.totalSupply();\n  const snxTotalSupply = snxjs.utils.formatEther(totalSupply);\n  console.log('snxTotalSupply', snxTotalSupply);\n\n  //issue 100 synths (will throw if insufficient funds for gas)\n  try {\n    const txObj = await snxjs.Synthetix.issueSynths(snxjs.util.parseEther('100')); //execute transaction (requires gas)\n    console.log('transaction hash', txObj.hash);\n  } catch (e) {\n    console.log(e);\n  }\n}\n\nrun();\n```\n\n## Live examples\n\n- Get total synth supply [![Get total supply](https://user-images.githubusercontent.com/799038/57645476-572dc780-758c-11e9-98e3-33846fb8c176.png)](https://codepen.io/justinjmoses/pen/vMKywz/left?editors=0010)\n- Get collateralized state [![image](https://user-images.githubusercontent.com/799038/57646044-ad4f3a80-758d-11e9-879e-4a507c2cf894.png)\n  ](https://codepen.io/justinjmoses/pen/qwqoBR/left?editors=0010)\n\n## Got any questions?\n\nJoin our dev community on Discord: [![Discord](https://img.shields.io/discord/413890591840272394.svg?color=768AD4\u0026label=discord\u0026logo=https%3A%2F%2Fdiscordapp.com%2Fassets%2F8c9701b98ad4372b58f13fd9f65f966e.svg)](https://discordapp.com/channels/413890591840272394/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynthetixio%2Fsynthetix-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsynthetixio%2Fsynthetix-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsynthetixio%2Fsynthetix-js/lists"}