{"bugs":{"url":"https://github.com/wallet-standard/wallet-standard/issues"},"dist":{"shasum":"5a1f9634e055ee602ae0254931c1db0991c737b4","tarball":"https://registry.npmjs.org/@wallet-standard/standard/-/standard-0.1.0-alpha.2.tgz","fileCount":38,"integrity":"sha512-NcSrxibQv6duC/ZpNqXviIlOWhZe5eLzQNMstAjAtYRI7tEVS5HjjP6VLp2q+SOBJYNrLXyY4ntGvgEMDLfSMg==","signatures":[{"sig":"MEUCIBL2if+avTWmo/R41olRkN0DaMa2g+aOFM6MPlTN0iF8AiEAzDhksIBLW5m9/kKJ/GnOpMRqAdjJuHVxt3nP0N90mgI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":55206,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi/p0cACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqOxg//eYuo7nDelCnIfsFL1e59nQ4W/gkdlWU6/OdwwL5UK+nOPFOj\r\n5JHeE3h+stLyUw7RPi/aMNnYmZh5y6t+CQgpydGfri7TI1VrY63/jD6MNA7R\r\nt4KPGo5oQ4VEvPG44freMffJmi2KtOVqgyVD3+kP6GegzXPXke+dNubOWzc7\r\nry5MpS4IVwGf6EWmUNx9gzrQALSPjbtf8UmbblB2WnWULOTEu4fv870rq4BN\r\nTFdqgoBlBxuzTFq9e2SsMIxI9Q8LOWVp87/dBidCc2NsJnzwarNQbZf3pEJ6\r\nNkkt4u7LbfKYs8dh78Gt8NknxnHvDRTWyd7kFcaFniAIVmcVrchAr/pxryTc\r\nDq9Qd2+btu2CJ/3bqAEGEH+tcR2gEau9ki48aGGEILfKjdCOYVSqu1Yk4/ve\r\n+5O2FPycqSB1avs19CKWu4ICLBwUb/NMOlncnzOuXy9nUfZQU8XULHtW1aAz\r\nUyjgL+DaPn2fkj2BwK1YHxlAPgZQL0/nM17x2qftlyp5lqopNxEgy3ZH4h3w\r\nN3Vk5MiY8l6h9zBqqXPqU2d4VAQAl6FscI0TALEL80wTRc6oJUXa3fc8W8Xu\r\nkHV3gs9kLtylxiBVKxxhILlCghBGL9nXy8e6XwTHzxM7GgqrSyAOS41qKjBL\r\naNiStnkm3ci3P1jmQVUScU/w867IWwNNI6M=\r\n=6VaL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/cjs/index.js","name":"@wallet-standard/standard","type":"module","_from":"file:wallet-standard-standard-0.1.0-alpha.2.tgz","types":"./lib/types/index.d.ts","author":{"name":"Solana Maintainers","email":"maintainers@solana.foundation"},"module":"./lib/esm/index.js","readme":"# [WIP] Wallet Standard\n\nThis package outlines the Wallet Standard.\n\nThe purpose of this standard is to improve the user experience of wallets.\n\nWe intend for this standard to become broadly adopted by wallets and dapps.\n\nThis is an incomplete work in progress and is rapidly changing.\n\nWallet and dapp devs are encouraged to provide their feedback and have it integrated.\n\n## Code\n\n- [Global `window.navigator.wallets` interface](src/window.ts)\n- [Wallet interface](src/wallet.ts)\n- [Example of how Standard Wallets attach to the window](../../example/wallets/src/window.ts)\n\n## Design Principles and Goals\n\n### This standard applies to \"injected\" wallets only\n\nThis standard is designed for wallets that run in browser extensions or embedded webviews and attach themselves to the global `window` object.\n\nWallets that require a dapp to load libraries or open popup windows cannot be detected in the same way.\n\nWhile these other wallets should attempt to have generally compatible interfaces, we do not design specifically for them here.\n\nWe should design for maximum compatibility across this standard, the SMS mobile wallet adapter, and Wallet Adapter.\n\nConsistent, compatible interfaces will reduce the maintenance burden of wallets and dapps.\n\n### Wallet Adapter (and other libraries) will still be used by dapps\n\nMany dapps use Wallet Adapter to maximize their support for wallets and for state management.\n\nSome popular wallets are not attached to the window, so Wallet Adapter will still be needed.\n\nWallet Adapter will support and integrate this standard, and dapps will be encouraged to update.\n\nDapps should be able to update Wallet Adapter to support this standard without significant changes to dependencies or code.\n\nNo breaking changes is the goal. Wallet Adapter should abstract changes and deprecate current APIs as needed.\n\n### Present a predictable interface for wallets to attach to the window\n\nWhen a dapp loads, it should detect all wallets that have already attached themselves to the window.\n\nAfter loading, a dapp should always detect any new wallet immediately when it attaches itself to the window.\n\nA dapp should have no special logic for detecting any specific wallet.\n\nIt should be impossible for conflicts between individual wallet browser extensions to prevent any wallet from being detected.\n\n### `window.navigator.wallets` is the namespace of the global interface\n\n`window.ethereum` has traditionally been used by injected wallets like Metamask. This convention causes multiple wallets to conflict for access to a global variable.\n\nBrowser extension wallets have adapted to this by using `Object.defineProperty(window, 'ethereum', { writable: false, ... })` to race to be the first to claim it.\n\nThis makes it impossible for multiple wallets a user has to coexist, or be detected reliably by dapps. Several existing wallets use `window.solana` to do the same thing.\n\nWallet Adapter has been doing its part to discourage use of this for the last year by consistently not accepting new adapters that use `window.solana`.\n\nWhile wallets should continue to migrate away from using `window.solana`, this standard will not conflict with this, and will instead present a chain-agnostic interface.\n\nBecause `window.wallets` may be in use by websites, and because wallets may be built into browsers themselves, we will extend the [Navigator](https://developer.mozilla.org/en-US/docs/Web/API/Navigator) interface instead.\n\n### Present a chain-agnostic interface\n\nTODO: docs\n\n### Decouple the state of the wallet UI from the state of the dapp UI\n\nWallets should be presented as stateless, isolated, multi-tenant applications to dapps.\n\nWhen a dapp acts upon a wallet, it should have no effect on any other dapp that may interact with the wallet.\n\nSimilarly, when a user interacts with the wallet UI, it should have no effect on any dapp.\n\nWhen a user changes accounts or networks in the wallet UI, their intent is to see their assets or act with them in the context of the wallet UI.\n\nAfter a dapp has connected to a wallet and discovered an account, the dapp should be able to request to sign using that account specifically.\n\nWhen this occurs, the wallet should display account and network changes to sign and send transactions for the dapp, and then return to its previous context.\n\n### Standardize feature support\n\nWallets inconsistently support signing and sending transactions, signing more than one transaction, signing a \"message\" (arbitrary byte array), and encryption and decryption.\n\nTo the extent they support these, they have different interfaces for them, and many wallets have behaviors that are not secure.\n\nThis standard will cover support for\n\n- signing one or more transactions\n- signing and sending one or more transactions\n- signing one or more \"messages\" (arbitrary byte arrays)\n- encryption and decryption\n\n### No web3.js dependency\n\nThe standard does not depend on `@solana/web3.js` or use it in its implementation.\n\nweb3.js is large and class-based, has many dependencies, and is likely to be substantially rewritten.\n\nSome wallets don't use web3.js to minimize the security surface of their code.\n\nThe interface in the standard will always input and output transactions, pubkeys, and signatures as raw bytes (`Uint8Array`).\n\nWallet Adapter will encode these as web3.js `Transaction`, `PublicKey`, and Base58 strings as needed for compatibility with dapps.\n\n### Network is used for simulation\n\nWhen signing a transaction (not just when signing and sending), a network parameter should be provided.\n\nThe recent blockhash of the transaction should be valid for the cluster, and simulation should succeed.\n\nWallets should treat failed simulation of transactions as a security issue and avoid returning signed transactions.\n\nSigning and sending from the wallet should still be the preferred interface, for security.\n\n### APIs should be versioned\n\nThe API for window objects and the API for wallets should both be versioned semantically.\n\nDapps should be able to detect available features based on known API versions.\n\nMultiple versions should be able to coexist to the greatest extent possible.\n\n### API methods should handle multiple inputs\n\n`doThing` and `doAllThings` is an antipattern.\n\nMethods should accept arrays rather than singular objects wherever it makes sense.\n\nWallets can choose to not support multiple inputs by throwing an error.\n\nThis is consistent with the SMS mobile wallet adapter SDK design.\n\nWallet Adapter will abstract over this interface to avoid breaking changes, while deprecating its current API.\n\n### API methods treat data as immutable\n\nReadonly bytes and primitive types should be the only inputs and outputs.\n\nWallets must not modify `Uint8Array` instances. Copy on write and return the copy.\n\n### Partial signatures and meta-transactions should be supported\n\nBrowser extensions that use programs and relayers for multisig and paying transaction fees for users must be supported.\n\nIn practice, this just means that transaction signing interfaces must return serialized transaction objects, not just signatures.\n\nBecause API data is immutable, this should be a natural default.\n\n### Multiple accounts should be supported\n\nWith the user's permission, dapps should be able to discover multiple accounts in the wallet.\n\nWallets need a way for accounts to be securely enumerated, and inform dapps when there are accounts it doesn't know about.\n\n### Wallets embed their own interface and metadata\n\nWallet names and icons should be provided by the wallet.\n\nImage files should be encoded with data URLs to avoid extra HTTP load.\n\n### Errors should be predictable\n\nThere should be standard error codes for known failure conditions.\n\n### Provide a reference implementation\n\nA browser extension wallet that implements minimal functionality should be created.\n\nThis will act as a reference implementation and let us test the practicability of the design.\n\nA dapp that implements limited functionality should also be created.\n\nThis will let us determine whether any breaking changes to Wallet Adapter are required.\n","exports":{"types":"./lib/types/index.d.ts","import":"./lib/esm/index.js","require":"./lib/cjs/index.js"},"license":"Apache-2.0","scripts":{"clean":"shx mkdir -p lib && shx rm -rf lib","prebuild":"pnpm run clean"},"_npmUser":{"name":"jordansexton","email":"jordan@jordansexton.com"},"homepage":"https://github.com/wallet-standard/wallet-standard#readme","_resolved":"/private/var/folders/yj/rbj_yzqn2mj3d4gt7rs6mnwm0000gn/T/839a5d1a7f98e30b2e852222f460d56c/wallet-standard-standard-0.1.0-alpha.2.tgz","_integrity":"sha512-NcSrxibQv6duC/ZpNqXviIlOWhZe5eLzQNMstAjAtYRI7tEVS5HjjP6VLp2q+SOBJYNrLXyY4ntGvgEMDLfSMg==","repository":{"url":"git+https://github.com/wallet-standard/wallet-standard.git","type":"git"},"_npmVersion":"8.15.0","description":"This package outlines the Wallet Standard.","directories":{},"maintainers":[{"name":"jordansexton","email":"jordan@jordansexton.com"}],"sideEffects":false,"_nodeVersion":"18.7.0","dependencies":{"@wallet-standard/types":"^0.1.0-alpha.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"shx":"^0.3.4"},"_npmOperationalInternal":{"tmp":"tmp/standard_0.1.0-alpha.2_1660853532262_0.018706724877036285","host":"s3://npm-registry-packages"},"_id":"@wallet-standard/standard@0.1.0-alpha.2","version":"0.1.0-alpha.2"}