{"_id":"@bananahq/react-native-sdk","name":"@bananahq/react-native-sdk","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@bananahq/react-native-sdk","version":"0.0.1","description":"React Native SDK for Banana Wallet","main":"lib/commonjs/index","module":"lib/module/index","types":"lib/typescript/index.d.ts","react-native":"src/index","source":"src/index","scripts":{"test":"jest","typecheck":"tsc --noEmit","lint":"eslint \"**/*.{js,ts,tsx}\"","prepack":"bob build","release":"release-it","example":"yarn --cwd example","bootstrap":"yarn example && yarn install && yarn example pods","clean":"del-cli android/build example/android/build example/android/app/build example/ios/build"},"keywords":["react-native","ios","android"],"repository":{"type":"git","url":"git+https://github.com/Banana-Wallet/banana-rn-sdk.git"},"author":{"name":"Banana SDK"},"license":"MIT","bugs":{"url":"https://github.com/Banana-Wallet/banana-rn-sdk/issues"},"homepage":"https://github.com/Banana-Wallet/banana-rn-sdk#readme","publishConfig":{"registry":"https://registry.npmjs.org/"},"dependencies":{"@account-abstraction/contracts":"^0.6.0","@account-abstraction/sdk":"^0.6.0","@ethersproject/abi":"^5.7.0","@ethersproject/providers":"^5.7.2","@ethersproject/shims":"^5.7.0","@ethersproject/signing-key":"^5.7.0","asn1.js":"^5.4.1","axios":"^1.3.1","buffer":"^6.0.3","crypto-browserify":"^3.12.0","ethers":"^5.7.2","typescript":"^4.9.5","uuid":"^9.0.0"},"devDependencies":{"@evilmartians/lefthook":"^1.2.2","@commitlint/config-conventional":"^17.0.2","@react-native-community/eslint-config":"^3.0.2","@release-it/conventional-changelog":"^5.0.0","@types/jest":"^28.1.2","@types/react":"~17.0.21","@types/react-native":"0.70.0","commitlint":"^17.0.2","del-cli":"^5.0.0","eslint":"^8.4.1","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","jest":"^28.1.1","pod-install":"^0.1.0","prettier":"^2.0.5","react":"18.2.0","react-native":"0.71.8","react-native-builder-bob":"^0.20.0","release-it":"^15.0.0","typescript":"^4.5.2","@types/chai":"^4.3.4","@types/chai-as-promised":"^7.1.5","@types/jsdom":"^21.1.0","@types/mocha":"^10.0.1","@types/node":"^18.11.18","@types/sinon":"^10.0.13","@types/uuid":"^9.0.0","chai":"^4.3.7","chai-as-promised":"^7.1.1","javascript-obfuscator":"^4.0.0","jsdom":"^21.1.0","mocha":"^10.2.0","sinon":"^15.0.1","uglify-js":"^3.17.4"},"resolutions":{"@types/react":"17.0.21"},"peerDependencies":{"react":"*","react-native":"*"},"engines":{"node":">= 16.0.0"},"packageManager":"^yarn@1.22.15","jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"commitlint":{"extends":["@commitlint/config-conventional"]},"release-it":{"git":{"commitMessage":"chore: release ${version}","tagName":"v${version}"},"npm":{"publish":true},"github":{"release":true},"plugins":{"@release-it/conventional-changelog":{"preset":"angular"}}},"eslintConfig":{"root":true,"extends":["@react-native-community","prettier"],"rules":{"prettier/prettier":["error",{"quoteProps":"consistent","singleQuote":true,"tabWidth":2,"trailingComma":"es5","useTabs":false}]}},"eslintIgnore":["node_modules/","lib/"],"prettier":{"quoteProps":"consistent","singleQuote":true,"tabWidth":2,"trailingComma":"es5","useTabs":false},"react-native-builder-bob":{"source":"src","output":"lib","targets":["commonjs","module",["typescript",{"project":"tsconfig.build.json"}]]},"gitHead":"0d0680aafe3a9611f450119bde49690c17d44de3","_id":"@bananahq/react-native-sdk@0.0.1","_nodeVersion":"18.0.0","_npmVersion":"8.6.0","dist":{"integrity":"sha512-6dt8gq8o9AzEvzQo8FrREIbtjNn/q4tfs1I3cmF+M4rkiuBbQz13tlfw8fP7QL7w8UXsBNiprt4ZaeBdNY++eQ==","shasum":"293a7244e4467ccb7129ed70d1c961c3073f5e14","tarball":"https://registry.npmjs.org/@bananahq/react-native-sdk/-/react-native-sdk-0.0.1.tgz","fileCount":892,"unpackedSize":4395149,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG+DCHdYQh9GxOTw8VlGzUNSpSY0uvZKOl+WRNucn5q6AiAt5qIa7ImWebfnjVfWIBFuQCD5TgGKZK0V99LV7AUzpA=="}]},"_npmUser":{"name":"creator5923","email":"nlokhande5923@gmail.com"},"directories":{},"maintainers":[{"name":"creator5923","email":"nlokhande5923@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-sdk_0.0.1_1689326706181_0.9757018724338447"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-14T09:25:06.026Z","0.0.1":"2023-07-14T09:25:06.500Z","modified":"2023-07-14T09:25:06.934Z"},"maintainers":[{"name":"creator5923","email":"nlokhande5923@gmail.com"}],"description":"React Native SDK for Banana Wallet","homepage":"https://github.com/Banana-Wallet/banana-rn-sdk#readme","keywords":["react-native","ios","android"],"repository":{"type":"git","url":"git+https://github.com/Banana-Wallet/banana-rn-sdk.git"},"author":{"name":"Banana SDK"},"bugs":{"url":"https://github.com/Banana-Wallet/banana-rn-sdk/issues"},"license":"MIT","readme":"# Banana wallet\n\nthis is the react native sdk for Banana Wallet\n\n## Installation\n\nInstall NPM package\n\n```sh\nnpm install react-native-aa-wallet --save\n```\n\nIOS\n\n```sh\ncd ios\npod install\n```\n\n## Usage\n\nHere's how to create app's deeplink: [android](https://developer.android.com/training/app-links/deep-linking), [ios](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app)\n\n- Import Banana, Chains from react-native-aa-wallet\n- Use your app's deeplink to initialize bananaInstance\n\n```js\nimport { Banana, Chains } from 'react-native-aa-wallet';\n\nconst APP_DEEPLINK = \"<Your app's deeplink>\";\nconst bananaInstance = new Banana(Chains.mumbai, APP_DEEPLINK);\nconst name = await bananaInstance.getWalletName();\n```\n\nCheck if there's an existing wallet in the device before connecting it\n\n```js\nconst name = await bananaInstance.getWalletName();\n\nif (name) {\n  const walletInstance = await bananaInstance.connectWallet(name);\n  const walletAddress = await walletInstance.getAddress();\n} else {\n  // create new wallet\n}\n```\n\nCreate a new wallet\n\n- Use bananaInstance to create wallet\n\n```js\nconst createNewBananaWallet = async () => {\n  try {\n    const walletInstance = await bananaInstance.createWallet();\n    const walletAddress = await walletInstance.getAddress();\n    console.log('Created new wallet', walletAddress);\n    // setBananaWallet(walletInstance);\n  } catch (err) {\n    console.log(err);\n  }\n};\n\nexport default Home;\n```\n\nGet signer for connected wallet\n\n```js\nconst signer = await walletInstance.getSigner();\n\n// get wallet balance\nconst walletEthBalance = signer.getBalance();\n```\n\nCreate a transaction\n\n```js\nconst createTransaction = async () => {\n  try {\n    setLoadingStake(true);\n    const abi = [\n      {\n        inputs: [],\n        name: 'returnStake',\n        outputs: [],\n        stateMutability: 'nonpayable',\n        type: 'function',\n      },\n      {\n        inputs: [],\n        name: 'stake',\n        outputs: [],\n        stateMutability: 'payable',\n        type: 'function',\n      },\n    ];\n    const signer = bananaWallet?.getSigner();\n    const stakeAddress = '0x8b370128A84bc2Df7fF4813675e294b1ae816178';\n    const tx = {\n      gasLimit: '0x55555',\n      to: stakeAddress,\n      value: ethers.utils.parseEther('100'),\n      data: new ethers.utils.Interface(abi).encodeFunctionData('stake', []),\n    };\n    const txn = await signer?.sendTransaction(tx);\n    console.log('transaction', txn);\n  } catch (error) {}\n};\n```\n\n# Setup example project\n\nWe also have an example react-native app for testing\n\n- Checkout example directory\n- To setup react native project follow the instructions [here](https://reactnative.dev/docs/environment-setup) or do the following\n- npm install\n\n```sh\ncd example\nnpm i\n```\n\n- Install cocoapods\n\n```sh\nbrew install cocoapods\nbrew install node\nbrew install watchman\n```\n\n- Install Android studio and Xcode for setting up build environment\n- For ios install pods\n\n```sh\ncd ios\npod install\n```\n\nWallet SDK will not work in ios simulator or andriod emulator, so connect real device to test the app.\n\nFor iOS:\n\n- Open the ios folder of example app directory in Xcode\n- Connect your iPhone through cable and open Xcode, select your iPhone from the available devices\n- Go to Signing & Capabilities from project navigator and select your icloud account in the team dropdown\n- Create a test build in your device\n\nfor Android:\n\n- Open android folder od example directory in Android Studio\n- Connect your android device\n- Select your device from the dropdown and create a test build\n","readmeFilename":"README.md"}