Skip to content

Commit

Permalink
Merge pull request #1135 from LimeChain/update-naj-to-v4.0.3
Browse files Browse the repository at this point in the history
perf: Update naj to v4.0.3
  • Loading branch information
Pavel Ivanov authored Jul 19, 2024
2 parents 67ddeb3 + 2c68914 commit 75b449b
Show file tree
Hide file tree
Showing 49 changed files with 6,219 additions and 7,375 deletions.
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ updates:
- dependency-name: "@walletconnect/sign-client"
- dependency-name: "better-sqlite3"
- dependency-name: "big.js"
- dependency-name: "bn.js"
- dependency-name: "buffer"
- dependency-name: "copy-to-clipboard"
- dependency-name: "is-mobile"
Expand All @@ -26,7 +25,6 @@ updates:
- dependency-name: "rxjs"
- dependency-name: "tslib"
- dependency-name: "@types/big.js"
- dependency-name: "@types/bn.js"
- dependency-name: "@types/gh-pages"
- dependency-name: "@types/qrcode"
- dependency-name: "@types/w3c-web-hid"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/out-tsc

# dependencies
/node_modules
node_modules

# IDEs and editors
/.idea
Expand Down
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"eslint.format.enable": true,
"prettier.enable": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint":
true
"source.fixAll.eslint": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib"
}
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ yarn add \
@near-wallet-selector/mintbase-wallet \
@near-wallet-selector/bitte-wallet


# Using NPM.
npm install \
@near-wallet-selector/bitget-wallet \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { WalletSelectorModal } from "@near-wallet-selector/modal-ui-js";
import { CONTRACT_ID } from "../../../constants";
import { WalletSelector } from "@near-wallet-selector/core";
import type { GetAccountBalanceProps } from "../../interfaces/account-balance";
import BN from "bn.js";

const SUGGESTED_DONATION = "0";
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Expand Down Expand Up @@ -67,8 +66,8 @@ export class ContentComponent implements OnInit, OnDestroy {
finality: "final",
account_id: accountId,
});
const bn = new BN(amount);
return { hasBalance: !bn.isZero() };
const bn = BigInt(amount);
return { hasBalance: bn !== BigInt(0) };
} catch {
return { hasBalance: false };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ 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";
import { CONTRACT_ID } from "../../../constants";

declare global {
interface Window {
Expand Down Expand Up @@ -81,8 +82,8 @@ export class WalletSelectorExportComponent implements OnInit {
}),
setupRamperWallet(),
setupNearMobileWallet(),
setupMintbaseWallet({ contractId: "guest-book.testnet" }),
setupBitteWallet({ contractId: "guest-book.testnet" }),
setupMintbaseWallet({ contractId: CONTRACT_ID }),
setupBitteWallet({ contractId: CONTRACT_ID }),
],
});
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ export class WalletSelectorComponent implements OnInit {
}),
setupRamperWallet(),
setupNearMobileWallet(),
setupMintbaseWallet({ contractId: "guest-book.testnet" }),
setupBitteWallet({ contractId: "guest-book.testnet" }),
setupMintbaseWallet({ contractId: CONTRACT_ID }),
setupBitteWallet({ contractId: CONTRACT_ID }),
],
});

Expand Down
5 changes: 2 additions & 3 deletions examples/react/components/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type {
} from "@near-wallet-selector/core";
import { verifyFullKeyBelongsToUser } from "@near-wallet-selector/core";
import { verifySignature } from "@near-wallet-selector/core";
import BN from "bn.js";

