Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
15cfad34
Unverified
Commit
15cfad34
authored
Nov 08, 2023
by
tom goriunov
Committed by
GitHub
Nov 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Overloaded method with different number of arguments can't be invoked (#1332)
Fixes #1327
parent
9ebaacb4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
utils.test.ts
ui/address/contract/utils.test.ts
+23
-1
utils.ts
ui/address/contract/utils.ts
+4
-0
No files found.
ui/address/contract/utils.test.ts
View file @
15cfad34
...
...
@@ -53,7 +53,7 @@ describe('function prepareAbi()', () => {
expect
(
abi
).
toHaveLength
(
commonAbi
.
length
);
});
it
(
'
if there are two or more methods with the same name
, filters out those which input
s are not matched
'
,
()
=>
{
it
(
'
if there are two or more methods with the same name
and inputs length, filters out those which input type
s are not matched
'
,
()
=>
{
const
abi
=
prepareAbi
([
...
commonAbi
,
{
...
...
@@ -75,4 +75,26 @@ describe('function prepareAbi()', () => {
const
item
=
abi
.
find
((
item
)
=>
'
name
'
in
item
?
item
.
name
===
method
.
name
:
false
);
expect
(
item
).
toEqual
(
commonAbi
[
2
]);
});
it
(
'
if there are two or more methods with the same name and different inputs length, filters out those which inputs are not matched
'
,
()
=>
{
const
abi
=
prepareAbi
([
...
commonAbi
,
{
inputs
:
[
{
internalType
:
'
address
'
,
name
:
'
_fallbackUser
'
,
type
:
'
address
'
},
],
name
:
'
directNativeDeposit
'
,
outputs
:
[
{
internalType
:
'
uint256
'
,
name
:
''
,
type
:
'
uint256
'
},
],
stateMutability
:
'
payable
'
,
type
:
'
function
'
,
},
],
method
);
expect
(
abi
).
toHaveLength
(
commonAbi
.
length
);
const
item
=
abi
.
find
((
item
)
=>
'
name
'
in
item
?
item
.
name
===
method
.
name
:
false
);
expect
(
item
).
toEqual
(
commonAbi
[
2
]);
});
});
ui/address/contract/utils.ts
View file @
15cfad34
...
...
@@ -61,6 +61,10 @@ export function prepareAbi(abi: Abi, item: SmartContractWriteMethod): Abi {
return
true
;
}
if
(
abiItem
.
inputs
.
length
!==
item
.
inputs
.
length
)
{
return
false
;
}
return
abiItem
.
inputs
.
every
(({
name
,
type
})
=>
{
const
itemInput
=
item
.
inputs
.
find
((
input
)
=>
input
.
name
===
name
);
return
Boolean
(
itemInput
)
&&
itemInput
?.
type
===
type
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment