@solana/codecs-numbers
Advanced tools
Comparing version 2.0.0-experimental.32b59a5 to 2.0.0-experimental.3690b65
@@ -22,7 +22,7 @@ import { combineCodec, assertByteArrayIsNotEmptyForCodec, assertByteArrayHasEnoughBytesForCodec } from '@solana/codecs-core'; | ||
if (input.size > 1) { | ||
littleEndian = !("endian" in input.options) || input.options.endian === 0 /* LITTLE */; | ||
littleEndian = !("endian" in input.config) || input.config.endian === 0 /* LITTLE */; | ||
defaultDescription += littleEndian ? "(le)" : "(be)"; | ||
} | ||
return { | ||
description: input.options.description ?? defaultDescription, | ||
description: input.config.description ?? defaultDescription, | ||
fixedSize: input.size, | ||
@@ -70,31 +70,31 @@ littleEndian, | ||
// src/f32.ts | ||
var getF32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "f32", | ||
options, | ||
set: (view, value, le) => view.setFloat32(0, value, le), | ||
size: 4 | ||
}); | ||
var getF32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getF32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getFloat32(0, le), | ||
name: "f32", | ||
options, | ||
size: 4 | ||
}); | ||
var getF32Codec = (options = {}) => combineCodec(getF32Encoder(options), getF32Decoder(options)); | ||
var getF64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF32Codec = (config = {}) => combineCodec(getF32Encoder(config), getF32Decoder(config)); | ||
var getF64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "f64", | ||
options, | ||
set: (view, value, le) => view.setFloat64(0, value, le), | ||
size: 8 | ||
}); | ||
var getF64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getF64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getFloat64(0, le), | ||
name: "f64", | ||
options, | ||
size: 8 | ||
}); | ||
var getF64Codec = (options = {}) => combineCodec(getF64Encoder(options), getF64Decoder(options)); | ||
var getI128Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF64Codec = (config = {}) => combineCodec(getF64Encoder(config), getF64Decoder(config)); | ||
var getI128Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i128", | ||
options, | ||
range: [-BigInt("0x7fffffffffffffffffffffffffffffff") - 1n, BigInt("0x7fffffffffffffffffffffffffffffff")], | ||
@@ -110,3 +110,4 @@ set: (view, value, le) => { | ||
}); | ||
var getI128Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI128Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => { | ||
@@ -120,9 +121,8 @@ const leftOffset = le ? 8 : 0; | ||
name: "i128", | ||
options, | ||
size: 16 | ||
}); | ||
var getI128Codec = (options = {}) => combineCodec(getI128Encoder(options), getI128Decoder(options)); | ||
var getI16Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI128Codec = (config = {}) => combineCodec(getI128Encoder(config), getI128Decoder(config)); | ||
var getI16Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i16", | ||
options, | ||
range: [-Number("0x7fff") - 1, Number("0x7fff")], | ||
@@ -132,12 +132,12 @@ set: (view, value, le) => view.setInt16(0, value, le), | ||
}); | ||
var getI16Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI16Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getInt16(0, le), | ||
name: "i16", | ||
options, | ||
size: 2 | ||
}); | ||
var getI16Codec = (options = {}) => combineCodec(getI16Encoder(options), getI16Decoder(options)); | ||
var getI32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI16Codec = (config = {}) => combineCodec(getI16Encoder(config), getI16Decoder(config)); | ||
var getI32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i32", | ||
options, | ||
range: [-Number("0x7fffffff") - 1, Number("0x7fffffff")], | ||
@@ -147,12 +147,12 @@ set: (view, value, le) => view.setInt32(0, value, le), | ||
}); | ||
var getI32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getInt32(0, le), | ||
name: "i32", | ||
options, | ||
size: 4 | ||
}); | ||
var getI32Codec = (options = {}) => combineCodec(getI32Encoder(options), getI32Decoder(options)); | ||
var getI64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI32Codec = (config = {}) => combineCodec(getI32Encoder(config), getI32Decoder(config)); | ||
var getI64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i64", | ||
options, | ||
range: [-BigInt("0x7fffffffffffffff") - 1n, BigInt("0x7fffffffffffffff")], | ||
@@ -162,12 +162,12 @@ set: (view, value, le) => view.setBigInt64(0, BigInt(value), le), | ||
}); | ||
var getI64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigInt64(0, le), | ||
name: "i64", | ||
options, | ||
size: 8 | ||
}); | ||
var getI64Codec = (options = {}) => combineCodec(getI64Encoder(options), getI64Decoder(options)); | ||
var getI8Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI64Codec = (config = {}) => combineCodec(getI64Encoder(config), getI64Decoder(config)); | ||
var getI8Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i8", | ||
options, | ||
range: [-Number("0x7f") - 1, Number("0x7f")], | ||
@@ -177,11 +177,11 @@ set: (view, value) => view.setInt8(0, value), | ||
}); | ||
var getI8Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI8Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view) => view.getInt8(0), | ||
name: "i8", | ||
options, | ||
size: 1 | ||
}); | ||
var getI8Codec = (options = {}) => combineCodec(getI8Encoder(options), getI8Decoder(options)); | ||
var getShortU16Encoder = (options = {}) => ({ | ||
description: options.description ?? "shortU16", | ||
var getI8Codec = (config = {}) => combineCodec(getI8Encoder(config), getI8Decoder(config)); | ||
var getShortU16Encoder = (config = {}) => ({ | ||
description: config.description ?? "shortU16", | ||
encode: (value) => { | ||
@@ -206,3 +206,3 @@ assertNumberIsBetweenForCodec("shortU16", 0, 65535, value); | ||
}); | ||
var getShortU16Decoder = (options = {}) => ({ | ||
var getShortU16Decoder = (config = {}) => ({ | ||
decode: (bytes, offset = 0) => { | ||
@@ -222,10 +222,10 @@ let value = 0; | ||
}, | ||
description: options.description ?? "shortU16", | ||
description: config.description ?? "shortU16", | ||
fixedSize: null, | ||
maxSize: 3 | ||
}); | ||
var getShortU16Codec = (options = {}) => combineCodec(getShortU16Encoder(options), getShortU16Decoder(options)); | ||
var getU128Encoder = (options = {}) => numberEncoderFactory({ | ||
var getShortU16Codec = (config = {}) => combineCodec(getShortU16Encoder(config), getShortU16Decoder(config)); | ||
var getU128Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u128", | ||
options, | ||
range: [0, BigInt("0xffffffffffffffffffffffffffffffff")], | ||
@@ -241,3 +241,4 @@ set: (view, value, le) => { | ||
}); | ||
var getU128Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU128Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => { | ||
@@ -251,9 +252,8 @@ const leftOffset = le ? 8 : 0; | ||
name: "u128", | ||
options, | ||
size: 16 | ||
}); | ||
var getU128Codec = (options = {}) => combineCodec(getU128Encoder(options), getU128Decoder(options)); | ||
var getU16Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU128Codec = (config = {}) => combineCodec(getU128Encoder(config), getU128Decoder(config)); | ||
var getU16Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u16", | ||
options, | ||
range: [0, Number("0xffff")], | ||
@@ -263,12 +263,12 @@ set: (view, value, le) => view.setUint16(0, value, le), | ||
}); | ||
var getU16Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU16Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint16(0, le), | ||
name: "u16", | ||
options, | ||
size: 2 | ||
}); | ||
var getU16Codec = (options = {}) => combineCodec(getU16Encoder(options), getU16Decoder(options)); | ||
var getU32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU16Codec = (config = {}) => combineCodec(getU16Encoder(config), getU16Decoder(config)); | ||
var getU32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u32", | ||
options, | ||
range: [0, Number("0xffffffff")], | ||
@@ -278,12 +278,12 @@ set: (view, value, le) => view.setUint32(0, value, le), | ||
}); | ||
var getU32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint32(0, le), | ||
name: "u32", | ||
options, | ||
size: 4 | ||
}); | ||
var getU32Codec = (options = {}) => combineCodec(getU32Encoder(options), getU32Decoder(options)); | ||
var getU64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU32Codec = (config = {}) => combineCodec(getU32Encoder(config), getU32Decoder(config)); | ||
var getU64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u64", | ||
options, | ||
range: [0, BigInt("0xffffffffffffffff")], | ||
@@ -293,12 +293,12 @@ set: (view, value, le) => view.setBigUint64(0, BigInt(value), le), | ||
}); | ||
var getU64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigUint64(0, le), | ||
name: "u64", | ||
options, | ||
size: 8 | ||
}); | ||
var getU64Codec = (options = {}) => combineCodec(getU64Encoder(options), getU64Decoder(options)); | ||
var getU8Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU64Codec = (config = {}) => combineCodec(getU64Encoder(config), getU64Decoder(config)); | ||
var getU8Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u8", | ||
options, | ||
range: [0, Number("0xff")], | ||
@@ -308,9 +308,9 @@ set: (view, value) => view.setUint8(0, value), | ||
}); | ||
var getU8Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU8Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view) => view.getUint8(0), | ||
name: "u8", | ||
options, | ||
size: 1 | ||
}); | ||
var getU8Codec = (options = {}) => combineCodec(getU8Encoder(options), getU8Decoder(options)); | ||
var getU8Codec = (config = {}) => combineCodec(getU8Encoder(config), getU8Decoder(config)); | ||
@@ -317,0 +317,0 @@ export { Endian, assertNumberIsBetweenForCodec, getF32Codec, getF32Decoder, getF32Encoder, getF64Codec, getF64Decoder, getF64Encoder, getI128Codec, getI128Decoder, getI128Encoder, getI16Codec, getI16Decoder, getI16Encoder, getI32Codec, getI32Decoder, getI32Encoder, getI64Codec, getI64Decoder, getI64Encoder, getI8Codec, getI8Decoder, getI8Encoder, getShortU16Codec, getShortU16Decoder, getShortU16Encoder, getU128Codec, getU128Decoder, getU128Encoder, getU16Codec, getU16Decoder, getU16Encoder, getU32Codec, getU32Decoder, getU32Encoder, getU64Codec, getU64Decoder, getU64Encoder, getU8Codec, getU8Decoder, getU8Encoder }; |
@@ -63,7 +63,7 @@ this.globalThis = this.globalThis || {}; | ||
if (input.size > 1) { | ||
littleEndian = !("endian" in input.options) || input.options.endian === 0 /* LITTLE */; | ||
littleEndian = !("endian" in input.config) || input.config.endian === 0 /* LITTLE */; | ||
defaultDescription += littleEndian ? "(le)" : "(be)"; | ||
} | ||
return { | ||
description: input.options.description ?? defaultDescription, | ||
description: input.config.description ?? defaultDescription, | ||
fixedSize: input.size, | ||
@@ -111,35 +111,35 @@ littleEndian, | ||
// src/f32.ts | ||
var getF32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "f32", | ||
options, | ||
set: (view, value, le) => view.setFloat32(0, value, le), | ||
size: 4 | ||
}); | ||
var getF32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getF32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getFloat32(0, le), | ||
name: "f32", | ||
options, | ||
size: 4 | ||
}); | ||
var getF32Codec = (options = {}) => combineCodec(getF32Encoder(options), getF32Decoder(options)); | ||
var getF32Codec = (config = {}) => combineCodec(getF32Encoder(config), getF32Decoder(config)); | ||
// src/f64.ts | ||
var getF64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "f64", | ||
options, | ||
set: (view, value, le) => view.setFloat64(0, value, le), | ||
size: 8 | ||
}); | ||
var getF64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getF64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getFloat64(0, le), | ||
name: "f64", | ||
options, | ||
size: 8 | ||
}); | ||
var getF64Codec = (options = {}) => combineCodec(getF64Encoder(options), getF64Decoder(options)); | ||
var getF64Codec = (config = {}) => combineCodec(getF64Encoder(config), getF64Decoder(config)); | ||
// src/i128.ts | ||
var getI128Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI128Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i128", | ||
options, | ||
range: [-BigInt("0x7fffffffffffffffffffffffffffffff") - 1n, BigInt("0x7fffffffffffffffffffffffffffffff")], | ||
@@ -155,3 +155,4 @@ set: (view, value, le) => { | ||
}); | ||
var getI128Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI128Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => { | ||
@@ -165,11 +166,10 @@ const leftOffset = le ? 8 : 0; | ||
name: "i128", | ||
options, | ||
size: 16 | ||
}); | ||
var getI128Codec = (options = {}) => combineCodec(getI128Encoder(options), getI128Decoder(options)); | ||
var getI128Codec = (config = {}) => combineCodec(getI128Encoder(config), getI128Decoder(config)); | ||
// src/i16.ts | ||
var getI16Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI16Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i16", | ||
options, | ||
range: [-Number("0x7fff") - 1, Number("0x7fff")], | ||
@@ -179,14 +179,14 @@ set: (view, value, le) => view.setInt16(0, value, le), | ||
}); | ||
var getI16Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI16Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getInt16(0, le), | ||
name: "i16", | ||
options, | ||
size: 2 | ||
}); | ||
var getI16Codec = (options = {}) => combineCodec(getI16Encoder(options), getI16Decoder(options)); | ||
var getI16Codec = (config = {}) => combineCodec(getI16Encoder(config), getI16Decoder(config)); | ||
// src/i32.ts | ||
var getI32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i32", | ||
options, | ||
range: [-Number("0x7fffffff") - 1, Number("0x7fffffff")], | ||
@@ -196,14 +196,14 @@ set: (view, value, le) => view.setInt32(0, value, le), | ||
}); | ||
var getI32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getInt32(0, le), | ||
name: "i32", | ||
options, | ||
size: 4 | ||
}); | ||
var getI32Codec = (options = {}) => combineCodec(getI32Encoder(options), getI32Decoder(options)); | ||
var getI32Codec = (config = {}) => combineCodec(getI32Encoder(config), getI32Decoder(config)); | ||
// src/i64.ts | ||
var getI64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i64", | ||
options, | ||
range: [-BigInt("0x7fffffffffffffff") - 1n, BigInt("0x7fffffffffffffff")], | ||
@@ -213,14 +213,14 @@ set: (view, value, le) => view.setBigInt64(0, BigInt(value), le), | ||
}); | ||
var getI64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigInt64(0, le), | ||
name: "i64", | ||
options, | ||
size: 8 | ||
}); | ||
var getI64Codec = (options = {}) => combineCodec(getI64Encoder(options), getI64Decoder(options)); | ||
var getI64Codec = (config = {}) => combineCodec(getI64Encoder(config), getI64Decoder(config)); | ||
// src/i8.ts | ||
var getI8Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI8Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i8", | ||
options, | ||
range: [-Number("0x7f") - 1, Number("0x7f")], | ||
@@ -230,13 +230,13 @@ set: (view, value) => view.setInt8(0, value), | ||
}); | ||
var getI8Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI8Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view) => view.getInt8(0), | ||
name: "i8", | ||
options, | ||
size: 1 | ||
}); | ||
var getI8Codec = (options = {}) => combineCodec(getI8Encoder(options), getI8Decoder(options)); | ||
var getI8Codec = (config = {}) => combineCodec(getI8Encoder(config), getI8Decoder(config)); | ||
// src/short-u16.ts | ||
var getShortU16Encoder = (options = {}) => ({ | ||
description: options.description ?? "shortU16", | ||
var getShortU16Encoder = (config = {}) => ({ | ||
description: config.description ?? "shortU16", | ||
encode: (value) => { | ||
@@ -261,3 +261,3 @@ assertNumberIsBetweenForCodec("shortU16", 0, 65535, value); | ||
}); | ||
var getShortU16Decoder = (options = {}) => ({ | ||
var getShortU16Decoder = (config = {}) => ({ | ||
decode: (bytes, offset = 0) => { | ||
@@ -277,12 +277,12 @@ let value = 0; | ||
}, | ||
description: options.description ?? "shortU16", | ||
description: config.description ?? "shortU16", | ||
fixedSize: null, | ||
maxSize: 3 | ||
}); | ||
var getShortU16Codec = (options = {}) => combineCodec(getShortU16Encoder(options), getShortU16Decoder(options)); | ||
var getShortU16Codec = (config = {}) => combineCodec(getShortU16Encoder(config), getShortU16Decoder(config)); | ||
// src/u128.ts | ||
var getU128Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU128Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u128", | ||
options, | ||
range: [0, BigInt("0xffffffffffffffffffffffffffffffff")], | ||
@@ -298,3 +298,4 @@ set: (view, value, le) => { | ||
}); | ||
var getU128Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU128Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => { | ||
@@ -308,11 +309,10 @@ const leftOffset = le ? 8 : 0; | ||
name: "u128", | ||
options, | ||
size: 16 | ||
}); | ||
var getU128Codec = (options = {}) => combineCodec(getU128Encoder(options), getU128Decoder(options)); | ||
var getU128Codec = (config = {}) => combineCodec(getU128Encoder(config), getU128Decoder(config)); | ||
// src/u16.ts | ||
var getU16Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU16Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u16", | ||
options, | ||
range: [0, Number("0xffff")], | ||
@@ -322,14 +322,14 @@ set: (view, value, le) => view.setUint16(0, value, le), | ||
}); | ||
var getU16Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU16Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint16(0, le), | ||
name: "u16", | ||
options, | ||
size: 2 | ||
}); | ||
var getU16Codec = (options = {}) => combineCodec(getU16Encoder(options), getU16Decoder(options)); | ||
var getU16Codec = (config = {}) => combineCodec(getU16Encoder(config), getU16Decoder(config)); | ||
// src/u32.ts | ||
var getU32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u32", | ||
options, | ||
range: [0, Number("0xffffffff")], | ||
@@ -339,14 +339,14 @@ set: (view, value, le) => view.setUint32(0, value, le), | ||
}); | ||
var getU32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint32(0, le), | ||
name: "u32", | ||
options, | ||
size: 4 | ||
}); | ||
var getU32Codec = (options = {}) => combineCodec(getU32Encoder(options), getU32Decoder(options)); | ||
var getU32Codec = (config = {}) => combineCodec(getU32Encoder(config), getU32Decoder(config)); | ||
// src/u64.ts | ||
var getU64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u64", | ||
options, | ||
range: [0, BigInt("0xffffffffffffffff")], | ||
@@ -356,14 +356,14 @@ set: (view, value, le) => view.setBigUint64(0, BigInt(value), le), | ||
}); | ||
var getU64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigUint64(0, le), | ||
name: "u64", | ||
options, | ||
size: 8 | ||
}); | ||
var getU64Codec = (options = {}) => combineCodec(getU64Encoder(options), getU64Decoder(options)); | ||
var getU64Codec = (config = {}) => combineCodec(getU64Encoder(config), getU64Decoder(config)); | ||
// src/u8.ts | ||
var getU8Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU8Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u8", | ||
options, | ||
range: [0, Number("0xff")], | ||
@@ -373,9 +373,9 @@ set: (view, value) => view.setUint8(0, value), | ||
}); | ||
var getU8Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU8Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view) => view.getUint8(0), | ||
name: "u8", | ||
options, | ||
size: 1 | ||
}); | ||
var getU8Codec = (options = {}) => combineCodec(getU8Encoder(options), getU8Decoder(options)); | ||
var getU8Codec = (config = {}) => combineCodec(getU8Encoder(config), getU8Decoder(config)); | ||
@@ -382,0 +382,0 @@ exports.Endian = Endian; |
@@ -22,7 +22,7 @@ import { combineCodec, assertByteArrayIsNotEmptyForCodec, assertByteArrayHasEnoughBytesForCodec } from '@solana/codecs-core'; | ||
if (input.size > 1) { | ||
littleEndian = !("endian" in input.options) || input.options.endian === 0 /* LITTLE */; | ||
littleEndian = !("endian" in input.config) || input.config.endian === 0 /* LITTLE */; | ||
defaultDescription += littleEndian ? "(le)" : "(be)"; | ||
} | ||
return { | ||
description: input.options.description ?? defaultDescription, | ||
description: input.config.description ?? defaultDescription, | ||
fixedSize: input.size, | ||
@@ -70,31 +70,31 @@ littleEndian, | ||
// src/f32.ts | ||
var getF32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "f32", | ||
options, | ||
set: (view, value, le) => view.setFloat32(0, value, le), | ||
size: 4 | ||
}); | ||
var getF32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getF32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getFloat32(0, le), | ||
name: "f32", | ||
options, | ||
size: 4 | ||
}); | ||
var getF32Codec = (options = {}) => combineCodec(getF32Encoder(options), getF32Decoder(options)); | ||
var getF64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF32Codec = (config = {}) => combineCodec(getF32Encoder(config), getF32Decoder(config)); | ||
var getF64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "f64", | ||
options, | ||
set: (view, value, le) => view.setFloat64(0, value, le), | ||
size: 8 | ||
}); | ||
var getF64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getF64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getFloat64(0, le), | ||
name: "f64", | ||
options, | ||
size: 8 | ||
}); | ||
var getF64Codec = (options = {}) => combineCodec(getF64Encoder(options), getF64Decoder(options)); | ||
var getI128Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF64Codec = (config = {}) => combineCodec(getF64Encoder(config), getF64Decoder(config)); | ||
var getI128Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i128", | ||
options, | ||
range: [-BigInt("0x7fffffffffffffffffffffffffffffff") - 1n, BigInt("0x7fffffffffffffffffffffffffffffff")], | ||
@@ -110,3 +110,4 @@ set: (view, value, le) => { | ||
}); | ||
var getI128Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI128Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => { | ||
@@ -120,9 +121,8 @@ const leftOffset = le ? 8 : 0; | ||
name: "i128", | ||
options, | ||
size: 16 | ||
}); | ||
var getI128Codec = (options = {}) => combineCodec(getI128Encoder(options), getI128Decoder(options)); | ||
var getI16Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI128Codec = (config = {}) => combineCodec(getI128Encoder(config), getI128Decoder(config)); | ||
var getI16Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i16", | ||
options, | ||
range: [-Number("0x7fff") - 1, Number("0x7fff")], | ||
@@ -132,12 +132,12 @@ set: (view, value, le) => view.setInt16(0, value, le), | ||
}); | ||
var getI16Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI16Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getInt16(0, le), | ||
name: "i16", | ||
options, | ||
size: 2 | ||
}); | ||
var getI16Codec = (options = {}) => combineCodec(getI16Encoder(options), getI16Decoder(options)); | ||
var getI32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI16Codec = (config = {}) => combineCodec(getI16Encoder(config), getI16Decoder(config)); | ||
var getI32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i32", | ||
options, | ||
range: [-Number("0x7fffffff") - 1, Number("0x7fffffff")], | ||
@@ -147,12 +147,12 @@ set: (view, value, le) => view.setInt32(0, value, le), | ||
}); | ||
var getI32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getInt32(0, le), | ||
name: "i32", | ||
options, | ||
size: 4 | ||
}); | ||
var getI32Codec = (options = {}) => combineCodec(getI32Encoder(options), getI32Decoder(options)); | ||
var getI64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI32Codec = (config = {}) => combineCodec(getI32Encoder(config), getI32Decoder(config)); | ||
var getI64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i64", | ||
options, | ||
range: [-BigInt("0x7fffffffffffffff") - 1n, BigInt("0x7fffffffffffffff")], | ||
@@ -162,12 +162,12 @@ set: (view, value, le) => view.setBigInt64(0, BigInt(value), le), | ||
}); | ||
var getI64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigInt64(0, le), | ||
name: "i64", | ||
options, | ||
size: 8 | ||
}); | ||
var getI64Codec = (options = {}) => combineCodec(getI64Encoder(options), getI64Decoder(options)); | ||
var getI8Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI64Codec = (config = {}) => combineCodec(getI64Encoder(config), getI64Decoder(config)); | ||
var getI8Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i8", | ||
options, | ||
range: [-Number("0x7f") - 1, Number("0x7f")], | ||
@@ -177,11 +177,11 @@ set: (view, value) => view.setInt8(0, value), | ||
}); | ||
var getI8Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI8Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view) => view.getInt8(0), | ||
name: "i8", | ||
options, | ||
size: 1 | ||
}); | ||
var getI8Codec = (options = {}) => combineCodec(getI8Encoder(options), getI8Decoder(options)); | ||
var getShortU16Encoder = (options = {}) => ({ | ||
description: options.description ?? "shortU16", | ||
var getI8Codec = (config = {}) => combineCodec(getI8Encoder(config), getI8Decoder(config)); | ||
var getShortU16Encoder = (config = {}) => ({ | ||
description: config.description ?? "shortU16", | ||
encode: (value) => { | ||
@@ -206,3 +206,3 @@ assertNumberIsBetweenForCodec("shortU16", 0, 65535, value); | ||
}); | ||
var getShortU16Decoder = (options = {}) => ({ | ||
var getShortU16Decoder = (config = {}) => ({ | ||
decode: (bytes, offset = 0) => { | ||
@@ -222,10 +222,10 @@ let value = 0; | ||
}, | ||
description: options.description ?? "shortU16", | ||
description: config.description ?? "shortU16", | ||
fixedSize: null, | ||
maxSize: 3 | ||
}); | ||
var getShortU16Codec = (options = {}) => combineCodec(getShortU16Encoder(options), getShortU16Decoder(options)); | ||
var getU128Encoder = (options = {}) => numberEncoderFactory({ | ||
var getShortU16Codec = (config = {}) => combineCodec(getShortU16Encoder(config), getShortU16Decoder(config)); | ||
var getU128Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u128", | ||
options, | ||
range: [0, BigInt("0xffffffffffffffffffffffffffffffff")], | ||
@@ -241,3 +241,4 @@ set: (view, value, le) => { | ||
}); | ||
var getU128Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU128Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => { | ||
@@ -251,9 +252,8 @@ const leftOffset = le ? 8 : 0; | ||
name: "u128", | ||
options, | ||
size: 16 | ||
}); | ||
var getU128Codec = (options = {}) => combineCodec(getU128Encoder(options), getU128Decoder(options)); | ||
var getU16Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU128Codec = (config = {}) => combineCodec(getU128Encoder(config), getU128Decoder(config)); | ||
var getU16Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u16", | ||
options, | ||
range: [0, Number("0xffff")], | ||
@@ -263,12 +263,12 @@ set: (view, value, le) => view.setUint16(0, value, le), | ||
}); | ||
var getU16Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU16Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint16(0, le), | ||
name: "u16", | ||
options, | ||
size: 2 | ||
}); | ||
var getU16Codec = (options = {}) => combineCodec(getU16Encoder(options), getU16Decoder(options)); | ||
var getU32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU16Codec = (config = {}) => combineCodec(getU16Encoder(config), getU16Decoder(config)); | ||
var getU32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u32", | ||
options, | ||
range: [0, Number("0xffffffff")], | ||
@@ -278,12 +278,12 @@ set: (view, value, le) => view.setUint32(0, value, le), | ||
}); | ||
var getU32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint32(0, le), | ||
name: "u32", | ||
options, | ||
size: 4 | ||
}); | ||
var getU32Codec = (options = {}) => combineCodec(getU32Encoder(options), getU32Decoder(options)); | ||
var getU64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU32Codec = (config = {}) => combineCodec(getU32Encoder(config), getU32Decoder(config)); | ||
var getU64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u64", | ||
options, | ||
range: [0, BigInt("0xffffffffffffffff")], | ||
@@ -293,12 +293,12 @@ set: (view, value, le) => view.setBigUint64(0, BigInt(value), le), | ||
}); | ||
var getU64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigUint64(0, le), | ||
name: "u64", | ||
options, | ||
size: 8 | ||
}); | ||
var getU64Codec = (options = {}) => combineCodec(getU64Encoder(options), getU64Decoder(options)); | ||
var getU8Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU64Codec = (config = {}) => combineCodec(getU64Encoder(config), getU64Decoder(config)); | ||
var getU8Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u8", | ||
options, | ||
range: [0, Number("0xff")], | ||
@@ -308,9 +308,9 @@ set: (view, value) => view.setUint8(0, value), | ||
}); | ||
var getU8Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU8Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view) => view.getUint8(0), | ||
name: "u8", | ||
options, | ||
size: 1 | ||
}); | ||
var getU8Codec = (options = {}) => combineCodec(getU8Encoder(options), getU8Decoder(options)); | ||
var getU8Codec = (config = {}) => combineCodec(getU8Encoder(config), getU8Decoder(config)); | ||
@@ -317,0 +317,0 @@ export { Endian, assertNumberIsBetweenForCodec, getF32Codec, getF32Decoder, getF32Encoder, getF64Codec, getF64Decoder, getF64Encoder, getI128Codec, getI128Decoder, getI128Encoder, getI16Codec, getI16Decoder, getI16Encoder, getI32Codec, getI32Decoder, getI32Encoder, getI64Codec, getI64Decoder, getI64Encoder, getI8Codec, getI8Decoder, getI8Encoder, getShortU16Codec, getShortU16Decoder, getShortU16Encoder, getU128Codec, getU128Decoder, getU128Encoder, getU16Codec, getU16Decoder, getU16Encoder, getU32Codec, getU32Decoder, getU32Encoder, getU64Codec, getU64Decoder, getU64Encoder, getU8Codec, getU8Decoder, getU8Encoder }; |
@@ -22,7 +22,7 @@ import { combineCodec, assertByteArrayIsNotEmptyForCodec, assertByteArrayHasEnoughBytesForCodec } from '@solana/codecs-core'; | ||
if (input.size > 1) { | ||
littleEndian = !("endian" in input.options) || input.options.endian === 0 /* LITTLE */; | ||
littleEndian = !("endian" in input.config) || input.config.endian === 0 /* LITTLE */; | ||
defaultDescription += littleEndian ? "(le)" : "(be)"; | ||
} | ||
return { | ||
description: input.options.description ?? defaultDescription, | ||
description: input.config.description ?? defaultDescription, | ||
fixedSize: input.size, | ||
@@ -70,31 +70,31 @@ littleEndian, | ||
// src/f32.ts | ||
var getF32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "f32", | ||
options, | ||
set: (view, value, le) => view.setFloat32(0, value, le), | ||
size: 4 | ||
}); | ||
var getF32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getF32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getFloat32(0, le), | ||
name: "f32", | ||
options, | ||
size: 4 | ||
}); | ||
var getF32Codec = (options = {}) => combineCodec(getF32Encoder(options), getF32Decoder(options)); | ||
var getF64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF32Codec = (config = {}) => combineCodec(getF32Encoder(config), getF32Decoder(config)); | ||
var getF64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "f64", | ||
options, | ||
set: (view, value, le) => view.setFloat64(0, value, le), | ||
size: 8 | ||
}); | ||
var getF64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getF64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getFloat64(0, le), | ||
name: "f64", | ||
options, | ||
size: 8 | ||
}); | ||
var getF64Codec = (options = {}) => combineCodec(getF64Encoder(options), getF64Decoder(options)); | ||
var getI128Encoder = (options = {}) => numberEncoderFactory({ | ||
var getF64Codec = (config = {}) => combineCodec(getF64Encoder(config), getF64Decoder(config)); | ||
var getI128Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i128", | ||
options, | ||
range: [-BigInt("0x7fffffffffffffffffffffffffffffff") - 1n, BigInt("0x7fffffffffffffffffffffffffffffff")], | ||
@@ -110,3 +110,4 @@ set: (view, value, le) => { | ||
}); | ||
var getI128Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI128Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => { | ||
@@ -120,9 +121,8 @@ const leftOffset = le ? 8 : 0; | ||
name: "i128", | ||
options, | ||
size: 16 | ||
}); | ||
var getI128Codec = (options = {}) => combineCodec(getI128Encoder(options), getI128Decoder(options)); | ||
var getI16Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI128Codec = (config = {}) => combineCodec(getI128Encoder(config), getI128Decoder(config)); | ||
var getI16Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i16", | ||
options, | ||
range: [-Number("0x7fff") - 1, Number("0x7fff")], | ||
@@ -132,12 +132,12 @@ set: (view, value, le) => view.setInt16(0, value, le), | ||
}); | ||
var getI16Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI16Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getInt16(0, le), | ||
name: "i16", | ||
options, | ||
size: 2 | ||
}); | ||
var getI16Codec = (options = {}) => combineCodec(getI16Encoder(options), getI16Decoder(options)); | ||
var getI32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI16Codec = (config = {}) => combineCodec(getI16Encoder(config), getI16Decoder(config)); | ||
var getI32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i32", | ||
options, | ||
range: [-Number("0x7fffffff") - 1, Number("0x7fffffff")], | ||
@@ -147,12 +147,12 @@ set: (view, value, le) => view.setInt32(0, value, le), | ||
}); | ||
var getI32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getInt32(0, le), | ||
name: "i32", | ||
options, | ||
size: 4 | ||
}); | ||
var getI32Codec = (options = {}) => combineCodec(getI32Encoder(options), getI32Decoder(options)); | ||
var getI64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI32Codec = (config = {}) => combineCodec(getI32Encoder(config), getI32Decoder(config)); | ||
var getI64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i64", | ||
options, | ||
range: [-BigInt("0x7fffffffffffffff") - 1n, BigInt("0x7fffffffffffffff")], | ||
@@ -162,12 +162,12 @@ set: (view, value, le) => view.setBigInt64(0, BigInt(value), le), | ||
}); | ||
var getI64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigInt64(0, le), | ||
name: "i64", | ||
options, | ||
size: 8 | ||
}); | ||
var getI64Codec = (options = {}) => combineCodec(getI64Encoder(options), getI64Decoder(options)); | ||
var getI8Encoder = (options = {}) => numberEncoderFactory({ | ||
var getI64Codec = (config = {}) => combineCodec(getI64Encoder(config), getI64Decoder(config)); | ||
var getI8Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "i8", | ||
options, | ||
range: [-Number("0x7f") - 1, Number("0x7f")], | ||
@@ -177,11 +177,11 @@ set: (view, value) => view.setInt8(0, value), | ||
}); | ||
var getI8Decoder = (options = {}) => numberDecoderFactory({ | ||
var getI8Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view) => view.getInt8(0), | ||
name: "i8", | ||
options, | ||
size: 1 | ||
}); | ||
var getI8Codec = (options = {}) => combineCodec(getI8Encoder(options), getI8Decoder(options)); | ||
var getShortU16Encoder = (options = {}) => ({ | ||
description: options.description ?? "shortU16", | ||
var getI8Codec = (config = {}) => combineCodec(getI8Encoder(config), getI8Decoder(config)); | ||
var getShortU16Encoder = (config = {}) => ({ | ||
description: config.description ?? "shortU16", | ||
encode: (value) => { | ||
@@ -206,3 +206,3 @@ assertNumberIsBetweenForCodec("shortU16", 0, 65535, value); | ||
}); | ||
var getShortU16Decoder = (options = {}) => ({ | ||
var getShortU16Decoder = (config = {}) => ({ | ||
decode: (bytes, offset = 0) => { | ||
@@ -222,10 +222,10 @@ let value = 0; | ||
}, | ||
description: options.description ?? "shortU16", | ||
description: config.description ?? "shortU16", | ||
fixedSize: null, | ||
maxSize: 3 | ||
}); | ||
var getShortU16Codec = (options = {}) => combineCodec(getShortU16Encoder(options), getShortU16Decoder(options)); | ||
var getU128Encoder = (options = {}) => numberEncoderFactory({ | ||
var getShortU16Codec = (config = {}) => combineCodec(getShortU16Encoder(config), getShortU16Decoder(config)); | ||
var getU128Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u128", | ||
options, | ||
range: [0, BigInt("0xffffffffffffffffffffffffffffffff")], | ||
@@ -241,3 +241,4 @@ set: (view, value, le) => { | ||
}); | ||
var getU128Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU128Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => { | ||
@@ -251,9 +252,8 @@ const leftOffset = le ? 8 : 0; | ||
name: "u128", | ||
options, | ||
size: 16 | ||
}); | ||
var getU128Codec = (options = {}) => combineCodec(getU128Encoder(options), getU128Decoder(options)); | ||
var getU16Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU128Codec = (config = {}) => combineCodec(getU128Encoder(config), getU128Decoder(config)); | ||
var getU16Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u16", | ||
options, | ||
range: [0, Number("0xffff")], | ||
@@ -263,12 +263,12 @@ set: (view, value, le) => view.setUint16(0, value, le), | ||
}); | ||
var getU16Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU16Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint16(0, le), | ||
name: "u16", | ||
options, | ||
size: 2 | ||
}); | ||
var getU16Codec = (options = {}) => combineCodec(getU16Encoder(options), getU16Decoder(options)); | ||
var getU32Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU16Codec = (config = {}) => combineCodec(getU16Encoder(config), getU16Decoder(config)); | ||
var getU32Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u32", | ||
options, | ||
range: [0, Number("0xffffffff")], | ||
@@ -278,12 +278,12 @@ set: (view, value, le) => view.setUint32(0, value, le), | ||
}); | ||
var getU32Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU32Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getUint32(0, le), | ||
name: "u32", | ||
options, | ||
size: 4 | ||
}); | ||
var getU32Codec = (options = {}) => combineCodec(getU32Encoder(options), getU32Decoder(options)); | ||
var getU64Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU32Codec = (config = {}) => combineCodec(getU32Encoder(config), getU32Decoder(config)); | ||
var getU64Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u64", | ||
options, | ||
range: [0, BigInt("0xffffffffffffffff")], | ||
@@ -293,12 +293,12 @@ set: (view, value, le) => view.setBigUint64(0, BigInt(value), le), | ||
}); | ||
var getU64Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU64Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view, le) => view.getBigUint64(0, le), | ||
name: "u64", | ||
options, | ||
size: 8 | ||
}); | ||
var getU64Codec = (options = {}) => combineCodec(getU64Encoder(options), getU64Decoder(options)); | ||
var getU8Encoder = (options = {}) => numberEncoderFactory({ | ||
var getU64Codec = (config = {}) => combineCodec(getU64Encoder(config), getU64Decoder(config)); | ||
var getU8Encoder = (config = {}) => numberEncoderFactory({ | ||
config, | ||
name: "u8", | ||
options, | ||
range: [0, Number("0xff")], | ||
@@ -308,9 +308,9 @@ set: (view, value) => view.setUint8(0, value), | ||
}); | ||
var getU8Decoder = (options = {}) => numberDecoderFactory({ | ||
var getU8Decoder = (config = {}) => numberDecoderFactory({ | ||
config, | ||
get: (view) => view.getUint8(0), | ||
name: "u8", | ||
options, | ||
size: 1 | ||
}); | ||
var getU8Codec = (options = {}) => combineCodec(getU8Encoder(options), getU8Decoder(options)); | ||
var getU8Codec = (config = {}) => combineCodec(getU8Encoder(config), getU8Decoder(config)); | ||
@@ -317,0 +317,0 @@ export { Endian, assertNumberIsBetweenForCodec, getF32Codec, getF32Decoder, getF32Encoder, getF64Codec, getF64Decoder, getF64Encoder, getI128Codec, getI128Decoder, getI128Encoder, getI16Codec, getI16Decoder, getI16Encoder, getI32Codec, getI32Decoder, getI32Encoder, getI64Codec, getI64Decoder, getI64Encoder, getI8Codec, getI8Decoder, getI8Encoder, getShortU16Codec, getShortU16Decoder, getShortU16Encoder, getU128Codec, getU128Decoder, getU128Encoder, getU16Codec, getU16Decoder, getU16Encoder, getU32Codec, getU32Decoder, getU32Encoder, getU64Codec, getU64Decoder, getU64Encoder, getU8Codec, getU8Decoder, getU8Encoder }; |
@@ -5,5 +5,5 @@ this.globalThis = this.globalThis || {}; | ||
function u(e,r,o,t){if(t<r||t>o)throw new Error(`Codec [${e}] expected number to be in the range [${r}, ${o}], got ${t}.`)}var C=(o=>(o[o.LITTLE=0]="LITTLE",o[o.BIG=1]="BIG",o))(C||{});function a(e,r,o=0){if(r.length-o<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function b(e,r,o,t=0){let d=o.length-t;if(d<r)throw new Error(`Codec [${e}] expected ${r} bytes, got ${d}.`)}function n(e,r,o){if(e.fixedSize!==r.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${e.fixedSize}] and [${r.fixedSize}].`);if(e.maxSize!==r.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${e.maxSize}] and [${r.maxSize}].`);if(o===void 0&&e.description!==r.description)throw new Error(`Encoder and decoder must have the same description, got [${e.description}] and [${r.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`);return {decode:r.decode,description:o??e.description,encode:e.encode,fixedSize:e.fixedSize,maxSize:e.maxSize}}function p(e){let r,o=e.name;return e.size>1&&(r=!("endian"in e.options)||e.options.endian===0,o+=r?"(le)":"(be)"),{description:e.options.description??o,fixedSize:e.size,littleEndian:r,maxSize:e.size}}function i(e){let r=p(e);return {description:r.description,encode(o){e.range&&u(e.name,e.range[0],e.range[1],o);let t=new ArrayBuffer(e.size);return e.set(new DataView(t),o,r.littleEndian),new Uint8Array(t)},fixedSize:r.fixedSize,maxSize:r.maxSize}}function c(e){let r=p(e);return {decode(o,t=0){a(r.description,o,t),b(r.description,e.size,o,t);let d=new DataView(x(o,t,e.size));return [e.get(d,r.littleEndian),t+e.size]},description:r.description,fixedSize:r.fixedSize,maxSize:r.maxSize}}function x(e,r,o){let t=e.byteOffset+(r??0),d=o??e.byteLength;return e.buffer.slice(t,t+d)}var E=(e={})=>i({name:"f32",options:e,set:(r,o,t)=>r.setFloat32(0,o,t),size:4}),z=(e={})=>c({get:(r,o)=>r.getFloat32(0,o),name:"f32",options:e,size:4}),me=(e={})=>n(E(e),z(e));var N=(e={})=>i({name:"f64",options:e,set:(r,o,t)=>r.setFloat64(0,o,t),size:8}),D=(e={})=>c({get:(r,o)=>r.getFloat64(0,o),name:"f64",options:e,size:8}),xe=(e={})=>n(N(e),D(e));var O=(e={})=>i({name:"i128",options:e,range:[-BigInt("0x7fffffffffffffffffffffffffffffff")-1n,BigInt("0x7fffffffffffffffffffffffffffffff")],set:(r,o,t)=>{let d=t?8:0,m=t?0:8,s=0xffffffffffffffffn;r.setBigInt64(d,BigInt(o)>>64n,t),r.setBigUint64(m,BigInt(o)&s,t);},size:16}),y=(e={})=>c({get:(r,o)=>{let t=o?8:0,d=o?0:8,m=r.getBigInt64(t,o),s=r.getBigUint64(d,o);return (m<<64n)+s},name:"i128",options:e,size:16}),Se=(e={})=>n(O(e),y(e));var l=(e={})=>i({name:"i16",options:e,range:[-+"0x7fff"-1,+"0x7fff"],set:(r,o,t)=>r.setInt16(0,o,t),size:2}),S=(e={})=>c({get:(r,o)=>r.getInt16(0,o),name:"i16",options:e,size:2}),Te=(e={})=>n(l(e),S(e));var h=(e={})=>i({name:"i32",options:e,range:[-+"0x7fffffff"-1,+"0x7fffffff"],set:(r,o,t)=>r.setInt32(0,o,t),size:4}),B=(e={})=>c({get:(r,o)=>r.getInt32(0,o),name:"i32",options:e,size:4}),Me=(e={})=>n(h(e),B(e));var I=(e={})=>i({name:"i64",options:e,range:[-BigInt("0x7fffffffffffffff")-1n,BigInt("0x7fffffffffffffff")],set:(r,o,t)=>r.setBigInt64(0,BigInt(o),t),size:8}),F=(e={})=>c({get:(r,o)=>r.getBigInt64(0,o),name:"i64",options:e,size:8}),Re=(e={})=>n(I(e),F(e));var U=(e={})=>i({name:"i8",options:e,range:[-+"0x7f"-1,+"0x7f"],set:(r,o)=>r.setInt8(0,o),size:1}),w=(e={})=>c({get:r=>r.getInt8(0),name:"i8",options:e,size:1}),tr=(e={})=>n(U(e),w(e));var v=(e={})=>({description:e.description??"shortU16",encode:r=>{u("shortU16",0,65535,r);let o=[0];for(let t=0;;t+=1){let d=r>>t*7;if(d===0)break;let m=127&d;o[t]=m,t>0&&(o[t-1]|=128);}return new Uint8Array(o)},fixedSize:null,maxSize:3}),T=(e={})=>({decode:(r,o=0)=>{let t=0,d=0;for(;++d;){let m=d-1,s=r[o+m],g=127&s;if(t|=g<<m*7,!(s&128))break}return [t,o+d]},description:e.description??"shortU16",fixedSize:null,maxSize:3}),ar=(e={})=>n(v(e),T(e));var $=(e={})=>i({name:"u128",options:e,range:[0,BigInt("0xffffffffffffffffffffffffffffffff")],set:(r,o,t)=>{let d=t?8:0,m=t?0:8,s=0xffffffffffffffffn;r.setBigUint64(d,BigInt(o)>>64n,t),r.setBigUint64(m,BigInt(o)&s,t);},size:16}),A=(e={})=>c({get:(r,o)=>{let t=o?8:0,d=o?0:8,m=r.getBigUint64(t,o),s=r.getBigUint64(d,o);return (m<<64n)+s},name:"u128",options:e,size:16}),Nr=(e={})=>n($(e),A(e));var L=(e={})=>i({name:"u16",options:e,range:[0,+"0xffff"],set:(r,o,t)=>r.setUint16(0,o,t),size:2}),V=(e={})=>c({get:(r,o)=>r.getUint16(0,o),name:"u16",options:e,size:2}),Ir=(e={})=>n(L(e),V(e));var _=(e={})=>i({name:"u32",options:e,range:[0,+"0xffffffff"],set:(r,o,t)=>r.setUint32(0,o,t),size:4}),k=(e={})=>c({get:(r,o)=>r.getUint32(0,o),name:"u32",options:e,size:4}),Lr=(e={})=>n(_(e),k(e));var H=(e={})=>i({name:"u64",options:e,range:[0,BigInt("0xffffffffffffffff")],set:(r,o,t)=>r.setBigUint64(0,BigInt(o),t),size:8}),M=(e={})=>c({get:(r,o)=>r.getBigUint64(0,o),name:"u64",options:e,size:8}),jr=(e={})=>n(H(e),M(e));var G=(e={})=>i({name:"u8",options:e,range:[0,+"0xff"],set:(r,o)=>r.setUint8(0,o),size:1}),P=(e={})=>c({get:r=>r.getUint8(0),name:"u8",options:e,size:1}),Yr=(e={})=>n(G(e),P(e)); | ||
function u(e,o,r,n){if(n<o||n>r)throw new Error(`Codec [${e}] expected number to be in the range [${o}, ${r}], got ${n}.`)}var p=(r=>(r[r.LITTLE=0]="LITTLE",r[r.BIG=1]="BIG",r))(p||{});function s(e,o,r=0){if(o.length-r<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function a(e,o,r,n=0){let f=r.length-n;if(f<o)throw new Error(`Codec [${e}] expected ${o} bytes, got ${f}.`)}function t(e,o,r){if(e.fixedSize!==o.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${e.fixedSize}] and [${o.fixedSize}].`);if(e.maxSize!==o.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${e.maxSize}] and [${o.maxSize}].`);if(r===void 0&&e.description!==o.description)throw new Error(`Encoder and decoder must have the same description, got [${e.description}] and [${o.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`);return {decode:o.decode,description:r??e.description,encode:e.encode,fixedSize:e.fixedSize,maxSize:e.maxSize}}function b(e){let o,r=e.name;return e.size>1&&(o=!("endian"in e.config)||e.config.endian===0,r+=o?"(le)":"(be)"),{description:e.config.description??r,fixedSize:e.size,littleEndian:o,maxSize:e.size}}function i(e){let o=b(e);return {description:o.description,encode(r){e.range&&u(e.name,e.range[0],e.range[1],r);let n=new ArrayBuffer(e.size);return e.set(new DataView(n),r,o.littleEndian),new Uint8Array(n)},fixedSize:o.fixedSize,maxSize:o.maxSize}}function c(e){let o=b(e);return {decode(r,n=0){s(o.description,r,n),a(o.description,e.size,r,n);let f=new DataView(x(r,n,e.size));return [e.get(f,o.littleEndian),n+e.size]},description:o.description,fixedSize:o.fixedSize,maxSize:o.maxSize}}function x(e,o,r){let n=e.byteOffset+(o??0),f=r??e.byteLength;return e.buffer.slice(n,n+f)}var E=(e={})=>i({config:e,name:"f32",set:(o,r,n)=>o.setFloat32(0,r,n),size:4}),z=(e={})=>c({config:e,get:(o,r)=>o.getFloat32(0,r),name:"f32",size:4}),me=(e={})=>t(E(e),z(e));var N=(e={})=>i({config:e,name:"f64",set:(o,r,n)=>o.setFloat64(0,r,n),size:8}),D=(e={})=>c({config:e,get:(o,r)=>o.getFloat64(0,r),name:"f64",size:8}),xe=(e={})=>t(N(e),D(e));var y=(e={})=>i({config:e,name:"i128",range:[-BigInt("0x7fffffffffffffffffffffffffffffff")-1n,BigInt("0x7fffffffffffffffffffffffffffffff")],set:(o,r,n)=>{let f=n?8:0,m=n?0:8,g=0xffffffffffffffffn;o.setBigInt64(f,BigInt(r)>>64n,n),o.setBigUint64(m,BigInt(r)&g,n);},size:16}),l=(e={})=>c({config:e,get:(o,r)=>{let n=r?8:0,f=r?0:8,m=o.getBigInt64(n,r),g=o.getBigUint64(f,r);return (m<<64n)+g},name:"i128",size:16}),he=(e={})=>t(y(e),l(e));var S=(e={})=>i({config:e,name:"i16",range:[-+"0x7fff"-1,+"0x7fff"],set:(o,r,n)=>o.setInt16(0,r,n),size:2}),h=(e={})=>c({config:e,get:(o,r)=>o.getInt16(0,r),name:"i16",size:2}),$e=(e={})=>t(S(e),h(e));var B=(e={})=>i({config:e,name:"i32",range:[-+"0x7fffffff"-1,+"0x7fffffff"],set:(o,r,n)=>o.setInt32(0,r,n),size:4}),I=(e={})=>c({config:e,get:(o,r)=>o.getInt32(0,r),name:"i32",size:4}),Me=(e={})=>t(B(e),I(e));var F=(e={})=>i({config:e,name:"i64",range:[-BigInt("0x7fffffffffffffff")-1n,BigInt("0x7fffffffffffffff")],set:(o,r,n)=>o.setBigInt64(0,BigInt(r),n),size:8}),U=(e={})=>c({config:e,get:(o,r)=>o.getBigInt64(0,r),name:"i64",size:8}),Re=(e={})=>t(F(e),U(e));var w=(e={})=>i({config:e,name:"i8",range:[-+"0x7f"-1,+"0x7f"],set:(o,r)=>o.setInt8(0,r),size:1}),v=(e={})=>c({config:e,get:o=>o.getInt8(0),name:"i8",size:1}),no=(e={})=>t(w(e),v(e));var T=(e={})=>({description:e.description??"shortU16",encode:o=>{u("shortU16",0,65535,o);let r=[0];for(let n=0;;n+=1){let f=o>>n*7;if(f===0)break;let m=127&f;r[n]=m,n>0&&(r[n-1]|=128);}return new Uint8Array(r)},fixedSize:null,maxSize:3}),$=(e={})=>({decode:(o,r=0)=>{let n=0,f=0;for(;++f;){let m=f-1,g=o[r+m],C=127&g;if(n|=C<<m*7,!(g&128))break}return [n,r+f]},description:e.description??"shortU16",fixedSize:null,maxSize:3}),ao=(e={})=>t(T(e),$(e));var A=(e={})=>i({config:e,name:"u128",range:[0,BigInt("0xffffffffffffffffffffffffffffffff")],set:(o,r,n)=>{let f=n?8:0,m=n?0:8,g=0xffffffffffffffffn;o.setBigUint64(f,BigInt(r)>>64n,n),o.setBigUint64(m,BigInt(r)&g,n);},size:16}),O=(e={})=>c({config:e,get:(o,r)=>{let n=r?8:0,f=r?0:8,m=o.getBigUint64(n,r),g=o.getBigUint64(f,r);return (m<<64n)+g},name:"u128",size:16}),Do=(e={})=>t(A(e),O(e));var L=(e={})=>i({config:e,name:"u16",range:[0,+"0xffff"],set:(o,r,n)=>o.setUint16(0,r,n),size:2}),V=(e={})=>c({config:e,get:(o,r)=>o.getUint16(0,r),name:"u16",size:2}),Uo=(e={})=>t(L(e),V(e));var _=(e={})=>i({config:e,name:"u32",range:[0,+"0xffffffff"],set:(o,r,n)=>o.setUint32(0,r,n),size:4}),k=(e={})=>c({config:e,get:(o,r)=>o.getUint32(0,r),name:"u32",size:4}),Vo=(e={})=>t(_(e),k(e));var H=(e={})=>i({config:e,name:"u64",range:[0,BigInt("0xffffffffffffffff")],set:(o,r,n)=>o.setBigUint64(0,BigInt(r),n),size:8}),M=(e={})=>c({config:e,get:(o,r)=>o.getBigUint64(0,r),name:"u64",size:8}),qo=(e={})=>t(H(e),M(e));var G=(e={})=>i({config:e,name:"u8",range:[0,+"0xff"],set:(o,r)=>o.setUint8(0,r),size:1}),P=(e={})=>c({config:e,get:o=>o.getUint8(0),name:"u8",size:1}),Zo=(e={})=>t(G(e),P(e)); | ||
exports.Endian = C; | ||
exports.Endian = p; | ||
exports.assertNumberIsBetweenForCodec = u; | ||
@@ -16,33 +16,33 @@ exports.getF32Codec = me; | ||
exports.getF64Encoder = N; | ||
exports.getI128Codec = Se; | ||
exports.getI128Decoder = y; | ||
exports.getI128Encoder = O; | ||
exports.getI16Codec = Te; | ||
exports.getI16Decoder = S; | ||
exports.getI16Encoder = l; | ||
exports.getI128Codec = he; | ||
exports.getI128Decoder = l; | ||
exports.getI128Encoder = y; | ||
exports.getI16Codec = $e; | ||
exports.getI16Decoder = h; | ||
exports.getI16Encoder = S; | ||
exports.getI32Codec = Me; | ||
exports.getI32Decoder = B; | ||
exports.getI32Encoder = h; | ||
exports.getI32Decoder = I; | ||
exports.getI32Encoder = B; | ||
exports.getI64Codec = Re; | ||
exports.getI64Decoder = F; | ||
exports.getI64Encoder = I; | ||
exports.getI8Codec = tr; | ||
exports.getI8Decoder = w; | ||
exports.getI8Encoder = U; | ||
exports.getShortU16Codec = ar; | ||
exports.getShortU16Decoder = T; | ||
exports.getShortU16Encoder = v; | ||
exports.getU128Codec = Nr; | ||
exports.getU128Decoder = A; | ||
exports.getU128Encoder = $; | ||
exports.getU16Codec = Ir; | ||
exports.getI64Decoder = U; | ||
exports.getI64Encoder = F; | ||
exports.getI8Codec = no; | ||
exports.getI8Decoder = v; | ||
exports.getI8Encoder = w; | ||
exports.getShortU16Codec = ao; | ||
exports.getShortU16Decoder = $; | ||
exports.getShortU16Encoder = T; | ||
exports.getU128Codec = Do; | ||
exports.getU128Decoder = O; | ||
exports.getU128Encoder = A; | ||
exports.getU16Codec = Uo; | ||
exports.getU16Decoder = V; | ||
exports.getU16Encoder = L; | ||
exports.getU32Codec = Lr; | ||
exports.getU32Codec = Vo; | ||
exports.getU32Decoder = k; | ||
exports.getU32Encoder = _; | ||
exports.getU64Codec = jr; | ||
exports.getU64Codec = qo; | ||
exports.getU64Decoder = M; | ||
exports.getU64Encoder = H; | ||
exports.getU8Codec = Yr; | ||
exports.getU8Codec = Zo; | ||
exports.getU8Decoder = P; | ||
@@ -49,0 +49,0 @@ exports.getU8Encoder = G; |
@@ -1,2 +0,2 @@ | ||
import { BaseCodecOptions, Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { BaseCodecConfig, Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
/** Defines a encoder for numbers and bigints. */ | ||
@@ -8,6 +8,6 @@ export type NumberEncoder = Encoder<number> | Encoder<number | bigint>; | ||
export type NumberCodec = Codec<number> | Codec<number | bigint, bigint>; | ||
/** Defines the options for u8 and i8 codecs. */ | ||
export type SingleByteNumberCodecOptions = BaseCodecOptions; | ||
/** Defines the options for number codecs that use more than one byte. */ | ||
export type NumberCodecOptions = BaseCodecOptions & { | ||
/** Defines the config for u8 and i8 codecs. */ | ||
export type SingleByteNumberCodecConfig = BaseCodecConfig; | ||
/** Defines the config for number codecs that use more than one byte. */ | ||
export type NumberCodecConfig = BaseCodecConfig & { | ||
/** | ||
@@ -14,0 +14,0 @@ * Whether the serializer should use little-endian or big-endian encoding. |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions } from './common'; | ||
export declare const getF32Encoder: (options?: NumberCodecOptions) => Encoder<number>; | ||
export declare const getF32Decoder: (options?: NumberCodecOptions) => Decoder<number>; | ||
export declare const getF32Codec: (options?: NumberCodecOptions) => Codec<number>; | ||
import { NumberCodecConfig } from './common'; | ||
export declare const getF32Encoder: (config?: NumberCodecConfig) => Encoder<number>; | ||
export declare const getF32Decoder: (config?: NumberCodecConfig) => Decoder<number>; | ||
export declare const getF32Codec: (config?: NumberCodecConfig) => Codec<number>; | ||
//# sourceMappingURL=f32.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions } from './common'; | ||
export declare const getF64Encoder: (options?: NumberCodecOptions) => Encoder<number>; | ||
export declare const getF64Decoder: (options?: NumberCodecOptions) => Decoder<number>; | ||
export declare const getF64Codec: (options?: NumberCodecOptions) => Codec<number>; | ||
import { NumberCodecConfig } from './common'; | ||
export declare const getF64Encoder: (config?: NumberCodecConfig) => Encoder<number>; | ||
export declare const getF64Decoder: (config?: NumberCodecConfig) => Decoder<number>; | ||
export declare const getF64Codec: (config?: NumberCodecConfig) => Codec<number>; | ||
//# sourceMappingURL=f64.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions } from './common'; | ||
export declare const getI128Encoder: (options?: NumberCodecOptions) => Encoder<number | bigint>; | ||
export declare const getI128Decoder: (options?: NumberCodecOptions) => Decoder<bigint>; | ||
export declare const getI128Codec: (options?: NumberCodecOptions) => Codec<number | bigint, bigint>; | ||
import { NumberCodecConfig } from './common'; | ||
export declare const getI128Encoder: (config?: NumberCodecConfig) => Encoder<number | bigint>; | ||
export declare const getI128Decoder: (config?: NumberCodecConfig) => Decoder<bigint>; | ||
export declare const getI128Codec: (config?: NumberCodecConfig) => Codec<number | bigint, bigint>; | ||
//# sourceMappingURL=i128.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions } from './common'; | ||
export declare const getI16Encoder: (options?: NumberCodecOptions) => Encoder<number>; | ||
export declare const getI16Decoder: (options?: NumberCodecOptions) => Decoder<number>; | ||
export declare const getI16Codec: (options?: NumberCodecOptions) => Codec<number>; | ||
import { NumberCodecConfig } from './common'; | ||
export declare const getI16Encoder: (config?: NumberCodecConfig) => Encoder<number>; | ||
export declare const getI16Decoder: (config?: NumberCodecConfig) => Decoder<number>; | ||
export declare const getI16Codec: (config?: NumberCodecConfig) => Codec<number>; | ||
//# sourceMappingURL=i16.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions } from './common'; | ||
export declare const getI32Encoder: (options?: NumberCodecOptions) => Encoder<number>; | ||
export declare const getI32Decoder: (options?: NumberCodecOptions) => Decoder<number>; | ||
export declare const getI32Codec: (options?: NumberCodecOptions) => Codec<number>; | ||
import { NumberCodecConfig } from './common'; | ||
export declare const getI32Encoder: (config?: NumberCodecConfig) => Encoder<number>; | ||
export declare const getI32Decoder: (config?: NumberCodecConfig) => Decoder<number>; | ||
export declare const getI32Codec: (config?: NumberCodecConfig) => Codec<number>; | ||
//# sourceMappingURL=i32.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions } from './common'; | ||
export declare const getI64Encoder: (options?: NumberCodecOptions) => Encoder<number | bigint>; | ||
export declare const getI64Decoder: (options?: NumberCodecOptions) => Decoder<bigint>; | ||
export declare const getI64Codec: (options?: NumberCodecOptions) => Codec<number | bigint, bigint>; | ||
import { NumberCodecConfig } from './common'; | ||
export declare const getI64Encoder: (config?: NumberCodecConfig) => Encoder<number | bigint>; | ||
export declare const getI64Decoder: (config?: NumberCodecConfig) => Decoder<bigint>; | ||
export declare const getI64Codec: (config?: NumberCodecConfig) => Codec<number | bigint, bigint>; | ||
//# sourceMappingURL=i64.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { SingleByteNumberCodecOptions } from './common'; | ||
export declare const getI8Encoder: (options?: SingleByteNumberCodecOptions) => Encoder<number>; | ||
export declare const getI8Decoder: (options?: SingleByteNumberCodecOptions) => Decoder<number>; | ||
export declare const getI8Codec: (options?: SingleByteNumberCodecOptions) => Codec<number>; | ||
import { SingleByteNumberCodecConfig } from './common'; | ||
export declare const getI8Encoder: (config?: SingleByteNumberCodecConfig) => Encoder<number>; | ||
export declare const getI8Decoder: (config?: SingleByteNumberCodecConfig) => Decoder<number>; | ||
export declare const getI8Codec: (config?: SingleByteNumberCodecConfig) => Codec<number>; | ||
//# sourceMappingURL=i8.d.ts.map |
@@ -1,6 +0,6 @@ | ||
import { BaseCodecOptions, Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { BaseCodecConfig, Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
/** | ||
* Defines the options for the shortU16 serializer. | ||
* Defines the config for the shortU16 serializer. | ||
*/ | ||
export type ShortU16CodecOptions = BaseCodecOptions; | ||
export type ShortU16CodecConfig = BaseCodecConfig; | ||
/** | ||
@@ -10,3 +10,3 @@ * Encodes short u16 numbers. | ||
*/ | ||
export declare const getShortU16Encoder: (options?: ShortU16CodecOptions) => Encoder<number>; | ||
export declare const getShortU16Encoder: (config?: ShortU16CodecConfig) => Encoder<number>; | ||
/** | ||
@@ -16,3 +16,3 @@ * Decodes short u16 numbers. | ||
*/ | ||
export declare const getShortU16Decoder: (options?: ShortU16CodecOptions) => Decoder<number>; | ||
export declare const getShortU16Decoder: (config?: ShortU16CodecConfig) => Decoder<number>; | ||
/** | ||
@@ -27,3 +27,3 @@ * Encodes and decodes short u16 numbers. | ||
*/ | ||
export declare const getShortU16Codec: (options?: ShortU16CodecOptions) => Codec<number>; | ||
export declare const getShortU16Codec: (config?: ShortU16CodecConfig) => Codec<number>; | ||
//# sourceMappingURL=short-u16.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions } from './common'; | ||
export declare const getU128Encoder: (options?: NumberCodecOptions) => Encoder<number | bigint>; | ||
export declare const getU128Decoder: (options?: NumberCodecOptions) => Decoder<bigint>; | ||
export declare const getU128Codec: (options?: NumberCodecOptions) => Codec<number | bigint, bigint>; | ||
import { NumberCodecConfig } from './common'; | ||
export declare const getU128Encoder: (config?: NumberCodecConfig) => Encoder<number | bigint>; | ||
export declare const getU128Decoder: (config?: NumberCodecConfig) => Decoder<bigint>; | ||
export declare const getU128Codec: (config?: NumberCodecConfig) => Codec<number | bigint, bigint>; | ||
//# sourceMappingURL=u128.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions } from './common'; | ||
export declare const getU16Encoder: (options?: NumberCodecOptions) => Encoder<number>; | ||
export declare const getU16Decoder: (options?: NumberCodecOptions) => Decoder<number>; | ||
export declare const getU16Codec: (options?: NumberCodecOptions) => Codec<number>; | ||
import { NumberCodecConfig } from './common'; | ||
export declare const getU16Encoder: (config?: NumberCodecConfig) => Encoder<number>; | ||
export declare const getU16Decoder: (config?: NumberCodecConfig) => Decoder<number>; | ||
export declare const getU16Codec: (config?: NumberCodecConfig) => Codec<number>; | ||
//# sourceMappingURL=u16.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions } from './common'; | ||
export declare const getU32Encoder: (options?: NumberCodecOptions) => Encoder<number>; | ||
export declare const getU32Decoder: (options?: NumberCodecOptions) => Decoder<number>; | ||
export declare const getU32Codec: (options?: NumberCodecOptions) => Codec<number>; | ||
import { NumberCodecConfig } from './common'; | ||
export declare const getU32Encoder: (config?: NumberCodecConfig) => Encoder<number>; | ||
export declare const getU32Decoder: (config?: NumberCodecConfig) => Decoder<number>; | ||
export declare const getU32Codec: (config?: NumberCodecConfig) => Codec<number>; | ||
//# sourceMappingURL=u32.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions } from './common'; | ||
export declare const getU64Encoder: (options?: NumberCodecOptions) => Encoder<number | bigint>; | ||
export declare const getU64Decoder: (options?: NumberCodecOptions) => Decoder<bigint>; | ||
export declare const getU64Codec: (options?: NumberCodecOptions) => Codec<number | bigint, bigint>; | ||
import { NumberCodecConfig } from './common'; | ||
export declare const getU64Encoder: (config?: NumberCodecConfig) => Encoder<number | bigint>; | ||
export declare const getU64Decoder: (config?: NumberCodecConfig) => Decoder<bigint>; | ||
export declare const getU64Codec: (config?: NumberCodecConfig) => Codec<number | bigint, bigint>; | ||
//# sourceMappingURL=u64.d.ts.map |
import { Codec, Decoder, Encoder } from '@solana/codecs-core'; | ||
import { SingleByteNumberCodecOptions } from './common'; | ||
export declare const getU8Encoder: (options?: SingleByteNumberCodecOptions) => Encoder<number>; | ||
export declare const getU8Decoder: (options?: SingleByteNumberCodecOptions) => Decoder<number>; | ||
export declare const getU8Codec: (options?: SingleByteNumberCodecOptions) => Codec<number>; | ||
import { SingleByteNumberCodecConfig } from './common'; | ||
export declare const getU8Encoder: (config?: SingleByteNumberCodecConfig) => Encoder<number>; | ||
export declare const getU8Decoder: (config?: SingleByteNumberCodecConfig) => Decoder<number>; | ||
export declare const getU8Codec: (config?: SingleByteNumberCodecConfig) => Codec<number>; | ||
//# sourceMappingURL=u8.d.ts.map |
import { Decoder, Encoder } from '@solana/codecs-core'; | ||
import { NumberCodecOptions, SingleByteNumberCodecOptions } from './common'; | ||
import { NumberCodecConfig, SingleByteNumberCodecConfig } from './common'; | ||
type NumberFactorySharedInput = { | ||
name: string; | ||
size: number; | ||
options: SingleByteNumberCodecOptions | NumberCodecOptions; | ||
config: SingleByteNumberCodecConfig | NumberCodecConfig; | ||
}; | ||
@@ -8,0 +8,0 @@ type NumberFactoryEncoderInput<T> = NumberFactorySharedInput & { |
{ | ||
"name": "@solana/codecs-numbers", | ||
"version": "2.0.0-experimental.32b59a5", | ||
"version": "2.0.0-experimental.3690b65", | ||
"description": "Codecs for numbers of different sizes and endianness", | ||
@@ -52,8 +52,8 @@ "exports": { | ||
"dependencies": { | ||
"@solana/codecs-core": "2.0.0-experimental.32b59a5" | ||
"@solana/codecs-core": "2.0.0-experimental.3690b65" | ||
}, | ||
"devDependencies": { | ||
"@solana/eslint-config-solana": "^1.0.2", | ||
"@swc/jest": "^0.2.28", | ||
"@types/jest": "^29.5.5", | ||
"@swc/jest": "^0.2.29", | ||
"@types/jest": "^29.5.6", | ||
"@typescript-eslint/eslint-plugin": "^6.7.0", | ||
@@ -63,10 +63,10 @@ "@typescript-eslint/parser": "^6.3.0", | ||
"eslint": "^8.45.0", | ||
"eslint-plugin-jest": "^27.2.3", | ||
"eslint-plugin-jest": "^27.4.2", | ||
"eslint-plugin-sort-keys-fix": "^1.1.2", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.6.4", | ||
"jest-runner-eslint": "^2.1.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"jest-runner-eslint": "^2.1.2", | ||
"jest-runner-prettier": "^1.0.0", | ||
"prettier": "^2.8", | ||
"tsup": "7.2.0", | ||
"tsup": "^8.0.1", | ||
"typescript": "^5.2.2", | ||
@@ -91,3 +91,3 @@ "version-from-git": "^1.1.1", | ||
"publish-packages": "pnpm publish --tag experimental --access public --no-git-checks", | ||
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/*", | ||
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json", | ||
"test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent", | ||
@@ -94,0 +94,0 @@ "test:prettier": "jest -c node_modules/test-config/jest-prettier.config.ts --rootDir . --silent", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
270744
2515
9
+ Added@solana/codecs-core@2.0.0-experimental.3690b65(transitive)
- Removed@solana/codecs-core@2.0.0-experimental.32b59a5(transitive)