Skip to content

Commit fa27e8d

Browse files
authored
Merge pull request #15 from eosrio/fix/consumer-types
fix(types): self-contained typings + stringToName bigint (pre-publish 4.2.0)
2 parents 7011341 + c0c400f commit fa27e8d

20 files changed

Lines changed: 81 additions & 37 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ node_modules
66
.idea
77
.cache
88
coverage
9+
*.tgz

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
1919
- `scripts/copy-module.mjs`: deterministically locates the addon across single-config (`build/`) and multi-config (`build/{Release,Debug}/`) generator layouts (no recursive scan — avoids stale binaries), exits non-zero if none is found, and on macOS writes both `abieos-darwin-arm64.node` and `abieos-darwin-x64.node` from the universal2 build.
2020
- `CMakeLists.txt`: portable `EXISTS` submodule check (replaces Unix-only `git submodule status | grep`); CRLF-robust `node-addon-api` include resolution; strips only the MSVC `/DELAYLOAD:*` token from `CMAKE_SHARED_LINKER_FLAGS` rather than clearing the whole variable.
2121

22+
### Fixed
23+
- **`stringToName` return type** was `BigInt` (the wrapper object type) instead of `bigint` (the primitive it actually returns) — every TypeScript consumer hit `Type 'BigInt' is not assignable to type 'bigint'`. Now `bigint`.
24+
- **Self-contained typings:** `binToJson`'s parameter is now `Uint8Array` instead of the ambient Node `Buffer` global (a `Buffer` is a `Uint8Array`, so existing callers are unaffected). The published `.d.ts` no longer depends on `@types/node` and type-checks cleanly under TypeScript's default `skipLibCheck: false` without extra consumer setup. Verified from a clean `npm install` of the packed tarball across Node + Bun (ESM & CJS) and TypeScript (`nodenext`).
25+
2226
### Notes
2327
- The `darwin-arm64` / `darwin-x64` prebuilts are the same universal2 binary, committed from the `build-macos` CI artifacts (Mach-O cannot be cross-built from the Linux/Windows dev environments). Their CI provenance is the source of truth.
2428
- GCC 13 emits one benign `-Wstringop-overflow` warning in the vendored `abieos/include/eosio/bitset.hpp`; it is not an error and does not affect correctness (Linux CI builds with Clang and does not emit it).