import type { Account, Message } from "../interfaces";
import { useWalletSelector } from "../contexts/WalletSelectorContext";
Expand Down Expand Up @@ -42,8 +41,8 @@ const getAccountBalance = async ({
finality: "final",
account_id: accountId,
});
const bn = new BN(amount);
return { hasBalance: !bn.isZero() };
const bn = BigInt(amount);
return { hasBalance: bn !== BigInt(0) };
} catch {
return { hasBalance: false };
}
Expand Down
4 changes: 2 additions & 2 deletions examples/react/contexts/WalletSelectorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export const WalletSelectorContextProvider: React.FC<{
},
}),
setupNearMobileWallet(),
setupMintbaseWallet({ contractId: "guest-book.testnet" }),
setupBitteWallet({ contractId: "guest-book.testnet" }),
setupMintbaseWallet({ contractId: CONTRACT_ID }),
setupBitteWallet({ contractId: CONTRACT_ID }),
],
});
const _modal = setupModal(_selector, {
Expand Down
5 changes: 3 additions & 2 deletions examples/react/contexts/WalletSelectorExportContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ 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 { CONTRACT_ID } from "../constants";

declare global {
interface Window {
Expand Down Expand Up @@ -71,8 +72,8 @@ export const ExportAccountSelectorContextProvider: React.FC<{
setupCoin98Wallet(),
setupNearFi(),
setupRamperWallet(),
setupMintbaseWallet({ contractId: "guest-book.testnet" }),
setupBitteWallet({ contractId: "guest-book.testnet" }),
setupMintbaseWallet({ contractId: CONTRACT_ID }),
setupBitteWallet({ contractId: CONTRACT_ID }),
setupWalletConnect({
projectId: "c4f79cc...",
metadata: {
Expand Down
126 changes: 111 additions & 15 deletions examples/vanillajs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
<body>
<button id="open-walletselector-button">Open wallet selector</button>
</body>
<script async src="https://ga.jspm.io/npm:es-module-shims@1.8.2/dist/es-module-shims.js" crossorigin="anonymous"></script>
<script async src="https://ga.jspm.io/npm:es-module-shims@1.10.0/dist/es-module-shims.js" crossorigin="anonymous"></script>
<script type="importmap">
{
"imports": {
"@near-wallet-selector/core": "https://ga.jspm.io/npm:@near-wallet-selector/core@8.8.0/index.js",
"@near-wallet-selector/here-wallet": "https://ga.jspm.io/npm:@near-wallet-selector/here-wallet@8.8.0/index.js",
"@near-wallet-selector/modal-ui-js": "https://ga.jspm.io/npm:@near-wallet-selector/modal-ui-js@8.8.0/index.js",
"@near-wallet-selector/my-near-wallet": "https://ga.jspm.io/npm:@near-wallet-selector/my-near-wallet@8.8.0/index.js"
"@near-wallet-selector/core": "https://ga.jspm.io/npm:@near-wallet-selector/core@8.9.10/index.js",
"@near-wallet-selector/here-wallet": "https://ga.jspm.io/npm:@near-wallet-selector/here-wallet@8.9.10/index.js",
"@near-wallet-selector/modal-ui-js": "https://ga.jspm.io/npm:@near-wallet-selector/modal-ui-js@8.9.10/index.js",
"@near-wallet-selector/my-near-wallet": "https://ga.jspm.io/npm:@near-wallet-selector/my-near-wallet@8.9.10/index.js"
},
"scopes": {
"https://ga.jspm.io/": {
"@here-wallet/core": "https://ga.jspm.io/npm:@here-wallet/core@1.5.1/build/index.js",
"@here-wallet/core": "https://ga.jspm.io/npm:@here-wallet/core@1.6.6/build/index.js",
"@near-js/accounts": "https://ga.jspm.io/npm:@near-js/accounts@0.1.4/lib/index.js",
"@near-js/crypto": "https://ga.jspm.io/npm:@near-js/crypto@0.0.5/lib/index.js",
"@near-js/keystores": "https://ga.jspm.io/npm:@near-js/keystores@0.0.5/lib/index.js",
Expand All @@ -29,11 +29,16 @@
"@near-js/types": "https://ga.jspm.io/npm:@near-js/types@0.0.4/lib/index.js",
"@near-js/utils": "https://ga.jspm.io/npm:@near-js/utils@0.0.4/lib/index.js",
"@near-js/wallet-account": "https://ga.jspm.io/npm:@near-js/wallet-account@0.0.7/lib/index.js",
"@near-wallet-selector/wallet-utils": "https://ga.jspm.io/npm:@near-wallet-selector/wallet-utils@8.8.0/index.js",
"ajv": "https://ga.jspm.io/npm:ajv@8.12.0/dist/dev.ajv.js",
"@near-wallet-selector/wallet-utils": "https://ga.jspm.io/npm:@near-wallet-selector/wallet-utils@8.9.10/index.js",
"@noble/curves/ed25519": "https://ga.jspm.io/npm:@noble/curves@1.2.0/ed25519.js",
"@noble/hashes/crypto": "https://ga.jspm.io/npm:@noble/hashes@1.3.3/crypto.js",
"@noble/hashes/sha256": "https://ga.jspm.io/npm:@noble/hashes@1.3.3/sha256.js",
"@noble/hashes/sha512": "https://ga.jspm.io/npm:@noble/hashes@1.3.2/sha512.js",
"@noble/hashes/utils": "https://ga.jspm.io/npm:@noble/hashes@1.3.2/utils.js",
"ajv": "https://ga.jspm.io/npm:ajv@8.17.1/dist/dev.ajv.js",
"ajv-formats": "https://ga.jspm.io/npm:ajv-formats@2.1.1/dist/index.js",
"ajv/dist/compile/codegen": "https://ga.jspm.io/npm:ajv@8.12.0/dist/compile/codegen/index.js",
"base-x": "https://ga.jspm.io/npm:base-x@3.0.9/src/index.js",
"ajv/dist/compile/codegen": "https://ga.jspm.io/npm:ajv@8.17.1/dist/compile/codegen/index.js",
"base-x": "https://ga.jspm.io/npm:base-x@3.0.10/src/index.js",
"bn.js": "https://ga.jspm.io/npm:bn.js@5.2.1/lib/bn.js",
"borsh": "https://ga.jspm.io/npm:borsh@0.7.0/lib/index.js",
"bs58": "https://ga.jspm.io/npm:bs58@4.0.1/index.js",
Expand All @@ -50,23 +55,26 @@
"error-polyfill": "https://ga.jspm.io/npm:error-polyfill@0.1.3/index.js",
"events": "https://ga.jspm.io/npm:events@3.3.0/events.js",
"fast-deep-equal": "https://ga.jspm.io/npm:fast-deep-equal@3.1.3/index.js",
"fast-uri": "https://ga.jspm.io/npm:fast-uri@3.0.1/index.js",
"http": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/http.js",
"http-errors": "https://ga.jspm.io/npm:http-errors@1.8.1/index.js",
"https": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/https.js",
"inherits": "https://ga.jspm.io/npm:inherits@2.0.4/inherits_browser.js",
"js-sha256": "https://ga.jspm.io/npm:js-sha256@0.9.0/src/sha256.js",
"json-schema-traverse": "https://ga.jspm.io/npm:json-schema-traverse@1.0.0/index.js",
"lru_map": "https://ga.jspm.io/npm:lru_map@0.4.1/dist/lru.js",
"mustache": "https://ga.jspm.io/npm:mustache@4.2.0/mustache.js",
"near-abi": "https://ga.jspm.io/npm:near-abi@0.1.1/lib/index.js",
"near-api-js": "https://ga.jspm.io/npm:near-api-js@2.1.4/lib/browser-index.js",
"near-api-js/lib/providers": "https://ga.jspm.io/npm:near-api-js@2.1.4/lib/providers/index.js",
"near-api-js/lib/utils": "https://ga.jspm.io/npm:near-api-js@2.1.4/lib/utils/index.js",
"near-api-js/lib/utils/key_pair": "https://ga.jspm.io/npm:near-api-js@2.1.4/lib/utils/key_pair.js",
"near-api-js/lib/utils/serialize": "https://ga.jspm.io/npm:near-api-js@2.1.4/lib/utils/serialize.js",
"near-api-js/lib/providers": "https://ga.jspm.io/npm:near-api-js@3.0.4/lib/providers/index.js",
"near-api-js/lib/utils": "https://ga.jspm.io/npm:near-api-js@3.0.4/lib/utils/index.js",
"near-api-js/lib/utils/key_pair": "https://ga.jspm.io/npm:near-api-js@3.0.4/lib/utils/key_pair.js",
"near-api-js/lib/utils/serialize": "https://ga.jspm.io/npm:near-api-js@3.0.4/lib/utils/serialize.js",
"node-fetch": "https://ga.jspm.io/npm:node-fetch@2.7.0/browser.js",
"o3": "https://ga.jspm.io/npm:o3@1.0.3/index.js",
"process": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/process.js",
"qrcode": "https://ga.jspm.io/npm:qrcode@1.5.3/lib/browser.js",
"randombytes": "https://ga.jspm.io/npm:randombytes@2.1.0/browser.js",
"rxjs": "https://ga.jspm.io/npm:rxjs@7.8.1/dist/esm5/index.js",
"safe-buffer": "https://ga.jspm.io/npm:safe-buffer@5.2.1/index.js",
"setprototypeof": "https://ga.jspm.io/npm:setprototypeof@1.2.0/index.js",
Expand All @@ -75,14 +83,102 @@
"text-encoding-utf-8": "https://ga.jspm.io/npm:text-encoding-utf-8@1.0.2/lib/encoding.lib.js",
"toggle-selection": "https://ga.jspm.io/npm:toggle-selection@1.0.6/index.js",
"toidentifier": "https://ga.jspm.io/npm:toidentifier@1.0.1/index.js",
"tslib": "https://ga.jspm.io/npm:tslib@2.6.2/tslib.es6.mjs",
"tslib": "https://ga.jspm.io/npm:tslib@2.6.3/tslib.es6.mjs",
"tweetnacl": "https://ga.jspm.io/npm:tweetnacl@1.0.3/nacl-fast.js",
"u3": "https://ga.jspm.io/npm:u3@0.1.1/index.js",
"uri-js": "https://ga.jspm.io/npm:uri-js@4.4.1/dist/es5/uri.all.js",
"uuid4": "https://ga.jspm.io/npm:uuid4@2.0.3/browser.mjs"
},
"https://ga.jspm.io/npm:@here-wallet/core@1.6.6/": {
"near-api-js": "https://ga.jspm.io/npm:near-api-js@3.0.4/lib/browser-index.js"
},
"https://ga.jspm.io/npm:@near-js/accounts@1.0.4/": {
"@near-js/crypto": "https://ga.jspm.io/npm:@near-js/crypto@1.2.1/lib/index.js",
"@near-js/providers": "https://ga.jspm.io/npm:@near-js/providers@0.1.1/lib/index.js",
"@near-js/signers": "https://ga.jspm.io/npm:@near-js/signers@0.1.1/lib/index.js",
"@near-js/transactions": "https://ga.jspm.io/npm:@near-js/transactions@1.1.2/lib/index.js",
"@near-js/utils": "https://ga.jspm.io/npm:@near-js/utils@0.1.0/lib/index.js",
"ajv": "https://ga.jspm.io/npm:ajv@8.11.2/dist/dev.ajv.js"
},
"https://ga.jspm.io/npm:@near-js/crypto@1.2.1/": {
"@near-js/utils": "https://ga.jspm.io/npm:@near-js/utils@0.1.0/lib/index.js"
},
"https://ga.jspm.io/npm:@near-js/crypto@1.2.1/_/LX1h3mee.js": {
"@noble/curves/ed25519": "https://ga.jspm.io/npm:@noble/curves@1.2.0/esm/ed25519.js"
},
"https://ga.jspm.io/npm:@near-js/crypto@1.2.1/_/LoRIA3Ec.js": {
"@noble/curves/ed25519": "https://ga.jspm.io/npm:@noble/curves@1.2.0/esm/ed25519.js"
},
"https://ga.jspm.io/npm:@near-js/keystores-browser@0.0.9/": {
"@near-js/crypto": "https://ga.jspm.io/npm:@near-js/crypto@1.2.1/lib/index.js",
"@near-js/keystores": "https://ga.jspm.io/npm:@near-js/keystores@0.0.9/lib/index.js"
},
"https://ga.jspm.io/npm:@near-js/keystores@0.0.9/": {
"@near-js/crypto": "https://ga.jspm.io/npm:@near-js/crypto@1.2.1/lib/index.js"
},
"https://ga.jspm.io/npm:@near-js/providers@0.1.1/": {
"@near-js/transactions": "https://ga.jspm.io/npm:@near-js/transactions@1.1.2/lib/index.js",
"@near-js/utils": "https://ga.jspm.io/npm:@near-js/utils@0.1.0/lib/index.js",
"http-errors": "https://ga.jspm.io/npm:http-errors@1.7.2/index.js",
"node-fetch": "https://ga.jspm.io/npm:node-fetch@2.6.7/browser.js"
},
"https://ga.jspm.io/npm:@near-js/signers@0.1.1/": {
"@near-js/crypto": "https://ga.jspm.io/npm:@near-js/crypto@1.2.1/lib/index.js",
"@near-js/keystores": "https://ga.jspm.io/npm:@near-js/keystores@0.0.9/lib/index.js"
},
"https://ga.jspm.io/npm:@near-js/transactions@1.1.2/": {
"borsh": "https://ga.jspm.io/npm:borsh@1.0.0/lib/cjs/index.js"
},
"https://ga.jspm.io/npm:@near-js/utils@0.1.0/": {
"bs58": "https://ga.jspm.io/npm:bs58@4.0.0/index.js",
"mustache": "https://ga.jspm.io/npm:mustache@4.0.0/mustache.js"
},
"https://ga.jspm.io/npm:@near-js/wallet-account@1.1.1/": {
"@near-js/accounts": "https://ga.jspm.io/npm:@near-js/accounts@1.0.4/lib/index.js",
"@near-js/crypto": "https://ga.jspm.io/npm:@near-js/crypto@1.2.1/lib/index.js",
"@near-js/transactions": "https://ga.jspm.io/npm:@near-js/transactions@1.1.2/lib/index.js",
"@near-js/utils": "https://ga.jspm.io/npm:@near-js/utils@0.1.0/lib/index.js",
"borsh": "https://ga.jspm.io/npm:borsh@1.0.0/lib/cjs/index.js"
},
"https://ga.jspm.io/npm:@noble/curves@1.2.0/esm/ed25519.js": {
"@noble/hashes/sha512": "https://ga.jspm.io/npm:@noble/hashes@1.3.2/esm/sha512.js",
"@noble/hashes/utils": "https://ga.jspm.io/npm:@noble/hashes@1.3.2/esm/utils.js"
},
"https://ga.jspm.io/npm:@noble/hashes@1.3.2/": {
"@noble/hashes/crypto": "https://ga.jspm.io/npm:@noble/hashes@1.3.2/crypto.js"
},
"https://ga.jspm.io/npm:@noble/hashes@1.3.2/esm/_sha2.js": {
"@noble/hashes/crypto": "https://ga.jspm.io/npm:@noble/hashes@1.3.2/esm/crypto.js"
},
"https://ga.jspm.io/npm:@noble/hashes@1.3.2/esm/sha512.js": {
"@noble/hashes/crypto": "https://ga.jspm.io/npm:@noble/hashes@1.3.2/esm/crypto.js"
},
"https://ga.jspm.io/npm:@noble/hashes@1.3.2/esm/utils.js": {
"@noble/hashes/crypto": "https://ga.jspm.io/npm:@noble/hashes@1.3.2/esm/crypto.js"
},
"https://ga.jspm.io/npm:bs58@4.0.0/": {
"base-x": "https://ga.jspm.io/npm:base-x@2.0.6/index.js"
},
"https://ga.jspm.io/npm:http-errors@1.7.2/": {
"depd": "https://ga.jspm.io/npm:depd@1.1.2/lib/browser/index.js",
"inherits": "https://ga.jspm.io/npm:inherits@2.0.3/inherits_browser.js",
"setprototypeof": "https://ga.jspm.io/npm:setprototypeof@1.1.1/index.js",
"toidentifier": "https://ga.jspm.io/npm:toidentifier@1.0.0/index.js"
},
"https://ga.jspm.io/npm:http-errors@1.8.1/": {
"depd": "https://ga.jspm.io/npm:depd@1.1.2/lib/browser/index.js"
},
"https://ga.jspm.io/npm:near-api-js@3.0.4/": {
"@near-js/accounts": "https://ga.jspm.io/npm:@near-js/accounts@1.0.4/lib/index.js",
"@near-js/crypto": "https://ga.jspm.io/npm:@near-js/crypto@1.2.1/lib/index.js",
"@near-js/keystores": "https://ga.jspm.io/npm:@near-js/keystores@0.0.9/lib/index.js",
"@near-js/keystores-browser": "https://ga.jspm.io/npm:@near-js/keystores-browser@0.0.9/lib/index.js",
"@near-js/providers": "https://ga.jspm.io/npm:@near-js/providers@0.1.1/lib/index.js",
"@near-js/signers": "https://ga.jspm.io/npm:@near-js/signers@0.1.1/lib/index.js",
"@near-js/transactions": "https://ga.jspm.io/npm:@near-js/transactions@1.1.2/lib/index.js",
"@near-js/utils": "https://ga.jspm.io/npm:@near-js/utils@0.1.0/lib/index.js",
"@near-js/wallet-account": "https://ga.jspm.io/npm:@near-js/wallet-account@1.1.1/lib/index.js",
"borsh": "https://ga.jspm.io/npm:borsh@1.0.0/lib/cjs/index.js"
}
}
}
Expand Down
Loading

0 comments on commit 75b449b

Please sign in to comment.