-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api-contracts
: handle foreign events gracefully
#5803
Comments
api-contracts
handle foreign events gracefullyapi-contracts
: handle foreign events gracefully
Could #5791 be responsible for this error? |
@tad3j Feels unlikely to me but not impossible. Could you share some code and steps to reproduce this? In which context is this happening? |
It's failing on line marked bellow (old version of code) when parsing this abi. Code:
|
@tad3j I was able to instantiate a Here is my code: import { ApiPromise, WsProvider } from "@polkadot/api";
import { ContractPromise } from "@polkadot/api-contract";
import abi from "./abi.json";
const wsProvider = new WsProvider(`wss://rococo-contracts-rpc.polkadot.io`);
const api = await ApiPromise.create({
provider: wsProvider,
});
const address = "5EnufwqqxnkWT6hc1LgjYWQGUsqQCtcr5192K2HuQJtRJgCi";
try {
const contract = new ContractPromise(api, abi, address);
console.log({ environment: contract.abi.environment });
} catch (error) {
console.error("Initializing contract error", error);
}
process.exit(0); You could run it by i.e Not sure what the |
Strange, maybe it's issue with Phala SDK...will check. Locking to |
@tad3j can you share which sdk you are using? Sounds reasonable that it might cause issues with sdks building ontop of pjs. They have probably not yet upgraded their sdk and this could cause hiccups. |
I'm using @phala/sdk. They've said they dont support ink v5 so maybe that's why it didn't work. EDIT: I've completely removed phala but TX signing is still failing. |
During the adaption of the event decoding for smart contract for ink! v5, #5791, it became clear that the prior and current implementation can't handle all circumstances gracefully.
The current implementation supports:
What could be improved:
Another usecase for this feature would be in handling foreign events. Foreign events are events emitted by the called contract but are defined in a different contract which was invoked by the called contract. For what I know this case of decoding events from a contract which ABI we don't have is not handled and will result in errors being thrown.
More information about this behavior you can find here:
The text was updated successfully, but these errors were encountered: