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

Uncaught (in promise) TypeError: reader[capitalizeFirstLetter(...)] is not a function #122

Open
easydeveloppement opened this issue Oct 10, 2021 · 2 comments

Comments

@easydeveloppement
Copy link

Hi,
I'm trying to decode metadata with metaplex script, and i have the following error :
Uncaught (in promise) TypeError: reader[capitalizeFirstLetter(...)] is not a function
the filedType is "pubkeyAsString"

What am i doing wrong ?

@unordered-set
Copy link

You are trying to serialize a type which is not supported. What is your schema?

@arpit04
Copy link

arpit04 commented Mar 3, 2023


class Payload {
  constructor(
    public amountIn: number,
    public minimumAmountOut: number,
    public amount: number,
    public otherAmountThreshold: number,
    public sqrtPriceLimit: number,
    public amountSpecifiedIsInput: boolean,
    public aToB: boolean,
  ) {}
}

const PayloadSchema = new Map([
  [Payload, { kind: 'struct', fields: [
    ['amountIn', 'u64'],
    ['minimumAmountOut', 'u64'],
    ['amount', 'u64'],
    ['otherAmountThreshold', 'u64'],
    ['sqrtPriceLimit', 'u128'],
    ['amountSpecifiedIsInput', 'bool'],
    ['aToB', 'bool'],
  ]}],
]);

const payload = new Payload(
  100000,
  1,
  100000,
  785,
  4295048016,
  true,
  true,
);

const encodedPayload = borsh.serialize(PayloadSchema, payload);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants