-
Notifications
You must be signed in to change notification settings - Fork 50
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
feat(wallets): Add sanchonet wallet option #2937
Merged
michaeljscript
merged 12 commits into
feature/governance
from
feat/sanchonet-integration
Dec 12, 2023
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
03d5ec7
feat(wallets): Add sanchonet wallet option
michaeljscript 64aa8ce
Refactor
michaeljscript 985c244
Update endpoints
michaeljscript 8bd5f85
Fix imports
michaeljscript fe307cd
Fix build issues
michaeljscript 5ee6c27
Use prod sanchonet url
michaeljscript c95c3fa
Hide links and fix storage
michaeljscript 53994a9
Fix rerender
michaeljscript 1c0a605
Fix network id
michaeljscript cf17cee
Introduce isMainnetNetworkId helper
michaeljscript 0302cd7
Fix rerender
michaeljscript f606afd
Update HomeScreen.tsx
michaeljscript File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -11,6 +11,8 @@ type Props = { | |
onSubmit?: (drepId: string) => void | ||
} | ||
|
||
const FIND_DREPS_LINK = '' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Links will be hidden until we have them ready YOMO-1025 |
||
|
||
export const EnterDrepIdModal = ({onSubmit}: Props) => { | ||
const strings = useStrings() | ||
const [drepId, setDrepId] = useState('') | ||
|
@@ -22,8 +24,7 @@ export const EnterDrepIdModal = ({onSubmit}: Props) => { | |
} | ||
|
||
const onLinkPress = () => { | ||
// TODO: Add link to DREPs | ||
Linking.openURL('https://google.com') | ||
Linking.openURL(FIND_DREPS_LINK) | ||
} | ||
|
||
return ( | ||
|
@@ -32,11 +33,15 @@ export const EnterDrepIdModal = ({onSubmit}: Props) => { | |
|
||
<Text style={styles.text}>{strings.enterDRepID}</Text> | ||
|
||
<Spacer height={24} /> | ||
{FIND_DREPS_LINK.length > 0 && ( | ||
<> | ||
<Spacer height={24} /> | ||
|
||
<Text style={[styles.text, styles.link]} onPress={onLinkPress}> | ||
{strings.findDRepHere} | ||
</Text> | ||
<Text style={[styles.text, styles.link]} onPress={onLinkPress}> | ||
{strings.findDRepHere} | ||
</Text> | ||
</> | ||
)} | ||
|
||
<Spacer height={24} /> | ||
|
||
|
@@ -48,7 +53,7 @@ export const EnterDrepIdModal = ({onSubmit}: Props) => { | |
errorText={error?.message} | ||
/> | ||
|
||
<Spacer height={24} /> | ||
<Spacer fill /> | ||
|
||
<Button | ||
title={strings.confirm} | ||
|
@@ -57,7 +62,7 @@ export const EnterDrepIdModal = ({onSubmit}: Props) => { | |
onPress={onPress} | ||
/> | ||
|
||
<Spacer height={44} /> | ||
<Spacer height={24} /> | ||
</View> | ||
) | ||
} | ||
|
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
108 changes: 108 additions & 0 deletions
108
apps/wallet-mobile/src/yoroi-wallets/cardano/constants/sanchonet/constants.ts
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,108 @@ | ||
import {Balance} from '@yoroi/types' | ||
|
||
import {DefaultAsset} from '../../../types' | ||
import {COIN_TYPE, COINS_PER_UTXO_WORD, KEY_DEPOSIT, LINEAR_FEE, MINIMUM_UTXO_VAL, POOL_DEPOSIT} from '../common' | ||
|
||
export * from '../common' | ||
|
||
export const NETWORK_ID = 450 | ||
export const API_ROOT = 'https://sanchonet-backend.yoroiwallet.com/api' | ||
export const TOKEN_INFO_SERVICE = 'https://stage-cdn.yoroiwallet.com' | ||
|
||
export const BACKEND = { | ||
API_ROOT, | ||
NFT_STORAGE_URL: 'https://validated-nft-images.s3.amazonaws.com', | ||
TOKEN_INFO_SERVICE, | ||
FETCH_UTXOS_MAX_ADDRESSES: 50, | ||
TX_HISTORY_MAX_ADDRESSES: 50, | ||
FILTER_USED_MAX_ADDRESSES: 50, | ||
TX_HISTORY_RESPONSE_LIMIT: 50, | ||
} as const | ||
export const CHAIN_NETWORK_ID = 0 | ||
|
||
export const IS_MAINNET = false | ||
|
||
export const PROTOCOL_MAGIC = 1097911063 | ||
export const BASE_CONFIG = { | ||
GENESIS_DATE: '1686789000000', | ||
PROTOCOL_MAGIC, | ||
SLOTS_PER_EPOCH: 432000, | ||
SLOT_DURATION: 20, | ||
START_AT: 0, | ||
} as const | ||
export const BYRON_BASE_CONFIG = { | ||
// byron-era | ||
PROTOCOL_MAGIC, | ||
// aka byron network id | ||
START_AT: 0, | ||
GENESIS_DATE: '1686789000000', | ||
SLOTS_PER_EPOCH: 4320, | ||
SLOT_DURATION: 20, | ||
} as const | ||
|
||
export const SHELLEY_BASE_CONFIG = { | ||
GENESIS_DATE: '1686789000000', | ||
PROTOCOL_MAGIC, | ||
// shelley-era | ||
START_AT: 0, | ||
SLOTS_PER_EPOCH: 86400, | ||
SLOT_DURATION: 1, | ||
} as const | ||
|
||
const CARDANO_BASE_CONFIG = [BYRON_BASE_CONFIG, SHELLEY_BASE_CONFIG] | ||
export const NETWORK_CONFIG = { | ||
BACKEND, | ||
BASE_CONFIG: CARDANO_BASE_CONFIG, | ||
CHAIN_NETWORK_ID: CHAIN_NETWORK_ID.toString(), | ||
COIN_TYPE, | ||
ENABLED: true, | ||
EXPLORER_URL_FOR_ADDRESS: (address: string) => `https://preprod.cardanoscan.io/address/${address}`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No sanchonet explorers yet |
||
EXPLORER_URL_FOR_TOKEN: (fingerprint: string) => | ||
fingerprint.length > 0 | ||
? `https://preprod.cardanoscan.io/token/${fingerprint}` | ||
: `https://preprod.cardanoscan.io/tokens`, | ||
CEXPLORER_URL_FOR_TOKEN: (fingerprint: string) => | ||
fingerprint.length > 0 ? `https://preprod.cexplorer.io/asset/${fingerprint}` : `https://preprod.cexplorer.io/asset`, | ||
EXPLORER_URL_FOR_TX: (txid: string) => `https://preprod.cardanoscan.io/transaction/${txid}`, | ||
POOL_EXPLORER: 'https://adapools.yoroiwallet.com/?source=mobile', | ||
IS_MAINNET, | ||
KEY_DEPOSIT, | ||
LINEAR_FEE, | ||
MARKETING_NAME: 'Cardano Sancho Testnet', | ||
MINIMUM_UTXO_VAL, | ||
NETWORK_ID, | ||
PER_EPOCH_PERCENTAGE_REWARD: 69344, | ||
POOL_DEPOSIT, | ||
PROVIDER_ID: 300, | ||
COINS_PER_UTXO_WORD, | ||
} as const | ||
|
||
export const PRIMARY_TOKEN_INFO: Balance.TokenInfo = { | ||
id: '', | ||
name: 'TADA', | ||
description: 'Cardano', | ||
fingerprint: '', | ||
kind: 'ft', | ||
group: '', | ||
icon: '', | ||
ticker: 'TADA', | ||
image: '', | ||
decimals: 6, | ||
symbol: '₳', | ||
metadatas: {}, | ||
} as const | ||
|
||
export const PRIMARY_TOKEN: DefaultAsset = { | ||
identifier: '', | ||
networkId: NETWORK_ID, | ||
isDefault: true, | ||
metadata: { | ||
type: 'Cardano', | ||
policyId: '', | ||
assetName: '', | ||
numberOfDecimals: 6, | ||
ticker: 'TADA', | ||
longName: null, | ||
maxSupply: '45000000000000000', | ||
}, | ||
} as const |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Links will be hidden until we have them ready YOMO-1025