{"_id":"@swivel-finance/swivel-js","_rev":"39-9cbd64f568fa84c51b1f95cae91cc05c","name":"@swivel-finance/swivel-js","dist-tags":{"latest":"4.0.3","next":"4.0.0-next.4"},"versions":{"1.0.0":{"name":"@swivel-finance/swivel-js","version":"1.0.0","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"lint":"eslint 'src/**/*.ts'","lint:fix":"eslint 'src/**/*.ts' --quiet --fix","prettier:base":"prettier --parser typescript --single-quote","prettier:check":"npm run prettier:base -- --list-different 'src/**/*.ts'","prettier:write":"npm run prettier:base -- --write 'src/**/*.ts'","test":"mocha -r ts-node/register 'src/**/*.test.ts'","build:clean":"rm -rf ./build","build:dry":"tsc -noEmit -p ./tsbuild.json","build":"npm run build:clean && tsc -p ./tsbuild.json"},"dependencies":{"@ethersproject/abstract-signer":"^5.0.12","@ethersproject/contracts":"^5.0.10","@ethersproject/providers":"^5.0.20","@ethersproject/wallet":"^5.0.11","ethers":"^5.0.31"},"devDependencies":{"@types/chai":"^4.2.14","@types/mocha":"^8.2.0","@types/sinon":"^9.0.10","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","chai":"^4.2.0","eslint":"^7.19.0","eslint-config-prettier":"^7.2.0","eslint-plugin-prettier":"^3.3.1","mocha":"^8.2.1","prettier":"^2.2.1","sinon":"^9.2.4","ts-node":"^9.1.1","typescript":"^4.1.3"},"engines":{"node":">=10.0.0 <15.0.0"},"gitHead":"6920055de133b064ef48aa840013eca5c0fe85c0","_id":"@swivel-finance/swivel-js@1.0.0","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-GA9zTAtdqFfuo58k0lzcUOlivYeunV8TslIblGOV5D2ixhFJ1hGW0EWDLWhH2tSPaHQTDV6mshH+QzerJ7RI7A==","shasum":"10a538d13d083b96fb5420f9c75cd9861874bdb8","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-1.0.0.tgz","fileCount":78,"unpackedSize":94397,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgWix1CRA9TVsSAnZWagAA8l4P/jptM6ji9tuTxqOI3odF\n3F+SOkEicX44S3dV5pDixeJWq4qi6jj4KaQk8Ot0Nm63N7ByBZWGEDc4v1Kn\nqyPrb9HioskemG5J86m6x+0K0sFiXQ2My7OO31C7P/5y+ZzrnJa+wxnMbsy9\n9MIAgortimnh0wgIMORAotLBJDJDlkBtHXfbusF6f38LLuk4I/H5VTfM+2/7\nXR0eB5Propsgmrj6wPKjSbaa5TnCQ7PhPu9tsuXy+372HftbrYxZ1d1psgVk\nbsyYwIQ1ykVqJN8CC1HzMQ4UzAi/yDcs9LvkDwl16j9PojOc9gBSiYYjGgrY\nkaiFQxAItoc/1d5QIS/AjeYDqZV5luifKhEYSGhFHsprlQkgfYE38Pp6P6Uj\nv9GW2KmoqhSynnWuMaPu+ZJ8ZzD1aeAAxS6CRgWuUNgYSG4Mq7WEpvLfFFCr\n91E4nY3bpIF3JW7ZG23EocEF8JpMpfsP9b7LN+iBmpsnNLh3pr/I50aS/jq4\nJcTNobcCw97W9x0w3+WHxq4mHT86bvpQ9K8P0r7TsDpQFBnX1M6UFgrYr4mJ\nQJH/pn7Xr3WCLKKV/aq5N9i9YdQLN8gFtPgVlPsx3TMm1IE3N3625T+6MJzs\nlMaebQdDceYMc6hxJjyh4qeNX1wIKEJ07SJcjErMWRrPPqhAlk1km0cqxPpH\nlfKo\r\n=HgmZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC1nQJ+Ta1+2zhOhl8ItA0u+vtekxrgS+RTflnhTV27YgIhANWp58yxbabqVBOvwwvC+pwZ8HfMdx7o+k4VVWTWIFJP"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_1.0.0_1616522357523_0.939701513328735"},"_hasShrinkwrap":false},"1.0.1":{"name":"@swivel-finance/swivel-js","version":"1.0.1","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"lint":"eslint 'src/**/*.ts'","lint:fix":"eslint 'src/**/*.ts' --quiet --fix","prettier:base":"prettier --parser typescript --single-quote","prettier:check":"npm run prettier:base -- --list-different 'src/**/*.ts'","prettier:write":"npm run prettier:base -- --write 'src/**/*.ts'","test":"mocha -r ts-node/register 'src/**/*.test.ts'","build:clean":"rm -rf ./build","build:dry":"tsc -noEmit -p ./tsbuild.json","build":"npm run build:clean && tsc -p ./tsbuild.json"},"dependencies":{"@ethersproject/abstract-signer":"^5.0.12","@ethersproject/contracts":"^5.0.10","@ethersproject/providers":"^5.0.20","@ethersproject/wallet":"^5.0.11","ethers":"^5.0.31"},"devDependencies":{"@types/chai":"^4.2.14","@types/mocha":"^8.2.0","@types/sinon":"^9.0.10","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","chai":"^4.2.0","eslint":"^7.19.0","eslint-config-prettier":"^7.2.0","eslint-plugin-prettier":"^3.3.1","mocha":"^8.2.1","prettier":"^2.2.1","sinon":"^9.2.4","ts-node":"^9.1.1","typescript":"^4.1.3"},"engines":{"node":">=10.0.0 <15.0.0"},"gitHead":"409d2a74dbf09caa91f91d54d0b66577c24c1f8e","_id":"@swivel-finance/swivel-js@1.0.1","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-/9bCgU0xgEEfsYqPvhb/kVMyB8EAGkmFKJaOEHQW1+zRZJo9QdVD0dOJHhC0r4W95cw7i59NUDJtp8YNurt7OA==","shasum":"997efb28b4e1328740ba4ce4fb34f21e96febea5","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-1.0.1.tgz","fileCount":78,"unpackedSize":94395,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgWlfPCRA9TVsSAnZWagAAdVIP/iAyDr+mbpgDOJmPyUTx\nFFWkf6eYLFK8+wB6yQCDXLKft+rSD+XR2HyGZVj0cnrh4zDGl8cP6omB4q+S\nWzC5H6Ophhju0GSqcUuBu0hHshhJyLiLI1HefM53vjjvGxypqmqzNuAV/sYL\n67nleBxKVBLmoYBNG86FTEP6ayizfqZIS+xw4LVgaztREidr+rl9a0m+fzeu\n+2DAwEkaQCKyo6n7FdTCkOt6QF7+g4hyImWjFmAOQFGC3youxcR53DanZs2r\nUnb5n0U8SSoJpGC/NIzQkBDArb0i/ZY5QfO4T9VNJGuTkQ6SPzUczBUh7QWV\nzpwrsa9BcjLp7PmHR3jLwp3T1/jpZFwdW3IYoYnsoXG6DvRKOOJet3TrqH2N\nKdYP5xMUs+wBj4/Ev4d91DBn2abKAQQQ2Cm0Ec0pGaj2cpjfmKtPj1MxTgh7\nfEcbgh0OS8W3iUkO3xIzkQzlgqSDFmUPcyKArhCVuX3cG0WZMFeTQrKLUHyj\n1pJ8UPqyFFPR9TI1lWjgjNqsEXTcjyzmRQk42600v5+yp3UbVoGQP6qHDq+U\nVDM9o6KLO0/Jcjlw8AXDZEqDUwus/ek2+kPqVx94vLe/BSkeKTVNUOerhRLd\nbU3J/gn0WNdj/C12oxCBgNolHoqnbAMOrVCn2cgM/I+vuPSUjbrwNMJ2O6jO\n0bNc\r\n=G73x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCwdQ1wDtjUmma2RjFa2e/J9brAN3SdPJxF9eEO8iqnsgIgKaUqfXcVxHeOEYWyFdvcfeZ+PkAG32mui2mgrtnMm4o="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_1.0.1_1616533454655_0.7608640488526945"},"_hasShrinkwrap":false},"1.0.2":{"name":"@swivel-finance/swivel-js","version":"1.0.2","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"lint":"eslint 'src/**/*.ts'","lint:fix":"eslint 'src/**/*.ts' --quiet --fix","prettier:base":"prettier --parser typescript --single-quote","prettier:check":"npm run prettier:base -- --list-different 'src/**/*.ts'","prettier:write":"npm run prettier:base -- --write 'src/**/*.ts'","test":"mocha -r ts-node/register 'src/**/*.test.ts'","build:clean":"rm -rf ./build","build:dry":"tsc -noEmit -p ./tsbuild.json","build":"npm run build:clean && tsc -p ./tsbuild.json"},"dependencies":{"@ethersproject/abstract-signer":"^5.0.12","@ethersproject/contracts":"^5.0.10","@ethersproject/providers":"^5.0.20","@ethersproject/wallet":"^5.0.11","ethers":"^5.0.31"},"devDependencies":{"@types/chai":"^4.2.14","@types/mocha":"^8.2.0","@types/sinon":"^9.0.10","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","chai":"^4.2.0","eslint":"^7.19.0","eslint-config-prettier":"^7.2.0","eslint-plugin-prettier":"^3.3.1","mocha":"^8.2.1","prettier":"^2.2.1","sinon":"^9.2.4","ts-node":"^9.1.1","typescript":"^4.1.3"},"engines":{"node":">=10.0.0 <15.0.0"},"gitHead":"8528b51bc53abe31e08c28246e83fed9b27ad8b2","_id":"@swivel-finance/swivel-js@1.0.2","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-2sbRtWiD0RMAmNX284JwbJ3YtVd8NxVxhKlW85RTh3t0oA4u37oxLQbW7gWY3yUqejby2PckBoCBphsxWPlx0A==","shasum":"2226929ace9980001a82eac8dd662c5c98ea452d","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-1.0.2.tgz","fileCount":78,"unpackedSize":94393,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgWmBVCRA9TVsSAnZWagAAkuEP/R5XXeqatevPomFp1vbG\nZa7VjBwUaSYpFyUsuddDptiMHSJxA+wuzAOHTqHu6aUVA/U4gliQCTrO5J3R\niaVVoy9xWR2hPzc9CL0tHIXSwukipfIfiWUV9MwANu7R+vuFUO7gDXUS/Dyn\nqlj/C1LH7m6KendzXnXvbThym1ySPIzNB8yYPr/nTwp1HRm1PDwkJER1i1P6\nhNBf//oDgDqRV537kUcNoMRx70pQO/KhK+A2QmRLT/INBB20KLII9Xj05wD7\nIe7MrO1ZZJ235vRnUZ4WSe5IFlsk7qXDISFRXzgTB5YLSa2CUYNwEaCDhcjG\nD1UFrYN5Y8g4Qngortp5+T2d57bOV0/dCc7nhTbWHX7iFpUlyMABzrj7X1/7\nGiCX8M74CIumFJ2StDNGZo0NX8jKLOlEE3r5w8MFkf0d+8ZN2Z3JceDgWPa+\nZ09M/B0bcoxJYZlvH/xtBYezjtqVm8cZw+0LEeUK5RVtOl1CmoLSvlvts9sJ\n/jKY3pL8EGk80jc/pY49ZPq3YAs3RpNgyLT+G/PALN5ch+AXrPycGqpp9dke\newH4DZdrJToJTnfko2v4xg1GvspTf8XirJ5RVSfAdjaUKnrk2CjK2LnRMZaN\nmYd88tVVTEvCHLxRXLcbwoYHYJoXQqkr7c3GOmZvsb7UwvXmgKd+CNf7OT4C\nYfRH\r\n=hUCu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIETPiWcCqvgcaDbaVYkiqTt58x6fOVjTeAsDI4dSX2WsAiASzPYTJddZ0YX7tuMUJSmSiQhkzEJgtOmpWPm38pUqDA=="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_1.0.2_1616535636994_0.568244524422729"},"_hasShrinkwrap":false},"2.0.0-next.0":{"name":"@swivel-finance/swivel-js","version":"2.0.0-next.0","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin main && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\n#### Javascript library for working with the Swivel Finance Protocol\n","readmeFilename":"README.md","gitHead":"2728ed0f40f76f86810bb1c2ea14be276344cd58","_id":"@swivel-finance/swivel-js@2.0.0-next.0","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-0ZSgSs9B78W8aNZhru0KMhZVHlaqJUj9iayIq2KoAvjH7pqgBZ0ZF84LGGBrmUCDnx7defW8W5IR3tlsyST4HA==","shasum":"9b3760f560c86fc7602a1a398b0f88fe950ca96a","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.0.0-next.0.tgz","fileCount":149,"unpackedSize":290806,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgukFCCRA9TVsSAnZWagAAyGoQAKCM3wfG/Zio8ABdswlR\naC9H/UNuRTYxeUfArOVXKUZbQ2XSBgZz+8u76/xWt1f7zscWgJOfRGtP9ACC\ndP2yf4RzR2ttFul0RLA3WtRZeQj/+vIrXLXvsahO5sFj1S405P7RrL/5Et5+\nk1CQmwRqNzFACaWnvV4H88dNVi69yeow2WCaSnWNhoMvojpoHwqnZbrekoYr\neJCYan8PLmrwy91ProZw4fbWw8Tw5vzJUwoa+5FGXxe6ki97RIbNJmC7krqL\nAH1+ULX961/v9vZq+O5QSSUuqpJOtahvzXlF8vmfW2OlgeQmyo+/9VmTqGOu\ncQE63TXvM8NwCSj94JLlA+mAwpaWIRkJg1OCi07/xlSQZaYsR5eBSkpX0lA0\nwC3kIXJMxDB8lPnzTwCPWkTbOOlYQvJ+1aBsetuoKqxDOWF7mWbl7vQSehQq\n6a8ZOk1aI/aBqKc3U5fHhO1jAu2Lco7bCWmd31tlT65t4sBGBIxKjVhINLof\nXuPHXqW7KdamE2kTsNGCgvsYitub+VNLIVF1gaVj0bxBcTrp+kDYW/AoiJvY\n3oZdxkJXENre1hXgkg4I6QXy7Nid27HYv9r+/PEtTtkrFqQ7dubmhQ2ioRxv\nm9A8KILZz1gkapeFmr24b06rGrap2TUErXS2dufiWT9XoQnSJ0FvecVpvbmp\ng4pC\r\n=YMDD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDl6kMLEtRHhXA3ACgdsQJmKujKX1teHGQgjsaa9qENNgIhAPwWFINGautIqKcyMWS4qBr7B+wUZY4NSGyzqDcI5tSN"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.0.0-next.0_1622819138176_0.6899177361950559"},"_hasShrinkwrap":false},"2.0.0-next.1":{"name":"@swivel-finance/swivel-js","version":"2.0.0-next.1","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin main && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\n#### Javascript library for working with the Swivel Finance Protocol\n","readmeFilename":"README.md","gitHead":"b7260d1e76ea4a527da52ca5096f8f487cba972c","_id":"@swivel-finance/swivel-js@2.0.0-next.1","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-Ls0QTox1A8rQVKAjJhuujJ1GXgoeXaw6XjARCaZ6RaAfco+ouOGhD0bed2k60mojKUIg2MKVmfF1bZi2+AQQcg==","shasum":"7512f009c2cbb06cce35e462910ee4cd937ecdf8","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.0.0-next.1.tgz","fileCount":166,"unpackedSize":304859,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgvpZ1CRA9TVsSAnZWagAAtvkP/3EpdPlH8iGYMiJw0ckQ\nkNl9AMLqahAnDvrAfhmWvB8qlm+UBXukkLfF8cyzX0eZb6MWoYeyfXh8Fc5b\nc0pjZczzav58Xr3rCGjLIQFrXH2XxTPnAagczwOmgevYEQIeBSK9VR4mPnGx\n8thTndyZHyECjwLlK48ewMAbrWo7maMOc12ewQvQnaBIPus5Mq3YZgr99pKi\n1nqfT5OCg5GQLUN2i2nrfHwAGEK1RoIOmiIXQYdpRFr1v4MKPCQwbV5Cm4dr\n62QKHlxj6aaiCsDlU76l6MD0JwYuO+F1U+zTphjnfo1e5qA0c/uMhtoWCHoA\nLSmdyaEATyc60Os6BlgP/KCgJRI4tEG5L1DBsd2wRyBcyDNBRWaLLuM7Le8f\nfH8Y7HfdWMB5SicVaDkeVxZ5Msk61dgYLiZrtcINqWZisbtvqznhEhjtco+2\nLf0/7hFL2tkPG/8gArL4wM00EvKdAu1lIBkqGmIbNHvwVcnoXHI/m/GxDWh9\noZZ1PTXRHcobNgt1Jbrj7hQHL5fx7L2Qbu5GP1jrx2XWT8ck+BMVJEfUE6ku\nADC3dYsKAcbfrAT1jPMU9/nES1/I51uVW+PPthjO1FeED1viL6GdF+LpXl2f\nQycHQImyRBp1VWboNQ70KAO8/Srq3VA6y9l9IKvrcELbGrxbCL7vC/3bOMtG\nj+Iu\r\n=S7D1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDpOHxUVvVlcay7xyRzzXQkOrs0T2AnYutQJbBoZGLbVgIhAISu5ic22vDG5dScvP+MkdxJGmQ8ZlwgKoyzvBkAMK7j"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.0.0-next.1_1623103093266_0.4707278106415158"},"_hasShrinkwrap":false},"2.0.0-next.2":{"name":"@swivel-finance/swivel-js","version":"2.0.0-next.2","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin main && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\n#### Javascript library for working with the Swivel Finance Protocol\n","readmeFilename":"README.md","gitHead":"9933ff484e29c08536aefacc80d6d8c7c88366a7","_id":"@swivel-finance/swivel-js@2.0.0-next.2","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-oTu/edq5sYGH5YhRZG/Vr4PnHYKOKyXpjs+cKJKBcVmy6Hg7plqNqz2ul58vKIKhHUWxplHVE9pZalX37stJNA==","shasum":"cca126a6b43534d858a9b9a7106c817fab1c7028","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.0.0-next.2.tgz","fileCount":166,"unpackedSize":390682,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgv4fyCRA9TVsSAnZWagAAnuEP/3DMbPR6VmSUT5avrmmy\n8jldko/kkaTqzNFJKpYiGqOeGYp0hHGH2PVm0v5Oxib1PnaWjtvk9HeLdmvm\nLwIDUXuE1F1qRVuLWBDRQpWR0EhK5EfbJf+LBiq3Z74KKjx9TwFrwxWD8OMH\nNuK1dF4RVXO40ypffvzj/+zqMS9clDVmMZyEyaHtI75SIT8Uk4/tE2ofYoV2\nrauBF3w0bGmDJz4v92rUktA1/LuDsj/l5JluZCjCF9Wi7NGmr0qYUKWlCy88\nDorfdBJx5x9kgNgI56cThCgQnhIk52cEukaIuAkomSSbq5ZOSPEW12AHQGxT\nBhTFtFCBAVPWLzNrkIQNSGN1DmKA/9YJM7B45glTIQGtGKtbRlY2oOe5mmOA\n5pgcjeVkeIbNThgzCZohKpMjbzA6zFplAHcx0BwCgt4GjF/YywoQ+9uHkZSb\n6zeRlvXJITCO4ySvcmN+OmXvf0WKubJHmwobfAhfaZTJ2RMY0iGRAdCftE2L\no4uyUoD2ZTjyzXVzoryKNkklMlTM6SampI6zzk9nGPd0M46oa2hUzS0CXDa5\nRqUNryniiRT+h1jIo/0fRJWIny9dauBmoKb+zpXomydYOJwKlXYccmN5EXaw\ne0n/JsnG2vB8Gq4S3VPZ9TCCItbHznxvhSeDeSYJWT8nWI++6eiCxoVjHFVU\nwJTk\r\n=s/Q3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCoGNQFMz5/pZkcp1chmvzvPQ9tJZRq4MKa0S6wjTi5lQIgFMRuRrO2mje1PrhdjF65DfU6jRYBjbNyb/iIgNxWgtE="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.0.0-next.2_1623164914054_0.12015868278588693"},"_hasShrinkwrap":false},"2.0.0-next.3":{"name":"@swivel-finance/swivel-js","version":"2.0.0-next.3","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin main && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\n#### Javascript library for working with the Swivel Finance Protocol\n","readmeFilename":"README.md","gitHead":"35e09a8e0d44f5c33e5a7ea1f4857654abc32600","_id":"@swivel-finance/swivel-js@2.0.0-next.3","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-n/9DXGWEwJmdWbiHFlPuymPBAwqpE9PXZGRrPD+HNVXb8vGvmLLUAPg7LRkwGW8NspRlqVLiZ88uUz93KrqjUg==","shasum":"dd5d5e6c75e03a39cdeacd2704ab504de0c7ca03","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.0.0-next.3.tgz","fileCount":171,"unpackedSize":398720,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg0gjlCRA9TVsSAnZWagAAiS8P/2bDXWo0/SBwarnhc6xU\naMeLv2mT0w3EoyQJaaVuU8M0eRR8bkBx7kbCd9PA25PnJ0yLMvUnqeDFhxUv\nLHWQ7YiY0gZI3ygD69xLwmiJhEESd61bUru80Jm0rNVFDIDogpB9yt5ZBxmc\nCklxrta3Wzhv7SPNnFtKNmwzm4WtqQim5Uaatf+pYHMBmoVw9ur79nqLTv/m\nimyAfwxd4lEP0MOfodn7Aa698rJS7nIUWJQUOGMb+qqe09LtssIJ7mvb6FLP\nB8QgsZwiZx0dyO69K19Fe6uuQcyeG+bn49dA9Lmyb0YQ7e5cpgMUVNCyc1SY\ndJb0kxCBEWY2BNtJw/Vj99ynTnnT7GDnVqoeJo2+MTLvCsOQ11/vjYBep7rI\nilsASQtVIlBvKH8J0uR9SpeRscvd5+IKdf2ryJj0X8jeaeW3KrnZB5UV0vu/\nVkdqK9SFRk6ZtOkD2UgoDC49pwkibMTQVyXfWjBorkOy1XLPFUcNoU34HGhh\nEp0qjGxAzLqG1u+HD5ubgzmgpHBmKSJCmyksf8LwUsEEYOZrCyq9I3Aig2Q5\nlJreaKguIo525kTRnWsu+Gx1eHv7EqVULUUq2Mq+U5tLV+VU5GKlpk2kLJBE\nlVOOyY8Dzmt9tH+XvK60/vuwF2r8OjjfkK+ZXa1aZfwfv8tzXLl9GFl/SkOy\n8s9s\r\n=n/Fd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmPGJxpowZXEQLrV0VfT90QiIwqLzjQXK9MBJWI5CnWwIgRUZMW5FCuk6z7dhMMw1HZ2yDBxFtTbFGUUDdoTQgS0Q="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.0.0-next.3_1624377572514_0.2148521345234704"},"_hasShrinkwrap":false},"2.0.0-next.4":{"name":"@swivel-finance/swivel-js","version":"2.0.0-next.4","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin main && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\n#### Javascript library for working with the Swivel Finance Protocol\n","readmeFilename":"README.md","gitHead":"9649a64d70ed1a8770e0964811d44abdd6136781","_id":"@swivel-finance/swivel-js@2.0.0-next.4","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-CvtQ3cbJwNyDSagGHUuKY3BpHT+D6s0OJhELs0Go6Z4vrRr6M5irXHYabIGWqTmqxF277XAoyq4b5RODcTwGAA==","shasum":"4ae8ad210b8946c1ebf54c1c874ff5a94595194c","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.0.0-next.4.tgz","fileCount":189,"unpackedSize":418658,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg1hP3CRA9TVsSAnZWagAABxkQAIuesr50flDj+wFxXnv0\nd92kuMpCg1Mn1EX2JIuYpUXurejx9CUlkL+61LvxQmzY4+Ik2TC7uLDCBP3k\nuXHTJucu3Qf/Q3MqHLEX/vBnv6si7Vd0aNTesjbG+DnRv3bnGJX1G5SLqMpo\nIaOARIXu2HXqGW3asYW/tdpIMyLAqhUxE6bgAG5WIRI44SHLYN6bynLV+h7u\nUVGxwXEGJcTYQ0ZZTrm1M2y0bvIV+gON/Uw427wiVVOQCoew5pFp9/SlLS4o\niQbMBFrFyTq0bmUlp3ranbTzm4WgCmLEZdFuZjeyY4XmhPPMCnTmGPyL7iaW\nQUQQJ4wp6ipkeccWpacrx2A8eYfiCcKf1b3Y+OJFL6aGd9VJRtdqzAqHexHW\nqTXOgUQxpehs6M1e3tRZYdeUYmnSuJqJNRjH4srO6u+MqtjBBqFiTHWJK9JC\nklWPWArJp1FYveQb+iehW0gGerOvt0mOlJcgrGj3ntuMWJ6A/jqfCtmfzpbc\noCoVnxfagggLbN6RNRdrxeGxt4IE9cC/xG51Eh0MqW15HfxD1W8eLD91V6Dm\nKgJ4zU4gOcRzSZUtDoKBWedBZEOaRjGNU8mAtaHIjovZ9fHyJAORNSxKdLJz\nEIBSmNq2brpx61hoFt9ZxQlFVYcs/L4+cRU2yES6Utc2k9lCeursSTmlatfD\niVOl\r\n=zX0U\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDR7jEZBgu+W98hscUj5ShdPT8j3nfMq5wFDufBn6saZAiEAsRq6Qca92FiYezgEHDlp/IzY+WlD1xf0L8CWUR5ofdo="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.0.0-next.4_1624642551116_0.4427452342625555"},"_hasShrinkwrap":false},"2.0.0-next.5":{"name":"@swivel-finance/swivel-js","version":"2.0.0-next.5","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin main && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\n#### Javascript library for working with the Swivel Finance Protocol\n","readmeFilename":"README.md","gitHead":"03c6ff1bb84dd89eed70fce0cee14a029d024671","_id":"@swivel-finance/swivel-js@2.0.0-next.5","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-kd7y7E9KlVM2ldNMtkiX/Jcwg0bgCsqYZP4XKcyUjKLcko7quLRs5flUdAhvaCYaDboy/PuZ6Dc6kLMXazxXow==","shasum":"687735216d33dd00408c068191592ad15e750f70","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.0.0-next.5.tgz","fileCount":189,"unpackedSize":446140,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhK7YYCRA9TVsSAnZWagAAYwYP/32jpf39DRk25G2E63kW\nn/fU8Ofp8KV6HoL6N7uz+DN08ozxin5tyQd4nRsnt6CZrbdgKHb7RTbGHMfK\nR7HxeS9f/qFMdoZTvMqf858DWXh59QggnczOzq7bDqhlUorHZZs3mXw0/8/8\nbR1LCQAO2aB4CCArik5BfyfCsMdt0WjVNalhPwBgrUZznGtjmmCCbfsKmyvw\nP61A4HsdcQb7yFw5u+P/cOY2M2BcB1UUImh+Xq2wrG+QzpohU76/y/wgc9UW\nkP0tJWSMXsKxX0Vq6Wreh3p8zofr84kRHSGeT4JH8urJk8ZcGn34PVXi5bf9\nS8q+3ad/cOerw+DARoOHsQaHiowoJWqTjLo1XqIb8QIBGch5DNpNaY5UvBkh\ntfM+C/lDs6nDnEVHUo3TB7yNaoApe9MMcg2YseeHeSFkLI3QBCulPZjS2+Pr\nhle2ip/oJ8RNBCUOQw96WOMI8Lkt1SaEpi5pYXCQHSK/0SVoy0BBZBVYVVSF\nunUs181HHOW7yOF4WCcCFP/Q2cILTXZ27YQMeedJPvpZSqOB3Aj55zI47aRt\notERD49A5D/vTCgNQIo8Jow57eBzS9YCXjJqECmbZEsSknT0vbtvbt4H2dYl\n8CNpPpozwRZZpkpZBgaRNF8siJ7mLX9BSLdRH6MPr/e+NwCLWzApb41fIZ6d\nQh+D\r\n=xSGQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDwu8ctyrYbl9oa4IcE2lzCWRU4EWA5EK/6kLwIaona6AIgWZrFNiYDvKaRZVsqFMWD/36Goz6VCkStKjBD80j5MyA="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.0.0-next.5_1630254616611_0.4509650848849609"},"_hasShrinkwrap":false},"2.0.0-next.6":{"name":"@swivel-finance/swivel-js","version":"2.0.0-next.6","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin main && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\n#### Javascript library for working with the Swivel Finance Protocol\n","readmeFilename":"README.md","gitHead":"dd4bb2fe370b86019a7f66e01e6fedbbcac366be","_id":"@swivel-finance/swivel-js@2.0.0-next.6","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-03AuuHUCXnhl2S+yXI+vSmbkjjXg3Ie7aBDZnp299nRyQ0wvOwVVce5tvupGUU09rRkbozAdpSLs7MN2U+kdvg==","shasum":"fc1bbcd777ad855537a8a36d30f7bd2aa6ba515e","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.0.0-next.6.tgz","fileCount":189,"unpackedSize":452494,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhL8AaCRA9TVsSAnZWagAAG3kP+QCavo8dtUceNcpqC0f9\nffDuLLv+uU6THQE7u8r2lVYzwzZZ/foFxBsQuaSwgNL/kTi1HVS2PMxqRb0m\nInf0GaYXdH3Afxf+g5rfRBEpciQwmuazD7NprV3UG8yJHGnX1CejtxUmWLJP\n0CA9G0/K5ma0DqiuaBn7UeO/0sLNadLxEhJJ72PViyIjy92ekmYERhiH4TcV\n86/7EztnvN7nXOvksUdgH5msEdDhdkldQW3+4vdUmTU9VyxEDdRniae0nWLr\n1WepIHBNVMteJnIDmpONlpVLMgXM68qGT+n1OpaAe8lHD1oSTHRTVBdHQKOk\ncjavkDXiB84QaV53Ma1p8zqZjYysBh6SuSjo5qn32JUtREP300vwRHsmZVBs\nCp5yIx/6xTYangNHtezAk4KUBiZIOe3HWFLYfSH4mYuCuQ/6gEGexvzJpGI8\ntppwXl92LuADSpI6PNe0hf95eefSYRLV8DJsWkU6x1WILNgWS/1HUv41tHC0\nZfgGesJqdhyg7AC+MKDREgCUspoPFKKnXy7pgYOBPs2HSJLa41POnTQIcS6d\nfGgAJbTAe48HYSjPprBnB2kmCOIgf0MTcL+VekvJwuqcpr04mKleHVxCVC8Y\nwfkS0gGdTR1Ud3+miOnCgaW4D2MJGLatcaq5bNDnLDjvJ/i4Vd135M6MMuHv\nRN3g\r\n=l1yU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmMG97/wzYg0eA7Bjst8Tap0k3O/VBEBnd6+UkxjzOAQIgEACJiLDKQ2LSJeEmYvEYTfBL3jhHNWIIhIFAh+vo9/o="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.0.0-next.6_1630519321952_0.41450807294280123"},"_hasShrinkwrap":false},"2.0.0":{"name":"@swivel-finance/swivel-js","version":"2.0.0","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin main && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"c864e08ac7d139065b6d154cf26c566538f179b5","_id":"@swivel-finance/swivel-js@2.0.0","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-4AiWzszNJsW7zEcXshQsMLzZnoGSneb7+V/YCQzWTspYwQiRbMACsdaQI/Sd16a38P66bU+lomIzKPNyJWhong==","shasum":"9576d7da6a2dd09f6b4115f741a68857eea8548c","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.0.0.tgz","fileCount":189,"unpackedSize":342325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQf7xCRA9TVsSAnZWagAA38oQAIHpkm/JMrn1/fhnYxaw\n+rA3Hbsv9rT2Vi22skyIDtbJcxv9Fw8RFNmRSaT2LCp87JsFVjU18zy+PFQn\nUlPITRYCoZvhW9+Ai3D5PsSV0Phk1kEDAIbvWCOAQs0PpNu0tH9rSFTj+QvG\noEq8SxxVfjVc8IIsBxcDEg7cqYnVmhTdn65kNReRUb/LA9aUO3dQpZuaIKEz\nCr96tsubJpHOautx4fWk5JBd9lzVtLZtEeFJSLKof7oz3Sf4C/bqZuRFYTl1\nP0JdJuhD+yG2GIlaGkc2XMIsBG0KCVymM9n0LF1zNKo9PlFYrWccTpOzzbSX\nNZjCxYTkR2K9MF2rBKhCaJRxX7LEo56QSEInPoJ6XSiGWdghv2cJHl6DFSmB\nMQhlZBjmqkJknPMnTOEZdkJ4iGSu6N8TO+3vS51gawWbZ3Jme9gIHlWeV0ES\nIvCESidOTb9yK0Zy0gWZoRvHIEqUIbVCHeWR27Z9Pa65WKzY3aSX3FKkEPsX\nLNw5y56eIlEWxb90RyJOyRtUan8SZn5XnJFZKNSXy2G9vhH0nnsuPwQaGeBW\ne+ROQib+4g4w/wEbYlyv87i1PxXqufUUbFRYLglQYStylader//7pAeQ7QA9\nttw+7BeM4AmGy0EqYic0KEHA4GODzwmtft0mibyKw55gwBI5zwBeD6XHVl4V\nzspe\r\n=6fKm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHL+THnJr3lE0ckevM093B4DmwfwUsrAfFebjpAWG6SNAiApYxAsDx0vUbif1zpsSZptveyB11QBkh1I6jCkJCxDUA=="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.0.0_1631715057259_0.8447138556070324"},"_hasShrinkwrap":false},"2.1.0":{"name":"@swivel-finance/swivel-js","version":"2.1.0","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin main && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"2711f11cec913fccd89a522f8d84b333dcc731b0","_id":"@swivel-finance/swivel-js@2.1.0","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-QfVY2Ky5LyWPTba8NbPeunJ4SedDzVCaFlWftqJpA8JnbkoQLMtOvSqf6M9GzzvFqS8tRqrCGeSqR4j6hS+ixQ==","shasum":"ab0c39f6b5b65c5121433f7a06aeb5262f554b30","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.1.0.tgz","fileCount":189,"unpackedSize":346315,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhp/ocCRA9TVsSAnZWagAAAjsP/RF8gLQLL0Sf+XENoXwL\nwQFiKDLSxRKSdUx5yWjQIdWPymb28oROwP50zbq0eJqhpV3D4Q282FFRMTip\no+obO36tteSEeLO1X2vRxeN8Q82ulCj3Rf6YLeL0ZOZwtH3MW7Ae4xwIsXni\n6JEuRHlRGA8MpANQCkornd4/bLEwNHvFOOf/QHQCIaIyFVqPW/gaEZjeyjeN\nyQfkoI0gf7pOoAiikEDHv0DVrkcmMa0Z3Oe8BCARjZp/D5dSbFzHKqGVppSy\nhGNJiz/m0ANwcMDYlZMH/UCL+qvHlaurtyxUCMYuMXJYOJmVWJya1i+h9tM7\nScUzkg9n/D099RdaeY1PscGQd7AsOeI7pKfkvBvZ2vtWyrkAO6K/Y236qVD2\nNEUW9SuSwxcg2wtLwoU3xrpd6v3fSUn6BIMN1AEzP61R25E4JQrmc5JqXEWD\n+0WJwqm69lZHcdUKL+CrU/MLXpw7HyUUyKSVjZvrklkTEAUt2SKtXG60oQR2\npREwmrHriBugvAxrMOwSfxhS8CGdw2W1aV5wmIBJk5S9DRNBruh3hrfNWpWs\nVkJtxmiw85SVZ3slkFx+1PwQZ1sxtYGrH/4MRF66UiUH8uSubXF/k1CkpBpE\nb/v26cVbrVvJGGIxqs66JrsvCHqDewGG7oK6G6BihWMCvHbvpeQHubzx+5WF\nvWDZ\r\n=OvKP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCe8eZbHWTkZ3m/61IXJ5758T9+WA7cY+hR0cQ+lWjAdgIhAMr3vji8W1IwFVXA0LNG5LFJb1ks36eja3vncOyZKA1o"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.1.0_1638398492541_0.5323356714612495"},"_hasShrinkwrap":false},"2.2.0-next.0":{"name":"@swivel-finance/swivel-js","version":"2.2.0-next.0","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v2 && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers.js\n\nTo use Swivel-JS you'll need to install ethers.js (`^5.2.0`). \n\n```bash\nnpm install --save ethers\n```\n\n> If demand for web3.js support is high, we'll consider supporting it in future releases.\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Swivel\n\n```typescript\nimport { ethers } from 'ethers';\nimport { EthersVendor, Swivel } from '@swivel-finance/swivel-js';\n\n// create a provider and signer using ethers.js - this example uses\n// metamask's window.ethereum to create an ethers provider\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to use swivel-js with ethers.js, create an EthersVendor using the \n// provider and signer you just created\nconst vendor = new EthersVendor(provider, signer);\n\n// you'll also need to know the chain id of the network you want to use\n// as well as the address of the deployed Swivel contract on that network\nconst chainId = 4;\nconst swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\nconst verifyingContract = swivelAddress;\n\n// create a Swivel instance using the EtherVendor instance\nconst swivel = new Swivel(vendor, chainId, verifyingContract).at(swivelAddress);\n```\n\n### MarketPlace\n\n```typescript\nimport { ethers } from 'ethers';\nimport { EthersVendor, Swivel } from '@swivel-finance/swivel-js';\n\n// create a provider and signer using ethers.js - this example uses\n// metamask's window.ethereum to create an ethers provider\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to use swivel-js with ethers.js, create an EthersVendor using the \n// provider and signer you just created\nconst vendor = new EthersVendor(provider, signer);\n\n// you'll also need to know the address of the deployed MarketPlace \n// contract on the network you want to use\nconst marketPlaceAddress = '0xeb389e2796E081FBb5C032F3D307CD5E6b438D78';\n\n// create a MarketPlace instance using the EthersVendor instance\nconst marketPlace = new MarketPlace(vendor).at(marketPlaceAddress);\n```\n\n### VaultTracker\n\n```typescript\nimport { ethers } from 'ethers';\nimport { EthersVendor, Swivel } from '@swivel-finance/swivel-js';\n\n// create a provider and signer using ethers.js - this example uses\n// metamask's window.ethereum to create an ethers provider\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to use swivel-js with ethers.js, create an EthersVendor using the \n// provider and signer you just created\nconst vendor = new EthersVendor(provider, signer);\n\n// you'll also need to know the address of the deployed VaultTracker\n// a VaultTracker is specific to a market and you can retrieve its\n// address by using the `markets` method of the MarketPlace contract\n\n// first you need to identify a market by its underlying and maturity:\n// - underlying is the market's underlying token address, e.g. \n//   the address of the DAI or USDC token contract\nconst underlying = '0x123456789';\n// - maturity is the market's maturity timestamp in seconds\nconst maturity = 1631638105;\n\n// assuming you already created a MarketPlace instance (as shown above)\nconst addresses = await marketPlace.markets(underlying, maturity);\nconst vaultAddress = addresses.vaultAddr;\n\n// create a VaultTracker instance using the EtherVendor instance\nconst vaultTracker = new VaultTracker(vendor).at(vaultAddress);\n```\n### Code Example: Consuming an order\n\n```typescript\nimport { ethers } from \"ethers\";\nimport { EthersVendor, Swivel } from '@swivel-finance/swivel-js';\nimport { DAI_ABI } from './constants.js';\n\n// @param amount of volume to fill\nasync marketOrderFixed(amount) {\n\n  //initialize ethers provider & signer\n  const provider = new ethers.providers.Web3Provider(window.ethereum);\n  const signer = provider.getSigner();\n  \n  // initialize EthersVender for Swivel consumpion\n  const vendor = new EthersVendor(provider, signer);\n  \n  // constants for Swivel on rinkeby\n  const chainId = 4;\n  const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n  const daiAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n  const verifyingContract = swivelAddress;\n  \n  // initialize swivel wrapper and DAI contract\n  const swivel = new Swivel(vendor, chainId, verifyingContract).at(swivelAddress);\n  const DAI = new ethers.Contract(daiAddress, DAI_ABI, provider);\n  \n  // check approvals, if not approved approve max uint\n  const approvalAmount = await DAI.allowance(window.ethereum.selectedAddress,swivelAddress);\n  if (approvalAmount < amount) {\n  const approve = await this._Dai.approve(swivelAddress, constants.MaxUint256);\n  await approve.wait();\n  }\n  \n  // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby. Can replace with FillPreview API fetch.\n  var order = \n    {\n      key: \"0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb\",\n      maker: \"0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C\",\n      underlying: \"0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa\",\n      vault: true,\n      exit: false,\n      principal: \"40000000000000000000000\",\n      premium: \"2000000000000000000000\",\n      maturity: \"1662089767\",\n      expiry: \"1633324220\",\n    };\n  var signature = \"0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c\";\n\n  // amount, normalized for 18 decimals of DAI, transformed into easily consumable string.\n  const normalizedAmount = (amount*10e18).toString();\n\n  // fill the hardcoded order by initiating your position. Each param is within an array, as multiple orders can be filled at once.\n  const tx = await swivel.initiate([order],[normalizedAmount],[signature]);\n  console.log(tx);\n  const receipt = await tx.wait();\n}\n```\n\n### Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n### Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md","gitHead":"fbbf42e4ecc1c3f31a057494f2f54d454db8e95e","_id":"@swivel-finance/swivel-js@2.2.0-next.0","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-33cvTCU5b3fF5ZiylwOva/DNpE/EF2tjAWMK7wtMMk9UTl7YmKpO8cYPJbwGvchE5lI7EaaVPXbrkOv4GV0wEA==","shasum":"089ef38cee0db748e45ff664088b6fbccdc32f9e","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.2.0-next.0.tgz","fileCount":194,"unpackedSize":355509,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhuiQPCRA9TVsSAnZWagAAezAP/j8be1ZITFYSNfxRcVEY\nD152nvTK983DkcRXajzkZbuCkh9IBVl96kMEd6Q9Jhev3llxneL6IF+ewqhU\nLMfeYB85GyH7gHm+e9YATJohCo8QvMCUFsUCsl9gwEAyQfO2EJChS4621W9I\nc5S2SAT/fSBIDs4upmwFmx2y07QARHDSdg7OdQoCinHCvANLGTPqFkzctVg4\n5IdxPS3prv76WRIPCbKwVuJ+i9YLwsuEZe+EPrmhEEpbiElFWZYqf8P8E2Et\nJOmPCiKg6syQhOstwkEr0vbc4OmkZnOe/HqaK+RaTUFIS4iSJddvjr8raT34\npvGQWG/5LcKcvfnVx6dqAUwfAH7S8CdrT5t7MbuC70OEfIipty2A6l1wLC9l\nf1nEfUJjvfAs0f4vL8XN7YA0C3zUJknr86Z1ghucCh0yPaqj631Bm4wzNGGi\nJtwgZVLfQDfTCpqHZKd8rFVplafjtJWbdJYApTAdZIIFpFUo38y9/OXGorAG\ndhDdMx8hK30zBhPGpLe76h/T9x82b+aMTumhBROB8RRkY4obBB8rkl2S60pJ\nW0jyUqdkfkOAHLIXbPqPjPh/wI6iceUgcDpeRAGTCQeSY2tmCS5vUjgsistv\nLTMccri7RsSqcNP3xAr1295hqKd4ieqKCBRCPAoh114UyLVxVbn51KVkDSMy\nC53s\r\n=KF4V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDVhdU27gpuH3OM9LnhqLvxBJaMgCdkoXqcVY4Qj1eUvQIhAJ+nHz2zWA8EQvCHBWhZmsE2SsS+Y3wCMQ48GrM5nmEQ"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.2.0-next.0_1639588879289_0.335704376172248"},"_hasShrinkwrap":false},"2.2.0":{"name":"@swivel-finance/swivel-js","version":"2.2.0","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v2 && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"7e2a17d86af22eb6f30015cd3e094a113c3cb509","_id":"@swivel-finance/swivel-js@2.2.0","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-BMG6Q/fGhd1dfZmPClRlCeTRnQpFtdBlMYdRylhcJsm2+oYZ1AbF+p4SVpwBoPyQwriT2cGN7j66K6sT6pkBnQ==","shasum":"b788317488d3ea5699c073b2ed6fe216e6b6a729","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.2.0.tgz","fileCount":194,"unpackedSize":355784,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhukbBCRA9TVsSAnZWagAAI4IP/2Ysw8hUt4ByaRxqqo5h\nwH62gUSGiPec316vxviqaDaSbZHxjV86o9vqlaSWC3ze06RoKO3SFlFDhXjd\nM5HOD+/KfiJkHlF1tw35o4fu7K9FVX8WH4YvdgLAExkpbo6PPNzW97xMD6UK\nrkRYzW8pGSPDoRee0qZRZSub/wBHXabsU/HvBOmRZiAv5NlC+q2IR+gGhZWM\nEcoLZhtsiefmkIDvzczusaM9j3mrcoK3dyh9gItMcCyZBpZbV1J8KLUJOuPa\nJTDas6WvuKoRlWjiAifykBt7XHR5wxGIA3mtx2s5k1rKKt4PpPkEt2u0J4N2\nJbxlHac3x6XZ90nPG+KRt795sfg3RbJnbKeBMQZPPuKb9C6lc9dNz9bxFrhr\nq+MnIrJn4wN6S2wuSfAhkgjSad65eWo6G5PvGuXaAzgfRIEm7Z/CYHeJ6ZQB\nR1BdUB24V2XdoPgfp8E32a2fSoskXlLuXjIXzHmmxJV1d1n5MRRHf9JZfg1s\nmGVAOLBFl5Y3earg4rn8z8U1wa53YbyC0/AYQNjrEcl3SEAiV5plqqIux8kd\nQpthDtkt6xCQ3c5Bs3iIX+Bhh9qNe06kHwZLk7FUres2aqqXdOUL93es5abv\nNqDCDDa/lFNkBsenBGHnFEw0CJNOecrrVXbE4r+X6LwWZpOrD075pcEmAF4M\n5pot\r\n=fx6U\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFOjp7G1NLE9rKWlTibQujgBGNsqEcrW8FJ/QmGCsmVaAiA6K03++OSQV6LmZ4ITAJWKcpMMYUdo6H6fofVKMOTb4A=="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.2.0_1639597760810_0.05011035567258082"},"_hasShrinkwrap":false},"2.2.1":{"name":"@swivel-finance/swivel-js","version":"2.2.1","description":"Javascript library for working with the Swivel Finance Protocol","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage ./.nyc_output","commit":"cz","prebuild":"npm run clean","build":"tsc --build ./src","build:watch":"npm run build -- --watch","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' mocha","test:watch":"npm run test -- --watch","test:coverage":"TS_NODE_COMPILER_OPTIONS='{\"resolveJsonModule\":true,\"esModuleInterop\": true}' nyc npm run test","prerelease":"npm-run-all lint build test:coverage","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v2 && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.2.18","@types/mocha":"^8.2.2","@types/sinon":"^10.0.1","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^8.4.0","npm-run-all":"^4.1.5","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^11.1.0","standard-version":"^9.3.0","ts-node":"^10.0.0","typescript":"^4.2.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"5587001fea5e3ca591af0efe5765517a8f2e6850","_id":"@swivel-finance/swivel-js@2.2.1","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-Io1UHsUSz55st6q5vMlHpXq//wNBC0ktfEPUQ/2fM4mUIUHRB0lbC4UCqyNGLPUBOuqlIhxjw3m5n0gpMX0O/w==","shasum":"7494b2e8ba9ceacb457457c8049d178366c6c547","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.2.1.tgz","fileCount":194,"unpackedSize":354043,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhu6srCRA9TVsSAnZWagAAQ4QP/0WPHFXlPKSYsPPL4cLD\ncTqPwBEe67OPOV3lBcLFY/673P7YuvAMuQPojXqUSWvlwlQ7aA7v5nDdmTUo\n9nxMAEQXqN4YJt1TeUMmbgYmnHRCfNvgNlDmOg7vv4skGhKFGliTKY0Eq8PZ\nLI8VV/uH2ser+4h+QrIvvDcJ9UagQn1lRuZxZsq4Vxz/JnqdWvNeBg7oDRG1\nHsGlU7iNsLHmZNg4FJXygzWxhGPyj9j0BzJhC7ZmeeYqXGtRnqY7bdM3LTgt\nCalWW/hqCcr0Fq0BeKcxfkbTMvvNuWq3qRXGnO1G+haSFJqpCSnOyTGPxxsY\nyQLdeUbNSyr2xpYHmP58Dlec/cfjU2diJqky9dPEecgzAMVBY7lO4/LyBQya\nhaE+qK2yW+VcJe7RwsvoAQQ06iVW4MhPn5IS6xkGZmGsbXB3iVnhjqzsXh8g\ngZb+CC5KaxfQuOBLDSNkaPSVtQ5vEkhU+c6B9Fmj1JsWLi5mpo2bIbvHj2/R\nLBCC2C2y3F/AZg/i78GG4Vtu7ErzcmKKov4f27QYnJ4xLuIhOv69Cf46ootK\njb+WFSDsnHAFd3AXvk1JuT4I49lXaKhxNiuTOBqXPxcFvkvZ3Z+Qu4Mb4ar1\nxVH38vgwfpSTJa8kKOAQCTy6+Og9/UnHYEG0U6b4qb55+0MrEIgZBl3igJHG\nDojt\r\n=Yke4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvVWHWXPbC9C+oOqq/9qGSD6hILrhCXBKAoctXkTr+ggIgD1IRGQpBgkS5j7rHpFDLLb/CutgwZ34ZAGzhci8GN9E="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.2.1_1639689003539_0.354392931181269"},"_hasShrinkwrap":false},"2.2.2-next.0":{"name":"@swivel-finance/swivel-js","version":"2.2.2-next.0","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v2 && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.3.0","@types/mocha":"^9.1.0","@types/sinon":"^10.0.8","c8":"^7.11.0","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^9.1.4","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^12.0.1","standard-version":"^9.3.0","typescript":"^4.5.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers.js\n\nTo use Swivel-JS you'll need to install ethers.js (`^5.2.0`). \n\n```bash\nnpm install --save ethers\n```\n\n> If demand for web3.js support is high, we'll consider supporting it in future releases.\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Swivel\n\n#### Create a Swivel instance\n\n```typescript\nimport { EthersVendor, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the chain id of the network you want to use\n// this is necessary for signing offline orders\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...create a Vendor for the Swivel contract,\nconst vendor = new EthersVendor(provider, signer);\n\n// ...and use the vendor to instantiate the Swivel contract\nconst swivel = new Swivel(vendor, chainId, swivelAddress).at(swivelAddress);\n```\n\n#### Sign an order\n\n```typescript\nimport { EthersVendor, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers, utils } from 'ethers';\n\n// you need the chain id of the network you want to use\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...create a Vendor for the Swivel contract,\nconst vendor = new EthersVendor(provider, signer);\n// ...and use the vendor to instantiate the Swivel contract\nconst swivel = new Swivel(vendor, chainId, swivelAddress);\n\n// the order maker is your account address\nconst maker = await signer.getAddress();\n// the order key should be a hash of your account address and a timestamp\nconst key = utils.keccak256(utils.toUtf8Bytes(`${ maker }${ Date.now() }`));\n// you will also need the underlying token address and maturity of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\n\n// create an order\nconst order: Order = {\n    key: key,\n    maker: maker,\n    underlying: underlying,\n    maturity: maturity,\n    vault: false,\n    exit: false,\n    principal: '1000',\n    premium: '50',\n    expiry: '123456789',\n};\n\n// you can now sign the order\nconst signature = await swivel.signOrder(order);\n```\n\n#### Fill an order\n\n```typescript\nimport { EthersVendor, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need a subset of the ERC-20 ABI for token allowance and approval\nconst ERC_20_ABI = [\n    'function allowance(address owner, address spender) public view returns (uint256)',\n    'function approve(address spender, uint256 value) public returns (bool)',\n];\n\n/**\n * Fill an order.\n * \n * @param amount - the amount of volume to fill\n */\nexport async function marketOrderFixed (amount: number): Promise<void> {\n\n    // convert the amount to a BigNumber with the appropriate amount of decimals (e.g. 18 for DAI)\n    const fillAmount = ethers.utils.parseUnits(amount.toString(), 18);\n\n    // create an ethers provider and signer\n    const provider = new ethers.providers.Web3Provider(window.ethereum);\n    const signer = provider.getSigner();\n\n    // create an EthersVender for the Swivel wrapper\n    const vendor = new EthersVendor(provider, signer);\n\n    // constants for Swivel on rinkeby (this might be outdated)\n    const chainId = 4;\n    const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n    const underlyingAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n\n    // create the Swivel wrapper\n    const swivel = new Swivel(vendor, chainId, swivelAddress).at(swivelAddress);\n\n    // to fill an order with Swivel, we need to approve Swivel to transfer our tokens\n    // in order to do this, we need to:\n    //   1. create an ERC20 contract instance\n    //   2. check if the Swivel contract has sufficient allowance for the fill amount\n    //   3. approve the Swivel contract for at least the fill amount\n\n    // create the ERC-20 token contract for the underlying (e.g. DAI)\n    const token = new ethers.Contract(underlyingAddress, ERC_20_ABI, provider);\n\n    // check approval\n    const approvalAmount = await token.allowance(window.ethereum.selectedAddress, swivelAddress) as ethers.BigNumber;\n\n    // if not approved approve max uint\n    // (this frees you from having to approve each single fill)\n    if (approvalAmount.lt(fillAmount)) {\n\n        const approve = await token.approve(swivelAddress, ethers.constants.MaxUint256) as ethers.providers.TransactionResponse;\n        await approve.wait();\n    }\n\n    // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby\n    // in a real-world scenario you would fetch orders from the Preview Market Order API call\n    const order = {\n        key: '0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb',\n        maker: '0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C',\n        underlying: '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa',\n        vault: true,\n        exit: false,\n        principal: '40000000000000000000000',\n        premium: '2000000000000000000000',\n        maturity: '1662089767',\n        expiry: '1633324220',\n    };\n    const signature = '0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c';\n\n    // fill the hardcoded order by initiating your position\n    // each parameter is an array, as multiple orders can be filled at once\n    const tx = await swivel.initiate([order], [fillAmount.toString()], [signature]) as ethers.providers.TransactionResponse;\n    \n    // wait for the transaction to confirm\n    const receipt = await tx.wait();\n\n    console.log(receipt);\n}\n```\n\n### MarketPlace\n\n```typescript\nimport { EthersVendor, MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...create a Vendor for the MarketPlace contract,\nconst vendor = new EthersVendor(provider, signer);\n\n// ...and use the vendor to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(vendor).at(marketPlaceAddress);\n```\n\n### VaultTracker\n\n```typescript\nimport { EthersVendor, VaultTracker } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...create a Vendor for the VaultTracker contract,\nconst vendor = new EthersVendor(provider, signer);\n\n// to create a VaultTracker instance you'll need the address of its\n// deployed contract - each market has it's own VaultTracker contract\n// you can retrieve the address of a VaultTracker by calling the \n// `markets` method of the MarketPlace wrapper\n\n// you will need the underlying token address and maturity of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\n\n// assuming you already created a MarketPlace instance, \n// retrieve the desired market information...\nconst market = await marketPlace.markets(underlying, maturity);\n// ...and extract the `vaultAddress` of the market\nconst vaultAddress = market.vaultAddr;\n\n// use the `vendor` and `vaultAdrress` to instantiate the VaultTracker\nconst vaultTracker = new VaultTracker(vendor).at(vaultAddress);\n```\n\n## Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n## Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md","gitHead":"dcf929286b1d14001d2b4e2396859fe7e174ea97","_id":"@swivel-finance/swivel-js@2.2.2-next.0","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-eK6IJExsPoQRMAjG0sjOsF5nXdK2YOVwts4ZknWgfLWdohMZMCoNPCvgpBLVA0ItXBCaDoN9nOPBwHbN+f/U9A==","shasum":"8f1da314cf5cb289722d37ae3f72e267e710f82d","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.2.2-next.0.tgz","fileCount":194,"unpackedSize":357508,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh6cruCRA9TVsSAnZWagAAR4kP+wSZ0uZHq0tm0CIcbuWp\nYdOqDNVZySu//P1x3WellhNiaH/CWEUy2egfFhkv/syBd/InfN2TfUB6NFPe\nn+AwWRzqR3+nPqNiqC+LPRWdI/FVseALEU/wtIQV5RFTNhAUTD1dJbg2wTm2\nUHRmblGlPl5qbl+s/gu5we4GXTZwVTL+6ttVXjGRCxZ6egdpL46FadTIJ8yf\n2ICsTtcFYHBzuPYZaTZPHjKF/lvG/nfvRYRDUYGFN01x3X7LZm9XxR4BU3VN\nGjYgI1FCxqnejnSYZNP58e4Qvzl1kxrRWu1po1CNjkF8S40CeCeH8I419TYq\nFs7xnBqUfCy2AY5PSn1cn8cFAuT0ZnqF2zVtvVGfvRW9PpjDHP/a0ek3F+Ym\nY6OWnKGwpZwQwBk9e/rRVtpuvJS4PjWc9gO9REAeqESxSMoM481PSUYmCo/9\ntZWeVaMkojq70q1q+dSlrQn8E68C5kSBk8aKOQds2f3U9URGJ4NMw/RyA9ro\nFany5l43fZA6KB/DBFDQHcEuYsegUBv/+foALtEoArzWh0m9PZgu3h9D/mzl\nMM3vC3uYUHFwElIgQKPHQJ06AxtUu3Ps/fSuIy7JVCy93aPbZmRFSMlprTiz\nbasAfSJzBs7sv+zOqtXoHMnOrtErIzEXY9nm92LHFEJZl2/ivxq7mNxNN8QM\nJFEI\r\n=958/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCXZbSvKIHWdf9mMG65lAw9NNGN7uyLyb4WsX2llqCd8QIhAN37j4enxQFnTel+NGfebzSErbThoUHdYELlgLbZaJ33"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.2.2-next.0_1642711790215_0.18751561426139496"},"_hasShrinkwrap":false},"2.2.2":{"name":"@swivel-finance/swivel-js","version":"2.2.2","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v2 && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.3.0","@types/mocha":"^9.1.0","@types/sinon":"^10.0.8","c8":"^7.11.0","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^9.1.4","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^12.0.1","standard-version":"^9.3.0","typescript":"^4.5.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"12dc7fe47137ef2d3edae92218c3356c0380bc31","_id":"@swivel-finance/swivel-js@2.2.2","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-+DhNRZn3PAi5tqp0Wky48ZDIsV2mx/UqBkl5dxzBsHNP3UbvnoloWDnFAXJv6pdwpLcGueuG/YtS4xVSFCPaMw==","shasum":"936c17c5c5ecf93e36fcb5397a4afe5f13477976","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.2.2.tgz","fileCount":194,"unpackedSize":357603,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh6dSbCRA9TVsSAnZWagAAqZMQAJ80TxkYcQ3eNroyy/AO\nm5Lko9sBFlAXXKajKW6gLoEJ6plO0ewdZZToKyvnLiQobVVD63Ezt97oryHd\nNXb6apqilxdtJ7zlOOgpGrKDtDc56KgjDK6Vs2yhuwRkgpJqrH2DZn0GrFL0\ndgQm3yfduE6AY5gAzIrKI/U3Fm7OsshXNEmUtCmkACizNc4zVs40jLvezYv8\ncA9shfEEK6dmb9TeDWrXzE19NY5K3o+GzS5WPLDmXx1Ac1fLnb3iaig3qBgt\nNuBdEwZ5X9b8y4+6VyvTLiGcPpMxNs2gfNqxnpjYIjRUR/LziIgsBqBYL5rn\nEXyF7VxrTJT0CNgfYt9Q5J/33pXhsjoQstPq4FrtWF+XBuXoGt9cNE9brOSB\nEQbrD4fgb4V7b0iMjincGjNN1criuXVtv08BZ9tQYqIe8dAqlZAXUwqvc7v/\n0w3hqC92EtuVIEMamEWgbLfWH07+6vv3X3QT8L6iNxPooJaQj+/w6ZbpRBP0\nSPFlLmUmKUzKntjAW3GRoU4hqHKSJe7YoV6dkLOaTgUwI6ByL/DPEfF5uLxE\nBqS75UclcnteX/vuJEFS6qtvlwCmXOYU5z5j+1PnZUesJagijDtKLYnrQVNa\nDaEuelvD8P6sUq35u7vsfT1WUtrAMOYe8ySGf44n5rOxiqxUR6TZsQMuZLVb\ngHvt\r\n=4gUo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAkkVwMX15GMKHIwgOascIuL1euQdNkgelIuYlroZQn7AiBqg/NO1/FLvz8qRTofz5QFBX6y2r70RU/yQdnOCFratA=="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.2.2_1642714266769_0.07986169238826157"},"_hasShrinkwrap":false},"2.2.3":{"name":"@swivel-finance/swivel-js","version":"2.2.3","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v2 && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.3.0","@types/mocha":"^9.1.0","@types/sinon":"^10.0.8","c8":"^7.11.0","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^9.1.4","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^12.0.1","standard-version":"^9.3.0","typescript":"^4.5.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"3c79832e1839e3c39edca662088ca639f5eb443f","_id":"@swivel-finance/swivel-js@2.2.3","_nodeVersion":"16.13.1","_npmVersion":"8.3.0","dist":{"integrity":"sha512-/iBNgpL2qQR0zKrOdAzrh2Mj6w/URj4pJ24LNvzOj5rfZRhAd7r1TI5NSv6kmf3B/7HrXdY/rW8q2UZooeB6Jg==","shasum":"454ffb5d9f6dbd3b2d1e27d8480fdb86ff7dd23c","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.2.3.tgz","fileCount":193,"unpackedSize":351416,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh7DtsCRA9TVsSAnZWagAAwJ8P/j22VsHi6jbXNSJt93Yy\nlM/bfKUL8dT4rXLmAZBkZ2T5crmdGAH3TF6e4VtIoKO63irQ8I8HfkB/0PrL\n7UNZgjArdosEgp6eoAhBJiUTUGHhxM28hi7KOmYSbWKV+uX1N5nnLj3FveSo\nG+r87x5qMwQQNN5xlxYuk4/nT1B790atglbTNZ5hKTM6YEl7kcNFXy87Uk04\nWyfQgxahfLuu+G7EHOuJxS9otDnDXwV4rO4zLx8VJ/1LxkUetxCKflq8oWrt\n8QErKgz1iapXLjnTR/F2u0lgQfHFatVdbc1z8pNpY5byutZaQxkcBOnTCnzs\nT8qo6DON8OBy7XkoXrl6JznaVMBPIUpcIF7WozqKO4RRSnAtGlEMA/lb39Hg\nYym+dSf+bU7GQZhXUdh6c+BjKpuNH9Cq5h2EQfuOzS6NWYwF/0UQwYsdPOrz\n7F5vZ4eR6MpyQizk639iSkVWHVFy8LygAZqGx3kbA/ADQIMHqJAinTani22F\nj4mjhkPL73oOKPchHOGrGE55pDOdpL+drU3wUna+OhUQZRkxByFfXwfGAzH+\n7omL7cOX9jfJHOtUpYqUvbKsdC11yj2BQIrYlPfzdBHbd9wbJk/j8E0u/Aoa\n9VtrHXqW/QIsj8az1NpqOEJjQdXdmZjrKtB4QKb96ulhrV2DRVCUT8FESdlD\nAgII\r\n=Xp1u\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC8aWCN0HMiqz27+68xccQ5wn9cLfup3byQGRoLaQZMWAIhAMGWyzZ0Kw34HOt1HujQAylgKUnB2irTIq49x0uknXjE"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.2.3_1642871660390_0.788463533541677"},"_hasShrinkwrap":false},"2.2.4":{"name":"@swivel-finance/swivel-js","version":"2.2.4","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v2 && npm publish --access public"},"devDependencies":{"@ethersproject/abstract-signer":"^5.2.0","@ethersproject/contracts":"^5.2.0","@ethersproject/providers":"^5.2.0","@ethersproject/wallet":"^5.2.0","@swivel-finance/eslint-config":"^0.1.0","@types/chai":"^4.3.0","@types/mocha":"^9.1.0","@types/sinon":"^10.0.8","c8":"^7.11.0","chai":"^4.3.4","commitizen":"^4.2.4","cz-conventional-changelog":"^3.2.0","eslint":"^7.27.0","eslint-plugin-import":"^2.23.3","ethers":"^5.2.0","mocha":"^9.1.4","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^12.0.1","standard-version":"^9.3.0","typescript":"^4.5.4","web3":"^1.3.6"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"4b92e3a2c66046427559657fa43c97890a4dfa71","_id":"@swivel-finance/swivel-js@2.2.4","_nodeVersion":"15.8.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-FGmY5ykGGCusuiJxddrxut23nnGfrJtWD2UmCcVmSj/AfSDej8Myampnu2GDR79FSqtv9c4XdAaacQFtwxa7zg==","shasum":"6d3912dcd3324d99af0ebe6b4490644523227db3","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-2.2.4.tgz","fileCount":194,"unpackedSize":358308,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8E13CRA9TVsSAnZWagAAOEUP/RjeR0+pL2C9AM5aLCNW\n6cs/3+C9ehJNlM45u8Vex7FT+X0dpUDcNsV4MitkgYoJ0ViJBnEhd8f4LhlO\nvpishesAR5yX0yZ5nzvqBvDQRS9/IEgEPwGxlKx7t46xW12D/ykxFfat3rP6\ntF+JAqLu9MhkOsXCK/g0b43yxjJVxlmlZ73NEdWzp2sE4FyWUq7T8sUpVJvC\nhcf7+M+YwE8eIx6jhDLDT68kHB+p800fn/JTnCskFnED0Me0cny6NYZldqbY\nfsB5FBAuJgo8HJ0MrCacmanbMpKKN6tXtsstUJ4bB9X89uig+WbRVUZgB/R9\nPSNU20/+gPB3g5M3Cn3EyN1q9d+anUxbY26bmisIi8kZuujH+N7gCLvLkmCA\ngREWm1wDA3u3csopW5dpU6RGx711/LRFASWzJ3fSuXUZkFTG+AlvUqXMTixo\nr6h9eFZQlnld435Fb8GEyLePRJMQ42MW4GY4SP2/nvnjcIyLWXiKL+4jq7hd\net7lQpxnkcWb8L5R7zSWCma3qE+1/0mOCYbwhMM+2CYZ0ZM1FudxcIe5v/ob\nnfIE/1cMqv5wE31aWL7AZUon6f3oRxr4OTgSe56uQPT6KbcQREPl5HADktEJ\nzdto7WezGFpY8Z7O9pzt4KQd8bggifOk7Ks00w1Diq8UdTXrzOww/u7AKheT\nCajR\r\n=TKKk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFsK2vv+uk58mM0mSmc4LK4C7YiyJSArt9963l/l/BdnAiEAkFnK0KGb4JY9z/TwTddXeZ0kxq6zFOoof9K/5DGzHnA="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_2.2.4_1643138422960_0.22358099806841736"},"_hasShrinkwrap":false},"3.0.0-next.0":{"name":"@swivel-finance/swivel-js","version":"3.0.0-next.0","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers\n\nIn order use `swivel-js` you'll need a compatible version (`^5.2.0`) of `ethers`. Being a peer dependency, you can use any compatible version of `ethers` you already have installed in your project. \n\nIf you haven't installed a compatible version of `ethers` in your project yet, run:\n\n```bash\nnpm install --save ethers\n```\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Protocols\n\nSwivel supports 6 different interest-generating protocols and each market on Swivel is tied to a specific protocol. You can select a Protocol using the `Protocols` enum:\n\n```typescript\nimport { Protocols } from '@swivel-finance/swivel-js';\n\nconst protocol = Protocols.Compound;\n```\n\nor you can use the Protocol's numeric value:\n\n```typescript\n/**\n * The Protocol's numeric values\n * \n * Erc4626  = 0\n * Compound = 1\n * Rari     = 2\n * Yearn    = 3\n * Aave     = 4\n * Euler    = 5\n */ \n \nconst protocol = 4; // Aave\n```\n\n### Swivel\n\n#### Create a Swivel instance\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n```\n\n#### Sign an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers, utils } from 'ethers';\n\n// you need the chain id of the network you want to use\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// the order maker is your account address\nconst maker = await signer.getAddress();\n// the order key should be a hash of your account address and a timestamp\nconst key = utils.keccak256(utils.toUtf8Bytes(`${ maker }${ Date.now() }`));\n// you will also need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// create an order\nconst order: Order = {\n    key: key,\n    maker: maker,\n    underlying: underlying,\n    maturity: maturity,\n    protocol: protocol,\n    vault: false,\n    exit: false,\n    principal: '10000000',\n    premium: '500000',\n    expiry: '1648177200',\n};\n\n// you can now sign the order using the Swivel class' static `signOrder` method\nconst signature = await Swivel.signOrder(order, signer, swivelAddress, chainId);\n```\n\n#### Fill an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need a subset of the ERC-20 ABI for token allowance and approval\nconst ERC_20_ABI = [\n    'function allowance(address owner, address spender) public view returns (uint256)',\n    'function approve(address spender, uint256 value) public returns (bool)',\n];\n\n/**\n * Fill an order.\n * \n * @param amount - the amount of volume to fill\n */\nexport async function marketOrderFixed (amount: number): Promise<void> {\n\n    // convert the amount to a BigNumber with the appropriate amount of decimals (e.g. 18 for DAI)\n    const fillAmount = ethers.utils.parseUnits(amount.toString(), 18);\n\n    // create an ethers provider and signer\n    const provider = new ethers.providers.Web3Provider(window.ethereum);\n    const signer = provider.getSigner();\n\n    // constants for Swivel on rinkeby (this might be outdated)\n    const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n    const underlyingAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n\n    // create the Swivel contract\n    const swivel = new Swivel(swivelAddress, signer);\n\n    // to fill an order with Swivel, we need to approve Swivel to transfer our tokens\n    // in order to do this, we need to:\n    //   1. create an ERC20 contract instance\n    //   2. check if the Swivel contract has sufficient allowance for the fill amount\n    //   3. approve the Swivel contract for at least the fill amount\n\n    // create the ERC-20 token contract for the underlying (e.g. DAI)\n    const token = new ethers.Contract(underlyingAddress, ERC_20_ABI, provider);\n\n    // check approval\n    const approvalAmount = await token.allowance(window.ethereum.selectedAddress, swivelAddress) as ethers.BigNumber;\n\n    // if not approved approve max uint\n    // (this frees you from having to approve each single fill)\n    if (approvalAmount.lt(fillAmount)) {\n\n        const approve = await token.approve(swivelAddress, ethers.constants.MaxUint256) as ethers.providers.TransactionResponse;\n        await approve.wait();\n    }\n\n    // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby\n    // in a real-world scenario you would fetch orders from the Preview Market Order API call\n    const order = {\n        key: '0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb',\n        maker: '0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C',\n        underlying: '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa',\n        vault: true,\n        exit: false,\n        principal: '40000000000000000000000',\n        premium: '2000000000000000000000',\n        maturity: '1662089767',\n        expiry: '1633324220',\n    };\n    const signature = '0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c';\n\n    // fill the hardcoded order by initiating your position\n    // each parameter is an array, as multiple orders can be filled at once\n    const tx = await swivel.initiate([order], [fillAmount.toString()], [signature]) as ethers.providers.TransactionResponse;\n    \n    // wait for the transaction to confirm\n    const receipt = await tx.wait();\n\n    console.log(receipt);\n}\n```\n\n### MarketPlace\n\n#### Create a MarketPlace instance\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n```\n\n#### Get the interest rate (supply APY) of a market\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n\n// you'll need to know the market's protocol (Compound in this example),\nconst protocol = Protocols.Compound;\n// ...underlying (USDC in this example),\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'\n// ... and maturity (30/9/2022 in this example)\nconst maturity = 1664550000;\n\n// get the market info for a specific market\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n\n// get the market's interest rate (supply APY)\nconst interestRate = await marketPlace.interestRate(protocol, market.cTokenAddr);\n```\n\n### VaultTracker\n\n```typescript\nimport { Protocols, VaultTracker } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to create a VaultTracker instance you'll need the address of its\n// deployed contract - each market has it's own VaultTracker contract\n// you can retrieve the address of a VaultTracker by calling the \n// `markets` method of the MarketPlace contract\n\n// you will need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// assuming you already created a MarketPlace instance, \n// retrieve the desired market information...\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n// ...and extract the `vaultTracker` of the market\nconst vaultAddress = market.vaultTracker;\n\n// use the `signer` and `vaultAdrress` to instantiate the VaultTracker\nconst vaultTracker = new VaultTracker(vaultAddress, signer);\n```\n\n### Error Handling\n\nThe Swivel protocol uses [solidity custom errors](https://blog.soliditylang.org/2021/04/21/custom-errors/) throughout to provide additional error context to consumers through error parameters. Swivel relies on a single custom error interface to do so:\n\n```solidity\nerror Exception(uint8 code, uint256 amountReceived, uint256 amountExpected, address addressReceived, address addressExpected);\n```\n\nEach error has a unique `code` and, depending on the `code`, the `amount` and `address` parameters will be set to provide relevant context to the error instance.\n\n`swivel-js` provides helpers to easily extract custom error data from failed transactions, as well as a mapping of `Exception` codes to human-readable error names and fully formatted error messages. The easiest way to handle custom errors using `swivel-js` is by using the `parseSwivelError` method:\n\n```typescript\nimport { parseSwivelError, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n\n// assume you have an order and its signature...\nconst order = {...};\nconst signature = '...';\n\n// ...and you'd like to fill the order with 100 underlying\nconst amount = ethers.utils.parseUnits('100', 18);\n\n// use a try/catch block around your transaction\ntry {\n\n    const tx = await swivel.initiate([order], [amount], [signature]);\n\n    const receipt = await tx.wait();\n\n} catch (error) {\n\n    // if the transaction fails, you will receive an ethers error which\n    // will usually be a `CALL_EXCEPTION` or `UNPREDICTABLE_GAS_LIMIT`\n    \n    // regardless of the ethers error, you can pass it to the \n    // `parseSwivelError` method, which will extract the custom error\n    // data (if it is available) and create a `SwivelError` instance,\n    // populating it with a human-readable error name and formatted error message\n    // if the ethers error does not contain any custom error data,\n    // `parseSwivelError` will return `undefined`\n    const swivelError = parseSwivelError(error);\n\n    if (swivelError) {\n\n        // you can notify users with a useful error message\n        alert(swivelError.message);\n    \n    } else {\n\n        // something else went wrong, you'll need to handle the ethers error\n    }\n}\n```\n\n## Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n## Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md","gitHead":"dccd2bd5c804a3b07ae88dfe586045a14e514d5a","_id":"@swivel-finance/swivel-js@3.0.0-next.0","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-/FCGVwzG7qgkA+8t8vrtnpEJXUu/3ztQmd/4TOhBJ1mb7YmR+h6GzaK7Dm4kX4DZUoxjBxEtICd+Q1GA0vt+AA==","shasum":"aec95f183fb06a8ca072504dc02dea7b4584ce6a","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.0.0-next.0.tgz","fileCount":293,"unpackedSize":496359,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDmLUQfcOUlhDXdCTrWgaoeRCVeTB/gPSpxaxmD1B+HXgIhAPh1sUnjQ72UGq8tuTkCw/MY0rkDJaFqYzOkAb9aT1bM"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi5C8UACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmosjg/8DBx5XjNPPXvT68NzceC+aUkwYprxCcJwxuPwKz52kyfx50Ex\r\nnHXpuozumlMFgW1pEn73QQEoVXq/E3DqOs62B0eonlJGTrmGHVyP2HxXLeO8\r\npvjwH6hqEgd/47+y7lezIpQY21LP8u/o9kMZMYPYjDktfzBsqHRjxpw7AOZ8\r\nZFQu2p8RtN87nR83E2LmjTd2Z1+fm+IGS3ypwSZ62Tuf2MwKpDVGtJtDSKM9\r\n1DEty0zml/eyT3SHTXX/5ADgtv+91MaYUeZWp62PIUL4XcmTmcy5iqePBIGe\r\nPnmHxDj3TvLgH9aINQcwttO6LBnNwitagxm3tKyclGQNmGhJlOs8RNUvWmEj\r\nESn0Pr7S19TQoPpzCNBdFZGL5/GKVLoqrP2KFCAtCvBEfclMZTI93veyTGmC\r\nrD3tKOUWfPsLgoAE4CScsoARXaznpTzU2w674dgktlz4nNe6Gcyphwr7zH6L\r\nXuUXIqPPK/4sP3pPLWwJsB6K0yww5G2iWBtl4GoU4OJ1RpeC5pdP6DdQYQ+5\r\nz3d6hmm6mj+RgaSeNFlIRTOJpYOW9tgZQu+BEIurGmakCMR69o9EgXCVDymB\r\nq0L/zhyoafywQSvL92LUxXvMdLQtK5qBSgzcfd+fkjk7rYmKIzlNAAEL2bDV\r\n2GoOP+ZZRVJb6C853cxNne3RlfwDP+axlqk=\r\n=1PG+\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.0.0-next.0_1659121427764_0.4286264861068554"},"_hasShrinkwrap":false},"3.0.0-next.1":{"name":"@swivel-finance/swivel-js","version":"3.0.0-next.1","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers\n\nIn order use `swivel-js` you'll need a compatible version (`^5.2.0`) of `ethers`. Being a peer dependency, you can use any compatible version of `ethers` you already have installed in your project. \n\nIf you haven't installed a compatible version of `ethers` in your project yet, run:\n\n```bash\nnpm install --save ethers\n```\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Protocols\n\nSwivel supports 6 different interest-generating protocols and each market on Swivel is tied to a specific protocol. You can select a Protocol using the `Protocols` enum:\n\n```typescript\nimport { Protocols } from '@swivel-finance/swivel-js';\n\nconst protocol = Protocols.Compound;\n```\n\nor you can use the Protocol's numeric value:\n\n```typescript\n/**\n * The Protocol's numeric values\n * \n * Erc4626  = 0\n * Compound = 1\n * Rari     = 2\n * Yearn    = 3\n * Aave     = 4\n * Euler    = 5\n */ \n \nconst protocol = 4; // Aave\n```\n\n### Swivel\n\n#### Create a Swivel instance\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n```\n\n#### Sign an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers, utils } from 'ethers';\n\n// you need the chain id of the network you want to use\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// the order maker is your account address\nconst maker = await signer.getAddress();\n// the order key should be a hash of your account address and a timestamp\nconst key = utils.keccak256(utils.toUtf8Bytes(`${ maker }${ Date.now() }`));\n// you will also need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// create an order\nconst order: Order = {\n    key: key,\n    maker: maker,\n    underlying: underlying,\n    maturity: maturity,\n    protocol: protocol,\n    vault: false,\n    exit: false,\n    principal: '10000000',\n    premium: '500000',\n    expiry: '1648177200',\n};\n\n// you can now sign the order using the Swivel class' static `signOrder` method\nconst signature = await Swivel.signOrder(order, signer, swivelAddress, chainId);\n```\n\n#### Fill an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need a subset of the ERC-20 ABI for token allowance and approval\nconst ERC_20_ABI = [\n    'function allowance(address owner, address spender) public view returns (uint256)',\n    'function approve(address spender, uint256 value) public returns (bool)',\n];\n\n/**\n * Fill an order.\n * \n * @param amount - the amount of volume to fill\n */\nexport async function marketOrderFixed (amount: number): Promise<void> {\n\n    // convert the amount to a BigNumber with the appropriate amount of decimals (e.g. 18 for DAI)\n    const fillAmount = ethers.utils.parseUnits(amount.toString(), 18);\n\n    // create an ethers provider and signer\n    const provider = new ethers.providers.Web3Provider(window.ethereum);\n    const signer = provider.getSigner();\n\n    // constants for Swivel on rinkeby (this might be outdated)\n    const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n    const underlyingAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n\n    // create the Swivel contract\n    const swivel = new Swivel(swivelAddress, signer);\n\n    // to fill an order with Swivel, we need to approve Swivel to transfer our tokens\n    // in order to do this, we need to:\n    //   1. create an ERC20 contract instance\n    //   2. check if the Swivel contract has sufficient allowance for the fill amount\n    //   3. approve the Swivel contract for at least the fill amount\n\n    // create the ERC-20 token contract for the underlying (e.g. DAI)\n    const token = new ethers.Contract(underlyingAddress, ERC_20_ABI, provider);\n\n    // check approval\n    const approvalAmount = await token.allowance(window.ethereum.selectedAddress, swivelAddress) as ethers.BigNumber;\n\n    // if not approved approve max uint\n    // (this frees you from having to approve each single fill)\n    if (approvalAmount.lt(fillAmount)) {\n\n        const approve = await token.approve(swivelAddress, ethers.constants.MaxUint256) as ethers.providers.TransactionResponse;\n        await approve.wait();\n    }\n\n    // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby\n    // in a real-world scenario you would fetch orders from the Preview Market Order API call\n    const order = {\n        key: '0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb',\n        maker: '0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C',\n        underlying: '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa',\n        vault: true,\n        exit: false,\n        principal: '40000000000000000000000',\n        premium: '2000000000000000000000',\n        maturity: '1662089767',\n        expiry: '1633324220',\n    };\n    const signature = '0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c';\n\n    // fill the hardcoded order by initiating your position\n    // each parameter is an array, as multiple orders can be filled at once\n    const tx = await swivel.initiate([order], [fillAmount.toString()], [signature]) as ethers.providers.TransactionResponse;\n    \n    // wait for the transaction to confirm\n    const receipt = await tx.wait();\n\n    console.log(receipt);\n}\n```\n\n### MarketPlace\n\n#### Create a MarketPlace instance\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n```\n\n#### Get the interest rate (supply APY) of a market\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n\n// you'll need to know the market's protocol (Compound in this example),\nconst protocol = Protocols.Compound;\n// ...underlying (USDC in this example),\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'\n// ... and maturity (30/9/2022 in this example)\nconst maturity = 1664550000;\n\n// get the market info for a specific market\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n\n// get the market's interest rate (supply APY)\nconst interestRate = await marketPlace.interestRate(protocol, market.cTokenAddr);\n```\n\n### VaultTracker\n\n```typescript\nimport { Protocols, VaultTracker } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to create a VaultTracker instance you'll need the address of its\n// deployed contract - each market has it's own VaultTracker contract\n// you can retrieve the address of a VaultTracker by calling the \n// `markets` method of the MarketPlace contract\n\n// you will need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// assuming you already created a MarketPlace instance, \n// retrieve the desired market information...\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n// ...and extract the `vaultTracker` of the market\nconst vaultAddress = market.vaultTracker;\n\n// use the `signer` and `vaultAdrress` to instantiate the VaultTracker\nconst vaultTracker = new VaultTracker(vaultAddress, signer);\n```\n\n### Error Handling\n\nThe Swivel protocol uses [solidity custom errors](https://blog.soliditylang.org/2021/04/21/custom-errors/) throughout to provide additional error context to consumers through error parameters. Swivel relies on a single custom error interface to do so:\n\n```solidity\nerror Exception(uint8 code, uint256 amountReceived, uint256 amountExpected, address addressReceived, address addressExpected);\n```\n\nEach error has a unique `code` and, depending on the `code`, the `amount` and `address` parameters will be set to provide relevant context to the error instance.\n\n`swivel-js` provides helpers to easily extract custom error data from failed transactions, as well as a mapping of `Exception` codes to human-readable error names and fully formatted error messages. The easiest way to handle custom errors using `swivel-js` is by using the `parseSwivelError` method:\n\n```typescript\nimport { parseSwivelError, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n\n// assume you have an order and its signature...\nconst order = {...};\nconst signature = '...';\n\n// ...and you'd like to fill the order with 100 underlying\nconst amount = ethers.utils.parseUnits('100', 18);\n\n// use a try/catch block around your transaction\ntry {\n\n    const tx = await swivel.initiate([order], [amount], [signature]);\n\n    const receipt = await tx.wait();\n\n} catch (error) {\n\n    // if the transaction fails, you will receive an ethers error which\n    // will usually be a `CALL_EXCEPTION` or `UNPREDICTABLE_GAS_LIMIT`\n    \n    // regardless of the ethers error, you can pass it to the \n    // `parseSwivelError` method, which will extract the custom error\n    // data (if it is available) and create a `SwivelError` instance,\n    // populating it with a human-readable error name and formatted error message\n    // if the ethers error does not contain any custom error data,\n    // `parseSwivelError` will return `undefined`\n    const swivelError = parseSwivelError(error);\n\n    if (swivelError) {\n\n        // you can notify users with a useful error message\n        alert(swivelError.message);\n    \n    } else {\n\n        // something else went wrong, you'll need to handle the ethers error\n    }\n}\n```\n\n## Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n## Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md","gitHead":"5bdfc368b6b082fd5012763f049b5809194ec3b2","_id":"@swivel-finance/swivel-js@3.0.0-next.1","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-WzVO2VV1wo/LDodcvyUEN+n+FPm2KWEqLWunOpNTxBEIopMLhvom5ywEgo8kIuBccrH/hYlnnnwpTLL0py/3Og==","shasum":"a2b57835b472c673e38d190d17ff544adf2db52d","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.0.0-next.1.tgz","fileCount":293,"unpackedSize":502541,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFeiBD+L6R6LFCEAHTweakCohKgzLkzST475EOGAnKu0AiAxP9+wLIMJVmcjYXTxFhkGFJzXQXpdr8ciyDlCuvWjpw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi9Rp6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrYjw/+P1N4LM9LxxCU6CEtQw0YpMQFvwny8M+vk8uO8hxbnhLGIyP4\r\nVNr26gmsoNgtz3krICkUWea7IVfJ769png3ZUhb2hIwU8AHqLiZRzULxaq7U\r\nOyr45FnGXY3uo5DTa8GGFY3vdbpOO2Dvywl/krzo54kuL2LY6hl+sROTpynm\r\nhE4KabFc55EdVuqa2XqEueUFZVejNOOXHzykjtKR5gcjO73C1Sg4lRjAmrrx\r\nFCFiNS3pzDGScTinIIONv4BBZ2qj/xnIu1z8nw7E0t2a1ejuB4RZLXRD6tNf\r\nZi6lLSqLY5kDfP2ue+HYVz1GtN/0MPxAq6Vfg6VTZzH3E0DGe2PUjYKaO5bb\r\nUXbn1SgsdOy2phsHVvI2S+IcRyEGxQNBYkyTblKgTV7WV2mgeZO84eqtB73+\r\nhU9ig+VBA/7HwOYDwdFaMgkBGLggQUJ32V2kMmVM0/bv1HsIfjvT5E3Kvru9\r\nw1nRhvnFCRWKjX9BD41sRh1zwvpkdJy6xLKb4ZP2VSt0nDcgH4UiAPytcyFu\r\nbQ6CYlL9jedaM9kTXILXtHxllZNqYgNSVxfo5f99RTXbagYHzfN7nnYio62j\r\nifpbYnnWJViT1ZjS07O/CP+Eit9TaGdHgtUMIAdH4M8EielsOD2zCX7qA1VJ\r\neADDQw2jCW3WiONhQEPmVx/u+t26Ki6FmdU=\r\n=hRsY\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.0.0-next.1_1660230266044_0.050902349785135304"},"_hasShrinkwrap":false},"3.0.0-next.2":{"name":"@swivel-finance/swivel-js","version":"3.0.0-next.2","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers\n\nIn order use `swivel-js` you'll need a compatible version (`^5.2.0`) of `ethers`. Being a peer dependency, you can use any compatible version of `ethers` you already have installed in your project. \n\nIf you haven't installed a compatible version of `ethers` in your project yet, run:\n\n```bash\nnpm install --save ethers\n```\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Protocols\n\nSwivel supports 6 different interest-generating protocols and each market on Swivel is tied to a specific protocol. You can select a Protocol using the `Protocols` enum:\n\n```typescript\nimport { Protocols } from '@swivel-finance/swivel-js';\n\nconst protocol = Protocols.Compound;\n```\n\nor you can use the Protocol's numeric value:\n\n```typescript\n/**\n * The Protocol's numeric values\n * \n * Erc4626  = 0\n * Compound = 1\n * Rari     = 2\n * Yearn    = 3\n * Aave     = 4\n * Euler    = 5\n */ \n \nconst protocol = 4; // Aave\n```\n\n### Swivel\n\n#### Create a Swivel instance\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n```\n\n#### Sign an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers, utils } from 'ethers';\n\n// you need the chain id of the network you want to use\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// the order maker is your account address\nconst maker = await signer.getAddress();\n// the order key should be a hash of your account address and a timestamp\nconst key = utils.keccak256(utils.toUtf8Bytes(`${ maker }${ Date.now() }`));\n// you will also need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// create an order\nconst order: Order = {\n    key: key,\n    maker: maker,\n    underlying: underlying,\n    maturity: maturity,\n    protocol: protocol,\n    vault: false,\n    exit: false,\n    principal: '10000000',\n    premium: '500000',\n    expiry: '1648177200',\n};\n\n// you can now sign the order using the Swivel class' static `signOrder` method\nconst signature = await Swivel.signOrder(order, signer, swivelAddress, chainId);\n```\n\n#### Fill an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need a subset of the ERC-20 ABI for token allowance and approval\nconst ERC_20_ABI = [\n    'function allowance(address owner, address spender) public view returns (uint256)',\n    'function approve(address spender, uint256 value) public returns (bool)',\n];\n\n/**\n * Fill an order.\n * \n * @param amount - the amount of volume to fill\n */\nexport async function marketOrderFixed (amount: number): Promise<void> {\n\n    // convert the amount to a BigNumber with the appropriate amount of decimals (e.g. 18 for DAI)\n    const fillAmount = ethers.utils.parseUnits(amount.toString(), 18);\n\n    // create an ethers provider and signer\n    const provider = new ethers.providers.Web3Provider(window.ethereum);\n    const signer = provider.getSigner();\n\n    // constants for Swivel on rinkeby (this might be outdated)\n    const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n    const underlyingAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n\n    // create the Swivel contract\n    const swivel = new Swivel(swivelAddress, signer);\n\n    // to fill an order with Swivel, we need to approve Swivel to transfer our tokens\n    // in order to do this, we need to:\n    //   1. create an ERC20 contract instance\n    //   2. check if the Swivel contract has sufficient allowance for the fill amount\n    //   3. approve the Swivel contract for at least the fill amount\n\n    // create the ERC-20 token contract for the underlying (e.g. DAI)\n    const token = new ethers.Contract(underlyingAddress, ERC_20_ABI, provider);\n\n    // check approval\n    const approvalAmount = await token.allowance(window.ethereum.selectedAddress, swivelAddress) as ethers.BigNumber;\n\n    // if not approved approve max uint\n    // (this frees you from having to approve each single fill)\n    if (approvalAmount.lt(fillAmount)) {\n\n        const approve = await token.approve(swivelAddress, ethers.constants.MaxUint256) as ethers.providers.TransactionResponse;\n        await approve.wait();\n    }\n\n    // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby\n    // in a real-world scenario you would fetch orders from the Preview Market Order API call\n    const order = {\n        key: '0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb',\n        maker: '0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C',\n        underlying: '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa',\n        vault: true,\n        exit: false,\n        principal: '40000000000000000000000',\n        premium: '2000000000000000000000',\n        maturity: '1662089767',\n        expiry: '1633324220',\n    };\n    const signature = '0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c';\n\n    // fill the hardcoded order by initiating your position\n    // each parameter is an array, as multiple orders can be filled at once\n    const tx = await swivel.initiate([order], [fillAmount.toString()], [signature]) as ethers.providers.TransactionResponse;\n    \n    // wait for the transaction to confirm\n    const receipt = await tx.wait();\n\n    console.log(receipt);\n}\n```\n\n### MarketPlace\n\n#### Create a MarketPlace instance\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n```\n\n#### Get the interest rate (supply APY) of a market\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n\n// you'll need to know the market's protocol (Compound in this example),\nconst protocol = Protocols.Compound;\n// ...underlying (USDC in this example),\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'\n// ... and maturity (30/9/2022 in this example)\nconst maturity = 1664550000;\n\n// get the market info for a specific market\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n\n// get the market's interest rate (supply APY)\nconst interestRate = await marketPlace.interestRate(protocol, market.cTokenAddr);\n```\n\n### VaultTracker\n\n```typescript\nimport { Protocols, VaultTracker } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to create a VaultTracker instance you'll need the address of its\n// deployed contract - each market has it's own VaultTracker contract\n// you can retrieve the address of a VaultTracker by calling the \n// `markets` method of the MarketPlace contract\n\n// you will need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// assuming you already created a MarketPlace instance, \n// retrieve the desired market information...\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n// ...and extract the `vaultTracker` of the market\nconst vaultAddress = market.vaultTracker;\n\n// use the `signer` and `vaultAdrress` to instantiate the VaultTracker\nconst vaultTracker = new VaultTracker(vaultAddress, signer);\n```\n\n### Error Handling\n\nThe Swivel protocol uses [solidity custom errors](https://blog.soliditylang.org/2021/04/21/custom-errors/) throughout to provide additional error context to consumers through error parameters. Swivel relies on a single custom error interface to do so:\n\n```solidity\nerror Exception(uint8 code, uint256 amountReceived, uint256 amountExpected, address addressReceived, address addressExpected);\n```\n\nEach error has a unique `code` and, depending on the `code`, the `amount` and `address` parameters will be set to provide relevant context to the error instance.\n\n`swivel-js` provides helpers to easily extract custom error data from failed transactions, as well as a mapping of `Exception` codes to human-readable error names and fully formatted error messages. The easiest way to handle custom errors using `swivel-js` is by using the `parseSwivelError` method:\n\n```typescript\nimport { parseSwivelError, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n\n// assume you have an order and its signature...\nconst order = {...};\nconst signature = '...';\n\n// ...and you'd like to fill the order with 100 underlying\nconst amount = ethers.utils.parseUnits('100', 18);\n\n// use a try/catch block around your transaction\ntry {\n\n    const tx = await swivel.initiate([order], [amount], [signature]);\n\n    const receipt = await tx.wait();\n\n} catch (error) {\n\n    // if the transaction fails, you will receive an ethers error which\n    // will usually be a `CALL_EXCEPTION` or `UNPREDICTABLE_GAS_LIMIT`\n    \n    // regardless of the ethers error, you can pass it to the \n    // `parseSwivelError` method, which will extract the custom error\n    // data (if it is available) and create a `SwivelError` instance,\n    // populating it with a human-readable error name and formatted error message\n    // if the ethers error does not contain any custom error data,\n    // `parseSwivelError` will return `undefined`\n    const swivelError = parseSwivelError(error);\n\n    if (swivelError) {\n\n        // you can notify users with a useful error message\n        alert(swivelError.message);\n    \n    } else {\n\n        // something else went wrong, you'll need to handle the ethers error\n    }\n}\n```\n\n## Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n## Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md","gitHead":"a8903bdfa956e2c9ec677be978dec8a46d9bfd7d","_id":"@swivel-finance/swivel-js@3.0.0-next.2","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-DNAS4/jx1CSYGEk8PsrY27fJS4oRudzhybyD+/fyxXESkQazA6vftNgi8BthW0T/uhKkJ8l2FnFs9suVaRpnzQ==","shasum":"1046e2a71abb8898b88b68300a11b713c83cfed6","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.0.0-next.2.tgz","fileCount":298,"unpackedSize":503489,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFVY1SG091XTC/Vv7qHCagReRAogmV1Xk6y/he8RgCzGAiAj0XyT0KEdSdGrn3g02ZlTCxZFXYKNnu8JkLLXYEByrA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi/QjcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFrA//Sv1dhU42F+IAi+DIJakxIkVrY0LQ02JdsGw4O8+YqlzAg0DS\r\niq6qk4UQP/H44MIuAuM4neQ7wUXN4m2Lx/UtkDOniRDzUfzSGPAHBkdETg1r\r\nF6VtugqGctHTD4msPhxWOgYjAv+SBPqMJni3mCfsV1IRBM4RBfe7Z5bej09K\r\ntPZmmvAbWs40IaE0aDxkzMHSV/FmedKbzS5LjQgzU3f5u2ddOo9IV8Vqq8Rg\r\ndVx6pE4f8OjM1ZVJUUoJFHB4WkSGIiW57vpPWoooagWwC34lwJ5KFBTySNWr\r\naBneGpuFfkopQkLQLlLBlpW8/V/BukTxiOeObD9sxnE5G3u6lgHU1N9w9nTQ\r\nyIXCr5TwvgpJW/EtXiuoQhYd9GniIHwru1O77QUqyb3eA6LqETosjquusSzb\r\npmBtX0hFIuFM4FeQYtG1UacbBY54BpEPk9W+Dh4z3lXi3BQc2jV79Pt74rOY\r\nh7a+Wj/IwkSJumKHTOmaXJ/fkGYGvqQQ9FlIKVCvimJ0BBAU9EkIkzfFYt40\r\nKkZaBzB2IZMsRhqCFo85f9jcn4B6SCSKRVc91XLVnAKlvdknZovoa/R9SN55\r\ntvDexT7vVVAi3RgdI6LY4wufbd6IS/NuZxiBqvmk3Okr7bhRJaHYASzrMqGU\r\n6C6gmqeXpbnkNY3KmG3o0BIcpfekZvzltI4=\r\n=q5ID\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.0.0-next.2_1660750043919_0.4937958666255795"},"_hasShrinkwrap":false},"3.0.0":{"name":"@swivel-finance/swivel-js","version":"3.0.0","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"a47166a401f29c78e9f33f5817ab6223f11966ff","_id":"@swivel-finance/swivel-js@3.0.0","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-DcwNtAn688LbF0TbmMBposI2FJpXdgilSdq6RxQDEX8XsXLGRGnnvaJVQ66a/D0ZC62QN6PooQMwyzs2lrCing==","shasum":"d48e9dbddef2e25fbd6f6d35e87d11bca905428e","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.0.0.tgz","fileCount":298,"unpackedSize":503482,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB9UtkwvOchuSs+KQmhb9xCgZVGZdCGDBxsNmHTI5EcjAiBvYkAwK1Y2TiLmq+yTouU96oM2XsMFMpef9j00Ad0+ig=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjMz4DACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr37hAApDvNDrbKZa3GXmm02/o2iVTLSB23v+Kb81P4zDMHchHT8iI/\r\n/izcxa64XVQm5XWCQw1r2e8Go7zGwgxqUDnUpV11uqMcx79XrzRar2/NPgpt\r\n0w+KyY6sVUQwVPjqeTiRU2SYf4mE31/KJQrkxP416Daol57YXTNTN5doE/8S\r\nz5fg+vBOsvvN/1NOnEbDCgkT3gJ4ssFMWDiS86/HjPdo4J2Q2bSMQFO91xtr\r\nvnEUG7v74gP3c8uMQMGsfGpVcjAEzUwRe54t5WVC8om4kROX4edPog7aG/4l\r\ncXOIoSkQ02rECCdhwY1pDNIzjqkOgSQO1Mk9oHhmMiiKcsIrWGBmJiocO9FP\r\no6dO+cfvBjF1USBXhrYUa9CkLZS+m7PXaDOer41TludXJeO2O5l+qPRPqGmQ\r\nyEzSFjFpsz4DEOozRNTzK6DzI5Um+uf0Z55rNySHqojAZ35bgeiKSlt/CRcK\r\ne0YTRHAFLvEs+pw7YcfxHjHgcoo76dT+hTbleApFZldSrx0CgQS+2kIuGi0j\r\nJPJhutCvPbM4CD8v/Tbgv3iHhf92C9xWHealvAmLmdfGryDIr/NSuZuekIVw\r\n/zAT69SY8lIV3UQD9h4UOCq3KVnuiqLfPpoLUeMQCzlI/Oje4os0NUAIyfRi\r\nqFDwAl15zJMj1S7D6Eb7Qjtc3nf2pqCyqW4=\r\n=PoFm\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.0.0_1664302595230_0.9033765778298308"},"_hasShrinkwrap":false},"3.0.1":{"name":"@swivel-finance/swivel-js","version":"3.0.1","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"99dd36df6f98ebbdb52fed8193776c369e7bb14d","_id":"@swivel-finance/swivel-js@3.0.1","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-hWYIXIovUB3UTMg0Wm4HcfbrZlg3nrZVcUhIlW7cxUc8qE07lfnJ/Os4T8ofjzb9r7h6tfDcFEXMEl9ydWOOtQ==","shasum":"200d89178df2190d67bed2305cf06729ff84add2","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.0.1.tgz","fileCount":298,"unpackedSize":503503,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEISrQTzO0He4FM56CKQ8DpnrFNsTmJzAa/2cHHeVahKAiBdbzxmXlhrrkwIfMFbIU0MRItgKTG97cThOpgb8BcOvA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjM2WXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrMzg//cesA6q8hhdDw3FJ1YVZIcVncLoY/xvjxIj5G7duofabiAXSu\r\nB/W0XcgUHdz1fCM1Q83moswEImOXC9AsShs9GFb8KhNdD9xwbSHzIUK62K5C\r\nZLClkxWkuRiz0r/hiN9gcHwCE8nIzzRWIDR5Y1uUZj0Am5LgFOvauwqIeHg+\r\nNBNv/g/tN95ejRrF0d8DTGr3Iy67ZbF2edeQaxCqp4KjxL+pX5dn7row7+SP\r\nS0ZDABwu4qTm3YXvg5Cb4SfuYYxbh42sQHyRSIiO0mIcH7qwrfqqCly5Piom\r\nz2qx+nUqSODqzN75J4I7N6iBGGvpJNjWvmjxRlDWHRx1AXCaSVf7AJN08Svl\r\nauMc1q85W08XlCL6F9DEX3y3tzmCf6oSrEPUIf2+aJXMKuBm7pN3BpjgCjL/\r\nnB7XUDuX4yUX+Py/rDnjyvjq48wSwc0ZAKfKNFXFJKJBpIbfwCo4wUe/5U5t\r\no2sB27eKA9F0RODznP9+lxcJAwt33VqUioswhCwDRzXle6j0sSjleTJlQ0AB\r\nVYDkfqKbnGvxujBdrFQOeKrgSLqqjD9yFEbUkiIwdRQsCmLc0T06CX3GSzoO\r\nmSqXBPnDEne63KpZUp/WZz2EEEK907QGPTPSnL2fMzBIb0d0Fq/D7zKuH/vr\r\nW0/udW33B2T+p2AgvZJbQnwihjtvpixau7k=\r\n=G6ai\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.0.1_1664312727432_0.4581681840077403"},"_hasShrinkwrap":false},"3.0.2":{"name":"@swivel-finance/swivel-js","version":"3.0.2","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"3e9f5433070694a9df43d23fe4e81ff936f35e66","_id":"@swivel-finance/swivel-js@3.0.2","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-m8YwocUPpBJgaaKIdxc6xdDLyQWl68qlaOCN3O2gxT5Pa2ouEuawDOKzqq2AZYsIXrNCGJCTKkr9+tFYNv+2eA==","shasum":"91269b1004c1509461ad6f6220274a302c49a97b","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.0.2.tgz","fileCount":298,"unpackedSize":505718,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbCmTtDKix+sg2mCSuMrIlYZjM/brr1ok9SYvtzPMrSQIgMTG3goCjCM18/onur03iekVsAtOgzqlHMDL0j6mGXDM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNIjxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq3Sg//VarLI0b785NBzdUxx34yp8kLeJ8d+hdnRESPvKaff6Z6gqLG\r\nJMGsshEX2R+MRRf1N5M+iqidCkJIQFkM/N0oxgCUb4oxT2mR9h3Bc7THrIr3\r\nBag5PCHOewC6nL4XfMteC6dKUy/JqpF7wxknTR1pHEdDp9xm+F/5yoPNUSgU\r\nAZ82mUrdWJPDHk0xVht6fsn1+qblD9K+9BYnsZQplCy6jKYTLEAMnQiqUgzN\r\nNEudZl9o9pH/siqYOwcDdMeAX+bJqLIXSAhnUsh0EmLuu+Sv7O3A/AibQOGt\r\nslIfyPc4dnLydXVuhcg343FG5MHxxLeyXGKC1qRRiJEuDOn0QUuUeFQ64krI\r\nlBJLTE6wzZEUehp0msmJis3XaQpF7chXXvCbstPNkMzWmRsOGKG2owjWs4Gp\r\nd72TfO1mhe4rjrtOS8HSQcZg8nZA8Lo/1VMmA3ov0fGYBjR9z4L995G8meWk\r\n/QD+Lr1crs3re1wLKzOv+mpJJYLWup0ot8lU/Hz4XUL5yS9Ah0cng525f1Y3\r\n5rXikwg7O1DvgUug/oOHiJ4h1G/Co98aCBPwgUtkvg0h6jBtOwnPgubfGX6P\r\nyVM8bHGeTX4zOliIyaha2J/0m9/MdGAxL9RmvC4i3Jt6F/tB1PGGcEMjY9iR\r\n2LFaWuezgN9Tb0fOY4EehRlMv3nfhnAgYhE=\r\n=Pf/d\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.0.2_1664387313142_0.48042468637566604"},"_hasShrinkwrap":false},"3.1.0":{"name":"@swivel-finance/swivel-js","version":"3.1.0","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"a1f6989c8e88b71530796aed72e115350f2b4322","_id":"@swivel-finance/swivel-js@3.1.0","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-krrc0DIC+tlQcNokqWCoSWbO9a4u7TywZyK6+s+pe0BW9xO03PNOAammh2sQmjRcMwH6UZU60Qc1qRiUssrRFQ==","shasum":"88cd4890d7bbeae88c1e5358f781a9fc5966291d","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.1.0.tgz","fileCount":318,"unpackedSize":521681,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDn4WHv1vHCf0q3JzzUzzfXJaZ/n7Dg13VxZwaxY8/pCwIhAJxG5g8dmK0TaonXwHdZVBK+tpRwk7tzZSEukdqgOZh7"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNhg5ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoYWw/9Ef+2jRWQsSY3+xNkzaceVSyJQCVMt+VgzazEekg9dkmsMYsC\r\nBDS2zmCLyxMQ9gIICqEct57qkP86pgkxC5H2p65Y1o9MPGKn/KkkAJrctHsV\r\n6VOgd00NuBp0c0uda2+oCooZy58LjgjHHpN/RGtwyG/IAmaeqS9c11oWaFKO\r\nrIkTpU6VaQDUcZOPfZ+QUk4Wa1Sng5w0TzXpmfuED6yp4lksNi0elM5zdGnQ\r\naOXD/ZAHbng5ypB5W3+Rmqh8g1cJkXNyV2DrV1KQ/XG1fV7FTWl7b3cvGQI+\r\n6rhFRqgw+t+wp4g7vOW4Sa2AIXrxHVHgMwq1Jr3DisLxFiF9byb/zpRGFRpC\r\nHzP4yvTf2kcIugAbc1jgQmywPlopwbqHhK2nbw1FdQ+ZlKnTAvWuAQIJA1Ks\r\nDkPOjNt9MjB9TuuPXnXe1IrMJ9ICxrBAL1Kq6IqFYAway6DEVmOi3PELv1/3\r\nYV2u9b3m/qd1RIfXmg0AHX+POvWhDJWd28kvTPsePh85a+COsgt3kyI+7YyX\r\nzmByREOPqtRQ1O2AhuGcGJfTE2s36fZbwa/TEjBRlvzbLH3IxTU4A3lMpvvp\r\niULqmLy9m/jmZSSa1ywhrFiolmf8FqHAyN/UbxrdY7ypBw3nBbLz1OsFvmUI\r\n5O2paG56V6CD4iC07B5sReVzo1AtSKPA5rI=\r\n=BFsJ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.1.0_1664489529519_0.016859787432663476"},"_hasShrinkwrap":false},"3.1.1":{"name":"@swivel-finance/swivel-js","version":"3.1.1","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"38c9d26b0466145a9c3e5bfe4e0c5dc6ce943b9f","_id":"@swivel-finance/swivel-js@3.1.1","_nodeVersion":"16.17.0","_npmVersion":"8.15.0","dist":{"integrity":"sha512-SeniZ9RGXohg/EjZ4WTRD4MxHk96L4VEGY6or1zvHwvqQj2G5Q8Ku6c4AoGrahOUOCTabx++kCa29683XdDfpQ==","shasum":"bb40b434975aee2983bbd429589010b726cd5a29","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.1.1.tgz","fileCount":318,"unpackedSize":523802,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICK5CvGGwMhSfgDSoJr0EL87khm8HhE0UHLxuVk0ZWyQAiAG2JrWyZk9a7gXo3t+r3RiZkMth1JiqttWPQh7zInKHw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjOzbkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqdiQ//QFX8bTf9IViMuyywXAPvwC3irGyN+1vS7+Jy9caiyAWP69js\r\nc34MBanCuL5KLk3TLVfjhqyaR7N73+8LkDfoesTumkwGb4rOrq9IcBUbsYGZ\r\nKzimu/rAX+UM/+jDpbW71TPjLt4oD86YWrEj/nXTI4wTcN+iUvYVGuxXrGng\r\nTQYdc+5sjzt1zNjTlPbzokq+pl9nKwsKUhApWHnUpuqg+2ltsMhvavBYgEtC\r\nxTuKNgQUpAvggmuM9xIKkjzmmN4lmSFeIRrACrpTFajtDJb89/F/OKZ+KpC9\r\n22BygZZIX9a1mqV1D7OCZghpkp59iQpoaf2TwLcOvDnIZFSb0B8QTtrHCikU\r\nrMxtzXP9H8y7Imjq14Wvr9nS0TgA+VVX/73wlCSIz8ZseYXtOgZVWLjE3mdF\r\nOzbmFzjPQnzUIReVSbybcaqKfm/GJ6qzmrwUXbwK9O3dLmWLGtmIokxXozbr\r\noOP5wrnTaGsQr6PbN1dvqEGEQ3jKUk3M0WoRVA4ZAgeeuJNiagYj4X0gWpWn\r\nbaal4ohiXp3TFJ1oKfKdSgqU320+gBRrM+uDI6eGHIxHRKQmp7Wi6VaJ6392\r\neMsxAYdogl+3hT6KrmKLOK4Alr/6SeMQ6kwCA3E9Rf7JV9HK2zA2VZtO0NeX\r\nr13v3pBEsc8AmLgyYz7yDDoOKCplJgB7Z5Y=\r\n=3tZW\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.1.1_1664825060558_0.37465613624635674"},"_hasShrinkwrap":false},"3.2.0":{"name":"@swivel-finance/swivel-js","version":"3.2.0","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"db9aef2a5df418a797e67a57b73c00cd257e71ac","_id":"@swivel-finance/swivel-js@3.2.0","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-+7UIFFcfch+WRxeX4uZw//HgZubV1Tf2a9XH7H1vd/MES14dozKCceDSwUMMCN7tedo/qE8U+jft72wVL2JNsg==","shasum":"ffa48c14bfb6fb6eeb3803e75714e737f9cfaa43","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.2.0.tgz","fileCount":338,"unpackedSize":533001,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEAB5iTegFlnvlExqUMyMFQTzFGvJGZRV7C+QwPA/C/iAiEAnwRL9s3yxOYshIWuTvRXOlUwhjxtiyfkxw76zYiDtr8="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkLsHsACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpplg/9HGL4NSGsmfXayzivwRno8+Uc0Qt201SbBdPP67vLM13TKbfu\r\ny/ArCRNUzJqus9PTtNbh3u2pVZRkdtoJRXBpt3bnb3K3Y6H9UX1botk8Oy11\r\nNuS+CRLOq2ba5oUpxvnB9oCLKUn+M9bgnR/mO2biOVruZjjDYRhP//kOszZ1\r\nKrs/IqRa+FN9xyELiYAKD8tabsyZigc+3p5WVmBhvCpWlBMHEZeKBJn+Q9tY\r\n02R19gDKmBuAYCfratiD+inVXjOji8/zdECEQIx278SJgpbXaX7FT62rcEI9\r\nFlTKgLtjPvW9MoA+O6MnEi3ENQZHugKuokwStCyn4XR7z84gLuh+oOWd0WPk\r\n3/zqxMWPXqzpTBM7SvnVrI/2eNSbTtkX087Vaj3AAFNwAlDgMdvjkLo1kHRT\r\nzmfbNS6TtdlEndS/qS6XVoScvc97N8LYUFmlcGBDO6EY3XLD0cgA2j9S1mFg\r\n7JtCV0qYBTS2O917IBgjXHoel1pxq+3kzKcLcdEWzQIBZeAJze51Yf8aJa5Q\r\nSx+mF+LCS8F/Ro0ZHdvTF43FXs0OW1PpCRbLfXCoQYxF5l9zHCIHDWvKXu0S\r\nfaTrsCtjVzodFjuaSW+6iKlZ/smAYyx4KrlXEnIIX3DA7eA+05a9TuOXIY18\r\nfs4trbuNo6EvxfyqR88xPqICpuTN/mlHeRU=\r\n=Zfh3\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.2.0_1680785900672_0.2593561833503457"},"_hasShrinkwrap":false},"3.2.1":{"name":"@swivel-finance/swivel-js","version":"3.2.1","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"da98d76c0f200fc14bdfa737b3253f3a2dbfd22b","_id":"@swivel-finance/swivel-js@3.2.1","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-anFaS/DltM4QGadLilIeCW+vBOo+H+pn0e3xUUNOLKSUo2O6cLtjcrXw6ftPua2QGjdez8LoiSxcdHtegzkfCQ==","shasum":"5f6e43995ea4ae86f87e4737cf1ee96a8c2d9d01","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.2.1.tgz","fileCount":338,"unpackedSize":533023,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID86qqOkP/h02FSOexiOLbWi0oa5LBgzARv9+dmpgmFUAiAQpOh14X7f5oVDIxJrRkdkfm8rLtxTFDTUS4loudchvg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkLvB8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqt/w//cy+WXgzImm1EzHxuBdEcLTQlf2z86IMH/1y9Fo9jsW6GgIaW\r\ndGPU+iohoJAn4gLl45liLMTXwuxG7eW/vwXde9faN9NRKksX8ej2REGHwLpv\r\nxS+EUzuw+bbFemM5vZfiwyVy0L62PLgawb+MV453NapyTRvlq9xHZeKjA0DI\r\n8E4bQ10YNnU0YIi81Utps8TRTuyZ02ucewFd+fulkTxCz9GIz5qqpGNLd5m4\r\nS/DeCoSH/+fJj2J4xfhX9cIaR3UEFx2t2MKDwer+gz2kYrxaDtm2gvb7kOLN\r\nXwX3jpp3HQcKw28cyVuPItbZaQrsQ2LO6MgDm4e19CQ+Zx89yxzLx4JRPMrX\r\n3YcNGGslosSAZSL919JUGSyS9yrM2cqL8JYlAy83PHJp6xyB7f6Et4D5YGBh\r\n7YJZCB3QYBQg4Y2ZXF6FdD69LUOb7fgPjyY4jfPG/2XxsX2c3MgR9zUro9n5\r\nhflVm+IKn47hbZdLw+Y7QnAZQw2XbnQ5sSNNvQF9pAhhS+AfXQHZv3sux4tW\r\nrKuQNnYi+0REHafUeFM33QyS9FQjQ2AupoZZJ+ZEVBuAt/Vygmr8fJS7VG0e\r\n9pwIfzM4BBqbt5uvsRV0n/XtsVlOGP2tIdJyz64o6R4ByPXterl7BUaSKJGq\r\n63T+fLcLXPSuTaUqJTuW+jg9LZeKCcz6tI4=\r\n=fxug\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.2.1_1680797820323_0.7055675013393896"},"_hasShrinkwrap":false},"4.0.0-next.0":{"name":"@swivel-finance/swivel-js","version":"4.0.0-next.0","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v4 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers\n\nIn order use `swivel-js` you'll need a compatible version (`^5.2.0`) of `ethers`. Being a peer dependency, you can use any compatible version of `ethers` you already have installed in your project. \n\nIf you haven't installed a compatible version of `ethers` in your project yet, run:\n\n```bash\nnpm install --save ethers\n```\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Protocols\n\nSwivel supports 7 different interest-generating protocols and each market on Swivel is tied to a specific protocol. You can select a Protocol using the `Protocols` enum:\n\n```typescript\nimport { Protocols } from '@swivel-finance/swivel-js';\n\nconst protocol = Protocols.Compound;\n```\n\nor you can use the Protocol's numeric value:\n\n```typescript\n/**\n * The Protocol's numeric values\n * \n * Frax     = 0\n * Compound = 1\n * Rari     = 2\n * Yearn    = 3\n * Aave     = 4\n * Euler    = 5\n * Lido     = 6\n */ \n \nconst protocol = 4; // Aave\n```\n\n### Swivel\n\n#### Create a Swivel instance\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n```\n\n#### Sign an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers, utils } from 'ethers';\n\n// you need the chain id of the network you want to use\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// the order maker is your account address\nconst maker = await signer.getAddress();\n// the order key should be a hash of your account address and a timestamp\nconst key = utils.keccak256(utils.toUtf8Bytes(`${ maker }${ Date.now() }`));\n// you will also need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// create an order\nconst order: Order = {\n    key: key,\n    maker: maker,\n    underlying: underlying,\n    maturity: maturity,\n    protocol: protocol,\n    vault: false,\n    exit: false,\n    principal: '10000000',\n    premium: '500000',\n    expiry: '1648177200',\n};\n\n// you can now sign the order using the Swivel class' static `signOrder` method\nconst signature = await Swivel.signOrder(order, signer, swivelAddress, chainId);\n```\n\n#### Fill an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need a subset of the ERC-20 ABI for token allowance and approval\nconst ERC_20_ABI = [\n    'function allowance(address owner, address spender) public view returns (uint256)',\n    'function approve(address spender, uint256 value) public returns (bool)',\n];\n\n/**\n * Fill an order.\n * \n * @param amount - the amount of volume to fill\n */\nexport async function marketOrderFixed (amount: number): Promise<void> {\n\n    // convert the amount to a BigNumber with the appropriate amount of decimals (e.g. 18 for DAI)\n    const fillAmount = ethers.utils.parseUnits(amount.toString(), 18);\n\n    // create an ethers provider and signer\n    const provider = new ethers.providers.Web3Provider(window.ethereum);\n    const signer = provider.getSigner();\n\n    // constants for Swivel on rinkeby (this might be outdated)\n    const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n    const underlyingAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n\n    // create the Swivel contract\n    const swivel = new Swivel(swivelAddress, signer);\n\n    // to fill an order with Swivel, we need to approve Swivel to transfer our tokens\n    // in order to do this, we need to:\n    //   1. create an ERC20 contract instance\n    //   2. check if the Swivel contract has sufficient allowance for the fill amount\n    //   3. approve the Swivel contract for at least the fill amount\n\n    // create the ERC-20 token contract for the underlying (e.g. DAI)\n    const token = new ethers.Contract(underlyingAddress, ERC_20_ABI, provider);\n\n    // check approval\n    const approvalAmount = await token.allowance(window.ethereum.selectedAddress, swivelAddress) as ethers.BigNumber;\n\n    // if not approved approve max uint\n    // (this frees you from having to approve each single fill)\n    if (approvalAmount.lt(fillAmount)) {\n\n        const approve = await token.approve(swivelAddress, ethers.constants.MaxUint256) as ethers.providers.TransactionResponse;\n        await approve.wait();\n    }\n\n    // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby\n    // in a real-world scenario you would fetch orders from the Preview Market Order API call\n    const order = {\n        key: '0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb',\n        maker: '0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C',\n        underlying: '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa',\n        vault: true,\n        exit: false,\n        principal: '40000000000000000000000',\n        premium: '2000000000000000000000',\n        maturity: '1662089767',\n        expiry: '1633324220',\n    };\n    const signature = '0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c';\n\n    // fill the hardcoded order by initiating your position\n    // each parameter is an array, as multiple orders can be filled at once\n    const tx = await swivel.initiate([order], [fillAmount.toString()], [signature]) as ethers.providers.TransactionResponse;\n    \n    // wait for the transaction to confirm\n    const receipt = await tx.wait();\n\n    console.log(receipt);\n}\n```\n\n### MarketPlace\n\n#### Create a MarketPlace instance\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n```\n\n#### Get the interest rate (supply APY) of a market\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n\n// you'll need to know the market's protocol (Compound in this example),\nconst protocol = Protocols.Compound;\n// ...underlying (USDC in this example),\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'\n// ... and maturity (30/9/2022 in this example)\nconst maturity = 1664550000;\n\n// get the market info for a specific market\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n\n// get the market's interest rate (supply APY)\nconst interestRate = await marketPlace.interestRate(protocol, market.cTokenAddr);\n```\n\n### VaultTracker\n\n```typescript\nimport { Protocols, VaultTracker } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to create a VaultTracker instance you'll need the address of its\n// deployed contract - each market has it's own VaultTracker contract\n// you can retrieve the address of a VaultTracker by calling the \n// `markets` method of the MarketPlace contract\n\n// you will need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// assuming you already created a MarketPlace instance, \n// retrieve the desired market information...\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n// ...and extract the `vaultTracker` of the market\nconst vaultAddress = market.vaultTracker;\n\n// use the `signer` and `vaultAdrress` to instantiate the VaultTracker\nconst vaultTracker = new VaultTracker(vaultAddress, signer);\n```\n\n### Error Handling\n\nThe Swivel protocol uses [solidity custom errors](https://blog.soliditylang.org/2021/04/21/custom-errors/) throughout to provide additional error context to consumers through error parameters. Swivel relies on a single custom error interface to do so:\n\n```solidity\nerror Exception(uint8 code, uint256 amountReceived, uint256 amountExpected, address addressReceived, address addressExpected);\n```\n\nEach error has a unique `code` and, depending on the `code`, the `amount` and `address` parameters will be set to provide relevant context to the error instance.\n\n`swivel-js` provides helpers to easily extract custom error data from failed transactions, as well as a mapping of `Exception` codes to human-readable error names and fully formatted error messages. The easiest way to handle custom errors using `swivel-js` is by using the `parseSwivelError` method:\n\n```typescript\nimport { parseSwivelError, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n\n// assume you have an order and its signature...\nconst order = {...};\nconst signature = '...';\n\n// ...and you'd like to fill the order with 100 underlying\nconst amount = ethers.utils.parseUnits('100', 18);\n\n// use a try/catch block around your transaction\ntry {\n\n    const tx = await swivel.initiate([order], [amount], [signature]);\n\n    const receipt = await tx.wait();\n\n} catch (error) {\n\n    // if the transaction fails, you will receive an ethers error which\n    // will usually be a `CALL_EXCEPTION` or `UNPREDICTABLE_GAS_LIMIT`\n    \n    // regardless of the ethers error, you can pass it to the \n    // `parseSwivelError` method, which will extract the custom error\n    // data (if it is available) and create a `SwivelError` instance,\n    // populating it with a human-readable error name and formatted error message\n    // if the ethers error does not contain any custom error data,\n    // `parseSwivelError` will return `undefined`\n    const swivelError = parseSwivelError(error);\n\n    if (swivelError) {\n\n        // you can notify users with a useful error message\n        alert(swivelError.message);\n    \n    } else {\n\n        // something else went wrong, you'll need to handle the ethers error\n    }\n}\n```\n\n## Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n## Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md","gitHead":"ace5f4b63b3fb7a4909f74f7fc84b90b38d9afe4","_id":"@swivel-finance/swivel-js@4.0.0-next.0","_nodeVersion":"18.15.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-6hRljAZ/2/l3kVmuK5UA1VJukeCiZsuNzChMKFkp3meR5+TeK8g37rRQY6BdCXzxtcC0qT1hU8PV8Hh15YNkng==","shasum":"b6d12c087692d635471fcabcc2a5495f8e5f2b97","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-4.0.0-next.0.tgz","fileCount":338,"unpackedSize":533882,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCrX53N8F0NefXLDo0fNOP+SmREYKWFFmvldTrH0JQ96AIhANS9QmllXyk3qzTKwk5YStqdvCgjCRSWMg/9iStlU/u/"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_4.0.0-next.0_1692024757949_0.510183346618349"},"_hasShrinkwrap":false},"4.0.0-next.1":{"name":"@swivel-finance/swivel-js","version":"4.0.0-next.1","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v4 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers\n\nIn order use `swivel-js` you'll need a compatible version (`^5.2.0`) of `ethers`. Being a peer dependency, you can use any compatible version of `ethers` you already have installed in your project. \n\nIf you haven't installed a compatible version of `ethers` in your project yet, run:\n\n```bash\nnpm install --save ethers\n```\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Protocols\n\nSwivel supports 7 different interest-generating protocols and each market on Swivel is tied to a specific protocol. You can select a Protocol using the `Protocols` enum:\n\n```typescript\nimport { Protocols } from '@swivel-finance/swivel-js';\n\nconst protocol = Protocols.Compound;\n```\n\nor you can use the Protocol's numeric value:\n\n```typescript\n/**\n * The Protocol's numeric values\n * \n * Frax     = 0\n * Compound = 1\n * Rari     = 2\n * Yearn    = 3\n * Aave     = 4\n * Euler    = 5\n * Lido     = 6\n */ \n \nconst protocol = 4; // Aave\n```\n\n### Swivel\n\n#### Create a Swivel instance\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n```\n\n#### Sign an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers, utils } from 'ethers';\n\n// you need the chain id of the network you want to use\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// the order maker is your account address\nconst maker = await signer.getAddress();\n// the order key should be a hash of your account address and a timestamp\nconst key = utils.keccak256(utils.toUtf8Bytes(`${ maker }${ Date.now() }`));\n// you will also need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// create an order\nconst order: Order = {\n    key: key,\n    maker: maker,\n    underlying: underlying,\n    maturity: maturity,\n    protocol: protocol,\n    vault: false,\n    exit: false,\n    principal: '10000000',\n    premium: '500000',\n    expiry: '1648177200',\n};\n\n// you can now sign the order using the Swivel class' static `signOrder` method\nconst signature = await Swivel.signOrder(order, signer, swivelAddress, chainId);\n```\n\n#### Fill an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need a subset of the ERC-20 ABI for token allowance and approval\nconst ERC_20_ABI = [\n    'function allowance(address owner, address spender) public view returns (uint256)',\n    'function approve(address spender, uint256 value) public returns (bool)',\n];\n\n/**\n * Fill an order.\n * \n * @param amount - the amount of volume to fill\n */\nexport async function marketOrderFixed (amount: number): Promise<void> {\n\n    // convert the amount to a BigNumber with the appropriate amount of decimals (e.g. 18 for DAI)\n    const fillAmount = ethers.utils.parseUnits(amount.toString(), 18);\n\n    // create an ethers provider and signer\n    const provider = new ethers.providers.Web3Provider(window.ethereum);\n    const signer = provider.getSigner();\n\n    // constants for Swivel on rinkeby (this might be outdated)\n    const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n    const underlyingAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n\n    // create the Swivel contract\n    const swivel = new Swivel(swivelAddress, signer);\n\n    // to fill an order with Swivel, we need to approve Swivel to transfer our tokens\n    // in order to do this, we need to:\n    //   1. create an ERC20 contract instance\n    //   2. check if the Swivel contract has sufficient allowance for the fill amount\n    //   3. approve the Swivel contract for at least the fill amount\n\n    // create the ERC-20 token contract for the underlying (e.g. DAI)\n    const token = new ethers.Contract(underlyingAddress, ERC_20_ABI, provider);\n\n    // check approval\n    const approvalAmount = await token.allowance(window.ethereum.selectedAddress, swivelAddress) as ethers.BigNumber;\n\n    // if not approved approve max uint\n    // (this frees you from having to approve each single fill)\n    if (approvalAmount.lt(fillAmount)) {\n\n        const approve = await token.approve(swivelAddress, ethers.constants.MaxUint256) as ethers.providers.TransactionResponse;\n        await approve.wait();\n    }\n\n    // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby\n    // in a real-world scenario you would fetch orders from the Preview Market Order API call\n    const order = {\n        key: '0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb',\n        maker: '0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C',\n        underlying: '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa',\n        vault: true,\n        exit: false,\n        principal: '40000000000000000000000',\n        premium: '2000000000000000000000',\n        maturity: '1662089767',\n        expiry: '1633324220',\n    };\n    const signature = '0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c';\n\n    // fill the hardcoded order by initiating your position\n    // each parameter is an array, as multiple orders can be filled at once\n    const tx = await swivel.initiate([order], [fillAmount.toString()], [signature]) as ethers.providers.TransactionResponse;\n    \n    // wait for the transaction to confirm\n    const receipt = await tx.wait();\n\n    console.log(receipt);\n}\n```\n\n### MarketPlace\n\n#### Create a MarketPlace instance\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n```\n\n#### Get the interest rate (supply APY) of a market\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n\n// you'll need to know the market's protocol (Compound in this example),\nconst protocol = Protocols.Compound;\n// ...underlying (USDC in this example),\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'\n// ... and maturity (30/9/2022 in this example)\nconst maturity = 1664550000;\n\n// get the market info for a specific market\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n\n// get the market's interest rate (supply APY)\nconst interestRate = await marketPlace.interestRate(protocol, market.cTokenAddr);\n```\n\n### VaultTracker\n\n```typescript\nimport { Protocols, VaultTracker } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to create a VaultTracker instance you'll need the address of its\n// deployed contract - each market has it's own VaultTracker contract\n// you can retrieve the address of a VaultTracker by calling the \n// `markets` method of the MarketPlace contract\n\n// you will need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// assuming you already created a MarketPlace instance, \n// retrieve the desired market information...\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n// ...and extract the `vaultTracker` of the market\nconst vaultAddress = market.vaultTracker;\n\n// use the `signer` and `vaultAdrress` to instantiate the VaultTracker\nconst vaultTracker = new VaultTracker(vaultAddress, signer);\n```\n\n### Error Handling\n\nThe Swivel protocol uses [solidity custom errors](https://blog.soliditylang.org/2021/04/21/custom-errors/) throughout to provide additional error context to consumers through error parameters. Swivel relies on a single custom error interface to do so:\n\n```solidity\nerror Exception(uint8 code, uint256 amountReceived, uint256 amountExpected, address addressReceived, address addressExpected);\n```\n\nEach error has a unique `code` and, depending on the `code`, the `amount` and `address` parameters will be set to provide relevant context to the error instance.\n\n`swivel-js` provides helpers to easily extract custom error data from failed transactions, as well as a mapping of `Exception` codes to human-readable error names and fully formatted error messages. The easiest way to handle custom errors using `swivel-js` is by using the `parseSwivelError` method:\n\n```typescript\nimport { parseSwivelError, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n\n// assume you have an order and its signature...\nconst order = {...};\nconst signature = '...';\n\n// ...and you'd like to fill the order with 100 underlying\nconst amount = ethers.utils.parseUnits('100', 18);\n\n// use a try/catch block around your transaction\ntry {\n\n    const tx = await swivel.initiate([order], [amount], [signature]);\n\n    const receipt = await tx.wait();\n\n} catch (error) {\n\n    // if the transaction fails, you will receive an ethers error which\n    // will usually be a `CALL_EXCEPTION` or `UNPREDICTABLE_GAS_LIMIT`\n    \n    // regardless of the ethers error, you can pass it to the \n    // `parseSwivelError` method, which will extract the custom error\n    // data (if it is available) and create a `SwivelError` instance,\n    // populating it with a human-readable error name and formatted error message\n    // if the ethers error does not contain any custom error data,\n    // `parseSwivelError` will return `undefined`\n    const swivelError = parseSwivelError(error);\n\n    if (swivelError) {\n\n        // you can notify users with a useful error message\n        alert(swivelError.message);\n    \n    } else {\n\n        // something else went wrong, you'll need to handle the ethers error\n    }\n}\n```\n\n## Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n## Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md","gitHead":"678a0b62860003a207bdbcdf713fe13edfe86b97","_id":"@swivel-finance/swivel-js@4.0.0-next.1","_nodeVersion":"18.15.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-1FzyHOm6QzfceATSRAREAPyFtKaLsqwrOLS+MLF3zbX7IfeC/utEq62mQGQkU//RnvoePCoKVqSupjTP/MRC4w==","shasum":"fd310af5508d1bf79f154191da744b66d1ac2a3a","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-4.0.0-next.1.tgz","fileCount":383,"unpackedSize":726874,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDGv5JOZfpKHOni55t2cUE3xwLN4ER2Pyt3dzOj4trsgAIgcp+X4E+MVR5bjgBvtFQ7CG92BmUoR6LLuDO1VwXCJ6k="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_4.0.0-next.1_1695151728248_0.8609200930034286"},"_hasShrinkwrap":false},"4.0.0-next.2":{"name":"@swivel-finance/swivel-js","version":"4.0.0-next.2","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v4 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers\n\nIn order use `swivel-js` you'll need a compatible version (`^5.2.0`) of `ethers`. Being a peer dependency, you can use any compatible version of `ethers` you already have installed in your project. \n\nIf you haven't installed a compatible version of `ethers` in your project yet, run:\n\n```bash\nnpm install --save ethers\n```\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Protocols\n\nSwivel supports 7 different interest-generating protocols and each market on Swivel is tied to a specific protocol. You can select a Protocol using the `Protocols` enum:\n\n```typescript\nimport { Protocols } from '@swivel-finance/swivel-js';\n\nconst protocol = Protocols.Compound;\n```\n\nor you can use the Protocol's numeric value:\n\n```typescript\n/**\n * The Protocol's numeric values\n * \n * Frax     = 0\n * Compound = 1\n * Rari     = 2\n * Yearn    = 3\n * Aave     = 4\n * Euler    = 5\n * Lido     = 6\n */ \n \nconst protocol = 4; // Aave\n```\n\n### Swivel\n\n#### Create a Swivel instance\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n```\n\n#### Sign an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers, utils } from 'ethers';\n\n// you need the chain id of the network you want to use\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// the order maker is your account address\nconst maker = await signer.getAddress();\n// the order key should be a hash of your account address and a timestamp\nconst key = utils.keccak256(utils.toUtf8Bytes(`${ maker }${ Date.now() }`));\n// you will also need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// create an order\nconst order: Order = {\n    key: key,\n    maker: maker,\n    underlying: underlying,\n    maturity: maturity,\n    protocol: protocol,\n    vault: false,\n    exit: false,\n    principal: '10000000',\n    premium: '500000',\n    expiry: '1648177200',\n};\n\n// you can now sign the order using the Swivel class' static `signOrder` method\nconst signature = await Swivel.signOrder(order, signer, swivelAddress, chainId);\n```\n\n#### Fill an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need a subset of the ERC-20 ABI for token allowance and approval\nconst ERC_20_ABI = [\n    'function allowance(address owner, address spender) public view returns (uint256)',\n    'function approve(address spender, uint256 value) public returns (bool)',\n];\n\n/**\n * Fill an order.\n * \n * @param amount - the amount of volume to fill\n */\nexport async function marketOrderFixed (amount: number): Promise<void> {\n\n    // convert the amount to a BigNumber with the appropriate amount of decimals (e.g. 18 for DAI)\n    const fillAmount = ethers.utils.parseUnits(amount.toString(), 18);\n\n    // create an ethers provider and signer\n    const provider = new ethers.providers.Web3Provider(window.ethereum);\n    const signer = provider.getSigner();\n\n    // constants for Swivel on rinkeby (this might be outdated)\n    const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n    const underlyingAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n\n    // create the Swivel contract\n    const swivel = new Swivel(swivelAddress, signer);\n\n    // to fill an order with Swivel, we need to approve Swivel to transfer our tokens\n    // in order to do this, we need to:\n    //   1. create an ERC20 contract instance\n    //   2. check if the Swivel contract has sufficient allowance for the fill amount\n    //   3. approve the Swivel contract for at least the fill amount\n\n    // create the ERC-20 token contract for the underlying (e.g. DAI)\n    const token = new ethers.Contract(underlyingAddress, ERC_20_ABI, provider);\n\n    // check approval\n    const approvalAmount = await token.allowance(window.ethereum.selectedAddress, swivelAddress) as ethers.BigNumber;\n\n    // if not approved approve max uint\n    // (this frees you from having to approve each single fill)\n    if (approvalAmount.lt(fillAmount)) {\n\n        const approve = await token.approve(swivelAddress, ethers.constants.MaxUint256) as ethers.providers.TransactionResponse;\n        await approve.wait();\n    }\n\n    // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby\n    // in a real-world scenario you would fetch orders from the Preview Market Order API call\n    const order = {\n        key: '0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb',\n        maker: '0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C',\n        underlying: '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa',\n        vault: true,\n        exit: false,\n        principal: '40000000000000000000000',\n        premium: '2000000000000000000000',\n        maturity: '1662089767',\n        expiry: '1633324220',\n    };\n    const signature = '0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c';\n\n    // fill the hardcoded order by initiating your position\n    // each parameter is an array, as multiple orders can be filled at once\n    const tx = await swivel.initiate([order], [fillAmount.toString()], [signature]) as ethers.providers.TransactionResponse;\n    \n    // wait for the transaction to confirm\n    const receipt = await tx.wait();\n\n    console.log(receipt);\n}\n```\n\n### MarketPlace\n\n#### Create a MarketPlace instance\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n```\n\n#### Get the interest rate (supply APY) of a market\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n\n// you'll need to know the market's protocol (Compound in this example),\nconst protocol = Protocols.Compound;\n// ...underlying (USDC in this example),\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'\n// ... and maturity (30/9/2022 in this example)\nconst maturity = 1664550000;\n\n// get the market info for a specific market\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n\n// get the market's interest rate (supply APY)\nconst interestRate = await marketPlace.interestRate(protocol, market.cTokenAddr);\n```\n\n### VaultTracker\n\n```typescript\nimport { Protocols, VaultTracker } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to create a VaultTracker instance you'll need the address of its\n// deployed contract - each market has it's own VaultTracker contract\n// you can retrieve the address of a VaultTracker by calling the \n// `markets` method of the MarketPlace contract\n\n// you will need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// assuming you already created a MarketPlace instance, \n// retrieve the desired market information...\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n// ...and extract the `vaultTracker` of the market\nconst vaultAddress = market.vaultTracker;\n\n// use the `signer` and `vaultAdrress` to instantiate the VaultTracker\nconst vaultTracker = new VaultTracker(vaultAddress, signer);\n```\n\n### Error Handling\n\nThe Swivel protocol uses [solidity custom errors](https://blog.soliditylang.org/2021/04/21/custom-errors/) throughout to provide additional error context to consumers through error parameters. Swivel relies on a single custom error interface to do so:\n\n```solidity\nerror Exception(uint8 code, uint256 amountReceived, uint256 amountExpected, address addressReceived, address addressExpected);\n```\n\nEach error has a unique `code` and, depending on the `code`, the `amount` and `address` parameters will be set to provide relevant context to the error instance.\n\n`swivel-js` provides helpers to easily extract custom error data from failed transactions, as well as a mapping of `Exception` codes to human-readable error names and fully formatted error messages. The easiest way to handle custom errors using `swivel-js` is by using the `parseSwivelError` method:\n\n```typescript\nimport { parseSwivelError, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n\n// assume you have an order and its signature...\nconst order = {...};\nconst signature = '...';\n\n// ...and you'd like to fill the order with 100 underlying\nconst amount = ethers.utils.parseUnits('100', 18);\n\n// use a try/catch block around your transaction\ntry {\n\n    const tx = await swivel.initiate([order], [amount], [signature]);\n\n    const receipt = await tx.wait();\n\n} catch (error) {\n\n    // if the transaction fails, you will receive an ethers error which\n    // will usually be a `CALL_EXCEPTION` or `UNPREDICTABLE_GAS_LIMIT`\n    \n    // regardless of the ethers error, you can pass it to the \n    // `parseSwivelError` method, which will extract the custom error\n    // data (if it is available) and create a `SwivelError` instance,\n    // populating it with a human-readable error name and formatted error message\n    // if the ethers error does not contain any custom error data,\n    // `parseSwivelError` will return `undefined`\n    const swivelError = parseSwivelError(error);\n\n    if (swivelError) {\n\n        // you can notify users with a useful error message\n        alert(swivelError.message);\n    \n    } else {\n\n        // something else went wrong, you'll need to handle the ethers error\n    }\n}\n```\n\n## Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n## Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md","gitHead":"1f44a88ac4edfe45dc697d5c0990eabac910eb4a","_id":"@swivel-finance/swivel-js@4.0.0-next.2","_nodeVersion":"18.15.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-05ToS3QrUH82SWjGFLmw2dZ/bp1VB5sOKDJF6VnIPzjL9yUd9AEwjw0W8URuT1TAgSKFR/8L4SzsU0y1U1lezA==","shasum":"38011fdb3ea3f0ad70b949c734286145aa116fe7","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-4.0.0-next.2.tgz","fileCount":338,"unpackedSize":534477,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfgKmmvLADnEQG+1mAOsAcNuBcZ+1ZcsTi8t8BbDbbCwIhAOrCONWlCFUnqZWAEUfNKXwbxfdZvRsRhbtJW/N9Hm9D"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_4.0.0-next.2_1695152663652_0.3400349743696922"},"_hasShrinkwrap":false},"4.0.0-next.3":{"name":"@swivel-finance/swivel-js","version":"4.0.0-next.3","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v4 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers\n\nIn order use `swivel-js` you'll need a compatible version (`^5.2.0`) of `ethers`. Being a peer dependency, you can use any compatible version of `ethers` you already have installed in your project. \n\nIf you haven't installed a compatible version of `ethers` in your project yet, run:\n\n```bash\nnpm install --save ethers\n```\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Protocols\n\nSwivel supports 7 different interest-generating protocols and each market on Swivel is tied to a specific protocol. You can select a Protocol using the `Protocols` enum:\n\n```typescript\nimport { Protocols } from '@swivel-finance/swivel-js';\n\nconst protocol = Protocols.Compound;\n```\n\nor you can use the Protocol's numeric value:\n\n```typescript\n/**\n * The Protocol's numeric values\n * \n * Frax     = 0\n * Compound = 1\n * Rari     = 2\n * Yearn    = 3\n * Aave     = 4\n * Euler    = 5\n * Lido     = 6\n */ \n \nconst protocol = 4; // Aave\n```\n\n### Swivel\n\n#### Create a Swivel instance\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n```\n\n#### Sign an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers, utils } from 'ethers';\n\n// you need the chain id of the network you want to use\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// the order maker is your account address\nconst maker = await signer.getAddress();\n// the order key should be a hash of your account address and a timestamp\nconst key = utils.keccak256(utils.toUtf8Bytes(`${ maker }${ Date.now() }`));\n// you will also need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// create an order\nconst order: Order = {\n    key: key,\n    maker: maker,\n    underlying: underlying,\n    maturity: maturity,\n    protocol: protocol,\n    vault: false,\n    exit: false,\n    principal: '10000000',\n    premium: '500000',\n    expiry: '1648177200',\n};\n\n// you can now sign the order using the Swivel class' static `signOrder` method\nconst signature = await Swivel.signOrder(order, signer, swivelAddress, chainId);\n```\n\n#### Fill an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need a subset of the ERC-20 ABI for token allowance and approval\nconst ERC_20_ABI = [\n    'function allowance(address owner, address spender) public view returns (uint256)',\n    'function approve(address spender, uint256 value) public returns (bool)',\n];\n\n/**\n * Fill an order.\n * \n * @param amount - the amount of volume to fill\n */\nexport async function marketOrderFixed (amount: number): Promise<void> {\n\n    // convert the amount to a BigNumber with the appropriate amount of decimals (e.g. 18 for DAI)\n    const fillAmount = ethers.utils.parseUnits(amount.toString(), 18);\n\n    // create an ethers provider and signer\n    const provider = new ethers.providers.Web3Provider(window.ethereum);\n    const signer = provider.getSigner();\n\n    // constants for Swivel on rinkeby (this might be outdated)\n    const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n    const underlyingAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n\n    // create the Swivel contract\n    const swivel = new Swivel(swivelAddress, signer);\n\n    // to fill an order with Swivel, we need to approve Swivel to transfer our tokens\n    // in order to do this, we need to:\n    //   1. create an ERC20 contract instance\n    //   2. check if the Swivel contract has sufficient allowance for the fill amount\n    //   3. approve the Swivel contract for at least the fill amount\n\n    // create the ERC-20 token contract for the underlying (e.g. DAI)\n    const token = new ethers.Contract(underlyingAddress, ERC_20_ABI, provider);\n\n    // check approval\n    const approvalAmount = await token.allowance(window.ethereum.selectedAddress, swivelAddress) as ethers.BigNumber;\n\n    // if not approved approve max uint\n    // (this frees you from having to approve each single fill)\n    if (approvalAmount.lt(fillAmount)) {\n\n        const approve = await token.approve(swivelAddress, ethers.constants.MaxUint256) as ethers.providers.TransactionResponse;\n        await approve.wait();\n    }\n\n    // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby\n    // in a real-world scenario you would fetch orders from the Preview Market Order API call\n    const order = {\n        key: '0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb',\n        maker: '0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C',\n        underlying: '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa',\n        vault: true,\n        exit: false,\n        principal: '40000000000000000000000',\n        premium: '2000000000000000000000',\n        maturity: '1662089767',\n        expiry: '1633324220',\n    };\n    const signature = '0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c';\n\n    // fill the hardcoded order by initiating your position\n    // each parameter is an array, as multiple orders can be filled at once\n    const tx = await swivel.initiate([order], [fillAmount.toString()], [signature]) as ethers.providers.TransactionResponse;\n    \n    // wait for the transaction to confirm\n    const receipt = await tx.wait();\n\n    console.log(receipt);\n}\n```\n\n### MarketPlace\n\n#### Create a MarketPlace instance\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n```\n\n#### Get the interest rate (supply APY) of a market\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n\n// you'll need to know the market's protocol (Compound in this example),\nconst protocol = Protocols.Compound;\n// ...underlying (USDC in this example),\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'\n// ... and maturity (30/9/2022 in this example)\nconst maturity = 1664550000;\n\n// get the market info for a specific market\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n\n// get the market's interest rate (supply APY)\nconst interestRate = await marketPlace.interestRate(protocol, market.cTokenAddr);\n```\n\n### VaultTracker\n\n```typescript\nimport { Protocols, VaultTracker } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to create a VaultTracker instance you'll need the address of its\n// deployed contract - each market has it's own VaultTracker contract\n// you can retrieve the address of a VaultTracker by calling the \n// `markets` method of the MarketPlace contract\n\n// you will need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// assuming you already created a MarketPlace instance, \n// retrieve the desired market information...\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n// ...and extract the `vaultTracker` of the market\nconst vaultAddress = market.vaultTracker;\n\n// use the `signer` and `vaultAdrress` to instantiate the VaultTracker\nconst vaultTracker = new VaultTracker(vaultAddress, signer);\n```\n\n### Error Handling\n\nThe Swivel protocol uses [solidity custom errors](https://blog.soliditylang.org/2021/04/21/custom-errors/) throughout to provide additional error context to consumers through error parameters. Swivel relies on a single custom error interface to do so:\n\n```solidity\nerror Exception(uint8 code, uint256 amountReceived, uint256 amountExpected, address addressReceived, address addressExpected);\n```\n\nEach error has a unique `code` and, depending on the `code`, the `amount` and `address` parameters will be set to provide relevant context to the error instance.\n\n`swivel-js` provides helpers to easily extract custom error data from failed transactions, as well as a mapping of `Exception` codes to human-readable error names and fully formatted error messages. The easiest way to handle custom errors using `swivel-js` is by using the `parseSwivelError` method:\n\n```typescript\nimport { parseSwivelError, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n\n// assume you have an order and its signature...\nconst order = {...};\nconst signature = '...';\n\n// ...and you'd like to fill the order with 100 underlying\nconst amount = ethers.utils.parseUnits('100', 18);\n\n// use a try/catch block around your transaction\ntry {\n\n    const tx = await swivel.initiate([order], [amount], [signature]);\n\n    const receipt = await tx.wait();\n\n} catch (error) {\n\n    // if the transaction fails, you will receive an ethers error which\n    // will usually be a `CALL_EXCEPTION` or `UNPREDICTABLE_GAS_LIMIT`\n    \n    // regardless of the ethers error, you can pass it to the \n    // `parseSwivelError` method, which will extract the custom error\n    // data (if it is available) and create a `SwivelError` instance,\n    // populating it with a human-readable error name and formatted error message\n    // if the ethers error does not contain any custom error data,\n    // `parseSwivelError` will return `undefined`\n    const swivelError = parseSwivelError(error);\n\n    if (swivelError) {\n\n        // you can notify users with a useful error message\n        alert(swivelError.message);\n    \n    } else {\n\n        // something else went wrong, you'll need to handle the ethers error\n    }\n}\n```\n\n## Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n## Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md","gitHead":"49fe36787cb2c79ef7732f34ee9df7d7bce9975d","_id":"@swivel-finance/swivel-js@4.0.0-next.3","_nodeVersion":"18.15.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-I66VA7nYIaU83zTTGSFRSBRit2WAcbfAdUtju5vtTZGnCM6wRkQZT9BlcrbjintFoYtPze0NRSzpkYDovOmFjA==","shasum":"c00811af0d80027bd3350f2ccfe1cb70cdecba42","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-4.0.0-next.3.tgz","fileCount":338,"unpackedSize":550140,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC1PyplfLicIAeM2ZtpB8gnG5xF+wM28QRPRaJSZ7O+yAiByVujGWzkG8RneZGY9bTmtZTbxP4gTzhwZbtg9saVkhA=="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_4.0.0-next.3_1695314818187_0.22534691993832423"},"_hasShrinkwrap":false},"4.0.0-next.4":{"name":"@swivel-finance/swivel-js","version":"4.0.0-next.4","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v4 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers\n\nIn order use `swivel-js` you'll need a compatible version (`^5.2.0`) of `ethers`. Being a peer dependency, you can use any compatible version of `ethers` you already have installed in your project. \n\nIf you haven't installed a compatible version of `ethers` in your project yet, run:\n\n```bash\nnpm install --save ethers\n```\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Protocols\n\nSwivel supports 7 different interest-generating protocols and each market on Swivel is tied to a specific protocol. You can select a Protocol using the `Protocols` enum:\n\n```typescript\nimport { Protocols } from '@swivel-finance/swivel-js';\n\nconst protocol = Protocols.Compound;\n```\n\nor you can use the Protocol's numeric value:\n\n```typescript\n/**\n * The Protocol's numeric values\n * \n * Frax     = 0\n * Compound = 1\n * Rari     = 2\n * Yearn    = 3\n * Aave     = 4\n * Euler    = 5\n * Lido     = 6\n */ \n \nconst protocol = 4; // Aave\n```\n\n### Swivel\n\n#### Create a Swivel instance\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n```\n\n#### Sign an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers, utils } from 'ethers';\n\n// you need the chain id of the network you want to use\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// the order maker is your account address\nconst maker = await signer.getAddress();\n// the order key should be a hash of your account address and a timestamp\nconst key = utils.keccak256(utils.toUtf8Bytes(`${ maker }${ Date.now() }`));\n// you will also need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// create an order\nconst order: Order = {\n    key: key,\n    maker: maker,\n    underlying: underlying,\n    maturity: maturity,\n    protocol: protocol,\n    vault: false,\n    exit: false,\n    principal: '10000000',\n    premium: '500000',\n    expiry: '1648177200',\n};\n\n// you can now sign the order using the Swivel class' static `signOrder` method\nconst signature = await Swivel.signOrder(order, signer, swivelAddress, chainId);\n```\n\n#### Fill an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need a subset of the ERC-20 ABI for token allowance and approval\nconst ERC_20_ABI = [\n    'function allowance(address owner, address spender) public view returns (uint256)',\n    'function approve(address spender, uint256 value) public returns (bool)',\n];\n\n/**\n * Fill an order.\n * \n * @param amount - the amount of volume to fill\n */\nexport async function marketOrderFixed (amount: number): Promise<void> {\n\n    // convert the amount to a BigNumber with the appropriate amount of decimals (e.g. 18 for DAI)\n    const fillAmount = ethers.utils.parseUnits(amount.toString(), 18);\n\n    // create an ethers provider and signer\n    const provider = new ethers.providers.Web3Provider(window.ethereum);\n    const signer = provider.getSigner();\n\n    // constants for Swivel on rinkeby (this might be outdated)\n    const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n    const underlyingAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n\n    // create the Swivel contract\n    const swivel = new Swivel(swivelAddress, signer);\n\n    // to fill an order with Swivel, we need to approve Swivel to transfer our tokens\n    // in order to do this, we need to:\n    //   1. create an ERC20 contract instance\n    //   2. check if the Swivel contract has sufficient allowance for the fill amount\n    //   3. approve the Swivel contract for at least the fill amount\n\n    // create the ERC-20 token contract for the underlying (e.g. DAI)\n    const token = new ethers.Contract(underlyingAddress, ERC_20_ABI, provider);\n\n    // check approval\n    const approvalAmount = await token.allowance(window.ethereum.selectedAddress, swivelAddress) as ethers.BigNumber;\n\n    // if not approved approve max uint\n    // (this frees you from having to approve each single fill)\n    if (approvalAmount.lt(fillAmount)) {\n\n        const approve = await token.approve(swivelAddress, ethers.constants.MaxUint256) as ethers.providers.TransactionResponse;\n        await approve.wait();\n    }\n\n    // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby\n    // in a real-world scenario you would fetch orders from the Preview Market Order API call\n    const order = {\n        key: '0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb',\n        maker: '0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C',\n        underlying: '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa',\n        vault: true,\n        exit: false,\n        principal: '40000000000000000000000',\n        premium: '2000000000000000000000',\n        maturity: '1662089767',\n        expiry: '1633324220',\n    };\n    const signature = '0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c';\n\n    // fill the hardcoded order by initiating your position\n    // each parameter is an array, as multiple orders can be filled at once\n    const tx = await swivel.initiate([order], [fillAmount.toString()], [signature]) as ethers.providers.TransactionResponse;\n    \n    // wait for the transaction to confirm\n    const receipt = await tx.wait();\n\n    console.log(receipt);\n}\n```\n\n### MarketPlace\n\n#### Create a MarketPlace instance\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n```\n\n#### Get the interest rate (supply APY) of a market\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n\n// you'll need to know the market's protocol (Compound in this example),\nconst protocol = Protocols.Compound;\n// ...underlying (USDC in this example),\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'\n// ... and maturity (30/9/2022 in this example)\nconst maturity = 1664550000;\n\n// get the market info for a specific market\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n\n// get the market's interest rate (supply APY)\nconst interestRate = await marketPlace.interestRate(protocol, market.cTokenAddr);\n```\n\n### VaultTracker\n\n```typescript\nimport { Protocols, VaultTracker } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to create a VaultTracker instance you'll need the address of its\n// deployed contract - each market has it's own VaultTracker contract\n// you can retrieve the address of a VaultTracker by calling the \n// `markets` method of the MarketPlace contract\n\n// you will need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// assuming you already created a MarketPlace instance, \n// retrieve the desired market information...\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n// ...and extract the `vaultTracker` of the market\nconst vaultAddress = market.vaultTracker;\n\n// use the `signer` and `vaultAdrress` to instantiate the VaultTracker\nconst vaultTracker = new VaultTracker(vaultAddress, signer);\n```\n\n### Error Handling\n\nThe Swivel protocol uses [solidity custom errors](https://blog.soliditylang.org/2021/04/21/custom-errors/) throughout to provide additional error context to consumers through error parameters. Swivel relies on a single custom error interface to do so:\n\n```solidity\nerror Exception(uint8 code, uint256 amountReceived, uint256 amountExpected, address addressReceived, address addressExpected);\n```\n\nEach error has a unique `code` and, depending on the `code`, the `amount` and `address` parameters will be set to provide relevant context to the error instance.\n\n`swivel-js` provides helpers to easily extract custom error data from failed transactions, as well as a mapping of `Exception` codes to human-readable error names and fully formatted error messages. The easiest way to handle custom errors using `swivel-js` is by using the `parseSwivelError` method:\n\n```typescript\nimport { parseSwivelError, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n\n// assume you have an order and its signature...\nconst order = {...};\nconst signature = '...';\n\n// ...and you'd like to fill the order with 100 underlying\nconst amount = ethers.utils.parseUnits('100', 18);\n\n// use a try/catch block around your transaction\ntry {\n\n    const tx = await swivel.initiate([order], [amount], [signature]);\n\n    const receipt = await tx.wait();\n\n} catch (error) {\n\n    // if the transaction fails, you will receive an ethers error which\n    // will usually be a `CALL_EXCEPTION` or `UNPREDICTABLE_GAS_LIMIT`\n    \n    // regardless of the ethers error, you can pass it to the \n    // `parseSwivelError` method, which will extract the custom error\n    // data (if it is available) and create a `SwivelError` instance,\n    // populating it with a human-readable error name and formatted error message\n    // if the ethers error does not contain any custom error data,\n    // `parseSwivelError` will return `undefined`\n    const swivelError = parseSwivelError(error);\n\n    if (swivelError) {\n\n        // you can notify users with a useful error message\n        alert(swivelError.message);\n    \n    } else {\n\n        // something else went wrong, you'll need to handle the ethers error\n    }\n}\n```\n\n## Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n## Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md","gitHead":"f7aa32a3e54174b9f821b10dd379b6ab293f7a0d","_id":"@swivel-finance/swivel-js@4.0.0-next.4","_nodeVersion":"18.15.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-/yhg2UwxGtOOUdG0rnjNFoaCk7/p1Wjc/vDkTDOQkhMyfIC7yexrl+KJ2Gk7OVvMqY2ipGCEZZL5hXGoKer+Jg==","shasum":"241b6032bfec6b8f5db7d11133eae9df0a2a5c55","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-4.0.0-next.4.tgz","fileCount":338,"unpackedSize":550116,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDITvHHdtRi1Iz87lKtQgOGKr/oxpLhV0K5QRpDB49W0AIgXamEPzDvNiqHYzIKr7m0CZT7ObKToD6a6sKkHvkK5c0="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_4.0.0-next.4_1695317512925_0.9130931528765103"},"_hasShrinkwrap":false},"4.0.0":{"name":"@swivel-finance/swivel-js","version":"4.0.0","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v4 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"7ce58e31443caebdf0d962dead4e480db9368b2d","_id":"@swivel-finance/swivel-js@4.0.0","_nodeVersion":"18.15.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-ny3Clg1kdRkUcO5kbWTBWyCSpg2QZjF3Zxwk7k6cMC9nreftG3Ej8D6nfFpWBzQYc7vMUasoEZSmfb0TAY/WlQ==","shasum":"1079db19f93289d34bb1fb8bda1e7553d617d91d","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-4.0.0.tgz","fileCount":338,"unpackedSize":550109,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDilUwKPocYd82HDuYrCfZClcWKYcIJJfTktPsYVABkMQIhALd3XXKluDtzFw8yIlVd+/o7nwnz4F9rqEKITlfW1Czl"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_4.0.0_1695661750869_0.14773910687757796"},"_hasShrinkwrap":false},"4.0.1":{"name":"@swivel-finance/swivel-js","version":"4.0.1","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v4 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"06b0ca400b4bb8d6e8e0bdd6ae95b74f45a275cb","_id":"@swivel-finance/swivel-js@4.0.1","_nodeVersion":"18.15.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-MErMKhH4Xit2u1TY4jrUMHp+Uvrer4SEs1ORvMc4FSv5+g63wT6i4S8fmsZp0EIXxOh7ZNkxDoaXngPmCvfXxg==","shasum":"a6861dab3cda92fd05aed270de983953ed935f5b","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-4.0.1.tgz","fileCount":338,"unpackedSize":544899,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFSk6sRSTd6VhqigFz/HRc8PBUHJYxAgOiczgEzpVMyaAiEAqYxoUS/92NptY8LJragoplOFZ9KnZwxGxKtFogI8vFM="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_4.0.1_1695844539209_0.4974130990795438"},"_hasShrinkwrap":false},"3.2.2":{"name":"@swivel-finance/swivel-js","version":"3.2.2","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v3 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"bfa7f227dab633e78e4751f5cd6d29d60faf7144","_id":"@swivel-finance/swivel-js@3.2.2","_nodeVersion":"18.15.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-/ewgtV3tVJ+F38ch+S5Q2p+F0yiGNJv2nsk5pjsRgASnL4Ocr9wfD5ty3BrO8MMdIAio4pGQjUurYAi/2j3NAg==","shasum":"b5656d7dbb67f96a6defb7dda3e963f2e9cbbc69","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-3.2.2.tgz","fileCount":338,"unpackedSize":538518,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEcARNdH8gjRocDxsEyLNBSXZ8ZM2O45ImrivJPuuFRaAiEAznxNfFSmzVjbesFOONxUUsqhfjA+qiKANuLvIbkD3s8="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_3.2.2_1696263156567_0.10928707355448153"},"_hasShrinkwrap":false},"4.0.2":{"name":"@swivel-finance/swivel-js","version":"4.0.2","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v4 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"1d96979e4cdd6590a5b65ab6e6c39d455eba585b","_id":"@swivel-finance/swivel-js@4.0.2","_nodeVersion":"18.15.0","_npmVersion":"9.6.5","dist":{"integrity":"sha512-Xu+CEtd7v+sbEFz65dZhhkDnfddgS4QtgmIQ99apvfpz+cTRrbyxaZtO+IORw31+GTXhTJTcDSk225U3a5eXKQ==","shasum":"74a4294d487b75f1e693a02e056b5c8aaa8a4fe7","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-4.0.2.tgz","fileCount":338,"unpackedSize":551586,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7NiFMNixKs+xrCamiUhuLwMG1IsU1C7RzUh27BW//NwIhAPyX72ZGgdgUEfuGHYCwxYoPn3D/ekyAwi52zoXlRskf"}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_4.0.2_1696273343780_0.367940899608987"},"_hasShrinkwrap":false},"4.0.3":{"name":"@swivel-finance/swivel-js","version":"4.0.3","description":"Javascript library for working with the Swivel Finance Protocol","type":"module","main":"build/index.js","module":"build/index.js","types":"build/index.d.ts","author":{"name":"swivel-finance"},"license":"MIT","bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"homepage":"https://github.com/Swivel-Finance/swivel-js#readme","repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"scripts":{"clean":"rimraf ./build ./coverage","commit":"cz","prebuild":"npm run clean","prebuild:prod":"rimraf ./build","build":"tsc --build","build:watch":"npm run build -- --watch","build:prod":"tsc --build ./src/tsconfig.prod.json","lint":"eslint 'src/**/*.ts' 'test/**/*.ts'","lint:fix":"npm run lint -- --fix","test":"mocha","test:watch":"npm run test -- --watch","test:coverage":"c8 npm run test","prerelease":"npm-run-all lint build test:coverage build:prod","release":"standard-version","release:minor":"npm run release -- --release-as minor","release:major":"npm run release -- --release-as major","release:dry":"npm run release -- --dry-run","release:publish":"git push --follow-tags origin v4 && npm publish --access public"},"devDependencies":{"@swivel-finance/eslint-config":"^0.1.0","@types/mocha":"^9.1.1","@types/sinon":"^10.0.12","c8":"^7.11.3","commitizen":"^4.2.4","cz-conventional-changelog":"^3.3.0","eslint":"^7.32.0","eslint-plugin-import":"^2.26.0","ethers":"^5.6.9","mocha":"^10.0.0","npm-run-all":"^4.1.5","rimraf":"^3.0.2","sinon":"^14.0.0","standard-version":"^9.5.0","tslib":"^2.4.0","typescript":"^4.7.4"},"peerDependencies":{"ethers":"^5.2.0"},"dependencies":{"cross-fetch":"^3.1.5"},"engines":{"node":">=15","npm":">=7"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"_id":"@swivel-finance/swivel-js@4.0.3","gitHead":"84c7583da439913b4edd9b0c9e27f05e2db039e1","_nodeVersion":"20.10.0","_npmVersion":"10.2.3","dist":{"integrity":"sha512-G6JmrT4q7ndaE5B5zU8vGHwu2hOvyyUgt+w7f8evY8mKCK5CVbuUqV3fN9ikRa8YmHyr5pzrFfGKKQUye/m7pQ==","shasum":"748adb1a8af4a193dc2fa9c0961faa94b84defef","tarball":"https://registry.npmjs.org/@swivel-finance/swivel-js/-/swivel-js-4.0.3.tgz","fileCount":338,"unpackedSize":555184,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBqpexx9J3Q4hNxa1QQGdAIUTVZ/XrvYX9FdJMvEViNJAiEAqnc1HCBToceQm532Sy9sh0mU8bLB3zHoJnddf2adCI4="}]},"_npmUser":{"name":"swivel-finance","email":"dev@swivel.finance"},"directories":{},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/swivel-js_4.0.3_1702498869472_0.6114880120580695"},"_hasShrinkwrap":false}},"time":{"created":"2021-03-23T17:59:17.461Z","1.0.0":"2021-03-23T17:59:17.678Z","modified":"2023-12-13T20:21:09.961Z","1.0.1":"2021-03-23T21:04:14.820Z","1.0.2":"2021-03-23T21:40:37.170Z","2.0.0-next.0":"2021-06-04T15:05:38.358Z","2.0.0-next.1":"2021-06-07T21:58:13.469Z","2.0.0-next.2":"2021-06-08T15:08:34.207Z","2.0.0-next.3":"2021-06-22T15:59:32.639Z","2.0.0-next.4":"2021-06-25T17:35:51.291Z","2.0.0-next.5":"2021-08-29T16:30:16.764Z","2.0.0-next.6":"2021-09-01T18:02:02.348Z","2.0.0":"2021-09-15T14:10:57.462Z","2.1.0":"2021-12-01T22:41:32.754Z","2.2.0-next.0":"2021-12-15T17:21:19.643Z","2.2.0":"2021-12-15T19:49:21.015Z","2.2.1":"2021-12-16T21:10:03.756Z","2.2.2-next.0":"2022-01-20T20:49:50.411Z","2.2.2":"2022-01-20T21:31:07.023Z","2.2.3":"2022-01-22T17:14:20.562Z","2.2.4":"2022-01-25T19:20:23.191Z","3.0.0-next.0":"2022-07-29T19:03:47.977Z","3.0.0-next.1":"2022-08-11T15:04:26.254Z","3.0.0-next.2":"2022-08-17T15:27:24.237Z","3.0.0":"2022-09-27T18:16:35.469Z","3.0.1":"2022-09-27T21:05:27.627Z","3.0.2":"2022-09-28T17:48:33.391Z","3.1.0":"2022-09-29T22:12:09.710Z","3.1.1":"2022-10-03T19:24:20.762Z","3.2.0":"2023-04-06T12:58:20.910Z","3.2.1":"2023-04-06T16:17:00.507Z","4.0.0-next.0":"2023-08-14T14:52:38.193Z","4.0.0-next.1":"2023-09-19T19:28:48.663Z","4.0.0-next.2":"2023-09-19T19:44:23.890Z","4.0.0-next.3":"2023-09-21T16:46:58.409Z","4.0.0-next.4":"2023-09-21T17:31:53.297Z","4.0.0":"2023-09-25T17:09:11.170Z","4.0.1":"2023-09-27T19:55:39.366Z","3.2.2":"2023-10-02T16:12:36.894Z","4.0.2":"2023-10-02T19:02:24.225Z","4.0.3":"2023-12-13T20:21:09.788Z"},"maintainers":[{"name":"swivel-finance","email":"dev@swivel.finance"}],"description":"Javascript library for working with the Swivel Finance Protocol","homepage":"https://github.com/Swivel-Finance/swivel-js#readme","keywords":["Swivel","Finance","Javascript","Typescript","Badass"],"repository":{"type":"git","url":"git+https://github.com/Swivel-Finance/swivel-js.git"},"author":{"name":"swivel-finance"},"bugs":{"url":"https://github.com/Swivel-Finance/swivel-js/issues"},"license":"MIT","readme":"[![Build Status](https://travis-ci.com/Swivel-Finance/swivel-js.svg?token=mHzJQzb11WHSPwztZw8B&branch=main)](https://travis-ci.com/Swivel-Finance/swivel-js)\n```\n     _______.____    __    ____  __  ____    ____  _______  __                 __       _______.\n    /       |\\   \\  /  \\  /   / |  | \\   \\  /   / |   ____||  |               |  |     /       |\n   |   (----` \\   \\/    \\/   /  |  |  \\   \\/   /  |  |__   |  |               |  |    |   (----`\n    \\   \\      \\            /   |  |   \\      /   |   __|  |  |         .--.  |  |     \\   \\    \n.----)   |      \\    /\\    /    |  |    \\    /    |  |____ |  `----. __ |  `--'  | .----)   |   \n|_______/        \\__/  \\__/     |__|     \\__/     |_______||_______|(__) \\______/  |_______/    \n```\nJavascript library for working with the Swivel Finance Protocol\n\n# Documentation\n\nFind the official documentation for the Swivel protocol at: https://docs.swivel.finance/.\n\n# Installation\n\n## Installing ethers\n\nIn order use `swivel-js` you'll need a compatible version (`^5.2.0`) of `ethers`. Being a peer dependency, you can use any compatible version of `ethers` you already have installed in your project. \n\nIf you haven't installed a compatible version of `ethers` in your project yet, run:\n\n```bash\nnpm install --save ethers\n```\n\n## Installing swivel-js\n\n```bash\nnpm install --save @swivel-finance/swivel-js\n```\n\n# Quickstart\n\nSwivel-JS provides implementations for the 3 main contracts of the Swivel protocol:\n\n- Swivel (sign orders, initiate/exit/cancel orders, split/combine/redeem tokens)\n- MarketPlace (retrieve token/vault information for a market)\n- VaultTracker (retrieve vault information for a market and owner)\n\nIn most cases you'll want to use the Swivel contract implementation to work with orders and tokens.\n\n## Usage\n\n### Protocols\n\nSwivel supports 7 different interest-generating protocols and each market on Swivel is tied to a specific protocol. You can select a Protocol using the `Protocols` enum:\n\n```typescript\nimport { Protocols } from '@swivel-finance/swivel-js';\n\nconst protocol = Protocols.Compound;\n```\n\nor you can use the Protocol's numeric value:\n\n```typescript\n/**\n * The Protocol's numeric values\n * \n * Frax     = 0\n * Compound = 1\n * Rari     = 2\n * Yearn    = 3\n * Aave     = 4\n * Euler    = 5\n * Lido     = 6\n */ \n \nconst protocol = 4; // Aave\n```\n\n### Swivel\n\n#### Create a Swivel instance\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n```\n\n#### Sign an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers, utils } from 'ethers';\n\n// you need the chain id of the network you want to use\nconst chainId = 1;\n// you need the address of the deployed swivel contract on that network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// the order maker is your account address\nconst maker = await signer.getAddress();\n// the order key should be a hash of your account address and a timestamp\nconst key = utils.keccak256(utils.toUtf8Bytes(`${ maker }${ Date.now() }`));\n// you will also need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// create an order\nconst order: Order = {\n    key: key,\n    maker: maker,\n    underlying: underlying,\n    maturity: maturity,\n    protocol: protocol,\n    vault: false,\n    exit: false,\n    principal: '10000000',\n    premium: '500000',\n    expiry: '1648177200',\n};\n\n// you can now sign the order using the Swivel class' static `signOrder` method\nconst signature = await Swivel.signOrder(order, signer, swivelAddress, chainId);\n```\n\n#### Fill an order\n\n```typescript\nimport { Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need a subset of the ERC-20 ABI for token allowance and approval\nconst ERC_20_ABI = [\n    'function allowance(address owner, address spender) public view returns (uint256)',\n    'function approve(address spender, uint256 value) public returns (bool)',\n];\n\n/**\n * Fill an order.\n * \n * @param amount - the amount of volume to fill\n */\nexport async function marketOrderFixed (amount: number): Promise<void> {\n\n    // convert the amount to a BigNumber with the appropriate amount of decimals (e.g. 18 for DAI)\n    const fillAmount = ethers.utils.parseUnits(amount.toString(), 18);\n\n    // create an ethers provider and signer\n    const provider = new ethers.providers.Web3Provider(window.ethereum);\n    const signer = provider.getSigner();\n\n    // constants for Swivel on rinkeby (this might be outdated)\n    const swivelAddress = '0xDe9a819630094dF6dA6FF7CCc77E04Fd3ad0ACFE';\n    const underlyingAddress = '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa';\n\n    // create the Swivel contract\n    const swivel = new Swivel(swivelAddress, signer);\n\n    // to fill an order with Swivel, we need to approve Swivel to transfer our tokens\n    // in order to do this, we need to:\n    //   1. create an ERC20 contract instance\n    //   2. check if the Swivel contract has sufficient allowance for the fill amount\n    //   3. approve the Swivel contract for at least the fill amount\n\n    // create the ERC-20 token contract for the underlying (e.g. DAI)\n    const token = new ethers.Contract(underlyingAddress, ERC_20_ABI, provider);\n\n    // check approval\n    const approvalAmount = await token.allowance(window.ethereum.selectedAddress, swivelAddress) as ethers.BigNumber;\n\n    // if not approved approve max uint\n    // (this frees you from having to approve each single fill)\n    if (approvalAmount.lt(fillAmount)) {\n\n        const approve = await token.approve(swivelAddress, ethers.constants.MaxUint256) as ethers.providers.TransactionResponse;\n        await approve.wait();\n    }\n\n    // hardcoded nToken purchase order (the order being filled) + signature valid on rinkeby\n    // in a real-world scenario you would fetch orders from the Preview Market Order API call\n    const order = {\n        key: '0x3449db081da0329d51b6757809ce4c1042ea0c110b8980628e46cb4d4b8297fb',\n        maker: '0x3f60008Dfd0EfC03F476D9B489D6C5B13B3eBF2C',\n        underlying: '0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa',\n        vault: true,\n        exit: false,\n        principal: '40000000000000000000000',\n        premium: '2000000000000000000000',\n        maturity: '1662089767',\n        expiry: '1633324220',\n    };\n    const signature = '0x2ab021d3577a940b6d2b2f47288dc240fb003c24d0af93751bd3b9354e1df0d03e6d2c47a7bf566d6ec887b6884edb80c80f0890d247a363eb31b1e99d5636ae1c';\n\n    // fill the hardcoded order by initiating your position\n    // each parameter is an array, as multiple orders can be filled at once\n    const tx = await swivel.initiate([order], [fillAmount.toString()], [signature]) as ethers.providers.TransactionResponse;\n    \n    // wait for the transaction to confirm\n    const receipt = await tx.wait();\n\n    console.log(receipt);\n}\n```\n\n### MarketPlace\n\n#### Create a MarketPlace instance\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n```\n\n#### Get the interest rate (supply APY) of a market\n\n```typescript\nimport { MarketPlace } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed MarketPlace contract\nconst marketPlaceAddress = '0x998689650D4d55822b4bDd4B7DB5F596bf6b3570';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the MarketPlace contract\nconst marketPlace = new MarketPlace(marketPlaceAddress, signer);\n\n// you'll need to know the market's protocol (Compound in this example),\nconst protocol = Protocols.Compound;\n// ...underlying (USDC in this example),\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'\n// ... and maturity (30/9/2022 in this example)\nconst maturity = 1664550000;\n\n// get the market info for a specific market\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n\n// get the market's interest rate (supply APY)\nconst interestRate = await marketPlace.interestRate(protocol, market.cTokenAddr);\n```\n\n### VaultTracker\n\n```typescript\nimport { Protocols, VaultTracker } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// create an ethers provider and signer\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// to create a VaultTracker instance you'll need the address of its\n// deployed contract - each market has it's own VaultTracker contract\n// you can retrieve the address of a VaultTracker by calling the \n// `markets` method of the MarketPlace contract\n\n// you will need the underlying token address, maturity and protocol of a market\n// you can get them from the Swivel Exchange API\nconst underlying = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\nconst maturity = '1648177200';\nconst protocol = Protocols.Compound;\n\n// assuming you already created a MarketPlace instance, \n// retrieve the desired market information...\nconst market = await marketPlace.markets(protocol, underlying, maturity);\n// ...and extract the `vaultTracker` of the market\nconst vaultAddress = market.vaultTracker;\n\n// use the `signer` and `vaultAdrress` to instantiate the VaultTracker\nconst vaultTracker = new VaultTracker(vaultAddress, signer);\n```\n\n### Error Handling\n\nThe Swivel protocol uses [solidity custom errors](https://blog.soliditylang.org/2021/04/21/custom-errors/) throughout to provide additional error context to consumers through error parameters. Swivel relies on a single custom error interface to do so:\n\n```solidity\nerror Exception(uint8 code, uint256 amountReceived, uint256 amountExpected, address addressReceived, address addressExpected);\n```\n\nEach error has a unique `code` and, depending on the `code`, the `amount` and `address` parameters will be set to provide relevant context to the error instance.\n\n`swivel-js` provides helpers to easily extract custom error data from failed transactions, as well as a mapping of `Exception` codes to human-readable error names and fully formatted error messages. The easiest way to handle custom errors using `swivel-js` is by using the `parseSwivelError` method:\n\n```typescript\nimport { parseSwivelError, Swivel } from '@swivel-finance/swivel-js';\nimport { ethers } from 'ethers';\n\n// you need the address of the deployed swivel contract on the connected network\nconst swivelAddress = '0x3b983B701406010866bD68331aAed374fb9f50C9';\n\n// create an ethers provider and signer,...\nconst provider = new ethers.providers.Web3Provider(window.ethereum);\nconst signer = provider.getSigner();\n\n// ...and use the signer to instantiate the Swivel contract\nconst swivel = new Swivel(swivelAddress, signer);\n\n// assume you have an order and its signature...\nconst order = {...};\nconst signature = '...';\n\n// ...and you'd like to fill the order with 100 underlying\nconst amount = ethers.utils.parseUnits('100', 18);\n\n// use a try/catch block around your transaction\ntry {\n\n    const tx = await swivel.initiate([order], [amount], [signature]);\n\n    const receipt = await tx.wait();\n\n} catch (error) {\n\n    // if the transaction fails, you will receive an ethers error which\n    // will usually be a `CALL_EXCEPTION` or `UNPREDICTABLE_GAS_LIMIT`\n    \n    // regardless of the ethers error, you can pass it to the \n    // `parseSwivelError` method, which will extract the custom error\n    // data (if it is available) and create a `SwivelError` instance,\n    // populating it with a human-readable error name and formatted error message\n    // if the ethers error does not contain any custom error data,\n    // `parseSwivelError` will return `undefined`\n    const swivelError = parseSwivelError(error);\n\n    if (swivelError) {\n\n        // you can notify users with a useful error message\n        alert(swivelError.message);\n    \n    } else {\n\n        // something else went wrong, you'll need to handle the ethers error\n    }\n}\n```\n\n## Deployed Contract Addresses\nTo connect a Swivel or MarketPlace instance to the deployed contract on the Ethereum network, you'll need to know the contract address. You can find the currently deployed addresses here: https://github.com/Swivel-Finance/swivel#current-deployments\n\n## Other Providers\n\nYou can use ethers.js to connect to the Ethereum network in different ways, not only using MetaMask. Please refer to the ethers.js documentation for different ways to connect: https://docs.ethers.io/v5/getting-started/#getting-started--connecting.\n\nOnce you have created a provider and a signer, creating a Swivel, MarketPlace or VaultTracker instance is identical to the steps illustrated above.\n","readmeFilename":"README.md"}