{"_id":"@algorandfoundation/algorand-metamask-snap","_rev":"13-7d192d2db1413ce13f859832aa9afee2","name":"@algorandfoundation/algorand-metamask-snap","dist-tags":{"latest":"10.0.2"},"versions":{"10.0.0":{"name":"@algorandfoundation/algorand-metamask-snap","version":"10.0.0","author":{},"license":"MIT","_id":"@algorandfoundation/algorand-metamask-snap@10.0.0","maintainers":[{"name":"joe-p","email":"joepolny@gmail.com"},{"name":"loedn","email":"alessandro@algorand.foundation"},{"name":"shane-at-algo","email":"shane.mcgovern@algorand.foundation"},{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"}],"dist":{"shasum":"3ef681da057163f2cb0bb4f210ac7ad178b1ee69","tarball":"https://registry.npmjs.org/@algorandfoundation/algorand-metamask-snap/-/algorand-metamask-snap-10.0.0.tgz","fileCount":91,"integrity":"sha512-V7Tq1H2pRewvIXUghCc0tVlP0i7TKyzmWsamxZC0iu2IpQ+L5g5f4SLYz4mCgqeB1AgFIOGFMAVq2TpsGkktPQ==","signatures":[{"sig":"MEQCIFYH8rA1sDwfPEvyQPZ6WZltIjf8MlV9CHDOG1GrPKnYAiAQLTbT42G3DRhX+7lYGTFyFs2VjPXHGg28aehT/GrKtg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12014913},"main":"src/index.js","scripts":{"test":"yarn build && yarn serve","postinstall":"patch-package","testUseWallet":"npx mm-snap build && npx mm-snap serve --root=useWalletIntegration_test/"},"_npmUser":{"name":"joe-p","email":"joepolny@gmail.com"},"repository":{"url":"https://github.com/algorandfoundation/algo-metamask","type":"git"},"description":"Metamask snap for Algorand","directories":{},"dependencies":{"nvm":"^0.0.4","async":"^3.2.4","buffer":"^6.0.3","global":"^4.4.0","algosdk":"1.14.0","async.js":"^0.9.5","crypto-js":"^4.1.1","querystring":"^0.2.1","bignumber.js":"^9.1.1","@babel/runtime":"^7.17.2","@metamask/key-tree":"^6.0.0","@metamask/snaps-ui":"^0.29.0","url-search-params-polyfill":"^8.1.1"},"_hasShrinkwrap":false,"devDependencies":{"patch-package":"^6.4.7","@metamask/snaps-cli":"^0.32.2","postinstall-postinstall":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/algorand-metamask-snap_10.0.0_1687901451260_0.9370375540062645","host":"s3://npm-registry-packages"}},"10.0.1":{"name":"@algorandfoundation/algorand-metamask-snap","version":"10.0.1","author":{},"license":"MIT","_id":"@algorandfoundation/algorand-metamask-snap@10.0.1","maintainers":[{"name":"joe-p","email":"joepolny@gmail.com"},{"name":"loedn","email":"alessandro@algorand.foundation"},{"name":"shane-at-algo","email":"shane.mcgovern@algorand.foundation"},{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"}],"dist":{"shasum":"4f61f94f992c3f29843487e6e686ff8bc19410d8","tarball":"https://registry.npmjs.org/@algorandfoundation/algorand-metamask-snap/-/algorand-metamask-snap-10.0.1.tgz","fileCount":91,"integrity":"sha512-ZA5XzSmfgYEMg1ixXQhGvyRDcHGB/PIYbjdVPCjeg9wY9sgGajzhAx2C5CoBcnwI2z6ZJo/IaB9D1YsFBBPzyw==","signatures":[{"sig":"MEUCICDZTe1iN+8+4wBFyIrZ+5WjYJvx0/9sLIGilQb9D9mVAiEAvCqq6V6h4aqqJ2AU2MHVyp05nMzbavDS+XHr45qK5/o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12013100},"main":"src/index.js","scripts":{"test":"yarn build && yarn serve","build":"yarn mm-snap build","postinstall":"patch-package","testUseWallet":"npx mm-snap build && npx mm-snap serve --root=useWalletIntegration_test/"},"_npmUser":{"name":"joe-p","email":"joepolny@gmail.com"},"repository":{"url":"https://github.com/algorandfoundation/algo-metamask","type":"git"},"description":"Metamask snap for Algorand","directories":{},"dependencies":{"nvm":"^0.0.4","async":"^3.2.4","buffer":"^6.0.3","global":"^4.4.0","algosdk":"1.14.0","async.js":"^0.9.5","crypto-js":"^4.1.1","querystring":"^0.2.1","bignumber.js":"^9.1.1","@babel/runtime":"^7.17.2","@metamask/key-tree":"^6.0.0","@metamask/snaps-ui":"^0.29.0","url-search-params-polyfill":"^8.1.1"},"_hasShrinkwrap":false,"devDependencies":{"patch-package":"^6.4.7","@metamask/snaps-cli":"^0.32.2","postinstall-postinstall":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/algorand-metamask-snap_10.0.1_1688072182390_0.4157718205482892","host":"s3://npm-registry-packages"}},"10.0.2":{"name":"@algorandfoundation/algorand-metamask-snap","version":"10.0.2","author":{},"license":"MIT","_id":"@algorandfoundation/algorand-metamask-snap@10.0.2","maintainers":[{"name":"joe-p","email":"joepolny@gmail.com"},{"name":"loedn","email":"alessandro@algorand.foundation"},{"name":"shane-at-algo","email":"shane.mcgovern@algorand.foundation"},{"name":"dev_algorand.foundation","email":"dev+npm@algorand.foundation"}],"dist":{"shasum":"66ba3c848920ba41db16e1c5ce750075d232c450","tarball":"https://registry.npmjs.org/@algorandfoundation/algorand-metamask-snap/-/algorand-metamask-snap-10.0.2.tgz","fileCount":91,"integrity":"sha512-ITaPCN1XsfvPFLJcgg7K89oSXp0tqh2nbeAJPganHE7y/4PLQI9XObaUEoDB8H8gULcXz+Gx3B0kOt+a98f3zg==","signatures":[{"sig":"MEUCIGyOsDtY5+qSQkbKqdEPmYGjvle1DPdf9gHoxpEl81bwAiEAmVGwyXjk9N8qCcScNKf+tGvGqnf55GUoXlanZQWQ5SU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12013285},"main":"src/index.js","scripts":{"test":"yarn build && yarn serve","build":"yarn mm-snap build","postinstall":"patch-package","testUseWallet":"npx mm-snap build && npx mm-snap serve --root=useWalletIntegration_test/"},"_npmUser":{"name":"joe-p","email":"joepolny@gmail.com"},"repository":{"url":"https://github.com/algorandfoundation/algo-metamask","type":"git"},"description":"Snap for interacting with the Algorand ecosystem via Metamask. Algorand is a scalable layer-1 blockchain powered by the Pure Proof-of-Stake consensus mechanism with quick block times and instant finality.","directories":{},"dependencies":{"nvm":"^0.0.4","async":"^3.2.4","buffer":"^6.0.3","global":"^4.4.0","algosdk":"1.14.0","async.js":"^0.9.5","crypto-js":"^4.1.1","querystring":"^0.2.1","bignumber.js":"^9.1.1","@babel/runtime":"^7.17.2","@metamask/key-tree":"^6.0.0","@metamask/snaps-ui":"^0.29.0","url-search-params-polyfill":"^8.1.1"},"_hasShrinkwrap":false,"devDependencies":{"patch-package":"^6.4.7","@metamask/snaps-cli":"^0.32.2","postinstall-postinstall":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/algorand-metamask-snap_10.0.2_1694092882799_0.23404192521955758","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-06-27T21:30:51.184Z","modified":"2026-04-08T12:51:21.648Z","10.0.0":"2023-06-27T21:30:51.587Z","10.0.1":"2023-06-29T20:56:22.670Z","10.0.2":"2023-09-07T13:21:23.130Z"},"author":{},"license":"MIT","repository":{"url":"https://github.com/algorandfoundation/algo-metamask","type":"git"},"description":"Snap for interacting with the Algorand ecosystem via Metamask. Algorand is a scalable layer-1 blockchain powered by the Pure Proof-of-Stake consensus mechanism with quick block times and instant finality.","maintainers":[{"email":"bruno.martins@algorand.foundation","name":"bruno.martins.algorand.foundation"},{"email":"dev+npm@algorand.foundation","name":"dev_algorand.foundation"},{"email":"shane.mcgovern@algorand.foundation","name":"shane-at-algo"},{"email":"joepolny@gmail.com","name":"joe-p"},{"email":"bit@d13.co","name":"bitd13co"},{"email":"kyle.breeding@algorand.foundation","name":"krby"}],"readme":"# SNAPALGO\n\n## ALGORAND on MetaMask\nSnapAlgo is an Algorand wallet built on metamask developmental snaps feature which allows code to be run in a secure execution enviroment inside the metamask extension itself. Because the feature is so new it is currently only available on Metamask Flask which can be found here\n[https://metamask.io/flask/](https://metamask.io/flask/)\n\n## Usage\n### building\n> npx mm-snap build\n\ncompiles the src folder into a functional version of the snap\n### serving\n> npx mm-snap serve\n\nServes index.html on port 3000\n### sdk\nIt is possible to use an sdk to simplify using snapalgo.\n[repository](https://github.com/Kyraview/SnapAlgoSDK)\nThis creates a floating wallet on the dapp for better user experence.\nAs well as creating an easier developer experence by not requiring the\ndeveloper to call raw rpc functions.\n\n### Connect and Install\nAdd and Call the below function to connect to the wallet.\nIf the user does not have the snap installed, but has metamask flask installed this code will automaticly install it for them. **This code snippet can be added to any website with 0 depenancies otheer than metamask flask**\n\n```javascript\nasync function connect () {\n  await window.ethereum.request({\n    method: 'wallet_requestSnaps',\n    params: {\n      'npm:algorand': {},\n    },\n  });\n}\n```\n\n### Calling RPC Methods\nBelow is an example call to the snap that transacts 1000 microalgos to an entered public address. Again this can be run with 0 dependency other than metamask flask\n---\nAll methods can be called with the param:\ntestnet: (bool)\nif the method does not depend on the testnet it is ignored\nif the method can be used with testnet, testnet is then used instead\n---\n```javascript\nconst address = prompt(\"Please enter your recipient Address\");\nconst response = await window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n        method: 'transfer',\n        params: {\n          to: address,\n          amount: 1000,\n          testnet: false\n        }\n    },\n  },\n});\n```\n### Available RPC Methods\n\n---\n## Account functions\nThese functions handle getting infomation about a users account, assets, balance, and history\n---\n\n### displayBalance\nDisplays the users current balance in a metamask flask popup\n\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'displayBalance',\n    },\n  },\n});\n```\n### getBalance\nreturns the users current balance\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'getBalance',\n    },\n  },\n});\n```\n### getAddress\nreturns the public address of the wallet\n```javascript\nlet address = await window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'getAddress',\n    },\n  },\n});\n```\n\n### transfer\ntransfers a number of algos to a specified address\n```javascript\nconst address = prompt(\"Please enter your address\");\nconst response = await window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'transfer',\n      params: {\n        to: address,\n        amount: 1000\n      }\n    },\n  },\n});\n```\n### displayMnemonic\ndisplays the wallets algorand mnemonic in a secure metamask window\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'displayMnemonic'\n    },\n  },\n});\n```\n### getTransactions\nreturns a list of javascript objects containing transaction data\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'getTransactions'\n    },\n  },\n});\n```\n### getAssets\nreturns a list of the current accounts assets\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'getAssets'\n    },\n  },\n});\n```\n### getAccounts\nreturns an object containing all of the algorand accounts on a users metamask\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'getAccounts'\n    },\n  },\n});\n```\n### getCurrentAccount\nreturns the users current Account\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'getCurrentAccount'\n    },\n  },\n});\n```\n### setCurrentAccount\nsets the Users Current Account\ntakes an algorand address as a parameter and throws an error if the address is not contained in the users wallet\nreturns the users current Account\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'setAccount',\n      params: {\n        address: 'address'\n      }\n    },\n  },\n});\n```\n***\n## Arc Complience Functions\nthese functions are used ARC complient ways to sign arbitray transactions\n***\n\n### signTxns\nsign an array of [WalletTransaction](https://arc.algorand.foundation/ARCs/arc-0001) objects\nreturns an array of signed b64 algorand transactions\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'signTxns',\n      params: {\n        txns:[WalletTransaction]\n      }\n    },\n  },\n});\n```\n\n### postTxns\ntakes an array of b64 signed algorand transactions. Like the output of signTxns and sends them to the algorand blockchain.\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'postTxns',\n      params: {\n        stxns: [\"b64SignedTxn\"]\n      }\n    },\n  },\n});\n```\n\n### signAndPostTxns\ntakes an array of [WalletTransaction](https://arc.algorand.foundation/ARCs/arc-0001) objects and signs then posts them to the algorand blockchain\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'signAndPostTxns',\n      params: {\n        txns: [WalletTransaction]\n      }\n    },\n  },\n});\n```\n\n\n***\n## Asset Functions\nthe functions are used to interact with algorand assets\n***\n### assetOptIn\nopts into an algorand asset\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'assetOptIn',\n      params: {\n        assetIndex: int\n      }\n    },\n  },\n});\n```\n\n### assetOptOut\nopts out of an algorand asset\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'assetOptOut',\n      params: {\n        assetIndex: int\n      }\n    },\n  },\n});\n```\n### transferAsset\nsends an algorand asset to another wallet that is opted into the given asset\n```javascript\nawait window.ethereum.request({\n  method: 'wallet_invokeSnap',\n  params: {\n    snapId: 'npm:algorand',\n    request: {\n      method: 'transferAsset',\n      params: {\n        assetIndex: int,\n        to: \"algorandAddress\",\n        amount: string\n      }\n    },\n  },\n});\n```\n\n\n***\n## swapping functions\nThese functions are used to swap crypto between\nAlgorand, Etherum, and Binance Smart Chain\nThe ticker values are\nalgo | eth | bsc\n\n***\n\n### get Minimum\nget minimum input amount for a specific swap\n```javascript\nasync function getMin(){\n  const result = await window.ethereum.request({\n    method: 'wallet_invokeSnap',\n    params: {\n      snapId: 'npm:algorand',\n      request: {\n        method: 'getMin',\n        params: {\n          from: 'eth' | 'bsc' | 'algo',\n          to: 'eth' | 'bsc' | 'algo',\n        }\n      },\n    },\n  });\n\n  return result;\n}\n```\n### preSwap\nGet infomation about a swap without actually swapping\n```javascript\nasync function preSwap(){\n  const result = await window.ethereum.request({\n    method: 'wallet_invokeSnap',\n    params: {\n      snapId: 'npm:algorand',\n      request: {\n        method: 'preSwap',\n        params: {\n          from: 'eth' | 'bsc' | 'algo',\n          to: 'eth' | 'bsc' | 'algo',\n          amount: Number(amount) //done in base units i.e. eth not wei\n        }\n      },\n    },\n  });\n\n  return result;\n}\n```\n\n### swap\nswap currencies\nthis will automatically send send the required currency to the exchange and use the selected address to receive the cash\nuses changenow\n```javascript\nasync function swap(){\n  const result = await window.ethereum.request({\n    method: 'wallet_invokeSnap',\n    params: {\n      snapId: 'npm:algorand',\n      request: {\n        method: 'swap',\n        params: {\n          from: 'eth' | 'bsc' | 'algo',\n          to: 'eth' | 'bsc' | 'algo',\n          amount: Number(amount) //done in base units i.e. eth not wei\n          email: String(\"emailAddress@example.com\") //completely optional\n        }\n      },\n    },\n  });\n\n  return result;\n}\n```\n\n### swapHistory\nthe method returns an array of swap objects that give info about a swap performed by a given wallet.\n```javascript\nasync function swapHistory(){\n  const result = await window.ethereum.request({\n    method: 'wallet_invokeSnap',\n    params: {\n      snapId: 'npm:algorand',\n      request: {\n        method: 'swapHistory',\n      },\n    },\n  });\n\n  return result;\n}\n```\n\n### getSwapStatus\nthis method returns a status object of swap given the swaps id that can be obtained from swap history\n```javascript\nasync function getSwapStatus(){\n  const result = await window.ethereum.request({\n    method: 'wallet_invokeSnap',\n    params: {\n      snapId: 'npm:algorand',\n      request: {\n        method: 'getSwapStatus',\n        params: {\n          id: 'changenowSwapID'\n        }\n      },\n    },\n  });\n\n  return result;\n}\n```\n\nMore RPC methods to come\n","readmeFilename":"README.md"}