Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use best any time #159

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/components/LocksCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ export const LocksCard = () => {
if (!unVoteTxs || !unlockTxs) return

const subscriptionCallback = getSubscriptionCallBack({
onFinalized: () => setIsUnlockingLoading(false),
onInBlock: () => setIsUnlockingLoading(false),
onError: () => setIsUnlockingLoading(false),
})

api.tx.Utility.batch({ calls: [...unVoteTxs, ...unlockTxs] })
.signSubmitAndWatch(selectedAccount.polkadotSigner)
.signSubmitAndWatch(selectedAccount.polkadotSigner, { at: 'best' })
.subscribe(subscriptionCallback)
}, [api, freeLocks, getSubscriptionCallBack, getUnlockTx, selectedAccount])

Expand Down
8 changes: 4 additions & 4 deletions src/components/MyDelegations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ export const MyDelegations = () => {
onError: () => {
setDelegatesLoading((prev) => prev.filter((id) => id !== delegate))
},
onFinalized: () => {
onInBlock: () => {
setDelegatesLoading((prev) => prev.filter((id) => id !== delegate))
refreshLocks()
},
})

tx.signSubmitAndWatch(selectedAccount.polkadotSigner).subscribe(
subscriptionCallback,
)
tx.signSubmitAndWatch(selectedAccount.polkadotSigner, {
at: 'best',
}).subscribe(subscriptionCallback)
},
[api, delegations, getSubscriptionCallback, refreshLocks, selectedAccount],
)
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/DelegatesContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const DelegateContextProvider = ({ children }: DelegatesContextProps) => {
// useEffect(() => {
// const a = async (delegates: any[]) => {
// const result: Promise<any>[] = delegates.map((d) => {
// return dotApi.query.ConvictionVoting.VotingFor.getEntries(d.address)
// return dotApi.query.ConvictionVoting.VotingFor.getEntries(d.address, 'best')
// })
// await Promise.all(result).then((res) => {
// console.log(res)
Expand Down
10 changes: 6 additions & 4 deletions src/pages/Delegate/MultiTransactionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ export const MultiTransactionDialog = ({

const subscriptionCallBack1 = getSubscriptionCallBack({
onError: () => setIsTxInitiated(false),
onFinalized: () => {
onInBlock: () => {
setStep(2)
setIsTxInitiated(false)
},
})

;(await step1Txs)
.signSubmitAndWatch(selectedAccount?.polkadotSigner)
.signSubmitAndWatch(selectedAccount?.polkadotSigner, { at: 'best' })
.subscribe(subscriptionCallBack1)
}

Expand Down Expand Up @@ -107,10 +107,12 @@ export const MultiTransactionDialog = ({
setIsTxInitiated(false)
setWaitingForFinalization(true)
},
onInBlock: () => setWaitingForFinalization(true),
onFinalized: () => {
onInBlock: () => {
setWaitingForFinalization(true)
onProcessFinished()
setIsTxInitiated(false)
},
onFinalized: () => {
setWaitingForFinalization(false)
},
})
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Delegate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ export const Delegate = () => {

const subscriptionCallBack = getSubscriptionCallBack({
onError: () => setIsTxInitiated(false),
onFinalized: () => onProcessFinished(),
onInBlock: () => onProcessFinished(),
})

await allTxs
.signSubmitAndWatch(selectedAccount?.polkadotSigner)
.signSubmitAndWatch(selectedAccount?.polkadotSigner, { at: 'best' })
.subscribe(subscriptionCallBack)
}

Expand Down