Skip to content

Commit

Permalink
fix: send tip modal (#1781)
Browse files Browse the repository at this point in the history
- downgrade near api js
- modal send tip clear before authentication to near
  • Loading branch information
rubenkristian authored Mar 26, 2023
1 parent 08e86f0 commit d986045
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"lodash": "^4.17.21",
"millify": "^4.0.0",
"mux.js": "^6.0.1",
"near-api-js": "^1.1.0",
"near-api-js": "^0.44.2",
"next": "latest",
"next-auth": "4.10.3",
"next-http-proxy-middleware": "^1.2.4",
Expand Down
8 changes: 7 additions & 1 deletion src/components/common/SendTipButton/SendTipButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import ShowIf from '../show-if.component';
import { useStyles } from './SendTipButton.style';

import { COOKIE_INSTANCE_URL } from 'components/SelectServer';
import * as nearAPI from 'near-api-js';
import { PromptComponent } from 'src/components/atoms/Prompt/prompt.component';
import { useUserHook } from 'src/hooks/use-user.hook';
import { Comment } from 'src/interfaces/comment';
Expand Down Expand Up @@ -227,6 +228,8 @@ export const SendTipButton: React.FC<SendTipButtonProps> = props => {
variant="contained"
color="primary"
onClick={async () => {
const keyStore =
new nearAPI.keyStores.BrowserLocalStorageKeyStore();
const network = networks.find(
network => network.id === NetworkIdEnum.NEAR,
);
Expand All @@ -242,7 +245,10 @@ export const SendTipButton: React.FC<SendTipButtonProps> = props => {
failureUrl: publicRuntimeConfig.appAuthURL + router.asPath,
};

await wallet.requestSignIn(signInOptions);
await Promise.all([
keyStore.clear(),
wallet.requestSignIn(signInOptions),
]);
}}>
{i18n.t('Tipping.Prompt_Near.Btn.Right')}
</Button>
Expand Down
22 changes: 11 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7766,7 +7766,7 @@ bluebird@^3.3.5, bluebird@^3.5.5:
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f"
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==

bn.js@5.2.1, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.1, bn.js@^5.2.0, bn.js@^5.2.1:
bn.js@5.2.0, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.1, bn.js@^5.2.0, bn.js@^5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70"
integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==
Expand All @@ -7792,10 +7792,10 @@ boolbase@^1.0.0:
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=

borsh@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.7.0.tgz#6e9560d719d86d90dc589bca60ffc8a6c51fec2a"
integrity sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==
borsh@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.6.0.tgz#a7c9eeca6a31ca9e0607cb49f329cb659eb791e1"
integrity sha512-sl5k89ViqsThXQpYa9XDtz1sBl3l1lI313cFUY1HKr+wvMILnb+58xpkqTNrYbelh99dY7K8usxoCusQmqix9Q==
dependencies:
bn.js "^5.2.0"
bs58 "^4.0.0"
Expand Down Expand Up @@ -14519,13 +14519,13 @@ natural-compare@^1.4.0:
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=

near-api-js@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/near-api-js/-/near-api-js-1.1.0.tgz#907e807f052c1f043c6fbf28f61872de3c02235a"
integrity sha512-qYKv1mYsaDZc2uYndhS+ttDhR9+60qFc+ZjD6lWsAxr3ZskMjRwPffDGQZYhC7BRDQMe1HEbk6d5mf+TVm0Lqg==
near-api-js@^0.44.2:
version "0.44.2"
resolved "https://registry.yarnpkg.com/near-api-js/-/near-api-js-0.44.2.tgz#e451f68f2c56bd885c7b918db5818a3e6e9423d0"
integrity sha512-eMnc4V+geggapEUa3nU2p8HSHn/njtloI4P2mceHQWO8vDE1NGpnAw8FuTBrLmXSgIv9m6oocgFc9t3VNf5zwg==
dependencies:
bn.js "5.2.1"
borsh "^0.7.0"
bn.js "5.2.0"
borsh "^0.6.0"
bs58 "^4.0.0"
depd "^2.0.0"
error-polyfill "^0.1.3"
Expand Down

0 comments on commit d986045

Please sign in to comment.