use latest mango client to add confirming transaction notification

This commit is contained in:
Tyler Shipe 2021-12-29 13:39:17 -05:00
parent 05bd420fce
commit 41fa096294
7 changed files with 32 additions and 22 deletions

View File

@ -1,7 +1,7 @@
const Loading = ({ className = '' }) => {
return (
<svg
className={`${className} animate-spin h-5 w-5`}
className={`${className} animate-spin-fast h-5 w-5`}
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"

View File

@ -103,7 +103,7 @@ const Notification = ({ notification }: { notification: Notification }) => {
hideNotification()
}
},
parsedTitle || type === 'confirm' || type === 'error' ? 30000 : 10000
parsedTitle || type === 'confirm' || type === 'error' ? 30000 : 8000
)
return () => {
@ -129,7 +129,7 @@ const Notification = ({ notification }: { notification: Notification }) => {
<XCircleIcon className={`text-th-red h-7 w-7 mr-1`} />
)}
{type === 'confirm' && (
<Loading className={`text-th-fgd-3 h-7 w-7 mr-1`} />
<Loading className="text-th-fgd-3 h-7 w-7 mr-1" />
)}
</div>
<div className={`ml-2 flex-1`}>

View File

@ -26,7 +26,7 @@
]
},
"dependencies": {
"@blockworks-foundation/mango-client": "^3.2.17",
"@blockworks-foundation/mango-client": "latest",
"@headlessui/react": "^1.2.0",
"@heroicons/react": "^1.0.0",
"@jup-ag/react-hook": "latest",

View File

@ -299,7 +299,7 @@
"stop-limit": "Stop Limit",
"stop-loss": "Stop Loss",
"stop-price": "Stop Price",
"successfully-placed": "Successfully sent order",
"successfully-placed": "Successfully placed order",
"supported-assets": "Please fund wallet with one of the supported assets.",
"swap": "Swap",
"take-profit": "Take Profit",

View File

@ -193,7 +193,16 @@ const useMangoStore = create<MangoStore>((set, get) => {
cluster: CLUSTER,
current: connection,
websocket: WEBSOCKET_CONNECTION,
client: new MangoClient(connection, programId),
client: new MangoClient(connection, programId, {
postSignTxCallback: ({ txid }) => {
notify({
title: 'Transaction sent',
description: 'Waiting for confirmation',
type: 'confirm',
txid,
})
},
}),
endpoint: ENDPOINT.url,
slot: 0,
},

View File

@ -15,12 +15,13 @@ module.exports = {
body: ['Lato, sans-serif'],
},
extend: {
animation: {
shake: 'shake 0.4s linear 4',
'spin-fast': 'spin 0.5s linear infinite',
},
cursor: {
help: 'help',
},
fontSize: {
xxs: '.65rem',
},
colors: {
'light-theme': {
orange: {
@ -90,6 +91,9 @@ module.exports = {
'th-green-muted': 'var(--green-muted)',
'th-orange': 'var(--orange)',
},
fontSize: {
xxs: '.65rem',
},
keyframes: {
shake: {
'0%, 100%': {
@ -103,9 +107,6 @@ module.exports = {
},
},
},
animation: {
shake: 'shake 0.4s linear 4',
},
},
},
variants: {

View File

@ -1004,10 +1004,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@blockworks-foundation/mango-client@^3.2.17":
version "3.2.17"
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-client/-/mango-client-3.2.17.tgz#96ccdeeb91dcde3d403fe90d3fc87f79cae97112"
integrity sha512-vAG48N89VATQ4BxfI9XwEnrIBroaDWK5r7CEhCY+zzMwCd6SOKckiMmJn8k7W/o35TUbNsXH3UOG8bwutkoupQ==
"@blockworks-foundation/mango-client@latest":
version "3.2.18"
resolved "https://registry.yarnpkg.com/@blockworks-foundation/mango-client/-/mango-client-3.2.18.tgz#9367485d5e31b6afe4aa7deea1e6f882486d42c1"
integrity sha512-mI/44VjZWp2XyFunAv4wagUFrOuIBz9xtyGZYMYZb8lpx50Y7n29I/YNs3gkTS2qw46FlDVraMERELqhYi81eQ==
dependencies:
"@project-serum/anchor" "^0.16.2"
"@project-serum/serum" "0.13.55"
@ -2100,14 +2100,14 @@
integrity sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==
"@types/node@*":
version "17.0.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.4.tgz#fec0ce0526abb6062fd206d72a642811b887a111"
integrity sha512-6xwbrW4JJiJLgF+zNypN5wr2ykM9/jHcL7rQ8fZe2vuftggjzZeRSM4OwRc6Xk8qWjwJ99qVHo/JgOGmomWRog==
version "17.0.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.5.tgz#57ca67ec4e57ad9e4ef5a6bab48a15387a1c83e0"
integrity sha512-w3mrvNXLeDYV1GKTZorGJQivK6XLCoGwpnyJFbJVK/aTBQUxOCaa/GlFAAN3OTDFcb7h5tiFG+YXCO2By+riZw==
"@types/node@^12.12.54":
version "12.20.38"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.38.tgz#74801983c0558a7a31a4ead18bce2edded2b0e2f"
integrity sha512-NxmtBRGipjx1B225OeMdI+CQmLbYqvvmYbukDTJGDgzIDgPQ1EcjGmYxGhOk5hTBqeB558S6RgHSpq2iiqifAQ==
version "12.20.39"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.39.tgz#ef3cb119eaba80e9f1012c78b9384a7489a18bf6"
integrity sha512-U7PMwkDmc3bnL0e4U8oA0POpi1vfsYDc+DEUS2+rPxm9NlLcW1dBa5JcRhO633PoPUcCSWMNXrMsqhmAVEo+IQ==
"@types/node@^14.14.25":
version "14.17.3"