Comments (9)
Hey @luisburigo, hope you are well.
I have been playing around with your example (thank you btw), not 100% on the root cause just yet. I did find a potential workaround (hopefully it can unblock you).
abi ContractA {
fn method(contract_b_id: ContractId);
}
impl ContractA for Contract {
fn method(contract_b_id: ContractId) {
let contract_b = abi(ContractB, contract_b_id.into());
let result = contract_b.method();
}
}
With the expected result of:
return new RequireRevertError(receipt, reason);
^
RequireRevertError: The script reverted with reason RequireFailed
from fuels-ts.
The issue is that we need the ABI of all contracts before being able to decode their logs. One suggested solution would be to, in case the ABI is missing and we can't decode logs, to just print a warning and move on instead of throwing.
This is subject to further analysis, of course.
from fuels-ts.
@luisburigo I just took a look at your code and you didn't add contract B into the call so the library doesn't know how to decode it. You should do this:
const contractAAbi = ContractAAbi__factory.connect(contractA, wallet);
const contractBAbi = ContractBAbi__factory.connect(contractB, wallet);
const result = await contractAAbi.functions.method({
value: contractB
})
.addContracts([contractBAbi]) // <------- this was missing
.txParams({
gasPrice: 1,
gasLimit: 1_000_000,
})
from fuels-ts.
Can we close this?
from fuels-ts.
Repository to reproduce the error: https://github.com/luisburigo/fuel-ts-issue.git
from fuels-ts.
I debugged the code and found the error in this function:
from fuels-ts.
Hey, @petertonysmith94 @arboleya thanks for the response.
This code in the description is just an example. In my contracts, I use the correct abi.
In this repo https://github.com/luisburigo/fuel-ts-issue there is an example of this bug.
from fuels-ts.
@luisburigo I just took a look at your code and you didn't add contract B into the call so the library doesn't know how to decode it. You should do this:
const contractAAbi = ContractAAbi__factory.connect(contractA, wallet); const contractBAbi = ContractBAbi__factory.connect(contractB, wallet); const result = await contractAAbi.functions.method({ value: contractB }) .addContracts([contractBAbi]) // <------- this was missing .txParams({ gasPrice: 1, gasLimit: 1_000_000, })
Look at that, thanks for the share ❤️
Link to the documentation on inter-contract calls.
from fuels-ts.
@luisburigo I just took a look at your code and you didn't add contract B into the call so the library doesn't know how to decode it. You should do this:
const contractAAbi = ContractAAbi__factory.connect(contractA, wallet); const contractBAbi = ContractBAbi__factory.connect(contractB, wallet); const result = await contractAAbi.functions.method({ value: contractB }) .addContracts([contractBAbi]) // <------- this was missing .txParams({ gasPrice: 1, gasLimit: 1_000_000, })Look at that, thanks for the share ❤️
Link to the documentation on inter-contract calls.
Thanks @petertonysmith94 ❤️❤️
from fuels-ts.
Related Issues (20)
- Add CI Benchmarks for Browser environments HOT 3
- Run Benchmarking utility in devnet environment
- Introduce Benchmark utility to support running different SDK versions HOT 4
- Include assets for Mainnet HOT 3
- buildBlockExplorerUrl needs to get updated HOT 1
- `this.provider.url` is not considering auth url passed
- Provide better ergonomics for proxied contract calls HOT 2
- Remove `signTransaction` method from `FuelConnectorMethods` enum
- Increase tests' timeout to prevent flakiness
- Add Receipts Missing Properties
- Automatic Linear x Github PR integration HOT 3
- Allow FuelConnector `selectNetwork` method to accept optional providerUrl and chainId
- `create-fuels` is not respecting the `fuel-toolchain` file
- Incorrect coder matching from namespaced library
- Implement caching to check latest `fuels` version
- Support Decoding Message Data from `MessageOut` Receipt HOT 1
- Upgrade fuel-core to `0.36.0`
- Update `forc` to `0.63.6`
- Document assets usage
- Logger tests are failing locally
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fuels-ts.