Skip to content
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

SDK: Improve result of build functions #1012

Closed
jurevans opened this issue Aug 19, 2024 · 0 comments · Fixed by #1033
Closed

SDK: Improve result of build functions #1012

jurevans opened this issue Aug 19, 2024 · 0 comments · Fixed by #1033

Comments

@jurevans
Copy link
Collaborator

jurevans commented Aug 19, 2024

Currently, all of the build_ functions (including build_batch) in the @heliax/namada-sdk package return a Rust struct instance (wasm pointer). It would be better to return a deserialized value from the SDK calls so they can be more easily inspected and destructured. We could Borsh-serialize/deserialize the BuiltTx type, and deserialize when returning from the SDK

Example of what this value would look like:

import { WrapperTxProps } from "@namada/types";

// We'll use borsh schemas instead of type defs, but essentially what the user
// will see is this:

type AccountPublicKeysMap = {
  pkToIdx: [string, number];
  idxToPk: [number, string];
}

type SigningTxData = {
  publicKeys: string[];
  threshold: number;
  feePayer: string;
  accountPublicKeysMap?: AccountPublicKeysMap[];
  owner?: string;
}

type Tx = {
  // tx hash
  hash: string;
  // tx bytes
  bytes: Uint8Array;
  // args used to create args::Tx in namada-sdk
  args: WrapperTxProps;
  // serialized signing data bytes
  signingDataBytes: SigningTxData[];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant