Skip to content

Commit

Permalink
fix: pr
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan committed Jul 14, 2023
1 parent 94f5508 commit 15925ed
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
10 changes: 4 additions & 6 deletions packages/neuron-ui/src/components/SUDTSend/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,11 @@ export function getGenerator(sendType?: SendType) {
return generateSUDTTransaction
}

export async function batchGenerateExperimental(
experimental: { tx: any; assetAccount?: any; params?: any },
priceArray: string[]
) {
export async function batchGenerateExperimental(experimental: State.Experimental, priceArray: string[]) {
if (experimental?.params) {
const generator = getGenerator(experimental?.params?.sendType)
const requestArray = priceArray.map(itemPrice => generator({ ...experimental.params, feeRate: itemPrice }))
const { params } = experimental
const generator = getGenerator(params.sendType)
const requestArray = priceArray.map(itemPrice => generator({ ...params, feeRate: itemPrice }))
const allPromiseResult = await Promise.allSettled(requestArray)
const resList = allPromiseResult.map(
(batchItem: PromiseSettledResult<ControllerResponse<{ fee: string }>>, index: number) => ({
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-ui/src/components/SUDTSend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ const SUDTSend = () => {
<div className={styles.sendContainer}>
{fields.map(field => {
return (
<>
<div key={field.key}>
<TextField
label={field.key === Fields.Amount ? `${field.label} (${displaySymbol})` : field.label}
value={
Expand Down Expand Up @@ -440,7 +440,7 @@ const SUDTSend = () => {
) : null}
</>
) : null}
</>
</div>
)
})}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/states/stateProvider/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export type StateAction =
| { type: AppActions.ToggleAllNotificationVisibility; payload?: boolean }
| { type: AppActions.ToggleIsAllowedToFetchList; payload?: boolean }
| { type: AppActions.Ignore; payload?: any }
| { type: AppActions.UpdateExperimentalParams; payload: { tx: any; assetAccount?: any; params?: any } | null }
| { type: AppActions.UpdateExperimentalParams; payload: State.Experimental | null }
| { type: AppActions.UpdateLoadedTransaction; payload: { filePath?: string; json: OfflineSignJSON } }
| { type: AppActions.SetPageNotice; payload?: State.PageNotice }
| { type: AppActions.HideWaitForFullySynced }
Expand Down
25 changes: 24 additions & 1 deletion packages/neuron-ui/src/types/App/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,29 @@ declare namespace State {
errorMsg: string
}

enum SendType {
secp256Cheque = 'cheque',
secp256NewCell = 'secp256NewCell',
acpExistCell = 'acpExistCell',
acpNewCell = 'acpNewCell',
unknowNewCell = 'unknowNewCell',
sendCKB = 'sendCKB',
}

interface Experimental {
tx: any
assetAccount?: any
params?: {
assetAccountID: string
walletID: string
address: string
amount: string
feeRate: string
description: string
sendType?: SendType
}
}

interface AppWithNeuronWallet {
app: App
chain: Chain
Expand All @@ -289,7 +312,7 @@ declare namespace State {
nervosDAO: NervosDAO
updater: AppUpdater
sUDTAccounts: SUDTAccount[]
experimental: { tx: any; assetAccount?: any; params?: any } | null
experimental: Experimental | null
}
}

Expand Down

0 comments on commit 15925ed

Please sign in to comment.