Skip to content

Commit 6d0cf60

Browse files
authored
Merge branch 'dev' into __release-pkg
2 parents 6c7329c + f1d74c3 commit 6d0cf60

File tree

9 files changed

+99
-10
lines changed

9 files changed

+99
-10
lines changed

.yarn/versions/833a7eca.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
releases:
2+
"@fluent-wallet/cfx_fee-history": patch
3+
4+
declined:
5+
- helios
6+
- helios-background

packages/background/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@fluent-wallet/cfx_client-version": "workspace:packages/rpcs/cfx_clientVersion",
1515
"@fluent-wallet/cfx_epoch-number": "workspace:packages/rpcs/cfx_epochNumber",
1616
"@fluent-wallet/cfx_estimate-gas-and-collateral": "workspace:packages/rpcs/cfx_estimateGasAndCollateral",
17+
"@fluent-wallet/cfx_fee-history": "workspace:packages/rpcs/cfx_feeHistory",
1718
"@fluent-wallet/cfx_gas-price": "workspace:packages/rpcs/cfx_gasPrice",
1819
"@fluent-wallet/cfx_get-account": "workspace:packages/rpcs/cfx_getAccount",
1920
"@fluent-wallet/cfx_get-account-pending-info": "workspace:*",
@@ -46,7 +47,7 @@
4647
"@fluent-wallet/cfx_get-transaction-by-hash": "workspace:packages/rpcs/cfx_getTransactionByHash",
4748
"@fluent-wallet/cfx_get-transaction-receipt": "workspace:packages/rpcs/cfx_getTransactionReceipt",
4849
"@fluent-wallet/cfx_get-vote-list": "workspace:packages/rpcs/cfx_getVoteList",
49-
"@fluent-wallet/cfx_max-priority-fee-per-gas": "workspace:*",
50+
"@fluent-wallet/cfx_max-priority-fee-per-gas": "workspace:packages/rpcs/cfx_maxPriorityFeePerGas",
5051
"@fluent-wallet/cfx_net-version": "workspace:packages/rpcs/cfx_netVersion",
5152
"@fluent-wallet/cfx_opened-method-groups": "workspace:*",
5253
"@fluent-wallet/cfx_request-accounts": "workspace:packages/rpcs/cfx_requestAccounts",

packages/background/src/index.integration.test.js

+34-5
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,20 @@ describe('integration test', () => {
167167
})
168168
})
169169

