Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
266 commits
Select commit Hold shift + click to select a range
e9bb627
bump anchor version and add uxd idl
sjillen Dec 4, 2021
99e3746
add uxd initalize controller itx
sjillen Dec 4, 2021
079c78a
add SetRedeemableGlobalSupplyCap
sjillen Dec 4, 2021
64326e2
add uxdprotocol/uxd-client package
sjillen Dec 6, 2021
ad885bb
add register mango depository itx
sjillen Dec 6, 2021
d47b62d
refactor using uxdclient, update contract, tx passing
sjillen Dec 9, 2021
1a3b52c
add SetMangoDepositoriesRedeemableSoftCap itx
sjillen Dec 9, 2021
d48243e
fix naming
sjillen Dec 9, 2021
18dd828
wip - add DepositInsuranceToMangoDepository
sjillen Dec 10, 2021
ab1cea3
refactor added uxdClient fct
sjillen Dec 10, 2021
9cce40c
wip add WithdrawInsuranceFromMangoDepository itx
sjillen Dec 12, 2021
4600df4
update devnet program and urls
sjillen Dec 12, 2021
bd6363c
fixes from rebase + update URL (Withdraw still not working)
sjillen Dec 12, 2021
20f85c8
lint
sjillen Dec 12, 2021
7c3a9bc
Merge pull request #2 from UXDProtocol/uxd_upgrade
sjillen Dec 12, 2021
4dd98fe
fix @project-serum/anchor publickey issue
0xCryptoSheik Dec 13, 2021
6367487
Merge pull request #4 from UXDProtocol/fix/anchor-publickey
sjillen Dec 13, 2021
ef87d5a
Merge branch 'blockworks-foundation:main' into main
sjillen Dec 13, 2021
7e83679
Update realm info
acamill Dec 14, 2021
eb47811
fix realm id
acamill Dec 14, 2021
4780709
Merge branch 'main' of https://github.com/blockworks-foundation/gover…
sjillen Dec 15, 2021
f4b1062
Merge branch 'blockworks-foundation-main'
sjillen Dec 15, 2021
694e681
yarn lock
sjillen Dec 15, 2021
d8bbb71
update UiInstruction obj
sjillen Dec 15, 2021
aa58517
Merge branch 'main' of https://github.com/blockworks-foundation/gover…
sjillen Dec 15, 2021
5081866
Merge branch 'blockworks-foundation-main'
sjillen Dec 15, 2021
6d98909
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Dec 18, 2021
2d08683
Merge branch 'solana-labs-main'
sjillen Dec 18, 2021
6c53ede
comment out github workflow for now
sjillen Dec 18, 2021
a5a4861
re update @uxdprotocol/uxd-client to latest version
sjillen Dec 18, 2021
0a1bef2
remove workflow
sjillen Dec 18, 2021
b3fc337
Update program to good one, remove mint symbol
acamill Dec 15, 2021
c45221b
Fix names
acamill Dec 15, 2021
edb751e
Fix mistake removal
acamill Dec 15, 2021
2108e8f
Update IDL to latest
acamill Dec 15, 2021
f905aa3
Actually use the mint decimals. Danger
acamill Dec 15, 2021
e98718c
Add comments + program ID
acamill Dec 15, 2021
7406615
get controller pda from input and cluster/connection dynamically
sjillen Dec 15, 2021
b296a8b
update uxd-client to 3.1, update idl
sjillen Dec 15, 2021
327953e
reinforce input rules, use wallet for provider, small uxd-client refa…
sjillen Dec 16, 2021
4c4bbd8
small brushup
sjillen Dec 16, 2021
fa5463c
controller Pda automatically derived instead of input
sjillen Dec 18, 2021
c4b093e
select collateral and insurance with select on symbol
sjillen Dec 18, 2021
b7f0a93
fix ConnectionContext import
sjillen Dec 18, 2021
6ebaf00
Merge pull request #6 from UXDProtocol/misc/support-latest-uxd-client
sjillen Dec 19, 2021
8415868
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Dec 20, 2021
4db2f03
Merge branch 'solana-labs-main'
sjillen Dec 20, 2021
b6bad99
fix: yarn types for react-virtualized
sjillen Dec 20, 2021
cbda107
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Dec 21, 2021
d24f44b
Merge branch 'solana-labs-main'
sjillen Dec 21, 2021
afd34f5
update uxd-client 3.6
sjillen Dec 22, 2021
6109f49
Merge branch 'solana-labs:main' into main
sjillen Dec 22, 2021
bd92c13
Merge branch 'solana-labs:main' into main
sjillen Dec 22, 2021
f7c443a
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Dec 23, 2021
ef69180
Merge branch 'solana-labs-main'
sjillen Dec 23, 2021
d07fdad
Merge branch 'solana-labs:main' into main
sjillen Dec 27, 2021
a4688ef
Merge branch 'solana-labs:main' into main
sjillen Dec 28, 2021
8a477a6
Merge branch 'solana-labs:main' into main
sjillen Jan 3, 2022
bb60941
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Jan 4, 2022
0144857
Merge branch 'solana-labs-main'
sjillen Jan 4, 2022
082ab4a
Merge branch 'main' of https://github.com/UXDProtocol/governance-ui
sjillen Jan 4, 2022
fd40ad4
Merge branch 'solana-labs:main' into main
sjillen Jan 5, 2022
2838304
switch to uxd dao v1 on mainnet-beta
sjillen Jan 5, 2022
cccb466
add close account itx
sjillen Jan 8, 2022
842c6cd
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Jan 8, 2022
857d6b6
Merge branch 'solana-labs-main'
sjillen Jan 8, 2022
95db587
update packages.json, lock and small fix
sjillen Jan 8, 2022
19f648a
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Jan 13, 2022
d4cfca0
Merge branch 'solana-labs-main'
sjillen Jan 13, 2022
d816642
update lock
sjillen Jan 13, 2022
ff2b3e8
update uxd instructions to work with @solana/spl-governance
sjillen Jan 13, 2022
3db9939
fix some types
sjillen Jan 13, 2022
8efc116
lint
sjillen Jan 13, 2022
cd87193
Merge branch 'solana-labs:main' into main
sjillen Jan 14, 2022
ead7b34
add SetProgramAuthority itx
sjillen Jan 14, 2022
7d97b90
update uxd itxs to work with uxd-client 4.10
sjillen Jan 14, 2022
b96096c
update UXD program name address
sjillen Jan 14, 2022
a8eabb7
fix UXD website url
0xCryptoSheik Jan 14, 2022
0908574
Merge pull request #16 from UXDProtocol/fix/uxd-website-url
0xCryptoSheik Jan 14, 2022
06391ec
Merge branch 'solana-labs:main' into main
sjillen Jan 15, 2022
9027f2d
Merge branch 'solana-labs:main' into main
sjillen Jan 16, 2022
0ef9c43
Merge branch 'solana-labs:main' into main
sjillen Jan 17, 2022
25ba32b
add raydium liquidity wip
sjillen Jan 17, 2022
db4d6f9
add Raydium Itx + Add Liquidity form - small refactor mint constants …
sjillen Jan 19, 2022
d3554bf
add liquidity to raydium proposal itx on any governance
sjillen Jan 22, 2022
965c86f
cleanup
sjillen Jan 22, 2022
9a8762e
Merge branch 'solana-labs:main' into main
sjillen Jan 22, 2022
1fbb41a
Merge branch 'main' into add_raydium
sjillen Jan 22, 2022
72aa2ec
Merge pull request #17 from UXDProtocol/add_raydium
sjillen Jan 22, 2022
691ca5c
fix(itxs): pass an actual instance of the controller instead of just …
sjillen Jan 23, 2022
9fb57d6
Merge pull request #18 from UXDProtocol/fix_controller-instantiation
sjillen Jan 23, 2022
3ba167f
Update chat sdk to v2 (#272)
SebastianBor Jan 22, 2022
06a1c8f
NFT 4 Cause DAO (#276)
qrtp Jan 22, 2022
bace14a
Pass through rpc env variables (#275)
mschneider Jan 23, 2022
f9ac469
Merge branch 'solana-labs-main'
sjillen Jan 24, 2022
a7e63ce
use genesysgo from env
sjillen Jan 24, 2022
35c8323
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Jan 24, 2022
949d6db
Merge branch 'solana-labs-main'
sjillen Jan 24, 2022
50fb1f6
FIX prevent governenace from crashing if https://token-list.solana.co…
sjillen Jan 24, 2022
cc98556
persist this fucking last line in package.json
sjillen Jan 24, 2022
2c00237
improve handling of decimal numbers
sjillen Jan 24, 2022
8a010e2
remove instantiateController for new Controller()
sjillen Jan 24, 2022
0148d41
Merge pull request #21 from UXDProtocol/chore_raydium_inputs
sjillen Jan 24, 2022
9bda6c0
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Jan 25, 2022
9b90f05
Merge branch 'solana-labs-main'
sjillen Jan 25, 2022
1227c09
bump yarn.lock
sjillen Jan 25, 2022
5cad227
fix Wallet type import
sjillen Jan 25, 2022
68e0733
Merge branch 'main' of https://github.com/UXDProtocol/governance-ui
sjillen Jan 25, 2022
6521821
lint
sjillen Jan 25, 2022
9e6c035
update icon and favicon
sjillen Jan 25, 2022
1869586
Merge branch 'solana-labs:main' into main
sjillen Jan 25, 2022
b437f1c
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Jan 25, 2022
43c297f
Merge branch 'solana-labs-main'
sjillen Jan 25, 2022
0673621
switch mainnet rpc to quiknode
sjillen Jan 28, 2022
506da7d
wip
sjillen Jan 28, 2022
a6278f2
update display for uxd proposals
sjillen Jan 29, 2022
85f3daa
fix ix ui indexes + formatting
sjillen Jan 29, 2022
fdbbff1
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Jan 29, 2022
51a2b61
Merge branch 'solana-labs-main'
sjillen Jan 29, 2022
cfca048
Merge pull request #25 from UXDProtocol/display_proposal_ui
sjillen Jan 29, 2022
aba4ecc
use UXP instead of UXD as DAO symbol
sjillen Jan 29, 2022
8e55176
remove some logs
sjillen Jan 29, 2022
ec3afd5
fix img path
sjillen Jan 29, 2022
49d1ede
restrict display of UXP itx to UXP DAO
sjillen Jan 30, 2022
8c54dcb
add redirect uxd->uxp in next config
sjillen Jan 30, 2022
5efbaa4
Merge pull request #27 from UXDProtocol/fix_uxp_symbol
sjillen Jan 30, 2022
4528a39
add eth in the depository mints list
sjillen Jan 31, 2022
07347ac
Merge pull request #29 from UXDProtocol/add_eth_depository_option
acamill Feb 1, 2022
4d3adf5
Add solend support (#24)
Orelsanpls Feb 3, 2022
89ded4e
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Feb 3, 2022
8581751
update yarn files
sjillen Feb 3, 2022
f77b97f
fix issues from merge
sjillen Feb 3, 2022
17673ef
Merge branch 'solana-labs-main'
sjillen Feb 4, 2022
1f59f3a
update getGovernanceByAccountTypes call in uxd form itxs
sjillen Feb 4, 2022
8b0e21e
fixes from spl-governance package update
sjillen Feb 4, 2022
36d736e
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Feb 4, 2022
fceab0c
Merge branch 'solana-labs-main'
sjillen Feb 4, 2022
bfc37bf
wip
sjillen Jan 24, 2022
73e79c6
fix routing (back to realms-explorer)
sjillen Jan 29, 2022
9bd70fa
regroup uxd itxs form into UXD folder
sjillen Jan 30, 2022
b529ab2
update Instructions list and names
sjillen Jan 30, 2022
03cabb2
Remove Liquidity simulation passing (but itx too > 1232bytes)
sjillen Jan 30, 2022
cf19a7c
refactor remove from liquidity pool
sjillen Feb 1, 2022
811b063
moar refactoar
sjillen Feb 1, 2022
c6e4e88
add radium pool not dependant from uxp/uxdc anymore
sjillen Feb 2, 2022
503b4f3
fixes and improvements from comments
sjillen Feb 3, 2022
9299491
cleanup and refacto helpers/poolKeys
sjillen Feb 3, 2022
4a602bd
refacto getMultiTypeAccounts for raydium itxs
sjillen Feb 3, 2022
91f4885
Merge pull request #28 from UXDProtocol/raydium_remove_liquidity
sjillen Feb 4, 2022
676cf40
Merge branch 'solana-labs:main' into main
sjillen Feb 4, 2022
9950e4c
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Feb 5, 2022
e4dbda0
Merge branch 'solana-labs-main'
sjillen Feb 5, 2022
55e4b4d
update lock file
sjillen Feb 5, 2022
c925bef
Merge branch 'main' of https://github.com/UXDProtocol/governance-ui
sjillen Feb 5, 2022
88f1b13
remove uxd env
sjillen Feb 5, 2022
6184d33
smol fix
sjillen Feb 6, 2022
8996f41
Fix governance select (#33)
Orelsanpls Feb 7, 2022
b105023
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Feb 8, 2022
d622ad0
Merge branch 'solana-labs-main'
sjillen Feb 8, 2022
cbb439b
Merge branch 'main' of https://github.com/solana-labs/governance-ui
sjillen Feb 10, 2022
3951f0f
udpate Wallet import
sjillen Feb 13, 2022
0cae56b
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Feb 13, 2022
a126436
Merge branch 'solana-labs-main'
sjillen Feb 13, 2022
ce4ca1d
update lock file
sjillen Feb 13, 2022
91873ef
update Wallet Interface import
sjillen Feb 13, 2022
883fe32
Merge branch 'solana-labs:main' into main
sjillen Feb 15, 2022
7f8ca0f
add link to tx explorer once proposal is executed (#39)
sjillen Feb 19, 2022
dcaf562
update raydium slippage from 0.5 to 1%
sjillen Feb 20, 2022
c7becdc
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Feb 20, 2022
5df7662
Merge branch 'solana-labs-main'
sjillen Feb 20, 2022
6457903
update lock file
sjillen Feb 20, 2022
a95bd89
Merge branch 'main' of https://github.com/solana-labs/governance-ui i…
sjillen Feb 23, 2022
16279b2
modif from previous merge
sjillen Feb 23, 2022
030af39
remove anchor patch
sjillen Feb 23, 2022
406b2fe
merge from source repo
sjillen Feb 23, 2022
dffcc6f
smol fix
sjillen Feb 23, 2022
bf1b9c3
Merge branch 'solana-labs-main'
sjillen Feb 23, 2022
23bb19c
Merge branch 'solana-labs:main' into main
sjillen Feb 24, 2022
6030080
fix typo
sjillen Feb 25, 2022
c87f656
Delete pages/dao/[symbol]/proposal/components/instructions/solend dir…
sjillen Feb 25, 2022
824a799
Merge branch 'main' of https://github.com/UXDProtocol/governance-ui
sjillen Feb 25, 2022
81f1e4e
fix deleted file
sjillen Feb 25, 2022
040742f
Merge branch 'solana-labs:main' into main
sjillen Feb 25, 2022
bd5c4e0
add the instruction to transfer token internally between accounts own…
Orelsanpls Feb 16, 2022
9be287e
keep data even after selection
Orelsanpls Feb 16, 2022
937fc48
change syntax
Orelsanpls Feb 16, 2022
5024b2c
remove useless code
Orelsanpls Feb 16, 2022
9be675d
allow the instruction on devnet
Orelsanpls Feb 16, 2022
694db39
remove some loops by using maps instead of arrays
Orelsanpls Feb 16, 2022
b81640e
naming + fix SSR
Orelsanpls Feb 16, 2022
a9494e1
import
Orelsanpls Feb 16, 2022
322bc94
apply sheik comments
Orelsanpls Feb 17, 2022
8e9f7a9
Fix particular governance cases
Orelsanpls Feb 17, 2022
3e0c524
Fix ATA interaction for non-SOL treasury
Orelsanpls Feb 17, 2022
1e2e2de
display treasury TA
Orelsanpls Feb 18, 2022
6a2958c
add treasury underlying account header
Orelsanpls Feb 19, 2022
3f70dc6
support newEscrow - createEscrowSbrATA - lock
Orelsanpls Feb 10, 2022
a0512a4
extract LockerData from instruction builder
Orelsanpls Feb 10, 2022
bc3a639
handle multiple saber tribeca programs
Orelsanpls Feb 10, 2022
e742e9e
start gauges work
Orelsanpls Feb 11, 2022
3914466
add more instructions
Orelsanpls Feb 11, 2022
43be560
declare last saber tribeca gauge instructions
Orelsanpls Feb 12, 2022
6b623c4
fix gauge instructions
Orelsanpls Feb 13, 2022
aa96011
add saber tribeca instructions explaination
Orelsanpls Feb 15, 2022
7b13b07
use authority instead of GOVE...
Orelsanpls Feb 15, 2022
9bf0f5d
use authority instead of GOVE...
Orelsanpls Feb 15, 2022
aa34f6a
bit of rewrite
Orelsanpls Feb 15, 2022
1fbdf00
some rewrite
Orelsanpls Feb 15, 2022
f2669ea
create GaugeSelect component
Orelsanpls Feb 15, 2022
f234a1f
rewrite new
Orelsanpls Feb 15, 2022
d100b3e
add linter for hooks + fix hooks error / rebased on main / merged wit…
Orelsanpls Feb 21, 2022
3d67554
Fix pubkey on Solend/SaberTribeca instructions
Orelsanpls Feb 21, 2022
8872afe
fix stuff
Orelsanpls Feb 22, 2022
5f93dd7
socean bonding token mint integration
Orelsanpls Feb 22, 2022
2eb33e3
add missing files
Orelsanpls Feb 22, 2022
28639d9
try to implement initialize auction + add custom mint in Create ATA
Orelsanpls Feb 22, 2022
81b6bdd
trying to init accounts for initializeAuction
Orelsanpls Feb 22, 2022
52d999d
Try handling additional signers for transaction
Orelsanpls Feb 23, 2022
0ad77bd
add socean vesting and others
Orelsanpls Feb 25, 2022
735505d
ad cancelVest & vest
Orelsanpls Feb 26, 2022
970b5bb
string input instead of PublicKey
Orelsanpls Feb 26, 2022
c2587d9
change from native amounts to ui amounts
Orelsanpls Feb 26, 2022
932cb37
update socean vest instruction
Orelsanpls Feb 26, 2022
e5a8a90
rebase
Orelsanpls Feb 28, 2022
e6de2af
add Saber pools deposit instruction
Orelsanpls Mar 2, 2022
673cd2c
Saber Pool: add deposit/withdrawOne instruction
Orelsanpls Mar 2, 2022
1f63cf3
Add socean Mint/Deposit/Purchase instruction display
Orelsanpls Mar 3, 2022
6502495
Fix treasury display
Orelsanpls Mar 4, 2022
68cf750
applied thomas comments
Orelsanpls Mar 4, 2022
8a7b3a2
naive implementation of Hot Wallet
Orelsanpls Mar 4, 2022
5953739
add icon to fire wallet
Orelsanpls Mar 4, 2022
4097f6f
fix flacky price
Orelsanpls Mar 4, 2022
2c72b66
extract Saber from SaberTribeca + add Saber/Sunny Tribeca conf
Orelsanpls Mar 5, 2022
6c5ad41
make hot wallet different for realms
Orelsanpls Mar 7, 2022
76293bd
support friktion deposit
Orelsanpls Mar 10, 2022
afd35e6
clean comments
Orelsanpls Mar 10, 2022
d6917af
change how we do friktion deposit
Orelsanpls Mar 10, 2022
ce6c2de
remove Friktion
Orelsanpls Mar 11, 2022
ac20290
Fix tribeca vote system
Orelsanpls Mar 13, 2022
a223929
Display infos about saber's tribeca gauges
Orelsanpls Mar 13, 2022
6e6e2a7
add more infos about gauges & stuff
Orelsanpls Mar 13, 2022
777e93d
add tribeca instructions
Orelsanpls Mar 15, 2022
332b3e9
support QuarryMine / SaberPeriphery
Orelsanpls Mar 17, 2022
38cdb98
Add instruction translation
Orelsanpls Mar 17, 2022
84f7fea
handle not initialised saber pool
Orelsanpls Mar 17, 2022
620f2fe
use Sonar to get rewards info for Saber
Orelsanpls Mar 22, 2022
547ee29
Make Solend compatible with multiple lending market + multi collateral
Orelsanpls Mar 23, 2022
0488aac
Fix hotwallet
Orelsanpls Apr 6, 2022
74d1f55
handle coin98 pool
Orelsanpls Apr 8, 2022
ed7fcf3
change RPC
Orelsanpls Jul 22, 2022
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
6 changes: 4 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"plugins": ["@typescript-eslint", "react-hooks"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
Expand Down Expand Up @@ -39,6 +39,8 @@
{
"argsIgnorePattern": "^_"
}
]
],
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
"react-hooks/exhaustive-deps": "warn" // Checks effect dependencies
}
}
16 changes: 0 additions & 16 deletions .github/workflows/pull-request.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,10 @@ yarn-error.log*
# vercel
.vercel

# visual studio
.vscode

.npmrc
.env
# TypeScript cache
*.tsbuildinfo
4 changes: 0 additions & 4 deletions .vscode/settings.json

This file was deleted.

37 changes: 37 additions & 0 deletions components/HotWallet/HotWallet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import useHotWallet from '@hooks/useHotWallet'
import HotWalletAccount from './HotWalletAccount'
import { FireIcon } from '@heroicons/react/outline'
import HotWalletName from './HotWalletName'

const HotWallet = () => {
const { tokenAccountsInfo, hotWalletInfo } = useHotWallet()

if (!hotWalletInfo) {
return <></>
}

return (
<div className="bg-bkg-2 p-4 md:p-6 rounded-lg transition-all">
<h3 className="bg-bkg-2 mb-4 flex items-center">
<FireIcon className="flex-shrink-0 h-5 mr-1 text-primary-light w-5" />
Hot Wallet
</h3>

<HotWalletName
hotWalletAddress={hotWalletInfo.publicKey}
hotWalletName={hotWalletInfo.name}
/>

<div style={{ maxHeight: '350px' }} className="overflow-y-auto space-y-3">
{tokenAccountsInfo?.map((tokenAccountInfo) => (
<HotWalletAccount
key={tokenAccountInfo.publicKey.toBase58()}
info={tokenAccountInfo}
/>
))}
</div>
</div>
)
}

export default HotWallet
53 changes: 53 additions & 0 deletions components/HotWallet/HotWalletAccount.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import BigNumber from 'bignumber.js'
import { abbreviateAddress } from '@utils/formatting'
import { HotWalletAccountInfo } from '@hooks/useHotWallet'
import { getExplorerUrl } from '@components/explorer/tools'
import useWalletStore from 'stores/useWalletStore'
import { createRef } from 'react'
import { ExternalLinkIcon } from '@heroicons/react/outline'

const HotWalletAccount = ({ info }: { info: HotWalletAccountInfo }) => {
const connection = useWalletStore((store) => store.connection)

const linkRef = createRef<HTMLAnchorElement>()

const amountFormatted = Number(
new BigNumber(info.amount.toString()).shiftedBy(-info.decimals).toString()
).toLocaleString()

const usdTotalValueFormatted = Number(
new BigNumber(info.usdTotalValue.toNumber())
.shiftedBy(-info.decimals)
.toString()
).toLocaleString()

return (
<div
className="flex flex-col items-start text-fgd-1 hover:bg-bkg-3 p-3 w-full cursor-pointer border border-fgd-4 rounded-lg relative"
onClick={() => linkRef.current?.click()}
>
<span className="text-xs text-th-fgd-1">
{abbreviateAddress(info.publicKey)}
</span>

<span className="text-fgd-3 text-xs flex flex-col">
{amountFormatted} {info.mintName ?? abbreviateAddress(info.mint)}
</span>

<span className="text-fgd-3 text-xs">${usdTotalValueFormatted}</span>

<a
className="absolute right-3"
href={getExplorerUrl(connection.endpoint, info.publicKey)}
ref={linkRef}
target="_blank"
rel="noreferrer"
onClick={(e) => e.stopPropagation()}
>
<ExternalLinkIcon className="flex-shrink-0 h-4 ml-2 mt-0.5 text-primary-light w-4" />
</a>
</div>
)
}

export default HotWalletAccount
41 changes: 41 additions & 0 deletions components/HotWallet/HotWalletName.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { getExplorerUrl } from '@components/explorer/tools'
import { ExternalLinkIcon } from '@heroicons/react/outline'
import { PublicKey } from '@solana/web3.js'
import { abbreviateAddress } from '@utils/formatting'
import { createRef } from 'react'
import useWalletStore from 'stores/useWalletStore'

const HotWalletName = ({
hotWalletName,
hotWalletAddress,
}: {
hotWalletName: string
hotWalletAddress: PublicKey
}) => {
const connection = useWalletStore((store) => store.connection)

const linkRef = createRef<HTMLAnchorElement>()

return (
<div
className="bg-bkg-1 mb-3 px-4 py-2 rounded-md w-full relative cursor-pointer"
onClick={() => linkRef.current?.click()}
>
<p className="text-fgd-3 text-xs">{hotWalletName}</p>
<h3 className="mb-0">{abbreviateAddress(hotWalletAddress)}</h3>

<a
className="absolute right-3 top-2"
href={getExplorerUrl(connection.endpoint, hotWalletAddress)}
ref={linkRef}
target="_blank"
rel="noreferrer"
onClick={(e) => e.stopPropagation()}
>
<ExternalLinkIcon className="flex-shrink-0 h-4 ml-2 mt-0.5 text-primary-light w-4" />
</a>
</div>
)
}

export default HotWalletName
31 changes: 20 additions & 11 deletions components/Members/MemberItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fmtMintAmount } from '@tools/sdk/units'
import tokenService from '@utils/services/token'
import useMembersListStore from 'stores/useMembersStore'
import { ViewState } from './types'
import { useMemo } from 'react'
import { useCallback, useMemo } from 'react'
import { Member } from '@utils/uiTypes/members'
import { AddressImage, DisplayAddress } from '@cardinal/namespaces-components'
import useWalletStore from 'stores/useWalletStore'
Expand All @@ -31,16 +31,25 @@ const MemberItem = ({ item }: { item: Member }) => {
? tokenService.getTokenInfo(realm?.account.communityMint.toBase58())?.symbol
: ''
const totalVotes = votesCasted
const communityAmount =
communityVotes && !communityVotes.isZero()
? useMemo(() => fmtMintAmount(mint, communityVotes), [item.walletAddress])
: null
const councilAmount =
councilVotes && !councilVotes.isZero()
? useMemo(() => fmtMintAmount(councilMint, councilVotes), [
item.walletAddress,
])
: null

const getCommunityAmount = useCallback(() => {
if (communityVotes && !communityVotes.isZero()) {
return fmtMintAmount(mint, communityVotes)
}

return null
}, [communityVotes, mint])

const getCouncilAmount = useCallback(() => {
if (councilVotes && !councilVotes.isZero()) {
return fmtMintAmount(councilMint, councilVotes)
}

return null
}, [councilMint, councilVotes])

const communityAmount = getCommunityAmount()
const councilAmount = getCouncilAmount()

async function handleGoToMemberOverview() {
setCurrentCompactView(ViewState.MemberOverview)
Expand Down
33 changes: 20 additions & 13 deletions components/Members/MemberOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { accountsToPubkeyMap } from '@tools/sdk/accounts'
import { fmtMintAmount } from '@tools/sdk/units'
import { notify } from '@utils/notifications'
import tokenService from '@utils/services/token'
import React, { useEffect, useMemo, useState } from 'react'
import React, { useCallback, useEffect, useState } from 'react'
import useMembersListStore from 'stores/useMembersStore'
import useWalletStore from 'stores/useWalletStore'
import { ViewState, WalletTokenRecordWithProposal } from './types'
Expand Down Expand Up @@ -52,18 +52,25 @@ const MemberOverview = () => {
? tokenService.getTokenInfo(realm?.account.communityMint.toBase58())?.symbol
: ''
const totalVotes = votesCasted
const communityAmount =
communityVotes && !communityVotes.isZero()
? useMemo(() => fmtMintAmount(mint, communityVotes), [
member!.walletAddress,
])
: null
const councilAmount =
councilVotes && !councilVotes.isZero()
? useMemo(() => fmtMintAmount(councilMint, councilVotes), [
member!.walletAddress,
])
: null

const getCommunityAmount = useCallback(() => {
if (communityVotes && !communityVotes.isZero()) {
return fmtMintAmount(mint, communityVotes)
}

return null
}, [communityVotes, mint])

const getCouncilAmount = useCallback(() => {
if (councilVotes && !councilVotes.isZero()) {
return fmtMintAmount(councilMint, councilVotes)
}

return null
}, [councilMint, councilVotes])

const communityAmount = getCommunityAmount()
const councilAmount = getCouncilAmount()

const handleGoBackToMainView = async () => {
setCurrentCompactView(ViewState.MainView)
Expand Down
29 changes: 29 additions & 0 deletions components/SaberStats/SaberStat.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { SaberStats } from '@hooks/useSaberStats'

const SaberStat = ({
saberStat: { liquidityPoolName, uiBalance, pendingRewards, mintName },
}: {
saberStat: SaberStats
}) => {
return (
<div className="flex flex-col items-start text-fgd-1 hover:bg-bkg-3 p-3 w-full border border-fgd-4 rounded-lg relative">
<span>{liquidityPoolName}</span>
<div className="flex flex-col mt-3">
<span className="text-xs">Balance</span>
<span className="text-fgd-3 text-xs mt-1">{`${uiBalance.toLocaleString()} ${mintName}`}</span>
</div>

<div className="flex flex-col mt-2">
<span className="text-xs">Pending Rewards</span>
{pendingRewards.map(({ name, uiPendingAmount }) => (
<span
key={name}
className="text-fgd-3 text-xs mt-1"
>{`${uiPendingAmount.toLocaleString()} ${name}`}</span>
))}
</div>
</div>
)
}

export default SaberStat
34 changes: 34 additions & 0 deletions components/SaberStats/SaberStats.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import useSaberStats from '@hooks/useSaberStats'
import { FireIcon } from '@heroicons/react/outline'
import SaberStatsName from './SaberStatsName'
import SaberStat from './SaberStat'

const SaberStats = () => {
const { saberAccountOwner, saberStats } = useSaberStats()

if (!saberStats || !saberAccountOwner) {
return <></>
}

return (
<div className="bg-bkg-2 p-4 md:p-6 rounded-lg transition-all">
<h3 className="bg-bkg-2 mb-4 flex items-center">
<FireIcon className="flex-shrink-0 h-5 mr-1 text-primary-light w-5" />
Saber Stats
</h3>

<SaberStatsName
saberAccountOwnerAddress={saberAccountOwner.publicKey}
saberAccountOwnerName={saberAccountOwner.name}
/>

<div style={{ maxHeight: '350px' }} className="overflow-y-auto space-y-3">
{saberStats.map((saberStat) => (
<SaberStat key={saberStat.liquidityPoolName} saberStat={saberStat} />
))}
</div>
</div>
)
}

export default SaberStats
41 changes: 41 additions & 0 deletions components/SaberStats/SaberStatsName.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { getExplorerUrl } from '@components/explorer/tools'
import { ExternalLinkIcon } from '@heroicons/react/outline'
import { PublicKey } from '@solana/web3.js'
import { abbreviateAddress } from '@utils/formatting'
import { createRef } from 'react'
import useWalletStore from 'stores/useWalletStore'

const SaberStatsName = ({
saberAccountOwnerName,
saberAccountOwnerAddress,
}: {
saberAccountOwnerName: string
saberAccountOwnerAddress: PublicKey
}) => {
const connection = useWalletStore((store) => store.connection)

const linkRef = createRef<HTMLAnchorElement>()

return (
<div
className="bg-bkg-1 mb-3 px-4 py-2 rounded-md w-full relative cursor-pointer"
onClick={() => linkRef.current?.click()}
>
<p className="text-fgd-3 text-xs">{saberAccountOwnerName}</p>
<h3 className="mb-0">{abbreviateAddress(saberAccountOwnerAddress)}</h3>

<a
className="absolute right-3 top-2"
href={getExplorerUrl(connection.endpoint, saberAccountOwnerAddress)}
ref={linkRef}
target="_blank"
rel="noreferrer"
onClick={(e) => e.stopPropagation()}
>
<ExternalLinkIcon className="flex-shrink-0 h-4 ml-2 mt-0.5 text-primary-light w-4" />
</a>
</div>
)
}

export default SaberStatsName
7 changes: 4 additions & 3 deletions components/TreasuryAccount/AccountHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ const AccountHeader = () => {
const currentAccount = useTreasuryAccountStore(
(s) => s.compact.currentAccount
)

const nfts = useTreasuryAccountStore((s) => s.governanceNfts)

const nftsCount =
currentAccount?.governance && currentAccount.isNft
? useTreasuryAccountStore((s) => s.governanceNfts)[
currentAccount?.governance?.pubkey.toBase58()
]?.length
? nfts[currentAccount?.governance?.pubkey.toBase58()]?.length
: 0
const isNFT = currentAccount?.isNft
const tokenInfo = useTreasuryAccountStore((s) => s.compact.tokenInfo)
Expand Down
Loading