Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/nervosnetwork/neuron int…
Browse files Browse the repository at this point in the history
…o develop
  • Loading branch information
Keith-CY committed Dec 14, 2023
2 parents a1fddf6 + f598a0f commit a156dca
Show file tree
Hide file tree
Showing 9 changed files with 429 additions and 510 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"lint-staged": "13.3.0",
"ncp": "2.0.0",
"prettier": "2.8.8",
"ts-jest": "27.1.5",
"ts-jest": "29.1.1",
"typescript": "5.3.3",
"wait-on": "7.0.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"last 2 chrome versions"
],
"dependencies": {
"@ckb-lumos/base": "0.21.0-next.2",
"@ckb-lumos/codec": "0.21.0-next.3",
"@ckb-lumos/base": "0.21.1",
"@ckb-lumos/codec": "0.21.1",
"@nervosnetwork/ckb-sdk-core": "0.109.0",
"@nervosnetwork/ckb-sdk-utils": "0.109.0",
"canvg": "2.0.0",
Expand Down
18 changes: 9 additions & 9 deletions packages/neuron-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
]
},
"dependencies": {
"@ckb-lumos/base": "0.21.0-next.2",
"@ckb-lumos/bi": "0.21.0-next.3",
"@ckb-lumos/ckb-indexer": "0.21.0-next.3",
"@ckb-lumos/codec": "0.21.0-next.3",
"@ckb-lumos/common-scripts": "0.21.0-next.3",
"@ckb-lumos/config-manager": "0.21.0-next.3",
"@ckb-lumos/hd": "0.21.0-next.3",
"@ckb-lumos/helpers": "0.21.0-next.2",
"@ckb-lumos/rpc": "0.21.0-next.2",
"@ckb-lumos/base": "0.21.1",
"@ckb-lumos/bi": "0.21.1",
"@ckb-lumos/ckb-indexer": "0.21.1",
"@ckb-lumos/codec": "0.21.1",
"@ckb-lumos/common-scripts": "0.21.1",
"@ckb-lumos/config-manager": "0.21.1",
"@ckb-lumos/hd": "0.21.1",
"@ckb-lumos/helpers": "0.21.1",
"@ckb-lumos/rpc": "0.21.1",
"@iarna/toml": "2.2.5",
"@ledgerhq/hw-transport-node-hid": "6.27.22",
"@spore-sdk/core": "0.1.0-beta.9",
Expand Down
27 changes: 1 addition & 26 deletions packages/neuron-wallet/src/services/sdk-core.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
import { CKBRPC } from '@ckb-lumos/rpc'
import https from 'https'
import http from 'http'

let httpsAgent: https.Agent
let httpAgent: http.Agent

const getHttpsAgent = () => {
if (!httpsAgent) {
httpsAgent = new https.Agent({ keepAlive: true })
}
return httpsAgent
}

const getHttpAgent = () => {
if (!httpAgent) {
httpAgent = new http.Agent({ keepAlive: true })
}
return httpAgent
}

export const generateCKB = (url: string): CKBRPC => {
const rpc = new CKBRPC(url)
if (url.startsWith('https')) {
rpc.setNode({ url, httpsAgent: getHttpsAgent() })
} else {
rpc.setNode({ url, httpAgent: getHttpAgent() })
}
return rpc
return new CKBRPC(url, { fetch: (request, init) => globalThis.fetch(request, { ...init, keepalive: true }) })
}

export default {
Expand Down
4 changes: 3 additions & 1 deletion packages/neuron-wallet/src/services/transaction-sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,9 @@ export default class TransactionSender {
const rpc = generateRPC(currentNetwork.remote, currentNetwork.type)

let tx = await rpc.getTransaction(depositOutPoint.txHash)
if (tx.txStatus.status !== 'committed') throw new Error('Transaction is not committed yet')
if (tx.txStatus.status !== 'committed' || !tx.txStatus.blockHash) {
throw new Error('Transaction is not committed yet')
}
const depositBlockHash = tx.txStatus.blockHash

const cellOutput = tx.transaction.outputs[+depositOutPoint.index]
Expand Down
Loading

0 comments on commit a156dca

Please # to comment.