Skip to content

Commit acfde56

Browse files
authored
Merge pull request #1421 from Conflux-Chain/cfx_call
chore: add more fields to cfx_call
2 parents 473f24e + f53136b commit acfde56

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed

.yarn/versions/9c11183a.yml

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

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

+68
Original file line numberDiff line numberDiff line change
@@ -2891,5 +2891,73 @@ describe('integration test', () => {
28912891
expect(res.result.startsWith('0x')).toBe(true)
28922892
})
28932893
})
2894+
2895+
describe('cfx_call', async () => {
2896+
test('cfx_call', async () => {
2897+
const {token1} = await deployCRC20()
2898+
await request({
2899+
method: 'wallet_importMnemonic',
2900+
params: {mnemonic: MNEMONIC, password},
2901+
})
2902+
expect(
2903+
(
2904+
await request({
2905+
method: 'cfx_call',
2906+
params: [
2907+
{
2908+
to: token1.contractAddress,
2909+
data: '0x06fdde03',
2910+
},
2911+
],
2912+
})
2913+
).result.startsWith('0x'),
2914+
).toBe(true)
2915+
expect(
2916+
(
2917+
await request({
2918+
method: 'cfx_call',
2919+
params: [
2920+
{
2921+
to: token1.contractAddress,
2922+
data: '0x06fdde03',
2923+
maxPriorityFeePerGas: '0x4a817c800',
2924+
},
2925+
],
2926+
})
2927+
).result.startsWith('0x'),
2928+
).toBe(true)
2929+
expect(
2930+
(
2931+
await request({
2932+
method: 'cfx_call',
2933+
params: [
2934+
{
2935+
to: token1.contractAddress,
2936+
data: '0x06fdde03',
2937+
maxPriorityFeePerGas: '0x4a817c800',
2938+
maxFeePerGas: '0x4a817c800',
2939+
},
2940+
],
2941+
})
2942+
).result.startsWith('0x'),
2943+
).toBe(true)
2944+
expect(
2945+
(
2946+
await request({
2947+
method: 'cfx_call',
2948+
params: [
2949+
{
2950+
to: token1.contractAddress,
2951+
data: '0x06fdde03',
2952+
maxPriorityFeePerGas: '0x4a817c800',
2953+
maxFeePerGas: '0x4a817c800',
2954+
type: '0x2',
2955+
},
2956+
],
2957+
})
2958+
).result.startsWith('0x'),
2959+
).toBe(true)
2960+
})
2961+
})
28942962
})
28952963
})

packages/rpcs/cfx_call/index.js

+26
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import {
66
base32ContractAddress,
77
Uint,
88
Bytes,
9+
catn,
10+
Hash32,
11+
base32Address,
912
} from '@fluent-wallet/spec'
1013

1114
export const NAME = 'cfx_call'
@@ -32,6 +35,29 @@ export const schemas = {
3235
['value', {optional: true}, Uint],
3336
['data', {optional: true}, Bytes],
3437
['nonce', {optional: true}, Uint],
38+
['type', {optional: true}, Uint],
39+
['maxPriorityFeePerGas', {optional: true}, Uint],
40+
['maxFeePerGas', {optional: true}, Uint],
41+
[
42+
'accessList',
43+
{optional: true},
44+
[
45+
catn,
46+
[
47+
'AccessListEntry',
48+
[
49+
map,
50+
{closed: true},
51+
['address', {optional: true}, base32Address],
52+
[
53+
'storageKeys',
54+
{optional: true},
55+
[catn, ['32BtyeHexValue', Hash32]],
56+
],
57+
],
58+
],
59+
],
60+
],
3561
],
3662
epochRef,
3763
],

0 commit comments

Comments
 (0)