Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e1f2765d0 | ||
|
|
8e35cb872b | ||
|
|
babfd19602 | ||
|
|
5172d1e117 | ||
|
|
92920eb7db | ||
|
|
12d495c0b4 |
+1
-1
@@ -39,7 +39,7 @@
|
|||||||
"@cosmjs/proto-signing": "^0.32.1",
|
"@cosmjs/proto-signing": "^0.32.1",
|
||||||
"@cosmjs/stargate": "^0.32.1",
|
"@cosmjs/stargate": "^0.32.1",
|
||||||
"@cosmjs/tendermint-rpc": "^0.32.1",
|
"@cosmjs/tendermint-rpc": "^0.32.1",
|
||||||
"@dydxprotocol/v4-abacus": "^1.3.2",
|
"@dydxprotocol/v4-abacus": "^1.4.0",
|
||||||
"@dydxprotocol/v4-client-js": "^1.0.20",
|
"@dydxprotocol/v4-client-js": "^1.0.20",
|
||||||
"@dydxprotocol/v4-localization": "^1.1.22",
|
"@dydxprotocol/v4-localization": "^1.1.22",
|
||||||
"@ethersproject/providers": "^5.7.2",
|
"@ethersproject/providers": "^5.7.2",
|
||||||
|
|||||||
Generated
+81
-98
@@ -1,9 +1,5 @@
|
|||||||
lockfileVersion: '6.0'
|
lockfileVersion: '6.0'
|
||||||
|
|
||||||
settings:
|
|
||||||
autoInstallPeers: true
|
|
||||||
excludeLinksFromLockfile: false
|
|
||||||
|
|
||||||
overrides:
|
overrides:
|
||||||
follow-redirects: 1.15.3
|
follow-redirects: 1.15.3
|
||||||
|
|
||||||
@@ -13,25 +9,25 @@ dependencies:
|
|||||||
version: 1.10.0
|
version: 1.10.0
|
||||||
'@cosmjs/amino':
|
'@cosmjs/amino':
|
||||||
specifier: ^0.32.1
|
specifier: ^0.32.1
|
||||||
version: 0.32.1
|
version: 0.32.2
|
||||||
'@cosmjs/crypto':
|
'@cosmjs/crypto':
|
||||||
specifier: ^0.32.1
|
specifier: ^0.32.1
|
||||||
version: 0.32.1
|
version: 0.32.2
|
||||||
'@cosmjs/encoding':
|
'@cosmjs/encoding':
|
||||||
specifier: ^0.32.1
|
specifier: ^0.32.1
|
||||||
version: 0.32.1
|
version: 0.32.2
|
||||||
'@cosmjs/proto-signing':
|
'@cosmjs/proto-signing':
|
||||||
specifier: ^0.32.1
|
specifier: ^0.32.1
|
||||||
version: 0.32.1
|
version: 0.32.2
|
||||||
'@cosmjs/stargate':
|
'@cosmjs/stargate':
|
||||||
specifier: ^0.32.1
|
specifier: ^0.32.1
|
||||||
version: 0.32.1
|
version: 0.32.2
|
||||||
'@cosmjs/tendermint-rpc':
|
'@cosmjs/tendermint-rpc':
|
||||||
specifier: ^0.32.1
|
specifier: ^0.32.1
|
||||||
version: 0.32.1
|
version: 0.32.2
|
||||||
'@dydxprotocol/v4-abacus':
|
'@dydxprotocol/v4-abacus':
|
||||||
specifier: ^1.3.2
|
specifier: ^1.4.0
|
||||||
version: 1.3.2
|
version: 1.4.0
|
||||||
'@dydxprotocol/v4-client-js':
|
'@dydxprotocol/v4-client-js':
|
||||||
specifier: ^1.0.20
|
specifier: ^1.0.20
|
||||||
version: 1.0.20
|
version: 1.0.20
|
||||||
@@ -382,7 +378,7 @@ packages:
|
|||||||
/@0xsquid/sdk@1.10.0:
|
/@0xsquid/sdk@1.10.0:
|
||||||
resolution: {integrity: sha512-NKxHYB+g/TMPY+XmCHs+LuhyfbhH4KvAbGpVBOBPXM9Q5FsKcKrDJpTd5YnGYCLF9B3qXAzVTR0XhiC73GmOOA==}
|
resolution: {integrity: sha512-NKxHYB+g/TMPY+XmCHs+LuhyfbhH4KvAbGpVBOBPXM9Q5FsKcKrDJpTd5YnGYCLF9B3qXAzVTR0XhiC73GmOOA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/encoding': 0.31.1
|
'@cosmjs/encoding': 0.31.0
|
||||||
'@cosmjs/stargate': 0.31.0
|
'@cosmjs/stargate': 0.31.0
|
||||||
axios: 0.27.2
|
axios: 0.27.2
|
||||||
cosmjs-types: 0.8.0
|
cosmjs-types: 0.8.0
|
||||||
@@ -689,16 +685,16 @@ packages:
|
|||||||
resolution: {integrity: sha512-xJ5CCEK7H79FTpOuEmlpSzVI+ZeYESTVvO3wHDgbnceIyAne3C68SvyaKqLUR4uJB0Z4q4+DZHbqW6itUiv4lA==}
|
resolution: {integrity: sha512-xJ5CCEK7H79FTpOuEmlpSzVI+ZeYESTVvO3wHDgbnceIyAne3C68SvyaKqLUR4uJB0Z4q4+DZHbqW6itUiv4lA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/crypto': 0.31.0
|
'@cosmjs/crypto': 0.31.0
|
||||||
'@cosmjs/encoding': 0.31.1
|
'@cosmjs/encoding': 0.31.0
|
||||||
'@cosmjs/math': 0.31.1
|
'@cosmjs/math': 0.31.0
|
||||||
'@cosmjs/utils': 0.31.1
|
'@cosmjs/utils': 0.31.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@cosmjs/amino@0.32.1:
|
/@cosmjs/amino@0.32.2:
|
||||||
resolution: {integrity: sha512-5l2xQ2XuAhV/B3kTIMPBcVZ/OQ+9Yyddzw/lIVs4qE5e/oBI0PVNWXw1oyR0wgfGHrMUxgKjsoOOqE2IbXVyCw==}
|
resolution: {integrity: sha512-lcK5RCVm4OfdAooxKcF2+NwaDVVpghOq6o/A40c2mHXDUzUoRZ33VAHjVJ9Me6vOFxshrw/XEFn1f4KObntjYA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/crypto': 0.32.1
|
'@cosmjs/crypto': 0.32.2
|
||||||
'@cosmjs/encoding': 0.32.1
|
'@cosmjs/encoding': 0.32.2
|
||||||
'@cosmjs/math': 0.32.2
|
'@cosmjs/math': 0.32.2
|
||||||
'@cosmjs/utils': 0.32.2
|
'@cosmjs/utils': 0.32.2
|
||||||
dev: false
|
dev: false
|
||||||
@@ -753,19 +749,19 @@ packages:
|
|||||||
/@cosmjs/crypto@0.31.0:
|
/@cosmjs/crypto@0.31.0:
|
||||||
resolution: {integrity: sha512-UaqCe6Tgh0pe1QlZ66E13t6FlIF86QrnBXXq+EN7Xe1Rouza3fJ1ojGlPleJZkBoq3tAyYVIOOqdZIxtVj/sIQ==}
|
resolution: {integrity: sha512-UaqCe6Tgh0pe1QlZ66E13t6FlIF86QrnBXXq+EN7Xe1Rouza3fJ1ojGlPleJZkBoq3tAyYVIOOqdZIxtVj/sIQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/encoding': 0.31.1
|
'@cosmjs/encoding': 0.31.0
|
||||||
'@cosmjs/math': 0.31.1
|
'@cosmjs/math': 0.31.0
|
||||||
'@cosmjs/utils': 0.31.1
|
'@cosmjs/utils': 0.31.0
|
||||||
'@noble/hashes': 1.3.3
|
'@noble/hashes': 1.3.3
|
||||||
bn.js: 5.2.1
|
bn.js: 5.2.1
|
||||||
elliptic: 6.5.4
|
elliptic: 6.5.4
|
||||||
libsodium-wrappers-sumo: 0.7.11
|
libsodium-wrappers-sumo: 0.7.11
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@cosmjs/crypto@0.32.1:
|
/@cosmjs/crypto@0.32.2:
|
||||||
resolution: {integrity: sha512-AsKucEg5o8evU0wXF/lDwX+ZSwCKF4bbc57nFzraHywlp3sNu4dfPPURoMrT0r7kT7wQZAy4Pdnvmm9nnCCm/Q==}
|
resolution: {integrity: sha512-RuxrYKzhrPF9g6NmU7VEq++Hn1vZJjqqJpZ9Tmw9lOYOV8BUsv+j/0BE86kmWi7xVJ7EwxiuxYsKuM8IR18CIA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/encoding': 0.32.1
|
'@cosmjs/encoding': 0.32.2
|
||||||
'@cosmjs/math': 0.32.2
|
'@cosmjs/math': 0.32.2
|
||||||
'@cosmjs/utils': 0.32.2
|
'@cosmjs/utils': 0.32.2
|
||||||
'@noble/hashes': 1.3.3
|
'@noble/hashes': 1.3.3
|
||||||
@@ -790,16 +786,16 @@ packages:
|
|||||||
readonly-date: 1.0.0
|
readonly-date: 1.0.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@cosmjs/encoding@0.31.1:
|
/@cosmjs/encoding@0.31.0:
|
||||||
resolution: {integrity: sha512-IuxP6ewwX6vg9sUJ8ocJD92pkerI4lyG8J5ynAM3NaX3q+n+uMoPRSQXNeL9bnlrv01FF1kIm8if/f5F7ZPtkA==}
|
resolution: {integrity: sha512-NYGQDRxT7MIRSlcbAezwxK0FqnaSPKCH7O32cmfpHNWorFxhy9lwmBoCvoe59Kd0HmArI4h+NGzLEfX3OLnA4Q==}
|
||||||
dependencies:
|
dependencies:
|
||||||
base64-js: 1.5.1
|
base64-js: 1.5.1
|
||||||
bech32: 1.1.4
|
bech32: 1.1.4
|
||||||
readonly-date: 1.0.0
|
readonly-date: 1.0.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@cosmjs/encoding@0.32.1:
|
/@cosmjs/encoding@0.32.2:
|
||||||
resolution: {integrity: sha512-x60Lfds+Eq42rVV29NaoIAson3kBhATBI3zPp7X3GJTryBc5HFHQ6L/976tE1WB2DrvkfUdWS3ayCMVOY/qm1g==}
|
resolution: {integrity: sha512-WX7m1wLpA9V/zH0zRcz4EmgZdAv1F44g4dbXOgNj1eXZw1PIGR12p58OEkLN51Ha3S4DKRtCv5CkhK1KHEvQtg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
base64-js: 1.5.1
|
base64-js: 1.5.1
|
||||||
bech32: 1.1.4
|
bech32: 1.1.4
|
||||||
@@ -859,12 +855,6 @@ packages:
|
|||||||
bn.js: 5.2.1
|
bn.js: 5.2.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@cosmjs/math@0.31.1:
|
|
||||||
resolution: {integrity: sha512-kiuHV6m6DSB8/4UV1qpFhlc4ul8SgLXTGRlYkYiIIP4l0YNeJ+OpPYaOlEgx4Unk2mW3/O2FWYj7Jc93+BWXng==}
|
|
||||||
dependencies:
|
|
||||||
bn.js: 5.2.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@cosmjs/math@0.32.2:
|
/@cosmjs/math@0.32.2:
|
||||||
resolution: {integrity: sha512-b8+ruAAY8aKtVKWSft2IvtCVCUH1LigIlf9ALIiY8n9jtM4kMASiaRbQ/27etnSAInV88IaezKK9rQZrtxTjcw==}
|
resolution: {integrity: sha512-b8+ruAAY8aKtVKWSft2IvtCVCUH1LigIlf9ALIiY8n9jtM4kMASiaRbQ/27etnSAInV88IaezKK9rQZrtxTjcw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -888,19 +878,19 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/amino': 0.31.0
|
'@cosmjs/amino': 0.31.0
|
||||||
'@cosmjs/crypto': 0.31.0
|
'@cosmjs/crypto': 0.31.0
|
||||||
'@cosmjs/encoding': 0.31.1
|
'@cosmjs/encoding': 0.31.0
|
||||||
'@cosmjs/math': 0.31.1
|
'@cosmjs/math': 0.31.0
|
||||||
'@cosmjs/utils': 0.31.1
|
'@cosmjs/utils': 0.31.0
|
||||||
cosmjs-types: 0.8.0
|
cosmjs-types: 0.8.0
|
||||||
long: 4.0.0
|
long: 4.0.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@cosmjs/proto-signing@0.32.1:
|
/@cosmjs/proto-signing@0.32.2:
|
||||||
resolution: {integrity: sha512-IHJMXQ8XnfzR5K1hWb8VV/jEfJof6BL2mgGIA7X4hSPegwoVfb9hnFKPEPgFjGCTTvGZ8SfnCdXxpsOjianVIA==}
|
resolution: {integrity: sha512-UV4WwkE3W3G3s7wwU9rizNcUEz2g0W8jQZS5J6/3fiN0mRPwtPKQ6EinPN9ASqcAJ7/VQH4/9EPOw7d6XQGnqw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/amino': 0.32.1
|
'@cosmjs/amino': 0.32.2
|
||||||
'@cosmjs/crypto': 0.32.1
|
'@cosmjs/crypto': 0.32.2
|
||||||
'@cosmjs/encoding': 0.32.1
|
'@cosmjs/encoding': 0.32.2
|
||||||
'@cosmjs/math': 0.32.2
|
'@cosmjs/math': 0.32.2
|
||||||
'@cosmjs/utils': 0.32.2
|
'@cosmjs/utils': 0.32.2
|
||||||
cosmjs-types: 0.9.0
|
cosmjs-types: 0.9.0
|
||||||
@@ -968,7 +958,7 @@ packages:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@confio/ics23': 0.6.8
|
'@confio/ics23': 0.6.8
|
||||||
'@cosmjs/amino': 0.31.0
|
'@cosmjs/amino': 0.31.0
|
||||||
'@cosmjs/encoding': 0.31.1
|
'@cosmjs/encoding': 0.31.0
|
||||||
'@cosmjs/math': 0.31.0
|
'@cosmjs/math': 0.31.0
|
||||||
'@cosmjs/proto-signing': 0.31.0
|
'@cosmjs/proto-signing': 0.31.0
|
||||||
'@cosmjs/stream': 0.31.0
|
'@cosmjs/stream': 0.31.0
|
||||||
@@ -984,16 +974,16 @@ packages:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@cosmjs/stargate@0.32.1:
|
/@cosmjs/stargate@0.32.2:
|
||||||
resolution: {integrity: sha512-S0E1qKQ2CMJU79G8bQTquTyrbU03gFsvCkbo3RvK8v2OltVCByjFNh+0nGN5do+uDOzwwmDvnNLhR+SaIyNQoQ==}
|
resolution: {integrity: sha512-AsJa29fT7Jd4xt9Ai+HMqhyj7UQu7fyYKdXj/8+/9PD74xe6lZSYhQPcitUmMLJ1ckKPgXSk5Dd2LbsQT0IhZg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@confio/ics23': 0.6.8
|
'@confio/ics23': 0.6.8
|
||||||
'@cosmjs/amino': 0.32.1
|
'@cosmjs/amino': 0.32.2
|
||||||
'@cosmjs/encoding': 0.32.1
|
'@cosmjs/encoding': 0.32.2
|
||||||
'@cosmjs/math': 0.32.2
|
'@cosmjs/math': 0.32.2
|
||||||
'@cosmjs/proto-signing': 0.32.1
|
'@cosmjs/proto-signing': 0.32.2
|
||||||
'@cosmjs/stream': 0.32.2
|
'@cosmjs/stream': 0.32.2
|
||||||
'@cosmjs/tendermint-rpc': 0.32.1
|
'@cosmjs/tendermint-rpc': 0.32.2
|
||||||
'@cosmjs/utils': 0.32.2
|
'@cosmjs/utils': 0.32.2
|
||||||
cosmjs-types: 0.9.0
|
cosmjs-types: 0.9.0
|
||||||
xstream: 11.14.0
|
xstream: 11.14.0
|
||||||
@@ -1044,12 +1034,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-yo9xbeuI6UoEKIhFZ9g0dvUKLqnBzwdpEc/uldQygQc51j38gQVwFko+6sjmhieJqRYYvrYumcbJMiV6GFM9aA==}
|
resolution: {integrity: sha512-yo9xbeuI6UoEKIhFZ9g0dvUKLqnBzwdpEc/uldQygQc51j38gQVwFko+6sjmhieJqRYYvrYumcbJMiV6GFM9aA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/crypto': 0.31.0
|
'@cosmjs/crypto': 0.31.0
|
||||||
'@cosmjs/encoding': 0.31.1
|
'@cosmjs/encoding': 0.31.0
|
||||||
'@cosmjs/json-rpc': 0.31.0
|
'@cosmjs/json-rpc': 0.31.0
|
||||||
'@cosmjs/math': 0.31.1
|
'@cosmjs/math': 0.31.0
|
||||||
'@cosmjs/socket': 0.31.0
|
'@cosmjs/socket': 0.31.0
|
||||||
'@cosmjs/stream': 0.31.0
|
'@cosmjs/stream': 0.31.0
|
||||||
'@cosmjs/utils': 0.31.1
|
'@cosmjs/utils': 0.31.0
|
||||||
axios: 0.21.4
|
axios: 0.21.4
|
||||||
readonly-date: 1.0.0
|
readonly-date: 1.0.0
|
||||||
xstream: 11.14.0
|
xstream: 11.14.0
|
||||||
@@ -1059,11 +1049,11 @@ packages:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@cosmjs/tendermint-rpc@0.32.1:
|
/@cosmjs/tendermint-rpc@0.32.2:
|
||||||
resolution: {integrity: sha512-4uGSxB2JejWhwBUgxca4GqcK/BGnCFMIP7ptwEledrC3AY/shPeIYcPXWEBwO7sfwCta8DhAOCLrc9zhVC+VAQ==}
|
resolution: {integrity: sha512-DXyJHDmcAfCix4H/7/dKR0UMdshP01KxJOXHdHxBCbLIpck94BsWD3B2ZTXwfA6sv98so9wOzhp7qGQa5malxg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/crypto': 0.32.1
|
'@cosmjs/crypto': 0.32.2
|
||||||
'@cosmjs/encoding': 0.32.1
|
'@cosmjs/encoding': 0.32.2
|
||||||
'@cosmjs/json-rpc': 0.32.2
|
'@cosmjs/json-rpc': 0.32.2
|
||||||
'@cosmjs/math': 0.32.2
|
'@cosmjs/math': 0.32.2
|
||||||
'@cosmjs/socket': 0.32.2
|
'@cosmjs/socket': 0.32.2
|
||||||
@@ -1090,10 +1080,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-nNcycZWUYLNJlrIXgpcgVRqdl6BXjF4YlXdxobQWpW9Tikk61bEGeAFhDYtC0PwHlokCNw0KxWiHGJL4nL7Q5A==}
|
resolution: {integrity: sha512-nNcycZWUYLNJlrIXgpcgVRqdl6BXjF4YlXdxobQWpW9Tikk61bEGeAFhDYtC0PwHlokCNw0KxWiHGJL4nL7Q5A==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@cosmjs/utils@0.31.1:
|
|
||||||
resolution: {integrity: sha512-n4Se1wu4GnKwztQHNFfJvUeWcpvx3o8cWhSbNs9JQShEuB3nv3R5lqFBtDCgHZF/emFQAP+ZjF8bTfCs9UBGhA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@cosmjs/utils@0.32.2:
|
/@cosmjs/utils@0.32.2:
|
||||||
resolution: {integrity: sha512-Gg5t+eR7vPJMAmhkFt6CZrzPd0EKpAslWwk5rFVYZpJsM8JG5KT9XQ99hgNM3Ov6ScNoIWbXkpX27F6A9cXR4Q==}
|
resolution: {integrity: sha512-Gg5t+eR7vPJMAmhkFt6CZrzPd0EKpAslWwk5rFVYZpJsM8JG5KT9XQ99hgNM3Ov6ScNoIWbXkpX27F6A9cXR4Q==}
|
||||||
dev: false
|
dev: false
|
||||||
@@ -1102,29 +1088,29 @@ packages:
|
|||||||
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
|
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@dydxprotocol/v4-abacus@1.3.2:
|
/@dydxprotocol/v4-abacus@1.4.0:
|
||||||
resolution: {integrity: sha512-zo0IHjGMlJRKOYDgNqNFQ9GtBJKJP4+Y9YY7V0X3Wt61ppKAYzodaYQhc9V/RYchcZTtS/xkicLug444YrvehQ==}
|
resolution: {integrity: sha512-mkdkXQXTVF1K6UmZwIwLC9gjsXg+Nt3h5/iW+WriVv1cUMPmHfPyRWL31eDDvkVO5UeECf05kiYXPk1y+7dPuA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@dydxprotocol/v4-client-js@1.0.20:
|
/@dydxprotocol/v4-client-js@1.0.20:
|
||||||
resolution: {integrity: sha512-dXKW2NC1XlVVIRKvHWVDofLZSCPTJAaRY5eXzxH5CcXpnl2kdXorr7ykqWZxW0jHFPWWvRSJtUDqZN1qFrEe/w==}
|
resolution: {integrity: sha512-dXKW2NC1XlVVIRKvHWVDofLZSCPTJAaRY5eXzxH5CcXpnl2kdXorr7ykqWZxW0jHFPWWvRSJtUDqZN1qFrEe/w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/amino': 0.32.1
|
'@cosmjs/amino': 0.32.2
|
||||||
'@cosmjs/encoding': 0.32.1
|
'@cosmjs/encoding': 0.32.2
|
||||||
'@cosmjs/math': 0.32.2
|
'@cosmjs/math': 0.32.2
|
||||||
'@cosmjs/proto-signing': 0.32.1
|
'@cosmjs/proto-signing': 0.32.2
|
||||||
'@cosmjs/stargate': 0.32.1
|
'@cosmjs/stargate': 0.32.2
|
||||||
'@cosmjs/tendermint-rpc': 0.32.1
|
'@cosmjs/tendermint-rpc': 0.32.2
|
||||||
'@cosmjs/utils': 0.32.2
|
'@cosmjs/utils': 0.32.2
|
||||||
'@dydxprotocol/v4-proto': 4.0.0-dev.0
|
'@dydxprotocol/v4-proto': 4.0.0-dev.0
|
||||||
'@osmonauts/lcd': 0.6.0
|
'@osmonauts/lcd': 0.6.0
|
||||||
'@scure/bip32': 1.3.3
|
'@scure/bip32': 1.3.2
|
||||||
'@scure/bip39': 1.2.2
|
'@scure/bip39': 1.2.1
|
||||||
axios: 1.1.3
|
axios: 1.1.3
|
||||||
bech32: 1.1.4
|
bech32: 1.1.4
|
||||||
bignumber.js: 9.1.1
|
bignumber.js: 9.1.1
|
||||||
cosmjs-types: 0.9.0
|
cosmjs-types: 0.9.0
|
||||||
ethereum-cryptography: 2.1.3
|
ethereum-cryptography: 2.1.2
|
||||||
ethers: 6.6.1
|
ethers: 6.6.1
|
||||||
long: 4.0.0
|
long: 4.0.0
|
||||||
protobufjs: 6.11.4
|
protobufjs: 6.11.4
|
||||||
@@ -2158,18 +2144,18 @@ packages:
|
|||||||
'@noble/hashes': 1.3.0
|
'@noble/hashes': 1.3.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@noble/curves@1.1.0:
|
||||||
|
resolution: {integrity: sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==}
|
||||||
|
dependencies:
|
||||||
|
'@noble/hashes': 1.3.1
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@noble/curves@1.2.0:
|
/@noble/curves@1.2.0:
|
||||||
resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==}
|
resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@noble/hashes': 1.3.2
|
'@noble/hashes': 1.3.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@noble/curves@1.3.0:
|
|
||||||
resolution: {integrity: sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==}
|
|
||||||
dependencies:
|
|
||||||
'@noble/hashes': 1.3.3
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@noble/ed25519@1.7.3:
|
/@noble/ed25519@1.7.3:
|
||||||
resolution: {integrity: sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==}
|
resolution: {integrity: sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -5035,18 +5021,18 @@ packages:
|
|||||||
'@scure/base': 1.1.1
|
'@scure/base': 1.1.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@scure/bip32@1.3.2:
|
/@scure/bip32@1.3.1:
|
||||||
resolution: {integrity: sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==}
|
resolution: {integrity: sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@noble/curves': 1.2.0
|
'@noble/curves': 1.1.0
|
||||||
'@noble/hashes': 1.3.3
|
'@noble/hashes': 1.3.3
|
||||||
'@scure/base': 1.1.5
|
'@scure/base': 1.1.5
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@scure/bip32@1.3.3:
|
/@scure/bip32@1.3.2:
|
||||||
resolution: {integrity: sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ==}
|
resolution: {integrity: sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@noble/curves': 1.3.0
|
'@noble/curves': 1.2.0
|
||||||
'@noble/hashes': 1.3.3
|
'@noble/hashes': 1.3.3
|
||||||
'@scure/base': 1.1.5
|
'@scure/base': 1.1.5
|
||||||
dev: false
|
dev: false
|
||||||
@@ -5065,13 +5051,6 @@ packages:
|
|||||||
'@scure/base': 1.1.5
|
'@scure/base': 1.1.5
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@scure/bip39@1.2.2:
|
|
||||||
resolution: {integrity: sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA==}
|
|
||||||
dependencies:
|
|
||||||
'@noble/hashes': 1.3.3
|
|
||||||
'@scure/base': 1.1.5
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@solana/buffer-layout@4.0.1:
|
/@solana/buffer-layout@4.0.1:
|
||||||
resolution: {integrity: sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==}
|
resolution: {integrity: sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==}
|
||||||
engines: {node: '>=5.10'}
|
engines: {node: '>=5.10'}
|
||||||
@@ -5083,7 +5062,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-up5VG1dK+GPhykmuMIozJZBbVqpm77vbOG6/r5dS7NBGZonwHfTLdBbsYc3rjmaQ4DpCXUa3tUc4RZHRORvZrw==}
|
resolution: {integrity: sha512-up5VG1dK+GPhykmuMIozJZBbVqpm77vbOG6/r5dS7NBGZonwHfTLdBbsYc3rjmaQ4DpCXUa3tUc4RZHRORvZrw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/runtime': 7.22.10
|
'@babel/runtime': 7.22.10
|
||||||
'@noble/curves': 1.3.0
|
'@noble/curves': 1.2.0
|
||||||
'@noble/hashes': 1.3.3
|
'@noble/hashes': 1.3.3
|
||||||
'@solana/buffer-layout': 4.0.1
|
'@solana/buffer-layout': 4.0.1
|
||||||
agentkeepalive: 4.5.0
|
agentkeepalive: 4.5.0
|
||||||
@@ -9307,13 +9286,13 @@ packages:
|
|||||||
fast-safe-stringify: 2.1.1
|
fast-safe-stringify: 2.1.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/ethereum-cryptography@2.1.3:
|
/ethereum-cryptography@2.1.2:
|
||||||
resolution: {integrity: sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA==}
|
resolution: {integrity: sha512-Z5Ba0T0ImZ8fqXrJbpHcbpAvIswRte2wGNR/KePnu8GbbvgJ47lMxT/ZZPG6i9Jaht4azPDop4HaM00J0J59ug==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@noble/curves': 1.3.0
|
'@noble/curves': 1.1.0
|
||||||
'@noble/hashes': 1.3.3
|
'@noble/hashes': 1.3.1
|
||||||
'@scure/bip32': 1.3.3
|
'@scure/bip32': 1.3.1
|
||||||
'@scure/bip39': 1.2.2
|
'@scure/bip39': 1.2.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/ethers@5.7.2:
|
/ethers@5.7.2:
|
||||||
@@ -14933,3 +14912,7 @@ packages:
|
|||||||
/zwitch@2.0.4:
|
/zwitch@2.0.4:
|
||||||
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
settings:
|
||||||
|
autoInstallPeers: true
|
||||||
|
excludeLinksFromLockfile: false
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ type ElementProps = {
|
|||||||
resolution?: number;
|
resolution?: number;
|
||||||
stripRelativeWords?: boolean;
|
stripRelativeWords?: boolean;
|
||||||
};
|
};
|
||||||
|
timeOptions?: {
|
||||||
|
useUTC?: boolean;
|
||||||
|
};
|
||||||
tag?: React.ReactNode;
|
tag?: React.ReactNode;
|
||||||
withParentheses?: boolean;
|
withParentheses?: boolean;
|
||||||
locale?: string;
|
locale?: string;
|
||||||
@@ -89,6 +92,7 @@ export const Output = ({
|
|||||||
relativeTimeFormatOptions = {
|
relativeTimeFormatOptions = {
|
||||||
format: 'singleCharacter',
|
format: 'singleCharacter',
|
||||||
},
|
},
|
||||||
|
timeOptions,
|
||||||
tag,
|
tag,
|
||||||
withParentheses,
|
withParentheses,
|
||||||
locale = navigator.language || 'en-US',
|
locale = navigator.language || 'en-US',
|
||||||
@@ -166,16 +170,21 @@ export const Output = ({
|
|||||||
if ((typeof value !== 'string' && typeof value !== 'number') || !value) return null;
|
if ((typeof value !== 'string' && typeof value !== 'number') || !value) return null;
|
||||||
const date = new Date(value);
|
const date = new Date(value);
|
||||||
const dateString = {
|
const dateString = {
|
||||||
[OutputType.Date]: date.toLocaleString(selectedLocale, { dateStyle: 'medium' }),
|
[OutputType.Date]: date.toLocaleString(selectedLocale, {
|
||||||
|
dateStyle: 'medium',
|
||||||
|
timeZone: timeOptions?.useUTC ? 'UTC' : undefined,
|
||||||
|
}),
|
||||||
[OutputType.DateTime]: date.toLocaleString(selectedLocale, {
|
[OutputType.DateTime]: date.toLocaleString(selectedLocale, {
|
||||||
dateStyle: 'short',
|
dateStyle: 'short',
|
||||||
timeStyle: 'short',
|
timeStyle: 'short',
|
||||||
|
timeZone: timeOptions?.useUTC ? 'UTC' : undefined,
|
||||||
}),
|
}),
|
||||||
[OutputType.Time]: date.toLocaleString(selectedLocale, {
|
[OutputType.Time]: date.toLocaleString(selectedLocale, {
|
||||||
hour12: false,
|
hour12: false,
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
second: '2-digit',
|
second: '2-digit',
|
||||||
|
timeZone: timeOptions?.useUTC ? 'UTC' : undefined,
|
||||||
}),
|
}),
|
||||||
}[type];
|
}[type];
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export type TableItem<TableRowData> = {
|
|||||||
onSelect?: (key: TableRowData) => void;
|
onSelect?: (key: TableRowData) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
type ColumnDef<TableRowData extends object> = {
|
export type ColumnDef<TableRowData extends object> = {
|
||||||
columnKey: string;
|
columnKey: string;
|
||||||
label: React.ReactNode;
|
label: React.ReactNode;
|
||||||
tag?: React.ReactNode;
|
tag?: React.ReactNode;
|
||||||
@@ -513,7 +513,7 @@ const TableColumnHeader = <TableRowData extends object>({
|
|||||||
export const ViewMoreRow = ({ colSpan, onClick }: { colSpan: number; onClick: () => void }) => {
|
export const ViewMoreRow = ({ colSpan, onClick }: { colSpan: number; onClick: () => void }) => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
return (
|
return (
|
||||||
<Styled.Tr key="viewmore">
|
<Styled.ViewMoreTr key="viewmore">
|
||||||
<Styled.Td
|
<Styled.Td
|
||||||
colSpan={colSpan}
|
colSpan={colSpan}
|
||||||
onMouseDown={(e: MouseEvent) => e.preventDefault()}
|
onMouseDown={(e: MouseEvent) => e.preventDefault()}
|
||||||
@@ -523,7 +523,7 @@ export const ViewMoreRow = ({ colSpan, onClick }: { colSpan: number; onClick: ()
|
|||||||
{stringGetter({ key: STRING_KEYS.VIEW_MORE })}
|
{stringGetter({ key: STRING_KEYS.VIEW_MORE })}
|
||||||
</Styled.ViewMoreButton>
|
</Styled.ViewMoreButton>
|
||||||
</Styled.Td>
|
</Styled.Td>
|
||||||
</Styled.Tr>
|
</Styled.ViewMoreTr>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -673,6 +673,8 @@ Styled.TableWrapper = styled.div<{
|
|||||||
--table-lastColumn-cell-align: end; // start | center | end | var(--table-cell-align)
|
--table-lastColumn-cell-align: end; // start | center | end | var(--table-cell-align)
|
||||||
--tableCell-padding: 0 1rem;
|
--tableCell-padding: 0 1rem;
|
||||||
|
|
||||||
|
--tableViewMore-borderColor: inherit;
|
||||||
|
|
||||||
// Rules
|
// Rules
|
||||||
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -984,3 +986,7 @@ Styled.ViewMoreButton = styled(Button)`
|
|||||||
margin-left: 0.5ch;
|
margin-left: 0.5ch;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
Styled.ViewMoreTr = styled(Styled.Tr)`
|
||||||
|
--border-color: var(--tableViewMore-borderColor);
|
||||||
|
`;
|
||||||
|
|||||||
@@ -119,6 +119,13 @@ export const InputSelectionOption = Abacus.exchange.dydx.abacus.output.input.Sel
|
|||||||
// ------ Wallet ------ //
|
// ------ Wallet ------ //
|
||||||
export type Wallet = Abacus.exchange.dydx.abacus.output.Wallet;
|
export type Wallet = Abacus.exchange.dydx.abacus.output.Wallet;
|
||||||
export type AccountBalance = Abacus.exchange.dydx.abacus.output.AccountBalance;
|
export type AccountBalance = Abacus.exchange.dydx.abacus.output.AccountBalance;
|
||||||
|
export type TradingRewards = Abacus.exchange.dydx.abacus.output.TradingRewards;
|
||||||
|
export type HistoricalTradingReward = Abacus.exchange.dydx.abacus.output.HistoricalTradingReward;
|
||||||
|
export const HistoricalTradingRewardsPeriod =
|
||||||
|
Abacus.exchange.dydx.abacus.state.manager.HistoricalTradingRewardsPeriod;
|
||||||
|
const historicalTradingRewardsPeriod = [...HistoricalTradingRewardsPeriod.values()] as const;
|
||||||
|
export type HistoricalTradingRewardsPeriods = (typeof historicalTradingRewardsPeriod)[number];
|
||||||
|
|
||||||
export type Subaccount = Abacus.exchange.dydx.abacus.output.Subaccount;
|
export type Subaccount = Abacus.exchange.dydx.abacus.output.Subaccount;
|
||||||
export type SubaccountPosition = Abacus.exchange.dydx.abacus.output.SubaccountPosition;
|
export type SubaccountPosition = Abacus.exchange.dydx.abacus.output.SubaccountPosition;
|
||||||
export type SubaccountOrder = Abacus.exchange.dydx.abacus.output.SubaccountOrder;
|
export type SubaccountOrder = Abacus.exchange.dydx.abacus.output.SubaccountOrder;
|
||||||
@@ -202,6 +209,9 @@ export const RestrictionType = Abacus.exchange.dydx.abacus.output.Restriction;
|
|||||||
const restrictionTypes = [...RestrictionType.values()] as const;
|
const restrictionTypes = [...RestrictionType.values()] as const;
|
||||||
export type RestrictionTypes = (typeof restrictionTypes)[number];
|
export type RestrictionTypes = (typeof restrictionTypes)[number];
|
||||||
|
|
||||||
|
// ------ Api data ------ //
|
||||||
|
export const ApiData = Abacus.exchange.dydx.abacus.state.manager.ApiData;
|
||||||
|
|
||||||
// ------ Enum Conversions ------ //
|
// ------ Enum Conversions ------ //
|
||||||
type IfEquals<X, Y, A, B> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2
|
type IfEquals<X, Y, A, B> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2
|
||||||
? A
|
? A
|
||||||
@@ -236,6 +246,15 @@ export const HISTORICAL_PNL_PERIODS: Record<
|
|||||||
[HistoricalPnlPeriod.Period90d.name]: HistoricalPnlPeriod.Period90d,
|
[HistoricalPnlPeriod.Period90d.name]: HistoricalPnlPeriod.Period90d,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const HISTORICAL_TRADING_REWARDS_PERIODS: Record<
|
||||||
|
KotlinIrEnumValues<typeof HistoricalTradingRewardsPeriod>,
|
||||||
|
HistoricalTradingRewardsPeriods
|
||||||
|
> = {
|
||||||
|
[HistoricalTradingRewardsPeriod.MONTHLY.name]: HistoricalTradingRewardsPeriod.MONTHLY,
|
||||||
|
[HistoricalTradingRewardsPeriod.WEEKLY.name]: HistoricalTradingRewardsPeriod.WEEKLY,
|
||||||
|
[HistoricalTradingRewardsPeriod.DAILY.name]: HistoricalTradingRewardsPeriod.DAILY,
|
||||||
|
};
|
||||||
|
|
||||||
export const ORDER_STATUS_STRINGS: Record<KotlinIrEnumValues<typeof AbacusOrderStatus>, string> = {
|
export const ORDER_STATUS_STRINGS: Record<KotlinIrEnumValues<typeof AbacusOrderStatus>, string> = {
|
||||||
[AbacusOrderStatus.open.name]: STRING_KEYS.OPEN_STATUS,
|
[AbacusOrderStatus.open.name]: STRING_KEYS.OPEN_STATUS,
|
||||||
[AbacusOrderStatus.open.rawValue]: STRING_KEYS.OPEN_STATUS,
|
[AbacusOrderStatus.open.rawValue]: STRING_KEYS.OPEN_STATUS,
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export type TooltipStrings = {
|
|||||||
stringParams?: any;
|
stringParams?: any;
|
||||||
urlConfigs?: LinksConfigs;
|
urlConfigs?: LinksConfigs;
|
||||||
}) => {
|
}) => {
|
||||||
title: string;
|
title?: string;
|
||||||
body: string;
|
body: string;
|
||||||
learnMoreLink?: string;
|
learnMoreLink?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -198,4 +198,7 @@ export const tradeTooltips: TooltipStrings = {
|
|||||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.UNREALIZED_PNL_TITLE }),
|
title: stringGetter({ key: TOOLTIP_STRING_KEYS.UNREALIZED_PNL_TITLE }),
|
||||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.UNREALIZED_PNL_BODY }),
|
body: stringGetter({ key: TOOLTIP_STRING_KEYS.UNREALIZED_PNL_BODY }),
|
||||||
}),
|
}),
|
||||||
|
'reward-history': ({ stringGetter }) => ({
|
||||||
|
body: stringGetter({ key: TOOLTIP_STRING_KEYS.REWARD_HISTORY_BODY }),
|
||||||
|
}),
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
+15
-2
@@ -3,6 +3,8 @@ import type { LocalWallet } from '@dydxprotocol/v4-client-js';
|
|||||||
import type {
|
import type {
|
||||||
ClosePositionInputFields,
|
ClosePositionInputFields,
|
||||||
Nullable,
|
Nullable,
|
||||||
|
HistoricalTradingRewardsPeriod,
|
||||||
|
HistoricalTradingRewardsPeriods,
|
||||||
HumanReadablePlaceOrderPayload,
|
HumanReadablePlaceOrderPayload,
|
||||||
HumanReadableCancelOrderPayload,
|
HumanReadableCancelOrderPayload,
|
||||||
TradeInputFields,
|
TradeInputFields,
|
||||||
@@ -23,6 +25,7 @@ import {
|
|||||||
CoroutineTimer,
|
CoroutineTimer,
|
||||||
TransferType,
|
TransferType,
|
||||||
AbacusAppConfig,
|
AbacusAppConfig,
|
||||||
|
ApiData,
|
||||||
} from '@/constants/abacus';
|
} from '@/constants/abacus';
|
||||||
|
|
||||||
import { DEFAULT_MARKETID } from '@/constants/markets';
|
import { DEFAULT_MARKETID } from '@/constants/markets';
|
||||||
@@ -33,8 +36,6 @@ import type { RootStore } from '@/state/_store';
|
|||||||
import { setTradeFormInputs } from '@/state/inputs';
|
import { setTradeFormInputs } from '@/state/inputs';
|
||||||
import { getInputTradeOptions, getTransferInputs } from '@/state/inputsSelectors';
|
import { getInputTradeOptions, getTransferInputs } from '@/state/inputsSelectors';
|
||||||
|
|
||||||
import { testFlags } from '@/lib/testFlags';
|
|
||||||
|
|
||||||
import AbacusRest from './rest';
|
import AbacusRest from './rest';
|
||||||
import AbacusAnalytics from './analytics';
|
import AbacusAnalytics from './analytics';
|
||||||
import AbacusWebsocket from './websocket';
|
import AbacusWebsocket from './websocket';
|
||||||
@@ -227,6 +228,15 @@ class AbacusStateManager {
|
|||||||
this.stateManager.historicalPnlPeriod = period;
|
this.stateManager.historicalPnlPeriod = period;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setHistoricalTradingRewardPeriod = (
|
||||||
|
period: (typeof HistoricalTradingRewardsPeriod)[keyof typeof HistoricalTradingRewardsPeriod]
|
||||||
|
) => {
|
||||||
|
this.stateManager.historicalTradingRewardPeriod = period;
|
||||||
|
};
|
||||||
|
|
||||||
|
refreshHistoricalTradingRewards = () =>
|
||||||
|
this.stateManager.refresh(ApiData.HISTORICAL_TRADING_REWARDS);
|
||||||
|
|
||||||
switchNetwork = (network: DydxNetwork) => {
|
switchNetwork = (network: DydxNetwork) => {
|
||||||
this.stateManager.environmentId = network;
|
this.stateManager.environmentId = network;
|
||||||
|
|
||||||
@@ -278,6 +288,9 @@ class AbacusStateManager {
|
|||||||
getHistoricalPnlPeriod = (): Nullable<HistoricalPnlPeriods> =>
|
getHistoricalPnlPeriod = (): Nullable<HistoricalPnlPeriods> =>
|
||||||
this.stateManager.historicalPnlPeriod;
|
this.stateManager.historicalPnlPeriod;
|
||||||
|
|
||||||
|
getHistoricalTradingRewardPeriod = (): HistoricalTradingRewardsPeriods =>
|
||||||
|
this.stateManager.historicalTradingRewardPeriod;
|
||||||
|
|
||||||
handleCandlesSubscription = ({
|
handleCandlesSubscription = ({
|
||||||
channelId,
|
channelId,
|
||||||
subscribe,
|
subscribe,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import {
|
|||||||
setSubaccount,
|
setSubaccount,
|
||||||
setTransfers,
|
setTransfers,
|
||||||
setWallet,
|
setWallet,
|
||||||
|
setTradingRewards,
|
||||||
} from '@/state/account';
|
} from '@/state/account';
|
||||||
|
|
||||||
import { setApiState } from '@/state/app';
|
import { setApiState } from '@/state/app';
|
||||||
@@ -96,6 +97,12 @@ class AbacusStateNotifier implements AbacusStateNotificationProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changes.has(Changes.tradingRewards)) {
|
||||||
|
if (updatedState.account?.tradingRewards) {
|
||||||
|
dispatch(setTradingRewards(updatedState.account?.tradingRewards));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (changes.has(Changes.configs)) {
|
if (changes.has(Changes.configs)) {
|
||||||
dispatch(setConfigs(updatedState.configs));
|
dispatch(setConfigs(updatedState.configs));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ class TestFlags {
|
|||||||
get addressOverride():string {
|
get addressOverride():string {
|
||||||
return this.queryParams.address;
|
return this.queryParams.address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get showTradingRewards() {
|
||||||
|
return !!this.queryParams.tradingrewards;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const testFlags = new TestFlags();
|
export const testFlags = new TestFlags();
|
||||||
|
|||||||
+110
-70
@@ -23,7 +23,10 @@ import { AppRoute, PortfolioRoute, HistoryRoute } from '@/constants/routes';
|
|||||||
import { wallets } from '@/constants/wallets';
|
import { wallets } from '@/constants/wallets';
|
||||||
import { useAccounts, useStringGetter, useTokenConfigs } from '@/hooks';
|
import { useAccounts, useStringGetter, useTokenConfigs } from '@/hooks';
|
||||||
|
|
||||||
import { getOnboardingState } from '@/state/accountSelectors';
|
import {
|
||||||
|
getHistoricalTradingRewardsForCurrentWeek,
|
||||||
|
getOnboardingState,
|
||||||
|
} from '@/state/accountSelectors';
|
||||||
import { openDialog } from '@/state/dialogs';
|
import { openDialog } from '@/state/dialogs';
|
||||||
|
|
||||||
import { isTruthy } from '@/lib/isTruthy';
|
import { isTruthy } from '@/lib/isTruthy';
|
||||||
@@ -52,6 +55,8 @@ const Profile = () => {
|
|||||||
chainId: ENS_CHAIN_ID,
|
chainId: ENS_CHAIN_ID,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const currentWeekTradingReward = useSelector(getHistoricalTradingRewardsForCurrentWeek);
|
||||||
|
|
||||||
const actions = [
|
const actions = [
|
||||||
{
|
{
|
||||||
key: 'deposit',
|
key: 'deposit',
|
||||||
@@ -159,64 +164,62 @@ const Profile = () => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Styled.Actions>
|
</Styled.Actions>
|
||||||
<Styled.EqualGrid>
|
|
||||||
<Styled.PanelButton
|
<Styled.SettingsButton
|
||||||
slotHeader={
|
slotHeader={
|
||||||
<Styled.InlineRow>
|
<Styled.InlineRow>
|
||||||
<Icon iconName={IconName.Gear} />
|
<Icon iconName={IconName.Gear} />
|
||||||
{stringGetter({ key: STRING_KEYS.SETTINGS })}
|
{stringGetter({ key: STRING_KEYS.SETTINGS })}
|
||||||
</Styled.InlineRow>
|
</Styled.InlineRow>
|
||||||
}
|
}
|
||||||
onClick={() => navigate(AppRoute.Settings)}
|
onClick={() => navigate(AppRoute.Settings)}
|
||||||
|
/>
|
||||||
|
<Styled.HelpButton
|
||||||
|
slotHeader={
|
||||||
|
<Styled.InlineRow>
|
||||||
|
<Icon iconName={IconName.HelpCircle} />
|
||||||
|
{stringGetter({ key: STRING_KEYS.HELP })}
|
||||||
|
</Styled.InlineRow>
|
||||||
|
}
|
||||||
|
onClick={() => dispatch(openDialog({ type: DialogTypes.Help }))}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Styled.MigratePanel />
|
||||||
|
|
||||||
|
<Styled.DYDXBalancePanel />
|
||||||
|
|
||||||
|
<Styled.RewardsPanel
|
||||||
|
slotHeaderContent={stringGetter({ key: STRING_KEYS.TRADING_REWARDS })}
|
||||||
|
href={`/${chainTokenLabel}`}
|
||||||
|
hasSeparator
|
||||||
|
>
|
||||||
|
<Styled.Details
|
||||||
|
items={[
|
||||||
|
{
|
||||||
|
key: 'week-rewards',
|
||||||
|
label: stringGetter({ key: STRING_KEYS.THIS_WEEK }),
|
||||||
|
value: currentWeekTradingReward?.amount ?? '-',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
layout="grid"
|
||||||
/>
|
/>
|
||||||
<Styled.PanelButton
|
</Styled.RewardsPanel>
|
||||||
slotHeader={
|
<Styled.FeesPanel
|
||||||
<Styled.InlineRow>
|
slotHeaderContent={stringGetter({ key: STRING_KEYS.FEES })}
|
||||||
<Icon iconName={IconName.HelpCircle} />
|
href={`${AppRoute.Portfolio}/${PortfolioRoute.Fees}`}
|
||||||
{stringGetter({ key: STRING_KEYS.HELP })}
|
hasSeparator
|
||||||
</Styled.InlineRow>
|
>
|
||||||
}
|
<Styled.Details
|
||||||
onClick={() => dispatch(openDialog({ type: DialogTypes.Help }))}
|
items={[
|
||||||
|
{ key: 'maker', label: stringGetter({ key: STRING_KEYS.MAKER }), value: '-' },
|
||||||
|
{ key: 'taker', label: stringGetter({ key: STRING_KEYS.TAKER }), value: '-' },
|
||||||
|
{ key: 'volume', label: stringGetter({ key: STRING_KEYS.VOLUME_30D }), value: '-' },
|
||||||
|
]}
|
||||||
|
layout="grid"
|
||||||
/>
|
/>
|
||||||
</Styled.EqualGrid>
|
</Styled.FeesPanel>
|
||||||
|
|
||||||
<MigratePanel />
|
<Styled.HistoryPanel
|
||||||
<DYDXBalancePanel />
|
|
||||||
|
|
||||||
<Styled.EqualGrid>
|
|
||||||
<Styled.RewardsPanel
|
|
||||||
slotHeaderContent="Trading Rewards"
|
|
||||||
href={`/${chainTokenLabel}`}
|
|
||||||
hasSeparator
|
|
||||||
>
|
|
||||||
<Styled.Details
|
|
||||||
items={[
|
|
||||||
{
|
|
||||||
key: 'week-rewards',
|
|
||||||
label: stringGetter({ key: STRING_KEYS.THIS_WEEK }),
|
|
||||||
value: '-',
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
layout="grid"
|
|
||||||
/>
|
|
||||||
</Styled.RewardsPanel>
|
|
||||||
<Panel
|
|
||||||
slotHeaderContent={stringGetter({ key: STRING_KEYS.FEES })}
|
|
||||||
href={`${AppRoute.Portfolio}/${PortfolioRoute.Fees}`}
|
|
||||||
hasSeparator
|
|
||||||
>
|
|
||||||
<Styled.Details
|
|
||||||
items={[
|
|
||||||
{ key: 'maker', label: stringGetter({ key: STRING_KEYS.MAKER }), value: '-' },
|
|
||||||
{ key: 'taker', label: stringGetter({ key: STRING_KEYS.TAKER }), value: '-' },
|
|
||||||
{ key: 'volume', label: stringGetter({ key: STRING_KEYS.VOLUME_30D }), value: '-' },
|
|
||||||
]}
|
|
||||||
layout="grid"
|
|
||||||
/>
|
|
||||||
</Panel>
|
|
||||||
</Styled.EqualGrid>
|
|
||||||
|
|
||||||
<Styled.TablePanel
|
|
||||||
slotHeaderContent={stringGetter({ key: STRING_KEYS.HISTORY })}
|
slotHeaderContent={stringGetter({ key: STRING_KEYS.HISTORY })}
|
||||||
href={`${AppRoute.Portfolio}/${PortfolioRoute.History}/${HistoryRoute.Trades}`}
|
href={`${AppRoute.Portfolio}/${PortfolioRoute.History}/${HistoryRoute.Trades}`}
|
||||||
hasSeparator
|
hasSeparator
|
||||||
@@ -230,10 +233,10 @@ const Profile = () => {
|
|||||||
]}
|
]}
|
||||||
withInnerBorders={false}
|
withInnerBorders={false}
|
||||||
/>
|
/>
|
||||||
</Styled.TablePanel>
|
</Styled.HistoryPanel>
|
||||||
|
|
||||||
<GovernancePanel />
|
<Styled.GovernancePanel />
|
||||||
<StakingPanel />
|
<Styled.StakingPanel />
|
||||||
</Styled.MobileProfileLayout>
|
</Styled.MobileProfileLayout>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -245,14 +248,27 @@ const Styled: Record<string, AnyStyledComponent> = {};
|
|||||||
Styled.MobileProfileLayout = styled.div`
|
Styled.MobileProfileLayout = styled.div`
|
||||||
${layoutMixins.contentContainerPage}
|
${layoutMixins.contentContainerPage}
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
padding: 1.25rem 0.9rem;
|
padding: 1.25rem 0.9rem;
|
||||||
max-width: 100vw;
|
max-width: 100vw;
|
||||||
|
|
||||||
|
grid-template-areas:
|
||||||
|
'header header'
|
||||||
|
'actions actions'
|
||||||
|
'settings help'
|
||||||
|
'migrate migrate'
|
||||||
|
'balance balance'
|
||||||
|
'rewards fees'
|
||||||
|
'history history'
|
||||||
|
'governance governance'
|
||||||
|
'staking staking';
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Header = styled.header`
|
Styled.Header = styled.header`
|
||||||
|
grid-area: header;
|
||||||
${layoutMixins.row}
|
${layoutMixins.row}
|
||||||
|
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -299,6 +315,7 @@ Styled.Address = styled.h1`
|
|||||||
Styled.Actions = styled(Toolbar)`
|
Styled.Actions = styled(Toolbar)`
|
||||||
${layoutMixins.spacedRow}
|
${layoutMixins.spacedRow}
|
||||||
--stickyArea-topHeight: 5rem;
|
--stickyArea-topHeight: 5rem;
|
||||||
|
grid-area: actions;
|
||||||
|
|
||||||
> a,
|
> a,
|
||||||
> label {
|
> label {
|
||||||
@@ -329,22 +346,16 @@ Styled.ActionButton = styled(IconButton)<{ iconName?: IconName }>`
|
|||||||
`}
|
`}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.EqualGrid = styled.div`
|
|
||||||
${layoutMixins.gridEqualColumns}
|
|
||||||
|
|
||||||
gap: 1rem;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Details = styled(Details)`
|
Styled.Details = styled(Details)`
|
||||||
font: var(--font-small-book);
|
font: var(--font-small-book);
|
||||||
--details-value-font: var(--font-medium-book);
|
--details-value-font: var(--font-medium-book);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.RewardsPanel = styled(Panel)`
|
Styled.RewardsPanel = styled(Panel)`
|
||||||
|
grid-area: rewards;
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
|
height: 100%;
|
||||||
&,
|
> div {
|
||||||
> * {
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,7 +364,12 @@ Styled.RewardsPanel = styled(Panel)`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.TablePanel = styled(Panel)`
|
Styled.FeesPanel = styled(Panel)`
|
||||||
|
grid-area: fees;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.HistoryPanel = styled(Panel)`
|
||||||
|
grid-area: history;
|
||||||
--panel-content-paddingY: 0;
|
--panel-content-paddingY: 0;
|
||||||
--panel-content-paddingX: 0;
|
--panel-content-paddingX: 0;
|
||||||
|
|
||||||
@@ -393,3 +409,27 @@ Styled.PanelButton = styled(Panel)`
|
|||||||
--panel-paddingY: 0
|
--panel-paddingY: 0
|
||||||
--panel-paddingX:0;
|
--panel-paddingX:0;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
Styled.SettingsButton = styled(Styled.PanelButton)`
|
||||||
|
grid-area: settings;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.HelpButton = styled(Styled.PanelButton)`
|
||||||
|
grid-area: help;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.MigratePanel = styled(MigratePanel)`
|
||||||
|
grid-area: migrate;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.DYDXBalancePanel = styled(DYDXBalancePanel)`
|
||||||
|
grid-area: balance;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.GovernancePanel = styled(GovernancePanel)`
|
||||||
|
grid-area: governance;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.StakingPanel = styled(StakingPanel)`
|
||||||
|
grid-area: staking;
|
||||||
|
`;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { OnboardingTriggerButton } from '@/views/dialogs/OnboardingTriggerButton
|
|||||||
import { openDialog } from '@/state/dialogs';
|
import { openDialog } from '@/state/dialogs';
|
||||||
import { calculateCanAccountTrade } from '@/state/accountCalculators';
|
import { calculateCanAccountTrade } from '@/state/accountCalculators';
|
||||||
|
|
||||||
export const DYDXBalancePanel = () => {
|
export const DYDXBalancePanel = ({ className }: { className?: string }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
|
||||||
@@ -33,6 +33,7 @@ export const DYDXBalancePanel = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Panel
|
<Panel
|
||||||
|
className={className}
|
||||||
slotHeader={
|
slotHeader={
|
||||||
<Styled.Header>
|
<Styled.Header>
|
||||||
<Styled.Title>
|
<Styled.Title>
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
import { useCallback, useState } from 'react';
|
||||||
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
|
|
||||||
|
import { useStringGetter } from '@/hooks';
|
||||||
|
|
||||||
|
import {
|
||||||
|
HISTORICAL_TRADING_REWARDS_PERIODS,
|
||||||
|
HistoricalTradingRewardsPeriod,
|
||||||
|
HistoricalTradingRewardsPeriods,
|
||||||
|
} from '@/constants/abacus';
|
||||||
|
|
||||||
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
|
import breakpoints from '@/styles/breakpoints';
|
||||||
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
|
import { Panel } from '@/components/Panel';
|
||||||
|
import { ToggleGroup } from '@/components/ToggleGroup';
|
||||||
|
import { WithTooltip } from '@/components/WithTooltip';
|
||||||
|
import { TradingRewardHistoryTable } from '@/views/tables/TradingRewardHistoryTable';
|
||||||
|
|
||||||
|
import abacusStateManager from '@/lib/abacus';
|
||||||
|
|
||||||
|
export const RewardHistoryPanel = () => {
|
||||||
|
const stringGetter = useStringGetter();
|
||||||
|
|
||||||
|
const [selectedPeriod, setSelectedPeriod] = useState<HistoricalTradingRewardsPeriods>(
|
||||||
|
abacusStateManager.getHistoricalTradingRewardPeriod() || HistoricalTradingRewardsPeriod.WEEKLY
|
||||||
|
);
|
||||||
|
|
||||||
|
const onSelectPeriod = useCallback(
|
||||||
|
(periodName: string) => {
|
||||||
|
const selectedPeriod =
|
||||||
|
HISTORICAL_TRADING_REWARDS_PERIODS[
|
||||||
|
periodName as keyof typeof HISTORICAL_TRADING_REWARDS_PERIODS
|
||||||
|
];
|
||||||
|
setSelectedPeriod(selectedPeriod);
|
||||||
|
abacusStateManager.setHistoricalTradingRewardPeriod(selectedPeriod);
|
||||||
|
},
|
||||||
|
[setSelectedPeriod, selectedPeriod]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Panel
|
||||||
|
slotHeader={
|
||||||
|
<Styled.Header>
|
||||||
|
<Styled.Title>
|
||||||
|
<WithTooltip tooltip="reward-history">
|
||||||
|
<h3>{stringGetter({ key: STRING_KEYS.REWARD_HISTORY })}</h3>
|
||||||
|
</WithTooltip>
|
||||||
|
<span>{stringGetter({ key: STRING_KEYS.REWARD_HISTORY_DESCRIPTION })}</span>
|
||||||
|
</Styled.Title>
|
||||||
|
<ToggleGroup
|
||||||
|
items={[
|
||||||
|
{
|
||||||
|
value: HistoricalTradingRewardsPeriod.MONTHLY.name,
|
||||||
|
label: stringGetter({ key: STRING_KEYS.MONTHLY }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: HistoricalTradingRewardsPeriod.WEEKLY.name,
|
||||||
|
label: stringGetter({ key: STRING_KEYS.WEEKLY }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: HistoricalTradingRewardsPeriod.DAILY.name,
|
||||||
|
label: stringGetter({ key: STRING_KEYS.DAILY }),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
value={selectedPeriod.name}
|
||||||
|
onValueChange={onSelectPeriod}
|
||||||
|
/>
|
||||||
|
</Styled.Header>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<TradingRewardHistoryTable period={selectedPeriod} />
|
||||||
|
</Panel>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
|
Styled.Header = styled.div`
|
||||||
|
${layoutMixins.spacedRow}
|
||||||
|
|
||||||
|
padding: 1rem 1rem 0;
|
||||||
|
margin-bottom: -0.5rem;
|
||||||
|
|
||||||
|
@media ${breakpoints.notTablet} {
|
||||||
|
padding: 1.25rem 1.5rem 0;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Title = styled.div`
|
||||||
|
${layoutMixins.column}
|
||||||
|
color: var(--color-text-0);
|
||||||
|
font: var(--font-small-book);
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font: var(--font-medium-book);
|
||||||
|
color: var(--color-text-2);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Content = styled.div`
|
||||||
|
${layoutMixins.flexColumn}
|
||||||
|
gap: 0.75rem;
|
||||||
|
`;
|
||||||
@@ -29,20 +29,18 @@ export const RewardsHelpPanel = () => {
|
|||||||
>
|
>
|
||||||
<Accordion
|
<Accordion
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
header: 'Who is eligible for trading rewards?',
|
header: stringGetter({ key: STRING_KEYS.FAQ_WHO_IS_ELIGIBLE_QUESTION }),
|
||||||
content: 'All traders are eligible for trading rewards.',
|
content: stringGetter({ key: STRING_KEYS.FAQ_WHO_IS_ELIGIBLE_ANSWER }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: 'How do trading rewards work?',
|
header: stringGetter({ key: STRING_KEYS.FAQ_HOW_DO_TRADING_REWARDS_WORK_QUESTION }),
|
||||||
content:
|
content: stringGetter({ key: STRING_KEYS.FAQ_HOW_DO_TRADING_REWARDS_WORK_ANSWER }),
|
||||||
'Immediately after each fill, trading rewards are sent directly to the trader’s dYdX Chain address, based on the amount of fees paid by the trader.',
|
},
|
||||||
},
|
{
|
||||||
{
|
header: stringGetter({ key: STRING_KEYS.FAQ_HOW_DO_I_CLAIM_MY_REWARDS_QUESTION }),
|
||||||
header: 'How do I claim my rewards?',
|
content: stringGetter({ key: STRING_KEYS.FAQ_HOW_DO_I_CLAIM_MY_REWARDS_ANSWER }),
|
||||||
content:
|
},
|
||||||
'Each block, trading rewards are automatically sent directly to the trader’s dYdX Chain address.',
|
|
||||||
},
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Styled.HelpCard>
|
</Styled.HelpCard>
|
||||||
@@ -72,7 +70,7 @@ Styled.Header = styled.div`
|
|||||||
font: var(--font-small-book);
|
font: var(--font-small-book);
|
||||||
|
|
||||||
@media ${breakpoints.notTablet} {
|
@media ${breakpoints.notTablet} {
|
||||||
padding: 1.5rem 1.25rem;
|
padding: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import styled, { AnyStyledComponent } from 'styled-components';
|
import styled, { AnyStyledComponent, css } from 'styled-components';
|
||||||
import { useDispatch } from 'react-redux';
|
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
@@ -11,18 +10,20 @@ import { breakpoints } from '@/styles';
|
|||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
import { BackButton } from '@/components/BackButton';
|
import { BackButton } from '@/components/BackButton';
|
||||||
import { Panel } from '@/components/Panel';
|
|
||||||
|
import { testFlags } from '@/lib/testFlags';
|
||||||
|
|
||||||
import { DYDXBalancePanel } from './DYDXBalancePanel';
|
import { DYDXBalancePanel } from './DYDXBalancePanel';
|
||||||
import { LaunchIncentivesPanel } from './LaunchIncentivesPanel';
|
import { LaunchIncentivesPanel } from './LaunchIncentivesPanel';
|
||||||
import { MigratePanel } from './MigratePanel';
|
import { MigratePanel } from './MigratePanel';
|
||||||
import { RewardsHelpPanel } from './RewardsHelpPanel';
|
import { RewardsHelpPanel } from './RewardsHelpPanel';
|
||||||
|
import { TradingRewardsSummaryPanel } from './TradingRewardsSummaryPanel';
|
||||||
|
import { RewardHistoryPanel } from './RewardHistoryPanel';
|
||||||
import { GovernancePanel } from './GovernancePanel';
|
import { GovernancePanel } from './GovernancePanel';
|
||||||
import { StakingPanel } from './StakingPanel';
|
import { StakingPanel } from './StakingPanel';
|
||||||
import { NewMarketsPanel } from './NewMarketsPanel';
|
import { NewMarketsPanel } from './NewMarketsPanel';
|
||||||
|
|
||||||
const RewardsPage = () => {
|
const RewardsPage = () => {
|
||||||
const dispatch = useDispatch();
|
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { isTablet, isNotTablet } = useBreakpoints();
|
const { isTablet, isNotTablet } = useBreakpoints();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -35,25 +36,38 @@ const RewardsPage = () => {
|
|||||||
{stringGetter({ key: STRING_KEYS.TRADING_REWARDS })}
|
{stringGetter({ key: STRING_KEYS.TRADING_REWARDS })}
|
||||||
</Styled.MobileHeader>
|
</Styled.MobileHeader>
|
||||||
)}
|
)}
|
||||||
{import.meta.env.VITE_V3_TOKEN_ADDRESS && isNotTablet && <MigratePanel />}
|
<Styled.GridLayout
|
||||||
|
showTradingRewards={testFlags.showTradingRewards}
|
||||||
|
showMigratePanel={import.meta.env.VITE_V3_TOKEN_ADDRESS && isNotTablet}
|
||||||
|
>
|
||||||
|
{import.meta.env.VITE_V3_TOKEN_ADDRESS && isNotTablet && <Styled.MigratePanel />}
|
||||||
|
|
||||||
{isTablet ? (
|
{isTablet ? (
|
||||||
<LaunchIncentivesPanel />
|
<Styled.LaunchIncentivesPanel />
|
||||||
) : (
|
) : (
|
||||||
<Styled.PanelRowIncentivesAndBalance>
|
<>
|
||||||
<LaunchIncentivesPanel />
|
<Styled.LaunchIncentivesPanel />
|
||||||
<DYDXBalancePanel />
|
<Styled.DYDXBalancePanel />
|
||||||
</Styled.PanelRowIncentivesAndBalance>
|
</>
|
||||||
)}
|
)}
|
||||||
{isNotTablet && (
|
|
||||||
<Styled.PanelRow>
|
|
||||||
<NewMarketsPanel />
|
|
||||||
<GovernancePanel />
|
|
||||||
<StakingPanel />
|
|
||||||
</Styled.PanelRow>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<RewardsHelpPanel />
|
{testFlags.showTradingRewards && (
|
||||||
|
<Styled.TradingRewardsColumn>
|
||||||
|
<TradingRewardsSummaryPanel />
|
||||||
|
{isTablet && <RewardsHelpPanel />}
|
||||||
|
<RewardHistoryPanel />
|
||||||
|
</Styled.TradingRewardsColumn>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{isNotTablet && (
|
||||||
|
<Styled.OtherColumn showTradingRewards={testFlags.showTradingRewards}>
|
||||||
|
<NewMarketsPanel />
|
||||||
|
<GovernancePanel />
|
||||||
|
<StakingPanel />
|
||||||
|
<RewardsHelpPanel />
|
||||||
|
</Styled.OtherColumn>
|
||||||
|
)}
|
||||||
|
</Styled.GridLayout>
|
||||||
</Styled.Page>
|
</Styled.Page>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -64,7 +78,6 @@ const Styled: Record<string, AnyStyledComponent> = {};
|
|||||||
|
|
||||||
Styled.Page = styled.div`
|
Styled.Page = styled.div`
|
||||||
${layoutMixins.contentContainerPage}
|
${layoutMixins.contentContainerPage}
|
||||||
gap: 1.5rem;
|
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
@@ -89,27 +102,98 @@ Styled.MobileHeader = styled.header`
|
|||||||
${layoutMixins.stickyHeader}
|
${layoutMixins.stickyHeader}
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
padding: 1.25rem 0;
|
padding: 1.25rem 0;
|
||||||
margin-bottom: -1.5rem;
|
|
||||||
|
|
||||||
font: var(--font-large-medium);
|
font: var(--font-large-medium);
|
||||||
color: var(--color-text-2);
|
color: var(--color-text-2);
|
||||||
background-color: var(--color-layer-2);
|
background-color: var(--color-layer-2);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Panel = styled(Panel)`
|
Styled.GridLayout = styled.div<{ showTradingRewards?: boolean; showMigratePanel?: boolean }>`
|
||||||
height: fit-content;
|
--gap: 1.5rem;
|
||||||
`;
|
display: grid;
|
||||||
|
grid-template-columns: 2fr 1fr;
|
||||||
|
gap: var(--gap);
|
||||||
|
|
||||||
Styled.PanelRow = styled.div`
|
> * {
|
||||||
${layoutMixins.gridEqualColumns}
|
gap: var(--gap);
|
||||||
gap: 1.5rem;
|
}
|
||||||
|
|
||||||
|
${({ showTradingRewards, showMigratePanel }) =>
|
||||||
|
showTradingRewards && showMigratePanel
|
||||||
|
? css`
|
||||||
|
grid-template-areas:
|
||||||
|
'migrate migrate'
|
||||||
|
'incentives balance'
|
||||||
|
'rewards other';
|
||||||
|
`
|
||||||
|
: showTradingRewards
|
||||||
|
? css`
|
||||||
|
grid-template-areas: 'incentives balance' 'rewards other';
|
||||||
|
`
|
||||||
|
: showMigratePanel
|
||||||
|
? css`
|
||||||
|
grid-template-areas: 'migrate migrate' 'incentives balance' 'other other';
|
||||||
|
`
|
||||||
|
: css`
|
||||||
|
grid-template-areas: 'incentives balance' 'other other';
|
||||||
|
`};
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
@media ${breakpoints.tablet} {
|
||||||
grid-auto-flow: row;
|
--gap: 1rem;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
|
|
||||||
|
${({ showTradingRewards }) =>
|
||||||
|
showTradingRewards
|
||||||
|
? css`
|
||||||
|
grid-template-areas:
|
||||||
|
'incentives'
|
||||||
|
'rewards';
|
||||||
|
`
|
||||||
|
: css`
|
||||||
|
grid-template-areas: 'incentives';
|
||||||
|
`}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.PanelRowIncentivesAndBalance = styled(Styled.PanelRow)`
|
Styled.MigratePanel = styled(MigratePanel)`
|
||||||
grid-template-columns: 2fr 1fr;
|
grid-area: migrate;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.LaunchIncentivesPanel = styled(LaunchIncentivesPanel)`
|
||||||
|
grid-area: incentives;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.DYDXBalancePanel = styled(DYDXBalancePanel)`
|
||||||
|
grid-area: balance;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.TradingRewardsColumn = styled.div`
|
||||||
|
grid-area: rewards;
|
||||||
|
${layoutMixins.flexColumn}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.OtherColumn = styled.div<{ showTradingRewards?: boolean }>`
|
||||||
|
grid-area: other;
|
||||||
|
${layoutMixins.flexColumn}
|
||||||
|
|
||||||
|
${({ showTradingRewards }) =>
|
||||||
|
!showTradingRewards &&
|
||||||
|
css`
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
|
||||||
|
> section:last-of-type {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.RewardHistoryHeader = styled.div`
|
||||||
|
h3 {
|
||||||
|
font: var(--font-medium-book);
|
||||||
|
color: var(--color-text-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
padding: 1rem 1.5rem 0;
|
||||||
|
margin-bottom: -0.5rem;
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -0,0 +1,134 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
|
|
||||||
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
import { useStringGetter, useTokenConfigs } from '@/hooks';
|
||||||
|
|
||||||
|
import { AssetIcon } from '@/components/AssetIcon';
|
||||||
|
import { Details } from '@/components/Details';
|
||||||
|
import { Output, OutputType } from '@/components/Output';
|
||||||
|
import { Panel } from '@/components/Panel';
|
||||||
|
|
||||||
|
import { getHistoricalTradingRewardsForCurrentWeek } from '@/state/accountSelectors';
|
||||||
|
|
||||||
|
import abacusStateManager from '@/lib/abacus';
|
||||||
|
|
||||||
|
export const TradingRewardsSummaryPanel = () => {
|
||||||
|
const stringGetter = useStringGetter();
|
||||||
|
const { chainTokenLabel } = useTokenConfigs();
|
||||||
|
const currentWeekTradingReward = useSelector(getHistoricalTradingRewardsForCurrentWeek, shallowEqual);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
abacusStateManager.refreshHistoricalTradingRewards();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return !currentWeekTradingReward ? null : (
|
||||||
|
<Panel
|
||||||
|
slotHeader={
|
||||||
|
<Styled.Header>{stringGetter({ key: STRING_KEYS.TRADING_REWARDS_SUMMARY })}</Styled.Header>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Styled.Content>
|
||||||
|
<Styled.TradingRewardsDetails
|
||||||
|
layout="grid"
|
||||||
|
items={[
|
||||||
|
{
|
||||||
|
key: 'week',
|
||||||
|
label: (
|
||||||
|
<Styled.Label>
|
||||||
|
<h4>{stringGetter({ key: STRING_KEYS.THIS_WEEK })}</h4>
|
||||||
|
</Styled.Label>
|
||||||
|
),
|
||||||
|
value: (
|
||||||
|
<Styled.Column>
|
||||||
|
<Output
|
||||||
|
slotRight={<Styled.AssetIcon symbol={chainTokenLabel} />}
|
||||||
|
type={OutputType.Asset}
|
||||||
|
value={currentWeekTradingReward.amount}
|
||||||
|
/>
|
||||||
|
<Styled.TimePeriod>
|
||||||
|
<Output
|
||||||
|
type={OutputType.Date}
|
||||||
|
value={currentWeekTradingReward.startedAtInMilliseconds}
|
||||||
|
timeOptions={{ useUTC: true }}
|
||||||
|
/>
|
||||||
|
→
|
||||||
|
<Output
|
||||||
|
type={OutputType.Date}
|
||||||
|
value={currentWeekTradingReward.endedAtInMilliseconds}
|
||||||
|
timeOptions={{ useUTC: true }}
|
||||||
|
/>
|
||||||
|
</Styled.TimePeriod>
|
||||||
|
</Styled.Column>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
// TODO(@aforaleka): add all-time when supported
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Styled.Content>
|
||||||
|
</Panel>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
|
Styled.Header = styled.div`
|
||||||
|
padding: var(--panel-paddingY) var(--panel-paddingX) 0;
|
||||||
|
font: var(--font-medium-book);
|
||||||
|
color: var(--color-text-2);
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Content = styled.div`
|
||||||
|
${layoutMixins.flexColumn}
|
||||||
|
gap: 0.75rem;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.TradingRewardsDetails = styled(Details)`
|
||||||
|
--details-item-backgroundColor: var(--color-layer-6);
|
||||||
|
|
||||||
|
grid-template-columns: 1fr; // TODO(@aforaleka): change to 1fr 1fr when all-time is supported
|
||||||
|
gap: 1rem;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 1rem;
|
||||||
|
border-radius: 0.75em;
|
||||||
|
background-color: var(--color-layer-5);
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
color: var(--color-text-2);
|
||||||
|
font: var(--font-large-book);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Label = styled.div`
|
||||||
|
${layoutMixins.spacedRow}
|
||||||
|
|
||||||
|
font: var(--font-base-book);
|
||||||
|
color: var(--color-text-1);
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.TimePeriod = styled.div`
|
||||||
|
${layoutMixins.inlineRow}
|
||||||
|
|
||||||
|
&, output {
|
||||||
|
color: var(--color-text-0);
|
||||||
|
font: var(--font-small-book);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Column = styled.div`
|
||||||
|
${layoutMixins.flexColumn}
|
||||||
|
gap: 0.33rem;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.AssetIcon = styled(AssetIcon)`
|
||||||
|
margin-left: 0.5ch;
|
||||||
|
`;
|
||||||
@@ -13,6 +13,7 @@ import type {
|
|||||||
HistoricalPnlPeriods,
|
HistoricalPnlPeriods,
|
||||||
SubAccountHistoricalPNLs,
|
SubAccountHistoricalPNLs,
|
||||||
UsageRestriction,
|
UsageRestriction,
|
||||||
|
TradingRewards,
|
||||||
} from '@/constants/abacus';
|
} from '@/constants/abacus';
|
||||||
|
|
||||||
import { OnboardingGuard, OnboardingState } from '@/constants/account';
|
import { OnboardingGuard, OnboardingState } from '@/constants/account';
|
||||||
@@ -24,6 +25,7 @@ import { getLocalStorage } from '@/lib/localStorage';
|
|||||||
export type AccountState = {
|
export type AccountState = {
|
||||||
balances?: Record<string, AccountBalance>;
|
balances?: Record<string, AccountBalance>;
|
||||||
stakingBalances?: Record<string, AccountBalance>;
|
stakingBalances?: Record<string, AccountBalance>;
|
||||||
|
tradingRewards?: TradingRewards;
|
||||||
wallet?: Nullable<Wallet>;
|
wallet?: Nullable<Wallet>;
|
||||||
walletType?: WalletType;
|
walletType?: WalletType;
|
||||||
|
|
||||||
@@ -179,6 +181,9 @@ export const accountSlice = createSlice({
|
|||||||
setStakingBalances: (state, action: PayloadAction<Record<string, AccountBalance>>) => {
|
setStakingBalances: (state, action: PayloadAction<Record<string, AccountBalance>>) => {
|
||||||
state.stakingBalances = action.payload;
|
state.stakingBalances = action.payload;
|
||||||
},
|
},
|
||||||
|
setTradingRewards: (state, action: PayloadAction<TradingRewards>) => {
|
||||||
|
state.tradingRewards = action.payload;
|
||||||
|
},
|
||||||
addUncommittedOrderClientId: (state, action: PayloadAction<number>) => {
|
addUncommittedOrderClientId: (state, action: PayloadAction<number>) => {
|
||||||
state.uncommittedOrderClientIds.push(action.payload);
|
state.uncommittedOrderClientIds.push(action.payload);
|
||||||
},
|
},
|
||||||
@@ -206,6 +211,7 @@ export const {
|
|||||||
viewedOrders,
|
viewedOrders,
|
||||||
setBalances,
|
setBalances,
|
||||||
setStakingBalances,
|
setStakingBalances,
|
||||||
|
setTradingRewards,
|
||||||
addUncommittedOrderClientId,
|
addUncommittedOrderClientId,
|
||||||
removeUncommittedOrderClientId,
|
removeUncommittedOrderClientId,
|
||||||
} = accountSlice.actions;
|
} = accountSlice.actions;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { Nullable, kollections } from '@dydxprotocol/v4-abacus';
|
||||||
import { OrderSide } from '@dydxprotocol/v4-client-js';
|
import { OrderSide } from '@dydxprotocol/v4-client-js';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
|
|
||||||
@@ -9,6 +10,8 @@ import {
|
|||||||
AbacusOrderStatus,
|
AbacusOrderStatus,
|
||||||
AbacusPositionSide,
|
AbacusPositionSide,
|
||||||
ORDER_SIDES,
|
ORDER_SIDES,
|
||||||
|
HistoricalTradingReward,
|
||||||
|
HistoricalTradingRewardsPeriod,
|
||||||
} from '@/constants/abacus';
|
} from '@/constants/abacus';
|
||||||
|
|
||||||
import { OnboardingState } from '@/constants/account';
|
import { OnboardingState } from '@/constants/account';
|
||||||
@@ -349,6 +352,38 @@ export const getBalances = (state: RootState) => state.account?.balances;
|
|||||||
* */
|
* */
|
||||||
export const getStakingBalances = (state: RootState) => state.account?.stakingBalances;
|
export const getStakingBalances = (state: RootState) => state.account?.stakingBalances;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns account all time trading rewards
|
||||||
|
*/
|
||||||
|
export const getTotalTradingRewards = (state: RootState) => state.account?.tradingRewards?.total;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns account trading rewards aggregated by period
|
||||||
|
*/
|
||||||
|
export const getHistoricalTradingRewards = (state: RootState) =>
|
||||||
|
state.account?.tradingRewards?.historical;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns account historical trading rewards for the specified perid
|
||||||
|
*/
|
||||||
|
export const getHistoricalTradingRewardsForPeriod = (period: string) =>
|
||||||
|
createSelector(
|
||||||
|
[getHistoricalTradingRewards],
|
||||||
|
(
|
||||||
|
historicalTradingRewards: Nullable<
|
||||||
|
kollections.Map<string, kollections.List<HistoricalTradingReward>>
|
||||||
|
>
|
||||||
|
) => historicalTradingRewards?.get(period)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns account historical trading rewards for the current week
|
||||||
|
*/
|
||||||
|
export const getHistoricalTradingRewardsForCurrentWeek = createSelector(
|
||||||
|
[getHistoricalTradingRewardsForPeriod(HistoricalTradingRewardsPeriod.WEEKLY.name)],
|
||||||
|
(historicalTradingRewards) => historicalTradingRewards?.firstOrNull()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns UsageRestriction of the current session
|
* @returns UsageRestriction of the current session
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,164 @@
|
|||||||
|
import styled, { type AnyStyledComponent } from 'styled-components';
|
||||||
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
|
|
||||||
|
import { HistoricalTradingRewardsPeriods, HistoricalTradingReward } from '@/constants/abacus';
|
||||||
|
import { STRING_KEYS, StringGetterFunction } from '@/constants/localization';
|
||||||
|
import { useStringGetter, useTokenConfigs } from '@/hooks';
|
||||||
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
|
import { AssetIcon } from '@/components/AssetIcon';
|
||||||
|
import { Output, OutputType } from '@/components/Output';
|
||||||
|
import { Table, TableCell, type ColumnDef } from '@/components/Table';
|
||||||
|
|
||||||
|
import {
|
||||||
|
getHistoricalTradingRewards,
|
||||||
|
getHistoricalTradingRewardsForPeriod,
|
||||||
|
} from '@/state/accountSelectors';
|
||||||
|
|
||||||
|
export enum TradingRewardHistoryTableColumnKey {
|
||||||
|
Event = 'Event',
|
||||||
|
Earned = 'Earned',
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTradingRewardHistoryTableColumnDef = ({
|
||||||
|
key,
|
||||||
|
chainTokenLabel,
|
||||||
|
stringGetter,
|
||||||
|
}: {
|
||||||
|
key: TradingRewardHistoryTableColumnKey;
|
||||||
|
chainTokenLabel: string;
|
||||||
|
stringGetter: StringGetterFunction;
|
||||||
|
}): ColumnDef<HistoricalTradingReward> => ({
|
||||||
|
...(
|
||||||
|
{
|
||||||
|
[TradingRewardHistoryTableColumnKey.Event]: {
|
||||||
|
columnKey: TradingRewardHistoryTableColumnKey.Event,
|
||||||
|
getCellValue: (row) => row.startedAtInMilliseconds,
|
||||||
|
label: stringGetter({ key: STRING_KEYS.EVENT }),
|
||||||
|
renderCell: ({ startedAtInMilliseconds, endedAtInMilliseconds }) => (
|
||||||
|
<TableCell stacked>
|
||||||
|
<Styled.Rewarded>{stringGetter({ key: STRING_KEYS.REWARDED })}</Styled.Rewarded>
|
||||||
|
<Styled.TimePeriod>
|
||||||
|
{stringGetter({
|
||||||
|
key: STRING_KEYS.FOR_TRADING,
|
||||||
|
params: {
|
||||||
|
PERIOD: (
|
||||||
|
<>
|
||||||
|
<Output
|
||||||
|
type={OutputType.Date}
|
||||||
|
value={startedAtInMilliseconds}
|
||||||
|
timeOptions={{ useUTC: true }}
|
||||||
|
/>
|
||||||
|
→
|
||||||
|
<Output
|
||||||
|
type={OutputType.Date}
|
||||||
|
value={endedAtInMilliseconds}
|
||||||
|
timeOptions={{ useUTC: true }}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
})}
|
||||||
|
</Styled.TimePeriod>
|
||||||
|
</TableCell>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
[TradingRewardHistoryTableColumnKey.Earned]: {
|
||||||
|
columnKey: TradingRewardHistoryTableColumnKey.Earned,
|
||||||
|
getCellValue: (row) => row.amount,
|
||||||
|
label: stringGetter({ key: STRING_KEYS.EARNED }),
|
||||||
|
renderCell: ({ amount }) => (
|
||||||
|
<Output
|
||||||
|
type={OutputType.Asset}
|
||||||
|
value={amount}
|
||||||
|
slotRight={<Styled.AssetIcon symbol={chainTokenLabel} />}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
} as Record<TradingRewardHistoryTableColumnKey, ColumnDef<HistoricalTradingReward>>
|
||||||
|
)[key],
|
||||||
|
});
|
||||||
|
|
||||||
|
type ElementProps = {
|
||||||
|
columnKeys?: TradingRewardHistoryTableColumnKey[];
|
||||||
|
period: HistoricalTradingRewardsPeriods;
|
||||||
|
};
|
||||||
|
|
||||||
|
type StyleProps = {
|
||||||
|
withOuterBorder?: boolean;
|
||||||
|
withInnerBorders?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const TradingRewardHistoryTable = ({
|
||||||
|
period,
|
||||||
|
columnKeys = Object.values(TradingRewardHistoryTableColumnKey),
|
||||||
|
withOuterBorder,
|
||||||
|
withInnerBorders = true,
|
||||||
|
}: ElementProps & StyleProps) => {
|
||||||
|
const stringGetter = useStringGetter();
|
||||||
|
const { chainTokenLabel } = useTokenConfigs();
|
||||||
|
|
||||||
|
const periodTradingRewards = useSelector(
|
||||||
|
getHistoricalTradingRewardsForPeriod(period.name),
|
||||||
|
shallowEqual
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Styled.Table
|
||||||
|
label={stringGetter({ key: STRING_KEYS.REWARD_HISTORY })}
|
||||||
|
data={periodTradingRewards?.toArray() ?? []}
|
||||||
|
getRowKey={(row: any) => row.startedAtInMilliseconds}
|
||||||
|
columns={columnKeys.map((key: TradingRewardHistoryTableColumnKey) =>
|
||||||
|
getTradingRewardHistoryTableColumnDef({
|
||||||
|
key,
|
||||||
|
chainTokenLabel,
|
||||||
|
stringGetter,
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
slotEmpty={
|
||||||
|
<div>{stringGetter({ key: STRING_KEYS.EMPTY_HISTORICAL_REWARDS_DESCRIPTION })}</div>
|
||||||
|
}
|
||||||
|
selectionBehavior="replace"
|
||||||
|
withOuterBorder={withOuterBorder}
|
||||||
|
withInnerBorders={withInnerBorders}
|
||||||
|
initialNumRowsToShow={5}
|
||||||
|
withScrollSnapColumns
|
||||||
|
withScrollSnapRows
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
|
Styled.Table = styled(Table)`
|
||||||
|
--tableCell-padding: 0.5rem 0;
|
||||||
|
--tableHeader-backgroundColor: var(--color-layer-3);
|
||||||
|
--tableRow-backgroundColor: var(--color-layer-3);
|
||||||
|
--tableViewMore-borderColor: var(--color-layer-3);
|
||||||
|
|
||||||
|
tbody {
|
||||||
|
font: var(--font-medium-book);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Rewarded = styled.span`
|
||||||
|
color: var(--color-text-2);
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.TimePeriod = styled.div`
|
||||||
|
${layoutMixins.inlineRow}
|
||||||
|
|
||||||
|
&& {
|
||||||
|
color: var(--color-text-0);
|
||||||
|
font: var(--font-base-book);
|
||||||
|
}
|
||||||
|
|
||||||
|
output {
|
||||||
|
color: var(--color-text-1);
|
||||||
|
font: var(--font-base-book);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.AssetIcon = styled(AssetIcon)`
|
||||||
|
margin-left: 0.5ch;
|
||||||
|
`;
|
||||||
Reference in New Issue
Block a user