Skip to content

Commit

Permalink
feat: add cfx_getFeeBurnt rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
iosh committed Sep 26, 2024
1 parent f1d74c3 commit 6abcae2
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/background/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@fluent-wallet/cfx_get-code": "workspace:packages/rpcs/cfx_getCode",
"@fluent-wallet/cfx_get-collateral-for-storage": "workspace:packages/rpcs/cfx_getCollateralForStorage",
"@fluent-wallet/cfx_get-confirmation-risk-by-hash": "workspace:packages/rpcs/cfx_getConfirmationRiskByHash",
"@fluent-wallet/cfx_get-fee-burnt": "workspace:packages/rpcs/cfx_getFeeBurnt",
"@fluent-wallet/cfx_get-interest-rate": "workspace:*",
"@fluent-wallet/cfx_get-logs": "workspace:packages/rpcs/cfx_getLogs",
"@fluent-wallet/cfx_get-max-gas-limit": "workspace:*",
Expand Down
8 changes: 8 additions & 0 deletions packages/background/src/index.integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ describe('integration test', () => {
})

describe('rpcs', () => {
describe('cfx_getFeeBurnt', async () => {
test('cfx_getFeeBurnt', async () => {
const result = await request({method: 'cfx_getFeeBurnt'})
console.log(result)
expect(result.result.startsWith('0x')).toBeTruthy()
})
})

describe('cfx_maxPriorityFeePerGas', async () => {
test('cfx_maxPriorityFeePerGas', async () => {
const result = await request({method: 'cfx_maxPriorityFeePerGas'})
Expand Down
2 changes: 2 additions & 0 deletions packages/background/src/rpc-engine-opts.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ import * as cfxSignTransaction from '@fluent-wallet/cfx_sign-transaction'
import * as cfxTypedSignV4 from '@fluent-wallet/cfx_sign-typed-data_v4'
import * as cfxMaxPriorityFeePerGas from '@fluent-wallet/cfx_max-priority-fee-per-gas'
import * as cfxFeeHistory from '@fluent-wallet/cfx_fee-history'
import * as cfxGetFeeBurnt from '@fluent-wallet/cfx_get-fee-burnt'
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 @@ -324,6 +325,7 @@ export const rpcEngineOpts = {
cfxGetMaxGasLimit,
cfxMaxPriorityFeePerGas,
cfxFeeHistory,
cfxGetFeeBurnt,

// eth
ethGetCode,
Expand Down
1 change: 1 addition & 0 deletions packages/rpcs/cfx_getFeeBurnt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @fluent-wallet/cfx_get-fee-burnt
4 changes: 4 additions & 0 deletions packages/rpcs/cfx_getFeeBurnt/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',
}
16 changes: 16 additions & 0 deletions packages/rpcs/cfx_getFeeBurnt/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {optParam} from '@fluent-wallet/spec'

export const NAME = 'cfx_getFeeBurnt'

export const schemas = {
input: optParam,
}

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

export function main({f}) {
return f()
}
9 changes: 9 additions & 0 deletions packages/rpcs/cfx_getFeeBurnt/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@fluent-wallet/cfx_get-fee-burnt",
"type": "module",
"main": "index.js",
"version": "0.0.0",
"dependencies": {
"@fluent-wallet/spec": "workspace:packages/spec"
}
}
9 changes: 9 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3900,6 +3900,14 @@ __metadata:
languageName: unknown
linkType: soft

"@fluent-wallet/cfx_get-fee-burnt@workspace:packages/rpcs/cfx_getFeeBurnt":
version: 0.0.0-use.local
resolution: "@fluent-wallet/cfx_get-fee-burnt@workspace:packages/rpcs/cfx_getFeeBurnt"
dependencies:
"@fluent-wallet/spec": "workspace:packages/spec"
languageName: unknown
linkType: soft

"@fluent-wallet/cfx_get-interest-rate@workspace:*, @fluent-wallet/cfx_get-interest-rate@workspace:packages/rpcs/cfx_getInterestRate":
version: 0.0.0-use.local
resolution: "@fluent-wallet/cfx_get-interest-rate@workspace:packages/rpcs/cfx_getInterestRate"
Expand Down Expand Up @@ -17909,6 +17917,7 @@ __metadata:
"@fluent-wallet/cfx_get-code": "workspace:packages/rpcs/cfx_getCode"
"@fluent-wallet/cfx_get-collateral-for-storage": "workspace:packages/rpcs/cfx_getCollateralForStorage"
"@fluent-wallet/cfx_get-confirmation-risk-by-hash": "workspace:packages/rpcs/cfx_getConfirmationRiskByHash"
"@fluent-wallet/cfx_get-fee-burnt": "workspace:packages/rpcs/cfx_getFeeBurnt"
"@fluent-wallet/cfx_get-interest-rate": "workspace:*"
"@fluent-wallet/cfx_get-logs": "workspace:packages/rpcs/cfx_getLogs"
"@fluent-wallet/cfx_get-max-gas-limit": "workspace:*"
Expand Down

0 comments on commit 6abcae2

Please sign in to comment.