dist/_tsup-dts-rollup.d.cts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ export declare class Abieos {
2727
*/
2828
cleanup(): void;
2929
/**
30-
* Converts a string name to its corresponding 64-bit unsigned integer representation (BigInt).
30+
* Converts a string name to its corresponding 64-bit unsigned integer representation.
3131
* @param {string} nameString The string name to convert.
32-
* @returns {BigInt} The BigInt representation of the name.
32+
* @returns {bigint} The bigint representation of the name.
3333
*/
34-
stringToName(nameString: string): BigInt;
34+
stringToName(nameString: string): bigint;
3535
/**
3636
* Converts a JSON string or object to its hexadecimal binary representation.
3737
* @param {string} contractName The name of the contract.
@@ -54,11 +54,11 @@ export declare class Abieos {
5454
* Converts a binary buffer to its JSON representation.
5555
* @param {string} contractName The name of the contract.
5656
* @param {string} type The type within the ABI to use for conversion.
57-
* @param {Buffer} buffer The binary data as a Buffer.
57+
* @param {Uint8Array} buffer The binary data (a Node `Buffer` is accepted — it is a `Uint8Array`).
5858
* @returns {any} The parsed JSON object.
5959
* @throws {Error} If parsing fails or an error occurs in the native module.
6060
*/
61-
binToJson(contractName: string, type: string, buffer: Buffer): any;
61+
binToJson(contractName: string, type: string, buffer: Uint8Array): any;
6262
/**
6363
* Loads an ABI for a given contract.
6464
* @param {string} contractName The name of the contract for which to load the ABI.

dist/_tsup-dts-rollup.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ export declare class Abieos {
2727
*/
2828
cleanup(): void;
2929
/**
30-
* Converts a string name to its corresponding 64-bit unsigned integer representation (BigInt).
30+
* Converts a string name to its corresponding 64-bit unsigned integer representation.
3131
* @param {string} nameString The string name to convert.
32-
* @returns {BigInt} The BigInt representation of the name.
32+
* @returns {bigint} The bigint representation of the name.
3333
*/
34-
stringToName(nameString: string): BigInt;
34+
stringToName(nameString: string): bigint;
3535
/**
3636
* Converts a JSON string or object to its hexadecimal binary representation.
3737
* @param {string} contractName The name of the contract.
@@ -54,11 +54,11 @@ export declare class Abieos {
5454
* Converts a binary buffer to its JSON representation.
5555
* @param {string} contractName The name of the contract.
5656
* @param {string} type The type within the ABI to use for conversion.
57-
* @param {Buffer} buffer The binary data as a Buffer.
57+
* @param {Uint8Array} buffer The binary data (a Node `Buffer` is accepted — it is a `Uint8Array`).
5858
* @returns {any} The parsed JSON object.
5959
* @throws {Error} If parsing fails or an error occurs in the native module.
6060
*/
61-
binToJson(contractName: string, type: string, buffer: Buffer): any;
61+
binToJson(contractName: string, type: string, buffer: Uint8Array): any;
6262
/**
6363
* Loads an ABI for a given contract.
6464
* @param {string} contractName The name of the contract for which to load the ABI.

dist/abieos-darwin-arm64.node

16.3 KB
Binary file not shown.

dist/abieos-darwin-x64.node

16.3 KB
Binary file not shown.

dist/abieos-linux-x64.node

112 Bytes
Binary file not shown.

dist/abieos-win32-x64.node

3.36 KB
Binary file not shown.

dist/abieos.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ var Abieos = class _Abieos {
106106
}
107107
}
108108
/**
109-
* Converts a string name to its corresponding 64-bit unsigned integer representation (BigInt).
109+
* Converts a string name to its corresponding 64-bit unsigned integer representation.
110110
* @param {string} nameString The string name to convert.
111-
* @returns {BigInt} The BigInt representation of the name.
111+
* @returns {bigint} The bigint representation of the name.
112112
*/
113113
stringToName(nameString) {
114114
try {
@@ -157,7 +157,7 @@ var Abieos = class _Abieos {
157157
* Converts a binary buffer to its JSON representation.
158158
* @param {string} contractName The name of the contract.
159159
* @param {string} type The type within the ABI to use for conversion.
160-
* @param {Buffer} buffer The binary data as a Buffer.
160+
* @param {Uint8Array} buffer The binary data (a Node `Buffer` is accepted — it is a `Uint8Array`).
161161
* @returns {any} The parsed JSON object.
162162
* @throws {Error} If parsing fails or an error occurs in the native module.
163163
*/

dist/abieos.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ var Abieos = class _Abieos {
7575
}
7676
}
7777
/**
78-
* Converts a string name to its corresponding 64-bit unsigned integer representation (BigInt).
78+
* Converts a string name to its corresponding 64-bit unsigned integer representation.
7979
* @param {string} nameString The string name to convert.
80-
* @returns {BigInt} The BigInt representation of the name.
80+
* @returns {bigint} The bigint representation of the name.
8181
*/
8282
stringToName(nameString) {
8383
try {
@@ -126,7 +126,7 @@ var Abieos = class _Abieos {
126126
* Converts a binary buffer to its JSON representation.
127127
* @param {string} contractName The name of the contract.
128128
* @param {string} type The type within the ABI to use for conversion.
129-
* @param {Buffer} buffer The binary data as a Buffer.
129+
* @param {Uint8Array} buffer The binary data (a Node `Buffer` is accepted — it is a `Uint8Array`).
130130
* @returns {any} The parsed JSON object.
131131
* @throws {Error} If parsing fails or an error occurs in the native module.
132132
*/

0 commit comments

Comments
 (0)