-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(3416039642): Add "Connect Wallet" functionality (#32)
- Loading branch information
1 parent
9a64077
commit 45c28dd
Showing
23 changed files
with
667 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
REACT_APP_PG_SERVICE_URL=http://localhost:8081/data.json | ||
REACT_APP_AUTO_CONNECT=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
REACT_APP_PG_SERVICE_URL=https://2uuf49xjkk.execute-api.us-east-2.amazonaws.com/prod/cairo | ||
REACT_APP_STARKNET_ALPHA_SERVICE_URL=https://alpha4.starknet.io | ||
REACT_APP_SHARP_SERVICE_URL=https://testnet.provingservice.io | ||
REACT_APP_AUTO_CONNECT=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
REACT_APP_PG_SERVICE_URL=https://vu00h9m96c.execute-api.us-east-2.amazonaws.com/staging/cairo-staging | ||
REACT_APP_STARKNET_ALPHA_SERVICE_URL=https://alpha4.starknet.io | ||
REACT_APP_SHARP_SERVICE_URL=https://testnet.provingservice.io | ||
REACT_APP_AUTO_CONNECT=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,5 +42,9 @@ | |
|
||
.right { | ||
float: right; | ||
|
||
& button { | ||
margin-left: 6px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/components/Features/StarknetWalletButton/StarknetWalletButton.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
WalletButton, | ||
useStarknetWallet | ||
} from '@starkware-industries/commons-js-components'; | ||
import { | ||
ChainInfo, | ||
ChainTypeL2, | ||
NetworkType | ||
} from '@starkware-industries/commons-js-enums'; | ||
import {evaluate} from '@starkware-industries/commons-js-utils'; | ||
import React from 'react'; | ||
import {addAddressPadding} from 'starknet'; | ||
import {CONTRACT_URL} from '../../../constants/links'; | ||
import styles from './StarknetWalletButton.module.scss'; | ||
|
||
export const StarknetWalletButton = () => { | ||
const {account, config, error, status, connect, disconnect} = | ||
useStarknetWallet(); | ||
|
||
return ( | ||
<div className={styles.starknetWalletButton}> | ||
<WalletButton | ||
account={addAddressPadding(account)} | ||
chain={ChainInfo.L2[ChainTypeL2.GOERLI].NAME} | ||
error={error} | ||
logoPath={config?.logoPath || ''} | ||
menuOptions={{ | ||
enable: true, | ||
explorerUrl: evaluate(`${CONTRACT_URL}{{account}}`, { | ||
account | ||
}), | ||
onDisconnect: disconnect | ||
}} | ||
network={NetworkType.L2} | ||
status={status} | ||
onClick={connect} | ||
/> | ||
</div> | ||
); | ||
}; |
11 changes: 11 additions & 0 deletions
11
src/components/Features/StarknetWalletButton/StarknetWalletButton.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@import '../../../index'; | ||
|
||
.starknetWalletButton { | ||
display: inline-flex; | ||
flex-direction: row; | ||
|
||
button, | ||
div { | ||
font: $--button1-font; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const PG_SERVICE_URL = process.env.REACT_APP_PG_SERVICE_URL; | ||
export const STARKNET_ALPHA_SERVICE_URL = | ||
process.env.REACT_APP_STARKNET_ALPHA_SERVICE_URL; | ||
export const SHARP_SERVICE_URL = | ||
process.env.REACT_APP_SHARP_SERVICE_URL; | ||
export const AUTO_CONNECT = | ||
process.env.REACT_APP_AUTO_CONNECT === 'true'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const CONTRACT_URL = 'https://testnet.starkscan.co/contract/'; | ||
export const TX_URL = 'https://testnet.starkscan.co/tx/'; |
Oops, something went wrong.