Observed since 20 Oct, 20:47 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
6551.js
NFT Bound account JS toolkit
6551.js is a tiny library to help working with Non-fungible Token Bound Accounts. You can read more about them here:
You'll need to install the 6551.js package and have an instance of ethers.
npm install 6551.js --save
Then import in your project:
const { ethers } = require("ethers");
const ERC6551Registry = require("6551.js");
const provider = new ethers.JsonRpcProvider("https://rpc.ankr.com/eth_goerli");
const Registry = new ERC6551Registry(provider);
This will generate the transaction data needed to deploy an account for a specifi NFT.
const NFT_CONTRACT = "0x5af0d9827e0c53e4799bb226655a1de152a425a5";
const NFT_ID = 1;
let unsignedTX = await Registry.prepareCreateAccount(NFT_CONTRACT, NFT_ID, Registry.DEFAULT_IMPLEMENTATION); // Implementation address and Salt are optional
let pendingTX = await signer.sendTransaction(unsignedTX)
let expectedAddress = await Registry.getAccountAddress(NFT_CONTRACT, NFT_ID); // Implementation address and Salt are optional
There is two way to get an instance of an Account. The Account is then used to make calls/get informations.
// From parameters
let Account = await Registry.getAccount(NFT_CONTRACT, NFT_ID); // Implementation address and Salt are optional
// From a known address
let Account2 = await Registry.getAccountFromAddress("0x324..4323434");
You can make a call to an account using prepareExecuteCall. This will generate an unsigned transaction:
// target contract, data, value in wei
let unsignedTX = await Account.prepareExecuteCall("0x324..4323434", "0x", 0);
let pendingTX = await signer.sendTransaction(unsignedTX)
let nonce = await Account.owner();
let nonce = await Account.nonce();
let nonce = await Account.isCreated(); // returns if the given account is properly deployed at the address
MIT License, feel free to PR or open new issues.
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
6551.jsEnvironment{
"local_name": "6551.js",
"alias": false,
"peer_metadata": null
} | ^1.0.0 | runtime |
dotenvEnvironment{
"local_name": "dotenv",
"alias": false,
"peer_metadata": null
} | ^16.0.3 | runtime |
ethersEnvironment{
"local_name": "ethers",
"alias": false,
"peer_metadata": null
} | ^6.3.0 | runtime |
Source distribution
{
"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"
}Observed since 20 Oct, 20:47 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:f0d228f3076edb543ab616df53a3ecd62cd205c4947fd343b0dbe46a884fa830