170+
describe('cfx_feeHistory', async () => {
171+
test('cfx_feeHistory', async () => {
172+
const result = await request({
173+
method: 'cfx_feeHistory',
174+
params: ['0x5', 'latest_state', [20, 30]],
175+
})
176+
console.log(result)
177+
expect(result.result.baseFeePerGas.length).toBe(6)
178+
expect(result.result.gasUsedRatio.length).toBe(5)
179+
expect(result.result.oldestEpoch).toBeDefined()
180+
expect(result.result.reward.length).toBe(5)
181+
})
182+
})
183+
170184
describe('cfx_getStatus', () => {
171185
test('cfx_getStatus', async () => {
172186
const stat = await request({method: 'cfx_getStatus'})
@@ -329,7 +343,10 @@ describe('integration test', () => {
329343
(
330344
await request({
331345
method: 'wallet_deleteNetwork',
332-
params: {password, networkId: db.getNetworkByType('eth')[0].eid},
346+
params: {
347+
password,
348+
networkId: db.getNetworkByType('eth')[0].eid,
349+
},
333350
})
334351
).result,
335352
).toBe(true)
@@ -359,7 +376,10 @@ describe('integration test', () => {
359376
(
360377
await request({
361378
method: 'wallet_deleteNetwork',
362-
params: {password, networkId: db.getNetworkByName('foo')[0].eid},
379+
params: {
380+
password,
381+
networkId: db.getNetworkByName('foo')[0].eid,
382+
},
363383
})
364384
).error.message,
365385
).toMatch(/Not allowed to delete builtin network/)
@@ -1215,7 +1235,10 @@ describe('integration test', () => {
12151235
// app is from the right site
12161236
expect(app.site.eid).toBe(db.getSite()[0].eid)
12171237
// app has the right permissions
1218-
expect(app.perms).toStrictEqual({wallet_accounts: {}, wallet_basic: {}})
1238+
expect(app.perms).toStrictEqual({
1239+
wallet_accounts: {},
1240+
wallet_basic: {},
1241+
})
12191242
// app has the right authed accounts
12201243
expect(
12211244
app.account.map(a => [a1.eid, a2.eid].includes(a.eid)),
@@ -1289,7 +1312,10 @@ describe('integration test', () => {
12891312
// app is from the right site
12901313
expect(app.site.eid).toBe(db.getSite()[0].eid)
12911314
// app has the right permissions
1292-
expect(app.perms).toStrictEqual({wallet_accounts: {}, wallet_basic: {}})
1315+
expect(app.perms).toStrictEqual({
1316+
wallet_accounts: {},
1317+
wallet_basic: {},
1318+
})
12931319
// app has the right authed accounts
12941320
expect(
12951321
app.account.map(a => [a1.eid, a2.eid].includes(a.eid)),
@@ -1629,7 +1655,10 @@ describe('integration test', () => {
16291655
(
16301656
await request({
16311657
method: 'wallet_getAddressPrivateKey',
1632-
params: {address: addr.value, accountId: db.getAccount()[0].eid},
1658+
params: {
1659+
address: addr.value,
1660+
accountId: db.getAccount()[0].eid,
1661+
},
16331662
_internal: true,
16341663
})
16351664
).error.message,

packages/background/src/rpc-engine-opts.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ import * as cfxSendRawTransaction from '@fluent-wallet/cfx_send-raw-transaction'
9191
import * as cfxSendTransaction from '@fluent-wallet/cfx_send-transaction'
9292
import * as cfxSignTransaction from '@fluent-wallet/cfx_sign-transaction'
9393
import * as cfxTypedSignV4 from '@fluent-wallet/cfx_sign-typed-data_v4'
94-
import * as cfx_maxPriorityFeePerGas from '@fluent-wallet/cfx_max-priority-fee-per-gas'
94+
import * as cfxMaxPriorityFeePerGas from '@fluent-wallet/cfx_max-priority-fee-per-gas'
95+
import * as cfxFeeHistory from '@fluent-wallet/cfx_fee-history'
9596
import * as ethAccounts from '@fluent-wallet/eth_accounts'
9697
import * as ethBlockNumber from '@fluent-wallet/eth_block-number'
9798
import * as ethCall from '@fluent-wallet/eth_call'
@@ -321,7 +322,8 @@ export const rpcEngineOpts = {
321322
cfxSendTransaction,
322323
cfxSignTxWithLedgerNanoS,
323324
cfxGetMaxGasLimit,
324-
cfx_maxPriorityFeePerGas,
325+
cfxMaxPriorityFeePerGas,
326+
cfxFeeHistory,
325327

326328
// eth
327329
ethGetCode,
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# @fluent-wallet/cfx_fee-history

packages/rpcs/cfx_feeHistory/doc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default {
2+
metadata: {standard: true},
3+
en: 'No doc available',
4+
}

packages/rpcs/cfx_feeHistory/index.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import {
2+
cat,
3+
epochRefNoMined,
4+
number,
5+
schema,
6+
string,
7+
zeroOrMore,
8+
} from '@fluent-wallet/spec'
9+
10+
export const NAME = 'cfx_feeHistory'
11+
12+
export const schemas = {
13+
input: [
14+
cat,
15+
string,
16+
epochRefNoMined,
17+
[schema, [zeroOrMore, [number, {max: 100, min: 1}]]],
18+
],
19+
}
20+
21+
export const permissions = {
22+
external: ['popup', 'inpage'],
23+
locked: true,
24+
}
25+
26+
export const main = ({f, params}) => {
27+
return f(params)
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@fluent-wallet/cfx_fee-history",
3+
"type": "module",
4+
"main": "index.js",
5+
"version": "0.0.0",
6+
"dependencies": {
7+
"@fluent-wallet/spec": "workspace:packages/spec"
8+
}
9+
}

yarn.lock

+11-2
Original file line numberDiff line numberDiff line change
@@ -3746,6 +3746,14 @@ __metadata:
37463746
languageName: unknown
37473747
linkType: soft
37483748

3749+
"@fluent-wallet/cfx_fee-history@workspace:packages/rpcs/cfx_feeHistory":
3750+
version: 0.0.0-use.local
3751+
resolution: "@fluent-wallet/cfx_fee-history@workspace:packages/rpcs/cfx_feeHistory"
3752+
dependencies:
3753+
"@fluent-wallet/spec": "workspace:packages/spec"
3754+
languageName: unknown
3755+
linkType: soft
3756+
37493757
"@fluent-wallet/cfx_gas-price@workspace:packages/rpcs/cfx_gasPrice":
37503758
version: 0.0.0-use.local
37513759
resolution: "@fluent-wallet/cfx_gas-price@workspace:packages/rpcs/cfx_gasPrice"
@@ -4028,7 +4036,7 @@ __metadata:
40284036
languageName: unknown
40294037
linkType: soft
40304038

4031-
"@fluent-wallet/cfx_max-priority-fee-per-gas@workspace:*, @fluent-wallet/cfx_max-priority-fee-per-gas@workspace:packages/rpcs/cfx_maxPriorityFeePerGas":
4039+
"@fluent-wallet/cfx_max-priority-fee-per-gas@workspace:packages/rpcs/cfx_maxPriorityFeePerGas":
40324040
version: 0.0.0-use.local
40334041
resolution: "@fluent-wallet/cfx_max-priority-fee-per-gas@workspace:packages/rpcs/cfx_maxPriorityFeePerGas"
40344042
dependencies:
@@ -17884,6 +17892,7 @@ __metadata:
1788417892
"@fluent-wallet/cfx_client-version": "workspace:packages/rpcs/cfx_clientVersion"
1788517893
"@fluent-wallet/cfx_epoch-number": "workspace:packages/rpcs/cfx_epochNumber"
1788617894
"@fluent-wallet/cfx_estimate-gas-and-collateral": "workspace:packages/rpcs/cfx_estimateGasAndCollateral"
17895+
"@fluent-wallet/cfx_fee-history": "workspace:packages/rpcs/cfx_feeHistory"
1788717896
"@fluent-wallet/cfx_gas-price": "workspace:packages/rpcs/cfx_gasPrice"
1788817897
"@fluent-wallet/cfx_get-account": "workspace:packages/rpcs/cfx_getAccount"
1788917898
"@fluent-wallet/cfx_get-account-pending-info": "workspace:*"
@@ -17916,7 +17925,7 @@ __metadata:
1791617925
"@fluent-wallet/cfx_get-transaction-by-hash": "workspace:packages/rpcs/cfx_getTransactionByHash"
1791717926
"@fluent-wallet/cfx_get-transaction-receipt": "workspace:packages/rpcs/cfx_getTransactionReceipt"
1791817927
"@fluent-wallet/cfx_get-vote-list": "workspace:packages/rpcs/cfx_getVoteList"
17919-
"@fluent-wallet/cfx_max-priority-fee-per-gas": "workspace:*"
17928+
"@fluent-wallet/cfx_max-priority-fee-per-gas": "workspace:packages/rpcs/cfx_maxPriorityFeePerGas"
1792017929
"@fluent-wallet/cfx_net-version": "workspace:packages/rpcs/cfx_netVersion"
1792117930
"@fluent-wallet/cfx_opened-method-groups": "workspace:*"
1792217931
"@fluent-wallet/cfx_request-accounts": "workspace:packages/rpcs/cfx_requestAccounts"

0 commit comments

Comments
 (0)