-
Notifications
You must be signed in to change notification settings - Fork 15
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
When using "fromFields", address will be add an 0x beforehand. #21
Comments
This could indeed be a bug. What is the type of the |
Curious how can we decode a event from BCS from suiClient.waitForTransaction? |
Does it not return bcs? |
vaultCreatedEventFields.manager is an address
|
Not for event, it shows bcs-encoded transaction input data waitForTransaction({ signal, timeout, pollInterval, ...input }: {
/** An optional abort signal that can be used to cancel */
signal?: AbortSignal;
/** The amount of time to wait for a transaction block. Defaults to one minute. */
timeout?: number;
/** The amount of time to wait between checks for the transaction block. Defaults to 2 seconds. */
pollInterval?: number;
} & Parameters<SuiClient['getTransactionBlock']>[0]): Promise<SuiTransactionBlockResponse>;
getTransactionBlock(input: GetTransactionBlockParams): Promise<SuiTransactionBlockResponse>;
export interface GetTransactionBlockParams {
/** the digest of the queried transaction */
digest: string;
/** options for specifying the content to be returned */
options?: RpcTypes.SuiTransactionBlockResponseOptions | null | undefined;
}
export interface SuiTransactionBlockResponseOptions {
/** Whether to show balance_changes. Default to be False */
showBalanceChanges?: boolean;
/** Whether to show transaction effects. Default to be False */
showEffects?: boolean;
/** Whether to show transaction events. Default to be False */
showEvents?: boolean;
/** Whether to show transaction input data. Default to be False */
showInput?: boolean;
/** Whether to show object_changes. Default to be False */
showObjectChanges?: boolean;
/** Whether to show raw transaction effects. Default to be False */
showRawEffects?: boolean;
/** Whether to show bcs-encoded transaction input data */
showRawInput?: boolean;
} |
It will be great to add a function that parses from the events from the transaction blocks. |
The returned event type contains a bcs string: You can decode like this: I will test the |
Oh yes! Got it! It works |
Yet when I try event with type, it will show const vaultCoinAddedEvent = CoinAddedEvent.fromBcs(
coinType, // Argument of type 'string' is not assignable to parameter of type 'PhantomReified<string>'.ts(2345)
fromBase58(vaultCoinAddedEvent_.bcs)
); public struct CoinAddedEvent<phantom T> has copy, drop {
vault_id: ID,
coin_value: u64,
} |
For generics you need to use reified https://github.com/kunalabs-io/sui-client-gen?tab=readme-ov-file#reified |
Below will return 400 because when I use "fromFields" it will load an extra 0x for any address regardless it had 0x already or not.
The text was updated successfully, but these errors were encountered: