{"_id":"6551.js","_rev":"2-34b096296c67871c0b007e71a3252ae8","name":"6551.js","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"6551.js","version":"1.0.0","description":"NFT Bound account JS toolkit ","main":"registry.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/verynifty/6551.js.git"},"keywords":["NFT","ERC6551","6551","JS"],"author":{"name":"Muse DAO"},"license":"MIT","bugs":{"url":"https://github.com/verynifty/6551.js/issues"},"homepage":"https://github.com/verynifty/6551.js#readme","dependencies":{"dotenv":"^16.0.3","ethers":"^6.3.0"},"gitHead":"8a32cd2096f935ecbc6551af2a6a9bcff99eb173","_id":"6551.js@1.0.0","_nodeVersion":"16.13.0","_npmVersion":"8.5.2","dist":{"integrity":"sha512-HhFDqTJldYYojodDsbrMqobzmuYpfjzQYfoz6UmMXSF3kthxVYPYCGH9dhatraUZ+077/sRXu95/VAzdr0q2UA==","shasum":"1e98bdca68b52b0d5cf1b8940f2b45dc9108877c","tarball":"https://registry.npmjs.org/6551.js/-/6551.js-1.0.0.tgz","fileCount":11,"unpackedSize":14536,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFk9ZcT1eEqXkjYO/OWudQEsgew5EES18vL9tNZVbbbjAiB7leL6deFWpj25o35TQa7COFVutNqUM7vVawjZ6KjoMg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkVG74ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpNDhAAhUmLcOCd/IZ4ipbTCCNKNdpHysg8zb9TBQv373grqY7cYn5z\r\nCeeyzuYKISKXAUIqF2KKLZj0wT3KSuwTDU4ZtpOMGqqsCEqN5A/2Pbb0ZOXl\r\nDl7TyHOiG812l4NTgmwx9Z4ReuhLwEGPaESnC+Msd83yTYT/fRJaqCOVHVf+\r\npnO06eVvfdHS2A99RLzOLlQJX17EKMP8rHovoDw0glB8sQf54CrU9a/Kvbeo\r\nnTyQlftaPX55l2o7791WxNcZpDbJiFtQ2awjUECgwlG83lEz/wfDtCjKy0kC\r\nL9K/Li4E61rLQ/8mIfE1/jaZ/B3uG3mqtXeRHEdaTsL2zKlcTEzS//5jLdMv\r\ntrdVAPEfekTtnX9gM/jvoRT98BEBbIlT3+ov+q1F9y87BAMZ53ZALGC/BD6Z\r\ncDHT3RdmQfn+x1MwqwzacLk/745HL7RukMO1T6e5ZamDmJqsPNYd0Xgsn6Xw\r\nL+p4lSUjRmiC0Ip+64/FtPjUZyBJvPcgd4rLfNoIrFxr5cyOZine9PZok0jK\r\nQl7Gm6s/BdIwt2AEtJPPWYBw0qiIIp7Y//8WsURMzyzCPP8J5ipANIbhFKGF\r\n/Ar85OgO74u5X8bcCiiMXFOCYDKbGXwWDvOMCBrm0WepCqchJgF3qw43Dwh6\r\nulADSl+vyLxKa5wCdM7WuCdLQaPiX0olrrQ=\r\n=hxCW\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"grands_marquis","email":"ethereumdevio@gmail.com"},"directories":{},"maintainers":[{"name":"grands_marquis","email":"ethereumdevio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/6551.js_1.0.0_1683255032762_0.7605827527094755"},"_hasShrinkwrap":false},"1.0.1":{"name":"6551.js","version":"1.0.1","description":"NFT Bound account JS toolkit ","main":"src/registry.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/verynifty/6551.js.git"},"keywords":["NFT","ERC6551","6551","JS"],"author":{"name":"Muse DAO"},"license":"MIT","bugs":{"url":"https://github.com/verynifty/6551.js/issues"},"homepage":"https://github.com/verynifty/6551.js#readme","dependencies":{"6551.js":"^1.0.0","dotenv":"^16.0.3","ethers":"^6.3.0"},"gitHead":"2feccd246b3649c3140198df495a01693f78b3ee","_id":"6551.js@1.0.1","_nodeVersion":"16.13.0","_npmVersion":"8.5.2","dist":{"integrity":"sha512-DRSOBUisLxGwsbP3vaNmkMQB9dl+D8eyEQjtnYaI1riBxXUfRkKaoMYVR4K/Yi9APFVuK+MOtbxaSahBcflxBA==","shasum":"de1265ed0293a7722932a32d129852d14abd303f","tarball":"https://registry.npmjs.org/6551.js/-/6551.js-1.0.1.tgz","fileCount":11,"unpackedSize":14679,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5eWfn97gyEgr814fx2jWmPXiD4BGvweIwfJ2hVq5nOAIgTWIQ4hLshB7blAw5YYzfiM7ssqPw0ykYfpX8R7G4k2A="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkVHqKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqsbQ//S9Wwvm3sPCcMGdTwsrPv8OnviY28vU8hY4q13ferPTjA/XWF\r\n+JH4huKWpNbq2vOR6D9X89wmHsP1hRvnbgks09U41MdiztwqFTV3VXJXlxAI\r\nP6ryC3D4GKfEcjyr0nnyKVzUAOcjqT9Bj4Z9WQVKMaCNRWWc+dX0L+ywW0qJ\r\nBheQg5wbcrNYMPrIyuGI/bari3TvHXkDAl7egYWoaiBdvAb3ynCkzPOAh9ub\r\noyR0wkC0cioptDL7EMUdUYB4wB9Iu0o9YBoGIat7o6tVVK54UZLvaxxXqkK5\r\nbHVlj62adilxbgWK1E9dE1iAZNcAsmXib2ifm/B1Wvi7CaM7LDM/UmKNlJ53\r\noo19WQ11k2VjQJxtLf7LB3PcUZVNo+awchPPaBaDBqZOCghd4ewUZL22zA7/\r\nDYB0P5XM3aeahsky3h+yYhKnuJltSXmi+jT9VXEpy7HY09u0t3T+QjWgPaTd\r\nqHisLGtmmvhfh0lwWrA50Ya4k9FzPPEHL0FW9GGf5PBUM43yx7is3mWAxLL5\r\nHS4CdJA6/DRpbJLHH1NtdRUtB6oC3maA+uzF7cAjgRE09qdcft0WA3iDNahI\r\nM2exNpjNa78n6m8tnk7kSZNB/B+xEL9yL3oWleIvcokrz8CV5LFUiR59ICET\r\n5pIBcZijH3gQv0siOQxc9y3gFqyuLpmYJ7M=\r\n=bV2j\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"grands_marquis","email":"ethereumdevio@gmail.com"},"directories":{},"maintainers":[{"name":"grands_marquis","email":"ethereumdevio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/6551.js_1.0.1_1683257994693_0.8852135361119096"},"_hasShrinkwrap":false},"1.0.2":{"name":"6551.js","version":"1.0.2","description":"NFT Bound account JS toolkit ","main":"src/registry.js","repository":{"type":"git","url":"git+https://github.com/verynifty/6551.js.git"},"keywords":["NFT","ERC6551","6551","JS"],"author":{"name":"Muse DAO"},"license":"MIT","bugs":{"url":"https://github.com/verynifty/6551.js/issues"},"homepage":"https://github.com/verynifty/6551.js#readme","dependencies":{"dotenv":"^16.0.3","ethers":"^6.3.0"},"gitHead":"8e854775f7e895c188bc04c78dabd1bf30302fd1","_id":"6551.js@1.0.2","_nodeVersion":"16.13.0","_npmVersion":"8.5.2","dist":{"integrity":"sha512-/fEyX6VA3C9RCyIBWI419/C7Ehm95JuykUxhs6tP/uoUG+j9eWay30FeZmrtPKHRU0WbojWHoV1T8utTs8yWTA==","shasum":"c446b62a51cd57203c16dfb8aaef01973af4a216","tarball":"https://registry.npmjs.org/6551.js/-/6551.js-1.0.2.tgz","fileCount":11,"unpackedSize":17575,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGlnrCq0hAGYDRfpJMR8ykGwdF6slduLFYVYyaK7Z8roAiAinH3JGd/gClIlH/eiohZ6obnqVWxMK88skl3HLtgTuQ=="}]},"_npmUser":{"name":"grands_marquis","email":"ethereumdevio@gmail.com"},"directories":{},"maintainers":[{"name":"grands_marquis","email":"ethereumdevio@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/6551.js_1.0.2_1683360200928_0.5290061206948287"},"_hasShrinkwrap":false}},"time":{"created":"2023-05-05T02:50:32.710Z","1.0.0":"2023-05-05T02:50:32.942Z","modified":"2023-05-06T08:03:21.196Z","1.0.1":"2023-05-05T03:39:54.856Z","1.0.2":"2023-05-06T08:03:21.090Z"},"maintainers":[{"name":"grands_marquis","email":"ethereumdevio@gmail.com"}],"description":"NFT Bound account JS toolkit ","homepage":"https://github.com/verynifty/6551.js#readme","keywords":["NFT","ERC6551","6551","JS"],"repository":{"type":"git","url":"git+https://github.com/verynifty/6551.js.git"},"author":{"name":"Muse DAO"},"bugs":{"url":"https://github.com/verynifty/6551.js/issues"},"license":"MIT","readme":"# 6551.js\n\n6551.js is a tiny library to help working with Non-fungible Token Bound Accounts. You can read more about them here:\n* [https://eips.ethereum.org/EIPS/eip-6551](EIP on ethereum.org)\n* [https://ethereum-magicians.org/t/erc-6551-non-fungible-token-bound-accounts/13030](EIP on ethereum magicians)\n* [https://eips.ethereum.org/EIPS/eip-6551](EIP on ethereum.org)\n* [https://github.com/tokenbound/contracts](Official implementation)\n* [https://github.com/tokenbound/sdk](Official SDK)\n\n## Installation\n\nYou'll need to install the 6551.js package and have an instance of ethers.\n\n```\nnpm install 6551.js --save\n```\n\nThen import in your project:\n\n```\nconst { ethers } = require(\"ethers\");\n\nconst ERC6551Registry = require(\"6551.js\");\n\nconst provider = new ethers.JsonRpcProvider(\"https://rpc.ankr.com/eth_goerli\");\nconst Registry = new ERC6551Registry(provider);\n\n```\n\n## Usage\n\n### Create an account\n\nThis will generate the transaction data needed to deploy an account for a specifi NFT.\n\n```\nconst NFT_CONTRACT = \"0x5af0d9827e0c53e4799bb226655a1de152a425a5\";\nconst NFT_ID = 1;\n\nlet unsignedTX = await Registry.prepareCreateAccount(NFT_CONTRACT, NFT_ID, Registry.DEFAULT_IMPLEMENTATION); // Implementation address and Salt are optional\nlet pendingTX = await signer.sendTransaction(unsignedTX)\n```\n\n### Compute the address of an account\n\n```\nlet expectedAddress = await Registry.getAccountAddress(NFT_CONTRACT, NFT_ID); // Implementation address and Salt are optional\n```\n\n### Instantiate an account\n\nThere is two way to get an instance of an **Account**. The Account is then used to make calls/get informations.\n\n```\n// From parameters\nlet Account = await Registry.getAccount(NFT_CONTRACT, NFT_ID);  // Implementation address and Salt are optional\n\n// From a known address\nlet Account2 = await Registry.getAccountFromAddress(\"0x324..4323434\");\n```\n\n\n### Make a call to an account\n\nYou can make a call to an account using prepareExecuteCall. This will generate an unsigned transaction: \n\n```\n// target contract, data, value in wei\nlet unsignedTX = await Account.prepareExecuteCall(\"0x324..4323434\", \"0x\", 0); \nlet pendingTX = await signer.sendTransaction(unsignedTX)\n```\n\n### Getters on account:\n\n```\nlet nonce = await Account.owner();\nlet nonce = await Account.nonce();\nlet nonce = await Account.isCreated(); // returns if the given account is properly deployed at the address\n\n```\n\n## License and contribution\n\nMIT License, feel free to PR or open new issues.\n\n","readmeFilename":"README.md"}