Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to bitte wallet #1123

Merged
merged 5 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ NEAR Wallet Selector makes it easy for users to interact with your dApp by provi

- [My NEAR Wallet](https://www.npmjs.com/package/@near-wallet-selector/my-near-wallet) - Browser wallet.
- [Mintbase Wallet](https://www.npmjs.com/package/@near-wallet-selector/mintbase-wallet) - Browser wallet.
- [Bitte Wallet](https://www.npmjs.com/package/@near-wallet-selector/bitte-wallet) - Browser wallet.
- [Ledger](https://www.npmjs.com/package/@near-wallet-selector/ledger) - Hardware wallet.
- [Sender](https://www.npmjs.com/package/@near-wallet-selector/sender) - Injected wallet.
- [Math Wallet](https://www.npmjs.com/package/@near-wallet-selector/math-wallet) - Injected wallet.
Expand Down Expand Up @@ -72,10 +73,11 @@ yarn add \
@near-wallet-selector/neth \
@near-wallet-selector/xdefi \
@near-wallet-selector/ramper-wallet \
@near-wallet-selector/mintbase-wallet \
@near-wallet-selector/near-mobile-wallet \
@near-wallet-selector/near-mobile-wallet \
@near-wallet-selector/bitget-wallet \
@near-wallet-selector/okx-wallet
@near-wallet-selector/okx-wallet \
@near-wallet-selector/mintbase-wallet \
@near-wallet-selector/bitte-wallet

sainthiago marked this conversation as resolved.
Show resolved Hide resolved
sainthiago marked this conversation as resolved.
Show resolved Hide resolved
# Using NPM.
npm install \
Expand All @@ -98,9 +100,10 @@ npm install \
@near-wallet-selector/xdefi \
@near-wallet-selector/ramper-wallet \
@near-wallet-selector/near-mobile-wallet \
@near-wallet-selector/mintbase-wallet \
@near-wallet-selector/bitget-wallet \
@near-wallet-selector/okx-wallet
@near-wallet-selector/okx-wallet \
@near-wallet-selector/mintbase-wallet \
@near-wallet-selector/bitte-wallet
```

Optionally, you can install our [`modal-ui`](https://www.npmjs.com/package/@near-wallet-selector/modal-ui) or [`modal-ui-js`](https://www.npmjs.com/package/@near-wallet-selector/modal-ui-js) package for a pre-built interface that wraps the `core` API and presents the supported wallets:
Expand Down Expand Up @@ -139,6 +142,7 @@ import { setupXDEFI } from "@near-wallet-selector/xdefi";
import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";
import { setupMintbaseWallet } from "@near-wallet-selector/mintbase-wallet";
import { setupBitteWallet } from "@near-wallet-selector/bitte-wallet";

const selector = await setupWalletSelector({
network: "testnet",
Expand Down Expand Up @@ -174,7 +178,13 @@ const selector = await setupWalletSelector({
walletUrl: "https://wallet.mintbase.xyz",
callbackUrl: "https://www.mywebsite.com",
deprecated: false,
}),
}),
setupBitteWallet({
networkId: "mainnet",
walletUrl: "https://wallet.bitte.ai",
callbackUrl: "https://www.mywebsite.com",
deprecated: false,
}),
],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";
import { setupLedger } from "@near-wallet-selector/ledger";
import { setupMintbaseWallet } from "@near-wallet-selector/mintbase-wallet";
import { setupBitteWallet } from "@near-wallet-selector/bitte-wallet";

declare global {
interface Window {
Expand Down Expand Up @@ -81,6 +82,7 @@ export class WalletSelectorExportComponent implements OnInit {
setupRamperWallet(),
setupNearMobileWallet(),
setupMintbaseWallet({ contractId: "guest-book.testnet" }),
setupBitteWallet({ contractId: "guest-book.testnet" }),
],
});
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupLedger } from "@near-wallet-selector/ledger";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";
import { setupMintbaseWallet } from "@near-wallet-selector/mintbase-wallet";
import { setupBitteWallet } from "@near-wallet-selector/bitte-wallet";
import { setupOKXWallet } from "@near-wallet-selector/okx-wallet";
import { CONTRACT_ID } from "../../../constants";

Expand Down Expand Up @@ -95,6 +96,7 @@ export class WalletSelectorComponent implements OnInit {
setupRamperWallet(),
setupNearMobileWallet(),
setupMintbaseWallet({ contractId: "guest-book.testnet" }),
setupBitteWallet({ contractId: "guest-book.testnet" }),
],
});

Expand Down
2 changes: 2 additions & 0 deletions examples/react/contexts/WalletSelectorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { setupXDEFI } from "@near-wallet-selector/xdefi";
import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";
import { setupMintbaseWallet } from "@near-wallet-selector/mintbase-wallet";
import { setupBitteWallet } from "@near-wallet-selector/bitte-wallet";
import { setupOKXWallet } from "@near-wallet-selector/okx-wallet";

import type { ReactNode } from "react";
Expand Down Expand Up @@ -97,6 +98,7 @@ export const WalletSelectorContextProvider: React.FC<{
}),
setupNearMobileWallet(),
setupMintbaseWallet({ contractId: "guest-book.testnet" }),
setupBitteWallet({ contractId: "guest-book.testnet" }),
],
});
const _modal = setupModal(_selector, {
Expand Down
2 changes: 2 additions & 0 deletions examples/react/contexts/WalletSelectorExportContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { setupLedger } from "@near-wallet-selector/ledger";
import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";
import { setupMintbaseWallet } from "@near-wallet-selector/mintbase-wallet";
import { setupBitteWallet } from "@near-wallet-selector/bitte-wallet";

declare global {
interface Window {
Expand Down Expand Up @@ -71,6 +72,7 @@ export const ExportAccountSelectorContextProvider: React.FC<{
setupNearFi(),
setupRamperWallet(),
setupMintbaseWallet({ contractId: "guest-book.testnet" }),
setupBitteWallet({ contractId: "guest-book.testnet" }),
setupWalletConnect({
projectId: "c4f79cc...",
metadata: {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"ramper-wallet",
"near-mobile-wallet",
"mintbase-wallet",
"bitte-wallet",
"okx-wallet"
],
"homepage": "https://github.com/near/wallet-selector#README",
Expand Down Expand Up @@ -65,6 +66,7 @@
"build:ramper-wallet": "nx run-many --target=build --projects=ramper-wallet --configuration=production",
"build:near-mobile-wallet": "nx run-many --target=build --projects=near-mobile-wallet --configuration=production",
"build:mintbase-wallet": "nx run-many --target=build --projects=mintbase-wallet --configuration=production",
"build:bitte-wallet": "nx run-many --target=build --projects=bitte-wallet --configuration=production",
"build:okx-wallet": "nx run-many --target=build --projects=okx-wallet --configuration=production",
"examples:vanillajs:generateimportmap": "(cd examples/vanillajs && jspm link index.html -o index.html)",
"serve:vanillajs": "yarn examples:vanillajs:generateimportmap && http-server -c-1 examples/vanillajs",
Expand Down Expand Up @@ -92,7 +94,7 @@
"@ledgerhq/hw-transport-webhid": "6.28.3",
"@metamask/detect-provider": "^2.0.0",
"@meteorwallet/sdk": "^1.0.9",
"@mintbase-js/wallet": "0.6.0-beta.3",
"@mintbase-js/wallet": "v0.6.0-beta.7",
"@near-snap/sdk": "^0.6.0",
"@peersyst/near-mobile-signer": "^1.0.10",
"@ramper/near": "^0.0.30",
Expand Down
10 changes: 10 additions & 0 deletions packages/bitte-wallet/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": [
[
"@nrwl/js/babel",
{
"useBuiltIns": "usage"
}
]
]
}
18 changes: 18 additions & 0 deletions packages/bitte-wallet/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
55 changes: 55 additions & 0 deletions packages/bitte-wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# @near-wallet-selector/bitte-wallet

This is the [Bitte Wallet](https://wallet.bitte.ai) package for NEAR Wallet Selector.

## Installation and Usage

The easiest way to use this package is to install it from the NPM registry, this package requires `near-api-js` v1.0.0 or above:

```bash
# Using Yarn
yarn add near-api-js

# Using NPM.
npm install near-api-js
```
```bash
# Using Yarn
yarn add @near-wallet-selector/bitte-wallet

# Using NPM.
npm install @near-wallet-selector/bitte-wallet
```

Then use it in your dApp:

```ts
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupBitteWallet } from "@near-wallet-selector/bitte-wallet";

const bitteWallet = setupBitteWallet({
networkId: 'mainnet',
walletUrl: 'https://wallet.bitte.ai',
callbackUrl: 'https://www.mywebsite.com',
contractId: "yourcontract.near", //remove if you don't want limited access keys to be generated
deprecated: false,
});

const selector = await setupWalletSelector({
network: "testnet",
modules: [bitteWallet],
});
```

## Options

- `networkId`: (`string?`): 'mainnet' or 'testnet' . Defaults to `mainnet`.
- `deprecated`: (`boolean?`): Deprecated is optional. Default is `false`.
- `callbackUrl`: (`string?`): Valid url to send your user after txn.
- `walletUrl`: (`string?`): wallet url: https://wallet.bitte.ai for mainnet and https://testnet.wallet.bitte.ai for testnet.
- `contractId`: (`string?`): the contract for which the generated limited access key will allow transactions, if you do not need a limited access key do not add this and it wont be created providing quicker onboarding


## License

This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
14 changes: 14 additions & 0 deletions packages/bitte-wallet/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
displayName: "bitte-wallet",
preset: "../../jest.preset.js",
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json",
},
},
transform: {
"^.+\\.[tj]sx?$": "ts-jest",
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
coverageDirectory: "../../coverage/packages/bitte-wallet",
};
16 changes: 16 additions & 0 deletions packages/bitte-wallet/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable */
export default {
displayName: "bitte-wallet",
preset: "../../jest.preset.js",
globals: {},
transform: {
"^.+\\.[tj]s$": [
"ts-jest",
{
tsconfig: "<rootDir>/tsconfig.spec.json",
},
],
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
coverageDirectory: "../../coverage/packages/bitte-wallet",
};
27 changes: 27 additions & 0 deletions packages/bitte-wallet/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@near-wallet-selector/bitte-wallet",
"version": "8.9.10",
"description": "Bitte wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
"blockchain",
"wallets",
"dapps",
"near-protocol",
"near-blockchain",
"wallet selector",
"browser wallet",
"bitte wallet"
],
"repository": {
"type": "git",
"url": "https://github.com/near/wallet-selector.git"
},
"bugs": {
"url": "https://github.com/near/wallet-selector/issues"
},
"homepage": "https://github.com/near/wallet-selector/tree/main/packages/bitte-wallet",
"peerDependencies": {
"near-api-js": "^1.0.0 || ^2.0.0"
}
}
56 changes: 56 additions & 0 deletions packages/bitte-wallet/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "bitte-wallet",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/bitte-wallet/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/rollup:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/bitte-wallet",
"tsConfig": "packages/bitte-wallet/tsconfig.lib.json",
"project": "packages/bitte-wallet/package.json",
"entryFile": "packages/bitte-wallet/src/index.ts",
"buildableProjectDepsInPackageJsonType": "dependencies",
"compiler": "babel",
"format": ["esm", "cjs"],
"assets": [
{
"glob": "packages/bitte-wallet/README.md",
"input": ".",
"output": "."
},
{
"glob": "packages/bitte-wallet/assets/*",
"input": ".",
"output": "assets"
}
]
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/bitte-wallet/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/packages/bitte-wallet"],
"options": {
"jestConfig": "packages/bitte-wallet/jest.config.ts",
"passWithNoTests": true
}
},
"deploy": {
"executor": "ngx-deploy-npm:deploy",
"options": {
"access": "public"
},
"dependsOn": ["^deploy"]
}
},
"tags": ["browser-wallet"]
}
3 changes: 3 additions & 0 deletions packages/bitte-wallet/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { setupBitteWallet } from "@mintbase-js/wallet";

export { setupBitteWallet };
20 changes: 20 additions & 0 deletions packages/bitte-wallet/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/bitte-wallet/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": []
},
"include": ["**/*.ts"],
"exclude": ["jest.config.ts", "**/*.spec.ts"]
}
9 changes: 9 additions & 0 deletions packages/bitte-wallet/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
}
Loading
Loading