Skip to content

Instantly share code, notes, and snippets.

@abuiles
Created April 29, 2020 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abuiles/9b3dcbcac8f8de477bc9d41bfebde3d0 to your computer and use it in GitHub Desktop.
Save abuiles/9b3dcbcac8f8de477bc9d41bfebde3d0 to your computer and use it in GitHub Desktop.
declare namespace xdr {
interface UINT {
readonly MAX_VALUE: 4294967295;
readonly MIN_VALUE: 0;
read(io: Buffer): number;
write(value: number, io: Buffer): void;
isValid(value: number): boolean;
toXDR(value: number): Buffer;
fromXDR(input: Buffer, format?: "raw"): number;
fromXDR(input: string, format: "hex" | "base64"): number;
}
class CryptoKeyType {
readonly name: "keyTypeEd25519" | "keyTypePreAuthTx" | "keyTypeHashX" | "keyTypeMuxedEd25519";
readonly value: 0 | 1 | 2 | 256;
static keyTypeEd25519(): CryptoKeyType;
static keyTypePreAuthTx(): CryptoKeyType;
static keyTypeHashX(): CryptoKeyType;
static keyTypeMuxedEd25519(): CryptoKeyType;
}
}
@abuiles
Copy link
Author

abuiles commented Apr 29, 2020

Source:

var types = XDR.config((xdr) => {
  xdr.typedef("Uint32", xdr.uint());
  xdr.typedef("Int32", xdr.int());

  xdr.enum("CryptoKeyType", {
    keyTypeEd25519: 0,
    keyTypePreAuthTx: 1,
    keyTypeHashX: 2,
    keyTypeMuxedEd25519: 256,
  });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment