Skip to content

Commit

Permalink
Merge branch 'dev' into __release-pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Sep 25, 2024
2 parents 6c7329c + f1d74c3 commit 6d0cf60
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .yarn/versions/833a7eca.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
releases:
"@fluent-wallet/cfx_fee-history": patch

declined:
- helios
- helios-background
3 changes: 2 additions & 1 deletion packages/background/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@fluent-wallet/cfx_client-version": "workspace:packages/rpcs/cfx_clientVersion",
"@fluent-wallet/cfx_epoch-number": "workspace:packages/rpcs/cfx_epochNumber",
"@fluent-wallet/cfx_estimate-gas-and-collateral": "workspace:packages/rpcs/cfx_estimateGasAndCollateral",
"@fluent-wallet/cfx_fee-history": "workspace:packages/rpcs/cfx_feeHistory",
"@fluent-wallet/cfx_gas-price": "workspace:packages/rpcs/cfx_gasPrice",
"@fluent-wallet/cfx_get-account": "workspace:packages/rpcs/cfx_getAccount",
"@fluent-wallet/cfx_get-account-pending-info": "workspace:*",
Expand Down Expand Up @@ -46,7 +47,7 @@
"@fluent-wallet/cfx_get-transaction-by-hash": "workspace:packages/rpcs/cfx_getTransactionByHash",
"@fluent-wallet/cfx_get-transaction-receipt": "workspace:packages/rpcs/cfx_getTransactionReceipt",
"@fluent-wallet/cfx_get-vote-list": "workspace:packages/rpcs/cfx_getVoteList",
"@fluent-wallet/cfx_max-priority-fee-per-gas": "workspace:*",
"@fluent-wallet/cfx_max-priority-fee-per-gas": "workspace:packages/rpcs/cfx_maxPriorityFeePerGas",
"@fluent-wallet/cfx_net-version": "workspace:packages/rpcs/cfx_netVersion",
"@fluent-wallet/cfx_opened-method-groups": "workspace:*",
"@fluent-wallet/cfx_request-accounts": "workspace:packages/rpcs/cfx_requestAccounts",
Expand Down
39 changes: 34 additions & 5 deletions packages/background/src/index.integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,20 @@ describe('integration test', () => {
})
})

describe('cfx_feeHistory', async () => {
test('cfx_feeHistory', async () => {
const result = await request({
method: 'cfx_feeHistory',
params: ['0x5', 'latest_state', [20, 30]],
})
console.log(result)
expect(result.result.baseFeePerGas.length).toBe(6)
expect(result.result.gasUsedRatio.length).toBe(5)
expect(result.result.oldestEpoch).toBeDefined()
expect(result.result.reward.length).toBe(5)
})
})

describe('cfx_getStatus', () => {
test('cfx_getStatus', async () => {
const stat = await request({method: 'cfx_getStatus'})
Expand Down Expand Up @@ -329,7 +343,10 @@ describe('integration test', () => {
(
await request({
method: 'wallet_deleteNetwork',
params: {password, networkId: db.getNetworkByType('eth')[0].eid},
params: {
password,
networkId: db.getNetworkByType('eth')[0].eid,
},
})
).result,
).toBe(true)
Expand Down Expand Up @@ -359,7 +376,10 @@ describe('integration test', () => {
(
await request({
method: 'wallet_deleteNetwork',
params: {password, networkId: db.getNetworkByName('foo')[0].eid},
params: {
password,
networkId: db.getNetworkByName('foo')[0].eid,
},
})
).error.message,
).toMatch(/Not allowed to delete builtin network/)
Expand Down Expand Up @@ -1215,7 +1235,10 @@ describe('integration test', () => {
// app is from the right site
expect(app.site.eid).toBe(db.getSite()[0].eid)
// app has the right permissions
expect(app.perms).toStrictEqual({wallet_accounts: {}, wallet_basic: {}})
expect(app.perms).toStrictEqual({
wallet_accounts: {},
wallet_basic: {},
})
// app has the right authed accounts
expect(
app.account.map(a => [a1.eid, a2.eid].includes(a.eid)),
Expand Down Expand Up @@ -1289,7 +1312,10 @@ describe('integration test', () => {
// app is from the right site
expect(app.site.eid).toBe(db.getSite()[0].eid)
// app has the right permissions
expect(app.perms).toStrictEqual({wallet_accounts: {}, wallet_basic: {}})
expect(app.perms).toStrictEqual({
wallet_accounts: {},
wallet_basic: {},
})
// app has the right authed accounts
expect(
app.account.map(a => [a1.eid, a2.eid].includes(a.eid)),
Expand Down Expand Up @@ -1629,7 +1655,10 @@ describe('integration test', () => {
(
await request({
method: 'wallet_getAddressPrivateKey',
params: {address: addr.value, accountId: db.getAccount()[0].eid},
params: {
address: addr.value,
accountId: db.getAccount()[0].eid,
},
_internal: true,
})
).error.message,
Expand Down
6 changes: 4 additions & 2 deletions packages/background/src/rpc-engine-opts.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ import * as cfxSendRawTransaction from '@fluent-wallet/cfx_send-raw-transaction'
import * as cfxSendTransaction from '@fluent-wallet/cfx_send-transaction'
import * as cfxSignTransaction from '@fluent-wallet/cfx_sign-transaction'
import * as cfxTypedSignV4 from '@fluent-wallet/cfx_sign-typed-data_v4'
import * as cfx_maxPriorityFeePerGas from '@fluent-wallet/cfx_max-priority-fee-per-gas'
import * as cfxMaxPriorityFeePerGas from '@fluent-wallet/cfx_max-priority-fee-per-gas'
import * as cfxFeeHistory from '@fluent-wallet/cfx_fee-history'
import * as ethAccounts from '@fluent-wallet/eth_accounts'
import * as ethBlockNumber from '@fluent-wallet/eth_block-number'
import * as ethCall from '@fluent-wallet/eth_call'
Expand Down Expand Up @@ -321,7 +322,8 @@ export const rpcEngineOpts = {
cfxSendTransaction,
cfxSignTxWithLedgerNanoS,
cfxGetMaxGasLimit,
cfx_maxPriorityFeePerGas,
cfxMaxPriorityFeePerGas,
cfxFeeHistory,

// eth
ethGetCode,
Expand Down
1 change: 1 addition & 0 deletions packages/rpcs/cfx_feeHistory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @fluent-wallet/cfx_fee-history
4 changes: 4 additions & 0 deletions packages/rpcs/cfx_feeHistory/doc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
metadata: {standard: true},
en: 'No doc available',
}
28 changes: 28 additions & 0 deletions packages/rpcs/cfx_feeHistory/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {
cat,
epochRefNoMined,
number,
schema,
string,
zeroOrMore,
} from '@fluent-wallet/spec'

export const NAME = 'cfx_feeHistory'

export const schemas = {
input: [
cat,
string,
epochRefNoMined,
[schema, [zeroOrMore, [number, {max: 100, min: 1}]]],
],
}

export const permissions = {
external: ['popup', 'inpage'],
locked: true,
}

export const main = ({f, params}) => {
return f(params)
}
9 changes: 9 additions & 0 deletions packages/rpcs/cfx_feeHistory/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@fluent-wallet/cfx_fee-history",
"type": "module",
"main": "index.js",
"version": "0.0.0",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
}
}
13 changes: 11 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3746,6 +3746,14 @@ __metadata:
languageName: unknown
linkType: soft

"@fluent-wallet/cfx_fee-history@workspace:packages/rpcs/cfx_feeHistory":
version: 0.0.0-use.local
resolution: "@fluent-wallet/cfx_fee-history@workspace:packages/rpcs/cfx_feeHistory"
dependencies:
"@fluent-wallet/spec": "workspace:packages/spec"
languageName: unknown
linkType: soft

"@fluent-wallet/cfx_gas-price@workspace:packages/rpcs/cfx_gasPrice":
version: 0.0.0-use.local
resolution: "@fluent-wallet/cfx_gas-price@workspace:packages/rpcs/cfx_gasPrice"
Expand Down Expand Up @@ -4028,7 +4036,7 @@ __metadata:
languageName: unknown
linkType: soft

"@fluent-wallet/cfx_max-priority-fee-per-gas@workspace:*, @fluent-wallet/cfx_max-priority-fee-per-gas@workspace:packages/rpcs/cfx_maxPriorityFeePerGas":
"@fluent-wallet/cfx_max-priority-fee-per-gas@workspace:packages/rpcs/cfx_maxPriorityFeePerGas":
version: 0.0.0-use.local
resolution: "@fluent-wallet/cfx_max-priority-fee-per-gas@workspace:packages/rpcs/cfx_maxPriorityFeePerGas"
dependencies:
Expand Down Expand Up @@ -17884,6 +17892,7 @@ __metadata:
"@fluent-wallet/cfx_client-version": "workspace:packages/rpcs/cfx_clientVersion"
"@fluent-wallet/cfx_epoch-number": "workspace:packages/rpcs/cfx_epochNumber"
"@fluent-wallet/cfx_estimate-gas-and-collateral": "workspace:packages/rpcs/cfx_estimateGasAndCollateral"
"@fluent-wallet/cfx_fee-history": "workspace:packages/rpcs/cfx_feeHistory"
"@fluent-wallet/cfx_gas-price": "workspace:packages/rpcs/cfx_gasPrice"
"@fluent-wallet/cfx_get-account": "workspace:packages/rpcs/cfx_getAccount"
"@fluent-wallet/cfx_get-account-pending-info": "workspace:*"
Expand Down Expand Up @@ -17916,7 +17925,7 @@ __metadata:
"@fluent-wallet/cfx_get-transaction-by-hash": "workspace:packages/rpcs/cfx_getTransactionByHash"
"@fluent-wallet/cfx_get-transaction-receipt": "workspace:packages/rpcs/cfx_getTransactionReceipt"
"@fluent-wallet/cfx_get-vote-list": "workspace:packages/rpcs/cfx_getVoteList"
"@fluent-wallet/cfx_max-priority-fee-per-gas": "workspace:*"
"@fluent-wallet/cfx_max-priority-fee-per-gas": "workspace:packages/rpcs/cfx_maxPriorityFeePerGas"
"@fluent-wallet/cfx_net-version": "workspace:packages/rpcs/cfx_netVersion"
"@fluent-wallet/cfx_opened-method-groups": "workspace:*"
"@fluent-wallet/cfx_request-accounts": "workspace:packages/rpcs/cfx_requestAccounts"
Expand Down

0 comments on commit 6d0cf60

Please sign in to comment.